[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/qa sc/source

2023-08-01 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc2.cxx|   26 ++
 sc/source/core/tool/refupdat.cxx |7 +--
 2 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 04098a535bf25494379678b9539c4987cb33431f
Author: Tünde Tóth 
AuthorDate: Tue Jul 18 15:20:47 2023 +0200
Commit: László Németh 
CommitDate: Tue Aug 1 12:16:11 2023 +0200

tdf#156174 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: If641af42a44cadbb8485bfa5b9a8eca5a757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154582
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155041

diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index 3be123de219d..1ec77ad7ad37 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1419,6 +1419,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577)
 CPPUNIT_ASSERT(!pDBs->empty());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+insertNewSheet(*pDoc);
+
+insertStringToCell("A1", u"1");
+insertStringToCell("A2", u"2");
+insertStringToCell("B1", u"3");
+insertStringToCell("B2", u"4");
+
+ScDBData* pDBData = new ScDBData("testDB", 1, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(3)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index ef0902aab3f4..e05a14d0137f 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -286,12 +286,7 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* 
pDoc, UpdateRefMode eUpdat
 bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz ));
 bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab );
 bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab );
-if ( theTab2 < theTab1 )
-{
-eRet = UR_INVALID;
-theTab2 = theTab1;
-}
-else if ( bCut1 || bCut2 )
+if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )
 {


[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-25 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc2.cxx|   26 ++
 sc/source/core/tool/refupdat.cxx |7 +--
 2 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a
Author: Tünde Tóth 
AuthorDate: Tue Jul 18 15:20:47 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 15:04:01 2023 +0200

tdf#156174 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: If641af42a44cadbb8485bfa5b9a8eca5a757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154582
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index 44ebf12935bc..4e154f8bbb83 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1446,6 +1446,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796)
 CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+insertNewSheet(*pDoc);
+
+insertStringToCell("A1", u"1");
+insertStringToCell("A2", u"2");
+insertStringToCell("B1", u"3");
+insertStringToCell("B2", u"4");
+
+ScDBData* pDBData = new ScDBData("testDB", 1, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(3)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index ef0902aab3f4..e05a14d0137f 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -286,12 +286,7 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* 
pDoc, UpdateRefMode eUpdat
 bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz ));
 bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab );
 bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab );
-if ( theTab2 < theTab1 )
-{
-eRet = UR_INVALID;
-theTab2 = theTab1;
-}
-else if ( bCut1 || bCut2 )
+if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - oox/source sw/qa

2023-06-30 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx|5 -
 sw/qa/extras/ooxmlexport/data/tdf155903.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx  |6 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 4b323aebda7fcafbcb3e37101f0b0dc882fb824b
Author: Tünde Tóth 
AuthorDate: Mon Jun 26 15:01:26 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 30 13:34:02 2023 +0200

tdf155903 DOCX export: fix corrupt file with embedded media

Regression from commit bc72514f90d90e1ab3fed8167663e835edf03508
"tdf#53970 PPTX: fix export of embedded media files".

Change-Id: I04521227346817d91f720b1f6a77beb7f4a01f83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153619
Tested-by: László Németh 
Reviewed-by: László Németh 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153793

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index b93dd01b69fb..0fc6eb337513 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1272,7 +1272,10 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 xShapeProps->getPropertyValue("Graphic") >>= xGraphic;
 }
 
-bool bHasMediaURL = xShapeProps.is() && 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL") && 
(xShapeProps->getPropertyValue("MediaURL") >>= sMediaURL);
+// tdf#155903 Only for PPTX, Microsoft does not support this feature in 
Word and Excel.
+bool bHasMediaURL = GetDocumentType() == DOCUMENT_PPTX && xShapeProps.is()
+&& 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL")
+&& (xShapeProps->getPropertyValue("MediaURL") >>= 
sMediaURL);
 
 if (!xGraphic.is() && !bHasMediaURL)
 {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf155903.odt 
b/sw/qa/extras/ooxmlexport/data/tdf155903.odt
new file mode 100644
index ..97ba58d892dd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf155903.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index fbb87915369e..c8dca64723a1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -850,6 +850,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135786, "tdf135786.docx")
 CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
+{
+// Without the accompanying fix in place, this test would have crashed,
+// because the exported file was corrupted.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: oox/source sw/qa

2023-06-28 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx|5 -
 sw/qa/extras/ooxmlexport/data/tdf155903.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx  |6 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 863a32171ed8efdf1aaee59918e49613e7ccd7a9
Author: Tünde Tóth 
AuthorDate: Mon Jun 26 15:01:26 2023 +0200
Commit: László Németh 
CommitDate: Wed Jun 28 13:38:22 2023 +0200

tdf155903 DOCX export: fix corrupt file with embedded media

Regression from commit bc72514f90d90e1ab3fed8167663e835edf03508
"tdf#53970 PPTX: fix export of embedded media files".

Change-Id: I04521227346817d91f720b1f6a77beb7f4a01f83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153619
Tested-by: László Németh 
Reviewed-by: László Németh 
Tested-by: Jenkins

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index dceb4ee706f8..efde8de56f72 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1272,7 +1272,10 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 xShapeProps->getPropertyValue("Graphic") >>= xGraphic;
 }
 
-bool bHasMediaURL = xShapeProps.is() && 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL") && 
(xShapeProps->getPropertyValue("MediaURL") >>= sMediaURL);
+// tdf#155903 Only for PPTX, Microsoft does not support this feature in 
Word and Excel.
+bool bHasMediaURL = GetDocumentType() == DOCUMENT_PPTX && xShapeProps.is()
+&& 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL")
+&& (xShapeProps->getPropertyValue("MediaURL") >>= 
sMediaURL);
 
 if (!xGraphic.is() && !bHasMediaURL)
 {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf155903.odt 
b/sw/qa/extras/ooxmlexport/data/tdf155903.odt
new file mode 100644
index ..97ba58d892dd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf155903.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 9183863c8af7..4d1136f24c42 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -864,6 +864,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf155736, 
"tdf155736_PageNumbers_footer.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("Page * of *"), 
parseDump("/root/page[2]/footer/txt/text()"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
+{
+// Without the accompanying fix in place, this test would have crashed,
+// because the exported file was corrupted.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source

2023-06-20 Thread Tünde Tóth (via logerrit)
 oox/source/export/chartexport.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e980ee9d4a77937a42766edf61b2989d11aac149
Author: Tünde Tóth 
AuthorDate: Thu Jun 1 15:25:45 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 20 14:55:03 2023 +0200

tdf#145651 Chart OOXML export: fix write error in exportSolidFill

Don't export the background color, if the FillColor property is empty.

Steps to reproduce:

1. E.g. in Impress, insert a chart (Insert > Chart...).

2. In chart editing mode, select the legend, use the "sidebar > Area >
Fill" and change from "none" to "color". Notice how the default blue
that is used does not correspond to the colour in the colour picker
right underneath.

3. Save as > OOXML format.

Change-Id: I33a060d8fc6c49708029008393e2e22e3d5335b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152951
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 6b3e29536ca770d7c2c42429390785c326d223ae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/15
Tested-by: Jenkins

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b60e84590ae9..e814e0de92e7 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1896,9 +1896,9 @@ void ChartExport::exportSolidFill(const Reference< 
XPropertySet >& xPropSet)
 // Similar to DrawingML::WriteSolidFill, but gradient access via name
 // and currently no InteropGrabBag
 // get fill color
-if (!GetProperty( xPropSet, "FillColor" ))
+sal_uInt32 nFillColor = 0;
+if (!GetProperty(xPropSet, "FillColor") || !(mAny >>= nFillColor))
 return;
-sal_uInt32 nFillColor = mAny.get();
 
 sal_Int32 nAlpha = MAX_PERCENT;
 if (GetProperty( xPropSet, "FillTransparence" ))


[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - oox/source

2023-06-20 Thread Tünde Tóth (via logerrit)
 oox/source/export/chartexport.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bb1e68c72e2c95855bde54cd9eb592d0bd3dc4c6
Author: Tünde Tóth 
AuthorDate: Thu Jun 1 15:25:45 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 20 14:49:30 2023 +0200

tdf#145651 Chart OOXML export: fix write error in exportSolidFill

Don't export the background color, if the FillColor property is empty.

Steps to reproduce:

1. E.g. in Impress, insert a chart (Insert > Chart...).

2. In chart editing mode, select the legend, use the "sidebar > Area >
Fill" and change from "none" to "color". Notice how the default blue
that is used does not correspond to the colour in the colour picker
right underneath.

3. Save as > OOXML format.

Change-Id: I33a060d8fc6c49708029008393e2e22e3d5335b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152951
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 5a4f32ebc037964b7d00a468bc7761e078baeecc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153332
Tested-by: Jenkins

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 29f25b82b944..f0a301f79136 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1889,9 +1889,9 @@ void ChartExport::exportSolidFill(const Reference< 
XPropertySet >& xPropSet)
 // Similar to DrawingML::WriteSolidFill, but gradient access via name
 // and currently no InteropGrabBag
 // get fill color
-if (!GetProperty( xPropSet, "FillColor" ))
+sal_uInt32 nFillColor = 0;
+if (!GetProperty(xPropSet, "FillColor") || !(mAny >>= nFillColor))
 return;
-sal_uInt32 nFillColor = mAny.get();
 
 sal_Int32 nAlpha = MAX_PERCENT;
 if (GetProperty( xPropSet, "FillTransparence" ))


[Libreoffice-commits] core.git: oox/source

2023-06-20 Thread Tünde Tóth (via logerrit)
 oox/source/export/chartexport.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6b3e29536ca770d7c2c42429390785c326d223ae
Author: Tünde Tóth 
AuthorDate: Thu Jun 1 15:25:45 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 20 13:10:15 2023 +0200

tdf#145651 Chart OOXML export: fix write error in exportSolidFill

Don't export the background color, if the FillColor property is empty.

Steps to reproduce:

1. E.g. in Impress, insert a chart (Insert > Chart...).

2. In chart editing mode, select the legend, use the "sidebar > Area >
Fill" and change from "none" to "color". Notice how the default blue
that is used does not correspond to the colour in the colour picker
right underneath.

3. Save as > OOXML format.

Change-Id: I33a060d8fc6c49708029008393e2e22e3d5335b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152951
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 29f25b82b944..f0a301f79136 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1889,9 +1889,9 @@ void ChartExport::exportSolidFill(const Reference< 
XPropertySet >& xPropSet)
 // Similar to DrawingML::WriteSolidFill, but gradient access via name
 // and currently no InteropGrabBag
 // get fill color
-if (!GetProperty( xPropSet, "FillColor" ))
+sal_uInt32 nFillColor = 0;
+if (!GetProperty(xPropSet, "FillColor") || !(mAny >>= nFillColor))
 return;
-sal_uInt32 nFillColor = mAny.get();
 
 sal_Int32 nAlpha = MAX_PERCENT;
 if (GetProperty( xPropSet, "FillTransparence" ))


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - chart2/qa xmloff/source

2023-05-22 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export3.cxx|   27 +++
 chart2/qa/extras/data/ods/tdf148142.ods   |binary
 xmloff/source/chart/SchXMLAxisContext.cxx |1 +
 3 files changed, 28 insertions(+)

New commits:
commit 9d7d35718f32fd757f6ce994e6aab0c6f3494b3c
Author: Tünde Tóth 
AuthorDate: Wed May 17 13:49:29 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon May 22 13:01:50 2023 +0200

tdf#148142 chart: fix export of modified On/Between tick marks

Reset the MajorOrigin property after import to avoid
of the bad export of the modified document, which reset
the original On tick marks/Between tick marks value.

Follow-up to commit 40d83914d43f60a196dfabddea0b52e2046b333a
"tdf#127792 implement UNO chart attribute MajorOrigin".

Change-Id: I0e3915b7d1b601abd40fbd1ba9d01fc05a8fb7c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151885
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/+/152009
Tested-by: Jenkins

diff --git a/chart2/qa/extras/chart2export3.cxx 
b/chart2/qa/extras/chart2export3.cxx
index dd081f8e5b9b..243ea6e234ba 100644
--- a/chart2/qa/extras/chart2export3.cxx
+++ b/chart2/qa/extras/chart2export3.cxx
@@ -74,6 +74,7 @@ public:
 void testMultipleAxisXLSX();
 void testSecondaryAxisXLSX();
 void testBarChartSecondaryAxisXLSX();
+void testTdf148142();
 
 CPPUNIT_TEST_SUITE(Chart2ExportTest3);
 CPPUNIT_TEST(testTdf108107);
@@ -120,6 +121,7 @@ public:
 CPPUNIT_TEST(testMultipleAxisXLSX);
 CPPUNIT_TEST(testSecondaryAxisXLSX);
 CPPUNIT_TEST(testBarChartSecondaryAxisXLSX);
+CPPUNIT_TEST(testTdf148142);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -773,6 +775,31 @@ void Chart2ExportTest3::testBarChartSecondaryAxisXLSX()
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", 
"val", YValueIdOf2Barchart);
 }
 
+void Chart2ExportTest3::testTdf148142()
+{
+// The document contains a line chart with "Between tick marks" X axis 
position.
+loadFromURL(u"ods/tdf148142.ods");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis.is());
+chart2::ScaleData aScaleData = xAxis->getScaleData();
+CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
+
+// Set the X axis position to "On tick marks".
+aScaleData.ShiftedCategoryPosition = false;
+xAxis->setScaleData(aScaleData);
+
+// Check the X axis position after export.
+saveAndReload("calc8");
+Reference xChartDoc2 = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc2.is());
+Reference xAxis2 = getAxisFromDoc(xChartDoc2, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis2.is());
+chart2::ScaleData aScaleData2 = xAxis2->getScaleData();
+CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest3);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/ods/tdf148142.ods 
b/chart2/qa/extras/data/ods/tdf148142.ods
new file mode 100644
index ..9b736a06d19a
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf148142.ods differ
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx 
b/xmloff/source/chart/SchXMLAxisContext.cxx
index ad8b187f88e2..ae55da90f8b5 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -547,6 +547,7 @@ void SchXMLAxisContext::CreateAxis()
 {
 aScaleData.ShiftedCategoryPosition = 
rtl::math::approxEqual(fMajorOrigin, 0.5);
 xAxis->setScaleData(aScaleData);
+m_xAxisProps->setPropertyValue("MajorOrigin", uno::Any());
 }
 }
 


[Libreoffice-commits] core.git: chart2/qa xmloff/source

2023-05-19 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2export3.cxx|   25 +
 chart2/qa/extras/data/ods/tdf148142.ods   |binary
 xmloff/source/chart/SchXMLAxisContext.cxx |1 +
 3 files changed, 26 insertions(+)

New commits:
commit deb2512e5ea16ad8fa9f975569fbc5363cebf8dd
Author: Tünde Tóth 
AuthorDate: Wed May 17 13:49:29 2023 +0200
Commit: László Németh 
CommitDate: Fri May 19 13:09:26 2023 +0200

tdf#148142 chart: fix export of modified On/Between tick marks

Reset the MajorOrigin property after import to avoid
of the bad export of the modified document, which reset
the original On tick marks/Between tick marks value.

Follow-up to commit 40d83914d43f60a196dfabddea0b52e2046b333a
"tdf#127792 implement UNO chart attribute MajorOrigin".

Change-Id: I0e3915b7d1b601abd40fbd1ba9d01fc05a8fb7c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151885
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2export3.cxx 
b/chart2/qa/extras/chart2export3.cxx
index d22d5e51e545..845e6c98c6a6 100644
--- a/chart2/qa/extras/chart2export3.cxx
+++ b/chart2/qa/extras/chart2export3.cxx
@@ -716,6 +716,31 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, 
testBarChartSecondaryAxisXLSX)
 assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", 
"val", YValueIdOf2Barchart);
 }
 
+CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testTdf148142)
+{
+// The document contains a line chart with "Between tick marks" X axis 
position.
+loadFromURL(u"ods/tdf148142.ods");
+Reference xChartDoc = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc.is());
+Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis.is());
+chart2::ScaleData aScaleData = xAxis->getScaleData();
+CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
+
+// Set the X axis position to "On tick marks".
+aScaleData.ShiftedCategoryPosition = false;
+xAxis->setScaleData(aScaleData);
+
+// Check the X axis position after export.
+saveAndReload("calc8");
+Reference xChartDoc2 = getChartDocFromSheet(0, 
mxComponent);
+CPPUNIT_ASSERT(xChartDoc2.is());
+Reference xAxis2 = getAxisFromDoc(xChartDoc2, 0, 0, 0);
+CPPUNIT_ASSERT(xAxis2.is());
+chart2::ScaleData aScaleData2 = xAxis2->getScaleData();
+CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/qa/extras/data/ods/tdf148142.ods 
b/chart2/qa/extras/data/ods/tdf148142.ods
new file mode 100644
index ..9b736a06d19a
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf148142.ods differ
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx 
b/xmloff/source/chart/SchXMLAxisContext.cxx
index ad8b187f88e2..ae55da90f8b5 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -547,6 +547,7 @@ void SchXMLAxisContext::CreateAxis()
 {
 aScaleData.ShiftedCategoryPosition = 
rtl::math::approxEqual(fMajorOrigin, 0.5);
 xAxis->setScaleData(aScaleData);
+m_xAxisProps->setPropertyValue("MajorOrigin", uno::Any());
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-7' - sc/qa sc/source

2023-05-03 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc.cxx |   27 +++
 sc/source/core/tool/refupdat.cxx |2 --
 2 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 203ad95d0a7a0c8224ce58c0c3e90b417ae06de9
Author: Tünde Tóth 
AuthorDate: Wed Apr 26 15:31:46 2023 +0200
Commit: Christian Lohmaier 
CommitDate: Wed May 3 11:50:14 2023 +0200

tdf#152577 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: I04923decdc768770f98763e60cd295400d15c769
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151065
Tested-by: Jenkins
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/+/151121
(cherry picked from commit f56008e837fc966219cbf2279cb2bbbdb47fad5d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151122
Reviewed-by: Eike Rathke 
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 042be6d569be..ac3fa2888b32 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -3144,6 +3144,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, 
testUnallocatedColumnsAttributes)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152577)
+{
+mxComponent = loadFromDesktop("private:factory/scalc");
+ScModelObj* pModelObj = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pModelObj);
+ScDocument* pDoc = pModelObj->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+
+insertStringToCell(*pModelObj, "A1", "1");
+insertStringToCell(*pModelObj, "A2", "2");
+insertStringToCell(*pModelObj, "B1", "3");
+insertStringToCell(*pModelObj, "B2", "4");
+
+ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(2)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 3fce7c714423..ef0902aab3f4 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -291,8 +291,6 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, 
UpdateRefMode eUpdat
 eRet = UR_INVALID;
 theTab2 = theTab1;
 }
-else if (bCut2 && theTab2 == 0)
-eRet = UR_INVALID;
 else if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/qa sc/source

2023-04-28 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc.cxx |   27 +++
 sc/source/core/tool/refupdat.cxx |2 --
 2 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit d9650695d30bcd1a885636984881603ed64ad6df
Author: Tünde Tóth 
AuthorDate: Wed Apr 26 15:31:46 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 28 15:05:31 2023 +0200

tdf#152577 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: I04923decdc768770f98763e60cd295400d15c769
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151065
Tested-by: Jenkins
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/+/151121

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 042be6d569be..ac3fa2888b32 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -3144,6 +3144,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, 
testUnallocatedColumnsAttributes)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152577)
+{
+mxComponent = loadFromDesktop("private:factory/scalc");
+ScModelObj* pModelObj = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pModelObj);
+ScDocument* pDoc = pModelObj->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+
+insertStringToCell(*pModelObj, "A1", "1");
+insertStringToCell(*pModelObj, "A2", "2");
+insertStringToCell(*pModelObj, "B1", "3");
+insertStringToCell(*pModelObj, "B2", "4");
+
+ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(2)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 3fce7c714423..ef0902aab3f4 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -291,8 +291,6 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, 
UpdateRefMode eUpdat
 eRet = UR_INVALID;
 theTab2 = theTab1;
 }
-else if (bCut2 && theTab2 == 0)
-eRet = UR_INVALID;
 else if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/qa sc/source

2023-04-28 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc.cxx |   24 
 sc/source/core/tool/refupdat.cxx |2 --
 2 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 3f778cbad0b3f00a09a9b2fbd60762c81eab1b41
Author: Tünde Tóth 
AuthorDate: Wed Apr 26 15:31:46 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 28 11:42:36 2023 +0200

tdf#152577 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: I04923decdc768770f98763e60cd295400d15c769
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151065
Tested-by: Jenkins
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/+/151159

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 25b4d0790383..19aa8a703943 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -3013,6 +3013,30 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, 
testUnallocatedColumnsAttributes)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152577)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+insertStringToCell("A1", u"1");
+insertStringToCell("A2", u"2");
+insertStringToCell("B1", u"3");
+insertStringToCell("B2", u"4");
+
+ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(2)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 3fce7c714423..ef0902aab3f4 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -291,8 +291,6 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, 
UpdateRefMode eUpdat
 eRet = UR_INVALID;
 theTab2 = theTab1;
 }
-else if (bCut2 && theTab2 == 0)
-eRet = UR_INVALID;
 else if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )


[Libreoffice-commits] core.git: sc/qa sc/source

2023-04-27 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc2.cxx|   24 
 sc/source/core/tool/refupdat.cxx |2 --
 2 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit b88d11ba05085002cf847d4828ded52a3dfb3b09
Author: Tünde Tóth 
AuthorDate: Wed Apr 26 15:31:46 2023 +0200
Commit: László Németh 
CommitDate: Thu Apr 27 18:58:32 2023 +0200

tdf#152577 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: I04923decdc768770f98763e60cd295400d15c769
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151065
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index a09c9b8e20e9..69db567f305c 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1395,6 +1395,30 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testAutoSum)
 CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B207:D207)"), pDoc->GetFormula(4, 206, 
0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+insertStringToCell("A1", u"1");
+insertStringToCell("A2", u"2");
+insertStringToCell("B1", u"3");
+insertStringToCell("B2", u"4");
+
+ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(2)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 3fce7c714423..ef0902aab3f4 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -291,8 +291,6 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, 
UpdateRefMode eUpdat
 eRet = UR_INVALID;
 theTab2 = theTab1;
 }
-else if (bCut2 && theTab2 == 0)
-eRet = UR_INVALID;
 else if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source sc/qa

2023-04-26 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx|3 ++-
 sc/qa/unit/data/xlsx/tdf91332.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx |   21 +
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit eba5256cba797c67e13d8fc99cb213d6113fcb6a
Author: Tünde Tóth 
AuthorDate: Wed Apr 19 14:48:33 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Apr 26 11:59:06 2023 +0200

tdf#91332 XLSX export: fix missing solidFill

Background color of shape inherited from theme
lost after export.

Regression from commit bc0a9076aa43a0782bcf81e55d3f84f6af0f68e8
"ooxml: Preserve shape theme attribute for solid fill".

Change-Id: I2d8298ac17332ba3ad6a627ce8b07c23087ac7b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150674
Tested-by: Jenkins
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/+/151038

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 86b9b5ac91dc..4af853619967 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -574,7 +574,8 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xff), 
nAlpha);
 }
 }
-else if ( !sColorFillScheme.isEmpty() )
+// tdf#91332 LO doesn't export the actual theme.xml in XLSX.
+else if ( !sColorFillScheme.isEmpty() && GetDocumentType() != 
DOCUMENT_XLSX )
 {
 // the shape had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations, nAlpha );
diff --git a/sc/qa/unit/data/xlsx/tdf91332.xlsx 
b/sc/qa/unit/data/xlsx/tdf91332.xlsx
new file mode 100644
index ..5f1d119e8ee7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf91332.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index f97dc4b643d3..32f557463ed3 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -185,6 +185,7 @@ public:
 void testTdf130104_XLSXIndent();
 void testWholeRowBold();
 void testXlsxRowsOrder();
+void testTdf91332();
 void testTdf91286();
 void testTdf148820();
 void testEmbeddedTextInDecimal();
@@ -315,6 +316,7 @@ public:
 CPPUNIT_TEST(testTdf130104_XLSXIndent);
 CPPUNIT_TEST(testWholeRowBold);
 CPPUNIT_TEST(testXlsxRowsOrder);
+CPPUNIT_TEST(testTdf91332);
 CPPUNIT_TEST(testTdf91286);
 CPPUNIT_TEST(testTdf148820);
 CPPUNIT_TEST(testEmbeddedTextInDecimal);
@@ -2814,6 +2816,25 @@ void ScExportTest2::testXlsxRowsOrder()
 save("Calc Office Open XML");
 }
 
+void ScExportTest2::testTdf91332()
+{
+createScDoc("xlsx/tdf91332.xlsx");
+saveAndReload("Calc Office Open XML");
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+uno::Reference xShapeProps(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: rgba[90cf47ff]
+// - Actual  : rgba[]
+// i.e. fill color inherited from theme lost after export.
+Color nColor;
+xShapeProps->getPropertyValue("FillColor") >>= nColor;
+CPPUNIT_ASSERT_EQUAL(Color(0x90cf47), nColor);
+}
+
 void ScExportTest2::testTdf91286()
 {
 createScDoc("ods/tdf91286.ods");


[Libreoffice-commits] core.git: oox/source sc/qa

2023-04-25 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx|3 ++-
 sc/qa/unit/data/xlsx/tdf91332.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx |   19 +++
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 2ef83c8782ed947b47f9292a12355fc3bb078078
Author: Tünde Tóth 
AuthorDate: Wed Apr 19 14:48:33 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 25 15:04:09 2023 +0200

tdf#91332 XLSX export: fix missing solidFill

Background color of shape inherited from theme
lost after export.

Regression from commit bc0a9076aa43a0782bcf81e55d3f84f6af0f68e8
"ooxml: Preserve shape theme attribute for solid fill".

Change-Id: I2d8298ac17332ba3ad6a627ce8b07c23087ac7b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150674
Tested-by: Jenkins
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 60a5cdd62d7e..77c4c1b02186 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -530,7 +530,8 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xff), 
nAlpha);
 }
 }
-else if ( !sColorFillScheme.isEmpty() )
+// tdf#91332 LO doesn't export the actual theme.xml in XLSX.
+else if ( !sColorFillScheme.isEmpty() && GetDocumentType() != 
DOCUMENT_XLSX )
 {
 // the shape had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations, nAlpha );
diff --git a/sc/qa/unit/data/xlsx/tdf91332.xlsx 
b/sc/qa/unit/data/xlsx/tdf91332.xlsx
new file mode 100644
index ..5f1d119e8ee7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf91332.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 7a9579f3dfa0..403bffc3112f 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1224,6 +1224,25 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX)
 assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", 
"TargetMode", "External");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332)
+{
+createScDoc("xlsx/tdf91332.xlsx");
+saveAndReload("Calc Office Open XML");
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+uno::Reference xShapeProps(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: rgba[90cf47ff]
+// - Actual  : rgba[]
+// i.e. fill color inherited from theme lost after export.
+Color nColor;
+xShapeProps->getPropertyValue("FillColor") >>= nColor;
+CPPUNIT_ASSERT_EQUAL(Color(0x90cf47), nColor);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: oox/source sc/qa

2023-04-25 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx|7 +--
 sc/qa/unit/data/xlsx/tdf119565.xlsx|binary
 sc/qa/unit/subsequent_export_test4.cxx |   26 ++
 3 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 5ee52d401e2086f79f794a4ec1a1d7beec8aa582
Author: Tünde Tóth 
AuthorDate: Tue Apr 18 12:01:18 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 25 14:52:02 2023 +0200

tdf#119565 XLSX export: fix lost line properties inherited from theme

Line properties (LineWidth and LineJoint) of shape
inherited from theme lost after export.

Perhaps regression from commit 5391d4872e71d1edba7acc4ad2d2e3b5b97e1723
"ooxml: Preserve shape style and theme attributes for line".

Change-Id: I9977bb20f16245f3c95ccbe2c5c8033b5b0c9cc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150547
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 aaad66b4d083..60a5cdd62d7e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1263,7 +1263,8 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 mpFS->startElementNS( XML_a, XML_ln,
   XML_cap, cap,
   XML_w, 
sax_fastparser::UseIf(OString::number(nEmuLineWidth),
-  nLineWidth == 0 || (nLineWidth > 1 && 
nStyleLineWidth != nLineWidth)) );
+  nLineWidth == 0 || GetDocumentType() == 
DOCUMENT_XLSX// tdf#119565 LO doesn't export the actual theme.xml in XLSX.
+  || (nLineWidth > 1 && nStyleLineWidth != 
nLineWidth)));
 
 if( bColorSet )
 {
@@ -1431,7 +1432,9 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 {
 LineJoint eLineJoint = mAny.get();
 
-if( aStyleLineJoint == LineJoint_NONE || aStyleLineJoint != eLineJoint 
)
+// tdf#119565 LO doesn't export the actual theme.xml in XLSX.
+if (aStyleLineJoint == LineJoint_NONE || GetDocumentType() == 
DOCUMENT_XLSX
+|| aStyleLineJoint != eLineJoint)
 {
 // style-defined line joint does not exist, or is different from 
the shape's joint
 switch( eLineJoint )
diff --git a/sc/qa/unit/data/xlsx/tdf119565.xlsx 
b/sc/qa/unit/data/xlsx/tdf119565.xlsx
new file mode 100644
index ..de530c0131f2
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf119565.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 8cb9a73a5f4e..79b5441c8f17 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1612,6 +1613,31 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf119565)
+{
+createScDoc("xlsx/tdf119565.xlsx");
+saveAndReload("Calc Office Open XML");
+
+uno::Reference xDoc(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+uno::Reference xShapeProps(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 35
+// - Actual  : 0
+// i.e. line width inherited from theme lost after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(35),
+ 
xShapeProps->getPropertyValue("LineWidth").get());
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 3
+// - Actual  : 4
+// i.e. line joint inherited from theme lost after export.
+CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_MITER,
+ 
xShapeProps->getPropertyValue("LineJoint").get());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - include/oox oox/source sw/qa sw/source

2023-04-18 Thread Tünde Tóth (via logerrit)
 include/oox/core/xmlfilterbase.hxx   |4 
 oox/source/export/shapes.cxx |   23 +++
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   11 +++
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   10 --
 sw/source/filter/ww8/docxattributeoutput.cxx |6 ++
 5 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit f323e6de3dc1e2658142644a3357cbd5459da4f6
Author: Tünde Tóth 
AuthorDate: Wed Mar 29 15:09:11 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Apr 18 11:56:22 2023 +0200

tdf#154469 DOCX export: fix hyperlink in group shape

Hyperlink inserted to shape lost after export,
if the shape was inside a group shape.

Follow-up to commit 7f4f88b883f81fbce975f72aea0f66a54e269ead
"tdf#145147 DOCX import: fix hyperlink in group shape".

Change-Id: I48b582c04b6f779cb5393179f65a32d7a7eca5ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149716
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 7460e4f4a7b15cc7984adf65bc17e3d580413224)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150507
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index 89a7994a904b..317c2a2cb789 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -221,6 +221,10 @@ public:
  */
 sal_Int32 GetUniqueId() { return mnMaxDocId++; }
 
+sal_Int32 GetMaxDocId() { return mnMaxDocId; }
+
+void SetMaxDocId(sal_Int32 maxDocId) { mnMaxDocId = maxDocId; }
+
 /** Write the document properties into into the current OPC package.
 
 @param xProperties  The document properties to export.
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index ec2ebd54d56c..a181f4d45db5 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -902,6 +902,29 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 else
 {
 pFS->startElementNS(mnXmlNamespace, XML_wsp);
+if (m_xParent.is())
+{
+pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id,
+OString::number(GetShapeID(xShape) == -1 ? 
GetNewShapeID(xShape)
+ : 
GetShapeID(xShape)),
+XML_name, GetShapeName(xShape));
+
+if (GetProperty(rXPropSet, "Hyperlink"))
+{
+OUString sURL;
+mAny >>= sURL;
+if (!sURL.isEmpty())
+{
+OUString sRelId = mpFB->addRelation(
+mpFS->getOutputStream(), 
oox::getRelationship(Relationship::HYPERLINK),
+mpURLTransformer->getTransformedString(sURL),
+mpURLTransformer->isExternalURL(sURL));
+
+mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), sRelId);
+}
+}
+pFS->endElementNS(mnXmlNamespace, XML_cNvPr);
+}
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
 }
 
diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
b/sw/qa/extras/ooxmlexport/data/grouped_link.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/grouped_link.docx
rename to sw/qa/extras/ooxmlexport/data/grouped_link.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 04ce5b8d452c..908d8db90e3e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -878,6 +878,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149996, 
"lorem_hyperlink.fodt")
 // because the exported file was corrupted.
 }
 
+DECLARE_OOXMLEXPORT_TEST(testGroupedShapeLink, "grouped_link.docx")
+{
+// tdf#145147 Hyperlink in grouped shape not imported
+// tdf#154469 Hyperlink in grouped shape not exported
+uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
+ getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org;),
+ getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 37f1a48ca834..a8e0c64c8712 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1132,16 +1132,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf145147)
-{
-createSwDoc("grouped_link.docx");
-uno::Reference 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-04-18 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf147810.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |6 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |   72 ++-
 sw/source/filter/ww8/docxattributeoutput.hxx |3 -
 4 files changed, 56 insertions(+), 25 deletions(-)

New commits:
commit 23cb5a95e057060a47facad19ad150134aa0692b
Author: Tünde Tóth 
AuthorDate: Tue Mar 28 09:17:17 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 18 11:04:03 2023 +0200

tdf#147810 DOCX export: fix corrupt file with hyperlink and text box

Remove m_startedHyperlink boolean, because the
m_nHyperLinkCount is more precise in nested paragraphs,
e.g. when exporting hyperlink combined with the export
of the paragraph of a text box attached to the paragraph
of the hyperlink, which caused corrupt DOCX file with data
loss.

Regression from commit 9835a5823e0f559aabbc0e15ea126c82229c4bc7
"sw textboxes: reimplement ODF import/export".

Change-Id: I94bcb64a756ba2c90360629640f667190fa45f3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149677
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf147810.odt 
b/sw/qa/extras/ooxmlexport/data/tdf147810.odt
new file mode 100644
index ..eb0d1a88466c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf147810.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 908d8db90e3e..4e8d2991d83b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -889,6 +889,12 @@ DECLARE_OOXMLEXPORT_TEST(testGroupedShapeLink, 
"grouped_link.docx")
  getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf147810, "tdf147810.odt")
+{
+// Without the accompanying fix in place, this test would have crashed,
+// because the exported file was corrupted.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 093ace109ddb..5590857f1c74 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -499,7 +499,7 @@ sal_Int32 
DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p
 
 m_bParagraphOpened = true;
 m_bIsFirstParagraph = false;
-m_nHyperLinkCount.push(0);
+m_nHyperLinkCount.push_back(0);
 
 return nParaId;
 }
@@ -1107,12 +1107,12 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 /* If m_nHyperLinkCount > 0 that means hyperlink tag is not yet closed.
  * This is due to nested hyperlink tags. So close it before end of 
paragraph.
  */
-if(m_nHyperLinkCount.top() > 0)
+if(m_nHyperLinkCount.back() > 0)
 {
-for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount.top(); ++nHyperLinkToClose)
+for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount.back(); ++nHyperLinkToClose)
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 }
-m_nHyperLinkCount.pop();
+m_nHyperLinkCount.pop_back();
 
 if (m_aRunSdt.m_bStartedSdt)
 {
@@ -1685,7 +1685,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 continue;
 }
 
-if (m_startedHyperlink || m_pHyperlinkAttrList.is())
+if (m_nHyperLinkCount.back() > 0 || m_pHyperlinkAttrList.is())
 {
 ++m_nFieldsInHyperlink;
 }
