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

2023-10-11 Thread Tomaž Vajngerl (via logerrit)
 oox/source/export/drawingml.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 97e7ea424021239b04924cde50ddc3474e31f8cd
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 11 11:58:35 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 11 12:31:28 2023 +0200

Revert "tdf#51510 Blurry QR code after save/reload (docx)"

This reverts commit f8b547097dc043924f6df89a8c0e8bafd3f9873a.

Reason for revert: This can cause compatibility issues with OOXML when they 
are saved like this because this is not the correct way how SVG should be saved 
to the OOXML document - it needs to use the OOXML SVG extension so that the 
image is still shown in old MSO versions. See more
info in https://gerrit.libreoffice.org/c/core/+/157729.

Change-Id: Ie8fbe8ac0dd7bd1bff5976a89e7d5e174e9d2fcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157784
Reviewed-by: Xisco Fauli 
Tested-by: Xisco Fauli 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 822f5a5e601e..a80111ededab 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1342,10 +1342,6 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic 
, bool bRelPathToMedia )
 sMediaType = "image/png";
 pExtension = ".png";
 break;
-case GfxLinkType::NativeSvg:
-sMediaType = "image/svg";
-pExtension = ".svg";
-break;
 case GfxLinkType::NativeTif:
 sMediaType = "image/tiff";
 pExtension = ".tif";


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

2023-10-11 Thread Darshan-upadhyay1110 (via logerrit)
 oox/source/export/drawingml.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit f8b547097dc043924f6df89a8c0e8bafd3f9873a
Author: Darshan-upadhyay1110 
AuthorDate: Tue Sep 26 12:29:15 2023 +0530
Commit: Xisco Fauli 
CommitDate: Wed Oct 11 11:39:22 2023 +0200

tdf#51510 Blurry QR code after save/reload (docx)

- without GfxLinkType::NativeSvg CASE in writeToStorage method by default 
QR svg changes to low resolution image type and that is the why QR got blurry 
in doc or docx format
- added svg option when we change from odt to doc or docx format


Change-Id: I74aec0619992c1f455cc9cbf3c19e352c3037e04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157264
Reviewed-by: Szymon Kłos 
Tested-by: Szymon Kłos 
(cherry picked from commit 1d7dc53f19d188ae12603ca3cd526eb0a5016cf4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157729
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 60a51b8397154e9685e63cff0a60c1a3da034423)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157781
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a80111ededab..822f5a5e601e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1342,6 +1342,10 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic 
, bool bRelPathToMedia )
 sMediaType = "image/png";
 pExtension = ".png";
 break;
+case GfxLinkType::NativeSvg:
+sMediaType = "image/svg";
+pExtension = ".svg";
+break;
 case GfxLinkType::NativeTif:
 sMediaType = "image/tiff";
 pExtension = ".tif";


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

2023-07-06 Thread Xisco Fauli (via logerrit)
 oox/source/export/shapes.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit af9ce10c5be501c143fa18d94f6cc45785a061b6
Author: Xisco Fauli 
AuthorDate: Wed Jul 5 09:55:18 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Jul 6 11:45:14 2023 +0200

oox: fix crash in lcl_GetGluePointId

See 
https://crashreport.libreoffice.org/stats/signature/static%20long%20oox::drawingml::lcl_GetGluePointId(const%20class%20com::sun::star::uno::Reference%3Ccom::sun::star::drawing::XShape%3E%20&%20const,%20long)

Regression from b7c542b5085374f1d031183cb86ceeefcf24964d
"tdf#154363 sd: fix line connectors regression of mirrored shapes"

