core.git: oox/source sd/qa

2025-01-06 Thread Balazs Varga (via logerrit)
 oox/source/drawingml/fillproperties.cxx |   13 +
 sd/qa/unit/data/pptx/tdf163852.pptx |binary
 sd/qa/unit/import-tests2.cxx|   18 ++
 3 files changed, 31 insertions(+)

New commits:
commit 63753117640dde3e8e0b0e677afe26b7f57c626b
Author: Balazs Varga 
AuthorDate: Thu Jan 2 16:45:10 2025 +0100
Commit: Balazs Varga 
CommitDate: Mon Jan 6 09:44:26 2025 +0100

tdf#163852 ooxml: fix import of cropped vector graphic objects

We need to store the vector graphic objects size, so later
we can calculate with that for the cropping.

follow-up commit of: 1db193c6c744289139b1df2af0b8defcf974b238
(tdf#126084 import svg image from ooxml document that use svgBlip elem)

Change-Id: Iffa98cc6a03063544bdf2b8ec3012415868e7c65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179626
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
Tested-by: Gabor Kelemen 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index eaeb0029c415..b75dfed5aac8 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -832,6 +832,19 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 {
 geometry::IntegerRectangle2D oClipRect( 
maBlipProps.moClipRect.value() );
 awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic 
) );
+
+if (aOriginalSize.Width <= 0 || aOriginalSize.Height <= 0)
+{
+// VectorGraphic Objects need the correct object size for 
cropping
+Graphic aGraphic(xGraphic);
+if (aGraphic.getVectorGraphicData())
+{
+Size aPrefSize = aGraphic.GetPrefSize();
+aOriginalSize.Height = 
static_cast(aPrefSize.getHeight());
+aOriginalSize.Width = 
static_cast(aPrefSize.getWidth());
+}
+}
+
 if (aOriginalSize.Width > 0 && aOriginalSize.Height > 0)
 {
 text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
diff --git a/sd/qa/unit/data/pptx/tdf163852.pptx 
b/sd/qa/unit/data/pptx/tdf163852.pptx
new file mode 100644
index ..542a8268f6f8
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf163852.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 8e9b7f5f72b9..13a86cf25d77 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1370,6 +1370,24 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf149206)
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aCrop.Right);
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testtdf163852)
+{
+// Check that the svg image is cropped
+createSdImpressDoc("pptx/tdf163852.pptx");
+
+uno::Reference 
xPropertySet(getShapeFromPage(/*nShape=*/1, /*nPage=*/0));
+text::GraphicCrop aCrop;
+xPropertySet->getPropertyValue(u"GraphicCrop"_ustr) >>= aCrop;
+
+CPPUNIT_ASSERT_EQUAL(static_cast(0), aCrop.Top);
+CPPUNIT_ASSERT_EQUAL(static_cast(0), aCrop.Left);
+CPPUNIT_ASSERT_EQUAL(static_cast(0), aCrop.Right);
+// Without the fix in place, this test would have failed with
+// - Expected: 702
+// - Actual  : 0
+CPPUNIT_ASSERT_EQUAL(static_cast(702), aCrop.Bottom);
+}
+
 CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf149785)
 {
 // Without the fix in place, this test would have failed to load the file


core.git: oox/source sd/qa

2024-12-09 Thread Vasily Melenchuk (via logerrit)
 oox/source/ppt/pptshapegroupcontext.cxx |2 +-
 sd/qa/unit/data/pptx/tdf158512.pptx |binary
 sd/qa/unit/import-tests2.cxx|   13 +
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 6c9055aaac77323b9446050dafb8dc8d492a6bd6
Author: Vasily Melenchuk 
AuthorDate: Thu Apr 11 11:10:37 2024 +0300
Commit: Gabor Kelemen 
CommitDate: Mon Dec 9 15:34:03 2024 +0100

tdf#158512: PPTX import: reset useBgFill flag when it is unused

Even if current fill is not "use background" we should reset useBgFill
explicitly, since this value could be set from master slide and was
nested in current shape.

It is somewhat confusing to have fillStyle as none and using slide
background at the same time. So better to clean it explicitly.

Change-Id: I0d817dc295785be7a6cb8f884d5023d316cd2ebf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165994
Reviewed-by: Gabor Kelemen 
Tested-by: Jenkins
Tested-by: Gabor Kelemen 

diff --git a/oox/source/ppt/pptshapegroupcontext.cxx 
b/oox/source/ppt/pptshapegroupcontext.cxx
index 26caf62ef67e..66b18c056872 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -108,10 +108,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( 
sal_Int32 aElementToken
 {
 auto pShape = std::make_shared( meShapeLocation, 
u"com.sun.star.drawing.CustomShape"_ustr );
 bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false);
+pShape->getFillProperties().moUseBgFill = bUseBgFill;
 if (bUseBgFill)
 {
 pShape->getFillProperties().moFillType = XML_noFill;
-pShape->getFillProperties().moUseBgFill = true;
 }
 pShape->setModelId(rAttribs.getStringDefaulted( XML_modelId ));
 return new PPTShapeContext( *this, mpSlidePersistPtr, 
mpGroupShapePtr, pShape );
diff --git a/sd/qa/unit/data/pptx/tdf158512.pptx 
b/sd/qa/unit/data/pptx/tdf158512.pptx
new file mode 100644
index ..96494ddf656a
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf158512.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 2ff83269d682..8e9b7f5f72b9 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -2149,6 +2149,19 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf161430)
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, eXFS);
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, tdf158512)
+{
+// First shape on first slide should have no fill to avoid hiding 
background
+createSdImpressDoc("pptx/tdf158512.pptx");
+
+const SdrPage* pPage = GetPage(1);
+CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE,
+ 
pPage->GetObj(0)->GetMergedItem(XATTR_FILLSTYLE).GetValue());
+CPPUNIT_ASSERT_EQUAL(false,
+ 
pPage->GetObj(0)->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND).GetValue());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: oox/source

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

New commits:
commit 810b895ec76d374e173a254c98552c3366183af2
Author: Caolán McNamara 
AuthorDate: Mon Dec 9 10:14:57 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 9 13:40:01 2024 +0100

crashtesting: reimport of fdo61125-1.docx has negative image width

we probably shouldn't do that anyway, but the assumption at this
import check appears to be for >= 0

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index ec2a10da02fe..eaeb0029c415 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -832,7 +832,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 {
 geometry::IntegerRectangle2D oClipRect( 
maBlipProps.moClipRect.value() );
 awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic 
) );
-if ( aOriginalSize.Width && aOriginalSize.Height )
+if (aOriginalSize.Width > 0 && aOriginalSize.Height > 0)
 {
 text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
 if ( oClipRect.X1 )


core.git: oox/source sd/qa

2024-12-05 Thread Balazs Varga (via logerrit)
 oox/source/export/drawingml.cxx |   22 --
 sd/qa/unit/data/pptx/tdf160487.pptx |binary
 sd/qa/unit/export-tests-ooxml4.cxx  |   10 ++
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 293d03e6803be57af7a3948e358e7ed9f8545c13
Author: Balazs Varga 
AuthorDate: Wed Dec 4 14:09:25 2024 +0100
Commit: Balazs Varga 
CommitDate: Thu Dec 5 09:05:46 2024 +0100

tdf#160487 - PPTX export: fix "Fit height to text"

attribute of drawing objects (placeholders)

Export spAutoFit attribute correctly to ooxml.

Change-Id: I57e5b21bd6c407bdb5d1b36b3c3674249fbd2f59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177798
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 18334ad0516a..d3bc81b08b26 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4305,9 +4305,27 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 }
 else
 {
-// tdf#127030: Only custom shapes obey the TextAutoGrowHeight 
option.
+bool bAutoGrowHeightEnabled = false;
+const SdrObject* pObj = xShape.is() ? 
SdrObject::getSdrObjectFromXShape(xShape) : nullptr;
+if (pObj)
+{
+switch (pObj->GetObjIdentifier())
+{
+case SdrObjKind::NONE:
+case SdrObjKind::Text:
+case SdrObjKind::TitleText:
+case SdrObjKind::OutlineText:
+case SdrObjKind::Caption:
+case SdrObjKind::CustomShape:
+bAutoGrowHeightEnabled = true;
+break;
+default:
+bAutoGrowHeightEnabled = false;
+}
+}
+
 bool bTextAutoGrowHeight = false;
-if (dynamic_cast(rXIface.get()) && 
GetProperty(rXPropSet, u"TextAutoGrowHeight"_ustr))
+if (bAutoGrowHeightEnabled && GetProperty(rXPropSet, 
u"TextAutoGrowHeight"_ustr))
 mAny >>= bTextAutoGrowHeight;
 mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? 
XML_spAutoFit : XML_noAutofit));
 }
diff --git a/sd/qa/unit/data/pptx/tdf160487.pptx 
b/sd/qa/unit/data/pptx/tdf160487.pptx
new file mode 100644
index ..ac0f3fb553d1
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf160487.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index 9513b3ae5e61..55f1b5d5de2d 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -1263,6 +1263,16 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testTdf163483_export_math_fallback)
 "id", cNvPr_id);
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testPlaceHolderFitHeightToText)
+{
+createSdImpressDoc("pptx/tdf160487.pptx");
+saveAndReload(u"Impress Office Open XML"_ustr);
+uno::Reference xShape(getShapeFromPage(1, 0));
+bool bTextAutoGrowHeight = false;
+xShape->getPropertyValue(u"TextAutoGrowHeight"_ustr) >>= 
bTextAutoGrowHeight;
+CPPUNIT_ASSERT_MESSAGE("PlaceHolder Fit height to text should be true.", 
bTextAutoGrowHeight);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: oox/source

2024-12-02 Thread Caolán McNamara (via logerrit)
 oox/source/shape/WpsContext.cxx |   95 
 1 file changed, 49 insertions(+), 46 deletions(-)

New commits:
commit 6091e6b0ed363b7e65569830ac76cdcb7ba99b24
Author: Caolán McNamara 
AuthorDate: Mon Dec 2 11:03:47 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 2 17:58:07 2024 +0100

crashtesting: further failure to reload forum-de3-6592.docx

git show -w

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

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 78cef2a0d45c..56abef55fcc1 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -730,60 +730,63 @@ 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::Any xCharColor = 
xPropertySet->getPropertyValue(u"CharColor"_ustr);
-Color aColor = COL_AUTO;
-if ((xCharColor >>= aColor) && aColor != COL_AUTO)
+if (xText)
 {
-// 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 })
+uno::Any xCharColor = 
xPropertySet->getPropertyValue(u"CharColor"_ustr);
+Color aColor = COL_AUTO;
+if ((xCharColor >>= aColor) && aColor != COL_AUTO)
 {
-uno::Reference paraEnum(
-paraEnumAccess->createEnumeration());
-
-while (paraEnum->hasMoreElements())
+// 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 })
 {
-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(u"ParaBackColor"_ustr)
- >>= aColor)
-&& aColor != COL_AUTO)
-continue;
-
-uno::Reference runEnum
-= runEnumAccess->createEnumeration();
+uno::Reference paraEnum(
+paraEnumAccess->createEnumeration());
 
-while (runEnum->hasMoreElements())
+while (paraEnum->hasMoreElements())
 {
-uno::Reference 
xRun(runEnum->nextElement(),
-  
uno::UNO_QUERY);
-const uno::Reference 
xRunState(
-xRun, uno::UNO_QUERY);
-if (!xRunState
-|| 
xRunState->getPropertyState(u"CharColor"_ustr)
-   == 
beans::PropertyState_DEFAULT_VALUE)
-{
-uno::Reference 
xRunPropSet(xRun,
-   
 uno::UNO_QUERY);
-if (!xRunPropSet)
-continue;
-if 
((xRunPropSet->getPropertyValue(u"CharBackColor"_ustr)
+uno::Reference 
xParagraph(paraEnum->nextElement(),
+
uno::UNO_QUERY);
+uno::Reference 
runEnumAccess(
+xParagraph, uno::UNO_QUERY)

core.git: oox/source sd/qa

2024-11-29 Thread Mike Kaganski (via logerrit)
 oox/source/export/shapes.cxx   |   38 ++---
 sd/qa/unit/data/odp/formula.fodp   |   41 
 sd/qa/unit/export-tests-ooxml4.cxx |   47 -
 3 files changed, 121 insertions(+), 5 deletions(-)

New commits:
commit 5a42e163cd5c6427fe46d19b43a57cb09b57cc14
Author: Mike Kaganski 
AuthorDate: Sat Nov 30 01:17:14 2024 +0500
Commit: Mike Kaganski 
CommitDate: Sat Nov 30 08:40:29 2024 +0100

tdf#163483: implement export of Math formula's fallback image to PPTX

This was left as a TODO in commit cb890ae43bacd2be24bc74fad2e2e5cce8910995
(oox: export Math objects to PPTX files, 2016-01-15). Now after commit
7cfff4751befd678b3db4b6f16b020d38f4e9c32 (Related: tdf#129061 Avoid formula
import and use fallback for now, 2024-09-11), that relied on the fallback
being present, our exported documents lost the formulas completely on load.
So the fallback export became a necessity.

Change-Id: I52d4ef0400ce72ee10fda10a1131b4ba29ea56be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177564
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 38c76ef59952..0bb8d1ebeecc 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2657,6 +2658,8 @@ void ShapeExport::WriteMathShape(Reference const& 
xShape)
 assert(xMathModel.is());
 assert(GetDocumentType() != DOCUMENT_DOCX); // should be written in 
DocxAttributeOutput
 SAL_WARN_IF(GetDocumentType() == DOCUMENT_XLSX, "oox.shape", "Math export 
to XLSX isn't tested, should it happen here?");
+const OString cNvPr_id = OString::number(GetNewShapeID(xShape));
+const OUString shapeName = GetShapeName(xShape);
 
 // ECMA standard does not actually allow oMath outside of
 // WordProcessingML so write a MCE like PPT 2010 does
@@ -2666,9 +2669,7 @@ void ShapeExport::WriteMathShape(Reference const& 
xShape)
 XML_Requires, "a14");
 mpFS->startElementNS(mnXmlNamespace, XML_sp);
 mpFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
-mpFS->startElementNS(mnXmlNamespace, XML_cNvPr,
- XML_id, OString::number(GetNewShapeID(xShape)),
- XML_name, GetShapeName(xShape));
+mpFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id, cNvPr_id, 
XML_name, shapeName);
 AddExtLst(mpFS, xPropSet);
 mpFS->endElementNS(mnXmlNamespace, XML_cNvPr);
 mpFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1");
@@ -2696,7 +2697,36 @@ void ShapeExport::WriteMathShape(Reference 
const& xShape)
 mpFS->endElementNS(mnXmlNamespace, XML_sp);
 mpFS->endElementNS(XML_mc, XML_Choice);
 mpFS->startElementNS(XML_mc, XML_Fallback);
-// TODO: export bitmap shape as fallback
+
+svt::EmbeddedObjectRef ref(
+
xPropSet->getPropertyValue(u"EmbeddedObject"_ustr).query(),
+embed::Aspects::MSOLE_CONTENT);
+if (auto* graphic = ref.GetGraphic(); graphic && graphic->GetType() != 
GraphicType::NONE)
+{
+if (OUString r_id = writeGraphicToStorage(*graphic); !r_id.isEmpty())
+{
+mpFS->startElementNS(mnXmlNamespace, XML_sp);
+mpFS->startElementNS(mnXmlNamespace, XML_nvSpPr);
+mpFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id, cNvPr_id, 
XML_name, shapeName);
+AddExtLst(mpFS, xPropSet);
+mpFS->endElementNS(mnXmlNamespace, XML_cNvPr);
+mpFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1");
+mpFS->singleElementNS(mnXmlNamespace, XML_nvPr);
+mpFS->endElementNS(mnXmlNamespace, XML_nvSpPr);
+mpFS->startElementNS(mnXmlNamespace, XML_spPr);
+WriteShapeTransformation(xShape, XML_a);
+WritePresetShape("rect"_ostr);
+mpFS->startElementNS(XML_a, XML_blipFill);
+mpFS->singleElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), 
r_id);
+mpFS->startElementNS(XML_a, XML_stretch);
+mpFS->singleElementNS(XML_a, XML_fillRect);
+mpFS->endElementNS(XML_a, XML_stretch);
+mpFS->endElementNS(XML_a, XML_blipFill);
+mpFS->endElementNS(mnXmlNamespace, XML_spPr);
+mpFS->endElementNS(mnXmlNamespace, XML_sp);
+}
+}
+
 mpFS->endElementNS(XML_mc, XML_Fallback);
 mpFS->endElementNS(XML_mc, XML_AlternateContent);
 }
diff --git a/sd/qa/unit/data/odp/formula.fodp b/sd/qa/unit/data/odp/formula.fodp
new file mode 100644
index ..67ae72f4f3a9
--- /dev/null
+++ b/sd/qa/unit/data/odp/formula.fodp
@@ -0,0 +1,41 @@
+
+
+http://www.w3.org/1998/Math/MathML"; office:version="1.4" 
office:mimetype="application/vnd.oasis.opendocument.presentation">
+ 
+ 
+ 
+  
+   
+  
+ 
+ 
+  
+   
+
+ 
+  http://www.w3.org/1998/Math/MathML"; displ

core.git: oox/source

2024-11-25 Thread Caolán McNamara (via logerrit)
 oox/source/vml/vmldrawing.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 1c49a6d5aab168ca02fdda6d2c27d4ca1fa152f6
Author: Caolán McNamara 
AuthorDate: Sat Nov 23 19:37:27 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 25 11:28:56 2024 +0100

cid#1607224 Overflowed return value

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

diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index c44b9e426119..69b0557c173b 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -235,7 +235,6 @@ sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view 
rShapeId ) const
 sal_Int32 nBlockId = (nShapeId - 1) / 1024;
 BlockIdVector::iterator aIt = ::std::lower_bound( maBlockIds.begin(), 
maBlockIds.end(), nBlockId );
 sal_Int32 nIndex = static_cast< sal_Int32 >( aIt - maBlockIds.begin() );
-assert(nIndex < std::numeric_limits::max() / 1024 -1 && 
"possible overflow");
 
 // block id not found in set -> register it now (value of nIndex remains 
valid)
 if( (aIt == maBlockIds.end()) || (*aIt != nBlockId) )
@@ -245,7 +244,13 @@ sal_Int32 Drawing::getLocalShapeIndex( std::u16string_view 
rShapeId ) const
 sal_Int32 nBlockOffset = (nShapeId - 1) % 1024 + 1;
 
 // calculate the local shape index
-return 1024 * nIndex + nBlockOffset;
+sal_Int32 nRet;
+if (o3tl::checked_add(1024 * nIndex, nBlockOffset, nRet))
+{
+SAL_WARN("oox", "getLocalShapeIndex: overflow on " << 1024 * nIndex << 
" + " << nBlockOffset);
+nRet = -1;
+}
+return nRet;
 }
 
 const OleObjectInfo* Drawing::getOleObjectInfo( const OUString& rShapeId ) 
const


core.git: oox/source

2024-11-24 Thread Caolán McNamara (via logerrit)
 oox/source/vml/vmlformatting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6272747e0668e98c818c1830ae6d25186e6e649d
Author: Caolán McNamara 
AuthorDate: Tue Nov 12 12:34:38 2024 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 24 16:40:18 2024 +0100

cid#1607832 Overflowed constant

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

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 3eefc8abd090..fa8dd5dc47f7 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -957,7 +957,7 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, 
const GraphicHelper&
 ? nOffsetY < 0 ? table::ShadowLocation_TOP_LEFT : 
table::ShadowLocation_BOTTOM_LEFT
 : nOffsetY < 0 ? table::ShadowLocation_TOP_RIGHT : 
table::ShadowLocation_BOTTOM_RIGHT;
 // The width of the shadow is the average of the x and y values, see 
SwWW8ImplReader::MatchSdrItemsIntoFlySet().
-aFormat.ShadowWidth = ((std::abs(nOffsetX) + std::abs(nOffsetY)) / 2);
+aFormat.ShadowWidth = 
std::min(o3tl::saturating_add(std::abs(nOffsetX), 
std::abs(nOffsetY)) / 2, SHRT_MAX);
 rPropMap.setProperty(PROP_ShadowFormat, aFormat);
 }
 


core.git: oox/source

2024-11-20 Thread Caolán McNamara (via logerrit)
 oox/source/core/xmlfilterbase.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b5c5b51e7561624f46c34ec1c1b024269b92739b
Author: Caolán McNamara 
AuthorDate: Tue Nov 19 08:47:00 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 20 09:33:28 2024 +0100

use TOOLS_WARN_EXCEPTION to get exception details

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

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 2f5c7a84d72a..38a51cc4b2d4 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -420,8 +421,7 @@ bool XmlFilterBase::importFragment( const 
rtl::Reference& rxHan
 }
 catch( Exception& )
 {
-OSL_FAIL( OStringBuffer( "XmlFilterBase::importFragment - XML 
parser failed in fragment '"  +
- OUStringToOString( aFragmentPath, 
RTL_TEXTENCODING_ASCII_US ) + "'" ).getStr() );
+TOOLS_WARN_EXCEPTION("oox", "XmlFilterBase::importFragment - XML 
parser failed in fragment '" << aFragmentPath << "'" );
 }
 }
 catch( Exception& )


core.git: oox/source

2024-11-18 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/chart/typegroupconverter.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 7a1ab3f0a3c4545b35cf4cc4e3d71b791053350d
Author: Xisco Fauli 
AuthorDate: Mon Nov 18 21:03:10 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Nov 18 22:40:54 2024 +0100

tdf#163486: PVS: reference may become invalid

V758The 'aModel' reference becomes invalid when smart pointer returned 
by a function is destroyed.

Change-Id: If06b81fda6fdaf4debf5061dd0e3c6c7caccad5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176742
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx 
b/oox/source/drawingml/chart/typegroupconverter.cxx
index 7a8a506af82b..9127e7d47006 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -303,16 +303,17 @@ Reference< XLabeledDataSequence > 
TypeGroupConverter::createCategorySequence()
 if( !xLabeledSeq.is() && !mrModel.maSeries.empty() ) {
 if( nMaxValues < 0 )
 nMaxValues = 2;
-SeriesModel &aModel = *mrModel.maSeries.get(0);
-if (!aModel.maSources.has(SeriesModel::CATEGORIES))
+typedef RefVector SeriesModelVector;
+SeriesModelVector::value_type aModel = mrModel.maSeries.get(0);
+if (!aModel->maSources.has(SeriesModel::CATEGORIES))
 {
-DataSourceModel &aSrc = aModel.maSources.create( 
SeriesModel::CATEGORIES );
+DataSourceModel &aSrc = aModel->maSources.create( 
SeriesModel::CATEGORIES );
 DataSequenceModel &aSeq = aSrc.mxDataSeq.create();
 aSeq.mnPointCount = nMaxValues;
 for( sal_Int32 i = 0; i < nMaxValues; i++ )
 aSeq.maData[ i ] <<= OUString::number( i + 1 );
 }
-SeriesConverter aSeriesConv( *this,  aModel );
+SeriesConverter aSeriesConv( *this,  *aModel );
 xLabeledSeq = aSeriesConv.createCategorySequence( u"categories"_ustr );
 }
 return xLabeledSeq;


core.git: oox/source

2024-11-13 Thread Xisco Fauli (via logerrit)
 oox/source/shape/ShapeContextHandler.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 97cb43c001ffa7811d05150b86902bff8323c2d7
Author: Xisco Fauli 
AuthorDate: Wed Nov 13 16:23:13 2024 +0100
Commit: Xisco Fauli 
CommitDate: Wed Nov 13 20:12:06 2024 +0100

tdf#163486: PVS: variable is used after being declared

Since
commit d4087b13fa278bd63f229a290dd12bda6392e77c
Author: Rüdiger Timm 
Date:   Fri Apr 18 13:32:32 2008 +

INTEGRATION: CWS xmlfilter04 (1.2.12); FILE MERGED

V614The 'pMasterShape' smart pointer is utilized immediately after 
being declared or reset. It is suspicious that no value was assigned to it. 
Consider checking the second actual argument of the 
'GraphicalObjectFrameContext' function.

Change-Id: I3d4241e8c88ee80c95a93d0e08d5498d87e7853b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176551
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 7f8ec35c7350..e34f5be34700 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -167,19 +167,18 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 
Element )
 if (! mxGraphicShapeContext.is())
 {
 auto pFragmentHandler = 
std::make_shared(*mxShapeFilterBase, 
msRelationFragmentPath);
-ShapePtr pMasterShape;
 
 switch (Element & 0x)
 {
 case XML_graphic:
 mpShape = 
std::make_shared("com.sun.star.drawing.GraphicObjectShape" );
 mxGraphicShapeContext.set
-(new GraphicalObjectFrameContext(*pFragmentHandler, 
pMasterShape, mpShape, true));
+(new GraphicalObjectFrameContext(*pFragmentHandler, nullptr, 
mpShape, true));
 break;
 case XML_pic:
 mpShape = 
std::make_shared("com.sun.star.drawing.GraphicObjectShape" );
 mxGraphicShapeContext.set
-(new GraphicShapeContext(*pFragmentHandler, pMasterShape, 
mpShape));
+(new GraphicShapeContext(*pFragmentHandler, nullptr, mpShape));
 break;
 default:
 break;


core.git: oox/source

2024-11-13 Thread Xisco Fauli (via logerrit)
 oox/source/export/DMLPresetShapeExport.cxx |   10 --
 1 file changed, 10 deletions(-)

New commits:
commit 6923fa7a92bd8f33b46be5e5ef6ff44362de435a
Author: Xisco Fauli 
AuthorDate: Wed Nov 13 16:02:35 2024 +0100
Commit: Xisco Fauli 
CommitDate: Wed Nov 13 20:11:37 2024 +0100

tdf#163486: PVS: identical conditional expressions

Since
commit 63cd67e5e18f01aca303131e148c80398a181a41
Author: Attila Bakos (NISZ) 
Date:   Fri May 14 13:53:32 2021 +0200

tdf#92525 tdf#142398: fix export of simple custom shapes

V649There are two 'if' statements with identical conditional 
expressions. The first 'if' statement contains function return. This means that 
the second 'if' statement is senseless. Check lines: 733, 738.

Change-Id: I92bff7ef8472c1774e6def78c5f1a165ea6a0153
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176550
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins

diff --git a/oox/source/export/DMLPresetShapeExport.cxx 
b/oox/source/export/DMLPresetShapeExport.cxx
index c77cbd3fcd5b..3e383ac13d8b 100644
--- a/oox/source/export/DMLPresetShapeExport.cxx
+++ b/oox/source/export/DMLPresetShapeExport.cxx
@@ -735,11 +735,6 @@ bool DMLPresetShapeExporter::WriteShapeWithAVlist()
 // Does not have handle points, so preset enough.
 return false;
 }
-if (sShapeType == "flowChartDecision")
-{
-// Does not have handle points, so preset enough.
-return false;
-}
 if (sShapeType == "flowChartDelay")
 {
 // Does not have handle points, so preset enough.
@@ -825,11 +820,6 @@ bool DMLPresetShapeExporter::WriteShapeWithAVlist()
 // Does not have handle points, so preset enough.
 return false;
 }
-if (sShapeType == "flowChartDecision")
-{
-// Does not have handle points, so preset enough.
-return false;
-}
 if (sShapeType == "flowChartPredefinedProcess")
 {
 // Does not have handle points, so preset enough.


core.git: oox/source

2024-11-12 Thread Caolán McNamara (via logerrit)
 oox/source/vml/vmlshape.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit e6e85bf47b2e62d3af61374eb771a102eb7282fc
Author: Caolán McNamara 
AuthorDate: Mon Nov 11 11:13:01 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Nov 12 12:53:38 2024 +0100

cid#1606989 Overflowed constant

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

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e201a80686af..1f5a8f27c59e 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -208,10 +208,16 @@ awt::Rectangle ShapeType::getAbsRectangle() const
 if (nLeft == 0 && maTypeModel.maPosition == "absolute")
 nLeft = 1;
 
-return awt::Rectangle(
-nLeft,
-ConversionHelper::decodeMeasureToHmm( rGraphicHelper, 
maTypeModel.maTop, 0, false, true ) + ConversionHelper::decodeMeasureToHmm( 
rGraphicHelper, maTypeModel.maMarginTop, 0, false, true ),
-nWidth, nHeight );
+sal_Int32 nTop;
+if 
(o3tl::checked_add(ConversionHelper::decodeMeasureToHmm(rGraphicHelper,
 maTypeModel.maTop, 0, false, true),
+ 
ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maMarginTop, 
0, false, true),
+ nTop))
+{
+SAL_WARN("oox", "overflow in addition");
+nTop = 0;
+}
+
+return awt::Rectangle(nLeft, nTop, nWidth, nHeight);
 }
 
 awt::Rectangle ShapeType::getRelRectangle() const


core.git: oox/source

2024-11-11 Thread Bogdan Buzea (via logerrit)
 oox/source/ppt/timenodelistcontext.cxx |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 27805424cc880433595a749a36c4bd61a10b2f75
Author: Bogdan Buzea 
AuthorDate: Sat Oct 19 19:40:52 2024 +0200
Commit: David Gilbert 
CommitDate: Tue Nov 12 01:23:05 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 544, 
552
V1037 Two or more case-branches perform the same actions. Check lines: 923, 
929
V1037 Two or more case-branches perform the same actions. Check lines: 993, 
1001

Change-Id: I373ccdb56bee8d446e2aec3295ba9c0fb23ff82a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175229
Reviewed-by: David Gilbert 
Tested-by: Jenkins

