summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)AuthorFilesLines
2021-03-26tdf#125936 writerfilter: treat escapement in numbering like stylesJustin Luth4-2/+13
deferCharacterProperties wasn't occurring in the numbering import (and so it was affecting the first run of the body text). But just like character styles, it would be better to just consider this auto-superscript instead of to defer it and calculate based on the fontsize - since that really isn't known until layout time, and so only works with direct formating. cherry-picked from 7.2's 2a7617653fb3d31e44e5cbcf8daf4b4c2a24e2c8 Change-Id: I9ce5a31c173089603316f4c3389e5f2e5dbe165a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112987 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113076
2021-03-11tdf#140597 DOCX import: fix missing tblPrEx borderLászló Németh1-1/+10
of first table cells, caused by the workaround for tdf#138612. Now property set of a new cell is a copy of the table exception property set of the table row, as needed for the import of the table style inheritance. Regression from commit f319d6b543c2367546bc80d138e56ed03731e265 (tdf#138612 DOCX import: fix lost part of split table cell). Change-Id: Iaf6637e757fbfeef7651a4300a7f65a23615f5c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112247 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 53884e8fe92597e909e4fa5599192783c3d31a56) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112225 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-03-01tdf#140137 Don't throw exception when w:gridCol is missing "w" attrAron Budea1-5/+13
2149e924cbc32c370128c5f87a4f55c50c99e6bd added a division-by-zero check, which caused Writer to throw an error on the bugdoc. Since the file could be loaded fine before, let's return to a working version, with the check included. The cause is the following in document.xml (originating from a non-MS generator): <w:tblGrid> <w:gridCol/> <w:gridCol/> </w:tblGrid> Word still splits such tables differently, but that difference was always there in Writer. Change-Id: I6d91a736f460394a76f035298a238c41da201cb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111723 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111736 Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111741
2021-01-16tdf#116394 writerfilter: append '=' if not a formula markerJustin Luth1-0/+2
Oops - a silly mistake to throw away the character if it didn't match a special purpose. There is no point in adding a unit test for this. Change-Id: I3b48af578ae96744405ec0919ff341d1c9b43f65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109426 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> (cherry picked from commit b232b422a3cfe3b410bbc75e0fffdfc238fd10e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109398 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-12-16tdf#138892 writerfilter: cancel style list if bNoNumberingJustin Luth4-8/+10
This fixes 6.1 regression from tdf#95377's commit e24e2d2fb02239753c1520a0458b44683ea4cc2e. Starting in 7.0 (tdf#131321), paragraph styles kept their numbering property. But even before that, non-paragraphs marked by bNoNumbering were having their direct numbering removed, and then finishParagraph applied para-style numbering since there was no direct numbering. So, we need to pass the bNoNumbering to finishParagraph so that it can cancel out a style-assigned numbering. Change-Id: I0c24af4e9bd0ea3712179a47ed3550f91c8f44b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107738 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> (cherry picked from commit bfcd952dc7820c4cf8761c4222d29ede039391dc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107795 (cherry picked from commit e901ffcb93d217f2cc09021a3b2fecb36f9884f6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107796 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Justin Luth <justin_luth@sil.org>
2020-12-11tdf#135217 DOCX import: remove no longer needed top/bottom margin syncMiklos Vajna3-9/+24
Regression from commit b7ae863efeb082816cc4fe660527a9650d90e186 (tdf#117503 DOCX import: fix out of sync first/later top margin, 2018-05-28), which adjusted the import so that the export can pair first/follow page styles and write them into a single Word section. But changing the import for pairing purposes is not a good idea after all, as it also affects the layout of the imported document. In the meantime, commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2 (tdf#127778 DOCX import: fix unexpected heading on non-first page when the first page has a heading, 2020-05-11) already fixed the export side, so this is not even necessary, just remove it. (cherry picked from commit 29993781ac991e85bfbd61f9e076c9d8088cd3ab) Change-Id: I94c02517ae1e0804547f81c43bb5890327d32376 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107400 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit d6674aaa23b34af702681beb4c0f219e6f50069c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107387 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-12-11negative return passed to parameter that cannot be negativeCaolán McNamara1-1/+2
Change-Id: I4b39a2130e961c6f2ca97695e4625df5a95e00b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107461 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-12-07tdf#138612 DOCX import: fix lost part of split table cellLászló Németh1-3/+0
by removing unnecessary rewriting of cell properties during import of w:tblPrEx. Regression from commit da8ea444b004a0be36964ae9a778f73e752b2673 (tdf#133455 DOCX import: fix table border regression) Change-Id: I93ce36991437644db439c8cf02e1a8503fbdfba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107239 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit f319d6b543c2367546bc80d138e56ed03731e265) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107304 (cherry picked from commit 2c4806d6b8d79c1b95a41b72d295888bca01d5d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107305 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-11-23tdf#138210 check if CustomShapeGeometry exist first.Mark Hung1-39/+35
CustomShapeGeometry does not exist for a text frame. Getting the property throws an Exception and cause a general IO error. Change-Id: I0e31780292d45211bfd1250d0d359c72def50583 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105834 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com> (cherry picked from commit 8c14adfa76956e76bac98330ce67f080c90af184) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106237 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-11-10tdf#137698 DOCX import: fix <w:spacing w:before="..."/> for more than 58cmMiklos Vajna4-1/+87
Regression from commit af313fc149f80adb0f1680ca20e19745ccb7fede (tdf#105143 DOCX import: enable DoNotCaptureDrawObjsOnPage layout compat option, 2017-01-06), this now uncovered a deeper problem that paragraph top margin import goes through ConversionHelper::convertTwipToMM100(), which ignores values larger than 0x8000. Previously this problem was not visible as we (incorrectly) captured draw objects inside the page frame. Word does not ignore values larger than that constant for paragraphs, so fix the problem by using convertTwipToMm100() directly to just do the conversion, without any checks on the input. And now that the paragraph margin is not lost, it'll have the correct horizontal position, so the position of the triangle in the bugdoc will be correct, too. (cherry picked from commit 0afba07a597bf1d361624e10968855a802b859a0) Change-Id: If664ad055f1916b7e7fb2fb85d1afa977c2d03aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105513 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-10-30tdf#137643 alternative solution to activate embedded fonts in one batchCaolán McNamara2-5/+21
Change-Id: Ib5ffb2b8a31f237d5d2e465bf3f777590e0bfade Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104957 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-10-27tdf#137593 DOCX import: fix para top margin in cells with shapesLászló Németh1-1/+2
and text boxes. Auto top margin value of the first table cell paragraph is zero. Paragraphs of shapes and text boxes anchored to this cell paragraph don't matter here, so keep m_bFirstParagraphInCell=true in shapes and text box paragraphs to avoid extra top margin of the anchoring point. Regression from commit 5c6bce38a01b21403a603acd3148cf3bbb4c685f (tdf#104354 DOCX import: fix paragraph auto spacing in tables). Change-Id: I22c4ae230bc0192f06d3d155217887c471c67b67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104816 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 41e230e81b50235b5b86f883ef424a8ba5b42288) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104828 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-10-22tdf#137085 writerfilter: RTF import: \trpaddfl and \trpaddl are row...Michael Stahl1-0/+10
...properties, not cell properties. What is supposed to happen here, afaict: 1. \trpaddfr3 either has an effect on the left margin too (despite being defined for right), or \trpaddfl3 is the default, 0 is not the default 2. \trgaph600 should be ignored if the \trpaddfl3 is in effect 3. \trpaddl0 should be in effect, overriding both the value from \trgaph600 and the built-in default of #define DEF_BORDER_DIST 190 CellMarginHandler::lcl_sprm() needs to distinguish between \trpaddfl0 and \trpaddfl3 cases, but its not possible currently because a) \trpaddfl is processed after \trgaph/\trpaddl, and b) both \trgaph and \trpaddl produce the same srpm-id. This fixes \trpaddl handling just enough to import the bugdoc properly, for more fixing a new sprm-id for \trgaph would be needed at least. At the other end, there is a line in DomainMapperTableHandler.cxx: m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf ) ... but nothing that would initialize the GAP_HALF there. That this bugdoc looked right before commit c2a5346b19c57f93f210b76c15cdba64f6871203 appears to be entirely accidental. Change-Id: I80dc34bdd5dadb7d7d7f5ec595907035d621a656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104638 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit fc872146845e4d77ff404d0929f28abf2d3a1c51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104604 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-10-14tdf#137180 RTF import: fix bad left margin with direct format/para style/numMiklos Vajna6-12/+130
This is a case when a left margin appears as direct formatting on a paragraph, the paragraph has a style and the style has the same left margin. But the paragraph has a numbering as well: so it's not valid to deduplicate the left margin from the direct formatting, because then the left margin from the numbering will be used, which can be a different value. (cherry picked from commit 3ee3ae85de3a29ebfb89e75960b65417bfd6ca55) Conflicts: writerfilter/source/rtftok/rtfsprm.cxx Change-Id: I5e27502b8d505bdfddfdc910858f62e501db35a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104224 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-10-01tdf#134784 DOCX import: fix shape paragraph marginsLászló Németh1-1/+6
based on bad style inheritance. Regression from commit dc0300eac3b755bc207cd1fe87217f4ebaeb9f58 (tdf#118521 DOCX import: fix paragraph margin from paragraph style), revealing the problematic m_sCurrentParaStyleName, see also commit 8920d865ee148518bf71f71ce1866b24cc17c07e for more information. Change-Id: Icc7f70452d946d56dc840d39545d850f74f97ebc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102774 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit c04ee66c7cfeb725d637b0f9ec3e3b1f8776bfe9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103585 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-09-25tdf#134782 sw: split AddParaSpacingToTableCells flag in 2Michael Stahl1-0/+1
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/+/103331 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-09-21tdf#136445 writerfilter: RTF import: buffer annotations inside tablesMichael Stahl2-2/+22
The problem is that one of the annotations is inside a table that happens to start with a covered cell (vertically merged). The table row is buffered, but the annotation is not, so it is inserted before any of the text of the table cells is inserted, so it ends up in the covered cell. The strucuture of annotations is a bit icky; to fix this, buffer both the \annotation destination and \atrfstart \atrfend start and end destinations. Change-Id: Ie955a75a2d254f8d7e965259698b688eece7cbd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103016 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 54bd2266d6e0c8926ecaf0fbb2dbb5ee9d1a802d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103050 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Miklos Vajna <vmiklos@collabora.com>
2020-09-16tdf#131537 DOCX export: fix OLE "Display as icon"Daniel Arato (NISZ)1-2/+2
for example to avoid converting OLE icons of an ODF document to an icon-size embedded spreadsheet. When creating a new OLE object in Writer the user has an option called "Display as icon" which causes the actual contents of the OLE to be hidden when rendered in the document. This setting, referred to internally as the DrawAspect of the object, was imported fine, but when exported to a .docx it always had the value "Content" (corresponding to "Display as icon" being unchecked). Now OLE objects with "Display as icon" checked are saved with DrawAspect="Icon". A grab bag entry was previously used to let the DrawAspect setting flow through Writer from OOXML import to export. Now this workaround is no longer needed and is removed by the present commit. Change-Id: I46ea4fc95a26bcd1f85e19a506c0965f73d4257a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101711 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 07dcb0dab759d4ab535d99c0e6d326959906b87e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102652 Reviewed-by: Dániel Arató <arato.daniel@nisz.hu> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
2020-09-15tdf#135665 DOCX: import tight wrap setting of VML shapesDaniel Arato (NISZ)1-8/+9
The wrap setting that OOXML calls "tight" and LibreOffice calls "contour" (== true) was not supported by the import code, only the export. Change-Id: I48739ffaad48e28df05fd87a9b51a14238dc47e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101932 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 4b7ee7bd61f78be60211cc72ba36da987191266e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102124 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-09-15tdf#132483: DOCX import: fix OLE anchoring positionBakos Attila1-1/+3
The relative orientation of OLE objects was not copied from the replacement object to OLE, resulting bad position. Co-authored-by: Attila Bánhegyi (NISZ) Change-Id: If62124e5a40218a224e047efbe86a09606b44af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98493 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 54031e6a2912ebe723b4423b5d737c13c9bb03c5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102565 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-09-08tdf#112342 DOCX import: fix page break before image-only paragraphsAttila Bakos1-1/+7
Picture anchored to an empty paragraphs was moved to the previous page, because the deferred page wasn't handled here. Change-Id: I4a694dd443ca8b67c4addbcba3523bffecd21418 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99763 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit e520a4f988bf0ff81e75e37588182af92fed7631) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100945 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-09-08tdf#120760 DOCX shape import: fix Z-order with behindDocSzabolcs Toth1-4/+13
DrawingML attribute relativeHeight contains z-indices for shape Z-order, but this depends on behindDoc, too. We can use z-index = relativeHeight - MAX_INT32 on shapes with behindDoc=true, as a simple workaround to get correct Z-order, because unsigned relativeHeight values stored in sal_Int32, and MIN_INT32 <= -MAX_INT32, and the temporary negative z-indices will converted by GraphicZOrderHelper. Note: this commit doesn't fix the old writerfilter implementation problem, that DOCX relativeHeight is an unsignedInt value according to W3C XML Schema, i.e. its maximal value is 4294967295 (MAX_UINT32), not 2147483647 (MAX_INT32). Co-authored-by: Balázs Regényi Change-Id: I54a72a95bc69b307b2835636fff376b0aa9bc45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96614 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 6479096dc2bd40215ff80273b4d27cadb2688cb1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100947 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-09-02tdf133647 tdf123386 tdf123389 fix DOCX table formula exportLászló Németh4-3/+15
Keep original DOCX table formula during round-trip using grab-bagging. This is a temporary solution until fixing formula export and a proposed solution for formula cannot be converted. Follow-up of commit 68e74bdf63e992666016c790e8e4cfd5b28d6abe (tdf133647 tdf123386 tdf123389 Improved .docx table formula import). Change-Id: Ia4759e250c06e9cc0495fb0b57fccd1ee1f50da9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100872 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101758
2020-08-31tdf133647 tdf123386 tdf123389 Improved .docx table formula importMichael Warner5-3/+95
Converts table formula syntax from MS Word to LibreOffice. This version uses the list separator of the document for the formula regexen; however, it does not convert the decimal or list separators in the case where the person opening the document is using a different locale from the author. Change-Id: I9600a0bea060a76705a7ad6b051ed4fdd50b9d40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98614 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 68e74bdf63e992666016c790e8e4cfd5b28d6abe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101676 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-08-28tdf#131801: sw: support of style references in ListAutoFormatVasily Melenchuk1-3/+1
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/+/101559 Tested-by: Jenkins
2020-08-10tdf#134572 DOCX: Incorrect default value in dropdown text fieldsSerge Krot1-0/+9
Change-Id: I3169e817c2f033d1525adc3b02ac3680ad220d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99074 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 89b6b2dbb728abea2186ff1ae158c0adb67d05be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100216 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-07-30tdf#134610 sw: fix incorrect position of math object from DOCXMiklos Vajna1-2/+2
Regression from commit a2f85c062aafb3fd9dfb1c6c6e87e1e73e7545a3 (tdf#130362 sw: fix anchoring of inline math objects, 2020-02-04), the problem was that the SwFlyFrameAttrMgr ctor wanted to set the anchor type to at-char, and then later DocumentContentOperationsManager::InsertEmbObject() wanted to undo that for math objects, but this did not play nicely with objects imported from DOCX. So don't set and clear the anchor type, rather set it conditionally in the first place. This allows setting the anchor type in writerfilter/ before insertion, and then all of 1) docx import (depends) 2) insert of Math objects (as-char) 3) insert of images (at-char) are working. (cherry picked from commit 383f39493c0ca3e11c296fa37e7d9cf679065f74) Change-Id: I94d82c12f30d069426db1bab70c456cadf1c91ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99661 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-07-22tdf#134648 DOCX import: fix bottom auto margin of subitemLászló Németh1-0/+10
If style based spacing was set to auto in the previous list item, style of the actual paragraph must be the same to guarantee the same auto setting. Regression from commit 9cca15204af9cc44a8a9528ccf2f36616fb70e69 (tdf#133052: DOCX import: fix top auto margin of subitems). Change-Id: I39d2bad03a659a407b52550768b010cfa716d363 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99096 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 1c3eb7e329cd2eaeb83068907ba0c9a5b3ef7852) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99195 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-07-21tdf#134400 RTF import: fix unexpected inner properties for picture-in-textframeMiklos Vajna5-0/+155
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>
2020-07-16tdf#133863 tdf#133864 DOCX shape import: width relative to insideRegényi Balázs1-0/+2
and outside margins. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386 (tdf#133070 DOCX import: fix shape height relative to bottom page margin) commit 330ed8120e9881656716d70d87b9f49f861f0bfa (tdf#133670 DOCX import: fix shape width relative to right margin) commit 7380905abc0833d9e4c4fe731d76174db8a8724c (tdf#132976 DOCX import: fix shape width relative to left margin) Co-authored-by: Szabolcs Tóth Change-Id: If81b7c80732141be1491ca82770cf6eee99f5656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97627 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit d63321d949563759ee2ada96fdc2e0f8728941b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98832 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2020-07-16tdf#133070 DOCX import: fix shape height relative to bottom page marginRegényi Balázs1-0/+7
using UNO API RelativeHeightRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Szabolcs Tóth Change-Id: I31db99fac5ad24971fa427671198b47906e9c057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95451 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98831 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-07-09cid#1465231 Improper user of negative valueCaolán McNamara1-2/+2
Change-Id: I984ae1103152a396cd157c3721a3739455b95997 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98345 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-08tdf#134260: docx import: allow default value for list tab positionVasily Melenchuk1-0/+2
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>
2020-07-07tdf#134264 writerfilter: fix DOCX->DOC of ADDRESSBLOCK fieldMichael Stahl1-3/+109
... 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/+/98086 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-02tdf#133735 DOCX: fix paragraph settings of nested tablesLászló Németh1-0/+3
First row of a nested tables lost its paragraph settings, by dropping the collected paragraph data of the unfinished row. Regression from commit 81ce88aa80f8e7cde4fdc5b211e9500a3599643c (tdf#132514 DOCX import: fix lost table style with footer) Change-Id: I17d81d0906f424fe35237ac285e8ad27090bcab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97645 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 8b5be44b30119b67d7b3ca9c4140046976a1df59) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97790 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2020-06-26tdf#133670 DOCX import: fix shape width relative to right marginSzabolcs Toth1-0/+8
using UNO API RelativeWidthRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Balázs Regényi Change-Id: Ic5d25701d46cdace6502ec55dbc0e5f0ebd7742b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95582 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 330ed8120e9881656716d70d87b9f49f861f0bfa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97067 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2020-06-25tdf#128197: sw: different line height for DOCX with compat=14Vasily Melenchuk1-0/+8
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> (cherry picked from commit ee7b6c773eb22268fefee4bfcc10110b0bbbd8cf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97066 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2020-06-25tdf#132976 DOCX import: fix shape width relative to left marginSzabolcs Toth1-0/+10
using UNO API RelativeWidthRelation and the associated lo-ext attribute for OpenDocument export. See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4 (offapi: document the 4 new properties which are no longer read-only). Co-authored-by: Balázs Regényi Change-Id: I2dada8ad764a1fba33d241117cc4bc5eddae74ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95525 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 7380905abc0833d9e4c4fe731d76174db8a8724c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96998 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-06-24tdf#76817 DOCX: fix round-tripped outline numberingLászló Németh1-2/+8
Fix automatic chapter numbering in DOCX documents created by Writer. Follow-up of commit de1b634a151c198584dc152676183f519c50a2da (tdf#76817: DOCX import: fix custom chapter numbering). Change-Id: I331b7dcf67efdf63b376122ec4da0a2e85bea761 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96529 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit d0cdeb78e9077320011ebe87cabd179b1029e1ea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96509 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-06-24tdf#108505 DOCX: fix legacy dropdown fields direct font settingGabor Kelemen1-4/+9
if it is at the beginning of the paragraph. See also commit 22ad4d69d771708f28a2d9e137cfd43ac846cf3a (tdf#121045 DOCX import: fix checkbox size in table). Change-Id: Ic4d4fc56cf031cc941c3f81930c6eba497090cba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91540 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit face27179d882cfbec368e2bed5f65276a5ce963) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96697 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2020-06-23tdf#134043 DOCX import: DropDown text field instead of ComboBox form controlSerge Krot1-14/+46
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/+/96729
2020-06-17tdf#133605: docx import: use ilvl value for list level importVasily Melenchuk2-13/+12
Previous implementation was not aware about ilvl value which declares a level number it is defining. So LO was able correctly handle only lists were levels are defined in increasing order starting from zero. Same problem was also with override lists: if we just override only one some random level (for example ilvl=2 in bugdoc) it was applied to level 0. Change-Id: If1f466fcbae0c82a8601e5b638e541d75aab665c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96268 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 408f2a1c09a6563caf193384df8e1cac6e153fbb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96422 Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
2020-06-16tdf#76817: DOCX import: fix custom chapter numberingLászló Németh3-1/+11
When one of the parents of the default Heading style has got custom paragraph style instead of the default Heading 1 – Heading 10, apply direct numbering again to avoid bad or missing numbering. Change-Id: I7e94600b5ac2cbf593a95eda6c0d6cd9d731dd75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96199 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit de1b634a151c198584dc152676183f519c50a2da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96212 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-06-16tdf#76817: DOCX import: fix chapter numberingLászló Németh1-5/+9
Imported headings got also redundant custom direct numbering, resulting broken automatic chapter numbering: applying standard Heading styles on paragraphs using the associated toolbar menu, Manage Styles dialog window or Ctrl-1–Ctrl-4 shortcut keys, it didn't result continuous numbering. Co-authored-by: Justin Luth <justin_luth@sil.org> Change-Id: Ic1ba5070fa4c387ad527aec05234a4da90fab751 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96198 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 2128d59ab91da853652305390d56b3287bcb67b1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96211 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-06-15tdf#128195 Keep spacing below last paragraph in header (docx)Samuel Mehrbrodt1-0/+2
Add a layout compat option to keep the spacing below the last paragraph in the header in doc/docx files Change-Id: I259511183a8252e04d9951357dbdd4f4832523ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94577 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 9b5805d1ef2b9e9c4e8f389c069807bf4489ea95) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96336
2020-06-12tdf#133457 DOCX import: fix frame position regressionTibor Nagy1-3/+14
caused by commit f5636817e7677a3081263df9004940a7d5ac54af (tdf#112287 DOCX frame import: fix default vAnchor). Co-authored-by: Attila Bakos (NISZ) Change-Id: I6fe16ff274d6a2fa4a335c7790ecd0f01641a6fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95035 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 5e8761ef902a8d5d6534b7c1803242bacff72be3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95977 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-06-09tdf#132596 writerfilter: fix paste of RTF with header/footerMichael Stahl1-5/+11
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 7a5afa492a7233b36165b3aba2774a1b03cdefc6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95823
2020-06-09tdf#133455 DOCX import: fix table border regressionLászló Németh5-39/+64
caused by commit 8ffc1299ebf83450e67cf2a89304859e2558cd27 (tdf#95033 DOCX import: apply tblPrEx table border). Change-Id: Ief4da3bce3282b5dab1ce4dabb4e075efcc1abaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95504 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 3593dd550882783b5f776262e928fc058c4dbd9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95550 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-06-06tdf#83309: docx import: allow for lists tabstop at zero positionVasily Melenchuk2-4/+3
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
2020-06-05tdf#120394: DOCX list import: simplify zero width space hackVasily Melenchuk1-37/+7
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> (cherry picked from commit 8401181bf0232959efb516802abcda42377ea06e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95315