summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/wrtw8nds.cxx
AgeCommit message (Collapse)Author
2022-05-12tdf#142840: doc export: use BookmarkToWord() for hyperlinksVasily Melenchuk
Inernal hyperlinks to bookmarks should not contain spaces. This is not required for RTF or DOC: MS Word is okay with spaces there (unlike in DOCX). But since we are replacing spaces in bookmark names we should do this also in links to these bookmarks. Change-Id: I7a3e530817572ed53032c2be1ad96f8e8498bac3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133590 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> (cherry picked from commit d45315c8eb91862958b29ead09cec58e03a80096) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134177 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-01-15tdf#143039 tdf#143106 sw: DOCX export: don't export duplicate flysMichael Stahl
The problem is that at the end of the paragraph a second call to OutFlys() is made in line 2730 and that causes the duplication; for this call the value FLY_POSTPONED must be returned, not FLY_NONE. (regression from 3eced2d52415abeac266804ab682bee022322a19) Also revert commit deb892628a1501527c8c41b85a65282df95b81b1 because its test fails now as 0 comments are exported; it was apparently another problem introduced by the above commit, and apparently this fix helps for duplication of comments too. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128386 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit f261fae4af72b1328bc3e93fc52a9a24ce0975b3) Restore tdf#134951 docxexport: stop duplicating stuff in postponed text Partially revert commit f261fae4af72b1328bc3e93fc52a9a24ce0975b3 to restore deb892628a1501527c8c41b85a65282df95b81b1 because as reported by jluth the test case testfdo79008 that failed was apparently somewhat misleading and the test case testTdf134951_duplicates that should test comments erroneously failed to fail because it is doing a loadAndSave() instead of a loadAndReload(). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128410 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 4c4fb36222f6c624cfdea82ce266bf9d99073558) Change-Id: Ib9706e4c24db38c15a0170ba2e8f08fba5327f98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128341 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-12-11tdf#145720 DOCX export: fix loss of tracked movingLászló Németh
of documents created in MSO to keep interoperability. Export moved redlines as moveFrom/moveTo instead of del/ins elements (also for newly created tracked moving). Export "MoveBookmark" elements moveFromRangeStart, moveFromRangeEnd, moveToRangeStart, moveToRangeEnd, which imported from DOCX documents created in MSO. Without them, moveFrom/moveTo elements were imported as plain deletion or insertion in MSO. Note: MoveBookmark elements were imported and exported as collapsed plain bookmarks. Now keep their ranges, also store the information of moveFrom/moveTo for correct export. In the export filter, mandatory author and date of the tracking information restored from RedlineData of the first redline within the MoveBookmark, if it's possible. Follow-up to commit f51fa7534421a195a58b4a737a2e836d8c25ba81 "tdf#145718 sw, DOCX import: complete tracked text moving". Change-Id: I54242453a7f7d8f73ea074fc74e8e7bc86d07d01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126258 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519, commit bbb09ebda08fec0702de0fb50dbe630acf73af2f and commit 3efde47ec9ee091479c04129696f99dc934c3f64) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126290 Tested-by: Jenkins
2021-10-21introduce SwNodeOffset strong typedefNoel Grandin
for indexing into node children. Replaces various usage of sal_uLong, tools::Long, sal_uInt32 with an underlying type of sal_Int32. Also add a NODE_OFFSET_MAX constant to replace usage of ULONG_MAX Change-Id: I2f466922e1ebc19029bb2883d2b29aa4c0614170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-20make more use of SwPaM::End()Noel Grandin
instead of open-coding the same thing Change-Id: I45ddc87317569c9ad6378eab1067ebea79c583f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123894 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-10use SfxItemSetFixed in swNoel Grandin
Change-Id: I69e188d7599b7fc439f613cec0a0967ccb748b7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-04tdf#77051 DOCX: fix user index and index entry supportLászló Németh
defined by field code \f. E.g. INDEX \f "user-index" inserts only the entries defined by XE "entry" \f "user-index" field codes. Revert commit a7bc9c1e4977bd3430df69287fa0a8377a686c58 "fdo#77051: Preservation of Index field flag '\f'", which added an undocumented UNO property only for round-trip support of INDEX, but not for XE index entries, so the DOCX export still resulted a broken index with lost entries, not only the import was broken because of the missing functionality in com.sun.star.text.DocumentIndex. Now the import uses com.sun.star.text.UserIndex and com.sun.star.text.UserIndexMark index and index entry fields, which support the requested user index not only during the DOCX and OpenDocument round-trip, but its run-time functionality, the multiple user-defined indices. Note: for manual testing, update the user index (the first index) of the left original unit test document IndexFieldFlagF.docx: the updated index is not empty, as before, but contains the user index entries. Change-Id: Ia6139bba88907051fd050cfd40809f5544b9a89e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122930 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2021-09-24no need to allocate this SfxItemSet on the heapNoel Grandin
Change-Id: I85bc4a7b9c638b928f55072e92188ee13ca9311f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122583 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-10sw: removed unused NO_NUMLEVELVasily Melenchuk
NO_NUMLEVEL is not used in code for a while. Change-Id: Ia39879723455dbe5cc13b20042e930088618588d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120113 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2021-07-27sw: document the last parameter of FieldVanish() where it's not usedMiklos Vajna
To resolve docx vs rtf/doc inconsistency. Change-Id: I349cfb4aa9575df31c29eb35a32d72474d089c6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119527 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-07-24use officecfg to retrieve SaveRelFSysNoel Grandin
Change-Id: If4e943153080e1c8fea02e712038dd6dee92c5a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119454 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-19Move svl::Items to include/svl/whichranges.hxx, and unify its usageMike Kaganski
... in WhichRangesContainer and SfxItemSet ctors. Now it's not needed to explicitly use 'value' in WhichRangesContainer's ctor, or create an instance for use in SfxItemSet ctor (svl::Items is already defined as a template value of corresponding type). Instead of WhichRangesContainer Foo(svl::Items<1, 2>::value); SfxItemSet Bar(rItemPool, svl::Items<1, 2>{}); now use: WhichRangesContainer Foo(svl::Items<1, 2>); SfxItemSet Bar(rItemPool, svl::Items<1, 2>); Change-Id: I4681d952b6442732025e5a26768098878907a238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119157 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-09Make loplugin:stringadd slightly more aggressiveStephan Bergmann
...by assuming that all const member functions are side-effect free. (This presumably means that some of the special cases in StringAdd::isSideEffectFree are obsoleted by this more general case, but any such removal is postponed to later clean-up.) (Came across this when idly wondering why 8b7f948d9d79393bc6c1b11d239706666fd5d7de "sc, VmlFormControlExporter: avoid OStringBuffer style" had not been found by the plugin before.) Change-Id: I6bca10df53885b14a590543aabd61f23b3748572 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118675 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-27use string_view in INetURLObject::decodeNoel Grandin
Change-Id: I10e04970ceac33c9c3fbfd0182dd2140e06cb80b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-20use OUString::Concat here, not OUStringLiteralNoel Grandin
Change-Id: Ia2172bcab60f32c9d9d4f6ca0230484343eef69b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-16tdf#122222: add DOCX export of resolved comments as "done"Mike Kaganski
Since implementation of tdf#119228, Writer comments may have "Resolved" state, which is the equivalent of Word's internal "done" flag. This relies on [MS-DOCX] extensions available since Word 2013. DOCX import will be implemented in a follow-up commit. [MS-DOCX]: https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx Change-Id: I3be1e8a096bdec41c8268974fe81328480eb0704 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114023 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-16sw: DOCX export: write hyperlinks for TOXMark TOX entriesMichael Stahl
* add hyperlink preprocessing in MSWordExportBase::AddLinkTarget() * <w:hyperlink> in the TOX entry * <w:bookmarkStart>/<w:bookmarkEnd> in the field command Change-Id: I4d18778d8ac594a1b4cb43bf0e1234f875eeaf95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114170 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-04-16tdf#134951 docxexport: stop duplicating stuff in postponed textJustin Luth
Certain attributes like comments, fields, and footnotes should not be duplicated when a character run is split by the bPostponeWritingText hack. Only DOCX PostponesWritingText. The comment-with-range is still not perfect, but at least it is not fully duplicated. Best would be to just get rid of the hack? A few more items suggested themselves as belonging to this list, but I don't really know what they are, and no instances of them in this position were found in the existing unit tests. So I just left them as a commented possibility. Change-Id: I950c4250b5f7ed62d63eeff71cabaa10b67dca5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114148 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2021-04-15NFC sw ww8export cleanup: bPostponeWritingText already trueJustin Luth
if (x is true) set x to true is unnecessary. Change-Id: If94fc4ee4fa97fa8175795959217008264f53d0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114120 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2021-03-10sw: DOCX export: put fly before fieldmark start into its own runMichael Stahl
If a fly starts at the same position as a CH_TXT_ATR_FIELDSTART, it is anchored before the field, and written in OutFlys() before the field is written in EndRun(), but the DOCX export reorders things in confusing ways. StartField_Impl() and CmdField_Impl() will actually end the current run (after putting the field char in it) and start a new one. So do something similar in this situation and create a new run if flys have been processed. Restrict this extra run to when there is actually a fly, because otherwise a dozen tests break; this requires a new FLY_NONE result for OutFlys() because FLY_PROCESSED is returned even if there are no flys. Change-Id: Id469c53d07eacad3992c7c0e451ab3756e02c8fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112267 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-02-11Remove unneeded breaksAndrea Gelmini
Extending this: https://gerrit.libreoffice.org/c/core/+/110512 Change-Id: I1066aac690fe297a557352266f3405ae29ed4593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110522 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-02-04Fix typoAndrea Gelmini
Change-Id: I7cc5e98fe967da00228c1540ac28a0074e6d5e4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110344 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2020-12-21tdf#138986 Fix DOC export of LinkDisplayNameRegényi Balázs
The LinkedDisplayName could be empty what caused an assert. tdf#138986 regression from commit: bda05ba17362222b74727872579b65b3fa14e3d8 (tdf#41466 DOCX import: fix VML v:shape/v:textbox) Change-Id: I166a7e4c1defc201d0563a961b28ecb6c6be500c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108077 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-08tdf#135329 revert sw MS export: prevent skipping at-char anchorsJustin Luth
...because Step 2 solved the problem, and I don't want to mask any future issues that miss an anchor position. This reverts LO 7.1 commit d4045509e58180768368db7a77479fc027ff7c42 tdf#135329 sw MS export: prevent skipping at-char anchors This patch is step 1 - write out bypassed flies. Step 2 - don't bypass fly positions. Change-Id: I5246ea531897de493eb050625cebcdcc2488605b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100390 Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-11-11loplugin:stringviewNoel
Add new methods "subView" to O(U)String to return substring views of the underlying data. Add a clang plugin to warn when replacing existing calls to copy() would be better to use subView(). Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11DOCX: fix memory leak of cell formula exportLászló Németh
clean-up of commit cf596c43315bb96b5e7256a82256f1ccb8c9c4d0 (tdf#133163 DOCX: export formula cell). The problem was reported by Miklós Vajna. Change-Id: Ia636a6ffe8386e58e31e37c0d8afc283e6f2fc4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105558 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-06tdf#136952 ww8export: always check for breakAfter on last splitJustin Luth
This patch primarily adds support for covering the situation where a rare page-after break exists on a split paragraph node. This patch also adds one more aspect to the fixes for tdf#132149, where a breakBefore wasn't evaluated with the correct CurrentPageDesc. Change-Id: Ia548c611c1b7b6c66cb7a7c58be1705cd8c42b77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103275 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-05retire most of SwModifyBjoern Michaelsen
only remaining uses are: - in calbck.{c,h}xx - in uwriter unittests - as a parameter of SwClientNotify all other uses have been replaced with sw::BroadcastingModify, which contains sw::BroadcastingMixin functionality. Existing code should then be moved to sw::BroadcastingMixin (only) as soon as possible. Change-Id: Ief7895597633c2fcb97e1cbc182905d75feb1567 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105320 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-10-28tdf#132149 ww8export: respect ginormous paragraphsJustin Luth
This handles the extremely unlikely case where a single paragraph contains multiple soft-page-breaks from spanning more than two pages. But it makes the unit tests I designed look much better, so I am happy. I think it might help to make the code slightly more understandable too, and it convinces me that I am understanding this section as I write multiple fixes against it. [Better evidence than all of this is that Michael Stahl came the the same conclusion from a code read - I just beat him to it.] (P.S. It isn't enough to change CurrentPageDesc, because that is reset from rNode.FindPageDesc on every WriteText. So the effective pageDesc needs to be kept track of.) Change-Id: I5852e90571a74f3df4362caf058f7960f413dad3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101545 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-10-13static_cast after dynamic_castNoel
Change-Id: I487b5dc148f5a3d0d45f198c00179002841242ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104213 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-02MSWordExportBase never passed a null SwDoc*Caolán McNamara
and drop redundant nullptr checks Change-Id: I42b86461ad276089454b35a51651c5aa1e1280ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103850 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-30SwNode::GetDoc can return a reference insteadCaolán McNamara
and remove discovered redundant null checks Change-Id: I6b8bc9593434f38947e399a48888a8fa0d4f7e77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103640 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-21tdf#132149 ww8export: always check for break at end of paragraphJustin Luth
Make sure to check if the next node has a page-break at the end of a split paragraph. Change-Id: Ib103d7b2f653f9ae5772ff536c041afb445903b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101344 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-09-08Add reference to spec to the commentMike Kaganski
Change-Id: I5085c1530fd0aacf31e775aac81d98cc1f88bd87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102131 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-09-05tdf#136441 ms export: don't export comments in footnotesJustin Luth
Microsoft UI does not allow comments in footnotes, or in headers/footers, or endnotes, so just throw them away for all MS formats. This avoids the biggest problem, which was an error in LO reading the DOCX. Prior to this bug fix, the status was: DOCX: Word 2016 opens it ok, but no comment in footnote. Word 2003 hangs. LO loads but has a SAX error the user must ignore, and no comment seen in the footnote anyway. DOC: Word 2016 opens, but misses the main body text, and of course no comment in footnote. Word 2003 opens, sees the main body text just fine, and no comment in footnote. LO loads, but no comment seen in footnote anyway. RTF: Word 2016/2003 open, and no comment in footnote. LO loads, but no comment seen in footnote anyway. If the SAX error problem could be fixed, then perhaps it would be worth allowing LO to export comments to DOCX for its own benefit. In that case, allow case SwFieldIds::Postit: PostitField( pField ); This patch does not fix the problem where the body text is missing in Word 2016 in DOC format. Change-Id: I0b7389616a2207d41ae525dbc0b2eea536364d90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102074 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-08-31tdf#132149 ww8export: nextNode has nothing to do with pageDescJustin Luth
While it can often be assumed that the next paragraph following one that has just soft-page-breaked in the middle will be on the same page, it isn't necessarily correct. Either the paragraph could span multiple pages, or a page-break could push it to the next page. Thus, strip the code out completely, and simply prepare a new page style based on the follow style - which by definition is different enough to not be a plausible single word section. A few followup commits will add enhancements, but this is broken up into minute bits in order to aid in regression identification. Change-Id: I80e4e17be69a49f45a624d819c9c4158541ee065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101424 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-28tdf#131801: sw: support of style references in ListAutoFormatVasily Melenchuk
ListAutoFormat property did support char attributes, but not style references ("CharStyleName"). It is important for correct formatting of pilcrow symbol or list format in some DOCX scenarios. Export to DOCX already works, but not to RTF/DOC. Change-Id: I1bf23d1e45fcc213adcf9aa6f404be803919fbee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100893 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-27tdf#136132 DOCX export: fix space in table formulaLászló Németh
Don't add extra space after the equal sign again and again. See commit 82189fdc93ac337e1de3379d678eca6b7654e6fc (tdf133647 tdf123386 tdf123389 fix DOCX table formula export) and commit cf596c43315bb96b5e7256a82256f1ccb8c9c4d0 (tdf#133163 DOCX: export formula cells). Change-Id: I45b49ce572c8e668571ed0550be13beff91634d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101405 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2020-08-21NFC sw MS export: flatten useless aTmpFlyIter loopJustin Luth
The loop did nothing, since aTmpFlyIter was never used. IsAnchorLinkedToThisNode() is only called in one place to test whether to bPostponeWritingText. One option would have been to actually use aTmpFlyIter instead of maFlyIter, which would seem to make the most sense, and was likely @synerzip's original intention. (And in that case, it should return false as soon as nNodePos < nAnchorPos since this is a sorted list.) However, this whole concept of PostponeWritingText is ripe for regressions etc. I don't want to introduce an even larger number of postponed cases, so instead I chose to do option two, which is to just re-write the function in the way that it actually operated. So this is supposed to be in a No-Functional-Change cleanup. Change-Id: I227e2ecd2aca82b03b54ae3924db91933ca2c930 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100374 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-08-19tdf#135329 sw MS export: don't miss nextAttr fly positionJustin Luth
Step 1 - write out bypassed flies. This patch is Step 2 - don't bypass fly position. The SearchNext function was skipping some flies because it was not returning them as a stopping position (nextAttr). The time I noticed this happening was at the start of the paragraph, when there were zero-anchored paragraph flies which hadn't been processed and so they returned a non-usable minPos. With this patch, I OUGHT to have rendered Step 1's patch unnecessary. Change-Id: I9924dbf5424f5b0309ec944e1bb79380672220f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100387 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-08-14loplugin:simplifybool moreNoel Grandin
look for expressions like !(a && !b) which can be expanded out Change-Id: I72515a9638762b050f9a258c08da39ebfa2ef8e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-14tdf#133163 DOCX: export formula cellsLászló Németh
as formula fields instead of exporting only cell text content. Only unmodified formula fields were exported from commit d42776e01b87f12fddbcf78101bca1e10a6e4f97 (tdf#118682 DOCX: export formula fields). Now newly added Writer formula cells or modified table formula fields imported from DOCX (which are converted to formula cells after formula editing) are exported. Change-Id: Iecec75b2a36b94c2d3aa998603ac10ea2f2b8d4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100667 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2020-08-14tdf#132726 tdf#134948 doc/rtf export: don't PostponeWritingTextJustin Luth
Since .doc and rtf don't postpone flys, they shouldn't also be postponing the text. Partially revert my LO 5.3 commits b39feae4f12b07a0fdb2c8c2a48d5aae613cd7c9/ 3ade281c1da91b7646a56227cffba8eb8818ea30 which only avoided postponing within tables for the .doc format, since this patch eliminates it completely for .doc and .rtf I think the original Synerzip LO 4.4 patch commit 80fd9fb7209cfd5c0622ee99d59e42e6db32f021 was only intended for DOCX formats. I am concerned about doing this since the implications are unclear, but I take comfort in seeing that many synerzip commits just need to be reverted, and that a number of .doc bugs are solved by doing this. The fact that few bug reports have been made since 4.4 also suggests this isn't a hugely active area. No intention to backport, and still lots of testing time available for LO 7.1. Change-Id: I9284d3cc516c480e8bb0848c17797988ffcdcd2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100175 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-08-13sw: MS Word export: don't insert section breaks in field instructionsMichael Stahl
MSWordExportBase::NeedTextNodeSplit() simply uses the soft-page-break positions to potentially insert section breaks - but now that Writer can display field instructions, it's quite silly to insert section breaks inside them. Change-Id: Ie57e6281a0287aac36984e5467920852db19a8ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100661 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-13tdf#135329 sw MS export: remove effectively dead anchoring codeJustin Luth
commit dce1d0766c5013e35762ab85f263df312901f5f4 Author: Caolán McNamara on Mon Oct 14 13:24:31 2002 +0000 #i2916# integrate markm character anchoring export impl 1.) if (nPos >= nStartPos && nPos <= nMinPos) 2.) nMinPos = nPos; 3.) ++nPos; 4.) if (nPos >= nStartPos && nPos <= nMinPos) 5.) nMinPos = nPos; So lines 3/4/5 should be dead code. With lines 1 and 2, MinPos has changed to be nPos, so if we increment nPos, by definition it will now be larger than itself (aka MinPos). There is ONLY one time when this could have been used, and that is if nPos == nStartPos - 1. However, in that case the fly WILL ALREADY BE HANDLED, because it is in the current run's position. So if the fly is already going to be handled, what good will treating the next character separately do? So the comment sounds really important, but in practice it seems as if it is not happening. Plus round-tripping already breaks everything anyway, so very unlikely to raise any substantial regressions. Change-Id: Ifa867ac3614aef82a3dde358ee3e5bd54d5a1142 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100386 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-08-08tdf#135329 sw MS export: prevent skipping at-char anchorsJustin Luth
This patch is step 1 - write out bypassed flies. Step 2 - don't bypass fly positions. The SearchNext function is skipping some flies because it is not returning them as a stopping position (nextAttr), and so OutFly just skipped them since they didn't exactly match the position it was acting on. Generally a bad idea to just ignore a picture etc. Perhaps this is safe enough to backport all the way to stable. But pictures are such a mess in general, and so fragile that I don't know what the implications might be. Thus I am breaking this fix down into as small pieces as I possibly can for the benefit of regression finding/fixing. Prior to this test, there were no unit tests that failed assert ( nPos >= nSwPos ); Change-Id: Idad0ea9d229f107a8b55150c476f3d4a6bdef3f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100375 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2020-08-04loplugin:simplifybool a little more aggressiveNoel Grandin
with expressions like !(a && b) Change-Id: Id2acec2a8d0eaaa8e5e37dbd2cae7281be36572e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100040 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-31loplugin:flatten in sw/filter/ww8Noel Grandin
Change-Id: Ia296fc6e6c8f78edf533dedf52996560ae62d143 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99853 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-17Use information about sprm structure from [MS-DOC] in GetWW8SprmSearcherMike Kaganski
That information is already used in sw/source/filter/ww8/sprmids.hxx. Just make it available for use by converting the sprms into templated structs with relevant members. Inspired by commit 56b04e40ab72b6333ce278ba2980650f5272025f. This commit changes values for the following sprms: sprmCPlain (0x2A33): len 0 => len 1 sprmTMerge (0x5624): len variable => len 2 sprmTSplit (0x5625): len variable => len 2 Change-Id: Icd65fc1ef488e7b2db60f13246c76f89176467ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>