@@ -1716,7 +1716,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 
 if ( m_closeHyperlinkInPreviousRun )
 {
-if ( m_startedHyperlink )
+if (m_nHyperLinkCount.back() > 0)
 {
 for ( int i = 0; i < nFieldsInPrevHyperlink; i++ )
 {
@@ -1726,11 +1726,24 @@ void DocxAttributeOutput::EndRun(const SwTextNode* 
pNode, sal_Int32 nPos, sal_In
 m_Fields.pop_back();
 }
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
-m_startedHyperlink = false;
 m_endPageRef = false;
-m_nHyperLinkCount.top()--;
+m_nHyperLinkCount.back()--;
+m_closeHyperlinkInPreviousRun = false;
+}
+else
+{
+bool bIsStartedHyperlink = false;
+for (const sal_Int32 nLinkCount : m_nHyperLinkCount)
+{
+if (nLinkCount > 0)
+{
+bIsStartedHyperlink = true;
+break;
+}
+}
+if (!bIsStartedHyperlink)
+m_closeHyperlinkInPreviousRun = false;
 }
-

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2023-04-11 Thread Tünde Tóth (via logerrit)
 include/oox/core/xmlfilterbase.hxx   |4 
 oox/source/export/shapes.cxx |   23 +++
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   11 +++
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   10 --
 sw/source/filter/ww8/docxattributeoutput.cxx |6 ++
 5 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit 7460e4f4a7b15cc7984adf65bc17e3d580413224
Author: Tünde Tóth 
AuthorDate: Wed Mar 29 15:09:11 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 11 19:35:57 2023 +0200

tdf#154469 DOCX export: fix hyperlink in group shape

Hyperlink inserted to shape lost after export,
if the shape was inside a group shape.

Follow-up to commit 7f4f88b883f81fbce975f72aea0f66a54e269ead
"tdf#145147 DOCX import: fix hyperlink in group shape".

Change-Id: I48b582c04b6f779cb5393179f65a32d7a7eca5ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149716
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index 89a7994a904b..317c2a2cb789 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -221,6 +221,10 @@ public:
  */
 sal_Int32 GetUniqueId() { return mnMaxDocId++; }
 
+sal_Int32 GetMaxDocId() { return mnMaxDocId; }
+
+void SetMaxDocId(sal_Int32 maxDocId) { mnMaxDocId = maxDocId; }
+
 /** Write the document properties into into the current OPC package.
 
 @param xProperties  The document properties to export.
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index eab82a86336d..83d308ca793f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -902,6 +902,29 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 else
 {
 pFS->startElementNS(mnXmlNamespace, XML_wsp);
+if (m_xParent.is())
+{
+pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id,
+OString::number(GetShapeID(xShape) == -1 ? 
GetNewShapeID(xShape)
+ : 
GetShapeID(xShape)),
+XML_name, GetShapeName(xShape));
+
+if (GetProperty(rXPropSet, "Hyperlink"))
+{
+OUString sURL;
+mAny >>= sURL;
+if (!sURL.isEmpty())
+{
+OUString sRelId = mpFB->addRelation(
+mpFS->getOutputStream(), 
oox::getRelationship(Relationship::HYPERLINK),
+mpURLTransformer->getTransformedString(sURL),
+mpURLTransformer->isExternalURL(sURL));
+
+mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), sRelId);
+}
+}
+pFS->endElementNS(mnXmlNamespace, XML_cNvPr);
+}
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
 }
 
diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
b/sw/qa/extras/ooxmlexport/data/grouped_link.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/grouped_link.docx
rename to sw/qa/extras/ooxmlexport/data/grouped_link.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 04ce5b8d452c..908d8db90e3e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -878,6 +878,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149996, 
"lorem_hyperlink.fodt")
 // because the exported file was corrupted.
 }
 
+DECLARE_OOXMLEXPORT_TEST(testGroupedShapeLink, "grouped_link.docx")
+{
+// tdf#145147 Hyperlink in grouped shape not imported
+// tdf#154469 Hyperlink in grouped shape not exported
+uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
+ getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org;),
+ getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index bcd75b78ecf5..caaa4b6842de 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1144,16 +1144,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf145147)
-{
-createSwDoc("grouped_link.docx");
-uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
- getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
-

[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source sw/qa

2023-04-06 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/shape.cxx  |   12 
 sw/qa/extras/ooxmlimport/data/grouped_link.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx   |   10 ++
 3 files changed, 22 insertions(+)

New commits:
commit e17a67735ffe8e0feeef8daddf2667d3e432f6cd
Author: Tünde Tóth 
AuthorDate: Thu Mar 9 16:01:03 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 6 11:35:43 2023 +0200

tdf#145147 DOCX import: fix hyperlink in group shape

Hyperlink inserted to shape lost, if the shape was
inside a group shape.

Test: ungroup the grouped shape and move the mouse
over the shapes, or use Edit Hyperlink... in their
context menu.

Change-Id: I45d816f18a1e1bc1c442943b31c9e0ae7de199e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148552
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit b5a0fa42adf68b33970da93c2b04f935f72cffde)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149608
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fad591a93d04..4e4836fdf8b4 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -405,6 +405,18 @@ void Shape::addShape(
  ? 
*getTextBody()->getTextProperties().moInsets[3]
  : 0));
 }
+
+// tdf#145147 Set the Hyperlink property to the child wps 
shape.
+if (getShapeProperties().hasProperty(PROP_URL)) try
+{
+uno::Any aAny = getShapeProperties().getProperty(PROP_URL);
+OUString sUrl = aAny.get();
+if (!sUrl.isEmpty())
+
xChildWPSProperties->setPropertyValue(UNO_NAME_HYPERLINK, aAny);
+}
+catch (const Exception&)
+{
+}
 }
 
 if( meFrameType == FRAMETYPE_DIAGRAM )
diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
b/sw/qa/extras/ooxmlimport/data/grouped_link.docx
new file mode 100644
index ..8c5657b708b4
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 04d23a4c1bc0..532ad030b28d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1078,6 +1078,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154319)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf145147)
+{
+createSwDoc("grouped_link.docx");
+uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
+ getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org;),
+ getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: oox/source sw/qa

2023-03-27 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/shape.cxx  |   12 
 sw/qa/extras/ooxmlimport/data/grouped_link.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx   |   10 ++
 3 files changed, 22 insertions(+)

New commits:
commit 7f4f88b883f81fbce975f72aea0f66a54e269ead
Author: Tünde Tóth 
AuthorDate: Thu Mar 9 16:01:03 2023 +0100
Commit: László Németh 
CommitDate: Mon Mar 27 14:22:05 2023 +

tdf#145147 DOCX import: fix hyperlink in group shape

Hyperlink inserted to shape lost, if the shape was
inside a group shape.

Test: ungroup the grouped shape and move the mouse
over the shapes, or use Edit Hyperlink... in their
context menu.

Change-Id: I45d816f18a1e1bc1c442943b31c9e0ae7de199e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148552
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index b8cac0d8f385..e3923c1b647d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -406,6 +406,18 @@ void Shape::addShape(
  ? 
*getTextBody()->getTextProperties().moInsets[3]
  : 0));
 }
+
+// tdf#145147 Set the Hyperlink property to the child wps 
shape.
+if (getShapeProperties().hasProperty(PROP_URL)) try
+{
+uno::Any aAny = getShapeProperties().getProperty(PROP_URL);
+OUString sUrl = aAny.get();
+if (!sUrl.isEmpty())
+
xChildWPSProperties->setPropertyValue(UNO_NAME_HYPERLINK, aAny);
+}
+catch (const Exception&)
+{
+}
 }
 
 if( meFrameType == FRAMETYPE_DIAGRAM )
diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
b/sw/qa/extras/ooxmlimport/data/grouped_link.docx
new file mode 100644
index ..8c5657b708b4
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 6436d68ec89e..c201e585e997 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1092,6 +1092,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154319)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf145147)
+{
+createSwDoc("grouped_link.docx");
+uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org;),
+ getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org;),
+ getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/qa sw/source

2023-03-13 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt |   40 +
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |6 +++
 sw/source/filter/ww8/docxattributeoutput.cxx   |   21 +--
 sw/source/filter/ww8/docxattributeoutput.hxx   |2 -
 4 files changed, 58 insertions(+), 11 deletions(-)

New commits:
commit 619132f022b7a71938069d7c282aaf8b578287e5
Author: Tünde Tóth 
AuthorDate: Mon Mar 6 15:34:57 2023 +0100
Commit: Michael Stahl 
CommitDate: Mon Mar 13 10:23:48 2023 +

tdf#149996 DOCX export: fix hyperlinks in nested paragraphs

Close all hyperlinks in the paragraph where they start.

Regression from commit 20a3792502120d67b1a9fdea641e15ea504359d3
"fdo#76316 : File gets corrupt after Roundtrip".

Change-Id: Ied5be90601f5a494f927d43aa6ff7efd3545f993
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148353
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 05df784c6febd1d77e95db8ef3dfdc03347a48a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148617
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt 
b/sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt
new file mode 100644
index ..485f87f130da
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt
@@ -0,0 +1,40 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   Lorem 
+  1
+  
+ ipsum
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 4feae4b5d864..04ce5b8d452c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -872,6 +872,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf152310, 
"ColorOverwritten.docx")
  getProperty(getParagraphOfText(2, xShape), 
"CharColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf149996, "lorem_hyperlink.fodt")
+{
+// Without the accompanying fix in place, this test would have crashed,
+// because the exported file was corrupted.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index e8b73e338d8e..5bc2f7ba597f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -530,6 +530,7 @@ sal_Int32 
DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p
 
 m_bParagraphOpened = true;
 m_bIsFirstParagraph = false;
+m_nHyperLinkCount.push(0);
 
 return nParaId;
 }
@@ -1062,12 +1063,12 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 /* If m_nHyperLinkCount > 0 that means hyperlink tag is not yet closed.
  * This is due to nested hyperlink tags. So close it before end of 
paragraph.
  */
-if(m_nHyperLinkCount > 0)
+if(m_nHyperLinkCount.top() > 0)
 {
-for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount; ++nHyperLinkToClose)
+for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount.top(); ++nHyperLinkToClose)
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
-m_nHyperLinkCount = 0;
 }
+m_nHyperLinkCount.pop();
 
 if (m_aRunSdt.m_bStartedSdt)
 {
@@ -1658,7 +1659,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 m_startedHyperlink = false;
 m_endPageRef = false;
-m_nHyperLinkCount--;
+m_nHyperLinkCount.top()--;
 }
 m_closeHyperlinkInPreviousRun = false;
 }
@@ -1738,7 +1739,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 
 m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
 m_startedHyperlink = true;
-m_nHyperLinkCount++;
+m_nHyperLinkCount.top()++;
 }
 
 // if there is some redlining in the document, output it
@@ -1900,7 +1901,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 
 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-03-10 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt |   40 +
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |6 +++
 sw/source/filter/ww8/docxattributeoutput.cxx   |   21 +--
 sw/source/filter/ww8/docxattributeoutput.hxx   |2 -
 4 files changed, 58 insertions(+), 11 deletions(-)

New commits:
commit 05df784c6febd1d77e95db8ef3dfdc03347a48a3
Author: Tünde Tóth 
AuthorDate: Mon Mar 6 15:34:57 2023 +0100
Commit: László Németh 
CommitDate: Fri Mar 10 11:46:59 2023 +

tdf#149996 DOCX export: fix hyperlinks in nested paragraphs

Close all hyperlinks in the paragraph where they start.

Regression from commit 20a3792502120d67b1a9fdea641e15ea504359d3
"fdo#76316 : File gets corrupt after Roundtrip".

Change-Id: Ied5be90601f5a494f927d43aa6ff7efd3545f993
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148353
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt 
b/sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt
new file mode 100644
index ..485f87f130da
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/lorem_hyperlink.fodt
@@ -0,0 +1,40 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   Lorem 
+  1
+  
+ ipsum
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 4feae4b5d864..04ce5b8d452c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -872,6 +872,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf152310, 
"ColorOverwritten.docx")
  getProperty(getParagraphOfText(2, xShape), 
"CharColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf149996, "lorem_hyperlink.fodt")
+{
+// Without the accompanying fix in place, this test would have crashed,
+// because the exported file was corrupted.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 05efeafbd19b..1b1afa152e69 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -516,6 +516,7 @@ sal_Int32 
DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p
 
 m_bParagraphOpened = true;
 m_bIsFirstParagraph = false;
+m_nHyperLinkCount.push(0);
 
 return nParaId;
 }
@@ -1083,12 +1084,12 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 /* If m_nHyperLinkCount > 0 that means hyperlink tag is not yet closed.
  * This is due to nested hyperlink tags. So close it before end of 
paragraph.
  */
-if(m_nHyperLinkCount > 0)
+if(m_nHyperLinkCount.top() > 0)
 {
-for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount; ++nHyperLinkToClose)
+for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount.top(); ++nHyperLinkToClose)
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
-m_nHyperLinkCount = 0;
 }
+m_nHyperLinkCount.pop();
 
 if (m_aRunSdt.m_bStartedSdt)
 {
@@ -1688,7 +1689,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 m_startedHyperlink = false;
 m_endPageRef = false;
-m_nHyperLinkCount--;
+m_nHyperLinkCount.top()--;
 }
 m_closeHyperlinkInPreviousRun = false;
 }
@@ -1768,7 +1769,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 
 m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
 m_startedHyperlink = true;
-m_nHyperLinkCount++;
+m_nHyperLinkCount.top()++;
 }
 
 // if there is some redlining in the document, output it
@@ -1930,7 +1931,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 m_startedHyperlink = false;
-m_nHyperLinkCount--;
+m_nHyperLinkCount.top()--;
 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-03-09 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf148026.fodt |   14 ++
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx   |   12 
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 --
 3 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit ed77023797985e62e8f0af29326a61f55a65ae0a
Author: Tünde Tóth 
AuthorDate: Wed Mar 1 10:09:02 2023 +0100
Commit: László Németh 
CommitDate: Thu Mar 9 16:46:36 2023 +

tdf#148026 DOCX export: fix link with target frame and anchor

Hyperlink with target frame and anchor didn't work after export.

Change-Id: I84980e30d2e1d6d53cfe201cf4cac60354151aba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148041
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf148026.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf148026.fodt
new file mode 100644
index ..80d958a6943c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf148026.fodt
@@ -0,0 +1,14 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+  
+ 
+ 
+  
+   https://bugs.documentfoundation.org/a#b; 
office:target-frame-name="_self" xlink:show="replace" 
text:style-name="Internet_20_link" 
text:visited-style-name="Visited_20_Internet_20_Link">https://bugs.documentfoundation.org/a#b _self 
frame 
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 770ea9a89dec..b9432a32a47b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -579,6 +579,18 @@ CPPUNIT_TEST_FIXTURE(Test, 
testExportingUnknownStyleInRedline)
 
"/w:document/w:body/w:p/w:pPr/w:pPrChange/w:pPr/w:pStyle[@w:val='UnknownStyle']");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf148026)
+{
+loadAndReload("tdf148026.fodt");
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// - In <>, XPath '//w:hyperlink' number of nodes is incorrect
+// i.e. a HYPERLINK field was exported instead of the hyperlink XML 
element.
+assertXPath(pXmlDoc, "//w:hyperlink", "tgtFrame", "_self");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 45121566ec24..05efeafbd19b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3654,7 +3654,7 @@ bool DocxAttributeOutput::AnalyzeURL( const OUString& 
rUrl, const OUString& rTar
 {
 bool bBookMarkOnly = AttributeOutputBase::AnalyzeURL( rUrl, rTarget, 
pLinkURL, pMark );
 
-if ( !pMark->isEmpty() )
+if (!pMark->isEmpty() && (bBookMarkOnly || rTarget.isEmpty()))
 {
 OUString sURL = *pLinkURL;
 
@@ -3689,7 +3689,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, 
const OUString& rTarge
 
 m_hyperLinkAnchor = sMark;
 
-if ( !sMark.isEmpty() && !bBookmarkOnly )
+if (!sMark.isEmpty() && !bBookmarkOnly && rTarget.isEmpty())
 {
 m_rExport.OutputField( nullptr, ww::eHYPERLINK, sUrl );
 }
@@ -3705,6 +3705,12 @@ bool DocxAttributeOutput::StartURL( const OUString& 
rUrl, const OUString& rTarge
 sUrl, true ), RTL_TEXTENCODING_UTF8 );
 
 m_pHyperlinkAttrList->add(FSNS(XML_r, XML_id), sId);
+if (!sMark.isEmpty())
+{
+sMark = sMark.replace(' ', '_');
+m_pHyperlinkAttrList->add(FSNS(XML_w, XML_anchor),
+  OUStringToOString(sMark, 
RTL_TEXTENCODING_UTF8));
+}
 }
 else
 {


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox oox/source sc/qa sc/source sd/qa sd/source

2023-03-08 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx |8 +
 oox/source/export/drawingml.cxx  |  207 +--
 sc/qa/unit/data/ods/tdf91286.ods |binary
 sc/qa/unit/subsequent_export_test2.cxx   |   26 +++
 sc/source/filter/excel/xestream.cxx  |4 
 sd/qa/unit/data/odp/tdf74670.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   27 
 sd/source/filter/eppt/pptx-epptooxml.cxx |2 
 8 files changed, 183 insertions(+), 91 deletions(-)

New commits:
commit cd4b20cd84018b7984826f42b878500cfd2d34c6
Author: Tünde Tóth 
AuthorDate: Tue Mar 22 09:47:57 2022 +0100
Commit: Noel Grandin 
CommitDate: Wed Mar 8 12:38:28 2023 +

tdf#74670 tdf#91286 PPTX XLSX export: save image once

Impress and Calc used to dump the same image file
as many times as it was featured in the document,
resulting redundant, sometimes huge documents.

Note: using only checksum to recognize image duplication
is a regression, because checksum collision results
image loss. This is a very unlikely event, and
the following commits have got the same problem.
The solution is comparing the images with the same
checksum byte for byte.

See also commit b484e9814c66d8d51cea974390963a6944bc9d73
"tdf#83227 oox: reuse RelId in DML/VML export for the same graphic"
and commit 797fef38612fb2fd62d1f6591619b9361e526bca
"tdf#118535 DOCX export: save header image once".

Change-Id: I9f233d521941381746634cf4f9b5991da0dadda9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131928
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit aea8043bc5f5187498fa450505d6de9d6986e2a6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148270
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 8e4fe156c0cd..7c79896a29b8 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -21,7 +21,9 @@
 #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -41,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -149,6 +152,7 @@ private:
 static std::map maWdpCache;
 static sal_Int32 mnDrawingMLCount;
 static sal_Int32 mnVmlCount;
+static std::stack> 
maExportGraphics;
 
 /// To specify where write eg. the images to (like 'ppt', or 'word' - 
according to the OPC).
 DocumentType meDocumentType;
@@ -344,9 +348,11 @@ public:
 sal_Int32 getBulletMarginIndentation (const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view 
propName);
 
 static void ResetCounters();
-
 static void ResetMlCounters();
 
+static void PushExportGraphics();
+static void PopExportGraphics();
+
 static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; }
 static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; }
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 55a9f07e90fe..e843d51606b7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -112,7 +112,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -240,6 +239,7 @@ int DrawingML::mnWdpImageCounter = 1;
 std::map DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
+std::stack> 
DrawingML::maExportGraphics;
 
 sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 {
@@ -278,6 +278,16 @@ void DrawingML::ResetMlCounters()
 mnVmlCount = 0;
 }
 
+void DrawingML::PushExportGraphics()
+{
+maExportGraphics.emplace();
+}
+
+void DrawingML::PopExportGraphics()
+{
+maExportGraphics.pop();
+}
+
 bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, 
const OUString& aName )
 {
 try
@@ -1243,113 +1253,130 @@ const char* DrawingML::GetRelationCompPrefix() const
 OUString DrawingML::WriteImage( const Graphic& rGraphic , bool 
bRelPathToMedia, OUString* pFileName )
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
+BitmapChecksum aChecksum = rGraphic.GetChecksum();
 OUString sMediaType;
 const char* pExtension = "";
 OUString sRelId;
+OUString sPath;
 
-SvMemoryStream aStream;
-const void* aData = aLink.GetData();
-std::size_t nDataSize = aLink.GetDataSize();
-
-switch ( aLink.GetType() )
+// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX)
+if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty())
 {
-case GfxLinkType::NativeGif:
-sMediaType = "image/gif";
-pExtension = ".gif";
-break;
+auto aIterator = maExportGraphics.top().find(aChecksum);
+if (aIterator != maExportGraphics.top().end())
+sPath = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sd/qa xmloff/source

2023-02-23 Thread Tünde Tóth (via logerrit)
 sd/qa/unit/export-tests.cxx|   16 +
 xmloff/source/draw/shapeexport.cxx |   45 +
 2 files changed, 61 insertions(+)

New commits:
commit 47c465cb049ad8055dbd13a793afa958194185c6
Author: Tünde Tóth 
AuthorDate: Fri Jan 27 09:55:40 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 23 10:06:50 2023 +

tdf#153179 ODP export regression: fix lost shape at missing object

If the object is missing, it's still possible to keep its shape
by exporting its preview graphic, as before the regression.

Regression from commit adc042f95d3dbd65b778260025d59283146916e5
"tdf#124333 PPTX import: fix Z-order of embedded OLE objects".

See also commit 907da02bf8b33c080538731864225b3c44251328
"tdf#152436 PPTX export regression: fix lost shape at missing object"

Change-Id: I614730435a857c6cdf01d4cdfc525fc452dffa29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146247
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit da725dfe07f2cf10349772d1667591c4d6a6fe8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146990
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146991

diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 2e1a3ad5ec30..7b0a1032b3d1 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -95,6 +95,7 @@ public:
 void testMasterPageBackgroundFullSize();
 void testColumnsODG();
 void testTdf112126();
+void testTdf153179();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -143,6 +144,7 @@ public:
 CPPUNIT_TEST(testMasterPageBackgroundFullSize);
 CPPUNIT_TEST(testColumnsODG);
 CPPUNIT_TEST(testTdf112126);
+CPPUNIT_TEST(testTdf153179);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1735,6 +1737,20 @@ void SdExportTest::testTdf112126()
 xDocShRef->DoClose();
 }
 
+void SdExportTest::testTdf153179()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/ole-emf_min.pptx"), 
PPTX);
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect", sal_Int32(1),
+ getPage(0, xDocShRef)->getCount());
+
+xDocShRef = saveAndReload(xDocShRef.get(), ODP);
+
+// Check number of shapes after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0, xDocShRef)->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 43f21168a871..683e2e8f1dfd 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3009,6 +3009,51 @@ void XMLShapeExport::ImpExportOLE2Shape(
 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, 
XML_EMBED );
 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, 
XML_ONLOAD );
 }
+else
+{
+// tdf#153179 Export the preview graphic of the object if 
the object is missing.
+uno::Reference xGraphic;
+xPropSet->getPropertyValue("Graphic") >>= xGraphic;
+
+if (xGraphic.is())
+{
+OUString aMimeType;
+const OUString aHref = 
mrExport.AddEmbeddedXGraphic(xGraphic, aMimeType);
+
+if (aMimeType.isEmpty())
+mrExport.GetGraphicMimeTypeFromStream(xGraphic, 
aMimeType);
+
+if (!aHref.isEmpty())
+{
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_HREF, aHref);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_TYPE, XML_SIMPLE);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_SHOW, XML_EMBED);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_ACTUATE, XML_ONLOAD);
+}
+
+if (!aMimeType.isEmpty()
+&& GetExport().getSaneDefaultVersion() > 
SvtSaveOptions::ODFSVER_012)
+{ // ODF 1.3 OFFICE-3943
+mrExport.AddAttribute(SvtSaveOptions::ODFSVER_013
+  <= 
GetExport().getSaneDefaultVersion()
+  ? XML_NAMESPACE_DRAW
+  : XML_NAMESPACE_LO_EXT,
+  "mime-type", aMimeType);
+}
+
+SvXMLElementExport aImageElem(mrExport, 
XML_NAMESPACE_DRAW, XML_IMAGE, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sd/qa xmloff/source

2023-02-16 Thread Tünde Tóth (via logerrit)
 sd/qa/unit/export-tests.cxx|   11 +
 xmloff/source/draw/shapeexport.cxx |   45 +
 2 files changed, 56 insertions(+)

New commits:
commit 134df0c64da6392648b8d4f7020d95e337307e67
Author: Tünde Tóth 
AuthorDate: Fri Jan 27 09:55:40 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 16 08:41:46 2023 +

tdf#153179 ODP export regression: fix lost shape at missing object

If the object is missing, it's still possible to keep its shape
by exporting its preview graphic, as before the regression.

Regression from commit adc042f95d3dbd65b778260025d59283146916e5
"tdf#124333 PPTX import: fix Z-order of embedded OLE objects".

See also commit 907da02bf8b33c080538731864225b3c44251328
"tdf#152436 PPTX export regression: fix lost shape at missing object"

Change-Id: I614730435a857c6cdf01d4cdfc525fc452dffa29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146247
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit da725dfe07f2cf10349772d1667591c4d6a6fe8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146990
Reviewed-by: Xisco Fauli 

diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 9b5c73bd43f3..029ee7267054 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -102,6 +102,7 @@ public:
 void testTdf112126();
 void testCellProperties();
 void testUserTableStyles();
+void testTdf153179();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -154,6 +155,7 @@ public:
 CPPUNIT_TEST(testTdf112126);
 CPPUNIT_TEST(testCellProperties);
 CPPUNIT_TEST(testUserTableStyles);
+CPPUNIT_TEST(testTdf153179);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1847,6 +1849,15 @@ void SdExportTest::testUserTableStyles()
 CPPUNIT_ASSERT(xTableStyle->isUserDefined());
 }
 
+void SdExportTest::testTdf153179()
+{
+createSdImpressDoc("pptx/ole-emf_min.pptx");
+saveAndReload("impress8");
+
+// Check number of shapes after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 6e687e746ba4..c8d513d4e724 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3011,6 +3011,51 @@ void XMLShapeExport::ImpExportOLE2Shape(
 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, 
XML_EMBED );
 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, 
XML_ONLOAD );
 }
+else
+{
+// tdf#153179 Export the preview graphic of the object if 
the object is missing.
+uno::Reference xGraphic;
+xPropSet->getPropertyValue("Graphic") >>= xGraphic;
+
+if (xGraphic.is())
+{
+OUString aMimeType;
+const OUString aHref = 
mrExport.AddEmbeddedXGraphic(xGraphic, aMimeType);
+
+if (aMimeType.isEmpty())
+mrExport.GetGraphicMimeTypeFromStream(xGraphic, 
aMimeType);
+
+if (!aHref.isEmpty())
+{
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_HREF, aHref);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_TYPE, XML_SIMPLE);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_SHOW, XML_EMBED);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_ACTUATE, XML_ONLOAD);
+}
+
+if (!aMimeType.isEmpty()
+&& GetExport().getSaneDefaultVersion() > 
SvtSaveOptions::ODFSVER_012)
+{ // ODF 1.3 OFFICE-3943
+mrExport.AddAttribute(SvtSaveOptions::ODFSVER_013
+  <= 
GetExport().getSaneDefaultVersion()
+  ? XML_NAMESPACE_DRAW
+  : XML_NAMESPACE_LO_EXT,
+  "mime-type", aMimeType);
+}
+
+SvXMLElementExport aImageElem(mrExport, 
XML_NAMESPACE_DRAW, XML_IMAGE, true,
+  true);
+
+// optional office:binary-data
+mrExport.AddEmbeddedXGraphicAsBase64(xGraphic);
+
+ImpExportEvents(xShape);
+ImpExportGluePoints(xShape);
+ImpExportDescription(xShape);
+

[Libreoffice-commits] core.git: sd/qa xmloff/source

2023-02-15 Thread Tünde Tóth (via logerrit)
 sd/qa/unit/export-tests.cxx|   11 +
 xmloff/source/draw/shapeexport.cxx |   45 +
 2 files changed, 56 insertions(+)

New commits:
commit da725dfe07f2cf10349772d1667591c4d6a6fe8a
Author: Tünde Tóth 
AuthorDate: Fri Jan 27 09:55:40 2023 +0100
Commit: László Németh 
CommitDate: Wed Feb 15 08:35:00 2023 +

tdf#153179 ODP export regression: fix lost shape at missing object

If the object is missing, it's still possible to keep its shape
by exporting its preview graphic, as before the regression.

Regression from commit adc042f95d3dbd65b778260025d59283146916e5
"tdf#124333 PPTX import: fix Z-order of embedded OLE objects".

See also commit 907da02bf8b33c080538731864225b3c44251328
"tdf#152436 PPTX export regression: fix lost shape at missing object"

Change-Id: I614730435a857c6cdf01d4cdfc525fc452dffa29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146247
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index a7915dcc4c23..1878bf11e706 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -103,6 +103,7 @@ public:
 void testTdf112126();
 void testCellProperties();
 void testUserTableStyles();
+void testTdf153179();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -156,6 +157,7 @@ public:
 CPPUNIT_TEST(testTdf112126);
 CPPUNIT_TEST(testCellProperties);
 CPPUNIT_TEST(testUserTableStyles);
+CPPUNIT_TEST(testTdf153179);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1861,6 +1863,15 @@ void SdExportTest::testUserTableStyles()
 CPPUNIT_ASSERT(xTableStyle->isUserDefined());
 }
 
+void SdExportTest::testTdf153179()
+{
+createSdImpressDoc("pptx/ole-emf_min.pptx");
+saveAndReload("impress8");
+
+// Check number of shapes after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/source/draw/shapeexport.cxx 
b/xmloff/source/draw/shapeexport.cxx
index 3e0786e6ea77..f972c389a396 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3011,6 +3011,51 @@ void XMLShapeExport::ImpExportOLE2Shape(
 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, 
XML_EMBED );
 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, 
XML_ONLOAD );
 }
+else
+{
+// tdf#153179 Export the preview graphic of the object if 
the object is missing.
+uno::Reference xGraphic;
+xPropSet->getPropertyValue("Graphic") >>= xGraphic;
+
+if (xGraphic.is())
+{
+OUString aMimeType;
+const OUString aHref = 
mrExport.AddEmbeddedXGraphic(xGraphic, aMimeType);
+
+if (aMimeType.isEmpty())
+mrExport.GetGraphicMimeTypeFromStream(xGraphic, 
aMimeType);
+
+if (!aHref.isEmpty())
+{
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_HREF, aHref);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_TYPE, XML_SIMPLE);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_SHOW, XML_EMBED);
+mrExport.AddAttribute(XML_NAMESPACE_XLINK, 
XML_ACTUATE, XML_ONLOAD);
+}
+
+if (!aMimeType.isEmpty()
+&& GetExport().getSaneDefaultVersion() > 
SvtSaveOptions::ODFSVER_012)
+{ // ODF 1.3 OFFICE-3943
+mrExport.AddAttribute(SvtSaveOptions::ODFSVER_013
+  <= 
GetExport().getSaneDefaultVersion()
+  ? XML_NAMESPACE_DRAW
+  : XML_NAMESPACE_LO_EXT,
+  "mime-type", aMimeType);
+}
+
+SvXMLElementExport aImageElem(mrExport, 
XML_NAMESPACE_DRAW, XML_IMAGE, true,
+  true);
+
+// optional office:binary-data
+mrExport.AddEmbeddedXGraphicAsBase64(xGraphic);
+
+ImpExportEvents(xShape);
+ImpExportGluePoints(xShape);
+ImpExportDescription(xShape);
+
+return;
+}
+}
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source

2023-02-09 Thread Tünde Tóth (via logerrit)
 sc/source/ui/app/client.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit bdbeff654038921943658a5bf6e7faf21f5776da
Author: Tünde Tóth 
AuthorDate: Fri Jan 13 09:31:38 2023 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Feb 9 11:43:02 2023 +

tdf#152989 sc: fix oversized rectangle of edited embedded object

Editing resulted unusably oversized OLE objects. Keep
its original size to fix the UX problem.

Note: lost zoom is still a problem.

See also commit fdf95de18ef1891862bdce26669d1ce2c6f24764
"tdf#152991 sd: fix oversized rectangle of edited embedded object"

Change-Id: I6b73d1aea76ea4addc24ff978403893c3cbd3dac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145432
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit a1f16b4603bffddb2f6380874d63f928289de85a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145588
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 2c7fea5ab376..ea9ffa9ade9c 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -202,6 +202,12 @@ void ScClient::ViewChanged()
 if (!pDrawObj)
 return;
 
+if (!IsObjectInPlaceActive())
+{
+pDrawObj->ActionChanged();
+return;
+}
+
 tools::Rectangle aLogicRect = pDrawObj->GetLogicRect();
 Fraction aFractX = GetScaleWidth() * aVisSize.Width();
 Fraction aFractY = GetScaleHeight() * aVisSize.Height();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sd/source

2023-02-09 Thread Tünde Tóth (via logerrit)
 sd/source/ui/docshell/sdclient.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit e553620ceb3bdef3cfa6d1e9fc18ca30c74fe9f7
Author: Tünde Tóth 
AuthorDate: Fri Jan 13 09:54:00 2023 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Feb 9 11:41:30 2023 +

tdf#152991 sd: fix oversized rectangle of edited embedded object

The embedded object became unusably oversized after editing,
because it was not possible to minimize it by the mouse. Now
the object keeps its original size to avoid of the UX problem.

Note: losing the original zoom of the OLE content is still a problem.

Change-Id: I8b7a2f2a84324bf4de2358ecb5fec5c1f7349155
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145454
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit fdf95de18ef1891862bdce26669d1ce2c6f24764)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145583
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sd/source/ui/docshell/sdclient.cxx 
b/sd/source/ui/docshell/sdclient.cxx
index 02521c2575ad..c7f79c3ea813 100644
--- a/sd/source/ui/docshell/sdclient.cxx
+++ b/sd/source/ui/docshell/sdclient.cxx
@@ -143,6 +143,13 @@ void Client::ViewChanged()
 if (!pView)
 return;
 
+// Do not recalculate the visareasize if the embedded object is opening in 
a new window.
+if (!IsObjectInPlaceActive())
+{
+pSdrOle2Obj->BroadcastObjectChange();
+return;
+}
+
 ::tools::Rectangle aLogicRect( pSdrOle2Obj->GetLogicRect() );
 Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() );
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source sd/qa

2023-01-31 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx   |   64 ++---
 sd/qa/unit/data/odp/linked_ole.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   18 ++
 3 files changed, 57 insertions(+), 25 deletions(-)

New commits:
commit 34ca1dca73ca03cbec1cfeab79f2e11e36af1280
Author: Tünde Tóth 
AuthorDate: Tue Jan 24 15:02:09 2023 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 31 11:36:41 2023 +

tdf#153185 PPTX: fix export of linked OLE objects

Linked OLE objects were not exported.

Change-Id: If6e8c6e0d0c9917e8ec476ad14dcaa1602c74b29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146073
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit f589d7e769bee4b82826a944fed3cf2382d84fb2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146319
Reviewed-by: Michael Stahl 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 4b41f56d79cd..4ef05ba80cab 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2601,49 +2601,60 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 OUString sRelationType;
 OUString sSuffix;
 const char * pProgID(nullptr);
+OString anotherProgID;
 
 uno::Reference const xInStream =
 oox::GetOLEObjectStream(
 mpFB->getComponentContext(), xObj, progID,
 sMediaType, sRelationType, sSuffix, pProgID);
 
+OUString sURL;
+OUString sRelId;
 if (!xInStream.is())
 {
-return *this;
-}
+xPropSet->getPropertyValue("LinkURL") >>= sURL;
+if (sURL.isEmpty())
+return *this;
 
