Commit Graph

891 Commits

Author SHA1 Message Date
72f368f6bf sw: fix undefined casts of SwTxtInputFld
... as reported by sberg via UBSan in CppunitTest_sw_mailmerge:

> sw/source/core/txtnode/thints.cxx:3207:38: runtime error: downcast of address 0x000003cadcb0 which does not point to an object of type 'SwTxtAttrNesting'
> 0x000003cadcb0: note: object is of type 'SwTxtInputFld'
> #0 in SwpHints::TryInsertHint(SwTxtAttr*, SwTxtNode&, unsigned short) sw/source/core/txtnode/thints.cxx:3207:13
> #1 in SwTxtNode::InsertHint(SwTxtAttr*, unsigned short) sw/source/core/txtnode/thints.cxx:1583:25
> #2 in SwTxtNode::SetAttr(SfxItemSet const&, int, int, unsigned short) sw/source/core/txtnode/thints.cxx:1943:39
> #3 in SwRegHistory::InsertItems(SfxItemSet const&, int, int, unsigned short) sw/source/core/undo/rolbck.cxx:1390:28
> #4 in (anonymous namespace)::lcl_InsAttr(SwDoc*, SwPaM const&, SfxItemSet const&, unsigned short, SwUndoAttr*, bool) sw/source/core/doc/DocumentContentOperationsManager.cxx:1169:28
> #5 in sw::DocumentContentOperationsManager::InsertPoolItem(SwPaM const&, SfxPoolItem const&, unsigned short, bool) sw/source/core/doc/DocumentContentOperationsManager.cxx:3041:23
> #6 in SwXTextField::attach(com::sun::uno::Reference<com::sun::text::XTextRange> const&) sw/source/core/unocore/unofield.cxx:1966:13 > #7 in non-virtual thunk to SwXTextField::attach(com::sun::uno::Reference<com::sun::text::XTextRange> const&) sw/source/core/unocore/unofield.cxx:2061:1

The SwTxtInputFld is unusual because it's both a field and has a range;
let's try to use virtual inheritance to inherit both from
SwTxtFld and SwTxtAttrNesting.  Sadly requires dynamic_cast everywhere.

Change-Id: I69f834d2b78ef7cdaac1f554bd80711084efcd02
2014-10-23 00:04:19 +02:00
0828003419 SwTxtNode::dumpAsXml: handle RES_TXTATR_CHARFMT
Change-Id: I29d8eb9ab6d6428f699a92b6cd9d58ed8b3b7e48
2014-10-17 12:47:56 +02:00
900d3e33a2 coverity#982191 Unchecked return value
Change-Id: Ieb5607513b61b2a5436332bdd8a572fb6a739be7
2014-10-13 16:54:22 +01:00
d0d64225d8 convert SWFMTFLD_ #defines to an enum
Change-Id: I5daf6436fd049410c4863a4b065c9abd95b5d361
Reviewed-on: https://gerrit.libreoffice.org/11928
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-10-12 05:21:24 +00:00
47a2d7642d fdo#81356: convert Fraction to boost::rational<long> - wip
* Added rational util functions used by Fraction class not
  available in the boost::rational class.
* Replaced usage of Fraction by boost::rational<long>
* Removed code that relies on:
  1. fraction.IsValid() -- rational only allow valid values, ie
     denominator() != 0
  2. rational.denominator() == 0 -- always false
  3. rational.denominator() < 0 -- always false but implementation
     detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation
* Simplified code that relies on:
  1. rational.denominator() != 0 -- always true
* BUGS EXIST because Fraction allows the creation of invalid values but
  boost::rational throws the exception boost::bad_rational

Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9
Reviewed-on: https://gerrit.libreoffice.org/11551
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2014-10-09 11:33:33 +00:00
4687ce0675 Constify dumpAsXml and friends
All these dump functions should never change the dumped objects
so 'const' all of them.

Change-Id: Id83422e3950a73e48feb4708fbd4c251506997e0
2014-10-01 10:32:43 +02:00
c9d4a2887c fdo#82577: Handle PolyPolygon
Put the TOOLS PolyPolygon class in the tools namespace. Avoids clash with the Windows
PolyPolygon typedef.

Change-Id: I811ecbb3d55ba4ce66e4555a8586f60fcd57fb66
2014-09-30 11:47:41 +02:00
ea733ab5b6 Turn SfxItemState into a C++11 scoped enumeration
...to gain further confidence in the claim "that none of the existing
code tries to uses combinations of these enum values"
(d92602c5b13d0a60439d86c5a033d124178726ca "more fixes for SfxItemState")

