summaryrefslogtreecommitdiff
path: root/oox/source/export/shapes.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/export/shapes.cxx')
-rw-r--r--oox/source/export/shapes.cxx47
1 files changed, 19 insertions, 28 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 466b392c1a0e..5f0f04bf6bda 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -551,8 +551,6 @@ static bool lcl_IsOnDenylist(OUString const & rShapeType)
u"flower",
u"bracket-pair",
u"brace-pair",
- u"col-60da8460",
- u"col-502ad400",
u"quad-bevel",
u"round-rectangular-callout",
u"rectangular-callout",
@@ -605,7 +603,9 @@ static bool lcl_IsOnAllowlist(OUString const & rShapeType)
{
static const std::initializer_list<std::u16string_view> vAllowlist = {
u"heart",
- u"puzzle"
+ u"puzzle",
+ u"col-60da8460",
+ u"col-502ad400"
};
return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end();
@@ -740,7 +740,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
bool bHasGeometrySeq(false);
Sequence< PropertyValue > aGeometrySeq;
- OUString sShapeType;
+ OUString sShapeType("non-primitive"); // default in ODF
if (GETA(CustomShapeGeometry))
{
SAL_INFO("oox.shape", "got custom shape geometry");
@@ -903,9 +903,6 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
// visual shape properties
pFS->startElementNS(mnXmlNamespace, XML_spPr);
- // moon is flipped in MSO, and mso-spt89 (right up arrow) is mapped to leftUpArrow
- if ( sShapeType == "moon" || sShapeType == "mso-spt89" )
- bFlipH = !bFlipH;
// we export non-primitive shapes to custom geometry
// we also export non-ooxml shapes which have handles/equations to custom geometry, because
@@ -925,15 +922,14 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
bCustGeom = false;
bOnDenylist = true;
}
- else if( bHasHandles )
- bCustGeom = true;
bool bPresetWriteSuccessful = false;
// Let the custom shapes what has name and preset information in OOXML, to be written
// as preset ones with parameters. Try that with this converter class.
if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive"
&& GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes
- && xShape->getShapeType() == "com.sun.star.drawing.CustomShape")
+ && xShape->getShapeType() == "com.sun.star.drawing.CustomShape"
+ && !lcl_IsOnAllowlist(sShapeType))
{
DMLPresetShapeExporter aCustomShapeConverter(this, xShape);
bPresetWriteSuccessful = aCustomShapeConverter.WriteShape();
@@ -941,28 +937,16 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
// If preset writing has problems try to write the shape as it done before
if (bPresetWriteSuccessful)
;// Already written do nothing.
- else if (bHasHandles && bCustGeom)
- {
- WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, false, true );// do not flip, polypolygon coordinates are flipped already
- tools::PolyPolygon aPolyPolygon( rSdrObjCustomShape.GetLineGeometry(true) );
- sal_Int32 nRotation = 0;
- // The RotateAngle property's value is independent from any flipping, and that's exactly what we need here.
- uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
- uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
- if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
- xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
- // Remove rotation
- bool bInvertRotation = bFlipH != bFlipV;
- if (nRotation != 0)
- aPolyPolygon.Rotate(Point(0,0), Degree10(static_cast<sal_Int16>(bInvertRotation ? nRotation/10 : 3600-nRotation/10)));
- WritePolyPolygon(xShape, aPolyPolygon, false);
- }
else if (bCustGeom)
{
WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV );
bool bSuccess = WriteCustomGeometry(xShape, rSdrObjCustomShape);
- if (!bSuccess)
- WritePresetShape( sPresetShape );
+ // In case of Writer, the parent element is <wps:spPr>, and there the <a:custGeom> element
+ // is not optional.
+ if (!bSuccess && GetDocumentType() == DOCUMENT_DOCX)
+ {
+ WriteEmptyCustomGeometry();
+ }
}
else if (bOnDenylist && bHasHandles && nAdjustmentValuesIndex !=-1 && !sShapeType.startsWith("mso-spt"))
{
@@ -1674,6 +1658,7 @@ static const NameToConvertMapType& lcl_GetConverters()
{ "com.sun.star.drawing.EllipseShape" , &ShapeExport::WriteEllipseShape },
{ "com.sun.star.drawing.GraphicObjectShape" , &ShapeExport::WriteGraphicObjectShape },
{ "com.sun.star.drawing.LineShape" , &ShapeExport::WriteLineShape },
+ { "com.sun.star.drawing.MediaShape" , &ShapeExport::WriteGraphicObjectShape },
{ "com.sun.star.drawing.OpenBezierShape" , &ShapeExport::WriteOpenPolyPolygonShape },
{ "com.sun.star.drawing.PolyPolygonShape" , &ShapeExport::WriteClosedPolyPolygonShape },
{ "com.sun.star.drawing.PolyLineShape" , &ShapeExport::WriteOpenPolyPolygonShape },
@@ -1990,6 +1975,12 @@ void ShapeExport::WriteBorderLine(const sal_Int32 XML_line, const BorderLine2& r
DrawingML::WriteSolidFill( ::Color(ColorTransparency, rBorderLine.Color) );
mpFS->endElementNS( XML_a, XML_line );
}
+ else if( nBorderWidth == 0)
+ {
+ mpFS->startElementNS(XML_a, XML_line);
+ mpFS->singleElementNS(XML_a, XML_noFill);
+ mpFS->endElementNS( XML_a, XML_line );
+ }
}
void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPropSet)