[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - oox/source sc/qa
oox/source/drawingml/shape.cxx | 12 ++-- sc/qa/unit/data/xlsx/tdf141644.xlsx|binary sc/qa/unit/subsequent_export-test.cxx |4 ++-- sc/qa/unit/subsequent_filters-test.cxx | 27 +++ 4 files changed, 35 insertions(+), 8 deletions(-) New commits: commit 16ec67b98179448a22c2cc3f82ca69a842ba8e3a Author: Szabolcs Toth AuthorDate: Wed May 19 08:42:29 2021 +0200 Commit: Gabor Kelemen CommitDate: Thu Aug 19 15:58:55 2021 +0200 tdf#141644 OOXML shape import: fix upright text rotate angle Text rotate angle was not imported correctly with "upright" setting, e.g. resulting horizontal text in shapes of XLSX documents instead of vertical. Change-Id: I2ad9ba3465278220e64123c4400acff4125310d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115777 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit b2190523e0b226bcae19cc8c3ce8a83855c7f009) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120714 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index a9388e8a4a70..6fdc11a14a24 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1498,6 +1498,9 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) ); nTextRotateAngle -= mnDiagramRotation; +/* OOX measures text rotation clockwise in 1/6th degrees, + relative to the containing shape. setTextRotateAngle wants degrees anticlockwise. */ +nTextRotateAngle = -1 * nTextRotateAngle / 6; if (getTextBody()->getTextProperties().moUpright) { @@ -1506,18 +1509,15 @@ Reference< XShape > const & Shape::createAndInsert( // shape containing it is rotated. // Hence, we rotate the text into the opposite direction of // the rotation of the shape, by as much as the shape was rotated. -mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); +mpCustomShapePropertiesPtr->setTextRotateAngle((mnRotation / 6) + nTextRotateAngle); // Also put the initial angles away in a GrabBag. putPropertyToGrabBag("Upright", Any(true)); putPropertyToGrabBag("nShapeRotationAtImport", Any(mnRotation / 6)); -putPropertyToGrabBag("nTextRotationAtImport", Any(mnRotation / 6)); +putPropertyToGrabBag("nTextRotationAtImport", Any(nTextRotateAngle)); } else { -/* OOX measures text rotation clockwise in 1/6th degrees, - relative to the containing shape. setTextRotateAngle wants - degrees anticlockwise. */ -mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 6); + mpCustomShapePropertiesPtr->setTextRotateAngle(nTextRotateAngle); } auto sHorzOverflow = getTextBody()->getTextProperties().msHorzOverflow; diff --git a/sc/qa/unit/data/xlsx/tdf141644.xlsx b/sc/qa/unit/data/xlsx/tdf141644.xlsx new file mode 100644 index ..61599d53fd62 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf141644.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 4fe66b51f487..3b6a16d98b3c 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5653,8 +5653,8 @@ void ScExportTest::testTdf137000_handle_upright() = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); -assertXPathNoAttribute(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", - "rot"); +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", + "rot", "-540"); } void ScExportTest::testTdf126305_DataValidatyErrorAlert() diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 38115f9ec2d6..8b9e000859cf 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -295,6 +295,7 @@ public: void testShapeRotationImport(); void testShapeDisplacementOnRotationImport(); void testTextBoxBodyUpright(); +void testTextBoxBodyRotateAngle(); void testTextLengthDataValidityXLSX(); void testDeleteCircles(); void testDrawCircleInMergeCells(); @@ -482,6 +483,7 @@ public: CPPUNIT_TEST(testShapeRotationImport);
[Libreoffice-commits] core.git: Branch 'distro/collabora/dcm-6.2' - sw/qa writerfilter/source
Rebased ref, commits from common ancestor: commit 546d94f864ed866fac9ba3790950820d60991e6f Author: Szabolcs Toth AuthorDate: Thu Feb 20 10:54:19 2020 +0100 Commit: Andras Timar CommitDate: Thu Jul 8 14:05:34 2021 +0200 tdf#130799 DOCX import: fix missing inside vertical borders caused by incomplete handling of tables with 1-column rows with merged cells. Have to check the rows below current to see if they contain also one cell, therefore form a column, or more than one cell, in which case do not remove vertical borders. Regression from commit: 8a2eb40abbd52d960dd21308157186be0ca9dd3d (tdf#129442 DOCX import: fix right border of 1-column tables). Change-Id: If9ca7ccd42255e78c61b6271e19262ab5cc8e439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89081 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 3726c9022b97..b1c8c98ba8fc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1048,6 +1048,17 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") +{ +// tdf#130799: Inside vertical borders of a table should not be missing. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +// Left and right borders. +assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 4cb518eb29d8..458feaa6cd96 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -836,7 +836,17 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl // Do not apply vertical borders to a one column table. else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) { -rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +bool isOneCol = true; +for (size_t i = nRow; i < m_aCellProperties.size(); i++) +{ +if (m_aCellProperties[i].size() > 1) +{ +isOneCol = false; +break; +} +} +if (isOneCol) +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } // Do not apply horizontal borders to a one row table. else if (m_aCellProperties.size() == 1 && aRowOfCellsIterator->size() > 1) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/dcm-6.2' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx| 11 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 +++- 2 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 23ae22b244230b42979d206943149924efc9a80c Author: Szabolcs Toth AuthorDate: Thu Feb 20 10:54:19 2020 +0100 Commit: Mike Kaganski CommitDate: Tue Jul 6 21:49:43 2021 +0300 tdf#130799 DOCX import: fix missing inside vertical borders caused by incomplete handling of tables with 1-column rows with merged cells. Have to check the rows below current to see if they contain also one cell, therefore form a column, or more than one cell, in which case do not remove vertical borders. Regression from commit: 8a2eb40abbd52d960dd21308157186be0ca9dd3d (tdf#129442 DOCX import: fix right border of 1-column tables). Change-Id: If9ca7ccd42255e78c61b6271e19262ab5cc8e439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89081 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 3726c9022b97..e2f9d6b1e14d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1050,6 +1050,17 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") #endif +DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") +{ +// tdf#130799: Inside vertical borders of a table should not be missing. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +// Left and right borders. +assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 4cb518eb29d8..458feaa6cd96 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -836,7 +836,17 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl // Do not apply vertical borders to a one column table. else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) { -rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +bool isOneCol = true; +for (size_t i = nRow; i < m_aCellProperties.size(); i++) +{ +if (m_aCellProperties[i].size() > 1) +{ +isOneCol = false; +break; +} +} +if (isOneCol) +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } // Do not apply horizontal borders to a one row table. else if (m_aCellProperties.size() == 1 && aRowOfCellsIterator->size() > 1) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - sc/qa sc/source
sc/qa/unit/data/ods/tdf142231.ods|binary sc/qa/unit/subsequent_export-test.cxx| 14 ++ sc/source/filter/xml/XMLExportDatabaseRanges.cxx |4 3 files changed, 18 insertions(+) New commits: commit 70189564fdbab3c75b4fce7accb2c91a1597b4d2 Author: Szabolcs Toth AuthorDate: Wed May 19 08:25:11 2021 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 2 13:28:30 2021 +0200 tdf#142231 sc odf: fix export of single date filter value by export the sting value of the filter condition, if its filter by date. Change-Id: I537fbd43810c78c0834480c9f1a480481aedd742 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115775 Tested-by: Balazs Varga Reviewed-by: Balazs Varga (cherry picked from commit f2c9da1ef662d10726a2dc709b46722ec7d4a016) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118262 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/tdf142231.ods b/sc/qa/unit/data/ods/tdf142231.ods new file mode 100644 index ..8b3e235625ce Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142231.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9b0aa643b1b4..ff43984bc327 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -212,6 +212,7 @@ public: void testTdf95640_ods_to_xlsx_with_standard_list(); void testTdf95640_xlsx_to_xlsx(); void testDateAutofilterXLSX(); +void testDateAutofilterODS(); void testRefStringXLSX(); void testRefStringConfigXLSX(); @@ -393,6 +394,7 @@ public: CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list); CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx); CPPUNIT_TEST(testDateAutofilterXLSX); +CPPUNIT_TEST(testDateAutofilterODS); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); @@ -4470,6 +4472,18 @@ void ScExportTest::testDateAutofilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testDateAutofilterODS() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf142231.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "Calc"); +assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", "2021-05-04"); +} + void ScExportTest::testTdf88657ODS() { ScDocShellRef xDocSh = loadDoc("tdf88657.", FORMAT_ODS); diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index 73362197a771..7611a2598f79 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -446,6 +446,10 @@ private: const ScQueryEntry::Item& rItem = rItems.front(); if (rItem.meType == ScQueryEntry::ByString) mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString()); +else if (rItem.meType == ScQueryEntry::ByDate) +{ +mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString()); +} else { mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_NUMBER); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source
oox/source/export/drawingml.cxx | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) New commits: commit b25c9bd18cfa544578ac87020b2b41d881e73e7f Author: Szabolcs Toth AuthorDate: Mon Jun 14 10:32:56 2021 +0200 Commit: László Németh CommitDate: Mon Jun 21 16:41:18 2021 +0200 tdf#137000: clean-up "XML shape export: fix upright" See commit ff5ca4e5fc6a9fb24b0eb6eb629210b024473f67 "tdf#137000 XLSX shape export: fix upright". Change-Id: Ie050da66f1eef4fc325b2acfd0a97d299c268153 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117135 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 20d2c2fe481eb66f518c554f8588ec87e0ee125a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117561 Tested-by: Jenkins diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 5f42dc18cd75..0372ae804b13 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3127,13 +3127,7 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo std::optional sHorzOverflow; std::optional sVertOverflow; -sal_Int32 nShapeRotateAngle = 0; -if (GetProperty(rXPropSet, "RotateAngle")) -nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; -Reference< XPropertySet > xTextSet(xXText, UNO_QUERY); -sal_Int32 nShapeTextRotateAngle = 0; -if (GetProperty(xTextSet, "RotateAngle")) -nShapeTextRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; +sal_Int32 nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; sal_Int16 nCols = 0; sal_Int32 nColSpacing = -1; if (GetProperty(rXPropSet, "TextColumns")) @@ -3193,7 +3187,7 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo // Keep upright and make the preRotateAngle 0, it is an attribute // of textBodyPr and must be 0 when upright is true, otherwise // bad rotation happens in MSO. -if (nShapeRotateAngle == nOldShapeRotation && nShapeTextRotateAngle == nOldTextRotation) +if (nShapeRotateAngle == nOldShapeRotation && nShapeRotateAngle == nOldTextRotation) nTextPreRotateAngle = 0; // So we rotated the shape, in this case lose upright and do // as LO normally does. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/source
oox/source/export/drawingml.cxx | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) New commits: commit 20d2c2fe481eb66f518c554f8588ec87e0ee125a Author: Szabolcs Toth AuthorDate: Mon Jun 14 10:32:56 2021 +0200 Commit: László Németh CommitDate: Mon Jun 21 13:17:55 2021 +0200 tdf#137000: clean-up "XML shape export: fix upright" See commit ff5ca4e5fc6a9fb24b0eb6eb629210b024473f67 "tdf#137000 XLSX shape export: fix upright". Change-Id: Ie050da66f1eef4fc325b2acfd0a97d299c268153 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117135 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 76874c5b1493..de8c2928ccba 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3220,13 +3220,7 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo std::optional sHorzOverflow; std::optional sVertOverflow; -sal_Int32 nShapeRotateAngle = 0; -if (GetProperty(rXPropSet, "RotateAngle")) -nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; -Reference< XPropertySet > xTextSet(xXText, UNO_QUERY); -sal_Int32 nShapeTextRotateAngle = 0; -if (GetProperty(xTextSet, "RotateAngle")) -nShapeTextRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; +sal_Int32 nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; sal_Int16 nCols = 0; sal_Int32 nColSpacing = -1; if (GetProperty(rXPropSet, "TextColumns")) @@ -3286,7 +3280,7 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo // Keep upright and make the preRotateAngle 0, it is an attribute // of textBodyPr and must be 0 when upright is true, otherwise // bad rotation happens in MSO. -if (nShapeRotateAngle == nOldShapeRotation && nShapeTextRotateAngle == nOldTextRotation) +if (nShapeRotateAngle == nOldShapeRotation && nShapeRotateAngle == nOldTextRotation) nTextPreRotateAngle = 0; // So we rotated the shape, in this case lose upright and do // as LO normally does. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf142231.ods|binary sc/qa/unit/subsequent_export-test.cxx| 14 ++ sc/source/filter/xml/XMLExportDatabaseRanges.cxx |4 3 files changed, 18 insertions(+) New commits: commit f2c9da1ef662d10726a2dc709b46722ec7d4a016 Author: Szabolcs Toth AuthorDate: Wed May 19 08:25:11 2021 +0200 Commit: Balazs Varga CommitDate: Wed May 26 09:11:26 2021 +0200 tdf#142231 sc odf: fix export of single date filter value by export the sting value of the filter condition, if its filter by date. Change-Id: I537fbd43810c78c0834480c9f1a480481aedd742 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115775 Tested-by: Balazs Varga Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/ods/tdf142231.ods b/sc/qa/unit/data/ods/tdf142231.ods new file mode 100644 index ..8b3e235625ce Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142231.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 7a74e6ebf1f6..ee9f0ee110e5 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -220,6 +220,7 @@ public: void testTdf95640_ods_to_xlsx_with_standard_list(); void testTdf95640_xlsx_to_xlsx(); void testDateAutofilterXLSX(); +void testDateAutofilterODS(); void testAutofilterColorsODF(); void testAutofilterColorsOOXML(); void testAutofilterColorsStyleOOXML(); @@ -410,6 +411,7 @@ public: CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list); CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx); CPPUNIT_TEST(testDateAutofilterXLSX); +CPPUNIT_TEST(testDateAutofilterODS); CPPUNIT_TEST(testAutofilterColorsODF); CPPUNIT_TEST(testAutofilterColorsOOXML); CPPUNIT_TEST(testAutofilterColorsStyleOOXML); @@ -4643,6 +4645,18 @@ void ScExportTest::testDateAutofilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testDateAutofilterODS() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf142231.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "Calc"); +assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", "2021-05-04"); +} + void ScExportTest::testAutofilterColorsODF() { ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_ODS); diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index c3f651e5416b..4e171d5b9da6 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -459,6 +459,10 @@ private: mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TEXT); mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString()); } +else if (rItem.meType == ScQueryEntry::ByDate) +{ +mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString()); +} else if (rItem.meType == ScQueryEntry::ByTextColor || rItem.meType == ScQueryEntry::ByBackgroundColor) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/source sc/qa
oox/source/drawingml/shape.cxx | 12 ++-- sc/qa/unit/data/xlsx/tdf141644.xlsx|binary sc/qa/unit/subsequent_export-test.cxx |4 ++-- sc/qa/unit/subsequent_filters-test.cxx | 27 +++ 4 files changed, 35 insertions(+), 8 deletions(-) New commits: commit b2190523e0b226bcae19cc8c3ce8a83855c7f009 Author: Szabolcs Toth AuthorDate: Wed May 19 08:42:29 2021 +0200 Commit: László Németh CommitDate: Tue May 25 13:41:29 2021 +0200 tdf#141644 OOXML shape import: fix upright text rotate angle Text rotate angle was not imported correctly with "upright" setting, e.g. resulting horizontal text in shapes of XLSX documents instead of vertical. Change-Id: I2ad9ba3465278220e64123c4400acff4125310d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115777 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index ed26e2313941..b0e2ddef30e7 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1507,6 +1507,9 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) ); nTextRotateAngle -= mnDiagramRotation; +/* OOX measures text rotation clockwise in 1/6th degrees, + relative to the containing shape. setTextRotateAngle wants degrees anticlockwise. */ +nTextRotateAngle = -1 * nTextRotateAngle / 6; if (getTextBody()->getTextProperties().moUpright) { @@ -1515,18 +1518,15 @@ Reference< XShape > const & Shape::createAndInsert( // shape containing it is rotated. // Hence, we rotate the text into the opposite direction of // the rotation of the shape, by as much as the shape was rotated. -mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); +mpCustomShapePropertiesPtr->setTextRotateAngle((mnRotation / 6) + nTextRotateAngle); // Also put the initial angles away in a GrabBag. putPropertyToGrabBag("Upright", Any(true)); putPropertyToGrabBag("nShapeRotationAtImport", Any(mnRotation / 6)); -putPropertyToGrabBag("nTextRotationAtImport", Any(mnRotation / 6)); +putPropertyToGrabBag("nTextRotationAtImport", Any(nTextRotateAngle)); } else { -/* OOX measures text rotation clockwise in 1/6th degrees, - relative to the containing shape. setTextRotateAngle wants - degrees anticlockwise. */ -mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 6); + mpCustomShapePropertiesPtr->setTextRotateAngle(nTextRotateAngle); } auto sHorzOverflow = getTextBody()->getTextProperties().msHorzOverflow; diff --git a/sc/qa/unit/data/xlsx/tdf141644.xlsx b/sc/qa/unit/data/xlsx/tdf141644.xlsx new file mode 100644 index ..61599d53fd62 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf141644.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 6d1b927e931a..7a74e6ebf1f6 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5856,8 +5856,8 @@ void ScExportTest::testTdf137000_handle_upright() = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); -assertXPathNoAttribute(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", - "rot"); +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", + "rot", "-540"); } void ScExportTest::testTdf126305_DataValidatyErrorAlert() diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 078bd9d3686a..0aed0e30c4b2 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -311,6 +311,7 @@ public: void testShapeRotationImport(); void testShapeDisplacementOnRotationImport(); void testTextBoxBodyUpright(); +void testTextBoxBodyRotateAngle(); void testTextLengthDataValidityXLSX(); void testDeleteCircles(); void testDrawCircleInMergeCells(); @@ -512,6 +513,7 @@ public: CPPUNIT_TEST(testShapeRotationImport); CPPUNIT_TEST(testShapeDisplacementOnRotationImport); CPPUNIT_TEST(testTextBoxBodyUpright); +CPPUNIT_TEST(testTextBoxBodyRotateAngle); CPPUNIT_TEST(testTextLengthDataValidityXLSX);
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/xcl97/xcl97rec.cxx | 11 +++ 2 files changed, 24 insertions(+), 8 deletions(-) New commits: commit 33dbe50194dbfaf2748691e6259eefdc63d35e67 Author: Szabolcs Toth AuthorDate: Thu Dec 31 10:31:30 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 15:08:49 2021 +0100 tdf#139258 XLSX export: fix position of rotated images Follow-up of commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d (tdf#123613 XLSX export: fix position of rotated shapes) and commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb (refactor for xlsx shape export). Change-Id: If5a79685efa1a80ea82eac19aed12bb426d10987 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108533 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit fddad2ed797f1773ed5be979a0b05d3f976b744e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109517 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit aa23da6b9e935fbfcb0b432d43c72f7a6db50657) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111885 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 760b194ed371..8df43f1e4922 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -276,6 +276,7 @@ public: void testTdf138824_linkToParentDirectory(); void testTdf129969(); void testTdf84874(); +void testTdf139258_rotated_image(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -446,6 +447,7 @@ public: CPPUNIT_TEST(testTdf138824_linkToParentDirectory); CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); +CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST_SUITE_END(); @@ -5694,6 +5696,25 @@ void ScExportTest::testTdf84874() xDocSh->DoClose(); } +void ScExportTest::testTdf139258_rotated_image() +{ +// Check that the topleft position of the image is correct. +ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +xmlDocUniquePtr pDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 38ad870c4970..b8676ca00e4e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1103,14 +1103,9 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& { sal_Int16 nHalfWidth = aSize.Width / 2; sal_Int16 nHalfHeight = aSize.Height / 2; -// aTopLeft needs correction for rotated customshapes -if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) -{ -const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape -aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; -aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; -} - +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/source
sc/source/filter/xcl97/xcl97rec.cxx | 47 ++-- 1 file changed, 24 insertions(+), 23 deletions(-) New commits: commit 7508e997dfdbd636870bbe71cccd1dfbdfbf3421 Author: Szabolcs Toth AuthorDate: Sat Dec 12 10:33:20 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 13:58:46 2021 +0100 refactor for xlsx shape export Just a refactor, fewer lines, less computing capacity. Change-Id: I3c3446c2917e9b5d2f205dd5c0110821ecf11f56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107613 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111886 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 3bb0d2af4608..38ad870c4970 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1094,32 +1094,33 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); -// size is correct, but aTopLeft needs correction for rotated shapes +// There are a few cases where we must adjust these values SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); -sal_Int32 nRotation = pObj->GetRotateAngle(); -if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) +if (pObj) { -const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape -aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); -aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); -} - -uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); -uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); -sal_Int32 nRot = nRotProp.get(); - -if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) -{ -// MSO changes the anchor positions at these angles and that does an extra 90 degrees -// rotation on our shapes, so we output it in such position that MSO -// can draw this shape correctly. - -sal_Int16 nHalfWidth = aSize.Width / 2; -sal_Int16 nHalfHeight = aSize.Height / 2; -aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; -aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; +sal_Int32 nRotation = pObj->GetRotateAngle(); +if (nRotation != 0) +{ +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +// aTopLeft needs correction for rotated customshapes +if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) +{ +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; +} -std::swap(aSize.Width, aSize.Height); +// MSO changes the anchor positions at these angles and that does an extra 90 degrees +// rotation on our shapes, so we output it in such position that MSO +// can draw this shape correctly. +if ((nRotation >= 45 * 100 && nRotation < 135 * 100) || (nRotation >= 225 * 100 && nRotation < 315 * 100)) +{ +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; +std::swap(aSize.Width, aSize.Height); +} +} } tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 16 sc/source/filter/xcl97/xcl97rec.cxx | 10 ++ 2 files changed, 22 insertions(+), 4 deletions(-) New commits: commit 87118c2e311af035171ec4b53609cc9e7a7b139e Author: Szabolcs Toth AuthorDate: Tue Dec 8 16:21:25 2020 +0100 Commit: Gabor Kelemen CommitDate: Tue Mar 2 15:17:45 2021 +0100 tdf#123613 XLSX export: fix position of rotated shapes based on the bounding box of the custom shape. Change-Id: I63a2a4380ae0c6c0eb37d3e5e4dcbfc839b410a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107424 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111786 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f9290a8d5995..3010bac88ead 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5364,8 +5364,9 @@ void ScExportTest::testHeaderFontStyleXLSX() void ScExportTest::testTdf135828_Shape_Rect() { -// tdf#135828 Check that the width and the height of rectangle of the shape -// is correct. +// tdf#135828 Check that the width and the height of rectangle of the shape is correct. +// tdf#123613 Check the positioning, and allow massive rounding errors because of the back and +// forth conversion between emu and hmm. ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.is()); @@ -5377,8 +5378,15 @@ void ScExportTest::testTdf135828_Shape_Rect() xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +double nXPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "x" ).toDouble(); +double nYPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "y" ).toDouble(); +double nWidth = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx").toDouble(); +double nHeight= getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy").toDouble(); + +CPPUNIT_ASSERT_DOUBLES_EQUAL( 854640, nXPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( -570600, nYPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 294840, nWidth, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 1988280,nHeight, 1); } void ScExportTest::testTdf123353() diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 215c38055cd7..77265db3f21f 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1103,6 +1103,16 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); +// size is correct, but aTopLeft needs correction for rotated shapes +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); +sal_Int32 nRotation = pObj->GetRotateAngle(); +if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) +{ +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); +} + uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); sal_Int32 nRot = nRotProp.get(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/source sc/qa
oox/source/drawingml/shape.cxx | 10 +++-- oox/source/export/drawingml.cxx| 37 +++-- sc/qa/unit/data/xlsx/tdf137000_export_upright.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 21 +++ 4 files changed, 61 insertions(+), 7 deletions(-) New commits: commit c080b0a44facfbbf4ca9e3ad74a93306df322df6 Author: Szabolcs Toth AuthorDate: Thu Sep 17 11:22:09 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 15:13:39 2021 +0100 tdf#137000 XLSX shape export: fix upright Upright is an XML attribute of xdr:txBody/a:bodyPr. It is set in MSO when in a textbox menu we choose "Do not rotate this element". LO import uses a text rotation opposite shape rotation to create upright text, but when exporting the attribute "upright" we must make sure that the text rotation in bodyPr is 0, not the temporary opposite value. Otherwise MSO rotates the text. Note: integer precision of rotation is enough for interoperability, because it's possible to rotate the shapes only by whole degrees in MSO. Follow-up of commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b (tdf#106197 XLSX shape import: keep text upright). Co-authored-by: Balázs Regényi Change-Id: I0ffae41f83d3fc3a1fa37f413a8fc9fd8ccd9b6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103094 Tested-by: László Németh Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111412 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 8d15beca453e..a69404094db1 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1430,8 +1430,7 @@ Reference< XShape > const & Shape::createAndInsert( nTextRotateAngle -= mnDiagramRotation; -bool isUpright = getTextBody()->getTextProperties().moUpright; -if (isUpright) +if (getTextBody()->getTextProperties().moUpright) { // When upright is set, we want the text without any rotation. // But if we set 0 here, the text is still rotated if the @@ -1439,8 +1438,11 @@ Reference< XShape > const & Shape::createAndInsert( // Hence, we rotate the text into the the opposite direction of // the rotation of the shape, by as much as the shape was rotated. mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); -// Also put this away in a Gabbag. -putPropertyToGrabBag("Upright", Any(isUpright)); + +// Also put the initial angles away in a GrabBag. +putPropertyToGrabBag("Upright", Any(true)); +putPropertyToGrabBag("nShapeRotationAtImport", Any(mnRotation / 6)); +putPropertyToGrabBag("nTextRotationAtImport", Any(mnRotation / 6)); } else { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 1532ce2b2ad2..6a9b4d3f6186 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2863,20 +2863,31 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin pWrap = "square"; } -bool isUpright = false; std::optional sHorzOverflow; std::optional sVertOverflow; +sal_Int32 nShapeRotateAngle = 0; +if (GetProperty(rXPropSet, "RotateAngle")) +nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; +Reference< XPropertySet > xTextSet(xXText, UNO_QUERY); +sal_Int32 nShapeTextRotateAngle = 0; +if (GetProperty(xTextSet, "RotateAngle")) +nShapeTextRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; +std::optional isUpright; if (GetProperty(rXPropSet, "InteropGrabBag")) { if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) { +bool bUpright = false; +sal_Int32 nOldShapeRotation = 0; +sal_Int32 nOldTextRotation = 0; uno::Sequence aGrabBag; rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; for (const auto& aProp : std::as_const(aGrabBag)) { if (aProp.Name == "Upright") { -aProp.Value >>= isUpright; +aProp.Value >>= bUpright; +isUpright = OString(bUpright ? "1" : "0"); } else if (aProp.Name == "horzOverflow") { @@ -2891,6 +2902,26 @@ void
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/inc oox/source sc/qa
oox/inc/drawingml/textbodyproperties.hxx |1 oox/source/drawingml/shape.cxx | 24 +-- oox/source/drawingml/textbodypropertiescontext.cxx |5 +- oox/source/export/drawingml.cxx| 37 - sc/qa/unit/data/xlsx/tdf106197_import_upright.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 45 + 6 files changed, 89 insertions(+), 23 deletions(-) New commits: commit 2967aae06af4c6c56da53db67e2e6fb297b4881e Author: Szabolcs Toth AuthorDate: Wed Sep 16 14:41:24 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 16:18:53 2021 +0100 tdf#106197 XLSX shape import: keep text upright Handle and grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction after import and after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If4c73aeaebad55af967cea894a94756068ca3766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102870 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/43 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx index eddf78a5f97f..27ca26fabc67 100644 --- a/oox/inc/drawingml/textbodyproperties.hxx +++ b/oox/inc/drawingml/textbodyproperties.hxx @@ -35,6 +35,7 @@ struct TextBodyProperties OptValue< sal_Int32 > moRotation; boolmbAnchorCtr; OptValue< sal_Int32 > moVert; +boolmoUpright = false; std::optional< sal_Int32 >moInsets[4]; std::optional< sal_Int32 >moTextOffUpper; std::optional< sal_Int32 >moTextOffLeft; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 567564479846..173095b37df2 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1429,10 +1429,26 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) ); nTextRotateAngle -= mnDiagramRotation; -/* OOX measures text rotation clockwise in 1/6th degrees, - relative to the containing shape. setTextRotateAngle wants - degrees anticlockwise. */ -mpCustomShapePropertiesPtr->setTextRotateAngle( -1 * nTextRotateAngle / 6 ); + +bool isUpright = getTextBody()->getTextProperties().moUpright; +if (isUpright) +{ +// When upright is set, we want the text without any rotation. +// But if we set 0 here, the text is still rotated if the +// shape containing it is rotated. +// Hence, we rotate the text into the the opposite direction of +// the rotation of the shape, by as much as the shape was rotated. +mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); +// Also put this away in a Gabbag. +putPropertyToGrabBag("Upright", Any(isUpright)); +} +else +{ +/* OOX measures text rotation clockwise in 1/6th degrees, + relative to the containing shape. setTextRotateAngle wants + degrees anticlockwise. */ +mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 6); +} } // Note that the script oox/source/drawingml/customshapes/generatePresetsData.pl looks diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 14f23c935b34..699c15ec2632 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -94,7 +94,10 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons // ST_PositiveCoordinate // sal_Int32 nSpcCol = rAttribs.getInteger( XML_spcCol, 0 ); // bool bSpcFirstLastPara = rAttribs.getBool( XML_spcFirstLastPara, 0 ); -// bool bUpRight = rAttribs.getBool( XML_upright, 0 ); + +bool bUpright = rAttribs.getBool(XML_upright, false); +if (bUpright) +mrTextBodyProp.moUpright = true; // ST_TextVerticalType if( rAttribs.hasAttribute( XML_vert ) ) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 70ecafec02f9..0728a131550f 100644 ---
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/source sw/qa
oox/source/export/drawingml.cxx | 19 oox/source/shape/WpsContext.cxx | 11 ++ sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 10 ++ 4 files changed, 40 insertions(+) New commits: commit 691de5dc45a86844c53723b4e32180876a0fc1c9 Author: Szabolcs Toth AuthorDate: Mon Sep 14 17:16:51 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 15:59:47 2021 +0100 tdf#123610 DOCX shape import: keep text upright Grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction in MSO after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If18a12c7728317a7af093048b07bc392d2964389 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102690 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d3094b98231730b8e6d863c6a2fc0dd62f3e991a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/41 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index de2d34979471..70ecafec02f9 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2813,6 +2813,24 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin else if( bVertical && eHorizontalAlignment == TextHorizontalAdjust_LEFT ) sVerticalAlignment = "b"; +bool isUpright = false; +if (GetProperty(rXPropSet, "InteropGrabBag")) +{ +if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) +{ +uno::Sequence aGrabBag; +rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; +for (auto& aProp : aGrabBag) +{ +if (aProp.Name == "Upright") +{ +aProp.Value >>= isUpright; +break; +} +} +} +} + bool bHasWrap = false; bool bWrap = false; // Only custom shapes obey the TextWordWrap option, normal text always wraps. @@ -2844,6 +2862,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin XML_anchor, sVerticalAlignment, XML_anchorCtr, bHorizontalCenter ? "1" : nullptr, XML_vert, sWritingMode, + XML_upright, isUpright ? "1" : "0", XML_rot, ((nTextPreRotateAngle + nTextRotateAngle) != 0) ? oox::drawingml::calcRotationValue( (nTextPreRotateAngle + nTextRotateAngle) * 100 ).getStr() : nullptr ); if (bIsFontworkShape) { diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index f78c38ff91e9..076fd1124307 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -96,6 +96,17 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken } } +if (bool bUpright = rAttribs.getBool(XML_upright, false)) +{ +uno::Sequence aGrabBag; +xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; +sal_Int32 length = aGrabBag.getLength(); +aGrabBag.realloc(length + 1); +aGrabBag[length].Name = "Upright"; +aGrabBag[length].Value <<= bUpright; +xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag)); +} + if (xServiceInfo.is()) { // Handle inset attributes for Writer textframes. diff --git a/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx b/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx new file mode 100644 index ..d7dc1978a067 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index a7fa86d47a14..61ba601ed1c5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1190,6 +1190,16 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, "tdf133 CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBodyPrUpright, "tdf123610_handle_upright.docx") +{ +// tdf#123610: Check grab-bag attribute upright to keep text upright regardless of shape rotation. + +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + +assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor" +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/qa sc/source
sc/qa/unit/data/ods/tdf139258_rotated_image.ods |binary sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/xcl97/xcl97rec.cxx | 11 --- 3 files changed, 25 insertions(+), 7 deletions(-) New commits: commit aa23da6b9e935fbfcb0b432d43c72f7a6db50657 Author: Szabolcs Toth AuthorDate: Thu Dec 31 10:31:30 2020 +0100 Commit: Xisco Fauli CommitDate: Tue Jan 19 11:43:42 2021 +0100 tdf#139258 XLSX export: fix position of rotated images Follow-up of commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d (tdf#123613 XLSX export: fix position of rotated shapes) and commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb (refactor for xlsx shape export). Change-Id: If5a79685efa1a80ea82eac19aed12bb426d10987 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108533 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit fddad2ed797f1773ed5be979a0b05d3f976b744e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109517 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/qa/unit/data/ods/tdf139258_rotated_image.ods b/sc/qa/unit/data/ods/tdf139258_rotated_image.ods new file mode 100755 index ..a90537c14bd9 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf139258_rotated_image.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 054452eb6784..e2da767d9bbb 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -278,6 +278,7 @@ public: void testTdf129969(); void testTdf84874(); void testTdf136721_paper_size(); +void testTdf139258_rotated_image(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -454,6 +455,7 @@ public: CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); CPPUNIT_TEST(testTdf136721_paper_size); +CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST_SUITE_END(); @@ -5778,6 +5780,25 @@ void ScExportTest::testTdf136721_paper_size() assertXPath(pDoc, "/x:worksheet/x:pageSetup", "paperSize", "70"); } +void ScExportTest::testTdf139258_rotated_image() +{ +// Check that the topleft position of the image is correct. +ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +xmlDocUniquePtr pDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 1fde9272f3f5..2eacb3edf28b 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1109,13 +1109,10 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& { sal_Int16 nHalfWidth = aSize.Width / 2; sal_Int16 nHalfHeight = aSize.Height / 2; -// aTopLeft needs correction for rotated customshapes -if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) -{ -const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape -aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; -aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; -} + +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf139258_rotated_image.ods |binary sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/xcl97/xcl97rec.cxx | 11 --- 3 files changed, 25 insertions(+), 7 deletions(-) New commits: commit fddad2ed797f1773ed5be979a0b05d3f976b744e Author: Szabolcs Toth AuthorDate: Thu Dec 31 10:31:30 2020 +0100 Commit: László Németh CommitDate: Fri Jan 15 12:48:07 2021 +0100 tdf#139258 XLSX export: fix position of rotated images Follow-up of commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d (tdf#123613 XLSX export: fix position of rotated shapes) and commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb (refactor for xlsx shape export). Change-Id: If5a79685efa1a80ea82eac19aed12bb426d10987 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108533 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf139258_rotated_image.ods b/sc/qa/unit/data/ods/tdf139258_rotated_image.ods new file mode 100755 index ..a90537c14bd9 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf139258_rotated_image.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1f8b648d81c6..27fa72e76d30 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -278,6 +278,7 @@ public: void testTdf129969(); void testTdf84874(); void testTdf136721_paper_size(); +void testTdf139258_rotated_image(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -454,6 +455,7 @@ public: CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); CPPUNIT_TEST(testTdf136721_paper_size); +CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST_SUITE_END(); @@ -5769,6 +5771,25 @@ void ScExportTest::testTdf136721_paper_size() assertXPath(pDoc, "/x:worksheet/x:pageSetup", "paperSize", "70"); } +void ScExportTest::testTdf139258_rotated_image() +{ +// Check that the topleft position of the image is correct. +ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +xmlDocUniquePtr pDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 24adafbae8a4..55eff899c3bb 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,13 +1100,10 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& { sal_Int16 nHalfWidth = aSize.Width / 2; sal_Int16 nHalfHeight = aSize.Height / 2; -// aTopLeft needs correction for rotated customshapes -if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) -{ -const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape -aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; -aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; -} + +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/inc sc/qa sc/source
sc/inc/detfunc.hxx |5 +- sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods |binary sc/qa/unit/subsequent_export-test.cxx | 16 + sc/source/core/tool/detfunc.cxx| 14 ++-- sc/source/filter/xcl97/xcl97rec.cxx| 17 ++ 5 files changed, 47 insertions(+), 5 deletions(-) New commits: commit 095035575d44bed6d6a6cad3f7fbb5bbd63eceb5 Author: Szabolcs Toth AuthorDate: Tue Sep 1 13:46:38 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 16:58:26 2021 +0100 tdf#133688 tdf#125414 XLSX: don't export tracer arrows (see Tools->Detective) as plain shapes. Co-authored-by: Balázs Regényi Change-Id: I920445637a6be12169ae7d70295e4460d7f9b26b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101845 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 14b40ec7be7ca8315848034591e3c3a246d5a8dd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108893 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index 28394627e913..b8d1d2c0bc81 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -42,10 +42,11 @@ enum ScDetectiveObjType SC_DETOBJ_ARROW, SC_DETOBJ_FROMOTHERTAB, SC_DETOBJ_TOOTHERTAB, -SC_DETOBJ_CIRCLE +SC_DETOBJ_CIRCLE, +SC_DETOBJ_RECTANGLE }; -class ScDetectiveFunc +class SC_DLLPUBLIC ScDetectiveFunc { static Color nArrowColor; static Color nErrorColor; diff --git a/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods new file mode 100644 index ..3dfdee77f143 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 38231f8dab98..56f38a3697a9 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -262,6 +262,7 @@ public: void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); void testTdf123353(); +void testTdf133688_precedents(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -418,6 +419,7 @@ public: CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST(testTdf123353); +CPPUNIT_TEST(testTdf133688_precedents); CPPUNIT_TEST_SUITE_END(); @@ -5294,6 +5296,20 @@ void ScExportTest::testTdf123353() xShell->DoClose(); } +void ScExportTest::testTdf133688_precedents() +{ +// tdf#133688 Check that we do not export detective shapes. +ScDocShellRef xShell = loadDoc("tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +// We do not export any shapes. +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 4923a2f68345..3f0419364bac 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1605,16 +1605,24 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject, if ( nObjColor == GetErrorColor() && nObjColor != GetArrowColor() ) rRedLine = true; } -else if ( dynamic_cast( pObject) != nullptr ) +else if (dynamic_cast(pObject) != nullptr) { -if ( bValidStart ) +if (bValidStart) { // cell position is returned in rPosition - rPosition = pData->maStart; eType = SC_DETOBJ_CIRCLE; } } +else if (dynamic_cast(pObject) != nullptr) +{ +if (bValidStart) +{ +// cell position is returned in rPosition +rPosition = pData->maStart; +eType = SC_DETOBJ_RECTANGLE; +} +} } } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 6c05b87e871c..215c38055cd7 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -68,6 +68,7 @@ #include #include #include +#include #include @@ -1094,6 +1095,7 @@ ExcBof8_Base::ExcBof8_Base() nRupBuild = 0x0dbb; nRupYear= 0x07cc; } + void
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 sc/source/filter/xcl97/xcl97rec.cxx| 19 +++ 3 files changed, 39 insertions(+) New commits: commit 20a87f9607317c223070f4c884c8ae654430cff1 Author: Szabolcs Toth AuthorDate: Mon Aug 17 10:55:43 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 14:56:05 2021 +0100 tdf#135828 XLSX shape export: fix distortion of rotated shapes Shapes that were rotated at angles {[45, 135) U [225, 315)} need new anchor positions that does an extra 90 degrees rotation. See commit 130e6a3f4493b987a7d0b177cc84d65219b47d13 (tdf#83593 XLSX DrawingML shape import: fix missing rotation) Co-authored-by: Balázs Regényi Change-Id: I42a5d203cf3b6f6e725d84dd5f39ac323f4f1ceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100853 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5e8875780d665b7ae0fee1a053b5ce78ec513f69) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108866 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx new file mode 100644 index ..c01c81ab6d74 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 895754f5e780..316af342f200 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -260,6 +260,7 @@ public: void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testTdf134459_HeaderFooterColorXLSX(); void testHeaderFontStyleXLSX(); +void testTdf135828_Shape_Rect(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -414,6 +415,7 @@ public: CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); +CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST_SUITE_END(); @@ -5253,6 +5255,24 @@ void ScExportTest::testHeaderFontStyleXLSX() xShell->DoClose(); } +void ScExportTest::testTdf135828_Shape_Rect() +{ +// tdf#135828 Check that the width and the height of rectangle of the shape +// is correct. +ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index d4f6eae65344..6c05b87e871c 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,6 +1100,25 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); + +uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) +{ +// MSO changes the anchor positions at these angles and that does an extra 90 degrees +// rotation on our shapes, so we output it in such position that MSO +// can draw this shape correctly. + +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; + +std::swap(aSize.Width, aSize.Height); +} + tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation ); tools::Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/source
sc/source/filter/xcl97/xcl97rec.cxx | 42 +--- 1 file changed, 20 insertions(+), 22 deletions(-) New commits: commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb Author: Szabolcs Toth AuthorDate: Sat Dec 12 10:33:20 2020 +0100 Commit: Caolán McNamara CommitDate: Sat Dec 12 21:09:39 2020 +0100 refactor for xlsx shape export Just a refactor, fewer lines, less computing capacity. Change-Id: I3c3446c2917e9b5d2f205dd5c0110821ecf11f56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107613 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index ed4dbf5da31e..1fde9272f3f5 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,35 +1100,33 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); -// size is correct, but aTopLeft needs correction for rotated shapes +// There are a few cases where we must adjust these values SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); -sal_Int32 nRotation = pObj->GetRotateAngle(); -if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) +if (pObj) { -const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape -aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); -aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); -} - -uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); -uno::Reference xPropertySetInfo = xShapeProperties->getPropertySetInfo(); -if (xPropertySetInfo->hasPropertyByName("RotateAngle")) -{ -uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); -sal_Int32 nRot = nRotProp.get(); - -if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) +sal_Int32 nRotation = pObj->GetRotateAngle(); +if (nRotation != 0) { +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +// aTopLeft needs correction for rotated customshapes +if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) +{ +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; +} + // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. +if ((nRotation >= 45 * 100 && nRotation < 135 * 100) || (nRotation >= 225 * 100 && nRotation < 315 * 100)) +{ +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; -sal_Int16 nHalfWidth = aSize.Width / 2; -sal_Int16 nHalfHeight = aSize.Height / 2; -aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; -aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; - -std::swap(aSize.Width, aSize.Height); +std::swap(aSize.Width, aSize.Height); +} } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 16 sc/source/filter/xcl97/xcl97rec.cxx | 10 ++ 2 files changed, 22 insertions(+), 4 deletions(-) New commits: commit 8f7c26f166df33589f3522b43dbea4169a9ffd1e Author: Szabolcs Toth AuthorDate: Tue Dec 8 16:21:25 2020 +0100 Commit: Xisco Fauli CommitDate: Fri Dec 11 17:47:54 2020 +0100 tdf#123613 XLSX export: fix position of rotated shapes based on the bounding box of the custom shape. Change-Id: I63a2a4380ae0c6c0eb37d3e5e4dcbfc839b410a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107424 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107599 Tested-by: Jenkins diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 03d63baeeabd..6f3e4d3d36e5 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5409,8 +5409,9 @@ void ScExportTest::testHeaderFontStyleXLSX() void ScExportTest::testTdf135828_Shape_Rect() { -// tdf#135828 Check that the width and the height of rectangle of the shape -// is correct. +// tdf#135828 Check that the width and the height of rectangle of the shape is correct. +// tdf#123613 Check the positioning, and allow massive rounding errors because of the back and +// forth conversion between emu and hmm. ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.is()); @@ -5422,8 +5423,15 @@ void ScExportTest::testTdf135828_Shape_Rect() xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +double nXPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "x" ).toDouble(); +double nYPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "y" ).toDouble(); +double nWidth = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx").toDouble(); +double nHeight= getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy").toDouble(); + +CPPUNIT_ASSERT_DOUBLES_EQUAL( 854640, nXPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( -570600, nYPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 294840, nWidth, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 1988280,nHeight, 1); } void ScExportTest::testTdf123353() diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index a095a599c58a..ed4dbf5da31e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,6 +1100,16 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); +// size is correct, but aTopLeft needs correction for rotated shapes +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); +sal_Int32 nRotation = pObj->GetRotateAngle(); +if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) +{ +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); +} + uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); uno::Reference xPropertySetInfo = xShapeProperties->getPropertySetInfo(); if (xPropertySetInfo->hasPropertyByName("RotateAngle")) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 16 sc/source/filter/xcl97/xcl97rec.cxx | 10 ++ 2 files changed, 22 insertions(+), 4 deletions(-) New commits: commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d Author: Szabolcs Toth AuthorDate: Tue Dec 8 16:21:25 2020 +0100 Commit: László Németh CommitDate: Fri Dec 11 10:09:42 2020 +0100 tdf#123613 XLSX export: fix position of rotated shapes based on the bounding box of the custom shape. Change-Id: I63a2a4380ae0c6c0eb37d3e5e4dcbfc839b410a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107424 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9da6af5cde8b..ce6083a591c2 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5409,8 +5409,9 @@ void ScExportTest::testTdf135828_Shape_Rect() { if (!IsDefaultDPI()) return; -// tdf#135828 Check that the width and the height of rectangle of the shape -// is correct. +// tdf#135828 Check that the width and the height of rectangle of the shape is correct. +// tdf#123613 Check the positioning, and allow massive rounding errors because of the back and +// forth conversion between emu and hmm. ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.is()); @@ -5422,8 +5423,15 @@ void ScExportTest::testTdf135828_Shape_Rect() xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +double nXPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "x" ).toDouble(); +double nYPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "y" ).toDouble(); +double nWidth = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx").toDouble(); +double nHeight= getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy").toDouble(); + +CPPUNIT_ASSERT_DOUBLES_EQUAL( 854640, nXPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( -570600, nYPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 294840, nWidth, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 1988280,nHeight, 1); } void ScExportTest::testTdf123353() diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index a095a599c58a..ed4dbf5da31e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,6 +1100,16 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); +// size is correct, but aTopLeft needs correction for rotated shapes +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); +sal_Int32 nRotation = pObj->GetRotateAngle(); +if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) +{ +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); +} + uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); uno::Reference xPropertySetInfo = xShapeProperties->getPropertySetInfo(); if (xPropertySetInfo->hasPropertyByName("RotateAngle")) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source sc/qa
filter/source/msfilter/util.cxx|4 ++- sc/qa/unit/data/xlsx/tdf136721_letter_sized_paper.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 18 +++-- 3 files changed, 19 insertions(+), 3 deletions(-) New commits: commit 9dd43f97b0d8223b571573d1fe5d899fc38d89ba Author: Szabolcs Toth AuthorDate: Fri Nov 6 10:44:17 2020 +0100 Commit: László Németh CommitDate: Tue Nov 10 11:08:39 2020 +0100 tdf#136721 XLSX: add missing A6 paper format Unrecognized A6 paper format was converted to the default A4/Letter previously, see Paper Format in Format->Page... Co-authored-by: Balázs Regényi Change-Id: If2ea0c4137177aa8be66cb11d4732b14cbc14455 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105392 Tested-by: László Németh Reviewed-by: László Németh diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 52421c99f892..778fdce07c3f 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -218,7 +218,9 @@ const ApiPaperSize spPaperSizeTable[] = { MM2MM100( 201 ), MM2MM100( 276 ) }, // 65 - ISO B5 extra paper { MM2MM100( 420 ), MM2MM100( 594 ) }, // 66 - A2 paper { MM2MM100( 297 ), MM2MM100( 420 ) }, // 67 - A3 transverse paper -{ MM2MM100( 322 ), MM2MM100( 445 ) } // 68 - A3 extra transverse paper +{ MM2MM100( 322 ), MM2MM100( 445 ) }, // 68 - A3 extra transverse paper +{ 0, 0 },// 69 - undefined +{ MM2MM100( 105 ), MM2MM100( 148 ),}, // 70 - A6 paper }; sal_Int32 PaperSizeConv::getMSPaperSizeIndex( const css::awt::Size& rSize ) diff --git a/sc/qa/unit/data/xlsx/tdf136721_letter_sized_paper.xlsx b/sc/qa/unit/data/xlsx/tdf136721_letter_sized_paper.xlsx new file mode 100644 index ..3027a9c0f142 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf136721_letter_sized_paper.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b5e382bc0ecf..f9e6e1f3ebb5 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -272,6 +272,7 @@ public: void testTdf76047_externalLink(); void testTdf129969(); void testTdf84874(); +void testTdf136721_paper_size(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -442,6 +443,7 @@ public: CPPUNIT_TEST(testTdf76047_externalLink); CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); +CPPUNIT_TEST(testTdf136721_paper_size); CPPUNIT_TEST_SUITE_END(); @@ -5566,7 +5568,7 @@ void ScExportTest::testTdf84874() const ScValidationData* pData = rDoc.GetValidationEntry(1); OUString aTitle, aText; -pData->GetInput( aTitle, aText ); +pData->GetInput(aTitle, aText); sal_uInt32 nPromptTitleLen = aTitle.getLength(); sal_uInt32 nPromptTextLen = aText.getLength(); @@ -5574,7 +5576,7 @@ void ScExportTest::testTdf84874() CPPUNIT_ASSERT_EQUAL(static_cast(255), nPromptTextLen); ScValidErrorStyle eErrStyle = SC_VALERR_STOP; -pData->GetErrMsg( aTitle, aText, eErrStyle ); +pData->GetErrMsg(aTitle, aText, eErrStyle); sal_uInt32 nErrorTitleLen = aTitle.getLength(); sal_uInt32 nErrorTextLen = aText.getLength(); @@ -5584,6 +5586,18 @@ void ScExportTest::testTdf84874() xDocSh->DoClose(); } +void ScExportTest::testTdf136721_paper_size() +{ +ScDocShellRef xShell = loadDoc("tdf136721_letter_sized_paper.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:worksheet/x:pageSetup", "paperSize", "70"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/source sw/qa
oox/source/vml/vmlshape.cxx |4 + sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 34 +- 3 files changed, 37 insertions(+), 1 deletion(-) New commits: commit 799522882159b839cc7aeec2fbc48f767507a30c Author: Szabolcs Toth AuthorDate: Wed Oct 28 09:50:00 2020 +0100 Commit: Balazs Varga CommitDate: Fri Oct 30 11:53:40 2020 +0100 tdf#137642 VML shape import: fix alignment from top margin Use the new define PAGE_PRINT_AREA_TOP at import. Everything else is handled in the previous patches. Change-Id: Ie801ab71a33a657551dbc5bfb63d1491aaa73abd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104923 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index a83cb6b2c76c..1e3e1f72e64d 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -608,6 +608,10 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType { rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA); } +else if (rTypeModel.maPositionVerticalRelative == "top-margin-area") +{ +rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA_TOP); +} else if (rTypeModel.maPositionVerticalRelative == "bottom-margin-area") { rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA_BOTTOM); diff --git a/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx new file mode 100644 index ..fbe8b264bbc4 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 4c0dfbf9ebbb..b9f01391e3f2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1560,8 +1560,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx") assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf137641_RelativeFromTopMargin.docx") +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMarginDML, "tdf137641_RelativeFromTopMargin.docx") { +// Import as DML. xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, @@ -1590,6 +1591,37 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf1376 "center"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMarginVML, "tdf137642_Vertical_Alignment_toppage.docx") +{ +// Import as VML. +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + +assertXPath(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" +"wp:anchor/wp:positionV", +"relativeFrom", "topMargin"); +assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "top"); +assertXPath(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" +"wp:anchor/wp:positionV", +"relativeFrom", "topMargin"); +assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "bottom"); +assertXPath(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" +"wp:anchor/wp:positionV", +"relativeFrom", "topMargin"); +assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "center"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/xmloff schema/libreoffice sw/qa xmloff/source
include/xmloff/xmltoken.hxx |2 ++ schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |2 ++ sw/qa/extras/odfexport/data/page-content-top.odt|binary sw/qa/extras/odfexport/odfexport.cxx|9 + xmloff/source/core/xmltoken.cxx |2 ++ xmloff/source/style/xmlexppr.cxx|6 ++ xmloff/source/text/txtprhdl.cxx |2 ++ xmloff/source/token/tokens.txt |1 + 8 files changed, 24 insertions(+) New commits: commit bc9049851fd7e914fd695bcfb3c9a94a19634ce0 Author: Szabolcs Toth AuthorDate: Thu Oct 15 16:13:08 2020 +0200 Commit: László Németh CommitDate: Thu Oct 29 17:52:48 2020 +0100 tdf#137627 sw top page border orientation: add ODF Map between RelOrientation::PAGE_PRINT_AREA_TOP and loext:vertical-rel="page-content-top". Follow-up of commit 1c593e1916c9164c7db71da2017cfc26972f8e9f (tdf#133045 sw: add shape alignment to the top page border). See also commit 65b7873aab5deec7157328047e869a6385e0a74a (sw from-bottom relative orientation: add ODF filter). Change-Id: I9bff7a9507152262dda7d126fa3e7e1bee6a8276 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104554 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 1b7a932f9399..99b94be7e2cc 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -3368,6 +3368,8 @@ namespace xmloff::token { XML_RESOLVED, +XML_PAGE_CONTENT_TOP, + XML_PAGE_CONTENT_BOTTOM, XML_TOKEN_END diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng index 9167044ca87e..0c0b41ef4ca9 100644 --- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng +++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng @@ -2291,11 +2291,13 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. + + page-content-top page-content-bottom diff --git a/sw/qa/extras/odfexport/data/page-content-top.odt b/sw/qa/extras/odfexport/data/page-content-top.odt new file mode 100644 index ..755d50242e4e Binary files /dev/null and b/sw/qa/extras/odfexport/data/page-content-top.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 6c1f2d6ccff8..8767b76110bb 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -2624,6 +2624,15 @@ DECLARE_ODFEXPORT_TEST(testRovasNumbering, "rovas-numbering.odt") aMap["NumberingType"].get()); } +DECLARE_ODFEXPORT_TEST(testPageContentTop, "page-content-top.odt") +{ +CPPUNIT_ASSERT_EQUAL(1, getShapes()); +CPPUNIT_ASSERT_EQUAL(1, getPages()); +uno::Reference xShape(getShape(1), uno::UNO_QUERY); +sal_Int16 nExpected = text::RelOrientation::PAGE_PRINT_AREA_TOP; +CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xShape, "VertOrientRelation")); +} + DECLARE_ODFEXPORT_TEST(testPageContentBottom, "page-content-bottom.odt") { CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index d78de79842aa..23186f625a75 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3365,6 +3365,8 @@ namespace xmloff::token { // For recording whether comments/annotations are resolved TOKEN( "resolved",XML_RESOLVED ), +TOKEN( "page-content-top",XML_PAGE_CONTENT_TOP ), + TOKEN( "page-content-bottom", XML_PAGE_CONTENT_BOTTOM ), #if OSL_DEBUG_LEVEL > 0 diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index b65669aed3c3..893e0fb36ee4 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -1080,6 +1080,12 @@ void SvXMLExportPropertyMapper::_exportXML( XML_NAMESPACE_LO_EXT, mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex)); } +if (IsXMLToken(aValue, XML_PAGE_CONTENT_TOP)) +{ +sName = rNamespaceMap.GetQNameByKey( +XML_NAMESPACE_LO_EXT, + mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex)); +} } rAttrList.AddAttribute( sName, aValue ); diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index d430c09a8878..77dbcb1bdd27 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -153,6
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 30 ++ sw/source/filter/ww8/docxsdrexport.cxx |3 + 3 files changed, 33 insertions(+) New commits: commit c690d49770d0c93a95bd8c3d11e95c1d17a17a60 Author: Szabolcs Toth AuthorDate: Wed Oct 14 16:32:05 2020 +0200 Commit: László Németh CommitDate: Tue Oct 27 13:35:49 2020 +0100 tdf#137641 DOCX export: fix relative from top page border alignment. Follow-up of commit 1c593e1916c9164c7db71da2017cfc26972f8e9f (tdf#133045 sw: add shape alignment to the top page border). Change-Id: Ie5bc536556b72030d17829a917f91a15ad5157a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104660 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx new file mode 100644 index ..2cd299ff211a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 1ff3ccf8ec3e..4c0dfbf9ebbb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1560,6 +1560,36 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx") assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf137641_RelativeFromTopMargin.docx") +{ +xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + +assertXPath(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" +"wp:anchor/wp:positionV", +"relativeFrom", "topMargin"); +assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "top"); +assertXPath(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" +"wp:anchor/wp:positionV", +"relativeFrom", "topMargin"); +assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "bottom"); +assertXPath(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" +"wp:anchor/wp:positionV", +"relativeFrom", "topMargin"); +assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "center"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index a1656ea75fab..41ca25235c48 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -509,6 +509,9 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons case text::RelOrientation::PAGE_PRINT_AREA: relativeFromV = "margin"; break; +case text::RelOrientation::PAGE_PRINT_AREA_TOP: +relativeFromV = "topMargin"; +break; case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM: relativeFromV = "bottomMargin"; break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: cui/source include/svx svx/inc
cui/source/tabpages/swpossizetabpage.cxx |6 -- include/svx/swframeposstrings.hxx|1 + svx/inc/swframeposstrings.hrc|1 + 3 files changed, 6 insertions(+), 2 deletions(-) New commits: commit 6a10ea009ef590ac13d01d19fbfbc28c916ef1d4 Author: Szabolcs Toth AuthorDate: Thu Oct 22 12:23:43 2020 +0200 Commit: László Németh CommitDate: Mon Oct 26 10:38:02 2020 +0100 tdf#137650 sw page top border relative orientation: add UI as new menu item "page text area top" of Position/Vertical popup menu "to:" in Position and Size dialog window of shapes. Follow-up of commit 1c593e1916c9164c7db71da2017cfc26972f8e9f (tdf#133045 sw: add shape alignment to the top page border). See also commit 8af2c4e3a517e3b75f2ace9719c1ca03153baddf (sw from-bottom relative orientation: add UI) Change-Id: I98671fa9c7c184c8f360ccb35e671df68cd271b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104661 Tested-by: László Németh Reviewed-by: László Németh diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index b0366bf48053..2b9c8c70a4b4 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -98,8 +98,9 @@ enum class LB { VertLine= 0x08, // vertical text line RelPagePrintAreaBottom = 0x10, // bottom of text area of page +RelPagePrintAreaTop = 0x20, -LAST = 0x20 +LAST = 0x40 }; } @@ -118,6 +119,7 @@ RelationMap const aRelationMap[] = {SvxSwFramePosString::REL_FRM_RIGHT, SvxSwFramePosString::MIR_REL_FRM_RIGHT, LB::RelFrameRight, RelOrientation::FRAME_RIGHT}, {SvxSwFramePosString::REL_PG_FRAME, SvxSwFramePosString::REL_PG_FRAME, LB::RelPageFrame,RelOrientation::PAGE_FRAME}, {SvxSwFramePosString::REL_PG_PRTAREA,SvxSwFramePosString::REL_PG_PRTAREA, LB::RelPagePrintArea, RelOrientation::PAGE_PRINT_AREA}, + {SvxSwFramePosString::REL_PG_PRTAREA_TOP,SvxSwFramePosString::REL_PG_PRTAREA_TOP, LB::RelPagePrintAreaTop, RelOrientation::PAGE_PRINT_AREA_TOP}, {SvxSwFramePosString::REL_PG_PRTAREA_BOTTOM,SvxSwFramePosString::REL_PG_PRTAREA_BOTTOM, LB::RelPagePrintAreaBottom, RelOrientation::PAGE_PRINT_AREA_BOTTOM}, {SvxSwFramePosString::REL_CHAR, SvxSwFramePosString::REL_CHAR, LB::RelChar,RelOrientation::CHAR}, @@ -259,7 +261,7 @@ FrmMap const aHParaHtmlAbsMap[] = constexpr auto VERT_PARA_REL = LB::VertFrame|LB::VertPrintArea| - LB::RelPageFrame|LB::RelPagePrintArea|LB::RelPagePrintAreaBottom; + LB::RelPageFrame|LB::RelPagePrintArea| LB::RelPagePrintAreaTop |LB::RelPagePrintAreaBottom; FrmMap const aVParaMap[] = { diff --git a/include/svx/swframeposstrings.hxx b/include/svx/swframeposstrings.hxx index 346553c70ec8..2aca2f195fbb 100644 --- a/include/svx/swframeposstrings.hxx +++ b/include/svx/swframeposstrings.hxx @@ -49,6 +49,7 @@ public: MIR_REL_FRM_RIGHT , REL_PG_FRAME , REL_PG_PRTAREA , +REL_PG_PRTAREA_TOP , REL_PG_PRTAREA_BOTTOM , REL_BASE , REL_CHAR , diff --git a/svx/inc/swframeposstrings.hrc b/svx/inc/swframeposstrings.hrc index b08a9a3b525b..1d3da664b208 100644 --- a/svx/inc/swframeposstrings.hrc +++ b/svx/inc/swframeposstrings.hrc @@ -43,6 +43,7 @@ const char* RID_SVXSW_FRAMEPOSITIONS[] = NC_("RID_SVXSW_FRAMEPOSITIONS", "Outer paragraph border"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Entire page"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Page text area"), +NC_("RID_SVXSW_FRAMEPOSITIONS", "Page text area top"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Page text area bottom"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Base line"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Character"), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: offapi/com sw/qa sw/source writerfilter/source
offapi/com/sun/star/text/RelOrientation.idl |8 +++ sw/qa/extras/ooxmlexport/data/tdf133045_TestShapeAlignmentRelativeFromTopMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 15 ++ sw/source/core/objectpositioning/anchoredobjectposition.cxx |1 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx | 22 -- writerfilter/source/dmapper/GraphicHelpers.cxx |7 ++- 6 files changed, 46 insertions(+), 7 deletions(-) New commits: commit 1c593e1916c9164c7db71da2017cfc26972f8e9f Author: Szabolcs Toth AuthorDate: Fri Oct 9 13:00:30 2020 +0200 Commit: László Németh CommitDate: Tue Oct 20 09:17:32 2020 +0200 tdf#133045 sw: add shape alignment to the top page border Allow relative alignment to the top page border (the area over PAGE_PRINT_AREA) by adding constant PAGE_PRINT_AREA_TOP to com::sun::star::text::RelOrientation. Fix DOCX shape import of . Follow-up of commit 6788133b3bdf02097d66a99047aa7bcba3a99a66 (tdf#135720 sw: fix PAGE_PRINT_AREA_BOTTOM alignment with footer) and commit 79107d3f8d10aa0f38641775c5eb47dcfd4fd37e (sw from-bottom relative orientation: add UNO API). Co-authored-by: Balázs Regényi Change-Id: I3a3f7324c0ef8d448526982d3e2f09b67f5fd4d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104113 Tested-by: László Németh Reviewed-by: László Németh diff --git a/offapi/com/sun/star/text/RelOrientation.idl b/offapi/com/sun/star/text/RelOrientation.idl index 59f39a045740..3ce3160d4a36 100644 --- a/offapi/com/sun/star/text/RelOrientation.idl +++ b/offapi/com/sun/star/text/RelOrientation.idl @@ -73,12 +73,18 @@ published constants RelOrientation */ const short TEXT_LINE = 9; -/** Similar to PAGE_PRINT_AREA, but count from bottom, not from top. +/** Bottom page border (page area below PAGE_PRINT_AREA). @since LibreOffice 7.0 */ const short PAGE_PRINT_AREA_BOTTOM = 10; +/** Top page border (page area above PAGE_PRINT_AREA). + +@since LibreOffice 7.1 + */ +const short PAGE_PRINT_AREA_TOP = 11; + }; diff --git a/sw/qa/extras/ooxmlexport/data/tdf133045_TestShapeAlignmentRelativeFromTopMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf133045_TestShapeAlignmentRelativeFromTopMargin.docx new file mode 100644 index ..2cd299ff211a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133045_TestShapeAlignmentRelativeFromTopMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 44d0bc8c27bd..cb00fff1f684 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -998,6 +998,21 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133924, "tdf133924.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "wrap", "notBeside"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAlignmentFromTopMargin, + "tdf133045_TestShapeAlignmentRelativeFromTopMargin.docx") +{ +// tdf#133045 These shapes are relatively aligned from top margin, vertically to +// top, center and bottom. + +if (mbExported) +return; + +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +assertXPath(pXmlDoc, "//SwAnchoredDrawObject[1]/bounds", "top", "1487"); // center +assertXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "top", "2668"); // bottom +assertXPath(pXmlDoc, "//SwAnchoredDrawObject[3]/bounds", "top", "298"); // top +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index bfcd075c8443..a5180ac06536 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -250,6 +250,7 @@ void SwAnchoredObjectPosition::GetVertAlignmentValues( } break; case text::RelOrientation::PAGE_FRAME: +case text::RelOrientation::PAGE_PRINT_AREA_TOP: { nHeight = aRectFnSet.GetHeight(_rPageAlignLayFrame.getFrameArea()); nOffset = aRectFnSet.YDiff( diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx index e115ed5a688b..dea6424bc3dd 100644 --- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx @@ -249,6 +249,14 @@ void SwToContentAnchoredObjectPosition::CalcPosition() aVert.GetRelationOrient(),
[Libreoffice-commits] core.git: oox/source sc/qa
oox/source/drawingml/shape.cxx |9 ++--- oox/source/export/drawingml.cxx| 37 +++-- sc/qa/unit/data/xlsx/tdf137000_export_upright.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 22 4 files changed, 61 insertions(+), 7 deletions(-) New commits: commit ff5ca4e5fc6a9fb24b0eb6eb629210b024473f67 Author: Szabolcs Toth AuthorDate: Thu Sep 17 11:22:09 2020 +0200 Commit: László Németh CommitDate: Tue Oct 6 09:45:51 2020 +0200 tdf#137000 XLSX shape export: fix upright Upright is an XML attribute of xdr:txBody/a:bodyPr. It is set in MSO when in a textbox menu we choose "Do not rotate this element". LO import uses a text rotation opposite shape rotation to create upright text, but when exporting the attribute "upright" we must make sure that the text rotation in bodyPr is 0, not the temporary opposite value. Otherwise MSO rotates the text. Note: integer precision of rotation is enough for interoperability, because it's possible to rotate the shapes only by whole degrees in MSO. Follow-up of commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b (tdf#106197 XLSX shape import: keep text upright). Co-authored-by: Balázs Regényi Change-Id: I0ffae41f83d3fc3a1fa37f413a8fc9fd8ccd9b6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103094 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index f8f65d09f59f..c9ade16f7a1d 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1410,8 +1410,7 @@ Reference< XShape > const & Shape::createAndInsert( nTextRotateAngle -= mnDiagramRotation; -bool isUpright = getTextBody()->getTextProperties().moUpright; -if (isUpright) +if (getTextBody()->getTextProperties().moUpright) { // When upright is set, we want the text without any rotation. // But if we set 0 here, the text is still rotated if the @@ -1419,8 +1418,10 @@ Reference< XShape > const & Shape::createAndInsert( // Hence, we rotate the text into the opposite direction of // the rotation of the shape, by as much as the shape was rotated. mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); -// Also put this away in a GrabBag. -putPropertyToGrabBag("Upright", Any(isUpright)); +// Also put the initial angles away in a GrabBag. +putPropertyToGrabBag("Upright", Any(true)); +putPropertyToGrabBag("nShapeRotationAtImport", Any(mnRotation / 6)); +putPropertyToGrabBag("nTextRotationAtImport", Any(mnRotation / 6)); } else { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 01f926c0c90c..4a9ac9f69014 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2954,20 +2954,31 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo pWrap = "square"; } -bool isUpright = false; std::optional sHorzOverflow; std::optional sVertOverflow; +sal_Int32 nShapeRotateAngle = 0; +if (GetProperty(rXPropSet, "RotateAngle")) +nShapeRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; +Reference< XPropertySet > xTextSet(xXText, UNO_QUERY); +sal_Int32 nShapeTextRotateAngle = 0; +if (GetProperty(xTextSet, "RotateAngle")) +nShapeTextRotateAngle = rXPropSet->getPropertyValue("RotateAngle").get() / 300; +std::optional isUpright; if (GetProperty(rXPropSet, "InteropGrabBag")) { if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) { +bool bUpright = false; +sal_Int32 nOldShapeRotation = 0; +sal_Int32 nOldTextRotation = 0; uno::Sequence aGrabBag; rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; for (const auto& aProp : std::as_const(aGrabBag)) { if (aProp.Name == "Upright") { -aProp.Value >>= isUpright; +aProp.Value >>= bUpright; +isUpright = OString(bUpright ? "1" : "0"); } else if (aProp.Name == "horzOverflow") { @@ -2982,6 +2993,26 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo sVertOverflow = sValue; } } +
[Libreoffice-commits] core.git: oox/inc oox/source sc/qa
oox/inc/drawingml/textbodyproperties.hxx |1 oox/source/drawingml/shape.cxx | 24 +-- oox/source/drawingml/textbodypropertiescontext.cxx |5 +- oox/source/export/drawingml.cxx| 37 - sc/qa/unit/data/xlsx/tdf106197_import_upright.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 45 + 6 files changed, 89 insertions(+), 23 deletions(-) New commits: commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b Author: Szabolcs Toth AuthorDate: Wed Sep 16 14:41:24 2020 +0200 Commit: László Németh CommitDate: Thu Sep 24 12:54:14 2020 +0200 tdf#106197 XLSX shape import: keep text upright Handle and grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction after import and after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If4c73aeaebad55af967cea894a94756068ca3766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102870 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx index 6e5e97fb94ba..26e34ac6a5f7 100644 --- a/oox/inc/drawingml/textbodyproperties.hxx +++ b/oox/inc/drawingml/textbodyproperties.hxx @@ -34,6 +34,7 @@ struct TextBodyProperties OptValue< sal_Int32 > moRotation; boolmbAnchorCtr; OptValue< sal_Int32 > moVert; +boolmoUpright = false; std::optional< sal_Int32 >moInsets[4]; std::optional< sal_Int32 >moTextOffUpper; std::optional< sal_Int32 >moTextOffLeft; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 02b89312d200..326d90be3ffd 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1409,10 +1409,26 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) ); nTextRotateAngle -= mnDiagramRotation; -/* OOX measures text rotation clockwise in 1/6th degrees, - relative to the containing shape. setTextRotateAngle wants - degrees anticlockwise. */ -mpCustomShapePropertiesPtr->setTextRotateAngle( -1 * nTextRotateAngle / 6 ); + +bool isUpright = getTextBody()->getTextProperties().moUpright; +if (isUpright) +{ +// When upright is set, we want the text without any rotation. +// But if we set 0 here, the text is still rotated if the +// shape containing it is rotated. +// Hence, we rotate the text into the the opposite direction of +// the rotation of the shape, by as much as the shape was rotated. +mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); +// Also put this away in a Gabbag. +putPropertyToGrabBag("Upright", Any(isUpright)); +} +else +{ +/* OOX measures text rotation clockwise in 1/6th degrees, + relative to the containing shape. setTextRotateAngle wants + degrees anticlockwise. */ +mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 6); +} } // Note that the script oox/source/drawingml/customshapes/generatePresetsData.pl looks diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index b72fa194401a..d3add310097f 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -94,7 +94,10 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons // ST_PositiveCoordinate // sal_Int32 nSpcCol = rAttribs.getInteger( XML_spcCol, 0 ); // bool bSpcFirstLastPara = rAttribs.getBool( XML_spcFirstLastPara, 0 ); -// bool bUpRight = rAttribs.getBool( XML_upright, 0 ); + +bool bUpright = rAttribs.getBool(XML_upright, false); +if (bUpright) +mrTextBodyProp.moUpright = true; // ST_TextVerticalType if( rAttribs.hasAttribute( XML_vert ) ) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 8d3cbd23a6a7..8ea8035ea39a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2932,24 +2932,6 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo else if( bVertical &&
[Libreoffice-commits] core.git: oox/source sw/qa
oox/source/export/drawingml.cxx | 19 oox/source/shape/WpsContext.cxx | 11 ++ sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 10 ++ 4 files changed, 40 insertions(+) New commits: commit d3094b98231730b8e6d863c6a2fc0dd62f3e991a Author: Szabolcs Toth AuthorDate: Mon Sep 14 17:16:51 2020 +0200 Commit: László Németh CommitDate: Tue Sep 22 09:48:30 2020 +0200 tdf#123610 DOCX shape import: keep text upright Grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction in MSO after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If18a12c7728317a7af093048b07bc392d2964389 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102690 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index c02cfac613a8..87e80e4ce12a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2891,6 +2891,24 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo else if( bVertical && eHorizontalAlignment == TextHorizontalAdjust_LEFT ) sVerticalAlignment = "b"; +bool isUpright = false; +if (GetProperty(rXPropSet, "InteropGrabBag")) +{ +if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) +{ +uno::Sequence aGrabBag; +rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; +for (auto& aProp : aGrabBag) +{ +if (aProp.Name == "Upright") +{ +aProp.Value >>= isUpright; +break; +} +} +} +} + bool bHasWrap = false; bool bWrap = false; // Only custom shapes obey the TextWordWrap option, normal text always wraps. @@ -2922,6 +2940,7 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo XML_anchor, sVerticalAlignment, XML_anchorCtr, sax_fastparser::UseIf("1", bHorizontalCenter), XML_vert, sWritingMode, + XML_upright, isUpright ? "1" : "0", XML_rot, sax_fastparser::UseIf(oox::drawingml::calcRotationValue((nTextPreRotateAngle + nTextRotateAngle) * 100), (nTextPreRotateAngle + nTextRotateAngle) != 0)); if (bIsFontworkShape) { diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index f78c38ff91e9..076fd1124307 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -96,6 +96,17 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken } } +if (bool bUpright = rAttribs.getBool(XML_upright, false)) +{ +uno::Sequence aGrabBag; +xPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; +sal_Int32 length = aGrabBag.getLength(); +aGrabBag.realloc(length + 1); +aGrabBag[length].Name = "Upright"; +aGrabBag[length].Value <<= bUpright; +xPropertySet->setPropertyValue("InteropGrabBag", uno::makeAny(aGrabBag)); +} + if (xServiceInfo.is()) { // Handle inset attributes for Writer textframes. diff --git a/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx b/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx new file mode 100644 index ..d7dc1978a067 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 76ccf318e8c9..0085734450c0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1142,6 +1142,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorWidthFromInsideOutsideMarg assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[4]/bounds", "width", "1440"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBodyPrUpright, "tdf123610_handle_upright.docx") +{ +// tdf#123610: Check grab-bag attribute upright to keep text upright regardless of shape rotation. + +xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + +assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor" +"/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", "upright", "1"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/inc sc/qa sc/source
sc/inc/detfunc.hxx |5 +- sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods |binary sc/qa/unit/subsequent_export-test.cxx | 16 + sc/source/core/tool/detfunc.cxx| 14 ++-- sc/source/filter/xcl97/xcl97rec.cxx| 17 ++ 5 files changed, 47 insertions(+), 5 deletions(-) New commits: commit 721e7c4d5a20797ea2876c89e21cccfe394b36af Author: Szabolcs Toth AuthorDate: Tue Sep 1 13:46:38 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Sep 18 10:32:34 2020 +0200 tdf#133688 tdf#125414 XLSX: don't export tracer arrows (see Tools->Detective) as plain shapes. Co-authored-by: Balázs Regényi Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101845 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 14b40ec7be7ca8315848034591e3c3a246d5a8dd) Change-Id: I920445637a6be12169ae7d70295e4460d7f9b26b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102940 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index 6eb38f669c41..2f97d881a968 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -42,10 +42,11 @@ enum ScDetectiveObjType SC_DETOBJ_ARROW, SC_DETOBJ_FROMOTHERTAB, SC_DETOBJ_TOOTHERTAB, -SC_DETOBJ_CIRCLE +SC_DETOBJ_CIRCLE, +SC_DETOBJ_RECTANGLE }; -class ScDetectiveFunc +class SC_DLLPUBLIC ScDetectiveFunc { static Color nArrowColor; static Color nErrorColor; diff --git a/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods new file mode 100644 index ..3dfdee77f143 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 39c5027cc676..184fe083bbfe 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -239,6 +239,7 @@ public: void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); void testTdf123353(); +void testTdf133688_precedents(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -376,6 +377,7 @@ public: CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST(testTdf123353); +CPPUNIT_TEST(testTdf133688_precedents); CPPUNIT_TEST_SUITE_END(); @@ -4743,6 +4745,20 @@ void ScExportTest::testTdf123353() xShell->DoClose(); } +void ScExportTest::testTdf133688_precedents() +{ +// tdf#133688 Check that we do not export detective shapes. +ScDocShellRef xShell = loadDoc("tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +// We do not export any shapes. +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 740a4af583fd..f429f615db7d 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1597,16 +1597,24 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject, if ( nObjColor == GetErrorColor() && nObjColor != GetArrowColor() ) rRedLine = true; } -else if ( dynamic_cast( pObject) != nullptr ) +else if (dynamic_cast(pObject) != nullptr) { -if ( bValidStart ) +if (bValidStart) { // cell position is returned in rPosition - rPosition = pData->maStart; eType = SC_DETOBJ_CIRCLE; } } +else if (dynamic_cast(pObject) != nullptr) +{ +if (bValidStart) +{ +// cell position is returned in rPosition +rPosition = pData->maStart; +eType = SC_DETOBJ_RECTANGLE; +} +} } } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 17420fe5c69e..b693838f74fe 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -1020,6 +1021,7 @@ ExcBof8_Base::ExcBof8_Base() nRupBuild = 0x0dbb; nRupYear= 0x07cc; } + void
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 sc/source/filter/xcl97/xcl97rec.cxx| 19 +++ 3 files changed, 39 insertions(+) New commits: commit b5adee6643a21d18a5fd865756017f7786fb79f7 Author: Szabolcs Toth AuthorDate: Mon Aug 17 10:55:43 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Sep 18 09:52:57 2020 +0200 tdf#135828 XLSX shape export: fix distortion of rotated shapes Shapes that were rotated at angles {[45, 135) U [225, 315)} need new anchor positions that does an extra 90 degrees rotation. See commit 130e6a3f4493b987a7d0b177cc84d65219b47d13 (tdf#83593 XLSX DrawingML shape import: fix missing rotation) Co-authored-by: Balázs Regényi Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100853 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5e8875780d665b7ae0fee1a053b5ce78ec513f69) Change-Id: I42a5d203cf3b6f6e725d84dd5f39ac323f4f1ceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102939 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx new file mode 100644 index ..c01c81ab6d74 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 6769aab25f07..9fdf9419f515 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -237,6 +237,7 @@ public: void testTdf134459_HeaderFooterColorXLSX(); void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testHeaderFontStyleXLSX(); +void testTdf135828_Shape_Rect(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -372,6 +373,7 @@ public: CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); +CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST_SUITE_END(); @@ -4702,6 +4704,24 @@ void ScExportTest::testHeaderFontStyleXLSX() xShell->DoClose(); } +void ScExportTest::testTdf135828_Shape_Rect() +{ +// tdf#135828 Check that the width and the height of rectangle of the shape +// is correct. +ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocPtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 5597b635ecbd..17420fe5c69e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1026,6 +1026,25 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); + +uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) +{ +// MSO changes the anchor positions at these angles and that does an extra 90 degrees +// rotation on our shapes, so we output it in such position that MSO +// can draw this shape correctly. + +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; + +std::swap(aSize.Width, aSize.Height); +} + tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation ); tools::Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |6 -- sc/source/filter/xcl97/xcl97rec.cxx |3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) New commits: commit 9711904c9a26e89d36a9d5aeb61b99f7fe59fb43 Author: Szabolcs Toth AuthorDate: Tue Sep 15 11:03:10 2020 +0200 Commit: László Németh CommitDate: Wed Sep 16 15:24:12 2020 +0200 Cleanup: apply Clang formatting Some formatting on a previous commit. Change-Id: Ib5de7170ca230486b6d8c85cc999fac1f736def6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102716 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 8df9882b0190..3e68d6691609 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5452,8 +5452,10 @@ void ScExportTest::testTdf133688_precedents() ScDocShellRef xShell = loadDoc("tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS); CPPUNIT_ASSERT(xShell.is()); -std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); -xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocUniquePtr pDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); // We do not export any shapes. diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 70eb9a7323b7..11c0b9b792ad 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1283,7 +1283,8 @@ void XclObjAny::SaveXml( XclExpXmlStream& rStrm ) ScAddress aPosition; ScRange aSourceRange; boolbRedLine; -ScDetectiveObjType eObjType = aDetFunc.GetDetectiveObjectType(pObject, mnScTab, aPosition, aSourceRange, bRedLine); +ScDetectiveObjType eObjType += aDetFunc.GetDetectiveObjectType(pObject, mnScTab, aPosition, aSourceRange, bRedLine); if (eObjType != SC_DETOBJ_NONE) return; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/detfunc.hxx |5 +- sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods |binary sc/qa/unit/subsequent_export-test.cxx | 16 + sc/source/core/tool/detfunc.cxx| 14 ++-- sc/source/filter/xcl97/xcl97rec.cxx| 17 ++ 5 files changed, 47 insertions(+), 5 deletions(-) New commits: commit 14b40ec7be7ca8315848034591e3c3a246d5a8dd Author: Szabolcs Toth AuthorDate: Tue Sep 1 13:46:38 2020 +0200 Commit: László Németh CommitDate: Mon Sep 14 13:57:30 2020 +0200 tdf#133688 tdf#125414 XLSX: don't export tracer arrows (see Tools->Detective) as plain shapes. Co-authored-by: Balázs Regényi Change-Id: I920445637a6be12169ae7d70295e4460d7f9b26b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101845 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index 28394627e913..b8d1d2c0bc81 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -42,10 +42,11 @@ enum ScDetectiveObjType SC_DETOBJ_ARROW, SC_DETOBJ_FROMOTHERTAB, SC_DETOBJ_TOOTHERTAB, -SC_DETOBJ_CIRCLE +SC_DETOBJ_CIRCLE, +SC_DETOBJ_RECTANGLE }; -class ScDetectiveFunc +class SC_DLLPUBLIC ScDetectiveFunc { static Color nArrowColor; static Color nErrorColor; diff --git a/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods new file mode 100644 index ..3dfdee77f143 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf133688_dont_save_precedents_to_xlsx.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 451d45d99c84..8df9882b0190 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -268,6 +268,7 @@ public: void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); void testTdf123353(); +void testTdf133688_precedents(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -430,6 +431,7 @@ public: CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST(testTdf123353); +CPPUNIT_TEST(testTdf133688_precedents); CPPUNIT_TEST_SUITE_END(); @@ -5444,6 +5446,20 @@ void ScExportTest::testTdf123353() xShell->DoClose(); } +void ScExportTest::testTdf133688_precedents() +{ +// tdf#133688 Check that we do not export detective shapes. +ScDocShellRef xShell = loadDoc("tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +// We do not export any shapes. +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index e77313830a17..2df199e2f7dd 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1605,16 +1605,24 @@ ScDetectiveObjType ScDetectiveFunc::GetDetectiveObjectType( SdrObject* pObject, if ( nObjColor == GetErrorColor() && nObjColor != GetArrowColor() ) rRedLine = true; } -else if ( dynamic_cast( pObject) != nullptr ) +else if (dynamic_cast(pObject) != nullptr) { -if ( bValidStart ) +if (bValidStart) { // cell position is returned in rPosition - rPosition = pData->maStart; eType = SC_DETOBJ_CIRCLE; } } +else if (dynamic_cast(pObject) != nullptr) +{ +if (bValidStart) +{ +// cell position is returned in rPosition +rPosition = pData->maStart; +eType = SC_DETOBJ_RECTANGLE; +} +} } } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 6cde8226c0ea..70eb9a7323b7 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include @@ -1089,6 +1090,7 @@ ExcBof8_Base::ExcBof8_Base() nRupBuild = 0x0dbb; nRupYear= 0x07cc; } + void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& rShape, SCTAB nTab ) { sax_fastparser::FSHelperPtr pDrawing = rStrm.GetCurrentStream(); @@ -1272,6 +1274,21 @@ void
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 16 +++ writerfilter/source/dmapper/GraphicImport.cxx | 17 +--- 3 files changed, 29 insertions(+), 4 deletions(-) New commits: commit 7739740ab36a933a134996427132c64dfddac49c Author: Szabolcs Toth AuthorDate: Thu Jun 18 15:58:32 2020 +0200 Commit: Xisco Fauli CommitDate: Tue Sep 8 12:36:38 2020 +0200 tdf#120760 DOCX shape import: fix Z-order with behindDoc 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 Reviewed-by: László Németh (cherry picked from commit 6479096dc2bd40215ff80273b4d27cadb2688cb1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100947 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx new file mode 100644 index ..77a6d48dd866 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index c2aaec5c64a9..08d4831d1b12 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1318,6 +1318,22 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf112287, "tdf112287.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr","vAnchor","margin"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testZOrderInHeader, "tdf120760_ZOrderInHeader.docx") +{ +// tdf#120760 Check that the Z-Order of the background is smaller than the front shape's. +xmlDocUniquePtr pXml = parseExport("word/header1.xml"); +if (!pXml) +return; + +// Get the Z-Order of the background image and of the shape in front of it. +sal_Int32 nBackground = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/w:drawing/wp:anchor", "relativeHeight").toInt32(); +sal_Int32 nFrontShape = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/mc:AlternateContent[2]" +"/mc:Choice/w:drawing/wp:anchor", "relativeHeight").toInt32(); + +// Assert that background is in the back. +CPPUNIT_ASSERT(nBackground < nFrontShape); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 27acbe045b25..372e9f40870a 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -208,6 +208,7 @@ public: bool bLayoutInCell; bool bAllowOverlap = true; bool bOpaque; +bool bBehindDoc; bool bContour; bool bContourOutside; WrapPolygon::Pointer_t mpWrapPolygon; @@ -273,6 +274,7 @@ public: ,nWrap(text::WrapTextMode_NONE) ,bLayoutInCell(true) ,bOpaque( !rDMapper.IsInHeaderFooter() ) +,bBehindDoc(false) ,bContour(false) ,bContourOutside(true) ,nLeftMargin(319) @@ -371,10 +373,15 @@ public: { if (zOrder >= 0) { +// tdf#120760 Send objects with behinddoc=true to the back. +sal_Int32 nZOrder = zOrder; +if (bBehindDoc && rDomainMapper.IsInHeaderFooter()) +nZOrder -= SAL_MAX_INT32; GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper(); bool bOldStyle = eGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE; - xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper->findZOrder(zOrder, bOldStyle))); -pZOrderHelper->addItem(xGraphicObjectProperties, zOrder); + xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), +uno::makeAny(pZOrderHelper->findZOrder(nZOrder, bOldStyle))); +pZOrderHelper->addItem(xGraphicObjectProperties, nZOrder); } } @@ -609,8 +616,11 @@ void GraphicImport::lcl_attribute(Id nName, Value&
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 sc/source/filter/xcl97/xcl97rec.cxx| 19 +++ 3 files changed, 39 insertions(+) New commits: commit 5e8875780d665b7ae0fee1a053b5ce78ec513f69 Author: Szabolcs Toth AuthorDate: Mon Aug 17 10:55:43 2020 +0200 Commit: László Németh CommitDate: Mon Aug 24 18:28:51 2020 +0200 tdf#135828 XLSX shape export: fix distortion of rotated shapes Shapes that were rotated at angles {[45, 135) U [225, 315)} need new anchor positions that does an extra 90 degrees rotation. See commit 130e6a3f4493b987a7d0b177cc84d65219b47d13 (tdf#83593 XLSX DrawingML shape import: fix missing rotation) Co-authored-by: Balázs Regényi Change-Id: I42a5d203cf3b6f6e725d84dd5f39ac323f4f1ceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100853 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx new file mode 100644 index ..c01c81ab6d74 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index c249322cbcf4..d4cce709686f 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -257,6 +257,7 @@ public: void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testTdf121718_UseFirstPageNumberXLSX(); void testHeaderFontStyleXLSX(); +void testTdf135828_Shape_Rect(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -412,6 +413,7 @@ public: CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testTdf121718_UseFirstPageNumberXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); +CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST_SUITE_END(); @@ -5277,6 +5279,24 @@ void ScExportTest::testHeaderFontStyleXLSX() xShell->DoClose(); } +void ScExportTest::testTdf135828_Shape_Rect() +{ +// tdf#135828 Check that the width and the height of rectangle of the shape +// is correct. +ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index fa2fc748bf2c..7af2ddc59fa2 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1095,6 +1095,25 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); + +uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) +{ +// MSO changes the anchor positions at these angles and that does an extra 90 degrees +// rotation on our shapes, so we output it in such position that MSO +// can draw this shape correctly. + +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; + +std::swap(aSize.Width, aSize.Height); +} + tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation ); tools::Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 16 +++ writerfilter/source/dmapper/GraphicImport.cxx | 17 +--- 3 files changed, 29 insertions(+), 4 deletions(-) New commits: commit eab422c01c5595479c7aa33d13cb633bd5a4cafe Author: Szabolcs Toth AuthorDate: Thu Jun 18 15:58:32 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 31 13:46:31 2020 +0200 tdf#120760 DOCX shape import: fix Z-order with behindDoc 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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96614 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 6479096dc2bd40215ff80273b4d27cadb2688cb1) Change-Id: I54a72a95bc69b307b2835636fff376b0aa9bc45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99832 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx new file mode 100644 index ..77a6d48dd866 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index bfdab8a541aa..c5441fae765a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1236,6 +1236,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112287, "tdf112287.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr","vAnchor","margin"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testZOrderInHeader, "tdf120760_ZOrderInHeader.docx") +{ +// tdf#120760 Check that the Z-Order of the background is smaller than the front shape's. +xmlDocPtr pXml = parseExport("word/header1.xml"); +if (!pXml) +return; + +// Get the Z-Order of the background image and of the shape in front of it. +sal_Int32 nBackground = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/w:drawing/wp:anchor", "relativeHeight").toInt32(); +sal_Int32 nFrontShape = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/mc:AlternateContent[2]" +"/mc:Choice/w:drawing/wp:anchor", "relativeHeight").toInt32(); + +// Assert that background is in the back. +CPPUNIT_ASSERT(nBackground < nFrontShape); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 8ebc0cdc3a43..16c65cdc1097 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -202,6 +202,7 @@ public: bool bLayoutInCell; bool bAllowOverlap = true; bool bOpaque; +bool bBehindDoc; bool bContour; bool bContourOutside; WrapPolygon::Pointer_t mpWrapPolygon; @@ -267,6 +268,7 @@ public: ,nWrap(text::WrapTextMode_NONE) ,bLayoutInCell(true) ,bOpaque( !rDMapper.IsInHeaderFooter() ) +,bBehindDoc(false) ,bContour(false) ,bContourOutside(true) ,nLeftMargin(319) @@ -364,10 +366,15 @@ public: { if (zOrder >= 0) { +// tdf#120760 Send objects with behinddoc=true to the back. +sal_Int32 nZOrder = zOrder; +if (bBehindDoc && rDomainMapper.IsInHeaderFooter()) +nZOrder -= SAL_MAX_INT32; GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper(); bool bOldStyle = eGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE; - xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper->findZOrder(zOrder, bOldStyle))); -pZOrderHelper->addItem(xGraphicObjectProperties, zOrder); + xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), +uno::makeAny(pZOrderHelper->findZOrder(nZOrder, bOldStyle))); +pZOrderHelper->addItem(xGraphicObjectProperties, nZOrder); } } @@ -602,8 +609,11 @@ void GraphicImport::lcl_attribute(Id nName, Value&
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 13 ++ sw/source/core/layout/anchoreddrawobject.cxx |3 ++ writerfilter/source/dmapper/GraphicImport.cxx |8 ++ 4 files changed, 24 insertions(+) New commits: commit ff4740980c7a7fa5162da94c0d31d41e25f5d1e3 Author: Szabolcs Toth AuthorDate: Fri Jun 5 12:06:22 2020 +0200 Commit: Gabor Kelemen CommitDate: Mon Jul 27 23:04:42 2020 +0200 tdf#133670 DOCX import: fix shape width relative to right margin 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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95582 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 330ed8120e9881656716d70d87b9f49f861f0bfa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97067 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos (cherry picked from commit 718683ab1582849ea43797e404c6453ce2fbd424) Change-Id: Ic5d25701d46cdace6502ec55dbc0e5f0ebd7742b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99536 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx new file mode 100644 index ..68f24370a31e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 93a65a57fc45..c9833e045f0a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1231,6 +1231,19 @@ DECLARE_OOXMLEXPORT_TEST(testDocxTablePosition, "floating-table-position.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", "4611"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, "tdf133670_testRelativeAnchorWidthFromRightMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#133670 The width was set relative from right margin, but this was handled relative from page width. +xmlDocPtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(2408), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 95ad5bc155b4..4b9b119b7d0f 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -633,6 +633,9 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const // E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) nWidth = GetPageFrame()->GetLeftMargin(); +// Same as the left margin above. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_RIGHT) +nWidth = GetPageFrame()->GetRightMargin(); else nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 04b2b124aae6..062c00d5f58e 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -948,6 +948,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_LEFT)); } break; +case NS_ooxml::LN_ST_SizeRelFromH_rightMargin: +if (m_xShape.is()) +{ +// Same as the left margin above. +uno::Reference xPropertySet(m_xShape, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_RIGHT)); +} +break; case
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 14 ++ sw/source/core/layout/anchoreddrawobject.cxx | 13 ++--- writerfilter/source/dmapper/GraphicImport.cxx | 10 +++ 4 files changed, 33 insertions(+), 4 deletions(-) New commits: commit 10b24292a37b69e9329b03fed2f10af4a91247e0 Author: Szabolcs Toth AuthorDate: Thu Jun 4 15:43:42 2020 +0200 Commit: Gabor Kelemen CommitDate: Mon Jul 27 22:34:02 2020 +0200 tdf#132976 DOCX import: fix shape width relative to left margin 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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95525 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 7380905abc0833d9e4c4fe731d76174db8a8724c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96998 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 5451833f3af5582a8cab7e4b3da402f083f56908) Change-Id: I2dada8ad764a1fba33d241117cc4bc5eddae74ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99530 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx new file mode 100644 index ..2f1c5560c17a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 089154675288..bd5c8605d454 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1130,6 +1130,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt") "/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testRelativeAnchorWidthFromLeftMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#132976 The size of the width of this shape should come from the size of the left margin. +// It was set to the size of the width of the entire page before. +xmlDocPtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 079468fdf062..95ad5bc155b4 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -624,13 +624,18 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const long nTargetWidth = aCurrObjRect.GetWidth( ); if ( GetDrawObj( )->GetRelativeWidth( ) ) { -tools::Rectangle aPageRect; +long nWidth = 0; if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::FRAME) // Exclude margins. -aPageRect = GetPageFrame()->getFramePrintArea().SVRect(); +nWidth = GetPageFrame()->getFramePrintArea().SVRect().GetWidth(); +// Here we handle the relative size of the width of some shape. +// The size of the shape's width is going to be relative to the size of the left margin. +// E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) +nWidth = GetPageFrame()->GetLeftMargin(); else -aPageRect = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect(); -nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( )->GetRelativeWidth()); +nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); +nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); } long nTargetHeight = aCurrObjRect.GetHeight( ); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 8afea80365fe..04b2b124aae6 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - oox/source sw/qa
oox/source/export/drawingml.cxx |2 +- sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 3 files changed, 13 insertions(+), 1 deletion(-) New commits: commit 1dc3fa541159e746b81561bb6a6170dcd968704d Author: Szabolcs Toth AuthorDate: Mon May 11 15:56:27 2020 +0200 Commit: Gabor Kelemen CommitDate: Mon Jul 27 20:03:26 2020 +0200 tdf#92526 DrawingML shape export: fix 0 line width 0 line width is the thinnest possible line width, but without its explicit export (a:ln w="0"), shape outline was imported with 0.75 pt line width by MSO. Co-authored-by: Balázs Regényi Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93968 Reviewed-by: László Németh Tested-by: László Németh (cherry picked from commit 96319d662dca12616eb52c601a2d5b5adca3ae57) Change-Id: I40f7aefe6358bebe9a3853fe3e7d6faa170bc34c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99533 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 468c89ad7b7e..9ef07ec5ef5d 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -874,7 +874,7 @@ void DrawingML::WriteOutline( const Reference& rXPropSet, Referenc mpFS->startElementNS( XML_a, XML_ln, XML_cap, cap, - XML_w, nLineWidth > 1 && nStyleLineWidth != nLineWidth ? + XML_w, nLineWidth == 0 || (nLineWidth > 1 && nStyleLineWidth != nLineWidth) ? OString::number(oox::drawingml::convertHmmToEmu(nLineWidth)).getStr() : nullptr ); if( bColorSet ) diff --git a/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt b/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt new file mode 100644 index ..fffd9b9b2037 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 7e9bcb639012..089154675288 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1118,6 +1118,18 @@ DECLARE_OOXMLEXPORT_TEST(testArrowMarker, "tdf123346_ArrowMarker.docx") "/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:tailEnd", "type", "arrow"); } +DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt") +{ +// tdf#92526: Make sure that line with stays 0. +xmlDocPtr pXml = parseExport("word/document.xml"); +if (!pXml) +return; + +// "w" attribute was not exported. +assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing" +"/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 16 +++ writerfilter/source/dmapper/GraphicImport.cxx | 17 +--- 3 files changed, 29 insertions(+), 4 deletions(-) New commits: commit 6479096dc2bd40215ff80273b4d27cadb2688cb1 Author: Szabolcs Toth AuthorDate: Thu Jun 18 15:58:32 2020 +0200 Commit: László Németh CommitDate: Wed Jul 15 13:11:29 2020 +0200 tdf#120760 DOCX shape import: fix Z-order with behindDoc 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 Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx new file mode 100644 index ..77a6d48dd866 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 480e9c700c08..c4208ada642a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1319,6 +1319,22 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf112287, "tdf112287.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr","vAnchor","margin"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testZOrderInHeader, "tdf120760_ZOrderInHeader.docx") +{ +// tdf#120760 Check that the Z-Order of the background is smaller than the front shape's. +xmlDocUniquePtr pXml = parseExport("word/header1.xml"); +if (!pXml) +return; + +// Get the Z-Order of the background image and of the shape in front of it. +sal_Int32 nBackground = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/w:drawing/wp:anchor", "relativeHeight").toInt32(); +sal_Int32 nFrontShape = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/mc:AlternateContent[2]" +"/mc:Choice/w:drawing/wp:anchor", "relativeHeight").toInt32(); + +// Assert that background is in the back. +CPPUNIT_ASSERT(nBackground < nFrontShape); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 6c8523ab9bff..cf27a30c49f3 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -208,6 +208,7 @@ public: bool bLayoutInCell; bool bAllowOverlap = true; bool bOpaque; +bool bBehindDoc; bool bContour; bool bContourOutside; WrapPolygon::Pointer_t mpWrapPolygon; @@ -273,6 +274,7 @@ public: ,nWrap(text::WrapTextMode_NONE) ,bLayoutInCell(true) ,bOpaque( !rDMapper.IsInHeaderFooter() ) +,bBehindDoc(false) ,bContour(false) ,bContourOutside(true) ,nLeftMargin(319) @@ -371,10 +373,15 @@ public: { if (zOrder >= 0) { +// tdf#120760 Send objects with behinddoc=true to the back. +sal_Int32 nZOrder = zOrder; +if (bBehindDoc && rDomainMapper.IsInHeaderFooter()) +nZOrder -= SAL_MAX_INT32; GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper(); bool bOldStyle = eGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE; - xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper->findZOrder(zOrder, bOldStyle))); -pZOrderHelper->addItem(xGraphicObjectProperties, zOrder); + xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), +uno::makeAny(pZOrderHelper->findZOrder(nZOrder, bOldStyle))); +pZOrderHelper->addItem(xGraphicObjectProperties, nZOrder); } } @@ -609,8 +616,11 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) m_pImpl->zOrder = nIntValue; break; case NS_ooxml::LN_CT_Anchor_behindDoc: // 90989; - in background -if( nIntValue > 0 ) +if
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 13 ++ sw/source/core/layout/anchoreddrawobject.cxx |3 ++ writerfilter/source/dmapper/GraphicImport.cxx |8 ++ 4 files changed, 24 insertions(+) New commits: commit 718683ab1582849ea43797e404c6453ce2fbd424 Author: Szabolcs Toth AuthorDate: Fri Jun 5 12:06:22 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Fri Jun 26 12:55:09 2020 +0200 tdf#133670 DOCX import: fix shape width relative to right margin 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 Reviewed-by: László Németh (cherry picked from commit 330ed8120e9881656716d70d87b9f49f861f0bfa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97067 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx new file mode 100644 index ..68f24370a31e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 5289dec3dfc5..791d32e26435 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1229,6 +1229,19 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, "tdf132491_UnderlineCo "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "color"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, "tdf133670_testRelativeAnchorWidthFromRightMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#133670 The width was set relative from right margin, but this was handled relative from page width. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(2408), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 4789ae807239..ae7ecf1ea295 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -641,6 +641,9 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const // E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) nWidth = GetPageFrame()->GetLeftMargin(); +// Same as the left margin above. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_RIGHT) +nWidth = GetPageFrame()->GetRightMargin(); else nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index d7128080dfeb..3773329c6a48 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -955,6 +955,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_LEFT)); } break; +case NS_ooxml::LN_ST_SizeRelFromH_rightMargin: +if (m_xShape.is()) +{ +// Same as the left margin above. +uno::Reference xPropertySet(m_xShape, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_RIGHT)); +} +break; case NS_ooxml::LN_ST_SizeRelFromH_page: if (m_xShape.is()) { ___ Libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 14 ++ sw/source/core/layout/anchoreddrawobject.cxx | 13 ++--- writerfilter/source/dmapper/GraphicImport.cxx | 10 +++ 4 files changed, 33 insertions(+), 4 deletions(-) New commits: commit 5451833f3af5582a8cab7e4b3da402f083f56908 Author: Szabolcs Toth AuthorDate: Thu Jun 4 15:43:42 2020 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 25 12:17:27 2020 +0200 tdf#132976 DOCX import: fix shape width relative to left margin 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 Reviewed-by: László Németh (cherry picked from commit 7380905abc0833d9e4c4fe731d76174db8a8724c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96998 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx new file mode 100644 index ..2f1c5560c17a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 4df9baf213ea..80ca3e83b8fe 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1153,6 +1153,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt") "/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testRelativeAnchorWidthFromLeftMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#132976 The size of the width of this shape should come from the size of the left margin. +// It was set to the size of the width of the entire page before. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 5f60d769a44a..4789ae807239 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -632,13 +632,18 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const long nTargetWidth = aCurrObjRect.GetWidth( ); if ( GetDrawObj( )->GetRelativeWidth( ) ) { -tools::Rectangle aPageRect; +long nWidth = 0; if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::FRAME) // Exclude margins. -aPageRect = GetPageFrame()->getFramePrintArea().SVRect(); +nWidth = GetPageFrame()->getFramePrintArea().SVRect().GetWidth(); +// Here we handle the relative size of the width of some shape. +// The size of the shape's width is going to be relative to the size of the left margin. +// E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) +nWidth = GetPageFrame()->GetLeftMargin(); else -aPageRect = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect(); -nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( )->GetRelativeWidth()); +nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); +nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); } long nTargetHeight = aCurrObjRect.GetHeight( ); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 7b23e790..d7128080dfeb 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -945,6 +945,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 13 ++ sw/source/core/layout/anchoreddrawobject.cxx |3 ++ writerfilter/source/dmapper/GraphicImport.cxx |8 ++ 4 files changed, 24 insertions(+) New commits: commit 330ed8120e9881656716d70d87b9f49f861f0bfa Author: Szabolcs Toth AuthorDate: Fri Jun 5 12:06:22 2020 +0200 Commit: László Németh CommitDate: Wed Jun 24 11:36:15 2020 +0200 tdf#133670 DOCX import: fix shape width relative to right margin 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 Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx new file mode 100644 index ..68f24370a31e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 7356de7be9fe..cc5f2d3364b1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1225,6 +1225,19 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, "tdf132491_UnderlineCo "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "color"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, "tdf133670_testRelativeAnchorWidthFromRightMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#133670 The width was set relative from right margin, but this was handled relative from page width. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(2408), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 4789ae807239..ae7ecf1ea295 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -641,6 +641,9 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const // E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) nWidth = GetPageFrame()->GetLeftMargin(); +// Same as the left margin above. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_RIGHT) +nWidth = GetPageFrame()->GetRightMargin(); else nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 700fb6ca34a8..7a273ed7b984 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -955,6 +955,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_LEFT)); } break; +case NS_ooxml::LN_ST_SizeRelFromH_rightMargin: +if (m_xShape.is()) +{ +// Same as the left margin above. +uno::Reference xPropertySet(m_xShape, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_RIGHT)); +} +break; case NS_ooxml::LN_ST_SizeRelFromH_page: if (m_xShape.is()) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 14 ++ sw/source/core/layout/anchoreddrawobject.cxx | 13 ++--- writerfilter/source/dmapper/GraphicImport.cxx | 10 +++ 4 files changed, 33 insertions(+), 4 deletions(-) New commits: commit 7380905abc0833d9e4c4fe731d76174db8a8724c Author: Szabolcs Toth AuthorDate: Thu Jun 4 15:43:42 2020 +0200 Commit: László Németh CommitDate: Tue Jun 23 16:20:13 2020 +0200 tdf#132976 DOCX import: fix shape width relative to left margin 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 Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx new file mode 100644 index ..2f1c5560c17a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 336e99b26507..4c6428321792 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1155,6 +1155,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt") "/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0"); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testRelativeAnchorWidthFromLeftMargin.docx") +{ +// TODO: Fix export. +if (mbExported) +return; + +// tdf#132976 The size of the width of this shape should come from the size of the left margin. +// It was set to the size of the width of the entire page before. +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +const sal_Int32 nAnchoredWidth += getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); +CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 5f60d769a44a..4789ae807239 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -632,13 +632,18 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const long nTargetWidth = aCurrObjRect.GetWidth( ); if ( GetDrawObj( )->GetRelativeWidth( ) ) { -tools::Rectangle aPageRect; +long nWidth = 0; if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::FRAME) // Exclude margins. -aPageRect = GetPageFrame()->getFramePrintArea().SVRect(); +nWidth = GetPageFrame()->getFramePrintArea().SVRect().GetWidth(); +// Here we handle the relative size of the width of some shape. +// The size of the shape's width is going to be relative to the size of the left margin. +// E.g.: (left margin = 8 && relative size = 150%) -> width of some shape = 12. +else if (GetDrawObj()->GetRelativeWidthRelation() == text::RelOrientation::PAGE_LEFT) +nWidth = GetPageFrame()->GetLeftMargin(); else -aPageRect = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect(); -nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( )->GetRelativeWidth()); +nWidth = GetPageFrame( )->GetBoundRect( GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth(); +nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth()); } long nTargetHeight = aCurrObjRect.GetHeight( ); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 5155e2f61211..700fb6ca34a8 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -945,6 +945,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::FRAME)); } break; +case NS_ooxml::LN_ST_SizeRelFromH_leftMargin: +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx| 49 ++ sc/source/filter/oox/drawingfragment.cxx | 37 ++-- 3 files changed, 82 insertions(+), 4 deletions(-) New commits: commit 5c62bdca7246d3ee64fa1380c2bdc30d4c8c8481 Author: Szabolcs Toth AuthorDate: Thu May 21 09:06:08 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jun 12 10:26:22 2020 +0200 tdf#83593 XLSX DrawingML shape import: fix missing rotation caused by broken import of xdr:twoCellAnchor. Co-authored-by: Balázs Regényi Change-Id: I3f382c3c9b2428e825a3e6d954c65356942f9158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94611 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 130e6a3f4493b987a7d0b177cc84d65219b47d13) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96136 Reviewed-by: Szabolcs Toth Reviewed-by: Gabor Kelemen Tested-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx new file mode 100644 index ..125a3ccaabd0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e005b258d979..99840eceaaae 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -77,6 +77,7 @@ #include "helper/qahelper.hxx" #include "helper/shared_test_impl.hxx" +#include namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } @@ -251,6 +252,7 @@ public: void testAutoheight2Rows(); void testXLSDefColWidth(); void testPreviewMissingObjLink(); +void testShapeRotationImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -393,6 +395,7 @@ public: CPPUNIT_TEST(testAutoheight2Rows); CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); +CPPUNIT_TEST(testShapeRotationImport); CPPUNIT_TEST_SUITE_END(); @@ -4344,6 +4347,52 @@ void ScFiltersTest::testPreviewMissingObjLink() xDocSh->DoClose(); } +void ScFiltersTest::testShapeRotationImport() +{ +// tdf#83593 Incorrectly calculated bounding rectangles caused shapes to appear as if there +// were extra or missing rotations. Hence, we check the sizes of these rectangles. +ScDocShellRef xDocSh = loadDoc("testShapeRotationImport.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testShapeRotationImport.xlsx", xDocSh.is()); +uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); +uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); + +// The expected values are in the map below. Note that some of the angles are outside of the set which contains +// the value of the wrong angles. This is to check the border cases and one value on both sides. +std::map> aExpectedValues +{ +{ 4400, { { "x", 6832 }, { "y", 36893 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4500, { { "x", 4490 }, { "y", 36400 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4600, { { "x", 1673 }, { "y", 36270 }, { "width", 8862 }, { "height", 1144 } } }, +{ 13400, { { "x", 13762 }, { "y", 28403 }, { "width", 8863 }, { "height", 1194 } } }, +{ 13500, { { "x", 10817 }, { "y", 27951 }, { "width", 8863 }, { "height", 1170 } } }, +{ 13600, { { "x", 8449 }, { "y", 28336 }, { "width", 8897 }, { "height", 1164 } } }, +{ 22400, { { "x", 14948 }, { "y", 12978 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22500, { { "x", 11765 }, { "y", 12834 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22600, { { "x", 8253 }, { "y", 12919 }, { "width", 8863 }, { "height", 1171 } } }, +{ 31400, { { "x", 8099 }, { "y", 1160 }, { "width", 9815 }, { "height", 1171 } } }, +{ 31500, { { "x", 4427 }, { "y", 1274 }, { "width", 10238 }, { "height", 1171 } } }, +{ 31600, { { "x", 1964 }, { "y", 1878 }, { "width", 10307 }, { "height", 1164 } } }, +}; + +for (sal_Int32 ind = 0; ind < 12; ++ind) +{ +uno::Reference< drawing::XShape > xShape(xPage->getByIndex(ind), uno::UNO_QUERY_THROW); + +uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +awt::Point aPosition = xShape->getPosition(); +awt::Size aSize = xShape->getSize(); + +CPPUNIT_ASSERT(aExpectedValues.find(nRot) != aExpectedValues.end()); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["x"], aPosition.X); +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx| 49 ++ sc/source/filter/oox/drawingfragment.cxx | 37 ++-- 3 files changed, 82 insertions(+), 4 deletions(-) New commits: commit d24e590cab4c948f19d4eaa00eaec81364c5b8ee Author: Szabolcs Toth AuthorDate: Thu May 21 09:06:08 2020 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Sun May 31 22:34:55 2020 +0200 tdf#83593 XLSX DrawingML shape import: fix missing rotation caused by broken import of xdr:twoCellAnchor. Co-authored-by: Balázs Regényi Change-Id: I3f382c3c9b2428e825a3e6d954c65356942f9158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94611 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 130e6a3f4493b987a7d0b177cc84d65219b47d13) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95192 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx new file mode 100644 index ..125a3ccaabd0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e56ebd256eb1..3292058ed979 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -77,6 +77,7 @@ #include "helper/qahelper.hxx" #include "helper/shared_test_impl.hxx" +#include namespace com::sun::star::frame { class XModel; } @@ -257,6 +258,7 @@ public: void testAutoheight2Rows(); void testXLSDefColWidth(); void testPreviewMissingObjLink(); +void testShapeRotationImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -405,6 +407,7 @@ public: CPPUNIT_TEST(testAutoheight2Rows); CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); +CPPUNIT_TEST(testShapeRotationImport); CPPUNIT_TEST_SUITE_END(); @@ -4445,6 +4448,52 @@ void ScFiltersTest::testPreviewMissingObjLink() xDocSh->DoClose(); } +void ScFiltersTest::testShapeRotationImport() +{ +// tdf#83593 Incorrectly calculated bounding rectangles caused shapes to appear as if there +// were extra or missing rotations. Hence, we check the sizes of these rectangles. +ScDocShellRef xDocSh = loadDoc("testShapeRotationImport.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testShapeRotationImport.xlsx", xDocSh.is()); +uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); +uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); + +// The expected values are in the map below. Note that some of the angles are outside of the set which contains +// the value of the wrong angles. This is to check the border cases and one value on both sides. +std::map> aExpectedValues +{ +{ 4400, { { "x", 6832 }, { "y", 36893 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4500, { { "x", 4490 }, { "y", 36400 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4600, { { "x", 1673 }, { "y", 36270 }, { "width", 8862 }, { "height", 1144 } } }, +{ 13400, { { "x", 13762 }, { "y", 28403 }, { "width", 8863 }, { "height", 1194 } } }, +{ 13500, { { "x", 10817 }, { "y", 27951 }, { "width", 8863 }, { "height", 1170 } } }, +{ 13600, { { "x", 8449 }, { "y", 28336 }, { "width", 8897 }, { "height", 1164 } } }, +{ 22400, { { "x", 14948 }, { "y", 12978 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22500, { { "x", 11765 }, { "y", 12834 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22600, { { "x", 8253 }, { "y", 12919 }, { "width", 8863 }, { "height", 1171 } } }, +{ 31400, { { "x", 8099 }, { "y", 1160 }, { "width", 9815 }, { "height", 1171 } } }, +{ 31500, { { "x", 4427 }, { "y", 1274 }, { "width", 10238 }, { "height", 1171 } } }, +{ 31600, { { "x", 1964 }, { "y", 1878 }, { "width", 10307 }, { "height", 1164 } } }, +}; + +for (sal_Int32 ind = 0; ind < 12; ++ind) +{ +uno::Reference< drawing::XShape > xShape(xPage->getByIndex(ind), uno::UNO_QUERY_THROW); + +uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +awt::Point aPosition = xShape->getPosition(); +awt::Size aSize = xShape->getSize(); + +CPPUNIT_ASSERT(aExpectedValues.find(nRot) != aExpectedValues.end()); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["x"], aPosition.X); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["y"],
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx| 49 ++ sc/source/filter/oox/drawingfragment.cxx | 37 ++-- 3 files changed, 82 insertions(+), 4 deletions(-) New commits: commit 130e6a3f4493b987a7d0b177cc84d65219b47d13 Author: Szabolcs Toth AuthorDate: Thu May 21 09:06:08 2020 +0200 Commit: László Németh CommitDate: Fri May 29 17:26:08 2020 +0200 tdf#83593 XLSX DrawingML shape import: fix missing rotation caused by broken import of xdr:twoCellAnchor. Co-authored-by: Balázs Regényi Change-Id: I3f382c3c9b2428e825a3e6d954c65356942f9158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94611 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx new file mode 100644 index ..125a3ccaabd0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e56ebd256eb1..3292058ed979 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -77,6 +77,7 @@ #include "helper/qahelper.hxx" #include "helper/shared_test_impl.hxx" +#include namespace com::sun::star::frame { class XModel; } @@ -257,6 +258,7 @@ public: void testAutoheight2Rows(); void testXLSDefColWidth(); void testPreviewMissingObjLink(); +void testShapeRotationImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -405,6 +407,7 @@ public: CPPUNIT_TEST(testAutoheight2Rows); CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); +CPPUNIT_TEST(testShapeRotationImport); CPPUNIT_TEST_SUITE_END(); @@ -4445,6 +4448,52 @@ void ScFiltersTest::testPreviewMissingObjLink() xDocSh->DoClose(); } +void ScFiltersTest::testShapeRotationImport() +{ +// tdf#83593 Incorrectly calculated bounding rectangles caused shapes to appear as if there +// were extra or missing rotations. Hence, we check the sizes of these rectangles. +ScDocShellRef xDocSh = loadDoc("testShapeRotationImport.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testShapeRotationImport.xlsx", xDocSh.is()); +uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); +uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); + +// The expected values are in the map below. Note that some of the angles are outside of the set which contains +// the value of the wrong angles. This is to check the border cases and one value on both sides. +std::map> aExpectedValues +{ +{ 4400, { { "x", 6832 }, { "y", 36893 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4500, { { "x", 4490 }, { "y", 36400 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4600, { { "x", 1673 }, { "y", 36270 }, { "width", 8862 }, { "height", 1144 } } }, +{ 13400, { { "x", 13762 }, { "y", 28403 }, { "width", 8863 }, { "height", 1194 } } }, +{ 13500, { { "x", 10817 }, { "y", 27951 }, { "width", 8863 }, { "height", 1170 } } }, +{ 13600, { { "x", 8449 }, { "y", 28336 }, { "width", 8897 }, { "height", 1164 } } }, +{ 22400, { { "x", 14948 }, { "y", 12978 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22500, { { "x", 11765 }, { "y", 12834 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22600, { { "x", 8253 }, { "y", 12919 }, { "width", 8863 }, { "height", 1171 } } }, +{ 31400, { { "x", 8099 }, { "y", 1160 }, { "width", 9815 }, { "height", 1171 } } }, +{ 31500, { { "x", 4427 }, { "y", 1274 }, { "width", 10238 }, { "height", 1171 } } }, +{ 31600, { { "x", 1964 }, { "y", 1878 }, { "width", 10307 }, { "height", 1164 } } }, +}; + +for (sal_Int32 ind = 0; ind < 12; ++ind) +{ +uno::Reference< drawing::XShape > xShape(xPage->getByIndex(ind), uno::UNO_QUERY_THROW); + +uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +awt::Point aPosition = xShape->getPosition(); +awt::Size aSize = xShape->getSize(); + +CPPUNIT_ASSERT(aExpectedValues.find(nRot) != aExpectedValues.end()); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["x"], aPosition.X); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["y"], aPosition.Y); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["width"], aSize.Width); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["height"], aSize.Height); +} +} + ScFiltersTest::ScFiltersTest() :
[Libreoffice-commits] core.git: oox/source sw/qa
oox/source/export/drawingml.cxx |2 +- sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 3 files changed, 13 insertions(+), 1 deletion(-) New commits: commit 96319d662dca12616eb52c601a2d5b5adca3ae57 Author: Szabolcs Toth AuthorDate: Mon May 11 15:56:27 2020 +0200 Commit: László Németh CommitDate: Mon May 18 15:55:41 2020 +0200 tdf#92526 DrawingML shape export: fix 0 line width 0 line width is the thinnest possible line width, but without its explicit export (a:ln w="0"), shape outline was imported with 0.75 pt line width by MSO. Co-authored-by: Balázs Regényi Change-Id: I40f7aefe6358bebe9a3853fe3e7d6faa170bc34c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93968 Reviewed-by: László Németh Tested-by: László Németh diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 12a4506a8e75..c925819dd9f8 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -866,7 +866,7 @@ void DrawingML::WriteOutline( const Reference& rXPropSet, Referenc mpFS->startElementNS( XML_a, XML_ln, XML_cap, cap, - XML_w, nLineWidth > 1 && nStyleLineWidth != nLineWidth ? + XML_w, nLineWidth == 0 || (nLineWidth > 1 && nStyleLineWidth != nLineWidth) ? OString::number(oox::drawingml::convertHmmToEmu(nLineWidth)).getStr() : nullptr ); if( bColorSet ) diff --git a/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt b/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt new file mode 100644 index ..fffd9b9b2037 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 6993eb54c273..48b2cef55586 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1135,6 +1135,18 @@ DECLARE_OOXMLEXPORT_TEST(testArrowMarker, "tdf123346_ArrowMarker.docx") "/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:tailEnd", "type", "arrow"); } +DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt") +{ +// tdf#92526: Make sure that line with stays 0. +xmlDocUniquePtr pXml = parseExport("word/document.xml"); +if (!pXml) +return; + +// "w" attribute was not exported. +assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing" +"/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - oox/source sw/qa
oox/source/vml/vmlshape.cxx| 19 - sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 3 files changed, 18 insertions(+), 13 deletions(-) New commits: commit 14f11a2a26163123502ac9ea915416871d180cc0 Author: Szabolcs Toth AuthorDate: Tue Mar 17 11:39:33 2020 +0100 Commit: László Németh CommitDate: Wed Apr 1 10:50:00 2020 +0200 tdf#100751 DOCX VML shape import: fix arrow direction Flips along both the y- and x-axis weren't imported, resulting wrong direction of arrow and other shapes. Co-Author: Balázs Regényi Change-Id: Iac222ac2a6a6110289969c32b40828b83da0aefd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90646 Tested-by: Jenkins Reviewed-by: Balazs Varga (cherry picked from commit cb441c4d0adf698e6af9073c6c3285a66b76871e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91391 Tested-by: Xisco Faulí Reviewed-by: László Németh diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 45409c3f23a3..e1c857f5528e 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -671,11 +671,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes oRotation = ConversionHelper::decodeRotation(maTypeModel.maRotation); if (!maTypeModel.maFlip.isEmpty()) { -if (maTypeModel.maFlip == "x") +if (maTypeModel.maFlip.startsWith("x")) { bFlipX = true; } -else if (maTypeModel.maFlip == "y") +if (maTypeModel.maFlip.endsWith("y")) { bFlipY = true; } @@ -831,17 +831,10 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur. // It might occur internally in SdrObject of "sw" module, not here. // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally. -if (bFlipX || bFlipY) -{ -assert(!(bFlipX && bFlipY)); -css::beans::PropertyValue aProp; -if (bFlipX) -aProp.Name = "MirroredX"; -else -aProp.Name = "MirroredY"; -aProp.Value <<= true; -aPropVec.push_back(aProp); -} +if (bFlipX) +aPropVec.push_back(comphelper::makePropertyValue("MirroredX", true)); +if (bFlipY) +aPropVec.push_back(comphelper::makePropertyValue("MirroredY", true)); if (!maTypeModel.maAdjustments.isEmpty()) { diff --git a/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx b/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx new file mode 100644 index ..8a57f69eaef0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 71628cb81e93..566eb076feef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1082,6 +1082,18 @@ DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2); } +DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx") +{ +// tdf#100751: Both x and y flip should happen. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +OUString arrowStyle = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group/v:shape[2]", "style"); +CPPUNIT_ASSERT(arrowStyle.indexOf(u"flip:xy") != sal_Int32(-1)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: oox/source sw/qa
oox/source/vml/vmlshape.cxx| 19 - sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 3 files changed, 18 insertions(+), 13 deletions(-) New commits: commit cb441c4d0adf698e6af9073c6c3285a66b76871e Author: Szabolcs Toth AuthorDate: Tue Mar 17 11:39:33 2020 +0100 Commit: Balazs Varga CommitDate: Tue Mar 31 10:09:13 2020 +0200 tdf#100751 DOCX VML shape import: fix arrow direction Flips along both the y- and x-axis weren't imported, resulting wrong direction of arrow and other shapes. Co-Author: Balázs Regényi Change-Id: Iac222ac2a6a6110289969c32b40828b83da0aefd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90646 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 1c53a87b463e..bdd9ac593dd6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -660,11 +660,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes oRotation = ConversionHelper::decodeRotation(maTypeModel.maRotation); if (!maTypeModel.maFlip.isEmpty()) { -if (maTypeModel.maFlip == "x") +if (maTypeModel.maFlip.startsWith("x")) { bFlipX = true; } -else if (maTypeModel.maFlip == "y") +if (maTypeModel.maFlip.endsWith("y")) { bFlipY = true; } @@ -820,17 +820,10 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur. // It might occur internally in SdrObject of "sw" module, not here. // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally. -if (bFlipX || bFlipY) -{ -assert(!(bFlipX && bFlipY)); -css::beans::PropertyValue aProp; -if (bFlipX) -aProp.Name = "MirroredX"; -else -aProp.Name = "MirroredY"; -aProp.Value <<= true; -aPropVec.push_back(aProp); -} +if (bFlipX) +aPropVec.push_back(comphelper::makePropertyValue("MirroredX", true)); +if (bFlipY) +aPropVec.push_back(comphelper::makePropertyValue("MirroredY", true)); if (!maTypeModel.maAdjustments.isEmpty()) { diff --git a/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx b/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx new file mode 100644 index ..8a57f69eaef0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 4a7219a90a86..498cf8a95772 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1103,6 +1103,18 @@ DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2); } +DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx") +{ +// tdf#100751: Both x and y flip should happen. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +OUString arrowStyle = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group/v:shape[2]", "style"); +CPPUNIT_ASSERT(arrowStyle.indexOf(u"flip:xy") != sal_Int32(-1)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx| 11 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 +++- 2 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 541f5b508e7d356803eac2bdce4278649ee76203 Author: Szabolcs Toth AuthorDate: Thu Feb 20 10:54:19 2020 +0100 Commit: Xisco Faulí CommitDate: Fri Feb 21 18:01:59 2020 +0100 tdf#130799 DOCX import: fix missing inside vertical borders caused by incomplete handling of tables with 1-column rows with merged cells. Have to check the rows below current to see if they contain also one cell, therefore form a column, or more than one cell, in which case do not remove vertical borders. Regression from commit: 8a2eb40abbd52d960dd21308157186be0ca9dd3d (tdf#129442 DOCX import: fix right border of 1-column tables). Change-Id: If9ca7ccd42255e78c61b6271e19262ab5cc8e439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89081 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 111db716c23f9f8450eda58c13dd2423770fd15e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89134 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index c85b8a7f932f..71628cb81e93 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1071,6 +1071,17 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, "tdf95495.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:ilvl [@w:val = '1']", 1); } +DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") +{ +// tdf#130799: Inside vertical borders of a table should not be missing. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +// Left and right borders. +assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 83cf9277b3e9..a0b214a76555 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -836,7 +836,17 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl // Do not apply vertical borders to a one column table. else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) { -rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +bool isOneCol = true; +for (size_t i = nRow; i < m_aCellProperties.size(); i++) +{ +if (m_aCellProperties[i].size() > 1) +{ +isOneCol = false; +break; +} +} +if (isOneCol) +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } // Do not apply horizontal borders to a one row table. else if (m_aCellProperties.size() == 1 && aRowOfCellsIterator->size() > 1) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf95495.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 10 + writerfilter/source/dmapper/StyleSheetTable.cxx | 44 ++-- 3 files changed, 44 insertions(+), 10 deletions(-) New commits: commit 7c339186b4b41ce9a591cb8fb14ec3120567 Author: Szabolcs Toth AuthorDate: Fri Jan 24 10:40:01 2020 +0100 Commit: Xisco Faulí CommitDate: Fri Feb 21 17:15:55 2020 +0100 tdf#95495 DOCX import: fix inherited list level of custom styles in DOCX export of MSO 2003, 2007 and 2010, where ilvl and outlinelvl settings are missing, based on the settings of the parent styles. Change-Id: I01d239db505d46a89d7f3b9118ef0b55697bc7fc CO-Author: Balázs Nádasdy (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87328 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89216 Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf95495.docx b/sw/qa/extras/ooxmlexport/data/tdf95495.docx new file mode 100644 index ..21f534b11223 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf95495.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index a87a0b2919f3..c85b8a7f932f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1061,6 +1061,16 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, "tdf95495.docx") +{ +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// tdf#95495: set list level of the custom style based on the setting of the parent style +assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:ilvl [@w:val = '1']", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 08881a93a9fe..e4f970dbcd0e 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -892,6 +892,12 @@ uno::Sequence< OUString > PropValVector::getNames() return comphelper::containerToSequence(aRet); } +static bool lcl_IsOutLineStyle(const OUString& sPrefix, const OUString& sStyleName) +{ +OUString sSuffix; +return sStyleName.getLength() == (sPrefix.getLength() + 2) && sStyleName.startsWith(sPrefix + " ", ) && sSuffix.toInt32() > 0; +} + void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) { try @@ -1049,13 +1055,39 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) } // Set the outline levels -const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast(pEntry ? pEntry->pProperties.get() : nullptr); +StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast(pEntry ? pEntry->pProperties.get() : nullptr); + if ( pStyleSheetProperties ) { beans::PropertyValue aLvlVal( getPropertyName( PROP_OUTLINE_LEVEL ), 0, uno::makeAny( sal_Int16( pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ), beans::PropertyState_DIRECT_VALUE ); aPropValues.push_back(aLvlVal); + +// tdf#95495 missing list level settings in custom styles in old DOCX: apply settings of the parent style +if (pStyleSheetProperties->GetListLevel() == -1 && pStyleSheetProperties->GetOutlineLevel() == -1) +{ +const beans::PropertyValues aPropGrabBag = pEntry->GetInteropGrabBagSeq(); +for (const auto& rVal : aPropGrabBag) +{ +if (rVal.Name == "customStyle" && rVal.Value == true) +{ +OUString sBaseId = pEntry->sBaseStyleIdentifier; +for (const auto& aSheetProps : m_pImpl->m_aStyleSheetEntries) +{ +if (aSheetProps->sStyleIdentifierD == sBaseId) +{ +StyleSheetPropertyMap* aStyleSheetProps +=
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx| 11 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 +++- 2 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 111db716c23f9f8450eda58c13dd2423770fd15e Author: Szabolcs Toth AuthorDate: Thu Feb 20 10:54:19 2020 +0100 Commit: László Németh CommitDate: Fri Feb 21 10:40:41 2020 +0100 tdf#130799 DOCX import: fix missing inside vertical borders caused by incomplete handling of tables with 1-column rows with merged cells. Have to check the rows below current to see if they contain also one cell, therefore form a column, or more than one cell, in which case do not remove vertical borders. Regression from commit: 8a2eb40abbd52d960dd21308157186be0ca9dd3d (tdf#129442 DOCX import: fix right border of 1-column tables). Change-Id: If9ca7ccd42255e78c61b6271e19262ab5cc8e439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89081 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index d1e62fb62c90..4a7219a90a86 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1092,6 +1092,17 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, "tdf95495.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:ilvl [@w:val = '1']", 1); } +DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") +{ +// tdf#130799: Inside vertical borders of a table should not be missing. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +// Left and right borders. +assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 25e9cd2ba261..bf5b638fafb5 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -889,7 +889,17 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl // Do not apply vertical borders to a one column table. else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) { -rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +bool isOneCol = true; +for (size_t i = nRow; i < m_aCellProperties.size(); i++) +{ +if (m_aCellProperties[i].size() > 1) +{ +isOneCol = false; +break; +} +} +if (isOneCol) +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } // Do not apply horizontal borders to a one row table. else if (m_aCellProperties.size() == 1 && aRowOfCellsIterator->size() > 1) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/dmapper/StyleSheetTable.cxx | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) New commits: commit 04a226b6f536f81a431301eb73985e6c515e21a5 Author: Szabolcs Toth AuthorDate: Mon Feb 17 09:51:55 2020 +0100 Commit: László Németh CommitDate: Mon Feb 17 14:28:10 2020 +0100 DOCX clean-up: revert underused lcl_IsOutLineStyle() Reverting a portion of commit 125dd0be473d15681049814c3982f1ae2c0f (tdf#95495 DOCX import: fix inherited list level of custom styles) Change-Id: I763ed303de2bad52b0c265eaf7ac9be664c4dcdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88850 Tested-by: László Németh Reviewed-by: László Németh diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 918ef8ad6e46..ceeb95a55d24 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -886,12 +886,6 @@ uno::Sequence< OUString > PropValVector::getNames() return comphelper::containerToSequence(aRet); } -static bool lcl_IsOutLineStyle(const OUString& sPrefix, const OUString& sStyleName) -{ -OUString sSuffix; -return sStyleName.getLength() == (sPrefix.getLength() + 2) && sStyleName.startsWith(sPrefix + " ", ) && sSuffix.toInt32() > 0; -} - void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) { try @@ -1095,7 +1089,15 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) } else if ( sConvertedStyleName == "Text body" ) xState->setPropertyToDefault(getPropertyName( PROP_PARA_BOTTOM_MARGIN )); -else if( lcl_IsOutLineStyle("Heading", sConvertedStyleName) ) +else if ( sConvertedStyleName == "Heading 1" || + sConvertedStyleName == "Heading 2" || + sConvertedStyleName == "Heading 3" || + sConvertedStyleName == "Heading 4" || + sConvertedStyleName == "Heading 5" || + sConvertedStyleName == "Heading 6" || + sConvertedStyleName == "Heading 7" || + sConvertedStyleName == "Heading 8" || + sConvertedStyleName == "Heading 9" ) { xState->setPropertyToDefault(getPropertyName( PROP_CHAR_WEIGHT )); xState->setPropertyToDefault(getPropertyName( PROP_CHAR_WEIGHT_ASIAN )); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf95495.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 10 + writerfilter/source/dmapper/StyleSheetTable.cxx | 44 ++-- 3 files changed, 44 insertions(+), 10 deletions(-) New commits: commit 125dd0be473d15681049814c3982f1ae2c0f Author: Szabolcs Toth AuthorDate: Fri Jan 24 10:40:01 2020 +0100 Commit: László Németh CommitDate: Thu Feb 13 09:37:51 2020 +0100 tdf#95495 DOCX import: fix inherited list level of custom styles in DOCX export of MSO 2003, 2007 and 2010, where ilvl and outlinelvl settings are missing, based on the settings of the parent styles. Change-Id: I01d239db505d46a89d7f3b9118ef0b55697bc7fc CO-Author: Balázs Nádasdy (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87328 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf95495.docx b/sw/qa/extras/ooxmlexport/data/tdf95495.docx new file mode 100644 index ..21f534b11223 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf95495.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 9001db35e92c..4293f1deb695 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1061,6 +1061,16 @@ DECLARE_OOXMLEXPORT_TEST(testFontTypes, "tdf120344_FontTypes.docx") assertXPath(qXmlDocument, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:rPr/w:rFonts [@w:ascii='Arial Black']", 1); } +DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, "tdf95495.docx") +{ +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// tdf#95495: set list level of the custom style based on the setting of the parent style +assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:ilvl [@w:val = '1']", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 33c22e357110..b3348099cfaf 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -886,6 +886,12 @@ uno::Sequence< OUString > PropValVector::getNames() return comphelper::containerToSequence(aRet); } +static bool lcl_IsOutLineStyle(const OUString& sPrefix, const OUString& sStyleName) +{ +OUString sSuffix; +return sStyleName.getLength() == (sPrefix.getLength() + 2) && sStyleName.startsWith(sPrefix + " ", ) && sSuffix.toInt32() > 0; +} + void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) { try @@ -1043,13 +1049,39 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) } // Set the outline levels -const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast(pEntry ? pEntry->pProperties.get() : nullptr); +StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast(pEntry ? pEntry->pProperties.get() : nullptr); + if ( pStyleSheetProperties ) { beans::PropertyValue aLvlVal( getPropertyName( PROP_OUTLINE_LEVEL ), 0, uno::makeAny( sal_Int16( pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ), beans::PropertyState_DIRECT_VALUE ); aPropValues.push_back(aLvlVal); + +// tdf#95495 missing list level settings in custom styles in old DOCX: apply settings of the parent style +if (pStyleSheetProperties->GetListLevel() == -1 && pStyleSheetProperties->GetOutlineLevel() == -1) +{ +const beans::PropertyValues aPropGrabBag = pEntry->GetInteropGrabBagSeq(); +for (const auto& rVal : aPropGrabBag) +{ +if (rVal.Name == "customStyle" && rVal.Value == true) +{ +OUString sBaseId = pEntry->sBaseStyleIdentifier; +for (const auto& aSheetProps : m_pImpl->m_aStyleSheetEntries) +{ +if (aSheetProps->sStyleIdentifierD == sBaseId) +{ +StyleSheetPropertyMap* aStyleSheetProps += dynamic_cast(aSheetProps->pProperties.get()); + pStyleSheetProperties->SetListLevel(aStyleSheetProps->GetListLevel()); +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 13 + writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 17 ++--- 3 files changed, 27 insertions(+), 3 deletions(-) New commits: commit 63518134fc0a148dcce75bebaba43dc5ae761da8 Author: Szabolcs Toth AuthorDate: Mon Dec 30 10:09:34 2019 +0100 Commit: Xisco Faulí CommitDate: Mon Jan 20 09:18:57 2020 +0100 tdf#129452 DOCX import: fix bottom border of merged column Bottom border of a vertically merged column of a table was missing if the inside borders were turned off and the merge included the last cell of the column. This happened because the first cell (topmost) in a set of vertically merged cells determines the borders of the new merged cell, and the turned off inside borders were at the bottom in this case. Change-Id: I3d3defad18a1315117a554a36ad599eb46daffe9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85988 Reviewed-by: László Németh Tested-by: László Németh (cherry picked from commit 0f4dd820ee433932d9d9237b676292d31c4ba913) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86430 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx new file mode 100644 index ..0e8ddd6d3833 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 4511509e69cd..55ac7efb2718 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1048,6 +1048,19 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorder, "tdf129450_BottomBorder.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") +{ +// tdf#129452: Do not omit bottom borders when a column in a table is vertically merged and +// the inside borders are turned off. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index b3bd18de4931..820408638a8d 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -98,7 +98,7 @@ static void lcl_mergeBorder( PropertyIds nId, const PropertyMapPtr& pOrig, const } static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const PropertyMapPtr& pCellProps, -sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow ) +sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow, bool bMergedVertically ) { boost::optional pVerticalVal = pCellProps->getProperty(META_PROP_VERTICAL_BORDER); boost::optional pHorizontalVal = pCellProps->getProperty(META_PROP_HORIZONTAL_BORDER); @@ -157,10 +157,13 @@ static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const P if ( nRow == 0 ) { lcl_mergeBorder( PROP_TOP_BORDER, pTableBorders, pCellProps ); -if ( pHorizontalVal ) +if ( pHorizontalVal && !bMergedVertically ) pCellProps->Insert( PROP_BOTTOM_BORDER, aHorizProp, false ); } +if ( bMergedVertically ) +lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps ); + if ( bIsEndRow ) { lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps ); @@ -841,7 +844,15 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); } -lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); +// tdf#129452 Checking if current cell is vertically merged with all the other cells below to the bottom. +// This must be done in order to apply the bottom border of the table to the first cell in a vertical merge. +bool bMergedVertically = bool(m_aCellProperties[nRow][nCell]->getProperty(PROP_VERTICAL_MERGE)); + +for (size_t i = nRow + 1; bMergedVertically && i < m_aCellProperties.size(); i++) +if (
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 17 + writerfilter/source/dmapper/NumberingManager.cxx | 15 --- 3 files changed, 25 insertions(+), 7 deletions(-) New commits: commit f8c12eca80b1faa65f130dfc64c303dcf88a3ac9 Author: Szabolcs Toth AuthorDate: Mon Jan 6 15:43:03 2020 +0100 Commit: László Németh CommitDate: Fri Jan 10 14:25:15 2020 +0100 tdf#120344 DOCX: fix font style of numbering (numbers and letters) when list items use different font type by direct formatting, solving also the mixed and changing numbering style during editing. Change-Id: I7ebf125bb1b67cbb33078a4e218798e7ffc06260 Co-Author: Balázs Nádasdy (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86277 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx b/sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx new file mode 100644 index ..74bcd59e24c6 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120344_FontTypes.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 48257077f0c3..478ee10310b7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1070,6 +1070,23 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testFontTypes, "tdf120344_FontTypes.docx") +{ +// tdf#120344: Font type of numbering symbols can be different than the font type of the text. + +// Check the font type of the text, should be Consolas. +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/w:rPr/w:rFonts [@w:ascii='Consolas']", 1); + +// Now the font type of the numbering symbols, should be Arial Black. +xmlDocPtr qXmlDocument = parseExport("word/numbering.xml"); +if (!qXmlDocument) +return; +assertXPath(qXmlDocument, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:rPr/w:rFonts [@w:ascii='Arial Black']", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index f55282f3df4f..33290f276be6 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -203,11 +203,15 @@ uno::Sequence ListLevel::GetProperties(bool bDefaults) return aLevelProps; } -static bool IgnoreForCharStyle(const OUString& aStr) +static bool IgnoreForCharStyle(const OUString& aStr, const bool bIsSymbol) { //Names found in PropertyIds.cxx, Lines 56-396 return (aStr=="Adjust" || aStr=="IndentAt" || aStr=="FirstLineIndent" -|| aStr=="FirstLineOffset" || aStr=="LeftMargin" || aStr=="CharFontName" +|| aStr=="FirstLineOffset" || aStr=="LeftMargin" +|| aStr=="CharInteropGrabBag" || aStr=="ParaInteropGrabBag" || +// We need font names when they are different for the bullet and for the text. +// But leave symbols alone, we only want to keep the font style for letters and numbers. +(bIsSymbol && aStr=="CharFontName") ); } uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( ) @@ -217,13 +221,10 @@ uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( ) uno::Sequence< beans::PropertyValue > vPropVals = PropertyMap::GetPropertyValues(); beans::PropertyValue* aValIter = vPropVals.begin(); beans::PropertyValue* aEndIter = vPropVals.end(); +const bool bIsSymbol(m_sBulletChar.getLength() <= 1); for( ; aValIter != aEndIter; ++aValIter ) -{ -if (IgnoreForCharStyle(aValIter->Name)) -continue; -else if ( aValIter->Name != "CharInteropGrabBag" && aValIter->Name != "ParaInteropGrabBag" ) +if (! IgnoreForCharStyle(aValIter->Name, bIsSymbol)) rProperties.emplace_back(aValIter->Name, 0, aValIter->Value, beans::PropertyState_DIRECT_VALUE); -} return comphelper::containerToSequence(rProperties); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 + 3 files changed, 17 insertions(+) New commits: commit e4b8fc7563087e82a659f6b697a986b53e51876c Author: Szabolcs Toth AuthorDate: Tue Dec 17 16:06:30 2019 +0100 Commit: Xisco Faulí CommitDate: Wed Jan 8 14:43:54 2020 +0100 tdf#129450 DOCX import: fix bottom border of 1-row tables Bottom border was missing in a 1-row table with disabled inside borders. This happened because LO applied the empty horizontal borders to the bottom border of the table. Change-Id: I40140bf63297189edad13088f98fc5f869969c2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85303 Reviewed-by: László Németh Tested-by: László Németh (cherry picked from commit 6b1bd2699b0bdad6dc42db741dea0717cf7c1d36) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86397 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx new file mode 100644 index ..df00bfe04421 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 8e7a7149292e..4511509e69cd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1036,6 +1036,18 @@ DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testBottomBorder, "tdf129450_BottomBorder.docx") +{ +// tdf#129450: Missing bottom border in one row table. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// If there is no bottom border, it is shown in tcBorders. +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 21472dc0eddf..b3bd18de4931 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -835,6 +835,11 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl { rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } +// Do not apply horizontal borders to a one row table. +else if (m_aCellProperties.size() == 1 && aRowOfCellsIterator->size() > 1) +{ +rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); +} lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx| 11 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 + 3 files changed, 16 insertions(+) New commits: commit 327de796b8a44028b2d49387a977663c88f59956 Author: Szabolcs Toth AuthorDate: Tue Dec 17 14:54:39 2019 +0100 Commit: Xisco Faulí CommitDate: Wed Jan 8 10:12:58 2020 +0100 tdf#129442 DOCX import: fix right border of 1-column tables Right border was missing in a 1-column table with disabled inside borders. This happened because LO applied the empty vertical borders to the right border of the table. Change-Id: Ib190689bf5059bfd7dbf07b07808cd761015f37e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85301 Reviewed-by: László Németh Tested-by: László Németh (cherry picked from commit 8a2eb40abbd52d960dd21308157186be0ca9dd3d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86261 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx new file mode 100644 index ..57ad24b61435 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 251ef426c58f..8e7a7149292e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1024,6 +1024,17 @@ DECLARE_OOXMLEXPORT_TEST(testInsideBorders, "tdf129242_InsideBorders.docx") assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders", 0); } +DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx") +{ +// tdf#129442: Right border of a one column table was missing. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// If the right border is missing like in the bug, then there is a tag in tcBorders. +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 'nil']", 0); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 0f675839e176..21472dc0eddf 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -830,6 +830,11 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } +// Do not apply vertical borders to a one column table. +else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) +{ +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +} lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 13 + writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 17 ++--- 3 files changed, 27 insertions(+), 3 deletions(-) New commits: commit 0f4dd820ee433932d9d9237b676292d31c4ba913 Author: Szabolcs Toth AuthorDate: Mon Dec 30 10:09:34 2019 +0100 Commit: László Németh CommitDate: Tue Jan 7 16:55:38 2020 +0100 tdf#129452 DOCX import: fix bottom border of merged column Bottom border of a vertically merged column of a table was missing if the inside borders were turned off and the merge included the last cell of the column. This happened because the first cell (topmost) in a set of vertically merged cells determines the borders of the new merged cell, and the turned off inside borders were at the bottom in this case. Change-Id: I3d3defad18a1315117a554a36ad599eb46daffe9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85988 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx new file mode 100644 index ..0e8ddd6d3833 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 41aa0b7d1ac8..48257077f0c3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1057,6 +1057,19 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorder, "tdf129450_BottomBorder.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") +{ +// tdf#129452: Do not omit bottom borders when a column in a table is vertically merged and +// the inside borders are turned off. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 9f376b3c07e8..31ce6b21d2c9 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -98,7 +98,7 @@ static void lcl_mergeBorder( PropertyIds nId, const PropertyMapPtr& pOrig, const } static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const PropertyMapPtr& pCellProps, -sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow ) +sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow, bool bMergedVertically ) { o3tl::optional pVerticalVal = pCellProps->getProperty(META_PROP_VERTICAL_BORDER); o3tl::optional pHorizontalVal = pCellProps->getProperty(META_PROP_HORIZONTAL_BORDER); @@ -157,10 +157,13 @@ static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const P if ( nRow == 0 ) { lcl_mergeBorder( PROP_TOP_BORDER, pTableBorders, pCellProps ); -if ( pHorizontalVal ) +if ( pHorizontalVal && !bMergedVertically ) pCellProps->Insert( PROP_BOTTOM_BORDER, aHorizProp, false ); } +if ( bMergedVertically ) +lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps ); + if ( bIsEndRow ) { lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps ); @@ -864,7 +867,15 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); } -lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); +// tdf#129452 Checking if current cell is vertically merged with all the other cells below to the bottom. +// This must be done in order to apply the bottom border of the table to the first cell in a vertical merge. +bool bMergedVertically = bool(m_aCellProperties[nRow][nCell]->getProperty(PROP_VERTICAL_MERGE)); + +for (size_t i = nRow + 1; bMergedVertically && i < m_aCellProperties.size(); i++) +if ( m_aCellProperties[i].size() > sal::static_int_cast(nCell) ) +bMergedVertically = bool(m_aCellProperties[i][nCell]->getProperty(PROP_VERTICAL_MERGE)); + +
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 + 3 files changed, 17 insertions(+) New commits: commit 6b1bd2699b0bdad6dc42db741dea0717cf7c1d36 Author: Szabolcs Toth AuthorDate: Tue Dec 17 16:06:30 2019 +0100 Commit: László Németh CommitDate: Mon Jan 6 12:18:58 2020 +0100 tdf#129450 DOCX import: fix bottom border of 1-row tables Bottom border was missing in a 1-row table with disabled inside borders. This happened because LO applied the empty horizontal borders to the bottom border of the table. Change-Id: I40140bf63297189edad13088f98fc5f869969c2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85303 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx new file mode 100644 index ..df00bfe04421 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index d9982a3e3da7..41aa0b7d1ac8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1045,6 +1045,18 @@ DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx") assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 'nil']", 0); } +DECLARE_OOXMLEXPORT_TEST(testBottomBorder, "tdf129450_BottomBorder.docx") +{ +// tdf#129450: Missing bottom border in one row table. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// If there is no bottom border, it is shown in tcBorders. +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index fc23c724dde2..77bf9e3f901a 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -832,6 +832,11 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl { rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } +// Do not apply horizontal borders to a one row table. +else if (m_aCellProperties.size() == 1 && aRowOfCellsIterator->size() > 1) +{ +rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); +} lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx| 11 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 + 3 files changed, 16 insertions(+) New commits: commit 8a2eb40abbd52d960dd21308157186be0ca9dd3d Author: Szabolcs Toth AuthorDate: Tue Dec 17 14:54:39 2019 +0100 Commit: László Németh CommitDate: Mon Jan 6 11:32:12 2020 +0100 tdf#129442 DOCX import: fix right border of 1-column tables Right border was missing in a 1-column table with disabled inside borders. This happened because LO applied the empty vertical borders to the right border of the table. Change-Id: Ib190689bf5059bfd7dbf07b07808cd761015f37e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85301 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx new file mode 100644 index ..57ad24b61435 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 22f898cec49b..d9982a3e3da7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1033,6 +1033,17 @@ DECLARE_OOXMLEXPORT_TEST(testInsideBorders, "tdf129242_InsideBorders.docx") assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders", 0); } +DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx") +{ +// tdf#129442: Right border of a one column table was missing. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// If the right border is missing like in the bug, then there is a tag in tcBorders. +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 'nil']", 0); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 5ab5a76825f5..fc23c724dde2 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -827,6 +827,11 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } +// Do not apply vertical borders to a one column table. +else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) +{ +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +} lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 13 + writerfilter/source/dmapper/DomainMapperTableHandler.cxx |2 +- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit 39e138902d05fbb00fda8003908c851d2f3ecb00 Author: Szabolcs Toth AuthorDate: Sat Dec 7 08:57:32 2019 +0100 Commit: Xisco Faulí CommitDate: Tue Dec 17 11:29:49 2019 +0100 tdf#129242 Regression fixed for one cell table borders Had to check an additional criteria before removing inside borders. Change-Id: I0828d973bd331e65ebabc1fe2e2f25f1bcaf58b0 Reviewed-on: https://gerrit.libreoffice.org/84676 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit dff3ae42d94fdf97c856c4a4d1e66234604927f4) Reviewed-on: https://gerrit.libreoffice.org/85199 Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx new file mode 100644 index ..58045c971c82 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index c78ecb5aff38..251ef426c58f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1012,6 +1012,19 @@ DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableB assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 1); } +DECLARE_OOXMLEXPORT_TEST(testInsideBorders, "tdf129242_InsideBorders.docx") +{ +// tdf#129242: Don't remove inside borders if the table has more than one cells. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// If this is not 0, then inside borders are removed. +assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders", 0); +} + + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index d6be09fbd4e4..b8923e734bee 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -824,7 +824,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl #endif // Do not apply horizontal and vertical borders to a one cell table. -if (m_aCellProperties.size() <= 1) +if (m_aCellProperties.size() <= 1 && aRowOfCellsIterator->size() <= 1) { rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 13 + writerfilter/source/dmapper/DomainMapperTableHandler.cxx |2 +- 3 files changed, 14 insertions(+), 1 deletion(-) New commits: commit dff3ae42d94fdf97c856c4a4d1e66234604927f4 Author: Szabolcs Toth AuthorDate: Sat Dec 7 08:57:32 2019 +0100 Commit: László Németh CommitDate: Mon Dec 16 09:12:38 2019 +0100 tdf#129242 Regression fixed for one cell table borders Had to check an additional criteria before removing inside borders. Change-Id: I0828d973bd331e65ebabc1fe2e2f25f1bcaf58b0 Reviewed-on: https://gerrit.libreoffice.org/84676 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx new file mode 100644 index ..58045c971c82 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index b11f3f0d45e5..22f898cec49b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1021,6 +1021,19 @@ DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableB assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 1); } +DECLARE_OOXMLEXPORT_TEST(testInsideBorders, "tdf129242_InsideBorders.docx") +{ +// tdf#129242: Don't remove inside borders if the table has more than one cells. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; + +// If this is not 0, then inside borders are removed. +assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders", 0); +} + + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index fb596a983204..db063663c326 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -821,7 +821,7 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl #endif // Do not apply horizontal and vertical borders to a one cell table. -if (m_aCellProperties.size() <= 1) +if (m_aCellProperties.size() <= 1 && aRowOfCellsIterator->size() <= 1) { rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 11 ++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx|7 ++ 3 files changed, 18 insertions(+) New commits: commit 6aca6d4ba87fec450065b205eff09654ae420d01 Author: Szabolcs Toth AuthorDate: Thu Nov 14 13:32:00 2019 +0100 Commit: Xisco Faulí CommitDate: Wed Nov 20 23:50:51 2019 +0100 tdf#124399 DOCX import: don't apply inside borders to 1-cell tables Extra cell borders appeared on the bottom, top, left or right of the 1-cell tables when only the "inside borders" option was selected. The extra borders were the ones that would normally have appeared as inside borders if there were more than one cells in the table. Change-Id: I05d5f2a5a0168989f220d20a95b6dacf5152f9f7 Reviewed-on: https://gerrit.libreoffice.org/82675 Reviewed-by: László Németh Tested-by: László Németh (cherry picked from commit 8a59f18b6eb22c43ec10cdc29ba5a13d5feba4f0) Reviewed-on: https://gerrit.libreoffice.org/83303 Tested-by: Jenkins Reviewed-by: Xisco Faulí diff --git a/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx new file mode 100755 index ..edb93b76e1df Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index ec87951cdeec..c78ecb5aff38 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1001,6 +1001,17 @@ DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula. assertXPathContent(pXmlDoc, "//w:tbl/w:tr/w:tc[2]/w:p/m:oMath/m:sSubSup/m:e/m:r/m:t", u"\u03C3"); } +DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableBorders.docx") +{ +// tdf#124399: Extra borders on single cell tables fixed. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top[@w:val = 'nil']", 1); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index d80f4b36518d..10eb60471126 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -820,6 +820,13 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl TagLogger::getInstance().attribute("row", nRow); #endif +// Do not apply horizontal and vertical borders to a one cell table. +if (m_aCellProperties.size() <= 1) +{ +rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +} + lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); //now set the default left+right border distance TODO: there's an sprm containing the default distance! ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 11 ++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx|7 ++ 3 files changed, 18 insertions(+) New commits: commit 8a59f18b6eb22c43ec10cdc29ba5a13d5feba4f0 Author: Szabolcs Toth AuthorDate: Thu Nov 14 13:32:00 2019 +0100 Commit: László Németh CommitDate: Wed Nov 20 13:16:57 2019 +0100 tdf#124399 DOCX import: don't apply inside borders to 1-cell tables Extra cell borders appeared on the bottom, top, left or right of the 1-cell tables when only the "inside borders" option was selected. The extra borders were the ones that would normally have appeared as inside borders if there were more than one cells in the table. Change-Id: I05d5f2a5a0168989f220d20a95b6dacf5152f9f7 Reviewed-on: https://gerrit.libreoffice.org/82675 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx new file mode 100755 index ..edb93b76e1df Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index ec87951cdeec..c78ecb5aff38 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1001,6 +1001,17 @@ DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula. assertXPathContent(pXmlDoc, "//w:tbl/w:tr/w:tc[2]/w:p/m:oMath/m:sSubSup/m:e/m:r/m:t", u"\u03C3"); } +DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableBorders.docx") +{ +// tdf#124399: Extra borders on single cell tables fixed. + +xmlDocPtr pXmlDocument = parseExport("word/document.xml"); +if (!pXmlDocument) +return; +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top[@w:val = 'nil']", 1); +assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 3996df51d8e4..d6be09fbd4e4 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -823,6 +823,13 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl TagLogger::getInstance().attribute("row", nRow); #endif +// Do not apply horizontal and vertical borders to a one cell table. +if (m_aCellProperties.size() <= 1) +{ +rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); +rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); +} + lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); //now set the default left+right border distance TODO: there's an sprm containing the default distance! ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx |binary sw/qa/extras/ooxmlexport/ooxmlw14export.cxx|8 sw/source/filter/ww8/docxattributeoutput.cxx |5 - 3 files changed, 12 insertions(+), 1 deletion(-) New commits: commit d0a7ed1052d0affe067e534b72a61461ca7058f1 Author: Szabolcs Toth AuthorDate: Thu Oct 10 13:22:11 2019 +0200 Commit: László Németh CommitDate: Wed Oct 16 18:19:13 2019 +0200 tdf#112103 DOCX cleanup: don't export redundant table bkground color "auto" because this is the default value of table cells. Change-Id: I4f45f32f24474f4d9c6bbc91fcd62cb66f008e5d Reviewed-on: https://gerrit.libreoffice.org/80601 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx b/sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx new file mode 100644 index ..cee8756ec3b8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx index d6f13dfc55a7..f6939083c456 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx @@ -642,6 +642,14 @@ DECLARE_OOXMLEXPORT_TEST(Test_TextEffects_InStyleXml, "TextEffects_InStyle.docx" } } +DECLARE_OOXMLEXPORT_TEST(Test_no_tag_if_no_fill, "tdf112103_tablebgnofill.docx") +{ +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) +return; + +assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:shd", 0); +} CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e7468c1c8d6d..866cc7f0c863 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4083,9 +4083,12 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_ if ( sOriginalColor != sColor ) { // color changed by the user, or no grab bag: write sColor -m_pSerializer->singleElementNS( XML_w, XML_shd, +if ( sColor != "auto" ) +{ +m_pSerializer->singleElementNS( XML_w, XML_shd, FSNS( XML_w, XML_fill ), sColor, FSNS( XML_w, XML_val ), "clear" ); +} } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/CommentTextHAlign.ods |binary sc/qa/unit/subsequent_export-test.cxx | 19 +++ sc/source/filter/oox/commentsbuffer.cxx | 16 sc/source/filter/xcl97/xcl97rec.cxx | 17 + 4 files changed, 52 insertions(+) New commits: commit 10c85f825f1fb5989490ec731fdba036c0b8e247 Author: Szabolcs Toth AuthorDate: Tue Oct 8 11:21:50 2019 +0200 Commit: László Németh CommitDate: Tue Oct 8 20:56:46 2019 +0200 tdf#123339 XLSX: fix horizontal alignment in comments Import and export of VML element TextHAlign weren't supported by Calc, losing horizontal aligment of the comments assigned to the spreadsheet cells. Change-Id: I41766d3004dd07ab34a2619e28532281366bf235 Reviewed-on: https://gerrit.libreoffice.org/79963 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/CommentTextHAlign.ods b/sc/qa/unit/data/ods/CommentTextHAlign.ods new file mode 100644 index ..2132779cb76a Binary files /dev/null and b/sc/qa/unit/data/ods/CommentTextHAlign.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index eaadde60f558..4c53441de68a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -223,6 +223,7 @@ public: void testTdf126024XLSX(); void testTdf126177XLSX(); void testCommentTextVAlignment(); +void testCommentTextHAlignment(); void testXltxExport(); @@ -351,6 +352,7 @@ public: CPPUNIT_TEST(testTdf126024XLSX); CPPUNIT_TEST(testTdf126177XLSX); CPPUNIT_TEST(testCommentTextVAlignment); +CPPUNIT_TEST(testCommentTextHAlignment); CPPUNIT_TEST(testXltxExport); @@ -4504,6 +4506,23 @@ void ScExportTest::testCommentTextVAlignment() assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextVAlign", "Center"); } +void ScExportTest::testCommentTextHAlignment() +{ +// Testing comment text alignments. +ScDocShellRef xShell = loadDoc("CommentTextHAlign.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +const xmlDocPtr pVmlDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); +CPPUNIT_ASSERT(pVmlDrawing); + +assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextHAlign", "Center"); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 00045842c9fd..c3c60c3f5a6d 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -77,6 +77,21 @@ static sal_Int32 lcl_ToVertAlign( sal_Int32 nAlign ) } } +static sal_Int16 lcl_ToParaAlign(sal_Int32 nAlign) +{ +switch ( nAlign ) +{ +case XML_Left: +return sal_Int16(css::style::ParagraphAdjust_LEFT); +case XML_Right: +return sal_Int16(css::style::ParagraphAdjust_RIGHT); +case XML_Center: +return sal_Int16(css::style::ParagraphAdjust_CENTER); +default: +return sal_Int16(css::style::ParagraphAdjust_BLOCK); +} +} + CommentModel::CommentModel() : mnAuthorId(-1) , mbAutoFill(false) @@ -171,6 +186,7 @@ void Comment::finalizeImport() // Setting comment text alignment const ::oox::vml::ClientData* xClientData = pNoteShape->getClientData(); aCommentPr.setProperty(PROP_TextVerticalAdjust, lcl_ToVertAlign(xClientData->mnTextVAlign)); +aCommentPr.setProperty(PROP_ParaAdjust, lcl_ToParaAlign(xClientData->mnTextHAlign)); } xAnno->setIsVisible( bVisible ); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index f750fdb9ad6c..3384e305185e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -624,6 +624,21 @@ sal_Int32 VmlCommentExporter::StartShape() return nId; } +static const char* lcl_GetHorizAlignFromItemSetChar(const SfxItemSet& rItemSet) +{ +switch (rItemSet.Get(EE_PARA_JUST).GetAdjust()) +{ +case SvxAdjust::Center: +return "Center"; +case SvxAdjust::Right: +return "Right"; +case SvxAdjust::Block: +return "Justify"; +default: +return "Left"; +} +} + static const char* lcl_GetVertAlignFromItemSetChar( const SfxItemSet& rItemSet ) { switch( rItemSet.Get( SDRATTR_TEXT_VERTADJUST ).GetValue() ) @@ -650,6 +665,7 @@ void VmlCommentExporter::EndShape( sal_Int32 nShapeElement ) // Getting comment text alignments const char* pVertAlign = lcl_GetVertAlignFromItemSetChar(mpCaption->GetMergedItemSet()); +const char* pHorizAlign =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/CommentTextVAlign.ods |binary sc/qa/unit/subsequent_export-test.cxx | 18 ++ sc/source/filter/oox/commentsbuffer.cxx |7 +++ sc/source/filter/xcl97/xcl97rec.cxx | 21 + 4 files changed, 46 insertions(+) New commits: commit 89c0b79911c469518c8872a4ec06b3d2c61c357c Author: Szabolcs Toth AuthorDate: Wed Sep 11 13:49:56 2019 +0200 Commit: László Németh CommitDate: Fri Oct 4 07:36:27 2019 +0200 tdf#123341 XLSX: fix vertical alignment in comments Import and export of VML element TextVAlign weren't supported by Calc, losing vertical aligment of the comments assigned to the spreadsheet cells. Change-Id: Ice70d3c65021902991ae869b6c60e30e4cdef8c3 Reviewed-on: https://gerrit.libreoffice.org/78816 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/CommentTextVAlign.ods b/sc/qa/unit/data/ods/CommentTextVAlign.ods new file mode 100755 index ..a1cac792cbac Binary files /dev/null and b/sc/qa/unit/data/ods/CommentTextVAlign.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 30cb91116875..eaadde60f558 100755 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -222,6 +222,7 @@ public: void testTdf79972XLSX(); void testTdf126024XLSX(); void testTdf126177XLSX(); +void testCommentTextVAlignment(); void testXltxExport(); @@ -349,6 +350,7 @@ public: CPPUNIT_TEST(testTdf79972XLSX); CPPUNIT_TEST(testTdf126024XLSX); CPPUNIT_TEST(testTdf126177XLSX); +CPPUNIT_TEST(testCommentTextVAlignment); CPPUNIT_TEST(testXltxExport); @@ -4486,6 +4488,22 @@ void ScExportTest::testTdf126177XLSX() assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External"); } +void ScExportTest::testCommentTextVAlignment() +{ +// Testing comment text alignments. +ScDocShellRef xShell = loadDoc("CommentTextVAlign.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +const xmlDocPtr pVmlDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); +CPPUNIT_ASSERT(pVmlDrawing); + +assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextVAlign", "Center"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx old mode 100644 new mode 100755 index aab70b07ae73..00045842c9fd --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -64,10 +64,13 @@ static sal_Int32 lcl_ToVertAlign( sal_Int32 nAlign ) switch( nAlign ) { case XML_top: +case XML_Top: return SDRTEXTVERTADJUST_TOP; case XML_center: +case XML_Center: return SDRTEXTVERTADJUST_CENTER; case XML_bottom: +case XML_Bottom: return SDRTEXTVERTADJUST_BOTTOM; default: return SDRTEXTVERTADJUST_BLOCK; @@ -164,6 +167,10 @@ void Comment::finalizeImport() pNoteShape->convertFormatting( xAnnoShape ); // visibility bVisible = pNoteShape->getTypeModel().mbVisible; + +// Setting comment text alignment +const ::oox::vml::ClientData* xClientData = pNoteShape->getClientData(); +aCommentPr.setProperty(PROP_TextVerticalAdjust, lcl_ToVertAlign(xClientData->mnTextVAlign)); } xAnno->setIsVisible( bVisible ); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx old mode 100644 new mode 100755 index e2b8593c88f0..f750fdb9ad6c --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -624,6 +624,22 @@ sal_Int32 VmlCommentExporter::StartShape() return nId; } +static const char* lcl_GetVertAlignFromItemSetChar( const SfxItemSet& rItemSet ) +{ +switch( rItemSet.Get( SDRATTR_TEXT_VERTADJUST ).GetValue() ) +{ +case SDRTEXTVERTADJUST_CENTER: +return "Center"; +case SDRTEXTVERTADJUST_BOTTOM: +return "Bottom"; +case SDRTEXTVERTADJUST_BLOCK: +return "Justify"; +case SDRTEXTVERTADJUST_TOP: +default: +return "Top"; +} +} + void VmlCommentExporter::EndShape( sal_Int32 nShapeElement ) { char pAnchor[100]; @@ -632,11 +648,15 @@ void VmlCommentExporter::EndShape( sal_Int32 nShapeElement ) maFrom.Left(), maFrom.Top(), maFrom.Right(), maFrom.Bottom(), maTo.Left(), maTo.Top(), maTo.Right(), maTo.Bottom() ); +// Getting comment text alignments +const char* pVertAlign = lcl_GetVertAlignFromItemSetChar(mpCaption->GetMergedItemSet()); +
[Libreoffice-commits] core.git: sc/qa
sc/qa/unit/subsequent_export-test.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1ab80992b8b9445e4cfad7f5b772bbef5a4b3c7b Author: Szabolcs Toth AuthorDate: Wed Sep 25 11:47:08 2019 +0200 Commit: László Németh CommitDate: Fri Oct 4 07:35:36 2019 +0200 CppunitTest_sc_subsequent_export_test: correct link to namespace x This fix makes it possible to use assertXPath on VmlDrawing elements. Change-Id: I6feae279933f18209cda8193f73dec25acee3c71 Reviewed-on: https://gerrit.libreoffice.org/79520 Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx old mode 100644 new mode 100755 index d4cee605170d..30cb91116875 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -381,7 +381,7 @@ void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) { BAD_CAST("draw"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0") }, { BAD_CAST("xlink"), BAD_CAST("http://www.w3c.org/1999/xlink;) }, { BAD_CAST("xdr"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing;) }, -{ BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main;) }, +{ BAD_CAST("xx"), BAD_CAST("urn:schemas-microsoft-com:office:excel") }, { BAD_CAST("r"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships;) }, { BAD_CAST("number"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0") }, { BAD_CAST("loext"), BAD_CAST("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0") }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: compilerplugins/clang include/sfx2 include/vcl sfx2/Library_sfx.mk sfx2/sdi sfx2/source solenv/clang-format vcl/inc vcl/Library_vclplug_gen.mk vcl/osx vcl/source vcl/un
compilerplugins/clang/badstatics.cxx|3 compilerplugins/clang/unusedenumconstants.writeonly.results |2 include/sfx2/sfxsids.hrc|1 include/vcl/svapp.hxx | 42 - sfx2/Library_sfx.mk |1 sfx2/sdi/appslots.sdi |5 sfx2/sdi/sfx.sdi| 19 sfx2/source/appl/app.cxx|3 sfx2/source/appl/appdata.cxx|2 sfx2/source/appl/appserv.cxx| 26 sfx2/source/appl/imestatuswindow.cxx| 229 -- sfx2/source/appl/imestatuswindow.hxx| 119 --- sfx2/source/inc/appdata.hxx |3 solenv/clang-format/blacklist |5 vcl/Library_vclplug_gen.mk |1 vcl/inc/pch/precompiled_vcl.hxx |1 vcl/inc/salimestatus.hxx| 39 - vcl/inc/salinst.hxx |4 vcl/inc/svdata.hxx | 15 vcl/inc/unx/gtk/gtkinst.hxx |3 vcl/inc/unx/i18n_ic.hxx |4 vcl/inc/unx/i18n_status.hxx | 89 -- vcl/inc/unx/salinst.h |1 vcl/osx/salinst.cxx |1 vcl/source/app/salvtables.cxx | 10 vcl/source/app/svapp.cxx| 29 vcl/source/app/svdata.cxx |1 vcl/source/app/svmain.cxx |4 vcl/unx/generic/app/i18n_cb.cxx |2 vcl/unx/generic/app/i18n_ic.cxx | 23 vcl/unx/generic/app/i18n_im.cxx |2 vcl/unx/generic/app/i18n_status.cxx | 439 vcl/unx/generic/window/salframe.cxx | 52 - vcl/unx/gtk/gtkinst.cxx | 11 vcl/win/app/salinst.cxx |1 35 files changed, 13 insertions(+), 1179 deletions(-) New commits: commit 5bfa8b8d5e1cf3cb572dbd91bf3b0cfcf29fb65a Author: Szabolcs Toth AuthorDate: Mon Aug 12 10:58:40 2019 +0200 Commit: László Németh CommitDate: Wed Sep 4 09:12:32 2019 +0200 tdf#118314 Code clean up on imestatuswindow Change-Id: I8bc5a73a91f28fcfd22ef716e9cf87d53997b1ad Reviewed-on: https://gerrit.libreoffice.org/77337 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl Reviewed-by: László Németh diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index 1c099a14236a..5f1edea78476 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -159,8 +159,7 @@ public: && pVarDecl->isThisDeclarationADefinition()) { auto const name(pVarDecl->getName()); -if ( name == "g_pI18NStatusInstance" // I18NStatus::free() -|| name == "s_pPreviousView" // not an owning pointer +if ( name == "s_pPreviousView" // not an owning pointer || name == "s_pDefCollapsed" // SvImpLBox::~SvImpLBox() || name == "s_pDefExpanded" // SvImpLBox::~SvImpLBox() || name == "g_pDDSource" // SvTreeListBox::dispose() diff --git a/compilerplugins/clang/unusedenumconstants.writeonly.results b/compilerplugins/clang/unusedenumconstants.writeonly.results index e1a9019589bc..38d6a1783e53 100644 --- a/compilerplugins/clang/unusedenumconstants.writeonly.results +++ b/compilerplugins/clang/unusedenumconstants.writeonly.results @@ -10414,8 +10414,6 @@ vcl/inc/salframe.hxx:72 enum SalFrameStyleFlags NOSHADOW vcl/inc/salptype.hxx:32 enum JobSetFlags ALL -vcl/inc/svdata.hxx:134 -enum ImplSVAppData::ImeStatusWindowMode ImeStatusWindowMode_UNKNOWN vcl/inc/unx/desktops.hxx:29 enum DesktopType DESKTOP_UNKNOWN vcl/inc/unx/i18n_cb.hxx:67 diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 1dcc40fc8ee4..80c92e1cdc2a 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -211,7 +211,6 @@ class SvxSearchItem; #define SID_INTERACTIONHANDLER (SID_SFX_START + 1675) #define SID_OPENHYPERLINK (SID_SFX_START + 1676) #define SID_CONTENT (SID_SFX_START + 1679) -#define SID_SHOW_IME_STATUS_WINDOW (SID_SFX_START + 1680) #define SID_VIEWONLY(SID_SFX_START + 1682) #define SID_REPAIRPACKAGE (SID_SFX_START +
[Libreoffice-commits] core.git: include/svx
include/svx/svxcommands.h | 28 1 file changed, 28 deletions(-) New commits: commit 24f609b51243b052f38930fbc902c4a95f0e94a0 Author: Szabolcs Toth AuthorDate: Thu Aug 8 14:45:15 2019 +0200 Commit: László Németh CommitDate: Fri Aug 9 15:37:53 2019 +0200 tdf#126722 Deleted svxcommands.h Change-Id: Ife8296ba74ad0f3016f65e69a488b9166d86e07b Reviewed-on: https://gerrit.libreoffice.org/77150 Reviewed-by: László Németh Tested-by: László Németh diff --git a/include/svx/svxcommands.h b/include/svx/svxcommands.h deleted file mode 100644 index e04bf84e2aec.. --- a/include/svx/svxcommands.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVX_SVXCOMMANDS_H -#define INCLUDED_SVX_SVXCOMMANDS_H - -#define CMD_SID_GALLERY_ENABLE_ADDCOPY ".uno:GalleryEnableAddCopy" -#define CMD_SID_GALLERY_FORMATS ".uno:InsertGalleryPic" -#define CMD_SID_GALLERY_BG_BRUSH".uno:BackgroundImage" - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: solenv/clang-format svx/inc svx/source
solenv/clang-format/blacklist|1 - svx/inc/helpids.h|2 -- svx/source/gallery2/galbrws2.cxx | 14 ++ 3 files changed, 6 insertions(+), 11 deletions(-) New commits: commit 5349e558cf60c6d124fc9a5a4aa41578a3903088 Author: Szabolcs Toth AuthorDate: Thu Aug 8 10:44:09 2019 +0200 Commit: Samuel Mehrbrodt CommitDate: Thu Aug 8 12:46:15 2019 +0200 tdf#126722 Deleted svxcommands.h file and replaced defines by their values Change-Id: I9347add59fcd7c8c4bbd08f6190405ad39131046 Reviewed-on: https://gerrit.libreoffice.org/77143 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 87e8df93f646..810cb3c121dc 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -7347,7 +7347,6 @@ include/svx/svdview.hxx include/svx/svdviter.hxx include/svx/svdxcgv.hxx include/svx/svx3ditems.hxx -include/svx/svxcommands.h include/svx/svxdlg.hxx include/svx/svxdllapi.h include/svx/svxerr.hxx diff --git a/svx/inc/helpids.h b/svx/inc/helpids.h index c3eead8872ff..c6693c822cea 100644 --- a/svx/inc/helpids.h +++ b/svx/inc/helpids.h @@ -19,8 +19,6 @@ #ifndef INCLUDED_SVX_INC_HELPIDS_H #define INCLUDED_SVX_INC_HELPIDS_H -#include - #define HID_BMPMASK_CTL_QCOL_1 "SVX_HID_BMPMASK_CTL_QCOL_1" #define HID_COLOR_CTL_COLORS "SVX_HID_COLOR_CTL_COLORS" #define HID_CTRL3D_HSCROLL "SVX_HID_CTRL3D_HSCROLL" diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index f35d4b5c535c..92734278eb85 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -48,8 +48,6 @@ #include #include #include - -#include #include #include #include @@ -157,15 +155,15 @@ GalleryThemePopup::GalleryThemePopup( // SID_GALLERY_ENABLE_ADDCOPY m_aCommandInfo.emplace( SID_GALLERY_ENABLE_ADDCOPY, -CommandInfo( CMD_SID_GALLERY_ENABLE_ADDCOPY )); +CommandInfo( ".uno:GalleryEnableAddCopy" )); // SID_GALLERY_BG_BRUSH m_aCommandInfo.emplace( SID_GALLERY_BG_BRUSH, -CommandInfo( CMD_SID_GALLERY_BG_BRUSH )); +CommandInfo( ".uno:BackgroundImage" )); // SID_GALLERY_FORMATS m_aCommandInfo.emplace( SID_GALLERY_FORMATS, -CommandInfo( CMD_SID_GALLERY_FORMATS )); +CommandInfo( ".uno:InsertGalleryPic" )); } @@ -173,14 +171,14 @@ void SAL_CALL GalleryThemePopup::statusChanged( const css::frame::FeatureStateEvent ) { const OUString = rEvent.FeatureURL.Complete; -if ( rURL == CMD_SID_GALLERY_ENABLE_ADDCOPY ) +if ( rURL == ".uno:GalleryEnableAddCopy" ) { if ( !rEvent.IsEnabled ) { mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("add"), false); } } -else if ( rURL == CMD_SID_GALLERY_BG_BRUSH ) +else if ( rURL == ".uno:BackgroundImage" ) { mpBackgroundPopup->Clear(); if ( rEvent.IsEnabled ) @@ -1017,7 +1015,7 @@ void GalleryBrowser2::DispatchAdd( if ( !xDispatchProvider.is() || !m_xTransformer.is() ) return; -aURL.Complete = CMD_SID_GALLERY_FORMATS; +aURL.Complete = ".uno:InsertGalleryPic"; m_xTransformer->parseStrict( aURL ); xDispatch = xDispatchProvider->queryDispatch( aURL, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/svx
include/svx/svxcommands.h | 111 -- 1 file changed, 111 deletions(-) New commits: commit 5bb6c1bdef28de0e30326b13161f681e1d58a032 Author: Szabolcs Toth AuthorDate: Wed Aug 7 12:21:09 2019 +0200 Commit: Samuel Mehrbrodt CommitDate: Wed Aug 7 14:04:38 2019 +0200 tdf#126722 All unnecessary defines are removed. Change-Id: I00f4f8c5b767a34563a0274ebcd37870ea9b346c Reviewed-on: https://gerrit.libreoffice.org/77094 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/include/svx/svxcommands.h b/include/svx/svxcommands.h index 0c1a6ffabf41..e04bf84e2aec 100644 --- a/include/svx/svxcommands.h +++ b/include/svx/svxcommands.h @@ -19,120 +19,9 @@ #ifndef INCLUDED_SVX_SVXCOMMANDS_H #define INCLUDED_SVX_SVXCOMMANDS_H -#define CMD_SID_OBJECT_ALIGN_CENTER ".uno:AlignCenter" -#define CMD_SID_OBJECT_ALIGN_DOWN ".uno:AlignDown" -#define CMD_SID_OBJECT_ALIGN_LEFT ".uno:ObjectAlignLeft" -#define CMD_SID_OBJECT_ALIGN_MIDDLE ".uno:AlignMiddle" -#define CMD_SID_OBJECT_ALIGN_RIGHT ".uno:ObjectAlignRight" -#define CMD_SID_OBJECT_ALIGN_UP ".uno:AlignUp" -#define CMD_SID_FM_AUTOCONTROLFOCUS ".uno:AutoControlFocus" -#define CMD_SID_BEZIER_CLOSE".uno:BezierClose" -#define CMD_SID_BEZIER_CONVERT ".uno:BezierConvert" -#define CMD_SID_BEZIER_CUTLINE ".uno:BezierCutLine" -#define CMD_SID_BEZIER_DELETE ".uno:BezierDelete" -#define CMD_SID_BEZIER_EDGE ".uno:BezierEdge" -#define CMD_SID_BEZIER_ELIMINATE_POINTS ".uno:BezierEliminatePoints" -#define CMD_SID_BEZIER_INSERT ".uno:BezierInsert" -#define CMD_SID_BEZIER_MOVE ".uno:BezierMove" -#define CMD_SID_BEZIER_SMOOTH ".uno:BezierSmooth" -#define CMD_SID_BEZIER_SYMMTR ".uno:BezierSymmetric" -#define CMD_SID_ATTR_CHAR_WEIGHT".uno:Bold" -#define CMD_SID_FRAME_TO_TOP".uno:BringToFront" -#define CMD_SID_ATTR_PARA_ADJUST_CENTER ".uno:CenterPara" -#define CMD_SID_FM_CHANGECONTROLTYPE".uno:ChangeControlType" -#define CMD_SID_ATTR_CHAR_FONT ".uno:CharFontName" -#define CMD_SID_FM_CHECKBOX ".uno:CheckBox" -#define CMD_SID_FM_COMBOBOX ".uno:ComboBox" -#define CMD_SID_FM_CONVERTTO_BUTTON ".uno:ConvertToButton" -#define CMD_SID_FM_CONVERTTO_CHECKBOX ".uno:ConvertToCheckBox" -#define CMD_SID_FM_CONVERTTO_COMBOBOX ".uno:ConvertToCombo" -#define CMD_SID_FM_CONVERTTO_CURRENCY ".uno:ConvertToCurrency" -#define CMD_SID_FM_CONVERTTO_DATE ".uno:ConvertToDate" -#define CMD_SID_FM_CONVERTTO_EDIT ".uno:ConvertToEdit" -#define CMD_SID_FM_CONVERTTO_FILECONTROL".uno:ConvertToFileControl" -#define CMD_SID_FM_CONVERTTO_FIXEDTEXT ".uno:ConvertToFixed" -#define CMD_SID_FM_CONVERTTO_FORMATTED ".uno:ConvertToFormatted" -#define CMD_SID_FM_CONVERTTO_SCROLLBAR ".uno:ConvertToScrollBar" -#define CMD_SID_FM_CONVERTTO_SPINBUTTON ".uno:ConvertToSpinButton" -#define CMD_SID_FM_CONVERTTO_GROUPBOX ".uno:ConvertToGroup" -#define CMD_SID_FM_CONVERTTO_IMAGEBUTTON".uno:ConvertToImageBtn" -#define CMD_SID_FM_CONVERTTO_IMAGECONTROL ".uno:ConvertToImageControl" -#define CMD_SID_FM_CONVERTTO_LISTBOX".uno:ConvertToList" -#define CMD_SID_FM_CONVERTTO_NUMERIC".uno:ConvertToNumeric" -#define CMD_SID_FM_CONVERTTO_PATTERN".uno:ConvertToPattern" -#define CMD_SID_FM_CONVERTTO_RADIOBUTTON".uno:ConvertToRadio" -#define CMD_SID_FM_CONVERTTO_TIME ".uno:ConvertToTime" -#define CMD_SID_FM_CONVERTTO_NAVIGATIONBAR ".uno:ConvertToNavigationBar" -#define CMD_SID_FM_CURRENCYFIELD".uno:CurrencyField" -#define CMD_SID_FM_DATEFIELD".uno:DateField" -#define CMD_SID_DISTRIBUTE_DLG ".uno:DistributeSelection" -#define CMD_SID_FM_EDIT ".uno:Edit" -#define CMD_SID_ENTER_GROUP ".uno:EnterGroup" -#define CMD_SID_CHAR_DLG".uno:FontDialog" -#define CMD_SID_ATTR_CHAR_FONTHEIGHT".uno:FontHeight" -#define CMD_SID_FONTWORK".uno:FontWork" -#define CMD_SID_ATTRIBUTES_AREA ".uno:FormatArea" -#define CMD_SID_GROUP ".uno:FormatGroup" -#define CMD_SID_ATTRIBUTES_LINE ".uno:FormatLine" -#define CMD_SID_FM_FORMATTEDFIELD ".uno:FormattedField" -#define CMD_SID_UNGROUP