Change-Id: I987922d945e8738e38adfde83b869adf3ff35b13
Reviewed-on: https://gerrit.libreoffice.org/11384
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2014-09-12 06:08:32 +00:00
f3d791f754 sw: [loplugin:externandnotdefined]
It turns out that document compare / merge and master document
insert file are all the callers of SwFindDocShell() so move the fix-up
there...

Change-Id: I912a464c3acab8d0adb7b5b659d62f629a15cb70
2014-09-10 18:45:23 +02:00
b56558717d fdo#83655: sw: RSID-only hint assertion when inserting in master document
For the temporary document there is no layout so SwTxtNode::MakeFrm()
isn't called.

(regression from 6db39dbd7378351f6476f6db25eb7110c9cfb291)

Change-Id: I711d32a81519edd6840cc29f5cd9dbc57ef21982
2014-09-10 16:14:56 +02:00
513a3a6a01 coverity#704947 Dereference after null check
Change-Id: Id6eb50de48b8a674d7b48d1256b1529637155eb1
2014-09-08 09:17:06 +01:00
da44e4cce8 Use size_t consistently, constify, reduce scope
Change-Id: Ie5de70645becc5ac584f1b3ffe6048969d2a19a9
2014-09-06 12:08:13 +02:00
3284daa3ab coverity#704947 Dereference after null check
Change-Id: Iea0a789b842b9bb05e4c774460e56e2ed0f5f74e
2014-09-02 12:14:49 +01:00
57a4337e25 set names on a bunch more threads...
Change-Id: I4c2f2f0bcce52839033876ec991529721e06a3c8
2014-08-25 13:21:59 +02:00
a00778f9d3 Dump table attributes and page description items
Adds the SwPageDesc name to the dumpAsXml output of the
SwFmtPageDesc / RES_PAGEDESC SfxPoolItem and dumps the tables
attibutes.

Adtittionally this renames the unknown field name, so it doesn't
produce wrong XML output (blamed by "xmllint --format") and adds
the hex node type to the start and end node XML output.

Reviewed on:
	https://gerrit.libreoffice.org/11091

Change-Id: I3cde39d423e17909243675efdd39557a6bfffbd7
2014-08-25 09:27:09 +02:00
de6fd1b90f Avoid invalid downcasts to SwFmtHeader instead of SwFmtFooter
...which only happened to work because the two classes have very similar layout

Change-Id: Ie4bde807a2442a95ff515b065d4f45f257a32f34
2014-08-21 15:06:48 +02:00
9f01ba1b78 i#107771: sw: burn, UnoCallBack, burn!
Change-Id: Ifdb6d4b2e404bd160e6fcec3229691e750bdf698
2014-08-20 16:40:18 +02:00
e54015d06f i#107771: sw: make SwXFootnote a client of its format poolitem
In other words, stop registering at SwDoc's "UnoCallBack".

Change-Id: Ie73c707b0f43559cc78717c0879d5e9a9335a7ac
2014-08-20 16:40:17 +02:00
bbd97fe57d i#107771: sw: make SwXTextField a client of its format poolitem
In other words, stop registering at SwDoc's "UnoCallBack"

Change-Id: Ieb2639497fe5e8d71aa1c47952c007da76fcee84
2014-08-20 16:40:17 +02:00
e7c96f3e8f i#107771: sw: make SwXReferenceMark a client of its format poolitem
In other words, stop registering at SwDoc's "UnoCallBack"

Change-Id: I9e08966cf8e2d2a373867d81549c8887f73993c8
2014-08-20 16:40:15 +02:00
df4bd415c0 fix crashing on exit in static SvxBrushItem dtor
site of first ctor

Change-Id: I3316e91bc54439b74df30fdf02ff264a39489c29
2014-08-20 14:06:33 +01:00
15295ab6db Refactored SwDoc::GetEditShell .
Removed its output paramater as GetCurrentViewShell should be
used instead and added a const version.

Change-Id: Iad8b57553b6e93e3472ce8c6905d08e8d49af770
2014-08-19 21:57:06 +02:00
47e2fd0dc8 Consistently use size_t and SAL_MAX_SIZE
Change-Id: Ibab89984ec94556ec368653b6db50c6c2e380dec
2014-08-16 21:52:32 +02:00
535971f3a1 Refactored IDocumentStylePoolAccess out of SwDoc.
Added non const SwDoc::GetDfltTxtFmtColl and SwDoc::GetTxtFmtColls
and SwDoc::GetCharFmts.
Had to make the manager friend of SwTxtFmtColl and SwConditionTxtFmtColl
Had to make SwDoc::_MakeCharFmt and SwDoc::_MakeFrmFmt public.

