summaryrefslogtreecommitdiff
path: root/oox/source/vml/vmlshape.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/vml/vmlshape.cxx')
-rw-r--r--oox/source/vml/vmlshape.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 1e3e1f72e64d..7ee10203341e 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -69,6 +69,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/sequenceashashmap.hxx>
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::uno::Any;
@@ -259,6 +260,7 @@ ShapeModel::ShapeModel()
: mbIsSignatureLine(false)
, mbSignatureLineShowSignDate(true)
, mbSignatureLineCanAddComment(false)
+ , mbInGroup(false)
{
}
@@ -459,6 +461,8 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
PropertySet aControlShapeProp( xControlShape->getControl() );
aControlShapeProp.setProperty( PROP_EnableVisible, uno::makeAny( false ) );
}
+
+ xShape = finalImplConvertAndInsert(xShape);
/* Notify the drawing that a new shape has been inserted. For
convenience, pass the rectangle that contains position and
size of the shape. */
@@ -887,6 +891,34 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
return xShape;
}
+Reference<XShape> SimpleShape::finalImplConvertAndInsert(const css::uno::Reference<css::drawing::XShape>& rxShape) const
+{
+ // tdf#41466 This setting must be done here, because the position of textbox will be set as an
+ // effect of the PROP_TextBox property setting, and if we do this setting earlier (setting of
+ // properties of position and size) then the position of textbox will be set with wrong data.
+ // TODO: TextShape is set if we have rect shape in group; we should use the shape-with-textbox
+ // mechanism to handle this situation
+ if (getTextBox() && maService != "com.sun.star.text.TextFrame" && maService != "com.sun.star.drawing.TextShape"
+ && !maShapeModel.mbInGroup)
+ {
+ const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
+ const auto& nLeft = ConversionHelper::decodeMeasureToHmm(
+ rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true);
+ PropertySet aPropertySet(rxShape);
+ aPropertySet.setProperty(PROP_HoriOrientPosition, nLeft);
+ const auto& nTop = ConversionHelper::decodeMeasureToHmm(
+ rGraphicHelper, maTypeModel.maMarginTop, 0, true, true);
+ aPropertySet.setProperty(PROP_VertOrientPosition, nTop);
+ aPropertySet.setProperty(PROP_TextBox, true);
+
+ // And these properties must be set after textbox creation (set PROP_Textbox property).
+ // Note: if you set a new property then you have to handle it in the proper
+ // SwTextBoxHelper::syncProperty function.
+ if (maTypeModel.maLayoutFlowAlt == "bottom-to-top")
+ aPropertySet.setAnyProperty(PROP_TextWritingMode, uno::makeAny(text::WritingMode2::BT_LR));
+ }
+ return ShapeBase::finalImplConvertAndInsert(rxShape);
+}
Reference< XShape > SimpleShape::createEmbeddedPictureObject( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect, OUString const & rGraphicPath ) const
{
Reference<XGraphic> xGraphic = mrDrawing.getFilter().getGraphicHelper().importEmbeddedGraphic(rGraphicPath);