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

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

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

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

of background image patterns defined by a:tile.

Note: factor "3.6" comes from EMU.

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

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

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

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

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

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

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

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

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

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

2022-10-28 Thread Sarper Akdemir (via logerrit)
 include/oox/export/drawingml.hxx  |2 -
 oox/source/export/drawingml.cxx   |   26 ++
 sd/qa/unit/data/odp/autofitted-textbox-indent.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx|   22 ++
 4 files changed, 45 insertions(+), 5 deletions(-)

New commits:
commit f2aba4e0f9bd11962739fed69bd5c99a56a6f5ed
Author: Sarper Akdemir 
AuthorDate: Mon Oct 24 14:16:16 2022 +0300
Commit: Andras Timar 
CommitDate: Fri Oct 28 12:06:44 2022 +0200

related tdf#149961 pptx export: scale indents for autofitted textboxes

For autofitted textboxes, Impress scales the indents with
the text size while PowerPoint doesn't.

Try to compensate for this by scaling exported indents
proportionally to the font scale on autofitted textboxes.

Change-Id: Ib0f967e923d23553b4cdbd1bbe2e137d97b1b2e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141758
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141940
Reviewed-by: Andras Timar 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index c80024ea1fdd..674457b3c6e4 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -302,7 +302,7 @@ public:
 
 @returns true if any paragraph properties were written
 */
-bool WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, float fFirstCharHeight, sal_Int32 
nElement);
+bool WriteParagraphProperties(const css::uno::Reference< 
css::text::XTextContent >& rParagraph, const 
css::uno::Reference& rXShapePropSet, float 
fFirstCharHeight, sal_Int32 nElement);
 void WriteParagraphNumbering(const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet, float fFirstCharHeight,
   sal_Int16 nLevel );
 void WriteParagraphTabStops(const 
css::uno::Reference& rXPropSet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0ab497a4fed3..5ee48ff6e338 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3020,7 +3020,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& 
rSpacing, float fFirstCharHe
 }
 }
 
-bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& 
rParagraph, float fFirstCharHeight, sal_Int32 nElement)
+bool DrawingML::WriteParagraphProperties(const Reference& 
rParagraph, const Reference& rXShapePropSet, float 
fFirstCharHeight, sal_Int32 nElement)
 {
 Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
 Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
@@ -3110,6 +3110,24 @@ bool DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 return false;
 }
 
+// for autofitted textboxes, scale the indents
+if (GetProperty(rXShapePropSet, "TextFitToSize") && 
mAny.get() == TextFitToSizeType_AUTOFIT)
+{
+SvxShapeText* pTextShape = 
dynamic_cast(rXShapePropSet.get());
+if (pTextShape)
+{
+SdrTextObj* pTextObject = 
dynamic_cast(pTextShape->GetSdrObject());
+if (pTextObject)
+{
+const auto nFontScaleY = pTextObject->GetFontScaleY();
+nLeftMargin = nLeftMargin * nFontScaleY / 100;
+nLineIndentation = nLineIndentation * nFontScaleY / 100;
+nParaLeftMargin = nParaLeftMargin * nFontScaleY / 100;
+nParaFirstLineIndent = nParaFirstLineIndent * nFontScaleY / 
100;
+}
+}
+}
+
 if (nParaLeftMargin) // For Paragraph
 mpFS->startElementNS( XML_a, nElement,
XML_lvl, 
sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0),
@@ -3197,7 +3215,7 @@ void DrawingML::WriteLstStyles(const 
css::uno::ReferencegetPropertyValue("CharHeight").get();
 
 mpFS->startElementNS(XML_a, XML_lstStyle);
-if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, 
XML_lvl1pPr) )
+if( !WriteParagraphProperties(rParagraph, rXShapePropSet, 
fFirstCharHeight, XML_lvl1pPr) )
 mpFS->startElementNS(XML_a, XML_lvl1pPr);
 WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, 
rbOverridingCharHeight,
rnCharHeight, GetScriptType(rRun->getString()), 
rXShapePropSet);
@@ -3239,7 +3257,7 @@ void DrawingML::WriteParagraph( const Reference< 
XTextContent >& rParagraph,
 rnCharHeight = 100 * fFirstCharHeight;
 rbOverridingCharHeight = true;
 }
-WriteParagraphProperties(rParagraph, fFirstCharHeight, 
XML_pPr);
+WriteParagraphProperties(rParagraph, rXShapePropSet, 
fFirstCharHeight, XML_pPr);
 bPropertiesWritten = true;
 }
 

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

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

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

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

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

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

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

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