Change-Id: I19a36d91f92b3781a6c4313ec12eb8f7d4dfacc3
2014-08-12 23:26:38 +02:00
5494954b26 Refactored IDocumentLayoutAccess out of SwDoc.
Into the new class DocumentLayoutManager.

Change-Id: I02d0cfcc63633d0bdab380508b2ef563187fd269
2014-08-12 23:26:38 +02:00
64e13a1456 Refactored IDocumentState out of SwDoc.
Into the new class DocumentStateManager.

Change-Id: I91c9097b091ff6118d58fd15fff2a4cefe0171fd
2014-08-12 23:26:38 +02:00
9d43f6d2c4 Refactored IDocumentLineNumberAccess.
This interface is obsolete and was deleted.

Change-Id: I56d37814f6e43f083ab3d199237ade06db287e18
2014-08-12 23:26:37 +02:00
69e5f335ab Refactored IDocumentFieldsAccess out of SwDoc.
Into the new class DocumentFieldsManager.
Removed SwDoc::_MakeFldList because it is not defined anywhere.
Also moved a few non interface methods that belong to the manager.

Change-Id: Icefd7ca7adcbb05a18d6fae0529fc54150b862fd
2014-08-12 23:26:36 +02:00
274f1811b9 Refactored IDocumentRedlineAccess out of SwDoc.
Into the new class DocumentRedlineManager.
Added an non const version of GetRedlineTbl to the interface.
Also Moved SetAutoFmtRedlineComment which is not part of interface.

Change-Id: I600d5821d5d5831557f5fc5375fb1203fe67a295
2014-08-12 23:26:36 +02:00
3dafed2ede -Werror,-Wundefined-bool-conversion
Change-Id: Iff8db4c82abeeed0789d7012223a846f1058c353
2014-08-12 12:19:43 +02:00
b32539d065 sw: improve doc model xml dump of SwFmtAnchor
Change-Id: Icdfc370c4b525fd43d9d5935ff461534cf535233
2014-08-08 15:27:31 +02:00
88de419ea6 coverity#704947 Dereference after null check
Change-Id: I3e2e3d78e84515cc6e1caa6e105762726d2b9e56
2014-08-07 18:00:51 +01:00
58f837d226 Avoid unnecessary illegal downcasts from SwFrmFmt to SwSectionFmt
Change-Id: I2ca8d57a09b6f8c6d760b5fb6a3d2f94ad22ada3
2014-08-07 11:06:41 +02:00
ca16ec4346 Avoid illegal downcasts from BigPtrEntry to SwNode
...and while at it, remove the need for the TempBigPtrEntry derivation.

Change-Id: Ic758f646578a90a28632b1368fed209eb84f9c1c
2014-08-07 10:09:07 +02:00
b75e052d31 Call SwTxtNode-specific part of DelFrms while SwTxtNode is still SwTxtNode
...when SwCntntNode::DelFrms is called from ~SwTxtNode -> ~SwCntntNode.

* SwCntntNode::DelFrms now needs a flag to distinguish calls from inside
  ~SwCntntNode from other calls.  bIsDisposeAccTable happens to already serve
  that purpose, so I reused it, but that may be a bad idea from a semantic point
  of view?

* ~SwTxtNode is careful to mimic old behavior and only calls DelFrms_TxtNodePart
  if GetDepends() is true; no idea whether that's really necessary, though.

* Shifting the work done by DelFrms_TxtNodePart from within ~SwCntntNode to
  before ~SwTxtNode calls ~SwCntntNode hopefully has no negative consequences.

Change-Id: I1532b4cfef7fbf9ba82e64b919a08cbefa335421
2014-08-06 18:14:00 +02:00
48c90eb75f SwCntntNode::DelFrms already checks for GetDepends()
Change-Id: I9f7ccd372a570dc4dea98983c51419dce83f8be8
2014-08-06 18:13:59 +02:00
02e462f5b1 Remove unused bNeedDel parameter to SwCntntNode::DelFrms
Change-Id: Iedc5e8caafda868db853fdf328fbdc99bbf28e20
2014-08-06 18:13:59 +02:00
a47b51b415 Avoid fn ptr casts in SwNodes::ForEeach
...by moving ForEach from BigPtrArray down to its sole user SwNodes.

