summaryrefslogtreecommitdiff
path: root/writerfilter/qa
AgeCommit message (Collapse)Author
2023-02-15tdf#147258 DOCX import: fix bad char format w/ inline <w:sdt> and data bindingMiklos Vajna
The bugdoc had an inline SDT in placeholder mode, where the placeholder had a char style to define a red text color. This red color is not in Word, but it was in Writer. This went wrong with commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a (sw content controls, plain text: enable DOCX filter with data binding, 2022-09-19), because previously we didn't map <w:sdt> to Writer content controls for plain text with data binding. Fix the problem by resetting the char style back to default when the value of the content control comes from data binding. Interestingly office.com renders the document the way Writer did previously, but let's try to match what desktop Word does, that's probably the reference for DOCX files. Change-Id: I7eccdb843d5ab63ccf573644c61832e2ef7dae14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147088 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-27tdf#151548 sw content controls: preserve tabIndex val="-1"Justin Luth
Either we have to read sal_uInt32 (which I can't figure out how to do) or else we have to write it out as sal_Int32. Microsoft isn't much help here because their documentation does not give any example of a non-tabsltop, and one errata document indicates that MS Word simply ignores tabIndex altogether for Sdt (and ffData). According to the documentation, tabIndex is a CT_UnsignedDecimalNumber which we do not have in our model.xml so it was defined as being a CT_DecimalNumber which works fine for reading something human sensible like -1. However, in our exporting we were exporting a sal_uInt32 which creates large, all positive numbers which were not being read on import. Nothing I tried worked to read these large numbers. Perhaps it is even illegal to do so in MS formats? Since it doesn't seem to matter to MS Word, and for a human it is easier to understand -1, and it is easier to solve in export than import, I'm taking the easy road. Change-Id: I6b296703c9a37149d9e11f29901e6db32bd041b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146149 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-01-23tdf#153046 RTF import: fix lost paragraph alignment after page breakMiklos Vajna
The bugdoc had a page break, and the paragraph after the page break is meant to be centered, but it was aligned to the left. This went wrong with 3c610336a58f644525d5e4d2566c35eee6f7a618 (tdf#148214 RTF import: avoid fake paragraph for \page when possible, 2022-09-08), previously we emitted fake paragraphs in most cases, which allowed simpler handling of pending paragraph properties. Now we have to be careful to call checkNeedPap() exactly when parBreak() in called, otherwise checkNeedPap() sends paragraph properties, and paragraph properties noticed later will be lost. Fix the problem by not sending paragraph properties unconditionally, only in case we send the fake paragraph break as well. This continues to allow the unwanted fake paragraphs in some cases, but it restores the lost paragraph properties, since m_bNeedPap will be still true after we hit the first character in the last paragraph, so \qc is sent to dmapper. Note that we don't have to check m_bNeedPap before checkNeedPap(), as it returns early already when m_bNeedPap is false. Change-Id: I683d42208072a84fe578e397ac3e29585da5aa89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145990 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-06tdf#152884 import alpha too for schemeClrRegina Henschel
Without fix the alpha child element was only read for w14:srgbClr but no for w14:schemeClr. Thus character colored by theme color had no transparency. Change-Id: I73c01b7142d3eab83400d2e5eb9dce01ff8d4a19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145099 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2022-12-16sw content controls: enhance preserve idJustin Luth
Follow-up to 100c914d44ae8f362924fe567d7d41d0033ae8ad which added the initial id preservation for DOCX. adding DOCX block SDT grabbaging, ODF import/export [content controls can't exist in DOC format] The ID field is CRITICAL to preserve for VBA purposes. This patch adjusts BlockSDT to also round-trip the id instead of just creating a random one. m_nRunSdtPrToken <never equals> FSNS(XML_w, XML_id) since 2021 with 5f3af56b2c0ef6c628a7cfe5ce6e86f8e1765f5f, so I removed that part of the clause. I had thought about changing the ID to use a string instead of an int, but then the integer version was adopted to fix a regression in the commit mentioned earlier. I think it is AWFUL to have a number as the identifier when it will be used in StarBASIC. The VBA guys have to deal with it, but it would be nice to do something reasonable for LO native access to content controls. However, the concern would be if we allow VBA macro content created in LO to be exported to DOCX format - that would cause problems converting from a string ID to a number ID. VBA editing already is happening to some extent, and mmeeks seems interested in enabling it. So over-all it seems best to just stick with an integer ID. I used the commits for <w:alias> and <w:tag> to compose this patch. XML_ID already existed in include/xmloff/xmltoken.hxx and "id" already exists in xmloff/source/token/tokens.txt The ID can be used in VBA to select a specific control. The id (which is a positive or negative integer in DOCX) specifies a unique control - either by passing the number as a string (of the UNSIGNED value) or by passing as a float (specified with #). For example: msgbox ActiveDocument.ContentControls(2587720202#).ID msgbox ActiveDocument.ContentControls("2587720202").ID but not as an integer since that is used for index access. dim index as integer index = 1 msgbox ActiveDocument.ContentControls(index).ID make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport make CppunitTest_sw_ooxmlexport18 CPPUNIT_TEST_NAME=testTdf151912 make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport Change-Id: I5c4022dc932d941fad9da6d75ce899ee1ff66ff5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142818 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-14tdf#151548 sw content controls: preserve tabIndexJustin Luth
This has to be vital to keyboard navigation. Certainly it is good to have it imported before we start to consider tab-movements for form controls. All tabIndex 1's are processed (in placement order) and then the 2's etc. 0's are to be done last. XML_TAB_INDEX already existed in include/xmloff/xmltoken.hxx and "tab-index" already exists in xmloff/source/token/tokens.txt make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport No existing unit test found containing blockSDT with tabIndex. Change-Id: I8a958844e6192b079a2b22a62dedfd8739021f4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143603 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-12-13tdf#151548 sw content controls: preserve lockJustin Luth
DOCX SdtControls can be locked in two ways: -Content Control cannot be deleted (sdtLocked) -Contents cannot be edited (contentLocked) or both (sdtContentLocked) make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText make CppunitTest_sw_ooxmlexport4 CPPUNIT_TEST_NAME=testSimpleSdts make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate make CppunitTest_sw_macros_test CPPUNIT_TEST_NAME=testVba make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport Change-Id: I5a82d9f6b5103a4902f59af66cd8a99addd4e690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143542 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-11-24Remove some unused includesMiklos Vajna
Mostly com/sun/star/frame/Desktop.hpp is unused after inheriting from UnoApiTest. Change-Id: Ifba307353a11a14e033a230a291314bee86b51c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143190 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-11-01CppunitTest_writerfilter_dmapper: inherit from UnoApiTestXisco Fauli
Change-Id: I342085e3c0e31794e0ec08f3b26ccf17caa8d2d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142097 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-11-01CppunitTest_writerfilter_rtftok: inherit from UnoApiTestXisco Fauli
Change-Id: I24dce2b743a2c2d1a7cc96b8d7833bde0ab385d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142096 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-10-26sw content controls: enable data binding for dateMiklos Vajna
The document had a 2022 date in document.xml, but had a 2012 date in data binding. Writer used to show 2022, while Word picks 2012. Data binding for dates were disabled in commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a (sw content controls, plain text: enable DOCX filter with data binding, 2022-09-19), because the formatting of those date timestamps were missing, so it was better to just not update them from data binding, temporarily. Fix the problem by adding a new read-only DateString property on SwXContentControl, this way the import filter can set not only the timestamp but the formatted date as well. This shares the SwContentControl::GetDateString() code with the UI, which already had the need in the past to turn a timestamp into a date string, based on a provided language and date format. Change-Id: I842a9483a675f895129a9854caec347be6b6b84e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141859 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-10-13Fix typoAndrea Gelmini
Change-Id: Ie04728548d82e6eb5b0d46e65c279dcda5442bf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141309 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-10-13Fix typoAndrea Gelmini
Change-Id: Iff1adef6278239436bbaabd619ed12648d0819df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141305 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-10-13tdf#149840 Use actual outer size for SmartArt in WriterRegina Henschel
SmartArt import needs the outer size of the diagram for to define a background shape in the correct size and calculate the size of the diagram shapes relative to the outer size. The patch passes the values read from wp:extent in writerfilter to DiagramGraphicDataContext in oox. Change-Id: Ib39227bc645ac353336bab2c558d041974188f6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141223 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-10-11Deduplicate O(U)StringConcatenationMike Kaganski
And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-10-10tdf#151261 DOCX import: fix dropdown SDT when the item display text is missingMiklos Vajna
Dropdown content controls have list items, and each list item can have a display text and a value. These are optional, and the bugdoc has a list item where the value is set, but not the display text. The trouble is that later in DomainMapper_Impl::PopSdt() we check if the length of the display texts and values array match and if not, then we throw away these arrays to avoid creating an inconsistent document model. Fix the problem by checking what display text and value we got at the end of each list item; if any of them is missing, we add an empty string, which matches the internal representation in SwContentControlListItem. This also helps in case these array sizes matched by accident, but display texts and values from different list items were mixed previously. Change-Id: Ib1eeabd2479963af4a84d4229d4f0ce4572e0f01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141151 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-10-05sw content controls: preserve tagMiklos Vajna
This is similar to <w15:color> to preserve <w:tag>. Resolves <https://gerrit.libreoffice.org/c/core/+/137399/2#message-a5ba9f1e0dc9e586034758ee7c0a94e1533e8922>. Change-Id: I4fdab44aaf13ca812502ae79f38f32ec9468db11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140981 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-10-05sw content controls: preserve aliasMiklos Vajna
This is similar to <w15:color> to preserve <w:alias>. Related to <https://gerrit.libreoffice.org/c/core/+/137399/2#message-a5ba9f1e0dc9e586034758ee7c0a94e1533e8922>. Change-Id: I774b7204c5ca02ec6db89f5cbd3a6de6f2bf82a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140975 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-09-29use more string_view in writerfilterNoel Grandin
Change-Id: Idd4582138e8da9cc60e0a728bdea5542a509a4f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140711 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-26tdf#150762 RTF import: fix missing left margin on numbered paragraphMiklos Vajna
The bugdoc has a numbered paragraph with a custom left margin, but this left margin is missing in Writer. This went wrong in commit 61b7034824dead1635f9e9c6ec996297e10f6910 (tdf#104016 RTF import: deduplicate before text indent from numbering, 2017-12-05), and now it's broken because the numbering properties are applied before paragraph properties in the DOCX case, but the RTF tokenizer didn't do this ordering. This behavior of sw core somewhat makes sense, users expect the margins from direct formatting to go away if you apply a new numbering. So fix the problem by tweaking the RTF tokenizer to emit the numbering tokens first and only then the paragraph tokens, which is an order that's closer to the working DOCX tokenizer. This only affects the old (WW6-style) paragraph numbering markup, not the newer (WW8-style) numbering markup. Change-Id: I39698f57684d47c03ea4848fc8eb6b2e855c4fbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140584 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-09-22sw content controls, combo box: add DOCX filterMiklos Vajna
Map the ComboBox UNO property to: <w:sdtPr> <w:comboBox> ... </w:comboBox> </w:sdtPr> and the opposite on import. Change-Id: I50e0b961bca99f4ecca86d6784d2e6a13f469314 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140399 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-09-13tdf#140302 RTF import: fix unexpected repeated imageMiklos Vajna
The bugdoc has 2 images, but the resulting doc model had 3 images since commit 7e863504854ae8ab286b32510aba8b363a8e314b (tdf#81943 sw RTF import: fix missing wrap in background for in-table shape, 2018-07-16). The trouble was that shape replay wants to access the current shape at m_aStates.top().aShape, but we only set it, forgot to unset it after replay was done, which can result in duplicated insertions. Fix this by saving the old current shape on the stack, set the current shape to the wanted value and then undo it after replay. This only affects documents that have a \picprop group, since the unwanted insertion happened when popping that group. Change-Id: I088054de2332deb4b45f7e269672fa799dd49c2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139818 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-09-09tdf#148214 RTF import: avoid fake paragraph for \page when possibleMiklos Vajna
The bugdoc has 2 pages, an explicit page break between them and the first page has enough content that an additional fake paragraph at the end would lead to a 3rd, unwanted page. The fake paragraph was introduced in commit 7b58fc3dafc789aa55fff5ffef6ab83c3aa8b6e0 (fdo#48104 fix RTF import of \page in inner groups, 2012-04-02), because dmapper ignores more than 1 page breaks in a paragraph. Fix the problem by only inserting the fake paragraph in case the "page break before" paragraph property would have no effect (very first paragraph in the document) or we already sent characters (para props are lazy-sent on the first character). This keeps existing cases working, but avoids the unwanted fake paragraph in the bugdoc. I suspect the root cause is that dmapper doesn't handle multiple page breaks in a paragraph -- once that's fixed, this parBreak() call can be completely removed. Adjusted tests: - testImportHeaderFooter: this asserted the presence of fake paragraphs, which are now gone in the easy case, so this change is an improvement - testTdf133437: no visual difference before/after, probably the test intent was just "make sure this page has several shapes", the exact number isn't that interesting Change-Id: Idd2b8a70b4122eb08d9d305018d384dc0bbb276a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139704 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-09-01tdf#150474 RTF import: fix missing char props for in-table newline charactersMiklos Vajna
I forgot about this in b9508dd55f82d35f09a58021dc001cf79b390e08 (fdo#50665 rtftok: don't ignore character properties of text fields, 2012-06-06), which handled the plain body text case, but not the buffered case. Change-Id: I5c5ebb58becc44a6cf1e0bb8984b2b8c212c3c2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139143 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-07-25sw content controls, plain text: add DOCX importMiklos Vajna
- the core of this is the writerfilter/ change to call PopSdt() for SdtControlType::plainText, which maps inline plain text SDTs to Writer content controls, not to input fields - disable the grab-bag in this case, otherwise we would run duplicated <w:sdt> elements on export - fix CppunitTest_sw_ooxmlexport7's testSdtAndShapeOverlapping by postponing the SDT start in DocxAttributeOutput::WriteContentControlStart() in case a shape is anchored at the same position as the SDT start: if the shape should start inside the content control, then it should be anchored after the dummy character - reduce the debug output in VMLExport::Commit(), which could write control characters to the terminal on test failure, potentially breaking it (requiring a 'reset' to recover) - fix CppunitTest_sw_ooxmlexport5's testSdt2Run: now we merge two runs inside a plain text content control into a single one, and there is no problem with that, so adapt the test instead - fix CppunitTest_sw_ooxmlexport17's testTdf148361: plain text inline SDT is now a content control, not a field - fix CppunitTest_sw_ooxmlfieldexport's testfdo82492: explicitly assert that there is 1 text run inside the SDT and there is a shape after it (outside). Also extend DocxAttributeOutput::EndContentControl(), so it ends the content control at the correct, earlier position in case it's followed by an as-char shape - fix CppunitTest_sw_ooxmlfieldexport's testfdo82123: again assert that the SDT has 1 run with text, and there is a drawing after the SDT - fix CppunitTest_sw_ooxmlfieldexport's testTdf104823: this revealed that some more complex logic is needed to support data bindings, so exclude text-with-databinding from the scope of this commit and continue to map those to input fields for now - fix CppunitTest_sw_ooxmlfieldexport's testFdo81945: this had a similar problem as as-char shapes, but this time a new SDT is starting right after a previous SDT. Adapt DocxAttributeOutput::EndContentControl() accordingly, though perhaps this should be generalized later, so we always close SDTs in the previous run, unless this is the last run, or something similar Change-Id: Ifaf581be884a683de6c8b932008a03ba43734b75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137399 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-06-28tdf#149654 sw content controls: fix missing string before inline SDT from DOCXMiklos Vajna
The document had a block SDT and inside that, a run SDT. The content that is before the run SDT but already inside the block SDT was lost. To work incrementally, it was intentional that once commit 5ee8670f18cb8b1913a23d04590d6a31ac9730de (sw content controls, date: add DOCX import, 2022-05-30) changed most of run SDTs to content controls, it left block SDTs (and cell/row SDTs, too) unchanged, so they are still mapped to fields. What was forgotten is that m_pImpl->m_pSdtHelper in DomainMapper is a shared state: once a run SDT starts, it assumes that no non-run SDTs are in progress. Fix the problem by explicitly checking for non-run SDTs before PushSdt(), that keeps the separation (content control for run SDT, fields for the rest) but fixes the lost content. This is for plain text SDTs, but other types can be added if necessary. Change-Id: I46b029a3a945d7416028aa196ac3160e6d96eae8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136524 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-06-08RTF filter: allow measuring page borders from the edge of the pageMiklos Vajna
This is similar to commit 51942eafdb4439559b6d59f3becd4afab45277f0 (DOC import: allow negative page border distances, 2022-06-08), except here we map \pgbrdropt's 5th bit to the "from page edge" bool, and then the rest of the import works already after the DOCX fixes. Similarly, the export has to map the "from page edge" bool to \pgbrdropt and has to call into editeng::BorderDistancesToWord(), but the rest of the process works after the DOCX fixes. Change-Id: Ic88f1ab17ac169025c38790ffa895748df0a76c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135502 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-06-07sw layout: allow negative page border distancesMiklos Vajna
Writer follows the CSS box model when it comes to page borders: there can be a positive distance between the edge of the page and the border, and again a positive distance between the border and the body frame. This ensures that the page border never intersect with the body frame, which is usually what users expect. Word, however, can work with 2 distances for border and text, both measured from the edge of the page, leading to a page border, which is inside the body text. This is described at great detail at <https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder#Importing_case_3:>. Fix the problem by allowing negative border distances: this doesn't influence the position or the size of the body frame, but it gives us a way to position the border more towards the center of the page, leading the matching layout between Writer and Word. The doc model (to allow negative border distances), UNO API and DOCX filter is updated in this commit. The ODT filter works without explicit effort. Other filters are not yet updated in this commit. Change-Id: I723e1bdb8dc6391129f1686f88826cc089f6fd67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135462 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-05-20sw content controls, picture: add DOCX filterMiklos Vajna
Map Picture UNO property on content controls to: <w:sdt> <w:sdtPr> <w:picture/> ... And do the opposite on import. Change-Id: I5b164f796f194f5fc4bb30d7a30e053e577ed92d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134657 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-05-11sw content controls, drop-down: add DOCX importMiklos Vajna
- inline drop-down content controls were imported as an SwDropDownField previously, but that has the drawback of not being able to store both display texts and values of each list items - adapt tests under sw/qa/ which asserted that the import result is a field, and check content control properties instead - change dmapper so that SdtControlType::dropDown is one more inline SDT that gets mapped to SwContentControl - remove the no longer needed grab-bagging in writerfilter/, otherwise we would write the SDT markup twice on export - improve DomainMapper_Impl::PopSdt() to actually map the collected dropdown properties to properties on the to-be-inserted content control Change-Id: I7e88ec8cd1d73bc1c6c75154d6ab07352cbcec8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134143 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-05-02Just use Any ctor instead of makeAny in writerfilterStephan Bergmann
Change-Id: I3db5381c5dc72f0498171d9e61479ae6763312bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133708 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-29sw content controls, checkbox: add DOCX importMiklos Vajna
My expectation was that <w14:checked w14:val="0"/> would be mapped to a single SPRM where the int value is 0 or 1 depending on if this is a true or false boolean. But the w14 tokenizer rules actually created a NS_ooxml::LN_CT_SdtCheckbox_checked token with a NS_ooxml::LN_CT_OnOff_val token in it, which itself again didn't contain just a bool but dedicated NS_ooxml::LN_ST_OnOff_true, NS_ooxml::LN_ST_OnOff_1, etc values. To make this more complicated, TextEffectsHandler even depends on this weird behavior. Bring the w14 rules closer to the "main" wml rules by folding the NS_ooxml::LN_CT_OnOff_val token into the parent token (NS_ooxml::LN_CT_SdtCheckbox_checked in this case), but leave the NS_ooxml::LN_ST_OnOff_* values unchanged for now. The rest of the changes are more straightforward: we now handle inline/run checkbox SDTs similar to rich text ones, i.e. map them to Writer content controls, rather than just doing a poor mapping to grab-bags. The main benefit here is that the checkbox type of Writer content controls actually change their value on mouse click, so it's possible to fill in such forms. Change-Id: Idbf49a8ff1843d5271f2836e5299c4387bb58e55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133588 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-04-20sw content controls: add initial DOCX importMiklos Vajna
- map inline/run SDTs with unknown type (i.e. rich text) to SwContentControl - decouple block and run SDTs and leave block ones unchanged - track start position of run SDTs similar to bookmarks, which needs different code to SDT at text start vs later - fix DocxAttributeOutput::RunText() to please CppunitTest_sw_ooxmlexport2's testFdo67013, which had an inline SDT in footer, not at para end Change-Id: I59b8b7f3170cf37f1547db07ae0992850e0e3aa8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133195 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-03-08sw clearing breaks: add DOCX importMiklos Vajna
Map <w:br w:clear="..."> to the com.sun.star.text.LineBreak UNO service, but keep the default clear=none case unchanged. Change-Id: I145e891c1df0bbd0fdac2c62463dc801bca827fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131167 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-03-04Removed executable bits on rtf filesAndrea Gelmini
Change-Id: I4b12bd5d399efa037bb84699572c8c9bfb07e459 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130977 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2022-03-02fail more gracefully if m_aTmpPosition is emptyCaolán McNamara
LIBREOFFICE-N4LA0OHZ Change-Id: I7f863151f753ad5605c4f1f280cfd79aa4c6bce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130760 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-09Fix typoAndrea Gelmini
Change-Id: Ic5e211c4802cedde313d5e03859bb6d3b6be48ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129718 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-02-08RTF paste: fix cursor creation on shapesMiklos Vajna
This went wrong in commit 232ad2f2588beff50cb5c1f3b689c581ba317583 (API CHANGE: add a "position" parameter to XParagraph/TextPortionAppend methods, 2012-11-28), the problem is that the text range is part of the shape text's node range, so we have to call createTextCursorByRange() on the shape's XText, not on the body text. Change-Id: Ifa97213659130b8c279022a6a03f920dca6061bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129603 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-01-28DOCX import: handle a subset of <w:ptab w:alignment="left">Miklos Vajna
The case when we can map it to a line break. This way the page number is visually inside the rectangle shape that is behind the field. The test intentionally uses \n as-is for line-break, because SwASCWriter::WriteStream() uses \n in the LINEEND_LF case even on Windows (and not SAL_NEWLINE_STRING), while SAL_NEWLINE_STRING is used for paragraph-break. Change-Id: Ic85e57b2391bfac73507727b17240f4d85fc2698 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129059 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-01-27Add simple unit test for recent fix to take layoutInCell into considerationTor Lillqvist
... when a graphic is in table row. The test just checks that the IsFollowingTextFlow property gets set as true, it doesn't check that the table row height actually is correct or that the result looks correct. Change-Id: Ia6feec2b2a9bbff6e130f9542c15106750ff415d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128982 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-24DOCX import: fix <wp:anchor layoutInCell="1"> with <wp:wrapNone>Miklos Vajna
If wrap is set to none ("in front of text"), then <wp:positionH relativeFrom="column"> ignores layoutInCell="1" in Word. But in case relativeFrom is something else (e.g. page) or wrap is not none, then the old behavior is OK. Adjust our import so that Writer's layout also allows this shape to leave the cell. Change-Id: I6ca7511d46d7a70df11a65dc67c182f4fff4ae69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128862 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-01-21DOCX import: floating table with negative top margin has to be a fly frameMiklos Vajna
The bugdoc has a large header, then part of the table goes into the whitespace of the header by specifying a negative vertical position. Keep this as a floating table as normal tables can't have negative top margins. Change-Id: I95299051f004976778765965971428d9764bef08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128724 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-01-18RTF import: handle the pictureContrast and pictureBrightness shape propsMiklos Vajna
Map it to (the UNO API of) GraphicDrawMode::Watermark, similar to what the binary import does in SvxMSDffManager::ImportGraphic() and how the drawingML import does it in oox::drawingml::GraphicProperties::pushToPropMap(). Change-Id: I8023aa8fcbd086d4c7a30729e3ca615a7356da4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128515 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-11-09RTF import: handle \snextMiklos Vajna
I.e. pressing enter at the end of a heading 1 paragraph should switch to body text. Change-Id: Idde9da3e2c058869a2ae4a9c61b3b43165121f5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124883 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-11-04RTF import: fix too small graphic size when both picwgoal and picw are providedMiklos Vajna
The original document provided \picwgoal and \pichgoal, stating the desired size of the image in twips. \picw and \pich is not provided, but we write it on export. The value of \picw and \pich is ignored by Word (it can calculate both the current and the original size from picw/hgoal and picscalex/h), so it displays the document correctly. Use the same trick in our RTF import: picscalex/y has a specified default value (100%), so if we have picwgoal and pichgoal, then we can also ignore picw and pich. This is needed, otherwise the much smaller size from picw/pich is used as the original size, so the layout "zooms in" so much that only a small white rectangle of the top left area is visible, as if the images would be all lost. Change-Id: I924e5f8b68613c654c857a57561c8a2e3a6db2f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124679 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-10-19tdf#144798 DOCX import: handle ZOrder of chart objectsMiklos Vajna
Regression from commit 10efab2b9a3cf7fc49655c90ba29db4512680c38 (tdf#82824 DOCX import: fix at-char embedded object handling, 2016-11-15), the problem was that if we start supporting anchor types other than as-char, then handling ZOrder is no longer optional. Change-Id: I605cee33180490817055978b22f3271b3c08a1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123757 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-10-13writerfilter: remove a bunch of unused documents from gitXisco Fauli
Change-Id: I95d6f5780ec43787f7daa75f435f1c918de6a57e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123549 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-08-20Make some scripts more portableIlmari Lauhakangas
Change-Id: Ia89059eea51ca396a7c74143625ac9a6706de198 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120773 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2021-07-23tdf#143455 exclude diagram from pos and margin adaptionsRegina Henschel
The current implementation of diagram (SmartArt) uses a SdrGroupObj, but it is actually not a group of the diagram parts. Currently the group's object list contains only one, dummy object. Therefore it works not well with the code parts used for groups. Because we will have (hopefully) the tender 'Dynamic Diagram feature' I have done nothing on diagrams, but as workaround only excluded diagrams from these code parts. That way the rendering is same as in LO 7.1. This part of code needs to be touched again, when diagrams are implemented in a different way. Change-Id: Ife4bb495c96fb1dd57663f28409dc2bb456282ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119344 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2021-07-23-Werror=maybe-uninitializedStephan Bergmann
(at least with recent GCC 12 trunk and --enable-dbgutil --enable-optimized) Change-Id: Ie16260267b70c9e887c0342a09875e8d0a6a5eee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119402 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>