Change-Id: I926d32f5b68582df588c28a800b0ec10e7e3e19f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154021
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 66fbe1fcc36b7ac67c4b06d7917705cd1171c2ea)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154031
Reviewed-by: Michael Stahl 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a181f4d45db5..7431e7091967 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1672,7 +1672,8 @@ static sal_Int32 lcl_GetGluePointId(const 
Reference& xShape, sal_Int32 n
 bool bFlipH = false;
 bool bFlipV = false;
 Reference xShapeProps(xShape, UNO_QUERY);
-if 
(xShapeProps->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry"))
+if (xShapeProps.is() && xShapeProps->getPropertySetInfo()
+&& 
xShapeProps->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry"))
 {
 Sequence aGeometrySeq;
 xShapeProps->getPropertyValue("CustomShapeGeometry") >>= 
aGeometrySeq;


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

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

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

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

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

Steps to reproduce:

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

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

3. Save as > OOXML format.

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

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


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

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

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

tdf#91332 XLSX export: fix missing solidFill

Background color of shape inherited from theme
lost after export.

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

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

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


[Libreoffice-commits] core.git: 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: Branch 'libreoffice-7-5' - oox/source

2023-04-17 Thread Xisco Fauli (via logerrit)
 oox/source/export/shapes.cxx |   44 +++
 1 file changed, 20 insertions(+), 24 deletions(-)

New commits:
commit a14dcd55f266eb9daae85a43741bbb2a4840702c
Author: Xisco Fauli 
AuthorDate: Wed Apr 5 20:25:01 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Apr 17 20:56:59 2023 +0200

oox: drop macros

Change-Id: Ic8eeb34bef91807b54823a4114acc1200bec9de9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150065
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150492

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 199180862c69..a77ee85b8b92 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -321,16 +321,6 @@ uno::Reference GetOLEObjectStream(
 
 namespace oox::drawingml {
 
-#define GETA(propName) \
-GetProperty( rXPropSet, #propName)
-
-#define GETAD(propName) \
-( GetPropertyAndState( rXPropSet, rXPropState, #propName, eState ) && 
eState == beans::PropertyState_DIRECT_VALUE )
-
-#define GET(variable, propName) \
-if ( GETA(propName) ) \
-mAny >>= variable;
-
 ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, 
ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType, 
DMLTextExport* pTextExport, bool bUserShapes )
 : DrawingML( std::move(pFS), pFB, eDocumentType, pTextExport )
 , m_nEmbeddedObjects(0)
@@ -746,7 +736,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 bool bHasGeometrySeq(false);
 Sequence< PropertyValue > aGeometrySeq;
 OUString sShapeType("non-primitive"); // default in ODF
-if (GETA(CustomShapeGeometry))
+if (GetProperty(rXPropSet, "CustomShapeGeometry"))
 {
 SAL_INFO("oox.shape", "got custom shape geometry");
 if (mAny >>= aGeometrySeq)
@@ -816,7 +806,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 if (GetDocumentType() != DOCUMENT_DOCX || mbUserShapes)
 {
 bool bUseBackground = false;
-if (GETA(FillUseSlideBackground))
+if (GetProperty(rXPropSet, "FillUseSlideBackground"))
 mAny >>= bUseBackground;
 if (bUseBackground)
 mpFS->startElementNS(mnXmlNamespace, XML_sp, XML_useBgFill, "1");
@@ -824,7 +814,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 mpFS->startElementNS(mnXmlNamespace, XML_sp);
 
 bool isVisible = true ;
-if( GETA (Visible))
+if( GetProperty(rXPropSet, "Visible"))
 {
 mAny >>= isVisible;
 }
@@ -834,7 +824,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 OString::number(GetShapeID(xShape) == -1 ? GetNewShapeID(xShape) : 
GetShapeID(xShape)),
 XML_name, GetShapeName(xShape), XML_hidden, 
sax_fastparser::UseIf("1", !isVisible));
 
-if( GETA( URL ) )
+if( GetProperty(rXPropSet, "URL") )
 {
 OUString sURL;
 mAny >>= sURL;
@@ -850,10 +840,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 }
 
 OUString sBookmark;
-if (GETA(Bookmark))
+if (GetProperty(rXPropSet, "Bookmark"))
 mAny >>= sBookmark;
 
-if (GETA(OnClick))
+if (GetProperty(rXPropSet, "OnClick"))
 {
 OUString sPPAction;
 presentation::ClickAction eClickAction = 
presentation::ClickAction_NONE;
@@ -1687,7 +1677,8 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 Reference< XShape > rXShapeB;
 PropertyState eState;
 ConnectorType eConnectorType = ConnectorType_STANDARD;
-GET(eConnectorType, EdgeKind);
+if (GetProperty(rXPropSet, "EdgeKind"))
+mAny >>= eConnectorType;
 
 switch( eConnectorType ) {
 case ConnectorType_CURVE:
@@ -1703,19 +1694,24 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 break;
 }
 
-if( GETAD( EdgeStartPoint ) ) {
+if (GetPropertyAndState( rXPropSet, rXPropState, "EdgeStartPoint", eState 
) && eState == beans::PropertyState_DIRECT_VALUE )
+{
 mAny >>= aStartPoint;
-if( GETAD( EdgeEndPoint ) ) {
+if (GetPropertyAndState( rXPropSet, rXPropState, "EdgeEndPoint", 
eState ) && eState == beans::PropertyState_DIRECT_VALUE )
 mAny >>= aEndPoint;
-}
 }
-GET( rXShapeA, EdgeStartConnection );
-GET( rXShapeB, EdgeEndConnection );
+if (GetProperty(rXPropSet, "EdgeStartConnection"))
+mAny >>= rXShapeA;
+if (GetProperty(rXPropSet, "EdgeEndConnection"))
+mAny >>= rXShapeB;
 
-GET(nStartGlueId, StartGluePointIndex);
+if (GetProperty(rXPropSet, "StartGluePointIndex"))
+mAny >>= nStartGlueId;
 if 

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

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

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

tdf#145147 DOCX import: fix hyperlink in group shape

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

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

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

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


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

2023-04-06 Thread Xisco Fauli (via logerrit)
 oox/source/export/shapes.cxx |   15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 9ae9bb6e224b6bd03c155825ed4f5742c231cc72
Author: Xisco Fauli 
AuthorDate: Wed Apr 5 20:03:06 2023 +0200
Commit: Caolán McNamara 
CommitDate: Thu Apr 6 11:32:50 2023 +0200

oox: fix crash in lcl_GetGluePointId by removing unused code

See

https://crashreport.libreoffice.org/stats/signature/oox::drawingml::lcl_GetGluePointId

Change-Id: I7737568b12a18a2195f24f023917d30dd838ea12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150064
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-by: Xisco Fauli 
(cherry picked from commit aa1008e29bcfbee2397f72971d2de745fad8e98a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150076

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 4ef05ba80cab..199180862c69 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1650,20 +1650,17 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
-static sal_Int32 lcl_GetGluePointId(const Reference& xShape, 
sal_Int32& nGluePointId)
+static sal_Int32 lcl_GetGluePointId(sal_Int32 nGluePointId)
 {
-uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
-uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
- uno::UNO_QUERY);
 if (nGluePointId > 3)
-nGluePointId -= 4;
+return nGluePointId - 4;
 else
 {
 // change id of the bounding box (1 <-> 3)
 if (nGluePointId == 1)
-nGluePointId = 3; // Right
+return 3; // Right
 else if (nGluePointId == 3)
-nGluePointId = 1; // Left
+return 1; // Left
 }
 
 return nGluePointId;
@@ -1717,10 +1714,10 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 
 GET(nStartGlueId, StartGluePointIndex);
 if (nStartGlueId != -1)
-lcl_GetGluePointId(rXShapeA, nStartGlueId);
+nStartGlueId = lcl_GetGluePointId(nStartGlueId);
 GET(nEndGlueId, EndGluePointIndex);
 if (nEndGlueId != -1)
-lcl_GetGluePointId(rXShapeB, nEndGlueId);
+nEndGlueId = lcl_GetGluePointId(nEndGlueId);
 
 // Position is relative to group in Word, but relative to anchor of group 
in API.
 if (GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes && m_xParent.is())


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

2023-03-09 Thread Mike Kaganski (via logerrit)
 oox/source/shape/WpsContext.cxx|   86 
--
 sw/qa/extras/ooxmlimport/data/tdf153791-shd_overrides_fontRef.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx  |   74 

 3 files changed, 114 insertions(+), 46 deletions(-)

New commits:
commit e8c46d0067d88832896798678993dc77edd9c493
Author: Mike Kaganski 
AuthorDate: Fri Feb 24 15:27:07 2023 +0300
Commit: Christian Lohmaier 
CommitDate: Thu Mar 9 12:44:43 2023 +

tdf#153791: paragraph's/character's shd overrides shape style's fontRef

I couldn't find any references to this in documentation (ECMA-376, MS-OE376)
regarding this, but Word ignores the font properties (including color) 
defined
in the shape style's fontRef for txbxContent's paragraphs / runs that have 
shd
elements with non-auto fill color.

Change-Id: Ice634a5eed7b51379649462303300f55358a566f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147630
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit c15412eb96bda1037c12811f5818ed8ce1e603bd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147844
Reviewed-by: Christian Lohmaier 

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 99656195075b..1d0ecfe95519 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -169,62 +169,56 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 
 // Apply character color of the shape to the shape's textbox.
 uno::Reference xText(mxShape, uno::UNO_QUERY);
-uno::Reference xTextCursor = 
xText->createTextCursor();
-xTextCursor->gotoStart(false);
-xTextCursor->gotoEnd(true);
-uno::Reference 
xTextBoxPropertySet(xTextCursor,
-
uno::UNO_QUERY);
 uno::Any xCharColor = 
xPropertySet->getPropertyValue("CharColor");
 Color aColor = COL_AUTO;
 if ((xCharColor >>= aColor) && aColor != COL_AUTO)
 {
-const uno::Reference 
xPropertyState(xTextCursor,
-   
uno::UNO_QUERY);
-const beans::PropertyState ePropertyState
-= xPropertyState->getPropertyState("CharColor");
-if (ePropertyState == beans::PropertyState_DEFAULT_VALUE)
-{
-xTextBoxPropertySet->setPropertyValue("CharColor", 
xCharColor);
-}
-else
+// tdf#135923 Apply character color of the shape to the 
textrun
+//when the character color of the textrun is 
default.
+// tdf#153791 But only if the run has no background color 
(shd element in OOXML)
+if (uno::Reference 
paraEnumAccess{
+xText, uno::UNO_QUERY })
 {
-// tdf#135923 Apply character color of the shape to 
the textrun
-//when the character color of the textrun 
is default.
-uno::Reference 
paraEnumAccess(
-xText, uno::UNO_QUERY);
-if (paraEnumAccess.is())
-{
-uno::Reference paraEnum(
-paraEnumAccess->createEnumeration());
+uno::Reference paraEnum(
+paraEnumAccess->createEnumeration());
 
-while (paraEnum->hasMoreElements())
-{
-uno::Reference 
xParagraph(paraEnum->nextElement(),
-
uno::UNO_QUERY);
-uno::Reference 
runEnumAccess(
-xParagraph, uno::UNO_QUERY);
-if (!runEnumAccess.is())
+while (paraEnum->hasMoreElements())
+{
+uno::Reference 
xParagraph(paraEnum->nextElement(),
+
uno::UNO_QUERY);
+uno::Reference 
runEnumAccess(
+xParagraph, uno::UNO_QUERY);
+if (!runEnumAccess.is())
+continue;
+if (uno::Reference 
xParaPropSet{ xParagraph,
+   
   uno::UNO_QUERY })
+if 
((xParaPropSet->getPropertyValue("ParaBackColor") >>= 

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

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

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

tdf#153185 PPTX: fix export of linked OLE objects

Linked OLE objects were not exported.

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

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

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

2023-01-30 Thread Caolán McNamara (via logerrit)
 oox/source/crypto/AgileEngine.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit a198283feb79281d7c542961d8eed94ebed2dc1b
Author: Caolán McNamara 
AuthorDate: Sun Jan 29 14:31:08 2023 +
Commit: Michael Stahl 
CommitDate: Mon Jan 30 11:40:03 2023 +

ofz#55499 output buffer has to at least be the same size as input buffer

Change-Id: Ie80b058673c47db11334554189ad878a884e26db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146213
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/oox/source/crypto/AgileEngine.cxx 
b/oox/source/crypto/AgileEngine.cxx
index 09748e9dfd7b..f7518498171d 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -332,7 +332,9 @@ bool AgileEngine::decryptAndCheckVerifierHash(OUString 
const & rPassword)
 
 std::vector& encryptedHashInput = 
mInfo.encryptedVerifierHashInput;
 // SALT - needs to be a multiple of block size (?)
-sal_Int32 nSaltSize = roundUp(mInfo.saltSize, mInfo.blockSize);
+sal_uInt32 nSaltSize = roundUp(mInfo.saltSize, mInfo.blockSize);
+if (nSaltSize < encryptedHashInput.size())
+return false;
 std::vector hashInput(nSaltSize, 0);
 calculateBlock(constBlock1, hashFinal, encryptedHashInput, hashInput);
 


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

2023-01-19 Thread Attila Szűcs (via logerrit)
 oox/source/ppt/slidepersist.cxx   |   72 +-
 sd/qa/unit/data/pptx/tdf153036_resizedConnectorL.pptx |binary
 sd/qa/unit/import-tests.cxx   |   16 
 3 files changed, 68 insertions(+), 20 deletions(-)

New commits:
commit a44ab07e05521b987c842265184240661e330ea4
Author: Attila Szűcs 
AuthorDate: Mon Jan 16 04:13:07 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 19 11:13:11 2023 +

tdf#153036 PPTX import resized connector broken

Fixed the EdgeLine1Delta calculation in case of bentConnector2.
(when L shape imported as a special Z shape)

Co-authored-by: Tibor Nagy (NISZ)
Change-Id: I08c92e63adc744322061e4e433bfdc512745eda1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145548
Tested-by: Jenkins
Reviewed-by: Andras Timar 
(cherry picked from commit 17c68fad2aef917adfdd3d4d651da786e620699c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145728

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index c875239aac46..ca296561a52f 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -341,6 +341,36 @@ void SlidePersist::hideShapesAsMasterShapes()
 }
 }
 
+// This angle determines in the direction of the line
+static sal_Int32 lcl_GetAngle(uno::Reference& rXShape, 
awt::Point& rPt)
+{
+SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rXShape);
+tools::Rectangle aR(pObj->GetSnapRect());
+sal_Int32 nLeftX = rPt.X - aR.Left();
+sal_Int32 nTopY = rPt.Y - aR.Top();
+sal_Int32 nRightX = aR.Right() - rPt.X;
+sal_Int32 nBottomY = aR.Bottom() - rPt.Y;
+sal_Int32 nX = std::min(nLeftX, nRightX);
+sal_Int32 nY = std::min(nTopY, nBottomY);
+
+sal_Int32 nAngle;
+if (nX < nY)
+{
+if (nLeftX < nRightX)
+nAngle = 180; // Left
+else
+nAngle = 0; // Right
+}
+else
+{
+if (nTopY < nBottomY)
+nAngle = 270; // Top
+else
+nAngle = 90; // Bottom
+}
+return nAngle;
+}
+
 Reference SlidePersist::getAnimationNode(const OUString& sId) 
const
 {
 const auto& pIter = maAnimNodesMap.find(sId);
@@ -372,6 +402,8 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 SdrObject* pEndObj = xEndSp.is() ? 
SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr;
 
 sal_Int32 nStartSpLineW = 0;
+sal_Int32 nStartA = -1;
+sal_Int32 nEndA = -1;
 if (pStartObj)
 {
 aStartRect = pStartObj->GetSnapRect();
@@ -379,6 +411,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW;
 if (nStartSpLineW)
 nStartSpLineW = nStartSpLineW / 2;
+nStartA = lcl_GetAngle(xStartSp, aStartPt);
 }
 sal_Int32 nEndSpLineW = 0;
 if (pEndObj)
@@ -388,6 +421,7 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW;
 if (nEndSpLineW)
 nEndSpLineW = nEndSpLineW / 2;
+nEndA = lcl_GetAngle(xEndSp, aEndPt);
 }
 
 const OUString sConnectorName = rShapePtr->getConnectorName();
@@ -396,27 +430,25 @@ static void 
lcl_SetEdgeLineValue(uno::Reference& rXConnector,
 awt::Size aConnSize = rXConnector->getSize();
 if (xStartSp.is() || xEndSp.is())
 {
-if (aConnSize.Height < aConnSize.Width)
+if (nStartA >= 0)
 {
-if (xStartSp.is())
-nEdge = (aStartPt.Y > aEndPt.Y)
-? (nStartSpLineW - (aStartRect.Top() - 
aEndPt.Y))
-: ((aEndPt.Y - aStartRect.Bottom()) - 
nStartSpLineW);
-else
-nEdge = (aStartPt.Y > aEndPt.Y)
-? ((aStartPt.Y - aEndRect.Bottom()) - 
nEndSpLineW)
-: (nEndSpLineW - (aEndRect.Top() - 
aStartPt.Y));
-}
-else
-{
-if (xStartSp.is())
-nEdge = (aStartPt.X > aEndPt.X)
-? (nStartSpLineW - (aStartRect.Left() - 
aEndPt.X))
-: ((aEndPt.X - aStartRect.Right()) - 
nStartSpLineW);
-else
-nEdge = (aStartPt.X > aEndPt.X)
-? ((aStartPt.X - aEndRect.Right()) - 
nEndSpLineW)
-: (nEndSpLineW - (aEndRect.Left() - 
aStartPt.X));
+switch (nStartA)
+{
+case 0: nEdge = aEndPt.X - aStartRect.Right();  break;
+case 180:   nEdge = aEndPt.X - aStartRect.Left();   break;
+case 90:nEdge = aEndPt.Y - aStartRect.Bottom(); break;
+case 270:   nEdge = aEndPt.Y - aStartRect.Top();break;
+  

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

2023-01-06 Thread Attila Szűcs (via logerrit)
 oox/source/drawingml/shape.cxx   |6 
 sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx |binary
 sd/qa/unit/import-tests2.cxx |   20 +++
 3 files changed, 26 insertions(+)

New commits:
commit c27ba904366a966c2f4cc8fe2a04d47a41b3cc1d
Author: Attila Szűcs 
AuthorDate: Wed Jan 4 00:40:23 2023 +0100
Commit: Andras Timar 
CommitDate: Fri Jan 6 09:29:22 2023 +

tdf#149588 pptx import: transparency at SolidFill

When copied color (RGB) property from text content to shape,
copy alpha component as well. (If text color have alpha component)

Change-Id: Ib86c48ab7b2d3c5f9491a2211b05e90b2c2ea10f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145031
Tested-by: Jenkins
Reviewed-by: Andras Timar 
(cherry picked from commit 0cc9aaae5dc6655490513e8e4a93967f6248e23c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145004

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index a9b869e86af2..059785edf6e5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -852,6 +852,12 @@ static void lcl_copyCharPropsToShape(const 
uno::Reference& xSha
 aFillColor = static_cast(
 
rCharProps.maFillProperties.maFillColor.getColor(rFilter.getGraphicHelper())
 .GetRGBColor());
+if (rCharProps.maFillProperties.maFillColor.hasTransparency())
+{
+const sal_Int16 aTransparence
+= 
rCharProps.maFillProperties.maFillColor.getTransparency();
+xSet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, 
uno::Any(aTransparence));
+}
 }
 xSet->setPropertyValue(UNO_NAME_FILLCOLOR, uno::Any(aFillColor));
 
diff --git a/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx 
b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx
new file mode 100644
index ..8967590b9284
Binary files /dev/null and 
b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index b258c535e2c6..5d5864a2891e 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -145,6 +145,7 @@ public:
 void testTdf89928BlackWhiteThreshold();
 void testTdf151547TransparentWhiteText();
 void testTdf149961AutofitIndentation();
+void testTdf149588TransparentSolidFill();
 
 CPPUNIT_TEST_SUITE(SdImportTest2);
 
@@ -223,6 +224,7 @@ public:
 CPPUNIT_TEST(testTdf89928BlackWhiteThreshold);
 CPPUNIT_TEST(testTdf151547TransparentWhiteText);
 CPPUNIT_TEST(testTdf149961AutofitIndentation);
+CPPUNIT_TEST(testTdf149588TransparentSolidFill);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2009,6 +2011,24 @@ void SdImportTest2::testTdf149961AutofitIndentation()
 }
 }
 
+void SdImportTest2::testTdf149588TransparentSolidFill()
+{
+createSdImpressDoc("pptx/tdf149588_transparentSolidFill.pptx");
+saveAndReload("Impress MS PowerPoint 2007 XML");
+
+uno::Reference xShape(getShapeFromPage(6, 0));
+uno::Reference xParagraph(getParagraphFromShape(0, 
xShape));
+uno::Reference xRun(getRunFromParagraph(0, xParagraph));
+uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW);
+
+Color nCharColor;
+xPropSet->getPropertyValue("CharColor") >>= nCharColor;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: Color: R:99 G:99 B:99 A   51  (T:204)
+// - Actual  : Color: R:99 G:99 B:99 A: 255  (T:  0)
+CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


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

2022-12-21 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/transform2dcontext.cxx |   41 +++-
 1 file changed, 22 insertions(+), 19 deletions(-)

New commits:
commit d5dd8a4e77e858b02ac626d8902fffa2d010ae49
Author: Xisco Fauli 
AuthorDate: Wed Dec 21 10:28:28 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Dec 21 19:07:54 2022 +

oox: fix crash in oox::drawingml::Transform2DContext::onCreateContext

Similar to 68a259f5af8757923be8a226631f38366fe8e37b
"tdf#152606: fix crash when opening specific pptx"

See 
https://crashreport.libreoffice.org/stats/signature/oox::drawingml::Transform2DContext::onCreateContext(long,oox::AttributeList%20const%20&)

Change-Id: Iac769edadb72590d8aef1ea3fc3845fce7a0bd86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144648
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit ad3a1ed90fc5a19c0191ec572f12f359f98a0958)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144669
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/transform2dcontext.cxx 
b/oox/source/drawingml/transform2dcontext.cxx
index 9d295d826b63..1cd67d1192db 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -328,26 +328,29 @@ ContextHandlerRef Transform2DContext::onCreateContext( 
sal_Int32 aElementToken,
 }
 }
 
-// Calculate indent offsets
-sal_Int32 nOffsetLeft = aUnrotatedTxXfrm.X - 
aPresetTextRectangle.X;
-sal_Int32 nOffsetTop = aUnrotatedTxXfrm.Y - 
aPresetTextRectangle.Y;
-sal_Int32 nOffsetRight
-= aPresetTextRectangle.Width - aUnrotatedTxXfrm.Width - 
nOffsetLeft;
-sal_Int32 nOffsetBottom
-= aPresetTextRectangle.Height - aUnrotatedTxXfrm.Height - 
nOffsetTop;
+if(mrShape.getTextBody())
+{
+// Calculate indent offsets
+sal_Int32 nOffsetLeft = aUnrotatedTxXfrm.X - 
aPresetTextRectangle.X;
+sal_Int32 nOffsetTop = aUnrotatedTxXfrm.Y - 
aPresetTextRectangle.Y;
+sal_Int32 nOffsetRight
+= aPresetTextRectangle.Width - aUnrotatedTxXfrm.Width 
- nOffsetLeft;
+sal_Int32 nOffsetBottom
+= aPresetTextRectangle.Height - 
aUnrotatedTxXfrm.Height - nOffsetTop;
 
-if (nOffsetLeft)
-mrShape.getTextBody()->getTextProperties().moTextOffLeft
-= GetCoordinate(nOffsetLeft);
-if (nOffsetTop)
-mrShape.getTextBody()->getTextProperties().moTextOffUpper
-= GetCoordinate(nOffsetTop);
-if (nOffsetRight)
-mrShape.getTextBody()->getTextProperties().moTextOffRight
-= GetCoordinate(nOffsetRight);
-if (nOffsetBottom)
-mrShape.getTextBody()->getTextProperties().moTextOffLower
-= GetCoordinate(nOffsetBottom);
+if (nOffsetLeft)
+
mrShape.getTextBody()->getTextProperties().moTextOffLeft
+= GetCoordinate(nOffsetLeft);
+if (nOffsetTop)
+
mrShape.getTextBody()->getTextProperties().moTextOffUpper
+= GetCoordinate(nOffsetTop);
+if (nOffsetRight)
+
mrShape.getTextBody()->getTextProperties().moTextOffRight
+= GetCoordinate(nOffsetRight);
+if (nOffsetBottom)
+
mrShape.getTextBody()->getTextProperties().moTextOffLower
+= GetCoordinate(nOffsetBottom);
+}
 }
 break;
 }


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

2022-12-21 Thread Julien Nabet (via logerrit)
 oox/source/drawingml/transform2dcontext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4eba7f7c838f9b1e7df9e0e3f616f4d07dce3850
Author: Julien Nabet 
AuthorDate: Tue Dec 20 12:26:31 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Dec 21 09:03:56 2022 +

tdf#152606: fix crash when opening specific pptx

bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=184264

Related with 7e23cbdbb6ec0247a29ed8a8f744c01e10963ea0
tdf#149551 separate TextRotateAngle from TextPreRotateAngle

Change-Id: Idab19bee37c7a6fe1dc3818b6ff111389d290e6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144588
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 68a259f5af8757923be8a226631f38366fe8e37b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144613
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/transform2dcontext.cxx 
b/oox/source/drawingml/transform2dcontext.cxx
index da4ad10a168b..9d295d826b63 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -50,7 +50,7 @@ Transform2DContext::Transform2DContext( ContextHandler2Helper 
const & rParent, c
 }
 else
 {
-if (rAttribs.hasAttribute(XML_rot))
+if (rAttribs.hasAttribute(XML_rot) && mrShape.getTextBody())
 {
 mno_txXfrmRot = rAttribs.getInteger(XML_rot, 0);
 sal_Int32 nTextAreaRot = 
mrShape.getTextBody()->getTextProperties().moTextAreaRotation.value_or(0);


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

2022-12-20 Thread Caolán McNamara (via logerrit)
 oox/source/helper/attributelist.cxx   |3 +++
 sc/source/filter/oox/pivotcachebuffer.cxx |   11 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit e6593922d026ab7adbdb88084637b2e018af88c9
Author: Caolán McNamara 
AuthorDate: Tue Dec 20 12:58:12 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 20 15:56:45 2022 +

crashtesting: assert on import of forum-mso-en4-253564.xlsx

source document contains a timestamp formatted as:

2011-010-31T00: 00:00Z
 ^^^
Change-Id: I604ffa69189280faf9d7f55dae472cf9fe1b6763
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144601
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index 49ff32a967f5..037483cefb5a 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -263,7 +263,10 @@ std::optional< util::DateTime > 
AttributeList::getDateTime( sal_Int32 nAttrToken
 (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') && (aValue[ 10 ] == 'T') 
&&
 (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':');
 if (!bValid)
+{
+SAL_WARN("oox", "bad date string: " << aValue);
 return std::optional< util::DateTime >();
+}
 aDateTime.Year= static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.substr( 0, 4 )) );
 aDateTime.Month   = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.substr( 5, 2 )) );
 aDateTime.Day = static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.substr( 8, 2 )) );
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx 
b/sc/source/filter/oox/pivotcachebuffer.cxx
index 76d5af6fd65b..4896f3123e92 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -245,7 +245,16 @@ OUString PivotCacheItem::getFormattedName(const 
ScDPSaveDimension& rSaveDim, ScD
 case XML_n: return pObj->GetFormattedString(rSaveDim.GetName(), 
maValue.get());
 case XML_i: return pObj->GetFormattedString(rSaveDim.GetName(), 
static_cast(maValue.get< sal_Int32 >()));
 case XML_b: return pObj->GetFormattedString(rSaveDim.GetName(), 
static_cast(maValue.get< bool >()));
-case XML_d: return pObj->GetFormattedString(rSaveDim.GetName(), 
maValue.get< css::util::DateTime >() - rNullDate);
+case XML_d:
+{
+css::util::DateTime aDateTime(maValue.get< css::util::DateTime 
>());
+if (aDateTime.Year == 0)
+{
+SAL_WARN("sc", "PivotCacheField::getFormattedName - invalid 
date");
+return OUString();
+}
+return pObj->GetFormattedString(rSaveDim.GetName(), aDateTime - 
rNullDate);
+}
 case XML_e: return maValue.get< OUString >();
 }
 OSL_FAIL( "PivotCacheItem::getFormattedName - invalid data type" );


[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' - oox/source

2022-12-18 Thread Caolán McNamara (via logerrit)
 oox/source/helper/attributelist.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 05b714bd902ac061629dc1b95cd4df5c2937dd6d
Author: Caolán McNamara 
AuthorDate: Sat Dec 17 20:23:59 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Dec 18 10:33:07 2022 +

crashtesting: assert on export of forum-mso-en4-212378.xlsx back to xlsx

input xml contains:

https://gerrit.libreoffice.org/c/core/+/144389
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit f52118159e1e958177aa8080d9b43962d31bbdfd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144373

diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index e950ee5ea490..49ff32a967f5 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -102,7 +103,7 @@ OUString AttributeConversion::decodeXString( const 
OUString& rValue )
 const sal_Unicode* pcEnd = pcStr + rValue.getLength();
 while( pcStr < pcEnd )
 aBuffer.append( lclGetXChar( pcStr, pcEnd ) );
-return aBuffer.makeStringAndClear();
+return 
comphelper::string::sanitizeStringSurrogates(aBuffer.makeStringAndClear());
 }
 
 sal_Int32 AttributeConversion::decodeInteger( std::u16string_view rValue )


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

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

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

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

Don't apply COL_AUTO as color of the run.

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

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

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


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

2022-12-14 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/fillproperties.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 473006f247098c94f28b346621eb11859b1cc1fd
Author: Caolán McNamara 
AuthorDate: Mon Dec 12 11:23:51 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Dec 14 14:08:50 2022 +

crashtesting: relax assert seen on loading forum-mso-en4-151836.xlsx

Change-Id: Ib21ab9747219589bb5b1ce13eb0feacbff89efb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143987
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 5ebce5bb1b741c50926407d7ee036827f0ad8aa6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144126

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 329d5d3bb4b1..c68568096fd8 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -616,7 +616,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 }
 ++aIt;
 }
-assert( nWidestWidth > 0 );
+assert( nWidestWidth >= 0 );
 
 double nBorder = 0;
 bool bSwap(false);


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

2022-12-11 Thread Caolán McNamara (via logerrit)
 oox/source/helper/attributelist.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 0f1de26d35e011e5a22b865e50f49a4a015510ad
Author: Caolán McNamara 
AuthorDate: Sun Dec 11 16:42:37 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Dec 11 19:26:17 2022 +

crashtesting: accept timestamp with Z suffix as valid

seen with forum-mso-en4-652977.xlsx

Change-Id: I5ca7be851c279d28e225cba1ba401a4f7fa99e87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143932
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index d61f3bb2bf44..e950ee5ea490 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -258,8 +258,9 @@ std::optional< util::DateTime > AttributeList::getDateTime( 
sal_Int32 nAttrToken
 {
 std::string_view aValue = getView( nAttrToken );
 util::DateTime aDateTime;
-bool bValid = (aValue.size() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 
] == '-') &&
-(aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == 
':');
+bool bValid = (aValue.size() == 19 || (aValue.size() == 20 && aValue[19] 
== 'Z')) &&
+(aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') && (aValue[ 10 ] == 'T') 
&&
+(aValue[ 13 ] == ':') && (aValue[ 16 ] == ':');
 if (!bValid)
 return std::optional< util::DateTime >();
 aDateTime.Year= static_cast< sal_uInt16 >( 
o3tl::toInt32(aValue.substr( 0, 4 )) );


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

2022-12-11 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/chart/converterbase.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 177ec099d1fa3eb1d023efa15abf10817c495395
Author: Caolán McNamara 
AuthorDate: Sun Dec 11 16:30:33 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Dec 11 19:25:57 2022 +

crashtesting: null deref seen with forum-mso-en4-763051.xlsx

Change-Id: I721ab5fc78efafac9bcb7594e881773863d867f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143930
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/oox/source/drawingml/chart/converterbase.cxx 
b/oox/source/drawingml/chart/converterbase.cxx
index bf85b7c02360..d7130ec9795d 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -85,6 +86,11 @@ void TitleLayoutInfo::convertTitlePos( ConverterRoot const & 
rRoot, const Refere
 {
 // try to get the title shape
 Reference< XShape > xTitleShape = mpGetShape( rxChart1Doc );
+if (!xTitleShape)
+{
+SAL_WARN("oox", "failed to get a TitleShape");
+return;
+}
 // get title rotation angle, needed for correction of position of 
top-left edge
 double fAngle = 0.0;
 PropertySet aTitleProp( mxTitle );