Change-Id: I6d326d3e1ac9dc6ac820e600973af420785d5a50
2014-08-05 16:30:31 +02:00
5ee87e861e Avoid undef downcast in base class ctor
Change-Id: I71eecfdc657b153f9289e8e9af52fba9ed22d3a8
2014-07-31 12:12:31 +02:00
05dda9a913 SwpHintsArray/SwpHints and related: sal_uInt16 to size_t
Change-Id: I9a7674109b05683287e12cbce6bc417b40ca5084
2014-07-22 23:50:42 +02:00
1e6ff8f7f8 XFillStyle -> css::drawing::FillStyle
Change-Id: I6b2fabd72fd34f4ac1b3a18f386c90794bc39ce4
2014-07-19 00:30:37 +02:00
a517898052 remove unnecessary "const &" qualifier from T* parameters
e.g. convert code like
    foo(X * const & p)
to
    foo(X * p)
since the "const &" part of it adds nothing useful.

Change-Id: Icf5f2041517259e7b6e055b75ed1e0e77c547da5
2014-07-18 14:24:19 +02:00
f634ec520f Refactored IDocumentContentOperations out of SwDoc.
Into the new class DocumentContentOperationsManager.

Made SwNodes in sw/inc/ndarr.hxx friend class to
DocumentContentOperationsManager so it can call DelNodes at end of
DocumentContentOperationsManager::DeleteSection .

Added DeleteAutoCorrExceptWord to SwDoc, its needed in the Manager.

Added a non const version of SwDoc::GetDfltGrfFmtColl() to SwDoc
because its needed in the Manager.

Made SwDoc a friend class to DocumentContentOperationsManager so it
can call SwDoc::checkRedlining and SwDocL::_MakeFlySection.

Moved SwDoc::CopyImpl_ , SwDoc::CopyWithFlyInFly and
SwDoc::CopyFlyInFlyImpl into the Manager.

Moved "struct ParaRstFmt" and "lcl_RstTxtAttr" from docfmt.cxx
in DocumentContentOperationsManager.hxx .

Change-Id: Icaab57f4a8c158a85e549ecb4aacc752bc95bbc9
2014-07-15 15:44:04 +02:00
c8a8695d4d Refactored IDocumentListItems out of SwDoc.
Into the new class DocumentListItemsManager.

Change-Id: Ic86200280caa1b6e2c940bb12149235223ed0cd2
2014-07-15 15:44:03 +02:00
54ca3a6efa Refactored IDocumentLinksAdministration out of SwDoc.
To the new class DocumentLinksAdministrationManager.
Additional to the Interface methods SwDoc::SelectServerObj was also moved
and sw/source/core/doc/docdde.cxx was deleted as it became empty.
Also fixed OUString usage in IDocumentLinksAdministration.hxx .

Change-Id: I1f2bf0881a7d4add9c657b6441851ae14ad8d161
2014-07-15 15:44:03 +02:00
c88a3d3e8c Refactored IDocumentChartDataProviderAccess in SwDoc.
Into the new class DocumentChartDataProviderManager.

Change-Id: I3be038ba276642546223c0c2fba3bea21980b33d
2014-07-15 15:44:02 +02:00
c62e854ee4 convert sw/ObservableThread to salhelper::SimpleReferenceObject
instead of re-implementing it's own reference counting

Change-Id: I2600b970544f1dfd84b987d1891c79e3c377bd1b
2014-07-11 14:41:02 +02:00
dac4ca5f68 new loplugin: externalandnotdefined
Find "missing headers," where a function is declared directly in the
.cxx (as extern) and not defined, and should arguably instead be declared
in an include file.

Change-Id: I6d83ee432b2ab0cd050aec2b27c3658d32ac02a2
2014-07-11 14:12:25 +02:00
f816087a1f coverity#704523 Division or modulo by zero
Change-Id: I165687b22f70a03d4bcb669a04d3495454d09042
2014-07-06 15:15:10 +01:00
dfeef9e970 remove unnecessary header macro wizardry
using the #define SW_DECL_SWSERVEROBJECT_DEFINED to turn typedefs
on and off. Rather just use SvRef<T> everywhere, like we do for
other reference types.

Change-Id: Id939c46c5861cd7440b66c5a84122f900ddb882c
2014-07-04 11:49:09 +02:00