summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
AgeCommit message (Collapse)AuthorFilesLines
2015-02-06Resolves: tdf#82942 updating field contents with incorrect attribute positionsCaolán McNamara1-6/+20
Updating a SwTxtInputFld requires expanding the contents of the node. Expanding the contents of the node requires all the positions of fields in the node to be correct in order to expand them to the right place. So on updating a SwTxtNode wait until all the attributes positions are adjusted to be correct before expanding the SwTxtInputFlds in that node Change-Id: I76500239a103e56be412707a708a303a58236070 (cherry picked from commit 95f4b2f4a6dfe47842336116d94edd175a6da960) Reviewed-on: https://gerrit.libreoffice.org/14253 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2015-01-21sw: fix bogus assert in SwTxtNode::RstTxtAttr()Michael Stahl1-6/+13
The assert for case 3 is wrong and fires when importing ooo44732-2.doc but there is also a bug here where a hint could be skipped. Change-Id: I028d2d5df9e80cf0001d9bc11aa7fabcd01e83bb (cherry picked from commit 01d25c96db366de003e4570ddf8559da3dd9ea5b) Reviewed-on: https://gerrit.libreoffice.org/14072 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-01-20Maintain the sorting in sorted_vector after modifying the elements.Ashod Nakashian1-5/+5
Resort immediately after modifying the data to prevent invalid lookups. Change-Id: If132af401d8164fd5973d81a8327c1fa726c908c Reviewed-on: https://gerrit.libreoffice.org/13984 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 5c363cf3f1d75e37835a6663a96b4e22c754c4cb) Signed-off-by: Michael Stahl <mstahl@redhat.com>
2014-12-15fdo#74981: sw: fix input field handling when splitting paragraphsMichael Stahl1-4/+5
The SwInputFld is copied because it doesn't have HasDummyChar() set although it has 2 dummy characters; TODO why is that... Change-Id: Iee91c1d0cf7a7a928e7383c1839f8192e8d4d5b0 (cherry picked from commit a1718045bd6218e07caebda7c4cacdcb853eabd3)
2014-12-15fdo#85876: Revert "fdo#74981: cutting nothing should do nothing, ...Michael Stahl1-2/+0
... should fix field dupes" This reverts commit f384598d8eec91c3c0f84a07ff3e59b8e3e13b3f. The attributes have to be copied in case splitting a paragraph creates an empty paragraph. Change-Id: Icd5730dd9ab8a68f737492645988a4d2f07af7a0 (cherry picked from commit 0f78ae1ca33f83737553ad204c869a63498b7d2d)
2014-11-20sw: convert more legacy assertsMichael Stahl1-8/+7
Change-Id: I602913a1cfb8dda072945770a585e6cd9fd3e134
2014-11-20SwTxtNode::IsIgnoredCharFmtForNumbering: ignore RES_CHRATR_COLORMiklos Vajna1-1/+1
And also in SwTxtFormatter::NewNumberPortion(), use SwTxtNode::IsIgnoredCharFmtForNumbering(), via checkApplyParagraphMarkFormatToNumbering(). Otherwise the color of the paragraph mark is inherited by the numbering portion, which is not what IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING (mirroring Word's behavior) is supposed to do. Change-Id: I5d8df9b404916cc4a4405bf796d971ede59e6111
2014-11-20sw: move IsIgnoredCharFmtForNumbering() to SwTxtNodeMiklos Vajna1-3/+2
I need this in SwTxtFormatter. Change-Id: Ib1586299f468a88e92fdb367fbab69a683791dc9
2014-11-16sal_True/sal_False to true/false in calls to getWordBoundaryMatteo Casalin1-5/+5
Change-Id: I6116b4c2b8e03e819a430cbdcb7874af6508fb62
2014-11-16sw: convert 'a ? b : sal_False' to 'a && b'Matteo Casalin1-1/+1
Change-Id: I4b7829a1abe1459f2e4915159588fd3e16a14eea
2014-11-16sw: avoid 'condition ? sal_True : sal_False' expressionsMatteo Casalin1-1/+1
Change-Id: Idd6c9f9752659fc5da575e5a3f0ffc15ce5dbe1c
2014-11-16sal_True/sal_False to true/false in sw comments (also delete obsolete ones)Matteo Casalin1-1/+1
Change-Id: Ifb29bd3e9c5dc7671c189fd9daa010305f7a85a4
2014-11-14fdo#86023 - O[U]String needs a 'clear' methodBrij Mohan Lal Srivastava1-1/+1
Added clear() method to OString and OUString class, Updated appropriate call-sites. Change-Id: I0ba97fa6dc7af3e31b605953089a4e8e9c3e61ac Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-11-12Fix common typos. No automatic tools. Handmade…Andrea Gelmini1-3/+3
Change-Id: I1ab4e23b0539f8d39974787f226e57a21f96e959 Reviewed-on: https://gerrit.libreoffice.org/12164 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-11-09faster mapping from nodes to SwFrmFmt's anchored at themLuboš Luňák1-0/+35
The SwFrmFmtAnchorMap class provides reverse mapping to SwFrmFmt::GetAnchor().GetCntntAnchor(), so that when code somewhere needs to update SwFrmFmt's anchored at a position, it's not necessary to iterate over all of them (which can be a large number e.g. with mail merge). One special catch with the multimap of SwNodeIndex keys is that the values of those keys change (whenever the node structure of the document changes, indexes of nodes change as a result). This makes it impossible to use any hashing container, as the hashes would change without the container noticing, but multimap should work fine, as it just requires that the keys remain sorted, and that is the case. Nevertheless, the old code in the two converted places is intentionally left there in debug mode to verify the reverse mapping is updated correctly. I intentionally went with SwNodeIndex rather than SwPosition, as SwIndex (the other component of SwPosition) was causing some trouble (see e.g. the SwPosition comparison operator< , where two same positions are different if one is registered and the other not) and it doesn't appear to be actually necessary. Change-Id: I7f1768558f60155d4ba83c84aa7f9e34dc65ebf9
2014-11-09do not break encapsulation of SwFmtAnchor::GetCntntAnchor()Luboš Luňák1-4/+5
Change-Id: I0a320eb990f9a3b6800447a97a84c118239bae96
2014-11-09do not iterate over all bookmarks in SwTxtNode::Update()Luboš Luňák1-6/+13
3f9872185e introduced new API for fast finding of marks to a specific text node, so use that (code itself based on cb46aaf2d7). This makes mailmerge faster (since it can create a huge document, and especially with the change to use UNO bookmarks to mark starts of MM documents inside the larger single document there can be a large number of marks). Change-Id: I30ec69acf423e9a62fae5f5492ed8744cb727a56
2014-11-03Resolves: fdo#68347 fix word count with recorded changesCaolán McNamara2-27/+45
also see fdo#46757 a) We need to ignore redline-deleted text, but count redline-added text b) each block of text is denoted by its end position in the model and where that maps to in the view so a hidden portion should record its end point not its starting point, and a non-hidden deleted portion should always record its end point c) when mapping a model position to the view we take the offset of the model pos arg from the block end and use that to offset the mapped block-end view pos to get the final view pos. But for hidden portions that won't make a whole lot of sense, and end up offsetting into prior portions, so map all positions within a hidden portion to the same block-end view pos add regression tests for these cases Change-Id: I45c76bba47fd430bc3bccb5f919502660d415d9e
2014-10-31sw: fix insertion of hyperlink inside hyperlink...Michael Stahl1-11/+19
... when either the start or the end position of the new hint is equal to an existing hint. There is not just 1 case here but 3 different ones; don't attempt to insert hints with start > end. Change-Id: I39cf8a352f67d77b56b0d01de5872f4d341f6bdd
2014-10-27sw: deploy some asserts in SwpHints::TryInsertNesting()Michael Stahl1-15/+14
Change-Id: I584edadf13b34edf054e3405865c43bae74a7830
2014-10-27sw: assert SfxPoolItem::operator==Michael Stahl5-9/+9
Change-Id: I9b48fc25abcbdeceefd5a86d8305209f312c9976
2014-10-23Fraction: Revert "fdo#81356: convert Fraction to boost::rational<long> - wip"Jan Holesovsky1-4/+6
This reverts commit 47a2d7642d249d70b5da0c330a73f3a0032e4bba. Conflicts: cui/source/tabpages/transfrm.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx tools/source/generic/rational.cxx Change-Id: I4849916f5f277a4afef0e279b0135c76b36b9d15
2014-10-23Fraction: Revert "fdo#84854 it seems long is not enough on 32 bit"Jan Holesovsky1-1/+1
This reverts commit 582ef22d3e8e30ffd58f092d37ffda30bd07bd9e. Conflicts: svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx Change-Id: I80abc7abdeddc267eaabc9f8ab49611bb3f8ae83
2014-10-23sw: fix undefined casts of SwTxtInputFldMichael Stahl9-73/+97
... 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::star::uno::Reference<com::sun::star::text::XTextRange> const&) sw/source/core/unocore/unofield.cxx:1966:13 > #7 in non-virtual thunk to SwXTextField::attach(com::sun::star::uno::Reference<com::sun::star::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-16fdo#84854 it seems long is not enough on 32 bitDavid Tardon1-1/+1
Fraction used BigInt internally for computations, rational does nothing like that. Change-Id: I3e9b25074f979bc291208f7c6362c3c40eb77ff5
2014-10-13create a macro library for implementing bit-flags typesNoel Grandin3-3/+3
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, changed from a macro- to a template-based solution. (Unfortunately MSVC 2012 does not support explicit conversion operators. Worked around that with explicit #ifs rather than some HAVE_EXPLICIT_CONVERSION_OPERATORS and SAL_EXPLICIT_CONVERSION_OPERATOR ainticipating we hopefully soon move to a baseline that requires unconditional support for them.) Change-Id: I4a89643b218d247e8e4a861faba458ec6dfe1396
2014-10-12convert SWFMTFLD_ #defines to an enumNoel Grandin2-5/+5
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-09fdo#81356: convert Fraction to boost::rational<long> - wipJuan Picca1-6/+4
* 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-06SwTxtNode::Update: don't move anchors at insert positionMiklos Vajna1-0/+16
Use cases: 1) User of the XTextAppend API's uses appendTextPortion(), then appendTextContent(), then appendTextPortion() again. It's expected that the text content will be in the middle of the paragraph, but before, it was at the end of it. It's possible to work this around by inserting the text contents only at the end of the paragraph (like it's done for ODF import in XMLParaContext::~XMLParaContext()), but probably it's not a good idea to copy&paste this workaround in all the import filters. 2) User types some characters in a new document, then inserts a picture, and sets anchor type to at-char. Now the anchor point is set to the end of the paragraph, but it's impossible to type anything after that character. To be fair, now it's not possible to type something *before* the anchor point, if it's at the first character, but hopefully that's less of an issue, since setting the anchor type to at-char sets it to the end of the paragraph, not at the start of it. Change-Id: Ia8b33e8880aae86f62fae09cd5ac1cf82c83320f
2014-09-23with show changes on we can have negative offsetsCaolán McNamara1-2/+4
for counting words in a range of text which has redline deleted text at the start Change-Id: I34149822d43f8ee3fbde58a166dad408fb588fce
2014-09-18fdo#82577: Handle FontNoel Grandin3-18/+18
Put the VCL Font class in the vcl namespace. Avoids clash with the X11 Font typedef. Change-Id: I1a84f7cad8b31697b9860a3418f7dff794ff6537
2014-09-12Turn SfxItemState into a C++11 scoped enumerationStephan Bergmann4-77/+77
...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-06SfxHint: convert home-grown RTTI to normal C++ RTTINoel Grandin1-1/+0
Also note that I fixed a bug in SvxFontMenuControl::Notify where the if statement had the check the wrong way around. Change-Id: I611e8929c65818191e36bd80f2b985820ada4411 Reviewed-on: https://gerrit.libreoffice.org/11147 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
2014-09-06Reserve vector capacity in advance + minor optimizationsMatteo Casalin1-2/+7
Change-Id: I04eea6825c02ea0c076b525e58a1dc86dd290b64
2014-09-06Avoid copying containers for local helper functionsMatteo Casalin1-23/+24
Change-Id: I9ba47e8a53a37cbeb2e8d0e197094531edbaeb4c
2014-09-06sal_uInt16 to size_tMatteo Casalin1-2/+2
Change-Id: I64bc6daa0585686c4d337a5c32ed7009b96fae0c
2014-09-06sal_uInt16: use more proper types, avoid downcasts/temporariesMatteo Casalin1-26/+20
Change-Id: Ib76af3f664dc259e8596d33492bd078c9e4536bd
2014-09-06Group some more common code and reduce castsMatteo Casalin1-35/+13
Change-Id: Ib2f23f098377a07237cdba973edd8e854db05625
2014-09-06Make GetDefaultFontHeight() localMatteo Casalin1-0/+5
Change-Id: I91dad2b1f806a1b7fab823e590ff97121ad5db31
2014-09-06Avoid unneeded downcasts, constifyMatteo Casalin1-6/+6
Change-Id: Iefd16f2b1d03a0fcd4745d3dd5622f189f1d4492
2014-09-06sal_uInt16: avoid unnecessary casts, constifyMatteo Casalin1-11/+7
Change-Id: Ia9bf83054d08d73711bb3f6e83d316ff55e4798c
2014-09-06Group common code into a local helper functionMatteo Casalin1-81/+19
Change-Id: Idc81a30787d09fb8008355251aad282df981cbbe
2014-09-06sal_uInt16: constify, simplify, avoid temporariesMatteo Casalin1-9/+7
Change-Id: I4eaf9910eec073fad5dac6722661383253912c10
2014-09-06sal_uInt16 to size_t, constify, avoid temporariesMatteo Casalin1-9/+7
Change-Id: I1208f1e98a0ee09263babeffa7554e94ed455434
2014-09-06sal_uInt16: constify, avoid temporaries, reduce scopeMatteo Casalin3-7/+7
Change-Id: I8033385b5edd6baa7b64ef77ca242d76f6bf30f3
2014-08-20i#107771: sw: burn, UnoCallBack, burn!Michael Stahl1-7/+0
Change-Id: Ifdb6d4b2e404bd160e6fcec3229691e750bdf698
2014-08-20i#107771: sw: implement thread-safe instance caching for SwXFootnoteMichael Stahl1-0/+9
Change-Id: I3fffb321877168dfa9844b4ad75a9a9efc9602a6
2014-08-20i#107771: sw: make SwXFootnote a client of its format poolitemMichael Stahl2-6/+15
In other words, stop registering at SwDoc's "UnoCallBack". Change-Id: Ie73c707b0f43559cc78717c0879d5e9a9335a7ac
2014-08-20SwWrtShell::StartInputFldDlg() can be called with RES_SETEXPFLD tooMichael Stahl1-0/+15
... and there's no way to get the SwFmtFld from a SwSetExpField, so add a member for it like SwInputField has. That's still better than the UnoCallBack nonsense. Change-Id: I59c82e95414dbae284432b8a318a6ce1a34256c7
2014-08-20i#107771: sw: make SwXTextField a client of its format poolitemMichael Stahl2-5/+20
In other words, stop registering at SwDoc's "UnoCallBack" Change-Id: Ieb2639497fe5e8d71aa1c47952c007da76fcee84