diff --git a/oox/source/ppt/timenodelistcontext.cxx 
b/oox/source/ppt/timenodelistcontext.cxx
index 81168d91ffa1..9ae108592612 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -540,12 +540,10 @@ namespace oox::ppt {
 sal_Int16 nEnum = 0;
 switch(nCalcMode)
 {
-case XML_discrete:
-nEnum = AnimationCalcMode::DISCRETE;
-break;
 case XML_lin:
 nEnum = AnimationCalcMode::LINEAR;
 break;
+case XML_discrete:
 case XML_fmla:
 default:
 // TODO what value is good ?
@@ -919,12 +917,10 @@ namespace oox::ppt {
 case PPT_TOKEN( animClr ):
 pCtx = new AnimColorContext( rParent, aElement, xAttribs, pNode );
 break;
-case PPT_TOKEN( par ):
-pCtx = new ParallelExclTimeNodeContext( rParent, aElement, pNode );
-break;
 case PPT_TOKEN( seq ):
 pCtx = new SequenceTimeNodeContext( rParent, aElement, xAttribs, 
pNode );
 break;
+case PPT_TOKEN( par ):
 case PPT_TOKEN( excl ):
 pCtx = new ParallelExclTimeNodeContext( rParent, aElement, pNode );
 break;
@@ -989,12 +985,10 @@ namespace oox::ppt {
 
 switch( aElementToken )
 {
-case PPT_TOKEN( par ):
-nNodeType = AnimationNodeType::PAR;
-break;
 case PPT_TOKEN( seq ):
 nNodeType = AnimationNodeType::SEQ;
 break;
+case PPT_TOKEN( par ):
 case PPT_TOKEN( excl ):
 // TODO pick the right type. We choose parallel for now as
 // there does not seem to be an "Exclusive"


core.git: oox/source

2024-10-29 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/graphicshapecontext.cxx |2 +-
 oox/source/drawingml/misccontexts.cxx|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 01b6f6936dbd1a6563aa071d5856f53f16e40b1a
Author: Caolán McNamara 
AuthorDate: Mon Oct 28 20:38:57 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Oct 29 09:25:43 2024 +0100

cid#1556968 COPY_INSTEAD_OF_MOVE

and

cid#1557514 COPY_INSTEAD_OF_MOVE

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

diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index 85de7df3fffc..9acdc6b54e16 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -99,7 +99,7 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( 
sal_Int32 aElementToken,
 Reference xMediaStream = 
lcl_GetMediaStream(rPath, getFilter());
 if (xMediaStream.is()) // embedded media file
 {
-mpShapePtr->getGraphicProperties().m_xMediaStream = 
xMediaStream;
+mpShapePtr->getGraphicProperties().m_xMediaStream = 
std::move(xMediaStream);
 mpShapePtr->getGraphicProperties().m_sMediaPackageURL
 = lcl_GetMediaReference(rPath);
 }
diff --git a/oox/source/drawingml/misccontexts.cxx 
b/oox/source/drawingml/misccontexts.cxx
index e080f3840e90..ccbff30df1a3 100644
--- a/oox/source/drawingml/misccontexts.cxx
+++ b/oox/source/drawingml/misccontexts.cxx
@@ -306,7 +306,7 @@ BlipContext::BlipContext(ContextHandler2Helper const & 
rParent, const AttributeL
 auto xGraphic = 
getFilter().getGraphicHelper().importEmbeddedGraphic(aFragmentPath);
 mrBlipProps.mxFillGraphic = xGraphic;
 if (mpBlipFill)
-mpBlipFill->mxGraphic = xGraphic;
+mpBlipFill->mxGraphic = std::move(xGraphic);
 }
 }
 else if( rAttribs.hasAttribute( R_TOKEN( link ) ) )


core.git: oox/source

2024-10-26 Thread Bogdan Buzea (via logerrit)
 oox/source/ppt/slidetransitioncontext.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 3c9715a64c6552f3b4e920a435fa1ad10489882b
Author: Bogdan Buzea 
AuthorDate: Sun Oct 20 21:33:34 2024 +0200
Commit: David Gilbert 
CommitDate: Sun Oct 27 01:21:56 2024 +0200

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 83, 
99

Change-Id: Ibe913d3662bb7cb731dd55327c0df4182b328b69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175272
Reviewed-by: David Gilbert 
Tested-by: Jenkins

diff --git a/oox/source/ppt/slidetransitioncontext.cxx 
b/oox/source/ppt/slidetransitioncontext.cxx
index e3e77cbeb6a9..a3ad670a676d 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -80,6 +80,8 @@ SlideTransitionContext::~SlideTransitionContext() noexcept
 return this;
 case PPT_TOKEN( cover ):
 case PPT_TOKEN( pull ):
+case PPT_TOKEN( push ):
+case PPT_TOKEN( wipe ):
 if (!mbHasTransition)
 {
 mbHasTransition = true;
@@ -94,14 +96,6 @@ SlideTransitionContext::~SlideTransitionContext() noexcept
 maTransition.setOoxTransitionType( aElementToken, 
sal_Int32(rAttribs.getBool( XML_thruBlk, false )), 0);
 }
 return this;
-case PPT_TOKEN( push ):
-case PPT_TOKEN( wipe ):
-if (!mbHasTransition)
-{
-mbHasTransition = true;
-maTransition.setOoxTransitionType( aElementToken, 
rAttribs.getToken( XML_dir, XML_l ), 0 );
-}
-return this;
 case PPT_TOKEN( split ):
 if (!mbHasTransition)
 {


core.git: oox/source

2024-10-23 Thread Bogdan Buzea (via logerrit)
 oox/source/crypto/CryptTools.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit d3dd616f563e2cb32fa1e9ba983509096548e95f
Author: Bogdan Buzea 
AuthorDate: Tue Oct 22 19:55:29 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 23 11:50:06 2024 +0200

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 289, 
293

Change-Id: I9828b4d5b7faca449c5377a0bd8223cddf883a43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175423
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx
index e8e842abeb43..a7d76b375c39 100644
--- a/oox/source/crypto/CryptTools.cxx
+++ b/oox/source/crypto/CryptTools.cxx
@@ -286,9 +286,6 @@ struct CryptoImpl
 mechanism = CKM_AES_ECB;
 break;
 case Crypto::CryptoType::AES_128_CBC:
-mechanism = CKM_AES_CBC;
-pIvItem = &ivItem;
-break;
 case Crypto::CryptoType::AES_256_CBC:
 mechanism = CKM_AES_CBC;
 pIvItem = &ivItem;


core.git: oox/source

2024-10-18 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 70b9a979dda072ddfe2d458d62396d853cd1f9cc
Author: Xisco Fauli 
AuthorDate: Fri Oct 18 14:53:19 2024 +0200
Commit: Xisco Fauli 
CommitDate: Fri Oct 18 16:20:57 2024 +0200

tdf#163486: PVS: check can be simplified

V728An excessive check can be simplified. The '||' operator is 
surrounded by opposite expressions '!p3DProperties' and 'p3DProperties'.

Change-Id: Iab3da21332f50a7414edff7283659106aa8d22e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175134
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index ce8296050db6..7ad926b4bbf2 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -388,7 +388,7 @@ bool Scene3DHelper::setExtrusionProperties(const 
oox::drawingml::Shape3DProperti
 // all cases.
 rRotZ = basegfx::deg2rad<6>(-rnMSOShapeRotation);
 
-if (!p3DProperties || (p3DProperties && 
!(*p3DProperties).mnPreset.has_value()))
+if (!p3DProperties || !(*p3DProperties).mnPreset.has_value())
 return false;
 
 const sal_Int32 nCameraPrstID((*p3DProperties).mnPreset.value());
@@ -878,7 +878,7 @@ void lcl_tweakLightRig(std::vector& 
rLightDirVec, PrstLightR
 void Scene3DHelper::setLightingProperties(const 
oox::drawingml::Shape3DPropertiesPtr p3DProperties,
   const double& rfRotZ, 
oox::PropertyMap& rPropertyMap)
 {
-if (!p3DProperties || (p3DProperties && 
!(*p3DProperties).mnLightRigType.has_value()))
+if (!p3DProperties || !(*p3DProperties).mnLightRigType.has_value())
 return;
 
 // get index of light rig in aPrstLightRigValuesArray


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

2024-10-16 Thread Balazs Varga (via logerrit)
 oox/source/drawingml/shape.cxx |   40 ++
 sd/qa/unit/data/xml/n762695_1.xml  |4 -
 sd/qa/unit/data/xml/n820786_0.xml  |4 -
 sd/qa/unit/data/xml/tdf90338_0.xml |2 
 sd/qa/unit/data/xml/tdf92001_0.xml |2 
 sd/source/ui/view/drtxtob1.cxx |   82 +++--
 6 files changed, 89 insertions(+), 45 deletions(-)

New commits:
commit 1d9ce0a67a71e51569cd33c26270eeece587a354
Author: Balazs Varga 
AuthorDate: Sun Oct 13 20:58:17 2024 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Oct 16 20:19:58 2024 +0200

tdf#162571 - sd: Text box expands or shrinks on left or right or

both sides, depending on the text alignment. Set the text anchor
position based on the first paragraph alignment.

WIP: testing...

Change-Id: Ie1588c3eab5dd24eddb20baf342aca57c0dd39fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174885
Reviewed-by: Gabor Kelemen 
Tested-by: Jenkins
Tested-by: Gabor Kelemen 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 56e04caadbf1..f01c4b90a7a6 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -616,6 +617,16 @@ static SdrTextHorzAdjust lcl_convertAdjust( 
ParagraphAdjust eAdjust )
 return SDRTEXTHORZADJUST_LEFT;
 }
 
+static TextHorizontalAdjust lcl_convertTextAdjust(ParagraphAdjust eAdjust)
+{
+if (eAdjust == ParagraphAdjust_LEFT)
+return drawing::TextHorizontalAdjust_LEFT;
+else if (eAdjust == ParagraphAdjust_RIGHT)
+return drawing::TextHorizontalAdjust_RIGHT;
+else
+return drawing::TextHorizontalAdjust_BLOCK;
+}
+
 // LO does not interpret properties in styles belonging to the text content of 
a FontWork shape,
 // but only those in the shape style. This method copies properties from the 
text content styles to
 // the shape style.
@@ -1508,6 +1519,35 @@ Reference< XShape > const & Shape::createAndInsert(
 }
 }
 
+// tdf#162571: In case of shapes with TextAutoGrowHeight, PP 
calculates/grow the
+// shapes size in edit mode (typing) based on the text horizontal 
alignment.
+// In LO, we simulate it by setting TextHorizontalAdjust based on 
the ParagraphAdjust
+// of the 1. paragraph
+// It is not perfect, because we have 1 TextHorizontalAdjust / 1 
shape,
+// while we can have many ParagraphAdjust / 1 shape
+if 
(!mpTextBody->getTextProperties().maPropertyMap.hasProperty(PROP_WritingMode)
+&& mpTextBody->getParagraphs().size() > 0)
+{
+std::optional& oParaAdjust
+= 
mpTextBody->getParagraphs()[0]->getProperties().getParaAdjust();
+
+bool bAutoHeight = false;
+Reference< XPropertySetInfo > 
xSetInfo(xSet->getPropertySetInfo());
+const OUString& rPropName = 
PropertyMap::getPropertyName(PROP_TextAutoGrowHeight);
+if (xSetInfo.is() && xSetInfo->hasPropertyByName(rPropName))
+{
+uno::Any aTextAutoGrowHeight = 
xSet->getPropertyValue(u"TextAutoGrowHeight"_ustr);
+aTextAutoGrowHeight >>= bAutoHeight;
+}
+
+if (bAutoHeight && nShapeRotateInclCamera == 0)
+{
+mpTextBody->getTextProperties().maPropertyMap.setProperty(
+PROP_TextHorizontalAdjust, lcl_convertTextAdjust(
+oParaAdjust ? *oParaAdjust : 
ParagraphAdjust_LEFT));
+}
+}
+
 
mpTextBody->getTextProperties().pushTextDistances(Size(aShapeRectHmm.Width, 
aShapeRectHmm.Height));
 aShapeProps.assignUsed( 
mpTextBody->getTextProperties().maPropertyMap );
 // Push char properties as well - specifically useful when this is 
a placeholder
diff --git a/sd/qa/unit/data/xml/n762695_1.xml 
b/sd/qa/unit/data/xml/n762695_1.xml
index 02d3b735da86..8cd404c575be 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -1,6 +1,6 @@
 
 
- 
+ 
   
   
   
@@ -85,7 +85,7 @@

   
  
- 
+ 
   
   
   
diff --git a/sd/qa/unit/data/xml/n820786_0.xml 
b/sd/qa/unit/data/xml/n820786_0.xml
index 4b2e06b3f347..fee4d9667e52 100644
--- a/sd/qa/unit/data/xml/n820786_0.xml
+++ b/sd/qa/unit/data/xml/n820786_0.xml
@@ -64,7 +64,7 @@
  
  
   
-   
+   
 
 
 
@@ -148,7 +148,7 @@
  
 

-   
+   
 
 
 
diff --git a/sd/qa/unit/data/xml/tdf90338_0.xml 
b/sd/qa/unit/data/xml/tdf90338_0.xml
index 741d6ca08071..792eca6f4cf1 100644
--- a/sd/qa/unit/data/xml/tdf90338_0.xml
+++ b/sd/qa/unit/data/xml/tdf90338_0.xml
@@ -1,6 +1,6 @@
 
 
- 
+ 
   
   
   
diff --git a/sd/qa/unit/data/xml/tdf92001_0.xml 
b/sd/qa/unit/data/xml/tdf92001_0.xml
index

core.git: oox/source

2024-09-12 Thread Mike Kaganski (via logerrit)
 oox/source/core/contexthandler2.cxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 976567aee323afd09629b6adf13537908f43d2a8
Author: Mike Kaganski 
AuthorDate: Thu Sep 12 06:54:14 2024 +0200
Commit: Mike Kaganski 
CommitDate: Thu Sep 12 10:09:36 2024 +0200

Simplify a bit

Change-Id: Id46a5029ce86f20ffae34aa6495d7311044999a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173177
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/core/contexthandler2.cxx 
b/oox/source/core/contexthandler2.cxx
index af25fc95843e..5c4ab66987ab 100644
--- a/oox/source/core/contexthandler2.cxx
+++ b/oox/source/core/contexthandler2.cxx
@@ -230,17 +230,15 @@ bool ContextHandler2Helper::prepareMceContext( sal_Int32 
nElement, const Attribu
 break;
 
 case MCE_TOKEN( Choice ):
+if (!isMCEStateEmpty() && getMCEState() == MCE_STATE::Started)
 {
-if (isMCEStateEmpty() || getMCEState() != MCE_STATE::Started)
-return false;
-
-OUString aRequires = rAttribs.getString( XML_Requires, 
u"none"_ustr );
+OUString aRequires = rAttribs.getStringDefaulted(XML_Requires);
 
 // At this point we can't access namespaces as the correct xml 
filter
 // is long gone. For now let's decide depending on a list of 
supported
 // namespaces like we do in writerfilter
 
-std::u16string_view aSupportedNS[] =
+static constexpr std::u16string_view aSupportedNS[] =
 {
 // u"a14", // We do not currently support inline formulas 
and other a14 stuff
 u"p14",
@@ -258,8 +256,9 @@ bool ContextHandler2Helper::prepareMceContext( sal_Int32 
nElement, const Attribu
 }
 
 setMCEState( MCE_STATE::FoundChoice ) ;
+break;
 }
-break;
+return false;
 
 case MCE_TOKEN( Fallback ):
 if( !isMCEStateEmpty() && getMCEState() == MCE_STATE::Started )


core.git: oox/source sd/qa

2024-09-11 Thread Mike Kaganski (via logerrit)
 dev/null|binary
 oox/source/core/contexthandler2.cxx |   31 ++-
 sd/qa/unit/data/odp/Math.fodp   |   70 
 sd/qa/unit/export-tests-ooxml2.cxx  |6 +--
 sd/qa/unit/export-tests-ooxml4.cxx  |2 -
 5 files changed, 87 insertions(+), 22 deletions(-)

New commits:
commit 7cfff4751befd678b3db4b6f16b020d38f4e9c32
Author: Mike Kaganski 
AuthorDate: Wed Sep 11 12:57:25 2024 +0500
Commit: Mike Kaganski 
CommitDate: Wed Sep 11 15:50:01 2024 +0200

Related: tdf#129061 Avoid formula import and use fallback for now

Until we support the correct inline formulas, their import fails badly
in Impress, because we completely lose them in boxes with other content,
and even where they are the sole content, they stretch to the size of
the box incorrectly.

Commit 4038d6c393c3cf6330671124ba69cdba98b24960 (tdf#117658 PPTX import:
fix duplicated math object handling, 2019-11-13) opted to enable the
Choice variant from the AlternateContent representing formula boxes.
This change switches to Fallback graphic, losing the option to edit
standalone imported formulas, but instead, allowing to see the formulas
as they were created in PowerPoint.

Unit test in sd/qa/unit/export-tests-ooxml2.cxx, created in commit
331a0a347e2ed238ff41c8cd7815b946cc95ac0f (starmath: fix OOXML export
of non-BMP Unicode, 2016-01-21) was changed, because it depended on
importing the formula from PPTX, which is disabled here. Since it
was fixing the export part, the FODP source seems to be a reasonable
replacement.

Change-Id: Ibd0e2bcd68296020c3bc057cb6a563918926cf2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173163
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/core/contexthandler2.cxx 
b/oox/source/core/contexthandler2.cxx
index bfadacb4bcda..af25fc95843e 100644
--- a/oox/source/core/contexthandler2.cxx
+++ b/oox/source/core/contexthandler2.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -239,30 +240,24 @@ bool ContextHandler2Helper::prepareMceContext( sal_Int32 
nElement, const Attribu
 // is long gone. For now let's decide depending on a list of 
supported
 // namespaces like we do in writerfilter
 
-std::vector aSupportedNS =
+std::u16string_view aSupportedNS[] =
 {
-u"a14"_ustr, // Impress needs this to import math formulas.
-u"p14"_ustr,
-u"p15"_ustr,
-u"x12ac"_ustr,
-u"v"_ustr
+// u"a14", // We do not currently support inline formulas 
and other a14 stuff
+u"p14",
+u"p15",
+u"x12ac",
+u"v"
 };
 
-Reference xModel(getDocFilter().getModel(), 
UNO_QUERY);
-if (xModel.is() && 
xModel->supportsService(u"com.sun.star.sheet.SpreadsheetDocument"_ustr))
+for (size_t pos = 0; pos != std::u16string_view::npos;)
 {
-// No a14 for Calc documents, it would cause duplicated 
shapes as-is.
-auto it = std::find(aSupportedNS.begin(), 
aSupportedNS.end(), "a14");
-if (it != aSupportedNS.end())
-{
-aSupportedNS.erase(it);
-}
+// 'Requires' is a space-separated list
+auto ns = o3tl::getToken(aRequires, u' ', pos);
+if (!ns.empty() && std::find(std::begin(aSupportedNS), 
std::end(aSupportedNS), ns) == std::end(aSupportedNS))
+return false;
 }
 
-if (std::find(aSupportedNS.begin(), aSupportedNS.end(), 
aRequires) != aSupportedNS.end())
-setMCEState( MCE_STATE::FoundChoice ) ;
-else
-return false;
+setMCEState( MCE_STATE::FoundChoice ) ;
 }
 break;
 
diff --git a/sd/qa/unit/data/odp/Math.fodp b/sd/qa/unit/data/odp/Math.fodp
new file mode 100644
index ..676fc84475a2
--- /dev/null
+++ b/sd/qa/unit/data/odp/Math.fodp
@@ -0,0 +1,70 @@
+
+
+
+ 
+  
+  
+ 
+ 
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+   
+   
+   
+   
+   
+  
+  
+ 
+ 
+  
+   
+
+ 
+  http://www.w3.org/1998/Math/MathML"; display="block">
+   
+
+ 
+  
+   𝑎
+   2
+  
+  +
+  
+   𝑏
+   2
+  
+ 
+ =
+ 
+  𝑐
+  2
+ 
+
+   
+  
+ 
+
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sd/qa/unit/data/pptx/Math.pptx b/sd/qa/un

core.git: oox/source sd/qa

2024-09-11 Thread Balazs Varga (via logerrit)
 oox/source/drawingml/table/tablecell.cxx |4 ++--
 sd/qa/unit/data/pptx/tdf149865.pptx  |binary
 sd/qa/unit/import-tests.cxx  |   22 ++
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 070682854800cb983b452a5b5bd16943433c4b2b
Author: Balazs Varga 
AuthorDate: Mon Sep 9 16:19:14 2024 +0200
Commit: Balazs Varga 
CommitDate: Wed Sep 11 12:28:06 2024 +0200

tdf#149865 - FILEOPEN PPTX: fix table lacks border

Fix wrong border line styles if we have merged cells.

Change-Id: I238aa08c65b9aefd7b77b0f4ae3c3df979a7171d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173109
Reviewed-by: Balazs Varga 
Tested-by: Jenkins

diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 2784ea818eb2..21948145e1d2 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -202,11 +202,11 @@ static void applyTableStylePart( const 
::oox::core::XmlFilterBase& rFilterBase,
 {
 if (nCol == 0)
 applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
-if (nCol == nMaxCol)
+if (nCol >= nMaxCol)
 applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder 
);
 if (nRow == 0)
 applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
-if (nRow == nMaxRow)
+if (nRow >= nMaxRow)
 applyBorder( rFilterBase, rTableStylePart, XML_bottom, 
rBottomBorder );
 
 applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder 
);
diff --git a/sd/qa/unit/data/pptx/tdf149865.pptx 
b/sd/qa/unit/data/pptx/tdf149865.pptx
new file mode 100644
index ..3b5a0cbb8f7a
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149865.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 220bf3e30342..6e6cd651d3b9 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1653,6 +1653,28 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, 
testTableBorderLineStyle)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest, testTableMergedCellsBorderLineStyle)
+{
+createSdImpressDoc("pptx/tdf149865.pptx");
+
+const SdrPage* pPage = GetPage(1);
+
+sdr::table::SdrTableObj* pTableObj;
+uno::Reference xTable;
+uno::Reference xCell;
+table::BorderLine2 aBorderLine;
+
+pTableObj = dynamic_cast(pPage->GetObj(0));
+CPPUNIT_ASSERT(pTableObj);
+xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+xCell.set(xTable->getCellByPosition(4, 1), uno::UNO_QUERY_THROW);
+xCell->getPropertyValue(u"RightBorder"_ustr) >>= aBorderLine;
+table::BorderLine2 expectedRight(0x30ba78, 0, 17, 0, 0, 17);
+CPPUNIT_ASSERT_EQUAL(expectedRight.LineStyle, aBorderLine.LineStyle);
+CPPUNIT_ASSERT_EQUAL(expectedRight.Color, aBorderLine.Color);
+CPPUNIT_ASSERT_EQUAL(expectedRight.LineWidth, aBorderLine.LineWidth);
+}
+
 CPPUNIT_TEST_FIXTURE(SdImportTest, testBnc862510_6)
 {
 // Black text was imported instead of gray


core.git: oox/source xmloff/inc

2024-07-29 Thread Oliver Specht (via logerrit)
 oox/source/vml/vmlshape.cxx |6 +-
 xmloff/inc/xmlprop.hxx  |1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 0d512cb88757ced10a825a3d544e41696a54341a
Author: Oliver Specht 
AuthorDate: Thu May 23 14:59:22 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Jul 30 00:30:05 2024 +0200

tdf#134902 evaluate visibility of VML shapes

VML shapes from docx should be invisible if "visibility:hidden" is set.

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

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index ef177576c342..41bfa084aefb 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -878,7 +878,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 aPropertySet.setAnyProperty(PROP_VertOrientPosition, 
Any(aShapeRect.Y));
 }
 }
-
+if (!maTypeModel.mbVisible)
+{
+aPropertySet.setAnyProperty(PROP_Visible, uno::Any(false));
+aPropertySet.setAnyProperty(PROP_Printable, uno::Any(false));
+}
 // custom shape geometry attributes
 std::vector aPropVec;
 
diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx
index 72ffd69323f4..5b2793f9b2b6 100644
--- a/xmloff/inc/xmlprop.hxx
+++ b/xmloff/inc/xmlprop.hxx
@@ -532,6 +532,7 @@ inline constexpr OUString PROP_PolynomialDegree = 
u"PolynomialDegree"_ustr;
 inline constexpr OUString PROP_PositionProtected = u"PositionProtected"_ustr;
 inline constexpr OUString PROP_PositiveError = u"PositiveError"_ustr;
 inline constexpr OUString PROP_Print = u"Print"_ustr;
+inline constexpr OUString PROP_Printable = u"Printable"_ustr;
 inline constexpr OUString PROP_PrintAnnotations = u"PrintAnnotations"_ustr;
 inline constexpr OUString PROP_PrintCharts = u"PrintCharts"_ustr;
 inline constexpr OUString PROP_PrintDownFirst = u"PrintDownFirst"_ustr;


core.git: oox/source sc/source svgio/source sw/source vcl/source writerperfect/source

2024-07-23 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/customshapepresetdata.cxx   |2 +-
 sc/source/core/data/table6.cxx   |2 +-
 sc/source/core/tool/interpr1.cxx |2 +-
 sc/source/filter/oox/stylesbuffer.cxx|2 +-
 sc/source/ui/Accessibility/AccessibleDocument.cxx|2 +-
 svgio/source/svgreader/svgstyleattributes.cxx|2 +-
 sw/source/core/access/accpara.cxx|2 +-
 vcl/source/bitmap/BitmapEx.cxx   |2 +-
 vcl/source/gdi/print.cxx |2 +-
 writerperfect/source/impress/KeynoteImportFilter.cxx |2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 82b7823cd83be3c31720c8a3b8eea33c22b312bc
Author: Caolán McNamara 
AuthorDate: Mon Jul 22 21:47:33 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 23 09:19:37 2024 +0200

cid#1555070 COPY_INSTEAD_OF_MOVE

and

cid#1555069 COPY_INSTEAD_OF_MOVE
cid#1555128 COPY_INSTEAD_OF_MOVE
cid#1555131 COPY_INSTEAD_OF_MOVE
cid#1555137 COPY_INSTEAD_OF_MOVE
cid#1555142 COPY_INSTEAD_OF_MOVE
cid#1555152 COPY_INSTEAD_OF_MOVE
cid#1555154 COPY_INSTEAD_OF_MOVE
cid#1555161 COPY_INSTEAD_OF_MOVE
cid#1555163 COPY_INSTEAD_OF_MOVE

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

diff --git a/oox/source/drawingml/customshapepresetdata.cxx 
b/oox/source/drawingml/customshapepresetdata.cxx
index b03d583a8cdf..c2872cf1adcc 100644
--- a/oox/source/drawingml/customshapepresetdata.cxx
+++ b/oox/source/drawingml/customshapepresetdata.cxx
@@ -1048,7 +1048,7 @@ void CustomShapeProperties::initializePresetDataMap()
 }
 bNotDone = aStream.ReadLine(aLine);
 }
-maPresetDataMap[TokenMap::getTokenFromUnicode(aName)] = aPropertyMap;
+maPresetDataMap[TokenMap::getTokenFromUnicode(aName)] = 
std::move(aPropertyMap);
 }
 }
 
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 243783c55d2e..e6919485f0f4 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -899,7 +899,7 @@ bool ScTable::SearchAndReplaceEmptyCells(
 
 aNewRanges.push_back(rRange);
 }
-aRanges = aNewRanges;
+aRanges = std::move(aNewRanges);
 }
 
 SvxSearchCmd nCommand = rSearchItem.GetCommand();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 64fc44b382fb..e2f74c19925a 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -484,7 +484,7 @@ void ScInterpreter::ScChooseJump()
 }
 }
 }
-xNew = new ScJumpMatrixToken( pJumpMat );
+xNew = new ScJumpMatrixToken(std::move(pJumpMat));
 GetTokenMatrixMap().emplace(pCur, xNew);
 }
 if (xNew)
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 5f64cf61addb..f19425c9d9dd 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1718,7 +1718,7 @@ void GradientFillModel::readGradientStop( 
SequenceInputStream& rStrm, bool bDxf
 fPosition = rStrm.readDouble();
 }
 if( !rStrm.isEof() && (fPosition >= 0.0) )
-maColors[ fPosition ] = aColor;
+maColors[ fPosition ] = std::move(aColor);
 }
 
 ApiSolidFillData::ApiSolidFillData() :
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 3380d9c7fa41..4ab426a2c36a 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1162,7 +1162,7 @@ void ScChildrenShapes::SetAnchor(const 
uno::Reference& xShape,
 if ((xAddress && pData->xRelationCell && (*xAddress != 
*(pData->xRelationCell))) ||
 (!xAddress && pData->xRelationCell) || (xAddress && 
!pData->xRelationCell))
 {
-pData->xRelationCell = xAddress;
+pData->xRelationCell = std::move(xAddress);
 if (pData->pAccShape.is())
 pData->pAccShape->SetRelationSet(GetRelationSet(pData));
 }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index b5579448492d..95229ddd93bf 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1450,7 +1450,7 @@ namespace svgio::svgreader
 }
 else if(readSvgNumberVector(aContent, aVector))
 {
-maStrokeDasharray = aVector;
+maStrokeDasharray = std::move(aVector);
 }
 }

core.git: oox/source sw/source

2024-06-25 Thread Andrea Gelmini (via logerrit)
 oox/source/core/filterdetect.cxx |2 +-
 sw/source/writerfilter/ooxml/OOXMLStreamImpl.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 52afd5d2679229ffb0f84143fe80b50472cd7e3b
Author: Andrea Gelmini 
AuthorDate: Tue Jun 25 13:22:27 2024 +0200
Commit: Julien Nabet 
CommitDate: Tue Jun 25 13:53:52 2024 +0200

Fix typo

