summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)Author
2020-09-25tdf#134782 sw: split AddParaSpacingToTableCells flag in 2Michael Stahl
commit 3cccdabf19a99fd3f657985c1822436d7679df2b "extend AddParaSpacingToTableCells with line spacing" changed how the ADD_PARA_SPACING_TO_TABLE_CELLS compat flag works, to improve interop with Word. This commit splits out the change as a separate new compat flag ADD_PARA_LINE_SPACING_TO_TABLE_CELLS ("AddParaLineSpacingToTableCells"), to preserve compatibility with ODT documents that were produced by LO < 6.4 (via SwXMLImport::SetConfigurationSettings()). New documents and WW8/RTF/DOCX import have both flags enabled. The combination false/true is invalid, and treated as equivalent to false/false. Change-Id: Ida20df8fe4a8192a714f91da95345f9726fd7d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103317 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 38aa699f265c17548769aaa4f20e1ae35d18f202) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103359 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-08-31tdf#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> (cherry picked from commit c77b9c349f0a48392d8cb7a49532844b2cafb5ba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101560 Tested-by: Jenkins
2020-08-17tdf#128197: sw: different line height for DOCX with compat=14Vasily Melenchuk
Lines containing just a shape inline without any other text are treated in DOCX with compatibility option 15 and 14 in a different way: while compat=15 is layouting line exatly as LO does, in compat=14 mode minimal line height takes into account just shape height and not current font. Change-Id: Id2bdab941a0bbaa9080567d736435d9e0babd490 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96080 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100542
2020-08-17tdf#134043 DOCX import: new unit tests: ComboBox to DropDownThorsten Behrens
Change-Id: I034b0cd9c6f66c531460d1bb69d9ede5ff46f7d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97531 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99994 tdf#134572 DOCX: Incorrect default value in dropdown text fields Change-Id: I3169e817c2f033d1525adc3b02ac3680ad220d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99074 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100306
2020-07-30DOCX import: fix overlapping floating tables when anchored inside a tableMiklos Vajna
The WW8 import does the same in SwWW8ImplReader::StartTable(), now we're on par with that. (cherry picked from commit 6c82a9fa1da15d5f83f524f6897028906dda337e) Change-Id: I2ce0d96d255d8f405203f36a358559687b36e9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99777 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-23tdf#134400 RTF import: fix unexpected inner properties for picture-in-textframeMiklos Vajna
Regression from commit 4ab658b56f5c6ff0082d38d8ace1924d11e30e96 (RTF import: implement support for tables inside text frames, 2013-06-16), the problem was that both the outer "textbox" and the inner "picture frame" object had a shapeType property, and the properties were stored in a vector. So by the time RTFSdrImport::initShape() looked up the shape type for the inner shape, it thought it's not a picture frame, leading to data loss. (cherry picked from commit 5a083be34456e91427d0f2e2fea172f49f4502db) Change-Id: I4a536789371619d1d54afa8c8d41c7d273b0d21b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99118 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99167 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-11tdf#134260: docx import: allow default value for list tab positionVasily Melenchuk
It looks like previously used as a testcase document is just a specific case with default values. All other readers (incl. Office 365) displaying that doc with default tab at zero position. Change-Id: I50fe00c7f87b6d790fbe6e2f32a306ac59060c72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97089 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 7221994b9b29659d3290e95eee92b1a3f80c2b7e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98331 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 54b6a6a5c95ed51ce0cd709d9fd3e477ced5ce8f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98332 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98517 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-10tdf#134264 writerfilter: fix DOCX->DOC of ADDRESSBLOCK fieldMichael Stahl
... and other unsupported ones; the problem was that the field got exported with ww::eUNKNOWN = 1, which can't be imported again. Move the ww8 eField enum to include/ so it can be used from writerfilter. (regression from e511a0ca5dde6d731bb126bbfe21768867890102..d9030ad6298e2f49ee63489d6158ea6ad23c0111) Change-Id: I19193392d62fdf0bba01fac2516bafe9fdfa5a99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98221 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit ae2e8202407e82c9b14f0cc307742561f8c6e530) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98244 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98510 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-04tdf#134043 DOCX import: DropDown text field instead of ComboBox form controlSerge Krot
Change-Id: Ide9cedefde3b00fa0eeb37a6540e8d4a420b70c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96471 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96608
2020-06-15tdf#83309: docx import: allow for lists tabstop at zero positionVasily Melenchuk
Zero position is valid value for tabstop, but previously it was treated as "no tab stop defined". Right now writer distinguishes tab stop at zero postion and no tab stop. Change-Id: Ie32da3d36a263644ba85a882029a8b29ae0501c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95132 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit d2e428d1abb9f2907c0b87d55830e8742f8209b9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95561 (cherry picked from commit a380a06c1872091e8fa8c810e95a8e1d5dfe1820) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96178
2020-06-15tdf#128195 Keep spacing below last paragraph in header (docx)Samuel Mehrbrodt
Add a layout compat option to keep the spacing below the last paragraph in the header in doc/docx files (cherry picked from commit 9b5805d1ef2b9e9c4e8f389c069807bf4489ea95) Conflicts: sw/inc/IDocumentSettingAccess.hxx sw/source/core/doc/DocumentSettingManager.cxx sw/source/core/inc/DocumentSettingManager.hxx sw/source/core/layout/flowfrm.cxx sw/source/filter/ww8/ww8par.cxx sw/source/uibase/uno/SwXDocumentSettings.cxx writerfilter/source/dmapper/DomainMapper.cxx Change-Id: I259511183a8252e04d9951357dbdd4f4832523ec
2020-06-12tdf#120394: DOCX list import: simplify zero width space hackVasily Melenchuk
Since introducion of list format string hack with creation of zero-width-space can be much more simple. It was being used to indicate existing, but empty list label suffix to avoid stripping down numbering. Change-Id: I9a0c6047f806b2c656ef5dbab0c6b38200818bd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94383 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95346
2020-06-12tdf#132754: DOCX import: changed default list start nubmerVasily Melenchuk
Default value for list numbering startAt is zero. If it is not proveded numbering starts from this value. Change-Id: I2cf7be9063e7bfb8b72d6ba77fcd9507e33bb848 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93899 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit f8211e84a5239de25fe6dc45a4bb6b6f8673a1ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96048
2020-06-11tdf#120394: docx import: support for w:styleLinkVasily Melenchuk
Previous implementation for w:numStyleLink was referring just ordinal styles, but there can be another abstract list marked with w:styleLink which should be used in given context. Change-Id: Ic5d4fe8bfd41b19e2f65d74defb6961e38ec9a9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94332 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95892
2020-06-11tdf#132596 writerfilter: fix paste of RTF with header/footerMichael Stahl
The problem is that writerfilter inserts the content of header/footer into the body text, but then DomainMapper_Impl::PopPageHeaderFooter() calls RemoveLastParagraph() and deletes a body paragraph containing a fieldmark, and then in Undo some SwHistoryTextFieldmark can't find it, and since ffb26b81e1c7ff1d64959200247bb2edd5a569da this crashes. This is because of the borked error handling in DomainMapper_Impl::PushPageHeaderFooter(); the m_xBodyText->createTextCursorByRange() call throws an exception that is swallowed, so the m_aTextAppendStack doesn't have an entry containing the position in the header. To fix the error handling, set m_bDiscardHeaderFooter = false only when everything was successful. Also fix the call to be xText->createTextCursorByRange instead (this is a regression from 232ad2f2588beff50cb5c1f3b689c581ba317583). Then it turns out that Undo still crashes, because sw can't Undo changes of header/footer content, so just return early unless it's a new document. Change-Id: Ie5aeb45447c5fbd4b3ae15c4cffb9800583a6d1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95797 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 27151ccf2305eac4192f8c4ceeee267170096a19) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95824 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-06-02tdf#78352: docx import: allow tab at left indent for listVasily Melenchuk
Looks like first tab stop for list bullets is at left paragraph boundry. Luckely there is a compatibility option for this. Change-Id: Iea4bd2b51912746dbd4722ff61eeb2e9293cab31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94559 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94971
2020-05-20tdf#127778 DOCX import: fix unexpected heading on non-first page ...Miklos Vajna
... when the first page has a heading Regression from commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page header should always set default headers as well, 2014-11-21), the problem is around how to split a first + follow page style on import, and then do the opposite on export. This is described using a single section in OOXML, but Writer has 2 page styles for this (unlike in case of the DOC filter). This means the header margin has to be taken from one of these page styles. The above commit tweaked the import, so the follow page style has the wanted header margin, but this leads to incorrect layout. Fix the problem by tweaking the export instead: it has random access to the doc model, so it can take the header margin from the first page style if needed, and then the import side can be reverted, leading to correct layout. Also remove some leftover debug code in test/, which was added in commit 5352d45dd4a04f8f02cf7f6ad4169126d3b3586a (convert AnimationImport to fast-parser APIs, 2020-02-18). (cherry picked from commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport6.cxx Change-Id: I4bbf7271f3a437e8432399bd1e32e9d24190a501 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94193 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2020-05-20sw: add pad-to-5 numberingMiklos Vajna
This is the last padded numbering type that is supported by Word but was not supported by Writer. (cherry picked from commit 8540c7b18bae9c9b46e6feb7658198a7fc62e811) Change-Id: Ica1a0843897c61a4b569105fd21e5bfe7b5012cb
2020-05-20sw pad-to-4 numbering: add DOCX filterMiklos Vajna
Now that style::NumberingType::ARABIC_ZERO3 is already handled, this is much easier. (cherry picked from commit d7b6269bd5414ca0aa502a2fef7a838bcfbc1161) Change-Id: Ibe76d90253a5bfad84560395502590a380d559d2
2020-05-19sw pad-to-3 numbering: add DOCX filterMiklos Vajna
There is no NS_ooxml::LN_Value_ST_NumberFormat_foo code for this on the import side, rather the number format code is set to NS_ooxml::LN_Value_ST_NumberFormat_custom, then a separate NS_ooxml::LN_CT_NumFmt_format contains the number format string. Declare w14 as an XML namespace on the export side, even if we write no <w14:something> elements. This is needed by <mc:Choice Requires="w14">, which refers to an XML namespace in the OOXML markup. (Interestingly officeotron doesn't check for this, though.) (cherry picked from commit 52ed1091be05d5a07a021403095c52f0f3986ed6) Change-Id: If5fbcea4f163bd4d1a1ed820e15ceb61dc9c0519
2020-05-19DOCX import: tokenize <w:numFmt w:val="custom" w:format="...">Miklos Vajna
Which means CT_NumFmt has to be a property resource, not a single value, and also ST_NumberFormat needs to recognize "custom" as a valid value. Adapt the RTF tokenizer to emit the new token format. This is needed (but not enough) to support markup like this: <w:numFmt w:val="custom" w:format="001, 002, 003, ..."/> (cherry picked from commit 496197fe4dff2cd94ceeb42fc04d0263ac8d8971) Conflicts: writerfilter/source/dmapper/NumberingManager.cxx writerfilter/source/rtftok/rtfdispatchvalue.cxx Change-Id: I767e4b92fc41f9425f446d6eaad1d875e2233964
2020-05-17tdf#132514 DOCX import: fix lost table style with footerLászló Németh
Table paragraphs collected for table style processing were mixed when both body text and footer contain tables, i.e. clearing paragraph vector at processing the first table resulted missing paragraph vector and table style processing for the other one. (Note: only missing bottom paragraph margin and line spacing were the problems here, not all table style based paragraph settings, as in branch 'master'.) Now tables in footer, also nested tables collect their paragraphs in separated table paragraph vectors. Regression from commit 6c5da2cd7af5c2d90e4d8e9635ba8c9989c87923 (tdf#119054 DOCX: fix not table style based bottom margin). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93415 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 81ce88aa80f8e7cde4fdc5b211e9500a3599643c) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport6.cxx writerfilter/source/dmapper/DomainMapperTableHandler.cxx writerfilter/source/dmapper/DomainMapperTableManager.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/PropertyMap.hxx Change-Id: Ib8568d8379cfb7da869120cdc7fe12895252d661 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93525 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-05-15tdf#130494: DOCX import: limit paragraph-level character propertyLászló Németh
expansion for the whole table paragraph based on the last character context. regression from 2ab481b038b62b1ff576ac4d49d03c1798cd7f84 (tdf#90069 DOCX: fix character style of new table rows) (cherry picked from commit abb9c7db8bcc06f907d39a7811711882161d5803) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport11.cxx Change-Id: I49da23c268436488ff1537771869c38108113c12
2020-05-15tdf#128959 DOCX import: fix missing text lines in tablesLászló Németh
Orphan/widow line break settings aren't always ignored by Writer table layout code, in this case, in vertically merged cells, resulting missing paragraph lines. As a workaround for interoperability, disable orphan/widow control in cell paragraphs during the DOCX import to get correct layout in Writer, too. (cherry picked from commit 8b13da71aedd094de0d351a4bd5ad43fdb4bddde) Conflicts: sw/qa/extras/layout/layout.cxx Change-Id: I48fdb0a3bb421fd4df2c729e307a7ef483e3e772
2020-05-15tdf#90069 DOCX: fix character style of new table rowsLászló Németh
DOCX table import didn't set paragraph level character styles on paragraph level, only on text portions, resulting default character style in the newly inserted table rows instead of copying the style of the previous table row. (cherry picked from commit 2ab481b038b62b1ff576ac4d49d03c1798cd7f84) Conflicts: sw/qa/extras/uiwriter/uiwriter2.cxx Change-Id: Idb4438c767bdc7e0026fc6e0f0a795d8efdda3c8
2020-05-15DOCX export: fix interaction between the crop and the wrap polygon of imageMiklos Vajna
If the wrap polygon is influenced by crop at import time, we need to do the opposite at export time. Do this for RTF and DOCX, where there is matching import code in writerfilter/, leave DOC alone for now. Test this by changing testFdo76803 into an export test, then seeing how the first point's Y position fails and fixing up the exporter, so we get back the old good value. (cherry picked from commit c68b458514b35cae70c9a6630e06f46a867aa3b9) Change-Id: Ieef18aad3c76f7945c7348201b07bcb27a4cd48d
2020-05-15DOCX import: fix interaction between the crop and the wrap polygon of imagesMiklos Vajna
Word first applies the crop, then applies the wrap polygon on the remaining visible part of the image. Writer applies the crop on the original bitmap, and even has explicit code to make sure the uncropped bitmap is used for the wrap polygon, see how SwFlyFrame::GetContour() calls SwNoTextFrame::GetGrfArea(), which will extend the resulting size based on cropping. Fix the problem by moving and scaling the wrap polygon, so it ends up where it would in Word. Also adapt testFdo76803, which had a similar crop+wrap polygon case, but the different there is quite small. (cherry picked from commit 2abe9837deee3823c7928a76b5b2f94f1464f1a3) Conflicts: writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx Change-Id: Iab2adaa81a33eb04e1806b17ed129ac50f5d2aa3
2020-05-14DOCX import: declare w14 as a supported featureMiklos Vajna
This is needed (but not enough) to support markup like this: <mc:AlternateContent> <mc:Choice Requires="w14"> <w:numFmt w:val="custom" w:format="001, 002, 003, ..."/> </mc:Choice> <mc:Fallback> <w:numFmt w:val="decimal"/> </mc:Fallback> </mc:AlternateContent> Change-Id: I598b0452b5d29624ed0a6795682c29a09fd0dcfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90564 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-05-14sw padded numbering: add DOCX filterMiklos Vajna
DOCX uses <w:numFmt w:val="decimalZero"/> for this. (cherry picked from commit 5435ea2afc5da5633a440f2f06d79265bcbb040c) Change-Id: I12a4a88f472af42a04244d30f9e59fc0b8b4855c
2020-05-13tdf#94628: sw: allow setting for bullet for outline paragraphsVasily Melenchuk
Paragraphs in outline (having style "Header XXX") can also be a part of list and have custom bullets. Simplified code of SwXNumberingRules::SetPropertiesToNumFormat(): do not check for properties special for outline/chapters and removed redundant data shuffle with local maps. Change-Id: I1fa7f8f5359acee1d5aa62d9700641490bb91b6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93672 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94032
2020-05-13tdf#95189: docx import: apply list ovverride only onceVasily Melenchuk
List overrides should be applied only once on first list with override appearance in document. Next reference to this list should not override again and reset list numbering. Change-Id: I7a24398d5980ca97a74fa8ad09d91ac9adff15ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93894 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94031
2020-05-12sw: add DOCX import for semi-transparent textMiklos Vajna
This is one of the text effects properties, which is already grab-bagged. That is done in a generic way, so the easiest is to just read the value from the grab-bag, rather than from the dmapper tokens directly. (cherry picked from commit 3a749d7278bbe65cfc063e64460df8af6bc2af47) Conflicts: writerfilter/CppunitTest_writerfilter_dmapper.mk Change-Id: Id74a3eb0abddf745a9e4e59625bf9345f7df9dfe
2020-05-07DOCX import: don't touch the ZOrder of inline, in-shape objectsMiklos Vajna
1) This is not needed: Word only supports inline "anchoring" in textboxes. 2) If the textbox has a certain ZOrder, we don't want the inline shapes to be behind the textbox. 3) This allows restoring the old assert in sw_ooxmlexport7 that was changed in commit 99847d6b3005c5444ed5a46ca578c0e40149d77c (DOCX import: fix ZOrder of inline vs anchored shapes, 2020-02-12). (cherry picked from commit 70ae12fe0b9e33633fc62cf805c261ef51fb4b59) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport7.cxx Change-Id: I817e4fb70cb789e8eb116219050fc1aeaec76667
2020-05-07DOCX import: fix ZOrder of inline vs anchored shapesMiklos Vajna
Shapes which are anchored but are not in the background should be always on top of as-char anchored shapes in OOXML terms. Writer supports a custom ZOrder even for as-char shapes, so make sure that they are always behind anchored shapes. To avoid unnecessary work, make sure that when there are multiple inline shapes, we don't pointlessly reorder them (the old vs new style of the sorting controls exactly this, what happens when two shapes have the same ZOrder, and all inline shapes have a 0 ZOrder). Adapt a few tests that used ZOrder indexes to access shapes, but the intention was to just refer to a shape: fix the index and migrate to shape names where possible. (cherry picked from commit 99847d6b3005c5444ed5a46ca578c0e40149d77c) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport7.cxx writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx Change-Id: I670e4dc2acbd2a0c6d47fe964cb5e3f2300e6848
2020-05-06tdf#116883: sw: support for lists level format stringVasily Melenchuk
Multilevel lists are more flexible in case of DOCX. There is supported custom format for any level in DOCX unlike in LO and ODT where we are limited only with prefix and suffix for hardcoded list levels separated by dot. At the same time DOCX can have lists not only "1.2.3.4", but "1/2/3/4" or even "1!2>3)4" and such format can vary on each list level. Here is basic implementation for list format as a core feature for all documents and old way (prefix-suffix + ".") is left as fallback. Practically its usage is currently implemented only in DOCX import/export. Some RTF/OOXML unittests were redesigned: since we are not creating prefix/suffix for these formats conditions should be checked in a different way. Change-Id: I1ec58bcc5874d4fa19aee6a1f42bf1671d853b14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92106 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93125 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Change-Id: Ia8f066913a2565559d81f3caabeba24b29c09052 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93456
2020-05-06tdf#108496: DOCX: redesign of override in listsVasily Melenchuk
List level overrides are not just about numbering, it is about numbering restart. Thus some changes to DOCX import/export were added. Improved support for several lists referring the same abstract list, especially in situation when one list have overrides. In addition some export cleanup is made: less unnecessary list duplications, less level overrides when no properties were changed. Change-Id: Ic7a69bc2e3080b39f5205cb90b46d14247abf305 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92412 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Change-Id: I35937449bd563eacceb3753e62b9ff7245f12b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92739 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93455
2020-05-06sw from-bottom relative orientation: add DOCX filterMiklos Vajna
The OOXML equivalent is <wp:positionV relativeFrom="bottomMargin">, and the position is typically a negative number (i.e. the position is the offset between the top of the shape and the top of the top or bottom margin; not the distance and it's always the top of some margin). (cherry picked from commit fc620901ddd134f644a56ed4ea4a9b5446cc5675) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport14.cxx Change-Id: Ia979bc8bfaa37d29b0947c4408335e0a80c05880
2020-05-06DOCX import: fix margins of inline shapes with effects, imported as Draw shapesMiklos Vajna
Effects have an extent, and unhandled effects (like this blurred shadow) need to take space in the margin of the shape to make sure they use the correct amount of space in the layout. This was working in general, but not in case the importer decided to import the shape as Draw shape + the shape was inline. (And also disable a new CppunitTest_sw_uibase_shells test on Windows, which is only stable on Linux, it seems.) (cherry picked from commit bf25e69f8f657d5e3bcdd0bd54c5fa0d66ec85fe) Conflicts: writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx Change-Id: I9d0531d9393d8c2cd274e6f54bbbfe8024bf270f
2020-05-04DOCX import: improve support for headers/footers from cont sect breakMiklos Vajna
A continuous section break in a DOCX file can set new headers/footers which start appearing from the next page. In general, this is not something Writer supports, but commit 08f13ab85b5c65b5dc8adfa15918fb3e426fcc3c (tdf#112202 writerfilter,sw: fix loss of headers, 2019-12-16) improved the situation significantly here. Build on top of that and add support for a few more cases: 1) When checking for the last paragraph of the previous section, detect when that last paragraph is so small so in practice that's not the last one. 2) Handle when the text node in question has no explicit break type set, only a SwFormatPageDesc (which implicitly causes a page break). 3) When setting the page style to show the correct header/footer, don't set the page style on the previous paragraph directly, rather update the "next style" of the already set page style. (This is safe, as we never reuse the same Writer page style for multiple Word sections.) Change-Id: Iede196b864af5123c5637f82432ed6e0f7e7241a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86870 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit 9a50e8f2bcde95233e4b38707c521ada90fcd6af)
2020-05-04DOCX import: fix lost page break when footer ends with a tableMiklos Vajna
Regression from commit 7d3778e0ef9f54f3c8988f1b84d58e7002d6c625 (bnc#816593 DOCX import: ignore page breaks in tables, 2013-09-02), the page break was ignored because the preceding footer ended with a table (no empty paragraph at the end of the footer stream). Fix the problem by saving/loading the table state around header/footers, that way the page break is not ignored. Adjust testTdf102466 to test the page number from Word. (cherry picked from commit a86a2a1c1ceb7203857d4317913c5b1bb9feb4aa) Conflicts: writerfilter/CppunitTest_writerfilter_dmapper.mk writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx Change-Id: Ia4c22452ee2c37f7f941dfd922db04c851644d0c
2020-04-29DOCX import: handle <wp:positionH relativeFrom="insideMargin">Miklos Vajna
This is the same as page, but it is from-left on odd pages and from-right on even pages, i.e. our "mirror on even pages" mode. (cherry picked from commit fccbb557add457db16e0556c3f0172cafc2cf981) Conflicts: writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx Change-Id: I018e0ac165a3d802f64cfc314d5c5f58da3cb580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93003 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-04-28tdf#131446 DOCX import: restrict IncreasedAnchoredObjectSpacing furtherMiklos Vajna
Regression from commit 8b73bafbc18acb4dd8911d2f2de8158d98eb6144 (tdf#115719 DOCX import: increase paragraph spacing for anchored objects, 2018-02-14), this is another case where the workaround for the Word layout bug is not needed. tdf115719.docx and tdf115719b.docx are tweaked to have <wp:anchor ... behindDoc="1"> for 1 shape, as the original bugdoc has it. This allows us to render both the tdf#115719 and tdf#131446 bug documents the same way as Word does. (cherry picked from commit 249428202be04ab9a2271a9cd48922523fa03bc4) Change-Id: I0c3f197c3360882cd64f8dcf286c6051dc11d674 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92978 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2020-04-20tdf#132185: field command does not necessarily end with spaceMike Kaganski
Change-Id: I5a5e54fb42e20855b75af7ab523465a032ab46e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92504 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92444 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-04-14tdf#132001 DOCX import: fix crash: redline in floating tableLászló Németh
Copying redlines to frame text was failed in tables inside frames. Skip these redlines temporarily. Regression from commit e8bae67b3dbcc90ace8264b6b1aefaf0ce459aba (tdf#125894: DOCX: import tracked changes in frames). Change-Id: I4f3ca2e95fb2e7637f8cf8dca1088a7727bcf98d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91985 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 1350832be533ce6627607b1aaabd2b3565e6e7b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92015 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2020-04-08tdf#131594: switch line numbering off if w:countBy="0"Xisco Fauli
See https://bugs.documentfoundation.org/show_bug.cgi?id=131594#c0 for more info Change-Id: Ic57826eb5a440e83cea1d9bde5e9144727e3b6df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91141 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 910197b8cf9b653c1b39b35b73424a36b7c1d1ae) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91512 Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-03-25tdf#106843 docxexport: don't write double docProtectJustin Luth
regression from LO 6.4 commit 2756ed9317e3474003c11ffe7d1e2f087c1412bf Change-Id: Iaf32974c7282d11bcd9572ed75cf1233ad3f0008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90321 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit b2471b8ab62abaa7f0c2c8342b4fa61c18f013c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90953 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2020-03-25ofz#21168 sw,writerfilter: limit writerfilter hack to writerfilterCaolán McNamara
The problem is that at the end of WW8 import, a delete redline is inserted that ends up calling DeleteAndJoin from inside AppendRedline(). A fly is anchored AT_CHAR at (node 46, offset 0) and the deletion goes from (node 46, offset 0) to (node 48, offset 13) hence the special case check in IsDestroyFrameAnchoredAtChar() for the IsInReading() prevents it from being deleted, and then its anchor is still registered at the node 46 when it gets deleted. So try to restrict the WriterfilterHack to writerfilter, so it won't affect WW8 import. Unfortunately this is far less obvious than expected, because import can happen for creating a new file, in which case it's all done via UNO in writerfilter, or when inserting into an existing file, in which case SwReader::Read() is used. The SwDocShell's pMedium can't be used becuse in insert file case it will be the loaded file, not the inserted file. There isn't any obvious alternative to adding a silly UNO property for the writerfilter to use. Change-Id: Ia7fdc9bb1925202f6692ebee6e4b6b1fe50e5345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90384 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit c4dab726caaa73be9f9c731312080143b0a0b89d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90951
2020-03-04tdf#123873 DOCX IMPORT: fix unhandled textwrap for objectsBakos Attila
The OLE objects (in this case charts) had bad wrap option setting and this lead to misplaced objects. Now this parameter is set according to the file. Change-Id: I506be91b6801f0ffc3942e514f81119d895fdcb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88091 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org> (cherry picked from commit affe9c8384475fc85027703332bc0f1b36eaa0a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89908 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2020-02-24tdf#130817 RTF doesn't set custom footnote stateJan-Marek Glogowski
RTFDocumentImpl::dispatchDestination detects the custom footnote and even sets NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows in the character attributes of the context, but that is at least not handled in the DomainMapper later on, so we can't check for m_pImpl->IsInCustomFootnote() here. Change-Id: I26c02ea16d0e75ed5bfde0cda9e0c6a2d30261a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89240 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> (cherry picked from commit 38306ea92560c82b0d70bdc195267549a8bab830) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89143 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2020-02-24tdf#130814 preserve context before page breaksJan-Marek Glogowski
... and add a comment, so nobody tries to move these again. Change-Id: I79e6f7a1538d0839fd525870439facef3218ec65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89239 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> (cherry picked from commit 70a9c644c63248719f1f4248e288df7ee06635cc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89142 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>