-OString anotherProgID;
-if (!pProgID && !progID.isEmpty())
-{
-anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
-pProgID = anotherProgID.getStr();
+sRelId = mpFB->addRelation(mpFS->getOutputStream(),
+   
oox::getRelationship(Relationship::OLEOBJECT), sURL, true);
 }
+else
+{
+if (!pProgID && !progID.isEmpty())
+{
+anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
+pProgID = anotherProgID.getStr();
+}
+
+assert(!sMediaType.isEmpty());
+assert(!sRelationType.isEmpty());
+assert(!sSuffix.isEmpty());
 
-assert(!sMediaType.isEmpty());
-assert(!sRelationType.isEmpty());
-assert(!sSuffix.isEmpty());
+OUString sFileName
+= "embeddings/oleObject" + OUString::number(++m_nEmbeddedObjects) 
+ "." + sSuffix;
+uno::Reference const 
xOutStream(mpFB->openFragmentStream(
+OUString::createFromAscii(GetComponentDir()) + "/" + sFileName, 
sMediaType));
+assert(xOutStream.is()); // no reason why that could fail
 
-OUString sFileName = "embeddings/oleObject" + 
OUString::number(++m_nEmbeddedObjects) + "." + sSuffix;
-uno::Reference const xOutStream(
-mpFB->openFragmentStream(
-OUString::createFromAscii(GetComponentDir()) + "/" + sFileName,
-sMediaType));
-assert(xOutStream.is()); // no reason why that could fail
+try
+{
+::comphelper::OStorageHelper::CopyInputToOutput(xInStream, 
xOutStream);
+}
+catch (uno::Exception const&)
+{
+TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject");
+}
 
-try {
-::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
-} catch (uno::Exception const&) {
-TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject");
+sRelId = mpFB->addRelation(
+mpFS->getOutputStream(), sRelationType,
+Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + 
sFileName));
 }
 
 sal_Int64 nAspect;
 bool bShowAsIcon = (xPropSet->getPropertyValue("Aspect") >>= nAspect)
&& nAspect == embed::Aspects::MSOLE_ICON;
 
-OUString const sRelId = mpFB->addRelation(
-mpFS->getOutputStream(), sRelationType,
-Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + 
sFileName));
-
 mpFS->startElementNS(mnXmlNamespace, XML_graphicFrame);
 
 mpFS->startElementNS(mnXmlNamespace, XML_nvGraphicFramePr);
@@ -2681,7 +2692,10 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
   XML_spid, "" );
 }
 
-mpFS->singleElementNS( mnXmlNamespace, XML_embed );
+if (sURL.isEmpty())
+mpFS->singleElementNS(mnXmlNamespace, XML_embed);
+else
+mpFS->singleElementNS(mnXmlNamespace, XML_link, XML_updateAutomatic, 
"1");
 
 // pic element
 SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape));
diff --git a/sd/qa/unit/data/odp/linked_ole.odp 
b/sd/qa/unit/data/odp/linked_ole.odp
new file mode 100644
index ..13fb0a845a13
Binary 

[Libreoffice-commits] core.git: oox/source sd/qa

2023-01-30 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx   |   64 ++---
 sd/qa/unit/data/odp/linked_ole.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   18 ++
 3 files changed, 57 insertions(+), 25 deletions(-)

New commits:
commit f589d7e769bee4b82826a944fed3cf2382d84fb2
Author: Tünde Tóth 
AuthorDate: Tue Jan 24 15:02:09 2023 +0100
Commit: László Németh 
CommitDate: Mon Jan 30 11:25:32 2023 +

tdf#153185 PPTX: fix export of linked OLE objects

Linked OLE objects were not exported.

Change-Id: If6e8c6e0d0c9917e8ec476ad14dcaa1602c74b29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146073
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d6b3a9e9ef99..1c828d438653 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2602,49 +2602,60 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 OUString sRelationType;
 OUString sSuffix;
 const char * pProgID(nullptr);
+OString anotherProgID;
 
 uno::Reference const xInStream =
 oox::GetOLEObjectStream(
 mpFB->getComponentContext(), xObj, progID,
 sMediaType, sRelationType, sSuffix, pProgID);
 
+OUString sURL;
+OUString sRelId;
 if (!xInStream.is())
 {
-return *this;
-}
+xPropSet->getPropertyValue("LinkURL") >>= sURL;
+if (sURL.isEmpty())
+return *this;
 
-OString anotherProgID;
-if (!pProgID && !progID.isEmpty())
-{
-anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
-pProgID = anotherProgID.getStr();
+sRelId = mpFB->addRelation(mpFS->getOutputStream(),
+   
oox::getRelationship(Relationship::OLEOBJECT), sURL, true);
 }
+else
+{
+if (!pProgID && !progID.isEmpty())
+{
+anotherProgID = OUStringToOString(progID, RTL_TEXTENCODING_UTF8);
+pProgID = anotherProgID.getStr();
+}
+
+assert(!sMediaType.isEmpty());
+assert(!sRelationType.isEmpty());
+assert(!sSuffix.isEmpty());
 
-assert(!sMediaType.isEmpty());
-assert(!sRelationType.isEmpty());
-assert(!sSuffix.isEmpty());
+OUString sFileName
+= "embeddings/oleObject" + OUString::number(++m_nEmbeddedObjects) 
+ "." + sSuffix;
+uno::Reference const 
xOutStream(mpFB->openFragmentStream(
+OUString::createFromAscii(GetComponentDir()) + "/" + sFileName, 
sMediaType));
+assert(xOutStream.is()); // no reason why that could fail
 
-OUString sFileName = "embeddings/oleObject" + 
OUString::number(++m_nEmbeddedObjects) + "." + sSuffix;
-uno::Reference const xOutStream(
-mpFB->openFragmentStream(
-OUString::createFromAscii(GetComponentDir()) + "/" + sFileName,
-sMediaType));
-assert(xOutStream.is()); // no reason why that could fail
+try
+{
+::comphelper::OStorageHelper::CopyInputToOutput(xInStream, 
xOutStream);
+}
+catch (uno::Exception const&)
+{
+TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject");
+}
 
-try {
-::comphelper::OStorageHelper::CopyInputToOutput(xInStream, xOutStream);
-} catch (uno::Exception const&) {
-TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject");
+sRelId = mpFB->addRelation(
+mpFS->getOutputStream(), sRelationType,
+Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + 
sFileName));
 }
 
 sal_Int64 nAspect;
 bool bShowAsIcon = (xPropSet->getPropertyValue("Aspect") >>= nAspect)
&& nAspect == embed::Aspects::MSOLE_ICON;
 
-OUString const sRelId = mpFB->addRelation(
-mpFS->getOutputStream(), sRelationType,
-Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + 
sFileName));
-
 mpFS->startElementNS(mnXmlNamespace, XML_graphicFrame);
 
 mpFS->startElementNS(mnXmlNamespace, XML_nvGraphicFramePr);
@@ -2682,7 +2693,10 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
   XML_spid, "" );
 }
 
-mpFS->singleElementNS( mnXmlNamespace, XML_embed );
+if (sURL.isEmpty())
+mpFS->singleElementNS(mnXmlNamespace, XML_embed);
+else
+mpFS->singleElementNS(mnXmlNamespace, XML_link, XML_updateAutomatic, 
"1");
 
 // pic element
 SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape));
diff --git a/sd/qa/unit/data/odp/linked_ole.odp 
b/sd/qa/unit/data/odp/linked_ole.odp
new file mode 100644
index ..13fb0a845a13
Binary files /dev/null and b/sd/qa/unit/data/odp/linked_ole.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 

[Libreoffice-commits] core.git: sc/source

2023-01-17 Thread Tünde Tóth (via logerrit)
 sc/source/ui/app/client.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit a1f16b4603bffddb2f6380874d63f928289de85a
Author: Tünde Tóth 
AuthorDate: Fri Jan 13 09:31:38 2023 +0100
Commit: László Németh 
CommitDate: Tue Jan 17 10:34:24 2023 +

tdf#152989 sc: fix oversized rectangle of edited embedded object

Editing resulted unusably oversized OLE objects. Keep
its original size to fix the UX problem.

Note: lost zoom is still a problem.

See also commit fdf95de18ef1891862bdce26669d1ce2c6f24764
"tdf#152991 sd: fix oversized rectangle of edited embedded object"

Change-Id: I6b73d1aea76ea4addc24ff978403893c3cbd3dac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145432
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 2c7fea5ab376..ea9ffa9ade9c 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -202,6 +202,12 @@ void ScClient::ViewChanged()
 if (!pDrawObj)
 return;
 
+if (!IsObjectInPlaceActive())
+{
+pDrawObj->ActionChanged();
+return;
+}
+
 tools::Rectangle aLogicRect = pDrawObj->GetLogicRect();
 Fraction aFractX = GetScaleWidth() * aVisSize.Width();
 Fraction aFractY = GetScaleHeight() * aVisSize.Height();


[Libreoffice-commits] core.git: sd/source

2023-01-17 Thread Tünde Tóth (via logerrit)
 sd/source/ui/docshell/sdclient.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit fdf95de18ef1891862bdce26669d1ce2c6f24764
Author: Tünde Tóth 
AuthorDate: Fri Jan 13 09:54:00 2023 +0100
Commit: László Németh 
CommitDate: Tue Jan 17 10:00:46 2023 +

tdf#152991 sd: fix oversized rectangle of edited embedded object

The embedded object became unusably oversized after editing,
because it was not possible to minimize it by the mouse. Now
the object keeps its original size to avoid of the UX problem.

Note: losing the original zoom of the OLE content is still a problem.

Change-Id: I8b7a2f2a84324bf4de2358ecb5fec5c1f7349155
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145454
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sd/source/ui/docshell/sdclient.cxx 
b/sd/source/ui/docshell/sdclient.cxx
index 02521c2575ad..c7f79c3ea813 100644
--- a/sd/source/ui/docshell/sdclient.cxx
+++ b/sd/source/ui/docshell/sdclient.cxx
@@ -143,6 +143,13 @@ void Client::ViewChanged()
 if (!pView)
 return;
 
+// Do not recalculate the visareasize if the embedded object is opening in 
a new window.
+if (!IsObjectInPlaceActive())
+{
+pSdrOle2Obj->BroadcastObjectChange();
+return;
+}
+
 ::tools::Rectangle aLogicRect( pSdrOle2Obj->GetLogicRect() );
 Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() );
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - sw/source

2023-01-13 Thread Tünde Tóth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |   16 
 sw/source/filter/ww8/styles.cxx  |2 +-
 sw/source/filter/ww8/wrtw8sty.cxx|8 
 3 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 8423b1b9894e183b801df6a7898a34e63e5eb645
Author: Tünde Tóth 
AuthorDate: Mon Oct 24 13:52:27 2022 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jan 13 10:37:33 2023 +

tdf#151384 DOCX export: lost hyperlink format in localized UI

Fix losing color and underline of hyperlinks in localized
builds, at least with Russian UI.

Regression from commit d57b4480903f700ad7c95e885b9dd0ace5883cfc
"tdf#127579 DOCX export: fix losing color and underline of ODT hyperlinks".

Change-Id: I1eebcf58a7071226e80df3f84ed1264c5a8baf31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141761
Tested-by: László Németh 
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145397
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1d571a17dd30..12a6380b6478 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8736,9 +8736,13 @@ void DocxAttributeOutput::CharHighlight( const 
SvxBrushItem& rHighlight )
 
 void DocxAttributeOutput::TextINetFormat( const SwFormatINetFormat& rLink )
 {
-OString aStyleId = MSWordStyles::CreateStyleId(rLink.GetINetFormat());
-if (!aStyleId.isEmpty() && !aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
-m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+const SwCharFormat* pFormat = 
m_rExport.m_rDoc.FindCharFormatByName(rLink.GetINetFormat());
+if (pFormat)
+{
+OString 
aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pFormat)));
+if (!aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
+m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+}
 }
 
 void DocxAttributeOutput::TextCharFormat( const SwFormatCharFormat& 
rCharFormat )
commit 5a96c5386ceed1f4ad006ec190dd3fe62ffe0639
Author: Tünde Tóth 
AuthorDate: Fri Jun 17 10:56:27 2022 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jan 13 10:37:23 2023 +

tdf#132781 DOCX: export interoperable hyperlink style names

Similar to the paragraph styles, export default character
style names instead of the localized ones to avoid e.g. not
interoperable hyperlinks in MSO.

Change-Id: I65678a564ae4e73a1d8319df364defd698381256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136139
Reviewed-by: László Németh 
Tested-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145374
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f1599b6bba3a..1d571a17dd30 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7214,7 +7214,11 @@ void DocxAttributeOutput::StartStyle( const OUString& 
rName, StyleType eType,
 if ( nWwId < ww::stiMax)
 pEnglishName = ww::GetEnglishNameFromSti( 
static_cast(nWwId ) );
 break;
-case STYLE_TYPE_CHAR: pType = "character"; break;
+case STYLE_TYPE_CHAR:
+pType = "character";
+if (nWwId < ww::stiMax)
+pEnglishName = 
ww::GetEnglishNameFromSti(static_cast(nWwId));
+break;
 case STYLE_TYPE_LIST: pType = "numbering"; break;
 }
 pStyleAttributeList->add(FSNS( XML_w, XML_type ), pType);
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index 6f613b40fad6..86ec89a37798 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -113,7 +113,7 @@ namespace
 "Body Text Indent 3",
 "Block Text",
 "Hyperlink",
-"Followed Hyperlink",
+"FollowedHyperlink",
 "Strong",
 "Emphasis",
 "Document Map",
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index a36de19cbb2f..3ebdf689b514 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -645,14 +645,6 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, 
sal_uInt16 nPos )
 // tdf#92335 don't export redundant DOCX import style "ListLabel"
 return;
 }
-else if (aName.equalsIgnoreAsciiCase("Internet Link"))
-{
-aName = "Hyperlink";
-}
-else if (aName.equalsIgnoreAsciiCase("Visited Internet Link"))
-{
-aName = "FollowedHyperlink";
-}
 
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - oox/source sd/qa

2022-12-20 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx  |   10 ++
 sd/qa/unit/data/pptx/ole-emf_min.pptx |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   19 +++
 3 files changed, 29 insertions(+)

New commits:
commit 77e050e785cc7bdeff8c3b7746737499f0e0b381
Author: Tünde Tóth 
AuthorDate: Tue Dec 13 11:08:52 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Dec 21 07:23:38 2022 +

tdf#152436 PPTX export regression: fix lost shape at missing object

If the object is missing, it's still possible to keep its shape
by exporting its preview graphic, as before the regression.

Regression from commit adc042f95d3dbd65b778260025d59283146916e5
"tdf#124333 PPTX import: fix Z-order of embedded OLE objects".

Change-Id: Ib2fd00f53a80572cfc9acaefea55015780c57da8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144040
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 907da02bf8b33c080538731864225b3c44251328)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144486
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144578

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d8717acb9c06..6e2484279ac1 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2511,6 +2511,16 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 if (!xObj.is())
 {
 SAL_WARN("oox.shape", "ShapeExport::WriteOLE2Shape: no object");
+
+// tdf#152436 Export the preview graphic of the object if the object 
is missing.
+SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape));
+if (auto pOle2Obj = dynamic_cast(pSdrOLE2))
+{
+const Graphic* pGraphic = pOle2Obj->GetGraphic();
+if (pGraphic)
+WriteGraphicObjectShapePart(xShape, pGraphic);
+}
+
 return *this;
 }
 
diff --git a/sd/qa/unit/data/pptx/ole-emf_min.pptx 
b/sd/qa/unit/data/pptx/ole-emf_min.pptx
new file mode 100644
index ..0f97208fbebc
Binary files /dev/null and b/sd/qa/unit/data/pptx/ole-emf_min.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index b1d66cdbed94..5f4928b669e2 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -122,6 +122,7 @@ public:
 void testTdf94122_autoColor();
 void testTdf124333();
 void testAutofittedTextboxIndent();
+void testTdf152436();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -210,6 +211,7 @@ public:
 CPPUNIT_TEST(testTdf94122_autoColor);
 CPPUNIT_TEST(testTdf124333);
 CPPUNIT_TEST(testAutofittedTextboxIndent);
+CPPUNIT_TEST(testTdf152436);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -2239,6 +2241,23 @@ void SdOOXMLExportTest3::testAutofittedTextboxIndent()
 "691200");
 }
 
+void SdOOXMLExportTest3::testTdf152436()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/ole-emf_min.pptx"), 
PPTX);
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect", sal_Int32(1),
+ getPage(0, xDocShRef)->getCount());
+
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+// Check number of shapes after export.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("number of shapes is incorrect after export", 
sal_Int32(1),
+ getPage(0, xDocShRef)->getCount());
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/qa sc/source

2022-12-19 Thread Tünde Tóth (via logerrit)
 sc/qa/uitest/autofilter/autofilterBugs.py  |   18 ++
 sc/qa/uitest/data/autofilter/tdf152082.ods |binary
 sc/source/filter/xml/xmlfilti.cxx  |2 ++
 3 files changed, 20 insertions(+)

New commits:
commit f6728e75f814bfc4df533469ff7d90601de490e6
Author: Tünde Tóth 
AuthorDate: Wed Dec 7 12:44:18 2022 +0100
Commit: László Németh 
CommitDate: Tue Dec 20 07:51:29 2022 +

tdf#152082 ODS: fix import of Empty filter operator

Bad import of the Empty filter operator resulted shifted
filter settings, e.g. selected "A" and "B" instead of
"empty" and "A" from the range "empty", "A" and "B".

Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
"tdf#142910 sc filter: fix "greater than" or "smaller than" etc".

Change-Id: I33082d77fb9e707aa474fb22753a001960341d66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143776
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 1f30f9cf012cee6823029ef5a96a1d91a0e16cdc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144481
Tested-by: Jenkins

diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py 
b/sc/qa/uitest/autofilter/autofilterBugs.py
index a295c6307793..864cde7d83a0 100644
--- a/sc/qa/uitest/autofilter/autofilterBugs.py
+++ b/sc/qa/uitest/autofilter/autofilterBugs.py
@@ -252,4 +252,22 @@ class autofilter(UITestCase):
 xCancel = xFloatWindow.getChild("cancel")
 xCancel.executeAction("CLICK", tuple())
 
+#tdf152082
+   def test_tdf152082(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf152082.ods")):
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertEqual(4, len(xTreeList.getChildren()))
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+self.assertEqual('false', 
get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+xCancelBtn = xFloatWindow.getChild("cancel")
+xCancelBtn.executeAction("CLICK", tuple())
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf152082.ods 
b/sc/qa/uitest/data/autofilter/tdf152082.ods
new file mode 100644
index ..6a0e1cac6751
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf152082.ods differ
diff --git a/sc/source/filter/xml/xmlfilti.cxx 
b/sc/source/filter/xml/xmlfilti.cxx
index e549a3438d78..7585ce0c50fa 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -422,6 +422,8 @@ void SAL_CALL ScXMLConditionContext::endFastElement( 
sal_Int32 /*nElement*/ )
 if (maQueryItems.empty())
 {
 ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
+if (IsXMLToken(sOperator, XML_EMPTY))
+return;
 if (IsXMLToken(sDataType, XML_NUMBER))
 {
 rItem.mfVal = sConditionValue.toDouble();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - 2 commits - oox/source sc/qa sc/source sd/qa

2022-12-19 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx  |   10 ++
 sc/qa/uitest/autofilter2/tdf151152.py |   52 ++
 sc/source/ui/view/gridwin.cxx |   14 +++--
 sd/qa/unit/data/pptx/ole-emf_min.pptx |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   11 +++
 5 files changed, 84 insertions(+), 3 deletions(-)

New commits:
commit b3ed83265c1ba0c6d15be0bafd6d16b9a87cc64a
Author: Tünde Tóth 
AuthorDate: Tue Dec 13 11:08:52 2022 +0100
Commit: László Németh 
CommitDate: Tue Dec 20 07:50:25 2022 +

tdf#152436 PPTX export regression: fix lost shape at missing object

If the object is missing, it's still possible to keep its shape
by exporting its preview graphic, as before the regression.

Regression from commit adc042f95d3dbd65b778260025d59283146916e5
"tdf#124333 PPTX import: fix Z-order of embedded OLE objects".

Change-Id: Ib2fd00f53a80572cfc9acaefea55015780c57da8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144040
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 907da02bf8b33c080538731864225b3c44251328)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144486
Tested-by: Jenkins

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 70466d17fdb1..4b41f56d79cd 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2537,6 +2537,16 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 if (!xObj.is())
 {
 SAL_WARN("oox.shape", "ShapeExport::WriteOLE2Shape: no object");
+
+// tdf#152436 Export the preview graphic of the object if the object 
is missing.
+SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape));
+if (auto pOle2Obj = dynamic_cast(pSdrOLE2))
+{
+const Graphic* pGraphic = pOle2Obj->GetGraphic();
+if (pGraphic)
+WriteGraphicObjectShapePart(xShape, pGraphic);
+}
+
 return *this;
 }
 
diff --git a/sd/qa/unit/data/pptx/ole-emf_min.pptx 
b/sd/qa/unit/data/pptx/ole-emf_min.pptx
new file mode 100644
index ..0f97208fbebc
Binary files /dev/null and b/sd/qa/unit/data/pptx/ole-emf_min.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 2e6a600ec686..309709317821 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -130,6 +130,7 @@ public:
 void testTdf124333();
 void testAutofittedTextboxIndent();
 void testTdf151622_oleIcon();
+void testTdf152436();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -221,6 +222,7 @@ public:
 CPPUNIT_TEST(testTdf124333);
 CPPUNIT_TEST(testAutofittedTextboxIndent);
 CPPUNIT_TEST(testTdf151622_oleIcon);
+CPPUNIT_TEST(testTdf152436);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -2105,6 +2107,15 @@ void SdOOXMLExportTest3::testTdf151622_oleIcon()
 assertXPath(pXml, "//p:oleObj", "showAsIcon", "1");
 }
 