Change-Id: Ic7b080780a924e0d824b3163487c21b6515844b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169513
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index c62ddfedd749..33c95c7e2ca3 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -161,7 +161,7 @@ void FilterDetectDocHandler::parseRelationship( const 
AttributeList& rAttribs )
 Reference xFactory = UriReferenceFactory::create( 
mxContext );
 try
 {
- // use '/' to representent the root of the zip package ( and provide 
a 'file' scheme to
+ // use '/' to represent the root of the zip package ( and provide a 
'file' scheme to
  // keep the XUriReference implementation happy )
  Reference< XUriReference > xBase = xFactory->parse( u"file:///"_ustr 
);
 
diff --git a/sw/source/writerfilter/ooxml/OOXMLStreamImpl.cxx 
b/sw/source/writerfilter/ooxml/OOXMLStreamImpl.cxx
index aa2567ad53b2..6ca6bb85a10b 100644
--- a/sw/source/writerfilter/ooxml/OOXMLStreamImpl.cxx
+++ b/sw/source/writerfilter/ooxml/OOXMLStreamImpl.cxx
@@ -122,7 +122,7 @@ bool OOXMLStreamImpl::lcl_getTarget(const 
uno::Reference xFac = 
uri::UriReferenceFactory::create(mxContext);
-// use '/' to representent the root of the zip package ( and provide a 
'file' scheme to
+// use '/' to represent the root of the zip package ( and provide a 'file' 
scheme to
 // keep the XUriReference implementation happy )
 // add mspath to represent the 'source' of this stream
 uno::Reference xBase = xFac->parse("file:///" + 
msPath);


core.git: oox/source sd/qa

2024-06-22 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/shape.cxx  |   10 +++---
 sd/qa/unit/data/pptx/tdf157529.pptx |binary
 sd/qa/unit/import-tests2.cxx|   25 +
 3 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 513c2bdbb1e7c0ad669d03043db61c94d6524aba
Author: Tibor Nagy 
AuthorDate: Sat Jun 22 11:17:33 2024 +0200
Commit: Nagy Tibor 
CommitDate: Sat Jun 22 21:08:52 2024 +0200

tdf#157529 PPTX import: fix transparency value

if the paragraph, which uses transformation (Arch, Circle, etc.),
contains multiple texts and the first text is only a space character,
then we use the transparency value of the following text.

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

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 2513db943b73..e2fed9eee281 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -646,9 +646,13 @@ static void lcl_copyCharPropsToShape(const 
uno::Reference& xSha
 {
 std::shared_ptr pParagraph = *aParaIt;
 const TextRunVector& rRuns = pParagraph->getRuns();
-auto aRunIt = std::find_if_not(
-rRuns.cbegin(), rRuns.cend(),
-[](const std::shared_ptr pRun) { return 
pRun->getText().isEmpty(); });
+auto aRunIt = std::find_if_not(rRuns.cbegin(), rRuns.cend(),
+   [](const std::shared_ptr pRun)
+   {
+   return pRun->getText().isEmpty()
+  || pRun->getText() == " "
+  || pRun->getText().toChar() 
== 0xA0; // NBSP
+   });
 if (aRunIt != rRuns.cend())
 {
 std::shared_ptr pRun = *aRunIt;
diff --git a/sd/qa/unit/data/pptx/tdf157529.pptx 
b/sd/qa/unit/data/pptx/tdf157529.pptx
new file mode 100644
index ..625777809711
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf157529.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index aa4517fb97f6..c01ae0b8747a 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -77,6 +77,31 @@ protected:
 bool checkPattern(int nShapeNumber, std::vector& rExpected);
 };
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157529)
+{
+createSdImpressDoc("pptx/tdf157529.pptx");
+
+uno::Reference xShape1(getShapeFromPage(0, 0));
+CPPUNIT_ASSERT(xShape1.is());
+sal_Int16 nTransparence1;
+xShape1->getPropertyValue(u"FillTransparence"_ustr) >>= nTransparence1;
+
+// Without the fix in place, this test would have failed with
+// Expected: transparence value: 100%
+// Actual  : transparence value: 0%
+CPPUNIT_ASSERT_EQUAL(sal_Int16(100), nTransparence1);
+
+uno::Reference xShape2(getShapeFromPage(1, 0));
+CPPUNIT_ASSERT(xShape2.is());
+sal_Int16 nTransparence2;
+xShape2->getPropertyValue(u"FillTransparence"_ustr) >>= nTransparence2;
+
+// Without the fix in place, this test would have failed with
+// Expected: transparence value: 100%
+// Actual  : transparence value: 0%
+CPPUNIT_ASSERT_EQUAL(sal_Int16(100), nTransparence2);
+}
+
 CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf160490)
 {
 createSdImpressDoc("pptx/tdf160490.pptx");


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

2024-06-19 Thread Tibor Nagy (via logerrit)
 oox/source/drawingml/shape.cxx  |   48 ++--
 sd/qa/unit/data/pptx/tdf160490.pptx |binary
 sd/qa/unit/data/xml/n819614_0.xml   |2 -
 sd/qa/unit/import-tests2.cxx|   31 ---
 sd/source/ui/unoidl/unopage.cxx |8 +++---
 5 files changed, 73 insertions(+), 16 deletions(-)

New commits:
commit 7e13d34086d67ecfe47db5a85a4877b5ba96f874
Author: Tibor Nagy 
AuthorDate: Wed Jun 19 16:07:13 2024 +0200
Commit: Nagy Tibor 
CommitDate: Wed Jun 19 23:18:59 2024 +0200

tdf#160490 PPTX import: fix automatically resized placeholder height

See also commit Ia7f94d7452d1a1c3f004aebd73b6ed5cbfd9b43b
"tdf#157285 PPTX import: fix placeholder height".

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

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 81abf10cf108..2513db943b73 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1254,14 +1254,48 @@ Reference< XShape > const & Shape::createAndInsert(
 xSet->setPropertyValue(u"Decorative"_ustr, 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(u"TextAutoGrowHeight"_ustr) >>= bAutoGrowHeight;
-if (bAutoGrowHeight && 
mxShape->getShapeType().startsWith("com.sun.star.presentation."))
+// Placeholder uses the height set on the slide instead of the height 
from the master slide,
+// if it has the "TextAutoGrowHeight" property
+if (getTextBody() && 
mxShape->getShapeType().startsWith("com.sun.star.presentation."))
 {
-awt::Size aSize(mxShape->getSize().Width, 0);
-mxShape->setSize(aSize);
+bool bAutoGrowHeight = getTextBody()
+   ->getTextProperties()
+   
.maPropertyMap.getProperty(PROP_TextAutoGrowHeight)
+   .get();
+if (bAutoGrowHeight)
+{
+ppt::PowerPointImport* pPPT = 
dynamic_cast(&rFilterBase);
+if (!pPPT->getActualSlidePersist()->isMasterPage())
+{
+// There is no support for change the shape of the drawing 
in LO, but we check,
+// if the placeholder changes its shape, top and bottom 
margins won't be used.
+bool bIsChangePlaceholderShape
+= 
!mpCustomShapePropertiesPtr->getAdjustmentGuideList().empty();
+
+sal_Int32 nUpper = 0;
+sal_Int32 nLower = 0;
+sal_Int32 nHeight = maSize.Height / 360;
+if (getTextBody()->getTextProperties().moInsets[1].value() 
!= 0
+&& 
getTextBody()->getTextProperties().moInsets[3].value() != 0)
+{
+if (!bIsChangePlaceholderShape)
+{
+nUpper = 
*getTextBody()->getTextProperties().moInsets[1];
+nLower = 
*getTextBody()->getTextProperties().moInsets[3];
+nHeight -= (nUpper + nLower);
+}
+}
+else
+{
+
maDefaultShapeProperties.getProperty(PROP_TextUpperDistance) >>= nUpper;
+
maDefaultShapeProperties.getProperty(PROP_TextLowerDistance) >>= nLower;
+nHeight += (nUpper + nLower);
+}
+mxShape->setSize(awt::Size(0, nHeight));
+}
+}
+else // the placeholder uses the height set on the master slide
+mxShape->setSize(awt::Size(0, 0));
 }
 
 if (aServiceName != "com.sun.star.text.TextFrame")
diff --git a/sd/qa/unit/data/pptx/tdf160490.pptx 
b/sd/qa/unit/data/pptx/tdf160490.pptx
new file mode 100644
index ..be1b316433f9
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf160490.pptx differ
diff --git a/sd/qa/unit/data/xml/n819614_0.xml 
b/sd/qa/unit/data/xml/n819614_0.xml
index 0fa127c07d9b..c889b00c343a 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 e5c2a0dcc132..aa4517fb97f6 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -77,6 +77,29 @@ protected:
 bool checkPattern(int nShapeNumber, std::vector& rExpected);
 };
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf160490)
+{
+createSdImpressDoc("pptx/tdf160

core.git: oox/source

2024-06-02 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/diagram/diagram.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 61f1a311ee174ee115af73a653b36ff62fa5dda0
Author: Andrea Gelmini 
AuthorDate: Sun Jun 2 01:23:28 2024 +0200
Commit: Julien Nabet 
CommitDate: Sun Jun 2 09:09:11 2024 +0200

Fix typo

Change-Id: I3d86a73b9bf74256337243d99677295317e5eafc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168338
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/oox/source/drawingml/diagram/diagram.cxx 
b/oox/source/drawingml/diagram/diagram.cxx
index ccff952e0576..fb3c9a0f3b8f 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -425,7 +425,7 @@ void loadDiagram( ShapePtr const & pShape,
 // just create the BackgroundShape.
 // NOTE: Need to use pShape->getExtDrawings() here, this is the
 // already *filtered* version, see usage of DiagramShapeCounter
-// above. Moving to local bool, there might more coditions show
+// above. Moving to local bool, there might more conditions show
 // up
 const bool bCreate(pShape->getExtDrawings().empty());
 pDiagram->addTo(pShape, bCreate);


core.git: oox/source

2024-05-31 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlshape.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 51f2f5ca45a9f9aade210ca674b167a9a11f87bf
Author: Justin Luth 
AuthorDate: Fri May 31 10:53:07 2024 -0400
Commit: Justin Luth 
CommitDate: Sat Jun 1 03:18:55 2024 +0200

tdf#97618 DOCX import: VML shape: fix missing text wrap #2

The default value is to wrap text.

mso-wrap-style: Specifies the wrapping mode for text
in shapes in WordprocessingML documents. *Default is square*.

Allowed values are:
   square - Wraps text inside the shape in a square.
   none - Text does not wrap.

Change-Id: Ia5f6d635d6d2ac4c8e28b27a993dcbff8bab249d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168301
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d8ac1b1ed9af..d9a50e3084db 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -830,8 +830,9 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, 
Any(eTextVerticalAdjust));
 
 // tdf#97618
-if(!maTypeModel.maWrapStyle.isEmpty())
-PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, 
Any(maTypeModel.maWrapStyle == "square"));
+const bool bWrap = maTypeModel.maWrapStyle != "none";
+PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, Any(bWrap));
+
 
 // tdf#123626
 if (!maShapeModel.maHyperlink.isEmpty())


core.git: oox/source

2024-04-26 Thread Noel Grandin (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |  352 -
 1 file changed, 175 insertions(+), 177 deletions(-)

New commits:
commit 54fced70718828bb73f5485b54445501ebf4fcdc
Author: Noel Grandin 
AuthorDate: Thu Apr 25 20:46:31 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 26 12:09:27 2024 +0200

mStyleIdMap can be static const

Change-Id: I4df2b1152605c175d7959b6739ba0068539bed6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166649
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 3e821456e3b3..6ca69eb958e4 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace oox;
 using namespace oox::drawingml::table;
@@ -29,173 +30,170 @@ using namespace oox::drawingml::table;
  * and change something easily when some styles change.
  */
 
-std::map> mStyleIdMap;
-
 // Create style-id map for using similar attributes of the groups.
 // (style ids used from here: 
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/hh273476(v=office.14)?redirectedfrom=MSDN)
 // and checked all of them.
 
-static void createStyleIdMap()
-{
-mStyleIdMap[OUString("{2D5ABB26-0587-4C30-8999-92F81FD0307C}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString(""));
-mStyleIdMap[OUString("{3C2FFA5D-87B4-456A-9821-1D502468CF0F}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString("Accent1"));
-mStyleIdMap[OUString("{284E427A-3D55-4303-BF80-6455036E1DE7}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString("Accent2"));
-mStyleIdMap[OUString("{69C7853C-536D-4A76-A0AE-DD22124D55A5}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString("Accent3"));
-mStyleIdMap[OUString("{775DCB02-9BB8-47FD-8907-85C794F793BA}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString("Accent4"));
-mStyleIdMap[OUString("{35758FB7-9AC5-4552-8A53-C91805E547FA}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString("Accent5"));
-mStyleIdMap[OUString("{08FB837D-C827-4EFA-A057-4D05807E0F7C}")]
-= std::make_pair(OUString("Themed-Style-1"), OUString("Accent6"));
-
-mStyleIdMap[OUString("{5940675A-B579-460E-94D1-54222C63F5DA}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString(""));
-mStyleIdMap[OUString("{D113A9D2-9D6B-4929-AA2D-F23B5EE8CBE7}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString("Accent1"));
-mStyleIdMap[OUString("{18603FDC-E32A-4AB5-989C-0864C3EAD2B8}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString("Accent2"));
-mStyleIdMap[OUString("{306799F8-075E-4A3A-A7F6-7FBC6576F1A4}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString("Accent3"));
-mStyleIdMap[OUString("{E269D01E-BC32-4049-B463-5C60D7B0CCD2}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString("Accent4"));
-mStyleIdMap[OUString("{327F97BB-C833-4FB7-BDE5-3F7075034690}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString("Accent5"));
-mStyleIdMap[OUString("{638B1855-1B75-4FBE-930C-398BA8C253C6}")]
-= std::make_pair(OUString("Themed-Style-2"), OUString("Accent6"));
-
-mStyleIdMap[OUString("{9D7B26C5-4107-4FEC-AEDC-1716B250A1EF}")]
-= std::make_pair(OUString("Light-Style-1"), OUString(""));
-mStyleIdMap[OUString("{3B4B98B0-60AC-42C2-AFA5-B58CD77FA1E5}")]
-= std::make_pair(OUString("Light-Style-1"), OUString("Accent1"));
-mStyleIdMap[OUString("{0E3FDE45-AF77-4B5C-9715-49D594BDF05E}")]
-= std::make_pair(OUString("Light-Style-1"), OUString("Accent2"));
-mStyleIdMap[OUString("{C083E6E3-FA7D-4D7B-A595-EF9225AFEA82}")]
-= std::make_pair(OUString("Light-Style-1"), OUString("Accent3"));
-mStyleIdMap[OUString("{D27102A9-8310-4765-A935-A1911B00CA55}")]
-= std::make_pair(OUString("Light-Style-1"), OUString("Accent4"));
-mStyleIdMap[OUString("{5FD0F851-EC5A-4D38-B0AD-8093EC10F338}")]
-= std::make_pair(OUString("Light-Style-1"), OUString("Accent5"));
-mStyleIdMap[OUString("{68D230F3-CF80-4859-8CE7-A43EE81993B5}")]
-= std::make_pair(OUString("Light-Style-1"), OUString("Accent6"));
-
-mStyleIdMap[OUString("{7E9639D4-E3E2-4D34-9284-5A2195B3D0D7}")]
-= std::make_pair(OUString("Light-Style-2"), OUString(""));
-mStyleIdMap[OUString("{69012ECD-51FC-41F1-AA8D-1B2483CD663E}")]
-= std::make_pair(OUString("Light-Style-2"), OUString("Accent1"));
-mStyleIdMap[OUString("{72833802-FEF1-4C79-8D5D-14CF1EAF98D9}")]
-= std::make_pair(OUString("Light-Style-2"), OUString("Accent2"));
-mStyleIdMap[OUString("{F2DE63D5-997A-4646-A377-4702673A728D}")]
-= std::make_pair(OUString("Light-Style-2"), OUString("Accent3"));
-

core.git: oox/source sc/qa

2024-04-12 Thread Mike Kaganski (via logerrit)
 oox/source/drawingml/drawingmltypes.cxx |   12 +---
 oox/source/export/drawingml.cxx |   18 +-
 sc/qa/unit/subsequent_export_test3.cxx  |8 
 3 files changed, 22 insertions(+), 16 deletions(-)

New commits:
commit 6e3ed71f906c3571a6b6efb5335c26807b566a42
Author: Mike Kaganski 
AuthorDate: Fri Apr 12 09:16:12 2024 +0100
Commit: Mike Kaganski 
CommitDate: Sat Apr 13 01:19:00 2024 +0200

Use o3tl::convert in oox

Change-Id: I1cbc299e7e64eae48f0f6c896a8160bbe6e19c97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165938
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/drawingml/drawingmltypes.cxx 
b/oox/source/drawingml/drawingmltypes.cxx
index 30fed83f4391..04668c6b9a72 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -92,22 +92,20 @@ float GetTextSize( std::u16string_view sValue )
 return fRet;
 }
 
-/** converts the ST_TextSpacingPoint to 1/100mm */
+/** converts the ST_TextSpacingPoint (1/100pt) to 1/100mm */
 sal_Int32 GetTextSpacingPoint( std::u16string_view sValue )
 {
 sal_Int32 nRet;
-if( ::sax::Converter::convertNumber( nRet, sValue, (SAL_MIN_INT32 + 360) / 
254, (SAL_MAX_INT32 - 360) / 254 ) )
+if( ::sax::Converter::convertNumber( nRet, sValue ) )
 nRet = GetTextSpacingPoint( nRet );
 return nRet;
 }
 
 sal_Int32 GetTextSpacingPoint(sal_Int32 nValue)
 {
-if (nValue > 0)
-nValue = (nValue * 254 + 360);
-else if (nValue < 0)
-nValue = (nValue * 254 - 360);
-return nValue / 720;
+constexpr auto mdFromPt = o3tl::getConversionMulDiv(o3tl::Length::pt, 
o3tl::Length::mm100);
+constexpr o3tl::detail::m_and_d md(mdFromPt.first, mdFromPt.second * 100);
+return o3tl::convertNarrowing(nValue);
 }
 
 float GetFontHeight( sal_Int32 nHeight )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 92aa84438e62..d14fd037f237 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -167,6 +167,14 @@ const char* g_aPredefinedClrNames[] = {
 "hlink",
 "folHlink",
 };
+
+/** converts 1/100mm to the ST_TextSpacingPoint (1/100pt) */
+sal_Int64 toTextSpacingPoint(sal_Int64 mm100)
+{
+constexpr auto mdToPt = o3tl::getConversionMulDiv(o3tl::Length::mm100, 
o3tl::Length::pt);
+constexpr o3tl::detail::m_and_d md(mdToPt.first * 100, mdToPt.second);
+return o3tl::convert(mm100, md.m, md.d);
+}
 }
 
 namespace oox::drawingml {
@@ -2491,7 +2499,7 @@ void DrawingML::WriteRunProperties( const Reference< 
XPropertySet >& rRun, bool
 *therefore to get original value CharKerning need to be convert.
 *
https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/drawingmltypes.cxx#95
 **/
-nCharKerning = ((nCharKerning * 720)-360) / 254;
+nCharKerning = toTextSpacingPoint(nCharKerning);
 
 if ((bComplex && GetProperty(rXPropSet, "CharWeightComplex"))
 || GetProperty(rXPropSet, "CharWeight"))
@@ -3445,7 +3453,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& 
rSpacing, float fFirstCharHe
XML_val, 
OString::number(static_cast(rSpacing.Height)*1000));
 }
 else if (rSpacing.Mode == LineSpacingMode::MINIMUM
- && fFirstCharHeight > static_cast(rSpacing.Height) * 0.001 
* 72.0 / 2.54)
+ && fFirstCharHeight > o3tl::convert(rSpacing.Height, 
o3tl::Length::mm100, o3tl::Length::pt))
 {
 // 100% proportional line spacing = single line spacing
 mpFS->singleElementNS(XML_a, XML_spcPct, XML_val,
@@ -3454,7 +3462,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& 
rSpacing, float fFirstCharHe
 else
 {
 mpFS->singleElementNS( XML_a, XML_spcPts,
-   XML_val, 
OString::number(std::lround(rSpacing.Height / 25.4 * 72)));
+   XML_val, 
OString::number(toTextSpacingPoint(rSpacing.Height)));
 }
 }
 
@@ -3582,7 +3590,7 @@ bool DrawingML::WriteParagraphProperties(const 
Reference& rParagra
 mpFS->startElementNS(XML_a, XML_spcBef);
 {
 mpFS->singleElementNS( XML_a, XML_spcPts,
-   XML_val, 
OString::number(std::lround(nParaTopMargin / 25.4 * 72)));
+   XML_val, 
OString::number(toTextSpacingPoint(nParaTopMargin)));
 }
 mpFS->endElementNS( XML_a, XML_spcBef );
 }
@@ -3592,7 +3600,7 @@ bool DrawingML::WriteParagraphProperties(const 
Reference& rParagra
 mpFS->startElementNS(XML_a, XML_spcAft);
 {
 mpFS->singleElementNS( XML_a, XML_spcPts,
-   XML_val, 
OString::number(std::lround(nParaBottomMargin / 25.4 * 72)));
+   XML_val, 
OString::number(toTextSpacingPoint(nParaBottomMargin)));
 }
 mpFS->endElementNS( XML_a, XML_spcAft );
 }
diff 

core.git: oox/source

2024-04-08 Thread Gabor Kelemen (via logerrit)
 oox/source/core/filterbase.cxx   |1 -
 oox/source/core/xmlfilterbase.cxx|1 -
 oox/source/drawingml/chart/chartspaceconverter.cxx   |1 -
 oox/source/drawingml/chart/objectformatter.cxx   |1 -
 oox/source/drawingml/chart/titleconverter.cxx|1 -
 oox/source/drawingml/clrschemecontext.cxx|2 --
 oox/source/drawingml/connectorshapecontext.cxx   |4 
 oox/source/drawingml/diagram/constraintlistcontext.cxx   |2 --
 oox/source/drawingml/diagram/datamodelcontext.cxx|1 -
 oox/source/drawingml/diagram/diagramdefinitioncontext.cxx|2 --
 oox/source/drawingml/diagram/diagramfragmenthandler.cxx  |2 --
 oox/source/drawingml/diagram/layoutatomvisitorbase.cxx   |1 -
 oox/source/drawingml/diagram/layoutatomvisitors.cxx  |2 --
 oox/source/drawingml/diagram/layoutnodecontext.cxx   |2 --
 oox/source/drawingml/effectpropertiescontext.cxx |1 -
 oox/source/drawingml/graphicshapecontext.cxx |3 ---
 oox/source/drawingml/guidcontext.cxx |2 --
 oox/source/drawingml/hyperlinkcontext.cxx|2 --
 oox/source/drawingml/linepropertiescontext.cxx   |2 --
 oox/source/drawingml/misccontexts.cxx|1 -
 oox/source/drawingml/objectdefaultcontext.cxx|2 --
 oox/source/drawingml/scene3dcontext.cxx  |2 --
 oox/source/drawingml/shape3dproperties.cxx   |2 --
 oox/source/drawingml/shapecontext.cxx|4 
 oox/source/drawingml/shapegroupcontext.cxx   |3 ---
 oox/source/drawingml/shapepropertiescontext.cxx  |2 --
 oox/source/drawingml/shapestylecontext.cxx   |2 --
 oox/source/drawingml/spdefcontext.cxx|1 -
 oox/source/drawingml/table/tablebackgroundstylecontext.cxx   |1 -
 oox/source/drawingml/table/tablepartstylecontext.cxx |2 --
 oox/source/drawingml/table/tablerow.cxx  |3 ---
 oox/source/drawingml/table/tablestylecellstylecontext.cxx|1 -
 oox/source/drawingml/table/tablestylecontext.cxx |2 --
 oox/source/drawingml/table/tablestylelistfragmenthandler.cxx |1 -
 oox/source/drawingml/table/tablestylepart.cxx|1 -
 oox/source/drawingml/table/tablestyletextstylecontext.cxx|2 --
 oox/source/drawingml/textbodypropertiescontext.cxx   |1 -
 oox/source/drawingml/textcharacterpropertiescontext.cxx  |2 --
 oox/source/drawingml/textfieldcontext.cxx|2 --
 oox/source/drawingml/textliststylecontext.cxx|2 --
 oox/source/drawingml/textspacingcontext.cxx  |1 -
 oox/source/drawingml/texttabstoplistcontext.cxx  |1 -
 oox/source/drawingml/themeelementscontext.cxx|1 -
 oox/source/dump/dumperbase.cxx   |2 --
 oox/source/export/shapes.cxx |1 -
 oox/source/helper/containerhelper.cxx|1 -
 oox/source/helper/graphichelper.cxx  |1 -
 oox/source/helper/zipstorage.cxx |1 -
 oox/source/ole/vbahelper.cxx |2 --
 oox/source/ole/vbamodule.cxx |1 -
 oox/source/ppt/animationtypes.cxx|1 -
 oox/source/ppt/animvariantcontext.cxx|1 -
 oox/source/ppt/backgroundproperties.cxx  |2 --
 oox/source/ppt/extdrawingfragmenthandler.cxx |2 --
 oox/source/ppt/headerfootercontext.cxx   |2 --
 oox/source/ppt/layoutfragmenthandler.cxx |3 ---
 oox/source/ppt/pptgraphicshapecontext.cxx|1 -
 oox/source/ppt/pptshapecontext.cxx   |1 -
 oox/source/ppt/pptshapegroupcontext.cxx  |2 --
 oox/source/ppt/pptshapepropertiescontext.cxx |1 -
 oox/source/ppt/slidemastertextstylescontext.cxx  |1 -
 oox/source/ppt/slidetimingcontext.cxx|4 
 oox/source/ppt/slidetransitioncontext.cxx|3 ---
 oox/source/ppt/soundactioncontext.cxx|1 -
 oox/source/ppt/timeanimvaluecontext.cxx  |2 --
 oox/source/ppt/timenodelistcontext.cxx   |1 -
 oox/source/ppt/timetargetelementcontext.cxx  |1 -
 67 files changed, 113 deletions(-)

New commits:
commit 9a4eead9958d887d37a5c9bab9465cc6ddd0b213
Author: Gabor Kelemen 
AuthorDate: Sun Mar 31 11:30:14 2024 +0200
Commit: Gabor Kelemen 
C

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: oox/source

2024-03-29 Thread Aaron Bourdeaux (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx |2 +-
 oox/source/helper/propertymap.cxx  |2 +-
 oox/source/shape/WpsContext.cxx|8 
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 6c358c28c5cc2d1d8d8bb9d1238e3546a9bf3ce8
Author: Aaron Bourdeaux 
AuthorDate: Thu Mar 28 14:32:45 2024 -0400
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Fri Mar 29 14:58:23 2024 +0100

tdf#158237 Use C++20 contains() instead of find() and end()

Change-Id: I529096d97991a89bdc68ec7f5d490ec21744fc6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165499
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 862ffd8624a3..a3e2dd5e10bb 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -111,7 +111,7 @@ void CustomShapeProperties::pushToPropSet(
 PropertyMap aPropertyMap;
 PropertySet aPropSet( xPropSet );
 
-if (maPresetDataMap.find(mnShapePresetType) != maPresetDataMap.end())
+if (maPresetDataMap.contains(mnShapePresetType))
 {
 SAL_INFO(
 "oox.drawingml",
diff --git a/oox/source/helper/propertymap.cxx 
b/oox/source/helper/propertymap.cxx
index d5a89e6f2388..d93fb41209bf 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -171,7 +171,7 @@ Property SAL_CALL GenericPropertySet::getPropertyByName( 
const OUString& rProper
 
 sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& 
rPropertyName )
 {
-return maPropMap.find( rPropertyName ) != maPropMap.end();
+return maPropMap.contains(rPropertyName);
 }
 
 } // namespace
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 6d7b3d117fc4..37c58d25029e 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -203,7 +203,7 @@ void lcl_getFillDetailsFromPropSeq(const 
uno::Sequence& rT
 if (!rTextFillSeq.hasElements())
 return;
 comphelper::SequenceAsHashMap aTextFillMap(rTextFillSeq);
-if (aTextFillMap.find(u"noFill"_ustr) != aTextFillMap.end())
+if (aTextFillMap.contains(u"noFill"_ustr))
 {
 rFillProperties.moFillType = oox::XML_noFill;
 return;
@@ -308,11 +308,11 @@ void lcl_getLineDetailsFromPropSeq(const 
uno::Sequence& rT
 
 // LineJoint
 comphelper::SequenceAsHashMap aTextOutlineMap(rTextOutlineSeq);
-if (aTextOutlineMap.find(u"bevel"_ustr) != aTextOutlineMap.end())
+if (aTextOutlineMap.contains(u"bevel"_ustr))
 rLineProperties.moLineJoint = oox::XML_bevel;
-else if (aTextOutlineMap.find(u"round"_ustr) != aTextOutlineMap.end())
+else if (aTextOutlineMap.contains(u"round"_ustr))
 rLineProperties.moLineJoint = oox::XML_round;
-else if (aTextOutlineMap.find(u"miter"_ustr) != aTextOutlineMap.end())
+else if (aTextOutlineMap.contains(u"miter"_ustr))
 {
 // LineProperties has no member to store a miter limit. Therefore some 
heuristic is
 // added here. 0 is default for attribute "lim" in MS Office. It is 
rendered same as bevel.


core.git: oox/source

2024-03-22 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9556504b213519e2900e72c81aa26a470dc6353c
Author: Regina Henschel 
AuthorDate: Fri Mar 22 00:52:25 2024 +0100
Commit: Regina Henschel 
CommitDate: Fri Mar 22 10:21:32 2024 +0100

Revert "extruded shape import: tweak threePt light rig too"

This reverts commit aa341e79ee241fec0b5afe159b0c674cf85a52c0.

Reason for revert: The front faces become too light. A similar front face 
is more important than lighter extrusion faces.

Change-Id: I7e58d19b7e6264358d46f172f23bbfea74936250
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165121
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index cb0a85eb7ed0..acddea7643c4 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -840,10 +840,10 @@ void lcl_tweakLightRig(std::vector& 
rLightDirVec, PrstLightR
 rLightRig.fAmbient = 0.35; // instead 0.11 resp. 0.13
 }
 else if (rLightRig.sLightRigName == u"freezing" || rLightRig.sLightRigName 
== u"morning"
- || rLightRig.sLightRigName == u"sunrise" || 
rLightRig.sLightRigName == u"threePt")
+ || rLightRig.sLightRigName == u"sunrise")
 {
-// These rigs have no ambient color but three or four lights. The 
objects are too dark with
-// only two lights.
+// These rigs have no ambient color but four lights. The objects are 
too dark with only
+// two lights.
 rLightRig.fAmbient = 0.4;
 }
 else if (rLightRig.sLightRigName == u"sunset")


core.git: oox/source

2024-03-21 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a85aeb1b8354ad6c4da23fe5947147991a573aa5
Author: Andrea Gelmini 
AuthorDate: Wed Mar 20 22:34:33 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Mar 21 08:33:43 2024 +0100

Fix typo

Change-Id: I5e1f9104405329452431ccf663f6916a6cd2036b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165085
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index eff649a71cd7..cb0a85eb7ed0 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -946,7 +946,7 @@ void Scene3DHelper::setLightingProperties(const 
oox::drawingml::Shape3DPropertie
 
 namespace
 /** This struct is used to hold material values for extruded custom shapes. 
Because we cannot yet
-render all material propertes MS Office uses, the values are adapted to 
our current abilities.*/
+render all material properties MS Office uses, the values are adapted to 
our current abilities.*/
 {
 struct MaterialValues
 {


core.git: oox/source

2024-03-19 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit aa341e79ee241fec0b5afe159b0c674cf85a52c0
Author: Regina Henschel 
AuthorDate: Mon Mar 18 19:52:02 2024 +0100
Commit: Regina Henschel 
CommitDate: Tue Mar 19 12:13:19 2024 +0100

extruded shape import: tweak threePt light rig too

This is an addition to commit 98b06ed3. The light rig 'threePt' has the
same problem that with only two lights the shapes are too dark.
I simply overlooked this rig.

Change-Id: Ib71088f24245da912cf0886e75841ffd6cec786f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164975
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index cfea2e93613b..d2b03ae97485 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -837,10 +837,10 @@ void lcl_tweakLightRig(std::vector& 
rLightDirVec, PrstLightR
 rLightRig.fAmbient = 0.35; // instead 0.11 resp. 0.13
 }
 else if (rLightRig.sLightRigName == u"freezing" || rLightRig.sLightRigName 
== u"morning"
- || rLightRig.sLightRigName == u"sunrise")
+ || rLightRig.sLightRigName == u"sunrise" || 
rLightRig.sLightRigName == u"threePt")
 {
-// These rigs have no ambient color but four lights. The objects are 
too dark with only
-// two lights.
+// These rigs have no ambient color but three or four lights. The 
objects are too dark with
+// only two lights.
 rLightRig.fAmbient = 0.4;
 }
 else if (rLightRig.sLightRigName == u"sunset")


core.git: oox/source

2024-03-14 Thread Julien Nabet (via logerrit)
 oox/source/core/filterbase.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2887ffbf240aa70330cb50bf810170cf9c896405
Author: Julien Nabet 
AuthorDate: Thu Mar 14 12:20:05 2024 +0100
Commit: Miklos Vajna 
CommitDate: Thu Mar 14 15:33:15 2024 +0100

tdf#160192: fix crash when trying to overwrite file in RO dir+lock file

Bug exposed with:
5259ab8104cfba60c40748ed0cd59d93df038c5b
sfx2 store: create temp files next to local files

bt:
6  0x7faac67ad9b5 in 
sax_fastparser::FastSaxSerializer::FastSaxSerializer(com::sun::star::uno::Reference
 const&) (this=0x559f316f0e70, xOutputStream=empty uno::Reference)
at sax/source/tools/fastserializer.cxx:68
7  0x7faac67c46e0 in 
sax_fastparser::FastSerializerHelper::FastSerializerHelper(com::sun::star::uno::Reference
 const&, bool)
(this=0x559f31721400, xOutputStream=empty uno::Reference, 
bWriteHeader=true) at sax/source/tools/fshelper.cxx:30
8  0x7fa9bfa1b4cc in 
std::_Construct, bool 
const&>(sax_fastparser::FastSerializerHelper*, 
com::sun::star::uno::Reference&&, bool 
const&) (__p=0x559f31721400, __args=..., __args=@0x7ffecd609207: true)
at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:119
...
15 0x7fa9bfa04087 in 
oox::core::XmlFilterBase::openFragmentStreamWithSerializer(rtl::OUString 
const&, rtl::OUString const&)
(this=0x559f318ed5f0, rStreamName="docProps/core.xml", 
rMediaType="application/vnd.openxmlformats-package.core-properties+xml") at 
oox/source/core/xmlfilterbase.cxx:511
16 0x7fa9bfa04999 in 
oox::core::writeCoreProperties(oox::core::XmlFilterBase&, 
com::sun::star::uno::Reference 
const&)
(rSelf=..., xProperties=uno::Reference to ((anonymous 
namespace)::SfxDocumentMetaData *) 0x559f2d673e28) at 
oox/source/core/xmlfilterbase.cxx:645
17 0x7fa9bfa047c2 in 
oox::core::XmlFilterBase::exportDocumentProperties(com::sun::star::uno::Reference
 const&, bool)
(this=0x559f318ed5f0, xProperties=uno::Reference to ((anonymous 
namespace)::SfxDocumentMetaData *) 0x559f2d673e28, 
bSecurityOptOpenReadOnly=false) at oox/source/core/xmlfilterbase.cxx:981
18 0x7fa9bee21bd4 in DocxExport::WriteProperties() 
(this=0x7ffecd609d78) at sw/source/filter/ww8/docxexport.cxx:952
19 0x7fa9bee24b0b in DocxExport::DocxExport(DocxExportFilter&, SwDoc&, 
std::shared_ptr&, SwPaM&, bool, bool)
(this=0x7ffecd609d78, rFilter=..., rDocument=..., 
pCurrentPam=std::shared_ptr (use count 1, weak count 1) = {...}, 
rOriginalPam=SwPaM = {...}, bDocm=false, bTemplate=false)
at sw/source/filter/ww8/docxexport.cxx:2149
20 0x7fa9bee4438e in DocxExportFilter::exportDocument() 
(this=0x559f318ed5f0) at sw/source/filter/ww8/docxexportfilter.cxx:112
21 0x7fa9bf9d6b8b in 
oox::core::FilterBase::filter(com::sun::star::uno::Sequence
 const&) (this=0x559f318ed5f0, rMediaDescSeq=uno::Sequence of length 12 = {...})
at oox/source/core/filterbase.cxx:494

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

Patch prevents LO from crashing + make LO displays error message:
Error saving the document :
Write Error.
The file could not be written

Change-Id: I41a94eeb17bb6568b586d89755bce330154d1dad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164808
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 6a2a51e47577..1fafb6ac9e4f 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -491,7 +491,7 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< 
PropertyValue >& rMediaDes
 if( mxImpl->mxOutStream.is() )
 {
 mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream 
);
-bRet = mxImpl->mxStorage && exportDocument() && 
implFinalizeExport( getMediaDescriptor() );
+bRet = mxImpl->mxStorage && mxImpl->mxStorage->isStorage() 
&& exportDocument() && implFinalizeExport( getMediaDescriptor() );
 }
 break;
 }


core.git: oox/source

2024-03-14 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 4176b89523efd0052b2a8c817f816d316797d3a0
Author: Andrea Gelmini 
AuthorDate: Thu Mar 14 12:58:54 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Mar 14 13:45:32 2024 +0100

Fix typos

Change-Id: I94df85715874013a28167d417107b09609f0293e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164831
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index 39a6217c9ae6..cfea2e93613b 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -688,9 +688,9 @@ void lcl_getLightDirectionsFromRig(const 
PrstLightRigValues& rLightRig,
 
 /** Converts the directions from MSO specification to coordinates in the shape 
coordinate system.
 @details The extruded shape uses a left-hand Cartesian coordinate system 
with x-axis right, y-axis
-down and z-axis towards observer. When L(Lx,Ly,Lz) is the specified ligth 
direction, then
+down and z-axis towards observer. When L(Lx,Ly,Lz) is the specified light 
direction, then
 V(-Ly, -Lx, Lz) is the direction in the shape coordinate system.
-@param [in,out] rLightDirVec contains for each indiviual light its 
direction.*/
+@param [in,out] rLightDirVec contains for each individual light its 
direction.*/
 void lcl_AdaptAndNormalizeLightDirections(std::vector& 
rLightDirVec)
 {
 basegfx::B3DHomMatrix aTransform; // unit matrix
@@ -747,7 +747,7 @@ void 
lcl_ApplyShapeRotationToLights(std::vector& rLightDirVe
 have an element 'rot', that describes a rotation by spherical 
coordinates 'lat', 'lon' and
 'rev'. The element has precedence over the attribute.
 @param [in] p3DProperties contains info about light rig.
-@param {in, out] rLightDirVec contains for each indiviual light its 
direction in shape coordinate
+@param {in, out] rLightDirVec contains for each individual light its 
direction in shape coordinate
 system with x-axis right, y-axis down, z-axis toward observer.*/
 void lcl_IncorporateRigRotationIntoLightDirections(
 const oox::drawingml::Shape3DPropertiesPtr p3DProperties,


core.git: oox/source

2024-03-14 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/shape.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit be29cfe3663d81b579895acade39adb089b942d1
Author: Andrea Gelmini 
AuthorDate: Thu Mar 14 12:58:30 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Mar 14 13:45:01 2024 +0100

Fix typo

Change-Id: Ia9e04aeda25f5a1b91950377c3eca335b443790b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164830
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index aaf26527db5b..195b85f893df 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1471,7 +1471,7 @@ Reference< XShape > const & Shape::createAndInsert(
 xSet->setPropertyValue( rPropName, Any( false ) );
 
 // For extruded shapes, MSO uses the line color if no extrusion color 
is specified. LO uses
-// fill color in 'automatic' case. Thus we set extrusion color 
explicitely.
+// fill color in 'automatic' case. Thus we set extrusion color 
explicitly.
 if (bHas3DEffect && !aExtrusionColor.isUsed())
 {
 const OUString& rFillColor2PropName = 
PropertyMap::getPropertyName(PROP_FillColor2);


core.git: oox/source

2024-03-14 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ec99dac5c4e0d7e93b54a4a3043ac16a6054c2d5
Author: Andrea Gelmini 
AuthorDate: Thu Mar 14 13:00:18 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Mar 14 13:44:10 2024 +0100

Fix typo

Change-Id: Ifcd144b89f1d5648a3c72471b691529251d26892
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164832
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index 8f2d41b9bb12..39a6217c9ae6 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -734,7 +734,7 @@ void 
lcl_ApplyShapeRotationToLights(std::vector& rLightDirVe
 const double& fY, const double& fZ)
 {
 basegfx::B3DHomMatrix aTransform; // unit matrix
-// rotate has the order first x, than y, last z. We need order z, y, x.
+// rotate has the order first x, then y, last z. We need order z, y, x.
 aTransform.rotate(0.0, 0.0, -fZ);
 aTransform.rotate(0.0, -fY, 0.0);
 aTransform.rotate(fX, 0.0, 0.0);


core.git: oox/source

2024-03-10 Thread Noel Grandin (via logerrit)
 oox/source/core/filterbase.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit ae351d9d5fc4fc3c0e02853e0a974791e41786fe
Author: Noel Grandin 
AuthorDate: Sun Mar 10 20:46:23 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Mar 11 06:31:18 2024 +0100

tdf#158773 reduce cost of importing binary data

no need to pass it via the internal buffer of SequenceOutputStream when
we can read it directly

Change-Id: I832737d73309449a1f3a26a4b451977a2a580de3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164634
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 3f47283d0825..6a2a51e47577 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -386,14 +386,13 @@ bool FilterBase::importBinaryData( StreamDataSequence & 
orDataSeq, const OUStrin
 return false;
 
 // try to open the stream (this may fail - do not assert)
-BinaryXInputStream aInStrm( openInputStream( rStreamName ), true );
-if( aInStrm.isEof() )
+Reference xInStream = openInputStream( rStreamName );
+if (!xInStream)
 return false;
 
 // copy the entire stream to the passed sequence
-SequenceOutputStream aOutStrm( orDataSeq );
-aInStrm.copyToStream( aOutStrm );
-return true;
+sal_Int32 nBytesRead = xInStream->readBytes( orDataSeq, SAL_MAX_INT32);
+return nBytesRead != -1 && nBytesRead != 0;
 }
 
 // com.sun.star.lang.XServiceInfo interface


core.git: oox/source sw/qa

2024-03-06 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlshape.cxx  |   17 +--
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   13 
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit e0ef7d54b4e4ccbaaada5d2c4a42ba41d961ea69
Author: Justin Luth 
AuthorDate: Tue Mar 5 19:05:29 2024 -0500
Commit: Miklos Vajna 
CommitDate: Wed Mar 6 11:22:31 2024 +0100

tdf#160049 oox import: use margins with left/right HoriOrientRelation

I'm really surprised this wasn't found much earlier.
Even DOC format isn't handling this.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML

Change-Id: I92ee8eceb6c6bab5f027663bae94d7acdf01be3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164442
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 5284de176839..8f16c6267211 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -647,8 +647,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rType
 rPropSet.setAnyProperty(PROP_VertOrient, 
Any(text::VertOrientation::TOP));
 }
 
+// if the anchor is not inline, and is relative to left or right, then 
apply the margins
+bool bHonorMargins = rTypeModel.maPosition == "relative" || 
rTypeModel.maPosition == "absolute";
 if ( rTypeModel.maPositionHorizontal == "center" )
+{
 rPropSet.setAnyProperty(PROP_HoriOrient, 
Any(text::HoriOrientation::CENTER));
+bHonorMargins = false;
+}
 else if ( rTypeModel.maPositionHorizontal == "left" )
 rPropSet.setAnyProperty(PROP_HoriOrient, 
Any(text::HoriOrientation::LEFT));
 else if ( rTypeModel.maPositionHorizontal == "right" )
@@ -663,6 +668,8 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rType
 rPropSet.setAnyProperty(PROP_HoriOrient, 
Any(text::HoriOrientation::RIGHT));
 rPropSet.setAnyProperty(PROP_PageToggle, Any(true));
 }
+else
+bHonorMargins = false;
 
 if ( rTypeModel.maPositionHorizontalRelative == "page" )
 rPropSet.setAnyProperty(PROP_HoriOrientRelation, 
Any(text::RelOrientation::PAGE_FRAME));
@@ -674,9 +681,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rType
 else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" ||
  rTypeModel.maPositionHorizontalRelative == "outer-margin-area")
 rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PAGE_LEFT);
-else if ( rTypeModel.maPositionHorizontalRelative == "text" )
-rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::FRAME);
-
+else // "text"
+{
+if (bHonorMargins)
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PRINT_AREA);
+else
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::FRAME);
+}
 if ( rTypeModel.maPositionVertical == "center" )
 rPropSet.setAnyProperty(PROP_VertOrient, 
Any(text::VertOrientation::CENTER));
 else if ( rTypeModel.maPositionVertical == "top" )
diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx
new file mode 100644
index ..f8cb262f53c8
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 2e6c10c99031..d045e18efa32 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -292,6 +293,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginVML.docx")
+{
+// given a VML (Word 2003) document with a LEFT "column/text" anchored 
image
+// (which will import as DML compat12 on the round-trip)
+if (isExported())
+return;
+// The image takes into account the margin, so it looks like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow.docx")
 {
 // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't 
specified or honored


core.git: oox/source

2024-02-27 Thread Justin Luth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5920bc2d1a624021a6f3eb42a56ce9b96b53a39f
Author: Justin Luth 
AuthorDate: Tue Feb 27 08:23:44 2024 -0500
Commit: Justin Luth 
CommitDate: Tue Feb 27 19:50:57 2024 +0100

address shortcoming: document why I avoided axials for transparency

Hmm, I like to complain when other people
don't comment on why certain situations are excluded,
and yet I did the same thing here.

Thanks vmiklos for pointing that out.

Change-Id: I4c5ddeaeee078f036fc31149fc29bc6acb277ab3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164040
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index f24208722cb5..596e18f2176e 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -543,6 +543,10 @@ void FillProperties::pushToPropMap(ShapePropertyMap& 
rPropMap, const GraphicHelp
 
 // convert DrawingML angle (in 1/6 degrees) to API 
angle (in 1/10 degrees)
 aGradient.SetAngle(Degree10(static_cast< sal_Int16 >( 
(8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 )));
+
+// If this is symmetrical, set it as an axial gradient for 
better UI/export.
+// There were chart2 unit test failures when doing this to 
transparent gradients
+// so just avoid that case.
 if (!bContainsTransparency)
 aGradient.tryToConvertToAxial();
 }


core.git: oox/source

2024-02-27 Thread Caolán McNamara (via logerrit)
 oox/source/export/chartexport.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 137247a4ef563547a591bf3af845cbaf21a1800d
Author: Caolán McNamara 
AuthorDate: Tue Feb 27 09:04:05 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 27 13:21:46 2024 +0100

cid#1592378 Logically dead code

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

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 58114eb2820e..f9c4c12d066d 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1720,7 +1720,6 @@ void ChartExport::exportPlotArea(const Reference< 
css::chart::XChartDocument >&
 case chart2::PieChartSubType_BAR:
 sSubType = "bar";
 break;
-case chart2::PieChartSubType_NONE:
 default:
 assert(false);
 }


core.git: oox/source

2024-02-27 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 5dc2fad7186ea5e03ae2aa453b14a3276b4a17d9
Author: Caolán McNamara 
AuthorDate: Tue Feb 27 08:53:19 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 27 12:05:35 2024 +0100

cid#1592381 silence Out-of-bounds read

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

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index ac7f0fd0450e..96a7ca3e0574 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -228,8 +228,10 @@ void Scene3DHelper::getAPIAnglesFrom3DProperties(
 // ignore it. The preset cameras have no rotation.
 nRevolution = 0;
 }
-else if (47 <= mnPrstCameraIndex && mnPrstCameraIndex <= 61)
+else if (47 <= mnPrstCameraIndex)
 {
+assert(mnPrstCameraIndex <= 61
+   && "by definition we don't set anything >= nCameraPresetCount 
(62)");
 // perspective. MS Office has a strange rendering behavior: If the 
shape rotation is not zero
 // and the angle for rotation on x-axis (=latitude) is >90deg and 
<=270deg, then MSO renders
 // the shape with an addition 180deg rotation on the z-axis. This 
happens only with user
@@ -383,10 +385,11 @@ bool Scene3DHelper::setExtrusionProperties(const 
oox::drawingml::Shape3DProperti
 return false;
 
 const sal_Int32 nCameraPrstID((*p3DProperties).mnPreset.value());
-mnPrstCameraIndex
+sal_Int16 nPrstCameraIndex
 = 
getPrstCameraIndex(oox::drawingml::Generic3DProperties::getCameraPrstName(nCameraPrstID));
-if (mnPrstCameraIndex < 0 or mnPrstCameraIndex >= nCameraPresetCount)
+if (nPrstCameraIndex < 0 or nPrstCameraIndex >= nCameraPresetCount)
 return false; // error in document. OOXML specifies a fixed set of 
preset camera types.
+mnPrstCameraIndex = nPrstCameraIndex;
 
 // We use extrusion, if there is a rotation around x-axis or y-axis,
 // or if there is no such rotation but we have a perspective projection 
with true depth,


core.git: oox/source

2024-02-27 Thread Attila Szűcs (via logerrit)
 oox/source/drawingml/shape.cxx |   41 +
 1 file changed, 41 insertions(+)

New commits:
commit 0079f0e77e74a355d57b24d3a6b6d1a29f45eb79
Author: Attila Szűcs 
AuthorDate: Mon Feb 26 10:04:23 2024 +0100
Commit: Attila Szűcs 
CommitDate: Tue Feb 27 09:51:43 2024 +0100

tdf#67347 pptx import: stacked + horz/vert aligment

In case of Stacked, PP calculates in the vertical direction
with the horizontal alignment.

We simulate it by setting TextVerticalAdjust at import time
(from PPTX) based on the ParagraphAdjust of the 1. paragraph

It is not perfect, because we have 1 TextVerticalAdjust / 1 shape,
and it does not support justified,
while we can have many ParagraphAdjust / 1 shape
(if the shape have more paragraphs)

For a better solution we should re-implement the entire stacked
thing, but that is a much bigger task.

Change-Id: I4011be0f118b870ab7f9e2ddc15c6dc5a21f8a89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163934
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Attila Szűcs 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 8f3aedf3488a..d9a3f8b8db59 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -90,6 +90,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1354,6 +1355,46 @@ Reference< XShape > const & Shape::createAndInsert(
 // add properties from textbody to shape properties
 if( mpTextBody )
 {
+// tdf#67347: In case of Stacked, PP calculates in the vertical 
direction with the
+// horizontal alignment.
+// In LO, we simulate it by setting TextVerticalAdjust based on 
the ParagraphAdjust
+// of the 1. paragraph
+// It is not perfect, because we have 1 TextVerticalAdjust / 1 
shape, and it
+// does not support justified, while we can have many 
ParagraphAdjust / 1 shape
+// (if the shape have more paragraphs)
+if 
(mpTextBody->getTextProperties().maPropertyMap.hasProperty(PROP_WritingMode)
+&& 
mpTextBody->getTextProperties().maPropertyMap.getProperty(PROP_WritingMode)
+   == uno::Any(text::WritingMode2::STACKED)
+&& mpTextBody->getParagraphs().size() > 0
+&& aServiceName != "com.sun.star.drawing.GroupShape")
+{
+std::optional& oParaAdjust
+= 
mpTextBody->getParagraphs()[0]->getProperties().getParaAdjust();
+
+if (oParaAdjust)
+{
+switch (*oParaAdjust)
+{
+case ParagraphAdjust::ParagraphAdjust_LEFT:
+mpTextBody->getTextProperties().meVA
+= TextVerticalAdjust::TextVerticalAdjust_TOP;
+break;
+case ParagraphAdjust::ParagraphAdjust_CENTER:
+mpTextBody->getTextProperties().meVA
+= 
TextVerticalAdjust::TextVerticalAdjust_CENTER;
+break;
+case ParagraphAdjust::ParagraphAdjust_RIGHT:
+mpTextBody->getTextProperties().meVA
+= 
TextVerticalAdjust::TextVerticalAdjust_BOTTOM;
+break;
+default:
+break;
+}
+mpTextBody->getTextProperties().maPropertyMap.setProperty(
+PROP_TextVerticalAdjust, 
mpTextBody->getTextProperties().meVA);
+}
+}
+
 
mpTextBody->getTextProperties().pushTextDistances(Size(aShapeRectHmm.Width, 
aShapeRectHmm.Height));
 aShapeProps.assignUsed( 
mpTextBody->getTextProperties().maPropertyMap );
 // Push char properties as well - specifically useful when this is 
a placeholder


core.git: oox/source sw/qa

2024-02-26 Thread Justin Luth (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |2 +
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |   30 +++
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |   26 +++-
 sw/qa/extras/rtfexport/rtfexport.cxx  |   47 +++---
 sw/qa/extras/rtfexport/rtfexport8.cxx |   15 +
 5 files changed, 42 insertions(+), 78 deletions(-)

New commits:
commit 38083e4c0b5638d69162593c3fbf599da6cd499f
Author: Justin Luth 
AuthorDate: Tue Feb 20 16:11:08 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 08:40:50 2024 +0100

related tdf#126533 dml/vml import: import radials as radials

... and not as symmetrical linear gradients.

The benefit is that our export code
will be able to intelligently export it.

Apparently RTF export code does not intelligently export axials,
(now fixed - tdf#159824)
but VML and DML (and doc) do it well.

Unfortunately charts can be badly affected,
(avoided by ignoring when transparent)
and unit tests are implementation-tested...

This affects existing unit tests:
-tdf128345_Legend_CS_TG_axial.pptx: label imports fine:
lost on export (no change)
-tdf128345_ChartWall_CS_TG.pptx: wall gradient now looks axial:
lost on export (no change)
-textframe-gradient.docx: still round-trips OK: no change
-textframe-gradient.rtf: round-trips as linear: lost axial-ness
 (now fixed: tdf#159824)
-fdo78663.docx: textbox font fill: still exports as solid: no change

I ran the assert check against chart2, oox, and sw

Change-Id: Ib16e9488a76b006bf335ff01a38acf7cde69cccb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163675
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index dec9ab9672cc..f24208722cb5 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -543,6 +543,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& 
rPropMap, const GraphicHelp
 
 // convert DrawingML angle (in 1/6 degrees) to API 
angle (in 1/10 degrees)
 aGradient.SetAngle(Degree10(static_cast< sal_Int16 >( 
(8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 )));
+if (!bContainsTransparency)
+aGradient.tryToConvertToAxial();
 }
 
 if (awt::GradientStyle_RECT == aGradient.GetGradientStyle())
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index f8defa15d1a2..72072bc5bb03 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -577,34 +577,16 @@ DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, 
"textframe-gradient.docx")
 uno::Reference xFrame(getShape(1), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, 
getProperty(xFrame, "FillStyle"));
 awt::Gradient2 aGradient(getProperty(xFrame, 
"FillGradient"));
-
-// MCGR: Use the completely imported transparency gradient to check for 
correctness
-basegfx::BColorStops aColorStops = 
model::gradient::getColorStopsFromUno(aGradient.ColorStops);
-
-CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size());
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 
0.0));
-CPPUNIT_ASSERT_EQUAL(Color(0xd99594), 
Color(aColorStops[0].getStopColor()));
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 
0.5));
-CPPUNIT_ASSERT_EQUAL(Color(0xc0504d), 
Color(aColorStops[1].getStopColor()));
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 
1.0));
-CPPUNIT_ASSERT_EQUAL(Color(0xd99594), 
Color(aColorStops[2].getStopColor()));
-CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style);
+CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), Color(ColorTransparency, 
aGradient.StartColor));
+CPPUNIT_ASSERT_EQUAL(Color(0xD99594), Color(ColorTransparency, 
aGradient.EndColor));
+CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);;
 
 xFrame.set(getShape(2), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, 
getProperty(xFrame, "FillStyle"));
 aGradient = getProperty(xFrame, "FillGradient");
-
-// MCGR: Use the completely imported transparency gradient to check for 
correctness
-aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops);
-
-CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size());
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 
0.0));
-CPPUNIT_ASSERT_EQUAL(Color(0x66), 
Color(aColorStops[0].getStopColor()));
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 
0.5));
-CPPUNIT_ASSERT_EQUAL(Color(0x00), 
Color(aColorStops[1].getStopColor()));
-CPPUNIT_ASSERT(b

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

2024-02-23 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlformatting.cxx |   17 ++--
 sw/qa/extras/ooxmlexport/data/tdf126533_axialAngle2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx|   27 +-
 sw/qa/extras/rtfexport/data/tdf159824_gradientAngle3.rtf |   17 
 sw/qa/extras/rtfexport/data/tdf159824_gradientAngle4.rtf |   17 
 sw/qa/extras/rtfexport/rtfexport8.cxx|   62 +--
 sw/source/filter/ww8/docxattributeoutput.cxx |   23 ++---
 sw/source/filter/ww8/rtfattributeoutput.cxx  |   37 
 8 files changed, 153 insertions(+), 47 deletions(-)

New commits:
commit 6dd6891a3deed8718bf2b0fcf564f229f676f8ba
Author: Justin Luth 
AuthorDate: Thu Feb 22 09:24:12 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Feb 23 20:28:31 2024 +0100

related tdf#126533 tdf#159824 VML: don't export: negative angles

and stop an automatic 180 reversal on import.

Some documents had gradient reversals on every round trip,
typically when the angle was 0-179
(mainly seen in ODT examples,
since DOCX/RTF imports defaulted to be angle 180).

The negative sign has special meaning,
indicating that the start and end colors
should be swapped.

Well, swapping colors was not intentional in the export logic.
Previously there was a mistaken idea
that any angles > 180 needed to be swapped on import,
and likely that is what prompted this overly complicated formula
to try to avoid any angle > 180 during export
by allowing negative angles.

This tdf#126533 patchset has already eliminated import checks
for angles > 180, so now a sane formula can be applied on export.

In order to do that, we have to avoid emulating color swaps
with 180 degree rotations at import time.
So ONLY do color swapping with start/end,
and leave the angle alone.
That GREATLY helps unit tests (which otherwise would flip-flop
the angle and the color start/stop).

Very unhelpful was an undocumented, indecipherable
inversion when converting to DML angle.

Boy, I hope I got this right...

make CppunitTest_sw_rtfexport8 \
   CPPUNIT_TEST_NAME=testTdf159824_gradientAngle3
make CppunitTest_sw_rtfexport8 \
   CPPUNIT_TEST_NAME=testTdf159824_gradientAngle4
make CppunitTest_sw_ooxmlexport7 \
   CPPUNIT_TEST_NAME=testTdf126533_axialAngle2

Eliminating the inversion for ooxml7 test is fine
since inversion does nothing to an axial.

Otherwise, eliminating inversions corresponds to a color swap.

Change-Id: I2aae0a7595807569ffc740689ff3840692d6159d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163798
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index f4022d0639d6..5fb422e63b9d 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -800,22 +800,29 @@ void FillModel::pushToPropMap( ShapePropertyMap& 
rPropMap, const GraphicHelper&
 }
 else// focus of -100%, 0%, and 100% is linear gradient
 {
+// LO linear gradients: top == start, but for MSO 
bottom == start == moColor
+bool bSwapColors = true;
+
 /*  According to spec, a focus of -100% or 100% swaps 
the
 start and stop colors, effectively reversing the 
gradient.
 If the angle was provided as a negative,
 then the colors are also (again) reversed. */
 if( fFocus < -0.5 || fFocus > 0.5 )
-nVmlAngle = (nVmlAngle + 180) % 360;
+bSwapColors = !bSwapColors;
 if (moAngle.value_or(0) < 0)
-nVmlAngle = (nVmlAngle + 180) % 360;
+bSwapColors = !bSwapColors;
 
+const Color& rStartColor = bSwapColors ? aColor2 : 
aColor1;
+const Color& rEndColor = bSwapColors ? aColor1 : 
aColor2;
 // set the start and stop colors
-lcl_setGradientStop( 
aFillProps.maGradientProps.maGradientStops, 0.0, aColor1 );
-lcl_setGradientStop( 
aFillProps.maGradientProps.maGradientStops, 1.0, aColor2 );
+
lcl_setGradientStop(aFillProps.maGradientProps.maGradientStops, 0.0,
+rStartColor);
+
lcl_setGradientStop(aFillProps.maGradientProps.maGradientStops, 1.0,
+rEndColor);
 }
 
 // VML counts counterclockwise from bottom, DrawingML 
clockwise from left
-sal_Int32 nDmlAngle = (630 - nVmlAngle) 

core.git: oox/source sw/qa

2024-02-23 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlformatting.cxx|   27 +++---
 sw/qa/extras/ooxmlexport/data/tdf126533_negativeAxialAngle.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx   |   45 
++
 3 files changed, 61 insertions(+), 11 deletions(-)

New commits:
commit 396ece804b3a31e4eddf56de4e557f3755331d8c
Author: Justin Luth 
AuthorDate: Wed Feb 14 18:16:29 2024 -0500
Commit: Miklos Vajna 
CommitDate: Fri Feb 23 10:53:40 2024 +0100

related tdf#126533 vml import: fix gradient color swapping

tdf#65295 already fixed one case
by removing the test for degrees > 180
for the linear-equivalent gradients.
Unfortunately the comment wasn't also removed,
so that was confusing: removed comment.

The test for degrees > 180 is not needed
for the axial-equivalent case either: removed.

The reason for that degrees > 180 case is likely due to
negative degrees, which is a documented reason
for swapping the colors: added swap if negative degrees.

All the affected, existing unit tests are improved now:
-tdf81345.docx: famous MS example: improved header gradient
-fdo78300.docx: fontworks: hard to tell without MCGR...

make CppunitTest_sw_ooxmlexport7 \
CPPUNIT_TEST_NAME=testTdf126533_negativeAxialAngle

make CppunitTest_sw_ooxmlexport7 \
CPPUNIT_TEST_NAME=testTdf77219_backgroundShape

Change-Id: I9f4d56375bb2cec28ffbd93df419d586da465b78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163417
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 6182950973ee..f4022d0639d6 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -777,15 +777,18 @@ void FillModel::pushToPropMap( ShapePropertyMap& 
rPropMap, const GraphicHelper&
 sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, 
sal_Int32 >( moAngle.value_or( 0 ), 0, 360 );
 
 // focus of -50% or 50% is axial gradient
+// so approximate anything with a similar focus by using 
LO's axial gradient,
+// (otherwise drop the radial aspect; linear gradient 
becomes the closest match)
 if( ((-0.75 <= fFocus) && (fFocus <= -0.25)) || ((0.25 <= 
fFocus) && (fFocus <= 0.75)) )
 {
-/*  According to spec, focus of 50% is outer-to-inner,
+/*  According to spec, a focus of positive 50% is 
outer-to-inner,
 and -50% is inner-to-outer (color to color2).
-BUT: For angles >= 180 deg., the behaviour is
-reversed... that's not spec'ed of course. So,
-[0;180) deg. and 50%, or [180;360) deg. and -50% is
-outer-to-inner in fact. */
-bool bOuterToInner = (fFocus > 0.0) == (nVmlAngle < 
180);
+If the angle was provided as a negative,
+then the colors are also (again) reversed. */
+bool bOuterToInner = fFocus > 0.0;
+if (moAngle.value_or(0) < 0)
+bOuterToInner = !bOuterToInner;
+
 // simulate axial gradient by 3-step DrawingML gradient
 const Color& rOuterColor = bOuterToInner ? aColor1 : 
aColor2;
 const Color& rInnerColor = bOuterToInner ? aColor2 : 
aColor1;
@@ -797,13 +800,15 @@ void FillModel::pushToPropMap( ShapePropertyMap& 
rPropMap, const GraphicHelper&
 }
 else// focus of -100%, 0%, and 100% is linear gradient
 {
-/*  According to spec, focus of -100% or 100% swaps the
-start and stop colors, effectively reversing the
-gradient. BUT: For angles >= 180 deg., the
-behaviour is reversed. This means that in this case
-a focus of 0% swaps the gradient. */
+/*  According to spec, a focus of -100% or 100% swaps 
the
+start and stop colors, effectively reversing the 
gradient.
+If the angle was provided as a negative,
+then the colors are also (again) reversed. */
 if( fFocus < -0.5 || fFocus > 0.5 )
 nVmlAngle = (nVmlAngle + 180) % 360;
+if (moAngle.value_or(0) < 0)
+nVmlAngle = (nVmlAngle + 180) % 360;
+
 // set the start and stop colors
 lcl_setGradientStop( 
aFillProps.maGradientProps.maGradientStops, 0.0, aColor1 );
   

core.git: oox/source

2024-02-20 Thread Julien Nabet (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ff516105c2df13cc71629b5a7156e16ec16b6988
Author: Julien Nabet 
AuthorDate: Tue Feb 20 18:40:13 2024 +0100
Commit: Julien Nabet 
CommitDate: Wed Feb 21 08:48:10 2024 +0100

Fix potentially uninitialized local variable 'fY' used in Windows TB

Change-Id: I3849d2263de113f09fc3f4839c156c2d0458d718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163667
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index 3bb537bbd7d7..b72ca4a38f78 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -392,8 +392,8 @@ bool Scene3DHelper::setExtrusionProperties(const 
oox::drawingml::Shape3DProperti
 // or if there is no such rotation but we have a perspective projection 
with true depth,
 // or we have a parallel projection other than a 'front' type.
 // In other cases the rendering as normal shape is better than any current 
extrusion.
-double fX;
-double fY;
+double fX = 0.0;
+double fY = 0.0;
 Scene3DHelper::getAPIAnglesFrom3DProperties(p3DProperties, 
rnMSOShapeRotation, fX, fY, rRotZ);
 sal_Int32 nDepthAmount = (*p3DProperties).mnExtrusionH.value_or(0);
 bool bIsParallel = aPrstCameraValuesArray[mnPrstCameraIndex].mbIsParallel;


core.git: oox/source sw/qa

2024-02-20 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlformatting.cxx   |   48 
 sw/qa/extras/tiledrendering/data/tdf159626_blackPatternFill.docx   |binary
 sw/qa/extras/tiledrendering/data/tdf159626_yellowPatternFill.docx  |binary
 sw/qa/extras/tiledrendering/data/tdf159626_yellowPatternFillB.docx |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   97 
++
 5 files changed, 145 insertions(+)

New commits:
commit 07521972bcd1cfbbd15b2f60ada84ffc69f8f997
Author: Justin Luth 
AuthorDate: Wed Feb 7 17:25:50 2024 -0500
Commit: Miklos Vajna 
CommitDate: Wed Feb 21 08:46:39 2024 +0100

tdf#159626 vml pattern import: add color, fix back/foreground

This depends on tdf#126533 which imports page style v:fill,
BUT ONLY IN ORDER TO support the unit tests.
The patch itself can stand alone
and fixes vml import into textboxes/shapes etc.
i.e. backporting could be possible by dropping the unit tests.

The pattern that VML uses to indicate foreground
and background is very different from what LO needs.
[Fortunately LO does not use the _guess_ from
vcl::bitmap::isHistorical8x8 to determine which
color is the background. Instead it always uses the first pixel.]

Documentation says that unspecified XML_fillcolor
and XML_color should be white, but observation
says it should be 25% gray (Word 2003).
25% gray == C0C0C0 == fillcolor="silver" == COL_LIGHTGRAY

Currently, we simply export as a colored, tiled image,
and not as a B&W type="pattern"
so no corresponding export changes need to be made to export.

Existing unit test documents that are affected:
-chart2export's PieChartDataLabels.docx (page background)
-ooxmlexport5's fdo77725.docx (minimized PieChartDataLabels.docx)
 * both foreground and background are set to white => solid white
-sw/qa/core/data/ooxml/pass/fdo79131.docx (shape "inline")

make CppunitTest_sw_tiledrendering \
CPPUNIT_TEST_NAME=testTdf159626_yellowPatternFill
make CppunitTest_sw_tiledrendering \
CPPUNIT_TEST_NAME=testTdf159626_yellowPatternFillB
make CppunitTest_sw_tiledrendering \
CPPUNIT_TEST_NAME=testTdf159626_blackPatternFill

Change-Id: I9533ac4a7489081ffc62a10e900f5526abb906db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163106
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 029d5429d921..6182950973ee 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+
 #include 
 #include 
 #include 
@@ -46,6 +47,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 namespace oox::vml {
@@ -843,6 +846,51 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, 
const GraphicHelper&
 aFillProps.maBlipProps.mxFillGraphic = 
rGraphicHelper.importEmbeddedGraphic(moBitmapPath.value());
 if (aFillProps.maBlipProps.mxFillGraphic.is())
 {
+if (nFillType == XML_pattern)
+{
+// VML provides an 8x8 black(background) and 
white(foreground) pattern
+// along with specified background(color2) and 
foreground(color) colors,
+// while LO needs the color applied directly to 
the pattern.
+const Graphic 
aGraphic(aFillProps.maBlipProps.mxFillGraphic);
+::Color nBackColor;
+::Color nPixelColor;
+bool bIs8x8 = 
vcl::bitmap::isHistorical8x8(aGraphic.GetBitmapEx(),
+   
nBackColor, nPixelColor);
+if (bIs8x8)
+{
+nBackColor
+= 
ConversionHelper::decodeColor(rGraphicHelper, moColor2,
+
moOpacity2, API_RGB_WHITE)
+  .getColor(rGraphicHelper);
+// Documentation says undefined == white; 
observation says lightgray
+nPixelColor
+= 
ConversionHelper::decodeColor(rGraphicHelper, moColor,
+moOpacity, 
COL_LIGHTGRAY)
+  .getColor(rGraphicHelper);
+
+XOBitmap aXOB(aGraphic.GetBitmapEx());
+aXOB.Bitmap2Array();
+// LO uses the first pixel's color to 
represent background pixels
+if (aXOB.GetBackgroundColor() == COL

core.git: oox/source sw/qa writerfilter/source

2024-02-20 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlshapecontext.cxx|1 
 sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx|   21 +
 writerfilter/source/dmapper/DomainMapper.cxx  |   58 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 
 writerfilter/source/dmapper/PropertyMap.cxx   |   33 +++
 writerfilter/source/ooxml/model.xml   |3 
 7 files changed, 115 insertions(+), 2 deletions(-)

New commits:
commit c14574e7ad2d3ec2ada40808be3332fac71e9767
Author: Justin Luth 
AuthorDate: Sat Feb 3 10:08:56 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 20 16:54:57 2024 +0100

tdf#126533 docx import: page background vml fill

This patch imports bitmaps/tiled textures (primarily),
but also somewhat for gradients
(because of a gradient2 -> gradient mismatch somewhere)
and somewhat for patterns
(because patterns are not well imported in general).

Note that the imported fill likely will NOT match MSO,
because their background CHANGES BASED ON THE ZOOM LEVEL.
For example, my primary testing file (A6 landscape)
has a logo which is only 25% visible in Word 2003 at 100%,
but shows 90% of the logo at 200%, and many tiles of logos
when exported as PDF.
The same is true for gradients etc.

Changing background on zoom is an absolutely bizarre implementation,
and naturally LO could only accidentally look identical
(and should never try to do so).

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf126533_noPageBitmap

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf126533_pageGradient

This is slightly ugly, but I don't know how to make a COPY
of the XPropertySet UNO junk. All I have is references,
and dispose deletes everything, even the references.

I took some inspiration from RTF
which just disposes the shape after grabbing the background color.

Thus, just change the page style known to exist and be used,
and then simply remove the fill if it isn't needed in the end.
Any new page styles can just copy the default page style fill.

Change-Id: Id3ea002c685642ff4c289982d0108247a6e9bb8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162958
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index e3242368a334..20ce2fa37434 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -251,6 +251,7 @@ ContextHandlerRef ShapeContextBase::createShapeContext( 
ContextHandler2Helper co
 return new ShapeContext( rParent, rShapes.createShape< 
BezierShape >(), rAttribs );
 else
 return new ShapeContext( rParent, rShapes.createShape< 
ComplexShape >(), rAttribs );
+case VML_TOKEN(background):
 case VML_TOKEN( rect ):
 return new RectangleShapeContext( rParent, rAttribs, 
rShapes.createShape< RectangleShape >() );
 case VML_TOKEN( roundrect ):
diff --git a/sw/qa/core/data/ooxml/pass/fill.docx 
b/sw/qa/extras/ooxmlexport/data/fill.docx
similarity index 100%
rename from sw/qa/core/data/ooxml/pass/fill.docx
rename to sw/qa/extras/ooxmlexport/data/fill.docx
diff --git a/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx 
b/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx
new file mode 100644
index ..87dfff296be5
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index f1d4a5e7121a..e455467a74ef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -366,6 +367,26 @@ CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData)
 assertXPath(pCoreDoc, "/cp:coreProperties/cp:revision"_ostr, 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, 
"tdf126533_noPageBitmap.docx")
+{
+// given a document with a v:background bitmap, but no w:background 
fillcolor
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName("Standard"),
+   uno::UNO_QUERY);
+// the image (or any fill for that matter) should be ignored.
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE,
+ getProperty(xPageStyle, 
"FillStyle"));
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient)
+{
+// given a document with a gradient page background
+loadFromFile(u"fill.docx");
+uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName("Standard"),
+   uno::UNO_QUERY);

core.git: oox/source

2024-02-20 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 01c7eefbb8722e2e5ef835777c2161b8e3d5aad8
Author: Andrea Gelmini 
AuthorDate: Tue Feb 20 11:13:33 2024 +0100
Commit: Julien Nabet 
CommitDate: Tue Feb 20 16:26:59 2024 +0100

Fix typo

Change-Id: I51796820bc4fdf3c792933b67a71b22c56fc36c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163642
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index 2cacc8e60fb0..3bb537bbd7d7 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -290,7 +290,7 @@ void Scene3DHelper::addExtrusionDepthToMap(const 
oox::drawingml::Shape3DProperti
 if (nDepthAmount == 0 && nZPosition != 0)
 {
 // We cannot express the position relative to the extrusion depth.
-// Use an artifical, small depth of 1Hmm
+// Use an artificial, small depth of 1Hmm
 fDepthRelPos = fZPosition;
 fDepthAmount = 1.0; // unit Hmm
 }


core.git: oox/source

2024-02-20 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/scene3dhelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 097978b98f457e91643e5d8c65f48e21855851fd
Author: Andrea Gelmini 
AuthorDate: Tue Feb 20 11:15:08 2024 +0100
Commit: Julien Nabet 
CommitDate: Tue Feb 20 16:25:45 2024 +0100

Fix typo

Change-Id: I22372726ef167714076278eff9727ee79b951c56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163643
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index 274cc460b825..2cacc8e60fb0 100755
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -329,7 +329,7 @@ void Scene3DHelper::addProjectionGeometryToMap(
 // oblique projections (index [38..45]) need special treatment. MS 
Office rotates around the
 // z-axis after the projection was created. Thus the rotation affects 
the skew direction. ODF
 // rotates the shape before creating the projection. Thus we need to 
incorporate the shape
-// rotation into the shew angle.
+// rotation into the skew angle.
 if (38 <= mnPrstCameraIndex && mnPrstCameraIndex <= 45)
 {
 fSkewAngle -= rnMSOShapeRotation / 6.0;


core.git: oox/source

2024-02-16 Thread Justin Luth (via logerrit)
 oox/source/export/vmlexport.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 5132255021aa61f8a1fa7d8de820cb3528699812
Author: Justin Luth 
AuthorDate: Fri Feb 16 14:11:11 2024 -0500
Commit: Justin Luth 
CommitDate: Sat Feb 17 03:57:47 2024 +0100

tdf#153761 vml export: avoid corrupt docx: don't write empty r:id

For the benefit of MSO, do not write r:id="",
since MSO refuses to open such a document.

Change-Id: I21887021c747fc9a9764befc7081e21d99e47545
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163523
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 1090b0857f5c..8438befa62af 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -741,8 +741,11 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, 
const tools::Rectangle&
 Graphic aGraphic;
 GraphicConverter::Import(aStream, aGraphic);
 OUString aImageId = 
m_pTextExport->GetDrawingML().writeGraphicToStorage(aGraphic, false);
-pAttrList->add(FSNS(XML_r, XML_id), aImageId);
-imageData = true;
+if (!aImageId.isEmpty())
+{
+pAttrList->add(FSNS(XML_r, XML_id), aImageId);
+imageData = true;
+}
 }
 
 if (rProps.GetOpt(ESCHER_Prop_fNoFillHitTest, nValue))


core.git: oox/source

2024-02-15 Thread Noel Grandin (via logerrit)
 oox/source/helper/zipstorage.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit dcc9626eac53fef42b1a85c3235d1e4e48331bee
Author: Noel Grandin 
AuthorDate: Mon Feb 12 15:56:48 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 15 13:58:53 2024 +0100

SAL_WARN->SAL_INFO

reduce log noise

Change-Id: I16a45c8c41292b245a507ee51924b2f465719c97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163370
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index db73b14bdd6c..ff74641d0860 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -65,7 +65,8 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& 
rxContext, const R
 }
 catch (Exception const&)
 {
-TOOLS_WARN_EXCEPTION("oox.storage", "ZipStorage::ZipStorage exception 
opening input storage");
+// this is normally a noise exception, because it happens during file 
format detection
+TOOLS_INFO_EXCEPTION("oox.storage", "ZipStorage::ZipStorage exception 
opening input storage");
 }
 }
 


core.git: oox/source package/source sfx2/source

2024-02-01 Thread Mike Kaganski (via logerrit)
 oox/source/core/xmlfilterbase.cxx |4 ++-
 package/source/zipapi/ZipFile.cxx |   42 --
 sfx2/source/doc/docfile.cxx   |   15 ++---
 3 files changed, 55 insertions(+), 6 deletions(-)

New commits:
commit 747463809e50c132557a95dcee6709a1fa82d760
Author: Mike Kaganski 
AuthorDate: Thu Feb 1 20:55:40 2024 +0600
Commit: Mike Kaganski 
CommitDate: Thu Feb 1 21:07:54 2024 +0100

tdf#154587: allow directory entries in ZIP packages

The problem in the bugdoc was the directory entries. These entries
are valid in ZIP packages (even if not common); they may be useful
to e.g. define per-directory permissions (ACLs).

In normal mode, ZipFile reads central directory; there we can read
if the entry has FAT file attributes; and then, if the entry is a
directory. Then it is OK to skip it.

In repair mode, central directory is not used, local file headers
don't contain a "directory" flag. A workaround is used, checking
if there are entries that represent directories of other entries.

Also this change fixes some places that didn't pass the recovery
flag correctly.

Change-Id: I324671841a2c4d0f279b03801d95c8f2eeb99b46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162888
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 7afb84cad2c6..f6bda14e920a 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -288,8 +288,10 @@ void XmlFilterBase::importDocumentProperties()
 rtl::Reference< ::oox::core::FilterDetect > xDetector( new 
::oox::core::FilterDetect( xContext ) );
 xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc );
 Reference< XComponent > xModel = getModel();
+const bool repairPackage = 
aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
 Reference< XStorage > xDocumentStorage (
-::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( 
OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) );
+::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
+OFOPXML_STORAGE_FORMAT_STRING, xInputStream, {}, repairPackage));
 Reference< XInterface > xTemp = 
xContext->getServiceManager()->createInstanceWithContext(
 "com.sun.star.document.OOXMLDocumentPropertiesImporter",
 xContext);
diff --git a/package/source/zipapi/ZipFile.cxx 
b/package/source/zipapi/ZipFile.cxx
index 474b73ff53db..71fd66f08196 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1073,7 +1074,7 @@ sal_Int32 ZipFile::readCEN()
 if ( nTestSig != CENSIG )
 throw ZipException("Invalid CEN header (bad signature)" );
 
-aMemGrabber.skipBytes ( 2 );
+sal_uInt16 versionMadeBy = aMemGrabber.ReadUInt16();
 aEntry.nVersion = aMemGrabber.ReadInt16();
 aEntry.nFlag = aMemGrabber.ReadInt16();
 
@@ -1093,7 +1094,8 @@ sal_Int32 ZipFile::readCEN()
 aEntry.nPathLen = aMemGrabber.ReadInt16();
 aEntry.nExtraLen = aMemGrabber.ReadInt16();
 nCommentLen = aMemGrabber.ReadInt16();
-aMemGrabber.skipBytes ( 8 );
+aMemGrabber.skipBytes ( 4 );
+sal_uInt32 externalFileAttributes = aMemGrabber.ReadUInt32();
 sal_uInt64 nOffset = aMemGrabber.ReadUInt32();
 
 if ( aEntry.nPathLen < 0 )
@@ -1132,6 +1134,15 @@ sal_Int32 ZipFile::readCEN()
 throw ZipException("Integer-overflow");
 
 aMemGrabber.skipBytes(nCommentLen);
+
+// Is this a FAT-compatible empty entry?
+if (aEntry.nSize == 0 && (versionMadeBy & 0xff00) == 0)
+{
+constexpr sal_uInt32 FILE_ATTRIBUTE_DIRECTORY = 16;
+if (externalFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+continue; // This is a directory entry, not a stream - 
skip it
+}
+
 aEntries[aEntry.sPath] = aEntry;
 }
 
@@ -1253,6 +1264,7 @@ void ZipFile::recover()
   
RTL_TEXTENCODING_UTF8 );
 aEntry.nPathLen = static_cast< sal_Int16 
>(aFileName.getLength());
 }
+aEntry.sPath = aEntry.sPath.replace('\', '/');
 
 // read 64bit header
 if (aEntry.nExtraLen > 0)
@@ -1294,7 +1306,33 @@ void ZipFile::recover()
 aEntry.nSize = 0;
 }
 
+// Do not add this entry, if it is empty 
and is a directory of
+// an al

core.git: oox/source

2024-01-29 Thread Justin Luth (via logerrit)
 oox/source/drawingml/chart/chartcontextbase.cxx |4 +++-
 oox/source/drawingml/chart/seriescontext.cxx|2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 301e27cbebf7d6e4c9b82290d7cd555c43f0c999
Author: Justin Luth 
AuthorDate: Thu Jan 25 10:30:33 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Jan 29 15:47:31 2024 +0100

tdf#146756 pie chart2: import extLst manualLayout W and H

The width of text labels in pie charts is currently determined
completely arbitrarily.

If the file specifies X and Y coordinates along with W and H sizing,
then perhaps it is appropriate to use this?
We currently import but ignore X/Y,
so lets also make W/H available
so we at least have a chance to ignore those too.

Change-Id: I5caa48cf899e4e290eb2e8e78f731b6c5bcdd017
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162589
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx 
b/oox/source/drawingml/chart/chartcontextbase.cxx
index 5423c52b3d35..283c8e03ad55 100644
--- a/oox/source/drawingml/chart/chartcontextbase.cxx
+++ b/oox/source/drawingml/chart/chartcontextbase.cxx
@@ -58,10 +58,12 @@ ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 
nElement, const Attr
 switch( getCurrentElement() )
 {
 case C_TOKEN( layout ):
+case C15_TOKEN(layout):
 switch( nElement )
 {
 case C_TOKEN( manualLayout ):
-mrModel.mbAutoLayout = false;
+if (getCurrentElement() == C_TOKEN(layout))
+mrModel.mbAutoLayout = false;
 return this;
 }
 break;
diff --git a/oox/source/drawingml/chart/seriescontext.cxx 
b/oox/source/drawingml/chart/seriescontext.cxx
index 5afc32c1497d..bfbc28304ab3 100644
--- a/oox/source/drawingml/chart/seriescontext.cxx
+++ b/oox/source/drawingml/chart/seriescontext.cxx
@@ -129,6 +129,8 @@ ContextHandlerRef DataLabelContext::onCreateContext( 
sal_Int32 nElement, const A
 mrModel.mobShowDataLabelsRange = rAttribs.getBool( XML_val 
);
 return nullptr;
 }
+else if (nElement == C15_TOKEN(layout))
+return new LayoutContext(*this, 
mrModel.mxLayout.getOrCreate());
 break;
 }
 }


core.git: oox/source sw/CppunitTest_sw_ooxmlexport21.mk sw/qa

2024-01-29 Thread Samuel Mehrbrodt (via logerrit)
 oox/source/core/xmlfilterbase.cxx   |   43 +++-
 sw/CppunitTest_sw_ooxmlexport21.mk  |4 +
 sw/qa/extras/ooxmlexport/data/personalmetadata.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx  |   39 ++
 4 files changed, 77 insertions(+), 9 deletions(-)

New commits:
commit 1e49f469afcbf3d1abec25451117f5f10d3ba825
Author: Samuel Mehrbrodt 
AuthorDate: Mon Jan 29 11:25:17 2024 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jan 29 13:18:04 2024 +0100

Don't export personal metadata to OOXML in privacy mode

Change-Id: Iac0985783a0c7334bd6ee3cfcaf37c135ac452ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162682
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 2e7ce9a75cbc..7afb84cad2c6 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -622,6 +623,12 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 
nXmlElement, const LanguageTag&
 static void
 writeCoreProperties( XmlFilterBase& rSelf, const Reference< 
XDocumentProperties >& xProperties )
 {
+bool bRemovePersonalInfo
+= 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo);
+bool bRemoveUserInfo
+= bRemovePersonalInfo
+  && 
!SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo);
+
 OUString sValue;
 if( rSelf.getVersion() == oox::core::ISOIEC_29500_2008  )
 {
@@ -670,8 +677,11 @@ writeCoreProperties( XmlFilterBase& rSelf, const 
Reference< XDocumentProperties
 if (it->second >>= aValue)
 writeElement( pCoreProps, FSNS( XML_cp, XML_contentType ), aValue 
);
 }
-writeElement( pCoreProps, FSNS( XML_dcterms, XML_created ), 
xProperties->getCreationDate() );
-writeElement( pCoreProps, FSNS( XML_dc, XML_creator ),  
xProperties->getAuthor() );
+if (!bRemoveUserInfo)
+{
+writeElement(pCoreProps, FSNS(XML_dcterms, XML_created), 
xProperties->getCreationDate());
+writeElement(pCoreProps, FSNS(XML_dc, XML_creator), 
xProperties->getAuthor());
+}
 writeElement( pCoreProps, FSNS( XML_dc, XML_description ),  
xProperties->getDescription() );
 
 it = aUserDefinedProperties.find("OOXMLCorePropertyIdentifier");
@@ -683,10 +693,18 @@ writeCoreProperties( XmlFilterBase& rSelf, const 
Reference< XDocumentProperties
 }
 writeElement( pCoreProps, FSNS( XML_cp, XML_keywords ), 
xProperties->getKeywords() );
 writeElement( pCoreProps, FSNS( XML_dc, XML_language ), 
LanguageTag( xProperties->getLanguage()) );
-writeElement( pCoreProps, FSNS( XML_cp, XML_lastModifiedBy ),   
xProperties->getModifiedBy() );
-writeElement( pCoreProps, FSNS( XML_cp, XML_lastPrinted ),  
xProperties->getPrintDate() );
-writeElement( pCoreProps, FSNS( XML_dcterms, XML_modified ),
xProperties->getModificationDate() );
-writeElement( pCoreProps, FSNS( XML_cp, XML_revision ), 
xProperties->getEditingCycles() );
+
+if (!bRemoveUserInfo)
+{
+writeElement(pCoreProps, FSNS(XML_cp, XML_lastModifiedBy), 
xProperties->getModifiedBy());
+writeElement(pCoreProps, FSNS(XML_cp, XML_lastPrinted), 
xProperties->getPrintDate());
+writeElement(pCoreProps, FSNS(XML_dcterms, XML_modified),
+ xProperties->getModificationDate());
+}
+if (!bRemovePersonalInfo)
+{
+writeElement(pCoreProps, FSNS(XML_cp, XML_revision), 
xProperties->getEditingCycles());
+}
 writeElement( pCoreProps, FSNS( XML_dc, XML_subject ),  
xProperties->getSubject() );
 writeElement( pCoreProps, FSNS( XML_dc, XML_title ),
xProperties->getTitle() );
 
@@ -706,6 +724,11 @@ writeCoreProperties( XmlFilterBase& rSelf, const 
Reference< XDocumentProperties
 static void
 writeAppProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties 
>& xProperties )
 {
+bool bRemovePersonalInfo
+= 
SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo);
+bool bRemoveUserInfo
+= bRemovePersonalInfo
+  && 
!SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo);
 rSelf.addRelation(
 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";,
 u"docProps/app.xml" );
@@ -720,7 +743,8 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< 
XDocumentProperties >
 comphelper::SequenceAsHashMap 
aUserDefinedProperties(xUserDefinedProperties->getPropertyValues());
 comphelper::SequenceAsHashMap::iterator it;
 
-writeElement( pAppProps, XML_Template,  
xProperties->getTemplateName() );
+if 

core.git: oox/source

2024-01-25 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/chart/chartspaceconverter.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9485d88da541c8614582b9f927ae40b1c8991c56
Author: Caolán McNamara 
AuthorDate: Wed Jan 24 20:24:12 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 25 11:47:38 2024 +0100

crashtesting: crash seen on import of forum-mso-en4-278652.xlsx

probably an issue since:

commit 135ce256ce9e879663d828ec6e699de521fad867
Date:   Mon Aug 14 15:59:18 2023 +0200

tdf#146487 Don't show generic diagram title when there is an empty 
title given

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

diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx 
b/oox/source/drawingml/chart/chartspaceconverter.cxx
index f9b370e04d8f..9280d42ff25c 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -191,7 +191,8 @@ void ChartSpaceConverter::convertFromModel( const 
Reference< XShapes >& rxExtern
&& mrModel.mxTitle->mxTextProp.is()
&& mrModel.mxTitle->mxTextProp->isEmpty();
 // Also for tdf#146487
-bool bEmptyRichText = mrModel.mxTitle->mxText.is()
+bool bEmptyRichText = mrModel.mxTitle
+&& mrModel.mxTitle->mxText.is()
 && mrModel.mxTitle->mxText->mxTextBody.is()
 && mrModel.mxTitle->mxText->mxTextBody->isEmpty();
 


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: oox/source

2024-01-19 Thread Stephan Bergmann (via logerrit)
 oox/source/drawingml/chart/plotareaconverter.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3fb9859c6aa4a32f2333d86fa438e9f1d6ef7f55
Author: Stephan Bergmann 
AuthorDate: Fri Jan 19 08:42:13 2024 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 19 10:20:57 2024 +0100

PlotAreaConverter::mbSingleSeriesTitle is apparently read uninitialized

...in code newly introduced in 135ce256ce9e879663d828ec6e699de521fad867
"tdf#146487 Don't show generic diagram title when there is an empty title
given", which caused CppunitTest_chart2_export2 to fail with

> /oox/inc/drawingml/chart/plotareaconverter.hxx:78:62: runtime error: load 
of value 222, which is not a valid value for type 'bool'
> #0 0x7f95cd9ed87c in 
oox::drawingml::chart::PlotAreaConverter::isSingleSeriesTitle() const 
/oox/inc/drawingml/chart/plotareaconverter.hxx:78:62
> #1 0x7f95cd9e506f in 
oox::drawingml::chart::ChartSpaceConverter::convertFromModel(com::sun::star::uno::Reference
 const&, com::sun::star::awt::Point const&) 
/oox/source/drawingml/chart/chartspaceconverter.cxx:189:53
> #2 0x7f95cd9b6c34 in 
oox::drawingml::chart::ChartConverter::convertFromModel(oox::core::XmlFilterBase&,
 oox::drawingml::chart::ChartSpaceModel&, 
com::sun::star::uno::Reference const&, 
com::sun::star::uno::Reference const&, 
com::sun::star::awt::Point const&, com::sun::star::awt::Size const&) 
/oox/source/drawingml/chart/chartconverter.cxx:93:20
> #3 0x7f95ce548f59 in 
oox::drawingml::Shape::finalizeXShape(oox::core::XmlFilterBase&, 
com::sun::star::uno::Reference const&) 
/oox/source/drawingml/shape.cxx:2245:50
> #4 0x7f95438150b2 in 
oox::xls::Shape::finalizeXShape(oox::core::XmlFilterBase&, 
com::sun::star::uno::Reference const&) 
/sc/source/filter/oox/drawingfragment.cxx:113:30
> #5 0x7f95ce5267bb in 
oox::drawingml::Shape::createAndInsert(oox::core::XmlFilterBase&, rtl::OUString 
const&, oox::drawingml::Theme const*, 
com::sun::star::uno::Reference const&, bool, 
bool, basegfx::B2DHomMatrix&, oox::drawingml::FillProperties const&, 
std::shared_ptr) /oox/source/drawingml/shape.cxx:1964:9
> #6 0x7f95ce4edb54 in 
oox::drawingml::Shape::addShape(oox::core::XmlFilterBase&, 
oox::drawingml::Theme const*, 
com::sun::star::uno::Reference const&, 
basegfx::B2DHomMatrix const&, oox::drawingml::FillProperties const&, 
std::__debug::map, 
std::less, std::allocator > > >*, 
std::shared_ptr) /oox/source/drawingml/shape.cxx:366:41
> #7 0x7f954381ef79 in oox::xls::DrawingFragment::onEndElement() 
/sc/source/filter/oox/drawingfragment.cxx:335:30
> #8 0x7f95cdcaee54 in 
oox::core::ContextHandler2Helper::implEndElement(int) 
/oox/source/core/contexthandler2.cxx:125:9
> #9 0x7f95cdd5c116 in oox::core::FragmentHandler2::endFastElement(int) 
/oox/source/core/fragmenthandler2.cxx:91:5
> #10 0x7f95caf68fca in (anonymous namespace)::Entity::endElement() 
/sax/source/fastparser/fastparser.cxx:514:27
> #11 0x7f95caf68998 in 
sax_fastparser::FastSaxParserImpl::callbackEndElement() 
/sax/source/fastparser/fastparser.cxx:1331:17
> #12 0x7f95caf58444 in (anonymous 
namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char 
const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:338:18
> #13 0x7f960adebeda in xmlParseEndTag2 
/workdir/UnpackedTarball/libxml2/parser.c:10090:2
> #14 0x7f960ad929b5 in xmlParseTryOrFinish 
/workdir/UnpackedTarball/libxml2/parser.c:11868:14
> #15 0x7f960ad86334 in xmlParseChunk 
/workdir/UnpackedTarball/libxml2/parser.c:12151:5
> #16 0x7f95caf53231 in sax_fastparser::FastSaxParserImpl::parse() 
/sax/source/fastparser/fastparser.cxx:1085:21
> #17 0x7f95caf4cd18 in 
sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource
 const&) /sax/source/fastparser/fastparser.cxx:890:9
> #18 0x7f95caf6e950 in 
sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource
 const&) /sax/source/fastparser/fastparser.cxx:1470:13
> #19 0x7f95cdce50d1 in 
oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource 
const&, bool) /oox/source/core/fastparser.cxx:121:15
> #20 0x7f95cdce5868 in 
oox::core::FastParser::parseStream(com::sun::star::uno::Reference
 const&, rtl::OUString const&) /oox/source/core/fastparser.cxx:129:5
> #21 0x7f95cddbb234 in 
oox::core::XmlFilterBase::importFragment(rtl::Reference
 const&, oox::core::FastParser&) /oox/source/core/xmlfilterbase.cxx:414:21
> #22 0x7f95cddb9b8d in 
oox::core::XmlFilterBase::importFragment(rtl::Reference
 const&) /oox/source/core/xmlfilterbase.cxx:344:12
> #23 0x7f95441ceaa8 in 
oox::xls::WorkbookHelper::importOoxFragment(rtl::Reference
 const&) /sc/source/filter/oox/workbookhelper.cxx:1046:27
> #24 0x7f95442797f1 in oox::xls::WorksheetGlobals::finalizeDrawings() 
/sc/sour

core.git: oox/source

2024-01-18 Thread Stephan Bergmann (via logerrit)
 oox/source/crypto/CryptTools.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 71d4abc51b556e147ab53a9a52b15be36fc710a3
Author: Stephan Bergmann 
AuthorDate: Thu Jan 18 13:16:56 2024 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 18 21:09:30 2024 +0100

-Werror,-Wdeprecated-declarations (Emscripten)

> oox/source/crypto/CryptTools.cxx:57:40: error: 'HMAC_CTX_free' is 
deprecated [-Werror,-Wdeprecated-declarations]
> void operator()(HMAC_CTX* p) { HMAC_CTX_free(p); }
>^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:35:1: note: 
'HMAC_CTX_free' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_free(HMAC_CTX *ctx);
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: 
expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0OSSL_DEPRECATED(3.0)
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: 
expanded from macro 'OSSL_DEPRECATED'
> # define OSSL_DEPRECATED(since) __attribute__((deprecated))
>^
> oox/source/crypto/CryptTools.cxx:112:29: error: 'HMAC_CTX_new' is 
deprecated [-Werror,-Wdeprecated-declarations]
> mpHmacContext.reset(HMAC_CTX_new());
> ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:33:1: note: 
'HMAC_CTX_new' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void);
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: 
expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0OSSL_DEPRECATED(3.0)
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: 
expanded from macro 'OSSL_DEPRECATED'
> # define OSSL_DEPRECATED(since) __attribute__((deprecated))
>^
> oox/source/crypto/CryptTools.cxx:125:9: error: 'HMAC_Init_ex' is 
deprecated [-Werror,-Wdeprecated-declarations]
> HMAC_Init_ex(mpHmacContext.get(), rKey.data(), rKey.size(), 
aEvpMd, nullptr);
> ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:43:1: note: 
'HMAC_Init_ex' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, 
int len,
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: 
expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0OSSL_DEPRECATED(3.0)
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: 
expanded from macro 'OSSL_DEPRECATED'
> # define OSSL_DEPRECATED(since) __attribute__((deprecated))
>^
> oox/source/crypto/CryptTools.cxx:499:12: error: 'HMAC_Update' is 
deprecated [-Werror,-Wdeprecated-declarations]
> return HMAC_Update(mpImpl->mpHmacContext.get(), rInput.data(), 
nActualInputLength) != 0;
>^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:45:1: note: 
'HMAC_Update' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char 
*data,
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: 
expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0OSSL_DEPRECATED(3.0)
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: 
expanded from macro 'OSSL_DEPRECATED'
> # define OSSL_DEPRECATED(since) __attribute__((deprecated))
>^
> oox/source/crypto/CryptTools.cxx:512:12: error: 'HMAC_Final' is 
deprecated [-Werror,-Wdeprecated-declarations]
> (void) HMAC_Final(mpImpl->mpHmacContext.get(), aHash.data(), 
&nSizeWritten);
>^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:47:1: note: 
'HMAC_Final' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md,
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: 
expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0OSSL_DEPRECATED(3.0)
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: 
expanded from macro 'OSSL_DEPRECATED'
> # define OSSL_DEPRECATED(since) __attribute__((deprecated))
>

core.git: oox/source sd/qa

2024-01-17 Thread Mike Kaganski (via logerrit)
 oox/source/drawingml/shape.cxx |   37 +++--
 sd/qa/unit/export-tests-ooxml4.cxx |   22 +-
 2 files changed, 16 insertions(+), 43 deletions(-)

New commits:
commit 67ba6ccd5a75ee6ade0e6aaa8bdc33f651a0d82c
Author: Mike Kaganski 
AuthorDate: Wed Jan 17 21:21:24 2024 +0600
Commit: Mike Kaganski 
CommitDate: Thu Jan 18 05:28:38 2024 +0100

tdf#140912, tdf#159219: fix import of graphic placeholder with custom prompt

Importing the text marks the object as not empty. Then, the object would
behave as an outliner object. This includes showing in slide show; allowing
text esiting; stretching the placeholder image, which required a workaround
implemented in commit 7b3be7f6f3d800e2ad86f5a043e6e9b21ed4409f (tdf#140912
Better handling of the picture placeholders, 2021-12-01).

Instead, drop the custom prompt. More correct solution would be making sure
to mark the object as empty after setting the text; but this doesn't round-
trip to ODF; and it crashes export to PPTX. Proper support for the sustom
placeholder prompt feature should be done separately.

The new workaround (dropping the text) makes previous workaround (special
handling of the placeholder graphic) unnecessary. The unit test is updated.

Change-Id: Ic7f42493af8d1d725ffa39ffab58f1ff033351cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162202
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 5df335be727d..b4c50a91f730 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -95,7 +95,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1539,35 +1538,6 @@ Reference< XShape > const & Shape::createAndInsert(
 
propertySet->setPropertyValue("InteropGrabBag",uno::Any(aGrabBag));
 }
 
-// If the shape is a picture placeholder.
-if (aServiceName == "com.sun.star.presentation.GraphicObjectShape" 
&& !bClearText)
-{
-// Placeholder text should be in center of the shape.
-aShapeProps.setProperty(PROP_TextContourFrame, false);
-
-/* Placeholder icon should be at the center of the parent 
shape.
- * We use negative graphic crop property because of that we 
don't
- * have padding support.
- */
-uno::Reference 
xGraphic(xSet->getPropertyValue("Graphic"), uno::UNO_QUERY);
-if (xGraphic.is())
-{
-awt::Size aBitmapSize;
-xGraphic->getPropertyValue("Size100thMM") >>= aBitmapSize;
-sal_Int32 nXMargin = (aShapeRectHmm.Width - 
aBitmapSize.Width) / 2;
-sal_Int32 nYMargin = (aShapeRectHmm.Height - 
aBitmapSize.Height) / 2;
-if (nXMargin > 0 && nYMargin > 0)
-{
-text::GraphicCrop aGraphicCrop;
-aGraphicCrop.Top = nYMargin * -1;
-aGraphicCrop.Bottom = nYMargin * -1;
-aGraphicCrop.Left = nXMargin * -1;
-aGraphicCrop.Right = nXMargin * -1;
-aShapeProps.setProperty(PROP_GraphicCrop, 
aGraphicCrop);
-}
-}
-}
-
 PropertySet( xSet ).setProperties( aShapeProps );
 
 if (mpTablePropertiesPtr && aServiceName == 
"com.sun.star.drawing.TableShape")
@@ -1873,6 +1843,13 @@ Reference< XShape > const & Shape::createAndInsert(
 aPropertySet.setAnyProperty( PROP_VertOrientPosition, Any( 
maPosition.Y ) );
 }
 
+// Make sure to not set text to placeholders. Doing it here would 
eventually call
+// SvxTextEditSourceImpl::UpdateData, 
SdrObject::SetEmptyPresObj(false), and that
+// would make the object behave like a standard outline object.
+// TODO/FIXME: support custom prompt text in placeholders.
+if (rServiceName == "com.sun.star.presentation.GraphicObjectShape")
+mpTextBody.reset();
+
 // in some cases, we don't have any text body.
 if( mpTextBody && ( !bDoNotInsertEmptyTextBody || 
!mpTextBody->isEmpty() ) )
 {
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index cd3b5f5d5de4..9ebb88208cc1 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -751,22 +751,18 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf147121)
 
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf140912_PicturePlaceholder)
 {
-// FIXME: the DPI check should be removed when either (1) the test is 
fixed to work with
-// non-default DPI; or (2) unit tests on Windows are made to use svp VCL 
plugin.
-// -8490 in the test belo

core.git: oox/source

2024-01-15 Thread Caolán McNamara (via logerrit)
 oox/source/export/chartexport.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6da480d086a599f6a0159c5244ce8fe0ae4131b8
Author: Caolán McNamara 
AuthorDate: Mon Jan 15 11:18:06 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Jan 15 14:13:02 2024 +0100

crashtesting: null deref of xValueSeq

since:

commit 0bf4338cfe406a0d527ac78ce76ff7dd3837df03 (HEAD)
Date:   Mon Jan 8 13:52:03 2024 -0500

tdf#137691 chart2 export: preserve NumberFormat of DataSeries

make CppunitTest_chart2_export3 CPPUNIT_TEST_NAME=tdf137691

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

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 7de4cee0c4c0..c80e8c1ba688 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2959,7 +2959,7 @@ void ChartExport::exportSeriesValues( const Reference< 
chart2::data::XDataSequen
 pFS->startElement(FSNS(XML_c, XML_numCache));
 pFS->startElement(FSNS(XML_c, XML_formatCode));
 OUString sNumberFormatString("General");
-const sal_Int32 nKey = xValueSeq->getNumberFormatKeyByIndex(-1);
+const sal_Int32 nKey = xValueSeq.is() ? 
xValueSeq->getNumberFormatKeyByIndex(-1) : 0;
 if (nKey > 0)
 sNumberFormatString = getNumberFormatCode(nKey);
 pFS->writeEscaped(sNumberFormatString);


core.git: oox/source

2024-01-07 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/diagram/diagram.cxx |  198 ---
 1 file changed, 104 insertions(+), 94 deletions(-)

New commits:
commit a46db49e301e71d78b356c57adfae6e79d3c38b5
Author: Caolán McNamara 
AuthorDate: Sat Jan 6 20:16:14 2024 +
Commit: Caolán McNamara 
CommitDate: Sun Jan 7 13:58:38 2024 +0100

ofz#65567 unset DiagramFontHeights on exception

git diff -w is your friend

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

diff --git a/oox/source/drawingml/diagram/diagram.cxx 
b/oox/source/drawingml/diagram/diagram.cxx
index ce8a7cfb1db4..029c2c56e962 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -310,121 +310,131 @@ void loadDiagram( ShapePtr const & pShape,
 DiagramLayoutPtr pLayout = std::make_shared(*pDiagram);
 pDiagram->setLayout( pLayout );
 
-// set DiagramFontHeights at filter
-rFilter.setDiagramFontHeights(&pDiagram->getDiagramFontHeights());
-
-// data
-if( !rDataModelPath.isEmpty() )
+try
 {
-rtl::Reference< core::FragmentHandler > xRefDataModel(
-new DiagramDataFragmentHandler( rFilter, rDataModelPath, pData 
));
+// set DiagramFontHeights at filter
+rFilter.setDiagramFontHeights(&pDiagram->getDiagramFontHeights());
 
-importFragment(rFilter,
-   loadFragment(rFilter,xRefDataModel),
-   "OOXData",
-   pDiagram,
-   xRefDataModel);
+// data
+if( !rDataModelPath.isEmpty() )
+{
+rtl::Reference< core::FragmentHandler > xRefDataModel(
+new DiagramDataFragmentHandler( rFilter, rDataModelPath, 
pData ));
 
-pDiagram->getDataRelsMap() = 
pShape->resolveRelationshipsOfTypeFromOfficeDoc( rFilter,
-xRefDataModel->getFragmentPath(), u"image" );
+importFragment(rFilter,
+   loadFragment(rFilter,xRefDataModel),
+   "OOXData",
+   pDiagram,
+   xRefDataModel);
 
-// Pass the info to pShape
-for (auto const& extDrawing : pData->getExtDrawings())
-{
-OUString aFragmentPath = 
rRelations.getFragmentPathFromRelId(extDrawing);
-// Ignore RelIds which don't resolve to a fragment path.
-if (aFragmentPath.isEmpty())
-continue;
-
-sal_Int32 nCounter = 0;
-rtl::Reference xCounter(
-new DiagramShapeCounter(rFilter, aFragmentPath, nCounter));
-rFilter.importFragment(xCounter);
-// Ignore ext drawings which don't actually have any shapes.
-if (nCounter == 0)
-continue;
-
-pShape->addExtDrawingRelId(extDrawing);
+pDiagram->getDataRelsMap() = 
pShape->resolveRelationshipsOfTypeFromOfficeDoc( rFilter,
+xRefDataModel->getFragmentPath(), u"image" );
+
+// Pass the info to pShape
+for (auto const& extDrawing : pData->getExtDrawings())
+{
+OUString aFragmentPath = 
rRelations.getFragmentPathFromRelId(extDrawing);
+// Ignore RelIds which don't resolve to a fragment path.
+if (aFragmentPath.isEmpty())
+continue;
+
+sal_Int32 nCounter = 0;
+rtl::Reference xCounter(
+new DiagramShapeCounter(rFilter, aFragmentPath, nCounter));
+rFilter.importFragment(xCounter);
+// Ignore ext drawings which don't actually have any shapes.
+if (nCounter == 0)
+continue;
+
+pShape->addExtDrawingRelId(extDrawing);
+}
 }
-}
 
-// extLst is present, lets bet on that and ignore the rest of the data 
from here
-if( pShape->getExtDrawings().empty() )
-{
-// layout
-if( !rLayoutPath.isEmpty() )
+// extLst is present, lets bet on that and ignore the rest of the data 
from here
+if( pShape->getExtDrawings().empty() )
 {
-rtl::Reference< core::FragmentHandler > xRefLayout(
-new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, 
pLayout ));
+// layout
+if( !rLayoutPath.isEmpty() )
+{
+rtl::Reference< core::FragmentHandler > xRefLayout(
+new DiagramLayoutFragmentHandler( rFilter, 
rLayoutPath, pLayout ));
+
+importFragment(rFilter,
+loadFragment(rFilter,xRefLayout),
+"OOXLayout",
+pDiagram,
+xRefLayout);
+}
 
-importFragment(r

core.git: oox/source

2023-12-31 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 43c03ebc221db18b6980fbe592cce11cbb46dd49
Author: Caolán McNamara 
AuthorDate: Sat Dec 30 20:04:37 2023 +
Commit: Caolán McNamara 
CommitDate: Sun Dec 31 13:33:44 2023 +0100

cid#1545219 COPY_INSTEAD_OF_MOVE

and a bunch more like that

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

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 451759036835..26b05612d010 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -216,7 +216,7 @@ void setBorderLineType(const 
oox::drawingml::LinePropertiesPtr& pLineProp, sal_I
 }
 
 void insertBorderLine(TableStylePart& aTableStylePart, sal_Int32 nToken,
-  oox::drawingml::LinePropertiesPtr pLineProp)
+  const oox::drawingml::LinePropertiesPtr& pLineProp)
 {
 if (pLineProp->maLineFill.moFillType.has_value())
 {


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

2023-12-18 Thread Balazs Varga (via logerrit)
 oox/source/ppt/slidepersist.cxx  |6 
 sd/qa/unit/data/pptx/tdf157740.pptx  |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |4 
 sd/qa/unit/export-tests-ooxml2.cxx   |4 
 sd/qa/unit/export-tests-ooxml4.cxx   |   16 +
 sd/source/core/drawdoc3.cxx  |   38 +++-
 sd/source/filter/eppt/epptbase.hxx   |2 
 sd/source/filter/eppt/epptooxml.hxx  |6 
 sd/source/filter/eppt/pptx-epptooxml.cxx |  284 +++
 xmloff/source/draw/ximpbody.cxx  |   19 ++
 10 files changed, 142 insertions(+), 237 deletions(-)

New commits:
commit bff76421e234df7246a7f49c71a11432f86e09d1
Author: Balazs Varga 
AuthorDate: Sun Dec 3 23:41:01 2023 +0100
Commit: Balazs Varga 
CommitDate: Mon Dec 18 15:10:54 2023 +0100

tdf#157740 FILESAVE PPTX: fix explosion of the number of master slides

- Export correctly the "supported" master slides with the actual slides 
names.
- Set SlideLayout property at ODF import as well for MasterSlides layout 
type.
- When we copy a slide with the master slide also copy the SlideLayout 
property
value as well.

Change-Id: Idb6b88ebe87a83818d8eb27a1fa087652a002c0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160290
Tested-by: Jenkins
Reviewed-by: Henry Castro 
Reviewed-by: Balazs Varga 

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index cd42ef6bcdb6..a4225f95cd43 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -105,6 +105,7 @@ sal_Int16 SlidePersist::getLayoutFromValueToken() const
 case XML_titleOnly: nLayout = 19; break;
 case XML_twoObj:
 case XML_twoColTx:  nLayout =  3; break;
+case XML_twoObjAndObj:
 case XML_twoObjAndTx:   nLayout = 15; break;
 case XML_twoObjOverTx:  nLayout = 16; break;
 case XML_tx:nLayout =  1; break;
@@ -112,19 +113,18 @@ sal_Int16 SlidePersist::getLayoutFromValueToken() const
 case XML_txAndClipArt:  nLayout =  6; break;
 case XML_txAndMedia:nLayout =  6; break;
 case XML_txAndObj:  nLayout = 10; break;
+case XML_objAndTwoObj:
 case XML_txAndTwoObj:   nLayout = 12; break;
 case XML_txOverObj: nLayout = 17; break;
 case XML_vertTitleAndTx:nLayout = 22; break;
 case XML_vertTitleAndTxOverChart: nLayout = 21; break;
 case XML_vertTx:nLayout = 23; break;
+case XML_objOnly:   nLayout = 32; break;
 
 case XML_twoTxTwoObj:
-case XML_twoObjAndObj:
 case XML_objTx:
 case XML_picTx:
 case XML_secHead:
-case XML_objOnly:
-case XML_objAndTwoObj:
 case XML_mediaAndTx:
 case XML_dgm:
 case XML_cust:
diff --git a/sd/qa/unit/data/pptx/tdf157740.pptx 
b/sd/qa/unit/data/pptx/tdf157740.pptx
new file mode 100644
index ..009e9eeb1da0
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf157740.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index deab0ea2de24..9f87fd5d92c4 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -111,11 +111,11 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf149128)
 
 xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
 assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn"_ostr,
-"id"_ostr, "42");
+"id"_ostr, "8");
 assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn"_ostr,
 "idx"_ostr, "0");
 assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn"_ostr,
-"id"_ostr, "43");
+"id"_ostr, "9");
 assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn"_ostr,
 "idx"_ostr, "2");
 }
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 0583233c9f06..4498f66bf03a 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1343,7 +1343,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf106867)
 
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
 
"p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/"
 "p:cBhvr/p:tgtEl/p:spTgt"_ostr,
-"spid"_ostr, "42");
+"spid"_ostr, "67");
 }
 
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112280)
@@ -1740,7 +1740,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testAccentColor)
 xmlDocUniquePtr pXmlDocTheme1 = parseExport("ppt/theme/theme1.xml");
 assertXPath(pXmlDocTheme1, 
"/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr"_ostr,
   

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

2023-12-08 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/misccontexts.cxx  |2 +-
 sd/qa/unit/export-tests.cxx|2 +-
 sw/qa/extras/globalfilter/globalfilter.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b3122d56af5eefbb170de105579b59b097f34d58
Author: Andrea Gelmini 
AuthorDate: Fri Dec 8 20:47:21 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 8 22:48:19 2023 +0100

Fix typos

Change-Id: I9f61a7858a98ae6eb25cc49d237172876114c767
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160503
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/misccontexts.cxx 
b/oox/source/drawingml/misccontexts.cxx
index 93d2c8ee411b..6c05654e5d14 100644
--- a/oox/source/drawingml/misccontexts.cxx
+++ b/oox/source/drawingml/misccontexts.cxx
@@ -630,7 +630,7 @@ ContextHandlerRef 
BlipExtensionContext::onCreateContext(sal_Int32 nElement, cons
 // Read the graphic from the fragment path
 auto xGraphic = 
getFilter().getGraphicHelper().importEmbeddedGraphic(aFragmentPath);
 
-// Overwrite the fill graphic with the one contining SVG
+// Overwrite the fill graphic with the one containing SVG
 mrBlipProps.mxFillGraphic = xGraphic;
 if (mpBlipFill)
 mpBlipFill->mxGraphic = xGraphic;
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 428b09e983a1..7ee6e3a5e8cd 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1959,7 +1959,7 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testSvgImageSupport)
 // Access the Graphic
 Graphic aGraphic(xGraphic);
 
-// Check if it contian a VectorGraphicData struct
+// Check if it contains a VectorGraphicData struct
 auto pVectorGraphic = aGraphic.getVectorGraphicData();
 CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pVectorGraphic);
 
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 9d7c28b83ff8..7442de87f6d3 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -2251,7 +2251,7 @@ void Test::testSvgImageSupport()
 // Access the Graphic
 Graphic aGraphic(xGraphic);
 
-// Check if it contian a VectorGraphicData struct
+// Check if it contains a VectorGraphicData struct
 auto pVectorGraphic = aGraphic.getVectorGraphicData();
 CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pVectorGraphic);
 


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

2023-12-07 Thread Tomaž Vajngerl (via logerrit)
 oox/source/drawingml/misccontexts.cxx  |6 +-
 sd/qa/unit/export-tests.cxx|   15 +--
 sw/qa/extras/globalfilter/globalfilter.cxx |   17 +
 3 files changed, 31 insertions(+), 7 deletions(-)

New commits:
commit a010567c2cdb8ea0fe059b0b64fd5d1f2fd99a03
Author: Tomaž Vajngerl 
AuthorDate: Wed Dec 6 16:55:01 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Dec 8 03:55:42 2023 +0100

tdf#126084 document OOXML SVG tests and import

Change-Id: Ief29d04f2f0693a4cdfa44c7c100ac6164da38f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160378
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/drawingml/misccontexts.cxx 
b/oox/source/drawingml/misccontexts.cxx
index 244d17d9fc62..93d2c8ee411b 100644
--- a/oox/source/drawingml/misccontexts.cxx
+++ b/oox/source/drawingml/misccontexts.cxx
@@ -619,20 +619,24 @@ ContextHandlerRef 
BlipExtensionContext::onCreateContext(sal_Int32 nElement, cons
 case OOX_TOKEN(a14, imgProps):
 return new ArtisticEffectContext(*this, mrBlipProps.maEffect);
 
+// Import the SVG Blip
 case OOX_TOKEN(asvg, svgBlip):
 {
 if (rAttribs.hasAttribute(R_TOKEN(embed)))
 {
-// internal picture URL
 OUString aFragmentPath = 
getFragmentPathFromRelId(rAttribs.getStringDefaulted(R_TOKEN(embed)));
 if (!aFragmentPath.isEmpty())
 {
+// Read the graphic from the fragment path
 auto xGraphic = 
getFilter().getGraphicHelper().importEmbeddedGraphic(aFragmentPath);
+
+// Overwrite the fill graphic with the one contining SVG
 mrBlipProps.mxFillGraphic = xGraphic;
 if (mpBlipFill)
 mpBlipFill->mxGraphic = xGraphic;
 }
 }
+// TODO - link
 }
 break;
 }
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 92b36ecacce7..428b09e983a1 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1933,10 +1933,12 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testSvgImageSupport)
 {
 // Load the original file
 createSdImpressDoc("odp/SvgImageTest.odp");
-const OString sFailedMessage = "Failed on filter: " + rFormat.toUtf8();
+// Save into the target format
 saveAndReload(rFormat);
 
-// Check whether graphic was exported well
+const OString sFailedMessage = "Failed on filter: " + rFormat.toUtf8();
+
+// Check whether SVG graphic was exported as expected
 uno::Reference 
xDrawPagesSupplier(mxComponent,

uno::UNO_QUERY_THROW);
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(1),
@@ -1944,15 +1946,24 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testSvgImageSupport)
 uno::Reference xDrawPage(
 xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
 CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDrawPage.is());
+
+// Get the image
 uno::Reference xImage(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
 uno::Reference xPropertySet(xImage, 
uno::UNO_QUERY_THROW);
 
+// Convert to a XGraphic
 uno::Reference xGraphic;
 xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
 CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+
+// Access the Graphic
 Graphic aGraphic(xGraphic);
+
+// Check if it contian a VectorGraphicData struct
 auto pVectorGraphic = aGraphic.getVectorGraphicData();
 CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pVectorGraphic);
+
+// Which should be of type SVG, which means we have a SVG file
 CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
VectorGraphicDataType::Svg,
  pVectorGraphic->getType());
 }
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 3eda6b6354e8..9d7c28b83ff8 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -2225,28 +2225,37 @@ void Test::testSvgImageSupport()
 
 for (OUString const & rFilterName : aFilterNames)
 {
-// Check whether the export code swaps in the image which was swapped 
out before by auto mechanism
+// Use case to import a document containing a SVG image, export in 
target format, import and check if the
+// SVG image is present and as expected in the document
 
+// Import ODT file
 createSwDoc("SvgImageTest.odt");
 
-// Export the document and import again for a check
+// Export the document in target format and import again
 saveAndReload(rFilterName);
 
-//

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

2023-11-15 Thread Andrea Gelmini (via logerrit)
 oox/source/shape/ShapeContextHandler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6e4ea6d73b2a4f3ae56169933d82596f92e88f0d
Author: Andrea Gelmini 
AuthorDate: Wed Nov 15 12:52:49 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 15 23:47:22 2023 +0100

Fix typo

Change-Id: I24bda03e65353510810a08a6df6061e21e11915a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159441
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 1d4ad9d323e4..19c2deb71f57 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -524,7 +524,7 @@ ShapeContextHandler::getShape()
 oox::drawingml::ShapeIdMap aShapeMap;
 lcl_createShapeMap(pShape, aShapeMap);
 
-// Travers aShapeMap and generate edge related properties.
+// Traverse aShapeMap and generate edge related properties.
 for (auto& rIt : aShapeMap)
 {
 if ((rIt.second)->getServiceName() == 
"com.sun.star.drawing.ConnectorShape")


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

2023-11-15 Thread Andrea Gelmini (via logerrit)
 oox/source/shape/ShapeContextHandler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 201e288e9886987eae467035b42863ac032f7e8f
Author: Andrea Gelmini 
AuthorDate: Wed Nov 15 12:51:55 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 15 23:46:50 2023 +0100

Fix typo

Change-Id: Ia0082b62e8dd6e93267995140fc61b91b6080cb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159440
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 53ddd3f575be..1d4ad9d323e4 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -538,7 +538,7 @@ ShapeContextHandler::getShape()

ConnectorHelper::applyBentHandleAdjustments(rIt.second);
 }
 // else use the default path of LibreOffice
-// curveConnecto2 and bentConnector2 do not have 
handles.
+// curvedConnector2 and bentConnector2 do not have 
handles.
 // ToDo: OOXML defines a path for curveConnector3, 
curveConnector4 and
 // curveConnector5 that is basically incompatible with 
the way LibreOffice
 // creates the path.


[Libreoffice-commits] core.git: oox/source sc/source shell/source sw/source toolkit/source

2023-11-15 Thread Noel Grandin (via logerrit)
 oox/source/export/drawingml.cxx  |5 +++--
 oox/source/export/vmlexport.cxx  |5 +++--
 oox/source/ole/oleobjecthelper.cxx   |5 +++--
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |5 +++--
 shell/source/win32/ooofilereader/simpletag.cxx   |7 ---
 sw/source/core/doc/dbgoutsw.cxx  |6 --
 sw/source/filter/ww8/docxattributeoutput.cxx |5 +++--
 sw/source/uibase/envelp/labelcfg.cxx |4 ++--
 sw/source/uibase/utlui/content.cxx   |5 +++--
 toolkit/source/controls/unocontrolmodel.cxx  |   15 +--
 10 files changed, 37 insertions(+), 25 deletions(-)

New commits:
commit d0e848dab096160b16c4778ba25a40d1e5ff82af
Author: Noel Grandin 
AuthorDate: Wed Nov 15 10:48:27 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 15 12:04:31 2023 +0100

avoid double map lookup

Change-Id: I02018eaaf220c7835756eba6215425bac9cbc6f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159432
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ebe1df3a72d8..4bce89943ba3 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4320,8 +4320,9 @@ void DrawingML::WritePresetShape( const OString& pShape, 
MSO_SPT eShapeType, boo
 static std::map< OString, std::vector > aAdjMap = 
lcl_getAdjNames();
 // If there are predefined adj names for this shape type, look them up now.
 std::vector aAdjustments;
-if (aAdjMap.find(pShape) != aAdjMap.end())
-aAdjustments = aAdjMap[pShape];
+auto it = aAdjMap.find(pShape);
+if (it != aAdjMap.end())
+aAdjustments = it->second;
 
 mpFS->startElementNS(XML_a, XML_prstGeom, XML_prst, pShape);
 mpFS->startElementNS(XML_a, XML_avLst);
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 2ed2903bfe27..cfaa815aa964 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1236,8 +1236,9 @@ static OUString lcl_getAnchorIdFromGrabBag(const 
SdrObject* pSdrObject)
 if (xShape->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
 {
 comphelper::SequenceAsHashMap 
aInteropGrabBag(xShape->getPropertyValue("InteropGrabBag"));
-if (aInteropGrabBag.find("AnchorId") != aInteropGrabBag.end())
-aInteropGrabBag["AnchorId"] >>= aResult;
+auto it = aInteropGrabBag.find("AnchorId");
+if (it != aInteropGrabBag.end())
+it->second >>= aResult;
 }
 
 return aResult;
diff --git a/oox/source/ole/oleobjecthelper.cxx 
b/oox/source/ole/oleobjecthelper.cxx
index 1816773db82d..f99e4a897ec0 100644
--- a/oox/source/ole/oleobjecthelper.cxx
+++ b/oox/source/ole/oleobjecthelper.cxx
@@ -100,8 +100,9 @@ void SaveInteropProperties(uno::Reference 
const& xModel,
 
 // get EmbeddedObjects property inside grab bag
 comphelper::SequenceAsHashMap objectsList;
-if (aGrabBag.find(sEmbeddingsPropName) != aGrabBag.end())
-objectsList << aGrabBag[sEmbeddingsPropName];
+auto grabIt = aGrabBag.find(sEmbeddingsPropName);
+if (grabIt != aGrabBag.end())
+objectsList << grabIt->second;
 
 uno::Sequence< beans::PropertyValue > aGrabBagAttribute{ 
comphelper::makePropertyValue("ProgID",

rProgId) };
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index fa57dd1a4fe7..7aaa7237ccac 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -1170,8 +1170,9 @@ uno::Reference SAL_CALL
 throw lang::IndexOutOfBoundsException();
 }
 ScMyAddress addr = 
CalcScAddressFromRangeList(mpMarkedRanges.get(),nSelectedChildIndex);
-if( m_mapSelectionSend.find(addr) != m_mapSelectionSend.end() )
-xAccessible = m_mapSelectionSend[addr];
+auto it = m_mapSelectionSend.find(addr);
+if( it != m_mapSelectionSend.end() )
+xAccessible = it->second;
 else
 xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
 }
diff --git a/shell/source/win32/ooofilereader/simpletag.cxx 
b/shell/source/win32/ooofilereader/simpletag.cxx
index 82b85aec5ce3..d4ceab77fe10 100644
--- a/shell/source/win32/ooofilereader/simpletag.cxx
+++ b/shell/source/win32/ooofilereader/simpletag.cxx
@@ -48,10 +48,11 @@ std::wstring CSimpleTag::getTagContent( )
 
 ::std::wstring CSimpleTag::getTagAttribute( ::std::wstring const & attrname )
 {
-if  ( m_SimpleAttributes.find(attrname) != m_SimpleAttributes.end())
-return m_SimpleAttributes[attrname];
+auto it = m_SimpleAttributes.find(attrn

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

2023-10-31 Thread Henry Castro (via logerrit)
 oox/source/ppt/presentationfragmenthandler.cxx |6 +
 sd/qa/unit/export-tests-ooxml2.cxx |6 -
 sd/qa/unit/export-tests-ooxml3.cxx |4 
 sd/source/filter/eppt/epptooxml.hxx|4 
 sd/source/filter/eppt/pptx-epptooxml.cxx   |  128 +++--
 sd/source/ui/inc/unopage.hxx   |1 
 sd/source/ui/unoidl/unopage.cxx|   13 ++
 7 files changed, 147 insertions(+), 15 deletions(-)

New commits:
commit d590f094ccd28ca449eff91692c2178058d5c621
Author: Henry Castro 
AuthorDate: Tue Oct 17 07:42:52 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Oct 31 12:01:43 2023 +0100

tdf#155512: sd: filter: eppt: add "SlideLayout" property to Slide Master

If it is importing all Slide Master from pptx file, unfortunately
it breaks the exporting to pptx due to save and reload unit test failures

According to the documentation
http://officeopenxml.com/prSlideLayout.php, so the file pptx has a
relationship Slide -> Slide Layout -> Slide Master

The Slide Layout is a template an unique to be reused
with Slide Master, so exporting requires to compare
the templates due to LibreOffice relation Slide -> Slide Master

Adjust unit test values:

SdOOXMLExportTest2::testTdf106867
revert adcde78935fb8ca2b93322aa3a558d0b3ccdbfad

SdOOXMLExportTest2::testTdf112280
revert adcde78935fb8ca2b93322aa3a558d0b3ccdbfad

SdOOXMLExportTest2::testThemeColors and
SdOOXMLExportTest3::testTdf114848
The file tdf84205.pptx does not contain theme2.xml,
and save and reload it does not caintain theme2.xml too
fix "An uncaught exception of type 
com.sun.star.container.NoSuchElementException"

Signed-off-by: Henry Castro 
Change-Id: I622e9d5d68c406ff520387f3903808613d1cd3d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158084
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158676
Tested-by: Jenkins

diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 8c5fbf261414..edb523161c9e 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -230,6 +230,9 @@ SlidePersistPtr 
PresentationFragmentHandler::importMasterSlide(const ReferencegetFragmentPathFromRelation(rEntry.second);
 
 sal_Int32 nIndex;
@@ -286,6 +289,9 @@ SlidePersistPtr 
PresentationFragmentHandler::importMasterSlide(const ReferencecreateBackground( rFilter );
 pMasterPersistPtr->createXShapes( rFilter );
 
+uno::Reference< beans::XPropertySet > 
xSet(pMasterPersistPtr->getPage(), uno::UNO_QUERY_THROW);
+xSet->setPropertyValue("SlideLayout", 
Any(pMasterPersistPtr->getLayoutFromValueToken()));
+
 oox::drawingml::ThemePtr pTheme = pMasterPersistPtr->getTheme();
 if (pTheme)
 {
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 625c04953006..30301c6e4c16 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1313,7 +1313,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf106867)
 
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
 
"p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/"
 "p:cBhvr/p:tgtEl/p:spTgt",
-"spid", "491");
+"spid", "42");
 }
 
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112280)
@@ -1694,7 +1694,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testAccentColor)
 "70ad47");
 xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
 assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
-"70ad47");
+"deb340");
 
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: Motyw pakietu Office
@@ -1709,7 +1709,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testThemeColors)
 createSdImpressDoc("pptx/tdf84205.pptx");
 save("Impress Office Open XML");
 
-xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
+xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme1.xml");
 assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
 "44546a");
 assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val",
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 409a8affc8d5..74bcfebb40a5 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -75,10 +75,6 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf114848)
 xmlDocUniquePtr pXmlDocTheme1 = parse

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

2023-09-19 Thread Tomaž Vajngerl (via logerrit)
 oox/source/export/shapes.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8a9c3e82386d700549cac30f2555952046e021cb
Author: Tomaž Vajngerl 
AuthorDate: Mon Sep 18 14:51:59 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 19 14:02:41 2023 +0200

oox: change frozen::make_set to "conventional" frozen::set construction

Fixes compile issue with bisect repo started with commit: 
b839c09760919d4f4a21ed1819885b5385f27e31 
(https://gerrit.libreoffice.org/c/core/+/157003)

Log:

/home/tdf/lode/bibisect/core242/oox/source/export/shapes.cxx:622:2: error: 
no matching function for call to ‘make_set()’
 });
  ^
In file included from 
/home/tdf/lode/bibisect/core242/oox/source/export/shapes.cxx:90:0:

/home/tdf/lode/bibisect/core242/workdir/UnpackedTarball/frozen/include/frozen/set.h:223:16:
 note: candidate: template constexpr auto 
frozen::make_set(frozen::bits::ignored_arg)
 constexpr auto make_set(bits::ignored_arg = {}/* for consistency with the 
initializer below for N = 0*/) {
^~~~

/home/tdf/lode/bibisect/core242/workdir/UnpackedTarball/frozen/include/frozen/set.h:223:16:
 note:   template argument deduction/substitution failed:
/home/tdf/lode/bibisect/core242/oox/source/export/shapes.cxx:622:2: note:   
cannot convert ‘{"b\000l\000o\000c\000k\000-\000a\000r\000c\000\000", 
"r\000e\000c\000t\000a\000n\000g\000l\000e\000\000", 
"e\000l\000l\000i\000p\000s\000e\000\000", "r\000i\000n\000g\000\000", 
"c\000a\000n\000\000", "c\000u\000b\000e\000\000", 
"p\000a\000p\000e\000r\000\000", "f\000r\000a\000m\000e\000\000", 
"f\000o\000r\000b\000i\000d\000d\000e\000n\000\000", 
"s\000m\000i\000l\000e\000y\000\000", "s\000u\000n\000\000", 
"f\000l\000o\000w\000e\000r\000\000", 
"b\000r\000a\000c\000k\000e\000t\000-\000p\000a\000i\000r\000\000", 
"b\000r\000a\000c\000e\000-\000p\000a\000i\000r\000\000", 
"q\000u\000a\000d\000-\000b\000e\000v\000e\000l\000\000", 
"r\000o\000u\000n\000d\000-\000r\000e\000c\000t\000a\000n\000g\000u\000l\000a\000r\000-\000c\000a\000l\000l\000o\000u\000t\000\000",
 
"r\000e\000c\000t\000a\000n\000g\000u\000l\000a\000r\000-\000c\000a\000l\000l\000o\000u\000t\000\000",
 "r\000o\000u\000n\000d\000-\000c\
 000a\000l\000l\000o\000u\000t\000\000", 
"c\000l\000o\000u\000d\000-\000c\000a\000l\000l\000o\000u\000t\000\000", 
"l\000i\000n\000e\000-\000c\000a\000l\000l\000o\000u\000t\000-\0001\000\000", 
"l\000i\000n\000e\000-\000c\000a\000l\000l\000o\000u\000t\000-\0002\000\000", 
"l\000i\000n\000e\000-\000c\000a\000l\000l\000o\000u\000t\000-\0003\000\000", 
"p\000a\000p\000e\000r\000\000", 
"v\000e\000r\000t\000i\000c\000a\000l\000-\000s\000c\000r\000o\000l\000l\000\000",
 
"h\000o\000r\000i\000z\000o\000n\000t\000a\000l\000-\000s\000c\000r\000o\000l\000l\000\000",
 "m\000s\000o\000-\000s\000p\000t\0003\0004\000\000", 
"m\000s\000o\000-\000s\000p\000t\0007\0005\000\000", 
"m\000s\000o\000-\000s\000p\000t\0001\0006\0004\000\000", 
"m\000s\000o\000-\000s\000p\000t\0001\0008\\000\000", 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000p\000r\000o\000c\000e\000s\000s\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000a\000l\000t\000e\000r\000n\000a\000t\000e\000-\000p\000r\000o\000c\000e\000
 s\000s\000\000", 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000d\000e\000c\000i\000s\000i\000o\000n\000\000",
 "f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000d\000a\000t\000a\000\000", 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000p\000r\000e\000d\000e\000f\000i\000n\000e\000d\000-\000p\000r\000o\000c\000e\000s\000s\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000i\000n\000t\000e\000r\000n\000a\000l\000-\000s\000t\000o\000r\000a\000g\000e\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000d\000o\000c\000u\000m\000e\000n\000t\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000m\000u\000l\000t\000i\000d\000o\000c\000u\000m\000e\000n\000t\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000t\000e\000r\000m\000i\000n\000a\000t\000o\000r\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000p\000r\000e\000p\000a\000r\000a\000t\000i\000o\000n\000\000",
 "f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000m\000a\000n\000u\000a\000
 l\000-\000i\000n\000p\000u\000t\000\000", 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000m\000a\000n\000u\000a\000l\000-\000o\000p\000e\000r\000a\000t\000i\000o\000n\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000c\000o\000n\000n\000e\000c\000t\000o\000r\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000o\000f\000f\000-\000p\000a\000g\000e\000-\000c\000o\000n\000n\000e\000c\000t\000o\000r\000\000",
 "f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000c\000a\000r\000d\000\000", 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000p\000u\000n\000c\000h\000e\000d\000-\000t\000a\000p\000e\000\000",
 
"f\000l\000o\000w\000c\000h\000a\000r\000t\000-\000s\00

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

2023-09-17 Thread Tomaž Vajngerl (via logerrit)
 oox/source/export/chartexport.cxx |   72 ++-
 oox/source/export/shapes.cxx  |  235 +++---
 2 files changed, 159 insertions(+), 148 deletions(-)

New commits:
commit b839c09760919d4f4a21ed1819885b5385f27e31
Author: Tomaž Vajngerl 
AuthorDate: Sun Sep 17 22:25:01 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Sep 18 07:54:27 2023 +0200

oox: some more conversions to frozen map and set

Change-Id: Ibe557006ee4393a2cfa2cb600744ca5ba7090ca7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157003
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index c9db6f8cc431..0265c2b7db8d 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -107,6 +107,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -440,41 +444,41 @@ static ::std::vector< double > 
lcl_getAllValuesFromSequence( const Reference< ch
 return aResult;
 }
 
-static sal_Int32 lcl_getChartType( std::u16string_view sChartType )
+namespace
+{
+
+constexpr auto constChartTypeMap = 
frozen::make_unordered_map(
+{
+{ u"com.sun.star.chart.BarDiagram", chart::TYPEID_BAR },
+{ u"com.sun.star.chart2.ColumnChartType",  chart::TYPEID_BAR },
+{ u"com.sun.star.chart.AreaDiagram",  chart::TYPEID_AREA },
+{ u"com.sun.star.chart2.AreaChartType",  chart::TYPEID_AREA },
+{ u"com.sun.star.chart.LineDiagram",  chart::TYPEID_LINE },
+{ u"com.sun.star.chart2.LineChartType",  chart::TYPEID_LINE },
+{ u"com.sun.star.chart.PieDiagram",  chart::TYPEID_PIE },
+{ u"com.sun.star.chart2.PieChartType",  chart::TYPEID_PIE },
+{ u"com.sun.star.chart.DonutDiagram",  chart::TYPEID_DOUGHNUT },
+{ u"com.sun.star.chart2.DonutChartType",  chart::TYPEID_DOUGHNUT },
+{ u"com.sun.star.chart.XYDiagram",  chart::TYPEID_SCATTER },
+{ u"com.sun.star.chart2.ScatterChartType",  chart::TYPEID_SCATTER },
+{ u"com.sun.star.chart.NetDiagram",  chart::TYPEID_RADARLINE },
+{ u"com.sun.star.chart2.NetChartType",  chart::TYPEID_RADARLINE },
+{ u"com.sun.star.chart.FilledNetDiagram",  chart::TYPEID_RADARAREA },
+{ u"com.sun.star.chart2.FilledNetChartType",  chart::TYPEID_RADARAREA },
+{ u"com.sun.star.chart.StockDiagram",  chart::TYPEID_STOCK },
+{ u"com.sun.star.chart2.CandleStickChartType",  chart::TYPEID_STOCK },
+{ u"com.sun.star.chart.BubbleDiagram",  chart::TYPEID_BUBBLE },
+{ u"com.sun.star.chart2.BubbleChartType",  chart::TYPEID_BUBBLE },
+});
+
+} // end anonymous namespace
+
+static sal_Int32 lcl_getChartType(std::u16string_view sChartType)
 {
-chart::TypeId eChartTypeId = chart::TYPEID_UNKNOWN;
-if( sChartType == u"com.sun.star.chart.BarDiagram"
-|| sChartType == u"com.sun.star.chart2.ColumnChartType" )
-eChartTypeId = chart::TYPEID_BAR;
-else if( sChartType == u"com.sun.star.chart.AreaDiagram"
- || sChartType == u"com.sun.star.chart2.AreaChartType" )
-eChartTypeId = chart::TYPEID_AREA;
-else if( sChartType == u"com.sun.star.chart.LineDiagram"
- || sChartType == u"com.sun.star.chart2.LineChartType" )
-eChartTypeId = chart::TYPEID_LINE;
-else if( sChartType == u"com.sun.star.chart.PieDiagram"
- || sChartType == u"com.sun.star.chart2.PieChartType" )
-eChartTypeId = chart::TYPEID_PIE;
-else if( sChartType == u"com.sun.star.chart.DonutDiagram"
- || sChartType == u"com.sun.star.chart2.DonutChartType" )
-eChartTypeId = chart::TYPEID_DOUGHNUT;
-else if( sChartType == u"com.sun.star.chart.XYDiagram"
- || sChartType == u"com.sun.star.chart2.ScatterChartType" )
-eChartTypeId = chart::TYPEID_SCATTER;
-else if( sChartType == u"com.sun.star.chart.NetDiagram"
- || sChartType == u"com.sun.star.chart2.NetChartType" )
-eChartTypeId = chart::TYPEID_RADARLINE;
-else if( sChartType == u"com.sun.star.chart.FilledNetDiagram"
- || sChartType == u"com.sun.star.chart2.FilledNetChartType" )
-eChartTypeId = chart::TYPEID_RADARAREA;
-else if( sChartType == u"com.sun.star.chart.StockDiagram"
- || sChartType == u"com.sun.star.chart2.CandleStickChartType" )
-eChartTypeId = chart::TYPEID_STOCK;
-else if( sChartType == u"com.sun.star.chart.BubbleDiagram"
- || sChartType == u"com.sun.star.chart2.BubbleChartType" )
-eChartTypeId = chart::TYPEID_BUBBLE;
-
-return eChartTypeId;
+auto aIterator = constChartTypeMap.find(sChartType);
+if (aIterator == constChartTypeMap.end())
+return chart::TYPEID_UNKNOWN;
+return aIterator->second;
 }
 
 static sal_Int32 lcl_generateRandomValue()
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 78614b7efbcc..08c3c38e4446 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx

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

2023-09-16 Thread Tomaž Vajngerl (via logerrit)
 oox/source/drawingml/fillproperties.cxx |  150 
 1 file changed, 59 insertions(+), 91 deletions(-)

New commits:
commit 5fd0d769a2a0106b6b12faed28dc81d90153c16c
Author: Tomaž Vajngerl 
AuthorDate: Sat Sep 16 12:59:17 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Sep 16 18:41:12 2023 +0200

oox: use frozen unordered_map for mapping the name string to token

Change-Id: Ib1f7d28509a1bc2680ad66b2cb1bf0ed35315f58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156975
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index ff78f3183831..dec9ab9672cc 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -49,6 +49,11 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::drawing;
 using namespace ::com::sun::star::graphic;
@@ -992,101 +997,64 @@ OUString ArtisticEffectProperties::getEffectString( 
sal_Int32 nToken )
 return OUString();
 }
 
-sal_Int32 ArtisticEffectProperties::getEffectToken( const OUString& sName )
+constexpr auto constEffectTokenForEffectNameMap = 
frozen::make_unordered_map(
 {
 // effects
-if( sName == "artisticBlur" )
-return XML_artisticBlur;
-else if( sName == "artisticCement" )
-return XML_artisticCement;
-else if( sName == "artisticChalkSketch" )
-return XML_artisticChalkSketch;
-else if( sName == "artisticCrisscrossEtching" )
-return XML_artisticCrisscrossEtching;
-else if( sName == "artisticCutout" )
-return XML_artisticCutout;
-else if( sName == "artisticFilmGrain" )
-return XML_artisticFilmGrain;
-else if( sName == "artisticGlass" )
-return XML_artisticGlass;
-else if( sName == "artisticGlowDiffused" )
-return XML_artisticGlowDiffused;
-else if( sName == "artisticGlowEdges" )
-return XML_artisticGlowEdges;
-else if( sName == "artisticLightScreen" )
-return XML_artisticLightScreen;
-else if( sName == "artisticLineDrawing" )
-return XML_artisticLineDrawing;
-else if( sName == "artisticMarker" )
-return XML_artisticMarker;
-else if( sName == "artisticMosiaicBubbles" )
-return XML_artisticMosiaicBubbles;
-else if( sName == "artisticPaintStrokes" )
-return XML_artisticPaintStrokes;
-else if( sName == "artisticPaintBrush" )
-return XML_artisticPaintBrush;
-else if( sName == "artisticPastelsSmooth" )
-return XML_artisticPastelsSmooth;
-else if( sName == "artisticPencilGrayscale" )
-return XML_artisticPencilGrayscale;
-else if( sName == "artisticPencilSketch" )
-return XML_artisticPencilSketch;
-else if( sName == "artisticPhotocopy" )
-return XML_artisticPhotocopy;
-else if( sName == "artisticPlasticWrap" )
-return XML_artisticPlasticWrap;
-else if( sName == "artisticTexturizer" )
-return XML_artisticTexturizer;
-else if( sName == "artisticWatercolorSponge" )
-return XML_artisticWatercolorSponge;
-else if( sName == "brightnessContrast" )
-return XML_brightnessContrast;
-else if( sName == "colorTemperature" )
-return XML_colorTemperature;
-else if( sName == "saturation" )
-return XML_saturation;
-else if( sName == "sharpenSoften" )
-return XML_sharpenSoften;
+{ u"artisticBlur", XML_artisticBlur },
+{ u"artisticCement", XML_artisticCement },
+{ u"artisticChalkSketch", XML_artisticChalkSketch },
+{ u"artisticCrisscrossEtching", XML_artisticCrisscrossEtching },
+{ u"artisticCutout", XML_artisticCutout },
+{ u"artisticFilmGrain", XML_artisticFilmGrain },
+{ u"artisticGlass", XML_artisticGlass },
+{ u"artisticGlowDiffused", XML_artisticGlowDiffused },
+{ u"artisticGlowEdges", XML_artisticGlowEdges },
+{ u"artisticLightScreen", XML_artisticLightScreen },
+{ u"artisticLineDrawing", XML_artisticLineDrawing },
+{ u"artisticMarker", XML_artisticMarker },
+{ u"artisticMosiaicBubbles", XML_artisticMosiaicBubbles },
+{ u"artisticPaintStrokes", XML_artisticPaintStrokes },
+{ u"artisticPaintBrush", XML_artisticPaintBrush },
+{ u"artisticPastelsSmooth", XML_artisticPastelsSmooth },
+{ u"artisticPencilGrayscale", XML_artisticPencilGrayscale },
+{ u"artisticPencilSketch", XML_artisticPencilSketch },
+{ u"artisticPhotocopy", XML_artisticPhotocopy },
+{ u"artisticPlasticWrap", XML_artisticPlasticWrap },
+{ u"artisticTexturizer", XML_artisticTexturizer },
+{ u"artisticWatercolorSponge", XML_artisticWatercolorSponge },
+{ u"brightnessContrast", XML_brightnessContrast },
+{ u"colorTemperature", XML_colorTemperature },
+{ u"saturation", XML_saturation },
+{ u"sharpenSoften", XML_sharpenSoften },
 
 // attr

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

2023-09-07 Thread Sarper Akdemir (via logerrit)
 oox/source/drawingml/fillproperties.cxx |4 +++-
 sd/qa/unit/data/pptx/tdf156649.pptx |binary
 sd/qa/unit/export-tests.cxx |   14 ++
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit b0e8ce9967acf3a759e5b85c4a0d16d7dad275fe
Author: Sarper Akdemir 
AuthorDate: Thu Sep 7 13:53:25 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Fri Sep 8 08:58:02 2023 +0200

tdf#156649: oox: correct import alphaModFix for custom shapes

alphaModFix should be imported into PROP_FillTransparency
for custom shapes.

Change-Id: I19621e424a64b097d5e6881877d60de253be636d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156660
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 9f18e7d65f7d..ff78f3183831 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -866,7 +866,9 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 
 if ( maBlipProps.moAlphaModFix.has_value() )
 {
-rPropMap.setProperty(PROP_Transparency, static_cast(100 
- (maBlipProps.moAlphaModFix.value() / PER_PERCENT)));
+rPropMap.setProperty(
+mbIsCustomShape ? PROP_FillTransparence : PROP_Transparency,
+static_cast(100 - 
(maBlipProps.moAlphaModFix.value() / PER_PERCENT)));
 }
 }
 rPropMap.setProperty(PROP_GraphicColorMode, eColorMode);
diff --git a/sd/qa/unit/data/pptx/tdf156649.pptx 
b/sd/qa/unit/data/pptx/tdf156649.pptx
new file mode 100644
index ..2b3b12a9a092
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf156649.pptx differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 61f6736fc33f..92971d4b4221 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1577,6 +1577,20 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testTdf140714)
 CPPUNIT_ASSERT_EQUAL(OUString{ "com.sun.star.drawing.CustomShape" }, 
xShape->getShapeType());
 }
 
+CPPUNIT_TEST_FIXTURE(SdExportTest, testTdf156649)
+{
+createSdImpressDoc("pptx/tdf156649.pptx");
+saveAndReload("Impress Office Open XML");
+
+auto xShapeProps(getShapeFromPage(0, 0));
+// Without the fix in place, this test would have failed with
+//- Expected: 55
+//- Actual  : 0
+// i.e. alphaModFix wasn't imported as fill transparency for the custom 
shape
+CPPUNIT_ASSERT_EQUAL(sal_Int16(55),
+ 
xShapeProps->getPropertyValue("FillTransparence").get());
+}
+
 CPPUNIT_TEST_FIXTURE(SdExportTest, testMasterPageBackgroundFullSize)
 {
 createSdImpressDoc("odp/background.odp");


[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 c

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

2023-08-29 Thread Caolán McNamara (via logerrit)
 oox/source/drawingml/textparagraphproperties.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 7cdefb880ed6fd413b9e31fa45352cdeb074a24f
Author: Caolán McNamara 
AuthorDate: Tue Aug 29 08:39:52 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 29 11:07:39 2023 +0200

supplement setting SYMBOL encoded charset with SymbolFont flag

as well as using the well-known symbol font names

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

diff --git a/oox/source/drawingml/textparagraphproperties.cxx 
b/oox/source/drawingml/textparagraphproperties.cxx
index 9dd3a6c3c181..f011878f3dbf 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -314,19 +314,22 @@ void BulletList::pushToPropMap( const 
::oox::core::XmlFilterBase* pFilterBase, P
 if( pFilterBase) {
 bool bFollowTextFont = false;
 mbBulletFontFollowText >>= bFollowTextFont;
-if (!bFollowTextFont && maBulletFont.getFontData( aBulletFontName, 
nBulletFontPitch, nBulletFontFamily, nullptr, *pFilterBase ) )
+if (!bFollowTextFont && maBulletFont.getFontData( aBulletFontName, 
nBulletFontPitch, nBulletFontFamily, &bSymbolFont, *pFilterBase ) )
 {
 FontDescriptor aFontDesc;
 sal_Int16 nFontSize = 0;
 if( mnFontSize >>= nFontSize )
 aFontDesc.Height = nFontSize;
 
-// TODO either use getFontData encoding hint, or move this to the 
TextFont struct.
+// TODO It is likely that bSymbolFont from getFontData is 
sufficient to check here
+// and looking at the font name is not necessary, if it is 
necessary then moving
+// the name lookup into getFontData is likely the best fix
 aFontDesc.Name = aBulletFontName;
 aFontDesc.Pitch = nBulletFontPitch;
 aFontDesc.Family = nBulletFontFamily;
 aFontDesc.Weight = nBulletFontWeight;
-if ( aBulletFontName.equalsIgnoreAsciiCase("Wingdings") ||
+if ( bSymbolFont ||
+ aBulletFontName.equalsIgnoreAsciiCase("Wingdings") ||
  aBulletFontName.equalsIgnoreAsciiCase("Wingdings 2") ||
  aBulletFontName.equalsIgnoreAsciiCase("Wingdings 3") ||
  aBulletFontName.equalsIgnoreAsciiCase("Monotype Sorts") ||


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

2023-08-25 Thread Samuel Mehrbrodt (via logerrit)
 oox/source/export/drawingml.cxx|2 +-
 sd/qa/unit/data/odp/tdf150316.odp  |binary
 sd/qa/unit/export-tests-ooxml1.cxx |9 +
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6e042b1e26bedcc8d8bdcf105ec750b03665c7b0
Author: Samuel Mehrbrodt 
AuthorDate: Fri Aug 25 15:05:42 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Fri Aug 25 20:50:00 2023 +0200

tdf#150316 Fix missing first line indent in pptx export

Change-Id: Ib2cac800b151823b77e44831100c2de9bbda8a16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156107
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1230517eda81..98496aa2c1f8 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3440,7 +3440,7 @@ bool DrawingML::WriteParagraphProperties(const 
Reference& rParagra
 mpFS->startElementNS( XML_a, nElement,
XML_lvl, 
sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0),
XML_marL, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaLeftMargin)),
 nParaLeftMargin > 0),
-   XML_indent, 
sax_fastparser::UseIf(OString::number(!bForceZeroIndent ? 
oox::drawingml::convertHmmToEmu(nParaFirstLineIndent) : 0), (bForceZeroIndent 
|| (nParaFirstLineIndent != 0))),
+   XML_indent, 
sax_fastparser::UseIf(OString::number((bForceZeroIndent && nParaFirstLineIndent 
== 0) ? 0 : oox::drawingml::convertHmmToEmu(nParaFirstLineIndent)), 
(bForceZeroIndent || nParaFirstLineIndent != 0)),
XML_algn, GetAlignment( nAlignment ),
XML_defTabSz, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nParaDefaultTabSize)),
 nParaDefaultTabSize > 0),
XML_rtl, sax_fastparser::UseIf(ToPsz10(bRtl), 
bRtl));
diff --git a/sd/qa/unit/data/odp/tdf150316.odp 
b/sd/qa/unit/data/odp/tdf150316.odp
new file mode 100644
index ..dab2971711f8
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf150316.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 2962456ffd49..0a9f82a27e59 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1588,6 +1588,15 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, 
testNarrationMimeType)
 assertXPath(pSlideDoc, "//p:childTnLst/p:audio", "isNarration", "1");
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf150316)
+{
+createSdImpressDoc("odp/tdf150316.odp");
+save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:pPr", 
"indent", "-343080");
+}
+
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf140865Wordart3D)
 {
 createSdImpressDoc("pptx/tdf140865Wordart3D.pptx");


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

2023-08-18 Thread Samuel Mehrbrodt (via logerrit)
 oox/source/export/drawingml.cxx|   15 +++
 sd/qa/unit/data/pptx/tdf151134.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx |9 +
 3 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 0367a168cd01f4a2c16101726714f696ba023a6f
Author: Samuel Mehrbrodt 
AuthorDate: Fri Aug 18 13:42:23 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Fri Aug 18 22:15:59 2023 +0200

tdf#151134 Always write inset properties when exporting placeholder shapes

The default value works for text boxes, but not for these special
presentation placeholder objects - here the values need to be written
explicitly.

Change-Id: Id606bd5e6b63dee2fd3b385435ce13ecec63b5f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155838
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 351c1b7cf265..6b464cf774ba 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4010,6 +4010,9 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 sVertOverflow = "clip";
 }
 
+// tdf#151134 When writing placeholder shapes, inset must be 
explicitly specified
+bool bRequireInset = GetProperty(rXPropSet, "IsPresentationObject") && 
rXPropSet->getPropertyValue("IsPresentationObject").get();
+
 mpFS->startElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), 
