summaryrefslogtreecommitdiff
path: root/writerfilter
AgeCommit message (Collapse)Author
2023-11-19Extended loplugin:ostr: writerfilterStephan Bergmann
Change-Id: I83bdd43357d07bce18a2cf286e639c816846e7d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159665 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-16writerfilter: fix utext()'s dumb sal_uInt8* parameterMichael Stahl
This removes all but 4 reinterpret_cast in the module! TableManager::utext() even assumed that the bytes are little-endian. Change-Id: I12031336cabedfd6c0fb614ee0e3400810f98e2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159486 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-16writerfilter: remove DomainMapper::text() handling of paragraph breakMichael Stahl
Convert all remaining callers to utext(). Change-Id: Ie1fdf22e9e474289df2c72eadc236ec6b270df4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159485 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-16tdf#153194 writerfilter: RTF import: testContSectionPageBreak last paraMichael Stahl
For testContSectionPageBreak, Word inserts an additional empty paragraph at the end of the document that was missing in Writer. Ensure markLastSectionGroup() is always called at the end of the document so that the \par that is dispatched in m_bNeedPar case will be inserted and not automatically removed immediately. Also add a test for the same document without \sbknone, which has 4 pages instead of 2. Change-Id: Ib3e4fbdb66df55941e4a487d4b249cd98fe42008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159472 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-16writerfilter: DomainMapper: fix undetected merge conflictMichael Stahl
... between commit fce18155052821756466ea043c638f4ed72f41d6 and commit 15b886f460919ea3dce425a621dc017c2992a96b - move the code from lcl_text() to lcl_utext(). Change-Id: Iaa515d2ebd9861e24b442b0d7b41f83662ed58df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159501 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-16tdf#153194 writerfilter: RTF import: \spltpgparMichael Stahl
1. Some experimenting with the bugdoc (saving it to DOCX in Word changes the layout in Word to exactly what Writer imports from RTF!) leads to DOCX w:splitPgBreakAndParaMark setting. 2. the RTF implementation of \spltpgpar was missing; apparently if the flag is present the "new" behavior is in effect, which is the opposite of how it's specified in RTF Spec 1.9.1. 3. the DomainMapper code that uses this attribute is not in the text() function to which RTFDocumentImpl sends paragraph breaks, but in the utext() function, so send the break there instead, rather than creating even more copypasta. 4. now some filters-text crashes with nullptr pContext in DomainMapper::lcl_utext(), avoid that. 5. dispatchSymbol(m_nResetBreakOnSectBreak) doesn't do anything because these are handled by dispatchFlag(). 6. Test name: testFdo81892::Load_Verify_Reload_Verify equality assertion failed - Expected: Performance - Actual : Fails because additional paragraph break inserted after \page; in dispatchSymbol() for \sect, remove the parBreak() as already hinted at in commit 3c610336a58f644525d5e4d2566c35eee6f7a618 7. rtfimport.cxx:868:Assertion Test name: testContSectionPageBreak::TestBody equality assertion failed - Expected: - Actual : THIRD It has no paragraph between SECOND and THIRD, whereas Word definitely shows a paragraph there. In dispatchSymbol() for \sect, sectBreak() is not called (which may create a paragraph break); in m_bIgnoreNextContSectBreak case this needs to be done manually for cont-section-pagebreak.rtf to get the empty paragraph between SECOND and THIRD. 8. testFdo52052 fails; in dispatchSymbol() for \sect, if the document ends with \sect (e.g. fdo52052.rtf) a paragraph break must be inserted after this (because DomainMapper unconditionally removes the last paragraph break), but not via m_bNeedCr as that creates unwanted page break in testNestedTable (m_bNeedCr => dispatchSymbol(\par) => m_bNeedSect => sectBreak()); handle it in RTFDocumentImpl::popState() for the end of the document by dispatching \par. 9. rtfimport.cxx:1519:Assertion testTdf108947 now has 1 empty paragraph in the header instead of 2; Word also shows only 1 so it's an improvement. 10. Test name: testFdo49893_2::Load_Verify_Reload_Verify equality assertion failed - Expected: 1 - Actual : 0 - xpath should match exactly 1 node This was reduced to only 2 pages, while Word shows 5; in dispatchSymbol() for \page, for the consecutive \page send an empty string to DomainMapper's utext() which causes a paragraph break to be created if \spltpgpar isn't set (this was not at all obvious!). 11. testTdf133437 fails with some numbers of flys changing, but it had those values before commit 3c610336a58f644525d5e4d2566c35eee6f7a618 which says "the exact number isn't that interesting". 12. testTdf153613_anchoredAfterPgBreak4 fails, but it now looks as in Word, so this is a bugfix. 13. Jenkins build on WNT (only) crashes in testForcepoint93 in sw layout code - disable test for now, debug asap. Change-Id: Ia1063693d96adff900ece943020a5bf69bdeb7a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159471 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-11-15Import Wordprocessing Canvas, wpc:wpc elementRegina Henschel
Currently LibreOffice uses the VML fallback, when a docx document has a wpc:wpc element. This patch implements to use the choice part with the wpc:wpc element. That is often called 'drawing canvas'. The patch uses a similar approach as for SmartArt. The drawing canvas is imported as group shape and for the background an additional rectangular shape is inserted as first in the children vector. Not using VML has the advantage, that the custom shape import is used for preset shapes. VML import produces problems because some properties are not available in VML or the current VML import has deficits. The test suite shows examples, what is better without using the VML fallback. Affected bug reports are e.g. tdf#104671 or tdf#154828. A drawing canvas must be used in Word for connector shapes. A connector in Word on the drawing canvas is not written as cxnSp element, but as ordinary wsp element with additional wps:cNvCnPr child element. The patch generates a connector in such case. Unsolved problems: The path of a curved connector in OOXML is basically incompatible to the path which LibreOffice generates. This patch uses the default path for a curved connector. Same is done in import in Impress. Using the VML fallback had generated a custom shape with the current path and handles, but the connections to the target shapes were lost. Export to docx is missing. The drawing canvas is not recreated, instead a group with the additional background shape is exported. That is no regression, using VML has produced a group too on export. I don't know whether XML_graphicFrame can occur in WordprocessingCanvasContext. At least charts and math equations are not possible on the drawing canvas in Word. Import of WordArt shapes does not work. That is not regression. It works neither in the VML import. Change-Id: I04bf8407efd1939cdf3137775f8afad420b74014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156629 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-11-15writerfilter: avoid double map lookup in RTFDocumentImplMiklos Vajna
It's not much more code and is faster. Change-Id: I7ed6b80890dce5cb18555e6c66f7b02c49abcde2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159425 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-11-10tdf#158044 handling of paragraph attributes in RTF importOliver Specht
style attributes need to be repeated at the paragraph if not repeated then defaults have to be applied Change-Id: I4ee567e8006c240c046b7e7bb75eae92e5563776 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158839 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-11-10tdf#153178 writerfilter: do not create text frame spuriouslyMichael Stahl
There are different RTF keywords that end up in RTFFrame, and some of them cause Word to create a frame, while others don't. Getting this right requires implementing support for all the missing wrapping keywords, as most of them create a frame in Word but \wrapdefault does not. Change-Id: I1e55d15180564f3d66a5ee7d98274ae18f032872 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159228 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-10-30Enable STYLEREF flag export/import with OOXMLSkyler Grey
This commit enables exporting the following STYLEREF flags with OOXML - Search from bottom to top - Hide non numerical After this commit, the following steps have been implemented - The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19) - The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19) - The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19) - UNO - DOCX filter Change-Id: Ib664fec059aa1f7f130acc76c253d5d298fa59f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158350 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-29tdf#157663 SW: Tracked change improve moveAttila Szűcs
Made accept/reject handle move redlines other pair, (moveto-movefrom) and handle the whole move redline, even if it is split into small pieces that separated from each other. Added unique ID to every move redline to help find their other parts. This move ID is generated in case of: move recognition moveing a paragraph. (directly create move redline with unique id without calling the recognition it is faster and more stable) (there are other cases that could be improved to not use recognition, but generate ID directly, like moveing selected partial text with mouse) Implemented the odt export/import of this move ID. it is a tag like this: "<loext:move-id>4</loext:move-id>" next to creator/date Improved the docx import to generate this move ID, so move redlines can find their other parts (Not changed Docx export... it works a bit, but far from perfect) Improved move reckognition: It can find them even if they are split into multiple parts differently. (like "ab"+"cd" == "a"+"bcd") Disabled this because of probably performance issue. made a complex unit test for it. Note: Left the move recognition on every place, to avoid as much regressions as possible.. but in the future, we may can disable it in some cases. Note2: We will have to keep move recognitnion, because there are documents from past, saved without any move informations in the file, and users expect to see move redlines there. (generated by the recognition.) Change-Id: If968d4235b676c5e538cfaf4187a4482a86eae9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157740 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158611 Tested-by: Jenkins
2023-10-27sw floattable: fix nullptr deref in TableManager::endLevel()Miklos Vajna
This is never an empty reference in the interesting use-case, so just make sure we don't crash. Reported to be a regression from 2d43c34333076fad092f0cdc0f60f81580acdbee (Related: tdf#55160 sw floattable, nested DOCX imp: fix inner tbl at cell start, 2023-09-15). See <https://crashreport.libreoffice.org/stats/signature/writerfilter::dmapper::TableManager::endLevel()>, e.g. <https://crashreport.libreoffice.org/stats/crash_details/84c2a273-49a3-4e62-9cfe-5cd620767749>. Change-Id: I4cd9c35ae3813a67d13d9b9e60f0dd6058f510c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158508 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-10-25tdf#155682 sw floattable: fix DOCX with big pictures causes endless loopMiklos Vajna
The bugdoc had a floating table in the header that overlapped with full-page, as-char anchored images in the body text, leading to a layout loop. The trouble is that the body text was broken into 2 lines: the first line just had fly portions for the area where the in-header floating table was rendered and then the second line hosted the actual image. But then this image didn't fit the remaining space, so it moves to the next page. And this happened again and again. Fix the problem by keeping in-header anchored floating tables inside the boundary of the header, this way the body text still doesn't overlap with the floating table, but the space available to the body text doesn't have to contain fly portions. Which means we don't try to move the image to a next page, so there is no loop. Note that the IsFollowingTextFlow flag is already ignored in some cases (e.g. sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc), so this doesn't break the use-case when a footer provides an anchor position for some text on the left/right margin. In that case the footer height is still unchanged as it should be. Change-Id: Id9e80140af3123d52b0fea2f96fc19c150c8e736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158413 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-10-24tdf#155040 sw floattable, RTF: fix table is overlapped by subsequent inline oneMiklos Vajna
The document had overlapping text on load since commit 05425f73bfa41d3f7591461e2ad0beb4fafc39b4 (sw floatable: teach the RTF import about SwFormatFlySplit, 2023-04-21). Interestingly the DOCX equivalent was fine, there the inline table is shifted down, below the floating table, so the overlap doesn't happen. Fix the problem by moving the AddVerticalFrameOffsets=true code from the DOCX filter to the shared dmapper, because RTF needs the same. See commit 50223ea6e212b60b7d33839c2753c5601fb50f95 (tdf#98987 sw: add AddVerticalFrameOffsets compat mode, 2016-03-31) for more details about this compat flag. It was already enabled for DOC, too. Change-Id: I948b179c9ec5fa24377014b0e86826568c417b6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158372 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-10-21Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: writerfilterStephan Bergmann
Change-Id: I6d566f7d7d2ef3d7d5efdd3cc94f129c6b4dbbb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158292 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20sw floattable: remove now unused FloattableNomargins compat flagMiklos Vajna
This was noop since commit 626fe9ab5ebebc4ef36e35f4aa597c03a3564d22 (tdf#157573 sw floattable: fix incorrect lack of left margin after table, 2023-10-18). Change-Id: I89a197313ac4ffbcff9bbff534e5411085282ac8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158237 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-10-20tdf#86790: Add support for a word-style stylerefSkyler Grey
STYLEREF is a field type in Word which changes its content based on nearby paragraphs. For example, upon creating a styleref referencing "Heading 1" you will see the text of the nearest "Heading 1"-styled paragraph that is above the field. This patch implements STYLEREF in Writer as a cross-reference. By using "insert>cross-reference>styles" you'll be presented with a list of styles. Selecting one and clicking "insert" will create a field which has text from the "most relevant" instance of the style. To find the most relevant instance we first search up for paragraphs with the style, and if there are any we take the closest. If there weren't any, we search down for paragraphs with the style. This patch also updates our use of STYLEREF for chapters exported to docx by using it for all chapters not only those in headers and footers. This allows us to approximate more chapter field functionality even when moving between Writer and Word. Finally, this patch adds some tests for STYLEREF: - testTdf86790 tests that the "sample file with STYLEREF" document from tdf#86790 has the correct fields - testStyleRefSearchUp tests that the STYLEREF searches up when there are bits of text both above and below it - testStyleRefSearchDown tests that the STYLEREF searches down when there are bits of text below it only - testMarginalStyleRef tests that the STYLEREF searches from the page top when it is placed in a footer - testFootnotetyleRef tests that the STYLEREF searches from the reference mark when it is placed in a footnote Still TODO: - [ ] Update documentation - [ ] Implement reverse-searching (\l) and nondelimiter suppression (\t) - Probably these 2 will be in a followup patch Change-Id: I25dd7a6940abee5651a784b9059fe23b32547d6c Signed-off-by: Skyler Grey <skyler.grey@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157456 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-10-17tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt.László Németh
Writer typeset DOCX files with more lines/pages, because of new default paragraph justification algorithm of MSO 2013 and newer, which resulted in losing text layout interoperability for new DOCX documents. Add new compatibility option "JustifyLinesWithShrinking" to store also the new type of justification in OpenDocument files. First analysis of the unknown justification algorithm shows up to 2% shrinking of plain justified line. Apply this value to break the lines in the same (or very similar) positions during importing a DOCX file with compatibilityMode >= 15 (created in MSO 2013 or newer), to avoid typesetting more lines and pages. Note: shrinking will be added by the next commits, fixing the temporary exceeding lines. Change-Id: I9a00db888e9af3f6723e4c502158e8e56a00ef02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158063 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2023-10-16sw floattable, wrap on all pages: add DOCX filterMiklos Vajna
- map DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK to <w:compatSetting w:name="allowTextAfterFloatingTableBreak"> on export - do the opposite on import - this requires a bit of rework, to avoid routing <w:compatSetting> via a grab-bag when we want to actually read it during import - also expose GetBooleanValue() from the OOXML tokenizer, so dmapper can know when the value of the compat flag is a true-like string. Note that it seems DOC and RTF don't have a matching compat flag for this. Change-Id: I0cb1230ee40994f59b816c42f8e7d2ac658b3212 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158013 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-10-12writerfilter: clean-up PushPageHeaderFooter method impl.Tomaž Vajngerl
in addition change m_aHeaderFooterTextAppendStack to use enum PagePartType for the "second" value in pair, instead of a bool to denote if it is an entry for header or footer. No change in functionality. Change-Id: I2aa75494c9b3337dd51bf79e282291cdca9d8547 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157839 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-10-12change PageType (first, left, right) enum to enum classTomaž Vajngerl
Change-Id: I45bb7947266de1e18028c7ed460149c609e430b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157834 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-10-11writerfilter: use content controls for text in block SDTsJaume Pujantell
Text inside block SDTs was shown as Text Fields wich ignored properties such as alias and formatting. Now those texts are imported as content controls like in the case of run SDTs. Added the ability for content controls to remember and export the "multiline" property of block SDT text. Some existing tests have been changed due to some different export results. Change-Id: Ice1eb4ca6dd53c99d5abb239371f8ac896c3b6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156867 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-10-07loplugin:ostr: automatic rewriteStephan Bergmann
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2023-10-05tdf#157574 Revert "tdf#153613 tdf#146984 split para after anchors"Justin Luth
This reverts 7.6 commit 828fde37632a5bb0542b6925454690a5287d6490. and also reverts the dependent parts of the follow-up test from commit 828fde37632a5bb0542b6925454690a5287d6490 (although the patch itself is fine to remain in place) and also reverts followup "cid#1522030 Uninitialized scalar field" commit 9a123a6e63600ba3998d22bbc300ac4b65b3da2c. The commit in general is fine. However, it fails in case of an empty paragraph (with only anchors). Unfortunately, there is no way of knowing ahead of time, so either everything needs to be processed after a delay, or else the paragraph needs to be split and then re-joined in case it is not an empty paragraph. Both options are extremely non-trivial - I don't know how to do either of them. Change-Id: I9e98d825ad0008e822172b6797116ad16e90b871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157593 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-10-04related tdf#157572 writerfilter framePr: no vAlign if vAnchor=textJustin Luth
See bug 157572 for the documentation. This can be seen in MS Word's UI. Have the vertical position be centered, and then change to "para": -> the vertical position changes to a numbered distance. make CppunitTest_sw_ooxmlexport5 \ CPPUNIT_TEST_NAME=testTdf157572_noVAlignAsText make CppunitTest_sw_ooxmlexport5 \ CPPUNIT_TEST_NAME=testTdf157572_insidiousCombination Change-Id: I6c00a34f14633e16178c1504a37e644a30cf4cd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157529 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-10-04related tdf#157572 writerfilter framePr: no vAlign if w:y definedJustin Luth
Documentation suggests that vAlign overrides w:y (as long as vAnchor is not equal to text). However, testing proves the opposite. Only when w:y is not defined does vAlign take effect. make CppunitTest_sw_ooxmlexport5 \ CPPUNIT_TEST_NAME=testTdf157572_defaultVAnchor make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf154703_framePr2 Change-Id: I8a5366d9b6bde0ad838f9584836a85fe79ce8b1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157528 Tested-by: Justin Luth <jluth@mail.com> Reviewed-by: Justin Luth <jluth@mail.com>
2023-10-04tdf#157572 tdf#112287 tdf#154129 writerfilter framePr: fix vAnchor defaultJustin Luth
Fixes LO 7.6 regression commit 630732bfd8ed531e9d412a36a083f33763def054 See bug 157572 for the documentation. To test this, I used ooxmlexport5's tdf112287B.docx with Word 2010: -changed vertical relative to Paragraph - exported w:vAnchor="text" -changed vertical relative to Page - exported w:vAnchor="page" -changed vertical relative to Margin - did not export w:vAnchor So, obviously the default is "margin" Note that it always exports w:y=1 For importing, the default vAnchor changed depending on whether w:y=0 (text) or w:y=1 (margin) * an exception is when w:y=0 and vAlign is defined - then 'margin' make CppunitTest_sw_ooxmlexport5 \ CPPUNIT_TEST_NAME=testTdf157572_defaultVAnchor Change-Id: I126094eafc43a83e3a4efdd1ebc8d9cab9d49759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157527 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
2023-09-29Use less libxml2 external headers dependencyGabor Kelemen
Change-Id: I1749628e0104dff856161bc0bdfd343ef0db208e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156784 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-09-25change bool header or footer parameter to use enum type insteadTomaž Vajngerl
Is much more readable. Change-Id: Ie81aaf344758182915796b18efbe25d3f45df4b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157236 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-09-20writerfilter: get rid of not needed RowPointer_t indirectionMiklos Vajna
RowData::Pointer_t is already a typedef, can use that directly everywhere. Change-Id: I393f8878abcdc9e053a08e70f26b6b1030ee5e8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157049 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-09-19m_nLastTableCellParagraphDepth is write-onlyNoel Grandin
ever since commit 2d43c34333076fad092f0cdc0f60f81580acdbee Author: Miklos Vajna <vmiklos@collabora.com> Date: Fri Sep 15 13:37:41 2023 +0200 Related: tdf#55160 sw floattable, nested DOCX imp: fix inner tbl at cell start Change-Id: Ifa2837fde41cecdf51ba4858dd52a59d79e4474e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157041 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-18tdf#55160 sw floattable, nested DOCX imp: fix inner tables at cell startMiklos Vajna
The trouble was that in case two floating tables start at an (outer) cell start, then everything up to the end of the first inner table ended up in the body text, not in the outer table. This happens because the table depth of the inserted dummy character was incorrect. Fix the problem by comparing what model.xml does at <w:p> start and what OOXMLFastContextHandlerTextTable::lcl_startFastElement() did in the dummy paragraph case, and sending the table depth in the dummy case as well. With this the bugdoc has the expected 19 floating tables in Writer and is of 1 page, both matching Word. Change-Id: I604956f28fdc01943ab913c5aa30365376c4d2b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157006 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-09-15Related: tdf#55160 sw floattable, nested DOCX imp: fix inner tbl at cell startMiklos Vajna
The bugdoc has an outer table and also two inner tables: the problematic one is the floating table anchored at the start of B1, which should float but does not. This special-casing was added in commit c1eebcdac9f2b289fd363399130c485ca5ff444c (tdf#79329 DOCX import: fix missing outer table with floattable at cell start, 2016-11-08), because there was no easy way to make sure that an inner floating table at cell start keeps the outer table import working, and having 2 inline tables is better than having an inner floating table and no outer table at all. The root of the problem is that in case an SwXParagraph tracks the outer cell start and we have an inner floating table, then the inner conversion to text frame will invalidate that SwXParagraph, so the outer table conversion will fail. Fix the problem by creating a cursor at cell start, moving it away, performing the inner table resolution. And in case the cell start SwXParagraph is now invalid, then move the cursor back and work with that position. The original bugdoc has 2 floating tables at cell start, which is still broken, but this approach allows fixing that in a later commit; while the old approach simply didn't notice that the 2nd floating table is also at cell start. Change-Id: Iedad7b2f023e88dfc5de7875ebc00320c2e6ad65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156937 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-09-13sw floattable, nesting: add DOCX importMiklos Vajna
There were two problems here: 1) writerfilter/ didn't even try allowing split floating tables for the inner case, because layout didn't support that previously. 2) CppunitTest_writerfilter_dmapper's test3NestedFloatingTables crashed because we expected that in case a fly+table is not toplevel, then the parent is also a fly+table frame, but in this case the parent was just a table frame. Fix this by checking for a table parent instead of a fly parent when deciding if we handle the split as a nested case or a toplevel one. Change-Id: I4c58636ef80371b8ec51a96fe436fa6379c795d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156865 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-09-07tdf#157136: apply top context properties to the text input fieldMike Kaganski
Change-Id: Ie3877811e482c1ec395a00ec6bf67155220b2b64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156675 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-08-25Revert "use more Reference::query instead of UNO_QUERY_THROW"Noel Grandin
This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd. sberg noticed that there is a difference now: there's a subtle difference now, in that if y was null originally, it would have thrown a (caught) exception, whereas now it will crash in the y.query<X>() call. Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-24tdf#77760 sw floattable: add support for footnotes, DOCX importMiklos Vajna
This was originally added in commit 2fe248f2b36d541c0d243a620c217058a50a9d5d (tdf#87460 DOCX import: fix missing endnote in floattable, 2015-06-23), because Writer core only allows footnotes in floating tables since commit 56da1d30afe48cc4acd79567052a575e81f8c7a0 (tdf#77760 sw floattable: add support for footnotes, doc model, 2023-08-22). The DOCX export works already. The ODT filter also works: there is a mechanism to try to not insert footnotes in text frames, but the way XMLTextImportHelper::IsInFrame() is implemented means that it only rejects footnotes directly in text frames, not in tables-in-textframes, which is the interesting case for us. Change-Id: I90a5f0228385b2e3db8d994c6c76064fe595f439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156024 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-08-18use more Reference::query instead of UNO_QUERY_THROWNoel Grandin
since querying with exceptions is consideably more expensive Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-15ComplexColor various clean-up and (trivial) refactoringsTomaž Vajngerl
Don't allow access to member variables of ComplexColor and makes them private. Needs a lot of changes. Change "scheme" to "theme" to be more consistent. In LO we usually call the "theme color" what is usually refered to as "scheme color" in OOXML, where it is sometimes refered to as "scheme" and other times as theme color. Remove ThemeColor class which was replaced with CmplexColor some time ago. Remove un-needed includes and un-needed components. Use isValidThemeColor in many places where we check that the ComplexColor is of "Theme" type and that ThemeColorType is set to a valid value. Change-Id: I325595fa65b8e56a4707e9d22acc6330aac28961 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155359 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-15sw floattable: handle AllowOverlap==false in the RTF filterMiklos Vajna
Map \tabsnoovrlp to SwFormatWrapInfluenceOnObjPos::mbAllowOverlap on import and do the opposite on export. Change-Id: I3d786041648d62e80f2ea9e3d726426e01a8d192 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155687 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-08-09sw floattable: import <w:tblOverlap w:val="never"> from DOCXMiklos Vajna
The bugdoc has 2 floating tables, the second one is shifted down in Word, so it doesn't overlap, even if the positioning attributes would lay them out with an overlap. The bugdoc has <w:tblOverlap w:val="never"> set for the second table, we can import that to Writer's SwFormatWrapInfluenceOnObjPos::mbAllowOverlap, which was originally added for shapes. writerfilter/ only has access to the UNO API, so do this via the AllowOverlap text frame property. The layout is still missing for this, but now the doc model is correct. Change-Id: I25df9b75633c05af206b94ff0ad71bd240f393f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155499 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-07-22tdf#149498 sw: fix Undo crash at bookmark over cellsLászló Németh
Importing DOCX files with bookmarks between w:p paragraph elements resulted bookmark ranges over cell boundaries within text tables, causing crash with Undo. Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 to avoid bookmark ranges over cell boundaries, creating only collapsed bookmarks here, as before. Regression from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 "tdf#145720 DOCX export: fix loss of tracked moving". Note: to avoid of another assertion, skip testing with debug builds. Change-Id: I3ed6daa55323f20130fcee6cc24d00a480731d0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154743 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2023-07-21Fix typoAndrea Gelmini
Change-Id: Ied624a73804f99a63b71f9088d6179ad2d93cef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154564 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-07-17tdf#156030: sw: better import of IF field for RTF and DOCXVasily Melenchuk
Since long time IF field was converted to ConditionalText, but no parameters were given. So condition, then text and else text were lost during import. Change-Id: I9b45e8ab394f3c53bb34370bf3ea15a939a400fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154101 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-07-13Fix typoAndrea Gelmini
Change-Id: I2a7613fbedf05b9d30695605ad9e568c0a77c0b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154385 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-07-13sw floattable: fix lost floating table right before a hidden para from DOCXMiklos Vajna
The bugdoc has a floating table, but that was not visible in Writer. What happens is that the table's anchor was hidden, so Writer was hiding the anchored table as well, but Word still shows the table in this case. Fix the problem similar to what commit 79ddca4def81198e3eee42eca8aca42fef964c80 (sw floattable: fix lost floating table right before a table from DOC, 2023-07-05) did for the DOC import: if the paragraph has an anchored floating table and is hidden, then show the paragraph. An alternative would be to change how NS_ooxml::LN_EG_RPrBase_vanish is handled in DomainMapper::sprmWithProps(), but that would be too early: by the time we get the SPRM, there is no floating table yet. Another alternative would be to make sure floating tables are part of the "anchored object" list in DomainMapper_Impl::finishParagraph() (that's how shapes don't have this problem), but the anchor paragraph is finished before creating the floating table, so that would be again too early. Change-Id: I7df7e318b15e78ceb51474440923a80bfdc6054b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154376 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-07-11tdf#150408: Implement "Legal" numbering (all levels using Arabic numbers)Mike Kaganski
Enabling this feature on a list level makes all numbered sublevels, that constitute the number of this level, to use Arabic numerals. This doesn't change the labels of other levels: e.g., if level 1 uses A,B,C; level 2 uses i,ii,iii; level 3 uses a,b,c, and is "Legal"; and level 4 uses 1,2,3; then a list may look like A. Something A.i. Some subitem A.ii. Another subitem 1.2.1. This is a "Legal" sub-subitem A.ii.a.1. And its child This improves interoperability with Word. This change introduces document model, ODF and OOXML import and export. In ODF, a new boolean attribute of 'text:outline-level-style' element, 'loext:is-legal', is introduced; its default value is "false". Change-Id: I5ae9f970864854c7e84c4b2f7ce46634b3ef104e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154288 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-07-11tdf#156130: Use default tab stop when TOC*N style doesn't define oneMike Kaganski
When TOC*N style only defines one tab stop, it's used by Word as the page number position, and the tab between chapter number and chapter name is set to a default position. When the style has no tab stops, they are both defaulted. testTdf154319 is updated to test this. Change-Id: I561995a8e96882e1f17ee9982e3fc640e621cda2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154281 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-09tdf#153804 DOCX import: fix lost footnotes in case of commentsLászló Németh
Incomplete handling of m_bIsFootnote had a conflict with XNote stream COMMENTS (i.e. not FOOTNOTES and ENDNOTES) since commit 96a856f87f16cca2e039c973c18d57c8b9dca362 in DomainMapper::lcl_checkId(), resulting lost (order or content) of footnotes, when were comments in the document. Regression from commit 96a856f87f16cca2e039c973c18d57c8b9dca362 "tdf#152206 DOCX import: fix mixed first footnote". Change-Id: I8d6901e8db1e183b959fecd350d6a263e79b5591 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154147 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>