+void SdOOXMLExportTest3::testTdf152436()
+{
+createSdImpressDoc("pptx/ole-emf_min.pptx");
+saveAndReload("Impress Office Open XML");
+
+// Check number of shapes after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 438192f4947669e6c514bc25ce95d9eba38ce39c
Author: Tünde Tóth 
AuthorDate: Wed Dec 7 13:34:37 2022 +0100
Commit: László Németh 
CommitDate: Tue Dec 20 07:50:12 2022 +

tdf#151152 sc filter: fix string entry checking

When a column was filtered for values that included 0,
the all string entries were always checked in the Autofilter
dropdown (because their conversion to number, i.e. value 0
was used to check their existence in the filtered values
instead of their string value).

Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
"tdf#142910 sc filter: fix "greater than" or "smaller than" etc".

Change-Id: Ib659aba9d6f3d6bc3557547b1a27963f51e3eca3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143777
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 2298087db28ee1b4251cac6e12c1d4806b395a1e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144479
Tested-by: Jenkins

diff --git a/sc/qa/uitest/autofilter2/tdf151152.py 
b/sc/qa/uitest/autofilter2/tdf151152.py
new file mode 100644
index ..6971096e9844
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf151152.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/qa sc/source

2022-12-19 Thread Tünde Tóth (via logerrit)
 sc/qa/uitest/autofilter/autofilterBugs.py  |   18 ++
 sc/qa/uitest/data/autofilter/tdf152082.ods |binary
 sc/source/filter/xml/xmlfilti.cxx  |2 ++
 3 files changed, 20 insertions(+)

New commits:
commit 2f01443e84e6dc81a41c5a09da13cb8abfc6d534
Author: Tünde Tóth 
AuthorDate: Wed Dec 7 12:44:18 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 19 15:54:24 2022 +

tdf#152082 ODS: fix import of Empty filter operator

Bad import of the Empty filter operator resulted shifted
filter settings, e.g. selected "A" and "B" instead of
"empty" and "A" from the range "empty", "A" and "B".

Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
"tdf#142910 sc filter: fix "greater than" or "smaller than" etc".

Change-Id: I33082d77fb9e707aa474fb22753a001960341d66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143776
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 1f30f9cf012cee6823029ef5a96a1d91a0e16cdc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144476
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py 
b/sc/qa/uitest/autofilter/autofilterBugs.py
index 100ceaf246f1..6fa029985fcc 100644
--- a/sc/qa/uitest/autofilter/autofilterBugs.py
+++ b/sc/qa/uitest/autofilter/autofilterBugs.py
@@ -252,4 +252,22 @@ class autofilter(UITestCase):
 xCancel = xFloatWindow.getChild("cancel")
 xCancel.executeAction("CLICK", tuple())
 
+#tdf152082
+   def test_tdf152082(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf152082.ods")):
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertEqual(4, len(xTreeList.getChildren()))
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+self.assertEqual('false', 
get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+xCancelBtn = xFloatWindow.getChild("cancel")
+xCancelBtn.executeAction("CLICK", tuple())
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf152082.ods 
b/sc/qa/uitest/data/autofilter/tdf152082.ods
new file mode 100644
index ..6a0e1cac6751
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf152082.ods differ
diff --git a/sc/source/filter/xml/xmlfilti.cxx 
b/sc/source/filter/xml/xmlfilti.cxx
index e549a3438d78..7585ce0c50fa 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -422,6 +422,8 @@ void SAL_CALL ScXMLConditionContext::endFastElement( 
sal_Int32 /*nElement*/ )
 if (maQueryItems.empty())
 {
 ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
+if (IsXMLToken(sOperator, XML_EMPTY))
+return;
 if (IsXMLToken(sDataType, XML_NUMBER))
 {
 rItem.mfVal = sConditionValue.toDouble();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/qa sc/source

2022-12-19 Thread Tünde Tóth (via logerrit)
 sc/qa/uitest/autofilter2/tdf151152.py |   52 ++
 sc/source/ui/view/gridwin.cxx |   14 +++--
 2 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit 6faac931869ad06ce38216148da2450652c1091b
Author: Tünde Tóth 
AuthorDate: Wed Dec 7 13:34:37 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 19 15:14:40 2022 +

tdf#151152 sc filter: fix string entry checking

When a column was filtered for values that included 0,
the all string entries were always checked in the Autofilter
dropdown (because their conversion to number, i.e. value 0
was used to check their existence in the filtered values
instead of their string value).

Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
"tdf#142910 sc filter: fix "greater than" or "smaller than" etc".

Change-Id: Ib659aba9d6f3d6bc3557547b1a27963f51e3eca3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143777
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 2298087db28ee1b4251cac6e12c1d4806b395a1e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144480
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter2/tdf151152.py 
b/sc/qa/uitest/autofilter2/tdf151152.py
new file mode 100644
index ..6971096e9844
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf151152.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+#Bug 151152 - Autofilter checkbox status is wrong when I deselect one item, 
click OK, then click on the dropdown again (2nd case)
+
+class tdf151152(UITestCase):
+def test_tdf151152(self):
+with self.ui_test.create_doc_in_start_center("calc"):
+calcDoc = self.xUITest.getTopFocusWindow()
+gridwin = calcDoc.getChild("grid_window")
+
+enter_text_to_cell(gridwin, "A1", "A")
+enter_text_to_cell(gridwin, "A2", "0")
+enter_text_to_cell(gridwin, "A3", "a")
+enter_text_to_cell(gridwin, "A4", "b")
+
+gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:A4"}))
+
+self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xList = xCheckListMenu.getChild("check_list_box")
+xEntry = xList.getChild("1")
+xEntry.executeAction("CLICK", tuple())
+
+xOkButton = xFloatWindow.getChild("ok")
+xOkButton.executeAction("CLICK", tuple())
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xList = xCheckListMenu.getChild("check_list_box")
+self.assertEqual(3, len(xList.getChildren()))
+self.assertEqual('true', 
get_state_as_dict(xList.getChild('0'))['IsChecked'])
+self.assertEqual('false', 
get_state_as_dict(xList.getChild('1'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xList.getChild('2'))['IsChecked'])
+xCloseBtn = xFloatWindow.getChild("cancel")
+xCloseBtn.executeAction("CLICK", tuple())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 8a7dd8b82bdc..0c471e4c53e3 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -963,10 +963,18 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 
 if (!aSelectedValue.empty() || !aSelectedString.empty())
 {
-if (aDoubleVal == aRDoubleVal)
-bSelected = aSelectedValue.count(aDoubleVal) > 0 || 
aSelectedString.count(aStringVal) > 0;
+if (rEntry.GetStringType() == ScTypedStrData::Value)
+{
+if (aDoubleVal == aRDoubleVal)
+bSelected = aSelectedValue.count(aDoubleVal) > 0
+|| aSelectedString.count(aStringVal) > 0;
+else
+bSelected = aSelectedValue.count(aDoubleVal) > 0
+|| aSelectedValue.count(aRDoubleVal) > 0
+  

[Libreoffice-commits] core.git: oox/source sd/qa

2022-12-19 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx  |   10 ++
 sd/qa/unit/data/pptx/ole-emf_min.pptx |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   11 +++
 3 files changed, 21 insertions(+)

New commits:
commit 907da02bf8b33c080538731864225b3c44251328
Author: Tünde Tóth 
AuthorDate: Tue Dec 13 11:08:52 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 19 11:47:09 2022 +

tdf#152436 PPTX export regression: fix lost shape at missing object

If the object is missing, it's still possible to keep its shape
by exporting its preview graphic, as before the regression.

Regression from commit adc042f95d3dbd65b778260025d59283146916e5
"tdf#124333 PPTX import: fix Z-order of embedded OLE objects".

Change-Id: Ib2fd00f53a80572cfc9acaefea55015780c57da8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144040
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 125ea39e2970..137c69fe7c33 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -2538,6 +2538,16 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 if (!xObj.is())
 {
 SAL_WARN("oox.shape", "ShapeExport::WriteOLE2Shape: no object");
+
+// tdf#152436 Export the preview graphic of the object if the object 
is missing.
+SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape));
+if (auto pOle2Obj = dynamic_cast(pSdrOLE2))
+{
+const Graphic* pGraphic = pOle2Obj->GetGraphic();
+if (pGraphic)
+WriteGraphicObjectShapePart(xShape, pGraphic);
+}
+
 return *this;
 }
 
diff --git a/sd/qa/unit/data/pptx/ole-emf_min.pptx 
b/sd/qa/unit/data/pptx/ole-emf_min.pptx
new file mode 100644
index ..0f97208fbebc
Binary files /dev/null and b/sd/qa/unit/data/pptx/ole-emf_min.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 2e6a600ec686..309709317821 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -130,6 +130,7 @@ public:
 void testTdf124333();
 void testAutofittedTextboxIndent();
 void testTdf151622_oleIcon();
+void testTdf152436();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -221,6 +222,7 @@ public:
 CPPUNIT_TEST(testTdf124333);
 CPPUNIT_TEST(testAutofittedTextboxIndent);
 CPPUNIT_TEST(testTdf151622_oleIcon);
+CPPUNIT_TEST(testTdf152436);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -2105,6 +2107,15 @@ void SdOOXMLExportTest3::testTdf151622_oleIcon()
 assertXPath(pXml, "//p:oleObj", "showAsIcon", "1");
 }
 
+void SdOOXMLExportTest3::testTdf152436()
+{
+createSdImpressDoc("pptx/ole-emf_min.pptx");
+saveAndReload("Impress Office Open XML");
+
+// Check number of shapes after export.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: sc/qa sc/source

2022-12-19 Thread Tünde Tóth (via logerrit)
 sc/qa/uitest/autofilter2/tdf151152.py |   52 ++
 sc/source/ui/view/gridwin.cxx |   14 +++--
 2 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit 2298087db28ee1b4251cac6e12c1d4806b395a1e
Author: Tünde Tóth 
AuthorDate: Wed Dec 7 13:34:37 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 19 11:02:53 2022 +

tdf#151152 sc filter: fix string entry checking

When a column was filtered for values that included 0,
the all string entries were always checked in the Autofilter
dropdown (because their conversion to number, i.e. value 0
was used to check their existence in the filtered values
instead of their string value).

Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
"tdf#142910 sc filter: fix "greater than" or "smaller than" etc".

Change-Id: Ib659aba9d6f3d6bc3557547b1a27963f51e3eca3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143777
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/uitest/autofilter2/tdf151152.py 
b/sc/qa/uitest/autofilter2/tdf151152.py
new file mode 100644
index ..6971096e9844
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf151152.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+#Bug 151152 - Autofilter checkbox status is wrong when I deselect one item, 
click OK, then click on the dropdown again (2nd case)
+
+class tdf151152(UITestCase):
+def test_tdf151152(self):
+with self.ui_test.create_doc_in_start_center("calc"):
+calcDoc = self.xUITest.getTopFocusWindow()
+gridwin = calcDoc.getChild("grid_window")
+
+enter_text_to_cell(gridwin, "A1", "A")
+enter_text_to_cell(gridwin, "A2", "0")
+enter_text_to_cell(gridwin, "A3", "a")
+enter_text_to_cell(gridwin, "A4", "b")
+
+gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:A4"}))
+
+self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xList = xCheckListMenu.getChild("check_list_box")
+xEntry = xList.getChild("1")
+xEntry.executeAction("CLICK", tuple())
+
+xOkButton = xFloatWindow.getChild("ok")
+xOkButton.executeAction("CLICK", tuple())
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xList = xCheckListMenu.getChild("check_list_box")
+self.assertEqual(3, len(xList.getChildren()))
+self.assertEqual('true', 
get_state_as_dict(xList.getChild('0'))['IsChecked'])
+self.assertEqual('false', 
get_state_as_dict(xList.getChild('1'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xList.getChild('2'))['IsChecked'])
+xCloseBtn = xFloatWindow.getChild("cancel")
+xCloseBtn.executeAction("CLICK", tuple())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 3316afdf95e4..547338589298 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -963,10 +963,18 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 
 if (!aSelectedValue.empty() || !aSelectedString.empty())
 {
-if (aDoubleVal == aRDoubleVal)
-bSelected = aSelectedValue.count(aDoubleVal) > 0 || 
aSelectedString.count(aStringVal) > 0;
+if (rEntry.GetStringType() == ScTypedStrData::Value)
+{
+if (aDoubleVal == aRDoubleVal)
+bSelected = aSelectedValue.count(aDoubleVal) > 0
+|| aSelectedString.count(aStringVal) > 0;
+else
+bSelected = aSelectedValue.count(aDoubleVal) > 0
+|| aSelectedValue.count(aRDoubleVal) > 0
+|| aSelectedString.count(aStringVal) > 0;
+}
 else
-bSelected = aSelectedValue.count(aDoubleVal) > 0 || 

[Libreoffice-commits] core.git: sc/qa sc/source

2022-12-19 Thread Tünde Tóth (via logerrit)
 sc/qa/uitest/autofilter/autofilterBugs.py  |   18 ++
 sc/qa/uitest/data/autofilter/tdf152082.ods |binary
 sc/source/filter/xml/xmlfilti.cxx  |2 ++
 3 files changed, 20 insertions(+)

New commits:
commit 1f30f9cf012cee6823029ef5a96a1d91a0e16cdc
Author: Tünde Tóth 
AuthorDate: Wed Dec 7 12:44:18 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 19 10:38:36 2022 +

tdf#152082 ODS: fix import of Empty filter operator

Bad import of the Empty filter operator resulted shifted
filter settings, e.g. selected "A" and "B" instead of
"empty" and "A" from the range "empty", "A" and "B".

Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
"tdf#142910 sc filter: fix "greater than" or "smaller than" etc".

Change-Id: I33082d77fb9e707aa474fb22753a001960341d66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143776
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py 
b/sc/qa/uitest/autofilter/autofilterBugs.py
index 100ceaf246f1..6fa029985fcc 100644
--- a/sc/qa/uitest/autofilter/autofilterBugs.py
+++ b/sc/qa/uitest/autofilter/autofilterBugs.py
@@ -252,4 +252,22 @@ class autofilter(UITestCase):
 xCancel = xFloatWindow.getChild("cancel")
 xCancel.executeAction("CLICK", tuple())
 
+#tdf152082
+   def test_tdf152082(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf152082.ods")):
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertEqual(4, len(xTreeList.getChildren()))
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+self.assertEqual('true', 
get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+self.assertEqual('false', 
get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+xCancelBtn = xFloatWindow.getChild("cancel")
+xCancelBtn.executeAction("CLICK", tuple())
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf152082.ods 
b/sc/qa/uitest/data/autofilter/tdf152082.ods
new file mode 100644
index ..6a0e1cac6751
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf152082.ods differ
diff --git a/sc/source/filter/xml/xmlfilti.cxx 
b/sc/source/filter/xml/xmlfilti.cxx
index e549a3438d78..7585ce0c50fa 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -422,6 +422,8 @@ void SAL_CALL ScXMLConditionContext::endFastElement( 
sal_Int32 /*nElement*/ )
 if (maQueryItems.empty())
 {
 ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
+if (IsXMLToken(sOperator, XML_EMPTY))
+return;
 if (IsXMLToken(sDataType, XML_NUMBER))
 {
 rItem.mfVal = sConditionValue.toDouble();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - oox/source sw/qa

2022-12-16 Thread Tünde Tóth (via logerrit)
 oox/source/shape/WpsContext.cxx |5 -
 sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |   10 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit d3459346a6f4cf7650a03685bcc89c83716d98b1
Author: Tünde Tóth 
AuthorDate: Thu Dec 1 16:15:42 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Dec 16 08:00:22 2022 +

tdf#152310 DOCX shape import: fix lost text color regression

Don't apply COL_AUTO as color of the run.

Regression from commit 49a40e3ed200e7c6d728f36d0b4be22dd85c51be
"tdf#135923 DOCX shape import: set text color".

Change-Id: I9c2088b4c531f09c80715bffdae225ac0987be79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143533
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit fd831c28bfc29d9d5fe2b3074324d4cbc4a70689)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144179
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 9a7458ac6a85..99656195075b 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -220,7 +220,10 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 {
 uno::Reference 
xRunPropSet(
 xRun, uno::UNO_QUERY);
-
xRunPropSet->setPropertyValue("CharColor", xCharColor);
+Color aRunColor = COL_AUTO;
+
xRunPropSet->getPropertyValue("CharColor") >>= aRunColor;
+if (aRunColor == COL_AUTO)
+
xRunPropSet->setPropertyValue("CharColor", xCharColor);
 }
 }
 }
diff --git a/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx 
b/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx
new file mode 100644
index ..f1c8e527df96
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 0f0af36ec7c7..4feae4b5d864 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -862,6 +862,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104348_contextMargin, 
"tdf104348_contextMargin.d
 CPPUNIT_ASSERT_EQUAL(nMargin, getProperty(getParagraph(2), 
"ParaBottomMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf152310, "ColorOverwritten.docx")
+{
+uno::Reference xShape(getShape(1), uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(Color(0xFF),
+ getProperty(getParagraphOfText(1, xShape), 
"CharColor"));
+CPPUNIT_ASSERT_EQUAL(Color(0x00b050),
+ getProperty(getParagraphOfText(2, xShape), 
"CharColor"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: oox/source sw/qa

2022-12-15 Thread Tünde Tóth (via logerrit)
 oox/source/shape/WpsContext.cxx |5 -
 sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |   10 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit fd831c28bfc29d9d5fe2b3074324d4cbc4a70689
Author: Tünde Tóth 
AuthorDate: Thu Dec 1 16:15:42 2022 +0100
Commit: László Németh 
CommitDate: Thu Dec 15 08:21:12 2022 +

tdf#152310 DOCX shape import: fix lost text color regression

Don't apply COL_AUTO as color of the run.

Regression from commit 49a40e3ed200e7c6d728f36d0b4be22dd85c51be
"tdf#135923 DOCX shape import: set text color".

Change-Id: I9c2088b4c531f09c80715bffdae225ac0987be79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143533
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 9a7458ac6a85..99656195075b 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -220,7 +220,10 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 {
 uno::Reference 
xRunPropSet(
 xRun, uno::UNO_QUERY);
-
xRunPropSet->setPropertyValue("CharColor", xCharColor);
+Color aRunColor = COL_AUTO;
+
xRunPropSet->getPropertyValue("CharColor") >>= aRunColor;
+if (aRunColor == COL_AUTO)
+
xRunPropSet->setPropertyValue("CharColor", xCharColor);
 }
 }
 }
diff --git a/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx 
b/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx
new file mode 100644
index ..f1c8e527df96
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 0f0af36ec7c7..4feae4b5d864 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -862,6 +862,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104348_contextMargin, 
"tdf104348_contextMargin.d
 CPPUNIT_ASSERT_EQUAL(nMargin, getProperty(getParagraph(2), 
"ParaBottomMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf152310, "ColorOverwritten.docx")
+{
+uno::Reference xShape(getShape(1), uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(Color(0xFF),
+ getProperty(getParagraphOfText(1, xShape), 
"CharColor"));
+CPPUNIT_ASSERT_EQUAL(Color(0x00b050),
+ getProperty(getParagraphOfText(2, xShape), 
"CharColor"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa sw/source

2022-12-05 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/embedded_chart.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx   |   26 +++
 sw/source/core/layout/atrfrm.cxx |9 +++
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 57db9a4fdbee6db24b381f3ea48b3df089c555fc
Author: Tünde Tóth 
AuthorDate: Wed Nov 30 14:56:25 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 5 13:14:19 2022 +

tdf#126477 DOCX export: fix lost charts in embedded documents

The charts of the embedded documents were not exported.

Follow-up to commit a41cf57c1eb4cabe5afc1a45d6fe535dbb935217
"tdf#134987 convert DOCX to ODT: fix lost charts".

Change-Id: I20f1cdfa68687043d0822c4bbf59793a208e83d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143495
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/embedded_chart.odt 
b/sw/qa/extras/ooxmlexport/data/embedded_chart.odt
new file mode 100644
index ..820e9a3b2e76
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/embedded_chart.odt 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 79ea4323274d..5d6576a0d619 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -12,6 +12,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -212,6 +213,31 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152200)
 assertXPath(pXmlDoc, "//w:fldChar", 3); // no field characters elsewhere
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf126477)
+{
+loadAndReload("embedded_chart.odt");
+
+uno::Reference 
xTEOSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xAccess(xTEOSupplier->getEmbeddedObjects());
+uno::Sequence aSeq(xAccess->getElementNames());
+
+// Check number of embedded objects.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeq.getLength());
+
+uno::Reference 
xEOSupplier(xAccess->getByName(aSeq[0]),
+  
uno::UNO_QUERY);
+uno::Reference xObj(xEOSupplier->getEmbeddedObject());
+uno::Reference xTEOSupplier2(xObj, 
uno::UNO_QUERY);
+uno::Reference 
xAccess2(xTEOSupplier2->getEmbeddedObjects());
+uno::Sequence aSeq2(xAccess2->getElementNames());
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// i.e. the chart lost in the embedded document.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeq2.getLength());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index dac5a59e2ccb..ff0763aed532 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2800,7 +2800,14 @@ SdrObject* SwFrameFormat::FindRealSdrObject()
 std::pair const tmp(aNullPt, false);
 SwFlyFrame* pFly = static_cast(::GetFrameOfModify( 
nullptr, *this, SwFrameType::Fly,
 nullptr, ));
-return pFly ? pFly->GetVirtDrawObj() : nullptr;
+if( pFly )
+return pFly->GetVirtDrawObj();
+
+if( !GetDoc() || !GetDoc()->GetDocShell() ||
+GetDoc()->GetDocShell()->GetCreateMode() != 
SfxObjectCreateMode::EMBEDDED )
+return nullptr;
+
+// tdf#126477 fix lost charts in embedded documents
 }
 return FindSdrObject();
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - include/oox oox/source sd/source sw/qa sw/source

2022-11-30 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx|5 +--
 oox/source/export/drawingml.cxx |   31 +++-
 sd/source/filter/eppt/pptx-epptooxml.cxx|1 
 sw/qa/extras/ooxmlexport/data/artistic_effects.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx  |   20 
 sw/source/filter/ww8/docxexport.cxx |1 
 6 files changed, 40 insertions(+), 18 deletions(-)

New commits:
commit 08489a539c10963b0b735740f658de2159638adc
Author: Tünde Tóth 
AuthorDate: Thu Nov 24 15:30:37 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Nov 30 11:05:09 2022 +0100

tdf#152152 DOCX export: fix lost WDP images in artistic effects

Handling of WDP image counter was incorrect if the
document contains embedded documents, overwriting
WDP images with the other ones.

See also commit 55b1d635350cb76ee3e19e90c938eedd38ac3342
"tdf#152153 DOCX export: fix lost images at embedded documents"
and commit cf2dc247ff5f726238856e9b46a4926a30430e14
"DOCX export: image deduplication and clean up"
and commit b5f6a5cfc517ecd8aa6ba96471d854b07b92ebaa
"ooxml: Do not repeat wdp files in artistic effects".

Change-Id: Ia26784519f6d514ee8c90c7a91a367feeba140b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143235
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 01246f06cfeeb6a1070e82351e2559def4f5d820)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143443
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index e4ba170300d6..8b57523a5c98 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -143,8 +143,8 @@ class OOX_DLLPUBLIC DrawingML
 
 private:
 static std::stack mnImageCounter;
-static int mnWdpImageCounter;
-static std::map maWdpCache;
+static std::stack mnWdpImageCounter;
+static std::stack> maWdpCache;
 static sal_Int32 mnDrawingMLCount;
 static sal_Int32 mnVmlCount;
 static std::stack> 
maExportGraphics;
@@ -347,7 +347,6 @@ public:
 static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape 
>& rXShape );
 sal_Int32 getBulletMarginIndentation (const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view 
propName);
 
-static void ResetCounters();
 static void ResetMlCounters();
 
 static void PushExportGraphics();
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index de5c8e6bc299..85207b7c713d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -236,8 +236,8 @@ void WriteGradientPath(const awt::Gradient& rGradient, 
const FSHelperPtr& pFS, c
 
 // not thread safe
 std::stack DrawingML::mnImageCounter;
-int DrawingML::mnWdpImageCounter = 1;
-std::map DrawingML::maWdpCache;
+std::stack DrawingML::mnWdpImageCounter;
+std::stack> DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
 std::stack> 
DrawingML::maExportGraphics;
@@ -266,12 +266,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 return css::i18n::ScriptType::LATIN;
 }
 
-void DrawingML::ResetCounters()
-{
-mnWdpImageCounter = 1;
-maWdpCache.clear();
-}
-
 void DrawingML::ResetMlCounters()
 {
 mnDrawingMLCount = 0;
@@ -282,12 +276,18 @@ void DrawingML::PushExportGraphics()
 {
 mnImageCounter.push(1);
 maExportGraphics.emplace();
+
+mnWdpImageCounter.push(1);
+maWdpCache.emplace();
 }
 
 void DrawingML::PopExportGraphics()
 {
 mnImageCounter.pop();
 maExportGraphics.pop();
+
+mnWdpImageCounter.pop();
+maWdpCache.pop();
 }
 
 bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, 
const OUString& aName )
@@ -5749,11 +5749,14 @@ void DrawingML::WriteArtisticEffect( const Reference< 
XPropertySet >& rXPropSet
 
 OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< 
sal_Int8 >& rPictureData )
 {
-std::map::iterator aCachedItem = maWdpCache.find( 
rFileId );
-if( aCachedItem != maWdpCache.end() )
-return OUStringToOString( aCachedItem->second, RTL_TEXTENCODING_UTF8 );
+if (!maWdpCache.empty())
+{
+std::map::iterator aCachedItem = 
maWdpCache.top().find(rFileId);
+if (aCachedItem != maWdpCache.top().end())
+return OUStringToOString(aCachedItem->second, 
RTL_TEXTENCODING_UTF8);
+}
 
-OUString sFileName = "media/hdphoto" + OUString::number( 
mnWdpImageCounter++ ) + ".wdp";
+OUString sFileName = "media/hdphoto" + OUString::number( 
mnWdpImageCounter.top()++ ) + ".wdp";
 Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( 
OUStringBuffer()
   
.appendAscii( GetComponentDir() )
 

[Libreoffice-commits] core.git: include/oox oox/source sd/source sw/qa sw/source

2022-11-29 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx|5 +--
 oox/source/export/drawingml.cxx |   31 +++-
 sd/source/filter/eppt/pptx-epptooxml.cxx|1 
 sw/qa/extras/ooxmlexport/data/artistic_effects.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx  |   20 
 sw/source/filter/ww8/docxexport.cxx |1 
 6 files changed, 40 insertions(+), 18 deletions(-)

New commits:
commit 01246f06cfeeb6a1070e82351e2559def4f5d820
Author: Tünde Tóth 
AuthorDate: Thu Nov 24 15:30:37 2022 +0100
Commit: László Németh 
CommitDate: Tue Nov 29 17:37:28 2022 +0100

tdf#152152 DOCX export: fix lost WDP images in artistic effects

Handling of WDP image counter was incorrect if the
document contains embedded documents, overwriting
WDP images with the other ones.

See also commit 55b1d635350cb76ee3e19e90c938eedd38ac3342
"tdf#152153 DOCX export: fix lost images at embedded documents"
and commit cf2dc247ff5f726238856e9b46a4926a30430e14
"DOCX export: image deduplication and clean up"
and commit b5f6a5cfc517ecd8aa6ba96471d854b07b92ebaa
"ooxml: Do not repeat wdp files in artistic effects".

Change-Id: Ia26784519f6d514ee8c90c7a91a367feeba140b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143235
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 543fb072921f..eb0fea23b95c 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -144,8 +144,8 @@ class OOX_DLLPUBLIC DrawingML
 
 private:
 static std::stack mnImageCounter;
-static int mnWdpImageCounter;
-static std::map maWdpCache;
+static std::stack mnWdpImageCounter;
+static std::stack> maWdpCache;
 static sal_Int32 mnDrawingMLCount;
 static sal_Int32 mnVmlCount;
 static std::stack> 
maExportGraphics;
@@ -348,7 +348,6 @@ public:
 static bool IsGroupShape( const css::uno::Reference< css::drawing::XShape 
>& rXShape );
 sal_Int32 getBulletMarginIndentation (const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view 
propName);
 
-static void ResetCounters();
 static void ResetMlCounters();
 
 static void PushExportGraphics();
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1da6391412fc..3418a125fac5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -237,8 +237,8 @@ void WriteGradientPath(const awt::Gradient& rGradient, 
const FSHelperPtr& pFS, c
 
 // not thread safe
 std::stack DrawingML::mnImageCounter;
-int DrawingML::mnWdpImageCounter = 1;
-std::map DrawingML::maWdpCache;
+std::stack DrawingML::mnWdpImageCounter;
+std::stack> DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
 std::stack> 
DrawingML::maExportGraphics;
@@ -267,12 +267,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 return css::i18n::ScriptType::LATIN;
 }
 
-void DrawingML::ResetCounters()
-{
-mnWdpImageCounter = 1;
-maWdpCache.clear();
-}
-
 void DrawingML::ResetMlCounters()
 {
 mnDrawingMLCount = 0;
@@ -283,12 +277,18 @@ void DrawingML::PushExportGraphics()
 {
 mnImageCounter.push(1);
 maExportGraphics.emplace();
+
+mnWdpImageCounter.push(1);
+maWdpCache.emplace();
 }
 
 void DrawingML::PopExportGraphics()
 {
 mnImageCounter.pop();
 maExportGraphics.pop();
+
+mnWdpImageCounter.pop();
+maWdpCache.pop();
 }
 
 bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, 
const OUString& aName )
@@ -5864,11 +5864,14 @@ void DrawingML::WriteArtisticEffect( const Reference< 
XPropertySet >& rXPropSet
 
 OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< 
sal_Int8 >& rPictureData )
 {
-std::map::iterator aCachedItem = maWdpCache.find( 
rFileId );
-if( aCachedItem != maWdpCache.end() )
-return OUStringToOString( aCachedItem->second, RTL_TEXTENCODING_UTF8 );
+if (!maWdpCache.empty())
+{
+std::map::iterator aCachedItem = 
maWdpCache.top().find(rFileId);
+if (aCachedItem != maWdpCache.top().end())
+return OUStringToOString(aCachedItem->second, 
RTL_TEXTENCODING_UTF8);
+}
 
-OUString sFileName = "media/hdphoto" + OUString::number( 
mnWdpImageCounter++ ) + ".wdp";
+OUString sFileName = "media/hdphoto" + OUString::number( 
mnWdpImageCounter.top()++ ) + ".wdp";
 Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( 
OUStringBuffer()
   
.appendAscii( GetComponentDir() )
   .append( 
"/" + sFileName )
@@ -5884,7 +5887,9 @@ OString DrawingML::WriteWdpPicture( const OUString& 
rFileId, const Sequence< sal
  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - include/oox oox/source sw/qa

2022-11-25 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx  |2 +-
 oox/source/export/drawingml.cxx   |   13 +++--
 sw/qa/extras/ooxmlexport/data/embedded_images.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|   20 
 4 files changed, 28 insertions(+), 7 deletions(-)

New commits:
commit 6a39bc2668e8f0f8f953ee5f605083eb182db970
Author: Tünde Tóth 
AuthorDate: Mon Nov 21 11:30:16 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 12:01:15 2022 +0100

tdf#152153 DOCX export: fix lost images at embedded documents

Handling of image counter was incorrect if the
document contains embedded documents, overwriting
images with the other ones.

See also commit cf2dc247ff5f726238856e9b46a4926a30430e14
"DOCX export: image deduplication and clean up" and
 commit 3f6df3835fec71ea61894f9a3bbfe5e4a06a5495
"DOCX export: fix image counters for multiple documents".

Change-Id: I3ce3e370f96fa8b9feca3bc73f06ddca933215d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143036
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 55b1d635350cb76ee3e19e90c938eedd38ac3342)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143256
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 674457b3c6e4..9f28a5891306 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -142,7 +142,7 @@ class OOX_DLLPUBLIC DrawingML
 {
 
 private:
-static int mnImageCounter;
+static std::stack mnImageCounter;
 static int mnWdpImageCounter;
 static std::map maWdpCache;
 static sal_Int32 mnDrawingMLCount;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5df185983ea8..ea44c4237ff0 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -234,7 +234,7 @@ void WriteGradientPath(const awt::Gradient& rGradient, 
const FSHelperPtr& pFS, c
 }
 
 // not thread safe
-int DrawingML::mnImageCounter = 1;
+std::stack DrawingML::mnImageCounter;
 int DrawingML::mnWdpImageCounter = 1;
 std::map DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
@@ -267,7 +267,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 
 void DrawingML::ResetCounters()
 {
-mnImageCounter = 1;
 mnWdpImageCounter = 1;
 maWdpCache.clear();
 }
@@ -280,11 +279,13 @@ void DrawingML::ResetMlCounters()
 
 void DrawingML::PushExportGraphics()
 {
+mnImageCounter.push(1);
 maExportGraphics.emplace();
 }
 
 void DrawingML::PopExportGraphics()
 {
+mnImageCounter.pop();
 maExportGraphics.pop();
 }
 
@@ -1393,7 +1394,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 Reference xOutStream = mpFB->openFragmentStream(
 OUStringBuffer()
 .appendAscii(GetComponentDir())
-.append("/media/image" + OUString::number(mnImageCounter))
+.append("/media/image" + 
OUString::number(mnImageCounter.top()))
 .appendAscii(pExtension)
 .makeStringAndClear(),
 sMediaType);
@@ -1409,7 +1410,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 sPath = OUStringBuffer()
 .appendAscii(sRelationCompPrefix.getStr())
 .appendAscii(sRelPathToMedia.getStr())
-.append(static_cast(mnImageCounter++))
+.append(static_cast(mnImageCounter.top()++))
 .appendAscii(pExtension)
 .makeStringAndClear();
 
@@ -1488,7 +1489,7 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::Reference xOutStream = 
mpFB->openFragmentStream(OUStringBuffer()

.appendAscii(GetComponentDir())

.append("/media/media" +
-
OUString::number(mnImageCounter) +
+
OUString::number(mnImageCounter.top()) +
 
aExtension)

.makeStringAndClear(),

aMimeType);
@@ -1500,7 +1501,7 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::ReferenceaddRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), aPath);
 aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), aPath);
diff --git a/sw/qa/extras/ooxmlexport/data/embedded_images.odt 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2022-11-23 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx  |2 +-
 oox/source/export/drawingml.cxx   |   13 +++--
 sw/qa/extras/ooxmlexport/data/embedded_images.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx|   20 
 4 files changed, 28 insertions(+), 7 deletions(-)

New commits:
commit 55b1d635350cb76ee3e19e90c938eedd38ac3342
Author: Tünde Tóth 
AuthorDate: Mon Nov 21 11:30:16 2022 +0100
Commit: László Németh 
CommitDate: Wed Nov 23 17:48:37 2022 +0100

tdf#152153 DOCX export: fix lost images at embedded documents

Handling of image counter was incorrect if the
document contains embedded documents, overwriting
images with the other ones.

See also commit cf2dc247ff5f726238856e9b46a4926a30430e14
"DOCX export: image deduplication and clean up" and
 commit 3f6df3835fec71ea61894f9a3bbfe5e4a06a5495
"DOCX export: fix image counters for multiple documents".

Change-Id: I3ce3e370f96fa8b9feca3bc73f06ddca933215d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143036
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 3f74f124d767..bf2ed44bca70 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -143,7 +143,7 @@ class OOX_DLLPUBLIC DrawingML
 {
 
 private:
-static int mnImageCounter;
+static std::stack mnImageCounter;
 static int mnWdpImageCounter;
 static std::map maWdpCache;
 static sal_Int32 mnDrawingMLCount;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index f7bf0ffdb6fe..16affd23295b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -235,7 +235,7 @@ void WriteGradientPath(const awt::Gradient& rGradient, 
const FSHelperPtr& pFS, c
 }
 
 // not thread safe
-int DrawingML::mnImageCounter = 1;
+std::stack DrawingML::mnImageCounter;
 int DrawingML::mnWdpImageCounter = 1;
 std::map DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
@@ -268,7 +268,6 @@ sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 
 void DrawingML::ResetCounters()
 {
-mnImageCounter = 1;
 mnWdpImageCounter = 1;
 maWdpCache.clear();
 }
@@ -281,11 +280,13 @@ void DrawingML::ResetMlCounters()
 
 void DrawingML::PushExportGraphics()
 {
+mnImageCounter.push(1);
 maExportGraphics.emplace();
 }
 
 void DrawingML::PopExportGraphics()
 {
+mnImageCounter.pop();
 maExportGraphics.pop();
 }
 
@@ -1394,7 +1395,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 Reference xOutStream = mpFB->openFragmentStream(
 OUStringBuffer()
 .appendAscii(GetComponentDir())
-.append("/media/image" + OUString::number(mnImageCounter))
+.append("/media/image" + 
OUString::number(mnImageCounter.top()))
 .appendAscii(pExtension)
 .makeStringAndClear(),
 sMediaType);
@@ -1410,7 +1411,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia )
 sPath = OUStringBuffer()
 .appendAscii(sRelationCompPrefix.getStr())
 .appendAscii(sRelPathToMedia.getStr())
-.append(static_cast(mnImageCounter++))
+.append(static_cast(mnImageCounter.top()++))
 .appendAscii(pExtension)
 .makeStringAndClear();
 
@@ -1489,7 +1490,7 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::Reference xOutStream = 
mpFB->openFragmentStream(OUStringBuffer()

.appendAscii(GetComponentDir())

.append("/media/media" +
-
OUString::number(mnImageCounter) +
+
OUString::number(mnImageCounter.top()) +
 
aExtension)

.makeStringAndClear(),

aMimeType);
@@ -1501,7 +1502,7 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::ReferenceaddRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), aPath);
 aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), aPath);
diff --git a/sw/qa/extras/ooxmlexport/data/embedded_images.odt 
b/sw/qa/extras/ooxmlexport/data/embedded_images.odt
new file mode 100644
index ..26166fac349b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/embedded_images.odt 
differ
diff --git 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sd/source

2022-11-02 Thread Tünde Tóth (via logerrit)
 sd/source/ui/view/drviews5.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit d9b73c3579cb6a16bb82c0e0e1643ae0893c52e5
Author: Tünde Tóth 
AuthorDate: Wed Oct 19 13:07:42 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Nov 2 11:00:44 2022 +0100

tdf#151621 sd UI: use correct zoom in embedded PPTX

Embedded PPTX object opened at 3000% zoom in a new window.

Change-Id: I7b353b607a1cef84eceaac5fbff96f2fbeb18500
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141528
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 6e378b5beee473edc54c50550eff9e7d9eec57b5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142143
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 9c00365be2c2..3eb9f39c376f 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -82,9 +82,11 @@ void DrawViewShell::Resize()
 {
 ViewShell::Resize();
 
-if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
+// tdf#151621 Do not set if the embedded object is opening in a new window.
+if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
+&& GetDocSh()->IsInPlaceActive())
 {
-SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
+SetZoomRect(GetDocSh()->GetVisArea(ASPECT_CONTENT));
 }
 
 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( 
GetViewShellBase() ) );
@@ -545,7 +547,9 @@ void DrawViewShell::ReadUserDataSequence ( const 
css::uno::Sequence < css::beans
 {
 const ::tools::Rectangle aVisArea( mpFrameView->GetVisArea() );
 
-if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
+// tdf#151621 Do not set if the embedded object is opening in a new 
window.
+if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
+&& GetDocSh()->IsInPlaceActive())
 {
 GetDocSh()->SetVisArea(aVisArea);
 }


[Libreoffice-commits] core.git: oox/source sd/qa

2022-11-02 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx   |7 +++
 sd/qa/unit/data/odp/ole_icon.odp   |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   19 +++
 3 files changed, 26 insertions(+)

New commits:
commit ea62cacd129f03813d7d3d214bf9aa2ae60bbef4
Author: Tünde Tóth 
AuthorDate: Tue Oct 18 16:20:43 2022 +0200
Commit: László Németh 
CommitDate: Wed Nov 2 08:03:40 2022 +0100

tdf#151622 PPTX: fix export of show as icon option

Embedded OLE object wasn't look like an icon after its opening
because of missing showAsIcon="1" of p:oleObj.

Change-Id: I21dbd1e31f7e1de78d8bf548ca6f3619eb3e4a10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141505
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d102880af7bd..541f54a0fdb8 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2591,6 +2592,10 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 TOOLS_WARN_EXCEPTION("oox.shape", "ShapeExport::WriteOLEObject");
 }
 
+sal_Int64 nAspect;
+bool bShowAsIcon = (xPropSet->getPropertyValue("Aspect") >>= nAspect)
+   && nAspect == embed::Aspects::MSOLE_ICON;
+
 OUString const sRelId = mpFB->addRelation(
 mpFS->getOutputStream(), sRelationType,
 Concat2View(OUString::createFromAscii(GetRelationCompPrefix()) + 
sFileName));
@@ -2617,6 +2622,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 if (pProgID)
 {
 mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
+  XML_showAsIcon, sax_fastparser::UseIf("1", 
bShowAsIcon),
   XML_progId, pProgID,
   FSNS(XML_r, XML_id), sRelId,
   XML_spid, "" );
@@ -2625,6 +2631,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const 
Reference< XShape >& xShape )
 {
 mpFS->startElementNS( mnXmlNamespace, XML_oleObj,
 //?  XML_name, "Document",
+  XML_showAsIcon, sax_fastparser::UseIf("1", 
bShowAsIcon),
   FSNS(XML_r, XML_id), sRelId,
   // The spec says that this is a required attribute, 
but PowerPoint can only handle an empty value.
   XML_spid, "" );
diff --git a/sd/qa/unit/data/odp/ole_icon.odp b/sd/qa/unit/data/odp/ole_icon.odp
new file mode 100644
index ..073899c6e564
Binary files /dev/null and b/sd/qa/unit/data/odp/ole_icon.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index a4e5d882d8e6..93c8a3ac908e 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -129,6 +129,7 @@ public:
 void testTdf94122_autoColor();
 void testTdf124333();
 void testAutofittedTextboxIndent();
+void testTdf151622_oleIcon();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -218,6 +219,7 @@ public:
 CPPUNIT_TEST(testTdf94122_autoColor);
 CPPUNIT_TEST(testTdf124333);
 CPPUNIT_TEST(testAutofittedTextboxIndent);
+CPPUNIT_TEST(testTdf151622_oleIcon);
 CPPUNIT_TEST_SUITE_END();
 
 virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -2071,6 +2073,23 @@ void SdOOXMLExportTest3::testAutofittedTextboxIndent()
 "691200");
 }
 
+void SdOOXMLExportTest3::testTdf151622_oleIcon()
+{
+auto xDocShRef = 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/ole_icon.odp"), ODP);
+
+utl::TempFileNamed tmpfile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXml = parseExport(tmpfile, "ppt/slides/slide1.xml");
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expression: prop
+// - In ..., XPath '//p:oleObj' no attribute 'showAsIcon' exist
+// i.e. show as icon option wasn't exported.
+assertXPath(pXml, "//p:oleObj", "showAsIcon", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-01 Thread Tünde Tóth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit a04ed691ea3f4891c98e7dde0344d461cb9def18
Author: Tünde Tóth 
AuthorDate: Mon Oct 24 13:52:27 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 2 03:02:18 2022 +0100

tdf#151384 DOCX export: lost hyperlink format in localized UI

Fix losing color and underline of hyperlinks in localized
builds, at least with Russian UI.

Regression from commit d57b4480903f700ad7c95e885b9dd0ace5883cfc
"tdf#127579 DOCX export: fix losing color and underline of ODT hyperlinks".

Change-Id: I1eebcf58a7071226e80df3f84ed1264c5a8baf31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141761
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 2dfd9e3e00f6e57ab1b307cf57c01a0830da4b17)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142134
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8020576cfcab..f62fb4440929 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8527,9 +8527,13 @@ void DocxAttributeOutput::CharHighlight( const 
SvxBrushItem& rHighlight )
 
 void DocxAttributeOutput::TextINetFormat( const SwFormatINetFormat& rLink )
 {
-OString aStyleId = MSWordStyles::CreateStyleId(rLink.GetINetFormat());
-if (!aStyleId.isEmpty() && !aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
-m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+const SwCharFormat* pFormat = 
m_rExport.m_rDoc.FindCharFormatByName(rLink.GetINetFormat());
+if (pFormat)
+{
+OString 
aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pFormat)));
+if (!aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
+m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+}
 }
 
 void DocxAttributeOutput::TextCharFormat( const SwFormatCharFormat& 
rCharFormat )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - oox/qa oox/source sd/qa

2022-11-01 Thread Tünde Tóth (via logerrit)
 oox/qa/unit/vml.cxx  |   15 +--
 oox/source/drawingml/graphicshapecontext.cxx |3 ++-
 oox/source/drawingml/shape.cxx   |   17 +
 sd/qa/unit/data/pptx/ole.pptx|binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   21 +
 5 files changed, 45 insertions(+), 11 deletions(-)

New commits:
commit 7f91933023a844f53b498439fb0e2752d46b01d5
Author: Tünde Tóth 
AuthorDate: Tue Sep 13 10:29:03 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Nov 1 11:13:34 2022 +0100

tdf#124333 PPTX import: fix Z-order of embedded OLE objects

Choose mc:Choice in a:graphicData element
if the selected p:oleObj element has a shape id
to avoid of shape duplication which created also
bad layout/overlapping because of the different Z-order
of the duplicated shape.

Change-Id: Idecff4903c2d637bc82353f13352cac72413cec1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140041
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/+/141938
Tested-by: Jenkins

diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index 9dcaaef83cc4..61730c744220 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -192,18 +192,13 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke)
 uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
  uno::UNO_QUERY);
 
-uno::Reference xShape;
-for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i)
-{
-uno::Reference xInfo(xDrawPage->getByIndex(i), 
uno::UNO_QUERY);
-if (!xInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
-{
-continue;
-}
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
 
+uno::Reference xShape;
+uno::Reference xInfo(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+if (xInfo->supportsService("com.sun.star.drawing.OLE2Shape"))
 xShape.set(xInfo, uno::UNO_QUERY);
-break;
-}
+
 CPPUNIT_ASSERT(xShape.is());
 
 drawing::LineStyle eLineStyle{};
diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index d90980a87824..2e5ce5dc47a8 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -256,7 +256,8 @@ void OleObjectGraphicDataContext::onEndElement()
 {
 if( getCurrentElement() == PPT_TOKEN( oleObj ) && !isMCEStateEmpty() )
 {
-if( getMCEState() == MCE_STATE::FoundChoice && 
!mrOleObjectInfo.mbHasPicture )
+if (getMCEState() == MCE_STATE::FoundChoice && 
!mrOleObjectInfo.mbHasPicture
+&& mrOleObjectInfo.maShapeId.isEmpty())
 setMCEState( MCE_STATE::Started );
 }
 }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 50bc2f8bc9c4..12b3303054e4 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1860,6 +1860,23 @@ Reference< XShape > const & Shape::createAndInsert(
 propertySet->setPropertyValue(
 "SoftEdgeRadius", 
Any(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.get(;
 }
+
+// Set the stroke and fill-color properties of the OLE shape
+if (aServiceName == "com.sun.star.drawing.OLE2Shape" && mxOleObjectInfo
+&& !mxOleObjectInfo->maShapeId.isEmpty())
+if (::oox::vml::Drawing* pVmlDrawing = rFilterBase.getVmlDrawing())
+if (const ::oox::vml::ShapeBase* pVmlShape
+= 
pVmlDrawing->getShapes().getShapeById(mxOleObjectInfo->maShapeId))
+{
+// Apply stroke props from the type model of the related 
VML shape.
+ShapePropertyMap 
aPropMap(rFilterBase.getModelObjectHelper());
+pVmlShape->getTypeModel().maStrokeModel.pushToPropMap(
+aPropMap, rFilterBase.getGraphicHelper());
+// And, fill-color properties as well...
+pVmlShape->getTypeModel().maFillModel.pushToPropMap(
+aPropMap, rFilterBase.getGraphicHelper());
+PropertySet(xSet).setProperties(aPropMap);
+}
 }
 
 if (mxShape.is())
diff --git a/sd/qa/unit/data/pptx/ole.pptx b/sd/qa/unit/data/pptx/ole.pptx
new file mode 100644
index ..b998e79e0d66
Binary files /dev/null and b/sd/qa/unit/data/pptx/ole.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 45453f8e2b42..499491d084f9 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -119,6 +119,7 @@ public:
 void testTdf109169_DiamondBevel();
 void testTdf144092_emptyShapeTextProps();
 void testTdf94122_autoColor();
+   

[Libreoffice-commits] core.git: sd/source

2022-10-27 Thread Tünde Tóth (via logerrit)
 sd/source/ui/view/drviews5.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 6e378b5beee473edc54c50550eff9e7d9eec57b5
Author: Tünde Tóth 
AuthorDate: Wed Oct 19 13:07:42 2022 +0200
Commit: László Németh 
CommitDate: Thu Oct 27 20:05:02 2022 +0200

tdf#151621 sd UI: use correct zoom in embedded PPTX

Embedded PPTX object opened at 3000% zoom in a new window.

Change-Id: I7b353b607a1cef84eceaac5fbff96f2fbeb18500
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141528
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 9c00365be2c2..3eb9f39c376f 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -82,9 +82,11 @@ void DrawViewShell::Resize()
 {
 ViewShell::Resize();
 
-if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
+// tdf#151621 Do not set if the embedded object is opening in a new window.
+if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
+&& GetDocSh()->IsInPlaceActive())
 {
-SetZoomRect( GetDocSh()->GetVisArea(ASPECT_CONTENT) );
+SetZoomRect(GetDocSh()->GetVisArea(ASPECT_CONTENT));
 }
 
 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( 
GetViewShellBase() ) );
@@ -545,7 +547,9 @@ void DrawViewShell::ReadUserDataSequence ( const 
css::uno::Sequence < css::beans
 {
 const ::tools::Rectangle aVisArea( mpFrameView->GetVisArea() );
 
-if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
+// tdf#151621 Do not set if the embedded object is opening in a new 
window.
+if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
+&& GetDocSh()->IsInPlaceActive())
 {
 GetDocSh()->SetVisArea(aVisArea);
 }


[Libreoffice-commits] core.git: sw/source

2022-10-27 Thread Tünde Tóth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 2dfd9e3e00f6e57ab1b307cf57c01a0830da4b17
Author: Tünde Tóth 
AuthorDate: Mon Oct 24 13:52:27 2022 +0200
Commit: László Németh 
CommitDate: Thu Oct 27 18:09:33 2022 +0200

tdf#151384 DOCX export: lost hyperlink format in localized UI

Fix losing color and underline of hyperlinks in localized
builds, at least with Russian UI.

Regression from commit d57b4480903f700ad7c95e885b9dd0ace5883cfc
"tdf#127579 DOCX export: fix losing color and underline of ODT hyperlinks".

Change-Id: I1eebcf58a7071226e80df3f84ed1264c5a8baf31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141761
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f6c8ff6902b9..dd6210566bfa 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8589,9 +8589,13 @@ void DocxAttributeOutput::CharHighlight( const 
SvxBrushItem& rHighlight )
 
 void DocxAttributeOutput::TextINetFormat( const SwFormatINetFormat& rLink )
 {
-OString aStyleId = MSWordStyles::CreateStyleId(rLink.GetINetFormat());
-if (!aStyleId.isEmpty() && !aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
-m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+const SwCharFormat* pFormat = 
m_rExport.m_rDoc.FindCharFormatByName(rLink.GetINetFormat());
+if (pFormat)
+{
+OString 
aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pFormat)));
+if (!aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
+m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+}
 }
 
 void DocxAttributeOutput::TextCharFormat( const SwFormatCharFormat& 
rCharFormat )


[Libreoffice-commits] core.git: oox/qa oox/source sd/qa

2022-09-28 Thread Tünde Tóth (via logerrit)
 oox/qa/unit/vml.cxx  |   15 +--
 oox/source/drawingml/graphicshapecontext.cxx |3 ++-
 oox/source/drawingml/shape.cxx   |   17 +
 sd/qa/unit/data/pptx/ole.pptx|binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   21 +
 5 files changed, 45 insertions(+), 11 deletions(-)

New commits:
commit adc042f95d3dbd65b778260025d59283146916e5
Author: Tünde Tóth 
AuthorDate: Tue Sep 13 10:29:03 2022 +0200
Commit: László Németh 
CommitDate: Wed Sep 28 14:16:50 2022 +0200

tdf#124333 PPTX import: fix Z-order of embedded OLE objects

Choose mc:Choice in a:graphicData element
if the selected p:oleObj element has a shape id
to avoid of shape duplication which created also
bad layout/overlapping because of the different Z-order
of the duplicated shape.

Change-Id: Idecff4903c2d637bc82353f13352cac72413cec1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140041
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index 9dcaaef83cc4..61730c744220 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -192,18 +192,13 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke)
 uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
  uno::UNO_QUERY);
 
-uno::Reference xShape;
-for (sal_Int32 i = 0; i < xDrawPage->getCount(); ++i)
-{
-uno::Reference xInfo(xDrawPage->getByIndex(i), 
uno::UNO_QUERY);
-if (!xInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
-{
-continue;
-}
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
 
+uno::Reference xShape;
+uno::Reference xInfo(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+if (xInfo->supportsService("com.sun.star.drawing.OLE2Shape"))
 xShape.set(xInfo, uno::UNO_QUERY);
-break;
-}
+
 CPPUNIT_ASSERT(xShape.is());
 
 drawing::LineStyle eLineStyle{};
diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index 6e4379c2e1ed..0f96d0a92d63 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -256,7 +256,8 @@ void OleObjectGraphicDataContext::onEndElement()
 {
 if( getCurrentElement() == PPT_TOKEN( oleObj ) && !isMCEStateEmpty() )
 {
-if( getMCEState() == MCE_STATE::FoundChoice && 
!mrOleObjectInfo.mbHasPicture )
+if (getMCEState() == MCE_STATE::FoundChoice && 
!mrOleObjectInfo.mbHasPicture
+&& mrOleObjectInfo.maShapeId.isEmpty())
 setMCEState( MCE_STATE::Started );
 }
 }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 2a46f93a440e..0369f5ff732c 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1868,6 +1868,23 @@ Reference< XShape > const & Shape::createAndInsert(
 propertySet->setPropertyValue(
 "SoftEdgeRadius", 
Any(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.value(;
 }
+
+// Set the stroke and fill-color properties of the OLE shape
+if (aServiceName == "com.sun.star.drawing.OLE2Shape" && mxOleObjectInfo
+&& !mxOleObjectInfo->maShapeId.isEmpty())
+if (::oox::vml::Drawing* pVmlDrawing = rFilterBase.getVmlDrawing())
+if (const ::oox::vml::ShapeBase* pVmlShape
+= 
pVmlDrawing->getShapes().getShapeById(mxOleObjectInfo->maShapeId))
+{
+// Apply stroke props from the type model of the related 
VML shape.
+ShapePropertyMap 
aPropMap(rFilterBase.getModelObjectHelper());
+pVmlShape->getTypeModel().maStrokeModel.pushToPropMap(
+aPropMap, rFilterBase.getGraphicHelper());
+// And, fill-color properties as well...
+pVmlShape->getTypeModel().maFillModel.pushToPropMap(
+aPropMap, rFilterBase.getGraphicHelper());
+PropertySet(xSet).setProperties(aPropMap);
+}
 }
 
 if (mxShape.is())
diff --git a/sd/qa/unit/data/pptx/ole.pptx b/sd/qa/unit/data/pptx/ole.pptx
new file mode 100644
index ..b998e79e0d66
Binary files /dev/null and b/sd/qa/unit/data/pptx/ole.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index c12a1f0ec4bd..e2ef6928104f 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -122,6 +122,7 @@ public:
 void testTdf149551_tbrl90();
 void testTdf149551_btlr();
 void testTdf94122_autoColor();
+void testTdf124333();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -209,6 +210,7 @@ public:
 

[Libreoffice-commits] core.git: chart2/qa chart2/source

2022-08-18 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2import2.cxx|   18 ++
 chart2/qa/extras/data/xlsx/tdf150434.xlsx |binary
 chart2/source/view/main/VLegend.cxx   |8 
 3 files changed, 26 insertions(+)

New commits:
commit e59db22b3b57c9e1a5678218cb56fb75bcc84c26
Author: Tünde Tóth 
AuthorDate: Wed Jul 27 08:58:35 2022 +0200
Commit: László Németh 
CommitDate: Thu Aug 18 13:39:31 2022 +0200

tdf#150434: chart2, XLSX import: strip long legend labels

Full text of legend labels could overflow the chart area,
if the legend text was too long. If it's longer than
520 characters, strip it at the first space from the
500th character (or if there is no space, at the 500th
character). This results better XLSX interoperability, too.

Change-Id: I23a94f6baaf620b40e9b2819738eba5c5a921722
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137492
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/chart2/qa/extras/chart2import2.cxx 
b/chart2/qa/extras/chart2import2.cxx
index ee41c37dd48a..eb983f7687f1 100644
--- a/chart2/qa/extras/chart2import2.cxx
+++ b/chart2/qa/extras/chart2import2.cxx
@@ -60,6 +60,7 @@ public:
 void testTdf121281();
 void testTdf139658();
 void testTdf146066();
+void testTdf150434();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest2);
 
@@ -101,6 +102,7 @@ public:
 CPPUNIT_TEST(testTdf121281);
 CPPUNIT_TEST(testTdf139658);
 CPPUNIT_TEST(testTdf146066);
+CPPUNIT_TEST(testTdf150434);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -930,6 +932,22 @@ void Chart2ImportTest2::testTdf146066()
 CPPUNIT_ASSERT_EQUAL(OUString("35"), xLabel7->getString());
 }
 
+void Chart2ImportTest2::testTdf150434()
+{
+load(u"/chart2/qa/extras/data/xlsx/", u"tdf150434.xlsx");
+Reference xChartDoc(getChartDocFromSheet(0, 
mxComponent),
+   UNO_QUERY_THROW);
+Reference xDrawPageSupplier(xChartDoc, 
UNO_QUERY_THROW);
+Reference xDrawPage(xDrawPageSupplier->getDrawPage(), 
UNO_SET_THROW);
+Reference xShapes(xDrawPage->getByIndex(0), 
UNO_QUERY_THROW);
+Reference xLegend = getShapeByName(xShapes, 
"CID/D=0:Legend=");
+CPPUNIT_ASSERT(xLegend.is());
+awt::Point aPosition = xLegend->getPosition();
+
+// This failed, if the legend flowed out of the chart area.
+CPPUNIT_ASSERT_GREATEREQUAL(static_cast(0), aPosition.Y);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf150434.xlsx 
b/chart2/qa/extras/data/xlsx/tdf150434.xlsx
new file mode 100644
index ..309a0c4c25f7
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf150434.xlsx differ
diff --git a/chart2/source/view/main/VLegend.cxx 
b/chart2/source/view/main/VLegend.cxx
index 7fc92b491ad2..e789baf62a62 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -167,6 +167,14 @@ awt::Size lcl_createTextShapes(
 if( i == 1 )
 break;
 
+// tdf#150034 limit legend label text
+if (aLabelSeq[i]->getString().getLength() > 520)
+{
+sal_Int32 nIndex = aLabelSeq[i]->getString().indexOf(' ', 
500);
+aLabelSeq[i]->setString(
+aLabelSeq[i]->getString().copy(0, nIndex > 500 ? 
nIndex : 500));
+}
+
 aLabelString += aLabelSeq[i]->getString();
 // workaround for Issue #i67540#
 if( aLabelString.isEmpty())


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa writerfilter/source

2022-08-03 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/odfexport/data/table_number_format_3.docx |binary
 sw/qa/extras/odfexport/odfexport2.cxx  |   17 +
 writerfilter/source/dmapper/DomainMapper_Impl.hxx  |4 +---
 3 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 7e93946fc5252a2437f05400dba02dd5bf5140c5
Author: Tünde Tóth 
AuthorDate: Wed Jul 6 14:12:54 2022 +0200
Commit: Michael Stahl 
CommitDate: Wed Aug 3 12:29:38 2022 +0200

tdf#120972 DOCX: fix import of decimal tabulators

Use locale specific decimal separator for decimal tabulators,
because OOXML does not support custom decimal separator.

Regression from commit c0b6aadedc9429eee4f4df85957e00e29ccb0c8f
"(related: fdo#81033) writerfilter: default tab fill character is space".

Change-Id: I9d89e5817707f3b39a1b718b732f6e289f7c6a99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136846
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit c4e3b76d99e0d32f55aacc3ddffcc68c107cc4db)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137601
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/odfexport/data/table_number_format_3.docx 
b/sw/qa/extras/odfexport/data/table_number_format_3.docx
new file mode 100644
index ..1bb423e455df
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/table_number_format_3.docx differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index c128d7be52d1..dc4762314c32 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -211,6 +212,22 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleLink)
 CPPUNIT_ASSERT_EQUAL(OUString("List Paragraph Char"), 
getProperty(aParaStyle, "LinkStyle"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, tdf120972)
+{
+loadAndReload("table_number_format_3.docx");
+
+xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+OUString cDecimal(SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]);
+assertXPath(
+pXmlDoc,
+
"//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/style:tab-stop",
+"char", cDecimal);
+assertXPath(
+pXmlDoc,
+
"//style:style[@style:name='P2']/style:paragraph-properties/style:tab-stops/style:tab-stop",
+"char", cDecimal);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 4072a646840b..f6b88fec09b3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -289,9 +289,7 @@ struct DeletableTabStop : public css::style::TabStop
 explicit DeletableTabStop()
 : bDeleted(false)
 {
-// same defaults as SvxXMLTabStopContext_Impl
-FillChar = ' ';
-DecimalChar = ',';
+FillChar = ' ';// same default as SvxXMLTabStopContext_Impl
 }
 DeletableTabStop(const css::style::TabStop& rTabStop)
 : TabStop(rTabStop),


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/qa sw/source

2022-07-23 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf139128.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   12 
 sw/source/filter/ww8/docxattributeoutput.cxx |2 ++
 3 files changed, 14 insertions(+)

New commits:
commit 14c4c6c1d764142a0f0ca8c02ccd2028d378e21e
Author: Tünde Tóth 
AuthorDate: Tue Jul 12 11:50:35 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Jul 23 14:07:38 2022 +0200

tdf#139128 DOCX: fix export of line break in text frames

Line breaks (text:line-break) of ODF text frames
(draw:text-box) were lost during DOCX export.

Change-Id: I2e1149234749437ceef0d4643b0e686d5ae92156
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136998
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 024d75681887dd33561917cb3ff6b213924fd59d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137327
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf139128.odt 
b/sw/qa/extras/ooxmlexport/data/tdf139128.odt
new file mode 100644
index ..544527c069a2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139128.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 74ff724dbbd3..9ab04a6aa8c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1050,6 +1050,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149089, "tdf149089.docx")
 CPPUNIT_ASSERT_EQUAL( sal_Int16(text::TextGridMode::LINES), nGridMode);   
// was LINES_AND_CHARS
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf139128)
+{
+loadAndReload("tdf139128.odt");
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(pXmlDoc);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 0
+// i.e. the line break was lost on export.
+assertXPath(pXmlDoc, "//w:br", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index a3a91a77827e..28e32a50929d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -150,6 +150,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3394,6 +3395,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
 prevUnicode = *pIt;
 break;
 case 0x0b: // line break
+case static_cast(text::ControlCharacter::LINE_BREAK):
 {
 if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || prevUnicode < 0x0020)
 {


[Libreoffice-commits] core.git: sw/qa sw/source

2022-07-22 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf139128.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   12 
 sw/source/filter/ww8/docxattributeoutput.cxx |2 ++
 3 files changed, 14 insertions(+)

New commits:
commit b7a294af40521d71e6583dad2908e09f3758649c
Author: Tünde Tóth 
AuthorDate: Tue Jul 12 11:50:35 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 22 12:49:32 2022 +0200

tdf#139128 DOCX: fix export of line break in text frames

Line breaks (text:line-break) of ODF text frames
(draw:text-box) were lost during DOCX export.

Change-Id: I2e1149234749437ceef0d4643b0e686d5ae92156
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136998
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf139128.odt 
b/sw/qa/extras/ooxmlexport/data/tdf139128.odt
new file mode 100644
index ..544527c069a2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139128.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 038dca7cc92b..f139837b822a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1077,6 +1077,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149089, "tdf149089.docx")
 CPPUNIT_ASSERT_EQUAL( sal_Int16(text::TextGridMode::LINES), nGridMode);   
// was LINES_AND_CHARS
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf139128)
+{
+loadAndReload("tdf139128.odt");
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(pXmlDoc);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 0
+// i.e. the line break was lost on export.
+assertXPath(pXmlDoc, "//w:br", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 28097d40c411..abbe2f8bb06f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -150,6 +150,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3396,6 +3397,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
 prevUnicode = *pIt;
 break;
 case 0x0b: // line break
+case static_cast(text::ControlCharacter::LINE_BREAK):
 {
 if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || prevUnicode < 0x0020)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-08 Thread Tünde Tóth (via logerrit)
 sw/source/core/unocore/unocrsrhelper.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 2b53b81a660899312d94479ad37d522b9f029c30
Author: Tünde Tóth 
AuthorDate: Wed Jun 29 13:22:59 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 8 12:07:37 2022 +0200

tdf#149747 DOCX import: use UI style name for tracked changes

instead of the programmatic style name, because rejection
of tracked paragraph style changes was incorrect
with an other UI than English UI.

Follow-up to commit 0ad5d133bd75ccd3a04505aaac7ad3f2f9105f76
"tdf#132781 DOCX: export interoperable hyperlink style names"
and commit 4248d759744f83a68d334a8b347124719a2886a8
"tdf#126243 DOCX: export/reject tracked paragraph style change".

Change-Id: I3b3b163b2538732b2470162888083de0609895fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136624
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 28dc21cc05adf62a8fe637d1e82ab885c1159478)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136869
Tested-by: Jenkins

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 04b93de0d003..b176138a0d2a 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1342,7 +1342,7 @@ void makeRedline( SwPaM const & rPaM,
 if (!aWhichPairs.empty())
 {
 sal_uInt16 nStylePoolId = USHRT_MAX;
-OUString sParaStyleName;
+OUString sParaStyleName, sUIStyle;
 SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs);
 
 for (size_t i = 0; i < aEntries.size(); ++i)
@@ -1374,7 +1374,11 @@ void makeRedline( SwPaM const & rPaM,
 if (eType == RedlineType::ParagraphFormat && 
sParaStyleName.isEmpty())
 nStylePoolId = RES_POOLCOLL_STANDARD;
 
-xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( 
sParaStyleName, nStylePoolId,  ));
+// tdf#149747 Get UI style name from programmatic style name
+SwStyleNameMapper::FillUIName(sParaStyleName, sUIStyle,
+  SwGetPoolIdFromName::TxtColl);
+xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl(
+sUIStyle.isEmpty() ? sParaStyleName : sUIStyle, 
nStylePoolId, ));
 }
 else if (eType == RedlineType::ParagraphFormat)
 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", 
RES_POOLCOLL_STANDARD, nullptr ));


[Libreoffice-commits] core.git: sw/source

2022-07-08 Thread Tünde Tóth (via logerrit)
 sw/source/core/unocore/unocrsrhelper.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 93c83aa91cc7608bfdb6972ad024697f1bc85f98
Author: Tünde Tóth 
AuthorDate: Wed Jun 29 13:22:59 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 8 10:15:08 2022 +0200

tdf#149747 DOCX import: use UI style name for tracked changes

instead of the programmatic style name, because rejection
of tracked paragraph style changes was incorrect
with an other UI than English UI.

Follow-up to commit 0ad5d133bd75ccd3a04505aaac7ad3f2f9105f76
"tdf#132781 DOCX: export interoperable hyperlink style names"
and commit 4248d759744f83a68d334a8b347124719a2886a8
"tdf#126243 DOCX: export/reject tracked paragraph style change".

Change-Id: I3b3b163b2538732b2470162888083de0609895fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136624
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 04b93de0d003..b176138a0d2a 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1342,7 +1342,7 @@ void makeRedline( SwPaM const & rPaM,
 if (!aWhichPairs.empty())
 {
 sal_uInt16 nStylePoolId = USHRT_MAX;
-OUString sParaStyleName;
+OUString sParaStyleName, sUIStyle;
 SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs);
 
 for (size_t i = 0; i < aEntries.size(); ++i)
@@ -1374,7 +1374,11 @@ void makeRedline( SwPaM const & rPaM,
 if (eType == RedlineType::ParagraphFormat && 
sParaStyleName.isEmpty())
 nStylePoolId = RES_POOLCOLL_STANDARD;
 
-xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( 
sParaStyleName, nStylePoolId,  ));
+// tdf#149747 Get UI style name from programmatic style name
+SwStyleNameMapper::FillUIName(sParaStyleName, sUIStyle,
+  SwGetPoolIdFromName::TxtColl);
+xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl(
+sUIStyle.isEmpty() ? sParaStyleName : sUIStyle, 
nStylePoolId, ));
 }
 else if (eType == RedlineType::ParagraphFormat)
 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", 
RES_POOLCOLL_STANDARD, nullptr ));


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-01 Thread Tünde Tóth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |6 +-
 sw/source/filter/ww8/styles.cxx  |2 +-
 sw/source/filter/ww8/wrtw8sty.cxx|8 
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 0538861f641578149c4de84862b4acd574737908
Author: Tünde Tóth 
AuthorDate: Fri Jun 17 10:56:27 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jul 1 11:45:08 2022 +0200

tdf#132781 DOCX: export interoperable hyperlink style names

Similar to the paragraph styles, export default character
style names instead of the localized ones to avoid e.g. not
interoperable hyperlinks in MSO.

Change-Id: I65678a564ae4e73a1d8319df364defd698381256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136139
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit e53984f798dc4730a5fb348d2b44ab85812c7fc0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136385
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 769f120e97a8..3923f0ac7b63 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6977,7 +6977,11 @@ void DocxAttributeOutput::StartStyle( const OUString& 
rName, StyleType eType,
 if ( nWwId < ww::stiMax)
 pEnglishName = ww::GetEnglishNameFromSti( 
static_cast(nWwId ) );
 break;
-case STYLE_TYPE_CHAR: pType = "character"; break;
+case STYLE_TYPE_CHAR:
+pType = "character";
+if (nWwId < ww::stiMax)
+pEnglishName = 
ww::GetEnglishNameFromSti(static_cast(nWwId));
+break;
 case STYLE_TYPE_LIST: pType = "numbering"; break;
 }
 pStyleAttributeList->add(FSNS( XML_w, XML_type ), pType);
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index 6f613b40fad6..86ec89a37798 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -113,7 +113,7 @@ namespace
 "Body Text Indent 3",
 "Block Text",
 "Hyperlink",
-"Followed Hyperlink",
+"FollowedHyperlink",
 "Strong",
 "Emphasis",
 "Document Map",
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 54a8a23f61e5..3175894c26a6 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -646,14 +646,6 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, 
sal_uInt16 nPos )
 // tdf#92335 don't export redundant DOCX import style "ListLabel"
 return;
 }
-else if (aName.equalsIgnoreAsciiCase("Internet Link"))
-{
-aName = "Hyperlink";
-}
-else if (aName.equalsIgnoreAsciiCase("Visited Internet Link"))
-{
-aName = "FollowedHyperlink";
-}
 
 m_rExport.AttrOutput().StartStyle( aName, (bFormatColl ? 
STYLE_TYPE_PARA : STYLE_TYPE_CHAR),
 nBase, nWwNext, nWwLink, GetWWId( *pFormat ), nPos,


[Libreoffice-commits] core.git: sw/source

2022-06-24 Thread Tünde Tóth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |6 +-
 sw/source/filter/ww8/styles.cxx  |2 +-
 sw/source/filter/ww8/wrtw8sty.cxx|8 
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 0ad5d133bd75ccd3a04505aaac7ad3f2f9105f76
Author: Tünde Tóth 
AuthorDate: Fri Jun 17 10:56:27 2022 +0200
Commit: László Németh 
CommitDate: Fri Jun 24 12:43:21 2022 +0200

tdf#132781 DOCX: export interoperable hyperlink style names

Similar to the paragraph styles, export default character
style names instead of the localized ones to avoid e.g. not
interoperable hyperlinks in MSO.

Change-Id: I65678a564ae4e73a1d8319df364defd698381256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136139
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 769f120e97a8..3923f0ac7b63 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6977,7 +6977,11 @@ void DocxAttributeOutput::StartStyle( const OUString& 
rName, StyleType eType,
 if ( nWwId < ww::stiMax)
 pEnglishName = ww::GetEnglishNameFromSti( 
static_cast(nWwId ) );
 break;
-case STYLE_TYPE_CHAR: pType = "character"; break;
+case STYLE_TYPE_CHAR:
+pType = "character";
+if (nWwId < ww::stiMax)
+pEnglishName = 
ww::GetEnglishNameFromSti(static_cast(nWwId));
+break;
 case STYLE_TYPE_LIST: pType = "numbering"; break;
 }
 pStyleAttributeList->add(FSNS( XML_w, XML_type ), pType);
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index 6f613b40fad6..86ec89a37798 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -113,7 +113,7 @@ namespace
 "Body Text Indent 3",
 "Block Text",
 "Hyperlink",
-"Followed Hyperlink",
+"FollowedHyperlink",
 "Strong",
 "Emphasis",
 "Document Map",
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 54a8a23f61e5..3175894c26a6 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -646,14 +646,6 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, 
sal_uInt16 nPos )
 // tdf#92335 don't export redundant DOCX import style "ListLabel"
 return;
 }
-else if (aName.equalsIgnoreAsciiCase("Internet Link"))
-{
-aName = "Hyperlink";
-}
-else if (aName.equalsIgnoreAsciiCase("Visited Internet Link"))
-{
-aName = "FollowedHyperlink";
-}
 
 m_rExport.AttrOutput().StartStyle( aName, (bFormatColl ? 
STYLE_TYPE_PARA : STYLE_TYPE_CHAR),
 nBase, nWwNext, nWwLink, GetWWId( *pFormat ), nPos,


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - cui/source include/svtools svtools/source svtools/uiconfig

2022-06-24 Thread Tünde Tóth (via logerrit)
 cui/source/options/optsave.cxx   |   16 +---
 include/svtools/restartdialog.hxx|3 +++
 svtools/source/dialogs/restartdialog.cxx |3 +++
 svtools/uiconfig/ui/restartdialog.ui |   19 +--
 4 files changed, 36 insertions(+), 5 deletions(-)

New commits:
commit 5766b29e49aa8cf15dc7a7b97a4347d74ba735ce
Author: Tünde Tóth 
AuthorDate: Tue May 31 16:11:03 2022 +0200
Commit: László Németh 
CommitDate: Fri Jun 24 12:04:38 2022 +0200

tdf#149401 show "Restart LibreOffice" dialog changing AutoRecovery

Changing "Save Autorecovery... information every ... minutes"
option in Tools->Options...->Load/Save->General shows that
dialog window to warn about its work.

Change-Id: I91ae72ea1e52ec5c6d9286a43cd986386636076c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135221
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 98cb1a3110848f7c974414ec3a4d24b4715a2626)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136327
Tested-by: Jenkins

diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 717fa623a668..43468715cd3a 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include "optsave.hxx"
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -225,7 +227,7 @@ void SvxSaveTabPage::DetectHiddenControls()
 bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
 auto xChanges = comphelper::ConfigurationChanges::create();
-bool bModified = false;
+bool bModified = false, bRequestRestart = false;
 if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
 
officecfg::Office::Common::Load::UserDefinedSettings::set(m_xLoadUserSettingsCB->get_active(),
 xChanges);
 
@@ -255,7 +257,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
 rSet->Put( SfxBoolItem( SID_ATTR_AUTOSAVE,
m_xAutoSaveCB->get_active() ) );
-bModified = true;
+bModified = bRequestRestart = true;
 }
 if ( m_xWarnAlienFormatCB->get_state_changed_from_saved() )
 {
@@ -268,7 +270,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
 rSet->Put( SfxUInt16Item( SID_ATTR_AUTOSAVEMINUTE,
  
static_cast(m_xAutoSaveEdit->get_value()) ) );
-bModified = true;
+bModified = bRequestRestart = true;
 }
 
 if ( m_xUserAutoSaveCB->get_state_changed_from_saved() )
@@ -322,6 +324,14 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 
aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL, 
pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
 
 xChanges->commit();
+
+if (bRequestRestart)
+{
+OfaTreeOptionsDialog* 
pParentDlg(static_cast(GetDialogController()));
+if (pParentDlg)
+pParentDlg->SetNeedsRestart(svtools::RESTART_REASON_SAVE);
+}
+
 return bModified;
 }
 