XML_bodyPr,
XML_numCol, 
sax_fastparser::UseIf(OString::number(nCols), nCols > 0),
XML_spcCol, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nColSpacing)),
 nCols > 0 && nColSpacing >= 0),
@@ -4017,10 +4020,14 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
XML_horzOverflow, sHorzOverflow,
XML_vertOverflow, sVertOverflow,
XML_fromWordArt, sax_fastparser::UseIf("1", 
bFromWordArt),
-   XML_lIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeft)), 
nLeft != constDefaultLeftRightInset),
-   XML_rIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRight)), 
nRight != constDefaultLeftRightInset),
-   XML_tIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nTop)), 
nTop != constDefaultTopBottomInset),
-   XML_bIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nBottom)),
 nBottom != constDefaultTopBottomInset),
+   XML_lIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeft)),
+   bRequireInset 
|| nLeft != constDefaultLeftRightInset),
+   XML_rIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRight)),
+   bRequireInset 
|| nRight != constDefaultLeftRightInset),
+   XML_tIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nTop)),
+   bRequireInset 
|| nTop != constDefaultTopBottomInset),
+   XML_bIns, 
sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nBottom)),
+   bRequireInset 
|| nBottom != constDefaultTopBottomInset),
XML_anchor, sAnchor,
XML_anchorCtr, sax_fastparser::UseIf("1", 
bAnchorCtr),
XML_vert, sWritingMode,
diff --git a/sd/qa/unit/data/pptx/tdf151134.odp 
b/sd/qa/unit/data/pptx/tdf151134.odp
new file mode 100644
index ..56ea86a3144c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf151134.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index ffc3530f40b6..1e7c05390d39 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1666,6 +1666,15 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf137675)
 "none");
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf151134)
+{
+createSdImpressDoc("pptx/tdf151134.odp");
+save("Impress Office Open XML");
+
+xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr", 
"lIns", "91440");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-08-15 Thread Mike Kaganski (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |   24 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |8 
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit d2c7cbc7d724d608f6d37bbb0233ad2b39eb938e
Author: Mike Kaganski 
AuthorDate: Tue Aug 15 21:09:27 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Aug 15 21:41:24 2023 +0200

Simplify and improve conversion

Using o3tl::convert makes sure that rounding is correct, which
shows in the improved unit test, that now doesn't need different
values before and after roundtrip.

Change-Id: If46e27300bc199e89c0abf0ea4d0cd825024aeb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155728
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index a11aeb6236ee..8cc400257155 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -105,9 +105,9 @@ std::optional 
CropQuotientsFromSrcRect(geometry::IntegerRectangle2D a
 aSrcRect.X2 = std::max(aSrcRect.X2, sal_Int32(0));
 aSrcRect.Y1 = std::max(aSrcRect.Y1, sal_Int32(0));
 aSrcRect.Y2 = std::max(aSrcRect.Y2, sal_Int32(0));
-if (aSrcRect.X1 + aSrcRect.X2 >= 100'000 || aSrcRect.Y1 + aSrcRect.Y2 >= 
100'000)
+if (aSrcRect.X1 + aSrcRect.X2 >= MAX_PERCENT || aSrcRect.Y1 + aSrcRect.Y2 
>= MAX_PERCENT)
 return {}; // Cropped everything
-return getQuotients(aSrcRect, 100'000.0, 100'000.0);
+return getQuotients(aSrcRect, MAX_PERCENT, MAX_PERCENT);
 }
 
 // ECMA-376 Part 1 20.1.8.30 fillRect (Fill Rectangle)
@@ -118,8 +118,8 @@ std::optional 
CropQuotientsFromFillRect(geometry::IntegerRectangle2D
 aFillRect.Y1 = std::min(aFillRect.Y1, sal_Int32(0));
 aFillRect.Y2 = std::min(aFillRect.Y2, sal_Int32(0));
 // Negative divisor and negative relative offset give positive value 
wanted in lclCropGraphic
-return getQuotients(aFillRect, -100'000.0 + aFillRect.X1 + aFillRect.X2,
--100'000.0 + aFillRect.Y1 + aFillRect.Y2);
+return getQuotients(aFillRect, -MAX_PERCENT + aFillRect.X1 + aFillRect.X2,
+-MAX_PERCENT + aFillRect.Y1 + aFillRect.Y2);
 }
 
 // Crops a piece of the bitmap. lclCropGraphic doesn't handle growing.
@@ -624,13 +624,13 @@ void FillProperties::pushToPropMap(ShapePropertyMap& 
rPropMap, const GraphicHelp
 {
 text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
 if ( aFillRect.X1 )
-aGraphCrop.Left = static_cast< sal_Int32 >( ( 
static_cast< double >( aOriginalSize.Width ) * aFillRect.X1 ) / 10 );
+aGraphCrop.Left = o3tl::convert(aFillRect.X1, 
aOriginalSize.Width, MAX_PERCENT);
 if ( aFillRect.Y1 )
-aGraphCrop.Top = static_cast< sal_Int32 >( ( 
static_cast< double >( aOriginalSize.Height ) * aFillRect.Y1 ) / 10 );
+aGraphCrop.Top = o3tl::convert(aFillRect.Y1, 
aOriginalSize.Height, MAX_PERCENT);
 if ( aFillRect.X2 )
-aGraphCrop.Right = static_cast< sal_Int32 >( ( 
static_cast< double >( aOriginalSize.Width ) * aFillRect.X2 ) / 10 );
+aGraphCrop.Right = o3tl::convert(aFillRect.X2, 
aOriginalSize.Width, MAX_PERCENT);
 if ( aFillRect.Y2 )
-aGraphCrop.Bottom = static_cast< sal_Int32 >( 
( static_cast< double >( aOriginalSize.Height ) * aFillRect.Y2 ) / 10 );
+aGraphCrop.Bottom = 
o3tl::convert(aFillRect.Y2, aOriginalSize.Height, MAX_PERCENT);
 
 bool bHasCropValues = aGraphCrop.Left != 0 || 
aGraphCrop.Right !=0 || aGraphCrop.Top != 0 || aGraphCrop.Bottom != 0;
 // Negative GraphicCrop values means "crop" here.
@@ -817,13 +817,13 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 {
 text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
 if ( oClipRect.X1 )
-aGraphCrop.Left = rtl::math::round( ( static_cast< double 
>( aOriginalSize.Width ) * oClipRect.X1 ) / 10 );
+aGraphCrop.Left = o3tl::convert(oClipRect.X1, 
aOriginalSize.Width, MAX_PERCENT);
 if ( oClipRect.Y1 )
-aGraphCrop.Top = rtl::math::round( ( static_cast< double 
>( aOriginalSize.Height ) * oClipRect.Y1 ) / 10 );
+aGraphCrop.Top = o3tl::convert(oClipRect.Y1, 
aOriginalSize.Height, MAX_PERCENT);
 if ( oClipRect.X2 )
-aGraphCrop.Right = rtl::math::round( ( static_cast< double 
>( aOriginalSize.Width ) * oClipRect.X2 ) / 10 );
+aGraph

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

2023-08-15 Thread Mike Kaganski (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |   10 ++-
 sd/qa/unit/data/pptx/tdf153008-srcRect-smallNegBound.pptx |binary
 sd/qa/unit/import-tests2.cxx  |   19 ++
 3 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 6c06c8a2be3d8cbbcb8ab1aaaeb04db95114dfcb
Author: Mike Kaganski 
AuthorDate: Tue Aug 15 14:42:20 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Aug 15 16:45:47 2023 +0200

tdf#153008: srcRect may have some members negative

The overly strict check (implying that all members must be non-negative,
to perform the crop) excluded valid cases where some of the members were
negative, and some positive.

Change-Id: I629689bdccedf9e37632a9fe14654778c0f14a6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155717
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 7e2f5185b7f6..5edc71b8bc12 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -826,13 +826,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 aGraphCrop.Bottom = rtl::math::round( ( static_cast< 
double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 10 );
 rPropMap.setProperty(PROP_GraphicCrop, aGraphCrop);
 
-bool bHasCropValues = aGraphCrop.Left != 0 || aGraphCrop.Right 
!=0 || aGraphCrop.Top != 0 || aGraphCrop.Bottom != 0;
-// Positive GraphicCrop values means "crop" here.
-bool bNeedCrop = aGraphCrop.Left >= 0 && aGraphCrop.Right >= 0 
&& aGraphCrop.Top >= 0 && aGraphCrop.Bottom >= 0;
-
-if(mbIsCustomShape && bHasCropValues && bNeedCrop)
+if(mbIsCustomShape)
 {
-xGraphic = lclCropGraphic(xGraphic, 
CropQuotientsFromSrcRect(oClipRect));
+// Positive GraphicCrop values means "crop" here.
+if (aGraphCrop.Left > 0 || aGraphCrop.Right > 0 || 
aGraphCrop.Top > 0 || aGraphCrop.Bottom > 0)
+xGraphic = lclCropGraphic(xGraphic, 
CropQuotientsFromSrcRect(oClipRect));
 }
 }
 }
diff --git a/sd/qa/unit/data/pptx/tdf153008-srcRect-smallNegBound.pptx 
b/sd/qa/unit/data/pptx/tdf153008-srcRect-smallNegBound.pptx
new file mode 100644
index ..9870e3f2e2e9
Binary files /dev/null and 
b/sd/qa/unit/data/pptx/tdf153008-srcRect-smallNegBound.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 4d197b364449..4e535c7749c7 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1918,6 +1918,25 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, 
testIndentDuplication)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nIndent2);
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, test_srcRect_smallNegBound)
+{
+// Given a cropped custom shape, with a srcRect having a small negative 
value in one of bounds
+createSdImpressDoc("pptx/tdf153008-srcRect-smallNegBound.pptx");
+
+uno::Reference xGraphic(
+getShapeFromPage(0, 0)->getPropertyValue("FillBitmap"), 
uno::UNO_QUERY_THROW);
+
+BitmapEx aBitmap(Graphic(xGraphic).GetBitmapEx());
+
+// Properly cropped bitmap should have black pixels close to left edge, 
near vertical center.
+// Before the fix, the gear was distorted, and this area was white.
+auto yMiddle = aBitmap.GetSizePixel().Height() / 2;
+auto x5Percent = aBitmap.GetSizePixel().Width() / 20;
+CPPUNIT_ASSERT(aBitmap.GetPixelColor(x5Percent, yMiddle).IsDark());
+// Just in case, check that the corner is bright (it is in fact yellow)
+CPPUNIT_ASSERT(aBitmap.GetPixelColor(0, 0).IsBright());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-08-11 Thread Noel Grandin (via logerrit)
 oox/source/drawingml/textparagraphproperties.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 996890180dc143df1de97072c81799ec1f1de083
Author: Noel Grandin 
AuthorDate: Fri Aug 11 12:08:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 11 14:15:44 2023 +0200

reduce noise in debug logs

Only set this property if the object supports it

Change-Id: If3adf76bbab5393e20a685b1af5016624c28fa79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155583
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/oox/source/drawingml/textparagraphproperties.cxx 
b/oox/source/drawingml/textparagraphproperties.cxx
index df3d36a21003..949ee3f22d6b 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -420,7 +420,8 @@ void TextParagraphProperties::pushToPropSet( const 
::oox::core::XmlFilterBase* p
 }
 else if ( pMasterBuList && pMasterBuList->mnNumberingType.hasValue() )
 pMasterBuList->mnNumberingType >>= nNumberingType;
-if ( nNumberingType == NumberingType::NUMBER_NONE )
+if ( nNumberingType == NumberingType::NUMBER_NONE
+&& aPropSet.hasProperty(PROP_NumberingLevel) )
 aPropSet.setProperty< sal_Int16 >( PROP_NumberingLevel, -1 );
 
 maBulletList.pushToPropMap( pFilterBase, rioBulletMap );


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

2023-08-07 Thread Szymon Kłos (via logerrit)
 oox/source/ppt/pptshape.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit b430cc2c3fba0ef2e56a1eb8610681c66714ef80
Author: Szymon Kłos 
AuthorDate: Fri Jul 28 12:16:36 2023 +0200
Commit: Szymon Kłos 
CommitDate: Mon Aug 7 10:07:44 2023 +0200

pptx: import ellipse shape correctly

Preset geometry "ellipse" was ignored:


Don't change service name to com.sun.star.presentation.OutlinerShape
it should stay CustomShape to be correctly shown as an ellipse.

Added next case: XML_body subtype in Layout and Slide mode.

This is continuation for:
commit 6df267780c4d41b41101c1be0a954b2f16ee8012
tdf#132557: PPTX import: Workaround for slide footer shape presets

Signed-off-by: Szymon Kłos 
Change-Id: Ifb914c58203a1ad533f9cc9b1857a48983354de6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155015
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 
(cherry picked from commit e63a9553c022a9976d59113938df068f9d2b5d6c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155233
Tested-by: Jenkins

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index a68ad18cf5b2..7b5b46546e3d 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -336,8 +336,10 @@ void PPTShape::addShape(
 // Need to use service name css.drawing.CustomShape if they have a non 
default shape.
 // This workaround has the drawback of them not really being processed 
as placeholders
 // so it is only done for slide footers...
-if ((mnSubType == XML_sldNum || mnSubType == XML_dt || mnSubType == 
XML_ftr)
-&& meShapeLocation == Slide && 
!mpCustomShapePropertiesPtr->representsDefaultShape())
+bool convertInSlideMode = meShapeLocation == Slide &&
+(mnSubType == XML_sldNum || mnSubType == XML_dt || mnSubType == 
XML_ftr || mnSubType == XML_body);
+bool convertInLayoutMode = meShapeLocation == Layout && (mnSubType == 
XML_body);
+if ((convertInSlideMode || convertInLayoutMode) && 
!mpCustomShapePropertiesPtr->representsDefaultShape())
 {
 sServiceName = "com.sun.star.drawing.CustomShape";
 }


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

2023-08-04 Thread Szymon Kłos (via logerrit)
 oox/source/ppt/pptshape.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ccd07c3bf5849a7939ea02a46b1c160ede16f03c
Author: Szymon Kłos 
AuthorDate: Wed Aug 2 08:57:54 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Aug 4 09:14:37 2023 +0200

oox: don't use master style by default

By default a shape with empty type attribute in placeholder tag: 
will get subtype = XML_obj (oox/source/drawingml/shapecontext.cxx:81)

When it is not referencing any master style shape by idx attribute
we shouldn't use master list style to be compatible with MSO.

Change-Id: Ib695b695885892dbe659e70a28daff1799c5f50e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155232
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index daa482eab94f..b6dd0f1c4603 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -206,7 +206,8 @@ void PPTShape::addShape(
case XML_obj :
 {
 sServiceName = sOutlinerShapeService;
-aMasterTextListStyle = rSlidePersist.getMasterPersist() ? 
rSlidePersist.getMasterPersist()->getBodyTextStyle() : 
rSlidePersist.getBodyTextStyle();
+if (getSubTypeIndex().has_value())
+aMasterTextListStyle = 
rSlidePersist.getMasterPersist() ? 
rSlidePersist.getMasterPersist()->getBodyTextStyle() : 
rSlidePersist.getBodyTextStyle();
 }
 break;
 case XML_body :


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

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

New commits:
commit 4567008914239b26533c1968820bf461d606f96d
Author: Xisco Fauli 
AuthorDate: Wed Jul 5 09:55:18 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 5 12:10:43 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 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index efde8de56f72..fc702c1c3a22 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1675,7 +1675,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: oox/source sw/qa

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

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

tdf155903 DOCX export: fix corrupt file with embedded media

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

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

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


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

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

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

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

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

Steps to reproduce:

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

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

3. Save as > OOXML format.

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

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


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

2023-06-19 Thread Tomaž Vajngerl (via logerrit)
 oox/source/export/ThemeExport.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 23a7fb9582fba4e5b699f0ea4bb270719256b403
Author: Tomaž Vajngerl 
AuthorDate: Mon Jun 19 15:25:40 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Jun 19 10:07:28 2023 +0200

oox: ThemeExport - add "relationship" xml:r namespace

Blips are referenced by r:embed element, which needs the xmlns:r
to be present, so add it at the toplevel.

Change-Id: Iccc3d197bf30b428927521c6ba598d8d92fa734d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153243
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/export/ThemeExport.cxx 
b/oox/source/export/ThemeExport.cxx
index 8d2d90fe1598..87cb5f2bc0bc 100644
--- a/oox/source/export/ThemeExport.cxx
+++ b/oox/source/export/ThemeExport.cxx
@@ -52,7 +52,8 @@ void ThemeExport::write(OUString const& rPath, model::Theme 
const& rTheme)
 OUString aThemeName = rTheme.GetName();
 
 mpFS->startElementNS(XML_a, XML_theme, FSNS(XML_xmlns, XML_a),
- mpFilterBase->getNamespaceURL(OOX_NS(dml)), XML_name, 
aThemeName);
+ mpFilterBase->getNamespaceURL(OOX_NS(dml)), 
FSNS(XML_xmlns, XML_r),
+ mpFilterBase->getNamespaceURL(OOX_NS(officeRel)), 
XML_name, aThemeName);
 
 mpFS->startElementNS(XML_a, XML_themeElements);
 


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

2023-06-17 Thread Andrea Gelmini (via logerrit)
 oox/source/drawingml/table/predefined-table-styles.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 48af1ee603149f09236f980c7b323997696bd946
Author: Andrea Gelmini 
AuthorDate: Sat Jun 17 15:12:07 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Jun 17 20:53:48 2023 +0200

Fix typo in code

Change-Id: I8f7e3b11b952b1882ca8e67619145c0dca71820a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153205
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx 
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 513637e3c7ee..451759036835 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -204,9 +204,9 @@ constexpr frozen::unordered_map tokens{
 
 sal_Int32 resolveToken(OUString const& rString)
 {
-auto interator = tokens.find(rString);
-if (interator != tokens.end())
-return interator->second;
+auto iterator = tokens.find(rString);
+if (iterator != tokens.end())
+return iterator->second;
 return XML_dk1;
 }
 


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

2023-06-14 Thread Noel Grandin (via logerrit)
 oox/source/drawingml/shapecontext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit de9107b2b875aa485f2375300cc1ce2c16ffdf89
Author: Noel Grandin 
AuthorDate: Wed Jun 14 11:52:23 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 14 13:00:11 2023 +0200

SAL_WARN->SAL_INFO in oox::ShapeContext

Change-Id: Ifd5e1493a8bbe9954ca9420d03b7a2b1db3307f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153043
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/oox/source/drawingml/shapecontext.cxx 
b/oox/source/drawingml/shapecontext.cxx
index 3ac32abd11aa..d14864ede331 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -124,7 +124,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 
aElementToken, const
 case XML_nvSpPr:
 break;
 default:
-SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " 
<< getBaseToken(aElementToken));
+SAL_INFO("oox", "ShapeContext::onCreateContext: unhandled element: " 
<< getBaseToken(aElementToken));
 break;
 }
 


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

2023-06-13 Thread Henry Castro (via logerrit)
 oox/source/token/tokens.txt   |1 +
 sc/source/filter/inc/condformatbuffer.hxx |3 +++
 sc/source/filter/oox/condformatbuffer.cxx |   15 +++
 sc/source/filter/oox/extlstcontext.cxx|6 ++
 4 files changed, 25 insertions(+)

New commits:
commit aebf004ae72e914540526269499bae27f39e04bf
Author: Henry Castro 
AuthorDate: Fri Mar 17 10:34:15 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Jun 13 17:45:46 2023 +0200

sc: filter: oox: add missing tag "fillcolor"

To fill the positive color of the conditional format data bar:


 
 
 
 
 


Signed-off-by: Henry Castro 
Change-Id: I17e83a01a292ff941d92f6ae59954aa246ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149064
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152965
Tested-by: Jenkins

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index dee9010df789..eb5239d8a8ac 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -2228,6 +2228,7 @@ fileType
 fileVersion
 filetime
 fill
+fillColor
 fillClrLst
 fillFormulas
 fillId
diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 992f14e041a8..1180b1e0aa74 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -237,6 +237,7 @@ struct ExCfRuleModel
 ExCfRuleModel() : mnAxisColor( ColorTransparency, UNSIGNED_RGB_TRANSPARENT 
), mnNegativeColor( ColorTransparency, UNSIGNED_RGB_TRANSPARENT ), mbGradient( 
false ), mbIsLower( true ) {}
 // AxisColor
 ::Color mnAxisColor;
+::Color mnPositiveColor;
 // NegativeFillColor
 ::Color mnNegativeColor;
 OUString maAxisPosition; // DataBar
@@ -250,6 +251,7 @@ class ExtCfDataBarRule : public WorksheetHelper
 enum RuleType
 {
 DATABAR,
+POSITIVEFILLCOLOR,
 NEGATIVEFILLCOLOR,
 AXISCOLOR,
 CFVO,
@@ -263,6 +265,7 @@ public:
 ExtCfDataBarRule(ScDataBarFormatData* pTarget, const WorksheetHelper& 
rParent);
 void finalizeImport();
 void importDataBar(  const AttributeList& rAttribs );
+void importPositiveFillColor(  const AttributeList& rAttribs );
 void importNegativeFillColor(  const AttributeList& rAttribs );
 void importAxisColor(  const AttributeList& rAttribs );
 void importCfvo(  const AttributeList& rAttribs );
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index ac5c2738aa47..63e75170a367 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1322,6 +1322,12 @@ void ExtCfDataBarRule::finalizeImport()
 pDataBar->maAxisColor = maModel.mnAxisColor;
 break;
 }
+case POSITIVEFILLCOLOR:
+{
+ScDataBarFormatData* pDataBar = mpTarget;
+pDataBar->maPositiveColor = maModel.mnPositiveColor;
+break;
+}
 case NEGATIVEFILLCOLOR:
 {
 ScDataBarFormatData* pDataBar = mpTarget;
@@ -1367,6 +1373,15 @@ void ExtCfDataBarRule::importDataBar( const 
AttributeList& rAttribs )
 maModel.maAxisPosition = rAttribs.getString( XML_axisPosition, "automatic" 
);
 }
 
+void ExtCfDataBarRule::importPositiveFillColor( const AttributeList& rAttribs )
+{
+mnRuleType = POSITIVEFILLCOLOR;
+ThemeBuffer& rThemeBuffer = getTheme();
+GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
+::Color aColor = importOOXColor(rAttribs, rThemeBuffer, rGraphicHelper);
+maModel.mnPositiveColor = aColor;
+}
+
 void ExtCfDataBarRule::importNegativeFillColor( const AttributeList& rAttribs )
 {
 mnRuleType = NEGATIVEFILLCOLOR;
diff --git a/sc/source/filter/oox/extlstcontext.cxx 
b/sc/source/filter/oox/extlstcontext.cxx
index 45e60e7c6f5e..760ba26c1727 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -56,6 +56,12 @@ void ExtCfRuleContext::onStartElement( const AttributeList& 
rAttribs )
 xRule->importDataBar( rAttribs );
 break;
 }
+case XLS14_TOKEN( fillColor ):
+{
+ExtCfDataBarRuleRef xRule = 
getCondFormats().createExtCfDataBarRule(mpTarget);
+xRule->importPositiveFillColor( rAttribs );
+break;
+}
 case XLS14_TOKEN( negativeFillColor ):
 {
 ExtCfDataBarRuleRef xRule = 
getCondFormats().createExtCfDataBarRule(mpTarget);


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

2023-06-13 Thread Caolán McNamara (via logerrit)
 oox/source/export/drawingml.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit f412c1e448b0268294ccbccee4f3a6a9e76a7b98
Author: Caolán McNamara 
AuthorDate: Tue Jun 13 14:37:56 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 13 16:55:07 2023 +0200

cid#1532377 Dereference before null check

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5b0772550471..dca260895af8 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -761,6 +761,14 @@ void DrawingML::WriteGradientFill(
 basegfx::utils::prepareColorStops(*pTransparenceGradient, aAlphaStops, 
aSingleAlpha);
 }
 
+if (nullptr == pGradient)
+{
+// an error - see comment in header - is to give neither pColorGradient
+// nor pTransparenceGradient
+assert(false && "pColorGradient or pTransparenceGradient should be 
set");
+return;
+}
+
 // apply steps if used. Need to do that before synchronizeColorStops
 // since that may add e.g. for AlphaStops all-the-same no-data entries,
 // so the number of entries might change
@@ -775,12 +783,10 @@ void DrawingML::WriteGradientFill(
 // method (at import time) will be exported again
 basegfx::utils::synchronizeColorStops(aColorStops, aAlphaStops, 
aSingleColor, aSingleAlpha);
 
-if (aColorStops.size() != aAlphaStops.size() || nullptr == pGradient)
+if (aColorStops.size() != aAlphaStops.size())
 {
 // this is an error - synchronizeColorStops above *has* to create that
 // state, see description there (!)
-// also an error - see comment in header - is to give neither 
pColorGradient
-// nor pTransparenceGradient
 assert(false && "oox::WriteGradientFill: non-synchronized gradients 
(!)");
 return;
 }


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

2023-06-11 Thread Tomaž Vajngerl (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx|2 
 oox/source/token/properties.txt |1 
 sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx |binary
 sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx  |   16 +++
 sw/source/filter/ww8/docxattributeoutput.cxx|   10 +-
 writerfilter/source/dmapper/DomainMapper.cxx|   42 
++
 writerfilter/source/dmapper/PropertyIds.cxx |1 
 writerfilter/source/dmapper/PropertyIds.hxx |1 
 8 files changed, 70 insertions(+), 3 deletions(-)

New commits:
commit 953ef30494661788b2e980ece84b62c653d77321
Author: Tomaž Vajngerl 
AuthorDate: Sun Jun 11 00:50:08 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Jun 12 05:26:11 2023 +0200

ooxml: import and export char underline theme colors

This adds support to import and export char underline theme color
properties.

Change-Id: Ia8948ee5aacd20e0c2b7cbb1b2fdf97fc65c04e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152834
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 0e1e2830a67f..1217c19441ae 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -206,6 +206,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 {
 rPropMap.setProperty( PROP_CharUnderlineHasColor, true);
 rPropMap.setProperty( PROP_CharUnderlineColor, 
maUnderlineColor.getColor( rFilter.getGraphicHelper() ));
+model::ComplexColor aComplexColor = maUnderlineColor.getComplexColor();
+rPropMap.setProperty( PROP_CharUnderlineComplexColor, 
model::color::createXComplexColor(aComplexColor));
 }
 else
 {
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 40988ffb0222..025b0628b9d8 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -91,6 +91,7 @@ CharStyleName
 CharTransparence
 CharUnderline
 CharUnderlineColor
+CharUnderlineComplexColor
 CharUnderlineHasColor
 CharWeight
 CharWeightAsian
diff --git a/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx 
b/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx
new file mode 100644
index ..3ee3cdf457f0
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx 
b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
index 3804f4606187..f9e7155859ea 100644
--- a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
@@ -81,6 +81,22 @@ DECLARE_SW_ROUNDTRIP_TEST(testThemePortionBorderColor_DOCX, 
"Test_ThemeBorderCol
 CPPUNIT_ASSERT(isPropertyVoid(xParagraph, "RightBorderComplexColor"));
 }
 
+DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, 
"Test_CharUnderlineThemeColor.docx", nullptr,
+  Test)
+{
+auto xParagraph = getParagraph(1);
+CPPUNIT_ASSERT(xParagraph.is());
+auto xRun = getRun(xParagraph, 1);
+auto xComplexColor
+= getProperty>(xRun, 
"CharUnderlineComplexColor");
+auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
+CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aComplexColor.getSchemeType());
+auto const& rTransforms = aComplexColor.getTransformations();
+CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
+CPPUNIT_ASSERT_EQUAL(model::TransformationType::Shade, 
rTransforms[0].meType);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f5742eae4515..a75682761d84 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7953,10 +7953,14 @@ void DocxAttributeOutput::CharUnderline( const 
SvxUnderlineItem& rUnderline )
 bool  bUnderlineHasColor = !aUnderlineColor.IsTransparent();
 if (bUnderlineHasColor)
 {
+model::ComplexColor const& rComplexColor = 
rUnderline.getComplexColor();
 // Underline has a color
-m_pSerializer->singleElementNS( XML_w, XML_u,
-FSNS( XML_w, XML_val ), 
pUnderlineValue,
-FSNS( XML_w, XML_color ), 
msfilter::util::ConvertColor(aUnderlineColor) );
+rtl::Reference pAttrList = 
FastSerializerHelper::createAttrList();
+pAttrList->add(FSNS(XML_w, XML_val), pUnderlineValue);
+pAttrList->add(FSNS(XML_w, XML_color), 
msfilter::util::ConvertColor(aUnderlineColor));
+ 

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

2023-05-23 Thread Armin Le Grand (allotropia) (via logerrit)
 oox/source/export/drawingml.cxx |   61 ++--
 svx/source/xoutdev/xattr.cxx|7 
 2 files changed, 48 insertions(+), 20 deletions(-)

New commits:
commit e6ad415037b0b0bc77cd742af8260d99c1610c11
Author: Armin Le Grand (allotropia) 
AuthorDate: Mon May 22 12:13:25 2023 +0200
Commit: Armin Le Grand 
CommitDate: Tue May 23 10:11:48 2023 +0200

MCGR: Check correctly for used FillTransparenceGradient

To correctly check using UNO API if a FillTransparence-
Gradient is used it is necessary to check if a Name for
it is set. This corresponds to the IsEnabled() state
of the XFillFloatTransparenceItem in the core.

This was not consequently done that way and e.g. was
done by checking if the FTG was 'default' in the sense
that the StartColor was COL_BLACK. This was never
sufficient and is not with MCGRs, too.

Important in this case is the UnitTest checking for
file fdo66688.docx - the re-export/roundtrip goes
wrong when not doing this correctly.

Change-Id: Iaf14c1e4481188124f044b4b3c8bcd6689c65aad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152087
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8bfcc8df5577..bd58cbf21249 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -473,15 +473,22 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 // OOXML has no separate transparence gradient but uses transparency in 
the gradient stops.
 // So we merge transparency and color and use gradient fill in such case.
 basegfx::BGradient aTransparenceGradient;
+OUString sFillTransparenceGradientName;
 bool bNeedGradientFill(false);
 
-if (GetProperty(rXPropSet, "FillTransparenceGradient"))
+if (GetProperty(rXPropSet, "FillTransparenceGradientName")
+&& (mAny >>= sFillTransparenceGradientName)
+&& !sFillTransparenceGradientName.isEmpty()
+&& GetProperty(rXPropSet, "FillTransparenceGradient"))
 {
 aTransparenceGradient = basegfx::BGradient(mAny);
 basegfx::BColor aSingleColor;
 bNeedGradientFill = 
!aTransparenceGradient.GetColorStops().isSingleColor(aSingleColor);
 
-if (!bNeedGradientFill && aSingleColor != basegfx::BColor())
+// we no longer need to 'guess' if FillTransparenceGradient is used by
+// comparing it's 1st color to COL_BLACK after having tested that the
+// FillTransparenceGradientName is set
+if (!bNeedGradientFill)
 {
 // Our alpha is a gray color value.
 const sal_uInt8 nRed(aSingleColor.getRed() * 255.0);
@@ -639,13 +646,11 @@ void DrawingML::WriteGradientFill( const Reference< 
XPropertySet >& rXPropSet )
 
 if (GetProperty(rXPropSet, "FillTransparenceGradientName")
 && (mAny >>= sFillTransparenceGradientName)
-&& !sFillTransparenceGradientName.isEmpty())
+&& !sFillTransparenceGradientName.isEmpty()
+&& GetProperty(rXPropSet, "FillTransparenceGradient"))
 {
-if (GetProperty(rXPropSet, "FillTransparenceGradient"))
-{
-aTransparenceGradient = basegfx::BGradient(mAny);
-}
-
+// TransparenceGradient is only used when name is not empty
+aTransparenceGradient = basegfx::BGradient(mAny);
 pTransparenceGradient = &aTransparenceGradient;
 }
 else if (GetProperty(rXPropSet, "FillTransparence"))
@@ -5314,19 +5319,35 @@ void DrawingML::WriteFill(const 
Reference& xPropSet, const awt::Si
 xPropSet->getPropertyValue( "FillStyle" ) >>= aFillStyle;
 
 // map full transparent background to no fill
-if ( aFillStyle == FillStyle_SOLID && GetProperty( xPropSet, 
"FillTransparence" ) )
-{
-sal_Int16 nVal = 0;
-xPropSet->getPropertyValue( "FillTransparence" ) >>= nVal;
-if ( nVal == 100 )
-aFillStyle = FillStyle_NONE;
-}
-if (aFillStyle == FillStyle_SOLID && GetProperty( xPropSet, 
"FillTransparenceGradient"))
+if (aFillStyle == FillStyle_SOLID)
 {
-awt::Gradient aTransparenceGradient;
-mAny >>= aTransparenceGradient;
-if (aTransparenceGradient.StartColor == 0xff && 
aTransparenceGradient.EndColor == 0xff)
-aFillStyle = FillStyle_NONE;
+OUString sFillTransparenceGradientName;
+
+if (GetProperty(xPropSet, "FillTransparenceGradientName")
+&& (mAny >>= sFillTransparenceGradientName)
+&& !sFillTransparenceGradientName.isEmpty()
+&& GetProperty(xPropSet, "FillTransparenceGradient"))
+{
+// check if a fully transparent TransparenceGradient is used
+// use BGradient constructor & tooling here now
+const basegfx::BGradient aTransparenceG

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

2023-05-19 Thread Andrea Gelmini (via logerrit)
 oox/source/export/drawingml.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0a8648f6d334a5aee4e39e265acacb655ae1d5b1
Author: Andrea Gelmini 
AuthorDate: Fri May 19 11:22:52 2023 +0200
Commit: Julien Nabet 
CommitDate: Fri May 19 13:44:28 2023 +0200

Fix typo

Change-Id: If39ff84ec74e29fdfcd21194ef371108b591caed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151996
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ef4e4ea2b445..8bfcc8df5577 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -611,7 +611,7 @@ void DrawingML::WriteGradientFill( const Reference< 
XPropertySet >& rXPropSet )
 if( rProp.Name == "GradFillDefinition" )
 rProp.Value >>= aGradientStops;
 else if( rProp.Name == "OriginalGradFill" )
-// use BGradient constructor direcly, it will take care of 
Gradient/Gradient2
+// use BGradient constructor directly, it will take care of 
Gradient/Gradient2
 aOriginalGradient = basegfx::BGradient(rProp.Value);
 }
 


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

2023-05-09 Thread Andrea Gelmini (via logerrit)
 oox/source/export/drawingml.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 91bdd2fa1a8d602a2af26dfbc38cdd09f2e8394e
Author: Andrea Gelmini 
AuthorDate: Wed May 3 19:55:51 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue May 9 19:25:18 2023 +0200

Fix typo

Change-Id: I38877f928fd6943afa1a6c17d8225caef8411d1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151338
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ad07308ada62..9f705a20cf9e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -860,7 +860,7 @@ void DrawingML::WriteGradientFill(
 // Caution: do not add 1st entry again, that would be double 
since it was
 // already added as last element of the inverse run above. But 
only if
 // the gradient has a start entry for 0.0 aka StartColor, else 
it is correct.
-// Since aColorStops and aAlphaStops are already syched (see
+// Since aColorStops and aAlphaStops are already synched (see
 // synchronizeColorStops above), testing one of them is 
sufficient here.
 aCurrColor++;
 aCurrAlpha++;


  1   2   3   4   5   6   7   8   9   10   >