summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)AuthorFilesLines
2019-08-20tdf#76260 cache next page style numberNoel Grandin4-57/+55
to speed up loading document with lots of footnotes. Takes the load time from 29s to 27.3s for me Change-Id: I911e4a7d7db8a2cdff1271d04e5535e76fd137a0 Reviewed-on: https://gerrit.libreoffice.org/77778 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-16Fix typosAndrea Gelmini1-1/+1
Change-Id: I8ab75eb5cd54d14fda42bcdb1a251e9e2b6fefdf Reviewed-on: https://gerrit.libreoffice.org/77612 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-16use more TOOLS_WARN_EXCEPTIONNoel Grandin2-8/+5
Change-Id: Ic21ea11ff106e0732bb8fa600ef39a549d7bda86 Reviewed-on: https://gerrit.libreoffice.org/77569 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15loplugin:sequenceloop in writerfilter..xmlhelpNoel Grandin7-16/+16
Change-Id: I7c9c911aa6b051eeab46344f25ea2919605de645 Reviewed-on: https://gerrit.libreoffice.org/77534 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15replace ".get->" with "->"Noel Grandin3-3/+3
Change-Id: I327a6fda1fe0170da33e06b735f09a39421c8a58 Reviewed-on: https://gerrit.libreoffice.org/77469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15sw btlr writing mode: RTF filter of Writer textframesMiklos Vajna1-5/+10
Both import and export needed fixing. Change-Id: Ie1728c3e67d8637e3720748d7f61a69c058eafe3 Reviewed-on: https://gerrit.libreoffice.org/77474 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-13tdf#114854 writerfilter: EditEng URLs import different from SW URLsJustin Luth1-15/+24
The only example I found was comments (aka annotations/postits). No other unit tests had a URL in a draw component. Change-Id: Iad5c285090d646c495cd2a7b19e076d9e50fb58d Reviewed-on: https://gerrit.libreoffice.org/77108 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2019-08-10NFC cleanup writerfilter: reuse existing variableJustin Luth1-2/+1
Change-Id: Ib44d5296c7879fe872c33357ee0bf24d27c143af Reviewed-on: https://gerrit.libreoffice.org/77228 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2019-08-10tdf#118936 writerfilter: MultiPropertySet retry on exceptionJustin Luth1-6/+21
Applying the same logic as in PropertyMap - if the efficient multipropertyset fails, then re-apply each property one at a time. This effectively reverts 9a19a1235c301f2699157ab44049bdfd54955e8a The "assert" idea of identifying and fixing invalid properties failed spectacularly with RTF - where paragraph properties seem to be routinely applied to character styles. No docx examples were found - unless they were the novell examples which I don't have access to. Change-Id: I4b733d52de93dfb6beb1da35e0813fd1b0396da7 Reviewed-on: https://gerrit.libreoffice.org/77221 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-08-09tdf#126768 DOCX import: fix absolute hyperlinks to documentsTünde Tóth1-0/+4
file:///absolute\\path\\to\\file didn't work in Writer. Change-Id: I61135668e47bc1d67afb4ed6bec6a90744d295cf Reviewed-on: https://gerrit.libreoffice.org/77184 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-08-09tdf#126723 writerfilter::finishParagraph - me, not previousJustin Luth1-9/+10
In LO 6.2 commit 480ac84f2f5049fb4337b36f12fd6796e005761b the existing m_xPreviousParagraph was conveniently used to apply the changed properties. I never did like that choice, but despite looking at it, I failed to see that it is set in an inside loop, which means that it was NOT NECESSARILY reset to the current paragaph. So I'm happy to have proof that we should not use m_xPreviousParagraph. Change-Id: I5c7f1b0f097711d65ae0d0be1f0fbc40c8b96e9d Reviewed-on: https://gerrit.libreoffice.org/77185 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2019-08-07Remove some unused includesMiklos Vajna6-11/+5
See tdf#42949 for motivation. Change-Id: I76f3cbf866d20a3e70d06148fb42ca25998de34b Reviewed-on: https://gerrit.libreoffice.org/77063 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-07Fix typosAndrea Gelmini1-1/+1
Change-Id: Ib3ada3eb5b7d2699a86f05bb646b71f30d8a7003 Reviewed-on: https://gerrit.libreoffice.org/77041 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-08-06tdf#118936 writerfilter: MultiPropertySet exception lost propertiesJustin Luth1-1/+4
An unsupported character style property was causing the loss of some properties - anything with a higher sorting value. Another way to deal with this could be something similar to section properties which retries properties individually if multiset fails. Another option is to add CHAR_SHADING_VALUE to aCharStyleMap in unomap1.cxx, since it is already in aAutoCharStyleMap. However, this is an area I completely don't understand. Change-Id: I70676c7a35d0efc95222960609da039e26df8a58 Reviewed-on: https://gerrit.libreoffice.org/76875 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-06tdf#126309 RTF import: fix not needed para adjust swap for bidi textMiklos Vajna1-1/+4
Regression from commit 4ee2a882dddb395a816cd54004b634d57cfb2446 (tdf#86182 RTF import: fix handling of \rtlpar, 2015-04-17), now that we don't ignore \rtlpar, it turned out that dmapper should not do paragraph alignment left/right swapping for RTF. It seems this is needed for DOCX, but not for legacy DOC/RTF. See how SwWW8ImplReader::Read_Justify() doesn't do this, either, so this is one of those rare cases when dmapper has to know if the token stream is generated by the DOCX or the RTF tokenizers. Change-Id: Ibd52e3dc9e782e1d985418085b82b2e2628bc1dd Reviewed-on: https://gerrit.libreoffice.org/76995 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-05Fix typosAndrea Gelmini2-2/+2
Change-Id: I82bf62737a714f4a63af56989eb1c9c632b7d606 Reviewed-on: https://gerrit.libreoffice.org/76973 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-05tdf126701: MSForms: Fix import of date field at the end of the paragraph.Tamás Zolnai4-17/+22
We need to create date field before the paragraph is finished (line break is inserted). A date field can not span between paragraphs. Extend other related unit tests too. In other use cases, the field content changes to an invalid data. Change-Id: Id274649e0aaaf6e3c31e042afd126cefc368c858 Reviewed-on: https://gerrit.libreoffice.org/76971 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-08-05writerfilter comment cleanup: keep comment with codeJustin Luth1-1/+1
Keep the comment with the code portion that it describes. Initially the if clause only dealt with this topic, but it has since expanded to include many other things. Although it talks about a right margin, the code doesn't do anything with that. I left the comment as is in case it indicates something that OUGHT to still be done, even though the original commit does nothing to the right margin. See original commit 1d2af74e226bf44e1a0f1e1981ca965cffeaa0b2. Change-Id: I8ac21082e7a27924a108dd16fe8131ec3de92b28 Reviewed-on: https://gerrit.libreoffice.org/76898 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2019-08-05Fix typosAndrea Gelmini1-1/+1
Change-Id: I63ab268d908477f8847b315f44f6ffd543b17794 Reviewed-on: https://gerrit.libreoffice.org/76969 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-02tdf#123702 RTF/DOCX default 1" left/right page marginsLászló Németh1-6/+6
since MSO 2007: now 1440 twips = 2540 1/100 mm (it was 1800 twips = 3175 1/100 mm). Changing the default value fixes the layout of the documents based on RTF templates without explicit margins. Change-Id: I0395fb7cdd6ba176f266c8f0a9309ba48a047da3 Reviewed-on: https://gerrit.libreoffice.org/76812 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-08-02sw btlr writing mode: RTF filter of Writer tbrl textframesMiklos Vajna1-2/+7
Fix both import and export. Values 1 and 3 seems to be the same. Accept both on import, but write 3, as DOCX only has a single value and Word uses 3 when doing DOCX->RTF conversion. Change-Id: Ic5420091ffee9eb20c6aaac61a127e93289aa9fe Reviewed-on: https://gerrit.libreoffice.org/76823 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-01Fix typosAndrea Gelmini1-2/+2
Change-Id: I2238961a7b124652e90e948e27a6ca9d98dc54ac Reviewed-on: https://gerrit.libreoffice.org/76826 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-08-01tdf#126544 writerfilter: check parent style exists before assigningJustin Luth1-1/+7
If you set the parent style to a style that is not yet created, then it silently fails, and thus inherits from nothing! Change-Id: Ibb85235643dd5b1eb9b0bd43f701580f24b2b7fa Reviewed-on: https://gerrit.libreoffice.org/76805 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
2019-08-01tdf#126590 DOCX import: fix absolute hyperlinks to documentsTünde Tóth1-1/+7
Absolute links in DOCX documents created with Word didn't work. Change-Id: Ie23c9ded1c88752768b925ec26df3061beeddd8e Reviewed-on: https://gerrit.libreoffice.org/76581 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it): writerfilterStephan Bergmann8-478/+478
Change-Id: I79a920d7f2d46f17fa14394120a7cb872013eec9 Reviewed-on: https://gerrit.libreoffice.org/76626 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-31writerfilter: merge indentical branches in switchMiklos Vajna1-1/+0
Change-Id: Ia7c48f3f19342fe917350bc03f35797dd5f1e20e Reviewed-on: https://gerrit.libreoffice.org/76715 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-29loplugin:sequentialassignNoel Grandin1-2/+1
Change-Id: I56a9bf698b60bd278c71cc632aacef2bd2f4c13f Reviewed-on: https://gerrit.libreoffice.org/76501 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-25tdf#123627 DOCX import: fix relative hyperlinks to documentsTünde Tóth2-3/+1
Revert "tdf#86087 DOCX Import link as relative if preferred" This reverts commit 40acf8d6447065077acba9e800c56239f58c8262. Relative urls aren't converted to absolute urls, if the "Save URLs relative to filesystem" setting is checked. Change-Id: I209fa57e508dd425772e0019c1749a2bdc92e3ed Reviewed-on: https://gerrit.libreoffice.org/75863 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-07-23tdf#126516 DOCX change tracking: fix paragraph style rejectionLászló Németh1-3/+3
by keeping paragraph-level ParagraphFormat redlines. (regression from commit a5abe0fc4d435d3a7a7de8bf55ec74087fdd299a "tdf#125546 DOCX import: fix overgrowth of change tracking entries") Change-Id: I1357a9e082f990c8a7d1d1aa6f93a06c3dfee5a8 Reviewed-on: https://gerrit.libreoffice.org/76154 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-07-23better implementation of RTFSprms::findAdrien Ollier1-10/+18
if not bFirst, then it is more efficient to start the search from the end. Change-Id: I89bcb3b70ada7746ab983878f2868f58b89f37a5 Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr> Reviewed-on: https://gerrit.libreoffice.org/76126 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-23RTF import: add tests for RTF_TLMDOT/HYPH/TH/EQMiklos Vajna1-5/+2
lcov points out these were not covered previously. Also, Word maps TH to underline and EQ to nothing, so do the same. Change-Id: I994f78cbe1c6c2edec73edc8944f739e2a7cb8d8 Reviewed-on: https://gerrit.libreoffice.org/76144 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-23using an algorithm of the STLAdrien Ollier1-4/+5
makes code clearer Change-Id: I0bf26b6a75354ccbb79d431c947277d621985385 Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr> Reviewed-on: https://gerrit.libreoffice.org/76127 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-22MSForms: DOCX filter: fix crash when the date field is inside a shapeTamás Zolnai1-4/+5
Change-Id: Ida6ff48e6e743e41dd793e31c11065f870e8959b Reviewed-on: https://gerrit.libreoffice.org/76117 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-07-21loplugin:referencecasting in writerfilter..xmlhelpNoel Grandin6-18/+12
Change-Id: I84954e35f285d968e3a83591c476b3c814c2a13f Reviewed-on: https://gerrit.libreoffice.org/76033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-19tdf#125546 DOCX import: fix overgrowth of change tracking entriesLászló Németh1-1/+6
The same text portion could get double redlines including ParagraphFormat. This broke redline compression, sometimes resulting huge amount of redundant change tracking entries based on rsId, or losing paragraph styles after deletion. Change-Id: I5930eab2ef0bc7eb9c93a10cdd30b96cd41c9098 Reviewed-on: https://gerrit.libreoffice.org/75926 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-07-18tdf#125894: DOCX: import tracked changes in framesLászló Németh3-3/+51
Tracked changes weren't imported in frames, losing also the actual text content: also tracked deletion reappeared as normal text here, not only the tracked insertions. Change-Id: I5fc8135cfb7402ad71c5c24eae606aa7ed707dfc Reviewed-on: https://gerrit.libreoffice.org/75779 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-07-18Revert "tdf#123627 DOCX import: fix relative hyperlinks to documents"László Németh2-1/+3
This reverts commit 217a80fd205c7f61794c863898cb7cfd1a17e78f. Change-Id: Ic6c9c68dff800f0969187bdd46b51f8e71c0c618 Reviewed-on: https://gerrit.libreoffice.org/75825 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
2019-07-17tdf#123627 DOCX import: fix relative hyperlinks to documentsTünde Tóth2-3/+1
Revert "tdf#86087 DOCX Import link as relative if preferred" This reverts commit 40acf8d6447065077acba9e800c56239f58c8262. Relativ urls aren't converted to absolute urls, if the "Save URLs relative to filesystem" setting is checked. Change-Id: Ie6d277e54e5f0136fed6e2804a56d29bc78e202f Reviewed-on: https://gerrit.libreoffice.org/75682 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
2019-07-15writerfilter: turn on clang-format for SdtHelperMiklos Vajna2-63/+52
This had manual consistent formatting. Recently it was broken, so bring back consistency by using clang-format. Change-Id: I1e4c127b20a2755cda72a35110b6ef8413bac548 Reviewed-on: https://gerrit.libreoffice.org/75621 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-07-12MSForms: Rework text-based date form field's representationTamás Zolnai3-51/+83
* Better to represent it similar to text form field with two marking characters selecting a text range * So the text between the two marks can be anything (not only a well formatted date) and also have any character formatting. * With this we handle the case when the user needs a placeholder text in the date field or when the user needs time values (hour, minute, sec) next to the date. Change-Id: Id60a50a2028058f8a6a080e265c0730d88b98543 Reviewed-on: https://gerrit.libreoffice.org/75459 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-07-12MSForms: DOCX filter: The new text-based date field is allowed in the header.Tamás Zolnai1-16/+6
Change-Id: I71d61c702ccd0470c4c3df09531704783c1b3e01 Reviewed-on: https://gerrit.libreoffice.org/75457 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-07-12MSForms: DOCX filter: handle date formats with quotation marks.Tamás Zolnai1-1/+4
Change-Id: I61cc6d47200acdd55f147b4f1829330dec8562a0 Reviewed-on: https://gerrit.libreoffice.org/75454 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-07-12MSForms: DOCX filter: import manually set date field as plain textTamás Zolnai1-6/+11
In MSO the user can add any text in the date field without having it in the specified date format. We import this kind of date as plain text. Change-Id: Ied4bf03a3ac4c9b6f1cfc78d91e6a52ad3d6e179 Reviewed-on: https://gerrit.libreoffice.org/75452 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-07-12MSForms: DOCX import of text-based date fieldTamás Zolnai5-95/+44
* Before the date content control was imported as LO specific date form control, but now I changed it to be imported into the compatible text-based date field. * Also removed the things stored in the grabbag, which are useless now. * Disabled some unit tests, I'll update them for the new field in other patches. Change-Id: Ide8f4b27ec6b2dbb182abb4180229736bf9c434f Reviewed-on: https://gerrit.libreoffice.org/75447 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-07-10tdf#121663 DOCX import: fix missing space in line numberingLászló Németh2-2/+9
Auto distance of line numbering is 0.5 cm, not zero. Change-Id: Ic451424bffb3eb3fe386bcaef5a476a5679faff2 Reviewed-on: https://gerrit.libreoffice.org/75317 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2019-07-09tdf#126173 RTF import: fix lost SHAPE fieldsMiklos Vajna1-1/+1
Commit 5a5d55a8a0f82406a8001015a723596f21d3562c (fdo#82860 RTF import: fix handling of SHAPE fields, 2014-10-15) already tried to handle this, but aCode is the shape command + its parameters (SHAPE \* MERGEFORMAT) for the bugdoc, while what we want is just the shape command. The field variable already contains a tokenized version, which was used previously only to decide if a field is unhandled or not. Reuse that for the shape comparison, so bugdoc's shape with parameters also appears. Change-Id: I7e044b94bcfab490c956b33c11dd6c69443939f5 Reviewed-on: https://gerrit.libreoffice.org/75243 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-05sw btlr writing mode: handle import from VMLMiklos Vajna3-16/+1
Instead of the character-level rotation added in commit 8738ded7bb1bb6262fe1038e310b5110407f4cfa (fdo#69636 VML import: handle mso-layout-flow-alt shape prop for sw frames, 2013-09-26) which does not work for multiple paragraphs. Change-Id: Ibe9a85d7f880846edfd1f4594c03b0617d83a965 Reviewed-on: https://gerrit.libreoffice.org/75104 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-02sw comments on frames: fix DOCX handlingMiklos Vajna1-0/+19
We used to ignore annotation marks which just cover the comment anchor since commit fff019debf14a0bf8cd358591a686191347f1542 (MSWordExportBase: ignore empty annotation marks, 2014-09-17), but this means comments on images are lost. Pass around SwWW8AttrIter, so we can decide if we have a relevant at-char anchored frame in MSWordExportBase::GetAnnotationMarks(), without iterating over all frames in the document, which would be slow for large documents. Regarding the import side, the only problem was that the empty comment range resulted in a loss of annotation marks; fix that by using a marker while inserting. Change-Id: I385677d74423bc05824dac4a12d1a991bb3983c4 Reviewed-on: https://gerrit.libreoffice.org/74996 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-06-26tdf#126114 - Form fields are displayed twice (double)Tamás Zolnai1-1/+1
We need to make sure that IsFieldResultAsString() returns true for drop-down field, to ignore the placeholder string. Change-Id: I127800bdff78eb68e000fdbfe433bc88181ac2c3 Reviewed-on: https://gerrit.libreoffice.org/74752 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-06-25improve loplugin:simplifyconstructNoel Grandin2-7/+4
Change-Id: If863d28c6db470faa0d22273020888d4219e069e Reviewed-on: https://gerrit.libreoffice.org/74559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>