diff --git a/include/svtools/restartdialog.hxx 
b/include/svtools/restartdialog.hxx
index 95ca3ef4356d..001f322772a5 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -65,6 +65,9 @@ enum RestartReason {
 // For restructuring the Form menu,
 // %PRODUCTNAME must be restarted:
 RESTART_REASON_MSCOMPATIBLE_FORMS_MENU,
+// For the modified save settings to take effect,
+// %PRODUCTNAME must be restarted:
+RESTART_REASON_SAVE,
 // To apply changes, %PRODUCTNAME,
 // %PRODUCTNAME must be restarted:
 RESTART_REASON_UI_CHANGE,
diff --git a/svtools/source/dialogs/restartdialog.cxx 
b/svtools/source/dialogs/restartdialog.cxx
index ba5c7d2a3304..30954f17638b 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -71,6 +71,9 @@ public:
 case svtools::RESTART_REASON_MSCOMPATIBLE_FORMS_MENU:
 reason_ = m_xBuilder->weld_widget("reason_mscompatible_formsmenu");
 break;
+case svtools::RESTART_REASON_SAVE:
+reason_ = m_xBuilder->weld_widget("reason_save");
+break;
 case svtools::RESTART_REASON_UI_CHANGE:
 reason_ = m_xBuilder->weld_widget("reason_uichange");
 break;
diff --git a/svtools/uiconfig/ui/restartdialog.ui 
b/svtools/uiconfig/ui/restartdialog.ui
index c49218c03bc8..9772c1659ad7 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -273,6 +273,21 @@
 13
   
 
+
+  
+False
+True
+For the modified save settings to take 
effect, %PRODUCTNAME must be restarted.
+True
+50
+0
+  
+  
+False
+ 

[Libreoffice-commits] core.git: cui/source include/svtools svtools/source svtools/uiconfig

2022-06-23 Thread Tünde Tóth (via logerrit)
 cui/source/options/optsave.cxx   |   16 +---
 include/svtools/restartdialog.hxx|3 +++
 svtools/source/dialogs/restartdialog.cxx |3 +++
 svtools/uiconfig/ui/restartdialog.ui |   19 +--
 4 files changed, 36 insertions(+), 5 deletions(-)

New commits:
commit 18cc891483fef63ad168273658a30bff72b87a95
Author: Tünde Tóth 
AuthorDate: Tue May 31 16:11:03 2022 +0200
Commit: László Németh 
CommitDate: Thu Jun 23 17:07:00 2022 +0200

tdf#149401 show "Restart LibreOffice" dialog changing AutoRecovery

Changing "Save Autorecovery... information every ... minutes"
option in Tools->Options...->Load/Save->General shows that
dialog window to warn about its work.

Change-Id: I91ae72ea1e52ec5c6d9286a43cd986386636076c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135221
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 717fa623a668..43468715cd3a 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include "optsave.hxx"
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -225,7 +227,7 @@ void SvxSaveTabPage::DetectHiddenControls()
 bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
 auto xChanges = comphelper::ConfigurationChanges::create();
-bool bModified = false;
+bool bModified = false, bRequestRestart = false;
 if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
 
officecfg::Office::Common::Load::UserDefinedSettings::set(m_xLoadUserSettingsCB->get_active(),
 xChanges);
 
@@ -255,7 +257,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
 rSet->Put( SfxBoolItem( SID_ATTR_AUTOSAVE,
m_xAutoSaveCB->get_active() ) );
-bModified = true;
+bModified = bRequestRestart = true;
 }
 if ( m_xWarnAlienFormatCB->get_state_changed_from_saved() )
 {
@@ -268,7 +270,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
 rSet->Put( SfxUInt16Item( SID_ATTR_AUTOSAVEMINUTE,
  
static_cast(m_xAutoSaveEdit->get_value()) ) );
-bModified = true;
+bModified = bRequestRestart = true;
 }
 
 if ( m_xUserAutoSaveCB->get_state_changed_from_saved() )
@@ -322,6 +324,14 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 
aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL, 
pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
 
 xChanges->commit();
+
+if (bRequestRestart)
+{
+OfaTreeOptionsDialog* 
pParentDlg(static_cast(GetDialogController()));
+if (pParentDlg)
+pParentDlg->SetNeedsRestart(svtools::RESTART_REASON_SAVE);
+}
+
 return bModified;
 }
 
diff --git a/include/svtools/restartdialog.hxx 
b/include/svtools/restartdialog.hxx
index 95ca3ef4356d..001f322772a5 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -65,6 +65,9 @@ enum RestartReason {
 // For restructuring the Form menu,
 // %PRODUCTNAME must be restarted:
 RESTART_REASON_MSCOMPATIBLE_FORMS_MENU,
+// For the modified save settings to take effect,
+// %PRODUCTNAME must be restarted:
+RESTART_REASON_SAVE,
 // To apply changes, %PRODUCTNAME,
 // %PRODUCTNAME must be restarted:
 RESTART_REASON_UI_CHANGE,
diff --git a/svtools/source/dialogs/restartdialog.cxx 
b/svtools/source/dialogs/restartdialog.cxx
index ba5c7d2a3304..30954f17638b 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -71,6 +71,9 @@ public:
 case svtools::RESTART_REASON_MSCOMPATIBLE_FORMS_MENU:
 reason_ = m_xBuilder->weld_widget("reason_mscompatible_formsmenu");
 break;
+case svtools::RESTART_REASON_SAVE:
+reason_ = m_xBuilder->weld_widget("reason_save");
+break;
 case svtools::RESTART_REASON_UI_CHANGE:
 reason_ = m_xBuilder->weld_widget("reason_uichange");
 break;
diff --git a/svtools/uiconfig/ui/restartdialog.ui 
b/svtools/uiconfig/ui/restartdialog.ui
index c49218c03bc8..9772c1659ad7 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -273,6 +273,21 @@
 13
   
 
+
+  
+False
+True
+For the modified save settings to take 
effect, %PRODUCTNAME must be restarted.
+True
+50
+0
+  
+  
+False
+True
+14
+  
+
 
   
 True
@@ -284,7 +299,7 @@
   
  

[Libreoffice-commits] core.git: framework/source

2022-05-23 Thread Tünde Tóth (via logerrit)
 framework/source/services/autorecovery.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit aeb8a0076cd5ec2836b3dfc1adffcced432f995f
Author: Tünde Tóth 
AuthorDate: Thu May 19 15:14:20 2022 +0200
Commit: László Németh 
CommitDate: Mon May 23 08:59:45 2022 +0200

tdf#149176 tdf#149178 fix Save autorecovery information.. option

Autorecovery information was saved in every 10 minutes,
regardless of the "Save Autorecovery information every" setting.

Change-Id: I1a52da2fa5febb53c270a8db7472e9a8c0e4c426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134642
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index ffc426a21d19..d4b68b11c994 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -96,6 +96,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1751,7 +1752,7 @@ void AutoRecovery::implts_readAutoSaveConfig()
 implts_openConfig();
 
 // AutoSave [bool]
-bool bEnabled(officecfg::Office::Recovery::AutoSave::Enabled::get());
+bool bEnabled(officecfg::Office::Common::Save::Document::AutoSave::get());
 
 /* SAFE */ {
 osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
@@ -1779,7 +1780,8 @@ void AutoRecovery::implts_readAutoSaveConfig()
 } /* SAFE */
 
 // AutoSaveTimeIntervall [int] in min
-sal_Int32 
nTimeIntervall(officecfg::Office::Recovery::AutoSave::TimeIntervall::get());
+sal_Int32 nTimeIntervall(
+
officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get());
 
 /* SAFE */ {
 osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - avmedia/source include/avmedia svx/source

2022-05-20 Thread Tünde Tóth (via logerrit)
 avmedia/source/viewer/mediawindow.cxx |8 ++--
 include/avmedia/mediawindow.hxx   |2 +-
 svx/source/svdraw/svdomedia.cxx   |4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 47b0a2935bf1b73647326cb1748b48cb0aeeeaa6
Author: Tünde Tóth 
AuthorDate: Mon May 16 11:37:57 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri May 20 12:08:35 2022 +0200

tdf#148923 PPTX import: fix incorrect image in media file

Linked media file was imported with incorrect image,
if the Impress couldn't play the media file.

Regression from commit 9564747d2fd5d2c859a359dd7fa6242c6859c0d7
(tdf#53970 PPTX: fix import of linked media files).

Change-Id: Ib277a61e83c3794376d2c090b7f742707e779832
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134394
Tested-by: Jenkins
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/+/134635

diff --git a/avmedia/source/viewer/mediawindow.cxx 
b/avmedia/source/viewer/mediawindow.cxx
index 4ff32f636eb6..0b1ca1b9c11a 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -352,10 +352,10 @@ uno::Reference< media::XPlayer > 
MediaWindow::createPlayer( const OUString& rURL
 return priv::MediaWindowImpl::createPlayer( rURL, rReferer, pMimeType );
 }
 
-
 uno::Reference< graphic::XGraphic > MediaWindow::grabFrame( const OUString& 
rURL,
 const OUString& 
rReferer,
-const OUString& 
sMimeType )
+const OUString& 
sMimeType,
+const 
uno::Reference& rGraphic)
 {
 uno::Reference< media::XPlayer >xPlayer( createPlayer( rURL, rReferer, 
 ) );
 uno::Reference< graphic::XGraphic > xRet;
@@ -394,7 +394,11 @@ uno::Reference< graphic::XGraphic > 
MediaWindow::grabFrame( const OUString& rURL
 }
 
 if (xGraphic)
+{
+if (rGraphic)
+xGraphic.reset(new Graphic(rGraphic));
 xRet = xGraphic->GetXGraphic();
+}
 
 return xRet;
 }
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index 78e0b1a299a3..328cad72aad8 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -103,7 +103,7 @@ namespace avmedia
 static css::uno::Reference< css::media::XPlayer > createPlayer( const 
OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr );
 
 static css::uno::Reference< css::graphic::XGraphic > grabFrame( const 
OUString& rURL, const OUString& rReferer,
-const OUString& sMimeType );
+const OUString& sMimeType, const 
css::uno::Reference& rGraphic = nullptr);
 
 private:
 MediaWindow(const MediaWindow&) = delete;
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 515bdff11b42..bc030c7d6d3f 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -146,7 +146,9 @@ uno::Reference< graphic::XGraphic > const & 
SdrMediaObj::getSnapshot() const
 OUString aRealURL = m_xImpl->m_MediaProperties.getTempURL();
 if( aRealURL.isEmpty() )
 aRealURL = m_xImpl->m_MediaProperties.getURL();
-m_xImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( 
aRealURL, m_xImpl->m_MediaProperties.getReferer(), 
m_xImpl->m_MediaProperties.getMimeType());
+uno::Reference xGraphic
+= m_xImpl->m_MediaProperties.getGraphic().GetXGraphic();
+m_xImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( 
aRealURL, m_xImpl->m_MediaProperties.getReferer(), 
m_xImpl->m_MediaProperties.getMimeType(), xGraphic);
 }
 #endif
 return m_xImpl->m_xCachedSnapshot;


