diff options
Diffstat (limited to 'filter/source/msfilter/eschesdo.cxx')
-rw-r--r-- | filter/source/msfilter/eschesdo.cxx | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 12e6e62be0a2..b21534676e4c 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -23,8 +23,8 @@ #include <svx/svdobj.hxx> #include <tools/poly.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <svx/fmdpage.hxx> +#include <comphelper/diagnose_ex.hxx> +#include <svx/unopage.hxx> #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -164,7 +164,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, if ( xPropInfo.is() && xPropInfo->hasPropertyByName( "InteropGrabBag" ) ) { xPropertySet->getPropertyValue( "InteropGrabBag" ) >>= aGrabBag; - for (const beans::PropertyValue& rProp : std::as_const(aGrabBag)) + for (const beans::PropertyValue& rProp : aGrabBag) { if (rProp.Name == "mso-edit-as") { @@ -430,13 +430,17 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, } mpEscherEx->OpenContainer( ESCHER_SpContainer ); - if(bInline) + nShapeType = bInline ? ESCHER_ShpInst_PictureFrame : ESCHER_ShpInst_HostControl; + const ShapeFlag nFlags = ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor; + nShapeID = rObj.GetShapeId(); + if (nShapeID) { - addShape( ESCHER_ShpInst_PictureFrame, ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor ); + mpEscherEx->AddShape(nShapeType, nFlags, nShapeID ); + rSolverContainer.AddShape(rObj.GetShapeRef(), nShapeID); } else { - addShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor ); + addShape(nShapeType, nFlags); } } else @@ -669,14 +673,14 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, if( SDRLAYER_NOTFOUND != mpEscherEx->GetHellLayerId() && rObj.ImplGetPropertyValue( "LayerID" ) && - *o3tl::doAccess<sal_uInt16>(rObj.GetUsrAny()) == sal_uInt8(mpEscherEx->GetHellLayerId()) ) + *o3tl::doAccess<sal_Int16>(rObj.GetUsrAny()) == mpEscherEx->GetHellLayerId().get() ) { aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 ); } { tools::Rectangle aRect( rObj.GetRect() ); - aRect.Justify(); + aRect.Normalize(); rObj.SetRect( aRect ); } @@ -868,7 +872,7 @@ bool ImplEESdrWriter::ImplInitPage( const SdrPage& rPage ) Reference<css::lang::XComponent> xOldDrawPage(mXDrawPage, UNO_QUERY); if (xOldDrawPage.is()) xOldDrawPage->dispose(); - mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( const_cast<SdrPage*>(&rPage) ); + mXDrawPage = pSvxDrawPage = new SvxDrawPage( const_cast<SdrPage*>(&rPage) ); mXShapes = mXDrawPage; if ( !mXShapes.is() ) return false; @@ -946,9 +950,9 @@ void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes, bool ooxmlExp mpImplEESdrWriter->ImplWriteCurrentPage(ooxmlExport); } -sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj, bool ooxmlExport ) +sal_uInt32 EscherEx::AddSdrObject(const SdrObject& rObj, bool ooxmlExport, sal_uInt32 nId) { - ImplEESdrObject aObj( *mpImplEESdrWriter, rObj, mbOOXML ); + ImplEESdrObject aObj(*mpImplEESdrWriter, rObj, mbOOXML , nId); if( aObj.IsValid() ) return mpImplEESdrWriter->ImplWriteTheShape( aObj, ooxmlExport ); return 0; @@ -995,8 +999,8 @@ const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape ) ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx, - const SdrObject& rObj, bool bOOXML ) : - mnShapeId( 0 ), + const SdrObject& rObj, bool bOOXML, sal_uInt32 nId) : + mnShapeId(nId), mnTextSize( 0 ), mnAngle( 0 ), mbValid( false ), @@ -1086,9 +1090,10 @@ static basegfx::B2DRange getUnrotatedGroupBoundRange(const Reference< XShape >& aHomogenMatrix.set(1, 0, aMatrix.Line2.Column1); aHomogenMatrix.set(1, 1, aMatrix.Line2.Column2); aHomogenMatrix.set(1, 2, aMatrix.Line2.Column3); - aHomogenMatrix.set(2, 0, aMatrix.Line3.Column1); - aHomogenMatrix.set(2, 1, aMatrix.Line3.Column2); - aHomogenMatrix.set(2, 2, aMatrix.Line3.Column3); + // For this to be a valid 2D transform matrix, the last row must be [0,0,1] + assert( aMatrix.Line3.Column1 == 0 ); + assert( aMatrix.Line3.Column2 == 0 ); + assert( aMatrix.Line3.Column3 == 1 ); basegfx::B2DVector aScale, aTranslate; double fRotate, fShearX; @@ -1151,10 +1156,19 @@ void ImplEESdrObject::Init() { // if it's a group, the unrotated range is needed for that group const basegfx::B2DRange aUnrotatedRange(getUnrotatedGroupBoundRange(mXShape)); - const Point aNewP(basegfx::fround(aUnrotatedRange.getMinX()), basegfx::fround(aUnrotatedRange.getMinY())); - const Size aNewS(basegfx::fround(aUnrotatedRange.getWidth()), basegfx::fround(aUnrotatedRange.getHeight())); + if (aUnrotatedRange.isEmpty()) + { + SetRect(tools::Rectangle()); + } + else + { + const Point aNewP(basegfx::fround<tools::Long>(aUnrotatedRange.getMinX()), + basegfx::fround<tools::Long>(aUnrotatedRange.getMinY())); + const Size aNewS(basegfx::fround<tools::Long>(aUnrotatedRange.getWidth()), + basegfx::fround<tools::Long>(aUnrotatedRange.getHeight())); - SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS)); + SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS)); + } } else { |