core.git: vcl/source

2024-04-18 Thread Tibor Nagy (via logerrit)
 vcl/source/gdi/print3.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit d129495bb19dededacb27fee18c9ed7273dddb82
Author: Tibor Nagy 
AuthorDate: Thu Apr 18 00:09:36 2024 +0200
Commit: Nagy Tibor 
CommitDate: Thu Apr 18 08:34:48 2024 +0200

tdf#160698: fix crash after opening print dialog

Regression from I5a0ab3d781b21eff575afaebb233237eff1827d5
"tdf#155218 sc: fix regression page orientation in print dialog"

Change-Id: Iccdd8a6eefcadea963a1ffec61c0bcf798931fcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166197
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 6b15615f2bc9..5f5e0e0327c9 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1018,9 +1018,12 @@ void 
vcl::ImplPrinterControllerData::resetPaperToLastConfigured()
 // reset the print area created by the Print Dialog to the page style's print 
area.
 void PrinterController::resetPrintArea()
 {
-mpImplData->mxPrinter->ResetPrintArea(true);
-mpImplData->mxPrinter->SetUsePrintDialogSetting(false);
-getPageCount();
+if (mpImplData->mxPrinter->IsUsePrintDialogSetting())
+{
+mpImplData->mxPrinter->ResetPrintArea(true);
+mpImplData->mxPrinter->SetUsePrintDialogSetting(false);
+getPageCount();
+}
 }
 
 int PrinterController::getPageCountProtected() const


core.git: Branch 'libreoffice-24-2' - sc/source

2024-04-07 Thread Tibor Nagy (via logerrit)
 sc/source/ui/view/output2.cxx |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 09a055c7457b005e1d7c733dc951dd8469c75411
Author: Tibor Nagy 
AuthorDate: Wed Mar 13 08:28:41 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Sun Apr 7 21:38:18 2024 +0200

tdf#156655 sc: fix disappear text in merged cell

The text does not appear if the first row or column of the merged cell
is hidden.

Change-Id: I398f0d572226e44ffaa4e33c066b51480ad124cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164757
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 
(cherry picked from commit d5f25d9c0026ec06a0b46e1560e26adba2725290)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165835
Reviewed-by: Thorsten Behrens 

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index d419981d8edb..877675c0ac48 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1877,8 +1877,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
 //  Cells to the left are marked directly, cells to the
 //  right are handled by the flag for nX2
 SCCOL nMarkX = ( nCellX <= nX2 ) ? nCellX : nX2;
-RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : 
[0];
-pMarkRowInfo->basicCellInfo(nMarkX).bEditEngine = true;
+pThisRowInfo->basicCellInfo(nMarkX).bEditEngine = true;
 bDoCell = false;// don't draw here
 }
 if ( bDoCell )
@@ -4429,14 +4428,17 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
 SCROW nCellY = nY;
 bool bDoCell = false;
 
+// if merged cell contains hidden row or column or both
+const ScMergeFlagAttr* pMergeFlag = mpDoc->GetAttr(nX, nY, 
nTab, ATTR_MERGE_FLAG);
+bool bOverlapped = (pMergeFlag->IsHorOverlapped() || 
pMergeFlag->IsVerOverlapped());
+
 tools::Long nPosY = nRowPosY;
-if ( nArrY == 0 )
+if (bOverlapped)
 {
-nPosY = nScrY;
-nY = pRowInfo[1].nRowNo;
+nY = pRowInfo[nArrY].nRowNo;
 SCCOL nOverX;   // start of the merged 
cells
 SCROW nOverY;
-if (GetMergeOrigin( nX,nY, 1, nOverX,nOverY, true ))
+if (GetMergeOrigin( nX,nY, nArrY, nOverX,nOverY, true 
))
 {
 nCellX = nOverX;
 nCellY = nOverY;


core.git: oox/source sd/qa sd/source

2024-03-29 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/shape.cxx  |   11 +++
 sd/qa/unit/data/pptx/tdf157285.pptx |binary
 sd/qa/unit/data/xml/n819614_0.xml   |2 +-
 sd/qa/unit/import-tests2.cxx|   23 +++
 sd/source/ui/unoidl/unopage.cxx |5 +
 5 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 40d3d510fca99b555381deb74b9915c91c924de5
Author: Tibor Nagy 
AuthorDate: Fri Mar 29 15:19:10 2024 +0100
Commit: Nagy Tibor 
CommitDate: Fri Mar 29 23:38:18 2024 +0100

tdf#157285 PPTX import: fix placeholder height

The "TextAutoGrowHeight" property doesn't shrink the shape automatically
when its content is smaller than the current size.

Change-Id: Ia7f94d7452d1a1c3f004aebd73b6ed5cbfd9b43b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165551
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index bd81fa9b42bf..23be28b546b6 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1251,6 +1251,17 @@ Reference< XShape > const & Shape::createAndInsert(
 {
 xSet->setPropertyValue("Decorative", Any(m_isDecorative));
 }
+
+// set the placeholder height to "0" if it has the 
'TextAutoGrowHeight' property
+// the placeholder height is set later to the correct size.
+bool bAutoGrowHeight = false;
+xSet->getPropertyValue("TextAutoGrowHeight") >>= bAutoGrowHeight;
+if (bAutoGrowHeight && 
mxShape->getShapeType().startsWith("com.sun.star.presentation."))
+{
+awt::Size aSize(mxShape->getSize().Width, 0);
+mxShape->setSize(aSize);
+}
+
 if (aServiceName != "com.sun.star.text.TextFrame")
 rxShapes->add( mxShape );
 
diff --git a/sd/qa/unit/data/pptx/tdf157285.pptx 
b/sd/qa/unit/data/pptx/tdf157285.pptx
new file mode 100644
index ..7fa9ec88f1b0
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf157285.pptx differ
diff --git a/sd/qa/unit/data/xml/n819614_0.xml 
b/sd/qa/unit/data/xml/n819614_0.xml
index c889b00c343a..0fa127c07d9b 100644
--- a/sd/qa/unit/data/xml/n819614_0.xml
+++ b/sd/qa/unit/data/xml/n819614_0.xml
@@ -1,6 +1,6 @@
 
 
- 
+ 
   
   
   
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index bf3cfee14dad..9ade40ad1917 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -74,6 +74,29 @@ protected:
 bool checkPattern(int nShapeNumber, std::vector& rExpected);
 };
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157285)
+{
+createSdImpressDoc("pptx/tdf157285.pptx");
+
+uno::Reference xShape1(getShapeFromPage(0, 0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xShape1.is());
+sal_Int32 nHeight1 = xShape1->getSize().Height;
+
+// Without the fix in place, this test would have failed with
+// Expected: placeholder height: 2541
+// Actual  : placeholder height: 3435
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2541), nHeight1);
+
+uno::Reference xShape2(getShapeFromPage(1, 0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xShape2.is());
+sal_Int32 nHeight2 = xShape2->getSize().Height;
+
+// Without the fix in place, this test would have failed with
+// Expected: placeholder height: 1169
+// Actual  : placeholder height: 11303
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1169), nHeight2);
+}
+
 CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf152186)
 {
 createSdImpressDoc("pptx/tdf152186.pptx");
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 1462e08e369e..569116c96b61 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -486,6 +486,11 @@ rtl::Reference 
SdGenericDrawPage::CreateSdrObject_( const Reference<
 
 ::tools::Rectangle aRect( eObjKind == PresObjKind::Title ? 
GetPage()->GetTitleRect() : GetPage()->GetLayoutRect()  );
 
+// OOXML placeholder with auto grow height
+// do not set the height here yet
+if (xShape->getSize().Height == 0)
+aRect.setHeight(0);
+
 const awt::Point aPos( aRect.Left(), aRect.Top() );
 xShape->setPosition( aPos );
 


core.git: Branch 'libreoffice-7-6' - drawinglayer/source sc/qa sc/source

2024-03-20 Thread Tibor Nagy (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |1 
 sc/qa/extras/scpdfexport.cxx   |   14 
 sc/qa/extras/testdocuments/tdf159094.ods   |binary
 sc/source/ui/unoobj/docuno.cxx |  190 -
 4 files changed, 197 insertions(+), 8 deletions(-)

New commits:
commit bffef73b0a0633969149ef504f97d9c701647a9e
Author: Tibor Nagy 
AuthorDate: Fri Mar 8 00:51:06 2024 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 20 16:15:38 2024 +0100

tdf#159094 sc: fix failure when exporting media files to PDF

Change-Id: I948190b31f45cf05ba24d1fbc4a84dfe91eb3876
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164557
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164976
(cherry picked from commit 4c1b617863f46ec4ef2553df8bde46b98b4a48bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164993

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index f2aea4cd7eae..b523c57c94df 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2584,6 +2584,7 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 case vcl::PDFWriter::TableRow:
 case vcl::PDFWriter::Formula:
 case vcl::PDFWriter::Figure:
+case vcl::PDFWriter::Annot:
 
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement,
   
vcl::PDFWriter::Block);
 break;
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index ca4a7b762f63..26b129d99d3c 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -58,6 +58,7 @@ private:
 
 // unit tests
 public:
+void testMediaShapeScreen_Tdf159094();
 void testExportRange_Tdf120161();
 void testExportFitToPage_Tdf103516();
 void testUnoCommands_Tdf120161();
@@ -69,6 +70,7 @@ public:
 void testForcepoint97();
 
 CPPUNIT_TEST_SUITE(ScPDFExportTest);
+CPPUNIT_TEST(testMediaShapeScreen_Tdf159094);
 CPPUNIT_TEST(testExportRange_Tdf120161);
 CPPUNIT_TEST(testExportFitToPage_Tdf103516);
 CPPUNIT_TEST(testUnoCommands_Tdf120161);
@@ -199,6 +201,18 @@ void ScPDFExportTest::setFont(ScFieldEditEngine& rEE, 
sal_Int32 nStart, sal_Int3
 rEE.QuickSetAttribs(aItemSet, aSel);
 }
 
+void ScPDFExportTest::testMediaShapeScreen_Tdf159094()
+{
+loadFromFile(u"tdf159094.ods");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+
+// A1:B8
+ScRange aRange(0, 0, 0, 1, 7, 0);
+
+// Without the fix, this test would crash on export media file to pdf
+exportToPDF(xModel, aRange);
+}
+
 // Selection was not taken into account during export into PDF
 void ScPDFExportTest::testExportRange_Tdf120161()
 {
diff --git a/sc/qa/extras/testdocuments/tdf159094.ods 
b/sc/qa/extras/testdocuments/tdf159094.ods
new file mode 100644
index ..c267b2152192
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf159094.ods differ
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a4fc5f6d60de..216cd6328be4 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -27,6 +27,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -127,6 +130,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2030,7 +2034,7 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 bWasCellRange = pPrintFunc->GetLastSourceRange( aCellRange );
 Size aTwips = pPrintFunc->GetPageSize();
 
-if (!m_pPrintState)
+if (!m_pPrintState || nRenderer == nTabStart)
 {
 m_pPrintState.reset(new ScPrintState());
 pPrintFunc->GetPrintState(*m_pPrintState, true);
@@ -2076,6 +2080,172 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 return aSequence;
 }
 
+static void lcl_SetMediaScreen(const uno::Reference& 
xMediaShape,
+   const OutputDevice* pDev, tools::Rectangle& 
aRect,
+   sal_Int32 nPageNumb)
+{
+OUString sMediaURL;
+uno::Reference xPropSet(xMediaShape, uno::UNO_QUERY);
+xPropSet->getPropertyValue("MediaURL") >>= sMediaURL;
+if (!sMediaURL.isEmpty())
+{
+OUString sTitle;
+xPropSet->getPropertyValue("Title") >>= sTitle;
+OUString sDescription;
+xPropSet->getPropertyValue("Description") >>= sDescription;
+OUString const altText(sTitle.isEmpty() ? sDescription
+   : sDescription.isEmpty()
+   ? sTitle
+   

core.git: sc/source

2024-03-13 Thread Tibor Nagy (via logerrit)
 sc/source/ui/view/output2.cxx |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit d5f25d9c0026ec06a0b46e1560e26adba2725290
Author: Tibor Nagy 
AuthorDate: Wed Mar 13 08:28:41 2024 +0100
Commit: Nagy Tibor 
CommitDate: Thu Mar 14 01:09:04 2024 +0100

tdf#156655 sc: fix disappear text in merged cell

The text does not appear if the first row or column of the merged cell
is hidden.

Change-Id: I398f0d572226e44ffaa4e33c066b51480ad124cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164757
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 2b6b5a27100b..dd9a7ba0e1a5 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1909,8 +1909,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
 //  Cells to the left are marked directly, cells to the
 //  right are handled by the flag for nX2
 SCCOL nMarkX = ( nCellX <= nX2 ) ? nCellX : nX2;
-RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : 
[0];
-pMarkRowInfo->basicCellInfo(nMarkX).bEditEngine = true;
+pThisRowInfo->basicCellInfo(nMarkX).bEditEngine = true;
 bDoCell = false;// don't draw here
 
 // Mark the tagged "TD" structure element to be drawn in 
DrawEdit
@@ -4485,14 +4484,17 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
 SCROW nCellY = nY;
 bool bDoCell = false;
 
+// if merged cell contains hidden row or column or both
+const ScMergeFlagAttr* pMergeFlag = mpDoc->GetAttr(nX, nY, 
nTab, ATTR_MERGE_FLAG);
+bool bOverlapped = (pMergeFlag->IsHorOverlapped() || 
pMergeFlag->IsVerOverlapped());
+
 tools::Long nPosY = nRowPosY;
-if ( nArrY == 0 )
+if (bOverlapped)
 {
-nPosY = nScrY;
-nY = pRowInfo[1].nRowNo;
+nY = pRowInfo[nArrY].nRowNo;
 SCCOL nOverX;   // start of the merged 
cells
 SCROW nOverY;
-if (GetMergeOrigin( nX,nY, 1, nOverX,nOverY, true ))
+if (GetMergeOrigin( nX,nY, nArrY, nOverX,nOverY, true 
))
 {
 nCellX = nOverX;
 nCellY = nOverY;


core.git: drawinglayer/source sc/qa sc/source

2024-03-11 Thread Tibor Nagy (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |1 
 sc/qa/extras/scpdfexport.cxx   |   14 
 sc/qa/extras/testdocuments/tdf159094.ods   |binary
 sc/source/ui/unoobj/docuno.cxx |  190 -
 4 files changed, 197 insertions(+), 8 deletions(-)

New commits:
commit f3bfe66fb54190fee6ac579835c03c2b4a2735d0
Author: Tibor Nagy 
AuthorDate: Fri Mar 8 00:51:06 2024 +0100
Commit: Nagy Tibor 
CommitDate: Mon Mar 11 15:59:22 2024 +0100

tdf#159094 sc: fix failure when exporting media files to PDF

Change-Id: I948190b31f45cf05ba24d1fbc4a84dfe91eb3876
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164557
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 4dc33974189f..0d4ee95470dc 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2576,6 +2576,7 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 case vcl::PDFWriter::TableRow:
 case vcl::PDFWriter::Formula:
 case vcl::PDFWriter::Figure:
+case vcl::PDFWriter::Annot:
 
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement,
   
vcl::PDFWriter::Block);
 break;
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index 6cf93f71ed51..b26c61bdfddd 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -61,6 +61,7 @@ private:
 
 // unit tests
 public:
+void testMediaShapeScreen_Tdf159094();
 void testExportRange_Tdf120161();
 void testExportFitToPage_Tdf103516();
 void testUnoCommands_Tdf120161();
@@ -77,6 +78,7 @@ public:
 void testForcepoint97();
 
 CPPUNIT_TEST_SUITE(ScPDFExportTest);
+CPPUNIT_TEST(testMediaShapeScreen_Tdf159094);
 CPPUNIT_TEST(testExportRange_Tdf120161);
 CPPUNIT_TEST(testExportFitToPage_Tdf103516);
 CPPUNIT_TEST(testUnoCommands_Tdf120161);
@@ -213,6 +215,18 @@ void ScPDFExportTest::setFont(ScFieldEditEngine& rEE, 
sal_Int32 nStart, sal_Int3
 rEE.QuickSetAttribs(aItemSet, aSel);
 }
 
+void ScPDFExportTest::testMediaShapeScreen_Tdf159094()
+{
+loadFromFile(u"tdf159094.ods");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+
+// A1:B8
+ScRange aRange(0, 0, 0, 1, 7, 0);
+
+// Without the fix, this test would crash on export media file to pdf
+exportToPDF(xModel, aRange);
+}
+
 // Selection was not taken into account during export into PDF
 void ScPDFExportTest::testExportRange_Tdf120161()
 {
diff --git a/sc/qa/extras/testdocuments/tdf159094.ods 
b/sc/qa/extras/testdocuments/tdf159094.ods
new file mode 100644
index ..c267b2152192
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf159094.ods differ
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e80a3bbed259..eef74952df9a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -29,6 +29,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -134,6 +137,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2147,7 +2151,7 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 bWasCellRange = pPrintFunc->GetLastSourceRange( aCellRange );
 Size aTwips = pPrintFunc->GetPageSize();
 
-if (!m_pPrintState)
+if (!m_pPrintState || nRenderer == nTabStart)
 {
 m_pPrintState.reset(new ScPrintState());
 pPrintFunc->GetPrintState(*m_pPrintState, true);
@@ -2343,6 +2347,172 @@ static void lcl_PDFExportBookmarkHelper(OutputDevice* 
pDev, ScDocument& rDoc,
 rBookmarks.clear();
 }
 
+static void lcl_SetMediaScreen(const uno::Reference& 
xMediaShape,
+   const OutputDevice* pDev, tools::Rectangle& 
aRect,
+   sal_Int32 nPageNumb)
+{
+OUString sMediaURL;
+uno::Reference xPropSet(xMediaShape, uno::UNO_QUERY);
+xPropSet->getPropertyValue("MediaURL") >>= sMediaURL;
+if (!sMediaURL.isEmpty())
+{
+OUString sTitle;
+xPropSet->getPropertyValue("Title") >>= sTitle;
+OUString sDescription;
+xPropSet->getPropertyValue("Description") >>= sDescription;
+OUString const altText(sTitle.isEmpty() ? sDescription
+   : sDescription.isEmpty()
+   ? sTitle
+   : OUString::Concat(sTitle) + 
OUString::Concat("
")
+ + OUString::Concat(sDescription));
+
+OUString const 

core.git: Branch 'feature/cib_contract49' - include/vcl sc/source vcl/source

2024-03-03 Thread Tibor Nagy (via logerrit)
 include/vcl/print.hxx  |4 ++
 sc/source/ui/unoobj/docuno.cxx |   63 +
 vcl/source/gdi/print.cxx   |1 
 vcl/source/gdi/print3.cxx  |   10 +-
 vcl/source/window/printdlg.cxx |7 ++--
 5 files changed, 64 insertions(+), 21 deletions(-)

New commits:
commit 2fc3251ef884ba75077126a631a55c9a51a47d1d
Author: Tibor Nagy 
AuthorDate: Wed Feb 28 11:13:10 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Mar 4 02:09:14 2024 +0100

tdf#155218 sc: fix regression page orientation in print dialog

The print page orientation set in the Print Dialog displays incorrect
print area borders on the sheet after closing the Print Dialog or
interrupting the printing process.

The print dialog increase in size if the "Pages" and "All pages" radio
buttons are toggled many times.(problem is not reproduced on Windows)

regression was made by: I5e494a0714e398221bee00744d7e25c419a41df7

Includes "Read of uninitialized Printer::mbResetPrintArea" fixup by Stephan.

Change-Id: I5a0ab3d781b21eff575afaebb233237eff1827d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164085
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164312
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 870ed5d915a1..53ff09694556 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -93,6 +93,7 @@ private:
 boolmbNewJobSetup;
 boolmbSinglePrintJobs;
 boolmbUsePrintSetting;
+boolmbResetPrintArea;
 
 VCL_DLLPRIVATE void ImplInitData();
 VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
@@ -222,6 +223,8 @@ public:
 VCL_DLLPRIVATE void SetPrinterOptions( const 
vcl::printer::Options& rOptions );
 const vcl::printer::Options& GetPrinterOptions() const { return( 
*mpPrinterOptions ); }
 
+voidResetPrintArea(bool bReset) { mbResetPrintArea 
= bReset; }
+boolIsPrintAreaReset() { return mbResetPrintArea; }
 voidSetUsePrintDialogSetting(bool bUsed) { 
mbUsePrintSetting = bUsed; }
 boolIsUsePrintDialogSetting() { return 
mbUsePrintSetting; }
 voidSetPrintPageSize(Size aPrintPageSize) { 
maPrintPageSize = aPrintPageSize; }
@@ -482,6 +485,7 @@ public:
   bool  getPrinterModified() const;
 VCL_DLLPRIVATEvoid  pushPropertiesToPrinter();
 VCL_DLLPRIVATEvoid  resetPaperToLastConfigured();
+VCL_DLLPRIVATEvoid  resetPrintArea();
   void  setJobState( css::view::PrintableState 
);
 VCL_DLLPRIVATEvoid  setupPrinter( weld::Window* 
i_pDlgParent );
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d70716b0a4c1..b572ae28c975 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1570,22 +1570,20 @@ static bool lcl_ParseTarget( const OUString& rTarget, 
ScRange& rTargetRange, too
 return bRangeValid;
 }
 
- static void lcl_SetPrintPage(const uno::Sequence& 
rOptions, Size& aSize,
- bool& bLandscape, bool& bUsed)
+static Printer* lcl_GetPrinter(const uno::Sequence& 
rOptions)
 {
+Printer* pPrinter = nullptr;
 OutputDevice* pDev = lcl_GetRenderDevice(rOptions);
 if (pDev && pDev->GetOutDevType() == OUTDEV_PRINTER)
-{
-Printer* pPrinter = dynamic_cast(pDev);
-if (pPrinter && pPrinter->IsUsePrintDialogSetting())
-{
-bUsed = true;
-bLandscape = (pPrinter->GetOrientation() == 
Orientation::Landscape);
-aSize = pPrinter->GetPrintPageSize();
-aSize.setWidth(o3tl::convert(aSize.Width(), o3tl::Length::mm100, 
o3tl::Length::twip));
-aSize.setHeight(o3tl::convert(aSize.Height(), o3tl::Length::mm100, 
o3tl::Length::twip));
-}
-}
+pPrinter = dynamic_cast(pDev);
+return pPrinter;
+}
+
+static Size lcl_GetPrintPageSize(Size aSize)
+{
+aSize.setWidth(o3tl::convert(aSize.Width(), o3tl::Length::mm100, 
o3tl::Length::twip));
+aSize.setHeight(o3tl::convert(aSize.Height(), o3tl::Length::mm100, 
o3tl::Length::twip));
+return aSize;
 }
 
 bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
@@ -1775,15 +1773,28 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const 
uno::Any& aSelection,
 return 0;
 
 Size aPrintPageSize;
+bool bPrintAreaReset = false;
 bool bPrintPageLandscape = false;
 bool bUsePrintDialogSetting = false;
-lcl_SetPrintPage(rOptions, aPrintPageSize, bPrintPageLandscape, 

core.git: include/vcl sc/source vcl/source

2024-02-28 Thread Tibor Nagy (via logerrit)
 include/vcl/print.hxx  |4 ++
 sc/source/ui/unoobj/docuno.cxx |   63 +
 vcl/source/gdi/print3.cxx  |   10 +-
 vcl/source/window/printdlg.cxx |7 ++--
 4 files changed, 63 insertions(+), 21 deletions(-)

New commits:
commit 364f0bb1cac0e12f5f926857f61c2f329a353ec7
Author: Tibor Nagy 
AuthorDate: Wed Feb 28 11:13:10 2024 +0100
Commit: Nagy Tibor 
CommitDate: Thu Feb 29 01:36:08 2024 +0100

tdf#155218 sc: fix regression page orientation in print dialog

The print page orientation set in the Print Dialog displays incorrect
print area borders on the sheet after closing the Print Dialog or
interrupting the printing process.

The print dialog increase in size if the "Pages" and "All pages" radio
buttons are toggled many times.(problem is not reproduced on Windows)

regression was made by: I5e494a0714e398221bee00744d7e25c419a41df7

Change-Id: I5a0ab3d781b21eff575afaebb233237eff1827d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164085
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 3da922afa884..2948ec3d823c 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -93,6 +93,7 @@ private:
 boolmbNewJobSetup;
 boolmbSinglePrintJobs;
 boolmbUsePrintSetting;
+boolmbResetPrintArea;
 
 VCL_DLLPRIVATE void ImplInitData();
 VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
@@ -222,6 +223,8 @@ public:
 VCL_DLLPRIVATE void SetPrinterOptions( const 
vcl::printer::Options& rOptions );
 const vcl::printer::Options& GetPrinterOptions() const { return( 
*mpPrinterOptions ); }
 
+voidResetPrintArea(bool bReset) { mbResetPrintArea 
= bReset; }
+boolIsPrintAreaReset() { return mbResetPrintArea; }
 voidSetUsePrintDialogSetting(bool bUsed) { 
mbUsePrintSetting = bUsed; }
 boolIsUsePrintDialogSetting() { return 
mbUsePrintSetting; }
 voidSetPrintPageSize(Size aPrintPageSize) { 
maPrintPageSize = aPrintPageSize; }
@@ -483,6 +486,7 @@ public:
   bool  getPrinterModified() const;
 VCL_DLLPRIVATEvoid  pushPropertiesToPrinter();
 VCL_DLLPRIVATEvoid  resetPaperToLastConfigured();
+VCL_DLLPRIVATEvoid  resetPrintArea();
   void  setJobState( css::view::PrintableState 
);
 VCL_DLLPRIVATEvoid  setupPrinter( weld::Window* 
i_pDlgParent );
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index bb36b29068ac..c46e10b23832 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1637,22 +1637,20 @@ static bool lcl_ParseTarget( const OUString& rTarget, 
ScRange& rTargetRange, too
 return bRangeValid;
 }
 
- static void lcl_SetPrintPage(const uno::Sequence& 
rOptions, Size& aSize,
- bool& bLandscape, bool& bUsed)
+static Printer* lcl_GetPrinter(const uno::Sequence& 
rOptions)
 {
+Printer* pPrinter = nullptr;
 OutputDevice* pDev = lcl_GetRenderDevice(rOptions);
 if (pDev && pDev->GetOutDevType() == OUTDEV_PRINTER)
-{
-Printer* pPrinter = dynamic_cast(pDev);
-if (pPrinter && pPrinter->IsUsePrintDialogSetting())
-{
-bUsed = true;
-bLandscape = (pPrinter->GetOrientation() == 
Orientation::Landscape);
-aSize = pPrinter->GetPrintPageSize();
-aSize.setWidth(o3tl::convert(aSize.Width(), o3tl::Length::mm100, 
o3tl::Length::twip));
-aSize.setHeight(o3tl::convert(aSize.Height(), o3tl::Length::mm100, 
o3tl::Length::twip));
-}
-}
+pPrinter = dynamic_cast(pDev);
+return pPrinter;
+}
+
+static Size lcl_GetPrintPageSize(Size aSize)
+{
+aSize.setWidth(o3tl::convert(aSize.Width(), o3tl::Length::mm100, 
o3tl::Length::twip));
+aSize.setHeight(o3tl::convert(aSize.Height(), o3tl::Length::mm100, 
o3tl::Length::twip));
+return aSize;
 }
 
 bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection,
@@ -1842,15 +1840,28 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const 
uno::Any& aSelection,
 return 0;
 
 Size aPrintPageSize;
+bool bPrintAreaReset = false;
 bool bPrintPageLandscape = false;
 bool bUsePrintDialogSetting = false;
-lcl_SetPrintPage(rOptions, aPrintPageSize, bPrintPageLandscape, 
bUsePrintDialogSetting);
+Printer* pPrinter = lcl_GetPrinter(rOptions);
+if (pPrinter)
+{
+if (pPrinter->IsUsePrintDialogSetting())
+{
+bUsePrintDialogSetting = true;
+bPrintPageLandscape = (pPrinter->GetOrientation() == 

core.git: Branch 'feature/cib_contract49' - 3 commits - include/vcl sc/qa sc/source sw/qa vcl/inc vcl/source writerfilter/source

2024-02-23 Thread Tibor Nagy (via logerrit)
 include/vcl/print.hxx  |6 ++
 sc/qa/uitest/calc_dialogs/printDialog.py   |   38 
 sc/qa/uitest/data/tdf155218.ods|binary
 sc/source/ui/inc/pfuncache.hxx |7 +-
 sc/source/ui/inc/printfun.hxx  |   18 +-
 sc/source/ui/unoobj/docuno.cxx |   53 +++--
 sc/source/ui/view/pfuncache.cxx|   15 +++--
 sc/source/ui/view/printfun.cxx |   41 +
 sw/qa/extras/rtfexport/data/piccrop.rtf|   74 +
 sw/qa/extras/rtfexport/rtfexport8.cxx  |   25 
 vcl/inc/printdlg.hxx   |2 
 vcl/source/gdi/print.cxx   |1 
 vcl/source/gdi/print3.cxx  |1 
 vcl/source/window/printdlg.cxx |   49 
 writerfilter/source/dmapper/GraphicImport.cxx  |   12 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 +++
 writerfilter/source/rtftok/rtfvalue.cxx|9 +++
 writerfilter/source/rtftok/rtfvalue.hxx|6 ++
 18 files changed, 335 insertions(+), 32 deletions(-)

New commits:
commit 1ad60d6860fd92d58394061f3bdb49dce38ecf72
Author: Tibor Nagy 
AuthorDate: Sun Feb 11 16:25:48 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Feb 23 15:37:31 2024 +0100

tdf#155218 sc: fix incorrect print area

In the print dialog, changes to the page orientation should not alter
the print area that is defined by the page style.

issue caused by commit I5e494a0714e398221bee00744d7e25c419a41df7
(tdf#155218 sc: fix different page orientation in print dialog)

Change-Id: I44eb3b30df0e8a227743df334da35316f86a0679
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163231
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 1ebab3b48177..5fb7b2b286d1 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -514,6 +514,7 @@ bool 
Printer::PreparePrintJob(std::shared_ptr xController,
 PrintDialog aDlg(xController->getWindow(), xController);
 if (!aDlg.run())
 {
+xController->getPrinter()->SetUsePrintDialogSetting(false);
 xController->abortJob();
 return false;
 }
commit c8f7ecd06aec9305a39678b28239e163475b8cfd
Author: Tibor Nagy 
AuthorDate: Wed Jan 31 16:49:24 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Feb 23 15:36:02 2024 +0100

tdf#155218 sc: fix different page orientation in print dialog

The page orientation is correct if you set it in the page style first.
However, if you change it in the Print dialog the page layout and size
refresh but the content orientation remains the same.

Change-Id: I5e494a0714e398221bee00744d7e25c419a41df7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162845
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index e23cf8d0af1b..870ed5d915a1 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -80,6 +80,7 @@ private:
 JobSetupmaJobSetup;
 Point   maPageOffset;
 SizemaPaperSize;
+SizemaPrintPageSize;
 ErrCode mnError;
 sal_uInt16  mnPageQueueSize;
 sal_uInt16  mnCopyCount;
@@ -91,6 +92,7 @@ private:
 boolmbInPrintPage;
 boolmbNewJobSetup;
 boolmbSinglePrintJobs;
+boolmbUsePrintSetting;
 
 VCL_DLLPRIVATE void ImplInitData();
 VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
@@ -220,6 +222,10 @@ public:
 VCL_DLLPRIVATE void SetPrinterOptions( const 
vcl::printer::Options& rOptions );
 const vcl::printer::Options& GetPrinterOptions() const { return( 
*mpPrinterOptions ); }
 
+voidSetUsePrintDialogSetting(bool bUsed) { 
mbUsePrintSetting = bUsed; }
+boolIsUsePrintDialogSetting() { return 
mbUsePrintSetting; }
+voidSetPrintPageSize(Size aPrintPageSize) { 
maPrintPageSize = aPrintPageSize; }
+SizeGetPrintPageSize() { return maPrintPageSize; }
 boolSetOrientation( Orientation eOrient );
 Orientation GetOrientation() const;
 voidSetDuplexMode( DuplexMode );
diff --git a/sc/qa/uitest/calc_dialogs/printDialog.py 
b/sc/qa/uitest/calc_dialogs/printDialog.py
new file mode 100644
index ..3e1290b9c8af
--- /dev/null
+++ b/sc/qa/uitest/calc_dialogs/printDialog.py
@@ -0,0 +1,38 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; 

core.git: Branch 'distro/collabora/co-23.05' - oox/source sd/qa svx/source

2024-02-19 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx|   16 +++
 oox/source/token/properties.txt   |1 
 sd/qa/unit/data/pptx/tdf156829.pptx   |binary
 sd/qa/unit/data/xml/n762695_0.xml |1 
 sd/qa/unit/data/xml/n762695_1.xml |2 +
 sd/qa/unit/data/xml/tdf109317_0.xml   |3 ++
 sd/qa/unit/import-tests.cxx   |   30 ++
 svx/source/customshapes/EnhancedCustomShape2d.cxx |2 -
 8 files changed, 54 insertions(+), 1 deletion(-)

New commits:
commit 7058ee63c0a3baba177dd719d4b7265cfd3b5ede
Author: Tibor Nagy 
AuthorDate: Sun Aug 27 18:39:17 2023 +0200
Commit: Aron Budea 
CommitDate: Tue Feb 20 07:11:43 2024 +0100

tdf#156829 PPTX import: fix connector regression at missing glue points

Glue points weren't imported if the custom shape type is
"non-primitive", resulting broken line connectors, moreover
broken graphic design, as attached to the original bug report.

~Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors".

Change-Id: I9908a23f8e6997bc1384aaeb3e8ba43c08d20d42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156171
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit a126f499bd4bef203f26b251d85ee30ce5dc4f91)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156222
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit d13505b8ef7459d97e9f90ee099ca54354d99922)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163609
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 9cdbb4ee8801..3483969f716d 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -228,6 +228,22 @@ void CustomShapeProperties::pushToPropSet(
 aPath.setProperty( PROP_TextFrames, aTextFrames);
 }
 
+if (!maConnectionSiteList.empty())
+{
+css::uno::Sequence seqGluePoints;
+seqGluePoints.realloc(maConnectionSiteList.size());
+sal_Int32 nId = 0;
+for (auto& rGluePoint : asNonConstRange(seqGluePoints))
+{
+rGluePoint.First.Value = 
maConnectionSiteList[nId].pos.First.Value;
+rGluePoint.First.Type = 
maConnectionSiteList[nId].pos.First.Type;
+rGluePoint.Second.Value = 
maConnectionSiteList[nId].pos.Second.Value;
+rGluePoint.Second.Type = 
maConnectionSiteList[nId].pos.Second.Type;
+nId++;
+}
+aPath.setProperty(PROP_GluePoints, seqGluePoints);
+}
+
 sal_uInt32 nParameterPairs = 0;
 for ( auto const & i: maPath2DList )
 nParameterPairs += i.parameter.size();
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index a6de5458b663..b5a3478f45b0 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -224,6 +224,7 @@ GenerateVbaEvents
 Geometry3D
 GlowEffect
 GlowEffectRadius
+GluePoints
 GradientName
 HatchName
 Graphic
diff --git a/sd/qa/unit/data/pptx/tdf156829.pptx 
b/sd/qa/unit/data/pptx/tdf156829.pptx
new file mode 100644
index ..423588377279
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf156829.pptx differ
diff --git a/sd/qa/unit/data/xml/n762695_0.xml 
b/sd/qa/unit/data/xml/n762695_0.xml
index ae755e644de7..59b226e0d5f8 100644
--- a/sd/qa/unit/data/xml/n762695_0.xml
+++ b/sd/qa/unit/data/xml/n762695_0.xml
@@ -63,6 +63,7 @@

   
  
+ 
  
   

diff --git a/sd/qa/unit/data/xml/n762695_1.xml 
b/sd/qa/unit/data/xml/n762695_1.xml
index a43924138f45..02d3b735da86 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -67,6 +67,7 @@

   
  
+ 
  
   

@@ -151,6 +152,7 @@

   
  
+ 
  
   

diff --git a/sd/qa/unit/data/xml/tdf109317_0.xml 
b/sd/qa/unit/data/xml/tdf109317_0.xml
index f34beafbdc80..74559e74 100644
--- a/sd/qa/unit/data/xml/tdf109317_0.xml
+++ b/sd/qa/unit/data/xml/tdf109317_0.xml
@@ -22,6 +22,7 @@


 
+ 
  
  
  
@@ -130,6 +131,7 @@


 
+ 
  
  
  
@@ -406,6 +408,7 @@


 
+ 
  
  
  
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 706214950411..8b885b0ad3ab 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -85,6 +85,7 @@ public:
 
 void testDocumentLayout();
 void testTdf154363();
+void testFreeformShapeGluePoints();
 void testTdf153466();
 void testTdf152434();
 void testStandardConnectors();
@@ -165,6 +166,7 @@ 

core.git: vcl/source

2024-02-11 Thread Tibor Nagy (via logerrit)
 vcl/source/gdi/print3.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5ccee13baa29c9899c88519ad71ed18c3fe944c1
Author: Tibor Nagy 
AuthorDate: Sun Feb 11 16:25:48 2024 +0100
Commit: Nagy Tibor 
CommitDate: Sun Feb 11 18:52:48 2024 +0100

tdf#155218 sc: fix incorrect print area

In the print dialog, changes to the page orientation should not alter
the print area that is defined by the page style.

issue caused by commit I5e494a0714e398221bee00744d7e25c419a41df7
(tdf#155218 sc: fix different page orientation in print dialog)

Change-Id: I44eb3b30df0e8a227743df334da35316f86a0679
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163231
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index dde3d8368116..a43bc41599cd 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -514,6 +514,7 @@ bool 
Printer::PreparePrintJob(std::shared_ptr xController,
 PrintDialog aDlg(xController->getWindow(), xController);
 if (!aDlg.run())
 {
+xController->getPrinter()->SetUsePrintDialogSetting(false);
 xController->abortJob();
 return false;
 }


core.git: include/vcl sc/qa sc/source vcl/inc vcl/source

2024-02-09 Thread Tibor Nagy (via logerrit)
 include/vcl/print.hxx|6 +++
 sc/qa/uitest/calc_dialogs/printDialog.py |   38 ++
 sc/qa/uitest/data/tdf155218.ods  |binary
 sc/source/ui/inc/pfuncache.hxx   |7 ++--
 sc/source/ui/inc/printfun.hxx|   18 --
 sc/source/ui/unoobj/docuno.cxx   |   53 +++
 sc/source/ui/view/pfuncache.cxx  |   15 ++--
 sc/source/ui/view/printfun.cxx   |   41 +++
 vcl/inc/printdlg.hxx |2 +
 vcl/source/gdi/print.cxx |1 
 vcl/source/window/printdlg.cxx   |   49 
 11 files changed, 200 insertions(+), 30 deletions(-)

New commits:
commit a67cd7b3cf03163f87811f7080cabc49750c4fd5
Author: Tibor Nagy 
AuthorDate: Wed Jan 31 16:49:24 2024 +0100
Commit: Nagy Tibor 
CommitDate: Fri Feb 9 12:06:01 2024 +0100

tdf#155218 sc: fix different page orientation in print dialog

The page orientation is correct if you set it in the page style first.
However, if you change it in the Print dialog the page layout and size
refresh but the content orientation remains the same.

Change-Id: I5e494a0714e398221bee00744d7e25c419a41df7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162845
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index e23cf8d0af1b..870ed5d915a1 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -80,6 +80,7 @@ private:
 JobSetupmaJobSetup;
 Point   maPageOffset;
 SizemaPaperSize;
+SizemaPrintPageSize;
 ErrCode mnError;
 sal_uInt16  mnPageQueueSize;
 sal_uInt16  mnCopyCount;
@@ -91,6 +92,7 @@ private:
 boolmbInPrintPage;
 boolmbNewJobSetup;
 boolmbSinglePrintJobs;
+boolmbUsePrintSetting;
 
 VCL_DLLPRIVATE void ImplInitData();
 VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
@@ -220,6 +222,10 @@ public:
 VCL_DLLPRIVATE void SetPrinterOptions( const 
vcl::printer::Options& rOptions );
 const vcl::printer::Options& GetPrinterOptions() const { return( 
*mpPrinterOptions ); }
 
+voidSetUsePrintDialogSetting(bool bUsed) { 
mbUsePrintSetting = bUsed; }
+boolIsUsePrintDialogSetting() { return 
mbUsePrintSetting; }
+voidSetPrintPageSize(Size aPrintPageSize) { 
maPrintPageSize = aPrintPageSize; }
+SizeGetPrintPageSize() { return maPrintPageSize; }
 boolSetOrientation( Orientation eOrient );
 Orientation GetOrientation() const;
 voidSetDuplexMode( DuplexMode );
diff --git a/sc/qa/uitest/calc_dialogs/printDialog.py 
b/sc/qa/uitest/calc_dialogs/printDialog.py
new file mode 100644
index ..3e1290b9c8af
--- /dev/null
+++ b/sc/qa/uitest/calc_dialogs/printDialog.py
@@ -0,0 +1,38 @@
+# -*- 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.common import get_state_as_dict, get_url_for_data_file, 
select_by_text
+
+class printDialog(UITestCase):
+def test_printDialog(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf155218.ods")):
+with self.ui_test.execute_dialog_through_command(".uno:Print", 
close_button="cancel") as xDialog:
+
+xPortraiTotalNumberPages = xDialog.getChild("totalnumpages")
+
self.assertEqual(get_state_as_dict(xPortraiTotalNumberPages)["Text"], "/ 2")
+
+xPortraiPageRange = xDialog.getChild("pagerange")
+self.assertEqual(get_state_as_dict(xPortraiPageRange)["Text"], 
"1-2")
+
+xpageorientationbox = xDialog.getChild("pageorientationbox")
+select_by_text(xpageorientationbox, "Landscape")
+
+# Without the fix in place, this test would have failed with
+# Expected: "/ 1"
+# Actual  : "/ 2"
+xLandscapeTotalNumberPages = xDialog.getChild("totalnumpages")
+
self.assertEqual(get_state_as_dict(xLandscapeTotalNumberPages)["Text"], "/ 1")
+
+# Without the fix in place, this test would have failed with
+# Expected: "1"
+# Actual  : "1-2"
+xLandscapePageRange = 

core.git: Branch 'libreoffice-7-6' - oox/source sd/qa

2024-01-29 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |   20 
 oox/source/drawingml/table/tablecell.cxx   |   12 ++
 sd/qa/unit/data/pptx/tdf156718.pptx|binary
 sd/qa/unit/import-tests.cxx|   70 +
 4 files changed, 98 insertions(+), 4 deletions(-)

New commits:
commit 00dd94eda1e4b46c7f9a53750aa829c31c6830d3
Author: Tibor Nagy 
AuthorDate: Mon Jan 22 11:24:51 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Jan 29 10:11:45 2024 +0100

tdf#156718 PPTX import: fix the different formatting in table style

when the PPTX file only has table style id, but no table style content.

Change-Id: Ia3416478716a50beb6837988e98697fd88e916d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162368
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 
(cherry picked from commit 27a1eccae1763b8efa17c909820f57f84361d308)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162378
Reviewed-by: Xisco Fauli 
(cherry picked from commit 67ae17ad8a74620eb744976d56f8d763893e847c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162386

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 513637e3c7ee..919b453368b3 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -231,6 +231,12 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 std::unique_ptr pTableStyle;
 pTableStyle.reset(new TableStyle());
 
+// Text Style definitions for table parts
+
+bool bFirstRowTextBoldStyle = false;
+bool bFirstColTextBoldStyle = false;
+bool bLastColTextBoldStyle = false;
+
 // Text Color definitions for table parts
 
 ::oox::drawingml::Color wholeTblTextColor;
@@ -410,6 +416,7 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pWholeTblBottomBorder->moLineWidth = 12700;
 pWholeTblInsideHBorder->moLineWidth = 12700;
 pWholeTblInsideVBorder->moLineWidth = 12700;
+pFirstRowBottomBorder->moLineWidth = 12700;
 
 pWholeTblLeftBorder->moPresetDash = XML_solid;
 pWholeTblRightBorder->moPresetDash = XML_solid;
@@ -417,6 +424,7 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pWholeTblBottomBorder->moPresetDash = XML_solid;
 pWholeTblInsideHBorder->moPresetDash = XML_solid;
 pWholeTblInsideVBorder->moPresetDash = XML_solid;
+pFirstRowBottomBorder->moPresetDash = XML_solid;
 
 // Start to handle all style groups.
 
@@ -557,7 +565,13 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
 setBorderLineType(pLastRowTopBorder, XML_solidFill);
 
+bFirstRowTextBoldStyle = true;
+bFirstColTextBoldStyle = true;
+bLastColTextBoldStyle = true;
+
 wholeTblTextColor.setSchemeClr(XML_tx1);
+firstRowTextColor.setSchemeClr(XML_tx1);
+lastColTextColor.setSchemeClr(XML_tx1);
 
 sal_Int32 accent_val;
 
@@ -571,8 +585,6 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
 pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
 
-firstRowTextColor.setSchemeClr(accent_val);
-
 pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
 pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
 
@@ -895,6 +907,10 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pTableStyle->getStyleId() = styleId;
 pTableStyle->getStyleName() = style_name;
 
+pTableStyle->getFirstRow().getTextBoldStyle() = bFirstRowTextBoldStyle;
+pTableStyle->getFirstCol().getTextBoldStyle() = bFirstColTextBoldStyle;
+pTableStyle->getLastCol().getTextBoldStyle() = bLastColTextBoldStyle;
+
 pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor;
 pTableStyle->getFirstRow().getTextColor() = firstRowTextColor;
 pTableStyle->getFirstCol().getTextColor() = firstColTextColor;
diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 9d16bce09d17..b480a0479ddf 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -358,10 +358,18 @@ void TableCell::pushToXCell( const 
::oox::core::XmlFilterBase& rFilterBase, cons
 }
 if ( rProperties.isBandRow() )
 {
+bool bHasFirstColFillColor
+= (rProperties.isFirstCol() && 
rTable.getFirstCol().getFillProperties()
+   && 
rTable.getFirstCol().getFillProperties()->maFillColor.isUsed());
+
+bool bHasLastColFillColor
+= (rProperties.isLastCol() && 
rTable.getLastCol().getFillProperties()
+   && 
rTable.getLastCol().getFillProperties()->maFillColor.isUsed());
+
 if ( ( 

core.git: Branch 'libreoffice-24-2' - oox/source sd/qa

2024-01-23 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |   20 
 oox/source/drawingml/table/tablecell.cxx   |   12 ++
 sd/qa/unit/data/pptx/tdf156718.pptx|binary
 sd/qa/unit/import-tests.cxx|   70 +
 4 files changed, 98 insertions(+), 4 deletions(-)

New commits:
commit 67ae17ad8a74620eb744976d56f8d763893e847c
Author: Tibor Nagy 
AuthorDate: Mon Jan 22 11:24:51 2024 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 23 09:37:25 2024 +0100

tdf#156718 PPTX import: fix the different formatting in table style

when the PPTX file only has table style id, but no table style content.

Change-Id: Ia3416478716a50beb6837988e98697fd88e916d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162368
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 
(cherry picked from commit 27a1eccae1763b8efa17c909820f57f84361d308)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162378
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 451759036835..90fb22e48de7 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -231,6 +231,12 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 std::unique_ptr pTableStyle;
 pTableStyle.reset(new TableStyle());
 
+// Text Style definitions for table parts
+
+bool bFirstRowTextBoldStyle = false;
+bool bFirstColTextBoldStyle = false;
+bool bLastColTextBoldStyle = false;
+
 // Text Color definitions for table parts
 
 ::oox::drawingml::Color wholeTblTextColor;
@@ -410,6 +416,7 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pWholeTblBottomBorder->moLineWidth = 12700;
 pWholeTblInsideHBorder->moLineWidth = 12700;
 pWholeTblInsideVBorder->moLineWidth = 12700;
+pFirstRowBottomBorder->moLineWidth = 12700;
 
 pWholeTblLeftBorder->moPresetDash = XML_solid;
 pWholeTblRightBorder->moPresetDash = XML_solid;
@@ -417,6 +424,7 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pWholeTblBottomBorder->moPresetDash = XML_solid;
 pWholeTblInsideHBorder->moPresetDash = XML_solid;
 pWholeTblInsideVBorder->moPresetDash = XML_solid;
+pFirstRowBottomBorder->moPresetDash = XML_solid;
 
 // Start to handle all style groups.
 
@@ -557,7 +565,13 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
 setBorderLineType(pLastRowTopBorder, XML_solidFill);
 
+bFirstRowTextBoldStyle = true;
+bFirstColTextBoldStyle = true;
+bLastColTextBoldStyle = true;
+
 wholeTblTextColor.setSchemeClr(XML_tx1);
+firstRowTextColor.setSchemeClr(XML_tx1);
+lastColTextColor.setSchemeClr(XML_tx1);
 
 sal_Int32 accent_val;
 
@@ -571,8 +585,6 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
 pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
 
-firstRowTextColor.setSchemeClr(accent_val);
-
 pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
 pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
 
@@ -895,6 +907,10 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pTableStyle->getStyleId() = styleId;
 pTableStyle->getStyleName() = style_name;
 
+pTableStyle->getFirstRow().getTextBoldStyle() = bFirstRowTextBoldStyle;
+pTableStyle->getFirstCol().getTextBoldStyle() = bFirstColTextBoldStyle;
+pTableStyle->getLastCol().getTextBoldStyle() = bLastColTextBoldStyle;
+
 pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor;
 pTableStyle->getFirstRow().getTextColor() = firstRowTextColor;
 pTableStyle->getFirstCol().getTextColor() = firstColTextColor;
diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 687c987fe242..78ec4f61feeb 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -358,10 +358,18 @@ void TableCell::pushToXCell( const 
::oox::core::XmlFilterBase& rFilterBase, cons
 }
 if ( rProperties.isBandRow() )
 {
+bool bHasFirstColFillColor
+= (rProperties.isFirstCol() && 
rTable.getFirstCol().getFillProperties()
+   && 
rTable.getFirstCol().getFillProperties()->maFillColor.isUsed());
+
+bool bHasLastColFillColor
+= (rProperties.isLastCol() && 
rTable.getLastCol().getFillProperties()
+   && 
rTable.getLastCol().getFillProperties()->maFillColor.isUsed());
+
 if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
 ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) &&
-( 

core.git: oox/source sd/qa

2024-01-22 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |   20 
 oox/source/drawingml/table/tablecell.cxx   |   12 ++
 sd/qa/unit/data/pptx/tdf156718.pptx|binary
 sd/qa/unit/import-tests.cxx|   70 +
 4 files changed, 98 insertions(+), 4 deletions(-)

New commits:
commit 27a1eccae1763b8efa17c909820f57f84361d308
Author: Tibor Nagy 
AuthorDate: Mon Jan 22 11:24:51 2024 +0100
Commit: Nagy Tibor 
CommitDate: Mon Jan 22 13:34:32 2024 +0100

tdf#156718 PPTX import: fix the different formatting in table style

when the PPTX file only has table style id, but no table style content.

Change-Id: Ia3416478716a50beb6837988e98697fd88e916d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162368
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 7df96036137d..3e821456e3b3 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -231,6 +231,12 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 std::unique_ptr pTableStyle;
 pTableStyle.reset(new TableStyle());
 
+// Text Style definitions for table parts
+
+bool bFirstRowTextBoldStyle = false;
+bool bFirstColTextBoldStyle = false;
+bool bLastColTextBoldStyle = false;
+
 // Text Color definitions for table parts
 
 ::oox::drawingml::Color wholeTblTextColor;
@@ -406,6 +412,7 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pWholeTblBottomBorder->moLineWidth = 12700;
 pWholeTblInsideHBorder->moLineWidth = 12700;
 pWholeTblInsideVBorder->moLineWidth = 12700;
+pFirstRowBottomBorder->moLineWidth = 12700;
 
 pWholeTblLeftBorder->moPresetDash = XML_solid;
 pWholeTblRightBorder->moPresetDash = XML_solid;
@@ -413,6 +420,7 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pWholeTblBottomBorder->moPresetDash = XML_solid;
 pWholeTblInsideHBorder->moPresetDash = XML_solid;
 pWholeTblInsideVBorder->moPresetDash = XML_solid;
+pFirstRowBottomBorder->moPresetDash = XML_solid;
 
 // Start to handle all style groups.
 
@@ -553,7 +561,13 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 setBorderLineType(pFirstRowBottomBorder, XML_solidFill);
 setBorderLineType(pLastRowTopBorder, XML_solidFill);
 
+bFirstRowTextBoldStyle = true;
+bFirstColTextBoldStyle = true;
+bLastColTextBoldStyle = true;
+
 wholeTblTextColor.setSchemeClr(XML_tx1);
+firstRowTextColor.setSchemeClr(XML_tx1);
+lastColTextColor.setSchemeClr(XML_tx1);
 
 sal_Int32 accent_val;
 
@@ -567,8 +581,6 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
 pLastRowTopBorder->maLineFill.maFillColor.setSchemeClr(accent_val);
 
-firstRowTextColor.setSchemeClr(accent_val);
-
 pBand1HFillProperties->maFillColor.setSchemeClr(accent_val);
 pBand1VFillProperties->maFillColor.setSchemeClr(accent_val);
 
@@ -891,6 +903,10 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 pTableStyle->getStyleId() = styleId;
 pTableStyle->getStyleName() = style_name;
 
+pTableStyle->getFirstRow().getTextBoldStyle() = bFirstRowTextBoldStyle;
+pTableStyle->getFirstCol().getTextBoldStyle() = bFirstColTextBoldStyle;
+pTableStyle->getLastCol().getTextBoldStyle() = bLastColTextBoldStyle;
+
 pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor;
 pTableStyle->getFirstRow().getTextColor() = firstRowTextColor;
 pTableStyle->getFirstCol().getTextColor() = firstColTextColor;
diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 687c987fe242..78ec4f61feeb 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -358,10 +358,18 @@ void TableCell::pushToXCell( const 
::oox::core::XmlFilterBase& rFilterBase, cons
 }
 if ( rProperties.isBandRow() )
 {
+bool bHasFirstColFillColor
+= (rProperties.isFirstCol() && 
rTable.getFirstCol().getFillProperties()
+   && 
rTable.getFirstCol().getFillProperties()->maFillColor.isUsed());
+
+bool bHasLastColFillColor
+= (rProperties.isLastCol() && 
rTable.getLastCol().getFillProperties()
+   && 
rTable.getLastCol().getFillProperties()->maFillColor.isUsed());
+
 if ( ( !rProperties.isFirstRow() || ( nRow != 0 ) ) &&
 ( !rProperties.isLastRow() || ( nRow != nMaxRow ) ) &&
-( !rProperties.isFirstCol() || ( nColumn != 0 ) ) &&
-( !rProperties.isLastCol() || ( nColumn != nMaxColumn ) ) )
+( !rProperties.isFirstCol() || ( nColumn != 0 ) || 

core.git: drawinglayer/source include/drawinglayer sc/qa svx/source

2024-01-19 Thread Tibor Nagy (via logerrit)
 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx  |4 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |   10 +
 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |4 
 sc/qa/extras/scpdfexport.cxx |   62 +++
 sc/qa/extras/testdocuments/tdf159067.ods |binary
 svx/source/sdr/contact/viewobjectcontact.cxx |2 
 svx/source/table/viewcontactoftableobj.cxx   |2 
 7 files changed, 80 insertions(+), 4 deletions(-)

New commits:
commit 01e41414847bcc3670df9537bbcba6a98ebd5190
Author: Tibor Nagy 
AuthorDate: Fri Jan 19 03:19:41 2024 +0100
Commit: Nagy Tibor 
CommitDate: Fri Jan 19 11:55:12 2024 +0100

tdf#159067 drawinglayer: fix untagged form control (PDF/UA export)

If the form object is marked as decorative, the form control should be 
exported as "Artifact"

Change-Id: I615d308ae966bf3d0f156899a0b4fad2d5a7c492
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162268
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx 
b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index 47af55ab9b57..783a54a4c409 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -30,13 +30,15 @@ namespace drawinglayer::primitive2d
 const vcl::PDFWriter::StructElement& rStructureElement,
 bool bBackground,
 bool bIsImage,
+bool bIsDecorative,
 Primitive2DContainer&& aChildren,
 void const*const pAnchorStructureElementKey,
 ::std::vector const*const pAnnotIds)
 :   GroupPrimitive2D(std::move(aChildren)),
 maStructureElement(rStructureElement),
 mbBackground(bBackground),
-mbIsImage(bIsImage)
+mbIsImage(bIsImage),
+mbIsDecorative(bIsDecorative)
 ,   m_pAnchorStructureElementKey(pAnchorStructureElementKey)
 {
 if (pAnnotIds)
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 22f464d70b7f..e4441bbda327 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1116,8 +1116,9 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 
 const bool bPDFExport(mpPDFExtOutDevData && 
mpPDFExtOutDevData->GetIsExportFormFields());
 bool bDoProcessRecursively(true);
+bool bDecorative = (mpCurrentStructureTag && 
mpCurrentStructureTag->isDecorative());
 
-if (bPDFExport)
+if (bPDFExport && !bDecorative)
 {
 // PDF export. Emulate data handling from UnoControlPDFExportContact
 std::unique_ptr pPDFControl(
@@ -1190,7 +1191,10 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 
 if (mpPDFExtOutDevData)
 { // no corresponding PDF Form, use Figure instead
-mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Figure);
+if (!bDecorative)
+
mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Figure);
+else
+
mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::NonStructElement);
 mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, 
vcl::PDFWriter::Block);
 auto const 
range(rControlPrimitive.getB2DRange(getViewInformation2D()));
 tools::Rectangle const aLogicRect(
@@ -1198,7 +1202,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 basegfx::fround(range.getMaxX()), 
basegfx::fround(range.getMaxY()));
 mpPDFExtOutDevData->SetStructureBoundingBox(aLogicRect);
 OUString const& rAltText(rControlPrimitive.GetAltText());
-if (!rAltText.isEmpty())
+if (!rAltText.isEmpty() && !bDecorative)
 {
 mpPDFExtOutDevData->SetAlternateText(rAltText);
 }
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx 
b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
index 0d7e6ba57735..3cc489973c19 100644
--- a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -49,6 +49,8 @@ namespace drawinglayer::primitive2d
 boolmbBackground;
 /// flag for image (OBJ_GRAF)
 boolmbIsImage;
+/// flag for form control object
+boolmbIsDecorative;
 /// anchor structure element (Writer)
 void const* m_pAnchorStructureElementKey;
 /// for Annot structure element, the ids of the annotations
@@ -60,6 +62,7 @@ namespace drawinglayer::primitive2d

core.git: sc/qa sc/source

2024-01-15 Thread Tibor Nagy (via logerrit)
 sc/qa/extras/scpdfexport.cxx |   62 +++
 sc/qa/extras/testdocuments/tdf159068.ods |binary
 sc/source/core/tool/detfunc.cxx  |3 +
 3 files changed, 65 insertions(+)

New commits:
commit 510e94913b87fd6a3ea6444da492f6428afa47d8
Author: Tibor Nagy 
AuthorDate: Sun Jan 14 21:33:02 2024 +0100
Commit: Nagy Tibor 
CommitDate: Mon Jan 15 10:10:23 2024 +0100

tdf#159068 sc: fix detective shapes (PDF/UA export)

The detective shapes(DetectiveArrow,ValidationCircle) don't have the
option to set alternative text, so it should be marked as decorative.

Change-Id: If83b29eb071b25f9eaa92a23337e416048b6aa8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162059
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index de888c083387..11211607c013 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -65,6 +65,7 @@ public:
 void testExportFitToPage_Tdf103516();
 void testUnoCommands_Tdf120161();
 void testTdf64703_hiddenPageBreak();
+void testTdf159068();
 void testTdf159066();
 void testTdf159065();
 void testTdf123870();
@@ -79,6 +80,7 @@ public:
 CPPUNIT_TEST(testExportFitToPage_Tdf103516);
 CPPUNIT_TEST(testUnoCommands_Tdf120161);
 CPPUNIT_TEST(testTdf64703_hiddenPageBreak);
+CPPUNIT_TEST(testTdf159068);
 CPPUNIT_TEST(testTdf159066);
 CPPUNIT_TEST(testTdf159065);
 CPPUNIT_TEST(testTdf123870);
@@ -398,6 +400,66 @@ void ScPDFExportTest::testTdf64703_hiddenPageBreak()
 }
 }
 
+void ScPDFExportTest::testTdf159068()
+{
+loadFromFile(u"tdf159068.ods");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+
+// A1:C3
+ScRange range1(0, 0, 0, 2, 2, 0);
+exportToPDF(xModel, range1);
+
+vcl::filter::PDFDocument aDocument;
+SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+CPPUNIT_ASSERT(aDocument.Read(aStream));
+
+// The document has one page.
+std::vector aPages = aDocument.GetPages();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size());
+
+vcl::filter::PDFObjectElement* pContents = 
aPages[0]->LookupObject("Contents"_ostr);
+CPPUNIT_ASSERT(pContents);
+vcl::filter::PDFStreamElement* pStream = pContents->GetStream();
+CPPUNIT_ASSERT(pStream);
+
+SvMemoryStream& rObjectStream = pStream->GetMemory();
+// Uncompress it.
+SvMemoryStream aUncompressed;
+ZCodec aZCodec;
+aZCodec.BeginCompression();
+rObjectStream.Seek(0);
+aZCodec.Decompress(rObjectStream, aUncompressed);
+CPPUNIT_ASSERT(aZCodec.EndCompression());
+
+auto pStart = static_cast(aUncompressed.GetData());
+const char* const pEnd = pStart + aUncompressed.GetSize();
+
+auto nArtifact(0);
+auto nLine(0);
+while (true)
+{
+++nLine;
+auto const pLine = ::std::find(pStart, pEnd, '
');
+if (pLine == pEnd)
+{
+break;
+}
+std::string_view const line(pStart, pLine - pStart);
+pStart = pLine + 1;
+if (!line.empty() && line[0] != '%')
+{
+::std::cerr << nLine << ": " << line << "
 ";
+if (o3tl::starts_with(line, "/Artifact BMC"))
+nArtifact++;
+}
+}
+
+// Without the fix in place, this test would have failed with
+// - Expected: 5 (Artifact: Header, Footer, Rectangel, DetectiveArrow, 
ValidationCircle)
+// - Actual  : 2 (Artifact: Header, Footer)
+CPPUNIT_ASSERT_EQUAL(static_cast(5), nArtifact);
+}
+
 void ScPDFExportTest::testTdf159066()
 {
 loadFromFile(u"tdf159066.ods");
diff --git a/sc/qa/extras/testdocuments/tdf159068.ods 
b/sc/qa/extras/testdocuments/tdf159068.ods
new file mode 100644
index ..a0745d924c84
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf159068.ods differ
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index b5dc71b92a63..59efb5ad6469 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -373,6 +373,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
 pBox->NbcSetStyleSheet(nullptr, true);
 pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet());
 
+pBox->SetDecorative(true);
 pBox->SetLayer( SC_LAYER_INTERN );
 pPage->InsertObject( pBox.get() );
 pModel->AddCalcUndo( std::make_unique( *pBox ) );
@@ -418,6 +419,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
 pArrow->NbcSetLogicRect(tools::Rectangle::Normalize(aStartPos,aEndPos));  
//TODO: needed ???
 pArrow->SetMergedItemSetAndBroadcast(rAttrSet);
 
+pArrow->SetDecorative(true);
 pArrow->SetLayer( SC_LAYER_INTERN );
 pPage->InsertObject( pArrow.get() );
 pModel->AddCalcUndo( std::make_unique( *pArrow ) );
@@ -561,6 +563,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, 
ScDetectiveData& 

core.git: sc/qa svx/source

2024-01-11 Thread Tibor Nagy (via logerrit)
 sc/qa/extras/scpdfexport.cxx   |   18 +
 sc/qa/extras/testdocuments/tdf159066.ods   |binary
 svx/source/sdr/contact/viewcontactofsdrole2obj.cxx |   38 ++---
 3 files changed, 44 insertions(+), 12 deletions(-)

New commits:
commit 37eb62c995a72fcd01d5f79e8b04fa0578cb822b
Author: Tibor Nagy 
AuthorDate: Thu Jan 11 02:45:05 2024 +0100
Commit: Nagy Tibor 
CommitDate: Thu Jan 11 14:14:20 2024 +0100

tdf#159066 sc: fix OLE object alternative text (PDF/UA export)

Change-Id: I0af9cf61cafbe7ba93d08ed22fc11bb173612bfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161904
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index ae85dbb9b442..de888c083387 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -65,6 +65,7 @@ public:
 void testExportFitToPage_Tdf103516();
 void testUnoCommands_Tdf120161();
 void testTdf64703_hiddenPageBreak();
+void testTdf159066();
 void testTdf159065();
 void testTdf123870();
 void testTdf143978();
@@ -78,6 +79,7 @@ public:
 CPPUNIT_TEST(testExportFitToPage_Tdf103516);
 CPPUNIT_TEST(testUnoCommands_Tdf120161);
 CPPUNIT_TEST(testTdf64703_hiddenPageBreak);
+CPPUNIT_TEST(testTdf159066);
 CPPUNIT_TEST(testTdf159065);
 CPPUNIT_TEST(testTdf123870);
 CPPUNIT_TEST(testTdf143978);
@@ -396,6 +398,22 @@ void ScPDFExportTest::testTdf64703_hiddenPageBreak()
 }
 }
 
+void ScPDFExportTest::testTdf159066()
+{
+loadFromFile(u"tdf159066.ods");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+
+// A1:E5
+ScRange range1(0, 0, 0, 4, 4, 0);
+exportToPDF(xModel, range1);
+
+bool bFound = false;
+CPPUNIT_ASSERT(hasTextInPdf("/Alt<", bFound));
+
+// The OLE object contains alternative text description
+CPPUNIT_ASSERT_EQUAL(true, bFound);
+}
+
 void ScPDFExportTest::testTdf159065()
 {
 loadFromFile(u"tdf159065.ods");
diff --git a/sc/qa/extras/testdocuments/tdf159066.ods 
b/sc/qa/extras/testdocuments/tdf159066.ods
new file mode 100644
index ..c8dafee209c3
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf159066.ods differ
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx 
b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index ab76225e5713..6899bb5407e2 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -85,7 +86,7 @@ void 
ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters(drawinglay
 rItemSet,
 GetOle2Obj().getText(0),
 true));
-drawinglayer::primitive2d::Primitive2DReference xContent;
+drawinglayer::primitive2d::Primitive2DContainer xContent;
 
 if(GetOle2Obj().IsChart())
 {
@@ -110,25 +111,38 @@ void 
ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters(drawinglay
 
 aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
 aEmbed = aObjectMatrix * aEmbed;
-xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
-aEmbed,
-std::move(aChartSequence));
+xContent = drawinglayer::primitive2d::Primitive2DContainer{
+new drawinglayer::primitive2d::TransformPrimitive2D(aEmbed,
+
std::move(aChartSequence))
+};
 }
 }
 
-if(!xContent.is())
+if(xContent.empty())
 {
 // #i102063# embed OLE content in an own primitive; this will be able 
to decompose accessing
 // the weak SdrOle2 reference and will also implement getB2DRange() 
for fast BoundRect
 // calculations without OLE Graphic access (which may trigger e.g. 
chart recalculation).
 // It will also take care of HighContrast and ScaleContent
-xContent = new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
-GetOle2Obj(),
-aObjectMatrix,
+xContent = drawinglayer::primitive2d::Primitive2DContainer{
+new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
+GetOle2Obj(), aObjectMatrix,
+
+// #i104867# add GraphicVersion number to be able to check for
+// content change in the primitive later
+GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion())
+};
+}
 
-// #i104867# add GraphicVersion number to be able to check for
-// content change in the primitive later
-GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion() );
+if (!GetOle2Obj().GetName().isEmpty() || !GetOle2Obj().GetTitle().isEmpty()
+|| !GetOle2Obj().GetDescription().isEmpty())
+{
+xContent = drawinglayer::primitive2d::Primitive2DContainer{
+   

core.git: editeng/source sc/qa

2024-01-09 Thread Tibor Nagy (via logerrit)
 editeng/source/editeng/impedit3.cxx  |   52 +-
 sc/qa/extras/scpdfexport.cxx |   60 +++
 sc/qa/extras/testdocuments/tdf159065.ods |binary
 3 files changed, 94 insertions(+), 18 deletions(-)

New commits:
commit 4202218af61573825edfe5ec5a1bba710d7df1f7
Author: Tibor Nagy 
AuthorDate: Tue Jan 9 23:54:43 2024 +0100
Commit: Nagy Tibor 
CommitDate: Wed Jan 10 08:49:29 2024 +0100

tdf#159065 sc: fix PDF/UA link annotation

Change-Id: I1586608780cc82908eaef62158887afee69c148f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161843
Tested-by: Jenkins
Reviewed-by: Nagy Tibor 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index d50c2eb1338e..bc93802694fd 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3855,6 +3855,25 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
  ' ' == aText[nTextStart + 
nTextLen - 1] )
 --nTextLen;
 
+// PDF export:
+const SvxFieldData* pFieldData = 
nullptr;
+if (pPDFExtOutDevData)
+{
+if (rTextPortion.GetKind() == 
PortionKind::FIELD)
+{
+const EditCharAttrib* pAttr = 
pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
+const SvxFieldItem* pFieldItem 
= dynamic_cast(pAttr->GetItem());
+if (pFieldItem)
+{
+pFieldData = 
pFieldItem->GetField();
+auto pUrlField = 
dynamic_cast(pFieldData);
+if (pUrlField)
+if 
(pPDFExtOutDevData->GetIsExportTaggedPDF())
+
pPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Link, "Link");
+}
+}
+}
+
 // output directly
 aTmpFont.QuickDrawText( , 
aRealOutPos, aText, nTextStart, nTextLen, pDXArray, pKashidaArray );
 
@@ -3869,27 +3888,24 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
 }
 
 // PDF export:
-if ( pPDFExtOutDevData )
+if (pPDFExtOutDevData)
 {
-if ( rTextPortion.GetKind() == 
PortionKind::FIELD )
+if (auto pUrlField = 
dynamic_cast(pFieldData))
 {
-const EditCharAttrib* pAttr = 
pPortion->GetNode()->GetCharAttribs().FindFeature(nIndex);
-const SvxFieldItem* pFieldItem 
= dynamic_cast(pAttr->GetItem());
-if( pFieldItem )
+Point aTopLeft(aTmpPos);
+
aTopLeft.AdjustY(-(pLine->GetMaxAscent()));
+
+tools::Rectangle 
aRect(aTopLeft, rTextPortion.GetSize());
+vcl::PDFExtOutDevBookmarkEntry 
aBookmark;
+aBookmark.nLinkId = 
pPDFExtOutDevData->CreateLink(aRect, pUrlField->GetRepresentation());
+aBookmark.aBookmark = 
pUrlField->GetURL();
+std::vector< 
vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = 
pPDFExtOutDevData->GetBookmarks();
+
rBookmarks.push_back(aBookmark);
+
+if 
(pPDFExtOutDevData->GetIsExportTaggedPDF())
 {
-const SvxFieldData* 
pFieldData = pFieldItem->GetField();
-if ( auto pUrlField = 
dynamic_cast< const SvxURLField* >( pFieldData ) )
-{
-   

core.git: include/vcl sc/qa sc/source

2024-01-08 Thread Tibor Nagy (via logerrit)
 include/vcl/pdfextoutdevdata.hxx |5 
 sc/qa/extras/scpdfexport.cxx |   96 +
 sc/qa/extras/testdocuments/tdf123870.ods |binary
 sc/source/ui/inc/output.hxx  |   15 +
 sc/source/ui/unoobj/docuno.cxx   |  305 +++
 sc/source/ui/view/output.cxx |   76 +++
 sc/source/ui/view/output2.cxx|   68 ++
 sc/source/ui/view/printfun.cxx   |   51 +
 8 files changed, 495 insertions(+), 121 deletions(-)

New commits:
commit b3c93b16d62e80955edc749af4b8ad10162c
Author: Tibor Nagy 
AuthorDate: Wed Jan 3 11:18:19 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Jan 8 21:24:49 2024 +0100

tdf#123870 sc: fix tagged content for accessible PDF export

Change-Id: Iec7ea2d5acb66d7c5f9241285cf98f83e02c2445
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161581
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 206dfa4adc97..670ff234e2bd 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -32,6 +32,7 @@ class Graphic;
 class GDIMetaFile;
 class SdrObject;
 struct SwEnhancedPDFState;
+struct ScEnhancedPDFState;
 
 namespace vcl
 {
@@ -98,6 +99,7 @@ class VCL_DLLPUBLIC PDFExtOutDevData final : public 
ExtOutDevData
 ::std::map> m_ScreenAnnotations;
 
 SwEnhancedPDFState * m_pSwPDFState = nullptr;
+ScEnhancedPDFState * m_pScPDFState = nullptr;
 
 public:
 
@@ -159,6 +161,9 @@ public:
 SwEnhancedPDFState * GetSwPDFState() { return m_pSwPDFState; }
 void SetSwPDFState(SwEnhancedPDFState *const pSwPDFState) { m_pSwPDFState 
= pSwPDFState; }
 
+ScEnhancedPDFState* GetScPDFState() { return m_pScPDFState; }
+void SetScPDFState(ScEnhancedPDFState* const pScPDFState) { m_pScPDFState 
= pScPDFState; }
+
 const Graphic& GetCurrentGraphic() const;
 
 /** Start a new group of render output
diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index bcca563ec9b3..bdb4eb3e44a0 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -34,6 +34,9 @@
 #if USE_TLS_NSS
 #include 
 #endif
+#include 
+#include 
+#include 
 
 using namespace css::lang;
 using namespace ::com::sun::star;
@@ -62,6 +65,7 @@ public:
 void testExportFitToPage_Tdf103516();
 void testUnoCommands_Tdf120161();
 void testTdf64703_hiddenPageBreak();
+void testTdf123870();
 void testTdf143978();
 void testTdf120190();
 void testTdf84012();
@@ -73,6 +77,7 @@ public:
 CPPUNIT_TEST(testExportFitToPage_Tdf103516);
 CPPUNIT_TEST(testUnoCommands_Tdf120161);
 CPPUNIT_TEST(testTdf64703_hiddenPageBreak);
+CPPUNIT_TEST(testTdf123870);
 CPPUNIT_TEST(testTdf143978);
 CPPUNIT_TEST(testTdf120190);
 CPPUNIT_TEST(testTdf84012);
@@ -149,7 +154,8 @@ void ScPDFExportTest::exportToPDF(const 
uno::Reference& xModel, c
 css::uno::Sequence aFilterData{
 comphelper::makePropertyValue("Selection", xCellRange),
 comphelper::makePropertyValue("Printing", sal_Int32(2)),
-comphelper::makePropertyValue("ViewPDFAfterExport", true)
+comphelper::makePropertyValue("ViewPDFAfterExport", true),
+comphelper::makePropertyValue("PDFUACompliance", true)
 };
 
 // init set of params for storeToURL() call
@@ -388,6 +394,94 @@ void ScPDFExportTest::testTdf64703_hiddenPageBreak()
 }
 }
 
+void ScPDFExportTest::testTdf123870()
+{
+loadFromURL(u"tdf123870.ods");
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+
+// A1:G4
+ScRange range1(0, 0, 0, 6, 4, 0);
+exportToPDF(xModel, range1);
+
+vcl::filter::PDFDocument aDocument;
+SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+CPPUNIT_ASSERT(aDocument.Read(aStream));
+
+// The document has one page.
+std::vector aPages = aDocument.GetPages();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size());
+
+vcl::filter::PDFObjectElement* pContents = 
aPages[0]->LookupObject("Contents"_ostr);
+CPPUNIT_ASSERT(pContents);
+vcl::filter::PDFStreamElement* pStream = pContents->GetStream();
+CPPUNIT_ASSERT(pStream);
+SvMemoryStream& rObjectStream = pStream->GetMemory();
+// Uncompress it.
+SvMemoryStream aUncompressed;
+ZCodec aZCodec;
+aZCodec.BeginCompression();
+rObjectStream.Seek(0);
+aZCodec.Decompress(rObjectStream, aUncompressed);
+CPPUNIT_ASSERT(aZCodec.EndCompression());
+
+auto pStart = static_cast(aUncompressed.GetData());
+const char* const pEnd = pStart + aUncompressed.GetSize();
+
+enum
+{
+Default,
+Artifact,
+Tagged
+} state
+= Default;
+
+auto nLine(0);
+auto nTagged(0);
+auto nArtifacts(0);
+while (true)
+{
+++nLine;
+auto const pLine = ::std::find(pStart, pEnd, '
');
+if (pLine == pEnd)
+{
+   

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

2023-09-01 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152070.pptx |binary
 1 file changed

New commits:
commit 8c92ca1287c127cb9ce23d75dead5ae18035b9bf
Author: Tibor Nagy 
AuthorDate: Mon Aug 28 14:19:22 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 1 14:41:26 2023 +0200

Follow-up to tdf#152070 sd: fix unit test of tile background

The test always failed if the output device DPI value is
higher than 96, because of its PNG image without pHYs (physical
pixel dimensions), so the size depended on the output device DPI
and therefore offset value of image changes. Fixed with extending
the PNG image with pHYs metadata.

Follow-up to commit b12e38c1ccb388e62e35d856d4a575e1724a10e9
"tdf#152070 PPTX import: fix offset of tile background image".

Change-Id: Ic936ec8013bf39bea5fd5f7fce7f17588a72fed4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156205
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 3db01ef3634e5ae87fe1bafced657ba6b860afca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156223
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sd/qa/unit/data/pptx/tdf152070.pptx 
b/sd/qa/unit/data/pptx/tdf152070.pptx
index 1fbc8016d149..c98116c1873e 100644
Binary files a/sd/qa/unit/data/pptx/tdf152070.pptx and 
b/sd/qa/unit/data/pptx/tdf152070.pptx differ


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

2023-09-01 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx|   16 
 oox/source/token/properties.txt   |1 
 sd/qa/unit/data/pptx/tdf156829.pptx   |binary
 sd/qa/unit/data/xml/n762695_0.xml |1 
 sd/qa/unit/data/xml/n762695_1.xml |2 +
 sd/qa/unit/data/xml/tdf109317_0.xml   |3 ++
 sd/qa/unit/import-tests.cxx   |   28 ++
 svx/source/customshapes/EnhancedCustomShape2d.cxx |2 -
 8 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit d13505b8ef7459d97e9f90ee099ca54354d99922
Author: Tibor Nagy 
AuthorDate: Sun Aug 27 18:39:17 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 1 13:32:39 2023 +0200

tdf#156829 PPTX import: fix connector regression at missing glue points

Glue points weren't imported if the custom shape type is
"non-primitive", resulting broken line connectors, moreover
broken graphic design, as attached to the original bug report.

~Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors".

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

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 9cdbb4ee8801..3483969f716d 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -228,6 +228,22 @@ void CustomShapeProperties::pushToPropSet(
 aPath.setProperty( PROP_TextFrames, aTextFrames);
 }
 
+if (!maConnectionSiteList.empty())
+{
+css::uno::Sequence seqGluePoints;
+seqGluePoints.realloc(maConnectionSiteList.size());
+sal_Int32 nId = 0;
+for (auto& rGluePoint : asNonConstRange(seqGluePoints))
+{
+rGluePoint.First.Value = 
maConnectionSiteList[nId].pos.First.Value;
+rGluePoint.First.Type = 
maConnectionSiteList[nId].pos.First.Type;
+rGluePoint.Second.Value = 
maConnectionSiteList[nId].pos.Second.Value;
+rGluePoint.Second.Type = 
maConnectionSiteList[nId].pos.Second.Type;
+nId++;
+}
+aPath.setProperty(PROP_GluePoints, seqGluePoints);
+}
+
 sal_uInt32 nParameterPairs = 0;
 for ( auto const & i: maPath2DList )
 nParameterPairs += i.parameter.size();
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index a6de5458b663..b5a3478f45b0 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -224,6 +224,7 @@ GenerateVbaEvents
 Geometry3D
 GlowEffect
 GlowEffectRadius
+GluePoints
 GradientName
 HatchName
 Graphic
diff --git a/sd/qa/unit/data/pptx/tdf156829.pptx 
b/sd/qa/unit/data/pptx/tdf156829.pptx
new file mode 100644
index ..423588377279
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf156829.pptx differ
diff --git a/sd/qa/unit/data/xml/n762695_0.xml 
b/sd/qa/unit/data/xml/n762695_0.xml
index ae755e644de7..59b226e0d5f8 100644
--- a/sd/qa/unit/data/xml/n762695_0.xml
+++ b/sd/qa/unit/data/xml/n762695_0.xml
@@ -63,6 +63,7 @@

   
  
+ 
  
   

diff --git a/sd/qa/unit/data/xml/n762695_1.xml 
b/sd/qa/unit/data/xml/n762695_1.xml
index a43924138f45..02d3b735da86 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -67,6 +67,7 @@

   
  
+ 
  
   

@@ -151,6 +152,7 @@

   
  
+ 
  
   

diff --git a/sd/qa/unit/data/xml/tdf109317_0.xml 
b/sd/qa/unit/data/xml/tdf109317_0.xml
index f34beafbdc80..74559e74 100644
--- a/sd/qa/unit/data/xml/tdf109317_0.xml
+++ b/sd/qa/unit/data/xml/tdf109317_0.xml
@@ -22,6 +22,7 @@


 
+ 
  
  
  
@@ -130,6 +131,7 @@


 
+ 
  
  
  
@@ -406,6 +408,7 @@


 
+ 
  
  
  
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6e996d14fb91..10ebc2fae48e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -202,6 +202,34 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testDocumentLayout)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest, testFreeformShapeGluePoints)
+{
+createSdImpressDoc("pptx/tdf156829.pptx");
+uno::Reference xFreeformShape(getShapeFromPage(0, 0));
+uno::Sequence aProps;
+xFreeformShape->getPropertyValue("CustomShapeGeometry") >>= aProps;
+
+uno::Sequence aPathProps;
+for (beans::PropertyValue const& rProp : 

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

2023-08-31 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/ods/tdf150815.ods   |binary
 sc/qa/unit/subsequent_filters_test3.cxx |   22 +-
 sc/source/ui/inc/viewfunc.hxx   |4 ++--
 sc/source/ui/view/viewfunc.cxx  |   22 ++
 4 files changed, 45 insertions(+), 3 deletions(-)

New commits:
commit d1411afab98f7b41e9e700ef26b43dc77242d917
Author: Tibor Nagy 
AuthorDate: Wed Aug 30 16:22:02 2023 +0200
Commit: László Németh 
CommitDate: Thu Aug 31 18:01:33 2023 +0200

tdf#150815 sc: fix repainting sparkline

On Windows, if the input range of the sparkline is not in the
same row as the output range, the sparkline wasn't repainted
after changing the data within its range. Force the update
to avoid of showing obsolete data.

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

diff --git a/sc/qa/unit/data/ods/tdf150815.ods 
b/sc/qa/unit/data/ods/tdf150815.ods
new file mode 100644
index ..2dd407b6cea5
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf150815.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index d277e0858905..ff19d3d55c3c 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -393,7 +393,8 @@ struct PaintListener : public SfxListener
 {
 if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 
0)
 && ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
-|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)))
+|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)
+|| (pPaintHint->GetStartRow() == 1 && 
pPaintHint->GetEndRow() == 1)))
 {
 mbCalled = true;
 }
@@ -441,6 +442,25 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf150815_RepaintSparkline)
+{
+createScDoc("ods/tdf150815.ods");
+
+ScDocument* pDoc = getScDoc();
+ScDocShell* pDocSh = getScDocShell();
+
+PaintListener aListener;
+aListener.StartListening(*pDocSh);
+
+auto pSparkline = pDoc->GetSparkline(ScAddress(0, 1, 0));
+CPPUNIT_ASSERT(pSparkline);
+
+ScTabViewShell* pViewShell = getViewShell();
+pViewShell->EnterData(0, 0, 0, "10");
+
+CPPUNIT_ASSERT(aListener.mbCalled);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
 {
 // Set the system locale to Turkish
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0d8d7515441a..323e7cbbe793 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -90,8 +90,8 @@ public:
 boolAutoSum( const ScRange& rRange, bool bSubTotal, bool 
bSetCursor, bool bContinue, const OpCode eCode );
 OUStringGetAutoSumFormula( const ScRangeList& rRangeList, bool 
bSubTotal, const ScAddress& rAddr, const OpCode eCode );
 
-voidEnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const 
OUString& rString,
-   const EditTextObject* pData = nullptr, bool 
bMatrixExpand = false );
+SC_DLLPUBLIC void EnterData(SCCOL nCol, SCROW nRow, SCTAB nTab, const 
OUString& rString,
+const EditTextObject* pData = nullptr, bool 
bMatrixExpand = false);
 voidEnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
const EditTextObject& rData, bool bTestSimple = 
false );
 voidEnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const 
double& rValue );
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 13c4ce63c6e7..af0dc57357f9 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -103,6 +104,26 @@ static void lcl_PostRepaintCondFormat( const 
ScConditionalFormat *pCondFmt, ScDo
 }
 }
 
+static void lcl_PostRepaintSparkLine(sc::SparklineList* pSparklineList, const 
ScRange& rRange,
+ ScDocShell* pDocSh)
+{
+if (pSparklineList)
+{
+for (auto& rSparkLineGroup : pSparklineList->getSparklineGroups())
+{
+for (auto& rSparkline : 
pSparklineList->getSparklinesFor(rSparkLineGroup))
+{
+if (rSparkline->getInputRange().Contains(rRange))
+{
+pDocSh->PostPaint(
+ScRange(rSparkline->getColumn(), rSparkline->getRow(), 
rRange.aStart.Tab()),
+PaintPartFlags::All, SC_PF_TESTMERGE);
+}
+}
+}
+}
+}
+
 ScViewFunc::ScViewFunc( vcl::Window* pParent, ScDocShell& 

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

2023-08-30 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152070.pptx |binary
 1 file changed

New commits:
commit f4c2ad6cc750a850dd32e5ae3aceb184ccc54fb5
Author: Tibor Nagy 
AuthorDate: Mon Aug 28 14:19:22 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 30 12:14:25 2023 +0200

Follow-up to tdf#152070 sd: fix unit test of tile background

The test always failed if the output device DPI value is
higher than 96, because of its PNG image without pHYs (physical
pixel dimensions), so the size depended on the output device DPI
and therefore offset value of image changes. Fixed with extending
the PNG image with pHYs metadata.

Follow-up to commit b12e38c1ccb388e62e35d856d4a575e1724a10e9
"tdf#152070 PPTX import: fix offset of tile background image".

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

diff --git a/sd/qa/unit/data/pptx/tdf152070.pptx 
b/sd/qa/unit/data/pptx/tdf152070.pptx
index 1fbc8016d149..c98116c1873e 100644
Binary files a/sd/qa/unit/data/pptx/tdf152070.pptx and 
b/sd/qa/unit/data/pptx/tdf152070.pptx differ


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

2023-08-30 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx|   16 
 oox/source/token/properties.txt   |1 
 sd/qa/unit/data/pptx/tdf156829.pptx   |binary
 sd/qa/unit/data/xml/n762695_0.xml |1 
 sd/qa/unit/data/xml/n762695_1.xml |2 +
 sd/qa/unit/data/xml/tdf109317_0.xml   |3 ++
 sd/qa/unit/import-tests.cxx   |   28 ++
 svx/source/customshapes/EnhancedCustomShape2d.cxx |2 -
 8 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit 7b93531ba7f3edf98a54392cfc83dcf3185888bd
Author: Tibor Nagy 
AuthorDate: Sun Aug 27 18:39:17 2023 +0200
Commit: László Németh 
CommitDate: Wed Aug 30 11:57:11 2023 +0200

tdf#156829 PPTX import: fix connector regression at missing glue points

Glue points weren't imported if the custom shape type is
"non-primitive", resulting broken line connectors, moreover
broken graphic design, as attached to the original bug report.

~Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors".

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

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index ac6fba8e7d53..766876385c64 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -228,6 +228,22 @@ void CustomShapeProperties::pushToPropSet(
 aPath.setProperty( PROP_TextFrames, aTextFrames);
 }
 
+if (!maConnectionSiteList.empty())
+{
+css::uno::Sequence seqGluePoints;
+seqGluePoints.realloc(maConnectionSiteList.size());
+sal_Int32 nId = 0;
+for (auto& rGluePoint : asNonConstRange(seqGluePoints))
+{
+rGluePoint.First.Value = 
maConnectionSiteList[nId].pos.First.Value;
+rGluePoint.First.Type = 
maConnectionSiteList[nId].pos.First.Type;
+rGluePoint.Second.Value = 
maConnectionSiteList[nId].pos.Second.Value;
+rGluePoint.Second.Type = 
maConnectionSiteList[nId].pos.Second.Type;
+nId++;
+}
+aPath.setProperty(PROP_GluePoints, seqGluePoints);
+}
+
 sal_uInt32 nParameterPairs = 0;
 for ( auto const & i: maPath2DList )
 nParameterPairs += i.parameter.size();
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index a6de5458b663..b5a3478f45b0 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -224,6 +224,7 @@ GenerateVbaEvents
 Geometry3D
 GlowEffect
 GlowEffectRadius
+GluePoints
 GradientName
 HatchName
 Graphic
diff --git a/sd/qa/unit/data/pptx/tdf156829.pptx 
b/sd/qa/unit/data/pptx/tdf156829.pptx
new file mode 100644
index ..423588377279
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf156829.pptx differ
diff --git a/sd/qa/unit/data/xml/n762695_0.xml 
b/sd/qa/unit/data/xml/n762695_0.xml
index ae755e644de7..59b226e0d5f8 100644
--- a/sd/qa/unit/data/xml/n762695_0.xml
+++ b/sd/qa/unit/data/xml/n762695_0.xml
@@ -63,6 +63,7 @@

   
  
+ 
  
   

diff --git a/sd/qa/unit/data/xml/n762695_1.xml 
b/sd/qa/unit/data/xml/n762695_1.xml
index a43924138f45..02d3b735da86 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -67,6 +67,7 @@

   
  
+ 
  
   

@@ -151,6 +152,7 @@

   
  
+ 
  
   

diff --git a/sd/qa/unit/data/xml/tdf109317_0.xml 
b/sd/qa/unit/data/xml/tdf109317_0.xml
index f34beafbdc80..74559e74 100644
--- a/sd/qa/unit/data/xml/tdf109317_0.xml
+++ b/sd/qa/unit/data/xml/tdf109317_0.xml
@@ -22,6 +22,7 @@


 
+ 
  
  
  
@@ -130,6 +131,7 @@


 
+ 
  
  
  
@@ -406,6 +408,7 @@


 
+ 
  
  
  
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 2345e17ee7a4..adc7c12e4632 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -203,6 +203,34 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testDocumentLayout)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest, testFreeformShapeGluePoints)
+{
+createSdImpressDoc("pptx/tdf156829.pptx");
+uno::Reference xFreeformShape(getShapeFromPage(0, 0));
+uno::Sequence aProps;
+xFreeformShape->getPropertyValue("CustomShapeGeometry") >>= aProps;
+
+uno::Sequence aPathProps;
+for (beans::PropertyValue const& rProp : std::as_const(aProps))
+{
+if (rProp.Name == "Path")
+aPathProps = 
rProp.Value.get>();
+}
+
+uno::Sequence seqGluePoints;
+for (beans::PropertyValue 

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

2023-08-04 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 694bacca057c9f1d93ab27d61199aec9d060b868
Author: Tibor Nagy 
AuthorDate: Fri Aug 4 00:39:24 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 4 08:39:59 2023 +0200

Fix heap-use-after-free

The issue is caused by commit Ic87983fa6e3279a64841babc565fbe97710ff730
(tdf#99808 sc: fix background of conditional formatting in merged cell)

Change-Id: Ic72ba16c2649537dc3b486e07c12e2486cdf1957
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155328
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 6b79a4318501..7a0abc7cf026 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -1394,21 +1394,19 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testConditionStyleInMergedCell)
 // Add a conditional format.
 auto pFormat = std::make_unique(1, m_pDoc);
 pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
-auto pFormatTmp = pFormat.get();
-sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
 
 // Add condition in which if the value equals 1, set the "Good" style.
 ScCondFormatEntry* pEntry = new ScCondFormatEntry(
 ScConditionMode::Equal, "=1", "", *m_pDoc, ScAddress(0, 0, 0), 
ScResId(STR_STYLENAME_GOOD));
-pFormatTmp->AddEntry(pEntry);
+pFormat->AddEntry(pEntry);
 
 // Apply the format to the range.
-m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
 
 ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
-sal_uInt32 nOldFormat = pFormatTmp->GetKey();
-const ScRangeList& rRangeList = pFormatTmp->GetRange();
-rFunc.ReplaceConditionalFormat(nOldFormat, pFormatTmp->Clone(), 0, 
rRangeList);
+sal_uInt32 nOldFormat = pFormat->GetKey();
+const ScRangeList& rRangeList = pFormat->GetRange();
+rFunc.ReplaceConditionalFormat(nOldFormat, std::move(pFormat), 0, 
rRangeList);
 
 CPPUNIT_ASSERT_EQUAL(true, aListener.mbPaintAllMergedCell);
 


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

2023-07-26 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx   |   54 ++
 sc/source/ui/docshell/docfunc.cxx |2 -
 2 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit 77720a8f4338f2b6e393387e6fb683339618e826
Author: Tibor Nagy 
AuthorDate: Thu Jul 13 14:54:55 2023 +0200
Commit: László Németh 
CommitDate: Wed Jul 26 11:04:42 2023 +0200

tdf#99808 sc: fix background of conditional formatting in merged cell

The background color of conditional formatting is applied only to the
first cell in the merged block, at least under Windows.

Note: Undo/Redo is still not perfect, at least under Linux.

Change-Id: Ic87983fa6e3279a64841babc565fbe97710ff730
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154390
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit e384be0f6ea6453e57cd4a7c4402d26b49debc41)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154867
Tested-by: Jenkins

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 634373b58ccc..6b79a4318501 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -25,6 +26,23 @@
 
 namespace {
 
+struct PaintListener : public SfxListener
+{
+bool mbPaintAllMergedCell = false;
+virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override
+{
+const ScPaintHint* pPaintHint = dynamic_cast();
+if (pPaintHint)
+{
+if (pPaintHint->GetStartCol() == 0 && pPaintHint->GetEndCol() == 0
+&& pPaintHint->GetStartRow() == 0 && pPaintHint->GetEndRow() 
== 1)
+{
+mbPaintAllMergedCell = true;
+}
+}
+}
+};
+
 struct ScDataBarLengthData
 {
 double nVal;
@@ -1361,6 +1379,42 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatVolatileFunctionRecalc)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testConditionStyleInMergedCell)
+{
+m_pDoc->InsertTab(0, "Test");
+
+PaintListener aListener;
+aListener.StartListening(*m_xDocShell);
+
+m_pDoc->DoMerge(0, 0, 0, 1, 0); // A1:A2
+CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0)));
+
+m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0);
+
+// Add a conditional format.
+auto pFormat = std::make_unique(1, m_pDoc);
+pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
+auto pFormatTmp = pFormat.get();
+sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+// Add condition in which if the value equals 1, set the "Good" style.
+ScCondFormatEntry* pEntry = new ScCondFormatEntry(
+ScConditionMode::Equal, "=1", "", *m_pDoc, ScAddress(0, 0, 0), 
ScResId(STR_STYLENAME_GOOD));
+pFormatTmp->AddEntry(pEntry);
+
+// Apply the format to the range.
+m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+
+ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
+sal_uInt32 nOldFormat = pFormatTmp->GetKey();
+const ScRangeList& rRangeList = pFormatTmp->GetRange();
+rFunc.ReplaceConditionalFormat(nOldFormat, pFormatTmp->Clone(), 0, 
rRangeList);
+
+CPPUNIT_ASSERT_EQUAL(true, aListener.mbPaintAllMergedCell);
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 4d99824fe0a0..4d3288558c40 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5670,7 +5670,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong 
nOldFormat, std::unique_ptr<
 }
 
 if(pRepaintRange)
-rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid);
+rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid, 
SC_PF_TESTMERGE);
 
 aModificator.SetDocumentModified();
 SfxGetpApp()->Broadcast(SfxHint(SfxHintId::ScAreasChanged));


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

2023-07-26 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx  |   52 +++
 sc/source/core/data/fillinfo.cxx |   20 +++
 2 files changed, 72 insertions(+)

New commits:
commit 83ead6e42f82c03f807cb4b003fcac35135de459
Author: Tibor Nagy 
AuthorDate: Wed Jul 12 17:17:10 2023 +0200
Commit: László Németh 
CommitDate: Wed Jul 26 11:04:27 2023 +0200

tdf#155322 sc: fix conditional format color scale in merged cells

Only first cell of a merged range got coloring, now all of them.

See also commit f142b3e84f97ae678bd0a94614e867d369680458
"tdf#131471 sc: fix background color of conditional formatting style".

Change-Id: I0e95bf49369de219e659295643aaf2659dd3de48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154362
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit ee4bd745be5dee15b68ca483f7f7771957ae3b3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154865

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 78978daec33a..634373b58ccc 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -319,6 +319,58 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testDataBarCondCopyPaste)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleInMergedCell)
+{
+m_pDoc->InsertTab(0, "Test");
+m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0);
+
+// Add a conditional format to A1.
+auto pFormat = std::make_unique(1, m_pDoc);
+pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
+auto pFormatTmp = pFormat.get();
+sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+// Add color scale entries.
+// The coloring is based on the value. (BLUE (x <= 0), GREEN (x == 1), RED 
(x >= 2))
+ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc);
+ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE);
+ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN);
+ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED);
+pColorScaleFormat->AddEntry(pEntryBlue);
+pColorScaleFormat->AddEntry(pEntryGreen);
+pColorScaleFormat->AddEntry(pEntryRed);
+
+pFormatTmp->AddEntry(pColorScaleFormat);
+
+// Apply the format to the range.
+m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+
+m_pDoc->DoMerge(0, 0, 0, 1, 0);  // A1:A2
+CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0)));
+
+ScTableInfo aTabInfo;
+m_pDoc->FillInfo(aTabInfo, 0, 0, 0, 1, 0, 1, 1, false, false);
+RowInfo* pRowInfo = aTabInfo.mpRowInfo.get();
+
+RowInfo* pRowInfoA1 = [1];
+ScCellInfo* pCellInfoA1 = >cellInfo(0);
+// Check if there is a color scale in A1.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A1!", true,
+ pCellInfoA1->mxColorScale.has_value());
+
+RowInfo* pRowInfoA2 = [2];
+ScCellInfo* pCellInfoA2 = >cellInfo(0);
+// Check if there is a color scale in A2.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A2!", true,
+ pCellInfoA2->mxColorScale.has_value());
+
+// Check that cells A1 and A2 have the same color scale. (GREEN)
+
CPPUNIT_ASSERT(pCellInfoA1->mxColorScale.value().IsRGBEqual(pCellInfoA2->mxColorScale.value()));
+
+m_pDoc->DeleteTab(0);
+}
+
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 7c95701e9705..db9eadc671ad 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -743,6 +743,26 @@ void ScDocument::FillInfo(
 pInfo->pShadowAttr = pShadowItem;
 if (pInfo->pShadowAttr != pDefShadow)
 bAnyShadow = true;
+
+const ScCondFormatIndexes& rCondFormatIndex
+= 
pStartPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
+
+if (pCondFormList && !pStartCond && 
!rCondFormatIndex.empty())
+{
+for (const auto& rItem : rCondFormatIndex)
+{
+const ScConditionalFormat* pCondForm = 
pCondFormList->GetFormat(rItem);
+if (pCondForm)
+{
+ScCondFormatData aData = pCondForm->GetData(
+pInfo->maCell, ScAddress(nStartX, nStartY, 
nTab));
+
+// Color scale
+if (aData.mxColorScale && !pInfo->mxColorScale)
+pInfo->mxColorScale = aData.mxColorScale;
+}
+}
+}
 }
 }
 }


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

2023-07-25 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx   |   54 ++
 sc/source/ui/docshell/docfunc.cxx |2 -
 2 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit e384be0f6ea6453e57cd4a7c4402d26b49debc41
Author: Tibor Nagy 
AuthorDate: Thu Jul 13 14:54:55 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 14:12:34 2023 +0200

tdf#99808 sc: fix background of conditional formatting in merged cell

The background color of conditional formatting is applied only to the
first cell in the merged block, at least under Windows.

Note: Undo/Redo is still not perfect, at least under Linux.

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

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 634373b58ccc..6b79a4318501 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -25,6 +26,23 @@
 
 namespace {
 
+struct PaintListener : public SfxListener
+{
+bool mbPaintAllMergedCell = false;
+virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override
+{
+const ScPaintHint* pPaintHint = dynamic_cast();
+if (pPaintHint)
+{
+if (pPaintHint->GetStartCol() == 0 && pPaintHint->GetEndCol() == 0
+&& pPaintHint->GetStartRow() == 0 && pPaintHint->GetEndRow() 
== 1)
+{
+mbPaintAllMergedCell = true;
+}
+}
+}
+};
+
 struct ScDataBarLengthData
 {
 double nVal;
@@ -1361,6 +1379,42 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatVolatileFunctionRecalc)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testConditionStyleInMergedCell)
+{
+m_pDoc->InsertTab(0, "Test");
+
+PaintListener aListener;
+aListener.StartListening(*m_xDocShell);
+
+m_pDoc->DoMerge(0, 0, 0, 1, 0); // A1:A2
+CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0)));
+
+m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0);
+
+// Add a conditional format.
+auto pFormat = std::make_unique(1, m_pDoc);
+pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
+auto pFormatTmp = pFormat.get();
+sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+// Add condition in which if the value equals 1, set the "Good" style.
+ScCondFormatEntry* pEntry = new ScCondFormatEntry(
+ScConditionMode::Equal, "=1", "", *m_pDoc, ScAddress(0, 0, 0), 
ScResId(STR_STYLENAME_GOOD));
+pFormatTmp->AddEntry(pEntry);
+
+// Apply the format to the range.
+m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+
+ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
+sal_uInt32 nOldFormat = pFormatTmp->GetKey();
+const ScRangeList& rRangeList = pFormatTmp->GetRange();
+rFunc.ReplaceConditionalFormat(nOldFormat, pFormatTmp->Clone(), 0, 
rRangeList);
+
+CPPUNIT_ASSERT_EQUAL(true, aListener.mbPaintAllMergedCell);
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 4d99824fe0a0..4d3288558c40 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5670,7 +5670,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong 
nOldFormat, std::unique_ptr<
 }
 
 if(pRepaintRange)
-rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid);
+rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid, 
SC_PF_TESTMERGE);
 
 aModificator.SetDocumentModified();
 SfxGetpApp()->Broadcast(SfxHint(SfxHintId::ScAreasChanged));


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

2023-07-25 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/ods/tdf131471.ods   |binary
 sc/qa/unit/subsequent_filters_test3.cxx |   25 +++--
 sc/source/ui/unoobj/docuno.cxx  |2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 830f501147f830d5d1eeac601d97f9720d7b80f9
Author: Tibor Nagy 
AuthorDate: Mon Jul 10 17:53:49 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 10:29:45 2023 +0200

tdf#131471 sc: fix background color of conditional formatting style

The issue appears for merged cells when you trigger a change that
causes the condition to be evaluated again.

Manual test: open unit test document, put "1" in A1, and press Undo:
the green background color of the condition was removed only
partially.

Change-Id: I8bb17c77ac49a1ee897c3e2b4902723d237765d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154277
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit fdbea1f65e9f30f0d6cb4bade181ed2386a7c568)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154853
Tested-by: Jenkins

diff --git a/sc/qa/unit/data/ods/tdf131471.ods 
b/sc/qa/unit/data/ods/tdf131471.ods
new file mode 100644
index ..31f079274256
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf131471.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index 44cd7024506c..54d5061d2cd9 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -391,8 +391,9 @@ struct PaintListener : public SfxListener
 const ScPaintHint* pPaintHint = dynamic_cast();
 if (pPaintHint)
 {
-if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
-&& pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 
0)
+&& ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)))
 {
 mbCalled = true;
 }
@@ -420,6 +421,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testCondFormatFormulaListenerXLSX)
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
+{
+// Repaint range of conditional format in merged cell.
+createScDoc("ods/tdf131471.ods");
+ScDocShell* pDocSh = getScDocShell();
+PaintListener aListener;
+aListener.StartListening(*pDocSh);
+ScDocument* pDoc = getScDoc();
+ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
+CPPUNIT_ASSERT(pList);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+ScConditionalFormat* pFormat = pList->begin()->get();
+CPPUNIT_ASSERT(pFormat);
+pDoc->SetDocVisible(true);
+pDoc->SetValue(0, 0, 0, 1.0);
+
+CPPUNIT_ASSERT(aListener.mbCalled);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
 {
 // Set the system locale to Turkish
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1358fb8ec56d..6ca01319a0b0 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -488,7 +488,7 @@ void ScModelObj::RepaintRange( const ScRange& rRange )
 void ScModelObj::RepaintRange( const ScRangeList& rRange )
 {
 if (pDocShell)
-pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
+pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
 }
 
 static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,


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

2023-07-25 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx  |   52 +++
 sc/source/core/data/fillinfo.cxx |   20 +++
 2 files changed, 72 insertions(+)

New commits:
commit ee4bd745be5dee15b68ca483f7f7771957ae3b3e
Author: Tibor Nagy 
AuthorDate: Wed Jul 12 17:17:10 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 10:28:32 2023 +0200

tdf#155322 sc: fix conditional format color scale in merged cells

Only first cell of a merged range got coloring, now all of them.

See also commit f142b3e84f97ae678bd0a94614e867d369680458
"tdf#131471 sc: fix background color of conditional formatting style".

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

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 78978daec33a..634373b58ccc 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -319,6 +319,58 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testDataBarCondCopyPaste)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleInMergedCell)
+{
+m_pDoc->InsertTab(0, "Test");
+m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0);
+
+// Add a conditional format to A1.
+auto pFormat = std::make_unique(1, m_pDoc);
+pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
+auto pFormatTmp = pFormat.get();
+sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+// Add color scale entries.
+// The coloring is based on the value. (BLUE (x <= 0), GREEN (x == 1), RED 
(x >= 2))
+ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc);
+ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE);
+ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN);
+ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED);
+pColorScaleFormat->AddEntry(pEntryBlue);
+pColorScaleFormat->AddEntry(pEntryGreen);
+pColorScaleFormat->AddEntry(pEntryRed);
+
+pFormatTmp->AddEntry(pColorScaleFormat);
+
+// Apply the format to the range.
+m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+
+m_pDoc->DoMerge(0, 0, 0, 1, 0);  // A1:A2
+CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0)));
+
+ScTableInfo aTabInfo;
+m_pDoc->FillInfo(aTabInfo, 0, 0, 0, 1, 0, 1, 1, false, false);
+RowInfo* pRowInfo = aTabInfo.mpRowInfo.get();
+
+RowInfo* pRowInfoA1 = [1];
+ScCellInfo* pCellInfoA1 = >cellInfo(0);
+// Check if there is a color scale in A1.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A1!", true,
+ pCellInfoA1->mxColorScale.has_value());
+
+RowInfo* pRowInfoA2 = [2];
+ScCellInfo* pCellInfoA2 = >cellInfo(0);
+// Check if there is a color scale in A2.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A2!", true,
+ pCellInfoA2->mxColorScale.has_value());
+
+// Check that cells A1 and A2 have the same color scale. (GREEN)
+
CPPUNIT_ASSERT(pCellInfoA1->mxColorScale.value().IsRGBEqual(pCellInfoA2->mxColorScale.value()));
+
+m_pDoc->DeleteTab(0);
+}
+
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 94d79da68031..2e268239b048 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -743,6 +743,26 @@ void ScDocument::FillInfo(
 pInfo->pShadowAttr = pShadowItem;
 if (pInfo->pShadowAttr != pDefShadow)
 bAnyShadow = true;
+
+const ScCondFormatIndexes& rCondFormatIndex
+= 
pStartPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
+
+if (pCondFormList && !pStartCond && 
!rCondFormatIndex.empty())
+{
+for (const auto& rItem : rCondFormatIndex)
+{
+const ScConditionalFormat* pCondForm = 
pCondFormList->GetFormat(rItem);
+if (pCondForm)
+{
+ScCondFormatData aData = pCondForm->GetData(
+pInfo->maCell, ScAddress(nStartX, nStartY, 
nTab));
+
+// Color scale
+if (aData.mxColorScale && !pInfo->mxColorScale)
+pInfo->mxColorScale = aData.mxColorScale;
+}
+}
+}
 }
 }
 }


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

2023-07-24 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/ods/tdf131471.ods   |binary
 sc/qa/unit/subsequent_filters_test3.cxx |   25 +++--
 sc/source/ui/unoobj/docuno.cxx  |2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit f142b3e84f97ae678bd0a94614e867d369680458
Author: Tibor Nagy 
AuthorDate: Mon Jul 10 17:53:49 2023 +0200
Commit: László Németh 
CommitDate: Mon Jul 24 15:03:58 2023 +0200

tdf#131471 sc: fix background color of conditional formatting style

The issue appears for merged cells when you trigger a change that
causes the condition to be evaluated again.

Manual test: open unit test document, put "1" in A1, and press Undo:
the green background color of the condition was removed only
partially.

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

diff --git a/sc/qa/unit/data/ods/tdf131471.ods 
b/sc/qa/unit/data/ods/tdf131471.ods
new file mode 100644
index ..31f079274256
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf131471.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index 44cd7024506c..54d5061d2cd9 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -391,8 +391,9 @@ struct PaintListener : public SfxListener
 const ScPaintHint* pPaintHint = dynamic_cast();
 if (pPaintHint)
 {
-if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
-&& pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 
0)
+&& ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)))
 {
 mbCalled = true;
 }
@@ -420,6 +421,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testCondFormatFormulaListenerXLSX)
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
+{
+// Repaint range of conditional format in merged cell.
+createScDoc("ods/tdf131471.ods");
+ScDocShell* pDocSh = getScDocShell();
+PaintListener aListener;
+aListener.StartListening(*pDocSh);
+ScDocument* pDoc = getScDoc();
+ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
+CPPUNIT_ASSERT(pList);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+ScConditionalFormat* pFormat = pList->begin()->get();
+CPPUNIT_ASSERT(pFormat);
+pDoc->SetDocVisible(true);
+pDoc->SetValue(0, 0, 0, 1.0);
+
+CPPUNIT_ASSERT(aListener.mbCalled);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
 {
 // Set the system locale to Turkish
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 33ffbd393f12..66c2667a1a1f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -488,7 +488,7 @@ void ScModelObj::RepaintRange( const ScRange& rRange )
 void ScModelObj::RepaintRange( const ScRangeList& rRange )
 {
 if (pDocShell)
-pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
+pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
 }
 
 static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,


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

2023-06-28 Thread Tibor Nagy (via logerrit)
 sc/qa/uitest/calc_tests8/tdf54768.py |   32 
 sc/qa/uitest/data/tdf54768.ods   |binary
 sc/source/ui/view/drawvie4.cxx   |   16 
 3 files changed, 36 insertions(+), 12 deletions(-)

New commits:
commit d41456c2aa86ecbc70b45e11eb6e411e33b3ac06
Author: Tibor Nagy 
AuthorDate: Thu Jun 22 09:53:59 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 28 13:11:07 2023 +0200

tdf#54768 sc: fix resizing of cropped images to original size

This is a follow up to commit a4e12cbfc69cfe668fa30756a3c5843e911e22b1
(tdf#155863 sd: fix resizing of cropped images to original size)

Change-Id: I923ed8b1df6c6559d527d43e4abe842497c4c28f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153449
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 54550800bf0d0208ea5085a2170100100d0da2d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153660
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py 
b/sc/qa/uitest/calc_tests8/tdf54768.py
new file mode 100644
index ..a4342fb8e238
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf54768.py
@@ -0,0 +1,32 @@
+# -*- 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 uitest.uihelper.common import get_url_for_data_file
+
+class tdf54768(UITestCase):
+def test_tdf54768(self):
+# This document contains an image with an original size of 7.99cm x 
5.74cm.
+# The image has been cropped 2.73cm at the top.
+# Also, it has been resized to a width of 4.04cm.
+with self.ui_test.load_file(get_url_for_data_file("tdf54768.ods")) as 
document:
+xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+# select the image
+xGridWin.executeAction("SELECT", 
mkPropertyValues({"OBJECT":"Image"}))
+
+# click "Original Size"
+self.xUITest.executeCommand(".uno:OriginalSize")
+
+# tdf#155863: Without the fix in place, the image stays cropped,
+# but stretches to the size of original image
+self.assertEqual(7988, 
document.DrawPages[0].getByIndex(0).Size.Width)
+self.assertEqual(3005, 
document.DrawPages[0].getByIndex(0).Size.Height)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf54768.ods b/sc/qa/uitest/data/tdf54768.ods
new file mode 100644
index ..222481db8bb0
Binary files /dev/null and b/sc/qa/uitest/data/tdf54768.ods differ
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 5cc1655b83c4..2bd329098206 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -476,9 +476,9 @@ void ScDrawView::SetMarkedOriginalSize()
 }
 else if (nIdent == SdrObjKind::Graphic)
 {
-const Graphic& rGraphic = 
static_cast(pObj)->GetGraphic();
+const SdrGrafObj* pSdrGrafObj = static_cast(pObj);
 
-MapMode aSourceMap = rGraphic.GetPrefMapMode();
+MapMode aSourceMap = pSdrGrafObj->GetGraphic().GetPrefMapMode();
 MapMode aDestMap( MapUnit::Map100thMM );
 if (aSourceMap.GetMapUnit() == MapUnit::MapPixel)
 {
@@ -488,16 +488,8 @@ void ScDrawView::SetMarkedOriginalSize()
 aDestMap.SetScaleX(aNormScaleX);
 aDestMap.SetScaleY(aNormScaleY);
 }
-if (pViewData)
-{
-vcl::Window* pActWin = pViewData->GetActiveWin();
-if (pActWin)
-{
-aOriginalSize = pActWin->LogicToLogic(
-rGraphic.GetPrefSize(), , 
 );
-bDo = true;
-}
-}
+aOriginalSize = pSdrGrafObj->getOriginalSize();
+bDo = true;
 }
 
 if ( bDo )


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

2023-06-28 Thread Tibor Nagy (via logerrit)
 oox/inc/drawingml/fillproperties.hxx|2 
 oox/source/drawingml/fillproperties.cxx |   89 ++--
 oox/source/drawingml/shape.cxx  |5 +
 oox/source/ppt/slidepersist.cxx |7 ++
 sd/qa/unit/data/pptx/tdf153466.pptx |binary
 sd/qa/unit/import-tests.cxx |   23 
 6 files changed, 110 insertions(+), 16 deletions(-)

New commits:
commit d9e0c76a845857cc8fba32df01aadb5ac36541f6
Author: Tibor Nagy 
AuthorDate: Wed Mar 8 16:26:10 2023 +0100
Commit: Aron Budea 
CommitDate: Wed Jun 28 12:02:06 2023 +0200

tdf#153466 PPTX import: fix "Custom position/size" background image

Custom sized background with the value "tile" was imported as
"stretched", losing the preset size. Restore also the exported
preset positions, and map the other values to the preset positions
supported by OpenDocument/Impress.

Follow-up to commit 11451781d4c562f506a3aae3732e35b92387b4db
(tdf#153105 PPTX export: fix "Custom position/size" background image)

Change-Id: Ibf9b487ecd31b3ad7b06bda668c51e6b7a98c4af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148482
Tested-by: László Németh 
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153581
Reviewed-by: Jaume Pujantell 
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/oox/inc/drawingml/fillproperties.hxx 
b/oox/inc/drawingml/fillproperties.hxx
index 532cb0ec3975..e4dddac659d9 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -145,6 +146,7 @@ struct FillProperties
 const GraphicHelper& rGraphicHelper,
 sal_Int32 nShapeRotation = 0,
 ::Color nPhClr = API_RGB_TRANSPARENT,
+const css::awt::Size& rSize = {},
 sal_Int16 nPhClrTheme = -1,
 bool bFlipH = false,
 bool bFlipV = false,
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 50439e5458b5..6026af2773c3 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -391,9 +391,10 @@ Color FillProperties::getBestSolidColor() const
 return aSolidColor;
 }
 
-void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
-const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color 
nPhClr, sal_Int16 nPhClrTheme,
-bool bFlipH, bool bFlipV, bool bIsCustomShape) const
+void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper,
+   sal_Int32 nShapeRotation, ::Color nPhClr,
+   const css::awt::Size& rSize, sal_Int16 
nPhClrTheme, bool bFlipH,
+   bool bFlipV, bool bIsCustomShape) const
 {
 if( !moFillType.has() )
 return;
@@ -789,7 +790,6 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 {
 // bitmap mode (single, repeat, stretch)
 BitmapMode eBitmapMode = lclGetBitmapMode( 
maBlipProps.moBitmapMode.get( XML_TOKEN_INVALID ) );
-rPropMap.setProperty( ShapeProperty::FillBitmapMode, 
eBitmapMode );
 
 // additional settings for repeated bitmap
 if( eBitmapMode == BitmapMode_REPEAT )
@@ -836,21 +836,82 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 // Negative GraphicCrop values means "crop" here.
 bool bNeedCrop = aGraphCrop.Left <= 0 && 
aGraphCrop.Right <= 0 && aGraphCrop.Top <= 0 && aGraphCrop.Bottom <= 0;
 
-if(bIsCustomShape && bHasCropValues && bNeedCrop)
+if (bHasCropValues)
 {
-// Physically crop the image
-// In this case, don't set the 
PROP_GraphicCrop because that
-// would lead to applying the crop twice after 
roundtrip
-xGraphic = lclCropGraphic(xGraphic, 
CropQuotientsFromFillRect(aFillRect));
-if 
(rPropMap.supportsProperty(ShapeProperty::FillBitmapName))
-
rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic);
+if (bIsCustomShape && bNeedCrop)
+{
+// Physically crop the image
+// In this case, don't set the 
PROP_GraphicCrop because that
+// would lead to applying the crop twice 
after 

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

2023-06-28 Thread Tibor Nagy (via logerrit)
 sd/qa/uitest/data/tdf155863.odp |binary
 sd/qa/uitest/impress_tests/tdf155863.py |   34 
 svx/source/svdraw/svdograf.cxx  |   24 ++
 3 files changed, 45 insertions(+), 13 deletions(-)

New commits:
commit 257dbf548a4f844422d793b240e44844b3eb7aea
Author: Tibor Nagy 
AuthorDate: Fri Jun 16 09:34:29 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Jun 28 11:28:12 2023 +0200

tdf#155863 sd: fix resizing of cropped images to original size

Resizing with the function "Original Size" (e.g. in the context menu) 
resulted distortion in case of cropped images, if the original image
and its cropping have different aspect ratios. Now zoom the cropped
image to the original resolution instead of stretching it to the
same size.

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

diff --git a/sd/qa/uitest/data/tdf155863.odp b/sd/qa/uitest/data/tdf155863.odp
new file mode 100644
index ..2ae286c05d31
Binary files /dev/null and b/sd/qa/uitest/data/tdf155863.odp differ
diff --git a/sd/qa/uitest/impress_tests/tdf155863.py 
b/sd/qa/uitest/impress_tests/tdf155863.py
new file mode 100644
index ..bce8936a3d40
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf155863.py
@@ -0,0 +1,34 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf155863(UITestCase):
+def test_tdf155863(self):
+# This document contains an image with an original size of 7.99cm x 
5.74cm.
+# The image has been cropped 0.8cm on the left, 3.59cm on the right, 
0.99cm at the top,
+# and 0.75cm at the bottom.
+# Also, it has been resized to a width of 2.1cm and a height of 2.33cm.
+with self.ui_test.load_file(get_url_for_data_file("tdf155863.odp")) as 
document:
+xImpressDoc = self.xUITest.getTopFocusWindow()
+xEditWin = xImpressDoc.getChild("impress_win")
+
+# select the image on the first slide
+xEditWin.executeAction("SELECT", 
mkPropertyValues({"OBJECT":"Image"}))
+
+# click "Original Size"
+self.xUITest.executeCommand(".uno:OriginalSize")
+
+# tdf#155863: Without the fix in place, the image will be 
distorted due to the wrong size.
+self.assertEqual(3597, 
document.DrawPages[0].getByIndex(0).Size.Width)
+self.assertEqual(3998, 
document.DrawPages[0].getByIndex(0).Size.Height)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 1c1be8a7a69a..946cbee0ba0d 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -480,23 +480,21 @@ Size SdrGrafObj::getOriginalSize() const
 {
 Size aSize = GetGrafPrefSize();
 
-if (aGrafInfo.IsCropped())
-{
-const tools::Long 
aCroppedTop(OutputDevice::LogicToLogic(aGrafInfo.GetTopCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedBottom(OutputDevice::LogicToLogic(aGrafInfo.GetBottomCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedLeft(OutputDevice::LogicToLogic(aGrafInfo.GetLeftCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedRight(OutputDevice::LogicToLogic(aGrafInfo.GetRightCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long aCroppedWidth(aSize.getWidth() - aCroppedLeft + 
aCroppedRight);
-const tools::Long aCroppedHeight(aSize.getHeight() - aCroppedTop + 
aCroppedBottom);
-
-aSize = Size ( aCroppedWidth, aCroppedHeight);
-}
-
-if ( GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
+if (GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
 aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, 
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
 else
 aSize = OutputDevice::LogicToLogic(aSize, GetGrafPrefMapMode(), 
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
 
+if 

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

2023-06-27 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/tdf156028.xlsx|binary
 sc/qa/unit/subsequent_filters_test.cxx |   11 +++
 sc/source/core/data/colorscale.cxx |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 4c4d56f94b8f9598bd3d7cd60d38e18bf1e42857
Author: Tibor Nagy 
AuthorDate: Mon Jun 26 11:35:38 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 27 22:39:29 2023 +0200

tdf#156028 sc: use color of the highest value if only one value

(in a single cell or the same value repeating in all cells of the
data set) on percentile color scale, like other spreadsheets do.

This is a follow up to commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56
(tdf#155321 sc: fix color of the highest value on percentile color scale
if the highest value occurs multiple times in the data set.)

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

diff --git a/sc/qa/unit/data/xlsx/tdf156028.xlsx 
b/sc/qa/unit/data/xlsx/tdf156028.xlsx
new file mode 100644
index ..6fc2fc814fe3
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf156028.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index f633073c85f9..d02ebc075e3e 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -134,6 +134,17 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, 
testTdf155321_CondFormatColor_XLSX)
 CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf156028_ColorScale_XLSX)
+{
+createScDoc("xlsx/tdf156028.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0);
+ScRefCellValue aCellA1(*pDoc, ScAddress(0, 0, 0));
+Color aColor = pCondFormat->GetData(aCellA1, ScAddress(0, 0, 
0)).mxColorScale.value();
+CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX)
 {
 createScDoc("xlsx/tdf138601.xlsx");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 4e61dbdbc228..20ea2b5186f6 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -647,7 +647,7 @@ std::optional ScColorScaleFormat::GetColor( const 
ScAddress& rAddr ) cons
 calcMinMax(nMin, nMax);
 
 // this check is for safety
-if(nMin >= nMax)
+if(nMin > nMax)
 return std::optional();
 
 ScColorScaleEntries::const_iterator itr = begin();


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

2023-06-27 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx|4 +
 oox/inc/drawingml/fillproperties.hxx|2 
 oox/source/drawingml/fillproperties.cxx |   89 ++--
 oox/source/drawingml/shape.cxx  |5 +
 oox/source/export/drawingml.cxx |   78 
 oox/source/ppt/slidepersist.cxx |7 ++
 sd/qa/unit/data/odp/tdf153105.odp   |binary
 sd/qa/unit/data/pptx/tdf153466.pptx |binary
 sd/qa/unit/export-tests-ooxml3.cxx  |   18 ++
 sd/qa/unit/import-tests.cxx |   22 +++
 10 files changed, 209 insertions(+), 16 deletions(-)

New commits:
commit a1acb19ec4c239a24b23ec9c03ad52465895606d
Author: Tibor Nagy 
AuthorDate: Wed Mar 8 16:26:10 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 27 16:00:35 2023 +0200

tdf#153466 PPTX import: fix "Custom position/size" background image

Custom sized background with the value "tile" was imported as
"stretched", losing the preset size. Restore also the exported
preset positions, and map the other values to the preset positions
supported by OpenDocument/Impress.

Follow-up to commit 11451781d4c562f506a3aae3732e35b92387b4db
(tdf#153105 PPTX export: fix "Custom position/size" background image)

Change-Id: Ibf9b487ecd31b3ad7b06bda668c51e6b7a98c4af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148482
Tested-by: László Németh 
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153580
Reviewed-by: Jaume Pujantell 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/oox/inc/drawingml/fillproperties.hxx 
b/oox/inc/drawingml/fillproperties.hxx
index 828c858e12f2..3323907fcad8 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -147,6 +148,7 @@ struct FillProperties
 const GraphicHelper& rGraphicHelper,
 sal_Int32 nShapeRotation = 0,
 ::Color nPhClr = API_RGB_TRANSPARENT,
+const css::awt::Size& rSize = {},
 sal_Int16 nPhClrTheme = -1,
 bool bFlipH = false,
 bool bFlipV = false,
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 0a2e53928076..becc632fd923 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -400,9 +400,10 @@ Color FillProperties::getBestSolidColor() const
 return aSolidColor;
 }
 
-void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
-const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color 
nPhClr, sal_Int16 nPhClrTheme,
-bool bFlipH, bool bFlipV, bool bIsCustomShape) const
+void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper,
+   sal_Int32 nShapeRotation, ::Color nPhClr,
+   const css::awt::Size& rSize, sal_Int16 
nPhClrTheme, bool bFlipH,
+   bool bFlipV, bool bIsCustomShape) const
 {
 if( !moFillType.has_value() )
 return;
@@ -588,7 +589,6 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 {
 // bitmap mode (single, repeat, stretch)
 BitmapMode eBitmapMode = lclGetBitmapMode( 
maBlipProps.moBitmapMode.value_or( XML_TOKEN_INVALID ) );
-rPropMap.setProperty( ShapeProperty::FillBitmapMode, 
eBitmapMode );
 
 // additional settings for repeated bitmap
 if( eBitmapMode == BitmapMode_REPEAT )
@@ -636,21 +636,82 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 // Negative GraphicCrop values means "crop" here.
 bool bNeedCrop = aGraphCrop.Left <= 0 && 
aGraphCrop.Right <= 0 && aGraphCrop.Top <= 0 && aGraphCrop.Bottom <= 0;
 
-if(bIsCustomShape && bHasCropValues && bNeedCrop)
+if (bHasCropValues)
 {
-// Physically crop the image
-// In this case, don't set the 
PROP_GraphicCrop because that
-// would lead to applying the crop twice after 
roundtrip
-xGraphic = lclCropGraphic(xGraphic, 
CropQuotientsFromFillRect(aFillRect));
-if 
(rPropMap.supportsProperty(ShapeProperty::FillBitmapName))
-
rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic);
+if (bIsCustomShape && bNeedCrop)
+ 

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

2023-06-27 Thread Tibor Nagy (via logerrit)
 sc/qa/uitest/calc_tests8/tdf54768.py |   32 
 sc/qa/uitest/data/tdf54768.ods   |binary
 sc/source/ui/view/drawvie4.cxx   |   16 
 3 files changed, 36 insertions(+), 12 deletions(-)

New commits:
commit f5bf91ea73bf8a7cd3abc0f343ab2bdceaad905a
Author: Tibor Nagy 
AuthorDate: Thu Jun 22 09:53:59 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 27 14:18:42 2023 +0200

tdf#54768 sc: fix resizing of cropped images to original size

This is a follow up to commit a4e12cbfc69cfe668fa30756a3c5843e911e22b1
(tdf#155863 sd: fix resizing of cropped images to original size)

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

diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py 
b/sc/qa/uitest/calc_tests8/tdf54768.py
new file mode 100644
index ..a4342fb8e238
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf54768.py
@@ -0,0 +1,32 @@
+# -*- 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 uitest.uihelper.common import get_url_for_data_file
+
+class tdf54768(UITestCase):
+def test_tdf54768(self):
+# This document contains an image with an original size of 7.99cm x 
5.74cm.
+# The image has been cropped 2.73cm at the top.
+# Also, it has been resized to a width of 4.04cm.
+with self.ui_test.load_file(get_url_for_data_file("tdf54768.ods")) as 
document:
+xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+# select the image
+xGridWin.executeAction("SELECT", 
mkPropertyValues({"OBJECT":"Image"}))
+
+# click "Original Size"
+self.xUITest.executeCommand(".uno:OriginalSize")
+
+# tdf#155863: Without the fix in place, the image stays cropped,
+# but stretches to the size of original image
+self.assertEqual(7988, 
document.DrawPages[0].getByIndex(0).Size.Width)
+self.assertEqual(3005, 
document.DrawPages[0].getByIndex(0).Size.Height)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf54768.ods b/sc/qa/uitest/data/tdf54768.ods
new file mode 100644
index ..222481db8bb0
Binary files /dev/null and b/sc/qa/uitest/data/tdf54768.ods differ
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 5cc1655b83c4..2bd329098206 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -476,9 +476,9 @@ void ScDrawView::SetMarkedOriginalSize()
 }
 else if (nIdent == SdrObjKind::Graphic)
 {
-const Graphic& rGraphic = 
static_cast(pObj)->GetGraphic();
+const SdrGrafObj* pSdrGrafObj = static_cast(pObj);
 
-MapMode aSourceMap = rGraphic.GetPrefMapMode();
+MapMode aSourceMap = pSdrGrafObj->GetGraphic().GetPrefMapMode();
 MapMode aDestMap( MapUnit::Map100thMM );
 if (aSourceMap.GetMapUnit() == MapUnit::MapPixel)
 {
@@ -488,16 +488,8 @@ void ScDrawView::SetMarkedOriginalSize()
 aDestMap.SetScaleX(aNormScaleX);
 aDestMap.SetScaleY(aNormScaleY);
 }
-if (pViewData)
-{
-vcl::Window* pActWin = pViewData->GetActiveWin();
-if (pActWin)
-{
-aOriginalSize = pActWin->LogicToLogic(
-rGraphic.GetPrefSize(), , 
 );
-bDo = true;
-}
-}
+aOriginalSize = pSdrGrafObj->getOriginalSize();
+bDo = true;
 }
 
 if ( bDo )


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

2023-06-27 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx |   27 -
 oox/source/export/drawingml.cxx  |   55 
 oox/source/export/shapes.cxx |6 +--
 sd/qa/unit/data/odp/tdf153107.odp|binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   60 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |4 +-
 6 files changed, 112 insertions(+), 40 deletions(-)

New commits:
commit df482562d2532956c197468740e2a02499a89f55
Author: Tibor Nagy 
AuthorDate: Mon Jan 23 09:33:13 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 27 14:16:25 2023 +0200

tdf#153107 OOXML export: fix scale of tile of shape background

Relative scale values were exported as absolute values,
resulting broken shape background.

Change-Id: Ia38e125862e7f8ceff5d41754340723c3a9eb028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145996
Tested-by: László Németh 
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153576
Reviewed-by: Jaume Pujantell 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index cdfb31af9c7c..89fb0cab1128 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -380,16 +380,18 @@ public:
 
 void WriteGrabBagGradientFill( const css::uno::Sequence< 
css::beans::PropertyValue >& aGradientStops, const basegfx::BGradient& 
rGradient);
 
-void WriteBlipOrNormalFill( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,
-const OUString& rURLPropName );
-void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
-const OUString& sURLPropName );
-void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
- const OUString& sURLPropName, sal_Int32 nXmlNamespace 
);
+void WriteBlipOrNormalFill(const 
css::uno::Reference& rXPropSet,
+   const OUString& rURLPropName, const 
css::awt::Size& rSize = {});
+void WriteBlipFill(const css::uno::Reference& 
rXPropSet,
+   const OUString& sURLPropName, const css::awt::Size& 
rSize = {});
+void WriteBlipFill(const css::uno::Reference& 
rXPropSet,
+   const css::awt::Size& rSize, const OUString& 
sURLPropName,
+   sal_Int32 nXmlNamespace);
 
 void WriteXGraphicBlipFill(css::uno::Reference 
const & rXPropSet,
css::uno::Reference 
const & rxGraphic,
-   sal_Int32 nXmlNamespace, bool bWriteMode, bool 
bRelPathToMedia = false);
+   sal_Int32 nXmlNamespace, bool bWriteMode,
+   bool bRelPathToMedia = false, css::awt::Size 
const& rSize = {});
 
 void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet );
 void WritePattFill(const css::uno::Reference& 
rXPropSet,
@@ -408,7 +410,8 @@ public:
   css::uno::Reference 
const & rxGraphic);
 
 void WriteXGraphicTile(css::uno::Reference 
const& rXPropSet,
-   css::uno::Reference const& 
rxGraphic);
+   css::uno::Reference const& 
rxGraphic,
+   css::awt::Size const& rSize);
 
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
@@ -418,8 +421,9 @@ public:
 
 void 
WriteImageBrightnessContrastTransparence(css::uno::Reference
 const & rXPropSet);
 
-void WriteXGraphicBlipMode(css::uno::Reference 
const & rXPropSet,
-   css::uno::Reference 
const & rxGraphic);
+void WriteXGraphicBlipMode(css::uno::Reference 
const& rXPropSet,
+   css::uno::Reference 
const& rxGraphic,
+   css::awt::Size const& rSize);
 
 void WriteShapeTransformation(const css::uno::Reference< 
css::drawing::XShape >& rXShape,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool 
bFlippedBeforeRotation = false);
@@ -459,7 +463,8 @@ public:
 void WriteEmptyCustomGeometry();
 void WritePolyPolygon(const css::uno::Reference& 
rXShape,
   const bool bClosed);
-void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
+void WriteFill(const css::uno::Reference& 
xPropSet,
+   const css::awt::Size& rSize = {});
 void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteShapeEffects( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
 void WriteShapeEffect( std::u16string_view sName, const 
css::uno::Sequence< 

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

2023-06-27 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/tdf156028.xlsx|binary
 sc/qa/unit/subsequent_filters_test.cxx |   11 +++
 sc/source/core/data/colorscale.cxx |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 3e0537a6e746db6ea746af6b91f94aeb9d2b05d9
Author: Tibor Nagy 
AuthorDate: Mon Jun 26 11:35:38 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 27 14:09:27 2023 +0200

tdf#156028 sc: use color of the highest value if only one value

(in a single cell or the same value repeating in all cells of the
data set) on percentile color scale, like other spreadsheets do.

This is a follow up to commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56
(tdf#155321 sc: fix color of the highest value on percentile color scale
if the highest value occurs multiple times in the data set.)

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

diff --git a/sc/qa/unit/data/xlsx/tdf156028.xlsx 
b/sc/qa/unit/data/xlsx/tdf156028.xlsx
new file mode 100644
index ..6fc2fc814fe3
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf156028.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index f633073c85f9..d02ebc075e3e 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -134,6 +134,17 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, 
testTdf155321_CondFormatColor_XLSX)
 CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf156028_ColorScale_XLSX)
+{
+createScDoc("xlsx/tdf156028.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0);
+ScRefCellValue aCellA1(*pDoc, ScAddress(0, 0, 0));
+Color aColor = pCondFormat->GetData(aCellA1, ScAddress(0, 0, 
0)).mxColorScale.value();
+CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX)
 {
 createScDoc("xlsx/tdf138601.xlsx");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 4e61dbdbc228..20ea2b5186f6 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -647,7 +647,7 @@ std::optional ScColorScaleFormat::GetColor( const 
ScAddress& rAddr ) cons
 calcMinMax(nMin, nMax);
 
 // this check is for safety
-if(nMin >= nMax)
+if(nMin > nMax)
 return std::optional();
 
 ScColorScaleEntries::const_iterator itr = begin();


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

2023-06-21 Thread Tibor Nagy (via logerrit)
 sd/qa/uitest/data/tdf155863.odp |binary
 sd/qa/uitest/impress_tests/tdf155863.py |   34 
 svx/source/svdraw/svdograf.cxx  |   24 ++
 3 files changed, 45 insertions(+), 13 deletions(-)

New commits:
commit 755d2a8e30c6f6fd0508697dcd8037e3ce560d3b
Author: Tibor Nagy 
AuthorDate: Fri Jun 16 09:34:29 2023 +0200
Commit: László Németh 
CommitDate: Wed Jun 21 19:57:19 2023 +0200

tdf#155863 sd: fix resizing of cropped images to original size

Resizing with the function "Original Size" (e.g. in the context menu) 
resulted distortion in case of cropped images, if the original image
and its cropping have different aspect ratios. Now zoom the cropped
image to the original resolution instead of stretching it to the
same size.

Change-Id: I5e59f8b48dc03844a739c3eb803e3195a12d9c6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153170
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit a3401a5acb300baa0be9a5e3bd8fa817c4b01c88)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153340
Tested-by: Jenkins

diff --git a/sd/qa/uitest/data/tdf155863.odp b/sd/qa/uitest/data/tdf155863.odp
new file mode 100644
index ..2ae286c05d31
Binary files /dev/null and b/sd/qa/uitest/data/tdf155863.odp differ
diff --git a/sd/qa/uitest/impress_tests/tdf155863.py 
b/sd/qa/uitest/impress_tests/tdf155863.py
new file mode 100644
index ..bce8936a3d40
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf155863.py
@@ -0,0 +1,34 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf155863(UITestCase):
+def test_tdf155863(self):
+# This document contains an image with an original size of 7.99cm x 
5.74cm.
+# The image has been cropped 0.8cm on the left, 3.59cm on the right, 
0.99cm at the top,
+# and 0.75cm at the bottom.
+# Also, it has been resized to a width of 2.1cm and a height of 2.33cm.
+with self.ui_test.load_file(get_url_for_data_file("tdf155863.odp")) as 
document:
+xImpressDoc = self.xUITest.getTopFocusWindow()
+xEditWin = xImpressDoc.getChild("impress_win")
+
+# select the image on the first slide
+xEditWin.executeAction("SELECT", 
mkPropertyValues({"OBJECT":"Image"}))
+
+# click "Original Size"
+self.xUITest.executeCommand(".uno:OriginalSize")
+
+# tdf#155863: Without the fix in place, the image will be 
distorted due to the wrong size.
+self.assertEqual(3597, 
document.DrawPages[0].getByIndex(0).Size.Width)
+self.assertEqual(3998, 
document.DrawPages[0].getByIndex(0).Size.Height)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index cdb1b0e8301c..b36daff54745 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -476,23 +476,21 @@ Size SdrGrafObj::getOriginalSize() const
 {
 Size aSize = GetGrafPrefSize();
 
-if (aGrafInfo.IsCropped())
-{
-const tools::Long 
aCroppedTop(OutputDevice::LogicToLogic(aGrafInfo.GetTopCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedBottom(OutputDevice::LogicToLogic(aGrafInfo.GetBottomCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedLeft(OutputDevice::LogicToLogic(aGrafInfo.GetLeftCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedRight(OutputDevice::LogicToLogic(aGrafInfo.GetRightCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long aCroppedWidth(aSize.getWidth() - aCroppedLeft + 
aCroppedRight);
-const tools::Long aCroppedHeight(aSize.getHeight() - aCroppedTop + 
aCroppedBottom);
-
-aSize = Size ( aCroppedWidth, aCroppedHeight);
-}
-
-if ( GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
+if (GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
 aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, 
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
 else
 aSize = OutputDevice::LogicToLogic(aSize, GetGrafPrefMapMode(), 
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
 
+if (aGrafInfo.IsCropped())
+{
+const 

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

2023-06-20 Thread Tibor Nagy (via logerrit)
 sd/qa/uitest/data/tdf155863.odp |binary
 sd/qa/uitest/impress_tests/tdf155863.py |   34 
 svx/source/svdraw/svdograf.cxx  |   24 ++
 3 files changed, 45 insertions(+), 13 deletions(-)

New commits:
commit a4e12cbfc69cfe668fa30756a3c5843e911e22b1
Author: Tibor Nagy 
AuthorDate: Fri Jun 16 09:34:29 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 20 18:31:41 2023 +0200

tdf#155863 sd: fix resizing of cropped images to original size

Resizing with the function "Original Size" (e.g. in the context menu) 
resulted distortion in case of cropped images, if the original image
and its cropping have different aspect ratios. Now zoom the cropped
image to the original resolution instead of stretching it to the
same size.

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

diff --git a/sd/qa/uitest/data/tdf155863.odp b/sd/qa/uitest/data/tdf155863.odp
new file mode 100644
index ..2ae286c05d31
Binary files /dev/null and b/sd/qa/uitest/data/tdf155863.odp differ
diff --git a/sd/qa/uitest/impress_tests/tdf155863.py 
b/sd/qa/uitest/impress_tests/tdf155863.py
new file mode 100644
index ..bce8936a3d40
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf155863.py
@@ -0,0 +1,34 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf155863(UITestCase):
+def test_tdf155863(self):
+# This document contains an image with an original size of 7.99cm x 
5.74cm.
+# The image has been cropped 0.8cm on the left, 3.59cm on the right, 
0.99cm at the top,
+# and 0.75cm at the bottom.
+# Also, it has been resized to a width of 2.1cm and a height of 2.33cm.
+with self.ui_test.load_file(get_url_for_data_file("tdf155863.odp")) as 
document:
+xImpressDoc = self.xUITest.getTopFocusWindow()
+xEditWin = xImpressDoc.getChild("impress_win")
+
+# select the image on the first slide
+xEditWin.executeAction("SELECT", 
mkPropertyValues({"OBJECT":"Image"}))
+
+# click "Original Size"
+self.xUITest.executeCommand(".uno:OriginalSize")
+
+# tdf#155863: Without the fix in place, the image will be 
distorted due to the wrong size.
+self.assertEqual(3597, 
document.DrawPages[0].getByIndex(0).Size.Width)
+self.assertEqual(3998, 
document.DrawPages[0].getByIndex(0).Size.Height)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index cdb1b0e8301c..b36daff54745 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -476,23 +476,21 @@ Size SdrGrafObj::getOriginalSize() const
 {
 Size aSize = GetGrafPrefSize();
 
-if (aGrafInfo.IsCropped())
-{
-const tools::Long 
aCroppedTop(OutputDevice::LogicToLogic(aGrafInfo.GetTopCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedBottom(OutputDevice::LogicToLogic(aGrafInfo.GetBottomCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedLeft(OutputDevice::LogicToLogic(aGrafInfo.GetLeftCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long 
aCroppedRight(OutputDevice::LogicToLogic(aGrafInfo.GetRightCrop(), 
getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit()));
-const tools::Long aCroppedWidth(aSize.getWidth() - aCroppedLeft + 
aCroppedRight);
-const tools::Long aCroppedHeight(aSize.getHeight() - aCroppedTop + 
aCroppedBottom);
-
-aSize = Size ( aCroppedWidth, aCroppedHeight);
-}
-
-if ( GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
+if (GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
 aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, 
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
 else
 aSize = OutputDevice::LogicToLogic(aSize, GetGrafPrefMapMode(), 
MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
 
+if (aGrafInfo.IsCropped())
+{
+const tools::Long aCroppedWidth(aSize.getWidth() - 
aGrafInfo.GetLeftCrop()
+- aGrafInfo.GetRightCrop());
+const tools::Long 

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

2023-06-05 Thread Tibor Nagy (via logerrit)
 sc/inc/conditio.hxx|2 +-
 sc/qa/unit/data/xlsx/tdf155321.xlsx|binary
 sc/qa/unit/subsequent_filters_test.cxx |   13 +
 sc/source/core/data/colorscale.cxx |8 ++--
 4 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 808cc62e2f43e638598fc1f4869735138ccf8217
Author: Tibor Nagy 
AuthorDate: Mon May 22 14:20:59 2023 +0200
Commit: László Németh 
CommitDate: Mon Jun 5 13:20:32 2023 +0200

tdf#155321 sc: fix color of the highest value on percentile color scale

if the highest value occurs multiple times in the data set.

Also for coloring based on the percentile, use always the end
of the color scale for the highest values, like other spreadsheets
do, i.e. not the first possible color in the case of repeating
values. For example, the corner case in the test document is not
a red and two yellow cells any more, but a red and two green cells.

Note: color of the other repeating values still differs from
MSO, but the same as in Google Sheets.

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

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index afd16ba27365..50b74bd8721c 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -208,7 +208,7 @@ class ScConditionalFormat;
 struct ScDataBarInfo;
 struct ScIconSetInfo;
 
-struct ScCondFormatData
+struct SC_DLLPUBLIC ScCondFormatData
 {
 ScCondFormatData();
 ScCondFormatData(ScCondFormatData&&);
diff --git a/sc/qa/unit/data/xlsx/tdf155321.xlsx 
b/sc/qa/unit/data/xlsx/tdf155321.xlsx
new file mode 100644
index ..42299ff746cb
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf155321.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index c080942d486d..2df33b125e66 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -78,6 +78,7 @@ public:
 ScFiltersTest();
 
 //ods, xls, xlsx filter tests
+void testTdf155321_CondFormatColor_XLSX();
 void testTdf138601_CondFormatXLSX();
 void testContentODS();
 void testContentXLS();
@@ -210,6 +211,7 @@ public:
 void testForcepoint107();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
+CPPUNIT_TEST(testTdf155321_CondFormatColor_XLSX);
 CPPUNIT_TEST(testTdf138601_CondFormatXLSX);
 CPPUNIT_TEST(testContentODS);
 CPPUNIT_TEST(testContentXLS);
@@ -421,6 +423,17 @@ void testContentImpl(ScDocument& rDoc, bool 
bCheckMergedCells)
 }
 }
 
+void ScFiltersTest::testTdf155321_CondFormatColor_XLSX()
+{
+createScDoc("xlsx/tdf155321.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0);
+ScRefCellValue aCellB1(*pDoc, ScAddress(1, 0, 0));
+Color aColor = pCondFormat->GetData(aCellB1, ScAddress(1, 0, 
0)).mxColorScale.value();
+CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
+}
+
 void ScFiltersTest::testTdf138601_CondFormatXLSX()
 {
 createScDoc("xlsx/tdf138601.xlsx");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 43be13b5f320..876d100840bf 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -636,11 +636,15 @@ std::optional ScColorScaleFormat::GetColor( const 
ScAddress& rAddr ) cons
 double nValMax = CalcValue(nMin, nMax, itr);
 Color rColMax = (*itr)->GetColor();
 
+// tdf#155321 for the last percentile value, use always the end of the 
color scale,
+// i.e. not the first possible color in the case of repeating values
+bool bEqual = COLORSCALE_PERCENTILE == (*itr)->GetType() && nVal == nMax 
&& nVal == nValMax;
+
 ++itr;
-while(itr != end() && nVal > nValMax)
+while(itr != end() && (nVal > nValMax || bEqual))
 {
 rColMin = rColMax;
-nValMin = nValMax;
+nValMin = !bEqual ? nValMax : nValMax - 1;
 rColMax = (*itr)->GetColor();
 nValMax = CalcValue(nMin, nMax, itr);
 ++itr;


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

2023-05-31 Thread Tibor Nagy (via logerrit)
 sc/inc/conditio.hxx|2 +-
 sc/qa/unit/data/xlsx/tdf155321.xlsx|binary
 sc/qa/unit/subsequent_filters_test.cxx |   11 +++
 sc/source/core/data/colorscale.cxx |8 ++--
 4 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56
Author: Tibor Nagy 
AuthorDate: Mon May 22 14:20:59 2023 +0200
Commit: László Németh 
CommitDate: Wed May 31 20:17:16 2023 +0200

tdf#155321 sc: fix color of the highest value on percentile color scale

if the highest value occurs multiple times in the data set.

Also for coloring based on the percentile, use always the end
of the color scale for the highest values, like other spreadsheets
do, i.e. not the first possible color in the case of repeating
values. For example, the corner case in the test document is not
a red and two yellow cells any more, but a red and two green cells.

Note: color of the other repeating values still differs from
MSO, but the same as in Google Sheets.

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

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 51786d3dc712..47f5fdb3addb 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -208,7 +208,7 @@ class ScConditionalFormat;
 struct ScDataBarInfo;
 struct ScIconSetInfo;
 
-struct ScCondFormatData
+struct SC_DLLPUBLIC ScCondFormatData
 {
 ScCondFormatData();
 ScCondFormatData(ScCondFormatData&&);
diff --git a/sc/qa/unit/data/xlsx/tdf155321.xlsx 
b/sc/qa/unit/data/xlsx/tdf155321.xlsx
new file mode 100644
index ..42299ff746cb
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf155321.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index 535afe72d818..d206ce2cbf69 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -123,6 +123,17 @@ void testContentImpl(ScDocument& rDoc, bool 
bCheckMergedCells)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf155321_CondFormatColor_XLSX)
+{
+createScDoc("xlsx/tdf155321.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0);
+ScRefCellValue aCellB1(*pDoc, ScAddress(1, 0, 0));
+Color aColor = pCondFormat->GetData(aCellB1, ScAddress(1, 0, 
0)).mxColorScale.value();
+CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX)
 {
 createScDoc("xlsx/tdf138601.xlsx");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 1d713c447c5b..4e61dbdbc228 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -657,11 +657,15 @@ std::optional ScColorScaleFormat::GetColor( const 
ScAddress& rAddr ) cons
 double nValMax = CalcValue(nMin, nMax, itr);
 Color rColMax = (*itr)->GetColor();
 
+// tdf#155321 for the last percentile value, use always the end of the 
color scale,
+// i.e. not the first possible color in the case of repeating values
+bool bEqual = COLORSCALE_PERCENTILE == (*itr)->GetType() && nVal == nMax 
&& nVal == nValMax;
+
 ++itr;
-while(itr != end() && nVal > nValMax)
+while(itr != end() && (nVal > nValMax || bEqual))
 {
 rColMin = rColMax;
-nValMin = nValMax;
+nValMin = !bEqual ? nValMax : nValMax - 1;
 rColMax = (*itr)->GetColor();
 nValMax = CalcValue(nMin, nMax, itr);
 ++itr;


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

2023-05-25 Thread Tibor Nagy (via logerrit)
 sc/inc/colorscale.hxx  |2 +
 sc/qa/unit/ucalc_condformat.cxx|   53 +
 sc/source/core/data/colorscale.cxx |   35 
 3 files changed, 90 insertions(+)

New commits:
commit c0529c1c3aa6d905b9e4824054c6f9effab329b7
Author: Tibor Nagy 
AuthorDate: Wed May 17 08:40:43 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 25 10:34:59 2023 +0200

tdf#155319 sc: fix conditional format data bar after copying

This is a follow up to commit I064fb3fe0443705553c6bbfcc34f2d717e0f6bd6
(tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color
 scale)

Change-Id: Iacc1f5af762e1f6a40ecd13c33384e4a3340822a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151860
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/+/152115

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 513eb11cf2f4..88e35775419a 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -310,6 +310,8 @@ public:
 const ScDataBarFormatData* GetDataBarData() const;
 ScDataBarFormatData* GetDataBarData();
 
+bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override;
+
 virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override;
 virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) 
override;
 virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) 
override;
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index e523968e4e37..005addc1fcb6 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -93,6 +93,7 @@ public:
 void testCondFormatInsertRow();
 void testCondFormatInsertCol();
 void testCondFormatInsertDeleteSheets();
+void testDataBarCondCopyPaste();
 void testColorScaleCondCopyPaste();
 void testCondCopyPaste();
 void testCondCopyPasteSingleCell(); //e.g. fdo#82503
@@ -139,6 +140,7 @@ public:
 CPPUNIT_TEST(testCondFormatInsertRow);
 CPPUNIT_TEST(testCondFormatInsertCol);
 CPPUNIT_TEST(testCondFormatInsertDeleteSheets);
+CPPUNIT_TEST(testDataBarCondCopyPaste);
 CPPUNIT_TEST(testColorScaleCondCopyPaste);
 CPPUNIT_TEST(testCondCopyPaste);
 CPPUNIT_TEST(testCondCopyPasteSingleCell);
@@ -353,6 +355,57 @@ void TestCondformat::testCondFormatInsertDeleteSheets()
 m_pDoc->DeleteTab(0);
 }
 
+void TestCondformat::testDataBarCondCopyPaste()
+{
+m_pDoc->InsertTab(0, "Test");
+
+auto pFormat = std::make_unique(1, m_pDoc);
+ScRange aCondFormatRange(0, 0, 0, 2, 0, 0);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+
+ScDataBarFormat* pDatabar = new ScDataBarFormat(m_pDoc);
+ScDataBarFormatData* pFormatData = new ScDataBarFormatData();
+pFormatData->meAxisPosition = databar::AUTOMATIC;
+pFormatData->maPositiveColor = COL_BLUE;
+pFormatData->mxNegativeColor = COL_GREEN;
+pFormatData->mbGradient = true;
+
+pDatabar->SetDataBarData(pFormatData);
+pFormat->AddEntry(pDatabar);
+
+sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, aCondFormatRange, );
+
+ScRange aTargetRange(0, 3, 0, 2, 3, 0);
+pasteFromClip(m_pDoc, aTargetRange, );
+
+// Pasting the same conditional format must modify existing format, making 
its range
+// combined of previous range and newly pasted range having the 
conditional format.
+// No new conditional formats must be created.
+CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size());
+aRangeList.Join(aTargetRange);
+for (SCCOL nCol = 0; nCol < 3; ++nCol)
+{
+ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0);
+CPPUNIT_ASSERT(pPastedFormat);
+CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange());
+
+sal_uLong nPastedKey = pPastedFormat->GetKey();
+CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey);
+
+const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, 
ATTR_CONDITIONAL);
+const ScCondFormatItem* pCondFormatItem = static_cast(pItem);
+CPPUNIT_ASSERT(pCondFormatItem);
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pCondFormatItem->GetCondFormatData().size());
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), 
pCondFormatItem->GetCondFormatData().front());
+}
+
+m_pDoc->DeleteTab(0);
+}
+
 void TestCondformat::testColorScaleCondCopyPaste()
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 192dd1cea78c..43be13b5f320 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -781,6 +781,41 @@ ScFormatEntry::Type ScDataBarFormat::GetType() const
 return Type::Databar;
 }
 
+bool 

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

2023-05-22 Thread Tibor Nagy (via logerrit)
 sc/inc/colorscale.hxx  |2 +
 sc/qa/unit/ucalc_condformat.cxx|   51 +
 sc/source/core/data/colorscale.cxx |   35 +
 3 files changed, 88 insertions(+)

New commits:
commit 8af6c46a9c0e86bbbd908e96ff236ad1d6c4ddab
Author: Tibor Nagy 
AuthorDate: Wed May 17 08:40:43 2023 +0200
Commit: László Németh 
CommitDate: Mon May 22 13:32:56 2023 +0200

tdf#155319 sc: fix conditional format data bar after copying

This is a follow up to commit I064fb3fe0443705553c6bbfcc34f2d717e0f6bd6
(tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color
 scale)

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

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 90a973391995..6652e224fe67 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -313,6 +313,8 @@ public:
 const ScDataBarFormatData* GetDataBarData() const;
 ScDataBarFormatData* GetDataBarData();
 
+bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override;
+
 virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override;
 virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) 
override;
 virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) 
override;
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index bfece1515a89..78978daec33a 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -268,6 +268,57 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatInsertDeleteSheets)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste)
+{
+m_pDoc->InsertTab(0, "Test");
+
+auto pFormat = std::make_unique(1, m_pDoc);
+ScRange aCondFormatRange(0, 0, 0, 2, 0, 0);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+
+ScDataBarFormat* pDatabar = new ScDataBarFormat(m_pDoc);
+ScDataBarFormatData* pFormatData = new ScDataBarFormatData();
+pFormatData->meAxisPosition = databar::AUTOMATIC;
+pFormatData->maPositiveColor = COL_BLUE;
+pFormatData->mxNegativeColor = COL_GREEN;
+pFormatData->mbGradient = true;
+
+pDatabar->SetDataBarData(pFormatData);
+pFormat->AddEntry(pDatabar);
+
+sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, aCondFormatRange, );
+
+ScRange aTargetRange(0, 3, 0, 2, 3, 0);
+pasteFromClip(m_pDoc, aTargetRange, );
+
+// Pasting the same conditional format must modify existing format, making 
its range
+// combined of previous range and newly pasted range having the 
conditional format.
+// No new conditional formats must be created.
+CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size());
+aRangeList.Join(aTargetRange);
+for (SCCOL nCol = 0; nCol < 3; ++nCol)
+{
+ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0);
+CPPUNIT_ASSERT(pPastedFormat);
+CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange());
+
+sal_uLong nPastedKey = pPastedFormat->GetKey();
+CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey);
+
+const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, 
ATTR_CONDITIONAL);
+const ScCondFormatItem* pCondFormatItem = static_cast(pItem);
+CPPUNIT_ASSERT(pCondFormatItem);
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pCondFormatItem->GetCondFormatData().size());
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), 
pCondFormatItem->GetCondFormatData().front());
+}
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 7fd48f47305d..1d713c447c5b 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -802,6 +802,41 @@ ScFormatEntry::Type ScDataBarFormat::GetType() const
 return Type::Databar;
 }
 
+bool ScDataBarFormat::IsEqual(const ScFormatEntry& rOther, bool 
/*bIgnoreSrcPos*/) const
+{
+if (GetType() != rOther.GetType())
+return false;
+
+const ScDataBarFormat& r = static_cast(rOther);
+
+bool bEq = 
(mpFormatData->maAxisColor.IsRGBEqual(r.mpFormatData->maAxisColor)
+&& 
mpFormatData->maPositiveColor.IsRGBEqual(r.mpFormatData->maPositiveColor)
+&& mpFormatData->mxNegativeColor == 
r.mpFormatData->mxNegativeColor
+&& mpFormatData->meAxisPosition == 
r.mpFormatData->meAxisPosition
+&& mpFormatData->mbGradient == r.mpFormatData->mbGradient
+&& mpFormatData->mbOnlyBar == r.mpFormatData->mbOnlyBar);
+
+if 

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

2023-04-26 Thread Tibor Nagy (via logerrit)
 sc/inc/colorscale.hxx  |2 +
 sc/qa/unit/ucalc_condformat.cxx|   50 +
 sc/source/core/data/colorscale.cxx |   18 +
 3 files changed, 70 insertions(+)

New commits:
commit 3fa15dd614bd72ddb36dbe033abeef5609d31f38
Author: Tibor Nagy 
AuthorDate: Mon Apr 24 09:08:14 2023 +0200
Commit: Nagy Tibor 
CommitDate: Wed Apr 26 11:39:44 2023 +0200

tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color scale

This is a follow up to commit 3f614f431475e1bf3bb3bbeac59b0681309628b7
(tdf#95295: don't add duplicate conditional formats)
The above commit clearly describes how this fix works.

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

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index de74030dbc85..513eb11cf2f4 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -270,6 +270,8 @@ public:
 std::optional GetColor(const ScAddress& rAddr) const;
 void AddEntry(ScColorScaleEntry* pEntry);
 
+bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override;
+
 virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override;
 virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) 
override;
 virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) 
override;
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 811cd0d540d8..bfece1515a89 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -268,6 +268,56 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatInsertDeleteSheets)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
+{
+m_pDoc->InsertTab(0, "Test");
+
+auto pFormat = std::make_unique(1, m_pDoc);
+ScRange aCondFormatRange(0, 0, 0, 2, 0, 0);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+
+ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc);
+ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE);
+ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN);
+ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED);
+pColorScaleFormat->AddEntry(pEntryBlue);
+pColorScaleFormat->AddEntry(pEntryGreen);
+pColorScaleFormat->AddEntry(pEntryRed);
+
+pFormat->AddEntry(pColorScaleFormat);
+sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, aCondFormatRange, );
+
+ScRange aTargetRange(0, 3, 0, 2, 3, 0);
+pasteFromClip(m_pDoc, aTargetRange, );
+
+// Pasting the same conditional format must modify existing format, making 
its range
+// combined of previous range and newly pasted range having the 
conditional format.
+// No new conditional formats must be created.
+CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size());
+aRangeList.Join(aTargetRange);
+for (SCCOL nCol = 0; nCol < 3; ++nCol)
+{
+ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0);
+CPPUNIT_ASSERT(pPastedFormat);
+CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange());
+
+sal_uLong nPastedKey = pPastedFormat->GetKey();
+CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey);
+
+const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, 
ATTR_CONDITIONAL);
+const ScCondFormatItem* pCondFormatItem = static_cast(pItem);
+CPPUNIT_ASSERT(pCondFormatItem);
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pCondFormatItem->GetCondFormatData().size());
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), 
pCondFormatItem->GetCondFormatData().front());
+}
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 0a357828c61e..192dd1cea78c 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -404,6 +404,24 @@ void ScColorScaleFormat::AddEntry( ScColorScaleEntry* 
pEntry )
 maColorScales.back()->SetRepaintCallback(mpParent);
 }
 
+bool ScColorScaleFormat::IsEqual(const ScFormatEntry& rOther, bool 
/*bIgnoreSrcPos*/) const
+{
+if (GetType() != rOther.GetType())
+return false;
+
+const ScColorScaleFormat& r = static_cast(rOther);
+
+for (size_t i = 0; i < maColorScales.size(); ++i)
+{
+if 
(!maColorScales[i]->GetColor().IsRGBEqual(r.maColorScales[i]->GetColor().GetRGBColor())
+|| maColorScales[i]->GetType() != r.maColorScales[i]->GetType()
+|| maColorScales[i]->GetValue() != r.maColorScales[i]->GetValue())
+return false;
+}

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

2023-04-18 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx|   37 
 oox/source/ppt/slidepersist.cxx |   15 +-
 sd/qa/unit/data/pptx/tdf154363.pptx |binary
 sd/qa/unit/import-tests.cxx |   26 +
 4 files changed, 65 insertions(+), 13 deletions(-)

New commits:
commit 756e7701486318e72dce823f3946b7b2ea350132
Author: Tibor Nagy 
AuthorDate: Wed Mar 29 09:00:47 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Apr 18 09:27:32 2023 +0200

tdf#154363 sd: fix line connectors regression of mirrored shapes

caused by commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
(tdf#89449 PPTX import: fix line connectors).

Note: partial revert of commit 9ab16e2738b4b9bd324c9aded8acb2ecba0fd2b0
"oox: fix crash in lcl_GetGluePointId by removing unused code".

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

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a77ee85b8b92..ec2ebd54d56c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1640,17 +1640,38 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
-static sal_Int32 lcl_GetGluePointId(sal_Int32 nGluePointId)
+static sal_Int32 lcl_GetGluePointId(const Reference& xShape, sal_Int32 
nGluePointId)
 {
 if (nGluePointId > 3)
 return nGluePointId - 4;
 else
 {
-// change id of the bounding box (1 <-> 3)
-if (nGluePointId == 1)
-return 3; // Right
-else if (nGluePointId == 3)
-return 1; // Left
+bool bFlipH = false;
+bool bFlipV = false;
+Reference xShapeProps(xShape, UNO_QUERY);
+if 
(xShapeProps->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry"))
+{
+Sequence aGeometrySeq;
+xShapeProps->getPropertyValue("CustomShapeGeometry") >>= 
aGeometrySeq;
+for (int i = 0; i < aGeometrySeq.getLength(); i++)
+{
+const PropertyValue& rProp = aGeometrySeq[i];
+if (rProp.Name == "MirroredX")
+rProp.Value >>= bFlipH;
+
+if (rProp.Name == "MirroredY")
+rProp.Value >>= bFlipV;
+}
+}
+
+if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
+{
+// change id of the bounding box (1 <-> 3)
+if (nGluePointId == 1)
+nGluePointId = 3; // Right
+else if (nGluePointId == 3)
+nGluePointId = 1; // Left
+}
 }
 
 return nGluePointId;
@@ -1708,12 +1729,12 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 if (GetProperty(rXPropSet, "StartGluePointIndex"))
 mAny >>= nStartGlueId;
 if (nStartGlueId != -1)
-nStartGlueId = lcl_GetGluePointId(nStartGlueId);
+nStartGlueId = lcl_GetGluePointId(rXShapeA, nStartGlueId);
 
 if (GetProperty(rXPropSet, "EndGluePointIndex"))
 mAny >>= nEndGlueId;
 if (nEndGlueId != -1)
-nEndGlueId = lcl_GetGluePointId(nEndGlueId);
+nEndGlueId = lcl_GetGluePointId(rXShapeB, nEndGlueId);
 
 // Position is relative to group in Word, but relative to anchor of group 
in API.
 if (GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes && m_xParent.is())
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 7298eea1247c..349262fc6b8f 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -654,11 +654,16 @@ void SlidePersist::createConnectorShapeConnection()
 nGlueId += 4;
 else
 {
-// change id of the left and right glue points of the 
bounding box (1 <-> 3)
-if (nGlueId == 1)
-nGlueId = 3; // Right
-else if (nGlueId == 3)
-nGlueId = 1; // Left
+bool bFlipH = pShape->second->getFlipH();
+bool bFlipV = pShape->second->getFlipV();
+if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
+{
+// change id of the left and right glue points of 
the bounding box (1 <-> 3)
+if (nGlueId == 1)
+nGlueId = 3; // Right
+else if (nGlueId == 3)
+nGlueId = 1; // Left
+}
 }
 
 bool bStart = aConnectorShapeProperties[j].mbStartShape;
diff --git 

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

2023-04-11 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx|   37 
 oox/source/ppt/slidepersist.cxx |   15 +-
 sd/qa/unit/data/pptx/tdf154363.pptx |binary
 sd/qa/unit/import-tests.cxx |   24 +++
 4 files changed, 63 insertions(+), 13 deletions(-)

New commits:
commit b7c542b5085374f1d031183cb86ceeefcf24964d
Author: Tibor Nagy 
AuthorDate: Wed Mar 29 09:00:47 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 11 19:32:45 2023 +0200

tdf#154363 sd: fix line connectors regression of mirrored shapes

caused by commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
(tdf#89449 PPTX import: fix line connectors).

Note: partial revert of commit 9ab16e2738b4b9bd324c9aded8acb2ecba0fd2b0
"oox: fix crash in lcl_GetGluePointId by removing unused code".

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

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 372b4376fe22..eab82a86336d 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1640,17 +1640,38 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
-static sal_Int32 lcl_GetGluePointId(sal_Int32 nGluePointId)
+static sal_Int32 lcl_GetGluePointId(const Reference& xShape, sal_Int32 
nGluePointId)
 {
 if (nGluePointId > 3)
 return nGluePointId - 4;
 else
 {
-// change id of the bounding box (1 <-> 3)
-if (nGluePointId == 1)
-return 3; // Right
-else if (nGluePointId == 3)
-return 1; // Left
+bool bFlipH = false;
+bool bFlipV = false;
+Reference xShapeProps(xShape, UNO_QUERY);
+if 
(xShapeProps->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry"))
+{
+Sequence aGeometrySeq;
+xShapeProps->getPropertyValue("CustomShapeGeometry") >>= 
aGeometrySeq;
+for (int i = 0; i < aGeometrySeq.getLength(); i++)
+{
+const PropertyValue& rProp = aGeometrySeq[i];
+if (rProp.Name == "MirroredX")
+rProp.Value >>= bFlipH;
+
+if (rProp.Name == "MirroredY")
+rProp.Value >>= bFlipV;
+}
+}
+
+if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
+{
+// change id of the bounding box (1 <-> 3)
+if (nGluePointId == 1)
+nGluePointId = 3; // Right
+else if (nGluePointId == 3)
+nGluePointId = 1; // Left
+}
 }
 
 return nGluePointId;
@@ -1708,12 +1729,12 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 if (GetProperty(rXPropSet, "StartGluePointIndex"))
 mAny >>= nStartGlueId;
 if (nStartGlueId != -1)
-nStartGlueId = lcl_GetGluePointId(nStartGlueId);
+nStartGlueId = lcl_GetGluePointId(rXShapeA, nStartGlueId);
 
 if (GetProperty(rXPropSet, "EndGluePointIndex"))
 mAny >>= nEndGlueId;
 if (nEndGlueId != -1)
-nEndGlueId = lcl_GetGluePointId(nEndGlueId);
+nEndGlueId = lcl_GetGluePointId(rXShapeB, nEndGlueId);
 
 // Position is relative to group in Word, but relative to anchor of group 
in API.
 if (GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes && m_xParent.is())
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index bb673b52442e..0f7479e8ede9 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -659,11 +659,16 @@ void SlidePersist::createConnectorShapeConnection()
 nGlueId += 4;
 else
 {
-// change id of the left and right glue points of the 
bounding box (1 <-> 3)
-if (nGlueId == 1)
-nGlueId = 3; // Right
-else if (nGlueId == 3)
-nGlueId = 1; // Left
+bool bFlipH = pShape->second->getFlipH();
+bool bFlipV = pShape->second->getFlipV();
+if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
+{
+// change id of the left and right glue points of 
the bounding box (1 <-> 3)
+if (nGlueId == 1)
+nGlueId = 3; // Right
+else if (nGlueId == 3)
+nGlueId = 1; // Left
+}
 }
 
 bool bStart = aConnectorShapeProperties[j].mbStartShape;
diff --git a/sd/qa/unit/data/pptx/tdf154363.pptx 
b/sd/qa/unit/data/pptx/tdf154363.pptx
new file mode 100644
index ..b549fda90135
Binary files 

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

2023-03-27 Thread Tibor Nagy (via logerrit)
 oox/inc/drawingml/fillproperties.hxx|2 
 oox/source/drawingml/fillproperties.cxx |   89 ++--
 oox/source/drawingml/shape.cxx  |6 +-
 oox/source/ppt/slidepersist.cxx |7 ++
 oox/source/shape/WpsContext.cxx |3 -
 sd/qa/unit/data/pptx/tdf153466.pptx |binary
 sd/qa/unit/import-tests.cxx |   20 +++
 7 files changed, 110 insertions(+), 17 deletions(-)

New commits:
commit a41dbf0bd726613204d975fb4fc5e50c23d61410
Author: Tibor Nagy 
AuthorDate: Wed Mar 8 16:26:10 2023 +0100
Commit: László Németh 
CommitDate: Mon Mar 27 08:32:50 2023 +

tdf#153466 PPTX import: fix "Custom position/size" background image

Custom sized background with the value "tile" was imported as
"stretched", losing the preset size. Restore also the exported
preset positions, and map the other values to the preset positions
supported by OpenDocument/Impress.

Follow-up to commit 11451781d4c562f506a3aae3732e35b92387b4db
(tdf#153105 PPTX export: fix "Custom position/size" background image)

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

diff --git a/oox/inc/drawingml/fillproperties.hxx 
b/oox/inc/drawingml/fillproperties.hxx
index 828c858e12f2..3323907fcad8 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -147,6 +148,7 @@ struct FillProperties
 const GraphicHelper& rGraphicHelper,
 sal_Int32 nShapeRotation = 0,
 ::Color nPhClr = API_RGB_TRANSPARENT,
+const css::awt::Size& rSize = {},
 sal_Int16 nPhClrTheme = -1,
 bool bFlipH = false,
 bool bFlipV = false,
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index d193653d7189..98a048d7f8ac 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -423,9 +423,10 @@ Color FillProperties::getBestSolidColor() const
 return aSolidColor;
 }
 
-void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
-const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color 
nPhClr, sal_Int16 nPhClrTheme,
-bool bFlipH, bool bFlipV, bool bIsCustomShape) const
+void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const 
GraphicHelper& rGraphicHelper,
+   sal_Int32 nShapeRotation, ::Color nPhClr,
+   const css::awt::Size& rSize, sal_Int16 
nPhClrTheme, bool bFlipH,
+   bool bFlipV, bool bIsCustomShape) const
 {
 if( !moFillType.has_value() )
 return;
@@ -824,7 +825,6 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 {
 // bitmap mode (single, repeat, stretch)
 BitmapMode eBitmapMode = lclGetBitmapMode( 
maBlipProps.moBitmapMode.value_or( XML_TOKEN_INVALID ) );
-rPropMap.setProperty( ShapeProperty::FillBitmapMode, 
eBitmapMode );
 
 // additional settings for repeated bitmap
 if( eBitmapMode == BitmapMode_REPEAT )
@@ -872,21 +872,82 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 // Negative GraphicCrop values means "crop" here.
 bool bNeedCrop = aGraphCrop.Left <= 0 && 
aGraphCrop.Right <= 0 && aGraphCrop.Top <= 0 && aGraphCrop.Bottom <= 0;
 
-if(bIsCustomShape && bHasCropValues && bNeedCrop)
+if (bHasCropValues)
 {
-// Physically crop the image
-// In this case, don't set the 
PROP_GraphicCrop because that
-// would lead to applying the crop twice after 
roundtrip
-xGraphic = lclCropGraphic(xGraphic, 
CropQuotientsFromFillRect(aFillRect));
-if 
(rPropMap.supportsProperty(ShapeProperty::FillBitmapName))
-
rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic);
+if (bIsCustomShape && bNeedCrop)
+{
+// Physically crop the image
+// In this case, don't set the 
PROP_GraphicCrop because that
+// would lead to applying the crop twice 
after roundtrip
+xGraphic = lclCropGraphic(xGraphic, 

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

2023-02-28 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx   |4 +
 oox/source/export/drawingml.cxx|   78 +
 sd/qa/unit/data/odp/tdf153105.odp  |binary
 sd/qa/unit/export-tests-ooxml3.cxx |   16 +++
 4 files changed, 98 insertions(+)

New commits:
commit 11451781d4c562f506a3aae3732e35b92387b4db
Author: Tibor Nagy 
AuthorDate: Mon Feb 20 16:13:17 2023 +0100
Commit: László Németh 
CommitDate: Tue Feb 28 11:21:12 2023 +

tdf#153105 PPTX export: fix "Custom position/size" background image

Map size and the 9 preset positions of the ODF background image
style "Custom position/size" to the OOXML a:stretch/a:fillRect
with the appropriate left/top/right/bottom arguments.

Note: it seems, applying a:stretch or a:tile was not mandatory,
but missing a:stretch resulted non-editable document in Office 365.

Note: the import of the PPTX mapping hasn't been implemented, yet.

Follow-up to commit e8335bac5690b6beccb5ca9b36281c89fb2f28f5
"tdf#153107 OOXML export: fix scale of tile of shape background".

Change-Id: Ie940ebc2610c5b75126da05678a04ed1552cacb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147337
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 3613eb49cdd0..21914fbf57d1 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -281,6 +281,10 @@ public:
css::uno::Reference const& 
rxGraphic,
css::awt::Size const& rSize);
 
+void 
WriteXGraphicCustomPosition(css::uno::Reference 
const& rXPropSet,
+ 
css::uno::Reference const& rxGraphic,
+ css::awt::Size const& rSize);
+
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
 OUString WriteXGraphicBlip(css::uno::Reference 
const & rXPropSet,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 24463a2abf9d..d3fb8a3daf97 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1584,6 +1584,9 @@ void 
DrawingML::WriteXGraphicBlipMode(uno::Reference const
 case BitmapMode_STRETCH:
 WriteXGraphicStretch(rXPropSet, rxGraphic);
 break;
+case BitmapMode_NO_REPEAT:
+WriteXGraphicCustomPosition(rXPropSet, rxGraphic, rSize);
+break;
 default:
 break;
 }
@@ -1923,6 +1926,81 @@ void 
DrawingML::WriteXGraphicTile(uno::Reference const& rXP
   OUString::number(nSizeY), XML_algn, sRectanglePoint);
 }
 
+void 
DrawingML::WriteXGraphicCustomPosition(uno::Reference 
const& rXPropSet,
+uno::Reference 
const& rxGraphic,
+css::awt::Size const& rSize)
+{
+Graphic aGraphic(rxGraphic);
+Size aOriginalSize(aGraphic.GetPrefSize());
+const MapMode& rMapMode = aGraphic.GetPrefMapMode();
+// if the original size is in pixel, convert it to mm100
+if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
+aOriginalSize = 
Application::GetDefaultDevice()->PixelToLogic(aOriginalSize,
+  
MapMode(MapUnit::Map100thMM));
+double nSizeX = 0;
+if (GetProperty(rXPropSet, "FillBitmapSizeX"))
+{
+mAny >>= nSizeX;
+if (nSizeX <= 0)
+{
+if (nSizeX == 0)
+nSizeX = aOriginalSize.Width();
+else
+nSizeX /= 100; // percentage
+}
+}
+
+double nSizeY = 0;
+if (GetProperty(rXPropSet, "FillBitmapSizeY"))
+{
+mAny >>= nSizeY;
+if (nSizeY <= 0)
+{
+if (nSizeY == 0)
+nSizeY = aOriginalSize.Height();
+else
+nSizeY /= 100; // percentage
+}
+}
+
+if (nSizeX < 0 && nSizeY < 0 && rSize.Width != 0 && rSize.Height != 0)
+{
+nSizeX = rSize.Width * std::abs(nSizeX);
+nSizeY = rSize.Height * std::abs(nSizeY);
+}
+
+sal_Int32 nL = 0, nT = 0, nR = 0, nB = 0;
+if (GetProperty(rXPropSet, "FillBitmapRectanglePoint"))
+{
+sal_Int32 nWidth = (1 - (nSizeX / rSize.Width)) * 10;
+sal_Int32 nHeight = (1 - (nSizeY / rSize.Height)) * 10;
+
+switch (*o3tl::doAccess(mAny))
+{
+case RectanglePoint_LEFT_TOP:  nR = nWidth;  nB = 
nHeight;  break;
+case RectanglePoint_RIGHT_TOP: nL = nWidth;  nB = 
nHeight;  break;
+case RectanglePoint_LEFT_BOTTOM:   nR = nWidth;  nT = 
nHeight;  break;
+case RectanglePoint_RIGHT_BOTTOM:  nL = nWidth;  nT = 
nHeight;  break;
+case RectanglePoint_LEFT_MIDDLE:   nR = nWidth;  

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

2023-02-17 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/shape.hxx  |3 
 include/svx/svdmodel.hxx |4 
 oox/source/drawingml/shape.cxx   |4 
 oox/source/ppt/slidepersist.cxx  |  232 +--
 sd/qa/unit/data/pptx/standardConnectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |   34 +++
 sd/source/ui/docshell/docshel4.cxx   |8 
 svx/source/svdraw/svdmodel.cxx   |   21 ++
 svx/source/svdraw/svdoedge.cxx   |   10 -
 9 files changed, 265 insertions(+), 51 deletions(-)

New commits:
commit a2c32afcae257e797ad69ab2346bbe3b6a2fa8ae
Author: Tibor Nagy 
AuthorDate: Thu Jan 26 09:17:56 2023 +0100
Commit: László Németh 
CommitDate: Fri Feb 17 20:01:46 2023 +

tdf#149756 tdf#152545 PPTX import: position of standard connector - part2

and add new compatibility option "ConnectorUseSnapRect".

Standard connectors (bentConnector3, bentConnector4, bentConnector5)
are improved. MSO calculates the edge track differently, so have
to add "ConnectorUseSnapRect" compatibility option:

- For PPTX file format, it is set to true and use the snap rectangle

- For ODP format, it is set to false by default and use the bounding
  rectangle.

Follow-up to commit eec48130271188cab63665acedbabf1ff5e850a2
"tdf#148926 tdf#151678 PPTX import: position of standard
connector - part1" (bentConnector2)

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

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 36017132e83d..72ce51ef6476 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -137,6 +137,7 @@ public:
 CustomShapePropertiesPtr&   getCustomShapeProperties(){ return 
mpCustomShapePropertiesPtr; }
 
 OUString&   getConnectorName() { return 
msConnectorName; }
+std::vector&  getConnectorAdjustments() { return 
maConnectorAdjustmentList; };
 ConnectorShapePropertiesList&   getConnectorShapeProperties() { return 
maConnectorShapePropertiesList; }
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
@@ -330,6 +331,8 @@ protected:
 css::awt::Size   maChSize; // only used for group shapes
 css::awt::Point  maChPosition; // only used for group shapes
 
+std::vector   maConnectorAdjustmentList; // only used for 
connector shapes
+
 TextBodyPtr mpTextBody;
 LinePropertiesPtr   mpLinePropertiesPtr;
 LinePropertiesPtr   mpShapeRefLinePropPtr;
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 76c63a40d351..6d130dfe0599 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -574,6 +574,10 @@ public:
 void SetLegacySingleLineFontwork(bool bEnabled);
 bool IsLegacySingleLineFontwork() const;
 
+// tdf#149756 compatibility flag
+void SetConnectorUseSnapRect(bool bEnabled);
+bool IsConnectorUseSnapRect() const;
+
 void ReformatAllTextObjects();
 
 std::unique_ptr createOutliner( OutlinerMode nOutlinerMode );
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index b3162381534a..fac027376784 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1692,6 +1692,10 @@ Reference< XShape > const & Shape::createAndInsert(
 RTL_TEXTENCODING_UTF8);
 msConnectorName = sConnectorShapePresetTypeName;
 
+auto aAdjustmentList = 
mpCustomShapePropertiesPtr->getAdjustmentGuideList();
+for (size_t i = 0; i < aAdjustmentList.size(); i++)
+
maConnectorAdjustmentList.push_back(aAdjustmentList[i].maFormula);
+
 sal_Int32 nType = mpCustomShapePropertiesPtr->getShapePresetType();
 switch (nType)
 {
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index ca296561a52f..7298eea1247c 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -386,7 +386,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 {
 sal_Int32 nEdge = 0;
 awt::Point aStartPt, aEndPt;
-tools::Rectangle aStartRect, aEndRect;
+tools::Rectangle aS, aE; // Start, End rectangle
 uno::Reference xStartSp, xEndSp;
 uno::Reference xPropSet(rXConnector, uno::UNO_QUERY);
 xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt;
@@ -401,80 +401,218 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 SdrObject* pStartObj = xStartSp.is() ? 
SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr;
 SdrObject* pEndObj = xEndSp.is() ? 

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

2023-02-15 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/tdf138601.xlsx   |binary
 sc/qa/unit/subsequent_filters_test.cxx|   26 ++
 sc/source/filter/oox/condformatbuffer.cxx |   20 
 3 files changed, 46 insertions(+)

New commits:
commit 90f4ea09cbe34e26e473ed2cf1c3457cf0f41e5e
Author: Tibor Nagy 
AuthorDate: Thu Feb 2 20:16:04 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Feb 15 15:14:24 2023 +

tdf#138601 XLSX import: fix priority of conditional formatting rules

Multiple conditional formattings can intersect or have the same
range of cell with different rules. Without sorting the rules
by their priority, the cells got bad formatting, e.g. different
colors than what was set in MSO.

Change-Id: I619359877f1a3e55fc8f895d5ba6f0f4f30e07f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146513
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 8c9a6abf30e9ff1ebd5647f7c271e0d64643860a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147057
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/xlsx/tdf138601.xlsx 
b/sc/qa/unit/data/xlsx/tdf138601.xlsx
new file mode 100644
index ..81107ee09c30
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf138601.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index fd0aa159467b..c080942d486d 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -78,6 +78,7 @@ public:
 ScFiltersTest();
 
 //ods, xls, xlsx filter tests
+void testTdf138601_CondFormatXLSX();
 void testContentODS();
 void testContentXLS();
 void testContentXLSX();
@@ -209,6 +210,7 @@ public:
 void testForcepoint107();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
+CPPUNIT_TEST(testTdf138601_CondFormatXLSX);
 CPPUNIT_TEST(testContentODS);
 CPPUNIT_TEST(testContentXLS);
 CPPUNIT_TEST(testContentXLSX);
@@ -419,6 +421,30 @@ void testContentImpl(ScDocument& rDoc, bool 
bCheckMergedCells)
 }
 }
 
+void ScFiltersTest::testTdf138601_CondFormatXLSX()
+{
+createScDoc("xlsx/tdf138601.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pFormat1 = pDoc->GetCondFormat(0, 0, 0);
+const ScFormatEntry* pEntry1 = pFormat1->GetEntry(0);
+const ScColorScaleFormat* pColorScale1 = static_cast(pEntry1);
+const ScColorScaleEntry* pColorScaleEntry1 = pColorScale1->GetEntry(0);
+CPPUNIT_ASSERT_EQUAL(Color(255, 255, 201), pColorScaleEntry1->GetColor());
+
+ScConditionalFormat* pFormat2 = pDoc->GetCondFormat(1, 0, 0);
+const ScFormatEntry* pEntry2 = pFormat2->GetEntry(0);
+const ScColorScaleFormat* pColorScale2 = static_cast(pEntry2);
+const ScColorScaleEntry* pColorScaleEntry2 = pColorScale2->GetEntry(0);
+CPPUNIT_ASSERT_EQUAL(Color(255, 139, 139), pColorScaleEntry2->GetColor());
+
+ScConditionalFormat* pFormat3 = pDoc->GetCondFormat(0, 1, 0);
+const ScFormatEntry* pEntry3 = pFormat3->GetEntry(0);
+const ScColorScaleFormat* pColorScale3 = static_cast(pEntry3);
+const ScColorScaleEntry* pColorScaleEntry3 = pColorScale3->GetEntry(0);
+CPPUNIT_ASSERT_EQUAL(Color(255, 255, 201), pColorScaleEntry3->GetColor());
+}
+
 void ScFiltersTest::testContentODS()
 {
 createScDoc("ods/universal-content.ods");
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 87b47456ab97..1abb3bf91938 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1163,6 +1163,26 @@ void CondFormatBuffer::finalizeImport()
 ++nExtCFIndex;
 }
 
+// tdf#138601 sort conditional formatting rules by their priority
+if (maCondFormats.size() > 1)
+{
+size_t minIndex;
+for (size_t i = 0; i < maCondFormats.size() - 1; ++i)
+{
+minIndex = i;
+for (size_t j = i + 1; j < maCondFormats.size(); ++j)
+{
+if (maCondFormats[j]->maRules.begin()->first
+< maCondFormats[minIndex]->maRules.begin()->first)
+{
+minIndex = j;
+}
+}
+if (i != minIndex)
+std::swap(maCondFormats[i], maCondFormats[minIndex]);
+}
+}
+
 for( const auto& rxCondFormat : maCondFormats )
 {
 if ( rxCondFormat)


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

2023-02-15 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/tdf138601.xlsx   |binary
 sc/qa/unit/subsequent_filters_test.cxx|   26 ++
 sc/source/filter/oox/condformatbuffer.cxx |   20 
 3 files changed, 46 insertions(+)

New commits:
commit 8c9a6abf30e9ff1ebd5647f7c271e0d64643860a
Author: Tibor Nagy 
AuthorDate: Thu Feb 2 20:16:04 2023 +0100
Commit: László Németh 
CommitDate: Wed Feb 15 10:17:06 2023 +

tdf#138601 XLSX import: fix priority of conditional formatting rules

Multiple conditional formattings can intersect or have the same
range of cell with different rules. Without sorting the rules
by their priority, the cells got bad formatting, e.g. different
colors than what was set in MSO.

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

diff --git a/sc/qa/unit/data/xlsx/tdf138601.xlsx 
b/sc/qa/unit/data/xlsx/tdf138601.xlsx
new file mode 100644
index ..81107ee09c30
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf138601.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index 7749106a3883..45598beae411 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -78,6 +78,7 @@ public:
 ScFiltersTest();
 
 //ods, xls, xlsx filter tests
+void testTdf138601_CondFormatXLSX();
 void testContentODS();
 void testContentXLS();
 void testContentXLSX();
@@ -210,6 +211,7 @@ public:
 void testForcepoint107();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
+CPPUNIT_TEST(testTdf138601_CondFormatXLSX);
 CPPUNIT_TEST(testContentODS);
 CPPUNIT_TEST(testContentXLS);
 CPPUNIT_TEST(testContentXLSX);
@@ -421,6 +423,30 @@ void testContentImpl(ScDocument& rDoc, bool 
bCheckMergedCells)
 }
 }
 
+void ScFiltersTest::testTdf138601_CondFormatXLSX()
+{
+createScDoc("xlsx/tdf138601.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pFormat1 = pDoc->GetCondFormat(0, 0, 0);
+const ScFormatEntry* pEntry1 = pFormat1->GetEntry(0);
+const ScColorScaleFormat* pColorScale1 = static_cast(pEntry1);
+const ScColorScaleEntry* pColorScaleEntry1 = pColorScale1->GetEntry(0);
+CPPUNIT_ASSERT_EQUAL(Color(255, 255, 201), pColorScaleEntry1->GetColor());
+
+ScConditionalFormat* pFormat2 = pDoc->GetCondFormat(1, 0, 0);
+const ScFormatEntry* pEntry2 = pFormat2->GetEntry(0);
+const ScColorScaleFormat* pColorScale2 = static_cast(pEntry2);
+const ScColorScaleEntry* pColorScaleEntry2 = pColorScale2->GetEntry(0);
+CPPUNIT_ASSERT_EQUAL(Color(255, 139, 139), pColorScaleEntry2->GetColor());
+
+ScConditionalFormat* pFormat3 = pDoc->GetCondFormat(0, 1, 0);
+const ScFormatEntry* pEntry3 = pFormat3->GetEntry(0);
+const ScColorScaleFormat* pColorScale3 = static_cast(pEntry3);
+const ScColorScaleEntry* pColorScaleEntry3 = pColorScale3->GetEntry(0);
+CPPUNIT_ASSERT_EQUAL(Color(255, 255, 201), pColorScaleEntry3->GetColor());
+}
+
 void ScFiltersTest::testContentODS()
 {
 createScDoc("ods/universal-content.ods");
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 87b47456ab97..1abb3bf91938 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1163,6 +1163,26 @@ void CondFormatBuffer::finalizeImport()
 ++nExtCFIndex;
 }
 
+// tdf#138601 sort conditional formatting rules by their priority
+if (maCondFormats.size() > 1)
+{
+size_t minIndex;
+for (size_t i = 0; i < maCondFormats.size() - 1; ++i)
+{
+minIndex = i;
+for (size_t j = i + 1; j < maCondFormats.size(); ++j)
+{
+if (maCondFormats[j]->maRules.begin()->first
+< maCondFormats[minIndex]->maRules.begin()->first)
+{
+minIndex = j;
+}
+}
+if (i != minIndex)
+std::swap(maCondFormats[i], maCondFormats[minIndex]);
+}
+}
+
 for( const auto& rxCondFormat : maCondFormats )
 {
 if ( rxCondFormat)


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

2023-01-26 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx |   27 -
 oox/source/export/drawingml.cxx  |   55 
 oox/source/export/shapes.cxx |6 +--
 sd/qa/unit/data/odp/tdf153107.odp|binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   60 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |4 +-
 6 files changed, 112 insertions(+), 40 deletions(-)

New commits:
commit e8335bac5690b6beccb5ca9b36281c89fb2f28f5
Author: Tibor Nagy 
AuthorDate: Mon Jan 23 09:33:13 2023 +0100
Commit: László Németh 
CommitDate: Thu Jan 26 19:49:09 2023 +

tdf#153107 OOXML export: fix scale of tile of shape background

Relative scale values were exported as absolute values,
resulting broken shape background.

Change-Id: Ia38e125862e7f8ceff5d41754340723c3a9eb028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145996
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 c131632aea8d..3613eb49cdd0 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -248,16 +248,18 @@ public:
 
 void WriteGrabBagGradientFill( const css::uno::Sequence< 
css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
 
-void WriteBlipOrNormalFill( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,
-const OUString& rURLPropName );
-void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
-const OUString& sURLPropName );
-void WriteBlipFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet,
- const OUString& sURLPropName, sal_Int32 nXmlNamespace 
);
+void WriteBlipOrNormalFill(const 
css::uno::Reference& rXPropSet,
+   const OUString& rURLPropName, const 
css::awt::Size& rSize = {});
+void WriteBlipFill(const css::uno::Reference& 
rXPropSet,
+   const OUString& sURLPropName, const css::awt::Size& 
rSize = {});
+void WriteBlipFill(const css::uno::Reference& 
rXPropSet,
+   const css::awt::Size& rSize, const OUString& 
sURLPropName,
+   sal_Int32 nXmlNamespace);
 
 void WriteXGraphicBlipFill(css::uno::Reference 
const & rXPropSet,
css::uno::Reference 
const & rxGraphic,
-   sal_Int32 nXmlNamespace, bool bWriteMode, bool 
bRelPathToMedia = false);
+   sal_Int32 nXmlNamespace, bool bWriteMode,
+   bool bRelPathToMedia = false, css::awt::Size 
const& rSize = {});
 
 void WritePattFill( const css::uno::Reference< css::beans::XPropertySet >& 
rXPropSet );
 void WritePattFill(const css::uno::Reference& 
rXPropSet,
@@ -276,7 +278,8 @@ public:
   css::uno::Reference 
const & rxGraphic);
 
 void WriteXGraphicTile(css::uno::Reference 
const& rXPropSet,
-   css::uno::Reference const& 
rxGraphic);
+   css::uno::Reference const& 
rxGraphic,
+   css::awt::Size const& rSize);
 
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
@@ -286,8 +289,9 @@ public:
 
 void 
WriteImageBrightnessContrastTransparence(css::uno::Reference
 const & rXPropSet);
 
-void WriteXGraphicBlipMode(css::uno::Reference 
const & rXPropSet,
-   css::uno::Reference 
const & rxGraphic);
+void WriteXGraphicBlipMode(css::uno::Reference 
const& rXPropSet,
+   css::uno::Reference 
const& rxGraphic,
+   css::awt::Size const& rSize);
 
 void WriteShapeTransformation(const css::uno::Reference< 
css::drawing::XShape >& rXShape,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool 
bFlippedBeforeRotation = false);
@@ -327,7 +331,8 @@ public:
 void WriteEmptyCustomGeometry();
 void WritePolyPolygon(const css::uno::Reference& 
rXShape,
   const bool bClosed);
-void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
+void WriteFill(const css::uno::Reference& 
xPropSet,
+   const css::awt::Size& rSize = {});
 void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteShapeEffects( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
 void WriteShapeEffect( std::u16string_view sName, const 
css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 751aabc859eb..8e57e9cecb36 100644
--- 

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

2023-01-08 Thread Tibor Nagy (via logerrit)
 cui/source/tabpages/tpbitmap.cxx |8 +---
 sd/qa/uitest/impress_tests/tdf152295.py  |   55 +++
 sw/qa/uitest/writer_tests3/pageDialog.py |8 ++--
 uitest/impress_tests/backgrounds.py  |4 +-
 4 files changed, 63 insertions(+), 12 deletions(-)

New commits:
commit 64a444eefc2fd1821349222eb07a720e46ea1494
Author: Tibor Nagy 
AuthorDate: Thu Dec 8 11:37:47 2022 +0100
Commit: Thorsten Behrens 
CommitDate: Sun Jan 8 11:49:08 2023 +

tdf#152295 sw sd UI: don't reset tiled image size by Area tab

The background tiling images become larger when
opening and closing Area tab: reopening the image
properties in the Area tab shows that the Width
and Height got reset to the original values of the
image.

Regression from commit 686349476e03f951f4a9ff9755b9f71951b64ea5
"[GSoC] Move all fill style tabs inside area tab".

Change-Id: Ibc4dfd73dedd81b1b7fe17574198dd4999aab967
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143819
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 4a4f58f06f802e7bc057e0a6e7180b595bd4a379)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144794
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index bf3b742a19d2..b515d6bd9a36 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -316,15 +316,9 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
 if(rAttrs->GetItemState(XATTR_FILLBMP_SIZELOG) != SfxItemState::DONTCARE)
 {
 if (rAttrs->Get( XATTR_FILLBMP_SIZELOG ).GetValue())
-{
 m_xTsbScale->set_state(TRISTATE_FALSE);
-m_bLogicalSize = true;
-}
 else
-{
 m_xTsbScale->set_state(TRISTATE_TRUE);
-m_bLogicalSize = false;
-}
 }
 else
 m_xTsbScale->set_state(TRISTATE_INDET);
@@ -337,6 +331,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
 nWidth = rBitmapSize.Width();
 else if(nWidth < 0)
 {
+m_bLogicalSize = true;
 eRelative = TRISTATE_TRUE;
 nWidth = std::abs(nWidth);
 }
@@ -349,6 +344,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
 nHeight = rBitmapSize.Height();
 else if(nHeight < 0)
 {
+m_bLogicalSize = true;
 eRelative = TRISTATE_TRUE;
 nHeight = std::abs(nHeight);
 }
diff --git a/sd/qa/uitest/impress_tests/tdf152295.py 
b/sd/qa/uitest/impress_tests/tdf152295.py
new file mode 100644
index ..e6994d09ee61
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf152295.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 uitest.uihelper.common import get_state_as_dict, select_pos
+from uitest.uihelper.common import change_measurement_unit
+
+class tdf152295(UITestCase):
+def test_tdf152295(self):
+with self.ui_test.create_doc_in_start_center("impress") as document:
+change_measurement_unit(self, "Centimeter")
+TemplateDialog = self.xUITest.getTopFocusWindow()
+close = TemplateDialog.getChild("close")
+self.ui_test.close_dialog_through_button(close)
+
+with self.ui_test.execute_dialog_through_command(".uno:PageSetup") 
as DrawPageDialog:
+xTabs = DrawPageDialog.getChild("tabcontrol")
+select_pos(xTabs, "1")
+btnbitmap = DrawPageDialog.getChild("btnbitmap")
+btnbitmap.executeAction("CLICK",tuple())
+width = DrawPageDialog.getChild("width")
+for _ in range(50):
+width.executeAction("UP",tuple())
+height = DrawPageDialog.getChild("height")
+for _ in range(50):
+height.executeAction("UP",tuple())
+
+with self.ui_test.execute_dialog_through_command(".uno:PageSetup") 
as DrawPageDialog:
+xTabs = DrawPageDialog.getChild("tabcontrol")
+select_pos(xTabs, "1")
+btnbitmap = DrawPageDialog.getChild("btnbitmap")
+btnbitmap.executeAction("CLICK",tuple())
+
+with self.ui_test.execute_dialog_through_command(".uno:PageSetup") 
as DrawPageDialog:
+xTabs = DrawPageDialog.getChild("tabcontrol")
+select_pos(xTabs, "1")
+btnbitmap = DrawPageDialog.getChild("btnbitmap")
+btnbitmap.executeAction("CLICK",tuple())
+ 

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

2022-12-26 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx |   12 
 sd/qa/unit/data/pptx/tdf152434.pptx |binary
 sd/qa/unit/import-tests.cxx |   11 +++
 3 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 28cc540d99f545a7871497a7228e57d17406d3ea
Author: Tibor Nagy 
AuthorDate: Mon Dec 12 16:44:07 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 26 10:37:45 2022 +

tdf#152434 PPTX import: fix lost shapes with connectors

Regression from commit eec48130271188cab63665acedbabf1ff5e850a2
"tdf#148926 tdf#151678 PPTX import: position of standard connector
 - part1".

Change-Id: Ib9381403f7c0edf9a06e3d98965067a51b4797d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144000
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit c3f1ec60569727d8aba50b2f59882e13a8443880)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144485
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144545
(cherry picked from commit 324f519b8ccf1a53c6d4e802241b157d774e9864)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144664
Reviewed-by: Michael Stahl 
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 4536e7c75be1..657703fff239 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -505,10 +505,14 @@ void SlidePersist::createConnectorShapeConnection()
 }
 }
 }
-ConnectorType aConnectorType;
-xPropertySet->getPropertyValue("EdgeKind") >>= aConnectorType;
-if (aConnectorType == ConnectorType_STANDARD)
-lcl_SetEdgeLineValue(xConnector, pIt->second);
+uno::Reference xPropInfo = 
xPropertySet->getPropertySetInfo();
+if (xPropInfo->hasPropertyByName("EdgeKind"))
+{
+ConnectorType aConnectorType;
+xPropertySet->getPropertyValue("EdgeKind") >>= aConnectorType;
+if (aConnectorType == ConnectorType_STANDARD)
+lcl_SetEdgeLineValue(xConnector, pIt->second);
+}
 }
 }
 maConnectorShapeId.clear();
diff --git a/sd/qa/unit/data/pptx/tdf152434.pptx 
b/sd/qa/unit/data/pptx/tdf152434.pptx
new file mode 100644
index ..f0716a92fe1b
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152434.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 66653f751867..d2c9001b50e2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -84,6 +84,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf152434();
 void testConnectors();
 void testTdf149314();
 void testTdf149124();
@@ -156,6 +157,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf152434);
 CPPUNIT_TEST(testConnectors);
 CPPUNIT_TEST(testTdf149314);
 CPPUNIT_TEST(testTdf149124);
@@ -306,6 +308,15 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf152434()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf152434.pptx"), 
PPTX);
+
+const SdrPage* pPage = GetPage( 1, xDocShRef );
+CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
+}
+
 void SdImportTest::testConnectors()
 {
 ::sd::DrawDocShellRef xDocShRef


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

2022-12-20 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx |   12 
 sd/qa/unit/data/pptx/tdf152434.pptx |binary
 sd/qa/unit/import-tests.cxx |   11 +++
 3 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 324f519b8ccf1a53c6d4e802241b157d774e9864
Author: Tibor Nagy 
AuthorDate: Mon Dec 12 16:44:07 2022 +0100
Commit: Xisco Fauli 
CommitDate: Tue Dec 20 09:20:26 2022 +

tdf#152434 PPTX import: fix lost shapes with connectors

Regression from commit eec48130271188cab63665acedbabf1ff5e850a2
"tdf#148926 tdf#151678 PPTX import: position of standard connector
 - part1".

Change-Id: Ib9381403f7c0edf9a06e3d98965067a51b4797d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144000
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit c3f1ec60569727d8aba50b2f59882e13a8443880)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144485
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144545

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 4536e7c75be1..657703fff239 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -505,10 +505,14 @@ void SlidePersist::createConnectorShapeConnection()
 }
 }
 }
-ConnectorType aConnectorType;
-xPropertySet->getPropertyValue("EdgeKind") >>= aConnectorType;
-if (aConnectorType == ConnectorType_STANDARD)
-lcl_SetEdgeLineValue(xConnector, pIt->second);
+uno::Reference xPropInfo = 
xPropertySet->getPropertySetInfo();
+if (xPropInfo->hasPropertyByName("EdgeKind"))
+{
+ConnectorType aConnectorType;
+xPropertySet->getPropertyValue("EdgeKind") >>= aConnectorType;
+if (aConnectorType == ConnectorType_STANDARD)
+lcl_SetEdgeLineValue(xConnector, pIt->second);
+}
 }
 }
 maConnectorShapeId.clear();
diff --git a/sd/qa/unit/data/pptx/tdf152434.pptx 
b/sd/qa/unit/data/pptx/tdf152434.pptx
new file mode 100644
index ..f0716a92fe1b
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152434.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 66653f751867..d2c9001b50e2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -84,6 +84,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf152434();
 void testConnectors();
 void testTdf149314();
 void testTdf149124();
@@ -156,6 +157,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf152434);
 CPPUNIT_TEST(testConnectors);
 CPPUNIT_TEST(testTdf149314);
 CPPUNIT_TEST(testTdf149124);
@@ -306,6 +308,15 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf152434()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf152434.pptx"), 
PPTX);
+
+const SdrPage* pPage = GetPage( 1, xDocShRef );
+CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
+}
+
 void SdImportTest::testConnectors()
 {
 ::sd::DrawDocShellRef xDocShRef


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

2022-12-20 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/fillproperties.cxx |5 +++--
 oox/source/export/drawingml.cxx |   26 --
 sd/qa/unit/data/pptx/tdf152070.pptx |binary
 sd/qa/unit/import-tests.cxx |   20 
 4 files changed, 39 insertions(+), 12 deletions(-)

New commits:
commit 63baa8c2450e2333fa343f8ddedad5f5908234e6
Author: Tibor Nagy 
AuthorDate: Mon Dec 5 09:21:51 2022 +0100
Commit: Xisco Fauli 
CommitDate: Tue Dec 20 08:49:00 2022 +

tdf#152070 PPTX import: fix offset of tile background image

by using bitmap image sizes instead of the original ones.

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index c68568096fd8..2627a1861850 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -831,10 +831,11 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 sal_Int32 nFillBmpSizeY = getLimitedValue< 
sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapSizeY, nFillBmpSizeY );
 
+awt::Size aBmpSize(nFillBmpSizeX, nFillBmpSizeY);
 // offset of the first bitmap tile (given as 
EMUs), convert to percent
-sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aOriginalSize.Width), 0, 100 );
+sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aBmpSize.Width), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetX, nTileOffsetX );
-sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aOriginalSize.Height), 0, 100 );
+sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aBmpSize.Height), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetY, nTileOffsetY );
 }
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3418a125fac5..86b9b5ac91dc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1887,19 +1887,18 @@ void 
DrawingML::WriteXGraphicTile(uno::Reference const& rXP
 if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
 aOriginalSize = 
Application::GetDefaultDevice()->PixelToLogic(aOriginalSize,
   
MapMode(MapUnit::Map100thMM));
-sal_Int32 nOffsetX = 0;
-if (GetProperty(rXPropSet, "FillBitmapPositionOffsetX"))
-nOffsetX = (*o3tl::doAccess(mAny)) * aOriginalSize.Width() 
* 3.6;
-
-sal_Int32 nOffsetY = 0;
-if (GetProperty(rXPropSet, "FillBitmapPositionOffsetY"))
-nOffsetY = (*o3tl::doAccess(mAny)) * aOriginalSize.Height() 
* 3.6;
-
-// convert the X size of bitmap to a percentage
 sal_Int32 nSizeX = 0;
+sal_Int32 nOffsetX = 0;
 if (GetProperty(rXPropSet, "FillBitmapSizeX"))
 {
 mAny >>= nSizeX;
+if (GetProperty(rXPropSet, "FillBitmapPositionOffsetX"))
+{
+sal_Int32 nX = (nSizeX != 0) ? nSizeX : aOriginalSize.Width();
+nOffsetX = (*o3tl::doAccess(mAny)) * nX * 3.6;
+}
+
+// convert the X size of bitmap to a percentage
 if (nSizeX > 0)
 nSizeX = double(nSizeX) / aOriginalSize.Width() * 10;
 else if (nSizeX < 0)
@@ -1908,11 +1907,18 @@ void 
DrawingML::WriteXGraphicTile(uno::Reference const& rXP
 nSizeX = 10;
 }
 
-// convert the Y size of bitmap to a percentage
 sal_Int32 nSizeY = 0;
+sal_Int32 nOffsetY = 0;
 if (GetProperty(rXPropSet, "FillBitmapSizeY"))
 {
 mAny >>= nSizeY;
+if (GetProperty(rXPropSet, "FillBitmapPositionOffsetY"))
+{
+sal_Int32 nY = (nSizeY != 0) ? nSizeY : aOriginalSize.Height();
+nOffsetY = (*o3tl::doAccess(mAny)) * nY * 3.6;
+}
+
+// convert the Y size of bitmap to a percentage
 if (nSizeY > 0)
 nSizeY = double(nSizeY) / aOriginalSize.Height() * 10;
 else if (nSizeY < 0)
diff --git a/sd/qa/unit/data/pptx/tdf152070.pptx 

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

2022-12-19 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx |   12 
 sd/qa/unit/data/pptx/tdf152434.pptx |binary
 sd/qa/unit/import-tests.cxx |   13 +
 3 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit d67b38039c672c8f88d2a668312dbcdbaea4297a
Author: Tibor Nagy 
AuthorDate: Mon Dec 12 16:44:07 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 19 19:58:32 2022 +

tdf#152434 PPTX import: fix lost shapes with connectors

Regression from commit eec48130271188cab63665acedbabf1ff5e850a2
"tdf#148926 tdf#151678 PPTX import: position of standard connector
 - part1".

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

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 9d2ad58b5be2..c875239aac46 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -504,10 +504,14 @@ void SlidePersist::createConnectorShapeConnection()
 }
 }
 }
-ConnectorType aConnectorType;
-xPropertySet->getPropertyValue("EdgeKind") >>= aConnectorType;
-if (aConnectorType == ConnectorType_STANDARD)
-lcl_SetEdgeLineValue(xConnector, pIt->second);
+uno::Reference xPropInfo = 
xPropertySet->getPropertySetInfo();
+if (xPropInfo->hasPropertyByName("EdgeKind"))
+{
+ConnectorType aConnectorType;
+xPropertySet->getPropertyValue("EdgeKind") >>= aConnectorType;
+if (aConnectorType == ConnectorType_STANDARD)
+lcl_SetEdgeLineValue(xConnector, pIt->second);
+}
 }
 }
 maConnectorShapeId.clear();
diff --git a/sd/qa/unit/data/pptx/tdf152434.pptx 
b/sd/qa/unit/data/pptx/tdf152434.pptx
new file mode 100644
index ..f0716a92fe1b
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152434.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index eb125a46834f..abd21782bf68 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -83,6 +83,7 @@ public:
 }
 
 void testDocumentLayout();
+void testTdf152434();
 void testConnectors();
 void testTdf150719();
 void testTdf149314();
@@ -157,6 +158,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf152434);
 CPPUNIT_TEST(testConnectors);
 CPPUNIT_TEST(testTdf150719);
 CPPUNIT_TEST(testTdf149314);
@@ -338,6 +340,17 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf152434()
+{
+createSdImpressDoc("pptx/tdf152434.pptx");
+
+SdXImpressDocument* pXImpressDocument = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pXImpressDocument);
+SdDrawDocument* pDoc = pXImpressDocument->GetDoc();
+const SdrPage* pPage = pDoc->GetPage(1);
+CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
+}
+
 void SdImportTest::testConnectors()
 {
 createSdImpressDoc("pptx/connectors.pptx");


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

2022-12-19 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152335.pptx  |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |   12 
 sd/source/filter/eppt/pptx-epptooxml.cxx |   11 ---
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 2dda846bcb32b13d9b6159003702db4359fec8b7
Author: Tibor Nagy 
AuthorDate: Thu Dec 1 09:33:58 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 19 17:37:33 2022 +

tdf#152335 PPTX export: fix 3D shape properties of the shape in theme

The shapes got extra 3D shape properties by the default template,
which caused visible difference in MSO.

Follow-up to commit I02f1edea84b50dbb9b0e0a59b6062a29894afde4
(tdf#152186 PPTX export: fix shadow of the shape in theme)

Follow-up to commit 25e9766e9b87342b6f1b29dc146d5f33e12157a7
(tdf#9 PPTX export: fix line width of the shape in theme)

Change-Id: I84f931e45e7656c456fe910cbb5e09aabeb8924f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143516
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 40ea23ecdb46dfe4f4677ddbe5cb82d7f71ee592)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144477
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sd/qa/unit/data/pptx/tdf152335.pptx 
b/sd/qa/unit/data/pptx/tdf152335.pptx
new file mode 100644
index ..03c8612bb54c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152335.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index d61d0c0991d4..2c3c5a0152e3 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -51,6 +51,7 @@ public:
 {
 }
 
+void testTdf152335();
 void testTdf149803();
 void testTdf149311();
 void testTdf149128();
@@ -125,6 +126,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf152335);
 CPPUNIT_TEST(testTdf149803);
 CPPUNIT_TEST(testTdf149311);
 CPPUNIT_TEST(testTdf149128);
@@ -225,6 +227,16 @@ void checkFontAttributes(const SdrTextObj* pObj, ItemValue 
nVal, sal_uInt32 nId)
 }
 }
 
+void SdOOXMLExportTest1::testTdf152335()
+{
+createSdImpressDoc("pptx/tdf152335.pptx");
+save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDocTheme = parseExport("ppt/theme/theme1.xml");
+assertXPathChildren(
+pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:effectStyleLst/a:effectStyle[3]", 1);
+}
+
 void SdOOXMLExportTest1::testTdf149803()
 {
 createSdImpressDoc("pptx/tdf149803.pptx");
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 842c7944d0c3..05ec471f610f 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2048,17 +2048,6 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
 \
   \
-  \
-\
-  \
-\
-\
-  \
-\
-  \
-  \
-\
-  \
 \
   \
   \


[Libreoffice-commits] core.git: cui/source sd/qa sw/qa uitest/impress_tests

2022-12-19 Thread Tibor Nagy (via logerrit)
 cui/source/tabpages/tpbitmap.cxx |8 +---
 sd/qa/uitest/impress_tests/tdf152295.py  |   55 +++
 sw/qa/uitest/writer_tests3/pageDialog.py |8 ++--
 uitest/impress_tests/backgrounds.py  |4 +-
 4 files changed, 63 insertions(+), 12 deletions(-)

New commits:
commit 4a4f58f06f802e7bc057e0a6e7180b595bd4a379
Author: Tibor Nagy 
AuthorDate: Thu Dec 8 11:37:47 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 19 12:20:08 2022 +

tdf#152295 sw sd UI: don't reset tiled image size by Area tab

The background tiling images become larger when
opening and closing Area tab: reopening the image
properties in the Area tab shows that the Width
and Height got reset to the original values of the
image.

Regression from commit 686349476e03f951f4a9ff9755b9f71951b64ea5
"[GSoC] Move all fill style tabs inside area tab".

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

diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index bf3b742a19d2..b515d6bd9a36 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -316,15 +316,9 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
 if(rAttrs->GetItemState(XATTR_FILLBMP_SIZELOG) != SfxItemState::DONTCARE)
 {
 if (rAttrs->Get( XATTR_FILLBMP_SIZELOG ).GetValue())
-{
 m_xTsbScale->set_state(TRISTATE_FALSE);
-m_bLogicalSize = true;
-}
 else
-{
 m_xTsbScale->set_state(TRISTATE_TRUE);
-m_bLogicalSize = false;
-}
 }
 else
 m_xTsbScale->set_state(TRISTATE_INDET);
@@ -337,6 +331,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
 nWidth = rBitmapSize.Width();
 else if(nWidth < 0)
 {
+m_bLogicalSize = true;
 eRelative = TRISTATE_TRUE;
 nWidth = std::abs(nWidth);
 }
@@ -349,6 +344,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs )
 nHeight = rBitmapSize.Height();
 else if(nHeight < 0)
 {
+m_bLogicalSize = true;
 eRelative = TRISTATE_TRUE;
 nHeight = std::abs(nHeight);
 }
diff --git a/sd/qa/uitest/impress_tests/tdf152295.py 
b/sd/qa/uitest/impress_tests/tdf152295.py
new file mode 100644
index ..e6994d09ee61
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf152295.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 uitest.uihelper.common import get_state_as_dict, select_pos
+from uitest.uihelper.common import change_measurement_unit
+
+class tdf152295(UITestCase):
+def test_tdf152295(self):
+with self.ui_test.create_doc_in_start_center("impress") as document:
+change_measurement_unit(self, "Centimeter")
+TemplateDialog = self.xUITest.getTopFocusWindow()
+close = TemplateDialog.getChild("close")
+self.ui_test.close_dialog_through_button(close)
+
+with self.ui_test.execute_dialog_through_command(".uno:PageSetup") 
as DrawPageDialog:
+xTabs = DrawPageDialog.getChild("tabcontrol")
+select_pos(xTabs, "1")
+btnbitmap = DrawPageDialog.getChild("btnbitmap")
+btnbitmap.executeAction("CLICK",tuple())
+width = DrawPageDialog.getChild("width")
+for _ in range(50):
+width.executeAction("UP",tuple())
+height = DrawPageDialog.getChild("height")
+for _ in range(50):
+height.executeAction("UP",tuple())
+
+with self.ui_test.execute_dialog_through_command(".uno:PageSetup") 
as DrawPageDialog:
+xTabs = DrawPageDialog.getChild("tabcontrol")
+select_pos(xTabs, "1")
+btnbitmap = DrawPageDialog.getChild("btnbitmap")
+btnbitmap.executeAction("CLICK",tuple())
+
+with self.ui_test.execute_dialog_through_command(".uno:PageSetup") 
as DrawPageDialog:
+xTabs = DrawPageDialog.getChild("tabcontrol")
+select_pos(xTabs, "1")
+btnbitmap = DrawPageDialog.getChild("btnbitmap")
+btnbitmap.executeAction("CLICK",tuple())
+width = DrawPageDialog.getChild("width")
+height = DrawPageDialog.getChild("height")
+
+# Without the fix in place, this test would have failed with

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

2022-12-19 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/fillproperties.cxx |5 +++--
 oox/source/export/drawingml.cxx |   26 --
 sd/qa/unit/data/pptx/tdf152070.pptx |binary
 sd/qa/unit/import-tests.cxx |   20 
 4 files changed, 39 insertions(+), 12 deletions(-)

New commits:
commit b12e38c1ccb388e62e35d856d4a575e1724a10e9
Author: Tibor Nagy 
AuthorDate: Mon Dec 5 09:21:51 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 19 12:11:48 2022 +

tdf#152070 PPTX import: fix offset of tile background image

by using bitmap image sizes instead of the original ones.

Change-Id: Id6f2777bf6803bca7252878203a12ab796ac33dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143766
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 c68568096fd8..2627a1861850 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -831,10 +831,11 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 sal_Int32 nFillBmpSizeY = getLimitedValue< 
sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapSizeY, nFillBmpSizeY );
 
+awt::Size aBmpSize(nFillBmpSizeX, nFillBmpSizeY);
 // offset of the first bitmap tile (given as 
EMUs), convert to percent
-sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aOriginalSize.Width), 0, 100 );
+sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aBmpSize.Width), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetX, nTileOffsetX );
-sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aOriginalSize.Height), 0, 100 );
+sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aBmpSize.Height), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetY, nTileOffsetY );
 }
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3418a125fac5..86b9b5ac91dc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1887,19 +1887,18 @@ void 
DrawingML::WriteXGraphicTile(uno::Reference const& rXP
 if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
 aOriginalSize = 
Application::GetDefaultDevice()->PixelToLogic(aOriginalSize,
   
MapMode(MapUnit::Map100thMM));
-sal_Int32 nOffsetX = 0;
-if (GetProperty(rXPropSet, "FillBitmapPositionOffsetX"))
-nOffsetX = (*o3tl::doAccess(mAny)) * aOriginalSize.Width() 
* 3.6;
-
-sal_Int32 nOffsetY = 0;
-if (GetProperty(rXPropSet, "FillBitmapPositionOffsetY"))
-nOffsetY = (*o3tl::doAccess(mAny)) * aOriginalSize.Height() 
* 3.6;
-
-// convert the X size of bitmap to a percentage
 sal_Int32 nSizeX = 0;
+sal_Int32 nOffsetX = 0;
 if (GetProperty(rXPropSet, "FillBitmapSizeX"))
 {
 mAny >>= nSizeX;
+if (GetProperty(rXPropSet, "FillBitmapPositionOffsetX"))
+{
+sal_Int32 nX = (nSizeX != 0) ? nSizeX : aOriginalSize.Width();
+nOffsetX = (*o3tl::doAccess(mAny)) * nX * 3.6;
+}
+
+// convert the X size of bitmap to a percentage
 if (nSizeX > 0)
 nSizeX = double(nSizeX) / aOriginalSize.Width() * 10;
 else if (nSizeX < 0)
@@ -1908,11 +1907,18 @@ void 
DrawingML::WriteXGraphicTile(uno::Reference const& rXP
 nSizeX = 10;
 }
 
-// convert the Y size of bitmap to a percentage
 sal_Int32 nSizeY = 0;
+sal_Int32 nOffsetY = 0;
 if (GetProperty(rXPropSet, "FillBitmapSizeY"))
 {
 mAny >>= nSizeY;
+if (GetProperty(rXPropSet, "FillBitmapPositionOffsetY"))
+{
+sal_Int32 nY = (nSizeY != 0) ? nSizeY : aOriginalSize.Height();
+nOffsetY = (*o3tl::doAccess(mAny)) * nY * 3.6;
+}
+
+// convert the Y size of bitmap to a percentage
 if (nSizeY > 0)
 nSizeY = double(nSizeY) / aOriginalSize.Height() * 10;
 else if (nSizeY < 0)
diff --git a/sd/qa/unit/data/pptx/tdf152070.pptx 
b/sd/qa/unit/data/pptx/tdf152070.pptx
new file mode 100644
index ..1fbc8016d149
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152070.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx 

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

2022-12-19 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152335.pptx  |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |   12 
 sd/source/filter/eppt/pptx-epptooxml.cxx |   11 ---
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 40ea23ecdb46dfe4f4677ddbe5cb82d7f71ee592
Author: Tibor Nagy 
AuthorDate: Thu Dec 1 09:33:58 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 19 10:10:11 2022 +

tdf#152335 PPTX export: fix 3D shape properties of the shape in theme

The shapes got extra 3D shape properties by the default template,
which caused visible difference in MSO.

Follow-up to commit I02f1edea84b50dbb9b0e0a59b6062a29894afde4
(tdf#152186 PPTX export: fix shadow of the shape in theme)

Follow-up to commit 25e9766e9b87342b6f1b29dc146d5f33e12157a7
(tdf#9 PPTX export: fix line width of the shape in theme)

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

diff --git a/sd/qa/unit/data/pptx/tdf152335.pptx 
b/sd/qa/unit/data/pptx/tdf152335.pptx
new file mode 100644
index ..03c8612bb54c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152335.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index d61d0c0991d4..2c3c5a0152e3 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -51,6 +51,7 @@ public:
 {
 }
 
+void testTdf152335();
 void testTdf149803();
 void testTdf149311();
 void testTdf149128();
@@ -125,6 +126,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf152335);
 CPPUNIT_TEST(testTdf149803);
 CPPUNIT_TEST(testTdf149311);
 CPPUNIT_TEST(testTdf149128);
@@ -225,6 +227,16 @@ void checkFontAttributes(const SdrTextObj* pObj, ItemValue 
nVal, sal_uInt32 nId)
 }
 }
 
+void SdOOXMLExportTest1::testTdf152335()
+{
+createSdImpressDoc("pptx/tdf152335.pptx");
+save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDocTheme = parseExport("ppt/theme/theme1.xml");
+assertXPathChildren(
+pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:effectStyleLst/a:effectStyle[3]", 1);
+}
+
 void SdOOXMLExportTest1::testTdf149803()
 {
 createSdImpressDoc("pptx/tdf149803.pptx");
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 842c7944d0c3..05ec471f610f 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2048,17 +2048,6 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
 \
   \
-  \
-\
-  \
-\
-\
-  \
-\
-  \
-  \
-\
-  \
 \
   \
   \


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

2022-12-05 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx  |   34 ++
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |4 ++--
 3 files changed, 28 insertions(+), 10 deletions(-)

New commits:
commit df6ff2392701b04bbafddb1119e1ac43cac71fae
Author: Tibor Nagy 
AuthorDate: Tue Nov 29 15:43:58 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 5 21:18:26 2022 +

tdf#152211 PPTX import: fix connector position based on line width

Thick shape line changed the connector, e.g. direction of
its arrow head.

Follow-up to commit d8c89fb920af747ec51ce966b5d7b65e9340afbd
"tdf#151891 PPTX import: fix regression of connector position"

Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors".

Change-Id: I99d22409ec65e10609b1e371cc4d301fd73c7c82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143467
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 400e44cebd993f4b9b3d878fb9264f99e005c9fb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143589
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index d4f56aba5a7e..4536e7c75be1 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -372,10 +372,24 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 SdrObject* pStartObj = xStartSp.is() ? 
SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr;
 SdrObject* pEndObj = xEndSp.is() ? 
SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr;
 
+sal_Int32 nStartSpLineW = 0;
 if (pStartObj)
+{
 aStartRect = pStartObj->GetSnapRect();
+uno::Reference xPropxStartSp(xStartSp, 
uno::UNO_QUERY);
+xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW;
+if (nStartSpLineW)
+nStartSpLineW = nStartSpLineW / 2;
+}
+sal_Int32 nEndSpLineW = 0;
 if (pEndObj)
+{
 aEndRect = pEndObj->GetSnapRect();
+uno::Reference xPropxEndSp(xEndSp, 
uno::UNO_QUERY);
+xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW;
+if (nEndSpLineW)
+nEndSpLineW = nEndSpLineW / 2;
+}
 
 const OUString sConnectorName = rShapePtr->getConnectorName();
 if (sConnectorName == "bentConnector2")
@@ -386,20 +400,24 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 if (aConnSize.Height < aConnSize.Width)
 {
 if (xStartSp.is())
-nEdge -= (aStartPt.Y > aEndPt.Y) ? (aStartRect.Top() - 
aEndPt.Y)
- : (aStartRect.Bottom() - 
aEndPt.Y);
+nEdge = (aStartPt.Y > aEndPt.Y)
+? (nStartSpLineW - (aStartRect.Top() - 
aEndPt.Y))
+: ((aEndPt.Y - aStartRect.Bottom()) - 
nStartSpLineW);
 else
-nEdge -= (aStartPt.Y > aEndPt.Y) ? (aEndRect.Bottom() - 
aStartPt.Y)
- : (aEndRect.Top() - 
aStartPt.Y);
+nEdge = (aStartPt.Y > aEndPt.Y)
+? ((aStartPt.Y - aEndRect.Bottom()) - 
nEndSpLineW)
+: (nEndSpLineW - (aEndRect.Top() - 
aStartPt.Y));
 }
 else
 {
 if (xStartSp.is())
-nEdge -= (aStartPt.X > aEndPt.X) ? (aStartRect.Left() - 
aEndPt.X)
- : (aStartRect.Right() - 
aEndPt.X);
+nEdge = (aStartPt.X > aEndPt.X)
+? (nStartSpLineW - (aStartRect.Left() - 
aEndPt.X))
+: ((aEndPt.X - aStartRect.Right()) - 
nStartSpLineW);
 else
-nEdge -= (aStartPt.X > aEndPt.X) ? (aEndRect.Right() - 
aStartPt.X)
- : (aEndRect.Left() - 
aStartPt.X);
+nEdge = (aStartPt.X > aEndPt.X)
+? ((aStartPt.X - aEndRect.Right()) - 
nEndSpLineW)
+: (nEndSpLineW - (aEndRect.Left() - 
aStartPt.X));
 }
 }
 else
diff --git a/sd/qa/unit/data/pptx/connectors.pptx 
b/sd/qa/unit/data/pptx/connectors.pptx
index ba959068663c..2f65acba13b8 100644
Binary files a/sd/qa/unit/data/pptx/connectors.pptx and 
b/sd/qa/unit/data/pptx/connectors.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 17b0f894c75f..66653f751867 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -311,8 +311,8 @@ void SdImportTest::testConnectors()
 ::sd::DrawDocShellRef xDocShRef
 = 

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

2022-12-05 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152186.pptx  |binary
 sd/qa/unit/import-tests2.cxx |   21 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |   16 ++--
 3 files changed, 23 insertions(+), 14 deletions(-)

New commits:
commit 21044e1469e95d30422c498ad0119d0ce76a6acd
Author: Tibor Nagy 
AuthorDate: Thu Nov 24 14:51:55 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 5 13:24:10 2022 +

tdf#152186 PPTX export: fix shadow of the shape in theme

Placeholder line styles defined extra effectStyle, resulting
bad export with shadows.

Follow-up to commit 25e9766e9b87342b6f1b29dc146d5f33e12157a7
(tdf#9 PPTX export: fix line width of the shape in theme)

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

diff --git a/sd/qa/unit/data/pptx/tdf152186.pptx 
b/sd/qa/unit/data/pptx/tdf152186.pptx
new file mode 100644
index ..c4160f2091a4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152186.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 1f73fc022a41..969eb250fb80 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -66,6 +66,7 @@ class SdImportTest2 : public SdModelTestBase
 public:
 virtual void setUp() override;
 
+void testTdf152186();
 void testTdf93868();
 void testTdf95932();
 void testTdf99030();
@@ -143,6 +144,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
+CPPUNIT_TEST(testTdf152186);
 CPPUNIT_TEST(testTdf93868);
 CPPUNIT_TEST(testTdf95932);
 CPPUNIT_TEST(testTdf99030);
@@ -224,6 +226,25 @@ void SdImportTest2::setUp()
 mxDesktop.set(frame::Desktop::create(getComponentContext()));
 }
 
+void SdImportTest2::testTdf152186()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf152186.pptx"), 
PPTX);
+
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+
+bool bHasShadow;
+const SdrPage* pPage = GetPage(1, xDocShRef);
+for (size_t i = 0; i < pPage->GetObjCount(); ++i)
+{
+uno::Reference xShape(getShapeFromPage(i, 0, 
xDocShRef));
+xShape->getPropertyValue("Shadow") >>= bHasShadow;
+CPPUNIT_ASSERT(!bHasShadow);
+}
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest2::testTdf93868()
 {
 sd::DrawDocShellRef xDocShRef
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 81b00cafea10..6a338a6a6fab 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2016,22 +2016,10 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
   \
 \
-  \
-\
-  \
-\
-  \
-\
-  \
+  \
 \
 \
-  \
-\
-  \
-\
-  \
-\
-  \
+  \
 \
 \
   \


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

2022-12-05 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx  |   34 ++
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |4 ++--
 3 files changed, 28 insertions(+), 10 deletions(-)

New commits:
commit 400e44cebd993f4b9b3d878fb9264f99e005c9fb
Author: Tibor Nagy 
AuthorDate: Tue Nov 29 15:43:58 2022 +0100
Commit: László Németh 
CommitDate: Mon Dec 5 11:20:11 2022 +

tdf#152211 PPTX import: fix connector position based on line width

Thick shape line changed the connector, e.g. direction of
its arrow head.

Follow-up to commit d8c89fb920af747ec51ce966b5d7b65e9340afbd
"tdf#151891 PPTX import: fix regression of connector position"

Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors".

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

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 3b9a93ded03c..9d2ad58b5be2 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -371,10 +371,24 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 SdrObject* pStartObj = xStartSp.is() ? 
SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr;
 SdrObject* pEndObj = xEndSp.is() ? 
SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr;
 
+sal_Int32 nStartSpLineW = 0;
 if (pStartObj)
+{
 aStartRect = pStartObj->GetSnapRect();
+uno::Reference xPropxStartSp(xStartSp, 
uno::UNO_QUERY);
+xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW;
+if (nStartSpLineW)
+nStartSpLineW = nStartSpLineW / 2;
+}
+sal_Int32 nEndSpLineW = 0;
 if (pEndObj)
+{
 aEndRect = pEndObj->GetSnapRect();
+uno::Reference xPropxEndSp(xEndSp, 
uno::UNO_QUERY);
+xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW;
+if (nEndSpLineW)
+nEndSpLineW = nEndSpLineW / 2;
+}
 
 const OUString sConnectorName = rShapePtr->getConnectorName();
 if (sConnectorName == "bentConnector2")
@@ -385,20 +399,24 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 if (aConnSize.Height < aConnSize.Width)
 {
 if (xStartSp.is())
-nEdge -= (aStartPt.Y > aEndPt.Y) ? (aStartRect.Top() - 
aEndPt.Y)
- : (aStartRect.Bottom() - 
aEndPt.Y);
+nEdge = (aStartPt.Y > aEndPt.Y)
+? (nStartSpLineW - (aStartRect.Top() - 
aEndPt.Y))
+: ((aEndPt.Y - aStartRect.Bottom()) - 
nStartSpLineW);
 else
-nEdge -= (aStartPt.Y > aEndPt.Y) ? (aEndRect.Bottom() - 
aStartPt.Y)
- : (aEndRect.Top() - 
aStartPt.Y);
+nEdge = (aStartPt.Y > aEndPt.Y)
+? ((aStartPt.Y - aEndRect.Bottom()) - 
nEndSpLineW)
+: (nEndSpLineW - (aEndRect.Top() - 
aStartPt.Y));
 }
 else
 {
 if (xStartSp.is())
-nEdge -= (aStartPt.X > aEndPt.X) ? (aStartRect.Left() - 
aEndPt.X)
- : (aStartRect.Right() - 
aEndPt.X);
+nEdge = (aStartPt.X > aEndPt.X)
+? (nStartSpLineW - (aStartRect.Left() - 
aEndPt.X))
+: ((aEndPt.X - aStartRect.Right()) - 
nStartSpLineW);
 else
-nEdge -= (aStartPt.X > aEndPt.X) ? (aEndRect.Right() - 
aStartPt.X)
- : (aEndRect.Left() - 
aStartPt.X);
+nEdge = (aStartPt.X > aEndPt.X)
+? ((aStartPt.X - aEndRect.Right()) - 
nEndSpLineW)
+: (nEndSpLineW - (aEndRect.Left() - 
aStartPt.X));
 }
 }
 else
diff --git a/sd/qa/unit/data/pptx/connectors.pptx 
b/sd/qa/unit/data/pptx/connectors.pptx
index ba959068663c..2f65acba13b8 100644
Binary files a/sd/qa/unit/data/pptx/connectors.pptx and 
b/sd/qa/unit/data/pptx/connectors.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3f3aafcbe0e8..eb125a46834f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -342,8 +342,8 @@ void SdImportTest::testConnectors()
 {
 createSdImpressDoc("pptx/connectors.pptx");
 
-sal_Int32 aEdgeValue[] = { -1167, -1167, -1591, 1476,  1356, -1357, 1604,  
-1540,
-   607,   1296,  -1638, -1060, -522, 1578,  -1291, 
333 };
+sal_Int32 aEdgeValue[] = { -1123, -1123, -1547, 1432,  1356, -1357, 

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

2022-11-29 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf152186.pptx  |binary
 sd/qa/unit/import-tests2.cxx |   17 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |   16 ++--
 3 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit bfe33d42a2381bce194cc6fe15b830902f7c8443
Author: Tibor Nagy 
AuthorDate: Thu Nov 24 14:51:55 2022 +0100
Commit: László Németh 
CommitDate: Tue Nov 29 18:15:11 2022 +0100

tdf#152186 PPTX export: fix shadow of the shape in theme

Placeholder line styles defined extra effectStyle, resulting
bad export with shadows.

Follow-up to commit 25e9766e9b87342b6f1b29dc146d5f33e12157a7
(tdf#9 PPTX export: fix line width of the shape in theme)

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

diff --git a/sd/qa/unit/data/pptx/tdf152186.pptx 
b/sd/qa/unit/data/pptx/tdf152186.pptx
new file mode 100644
index ..c4160f2091a4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf152186.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 43ea5583a579..46d1966a2e1a 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -68,6 +68,7 @@ public:
 {
 }
 
+void testTdf152186();
 void testTdf93868();
 void testTdf95932();
 void testTdf99030();
@@ -147,6 +148,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
+CPPUNIT_TEST(testTdf152186);
 CPPUNIT_TEST(testTdf93868);
 CPPUNIT_TEST(testTdf95932);
 CPPUNIT_TEST(testTdf99030);
@@ -225,6 +227,21 @@ public:
 CPPUNIT_TEST_SUITE_END();
 };
 
+void SdImportTest2::testTdf152186()
+{
+loadFromURL(u"pptx/tdf152186.pptx");
+saveAndReload("Impress MS PowerPoint 2007 XML");
+
+bool bHasShadow;
+const SdrPage* pPage = GetPage(1);
+for (size_t i = 0; i < pPage->GetObjCount(); ++i)
+{
+uno::Reference xShape(getShapeFromPage(i, 0));
+xShape->getPropertyValue("Shadow") >>= bHasShadow;
+CPPUNIT_ASSERT(!bHasShadow);
+}
+}
+
 void SdImportTest2::testTdf93868()
 {
 createSdImpressDoc("pptx/tdf93868.pptx");
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index a9edd475aeff..842c7944d0c3 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2035,22 +2035,10 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
   \
 \
-  \
-\
-  \
-\
-  \
-\
-  \
+  \
 \
 \
-  \
-\
-  \
-\
-  \
-\
-  \
+  \
 \
 \
   \


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

2022-11-28 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/groupShape.xlsx   |binary
 sc/qa/unit/subsequent_export_test2.cxx |   13 +
 sc/source/filter/xcl97/xcl97rec.cxx|   30 +++---
 3 files changed, 36 insertions(+), 7 deletions(-)

New commits:
commit 916bf965bf69784da68311040ba5520e58ca8321
Author: Tibor Nagy 
AuthorDate: Wed Nov 23 12:14:31 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Nov 28 18:14:08 2022 +0100

tdf#70293 XLSX export: fix lost grouping of shapes

SaveDrawingMLObjects() needs to skip all
the grouped objects, including subgroups
of a group to avoid of broken export. Fixing
this and reverting the old workaround
commit c323e60157422ae264e798b9a279a532fe9997af
"ignore the (unsupported ) group customshape when exporting xlsx",
Calc keeps the grouped state of the objects now.

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

diff --git a/sc/qa/unit/data/xlsx/groupShape.xlsx 
b/sc/qa/unit/data/xlsx/groupShape.xlsx
new file mode 100644
index ..060b3fd2e377
Binary files /dev/null and b/sc/qa/unit/data/xlsx/groupShape.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index a49cb97f8376..7e9282e6a53c 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -68,6 +68,7 @@ public:
 virtual void setUp() override;
 virtual void tearDown() override;
 
+void testGroupShape();
 void testMatrixMultiplicationXLSX();
 void testTdf121260();
 void testTextDirectionXLSX();
@@ -194,6 +195,7 @@ public:
 
 CPPUNIT_TEST_SUITE(ScExportTest2);
 
+CPPUNIT_TEST(testGroupShape);
 CPPUNIT_TEST(testMatrixMultiplicationXLSX);
 CPPUNIT_TEST(testTdf121260);
 CPPUNIT_TEST(testTextDirectionXLSX);
@@ -349,6 +351,17 @@ void ScExportTest2::registerNamespaces(xmlXPathContextPtr& 
pXmlXPathCtx)
 XmlTestTools::registerODFNamespaces(pXmlXPathCtx);
 }
 
+void ScExportTest2::testGroupShape()
+{
+ScDocShellRef xDocSh = loadDoc(u"groupShape.", FORMAT_XLSX);
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX);
+
+xmlDocUniquePtr pDoc
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/drawing1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:grpSp/xdr:grpSpPr");
+}
+
 void ScExportTest2::testMatrixMultiplicationXLSX()
 {
 ScDocShellRef xShell = loadDoc(u"matrix-multiplication.", FORMAT_XLSX);
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 3cc27e9e0bad..d4524b22e07b 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -223,13 +223,34 @@ bool IsValidObject( const XclObj& rObj )
 void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& rStrm )
 {
 std::vector aList;
-aList.reserve(rList.size());
+// do not add objects to the list that are in the group,
+// because the group already contains them. For this, count
+// the next skipped objects, i.e. objects of a group,
+// including objects of its subgroups
+size_t nSkipObj = 0;
 for (const auto& rxObj : rList)
 {
+// FIXME: Can DrawingML objects be grouped with VML or not valid 
objects?
 if (IsVmlObject(rxObj.get()) || !IsValidObject(*rxObj))
 continue;
 
-aList.push_back(rxObj.get());
+if (nSkipObj == 0)
+aList.push_back(rxObj.get());
+else
+--nSkipObj;
+
+XclObjAny* pObj = nullptr;
+if (rxObj->GetObjType() == 0) // group (it can be a subgroup)
+pObj = dynamic_cast(rxObj.get());
+if (pObj)
+{
+css::uno::Reference 
xShapes(pObj->GetShape(), UNO_QUERY);
+if (xShapes)
+{
+// skip (also) the objects of this group
+nSkipObj += xShapes->getCount();
+}
+}
 }
 
 if (aList.empty())
@@ -1282,11 +1303,6 @@ bool ScURLTransformer::isExternalURL(const OUString& 
rURL) const
 
 void XclObjAny::SaveXml( XclExpXmlStream& rStrm )
 {
-// ignore group shapes at the moment, we don't process them correctly
-// leading to ms2010 rejecting the content
-if( !mxShape.is() || mxShape->getShapeType() == 
"com.sun.star.drawing.GroupShape" )
-return;
-
 // Do not output any of the detective shapes and validation circles.
 SdrObject* pObject = SdrObject::getSdrObjectFromXShape(mxShape);
 if (pObject)


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

2022-11-25 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx |3 
 oox/source/drawingml/fillproperties.cxx  |4 -
 oox/source/export/drawingml.cxx  |  109 ++-
 sd/qa/unit/data/odp/repeatBitmapMode.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   25 +++
 5 files changed, 138 insertions(+), 3 deletions(-)

New commits:
commit 405cd10aab717f31b8dd0210f10f1cb4059230a5
Author: Tibor Nagy 
AuthorDate: Fri Nov 18 12:06:59 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 17:48:59 2022 +0100

tdf#152069 tdf#108356 PPTX export: fix missing tile properties

of background image patterns defined by a:tile.

Note: factor "3.6" comes from EMU.

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

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 9f28a5891306..e4ba170300d6 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -274,6 +274,9 @@ public:
 void WriteXGraphicStretch(css::uno::Reference 
const & rXPropSet,
   css::uno::Reference 
const & rxGraphic);
 
+void WriteXGraphicTile(css::uno::Reference 
const& rXPropSet,
+   css::uno::Reference const& 
rxGraphic);
+
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
 OUString WriteXGraphicBlip(css::uno::Reference 
const & rXPropSet,
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 144c67fa5caf..9ae39b8cfa48 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -832,9 +832,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 rPropMap.setProperty( 
ShapeProperty::FillBitmapSizeY, nFillBmpSizeY );
 
 // offset of the first bitmap tile (given as 
EMUs), convert to percent
-sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >( maBlipProps.moTileOffsetX.get( 0 ) / 3.6 / aOriginalSize.Width, 0, 
100 );
+sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >( std::round( maBlipProps.moTileOffsetX.get( 0 ) / 3.6 / 
aOriginalSize.Width ), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetX, nTileOffsetX );
-sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >( maBlipProps.moTileOffsetY.get( 0 ) / 3.6 / aOriginalSize.Height, 
0, 100 );
+sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >( std::round( maBlipProps.moTileOffsetY.get( 0 ) / 3.6 / 
aOriginalSize.Height ), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetY, nTileOffsetY );
 }
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ea44c4237ff0..53137523999a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -100,6 +100,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1614,7 +1615,7 @@ void 
DrawingML::WriteXGraphicBlipMode(uno::Reference const
 switch (eBitmapMode)
 {
 case BitmapMode_REPEAT:
-mpFS->singleElementNS(XML_a, XML_tile);
+WriteXGraphicTile(rXPropSet, rxGraphic);
 break;
 case BitmapMode_STRETCH:
 WriteXGraphicStretch(rXPropSet, rxGraphic);
@@ -1837,6 +1838,112 @@ void 
DrawingML::WriteXGraphicStretch(uno::Reference const &
 mpFS->endElementNS(XML_a, XML_stretch);
 }
 
+static OUString lclConvertRectanglePointToToken(RectanglePoint eRectanglePoint)
+{
+OUString sAlignment;
+switch (eRectanglePoint)
+{
+case RectanglePoint_LEFT_TOP:
+sAlignment = "tl";
+break;
+case RectanglePoint_MIDDLE_TOP:
+sAlignment = "t";
+break;
+case RectanglePoint_RIGHT_TOP:
+sAlignment = "tr";
+break;
+case RectanglePoint_LEFT_MIDDLE:
+sAlignment = "l";
+break;
+case RectanglePoint_MIDDLE_MIDDLE:
+sAlignment = "ctr";
+break;
+case RectanglePoint_RIGHT_MIDDLE:
+sAlignment = "r";
+break;
+case RectanglePoint_LEFT_BOTTOM:
+sAlignment = "bl";
+break;
+case RectanglePoint_MIDDLE_BOTTOM:
+sAlignment = "b";
+break;
+case RectanglePoint_RIGHT_BOTTOM:
+sAlignment = "br";
+break;
+default:
+break;
+}
+return sAlignment;
+}
+
+void 

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

2022-11-25 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/groupShape.xlsx   |binary
 sc/qa/unit/subsequent_export_test2.cxx |   12 
 sc/source/filter/xcl97/xcl97rec.cxx|   25 ++---
 3 files changed, 30 insertions(+), 7 deletions(-)

New commits:
commit c4d7b9c3ec6e44b96134fdfb036be7f9fcf39f9d
Author: Tibor Nagy 
AuthorDate: Wed Nov 23 12:14:31 2022 +0100
Commit: Nagy Tibor 
CommitDate: Fri Nov 25 14:01:09 2022 +0100

tdf#70293 XLSX export: fix lost grouping of shapes

SaveDrawingMLObjects() needs to skip all
the grouped objects, including subgroups
of a group to avoid of broken export. Fixing
this and reverting the old workaround
commit c323e60157422ae264e798b9a279a532fe9997af
"ignore the (unsupported ) group customshape when exporting xlsx",
Calc keeps the grouped state of the objects now.

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

diff --git a/sc/qa/unit/data/xlsx/groupShape.xlsx 
b/sc/qa/unit/data/xlsx/groupShape.xlsx
new file mode 100644
index ..060b3fd2e377
Binary files /dev/null and b/sc/qa/unit/data/xlsx/groupShape.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 03f747e82b63..55c628f1de6b 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -64,6 +64,7 @@ protected:
 public:
 ScExportTest2();
 
+void testGroupShape();
 void testMatrixMultiplicationXLSX();
 void testTdf121260();
 void testTextDirectionXLSX();
@@ -189,6 +190,7 @@ public:
 
 CPPUNIT_TEST_SUITE(ScExportTest2);
 
+CPPUNIT_TEST(testGroupShape);
 CPPUNIT_TEST(testMatrixMultiplicationXLSX);
 CPPUNIT_TEST(testTdf121260);
 CPPUNIT_TEST(testTextDirectionXLSX);
@@ -324,6 +326,16 @@ void ScExportTest2::registerNamespaces(xmlXPathContextPtr& 
pXmlXPathCtx)
 XmlTestTools::registerODFNamespaces(pXmlXPathCtx);
 }
 
+void ScExportTest2::testGroupShape()
+{
+createScDoc("xlsx/groupShape.xlsx");
+save("Calc Office Open XML");
+
+xmlDocUniquePtr pDoc = parseExport("xl/drawings/drawing1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:grpSp/xdr:grpSpPr");
+}
+
 void ScExportTest2::testMatrixMultiplicationXLSX()
 {
 createScDoc("xlsx/matrix-multiplication.xlsx");
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 55ec685428ae..84718321b126 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -225,13 +225,29 @@ bool IsValidObject( const XclObj& rObj )
 void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& rStrm )
 {
 std::vector aList;
-aList.reserve(rList.size());
+// do not add objects to the list that are in the group,
+// because the group already contains them. For this, count
+// the next skipped objects, i.e. objects of a group,
+// including objects of its subgroups
+size_t nSkipObj = 0;
 for (const auto& rxObj : rList)
 {
+// FIXME: Can DrawingML objects be grouped with VML or not valid 
objects?
 if (IsVmlObject(rxObj.get()) || !IsValidObject(*rxObj))
 continue;
 
-aList.push_back(rxObj.get());
+if (nSkipObj == 0)
+aList.push_back(rxObj.get());
+else
+--nSkipObj;
+
+if (rxObj->GetObjType() == 0) // group (it can be a subgroup)
+{
+XclObjAny* pObj = dynamic_cast(rxObj.get());
+css::uno::Reference 
mXShapes(pObj->GetShape(), UNO_QUERY);
+// skip (also) the objects of this group
+nSkipObj += mXShapes->getCount();
+}
 }
 
 if (aList.empty())
@@ -1284,11 +1300,6 @@ bool ScURLTransformer::isExternalURL(const OUString& 
rURL) const
 
 void XclObjAny::SaveXml( XclExpXmlStream& rStrm )
 {
-// ignore group shapes at the moment, we don't process them correctly
-// leading to ms2010 rejecting the content
-if( !mxShape.is() || mxShape->getShapeType() == 
"com.sun.star.drawing.GroupShape" )
-return;
-
 // Do not output any of the detective shapes and validation circles.
 SdrObject* pObject = SdrObject::getSdrObjectFromXShape(mxShape);
 if (pObject)


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

2022-11-25 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx  |   24 +++-
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |   16 
 3 files changed, 31 insertions(+), 9 deletions(-)

New commits:
commit 8abf381416e4cad90027542c1d230736cc1b4d96
Author: Tibor Nagy 
AuthorDate: Fri Nov 4 20:58:36 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 13:32:11 2022 +0100

tdf#151891 PPTX import: fix regression of connector position

If the connector shape is connected to the glue point which there
is inside the bounding box, then the position of connector appear
incorrectly, for example different direction of the arrow head.

Regression likely from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors", as tdf#148926.

Follow-up to commit eec48130271188cab63665acedbabf1ff5e850a2
"tdf#148926 tdf#151678 PPTX import: position of standard connector
 - part1".

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

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 137a9c437a4b..d4f56aba5a7e 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -356,6 +357,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 {
 sal_Int32 nEdge = 0;
 awt::Point aStartPt, aEndPt;
+tools::Rectangle aStartRect, aEndRect;
 uno::Reference xStartSp, xEndSp;
 uno::Reference xPropSet(rXConnector, uno::UNO_QUERY);
 xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt;
@@ -367,6 +369,14 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 xPropSet->setPropertyValue("EdgeNode2HorzDist", Any(sal_Int32(0)));
 xPropSet->setPropertyValue("EdgeNode2VertDist", Any(sal_Int32(0)));
 
+SdrObject* pStartObj = xStartSp.is() ? 
SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr;
+SdrObject* pEndObj = xEndSp.is() ? 
SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr;
+
+if (pStartObj)
+aStartRect = pStartObj->GetSnapRect();
+if (pEndObj)
+aEndRect = pEndObj->GetSnapRect();
+
 const OUString sConnectorName = rShapePtr->getConnectorName();
 if (sConnectorName == "bentConnector2")
 {
@@ -376,16 +386,20 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 if (aConnSize.Height < aConnSize.Width)
 {
 if (xStartSp.is())
-nEdge = (aStartPt.Y > aEndPt.Y) ? -aConnSize.Height : 
aConnSize.Height;
+nEdge -= (aStartPt.Y > aEndPt.Y) ? (aStartRect.Top() - 
aEndPt.Y)
+ : (aStartRect.Bottom() - 
aEndPt.Y);
 else
-nEdge = (aStartPt.Y > aEndPt.Y) ? aConnSize.Height : 
-aConnSize.Height;
+nEdge -= (aStartPt.Y > aEndPt.Y) ? (aEndRect.Bottom() - 
aStartPt.Y)
+ : (aEndRect.Top() - 
aStartPt.Y);
 }
 else
 {
 if (xStartSp.is())
-nEdge = (aStartPt.X > aEndPt.X) ? -aConnSize.Width : 
aConnSize.Width;
+nEdge -= (aStartPt.X > aEndPt.X) ? (aStartRect.Left() - 
aEndPt.X)
+ : (aStartRect.Right() - 
aEndPt.X);
 else
-nEdge = (aStartPt.X > aEndPt.X) ? aConnSize.Width : 
-aConnSize.Width;
+nEdge -= (aStartPt.X > aEndPt.X) ? (aEndRect.Right() - 
aStartPt.X)
+ : (aEndRect.Left() - 
aStartPt.X);
 }
 }
 else
@@ -396,7 +410,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 if (aConnSize.Height < aConnSize.Width)
 {
 if ((nConnectorAngle == 90 && bFlipH && bFlipV) || 
(nConnectorAngle == 180)
-|| (nConnectorAngle == 180 && bFlipV) || (nConnectorAngle 
== 270 && bFlipH))
+|| (nConnectorAngle == 270 && bFlipH))
 nEdge -= aConnSize.Width;
 else
 nEdge += aConnSize.Width;
diff --git a/sd/qa/unit/data/pptx/connectors.pptx 
b/sd/qa/unit/data/pptx/connectors.pptx
index fa03ef0f6046..ba959068663c 100644
Binary files a/sd/qa/unit/data/pptx/connectors.pptx and 
b/sd/qa/unit/data/pptx/connectors.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 87d282a8a8f9..17b0f894c75f 100644
--- 

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

2022-11-25 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf9.pptx   |binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   19 +++
 sd/source/filter/eppt/pptx-epptooxml.cxx |6 +++---
 3 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 3c58ab7f075a0c8528f00a9f22919e598c18e092
Author: Tibor Nagy 
AuthorDate: Tue Nov 8 11:57:28 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 12:27:24 2022 +0100

tdf#9 PPTX export: fix line width of the shape in theme

Change shape line width values of minimal office theme
to the correct 0.5, 1, 1.5 pt (from  0.7, 2, 3 pt).

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

diff --git a/sd/qa/unit/data/pptx/tdf9.pptx 
b/sd/qa/unit/data/pptx/tdf9.pptx
new file mode 100644
index ..60ec3b886fe9
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf9.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 499491d084f9..b1d66cdbed94 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -35,6 +35,7 @@
 class SdOOXMLExportTest3 : public SdModelTestBaseXML
 {
 public:
+void testTdf9();
 void testTdf129430();
 void testTdf114848();
 void testTdf147586();
@@ -124,6 +125,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
+CPPUNIT_TEST(testTdf9);
 CPPUNIT_TEST(testTdf129430);
 CPPUNIT_TEST(testTdf114848);
 CPPUNIT_TEST(testTdf147586);
@@ -217,6 +219,23 @@ public:
 }
 };
 
+void SdOOXMLExportTest3::testTdf9()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf9.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDocTheme = parseExport(tempFile, 
"ppt/theme/theme1.xml");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[1]", "w",
+"6350");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[2]", "w",
+"12700");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[3]", "w",
+"19050");
+}
+
 void SdOOXMLExportTest3::testTdf129430()
 {
 sd::DrawDocShellRef xDocShRef
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index b3c56b6585e5..00e6de81885a 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1990,7 +1990,7 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
 \
   \
   \
-\
+\
   \
 \
   \
@@ -2000,14 +2000,14 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
   \
 \
-\
+\
   \
 \
   \
   \
   \
 \
-\
+\
   \
 \
   \


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

2022-11-25 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx|   13 +++--
 sd/qa/unit/data/pptx/tdf149803.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx  |   14 ++
 3 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 869e9e0dfe1cf7f263994468d5c3604b9c9c86c6
Author: Tibor Nagy 
AuthorDate: Wed Nov 9 14:08:02 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 10:04:46 2022 +0100

tdf#149803 tdf#128150 PPTX: export UseBgFill of custom shapes

Fixing tdf#128150 the UseBgFill property of shapes can
be saved to PPTX, but not in the case of custom shapes.

Follow-up to commits c4cf2e82e8d0aaef9b1daedc033d6edf647e5284
(tdf#128150 Add OOXML import/export for "use background fill"),
commit 50394abcc36a73c0205e6cb69d925c66c25f81f2,
(tdf#128150 Implement/add SlideBackgroundFill visualization") and
commit  9c2c48f14535e58cad0453fef584400ee703aecc
"tdf#128150 xmloff: ODF import/export of fill-use-slide-background".

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

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index f7b3480fd972..d8717acb9c06 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -809,11 +809,17 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 }
 
 FSHelperPtr pFS = GetFS();
-pFS->startElementNS(mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX || 
mbUserShapes ? XML_sp : XML_wsp));
-
 // non visual shape properties
 if (GetDocumentType() != DOCUMENT_DOCX || mbUserShapes)
 {
+bool bUseBackground = false;
+if (GETA(FillUseSlideBackground))
+mAny >>= bUseBackground;
+if (bUseBackground)
+mpFS->startElementNS(mnXmlNamespace, XML_sp, XML_useBgFill, "1");
+else
+mpFS->startElementNS(mnXmlNamespace, XML_sp);
+
 bool isVisible = true ;
 if( GETA (Visible))
 {
@@ -901,7 +907,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
 }
 else
+{
+pFS->startElementNS(mnXmlNamespace, XML_wsp);
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
+}
 
 // visual shape properties
 pFS->startElementNS(mnXmlNamespace, XML_spPr);
diff --git a/sd/qa/unit/data/pptx/tdf149803.pptx 
b/sd/qa/unit/data/pptx/tdf149803.pptx
new file mode 100644
index ..a3a16cc23fdc
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149803.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index c5a2c2ebc7e8..965ffe7c1387 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -48,6 +48,7 @@ using namespace css;
 class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
+void testTdf149803();
 void testTdf149311();
 void testTdf149128();
 void testTdf66228();
@@ -121,6 +122,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf149803);
 CPPUNIT_TEST(testTdf149311);
 CPPUNIT_TEST(testTdf149128);
 CPPUNIT_TEST(testTdf66228);
@@ -221,6 +223,18 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf149803()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149803.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp", "useBgFill", "1");
+}
+
 void SdOOXMLExportTest1::testTdf149311()
 {
 sd::DrawDocShellRef xDocShRef


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

2022-11-24 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx |3 
 oox/source/drawingml/fillproperties.cxx  |4 -
 oox/source/export/drawingml.cxx  |  109 ++-
 sd/qa/unit/data/odp/repeatBitmapMode.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   23 ++
 5 files changed, 136 insertions(+), 3 deletions(-)

New commits:
commit 3f70375cf160841b6140f5f1b2b79af3652897f8
Author: Tibor Nagy 
AuthorDate: Fri Nov 18 12:06:59 2022 +0100
Commit: László Németh 
CommitDate: Thu Nov 24 16:56:38 2022 +0100

tdf#152069 tdf#108356 PPTX export: fix missing tile properties

of background image patterns defined by a:tile.

Note: factor "3.6" comes from EMU.

Change-Id: I5da532ff9ad63fd6c236a58933a31dcd96cf5156
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142913
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 bf2ed44bca70..543fb072921f 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -275,6 +275,9 @@ public:
 void WriteXGraphicStretch(css::uno::Reference 
const & rXPropSet,
   css::uno::Reference 
const & rxGraphic);
 
+void WriteXGraphicTile(css::uno::Reference 
const& rXPropSet,
+   css::uno::Reference const& 
rxGraphic);
+
 void WriteLinespacing(const css::style::LineSpacing& rLineSpacing, float 
fFirstCharHeight);
 
 OUString WriteXGraphicBlip(css::uno::Reference 
const & rXPropSet,
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 7933a79f5dba..75da3836b6f5 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -832,9 +832,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 rPropMap.setProperty( 
ShapeProperty::FillBitmapSizeY, nFillBmpSizeY );
 
 // offset of the first bitmap tile (given as 
EMUs), convert to percent
-sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >( maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aOriginalSize.Width, 0, 100 );
+sal_Int16 nTileOffsetX = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetX.value_or( 0 ) / 3.6 / 
aOriginalSize.Width), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetX, nTileOffsetX );
-sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >( maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aOriginalSize.Height, 0, 100 );
+sal_Int16 nTileOffsetY = getDoubleIntervalValue< 
sal_Int16 >(std::round(maBlipProps.moTileOffsetY.value_or( 0 ) / 3.6 / 
aOriginalSize.Height), 0, 100 );
 rPropMap.setProperty( 
ShapeProperty::FillBitmapOffsetY, nTileOffsetY );
 }
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 16affd23295b..3dc68b2f3d3b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -100,6 +100,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1615,7 +1616,7 @@ void 
DrawingML::WriteXGraphicBlipMode(uno::Reference const
 switch (eBitmapMode)
 {
 case BitmapMode_REPEAT:
-mpFS->singleElementNS(XML_a, XML_tile);
+WriteXGraphicTile(rXPropSet, rxGraphic);
 break;
 case BitmapMode_STRETCH:
 WriteXGraphicStretch(rXPropSet, rxGraphic);
@@ -1838,6 +1839,112 @@ void 
DrawingML::WriteXGraphicStretch(uno::Reference const &
 mpFS->endElementNS(XML_a, XML_stretch);
 }
 
+static OUString lclConvertRectanglePointToToken(RectanglePoint eRectanglePoint)
+{
+OUString sAlignment;
+switch (eRectanglePoint)
+{
+case RectanglePoint_LEFT_TOP:
+sAlignment = "tl";
+break;
+case RectanglePoint_MIDDLE_TOP:
+sAlignment = "t";
+break;
+case RectanglePoint_RIGHT_TOP:
+sAlignment = "tr";
+break;
+case RectanglePoint_LEFT_MIDDLE:
+sAlignment = "l";
+break;
+case RectanglePoint_MIDDLE_MIDDLE:
+sAlignment = "ctr";
+break;
+case RectanglePoint_RIGHT_MIDDLE:
+sAlignment = "r";
+break;
+case RectanglePoint_LEFT_BOTTOM:
+sAlignment = "bl";
+break;
+case RectanglePoint_MIDDLE_BOTTOM:
+sAlignment = "b";
+break;
+case RectanglePoint_RIGHT_BOTTOM:
+sAlignment = "br";
+break;
+default:
+break;
+}
+return sAlignment;
+}
+
+void DrawingML::WriteXGraphicTile(uno::Reference const& 
rXPropSet,
+  

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

2022-11-23 Thread Tibor Nagy (via logerrit)
 sd/qa/unit/data/pptx/tdf9.pptx   |binary
 sd/qa/unit/export-tests-ooxml3.cxx   |   17 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |6 +++---
 3 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 25e9766e9b87342b6f1b29dc146d5f33e12157a7
Author: Tibor Nagy 
AuthorDate: Tue Nov 8 11:57:28 2022 +0100
Commit: László Németh 
CommitDate: Wed Nov 23 10:50:59 2022 +0100

tdf#9 PPTX export: fix line width of the shape in theme

Change shape line width values of minimal office theme
to the correct 0.5, 1, 1.5 pt (from  0.7, 2, 3 pt).

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

diff --git a/sd/qa/unit/data/pptx/tdf9.pptx 
b/sd/qa/unit/data/pptx/tdf9.pptx
new file mode 100644
index ..60ec3b886fe9
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf9.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 90cf168be5a3..bc47f1936316 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -41,6 +41,7 @@ public:
 {
 }
 
+void testTdf9();
 void testTdf129430();
 void testTdf114848();
 void testTdf147586();
@@ -133,6 +134,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
+CPPUNIT_TEST(testTdf9);
 CPPUNIT_TEST(testTdf129430);
 CPPUNIT_TEST(testTdf114848);
 CPPUNIT_TEST(testTdf147586);
@@ -229,6 +231,20 @@ public:
 }
 };
 
+void SdOOXMLExportTest3::testTdf9()
+{
+loadFromURL(u"pptx/tdf9.pptx");
+save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDocTheme = parseExport("ppt/theme/theme1.xml");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[1]", "w",
+"6350");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[2]", "w",
+"12700");
+assertXPath(pXmlDocTheme, 
"/a:theme/a:themeElements/a:fmtScheme/a:lnStyleLst/a:ln[3]", "w",
+"19050");
+}
+
 void SdOOXMLExportTest3::testTdf129430()
 {
 loadFromURL(u"odp/tdf129430.odp");
@@ -248,6 +264,7 @@ void SdOOXMLExportTest3::testTdf114848()
 assertXPath(pXmlDocTheme1, 
"/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
 "1f497d");
 xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
+
 assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
 "1f497d");
 }
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index d08b399309d7..b31ea7de9824 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2009,7 +2009,7 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
 \
   \
   \
-\
+\
   \
 \
   \
@@ -2019,14 +2019,14 @@ ShapeExport& 
PowerPointShapeExport::WritePlaceholderReferenceTextBody(
   \
   \
 \
-\
+\
   \
 \
   \
   \
   \
 \
-\
+\
   \
 \
   \


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

2022-11-21 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx|   13 +++--
 sd/qa/unit/data/pptx/tdf149803.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx  |   11 +++
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit ab10008ecaa33228838115a0b714e4f118c07ac1
Author: Tibor Nagy 
AuthorDate: Wed Nov 9 14:08:02 2022 +0100
Commit: László Németh 
CommitDate: Mon Nov 21 10:04:36 2022 +0100

tdf#149803 tdf#128150 PPTX: export UseBgFill of custom shapes

Fixing tdf#128150 the UseBgFill property of shapes can
be saved to PPTX, but not in the case of custom shapes.

Follow-up to commits c4cf2e82e8d0aaef9b1daedc033d6edf647e5284
(tdf#128150 Add OOXML import/export for "use background fill"),
commit 50394abcc36a73c0205e6cb69d925c66c25f81f2,
(tdf#128150 Implement/add SlideBackgroundFill visualization") and
commit  9c2c48f14535e58cad0453fef584400ee703aecc
"tdf#128150 xmloff: ODF import/export of fill-use-slide-background".

Change-Id: Ib88f236d2533ef71ea66718d380e83d9a0685c3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142489
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 9d00dff8348c..70466d17fdb1 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -812,11 +812,17 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 }
 
 FSHelperPtr pFS = GetFS();
-pFS->startElementNS(mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX || 
mbUserShapes ? XML_sp : XML_wsp));
-
 // non visual shape properties
 if (GetDocumentType() != DOCUMENT_DOCX || mbUserShapes)
 {
+bool bUseBackground = false;
+if (GETA(FillUseSlideBackground))
+mAny >>= bUseBackground;
+if (bUseBackground)
+mpFS->startElementNS(mnXmlNamespace, XML_sp, XML_useBgFill, "1");
+else
+mpFS->startElementNS(mnXmlNamespace, XML_sp);
+
 bool isVisible = true ;
 if( GETA (Visible))
 {
@@ -904,7 +910,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 pFS->endElementNS( mnXmlNamespace, XML_nvSpPr );
 }
 else
+{
+pFS->startElementNS(mnXmlNamespace, XML_wsp);
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
+}
 
 // visual shape properties
 pFS->startElementNS(mnXmlNamespace, XML_spPr);
diff --git a/sd/qa/unit/data/pptx/tdf149803.pptx 
b/sd/qa/unit/data/pptx/tdf149803.pptx
new file mode 100644
index ..a3a16cc23fdc
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149803.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 97d2b80902c8..866cd331dc68 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -53,6 +53,7 @@ public:
 {
 }
 
+void testTdf149803();
 void testTdf149311();
 void testTdf149128();
 void testTdf66228();
@@ -126,6 +127,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf149803);
 CPPUNIT_TEST(testTdf149311);
 CPPUNIT_TEST(testTdf149128);
 CPPUNIT_TEST(testTdf66228);
@@ -225,6 +227,15 @@ void checkFontAttributes(const SdrTextObj* pObj, ItemValue 
nVal, sal_uInt32 nId)
 }
 }
 
+void SdOOXMLExportTest1::testTdf149803()
+{
+loadFromURL(u"pptx/tdf149803.pptx");
+save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp", "useBgFill", "1");
+}
+
 void SdOOXMLExportTest1::testTdf149311()
 {
 loadFromURL(u"odp/tdf149311.odp");


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

2022-11-14 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx  |   24 +++-
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |   16 
 3 files changed, 31 insertions(+), 9 deletions(-)

New commits:
commit d8c89fb920af747ec51ce966b5d7b65e9340afbd
Author: Tibor Nagy 
AuthorDate: Fri Nov 4 20:58:36 2022 +0100
Commit: László Németh 
CommitDate: Mon Nov 14 13:31:36 2022 +0100

tdf#151891 PPTX import: fix regression of connector position

If the connector shape is connected to the glue point which there
is inside the bounding box, then the position of connector appear
incorrectly, for example different direction of the arrow head.

Regression likely from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
"tdf#89449 PPTX import: fix line connectors", as tdf#148926.

Follow-up to commit eec48130271188cab63665acedbabf1ff5e850a2
"tdf#148926 tdf#151678 PPTX import: position of standard connector
 - part1".

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

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 126fc664bd3a..3b9a93ded03c 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -355,6 +356,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 {
 sal_Int32 nEdge = 0;
 awt::Point aStartPt, aEndPt;
+tools::Rectangle aStartRect, aEndRect;
 uno::Reference xStartSp, xEndSp;
 uno::Reference xPropSet(rXConnector, uno::UNO_QUERY);
 xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt;
@@ -366,6 +368,14 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 xPropSet->setPropertyValue("EdgeNode2HorzDist", Any(sal_Int32(0)));
 xPropSet->setPropertyValue("EdgeNode2VertDist", Any(sal_Int32(0)));
 
+SdrObject* pStartObj = xStartSp.is() ? 
SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr;
+SdrObject* pEndObj = xEndSp.is() ? 
SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr;
+
+if (pStartObj)
+aStartRect = pStartObj->GetSnapRect();
+if (pEndObj)
+aEndRect = pEndObj->GetSnapRect();
+
 const OUString sConnectorName = rShapePtr->getConnectorName();
 if (sConnectorName == "bentConnector2")
 {
@@ -375,16 +385,20 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 if (aConnSize.Height < aConnSize.Width)
 {
 if (xStartSp.is())
-nEdge = (aStartPt.Y > aEndPt.Y) ? -aConnSize.Height : 
aConnSize.Height;
+nEdge -= (aStartPt.Y > aEndPt.Y) ? (aStartRect.Top() - 
aEndPt.Y)
+ : (aStartRect.Bottom() - 
aEndPt.Y);
 else
-nEdge = (aStartPt.Y > aEndPt.Y) ? aConnSize.Height : 
-aConnSize.Height;
+nEdge -= (aStartPt.Y > aEndPt.Y) ? (aEndRect.Bottom() - 
aStartPt.Y)
+ : (aEndRect.Top() - 
aStartPt.Y);
 }
 else
 {
 if (xStartSp.is())
-nEdge = (aStartPt.X > aEndPt.X) ? -aConnSize.Width : 
aConnSize.Width;
+nEdge -= (aStartPt.X > aEndPt.X) ? (aStartRect.Left() - 
aEndPt.X)
+ : (aStartRect.Right() - 
aEndPt.X);
 else
-nEdge = (aStartPt.X > aEndPt.X) ? aConnSize.Width : 
-aConnSize.Width;
+nEdge -= (aStartPt.X > aEndPt.X) ? (aEndRect.Right() - 
aStartPt.X)
+ : (aEndRect.Left() - 
aStartPt.X);
 }
 }
 else
@@ -395,7 +409,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 if (aConnSize.Height < aConnSize.Width)
 {
 if ((nConnectorAngle == 90 && bFlipH && bFlipV) || 
(nConnectorAngle == 180)
-|| (nConnectorAngle == 180 && bFlipV) || (nConnectorAngle 
== 270 && bFlipH))
+|| (nConnectorAngle == 270 && bFlipH))
 nEdge -= aConnSize.Width;
 else
 nEdge += aConnSize.Width;
diff --git a/sd/qa/unit/data/pptx/connectors.pptx 
b/sd/qa/unit/data/pptx/connectors.pptx
index fa03ef0f6046..ba959068663c 100644
Binary files a/sd/qa/unit/data/pptx/connectors.pptx and 
b/sd/qa/unit/data/pptx/connectors.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6e10700d5671..34523fa136cd 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -344,12 +344,20 @@ void SdImportTest::testConnectors()
 {
 

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

2022-11-14 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx|   27 ++-
 sd/qa/unit/data/pptx/tdt142291.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   30 ++
 3 files changed, 56 insertions(+), 1 deletion(-)

New commits:
commit 1b167f3e0b1afec7c257f458db7505d8d8f177b3
Author: Tibor Nagy 
AuthorDate: Thu Nov 3 16:10:11 2022 +0100
Commit: László Németh 
CommitDate: Mon Nov 14 12:15:01 2022 +0100

tdf#142291 PPTX export: fix table border styles

Export border style subset used by the PPTX
import, ::table::BorderLineStyle::SOLID, DOTTED,
DASHED, DASH_DOT and DASH_DOT_DOT.

See also tablecell.cxx:applyLineAttributes().

Change-Id: I5e4d631f7ca410beb76155579ea5b21a6eb66350
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142240
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 d102880af7bd..88be4362b228 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -65,6 +66,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2290,7 +2292,30 @@ void ShapeExport::WriteBorderLine(const sal_Int32 
XML_line, const BorderLine2& r
 mpFS->singleElementNS(XML_a, XML_noFill);
 else
 DrawingML::WriteSolidFill( ::Color(ColorTransparency, 
rBorderLine.Color) );
-mpFS->endElementNS( XML_a, XML_line );
+
+OUString sBorderStyle;
+sal_Int16 nStyle = rBorderLine.LineStyle;
+mAny.setValue(, cppu::UnoType::get());
+switch (*o3tl::doAccess(mAny))
+{
+case ::table::BorderLineStyle::SOLID:
+sBorderStyle = "solid";
+break;
+case ::table::BorderLineStyle::DOTTED:
+sBorderStyle = "dot";
+break;
+case ::table::BorderLineStyle::DASHED:
+sBorderStyle = "dash";
+break;
+case ::table::BorderLineStyle::DASH_DOT:
+sBorderStyle = "dashDot";
+break;
+case ::table::BorderLineStyle::DASH_DOT_DOT:
+sBorderStyle = "sysDashDotDot";
+break;
+}
+mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, sBorderStyle);
+mpFS->endElementNS(XML_a, XML_line);
 }
 else if( nBorderWidth == 0)
 {
diff --git a/sd/qa/unit/data/pptx/tdt142291.pptx 
b/sd/qa/unit/data/pptx/tdt142291.pptx
new file mode 100644
index ..eb5a17eebe88
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdt142291.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index f7866c70a154..69f50c016315 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -76,6 +76,7 @@ public:
 {
 }
 
+void testTdf142291();
 void testTdf151492();
 void testTdf149697();
 void testTdf149126();
@@ -146,6 +147,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+CPPUNIT_TEST(testTdf142291);
 CPPUNIT_TEST(testTdf151492);
 CPPUNIT_TEST(testTdf149697);
 CPPUNIT_TEST(testTdf149126);
@@ -222,6 +224,34 @@ public:
 }
 };
 
+void SdOOXMLExportTest2::testTdf142291()
+{
+loadFromURL(u"pptx/tdt142291.pptx");
+utl::TempFileNamed tempFile = save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), 
"ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent,
+
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+"a:tcPr/a:lnL/a:prstDash",
+"val", "sysDashDotDot");
+assertXPath(pXmlDocContent,
+
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+"a:tcPr/a:lnR/a:prstDash",
+"val", "dot");
+assertXPath(pXmlDocContent,
+
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+"a:tcPr/a:lnT/a:prstDash",
+"val", "solid");
+assertXPath(pXmlDocContent,
+
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+"a:tcPr/a:lnB/a:prstDash",
+"val", "dash");
+assertXPath(pXmlDocContent,
+
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[2]/"
+"a:tcPr/a:lnR/a:prstDash",
+"val", "dashDot");
+}
+
 void SdOOXMLExportTest2::testTdf151492()
 {
 loadFromURL(u"odp/tdf151492.odp");


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

2022-11-02 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/shape.hxx  |4 ++
 oox/source/drawingml/shape.cxx   |7 +++
 oox/source/ppt/slidepersist.cxx  |   69 +++
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |   18 +
 5 files changed, 98 insertions(+)

New commits:
commit 66806942e246b5aa72677807e1a290e4bbf6bcea
Author: Tibor Nagy 
AuthorDate: Mon Oct 24 09:36:54 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Nov 2 11:14:00 2022 +0100

tdf#148926 tdf#151678 PPTX import: position of standard connector - part1

Connectors are typically connected to connection dots,
which exist on shapes. If both or one of the two shapes
are missing, it will be drawn the default type of a
standard connector in LO. In this case, there is an
adjustment point which is used to modify positions and
shapes of the connectors. This patch fixes the position of
the connector by calculating and setting the adjustment
value.

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

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 5f4173c9de87..5c4f788cde2e 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -136,6 +136,7 @@ public:
 
 CustomShapePropertiesPtr&   getCustomShapeProperties(){ return 
mpCustomShapePropertiesPtr; }
 
+OUString&   getConnectorName() { return 
msConnectorName; }
 ConnectorShapePropertiesList&   getConnectorShapeProperties() { return 
maConnectorShapePropertiesList; }
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
@@ -163,6 +164,8 @@ public:
 sal_Int32   getRotation() const { return mnRotation; }
 voidsetDiagramRotation( sal_Int32 nRotation ) 
{ mnDiagramRotation = nRotation; }
 voidsetFlip( bool bFlipH, bool bFlipV ) { 
mbFlipH = bFlipH; mbFlipV = bFlipV; }
+boolgetFlipH() const { return mbFlipH; }
+boolgetFlipV() const { return mbFlipV; }
 voidaddChild( const ShapePtr& rChildPtr ) { 
maChildren.push_back( rChildPtr ); }
 std::vector< ShapePtr >&getChildren() { return maChildren; }
 
@@ -347,6 +350,7 @@ protected:
 css::uno::Reference< css::drawing::XShape > mxShape;
 ConnectorShapePropertiesList maConnectorShapePropertiesList;
 
+OUStringmsConnectorName;
 OUStringmsServiceName;
 OUStringmsName;
 OUStringmsInternalName; // used by diagram; not 
displayed in UI
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 12b3303054e4..1dd4eb319c26 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1678,6 +1678,13 @@ Reference< XShape > const & Shape::createAndInsert(
 
 if (bIsConnectorShape)
 {
+OUString sConnectorShapePresetTypeName(
+reinterpret_cast(
+
mpCustomShapePropertiesPtr->getShapePresetTypeName().getConstArray()),
+
mpCustomShapePropertiesPtr->getShapePresetTypeName().getLength(),
+RTL_TEXTENCODING_UTF8);
+msConnectorName = sConnectorShapePresetTypeName;
+
 sal_Int32 nType = mpCustomShapePropertiesPtr->getShapePresetType();
 switch (nType)
 {
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 8d45bcdb7947..137a9c437a4b 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -350,6 +351,70 @@ Reference 
SlidePersist::getAnimationNode(const OUString& sId) co
 return aResult;
 }
 
+static void lcl_SetEdgeLineValue(uno::Reference& rXConnector,
+ oox::drawingml::ShapePtr& rShapePtr)
+{
+sal_Int32 nEdge = 0;
+awt::Point aStartPt, aEndPt;
+uno::Reference xStartSp, xEndSp;
+uno::Reference xPropSet(rXConnector, uno::UNO_QUERY);
+xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt;
+xPropSet->getPropertyValue("EdgeEndPoint") >>= aEndPt;
+xPropSet->getPropertyValue("StartShape") >>= xStartSp;
+xPropSet->getPropertyValue("EndShape") >>= xEndSp;
+xPropSet->setPropertyValue("EdgeNode1HorzDist", Any(sal_Int32(0)));
+

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

2022-11-01 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |3 +--
 sd/qa/unit/data/odp/tdf151492.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   16 
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 9131a0367b1bcf9c876f1289fdf144fbc1f569b0
Author: Tibor Nagy 
AuthorDate: Sun Oct 16 09:32:33 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Nov 1 21:53:40 2022 +0100

tdf#151492 PPTX export: fix connection points regression

caused by commit 4d153517183193f468dee9148c94fe9d874bacb3
(tdf#149697 PPTX export: fix changing place of connection points).

Change-Id: I6134f18f3c32182a2f5d7295e2511da192dd20c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141427
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 097a2de6428f834d28fa78af203d3c0b6577656e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142135
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 4bb6520ec951..f7b3480fd972 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1643,8 +1643,7 @@ static sal_Int32 lcl_GetGluePointId(const 
Reference& xShape, sal_Int32&
 uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
 uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
  uno::UNO_QUERY);
-sal_uInt32 nCount = xGluePoints->getIdentifiers().size();
-if (nCount > 4)
+if (nGluePointId > 3)
 nGluePointId -= 4;
 else
 {
diff --git a/sd/qa/unit/data/odp/tdf151492.odp 
b/sd/qa/unit/data/odp/tdf151492.odp
new file mode 100644
index ..6928dac5982d
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf151492.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index fb57a721149e..b11e38011e74 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -70,6 +70,7 @@ static void assertMotionPath(std::u16string_view rStr1, 
std::u16string_view rStr
 class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
+void testTdf151492();
 void testTdf149697();
 void testTdf149126();
 void testTdf131905();
@@ -139,6 +140,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+CPPUNIT_TEST(testTdf151492);
 CPPUNIT_TEST(testTdf149697);
 CPPUNIT_TEST(testTdf149126);
 CPPUNIT_TEST(testTdf131905);
@@ -214,6 +216,20 @@ public:
 }
 };
 
+void SdOOXMLExportTest2::testTdf151492()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf151492.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+
+xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, 
"ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn",
+"idx", "0");
+
+xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf149697()
 {
 ::sd::DrawDocShellRef xDocShRef


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

2022-10-27 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |2 
 oox/source/drawingml/table/tablecell.cxx   |   59 ++---
 sd/qa/unit/data/pptx/tdf151767.pptx|binary
 sd/qa/unit/export-tests-ooxml3.cxx |   28 
 sd/qa/unit/import-tests.cxx|   30 
 5 files changed, 83 insertions(+), 36 deletions(-)

New commits:
commit d83a016823dceaeb48f34d4e94f9a230bebd9169
Author: Tibor Nagy 
AuthorDate: Wed Oct 26 16:44:01 2022 +0200
Commit: László Németh 
CommitDate: Thu Oct 27 20:35:01 2022 +0200

tdf#151767 PPTX import: fix table border width

There is a "Clear Table" function in PP. In this case,
the table uses the default border value of MSO, which
was imported as missing table border.

(Note: commit ff0387e726b59e374029d2f635ce00308d99eff6
"tdf#135843: sd_export_tests-ooxml3: Add unittest for the
export part" If attachment from tdf#106011 is opened in
PowerPoint, the table is visible it, but was not in LO.
This patch fixed that. Therefore the borders of table are
not missing after export.)

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

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 7d420038856a..531e20b14512 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -884,6 +884,8 @@ std::unique_ptr CreateTableStyle(const 
OUString& styleId)
 // End to handle all style groups.
 
 // Create a TableStyle from handled properties.
+pTableStyle->getStyleId() = styleId;
+pTableStyle->getStyleName() = style_name;
 
 pTableStyle->getWholeTbl().getTextColor() = wholeTblTextColor;
 pTableStyle->getFirstRow().getTextColor() = firstRowTextColor;
diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 77b69b8e4e3e..17b13526084d 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -61,26 +61,41 @@ TableCell::TableCell()
 {
 }
 
-static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
-Reference< XPropertySet > const & rxPropSet, 
oox::drawingml::LineProperties const & rLineProperties,
-sal_Int32 nPropId )
+static void applyLineAttributes(const ::oox::core::XmlFilterBase& rFilterBase,
+Reference const& rxPropSet,
+oox::drawingml::table::TableStyle const& 
rTableStyle,
+oox::drawingml::LineProperties const& 
rLineProperties,
+sal_Int32 nPropId)
 {
 BorderLine2 aBorderLine;
-if ( rLineProperties.maLineFill.moFillType.has_value() && 
rLineProperties.maLineFill.moFillType.value() != XML_noFill )
+TableStyle& rTable(const_cast(rTableStyle));
+if (!rTable.getStyleId().isEmpty())
 {
 Color aColor = rLineProperties.maLineFill.getBestSolidColor();
-aBorderLine.Color = sal_Int32(aColor.getColor( 
rFilterBase.getGraphicHelper() ));
-aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( 
rLineProperties.moLineWidth.value_or( 0 ) ) / 4 );
-aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( 
rLineProperties.moLineWidth.value_or( 0 ) ) / 4 );
-aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( 
rLineProperties.moLineWidth.value_or( 0 ) ) / 2 );
+aBorderLine.Color = 
sal_Int32(aColor.getColor(rFilterBase.getGraphicHelper()));
+aBorderLine.OuterLineWidth = 
static_cast(GetCoordinate(rLineProperties.moLineWidth.value_or(0)) / 
4);
+aBorderLine.InnerLineWidth = 
static_cast(GetCoordinate(rLineProperties.moLineWidth.value_or(0)) / 
4);
+aBorderLine.LineWidth = 
static_cast(GetCoordinate(rLineProperties.moLineWidth.value_or(0)) / 
2);
 aBorderLine.LineDistance = 0;
 }
 else
 {
-aBorderLine.Color = sal_Int32( COL_AUTO );
-aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( 
rLineProperties.moLineWidth.value_or( 0 ) ) / 4 );
-aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( 
rLineProperties.moLineWidth.value_or( 0 ) ) / 4 );
-aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( 
rLineProperties.moLineWidth.value_or( 0 ) ) / 2 );
+if (rLineProperties.maLineFill.moFillType.has_value())
+{
+if (rLineProperties.maLineFill.moFillType.value() != XML_noFill)
+{
+Color aColor = rLineProperties.maLineFill.getBestSolidColor();
+aBorderLine.Color = 
sal_Int32(aColor.getColor(rFilterBase.getGraphicHelper()));
+ 

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

2022-10-27 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/shape.hxx  |4 ++
 oox/source/drawingml/shape.cxx   |7 +++
 oox/source/ppt/slidepersist.cxx  |   69 +++
 sd/qa/unit/data/pptx/connectors.pptx |binary
 sd/qa/unit/import-tests.cxx  |   18 +
 5 files changed, 98 insertions(+)

New commits:
commit eec48130271188cab63665acedbabf1ff5e850a2
Author: Tibor Nagy 
AuthorDate: Mon Oct 24 09:36:54 2022 +0200
Commit: László Németh 
CommitDate: Thu Oct 27 20:23:18 2022 +0200

tdf#148926 tdf#151678 PPTX import: position of standard connector - part1

Connectors are typically connected to connection dots,
which exist on shapes. If both or one of the two shapes
are missing, it will be drawn the default type of a
standard connector in LO. In this case, there is an
adjustment point which is used to modify positions and
shapes of the connectors. This patch fixes the position of
the connector by calculating and setting the adjustment
value.

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

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index e481b98c3f6e..36017132e83d 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -136,6 +136,7 @@ public:
 
 CustomShapePropertiesPtr&   getCustomShapeProperties(){ return 
mpCustomShapePropertiesPtr; }
 
+OUString&   getConnectorName() { return 
msConnectorName; }
 ConnectorShapePropertiesList&   getConnectorShapeProperties() { return 
maConnectorShapePropertiesList; }
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
@@ -160,6 +161,8 @@ public:
 sal_Int32   getRotation() const { return mnRotation; }
 voidsetDiagramRotation( sal_Int32 nRotation ) 
{ mnDiagramRotation = nRotation; }
 voidsetFlip( bool bFlipH, bool bFlipV ) { 
mbFlipH = bFlipH; mbFlipV = bFlipV; }
+boolgetFlipH() const { return mbFlipH; }
+boolgetFlipV() const { return mbFlipV; }
 voidaddChild( const ShapePtr& rChildPtr ) { 
maChildren.push_back( rChildPtr ); }
 std::vector< ShapePtr >&getChildren() { return maChildren; }
 
@@ -344,6 +347,7 @@ protected:
 css::uno::Reference< css::drawing::XShape > mxShape;
 ConnectorShapePropertiesList maConnectorShapePropertiesList;
 
+OUStringmsConnectorName;
 OUStringmsServiceName;
 OUStringmsName;
 OUStringmsInternalName; // used by diagram; not 
displayed in UI
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 7357e36f0481..99c1c5a979a5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1682,6 +1682,13 @@ Reference< XShape > const & Shape::createAndInsert(
 
 if (bIsConnectorShape)
 {
+OUString sConnectorShapePresetTypeName(
+reinterpret_cast(
+
mpCustomShapePropertiesPtr->getShapePresetTypeName().getConstArray()),
+
mpCustomShapePropertiesPtr->getShapePresetTypeName().getLength(),
+RTL_TEXTENCODING_UTF8);
+msConnectorName = sConnectorShapePresetTypeName;
+
 sal_Int32 nType = mpCustomShapePropertiesPtr->getShapePresetType();
 switch (nType)
 {
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 1e7461fa5f49..126fc664bd3a 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -349,6 +350,70 @@ Reference 
SlidePersist::getAnimationNode(const OUString& sId) co
 return aResult;
 }
 
+static void lcl_SetEdgeLineValue(uno::Reference& rXConnector,
+ oox::drawingml::ShapePtr& rShapePtr)
+{
+sal_Int32 nEdge = 0;
+awt::Point aStartPt, aEndPt;
+uno::Reference xStartSp, xEndSp;
+uno::Reference xPropSet(rXConnector, uno::UNO_QUERY);
+xPropSet->getPropertyValue("EdgeStartPoint") >>= aStartPt;
+xPropSet->getPropertyValue("EdgeEndPoint") >>= aEndPt;
+xPropSet->getPropertyValue("StartShape") >>= xStartSp;
+xPropSet->getPropertyValue("EndShape") >>= xEndSp;
+xPropSet->setPropertyValue("EdgeNode1HorzDist", Any(sal_Int32(0)));
+xPropSet->setPropertyValue("EdgeNode1VertDist", Any(sal_Int32(0)));
+xPropSet->setPropertyValue("EdgeNode2HorzDist", Any(sal_Int32(0)));
+

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

2022-10-27 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |3 +--
 sd/qa/unit/data/odp/tdf151492.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   16 
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 097a2de6428f834d28fa78af203d3c0b6577656e
Author: Tibor Nagy 
AuthorDate: Sun Oct 16 09:32:33 2022 +0200
Commit: László Németh 
CommitDate: Thu Oct 27 18:17:26 2022 +0200

tdf#151492 PPTX export: fix connection points regression

caused by commit 4d153517183193f468dee9148c94fe9d874bacb3
(tdf#149697 PPTX export: fix changing place of connection points).

Change-Id: I6134f18f3c32182a2f5d7295e2511da192dd20c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141427
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 c7b563f4..d102880af7bd 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1643,8 +1643,7 @@ static sal_Int32 lcl_GetGluePointId(const 
Reference& xShape, sal_Int32&
 uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
 uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
  uno::UNO_QUERY);
-sal_uInt32 nCount = xGluePoints->getIdentifiers().size();
-if (nCount > 4)
+if (nGluePointId > 3)
 nGluePointId -= 4;
 else
 {
diff --git a/sd/qa/unit/data/odp/tdf151492.odp 
b/sd/qa/unit/data/odp/tdf151492.odp
new file mode 100644
index ..6928dac5982d
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf151492.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 928ecab95997..6b7e934a176f 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -70,6 +70,7 @@ static void assertMotionPath(std::u16string_view rStr1, 
std::u16string_view rStr
 class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
+void testTdf151492();
 void testTdf149697();
 void testTdf149126();
 void testTdf131905();
@@ -139,6 +140,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+CPPUNIT_TEST(testTdf151492);
 CPPUNIT_TEST(testTdf149697);
 CPPUNIT_TEST(testTdf149126);
 CPPUNIT_TEST(testTdf131905);
@@ -214,6 +216,20 @@ public:
 }
 };
 
+void SdOOXMLExportTest2::testTdf151492()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf151492.odp"), 
ODP);
+utl::TempFileNamed tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+
+xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, 
"ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn",
+"idx", "0");
+
+xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf149697()
 {
 ::sd::DrawDocShellRef xDocShRef


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

2022-09-09 Thread Tibor Nagy (via logerrit)
 include/oox/core/xmlfilterbase.hxx  |   10 -
 include/oox/drawingml/shape.hxx |6 -
 include/oox/ppt/presentationfragmenthandler.hxx |1 
 include/oox/ppt/slidepersist.hxx|4 
 oox/source/core/xmlfilterbase.cxx   |6 -
 oox/source/drawingml/hyperlinkcontext.cxx   |4 
 oox/source/drawingml/textrun.cxx|6 -
 oox/source/ppt/pptshape.cxx |   49 
 oox/source/ppt/presentationfragmenthandler.cxx  |  138 ++--
 oox/source/ppt/slidepersist.cxx |2 
 sd/qa/unit/data/pptx/tdf150719.pptx |binary
 sd/qa/unit/import-tests.cxx |   18 +++
 12 files changed, 63 insertions(+), 181 deletions(-)

New commits:
commit fabfa4bd23e89a2d5b6e232cd2eab61996534659
Author: Tibor Nagy 
AuthorDate: Mon Aug 22 10:54:53 2022 +0200
Commit: Nagy Tibor 
CommitDate: Fri Sep 9 14:05:26 2022 +0200

tdf#150719 PPTX import: fix hyperlink format (lost underline)

Hypertext lost its formatting partially: e.g. underline
character setting lost, except on the last word.

Follow-up to commit commit a761a51d9db3a2771ca9fd6ab233c513aa5d8ecf
"tdf#149311 PPTX export: fix internal hyperlink on texts".

Clean-up of commit 855a56fea4561135a63cb729d7a625a950b210e7
"tdf#148965 PPTX import: fix internal hyperlinks on shapes" and
commit cec1f712c87e557e1b7313e0dbef4a635f69d953
"tdf#144918 PPTX import: fix internal hyperlink on shapes" and
commit 7eb0e52527e729a21973e70d5be8e0a6779ec748
"tdf#142648 PPTX: import long slide names to avoid broken link export".

Change-Id: I1de8b06361c7b9529a70a039e194db88460cc27b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138669
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 35312fda53ab..89a7994a904b 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -75,13 +75,6 @@ namespace oox::core {
 class FragmentHandler;
 class FastParser;
 
-struct TextField {
-css::uno::Reference< css::text::XText >   xText;
-css::uno::Reference< css::text::XTextCursor > xTextCursor;
-css::uno::Reference< css::text::XTextField >  xTextField;
-};
-typedef std::vector< TextField > TextFieldStack;
-
 struct XmlFilterBaseImpl;
 
 using ShapePairs
@@ -183,9 +176,6 @@ public:
  */
 OUString addRelation( const css::uno::Reference< 
css::io::XOutputStream >& rOutputStream, const OUString& rType, 
std::u16string_view rTarget, bool bExternal = false );
 
-/** Returns a stack of used textfields, used by the pptx importer to 
replace links to slidepages with the real page name */
-TextFieldStack& getTextFieldStack() const;
-
 /** Opens and returns the specified output stream from the base storage 
with specified media type.
 
 @param rStreamName
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 246a964fc2a6..e481b98c3f6e 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -140,9 +140,6 @@ public:
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
 
-voidsetBookmark(bool bBookmark) { 
mbHasBookmark = bBookmark; }
-boolhasBookmark() const { return 
mbHasBookmark; }
-
 Shape3DProperties&  get3DProperties() { return 
*mp3DPropertiesPtr; }
 const Shape3DProperties&get3DProperties() const { return 
*mp3DPropertiesPtr; }
 
@@ -408,9 +405,6 @@ private:
 // Is this a connector shape?
 bool mbConnector = false;
 
-// Is shape has bookmark?
-bool mbHasBookmark = false;
-
 // temporary space for DiagramHelper in preparation for collecting data
 // Note: I tried to use a unique_ptr here, but existing constructor func 
does not allow that
 svx::diagram::IDiagramHelper* mpDiagramHelper;
diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index a9bb5bb67a77..7ac929ec555b 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -52,6 +52,7 @@ private:
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
 void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, 
sal_Int32 nThemeIdx);
 void importCustomSlideShow(std::vector& rCustomShowList);
+static void importSlideNames(::oox::core::XmlFilterBase& rFilter, const 
std::vector& rSlidePersist);
 
 std::vector< OUString > maSlideMasterVector;
 std::vector< OUString > maSlidesVector;
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index 

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

2022-07-26 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx|2 +-
 oox/source/export/drawingml.cxx |6 +++---
 oox/source/export/shapes.cxx|   33 -
 sd/qa/unit/data/pptx/tdf149697.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   25 +
 5 files changed, 61 insertions(+), 5 deletions(-)

New commits:
commit 6b39dbd3e60a61c893640a6b7f0c80b9432580fb
Author: Tibor Nagy 
AuthorDate: Mon Jun 27 09:45:04 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 26 16:34:23 2022 +0200

tdf#149697 PPTX export: fix changing place of connection points

Place of the connection point of a polygon changed during
a PPTX round-trip, connecting other vertices of e.g. a square
or a hexagon, as before.

See also commit c3f73f75772d076dfb2ed0538e7d515503edc038
"tdf#149128 PPTX export: fix  and  connector properties".

Change-Id: I64fc6377417a99d32e84ea71fbed13cf36760118
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136474
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 4d153517183193f468dee9148c94fe9d874bacb3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137422
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 455676e9c262..c80024ea1fdd 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -231,7 +231,7 @@ public:
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
-void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, 
sal_Int32 nStartID, sal_Int32 nEndID );
+void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
 bool WriteCharColor(const css::uno::Reference& 
xPropertySet);
 bool WriteFillColor(const css::uno::Reference& 
xPropertySet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index fe6635dc23f2..1b1696f0de60 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4699,19 +4699,19 @@ void DrawingML::WritePolyPolygon(const 
css::uno::Reference
 mpFS->endElementNS(XML_a, XML_custGeom);
 }
 
-void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& 
rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID )
+void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID )
 {
 if( nStartID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_stCxn,
XML_id, OString::number(nStartID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(true)) );
+   XML_idx, OString::number(nStartGlueId) );
 }
 if( nEndID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_endCxn,
XML_id, OString::number(nEndID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(false)) );
+   XML_idx, OString::number(nEndGlueId) );
 }
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 79691c338985..6a389c83c432 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -63,6 +63,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1636,11 +1638,33 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
+static sal_Int32 lcl_GetGluePointId(const Reference& xShape, 
sal_Int32& nGluePointId)
+{
+uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
+uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
+ uno::UNO_QUERY);
+sal_uInt32 nCount = xGluePoints->getIdentifiers().size();
+if (nCount > 4)
+nGluePointId -= 4;
+else
+{
+// change id of the bounding box (1 <-> 3)
+if (nGluePointId == 1)
+nGluePointId = 3; // Right
+else if (nGluePointId == 3)
+nGluePointId = 1; // Left
+}
+
+return nGluePointId;
+}
+
 ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& 
xShape )
 {
 bool bFlipH = false;
 bool bFlipV = false;
 sal_Int32 nAngle = 0;
+sal_Int32 nStartGlueId = 0;
+sal_Int32 nEndGlueId = 0;
 
 SAL_INFO("oox.shape", "write connector shape");
 
@@ -1680,6 +1704,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 GET( rXShapeA, EdgeStartConnection );
 GET( 

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

2022-07-22 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx|2 +-
 oox/source/export/drawingml.cxx |6 +++---
 oox/source/export/shapes.cxx|   33 -
 sd/qa/unit/data/pptx/tdf149697.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   25 +
 5 files changed, 61 insertions(+), 5 deletions(-)

New commits:
commit 4d153517183193f468dee9148c94fe9d874bacb3
Author: Tibor Nagy 
AuthorDate: Mon Jun 27 09:45:04 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 22 13:40:25 2022 +0200

tdf#149697 PPTX export: fix changing place of connection points

Place of the connection point of a polygon changed during
a PPTX round-trip, connecting other vertices of e.g. a square
or a hexagon, as before.

See also commit c3f73f75772d076dfb2ed0538e7d515503edc038
"tdf#149128 PPTX export: fix  and  connector properties".

Change-Id: I64fc6377417a99d32e84ea71fbed13cf36760118
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136474
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 455676e9c262..c80024ea1fdd 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -231,7 +231,7 @@ public:
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
-void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, 
sal_Int32 nStartID, sal_Int32 nEndID );
+void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
 bool WriteCharColor(const css::uno::Reference& 
xPropertySet);
 bool WriteFillColor(const css::uno::Reference& 
xPropertySet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d889f475c556..392ce6f4d6aa 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4747,19 +4747,19 @@ void DrawingML::WritePolyPolygon(const 
css::uno::Reference
 mpFS->endElementNS(XML_a, XML_custGeom);
 }
 
-void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& 
rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID )
+void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID )
 {
 if( nStartID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_stCxn,
XML_id, OString::number(nStartID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(true)) );
+   XML_idx, OString::number(nStartGlueId) );
 }
 if( nEndID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_endCxn,
XML_id, OString::number(nEndID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(false)) );
+   XML_idx, OString::number(nEndGlueId) );
 }
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index f0b446a7eb33..19ef8156f3e3 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -63,6 +63,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1636,11 +1638,33 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
+static sal_Int32 lcl_GetGluePointId(const Reference& xShape, 
sal_Int32& nGluePointId)
+{
+uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
+uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
+ uno::UNO_QUERY);
+sal_uInt32 nCount = xGluePoints->getIdentifiers().size();
+if (nCount > 4)
+nGluePointId -= 4;
+else
+{
+// change id of the bounding box (1 <-> 3)
+if (nGluePointId == 1)
+nGluePointId = 3; // Right
+else if (nGluePointId == 3)
+nGluePointId = 1; // Left
+}
+
+return nGluePointId;
+}
+
 ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& 
xShape )
 {
 bool bFlipH = false;
 bool bFlipV = false;
 sal_Int32 nAngle = 0;
+sal_Int32 nStartGlueId = 0;
+sal_Int32 nEndGlueId = 0;
 
 SAL_INFO("oox.shape", "write connector shape");
 
@@ -1680,6 +1704,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 GET( rXShapeA, EdgeStartConnection );
 GET( rXShapeB, EdgeEndConnection );
 
+GET(nStartGlueId, StartGluePointIndex);
+if (nStartGlueId != -1)
+lcl_GetGluePointId(rXShapeA, nStartGlueId);
+GET(nEndGlueId, 

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

2022-06-27 Thread Tibor Nagy (via logerrit)
 oox/source/export/drawingml.cxx|8 +++-
 sd/qa/unit/data/odp/tdf149311.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   16 
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit c49d427170752b6e5a559000c5a0766f0e3da81b
Author: Tibor Nagy 
AuthorDate: Wed Jun 1 18:05:03 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 27 09:46:19 2022 +0200

tdf#149311 PPTX export: fix internal hyperlink on texts

by converting "Slide [digits]" URLs to slide[digits].xml

See also commit 4142d728f003166ebe520bfdaf672505e585b807
"tdf#149314 PPTX import: fix internal hyperlink on texts".

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index dad1ce7a5c44..77363ab4b201 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1984,7 +1984,7 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation + 
nCameraRotation), IsGroupShape( rXShape ));
 }
 
-static OUString lcl_GetTarget(const css::uno::Reference& 
xModel, std::u16string_view rURL)
+static OUString lcl_GetTarget(const css::uno::Reference& 
xModel, OUString& rURL)
 {
 Reference xDPS(xModel, uno::UNO_QUERY_THROW);
 Reference xDrawPages(xDPS->getDrawPages(), 
uno::UNO_SET_THROW);
@@ -2005,6 +2005,12 @@ static OUString lcl_GetTarget(const 
css::uno::Reference& xMo
 break;
 }
 }
+if (sTarget.isEmpty())
+{
+sal_Int32 nSplit = rURL.lastIndexOf(' ');
+if (nSplit > -1)
+sTarget = OUString::Concat("slide") + rURL.subView(nSplit + 1) + 
".xml";
+}
 
 return sTarget;
 }
diff --git a/sd/qa/unit/data/odp/tdf149311.odp 
b/sd/qa/unit/data/odp/tdf149311.odp
new file mode 100644
index ..2500ed5e7a51
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149311.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 01d0e9b3336f..c5a2c2ebc7e8 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -48,6 +48,7 @@ using namespace css;
 class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
+void testTdf149311();
 void testTdf149128();
 void testTdf66228();
 void testTdf147919();
@@ -120,6 +121,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf149311);
 CPPUNIT_TEST(testTdf149128);
 CPPUNIT_TEST(testTdf66228);
 CPPUNIT_TEST(testTdf147919);
@@ -219,6 +221,20 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf149311()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149311.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pRelsDoc = parseExport(tempFile, 
"ppt/slides/_rels/slide1.xml.rels");
+
+assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", 
"Target",
+"slide2.xml");
+}
+
 void SdOOXMLExportTest1::testTdf149128()
 {
 sd::DrawDocShellRef xDocShRef


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

2022-06-24 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |3 -
 sd/qa/unit/data/odp/tdf149126.odp  |binary
 sd/qa/unit/data/xml/tdf92001_0.xml |   32 +++-
 sd/qa/unit/export-tests-ooxml2.cxx |   59 -
 4 files changed, 51 insertions(+), 43 deletions(-)

New commits:
commit a6d87845afc4080bb976f8e248d6c6cfc9a045b1
Author: Tibor Nagy 
AuthorDate: Fri Jun 3 15:32:50 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 24 16:18:41 2022 +0200

tdf#149126 fix export of PPTX preset shapes

Follow-up to commit 63cd67e5e18f01aca303131e148c80398a181a41
"tdf#92525 tdf#142398: fix export of simple custom shapes" and
commit 744e6c0b758fefe6011f09860b44f03ab70fbcfe
"tdf#147459 PPTX: add "glue points" to some basic shapes".

Thanks to Regina Henschel for the code pointer.

Change-Id: I378c2ba09fcffcaa4e5dcf74bfd19e9f704d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135361
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 3c80d00689dd52c11ebc8de1c90142148e58b2ce)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136324
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 305bc2e78f53..79691c338985 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -926,8 +926,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 bool bPresetWriteSuccessful = false;
 // Let the custom shapes what has name and preset information in OOXML, to 
be written
 // as preset ones with parameters. Try that with this converter class.
-if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive"
-&& GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes
+if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive" && 
!mbUserShapes
 && xShape->getShapeType() == "com.sun.star.drawing.CustomShape"
 && !lcl_IsOnAllowlist(sShapeType))
 {
diff --git a/sd/qa/unit/data/odp/tdf149126.odp 
b/sd/qa/unit/data/odp/tdf149126.odp
new file mode 100644
index ..1d9c3c8c2318
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149126.odp differ
diff --git a/sd/qa/unit/data/xml/tdf92001_0.xml 
b/sd/qa/unit/data/xml/tdf92001_0.xml
index 1bacf2f2559c..08d9622583d3 100644
--- a/sd/qa/unit/data/xml/tdf92001_0.xml
+++ b/sd/qa/unit/data/xml/tdf92001_0.xml
@@ -15,7 +15,10 @@
   
   

-
+
+ 
+ 
+



@@ -27,31 +30,31 @@
   

 
-
+


-
-
+
+


-
+
 


-
-
+
+


-
-
+
+


-
-
+
+


 
-
+

   
  
@@ -63,11 +66,12 @@

   
  
- 
  
 

-   
+   
+   
+   

 

diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index b9c1f437c64c..0029f882463b 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -70,6 +70,7 @@ static void assertMotionPath(std::u16string_view rStr1, 
std::u16string_view rStr
 class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
+void testTdf149126();
 void testTdf131905();
 void testTdf93883();
 void testTdf91378();
@@ -137,6 +138,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+CPPUNIT_TEST(testTdf149126);
 CPPUNIT_TEST(testTdf131905);
 CPPUNIT_TEST(testTdf93883);
 CPPUNIT_TEST(testTdf91378);
@@ -210,6 +212,20 @@ public:
 }
 };
 
+void SdOOXMLExportTest2::testTdf149126()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149126.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+
+xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, 
"ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst",
+"triangle");
+
+xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf131905()
 {
 ::sd::DrawDocShellRef xDocShRef
@@ -661,7 +677,7 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 "donut",
 "adj","val 9601",
 "bevel",
-"adj","val 42587",
+"adj","val 42592",
 "foldedCorner",
 "adj","val 10750",
 "verticalScroll",
@@ -692,9 +708,9 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 "adj5","val -22375",
 "adj6","val -134550",
 "blockArc",
-"adj1","val 1302",
-"adj2","val 1938",
-"adj3","val 3773",
+"adj1","val 12975429",
+"adj2","val 19424571",
+

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

2022-06-24 Thread Tibor Nagy (via logerrit)
 oox/inc/ooxresid.hxx   |1 
 oox/inc/strings.hrc|1 
 oox/source/helper/ooxresid.cxx |1 
 oox/source/ppt/presentationfragmenthandler.cxx |7 -
 sd/qa/unit/data/pptx/tdf149314.pptx|binary
 sd/qa/unit/import-tests.cxx|   31 +
 6 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 325edd3846c968cdcbd218305195ea96c7787e18
Author: Tibor Nagy 
AuthorDate: Wed Jun 1 16:10:42 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 24 16:18:10 2022 +0200

tdf#149314 PPTX import: fix internal hyperlink in editor

Hyperlinks on text weren't imported correctly if the linked
slides have default slide name, resulting broken links
in the editor (hyperlinks work well in slide shows without
this fix, too).

Change-Id: I797fa94134c1346bc83729c713e65b2a268a14c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135245
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 00b920af618d549fbd8180ad98bfaeca75830ed0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136326
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/inc/ooxresid.hxx b/oox/inc/ooxresid.hxx
index 473e13407ac3..c374b664525c 100644
--- a/oox/inc/ooxresid.hxx
+++ b/oox/inc/ooxresid.hxx
@@ -14,6 +14,7 @@
 #include 
 
 OUString OoxResId(TranslateId aId);
+OUString URLResId(TranslateId aId);
 
 #endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/inc/strings.hrc b/oox/inc/strings.hrc
index c9b4f3cf7230..cd107aa36a02 100644
--- a/oox/inc/strings.hrc
+++ b/oox/inc/strings.hrc
@@ -14,5 +14,6 @@
 
 #define STR_DIAGRAM_TITLENC_("STR_DIAGRAM_TITLE", 
"Chart Title")
 #define STR_DIAGRAM_AXISTITLENC_("STR_DIAGRAM_AXISTITLE", 
"Axis Title")
+#define STR_SLIDE_NAME   NC_("STR_SLIDE_NAME", "Slide" 
)
 #endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/helper/ooxresid.cxx b/oox/source/helper/ooxresid.cxx
index 58e0e8cb33e0..6ad02a70b056 100644
--- a/oox/source/helper/ooxresid.cxx
+++ b/oox/source/helper/ooxresid.cxx
@@ -12,5 +12,6 @@
 #include 
 
 OUString OoxResId(TranslateId aId) { return Translate::get(aId, 
Translate::Create("oox")); }
+OUString URLResId(TranslateId aId) { return Translate::get(aId, 
Translate::Create("sd")); }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index c9deec076edc..b0a7b7ec0fd3 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -60,6 +60,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -195,7 +197,10 @@ static void ResolveTextFields( XmlFilterBase const & 
rFilter )
 xDrawPage = xPresentationPage->getNotesPage();
 }
 Reference< container::XNamed > xNamed( xDrawPage, 
UNO_QUERY_THROW );
-aURL = "#" + xNamed->getName();
+if (!xNamed->getName().startsWith("page"))
+aURL = "#" + xNamed->getName();
+else
+aURL = "#" + URLResId(STR_SLIDE_NAME) + " " + 
OUString::number(nPageNumber);
 xPropSet->setPropertyValue( sURL, Any( aURL ) );
 Reference< text::XTextContent > xContent( 
rTextField.xTextField);
 Reference< text::XTextRange > xTextRange = 
rTextField.xTextCursor;
diff --git a/sd/qa/unit/data/pptx/tdf149314.pptx 
b/sd/qa/unit/data/pptx/tdf149314.pptx
new file mode 100644
index ..3138c1ddaf78
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149314.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index aa329dfddec6..68161536da93 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -83,6 +83,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf149314();
 void testTdf149124();
 void testTdf148965();
 void testTdf89449();
@@ -153,6 +154,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf149314);
 CPPUNIT_TEST(testTdf149124);
 CPPUNIT_TEST(testTdf148965);
 CPPUNIT_TEST(testTdf89449);
@@ -301,6 +303,35 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf149314()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf149314.pptx"), 
PPTX);
+

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

2022-06-24 Thread Tibor Nagy (via logerrit)
 oox/source/export/drawingml.cxx|8 +++-
 sd/qa/unit/data/odp/tdf149311.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   16 
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit a761a51d9db3a2771ca9fd6ab233c513aa5d8ecf
Author: Tibor Nagy 
AuthorDate: Wed Jun 1 18:05:03 2022 +0200
Commit: László Németh 
CommitDate: Fri Jun 24 11:18:24 2022 +0200

tdf#149311 PPTX export: fix internal hyperlink on texts

by converting "Slide [digits]" URLs to slide[digits].xml

See also commit 4142d728f003166ebe520bfdaf672505e585b807
"tdf#149314 PPTX import: fix internal hyperlink on texts".

Change-Id: I39e095c960b04e728b3e28fa0a657d37d9c71ba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135250
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 8d16911311ec..fe6635dc23f2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1984,7 +1984,7 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation + 
nCameraRotation), IsGroupShape( rXShape ));
 }
 
-static OUString lcl_GetTarget(const css::uno::Reference& 
xModel, std::u16string_view rURL)
+static OUString lcl_GetTarget(const css::uno::Reference& 
xModel, OUString& rURL)
 {
 Reference xDPS(xModel, uno::UNO_QUERY_THROW);
 Reference xDrawPages(xDPS->getDrawPages(), 
uno::UNO_SET_THROW);
@@ -2005,6 +2005,12 @@ static OUString lcl_GetTarget(const 
css::uno::Reference& xMo
 break;
 }
 }
+if (sTarget.isEmpty())
+{
+sal_Int32 nSplit = rURL.lastIndexOf(' ');
+if (nSplit > -1)
+sTarget = OUString::Concat("slide") + rURL.subView(nSplit + 1) + 
".xml";
+}
 
 return sTarget;
 }
diff --git a/sd/qa/unit/data/odp/tdf149311.odp 
b/sd/qa/unit/data/odp/tdf149311.odp
new file mode 100644
index ..2500ed5e7a51
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149311.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 01d0e9b3336f..c5a2c2ebc7e8 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -48,6 +48,7 @@ using namespace css;
 class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
+void testTdf149311();
 void testTdf149128();
 void testTdf66228();
 void testTdf147919();
@@ -120,6 +121,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf149311);
 CPPUNIT_TEST(testTdf149128);
 CPPUNIT_TEST(testTdf66228);
 CPPUNIT_TEST(testTdf147919);
@@ -219,6 +221,20 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf149311()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149311.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pRelsDoc = parseExport(tempFile, 
"ppt/slides/_rels/slide1.xml.rels");
+
+assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", 
"Target",
+"slide2.xml");
+}
+
 void SdOOXMLExportTest1::testTdf149128()
 {
 sd::DrawDocShellRef xDocShRef


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

2022-06-23 Thread Tibor Nagy (via logerrit)
 oox/inc/ooxresid.hxx   |1 
 oox/inc/strings.hrc|1 
 oox/source/helper/ooxresid.cxx |1 
 oox/source/ppt/presentationfragmenthandler.cxx |7 -
 sd/qa/unit/data/pptx/tdf149314.pptx|binary
 sd/qa/unit/import-tests.cxx|   31 +
 6 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 4142d728f003166ebe520bfdaf672505e585b807
Author: Tibor Nagy 
AuthorDate: Wed Jun 1 16:10:42 2022 +0200
Commit: László Németh 
CommitDate: Thu Jun 23 16:20:43 2022 +0200

tdf#149314 PPTX import: fix internal hyperlink in editor

Hyperlinks on text weren't imported correctly if the linked
slides have default slide name, resulting broken links
in the editor (hyperlinks work well in slide shows without
this fix, too).

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

diff --git a/oox/inc/ooxresid.hxx b/oox/inc/ooxresid.hxx
index 473e13407ac3..c374b664525c 100644
--- a/oox/inc/ooxresid.hxx
+++ b/oox/inc/ooxresid.hxx
@@ -14,6 +14,7 @@
 #include 
 
 OUString OoxResId(TranslateId aId);
+OUString URLResId(TranslateId aId);
 
 #endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/inc/strings.hrc b/oox/inc/strings.hrc
index c9b4f3cf7230..cd107aa36a02 100644
--- a/oox/inc/strings.hrc
+++ b/oox/inc/strings.hrc
@@ -14,5 +14,6 @@
 
 #define STR_DIAGRAM_TITLENC_("STR_DIAGRAM_TITLE", 
"Chart Title")
 #define STR_DIAGRAM_AXISTITLENC_("STR_DIAGRAM_AXISTITLE", 
"Axis Title")
+#define STR_SLIDE_NAME   NC_("STR_SLIDE_NAME", "Slide" 
)
 #endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/helper/ooxresid.cxx b/oox/source/helper/ooxresid.cxx
index 58e0e8cb33e0..6ad02a70b056 100644
--- a/oox/source/helper/ooxresid.cxx
+++ b/oox/source/helper/ooxresid.cxx
@@ -12,5 +12,6 @@
 #include 
 
 OUString OoxResId(TranslateId aId) { return Translate::get(aId, 
Translate::Create("oox")); }
+OUString URLResId(TranslateId aId) { return Translate::get(aId, 
Translate::Create("sd")); }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 43b7f105a1c4..ac1e32e533ec 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -60,6 +60,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::oox::core;
@@ -197,7 +199,10 @@ static void ResolveTextFields( XmlFilterBase const & 
rFilter )
 xDrawPage = xPresentationPage->getNotesPage();
 }
 Reference< container::XNamed > xNamed( xDrawPage, 
UNO_QUERY_THROW );
-aURL = "#" + xNamed->getName();
+if (!xNamed->getName().startsWith("page"))
+aURL = "#" + xNamed->getName();
+else
+aURL = "#" + URLResId(STR_SLIDE_NAME) + " " + 
OUString::number(nPageNumber);
 xPropSet->setPropertyValue( sURL, Any( aURL ) );
 Reference< text::XTextContent > xContent( 
rTextField.xTextField);
 Reference< text::XTextRange > xTextRange = 
rTextField.xTextCursor;
diff --git a/sd/qa/unit/data/pptx/tdf149314.pptx 
b/sd/qa/unit/data/pptx/tdf149314.pptx
new file mode 100644
index ..3138c1ddaf78
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149314.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index aa329dfddec6..68161536da93 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -83,6 +83,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf149314();
 void testTdf149124();
 void testTdf148965();
 void testTdf89449();
@@ -153,6 +154,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf149314);
 CPPUNIT_TEST(testTdf149124);
 CPPUNIT_TEST(testTdf148965);
 CPPUNIT_TEST(testTdf89449);
@@ -301,6 +303,35 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf149314()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf149314.pptx"), 
PPTX);
+
+OUString aURL;
+uno::Reference xShape(getShapeFromPage(0, 1, 
xDocShRef));
+
+uno::Reference const 
xParagraph1(getParagraphFromShape(0, xShape));
+uno::Reference 

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

2022-06-23 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |3 -
 sd/qa/unit/data/odp/tdf149126.odp  |binary
 sd/qa/unit/data/xml/tdf92001_0.xml |   32 +++-
 sd/qa/unit/export-tests-ooxml2.cxx |   59 -
 4 files changed, 51 insertions(+), 43 deletions(-)

New commits:
commit db39e5359d7f9b4e42c6101dd75bc5e8d809ad41
Author: Tibor Nagy 
AuthorDate: Fri Jun 3 15:32:50 2022 +0200
Commit: László Németh 
CommitDate: Thu Jun 23 16:02:58 2022 +0200

tdf#149126 fix export of PPTX preset shapes

Follow-up to commit 63cd67e5e18f01aca303131e148c80398a181a41
"tdf#92525 tdf#142398: fix export of simple custom shapes" and
commit 744e6c0b758fefe6011f09860b44f03ab70fbcfe
"tdf#147459 PPTX: add "glue points" to some basic shapes".

Thanks to Regina Henschel for the code pointer.

Change-Id: I378c2ba09fcffcaa4e5dcf74bfd19e9f704d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135361
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 305bc2e78f53..79691c338985 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -926,8 +926,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 bool bPresetWriteSuccessful = false;
 // Let the custom shapes what has name and preset information in OOXML, to 
be written
 // as preset ones with parameters. Try that with this converter class.
-if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive"
-&& GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes
+if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive" && 
!mbUserShapes
 && xShape->getShapeType() == "com.sun.star.drawing.CustomShape"
 && !lcl_IsOnAllowlist(sShapeType))
 {
diff --git a/sd/qa/unit/data/odp/tdf149126.odp 
b/sd/qa/unit/data/odp/tdf149126.odp
new file mode 100644
index ..1d9c3c8c2318
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149126.odp differ
diff --git a/sd/qa/unit/data/xml/tdf92001_0.xml 
b/sd/qa/unit/data/xml/tdf92001_0.xml
index 1bacf2f2559c..08d9622583d3 100644
--- a/sd/qa/unit/data/xml/tdf92001_0.xml
+++ b/sd/qa/unit/data/xml/tdf92001_0.xml
@@ -15,7 +15,10 @@
   
   

-
+
+ 
+ 
+



@@ -27,31 +30,31 @@
   

 
-
+


-
-
+
+


-
+
 


-
-
+
+


-
-
+
+


-
-
+
+


 
-
+

   
  
@@ -63,11 +66,12 @@

   
  
- 
  
 

-   
+   
+   
+   

 

diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index b9c1f437c64c..0029f882463b 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -70,6 +70,7 @@ static void assertMotionPath(std::u16string_view rStr1, 
std::u16string_view rStr
 class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
+void testTdf149126();
 void testTdf131905();
 void testTdf93883();
 void testTdf91378();
@@ -137,6 +138,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+CPPUNIT_TEST(testTdf149126);
 CPPUNIT_TEST(testTdf131905);
 CPPUNIT_TEST(testTdf93883);
 CPPUNIT_TEST(testTdf91378);
@@ -210,6 +212,20 @@ public:
 }
 };
 
+void SdOOXMLExportTest2::testTdf149126()
+{
+::sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149126.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+
+xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, 
"ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst",
+"triangle");
+
+xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf131905()
 {
 ::sd::DrawDocShellRef xDocShRef
@@ -661,7 +677,7 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 "donut",
 "adj","val 9601",
 "bevel",
-"adj","val 42587",
+"adj","val 42592",
 "foldedCorner",
 "adj","val 10750",
 "verticalScroll",
@@ -692,9 +708,9 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 "adj5","val -22375",
 "adj6","val -134550",
 "blockArc",
-"adj1","val 1302",
-"adj2","val 1938",
-"adj3","val 3773",
+"adj1","val 12975429",
+"adj2","val 19424571",
+"adj3","val 3770",
 };
 
 utl::TempFile tempFile;
@@ -720,9 +736,8 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 
 void SdOOXMLExportTest2::testTdf92527()
 {
-// We draw a 

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

2022-05-30 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |   13 +
 sd/qa/unit/data/odp/tdf149128.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   17 +
 3 files changed, 26 insertions(+), 4 deletions(-)

New commits:
commit c3f73f75772d076dfb2ed0538e7d515503edc038
Author: Tibor Nagy 
AuthorDate: Wed May 25 12:29:10 2022 +0200
Commit: László Németh 
CommitDate: Mon May 30 12:48:03 2022 +0200

tdf#149128 PPTX export: fix  and  connector properties

to avoid of detaching connections between shapes,
when these connections were created in Impress.

Change-Id: I1bc90bb8a408546b303b70bcfb27d3549d5e72d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134940
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 284daea2db21..9854c98a584e 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -818,10 +818,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 mAny >>= isVisible;
 }
 pFS->startElementNS( mnXmlNamespace, XML_nvSpPr );
-pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
-XML_id, OString::number(GetNewShapeID(xShape)),
-XML_name, GetShapeName(xShape),
-XML_hidden, sax_fastparser::UseIf("1", !isVisible));
+pFS->startElementNS(
+mnXmlNamespace, XML_cNvPr, XML_id,
+OString::number(GetShapeID(xShape) == -1 ? GetNewShapeID(xShape) : 
GetShapeID(xShape)),
+XML_name, GetShapeName(xShape), XML_hidden, 
sax_fastparser::UseIf("1", !isVisible));
 
 if( GETA( URL ) )
 {
@@ -1745,6 +1745,11 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 XML_name, GetShapeName(xShape));
 // non visual connector shape drawing properties
 pFS->startElementNS(mnXmlNamespace, XML_cNvCxnSpPr);
+
+if (GetShapeID(rXShapeA) == -1)
+GetNewShapeID(rXShapeA);
+if (GetShapeID(rXShapeB) == -1)
+GetNewShapeID(rXShapeB);
 WriteConnectorConnections(aConnectorEntry, GetShapeID(rXShapeA), 
GetShapeID(rXShapeB));
 pFS->endElementNS(mnXmlNamespace, XML_cNvCxnSpPr);
 if (GetDocumentType() == DOCUMENT_PPTX)
diff --git a/sd/qa/unit/data/odp/tdf149128.odp 
b/sd/qa/unit/data/odp/tdf149128.odp
new file mode 100644
index ..0c26fdd6b3a7
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149128.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 70c64d793084..01d0e9b3336f 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -48,6 +48,7 @@ using namespace css;
 class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
+void testTdf149128();
 void testTdf66228();
 void testTdf147919();
 void testTdf130165();
@@ -119,6 +120,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf149128);
 CPPUNIT_TEST(testTdf66228);
 CPPUNIT_TEST(testTdf147919);
 CPPUNIT_TEST(testTdf130165);
@@ -217,6 +219,21 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf149128()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149128.odp"), 
ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id", "42");
+assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx", "0");
+assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "id", "43");
+assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", "2");
+}
+
 void SdOOXMLExportTest1::testTdf66228()
 {
 sd::DrawDocShellRef xDocShRef


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

2022-05-27 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/shape.hxx|6 +++
 include/oox/ppt/slidepersist.hxx   |4 ++
 oox/source/ppt/pptshape.cxx|   23 ++--
 oox/source/ppt/presentationfragmenthandler.cxx |   46 +
 oox/source/ppt/slidepersist.cxx|2 +
 sd/qa/unit/data/pptx/tdf148965.pptx|binary
 sd/qa/unit/import-tests.cxx|   37 
 7 files changed, 100 insertions(+), 18 deletions(-)

New commits:
commit 855a56fea4561135a63cb729d7a625a950b210e7
Author: Tibor Nagy 
AuthorDate: Fri May 13 08:12:17 2022 +0200
Commit: László Németh 
CommitDate: Fri May 27 18:32:38 2022 +0200

tdf#148965 PPTX import: fix internal hyperlinks on shapes

Locale dependent code path resulted broken hyperlinks
on shapes in a non-English build.

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

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 4318c1e24d2d..e845b399f5f8 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -140,6 +140,9 @@ public:
 voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
 boolisConnectorShape() const { return 
mbConnector; }
 
+voidsetBookmark(bool bBookmark) { 
mbHasBookmark = bBookmark; }
+boolhasBookmark() const { return 
mbHasBookmark; }
+
 Shape3DProperties&  get3DProperties() { return 
*mp3DPropertiesPtr; }
 const Shape3DProperties&get3DProperties() const { return 
*mp3DPropertiesPtr; }
 
@@ -410,6 +413,9 @@ private:
 // Is this a connector shape?
 bool mbConnector = false;
 
+// Is shape has bookmark?
+bool mbHasBookmark = false;
+
 // temporary space for DiagramHelper in preparation for collecting data
 // Note: I tried to use a unique_ptr here, but existing constructor func 
does not allow that
 svx::diagram::IDiagramHelper* mpDiagramHelper;
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index 1b0a92c70783..4ba48637c66a 100644
--- a/include/oox/ppt/slidepersist.hxx
+++ b/include/oox/ppt/slidepersist.hxx
@@ -127,6 +127,9 @@ public:
 
 void createConnectorShapeConnection();
 
+void  addURLShapeId(const OUString& rShapeId) { 
maURLShapeId.push_back(rShapeId); }
+std::vector& getURLShapeId() { return maURLShapeId; }
+
 private:
 OUString
maPath;
 OUString
maLayoutPath;
@@ -160,6 +163,7 @@ private:
 CommentAuthorList   
maCommentAuthors;
 
 std::vector   
maConnectorShapeId;
+std::vector   
maURLShapeId;
 };
 
 }
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index d83737250550..2ec4a3fbe327 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -613,27 +613,14 @@ void PPTShape::addShape(
 // so check here if it's a bookmark or a document
 if (meClickAction == ClickAction_BOOKMARK)
 {
+sal_Int32 nSplitPos;
 if (!sURL.startsWith("#"))
 meClickAction = ClickAction_DOCUMENT;
-else
+else if (-1 != (nSplitPos = sURL.indexOf( ' ' )))
 {
-sURL = sURL.copy(1);
-sal_Int32 nPageNumber = 0;
-static const OUStringLiteral sSlide = u"Slide ";
-if (sURL.match(sSlide))
-nPageNumber = 
o3tl::toInt32(sURL.subView(sSlide.getLength()));
-Reference 
xDPS(rFilterBase.getModel(),
-
uno::UNO_QUERY_THROW);
-Reference 
xDrawPages(xDPS->getDrawPages(),
-  
uno::UNO_SET_THROW);
-sal_Int32 nMaxPages = xDrawPages->getCount();
-if (nPageNumber && nPageNumber <= nMaxPages)
-{
-Reference xDrawPage;
-xDrawPages->getByIndex(nPageNumber - 1) >>= 
xDrawPage;
-Reference xNamed(xDrawPage, 
UNO_QUERY);
-sURL = xNamed->getName();
-}
+ 

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

2022-05-27 Thread Tibor Nagy (via logerrit)
 oox/source/ppt/slidepersist.cxx |8 
 sd/qa/unit/data/pptx/tdf149124.pptx |binary
 sd/qa/unit/import-tests.cxx |   18 ++
 3 files changed, 26 insertions(+)

New commits:
commit 25e747ed39a3742d26c1128b6823679de279d5df
Author: Tibor Nagy 
AuthorDate: Wed May 25 15:52:55 2022 +0200
Commit: László Németh 
CommitDate: Fri May 27 09:59:59 2022 +0200

tdf#149124 PPTX import: fix broken connectors in grouped shapes

Previously connector lines of grouped shapes were detached
after the import losing the original layout (without
ungrouping and moving the shapes).

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

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 81a0fd7991a7..24ce2f9da464 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -150,6 +150,14 @@ void SlidePersist::createXShapes( XmlFilterBase& 
rFilterBase )
 pPPTShape->addShape( rFilterBase, *this, getTheme().get(), 
xShapes, aTransformation, () );
 if (pPPTShape->isConnectorShape())
 maConnectorShapeId.push_back(pPPTShape->getId());
+if (!pPPTShape->getChildren().empty())
+{
+for (size_t i = 0; i < pPPTShape->getChildren().size(); 
i++)
+{
+if (pPPTShape->getChildren()[i]->isConnectorShape())
+
maConnectorShapeId.push_back(pPPTShape->getChildren()[i]->getId());
+}
+}
 }
 else
 child->addShape( rFilterBase, getTheme().get(), xShapes, 
aTransformation, maShapesPtr->getFillProperties(), () );
diff --git a/sd/qa/unit/data/pptx/tdf149124.pptx 
b/sd/qa/unit/data/pptx/tdf149124.pptx
new file mode 100644
index ..9c43c43ce09b
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149124.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 100c9e784875..9e60c8886dec 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -81,6 +81,7 @@ public:
 virtual void setUp() override;
 
 void testDocumentLayout();
+void testTdf149124();
 void testTdf89449();
 void testTdf147459();
 void testTdf146223();
@@ -149,6 +150,7 @@ public:
 CPPUNIT_TEST_SUITE(SdImportTest);
 
 CPPUNIT_TEST(testDocumentLayout);
+CPPUNIT_TEST(testTdf149124);
 CPPUNIT_TEST(testTdf89449);
 CPPUNIT_TEST(testTdf147459);
 CPPUNIT_TEST(testTdf146223);
@@ -295,6 +297,22 @@ void SdImportTest::testDocumentLayout()
 }
 }
 
+void SdImportTest::testTdf149124()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149124.pptx"), 
PPTX);
+
+uno::Reference xGroupShape(getShapeFromPage(0, 0, 
xDocShRef), uno::UNO_QUERY_THROW);
+uno::Reference 
xStandardConnector(xGroupShape->getByIndex(2), uno::UNO_QUERY_THROW);
+
+sal_Int32 nStartGlueId = 
xStandardConnector->getPropertyValue("StartGluePointIndex").get();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nStartGlueId);
+sal_Int32 nEndGlueId = 
xStandardConnector->getPropertyValue("EndGluePointIndex").get();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nEndGlueId);
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf89449()
 {
 sd::DrawDocShellRef xDocShRef


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

2022-05-23 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |4 ++--
 sd/qa/unit/data/odp/tdf66228.odp   |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   15 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit f4efaf455136c3a0db8dfd3f1afc0db827192147
Author: Tibor Nagy 
AuthorDate: Fri May 13 14:09:35 2022 +0200
Commit: László Németh 
CommitDate: Mon May 23 10:59:10 2022 +0200

tdf#66228 PPTX export: fix lost U-shaped connectors

which were replaced with straight connector lines.

The "Line Connector" has no equivalent in OOXML. So far it has
been saved as a "Straight connector". In most cases, the better
solution is to change it to "Standard connector", keeping
the original layout with U-shaped connectors.

Change-Id: I9d6b6174d0556ba2478c6a9837c500b3cc794c82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134284
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 ed129784ba51..284daea2db21 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1662,12 +1662,12 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 case ConnectorType_CURVE:
 sGeometry = "curvedConnector";
 break;
+case ConnectorType_LINES:
 case ConnectorType_STANDARD:
 sGeometry = "bentConnector";
 break;
 default:
 case ConnectorType_LINE:
-case ConnectorType_LINES:
 sGeometry = "straightConnector1";
 break;
 }
@@ -1692,7 +1692,7 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 }
 EscherConnectorListEntry aConnectorEntry( xShape, aStartPoint, rXShapeA, 
aEndPoint, rXShapeB );
 
-if (eConnectorType == ConnectorType_CURVE || eConnectorType == 
ConnectorType_STANDARD)
+if (eConnectorType != ConnectorType_LINE)
 {
 tools::PolyPolygon aPolyPolygon = 
EscherPropertyContainer::GetPolyPolygon(xShape);
 if (aPolyPolygon.Count() > 0)
diff --git a/sd/qa/unit/data/odp/tdf66228.odp b/sd/qa/unit/data/odp/tdf66228.odp
new file mode 100644
index ..a34c6fc65270
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf66228.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index a1dac4fbf63c..70c64d793084 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -48,6 +48,7 @@ using namespace css;
 class SdOOXMLExportTest1 : public SdModelTestBaseXML
 {
 public:
+void testTdf66228();
 void testTdf147919();
 void testTdf130165();
 void testTdf124781();
@@ -118,6 +119,7 @@ public:
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
+CPPUNIT_TEST(testTdf66228);
 CPPUNIT_TEST(testTdf147919);
 CPPUNIT_TEST(testTdf130165);
 CPPUNIT_TEST(testTdf124781);
@@ -215,6 +217,19 @@ void checkFontAttributes( const SdrTextObj* pObj, 
ItemValue nVal, sal_uInt32 nId
 
 }
 
+void SdOOXMLExportTest1::testTdf66228()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf66228.odp"), ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:spPr/a:prstGeom", 
"prst",
+"bentConnector3");
+}
+
 void SdOOXMLExportTest1::testTdf147919()
 {
 sd::DrawDocShellRef xDocShRef


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

2022-05-10 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |  306 +
 sd/qa/unit/data/odp/tdf147919.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   62 +++
 3 files changed, 340 insertions(+), 28 deletions(-)

New commits:
commit 4cc3a144ef2ecc019da42bb9b115267a18e9559f
Author: Tibor Nagy 
AuthorDate: Fri Apr 29 14:08:17 2022 +0200
Commit: László Németh 
CommitDate: Tue May 10 16:51:54 2022 +0200

tdf#147919 PPTX export: fix curved and bent connector shape

by calculating and exporting adjustment values to avoid
of connector lines with bad turns overlapping the
connected shapes.

Change-Id: I0441508f4fe98b3482e2955df5f41f2cfc2ffb4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134109
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 3308d5ab4492..ed129784ba51 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1411,49 +1411,276 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 pFS->endElementNS( mnXmlNamespace, XML_pic );
 }
 
+static void lcl_Rotate(sal_Int32 nAngle, Point center, awt::Point& pt)
+{
+sal_Int16 nCos, nSin;
+switch (nAngle)
+{
+case 90:
+nCos = 0;
+nSin = 1;
+break;
+case 180:
+nCos = -1;
+nSin = 0;
+break;
+case 270:
+nCos = 0;
+nSin = -1;
+break;
+default:
+return;
+}
+sal_Int32 x = pt.X - center.X();
+sal_Int32 y = pt.Y - center.Y();
+pt.X = center.X() + x * nCos - y * nSin;
+pt.Y = center.Y() + y * nCos + x * nSin;
+}
+
+static void lcl_FlipHFlipV(tools::Polygon aPoly, sal_Int32 nAngle, bool& 
rFlipH, bool& rFlipV)
+{
+Point aStart = aPoly[0];
+Point aEnd = aPoly[aPoly.GetSize() - 1];
+
+if (aStart.X() > aEnd.X() && aStart.Y() > aEnd.Y())
+{
+if (nAngle)
+{
+if (nAngle == 90)
+rFlipH = true;
+if (nAngle == 270)
+rFlipV = true;
+}
+else // 0°
+{
+rFlipH = true;
+rFlipV = true;
+}
+}
+
+if (aStart.X() < aEnd.X() && aStart.Y() < aEnd.Y())
+{
+if (nAngle)
+{
+if (nAngle != 270)
+{
+rFlipH = true;
+rFlipV = true;
+}
+else
+rFlipH = true;
+}
+}
+
+if (aStart.Y() < aEnd.Y() && aStart.X() > aEnd.X())
+{
+if (nAngle)
+{
+if (nAngle == 180)
+rFlipV = true;
+if (nAngle == 270)
+{
+rFlipV = true;
+rFlipH = true;
+}
+}
+else // 0°
+{
+rFlipH = true;
+}
+}
+
+if (aStart.Y() > aEnd.Y() && aStart.X() < aEnd.X())
+{
+if (nAngle)
+{
+if (nAngle == 90)
+{
+rFlipH = true;
+rFlipV = true;
+}
+if (nAngle == 180)
+rFlipH = true;
+}
+else // 0°
+rFlipV = true;
+}
+}
+
+static sal_Int32 lcl_GetAngle(tools::Polygon aPoly)
+{
+sal_Int32 nAngle;
+Point aStartPoint = aPoly[0];
+Point aEndPoint = aPoly[aPoly.GetSize() - 1];
+if (aStartPoint.X() == aPoly[1].X())
+{
+if ((aStartPoint.X() < aEndPoint.X() && aStartPoint.Y() > 
aEndPoint.Y())
+|| (aStartPoint.X() > aEndPoint.X() && aStartPoint.Y() < 
aEndPoint.Y()))
+{
+nAngle = 90;
+}
+else
+nAngle = 270;
+}
+else
+{
+if (aStartPoint.X() > aPoly[1].X())
+nAngle = 180;
+else
+nAngle = 0;
+}
+
+return nAngle;
+}
+
+// Adjust value decide the position, where the connector should turn.
+static void lcl_GetConnectorAdjustValue(const Reference& xShape, 
tools::Polygon aPoly,
+ConnectorType eConnectorType,
+std::vector>& rAvList)
+{
+sal_Int32 nAdjCount = 0;
+if (eConnectorType == ConnectorType_CURVE)
+{
+if (aPoly.GetSize() == 4)
+{
+if ((aPoly[0].X() == aPoly[1].X() && aPoly[2].X() == aPoly[3].X())
+|| (aPoly[0].Y() == aPoly[1].Y() && aPoly[2].Y() == 
aPoly[3].Y()))
+{
+nAdjCount = 1; // curvedConnector3
+}
+else
+nAdjCount = 0; // curvedConnector2
+}
+else if (aPoly.GetSize() > 4)
+{
+if ((aPoly[2].X() == aPoly[3].X() && aPoly[3].X() == aPoly[4].X())
+|| (aPoly[2].Y() == aPoly[3].Y() && aPoly[3].Y() == 
aPoly[4].Y()))
+{
+nAdjCount = 

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

2022-05-04 Thread Tibor Nagy (via logerrit)
 oox/source/export/shapes.cxx   |  306 +
 sd/qa/unit/data/odp/tdf147919.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   62 +++
 3 files changed, 340 insertions(+), 28 deletions(-)

New commits:
commit 1f8c6efbfea10997f188962d036f5c7db4c13f8a
Author: Tibor Nagy 
AuthorDate: Fri Apr 29 14:08:17 2022 +0200
Commit: László Németh 
CommitDate: Wed May 4 12:46:36 2022 +0200

tdf#147919 PPTX export: fix curved and bent connector shape

by calculating and exporting adjustment values to avoid
of connector lines with bad turns overlapping the
connected shapes.

Change-Id: I615a20f3ba3c5d03ae73d87848dc41e9ecd29ae5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133635
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 3308d5ab4492..de1527ecda0f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1411,49 +1411,276 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
 pFS->endElementNS( mnXmlNamespace, XML_pic );
 }
 
+static void lcl_Rotate(sal_Int32 nAngle, Point center, awt::Point& pt)
+{
+sal_Int16 nCos, nSin;
+switch (nAngle)
+{
+case 90:
+nCos = 0;
+nSin = 1;
+break;
+case 180:
+nCos = -1;
+nSin = 0;
+break;
+case 270:
+nCos = 0;
+nSin = -1;
+break;
+default:
+return;
+}
+sal_Int32 x = pt.X - center.X();
+sal_Int32 y = pt.Y - center.Y();
+pt.X = center.X() + x * nCos - y * nSin;
+pt.Y = center.Y() + y * nCos + x * nSin;
+}
+
+static void lcl_FlipHFlipV(tools::Polygon aPoly, sal_Int32 nAngle, bool& 
rFlipH, bool& rFlipV)
+{
+Point aStart = aPoly[0];
+Point aEnd = aPoly[aPoly.GetSize() - 1];
+
+if (aStart.X() > aEnd.X() && aStart.Y() > aEnd.Y())
+{
+if (nAngle)
+{
+if (nAngle == 90)
+rFlipH = true;
+if (nAngle == 270)
+rFlipV = true;
+}
+else // 0°
+{
+rFlipH = true;
+rFlipV = true;
+}
+}
+
+if (aStart.X() < aEnd.X() && aStart.Y() < aEnd.Y())
+{
+if (nAngle)
+{
+if (nAngle != 270)
+{
+rFlipH = true;
+rFlipV = true;
+}
+else
+rFlipH = true;
+}
+}
+
+if (aStart.Y() < aEnd.Y() && aStart.X() > aEnd.X())
+{
+if (nAngle)
+{
+if (nAngle == 180)
+rFlipV = true;
+if (nAngle == 270)
+{
+rFlipV = true;
+rFlipH = true;
+}
+}
+else // 0°
+{
+rFlipH = true;
+}
+}
+
+if (aStart.Y() > aEnd.Y() && aStart.X() < aEnd.X())
+{
+if (nAngle)
+{
+if (nAngle == 90)
+{
+rFlipH = true;
+rFlipV = true;
+}
+if (nAngle == 180)
+rFlipH = true;
+}
+else // 0°
+rFlipV = true;
+}
+}
+
+static sal_Int32 lcl_GetAngle(tools::Polygon aPoly)
+{
+sal_Int32 nAngle;
+Point aStartPoint = aPoly[0];
+Point aEndPoint = aPoly[aPoly.GetSize() - 1];
+if (aStartPoint.X() == aPoly[1].X())
+{
+if ((aStartPoint.X() < aEndPoint.X() && aStartPoint.Y() > 
aEndPoint.Y())
+|| (aStartPoint.X() > aEndPoint.X() && aStartPoint.Y() < 
aEndPoint.Y()))
+{
+nAngle = 90;
+}
+else
+nAngle = 270;
+}
+else
+{
+if (aStartPoint.X() > aPoly[1].X())
+nAngle = 180;
+else
+nAngle = 0;
+}
+
+return nAngle;
+}
+
+// Adjust value decide the position, where the connector should turn.
+static void lcl_GetConnectorAdjustValue(const Reference& xShape, 
tools::Polygon aPoly,
+ConnectorType eConnectorType,
+std::vector>& rAvList)
+{
+sal_Int32 nAdjCount = 0;
+if (eConnectorType == ConnectorType_CURVE)
+{
+if (aPoly.GetSize() == 4)
+{
+if ((aPoly[0].X() == aPoly[1].X() && aPoly[2].X() == aPoly[3].X())
+|| (aPoly[0].Y() == aPoly[1].Y() && aPoly[2].Y() == 
aPoly[3].Y()))
+{
+nAdjCount = 1; // curvedConnector3
+}
+else
+nAdjCount = 0; // curvedConnector2
+}
+else
+{
+if ((aPoly[2].X() == aPoly[3].X() && aPoly[3].X() == aPoly[4].X())
+|| (aPoly[2].Y() == aPoly[3].Y() && aPoly[3].Y() == 
aPoly[4].Y()))
+{
+nAdjCount = 3; // curvedConnector5
+}
+   

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

2022-03-29 Thread Tibor Nagy (via logerrit)
 include/oox/drawingml/connectorshapecontext.hxx |   15 
 include/oox/drawingml/shape.hxx |   11 
 include/oox/ppt/slidepersist.hxx|4 
 oox/inc/drawingml/customshapeproperties.hxx |1 
 oox/source/drawingml/chart/chartdrawingfragment.cxx |3 
 oox/source/drawingml/connectorshapecontext.cxx  |   84 -
 oox/source/drawingml/customshapeproperties.cxx  |   36 --
 oox/source/drawingml/shape.cxx  |   37 ++
 oox/source/drawingml/shapegroupcontext.cxx  |3 
 oox/source/drawingml/shapepropertiescontext.cxx |8 
 oox/source/export/shapes.cxx|3 
 oox/source/ppt/pptshapegroupcontext.cxx |6 
 oox/source/ppt/slidepersist.cxx |   70 
 oox/source/shape/LockedCanvasContext.cxx|7 
 sc/source/filter/oox/drawingfragment.cxx|3 
 sd/qa/unit/data/pptx/tdf89449.pptx  |binary
 sd/qa/unit/data/xml/fdo47434_0.xml  |  188 
 sd/qa/unit/data/xml/tdf100491_0.xml |  304 +---
 sd/qa/unit/export-tests-ooxml2.cxx  |8 
 sd/qa/unit/import-tests.cxx |   39 ++
 20 files changed, 288 insertions(+), 542 deletions(-)

New commits:
commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8
Author: Tibor Nagy 
AuthorDate: Thu Mar 10 08:42:12 2022 +0100
Commit: László Németh 
CommitDate: Tue Mar 29 16:12:45 2022 +0200

tdf#89449 PPTX import: fix line connectors

Line connectors were imported as plain shapes, losing
their functionality during editing, i.e. keeping
connections of boxes and other shapes.

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

diff --git a/include/oox/drawingml/connectorshapecontext.hxx 
b/include/oox/drawingml/connectorshapecontext.hxx
index 1efdd2e40611..c9819ae85137 100644
--- a/include/oox/drawingml/connectorshapecontext.hxx
+++ b/include/oox/drawingml/connectorshapecontext.hxx
@@ -25,16 +25,29 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace oox { class AttributeList; }
 namespace oox::core { class ContextHandler2Helper; }
 
 namespace oox::drawingml {
 
+struct ConnectorShapeProperties
+{
+bool mbStartShape;
+OUString maDestShapeId;
+sal_Int32 mnDestGlueId;
+};
+
 class OOX_DLLPUBLIC ConnectorShapeContext final : public ShapeContext
 {
+std::vector& mrConnectorShapePropertiesList;
+ShapePtr mpConnectorShapePtr;
+
 public:
-ConnectorShapeContext( ::oox::core::ContextHandler2Helper const & rParent, 
const ShapePtr& pMasterShapePtr, const ShapePtr& pGroupShapePtr );
+ConnectorShapeContext(::oox::core::ContextHandler2Helper const& rParent,
+  const ShapePtr& pMasterShapePtr, const ShapePtr& 
pGroupShapePtr,
+  std::vector& 
rConnectorShapePropertiesList);
 virtual ~ConnectorShapeContext() override;
 virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 
Element, const ::oox::AttributeList& rAttribs ) override;
 };
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 734e805ccac5..a16e65a71ef1 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -73,6 +74,8 @@ typedef std::shared_ptr< CustomShapeProperties > 
CustomShapePropertiesPtr;
 
 typedef ::std::map< OUString, ShapePtr > ShapeIdMap;
 
+typedef std::vector ConnectorShapePropertiesList;
+
 struct ShapeStyleRef
 {
 Color   maPhClr;
@@ -128,6 +131,10 @@ public:
 
 CustomShapePropertiesPtr&   getCustomShapeProperties(){ return 
mpCustomShapePropertiesPtr; }
 
+ConnectorShapePropertiesList&   getConnectorShapeProperties() { return 
maConnectorShapePropertiesList; }
+voidsetConnectorShape(bool bConnector) { 
mbConnector = bConnector; }
+boolisConnectorShape() const { return 
mbConnector; }
+
 Shape3DProperties&  get3DProperties() { return 
*mp3DPropertiesPtr; }
 const Shape3DProperties&get3DProperties() const { return 
*mp3DPropertiesPtr; }
 
@@ -332,6 +339,7 @@ protected:
 PropertyMap maDefaultShapeProperties;
 TextListStylePtrmpMasterTextListStyle;
 css::uno::Reference< css::drawing::XShape > mxShape;
+ConnectorShapePropertiesList maConnectorShapePropertiesList;
 
 OUStringmsServiceName;
 OUStringmsName;
@@ -394,6 +402,9 @@ private:
 /// The shape fill should be set to that of the slide background surface.
 bool mbUseBgFill = false;
 
+// Is this a connector shape?
+bool mbConnector = 

  1   2   3   >