[Libreoffice-commits] core.git: avmedia/source include/avmedia svx/source

2022-05-19 Thread Tünde Tóth (via logerrit)
 avmedia/source/viewer/mediawindow.cxx |8 +++-
 include/avmedia/mediawindow.hxx   |4 +++-
 svx/source/svdraw/svdomedia.cxx   |4 +++-
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit d4ab6a4693c0f3147b086173d5a9787f1f0eee34
Author: Tünde Tóth 
AuthorDate: Mon May 16 11:37:57 2022 +0200
Commit: László Németh 
CommitDate: Thu May 19 10:26:01 2022 +0200

tdf#148923 PPTX import: fix incorrect image in media file

Linked media file was imported with incorrect image,
if the Impress couldn't play the media file.

Regression from commit 9564747d2fd5d2c859a359dd7fa6242c6859c0d7
(tdf#53970 PPTX: fix import of linked media files).

Change-Id: Ib277a61e83c3794376d2c090b7f742707e779832
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134394
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/avmedia/source/viewer/mediawindow.cxx 
b/avmedia/source/viewer/mediawindow.cxx
index d6649a2d743c..c9b7f9bf20bb 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -363,7 +363,9 @@ uno::Reference< media::XPlayer > MediaWindow::createPlayer( 
const OUString& rURL
 return priv::MediaWindowImpl::createPlayer( rURL, rReferer, pMimeType );
 }
 
-uno::Reference< graphic::XGraphic > MediaWindow::grabFrame(const 
css::uno::Reference& xPlayer)
+uno::Reference
+MediaWindow::grabFrame(const uno::Reference& xPlayer,
+   const uno::Reference& rGraphic)
 {
 uno::Reference< graphic::XGraphic > xRet;
 std::unique_ptr< Graphic > xGraphic;
@@ -401,7 +403,11 @@ uno::Reference< graphic::XGraphic > 
MediaWindow::grabFrame(const css::uno::Refer
 }
 
 if (xGraphic)
+{
+if (rGraphic)
+xGraphic.reset(new Graphic(rGraphic));
 xRet = xGraphic->GetXGraphic();
+}
 
 return xRet;
 }
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index f398f7e56427..8f48ba58cb89 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -134,7 +134,9 @@ namespace avmedia
 
 static css::uno::Reference< css::media::XPlayer > createPlayer( const 
OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr );
 
-static css::uno::Reference grabFrame(const 
css::uno::Reference& rPlayer);
+static css::uno::Reference
+grabFrame(const css::uno::Reference& rPlayer,
+  const css::uno::Reference& rGraphic 
= nullptr);
 
 static css::uno::Reference< css::graphic::XGraphic > grabFrame(const 
OUString& rURL, const OUString& rReferer,
 const OUString& sMimeType, rtl::Reference 
xPreferredPixelSizeListener);
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 9e011a64ce80..8ab9d45a54c6 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -161,7 +161,9 @@ uno::Reference< graphic::XGraphic > const & 
SdrMediaObj::getSnapshot() const
 m_xImpl->m_xPlayerListener.set(new avmedia::PlayerListener(
 [this, xCachedSnapshot, aRealURL, sReferer, sMimeType](const 
css::uno::Reference& rPlayer){
 SolarMutexGuard g;
-m_xImpl->m_xCachedSnapshot = 
avmedia::MediaWindow::grabFrame(rPlayer);
+uno::Reference xGraphic
+= m_xImpl->m_MediaProperties.getGraphic().GetXGraphic();
+m_xImpl->m_xCachedSnapshot = 
avmedia::MediaWindow::grabFrame(rPlayer, xGraphic);
 ActionChanged();
 }));
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - 2 commits - hwpfilter/source oox/source sd/qa

2022-04-27 Thread Tünde Tóth (via logerrit)
 hwpfilter/source/hwpreader.cxx   |   12 +-
 oox/source/drawingml/fillproperties.cxx  |6 ++---
 oox/source/drawingml/graphicshapecontext.cxx |   32 ---
 sd/qa/unit/export-tests-ooxml2.cxx   |   19 +++-
 4 files changed, 51 insertions(+), 18 deletions(-)

New commits:
commit 4d26bb9e8fd25edb913ad5fb52bdbc56fad75291
Author: Tünde Tóth 
AuthorDate: Wed Apr 6 16:18:29 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Apr 27 10:49:22 2022 +0200

tdf#53970 PPTX: fix import of linked media files

Linked media files were imported as images in documents
created with Impress after PPTX export.

Change-Id: If4920c2e40f45fff73eca4a5fa987d524177597e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132635
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 9564747d2fd5d2c859a359dd7fa6242c6859c0d7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133410
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 2b682bcd1b99..e3830618522b 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -954,11 +954,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 rPropMap.setProperty(PROP_AdjustContrast, nContrast);
 
 // Media content
-assert(m_xMediaStream.is() != m_sMediaPackageURL.isEmpty());
-if (m_xMediaStream.is() && !m_sMediaPackageURL.isEmpty())
+if (!m_sMediaPackageURL.isEmpty())
 {
-rPropMap.setProperty(PROP_PrivateStream, m_xMediaStream);
 rPropMap.setProperty(PROP_MediaURL, m_sMediaPackageURL);
+if (m_xMediaStream.is())
+rPropMap.setProperty(PROP_PrivateStream, m_xMediaStream);
 }
 }
 
diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index 3ed00edfd28c..d90980a87824 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -84,10 +84,12 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( 
sal_Int32 aElementToken,
 case XML_wavAudioFile:
 {
 OUString const path(getEmbeddedWAVAudioFile(getRelations(), 
rAttribs));
-mpShapePtr->getGraphicProperties().m_xMediaStream =
-lcl_GetMediaStream(path, getFilter());
-mpShapePtr->getGraphicProperties().m_sMediaPackageURL =
-lcl_GetMediaReference(path);
+Reference xMediaStream = lcl_GetMediaStream(path, 
getFilter());
+if (xMediaStream.is())
+{
+mpShapePtr->getGraphicProperties().m_xMediaStream = 
xMediaStream;
+mpShapePtr->getGraphicProperties().m_sMediaPackageURL = 
lcl_GetMediaReference(path);
+}
 }
 break;
 case XML_audioFile:
@@ -95,10 +97,24 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( 
sal_Int32 aElementToken,
 {
 OUString rPath = getRelations().getFragmentPathFromRelId(
 rAttribs.getString(R_TOKEN(link)).get() );
-mpShapePtr->getGraphicProperties().m_xMediaStream =
-lcl_GetMediaStream(rPath, getFilter());
-mpShapePtr->getGraphicProperties().m_sMediaPackageURL =
-lcl_GetMediaReference(rPath);
+if (!rPath.isEmpty())
+{
+Reference xMediaStream = 
lcl_GetMediaStream(rPath, getFilter());
+if (xMediaStream.is()) // embedded media file
+{
+mpShapePtr->getGraphicProperties().m_xMediaStream = 
xMediaStream;
+mpShapePtr->getGraphicProperties().m_sMediaPackageURL
+= lcl_GetMediaReference(rPath);
+}
+}
+else
+{
+rPath = getRelations().getExternalTargetFromRelId(
+rAttribs.getString(R_TOKEN(link)).get());
+if (!rPath.isEmpty()) // linked media file
+mpShapePtr->getGraphicProperties().m_sMediaPackageURL
+= getFilter().getAbsoluteUrl(rPath);
+}
 }
 break;
 }
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index dc6498ec614d..0b244bc76233 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1832,11 +1832,28 @@ void SdOOXMLExportTest2::testTdf53970()
 
m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP);
 utl::TempFile tempFile;
 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
-xDocShRef->DoClose();
 
 xmlDocUniquePtr pXmlRels = parseExport(tempFile, 
"ppt/slides/_rels/slide1.xml.rels");
 CPPUNIT_ASSERT(pXmlRels);
   

[Libreoffice-commits] core.git: include/oox oox/source sw/source

2022-04-26 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx |8 --
 include/oox/export/vmlexport.hxx |4 -
 oox/source/export/drawingml.cxx  |   35 +-
 oox/source/export/vmlexport.cxx  |   20 --
 sw/source/filter/ww8/docxattributeoutput.cxx |   87 ---
 sw/source/filter/ww8/docxattributeoutput.hxx |   13 
 sw/source/filter/ww8/docxexport.cxx  |2 
 7 files changed, 13 insertions(+), 156 deletions(-)

New commits:
commit cf2dc247ff5f726238856e9b46a4926a30430e14
Author: Tünde Tóth 
AuthorDate: Mon Apr 4 11:49:59 2022 +0200
Commit: László Németh 
CommitDate: Tue Apr 26 18:07:40 2022 +0200

DOCX export: image deduplication and clean up

Follow-up to commit aea8043bc5f5187498fa450505d6de9d6986e2a6
"tdf#74670 tdf#91286 PPTX XLSX export: save image once".

This reverts commit 797fef38612fb2fd62d1f6591619b9361e526bca
"tdf#118535 DOCX export: save header image once"

and commit 32ada80a9f47b095d7b0c4d16e3422f6ef7f2ac2
"DOCX export: make sure a graphic is only written once"

and commit b484e9814c66d8d51cea974390963a6944bc9d73
"tdf#83227 oox: reuse RelId in DML/VML export for the same graphic".

Change-Id: I2d90249808174290b6b3e4eb957b3ac87ad41f95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132506
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 9a7f744520c8..43aba83b6531 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -130,12 +130,6 @@ public:
 virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
 /// Write the contents of the textbox that is associated to this shape.
 virtual void WriteTextBox(css::uno::Reference 
xShape) = 0;
-/// Look up the RelId of a graphic based on its checksum.
-virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
-/// Look up the filename of a graphic based on its checksum.
-virtual OUString FindFileName(BitmapChecksum nChecksum) = 0;
-/// Store the RelId and filename of a graphic based on its checksum.
-virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, 
const OUString& rFileName) = 0;
 ///  Get textbox which belongs to the shape.
 virtual css::uno::Reference GetUnoTextFrame(
 css::uno::Reference xShape) = 0;
@@ -224,7 +218,7 @@ public:
 
 void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
 /// If bRelPathToMedia is true add "../" to image folder path while adding 
the image relationship
-OUString WriteImage( const Graphic  , bool bRelPathToMedia = 
false, OUString* pFileName = nullptr );
+OUString WriteImage( const Graphic  , bool bRelPathToMedia = 
false );
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 5efdb34a90ff..fa54f27aa250 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -65,10 +65,6 @@ public:
 virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
 /// Write the contents of the textbox that is associated to this shape in 
VML format.
 virtual void WriteVMLTextBox(css::uno::Reference 
xShape) = 0;
-/// Look up the RelId of a graphic based on its checksum.
-virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
-/// Store the RelId and filename of a graphic based on its checksum.
-virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, 
const OUString& rFileName) = 0;
 protected:
 VMLTextExport() {}
 virtual ~VMLTextExport() {}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 78eac3d00f60..87ca05452513 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1271,7 +1271,7 @@ const char* DrawingML::GetRelationCompPrefix() const
 return "unknown";
 }
 
-OUString DrawingML::WriteImage( const Graphic& rGraphic , bool 
bRelPathToMedia, OUString* pFileName )
+OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia 
)
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
 BitmapChecksum aChecksum = rGraphic.GetChecksum();
@@ -1280,8 +1280,8 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , 
bool bRelPathToMedia,
 OUString sRelId;
 OUString sPath;
 
-// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX)
-if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty())
+// tdf#74670 tdf#91286 Save image only once
+if (!maExportGraphics.empty())
 {
 auto aIterator = maExportGraphics.top().find(aChecksum);
 if (aIterator != 

[Libreoffice-commits] core.git: oox/source sd/qa

2022-04-26 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx  |6 ++---
 oox/source/drawingml/graphicshapecontext.cxx |   32 ---
 sd/qa/unit/export-tests-ooxml2.cxx   |   19 +++-
 3 files changed, 45 insertions(+), 12 deletions(-)

New commits:
commit 9564747d2fd5d2c859a359dd7fa6242c6859c0d7
Author: Tünde Tóth 
AuthorDate: Wed Apr 6 16:18:29 2022 +0200
Commit: László Németh 
CommitDate: Tue Apr 26 17:41:27 2022 +0200

tdf#53970 PPTX: fix import of linked media files

Linked media files were imported as images in documents
created with Impress after PPTX export.

Change-Id: If4920c2e40f45fff73eca4a5fa987d524177597e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132635
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 9589a7388bd5..a6d5250f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -963,11 +963,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 rPropMap.setProperty(PROP_AdjustContrast, nContrast);
 
 // Media content
-assert(m_xMediaStream.is() != m_sMediaPackageURL.isEmpty());
-if (m_xMediaStream.is() && !m_sMediaPackageURL.isEmpty())
+if (!m_sMediaPackageURL.isEmpty())
 {
-rPropMap.setProperty(PROP_PrivateStream, m_xMediaStream);
 rPropMap.setProperty(PROP_MediaURL, m_sMediaPackageURL);
+if (m_xMediaStream.is())
+rPropMap.setProperty(PROP_PrivateStream, m_xMediaStream);
 }
 }
 
diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index 3ed00edfd28c..d90980a87824 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -84,10 +84,12 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( 
sal_Int32 aElementToken,
 case XML_wavAudioFile:
 {
 OUString const path(getEmbeddedWAVAudioFile(getRelations(), 
rAttribs));
-mpShapePtr->getGraphicProperties().m_xMediaStream =
-lcl_GetMediaStream(path, getFilter());
-mpShapePtr->getGraphicProperties().m_sMediaPackageURL =
-lcl_GetMediaReference(path);
+Reference xMediaStream = lcl_GetMediaStream(path, 
getFilter());
+if (xMediaStream.is())
+{
+mpShapePtr->getGraphicProperties().m_xMediaStream = 
xMediaStream;
+mpShapePtr->getGraphicProperties().m_sMediaPackageURL = 
lcl_GetMediaReference(path);
+}
 }
 break;
 case XML_audioFile:
@@ -95,10 +97,24 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( 
sal_Int32 aElementToken,
 {
 OUString rPath = getRelations().getFragmentPathFromRelId(
 rAttribs.getString(R_TOKEN(link)).get() );
-mpShapePtr->getGraphicProperties().m_xMediaStream =
-lcl_GetMediaStream(rPath, getFilter());
-mpShapePtr->getGraphicProperties().m_sMediaPackageURL =
-lcl_GetMediaReference(rPath);
+if (!rPath.isEmpty())
+{
+Reference xMediaStream = 
lcl_GetMediaStream(rPath, getFilter());
+if (xMediaStream.is()) // embedded media file
+{
+mpShapePtr->getGraphicProperties().m_xMediaStream = 
xMediaStream;
+mpShapePtr->getGraphicProperties().m_sMediaPackageURL
+= lcl_GetMediaReference(rPath);
+}
+}
+else
+{
+rPath = getRelations().getExternalTargetFromRelId(
+rAttribs.getString(R_TOKEN(link)).get());
+if (!rPath.isEmpty()) // linked media file
+mpShapePtr->getGraphicProperties().m_sMediaPackageURL
+= getFilter().getAbsoluteUrl(rPath);
+}
 }
 break;
 }
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 8ad1872d2c52..56ff8b067763 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1823,11 +1823,28 @@ void SdOOXMLExportTest2::testTdf53970()
 
m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP);
 utl::TempFile tempFile;
 xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
-xDocShRef->DoClose();
 
 xmlDocUniquePtr pXmlRels = parseExport(tempFile, 
"ppt/slides/_rels/slide1.xml.rels");
 CPPUNIT_ASSERT(pXmlRels);
 assertXPath(pXmlRels, 
"/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);
+
+uno::Reference xShape(getShape(0, getPage(0, 
xDocShRef)));
+CPPUNIT_ASSERT(xShape.is());
+OUString 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa

2022-04-04 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx |4 ++--
 sd/qa/unit/data/odp/tdf53970_linked.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   27 +--
 3 files changed, 23 insertions(+), 8 deletions(-)

New commits:
commit 85adc43540f75f2e3ce51fb438e5efd777a5b8f7
Author: Tünde Tóth 
AuthorDate: Thu Mar 31 13:11:04 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Apr 4 17:05:04 2022 +0200

tdf#53970 PPTX: fix broken export of linked media files

Missing TargetMode="External" in the export of
linked media files resulted corrupted PPTX.

Change-Id: I76246db331d199810a5b413d44bec95283e88e47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132402
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit c2e8a96a8107a37901e475c65a8e61211fc3b132)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132383
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 4d0317be921d..d4dbef899b96 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1378,8 +1378,8 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::ReferenceaddRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), rURL);
-aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), rURL);
+aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), rURL, true);
+aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), rURL, true);
 }
 
 GetFS()->startElementNS(XML_p, XML_nvPr);
diff --git a/sd/qa/unit/data/odp/tdf53970_linked.odp 
b/sd/qa/unit/data/odp/tdf53970_linked.odp
new file mode 100644
index ..3ddb7933463f
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf53970_linked.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 6afe97292ea8..dc6498ec614d 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1814,15 +1814,30 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
 
 void SdOOXMLExportTest2::testTdf53970()
 {
-::sd::DrawDocShellRef xDocShRef
-= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
-xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+// Embedded media file
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
 
+// Without fix in place, the media shape was lost on export.
+CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
 
-// Without fix in place, the media shape was lost on export.
-CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
+xDocShRef->DoClose();
+}
 
-xDocShRef->DoClose();
+// Linked media file
+{
+::sd::DrawDocShellRef xDocShRef = loadURL(
+
m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlRels = parseExport(tempFile, 
"ppt/slides/_rels/slide1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+assertXPath(pXmlRels, 
"/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);
+}
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);


[Libreoffice-commits] core.git: oox/source sd/qa

2022-04-04 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx |4 ++--
 sd/qa/unit/data/odp/tdf53970_linked.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   27 +--
 3 files changed, 23 insertions(+), 8 deletions(-)

New commits:
commit c2e8a96a8107a37901e475c65a8e61211fc3b132
Author: Tünde Tóth 
AuthorDate: Thu Mar 31 13:11:04 2022 +0200
Commit: László Németh 
CommitDate: Mon Apr 4 13:01:08 2022 +0200

tdf#53970 PPTX: fix broken export of linked media files

Missing TargetMode="External" in the export of
linked media files resulted corrupted PPTX.

Change-Id: I76246db331d199810a5b413d44bec95283e88e47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132402
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 a99a0474a458..54f94278d782 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1490,8 +1490,8 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::ReferenceaddRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), rURL);
-aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), rURL);
+aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(eMediaType), rURL, true);
+aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), 
oox::getRelationship(Relationship::MEDIA), rURL, true);
 }
 
 GetFS()->startElementNS(XML_p, XML_nvPr);
diff --git a/sd/qa/unit/data/odp/tdf53970_linked.odp 
b/sd/qa/unit/data/odp/tdf53970_linked.odp
new file mode 100644
index ..3ddb7933463f
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf53970_linked.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index a620386ad22d..5fac35ea1833 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1804,15 +1804,30 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
 
 void SdOOXMLExportTest2::testTdf53970()
 {
-::sd::DrawDocShellRef xDocShRef
-= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
-xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+// Embedded media file
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
 
+// Without fix in place, the media shape was lost on export.
+CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
 
-// Without fix in place, the media shape was lost on export.
-CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
+xDocShRef->DoClose();
+}
 
-xDocShRef->DoClose();
+// Linked media file
+{
+::sd::DrawDocShellRef xDocShRef = loadURL(
+
m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlRels = parseExport(tempFile, 
"ppt/slides/_rels/slide1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+assertXPath(pXmlRels, 
"/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);
+}
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sd/qa

2022-03-30 Thread Tünde Tóth (via logerrit)
 sd/qa/unit/export-tests-ooxml2.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit a45cfefc284b2e468ca2847e47102964c67d12c4
Author: Tünde Tóth 
AuthorDate: Wed Mar 30 09:52:57 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Mar 30 20:47:25 2022 +0200

tdf#53970 PPTX: add unittest

Change-Id: I1bcf8f79213245fdf135d6d3b2aafea6ed99f5b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132296
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: Xisco Fauli 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132320

diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 78f43f2160eb..6afe97292ea8 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -152,6 +152,7 @@ public:
 void testTextColumns_tdf140852();
 void testTextColumns_3columns();
 void testTdf59323_slideFooters();
+void testTdf53970();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -218,6 +219,7 @@ public:
 CPPUNIT_TEST(testTextColumns_tdf140852);
 CPPUNIT_TEST(testTextColumns_3columns);
 CPPUNIT_TEST(testTdf59323_slideFooters);
+CPPUNIT_TEST(testTdf53970);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1810,6 +1812,19 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf53970()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+
+// Without fix in place, the media shape was lost on export.
+CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa

2022-03-30 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx  |5 +
 oox/source/export/shapes.cxx |1 +
 sd/qa/unit/data/odp/tdf53970.odp |binary
 3 files changed, 6 insertions(+)

New commits:
commit b64c55169d72bfde6aee00673a56d5c25acfd4d4
Author: Tünde Tóth 
AuthorDate: Thu Mar 24 16:54:01 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 30 20:47:06 2022 +0200

tdf#53970 PPTX: fix export of embedded media files

Embedded media files lost in documents created
with Impress after PPTX export.

Change-Id: I453b58f9cfa6a33653e9216fb82b66970a9ec31b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132095
Tested-by: Jenkins
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/+/132319

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 708aea6fb29a..4d0317be921d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1343,6 +1343,11 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::Reference

[Libreoffice-commits] core.git: include/oox oox/source sc/qa sc/source sd/qa sd/source

2022-03-30 Thread Tünde Tóth (via logerrit)
 include/oox/export/drawingml.hxx |8 +
 oox/source/export/drawingml.cxx  |  207 +--
 sc/qa/unit/data/ods/tdf91286.ods |binary
 sc/qa/unit/subsequent_export_test2.cxx   |   26 +++
 sc/source/filter/excel/xestream.cxx  |4 
 sd/qa/unit/data/odp/tdf74670.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   26 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |2 
 8 files changed, 182 insertions(+), 91 deletions(-)

New commits:
commit aea8043bc5f5187498fa450505d6de9d6986e2a6
Author: Tünde Tóth 
AuthorDate: Tue Mar 22 09:47:57 2022 +0100
Commit: László Németh 
CommitDate: Wed Mar 30 18:24:45 2022 +0200

tdf#74670 tdf#91286 PPTX XLSX export: save image once

Impress and Calc used to dump the same image file
as many times as it was featured in the document,
resulting redundant, sometimes huge documents.

Note: using only checksum to recognize image duplication
is a regression, because checksum collision results
image loss. This is a very unlikely event, and
the following commits have got the same problem.
The solution is comparing the images with the same
checksum byte for byte.

See also commit b484e9814c66d8d51cea974390963a6944bc9d73
"tdf#83227 oox: reuse RelId in DML/VML export for the same graphic"
and commit 797fef38612fb2fd62d1f6591619b9361e526bca
"tdf#118535 DOCX export: save header image once".

Change-Id: I9f233d521941381746634cf4f9b5991da0dadda9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131928
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index fb125dd647ad..9a7f744520c8 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -21,7 +21,9 @@
 #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -41,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -150,6 +153,7 @@ private:
 static std::map maWdpCache;
 static sal_Int32 mnDrawingMLCount;
 static sal_Int32 mnVmlCount;
+static std::stack> 
maExportGraphics;
 
 /// To specify where write eg. the images to (like 'ppt', or 'word' - 
according to the OPC).
 DocumentType meDocumentType;
@@ -342,9 +346,11 @@ public:
 sal_Int32 getBulletMarginIndentation (const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, std::u16string_view 
propName);
 
 static void ResetCounters();
-
 static void ResetMlCounters();
 
+static void PushExportGraphics();
+static void PopExportGraphics();
+
 static sal_Int32 getNewDrawingUniqueId() { return ++mnDrawingMLCount; }
 static sal_Int32 getNewVMLUniqueId() { return ++mnVmlCount; }
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a790a643abc0..a99a0474a458 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -111,7 +111,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -237,6 +236,7 @@ int DrawingML::mnWdpImageCounter = 1;
 std::map DrawingML::maWdpCache;
 sal_Int32 DrawingML::mnDrawingMLCount = 0;
 sal_Int32 DrawingML::mnVmlCount = 0;
+std::stack> 
DrawingML::maExportGraphics;
 
 sal_Int16 DrawingML::GetScriptType(const OUString& rStr)
 {
@@ -275,6 +275,16 @@ void DrawingML::ResetMlCounters()
 mnVmlCount = 0;
 }
 
+void DrawingML::PushExportGraphics()
+{
+maExportGraphics.emplace();
+}
+
+void DrawingML::PopExportGraphics()
+{
+maExportGraphics.pop();
+}
+
 bool DrawingML::GetProperty( const Reference< XPropertySet >& rXPropertySet, 
const OUString& aName )
 {
 try
@@ -1264,113 +1274,130 @@ const char* DrawingML::GetRelationCompPrefix() const
 OUString DrawingML::WriteImage( const Graphic& rGraphic , bool 
bRelPathToMedia, OUString* pFileName )
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
+BitmapChecksum aChecksum = rGraphic.GetChecksum();
 OUString sMediaType;
 const char* pExtension = "";
 OUString sRelId;
+OUString sPath;
 
-SvMemoryStream aStream;
-const void* aData = aLink.GetData();
-std::size_t nDataSize = aLink.GetDataSize();
-
-switch ( aLink.GetType() )
+// tdf#74670 tdf#91286 Save image only once (this is no problem for DOCX)
+if (GetDocumentType() != DOCUMENT_DOCX && !maExportGraphics.empty())
 {
-case GfxLinkType::NativeGif:
-sMediaType = "image/gif";
-pExtension = ".gif";
-break;
+auto aIterator = maExportGraphics.top().find(aChecksum);
+if (aIterator != maExportGraphics.top().end())
+sPath = aIterator->second;
+}
 
-// #i15508# added BMP type for better exports
-// export not yet active, so adding for reference (not checked)
-case GfxLinkType::NativeBmp:
-

[Libreoffice-commits] core.git: sd/qa

2022-03-30 Thread Tünde Tóth (via logerrit)
 sd/qa/unit/export-tests-ooxml2.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 96622aa772518926c4563a54238edc8e83e723c5
Author: Tünde Tóth 
AuthorDate: Wed Mar 30 09:52:57 2022 +0200
Commit: László Németh 
CommitDate: Wed Mar 30 16:17:29 2022 +0200

tdf#53970 PPTX: add unittest

Change-Id: I1bcf8f79213245fdf135d6d3b2aafea6ed99f5b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132296
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: Xisco Fauli 
Reviewed-by: László Németh 

diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 6be1222b5c7d..a620386ad22d 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -132,6 +132,7 @@ public:
 void testTextColumns_tdf140852();
 void testTextColumns_3columns();
 void testTdf59323_slideFooters();
+void testTdf53970();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -198,6 +199,7 @@ public:
 CPPUNIT_TEST(testTextColumns_tdf140852);
 CPPUNIT_TEST(testTextColumns_3columns);
 CPPUNIT_TEST(testTdf59323_slideFooters);
+CPPUNIT_TEST(testTdf53970);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1800,6 +1802,19 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf53970()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+
+// Without fix in place, the media shape was lost on export.
+CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: oox/source sw/qa

2022-03-29 Thread Tünde Tóth (via logerrit)
 oox/source/shape/WpsContext.cxx  |   64 ++-
 sw/qa/extras/ooxmlexport/data/tdf135923-min.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   11 +++
 3 files changed, 63 insertions(+), 12 deletions(-)

New commits:
commit 49a40e3ed200e7c6d728f36d0b4be22dd85c51be
Author: Tünde Tóth 
AuthorDate: Thu Mar 3 11:25:31 2022 +0100
Commit: László Németh 
CommitDate: Tue Mar 29 13:01:18 2022 +0200

tdf#135923 DOCX shape import: set text color

to the character color of the shape if it is not comes
from direct formatting.

Change-Id: I3f0a3e952b5449a6d92c5bb273d353a561f3e3dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130922
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index d39f93fc8402..604065be9aad 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -155,20 +156,59 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 uno::Reference xTextCursor = 
xText->createTextCursor();
 xTextCursor->gotoStart(false);
 xTextCursor->gotoEnd(true);
-const uno::Reference 
xPropertyState(xTextCursor,
-   
uno::UNO_QUERY);
-const beans::PropertyState ePropertyState
-= xPropertyState->getPropertyState("CharColor");
-if (ePropertyState == beans::PropertyState_DEFAULT_VALUE)
+uno::Reference 
xTextBoxPropertySet(xTextCursor,
+
uno::UNO_QUERY);
+uno::Any xCharColor = 
xPropertySet->getPropertyValue("CharColor");
+Color aColor = COL_AUTO;
+if ((xCharColor >>= aColor) && aColor != COL_AUTO)
 {
-uno::Reference 
xTextBoxPropertySet(xTextCursor,
-
uno::UNO_QUERY);
-uno::Any xCharColor = 
xPropertySet->getPropertyValue("CharColor");
-Color aColor = COL_AUTO;
-if (xCharColor >>= aColor)
+const uno::Reference 
xPropertyState(xTextCursor,
+   
uno::UNO_QUERY);
+const beans::PropertyState ePropertyState
+= xPropertyState->getPropertyState("CharColor");
+if (ePropertyState == beans::PropertyState_DEFAULT_VALUE)
+{
+xTextBoxPropertySet->setPropertyValue("CharColor", 
xCharColor);
+}
+else
 {
-if (aColor != COL_AUTO)
-xTextBoxPropertySet->setPropertyValue("CharColor", 
xCharColor);
+// tdf#135923 Apply character color of the shape to 
the textrun
+//when the character color of the textrun 
is default.
+uno::Reference 
paraEnumAccess(
+xText, uno::UNO_QUERY);
+if (paraEnumAccess.is())
+{
+uno::Reference paraEnum(
+paraEnumAccess->createEnumeration());
+
+while (paraEnum->hasMoreElements())
+{
+uno::Reference 
xParagraph(paraEnum->nextElement(),
+
uno::UNO_QUERY);
+uno::Reference 
runEnumAccess(
+xParagraph, uno::UNO_QUERY);
+if (!runEnumAccess.is())
+continue;
+
+uno::Reference runEnum
+= runEnumAccess->createEnumeration();
+
+while (runEnum->hasMoreElements())
+{
+uno::Reference 
xRun(runEnum->nextElement(),
+  
uno::UNO_QUERY);
+const 
uno::Reference xRunState(
+xRun, uno::UNO_QUERY);
+if 
(xRunState->getPropertyState("CharColor")
+== beans::PropertyState_DEFAULT_VALUE)
+{
+uno::Reference 
xRunPropSet(
+ 

[Libreoffice-commits] core.git: oox/source sd/qa

2022-03-29 Thread Tünde Tóth (via logerrit)
 oox/source/export/drawingml.cxx  |5 +
 oox/source/export/shapes.cxx |1 +
 sd/qa/unit/data/odp/tdf53970.odp |binary
 3 files changed, 6 insertions(+)

New commits:
commit bc72514f90d90e1ab3fed8167663e835edf03508
Author: Tünde Tóth 
AuthorDate: Thu Mar 24 16:54:01 2022 +0100
Commit: László Németh 
CommitDate: Tue Mar 29 12:59:55 2022 +0200

tdf#53970 PPTX: fix export of embedded media files

Embedded media files lost in documents created
with Impress after PPTX export.

Change-Id: I453b58f9cfa6a33653e9216fb82b66970a9ec31b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132095
Tested-by: Jenkins
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 912f3921d406..ff092b44641c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1428,6 +1428,11 @@ void DrawingML::WriteMediaNonVisualProperties(const 
css::uno::Reference

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/inc oox/source sd/qa

2022-03-01 Thread Tünde Tóth (via logerrit)
 oox/inc/drawingml/textparagraph.hxx|2 ++
 oox/source/drawingml/textbody.cxx  |   18 +-
 oox/source/drawingml/textparagraph.cxx |   15 ---
 sd/qa/unit/data/pptx/tdf103800.pptx|binary
 sd/qa/unit/import-tests.cxx|   17 +
 5 files changed, 40 insertions(+), 12 deletions(-)

New commits:
commit 366954ef0acce4952c4a8945e43a531dc20659fa
Author: Tünde Tóth 
AuthorDate: Fri Feb 18 10:30:54 2022 +0100
Commit: László Németh 
CommitDate: Tue Mar 1 14:08:41 2022 +0100

tdf#103800 PPTX shape import: fix regression of text color

defined by list styles. Properties in a:lstStyle of p:txBody
should take precedence over the same properties defined in
a:fontRef of style elements.

Change-Id: I02cc886eb9eba94f49fe413a63bf7c46c9e3c127
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130237
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/+/130712
Tested-by: Jenkins

diff --git a/oox/inc/drawingml/textparagraph.hxx 
b/oox/inc/drawingml/textparagraph.hxx
index 021434d6a5fb..1f43249372a5 100644
--- a/oox/inc/drawingml/textparagraph.hxx
+++ b/oox/inc/drawingml/textparagraph.hxx
@@ -63,6 +63,7 @@ public:
 
 TextCharacterProperties  getCharacterStyle(
 const TextCharacterProperties& rTextStyleProperties,
+const TextListStyle& rMasterTextListStyle,
 const TextListStyle& rTextListStyle) const;
 
 TextParagraphProperties*  getParagraphStyle(
@@ -73,6 +74,7 @@ public:
 const css::uno::Reference < 
css::text::XText > & xText,
 const css::uno::Reference < 
css::text::XTextCursor > ,
 const TextCharacterProperties& 
rTextStyleProperties,
+const TextListStyle& rMasterTextListStyle,
 const TextListStyle& rTextListStyle,
 bool bFirst,
 float nDefaultCharHeight) const;
diff --git a/oox/source/drawingml/textbody.cxx 
b/oox/source/drawingml/textbody.cxx
index f4da6886a69c..41a237e97cee 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -57,16 +57,15 @@ void TextBody::insertAt(
 const TextCharacterProperties& rTextStyleProperties,
 const TextListStylePtr& pMasterTextListStylePtr ) const
 {
-TextListStyle aCombinedTextStyle;
-aCombinedTextStyle.apply( *pMasterTextListStylePtr );
-aCombinedTextStyle.apply( maTextListStyle );
+TextListStyle aMasterTextStyle(*pMasterTextListStylePtr);
 
 Reference xPropertySet(xAt, UNO_QUERY);
 float nCharHeight = 
xPropertySet->getPropertyValue("CharHeight").get();
 size_t nIndex = 0;
 for (auto const& paragraph : maParagraphs)
 {
-paragraph->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, 
aCombinedTextStyle, (nIndex == 0), nCharHeight );
+paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, 
aMasterTextStyle,
+maTextListStyle, (nIndex == 0), nCharHeight);
 ++nIndex;
 }
 }
@@ -127,15 +126,16 @@ void TextBody::ApplyStyleEmpty(
 return;
 
 // Apply character properties
-TextListStyle aCombinedTextStyle;
-aCombinedTextStyle.apply( *pMasterTextListStylePtr );
-aCombinedTextStyle.apply( maTextListStyle );
-
 PropertySet aPropSet(xText);
-TextCharacterProperties 
aTextCharacterProps(maParagraphs[0]->getCharacterStyle(rTextStyleProperties, 
aCombinedTextStyle));
+TextCharacterProperties 
aTextCharacterProps(maParagraphs[0]->getCharacterStyle(
+rTextStyleProperties, *pMasterTextListStylePtr, maTextListStyle));
 aTextCharacterProps.pushToPropSet(aPropSet, rFilterBase);
 
 // Apply paragraph properties
+TextListStyle aCombinedTextStyle;
+aCombinedTextStyle.apply(*pMasterTextListStylePtr);
+aCombinedTextStyle.apply(maTextListStyle);
+
 TextParagraphProperties* pTextParagraphStyle = 
maParagraphs[0]->getParagraphStyle(aCombinedTextStyle);
 if (pTextParagraphStyle)
 {
diff --git a/oox/source/drawingml/textparagraph.cxx 
b/oox/source/drawingml/textparagraph.cxx
index 9e4f309e9391..f91ee279bb3b 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -48,14 +48,18 @@ TextParagraph::~TextParagraph()
 
 TextCharacterProperties TextParagraph::getCharacterStyle (
 const TextCharacterProperties& rTextStyleProperties,
+const TextListStyle& rMasterTextListStyle,
 const TextListStyle& rTextListStyle) const
 {
+const TextParagraphProperties* pMasterTextParagraphStyle = 
getParagraphStyle(rMasterTextListStyle);
 const TextParagraphProperties* pTextParagraphStyle = 
getParagraphStyle(rTextListStyle);
 
 

[Libreoffice-commits] core.git: oox/inc oox/source sd/qa

2022-02-28 Thread Tünde Tóth (via logerrit)
 oox/inc/drawingml/textparagraph.hxx|2 ++
 oox/source/drawingml/textbody.cxx  |   18 +-
 oox/source/drawingml/textparagraph.cxx |   15 ---
 sd/qa/unit/data/pptx/tdf103800.pptx|binary
 sd/qa/unit/import-tests.cxx|   17 +
 5 files changed, 40 insertions(+), 12 deletions(-)

New commits:
commit 7d6212e218d4d5c76c8bc60983b548a6893fc6a5
Author: Tünde Tóth 
AuthorDate: Fri Feb 18 10:30:54 2022 +0100
Commit: László Németh 
CommitDate: Mon Feb 28 15:39:07 2022 +0100

tdf#103800 PPTX shape import: fix regression of text color

defined by list styles. Properties in a:lstStyle of p:txBody
should take precedence over the same properties defined in
a:fontRef of style elements.

Change-Id: I02cc886eb9eba94f49fe413a63bf7c46c9e3c127
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130237
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/inc/drawingml/textparagraph.hxx 
b/oox/inc/drawingml/textparagraph.hxx
index 021434d6a5fb..1f43249372a5 100644
--- a/oox/inc/drawingml/textparagraph.hxx
+++ b/oox/inc/drawingml/textparagraph.hxx
@@ -63,6 +63,7 @@ public:
 
 TextCharacterProperties  getCharacterStyle(
 const TextCharacterProperties& rTextStyleProperties,
+const TextListStyle& rMasterTextListStyle,
 const TextListStyle& rTextListStyle) const;
 
 TextParagraphProperties*  getParagraphStyle(
@@ -73,6 +74,7 @@ public:
 const css::uno::Reference < 
css::text::XText > & xText,
 const css::uno::Reference < 
css::text::XTextCursor > ,
 const TextCharacterProperties& 
rTextStyleProperties,
+const TextListStyle& rMasterTextListStyle,
 const TextListStyle& rTextListStyle,
 bool bFirst,
 float nDefaultCharHeight) const;
diff --git a/oox/source/drawingml/textbody.cxx 
b/oox/source/drawingml/textbody.cxx
index f4da6886a69c..41a237e97cee 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -57,16 +57,15 @@ void TextBody::insertAt(
 const TextCharacterProperties& rTextStyleProperties,
 const TextListStylePtr& pMasterTextListStylePtr ) const
 {
-TextListStyle aCombinedTextStyle;
-aCombinedTextStyle.apply( *pMasterTextListStylePtr );
-aCombinedTextStyle.apply( maTextListStyle );
+TextListStyle aMasterTextStyle(*pMasterTextListStylePtr);
 
 Reference xPropertySet(xAt, UNO_QUERY);
 float nCharHeight = 
xPropertySet->getPropertyValue("CharHeight").get();
 size_t nIndex = 0;
 for (auto const& paragraph : maParagraphs)
 {
-paragraph->insertAt( rFilterBase, xText, xAt, rTextStyleProperties, 
aCombinedTextStyle, (nIndex == 0), nCharHeight );
+paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, 
aMasterTextStyle,
+maTextListStyle, (nIndex == 0), nCharHeight);
 ++nIndex;
 }
 }
@@ -127,15 +126,16 @@ void TextBody::ApplyStyleEmpty(
 return;
 
 // Apply character properties
-TextListStyle aCombinedTextStyle;
-aCombinedTextStyle.apply( *pMasterTextListStylePtr );
-aCombinedTextStyle.apply( maTextListStyle );
-
 PropertySet aPropSet(xText);
-TextCharacterProperties 
aTextCharacterProps(maParagraphs[0]->getCharacterStyle(rTextStyleProperties, 
aCombinedTextStyle));
+TextCharacterProperties 
aTextCharacterProps(maParagraphs[0]->getCharacterStyle(
+rTextStyleProperties, *pMasterTextListStylePtr, maTextListStyle));
 aTextCharacterProps.pushToPropSet(aPropSet, rFilterBase);
 
 // Apply paragraph properties
+TextListStyle aCombinedTextStyle;
+aCombinedTextStyle.apply(*pMasterTextListStylePtr);
+aCombinedTextStyle.apply(maTextListStyle);
+
 TextParagraphProperties* pTextParagraphStyle = 
maParagraphs[0]->getParagraphStyle(aCombinedTextStyle);
 if (pTextParagraphStyle)
 {
diff --git a/oox/source/drawingml/textparagraph.cxx 
b/oox/source/drawingml/textparagraph.cxx
index 9e4f309e9391..f91ee279bb3b 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -48,14 +48,18 @@ TextParagraph::~TextParagraph()
 
 TextCharacterProperties TextParagraph::getCharacterStyle (
 const TextCharacterProperties& rTextStyleProperties,
+const TextListStyle& rMasterTextListStyle,
 const TextListStyle& rTextListStyle) const
 {
+const TextParagraphProperties* pMasterTextParagraphStyle = 
getParagraphStyle(rMasterTextListStyle);
 const TextParagraphProperties* pTextParagraphStyle = 
getParagraphStyle(rTextListStyle);
 
 TextCharacterProperties aTextCharacterStyle;
+if (pMasterTextParagraphStyle)
+

[Libreoffice-commits] core.git: oox/source sd/qa

2022-02-28 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |4 +++-
 sd/qa/unit/data/pptx/tdf128596.pptx |binary
 sd/qa/unit/import-tests2.cxx|   17 +
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 259a8e59107bb0a3d4f4f4bb7e056ce1e4231da2
Author: Tünde Tóth 
AuthorDate: Thu Feb 3 15:13:33 2022 +0100
Commit: László Németh 
CommitDate: Mon Feb 28 14:15:22 2022 +0100

tdf#128596 PPTX import: fix default tiled bitmap fill

OOXML bitmap fill element a:blipFill has got default tiled
area setting without explicit a:tile in MSO. Previous import
of bitmap fill as "BitmapMode_NO_REPEAT" instead of
BitmapMode_REPEAT resulted missing or incomplete area fill
of shapes and other objects.

Change-Id: Idf94f4450980f67172a0126784b3e08cc5c178c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129483
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 2b682bcd1b99..49906cc9b10f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -221,7 +221,9 @@ BitmapMode lclGetBitmapMode( sal_Int32 nToken )
 case XML_tile:  return BitmapMode_REPEAT;
 case XML_stretch:   return BitmapMode_STRETCH;
 }
-return BitmapMode_NO_REPEAT;
+
+// tdf#128596 Default value is XML_tile for MSO.
+return BitmapMode_REPEAT;
 }
 
 RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
diff --git a/sd/qa/unit/data/pptx/tdf128596.pptx 
b/sd/qa/unit/data/pptx/tdf128596.pptx
new file mode 100644
index ..62a166308dc2
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128596.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 7c0844e354b9..2654e6f6290e 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -128,6 +128,7 @@ public:
 void testTdf103347();
 void testHyperlinksOnShapes();
 void testTdf112209();
+void testTdf128596();
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
@@ -192,6 +193,7 @@ public:
 CPPUNIT_TEST(testTdf103347);
 CPPUNIT_TEST(testHyperlinksOnShapes);
 CPPUNIT_TEST(testTdf112209);
+CPPUNIT_TEST(testTdf128596);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -1890,6 +1892,21 @@ void SdImportTest2::testTdf112209()
 xDocShRef->DoClose();
 }
 
+void SdImportTest2::testTdf128596()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf128596.pptx"), 
PPTX);
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef),
+   uno::UNO_SET_THROW);
+CPPUNIT_ASSERT(xShape.is());
+
+css::drawing::BitmapMode bitmapmode;
+xShape->getPropertyValue("FillBitmapMode") >>= bitmapmode;
+CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_REPEAT, bitmapmode);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-1' - comphelper/source sc/qa

2022-02-23 Thread Tünde Tóth (via logerrit)
 comphelper/source/misc/docpasswordhelper.cxx |   31 ---
 sc/qa/uitest/calc_tests8/tdf147086.py|   55 +++
 2 files changed, 72 insertions(+), 14 deletions(-)

New commits:
commit 3467b8b63f100e5474673727f137778fed7ccad5
Author: Tünde Tóth 
AuthorDate: Mon Feb 7 11:58:16 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Feb 23 13:30:24 2022 +0100

tdf#147086 OOXML export: don't save the empty editing password

Saving with opening password, but without editing password
resulted read-only documents (only on their original path: saving,
i.e. copying the file in a different path was a workaround for
the lost permission).

Regression from commit 1b53c1dfc76f08ca7df40a0673aa50eca700d072
(tdf#144374 DOCX: export the password for editing).

Change-Id: I2759dc876ee7668d00eee0aa81490c9d1e0c272b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129593
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/+/130060
Tested-by: Jenkins
(cherry picked from commit f7e03352c18e13161effcfe08c7591d3be11b3e0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130088
Reviewed-by: Christian Lohmaier 

diff --git a/comphelper/source/misc/docpasswordhelper.cxx 
b/comphelper/source/misc/docpasswordhelper.cxx
index 71f92db48d00..952368bc91ed 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -111,23 +111,26 @@ 
DocPasswordHelper::GenerateNewModifyPasswordInfoOOXML(std::u16string_view aPassw
 {
 uno::Sequence aResult;
 
-uno::Sequence aSalt = GenerateRandomByteSequence(16);
-OUStringBuffer aBuffer;
-comphelper::Base64::encode(aBuffer, aSalt);
-OUString sSalt = aBuffer.toString();
+if (!aPassword.empty())
+{
+uno::Sequence aSalt = GenerateRandomByteSequence(16);
+OUStringBuffer aBuffer;
+comphelper::Base64::encode(aBuffer, aSalt);
+OUString sSalt = aBuffer.toString();
 
-sal_Int32 const nIterationCount = 10;
-OUString sAlgorithm("SHA-512");
+sal_Int32 const nIterationCount = 10;
+OUString sAlgorithm("SHA-512");
 
-const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, 
nIterationCount,
-
comphelper::Hash::IterCount::APPEND, sAlgorithm));
+const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, 
nIterationCount,
+
comphelper::Hash::IterCount::APPEND, sAlgorithm));
 
-if (!sHash.isEmpty())
-{
-aResult = { comphelper::makePropertyValue("algorithm-name", 
sAlgorithm),
-comphelper::makePropertyValue("salt", sSalt),
-comphelper::makePropertyValue("iteration-count", 
nIterationCount),
-comphelper::makePropertyValue("hash", sHash) };
+if (!sHash.isEmpty())
+{
+aResult = { comphelper::makePropertyValue("algorithm-name", 
sAlgorithm),
+comphelper::makePropertyValue("salt", sSalt),
+comphelper::makePropertyValue("iteration-count", 
nIterationCount),
+comphelper::makePropertyValue("hash", sHash) };
+}
 }
 
 return aResult;
diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py 
b/sc/qa/uitest/calc_tests8/tdf147086.py
new file mode 100755
index ..906f79075b59
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf147086.py
@@ -0,0 +1,55 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from uitest.uihelper.common import select_by_text
+from tempfile import TemporaryDirectory
+import os.path
+
+#Bug 147086 - Password in .xlsx creates readonly sheet
+
+class tdf147086(UITestCase):
+
+def test_tdf147086(self):
+
+with TemporaryDirectory() as tempdir:
+xFilePath = os.path.join(tempdir, "tdf147086_tmp.xlsx")
+
+with self.ui_test.create_doc_in_start_center("calc"):
+# Save the document
+with self.ui_test.execute_dialog_through_command(".uno:Save", 
close_button="") as xSaveDialog:
+xFileName = xSaveDialog.getChild("file_name")
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - comphelper/source sc/qa

2022-02-17 Thread Tünde Tóth (via logerrit)
 comphelper/source/misc/docpasswordhelper.cxx |   31 ---
 sc/qa/uitest/calc_tests8/tdf147086.py|   55 +++
 2 files changed, 72 insertions(+), 14 deletions(-)

New commits:
commit f7e03352c18e13161effcfe08c7591d3be11b3e0
Author: Tünde Tóth 
AuthorDate: Mon Feb 7 11:58:16 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 17 16:29:34 2022 +0100

tdf#147086 OOXML export: don't save the empty editing password

Saving with opening password, but without editing password
resulted read-only documents (only on their original path: saving,
i.e. copying the file in a different path was a workaround for
the lost permission).

Regression from commit 1b53c1dfc76f08ca7df40a0673aa50eca700d072
(tdf#144374 DOCX: export the password for editing).

Change-Id: I2759dc876ee7668d00eee0aa81490c9d1e0c272b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129593
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/+/130060
Tested-by: Jenkins

diff --git a/comphelper/source/misc/docpasswordhelper.cxx 
b/comphelper/source/misc/docpasswordhelper.cxx
index 71f92db48d00..952368bc91ed 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -111,23 +111,26 @@ 
DocPasswordHelper::GenerateNewModifyPasswordInfoOOXML(std::u16string_view aPassw
 {
 uno::Sequence aResult;
 
-uno::Sequence aSalt = GenerateRandomByteSequence(16);
-OUStringBuffer aBuffer;
-comphelper::Base64::encode(aBuffer, aSalt);
-OUString sSalt = aBuffer.toString();
+if (!aPassword.empty())
+{
+uno::Sequence aSalt = GenerateRandomByteSequence(16);
+OUStringBuffer aBuffer;
+comphelper::Base64::encode(aBuffer, aSalt);
+OUString sSalt = aBuffer.toString();
 
-sal_Int32 const nIterationCount = 10;
-OUString sAlgorithm("SHA-512");
+sal_Int32 const nIterationCount = 10;
+OUString sAlgorithm("SHA-512");
 
-const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, 
nIterationCount,
-
comphelper::Hash::IterCount::APPEND, sAlgorithm));
+const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, 
nIterationCount,
+
comphelper::Hash::IterCount::APPEND, sAlgorithm));
 
-if (!sHash.isEmpty())
-{
-aResult = { comphelper::makePropertyValue("algorithm-name", 
sAlgorithm),
-comphelper::makePropertyValue("salt", sSalt),
-comphelper::makePropertyValue("iteration-count", 
nIterationCount),
-comphelper::makePropertyValue("hash", sHash) };
+if (!sHash.isEmpty())
+{
+aResult = { comphelper::makePropertyValue("algorithm-name", 
sAlgorithm),
+comphelper::makePropertyValue("salt", sSalt),
+comphelper::makePropertyValue("iteration-count", 
nIterationCount),
+comphelper::makePropertyValue("hash", sHash) };
+}
 }
 
 return aResult;
diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py 
b/sc/qa/uitest/calc_tests8/tdf147086.py
new file mode 100755
index ..906f79075b59
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf147086.py
@@ -0,0 +1,55 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from uitest.uihelper.common import select_by_text
+from tempfile import TemporaryDirectory
+import os.path
+
+#Bug 147086 - Password in .xlsx creates readonly sheet
+
+class tdf147086(UITestCase):
+
+def test_tdf147086(self):
+
+with TemporaryDirectory() as tempdir:
+xFilePath = os.path.join(tempdir, "tdf147086_tmp.xlsx")
+
+with self.ui_test.create_doc_in_start_center("calc"):
+# Save the document
+with self.ui_test.execute_dialog_through_command(".uno:Save", 
close_button="") as xSaveDialog:
+xFileName = xSaveDialog.getChild("file_name")
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
xFilePath}))
+xFileTypeCombo = xSaveDialog.getChild("file_type")
+select_by_text(xFileTypeCombo, 

[Libreoffice-commits] core.git: comphelper/source sc/qa

2022-02-17 Thread Tünde Tóth (via logerrit)
 comphelper/source/misc/docpasswordhelper.cxx |   31 ---
 sc/qa/uitest/calc_tests8/tdf147086.py|   55 +++
 2 files changed, 72 insertions(+), 14 deletions(-)

New commits:
commit 8f7d355e7f153a940b85179f5bc54a506eeab05a
Author: Tünde Tóth 
AuthorDate: Mon Feb 7 11:58:16 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 17 10:25:24 2022 +0100

tdf#147086 OOXML export: don't save the empty editing password

Saving with opening password, but without editing password
resulted read-only documents (only on their original path: saving,
i.e. copying the file in a different path was a workaround for
the lost permission).

Regression from commit 1b53c1dfc76f08ca7df40a0673aa50eca700d072
(tdf#144374 DOCX: export the password for editing).

Change-Id: I2759dc876ee7668d00eee0aa81490c9d1e0c272b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129593
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/comphelper/source/misc/docpasswordhelper.cxx 
b/comphelper/source/misc/docpasswordhelper.cxx
index 62d6d59a960f..436b599f9e1f 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -111,23 +111,26 @@ 
DocPasswordHelper::GenerateNewModifyPasswordInfoOOXML(std::u16string_view aPassw
 {
 uno::Sequence aResult;
 
-uno::Sequence aSalt = GenerateRandomByteSequence(16);
-OUStringBuffer aBuffer(22);
-comphelper::Base64::encode(aBuffer, aSalt);
-OUString sSalt = aBuffer.makeStringAndClear();
+if (!aPassword.empty())
+{
+uno::Sequence aSalt = GenerateRandomByteSequence(16);
+OUStringBuffer aBuffer(22);
+comphelper::Base64::encode(aBuffer, aSalt);
+OUString sSalt = aBuffer.makeStringAndClear();
 
-sal_Int32 const nIterationCount = 10;
-OUString sAlgorithm("SHA-512");
+sal_Int32 const nIterationCount = 10;
+OUString sAlgorithm("SHA-512");
 
-const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, 
nIterationCount,
-
comphelper::Hash::IterCount::APPEND, sAlgorithm));
+const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, 
nIterationCount,
+
comphelper::Hash::IterCount::APPEND, sAlgorithm));
 
-if (!sHash.isEmpty())
-{
-aResult = { comphelper::makePropertyValue("algorithm-name", 
sAlgorithm),
-comphelper::makePropertyValue("salt", sSalt),
-comphelper::makePropertyValue("iteration-count", 
nIterationCount),
-comphelper::makePropertyValue("hash", sHash) };
+if (!sHash.isEmpty())
+{
+aResult = { comphelper::makePropertyValue("algorithm-name", 
sAlgorithm),
+comphelper::makePropertyValue("salt", sSalt),
+comphelper::makePropertyValue("iteration-count", 
nIterationCount),
+comphelper::makePropertyValue("hash", sHash) };
+}
 }
 
 return aResult;
diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py 
b/sc/qa/uitest/calc_tests8/tdf147086.py
new file mode 100755
index ..906f79075b59
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf147086.py
@@ -0,0 +1,55 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from uitest.uihelper.common import select_by_text
+from tempfile import TemporaryDirectory
+import os.path
+
+#Bug 147086 - Password in .xlsx creates readonly sheet
+
+class tdf147086(UITestCase):
+
+def test_tdf147086(self):
+
+with TemporaryDirectory() as tempdir:
+xFilePath = os.path.join(tempdir, "tdf147086_tmp.xlsx")
+
+with self.ui_test.create_doc_in_start_center("calc"):
+# Save the document
+with self.ui_test.execute_dialog_through_command(".uno:Save", 
close_button="") as xSaveDialog:
+xFileName = xSaveDialog.getChild("file_name")
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
xFilePath}))
+xFileTypeCombo = xSaveDialog.getChild("file_type")
+select_by_text(xFileTypeCombo, "Excel 2007–365 (.xlsx)")
+xPasswordCheckButton = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sw/qa

2022-02-03 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |2 ++
 oox/source/export/drawingml.cxx |   15 +++
 sw/qa/extras/uiwriter/uiwriter4.cxx |   14 +-
 3 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit d036ea9651c05a2a50794bc5c0ee7ea54708ad6a
Author: Tünde Tóth 
AuthorDate: Mon Jan 17 15:00:13 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 3 12:22:55 2022 +0100

tdf#146822 OOXML: fix export of the transparency in hatch fill

The transparency value of the hatch was not exported.

Follow-up to commit 001afbed910b7e565f602c1b11b1b4538cd59442
"tdf#127989 OOXML: fix import of transparent hatching".

Change-Id: I9b82a3422de8e4f85c534f861c45c0c097ceb02f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128504
Tested-by: Jenkins
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129396

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 5d17c321d0f8..2b682bcd1b99 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -812,6 +812,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 {
 eFillStyle = FillStyle_HATCH;
 rPropMap.setProperty( ShapeProperty::FillHatch, 
createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( 
rGraphicHelper, nPhClr ) ) );
+if( aColor.hasTransparency() )
+rPropMap.setProperty( ShapeProperty::FillTransparency, 
aColor.getTransparency() );
 
 // Set background color for hatch
 if(maPatternProps.maPattBgColor.isUsed())
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e1062795e3ae..0bcb8b4e1f92 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1599,12 +1599,19 @@ void DrawingML::WritePattFill(const 
Reference& rXPropSet, const cs
 {
 mpFS->startElementNS(XML_a, XML_pattFill, XML_prst, 
GetHatchPattern(rHatch));
 
+sal_Int32 nAlpha = MAX_PERCENT;
+if (GetProperty(rXPropSet, "FillTransparence"))
+{
+sal_Int32 nTransparency = 0;
+mAny >>= nTransparency;
+nAlpha = (MAX_PERCENT - (PER_PERCENT * nTransparency));
+}
+
 mpFS->startElementNS(XML_a, XML_fgClr);
-WriteColor(::Color(ColorTransparency, rHatch.Color));
+WriteColor(::Color(ColorTransparency, rHatch.Color), nAlpha);
 mpFS->endElementNS( XML_a , XML_fgClr );
 
 ::Color nColor = COL_WHITE;
-sal_Int32 nAlpha  = 0;
 
 if ( GetProperty( rXPropSet, "FillBackground" ) )
 {
@@ -1612,13 +1619,13 @@ void DrawingML::WritePattFill(const 
Reference& rXPropSet, const cs
 mAny >>= isBackgroundFilled;
 if( isBackgroundFilled )
 {
-nAlpha = MAX_PERCENT;
-
 if( GetProperty( rXPropSet, "FillColor" ) )
 {
 mAny >>= nColor;
 }
 }
+else
+nAlpha = 0;
 }
 
 mpFS->startElementNS(XML_a, XML_bgClr);
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 46d06d0985ae..090938240c63 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -287,7 +287,7 @@ public:
 void testTdf129270();
 void testInsertPdf();
 void testTdf143760WrapContourToOff();
-void testTdf127989();
+void testHatchFill();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest4);
 CPPUNIT_TEST(testTdf96515);
@@ -409,7 +409,7 @@ public:
 CPPUNIT_TEST(testTdf129270);
 CPPUNIT_TEST(testInsertPdf);
 CPPUNIT_TEST(testTdf143760WrapContourToOff);
-CPPUNIT_TEST(testTdf127989);
+CPPUNIT_TEST(testHatchFill);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -3878,7 +3878,7 @@ void SwUiWriterTest4::testTdf143760WrapContourToOff()
 CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), 
"SurroundContour"));
 }
 
-void SwUiWriterTest4::testTdf127989()
+void SwUiWriterTest4::testHatchFill()
 {
 createSwDoc();
 
@@ -3892,16 +3892,20 @@ void SwUiWriterTest4::testTdf127989()
 xShapeProps->setPropertyValue("FillStyle", 
uno::makeAny(drawing::FillStyle_HATCH));
 xShapeProps->setPropertyValue("FillHatchName", 
uno::makeAny(OUString("Black 0 Degrees")));
 xShapeProps->setPropertyValue("FillBackground", uno::makeAny(false));
+xShapeProps->setPropertyValue("FillTransparence", 
uno::makeAny(sal_Int32(30)));
 uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
 xDrawPage->add(xShape);
 
 // Save it as DOCX and load it again.
-reload("Office Open XML Text", "tdf127989.docx");
+reload("Office Open XML 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa

2022-02-03 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |3 +++
 sd/qa/unit/data/pptx/tdf112209.pptx |binary
 sd/qa/unit/import-tests2.cxx|   26 ++
 3 files changed, 29 insertions(+)

New commits:
commit 5a0ad13545197a4a66e0bc4933418110f73c1e9e
Author: Tünde Tóth 
AuthorDate: Wed Jan 19 14:53:50 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 3 11:50:29 2022 +0100

tdf#112209 PPTX import: fix grayscale effect on image filled shape

Some image filled shapes with grayscale effect in PPTX documents
created with PowerPoint were not grayscale in Impress.

Change-Id: I0a89f283f525eb47c21c5d5fa788484d8074a7e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128616
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 1bce0e3004e3ec9d62a3c43801f8f2e8ef5f7fdb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129342
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 480bbe641737..5d17c321d0f8 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -722,6 +722,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 
 if (xGraphic.is())
 {
+if (maBlipProps.moColorEffect.get(XML_TOKEN_INVALID) == 
XML_grayscl)
+xGraphic = lclGreysScaleGraphic(xGraphic);
+
 if 
(rPropMap.supportsProperty(ShapeProperty::FillBitmapName) &&
 rPropMap.setProperty(ShapeProperty::FillBitmapName, 
xGraphic))
 {
diff --git a/sd/qa/unit/data/pptx/tdf112209.pptx 
b/sd/qa/unit/data/pptx/tdf112209.pptx
new file mode 100644
index ..80865820dfad
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112209.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index c299ad4303dd..b62573ec354b 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -171,6 +171,7 @@ public:
 void testTdf49856();
 void testTdf103347();
 void testHyperlinksOnShapes();
+void testTdf112209();
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
@@ -234,6 +235,7 @@ public:
 CPPUNIT_TEST(testTdf134210CropPosition);
 CPPUNIT_TEST(testTdf103347);
 CPPUNIT_TEST(testHyperlinksOnShapes);
+CPPUNIT_TEST(testTdf112209);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -1908,6 +1910,30 @@ void SdImportTest2::testHyperlinksOnShapes()
 xDocShRef->DoClose();
 }
 
+void SdImportTest2::testTdf112209()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112209.pptx"), 
PPTX);
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef),
+   uno::UNO_SET_THROW);
+CPPUNIT_ASSERT(xShape.is());
+
+uno::Reference xGraphic;
+xShape->getPropertyValue("FillBitmap") >>= xGraphic;
+CPPUNIT_ASSERT(xGraphic.is());
+
+Graphic aGraphic(xGraphic);
+BitmapEx aBitmap(aGraphic.GetBitmapEx());
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: Color: R:132 G:132 B:132 A:0
+// - Actual  : Color: R:21 G:170 B:236 A:0
+// i.e. the image color was blue instead of grey.
+CPPUNIT_ASSERT_EQUAL(Color(0x848484), aBitmap.GetPixelColor(0, 0));
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: oox/source sw/qa

2022-02-02 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |2 ++
 oox/source/export/drawingml.cxx |   15 +++
 sw/qa/extras/uiwriter/uiwriter4.cxx |   10 +++---
 3 files changed, 20 insertions(+), 7 deletions(-)

New commits:
commit b8925251e48534706c6960a54c320d3879317321
Author: Tünde Tóth 
AuthorDate: Mon Jan 17 15:00:13 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 3 08:59:10 2022 +0100

tdf#146822 OOXML: fix export of the transparency in hatch fill

The transparency value of the hatch was not exported.

Follow-up to commit 001afbed910b7e565f602c1b11b1b4538cd59442
"tdf#127989 OOXML: fix import of transparent hatching".

Change-Id: I9b82a3422de8e4f85c534f861c45c0c097ceb02f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128504
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 5d17c321d0f8..2b682bcd1b99 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -812,6 +812,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 {
 eFillStyle = FillStyle_HATCH;
 rPropMap.setProperty( ShapeProperty::FillHatch, 
createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( 
rGraphicHelper, nPhClr ) ) );
+if( aColor.hasTransparency() )
+rPropMap.setProperty( ShapeProperty::FillTransparency, 
aColor.getTransparency() );
 
 // Set background color for hatch
 if(maPatternProps.maPattBgColor.isUsed())
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 09ca9c22915a..87bbe81bd88a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1658,12 +1658,19 @@ void DrawingML::WritePattFill(const 
Reference& rXPropSet, const cs
 {
 mpFS->startElementNS(XML_a, XML_pattFill, XML_prst, 
GetHatchPattern(rHatch));
 
+sal_Int32 nAlpha = MAX_PERCENT;
+if (GetProperty(rXPropSet, "FillTransparence"))
+{
+sal_Int32 nTransparency = 0;
+mAny >>= nTransparency;
+nAlpha = (MAX_PERCENT - (PER_PERCENT * nTransparency));
+}
+
 mpFS->startElementNS(XML_a, XML_fgClr);
-WriteColor(::Color(ColorTransparency, rHatch.Color));
+WriteColor(::Color(ColorTransparency, rHatch.Color), nAlpha);
 mpFS->endElementNS( XML_a , XML_fgClr );
 
 ::Color nColor = COL_WHITE;
-sal_Int32 nAlpha  = 0;
 
 if ( GetProperty( rXPropSet, "FillBackground" ) )
 {
@@ -1671,13 +1678,13 @@ void DrawingML::WritePattFill(const 
Reference& rXPropSet, const cs
 mAny >>= isBackgroundFilled;
 if( isBackgroundFilled )
 {
-nAlpha = MAX_PERCENT;
-
 if( GetProperty( rXPropSet, "FillColor" ) )
 {
 mAny >>= nColor;
 }
 }
+else
+nAlpha = 0;
 }
 
 mpFS->startElementNS(XML_a, XML_bgClr);
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index c1635b64ffad..29d31a0940b2 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -3681,7 +3681,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, 
testTdf143760WrapContourToOff)
 CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), 
"SurroundContour"));
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf127989)
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testHatchFill)
 {
 createSwDoc();
 
@@ -3695,16 +3695,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf127989)
 xShapeProps->setPropertyValue("FillStyle", 
uno::makeAny(drawing::FillStyle_HATCH));
 xShapeProps->setPropertyValue("FillHatchName", 
uno::makeAny(OUString("Black 0 Degrees")));
 xShapeProps->setPropertyValue("FillBackground", uno::makeAny(false));
+xShapeProps->setPropertyValue("FillTransparence", 
uno::makeAny(sal_Int32(30)));
 uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
 xDrawPage->add(xShape);
 
 // Save it as DOCX and load it again.
-reload("Office Open XML Text", "tdf127989.docx");
+reload("Office Open XML Text", "hatchFill.docx");
 CPPUNIT_ASSERT_EQUAL(1, getShapes());
 
-// Without fix this had failed, because the background of the hatch was 
not set as 'no background'.
+// tdf#127989 Without fix this had failed, because the background of the 
hatch was not set as 'no background'.
 CPPUNIT_ASSERT(!getProperty(getShape(1), "FillBackground"));
