diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-11-24 16:40:56 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-11-24 16:56:11 +0100 |
commit | 67d11883740da4ef242d0002acde83f67d4b327a (patch) | |
tree | 451ae65318d39bad2b408a98c54d0a5241f725a4 | |
parent | ca6fec87e0ebc32a748f9f44143e6336b008399e (diff) |
tdf#113938 sw: apply new default vertical orientation only during import
Commit c79467ba954987f1d239c594c1e1b3af3f5515f6 changed the default
vertical orientation for shapes in Writer; it turns out that at
least one extension assumes the previous default.
Tweak SwXShape so that the new default is used for shapes that are
created during file import, otherwise the old default.
Change-Id: I1dc4d3342dd53ce8e0857984456717b8ffcc97c7
-rw-r--r-- | sw/inc/unodraw.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 23 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
3 files changed, 19 insertions, 12 deletions
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx index ec85124980f7..6b35f6468b4a 100644 --- a/sw/inc/unodraw.hxx +++ b/sw/inc/unodraw.hxx @@ -215,7 +215,7 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; public: - SwXShape(css::uno::Reference< css::uno::XInterface > & xShape); + SwXShape(css::uno::Reference<css::uno::XInterface> & xShape, SwDoc const* pDoc); static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; @@ -275,7 +275,7 @@ class SwXGroupShape : protected: virtual ~SwXGroupShape() override; public: - SwXGroupShape(css::uno::Reference< css::uno::XInterface > & xShape); + SwXGroupShape(css::uno::Reference<css::uno::XInterface> & xShape, SwDoc const* pDoc); virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; virtual void SAL_CALL acquire( ) throw() override; diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 3d080b56391a..c0a5f75b9fb1 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -73,6 +73,7 @@ using namespace ::com::sun::star; class SwShapeDescriptor_Impl { + bool m_isInReading; SwFormatHoriOrient* pHOrient; SwFormatVertOrient* pVOrient; SwFormatAnchor* pAnchor; @@ -95,7 +96,9 @@ public: bool bInitializedPropertyNotifier; public: - SwShapeDescriptor_Impl() : + SwShapeDescriptor_Impl(SwDoc const*const pDoc) + : m_isInReading(pDoc && pDoc->IsInReading()) + , // #i32349# - no defaults, in order to determine on // adding a shape, if positioning attributes are set or not. pHOrient( nullptr ), @@ -149,7 +152,8 @@ public: { if(bCreate && !pVOrient) { - if (!GetAnchor(true) || pAnchor->GetAnchorId() == RndStdIds::FLY_AS_CHAR) + if (m_isInReading && // tdf#113938 extensions might rely on old default + (!GetAnchor(true) || pAnchor->GetAnchorId() == RndStdIds::FLY_AS_CHAR)) { // for as-char, NONE ("from-top") is not a good default pVOrient = new SwFormatVertOrient(0, text::VertOrientation::TOP, text::RelOrientation::FRAME); } @@ -381,9 +385,9 @@ uno::Reference< drawing::XShape > SwFmDrawPage::CreateShape( SdrObject *pObj ) c xRet = nullptr; uno::Reference< beans::XPropertySet > xPrSet; if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || (dynamic_cast<const E3dScene*>( pObj) != nullptr)) ) - xPrSet = new SwXGroupShape( xCreate ); + xPrSet = new SwXGroupShape(xCreate, nullptr); else - xPrSet = new SwXShape( xCreate ); + xPrSet = new SwXShape(xCreate, nullptr); xRet.set(xPrSet, uno::UNO_QUERY); } } @@ -900,10 +904,12 @@ namespace } } -SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : +SwXShape::SwXShape(uno::Reference<uno::XInterface> & xShape, + SwDoc const*const pDoc) + : m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE)), m_pPropertyMapEntries(aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE)), - pImpl(new SwShapeDescriptor_Impl()), + pImpl(new SwShapeDescriptor_Impl(pDoc)), m_bDescriptor(true) { if(!xShape.is()) // default Ctor @@ -2716,8 +2722,9 @@ css::drawing::PolyPolygonBezierCoords SwXShape::ConvertPolyPolygonBezierToLayout return aConvertedPath; } -SwXGroupShape::SwXGroupShape(uno::Reference< XInterface > & xShape) : - SwXShape(xShape) +SwXGroupShape::SwXGroupShape(uno::Reference<XInterface> & xShape, + SwDoc const*const pDoc) + : SwXShape(xShape, pDoc) { #if OSL_DEBUG_LEVEL > 0 uno::Reference<XShapes> xShapes(xShapeAgg, uno::UNO_QUERY); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 0d82750de8ce..ce4988f6adc0 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1680,11 +1680,11 @@ css::uno::Reference<css::uno::XInterface> SwXTextDocument::create( if (rServiceName == "com.sun.star.drawing.GroupShape" || rServiceName == "com.sun.star.drawing.Shape3DSceneObject") { - return *new SwXGroupShape(xTmp); + return *new SwXGroupShape(xTmp, pDocShell->GetDoc()); } if (rServiceName.startsWith("com.sun.star.drawing.")) { - return *new SwXShape(xTmp); + return *new SwXShape(xTmp, pDocShell->GetDoc()); } return xTmp; } |