summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-11-16 15:02:35 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-11-16 16:55:19 +0100
commitb699a693cabf307418d3aa2c159d58a4bedd43a4 (patch)
tree29d782098c3e57d6db580b7b4d2005aa86d6064c /oox
parentab8fc2603c647754d7954b77c1347123402c8b7b (diff)
tdf#128820: use wps namespace for simple text shapes
Without that, simple text shapes inside groups were written in <pic:wsp> elements, with many child elements also having pic:: prefix. Change-Id: I114cf3499e03aa5ca042211d7b134aaf5b0e7fbf Reviewed-on: https://gerrit.libreoffice.org/82980 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/shapes.cxx35
1 files changed, 18 insertions, 17 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index ebab46728bef..9f69e316cbec 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -381,6 +381,14 @@ awt::Size ShapeExport::MapSize( const awt::Size& rSize ) const
return awt::Size( aRetSize.Width(), aRetSize.Height() );
}
+static bool IsNonEmptySimpleText(const Reference<XInterface>& xIface)
+{
+ if (Reference<XSimpleText> xText{ xIface, UNO_QUERY })
+ return xText->getString().getLength();
+
+ return false;
+}
+
bool ShapeExport::NonEmptyText( const Reference< XInterface >& xIface )
{
Reference< XPropertySet > xPropSet( xIface, UNO_QUERY );
@@ -414,12 +422,7 @@ bool ShapeExport::NonEmptyText( const Reference< XInterface >& xIface )
}
}
- Reference< XSimpleText > xText( xIface, UNO_QUERY );
-
- if( xText.is() )
- return xText->getString().getLength();
-
- return false;
+ return IsNonEmptySimpleText(xIface);
}
ShapeExport& ShapeExport::WritePolyPolygonShape( const Reference< XShape >& xShape, const bool bClosed )
@@ -529,7 +532,11 @@ ShapeExport& ShapeExport::WriteGroupShape(const uno::Reference<drawing::XShape>&
uno::Reference<lang::XServiceInfo> xServiceInfo(xChild, uno::UNO_QUERY_THROW);
if (GetDocumentType() == DOCUMENT_DOCX)
{
- if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+ // tdf#128820: WriteGraphicObjectShapePart calls WriteTextShape for non-empty simple
+ // text objects, which needs writing into wps::wsp element, so make sure to use wps
+ // namespace for those objects
+ if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape")
+ && !IsNonEmptySimpleText(xChild))
mnXmlNamespace = XML_pic;
else
mnXmlNamespace = XML_wps;
@@ -1165,19 +1172,13 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape
{
SAL_INFO("oox.shape", "write graphic object shape");
- if( NonEmptyText( xShape ) )
+ if (IsNonEmptySimpleText(xShape))
{
- // avoid treating all 'IsPresentationObject' objects as having text.
- Reference< XSimpleText > xText( xShape, UNO_QUERY );
+ SAL_INFO("oox.shape", "graphicObject: wrote only text");
- if( xText.is() && !xText->getString().isEmpty() )
- {
- SAL_INFO("oox.shape", "graphicObject: wrote only text");
+ WriteTextShape(xShape);
- WriteTextShape( xShape );
-
- return;
- }
+ return;
}
SAL_INFO("oox.shape", "graphicObject without text");