+
+// tdf#146822 Without fix this had failed, because the transparency value 
of the hatch was not exported.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(30), getProperty(getShape(1), 

[Libreoffice-commits] core.git: oox/source sd/qa

2022-02-02 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |3 +++
 sd/qa/unit/data/pptx/tdf112209.pptx |binary
 sd/qa/unit/import-tests2.cxx|   26 ++
 3 files changed, 29 insertions(+)

New commits:
commit 1bce0e3004e3ec9d62a3c43801f8f2e8ef5f7fdb
Author: Tünde Tóth 
AuthorDate: Wed Jan 19 14:53:50 2022 +0100
Commit: László Németh 
CommitDate: Wed Feb 2 17:27:00 2022 +0100

tdf#112209 PPTX import: fix grayscale effect on image filled shape

Some image filled shapes with grayscale effect in PPTX documents
created with PowerPoint were not grayscale in Impress.

Change-Id: I0a89f283f525eb47c21c5d5fa788484d8074a7e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128616
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 480bbe641737..5d17c321d0f8 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -722,6 +722,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 
 if (xGraphic.is())
 {
+if (maBlipProps.moColorEffect.get(XML_TOKEN_INVALID) == 
XML_grayscl)
+xGraphic = lclGreysScaleGraphic(xGraphic);
+
 if 
(rPropMap.supportsProperty(ShapeProperty::FillBitmapName) &&
 rPropMap.setProperty(ShapeProperty::FillBitmapName, 
xGraphic))
 {
diff --git a/sd/qa/unit/data/pptx/tdf112209.pptx 
b/sd/qa/unit/data/pptx/tdf112209.pptx
new file mode 100644
index ..80865820dfad
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112209.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 04e365bfa130..7c0844e354b9 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -127,6 +127,7 @@ public:
 void testTdf49856();
 void testTdf103347();
 void testHyperlinksOnShapes();
+void testTdf112209();
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
@@ -190,6 +191,7 @@ public:
 CPPUNIT_TEST(testTdf134210CropPosition);
 CPPUNIT_TEST(testTdf103347);
 CPPUNIT_TEST(testHyperlinksOnShapes);
+CPPUNIT_TEST(testTdf112209);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -1864,6 +1866,30 @@ void SdImportTest2::testHyperlinksOnShapes()
 xDocShRef->DoClose();
 }
 
+void SdImportTest2::testTdf112209()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112209.pptx"), 
PPTX);
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef),
+   uno::UNO_SET_THROW);
+CPPUNIT_ASSERT(xShape.is());
+
+uno::Reference xGraphic;
+xShape->getPropertyValue("FillBitmap") >>= xGraphic;
+CPPUNIT_ASSERT(xGraphic.is());
+
+Graphic aGraphic(xGraphic);
+BitmapEx aBitmap(aGraphic.GetBitmapEx());
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: Color: R:132 G:132 B:132 A:0
+// - Actual  : Color: R:21 G:170 B:236 A:0
+// i.e. the image color was blue instead of grey.
+CPPUNIT_ASSERT_EQUAL(Color(0x848484), aBitmap.GetPixelColor(0, 0));
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - chart2/qa chart2/source

2022-02-01 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2import2.cxx|   48 ++
 chart2/qa/extras/data/ods/tdf146066.ods   |binary
 chart2/source/view/axes/VCoordinateSystem.cxx |   22 +++
 3 files changed, 69 insertions(+), 1 deletion(-)

New commits:
commit dca425203c0205a6c570fa36f0dfdfa078960249
Author: Tünde Tóth 
AuthorDate: Thu Jan 6 15:05:10 2022 +0100
Commit: László Németh 
CommitDate: Tue Feb 1 09:41:38 2022 +0100

tdf#146066 chart: fix automatic axis scaling at dates

Automatic scaling of the Y axis was incorrect
when the X axis was a date axis and the last
Y value was the highest value. To fix this,
increase maximum date value by one month/year.

Regression from commit ed2c880a691a0b179bbc92a8ce4ee49eac004035
(tdf#133005 Chart: fix ODF import of date axis position).

Change-Id: I0989ae8002e55f4ecfaf530ab845badb4409ecf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128209
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 81abc0d7657f194804681415a786627ab71475e3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129085
Tested-by: Jenkins
Reviewed-by: Tünde Tóth 

diff --git a/chart2/qa/extras/chart2import2.cxx 
b/chart2/qa/extras/chart2import2.cxx
index 0693a1e64184..95ee2428b47d 100644
--- a/chart2/qa/extras/chart2import2.cxx
+++ b/chart2/qa/extras/chart2import2.cxx
@@ -75,6 +75,7 @@ public:
 void testTdfCustomShapePos();
 void testTdf121281();
 void testTdf139658();
+void testTdf146066();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest2);
 
@@ -114,6 +115,7 @@ public:
 CPPUNIT_TEST(testTdfCustomShapePos);
 CPPUNIT_TEST(testTdf121281);
 CPPUNIT_TEST(testTdf139658);
+CPPUNIT_TEST(testTdf146066);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -874,6 +876,52 @@ void Chart2ImportTest2::testTdf139658()
 CPPUNIT_ASSERT_EQUAL(OUString("category\"3"), aCategories[2]);
 }
 
+void Chart2ImportTest2::testTdf146066()
+{
+load(u"/chart2/qa/extras/data/ods/", "tdf146066.ods");
+Reference xChartDoc(getChartDocFromSheet(0, 
mxComponent),
+   UNO_QUERY_THROW);
+uno::Reference xDrawPageSupplier(xChartDoc, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+uno::Reference xShapes(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xShapes.is());
+
+uno::Reference xYAxisShape = getShapeByName(
+xShapes, "CID/D=0:CS=0:Axis=1,0", // Y Axis
+// Axis occurs twice in chart xshape representation so need to get the 
one related to labels
+[](const uno::Reference& rXShape) -> bool {
+uno::Reference xAxisShapes(rXShape, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xAxisShapes.is());
+uno::Reference 
xChildShape(xAxisShapes->getByIndex(0), uno::UNO_QUERY);
+uno::Reference 
xShapeDescriptor(xChildShape,
+   
uno::UNO_QUERY_THROW);
+return (xShapeDescriptor->getShapeType() == 
"com.sun.star.drawing.TextShape");
+});
+CPPUNIT_ASSERT(xYAxisShape.is());
+
+// Check label count
+uno::Reference xIndexAccess(xYAxisShape, 
UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(static_cast(8), xIndexAccess->getCount());
+
+// Check text
+uno::Reference xLabel0(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("0"), xLabel0->getString());
+uno::Reference xLabel1(xIndexAccess->getByIndex(1), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("5"), xLabel1->getString());
+uno::Reference xLabel2(xIndexAccess->getByIndex(2), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("10"), xLabel2->getString());
+uno::Reference xLabel3(xIndexAccess->getByIndex(3), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("15"), xLabel3->getString());
+uno::Reference xLabel4(xIndexAccess->getByIndex(4), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("20"), xLabel4->getString());
+uno::Reference xLabel5(xIndexAccess->getByIndex(5), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("25"), xLabel5->getString());
+uno::Reference xLabel6(xIndexAccess->getByIndex(6), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("30"), xLabel6->getString());
+uno::Reference xLabel7(xIndexAccess->getByIndex(7), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("35"), xLabel7->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/ods/tdf146066.ods 
b/chart2/qa/extras/data/ods/tdf146066.ods
new file mode 100644
index ..03abe9ae68ca
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf146066.ods differ
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx 
b/chart2/source/view/axes/VCoordinateSystem.cxx
index f546af789ddd..9b330a0b4171 100644
--- 

[Libreoffice-commits] core.git: chart2/qa chart2/source

2022-01-31 Thread Tünde Tóth (via logerrit)
 chart2/qa/extras/chart2import2.cxx|   48 ++
 chart2/qa/extras/data/ods/tdf146066.ods   |binary
 chart2/source/view/axes/VCoordinateSystem.cxx |   22 +++
 3 files changed, 69 insertions(+), 1 deletion(-)

New commits:
commit 81abc0d7657f194804681415a786627ab71475e3
Author: Tünde Tóth 
AuthorDate: Thu Jan 6 15:05:10 2022 +0100
Commit: László Németh 
CommitDate: Mon Jan 31 16:07:06 2022 +0100

tdf#146066 chart: fix automatic axis scaling at dates

Automatic scaling of the Y axis was incorrect
when the X axis was a date axis and the last
Y value was the highest value. To fix this,
increase maximum date value by one month/year.

Regression from commit ed2c880a691a0b179bbc92a8ce4ee49eac004035
(tdf#133005 Chart: fix ODF import of date axis position).

Change-Id: I0989ae8002e55f4ecfaf530ab845badb4409ecf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128209
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/chart2/qa/extras/chart2import2.cxx 
b/chart2/qa/extras/chart2import2.cxx
index f84254c30c2a..17b762824f43 100644
--- a/chart2/qa/extras/chart2import2.cxx
+++ b/chart2/qa/extras/chart2import2.cxx
@@ -58,6 +58,7 @@ public:
 void testTdfCustomShapePos();
 void testTdf121281();
 void testTdf139658();
+void testTdf146066();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest2);
 
@@ -97,6 +98,7 @@ public:
 CPPUNIT_TEST(testTdfCustomShapePos);
 CPPUNIT_TEST(testTdf121281);
 CPPUNIT_TEST(testTdf139658);
+CPPUNIT_TEST(testTdf146066);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -857,6 +859,52 @@ void Chart2ImportTest2::testTdf139658()
 CPPUNIT_ASSERT_EQUAL(OUString("category\"3"), aCategories[2]);
 }
 
+void Chart2ImportTest2::testTdf146066()
+{
+load(u"/chart2/qa/extras/data/ods/", "tdf146066.ods");
+Reference xChartDoc(getChartDocFromSheet(0, 
mxComponent),
+   UNO_QUERY_THROW);
+uno::Reference xDrawPageSupplier(xChartDoc, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+uno::Reference xShapes(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xShapes.is());
+
+uno::Reference xYAxisShape = getShapeByName(
+xShapes, "CID/D=0:CS=0:Axis=1,0", // Y Axis
+// Axis occurs twice in chart xshape representation so need to get the 
one related to labels
+[](const uno::Reference& rXShape) -> bool {
+uno::Reference xAxisShapes(rXShape, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xAxisShapes.is());
+uno::Reference 
xChildShape(xAxisShapes->getByIndex(0), uno::UNO_QUERY);
+uno::Reference 
xShapeDescriptor(xChildShape,
+   
uno::UNO_QUERY_THROW);
+return (xShapeDescriptor->getShapeType() == 
"com.sun.star.drawing.TextShape");
+});
+CPPUNIT_ASSERT(xYAxisShape.is());
+
+// Check label count
+uno::Reference xIndexAccess(xYAxisShape, 
UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(static_cast(8), xIndexAccess->getCount());
+
+// Check text
+uno::Reference xLabel0(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("0"), xLabel0->getString());
+uno::Reference xLabel1(xIndexAccess->getByIndex(1), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("5"), xLabel1->getString());
+uno::Reference xLabel2(xIndexAccess->getByIndex(2), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("10"), xLabel2->getString());
+uno::Reference xLabel3(xIndexAccess->getByIndex(3), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("15"), xLabel3->getString());
+uno::Reference xLabel4(xIndexAccess->getByIndex(4), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("20"), xLabel4->getString());
+uno::Reference xLabel5(xIndexAccess->getByIndex(5), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("25"), xLabel5->getString());
+uno::Reference xLabel6(xIndexAccess->getByIndex(6), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("30"), xLabel6->getString());
+uno::Reference xLabel7(xIndexAccess->getByIndex(7), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("35"), xLabel7->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/ods/tdf146066.ods 
b/chart2/qa/extras/data/ods/tdf146066.ods
new file mode 100644
index ..03abe9ae68ca
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf146066.ods differ
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx 
b/chart2/source/view/axes/VCoordinateSystem.cxx
index f98f66502857..222383c8c7be 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include "VCartesianCoordinateSystem.hxx"
 #include 

[Libreoffice-commits] core.git: oox/source sd/qa

2022-01-03 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx |8 +-
 oox/source/export/drawingml.cxx  |   24 +-
 sd/qa/unit/uiimpress.cxx |   91 +--
 3 files changed, 117 insertions(+), 6 deletions(-)

New commits:
commit 678790f292b63c9def1f0427df20028a1f734c15
Author: Tünde Tóth 
AuthorDate: Thu Dec 16 15:10:33 2021 +0100
Commit: László Németh 
CommitDate: Mon Jan 3 14:40:09 2022 +0100

tdf#127696 PPTX export: fix lost outline character formatting

Now outline font property export is supported partially in PPTX
export and in text shape export in other OOXML formats.

Note: OOXML/MSO has customizable Text Fill and Text Outline in
Format Text Effects, while LO has only simple and buggy outline
character formatting property, showing only white or completely
transparent outline fill color. Transparency issues and the buggy
outline font handling of LO (e.g. 1% font color (line) transparency
results 100% fill transparency of the outline text) haven't been
handled yet.

Change-Id: Ic34bce4efd4a544d799b1d89af1107c4918061d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126996
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 7ffeaeba8da2..9d568cd5cabb 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 if ( maFillProperties.moFillType.has() )
 {
 Color aColor = maFillProperties.getBestSolidColor();
+bool bContoured = false;
 
 // noFill doesn't exist for characters. Map noFill to 99% transparency
 if (maFillProperties.moFillType.get() == XML_noFill)
@@ -124,7 +125,11 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 {
 Color aLineColor = 
moTextOutlineProperties.get().maLineFill.getBestSolidColor();
 sal_Int16 nLineTransparency = aLineColor.getTransparency();
-if (nLineTransparency < aColor.getTransparency())
+
+// tdf#127696 If the text color is white (and the outline color 
doesn't dominate),
+//then this is contoured text in LO.
+if (nLineTransparency < aColor.getTransparency()
+|| (bContoured = aColor.getColor(rFilter.getGraphicHelper()) 
== COL_WHITE))
 aColor = aLineColor;
 }
 rPropMap.setProperty(PROP_CharColor, 
aColor.getColor(rFilter.getGraphicHelper()));
@@ -133,6 +138,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 rPropMap.setProperty(PROP_CharColorTintOrShade, 
aColor.getTintOrShade());
 rPropMap.setProperty(PROP_CharColorLumMod, aColor.getLumMod());
 rPropMap.setProperty(PROP_CharColorLumOff, aColor.getLumOff());
+rPropMap.setProperty(PROP_CharContoured, bContoured);
 
 if (aColor.hasTransparency())
 {
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8581535357a0..d87c6cccddee 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2201,9 +2201,31 @@ void DrawingML::WriteRunProperties( const Reference< 
XPropertySet >& rRun, bool
 nTransparency = MAX_PERCENT - (nTransparency * PER_PERCENT);
 }
 
+bool bContoured = false;
+if (GetProperty(rXPropSet, "CharContoured"))
+bContoured = *o3tl::doAccess(mAny);
+
+// tdf#127696 If the CharContoured is true, then the text color is 
white and the outline color is the CharColor.
+if (bContoured)
+{
+mpFS->startElementNS(XML_a, XML_ln);
+if (color == COL_AUTO)
+{
+mbIsBackgroundDark ? WriteSolidFill(COL_WHITE) : 
WriteSolidFill(COL_BLACK);
+}
+else
+{
+color.SetAlpha(255);
+if (!WriteCharColor(rXPropSet))
+WriteSolidFill(color, nTransparency);
+}
+mpFS->endElementNS(XML_a, XML_ln);
+
+WriteSolidFill(COL_WHITE);
+}
 // tdf#104219 In LibreOffice and MS Office, there are two types of 
colors:
 // Automatic and Fixed. OOXML is setting automatic color, by not 
providing color.
-if( color != COL_AUTO )
+else if( color != COL_AUTO )
 {
 color.SetAlpha(255);
 // TODO: special handle embossed/engraved
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 2ea61ea63e94..5a773aa8ced6 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ 

[Libreoffice-commits] core.git: oox/source sw/qa

2022-01-03 Thread Tünde Tóth (via logerrit)
 oox/source/export/shapes.cxx|5 +
 sw/qa/extras/uiwriter/uiwriter4.cxx |   23 +++
 2 files changed, 28 insertions(+)

New commits:
commit 87db920b141fe9846cbd1b37fff3a9806a9b5c2d
Author: Tünde Tóth 
AuthorDate: Tue Nov 30 11:59:55 2021 +0100
Commit: László Németh 
CommitDate: Mon Jan 3 13:37:29 2022 +0100

tdf#98736 OOXML export: keep CaptionShape as TextShape

Caption shapes were lost during OOXML export. As a
workaround, export them as text shapes, losing
only the leader lines, but not their text shapes and
text content.

Change-Id: I372708fa4c9356c807a0a239c722691fd88ec1a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126123
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 35b7a4bd4c9d..997a6e949b76 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1668,6 +1668,11 @@ static const NameToConvertMapType& lcl_GetConverters()
 {
 static NameToConvertMapType const shape_converters
 {
+// tdf#98736 export CaptionShape as TextShape, because it is non-ooxml 
shape and
+//   we can't export this shape as CustomShape
+// TODO: WriteCaptionShape
+{ "com.sun.star.drawing.CaptionShape"  , 
::WriteTextShape },
+
 { "com.sun.star.drawing.ClosedBezierShape" , 
::WriteClosedPolyPolygonShape },
 { "com.sun.star.drawing.ConnectorShape", 
::WriteConnectorShape },
 { "com.sun.star.drawing.CustomShape"   , 
::WriteCustomShape },
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index fa9258949c07..0101e246a42d 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -290,6 +290,7 @@ public:
 void testInsertPdf();
 void testTdf143760WrapContourToOff();
 void testTdf127989();
+void testCaptionShape();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest4);
 CPPUNIT_TEST(testTdf96515);
@@ -413,6 +414,7 @@ public:
 CPPUNIT_TEST(testInsertPdf);
 CPPUNIT_TEST(testTdf143760WrapContourToOff);
 CPPUNIT_TEST(testTdf127989);
+CPPUNIT_TEST(testCaptionShape);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -4067,6 +4069,27 @@ void SwUiWriterTest4::testTdf127989()
 CPPUNIT_ASSERT(!getProperty(getShape(1), "FillBackground"));
 }
 
+void SwUiWriterTest4::testCaptionShape()
+{
+createSwDoc();
+
+// Add a caption shape to the document.
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xShape(
+xFactory->createInstance("com.sun.star.drawing.CaptionShape"), 
uno::UNO_QUERY);
+xShape->setSize(awt::Size(1, 1));
+xShape->setPosition(awt::Point(1000, 1000));
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+xDrawPage->add(xShape);
+
+// Save it as DOCX and load it again.
+reload("Office Open XML Text", "captionshape.docx");
+
+// Without fix in place, the shape was lost on export.
+CPPUNIT_ASSERT_EQUAL(1, getShapes());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sw/qa

2021-12-21 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |5 +++--
 sw/qa/extras/uiwriter/uiwriter4.cxx |   28 
 2 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 642f85b234d61ed87ee74f94b713321572e6774e
Author: Tünde Tóth 
AuthorDate: Wed Dec 8 11:13:24 2021 +0100
Commit: Xisco Fauli 
CommitDate: Tue Dec 21 21:23:24 2021 +0100

tdf#127989 OOXML: fix import of transparent hatching

Set FillBackground property of hatching fill to false,
if the alpha value is 0 in the  element, i.e.
if it's a transparent hatching. This way the previous
non-transparent hatching is transparent now.

Change-Id: I483d5c654be55e74c9073769b06f185526429635
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126550
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 001afbed910b7e565f602c1b11b1b4538cd59442)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127247
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 12d2cd9ad2fd..6a60a685c84f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -816,8 +816,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 // Set background color for hatch
 if(maPatternProps.maPattBgColor.isUsed())
 {
-rPropMap.setProperty( ShapeProperty::FillBackground, 
true );
-rPropMap.setProperty( ShapeProperty::FillColor, 
maPatternProps.maPattBgColor.getColor( rGraphicHelper, nPhClr ) );
+aColor = maPatternProps.maPattBgColor;
+rPropMap.setProperty( ShapeProperty::FillBackground, 
aColor.getTransparency() != 100 );
+rPropMap.setProperty( ShapeProperty::FillColor, 
aColor.getColor( rGraphicHelper, nPhClr ) );
 }
 }
 else if ( maPatternProps.maPattBgColor.isUsed() )
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 44d48697799f..015a065f543b 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -286,6 +286,7 @@ public:
 void testTdf129270();
 void testInsertPdf();
 void testTdf143760WrapContourToOff();
+void testTdf127989();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest4);
 CPPUNIT_TEST(testTdf96515);
@@ -406,6 +407,7 @@ public:
 CPPUNIT_TEST(testTdf129270);
 CPPUNIT_TEST(testInsertPdf);
 CPPUNIT_TEST(testTdf143760WrapContourToOff);
+CPPUNIT_TEST(testTdf127989);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -3816,6 +3818,32 @@ void SwUiWriterTest4::testTdf143760WrapContourToOff()
 CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), 
"SurroundContour"));
 }
 
+void SwUiWriterTest4::testTdf127989()
+{
+createSwDoc();
+
+// Add a rectangle shape to the document.
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xShape(
+xFactory->createInstance("com.sun.star.drawing.RectangleShape"), 
uno::UNO_QUERY);
+xShape->setSize(awt::Size(1, 1));
+xShape->setPosition(awt::Point(1000, 1000));
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+xShapeProps->setPropertyValue("FillStyle", 
uno::makeAny(drawing::FillStyle_HATCH));
+xShapeProps->setPropertyValue("FillHatchName", 
uno::makeAny(OUString("Black 0 Degrees")));
+xShapeProps->setPropertyValue("FillBackground", uno::makeAny(false));
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+xDrawPage->add(xShape);
+
+// Save it as DOCX and load it again.
+reload("Office Open XML Text", "tdf127989.docx");
+CPPUNIT_ASSERT_EQUAL(1, getShapes());
+
+// Without fix this had failed, because the background of the hatch was 
not set as 'no background'.
+CPPUNIT_ASSERT(!getProperty(getShape(1), "FillBackground"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


[Libreoffice-commits] core.git: oox/source sw/qa

2021-12-21 Thread Tünde Tóth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |5 +++--
 sw/qa/extras/uiwriter/uiwriter4.cxx |   28 
 2 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 001afbed910b7e565f602c1b11b1b4538cd59442
Author: Tünde Tóth 
AuthorDate: Wed Dec 8 11:13:24 2021 +0100
Commit: László Németh 
CommitDate: Tue Dec 21 16:00:54 2021 +0100

tdf#127989 OOXML: fix import of transparent hatching

Set FillBackground property of hatching fill to false,
if the alpha value is 0 in the  element, i.e.
if it's a transparent hatching. This way the previous
non-transparent hatching is transparent now.

Change-Id: I483d5c654be55e74c9073769b06f185526429635
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126550
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 12d2cd9ad2fd..6a60a685c84f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -816,8 +816,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 // Set background color for hatch
 if(maPatternProps.maPattBgColor.isUsed())
 {
-rPropMap.setProperty( ShapeProperty::FillBackground, 
true );
-rPropMap.setProperty( ShapeProperty::FillColor, 
maPatternProps.maPattBgColor.getColor( rGraphicHelper, nPhClr ) );
+aColor = maPatternProps.maPattBgColor;
+rPropMap.setProperty( ShapeProperty::FillBackground, 
aColor.getTransparency() != 100 );
+rPropMap.setProperty( ShapeProperty::FillColor, 
aColor.getColor( rGraphicHelper, nPhClr ) );
 }
 }
 else if ( maPatternProps.maPattBgColor.isUsed() )
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 726a939a55c9..fa9258949c07 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -289,6 +289,7 @@ public:
 void testTdf129270();
 void testInsertPdf();
 void testTdf143760WrapContourToOff();
+void testTdf127989();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest4);
 CPPUNIT_TEST(testTdf96515);
@@ -411,6 +412,7 @@ public:
 CPPUNIT_TEST(testTdf129270);
 CPPUNIT_TEST(testInsertPdf);
 CPPUNIT_TEST(testTdf143760WrapContourToOff);
+CPPUNIT_TEST(testTdf127989);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -4039,6 +4041,32 @@ void SwUiWriterTest4::testTdf143760WrapContourToOff()
 CPPUNIT_ASSERT_EQUAL(false, getProperty(getShape(1), 
"SurroundContour"));
 }
 
+void SwUiWriterTest4::testTdf127989()
+{
+createSwDoc();
+
+// Add a rectangle shape to the document.
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xShape(
+xFactory->createInstance("com.sun.star.drawing.RectangleShape"), 
uno::UNO_QUERY);
+xShape->setSize(awt::Size(1, 1));
+xShape->setPosition(awt::Point(1000, 1000));
+uno::Reference xShapeProps(xShape, uno::UNO_QUERY);
+xShapeProps->setPropertyValue("FillStyle", 
uno::makeAny(drawing::FillStyle_HATCH));
+xShapeProps->setPropertyValue("FillHatchName", 
uno::makeAny(OUString("Black 0 Degrees")));
+xShapeProps->setPropertyValue("FillBackground", uno::makeAny(false));
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+xDrawPage->add(xShape);
+
+// Save it as DOCX and load it again.
+reload("Office Open XML Text", "tdf127989.docx");
+CPPUNIT_ASSERT_EQUAL(1, getShapes());
+
+// Without fix this had failed, because the background of the hatch was 
not set as 'no background'.
+CPPUNIT_ASSERT(!getProperty(getShape(1), "FillBackground"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa writerfilter/source

2021-11-30 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx  |   36 +++
 writerfilter/source/dmapper/NumberingManager.cxx |   19 +---
 2 files changed, 45 insertions(+), 10 deletions(-)

New commits:
commit 5d0f0d1a70a0b001be9db95d85f1d33a5f23f13f
Author: Tünde Tóth 
AuthorDate: Fri Nov 19 12:23:41 2021 +0100
Commit: Xisco Fauli 
CommitDate: Tue Nov 30 10:07:47 2021 +0100

tdf#97899 DOCX import: allow character formatting only of numbering

After the DOCX round-trip of a numbering created in Writer
using direct formatting (e.g. using Toggle Ordered/Unordered
List icons), it was not possible to format only the numbering
or bullets, e.g. selecting and formatting them by positioning
the text cursor on the numbering. Set CharStyleName property
during the DOCX import to allow this formatting.

Note: default list styles of Writer is still not supported,
resulting missing numbering after DOCX import.

Change-Id: I6f2c5d6e0d63b15e9c28367181af1e9e083ae68d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125649
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 7b8ae6f90c37c18ff724c0751b5f73cca6ae02ac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125999
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 80874d041267..43ef4250aaba 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -3250,6 +3250,42 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf103612)
 "Text after section");
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf97899)
+{
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
+IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations());
+
+// Create an Ordered List
+rIDCO.InsertString(*pCursor, "a");
+pWrtShell->SplitNode();
+rIDCO.InsertString(*pCursor, "b");
+pWrtShell->SplitNode();
+rIDCO.InsertString(*pCursor, "c");
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
+
+// Save it as DOCX & load it again
+reload("Office Open XML Text", "tdf97899-tmp.docx");
+uno::Reference xNumberingRules
+= 
getProperty>(getParagraph(1), 
"NumberingRules");
+CPPUNIT_ASSERT(xNumberingRules->getCount());
+uno::Sequence aNumbering;
+xNumberingRules->getByIndex(0) >>= aNumbering;
+OUString sCharStyleName;
+for (const auto& prop : aNumbering)
+{
+if (prop.Name == "CharStyleName")
+{
+prop.Value >>= sCharStyleName;
+break;
+}
+}
+CPPUNIT_ASSERT(!sCharStyleName.isEmpty());
+}
+
 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 61dbea4a5563..8829aa52697f 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -568,16 +568,15 @@ void ListDef::CreateNumberingRules( DomainMapper& 
rDMapper,
 lcl_mergeProperties( rAbsCharStyleProps, rCharStyleProps );
 }
 
-if( aAbsCharStyleProps.hasElements() )
-{
-// Change the sequence into a vector
-auto aStyleProps = 
comphelper::sequenceToContainer(aAbsCharStyleProps);
-
-//create (or find) a character style containing the character
-// attributes of the symbol and apply it to the numbering level
-OUString sStyle = rDMapper.getOrCreateCharStyle( aStyleProps, 
/*bAlwaysCreate=*/true );
-
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_CHAR_STYLE_NAME),
 sStyle));
-}
+// Change the sequence into a vector
+auto aStyleProps
+= 
comphelper::sequenceToContainer(aAbsCharStyleProps);
+
+//create (or find) a character style containing the character
+// attributes of the symbol and apply it to the numbering level
+OUString sStyle = rDMapper.getOrCreateCharStyle(aStyleProps, 
/*bAlwaysCreate=*/true);
+aLvlProps.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_CHAR_STYLE_NAME), sStyle));
 
 OUString sText = pAbsLevel
? pAbsLevel->GetBulletChar()


[Libreoffice-commits] core.git: sw/qa writerfilter/source

2021-11-29 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx  |   36 +++
 writerfilter/source/dmapper/NumberingManager.cxx |   19 +---
 2 files changed, 45 insertions(+), 10 deletions(-)

New commits:
commit 7b8ae6f90c37c18ff724c0751b5f73cca6ae02ac
Author: Tünde Tóth 
AuthorDate: Fri Nov 19 12:23:41 2021 +0100
Commit: László Németh 
CommitDate: Mon Nov 29 10:54:39 2021 +0100

tdf#97899 DOCX import: allow character formatting only of numbering

After the DOCX round-trip of a numbering created in Writer
using direct formatting (e.g. using Toggle Ordered/Unordered
List icons), it was not possible to format only the numbering
or bullets, e.g. selecting and formatting them by positioning
the text cursor on the numbering. Set CharStyleName property
during the DOCX import to allow this formatting.

Note: default list styles of Writer is still not supported,
resulting missing numbering after DOCX import.

Change-Id: I6f2c5d6e0d63b15e9c28367181af1e9e083ae68d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125649
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 7214b63e5811..22a4f329296b 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -3254,6 +3254,42 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf103612)
 "Text after section");
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf97899)
+{
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
+IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations());
+
+// Create an Ordered List
+rIDCO.InsertString(*pCursor, "a");
+pWrtShell->SplitNode();
+rIDCO.InsertString(*pCursor, "b");
+pWrtShell->SplitNode();
+rIDCO.InsertString(*pCursor, "c");
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
+
+// Save it as DOCX & load it again
+reload("Office Open XML Text", "tdf97899-tmp.docx");
+uno::Reference xNumberingRules
+= 
getProperty>(getParagraph(1), 
"NumberingRules");
+CPPUNIT_ASSERT(xNumberingRules->getCount());
+uno::Sequence aNumbering;
+xNumberingRules->getByIndex(0) >>= aNumbering;
+OUString sCharStyleName;
+for (const auto& prop : aNumbering)
+{
+if (prop.Name == "CharStyleName")
+{
+prop.Value >>= sCharStyleName;
+break;
+}
+}
+CPPUNIT_ASSERT(!sCharStyleName.isEmpty());
+}
+
 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 61dbea4a5563..8829aa52697f 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -568,16 +568,15 @@ void ListDef::CreateNumberingRules( DomainMapper& 
rDMapper,
 lcl_mergeProperties( rAbsCharStyleProps, rCharStyleProps );
 }
 
-if( aAbsCharStyleProps.hasElements() )
-{
-// Change the sequence into a vector
-auto aStyleProps = 
comphelper::sequenceToContainer(aAbsCharStyleProps);
-
-//create (or find) a character style containing the character
-// attributes of the symbol and apply it to the numbering level
-OUString sStyle = rDMapper.getOrCreateCharStyle( aStyleProps, 
/*bAlwaysCreate=*/true );
-
aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_CHAR_STYLE_NAME),
 sStyle));
-}
+// Change the sequence into a vector
+auto aStyleProps
+= 
comphelper::sequenceToContainer(aAbsCharStyleProps);
+
+//create (or find) a character style containing the character
+// attributes of the symbol and apply it to the numbering level
+OUString sStyle = rDMapper.getOrCreateCharStyle(aStyleProps, 
/*bAlwaysCreate=*/true);
+aLvlProps.push_back(
+
comphelper::makePropertyValue(getPropertyName(PROP_CHAR_STYLE_NAME), sStyle));
 
 OUString sText = pAbsLevel
? pAbsLevel->GetBulletChar()


[Libreoffice-commits] core.git: sd/qa sd/source

2021-11-24 Thread Tünde Tóth (via logerrit)
 sd/qa/uitest/impress_tests/save_readonly_with_password.py |   47 +
 sd/source/filter/eppt/epptooxml.hxx   |2 
 sd/source/filter/eppt/pptx-epptooxml.cxx  |   71 ++
 3 files changed, 120 insertions(+)

New commits:
commit 04e279007272de286be31152d01e9cb45c9bd3e3
Author: Tünde Tóth 
AuthorDate: Wed Nov 3 12:59:47 2021 +0100
Commit: László Németh 
CommitDate: Wed Nov 24 09:19:18 2021 +0100

tdf#145511 PPTX: export the password for editing

The password for editing wasn't exported in PPTX
documents.

Test: Edit->Edit Mode doesn't change to edit mode
any more without asking the password for editing.

Follow-up to commit 5697e09b3e726a38b58ce31ac0c3a97e7871c74a
"tdf#144943 PPTX import: fix permission for editing".

Change-Id: I1a9de511cf8b79224d8ac0a9aa0bf860b87bf184
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124651
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sd/qa/uitest/impress_tests/save_readonly_with_password.py 
b/sd/qa/uitest/impress_tests/save_readonly_with_password.py
index 3f789035d0a8..cd4fe98339c0 100644
--- a/sd/qa/uitest/impress_tests/save_readonly_with_password.py
+++ b/sd/qa/uitest/impress_tests/save_readonly_with_password.py
@@ -13,6 +13,53 @@ import os.path
 
 class save_readonly_with_password(UITestCase):
 
+#Bug 145511 - FILESAVE to PPTX as read-only with additional password 
protection for editing not working
+   def test_save_to_pptx(self):
+
+with TemporaryDirectory() as tempdir:
+xFilePath = os.path.join(tempdir, "tdf144374-tmp.pptx")
+
+with self.ui_test.create_doc_in_start_center("impress"):
+xTemplateDlg = self.xUITest.getTopFocusWindow()
+xCancelBtn = xTemplateDlg.getChild("close")
+self.ui_test.close_dialog_through_button(xCancelBtn)
+
+# Save the document
+with self.ui_test.execute_dialog_through_command(".uno:Save", 
close_button="") as xSaveDialog:
+xFileName = xSaveDialog.getChild("file_name")
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
xFilePath}))
+xFileTypeCombo = xSaveDialog.getChild("file_type")
+select_by_text(xFileTypeCombo, "Office Open XML 
Presentation (.pptx)")
+xPasswordCheckButton = xSaveDialog.getChild("password")
+xPasswordCheckButton.executeAction("CLICK", tuple())
+xOpen = xSaveDialog.getChild("open")
+
+with self.ui_test.execute_dialog_through_action(xOpen, 
"CLICK") as xPasswordDialog:
+xReadonly = xPasswordDialog.getChild("readonly")
+xReadonly.executeAction("CLICK", tuple())
+xNewPassword = 
xPasswordDialog.getChild("newpassroEntry")
+xNewPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
+xConfirmPassword = 
xPasswordDialog.getChild("confirmropassEntry")
+xConfirmPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
+
+# PPTX confirmation dialog is displayed
+xWarnDialog = self.xUITest.getTopFocusWindow()
+xSave = xWarnDialog.getChild("save")
+self.ui_test.close_dialog_through_button(xSave)
+
+with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as 
document:
+
+self.assertTrue(document.isReadonly())
+
+# Without the fix in place, this dialog wouldn't have been 
displayed
+with 
self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
+xPassword = xDialog.getChild("newpassEntry")
+xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": 
"password"}))
+
+self.assertFalse(document.isReadonly())
+
def test_save_to_odp(self):
 
 with TemporaryDirectory() as tempdir:
diff --git a/sd/source/filter/eppt/epptooxml.hxx 
b/sd/source/filter/eppt/epptooxml.hxx
index 82bb6a3ab937..0c7e098f5771 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -168,6 +168,8 @@ private:
 
 /// If this is PPTM, output the VBA stream.
 void WriteVBA();
+
+void WriteModifyVerifier();
 };
 
 }
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 59f2e879b06f..d5787d6f4cb7 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -495,6 +495,8 @@ bool PowerPointExport::exportDocument()
 
 WriteVBA();
 
+

  1   2   3   4   >