diff options
Diffstat (limited to 'svx/source/svdraw/svdoashp.cxx')
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 70c9faf7978b..783c5e9b5b58 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -810,8 +810,8 @@ sdr::properties::BaseProperties* SdrObjCustomShape::CreateObjectSpecificProperti return new sdr::properties::CustomShapeProperties(*this); } -SdrObjCustomShape::SdrObjCustomShape() - : SdrTextObj() +SdrObjCustomShape::SdrObjCustomShape(SdrModel& rSdrModel) +: SdrTextObj(rSdrModel) , fObjectRotation(0.0) , mbAdjustingTextFrameWidthAndHeight(false) , mpLastShadowGeometry(nullptr) @@ -1346,23 +1346,16 @@ void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const } } -void SdrObjCustomShape::SetModel(SdrModel* pNewModel) -{ - SdrTextObj::SetModel(pNewModel); - mXRenderedCustomShape.clear(); -} - sal_uInt16 SdrObjCustomShape::GetObjIdentifier() const { return sal_uInt16(OBJ_CUSTOMSHAPE); } - // #115391# This implementation is based on the TextFrame size of the CustomShape and the // state of the ResizeShapeToFitText flag to correctly set TextMinFrameWidth/Height void SdrObjCustomShape::AdaptTextMinSize() { - if (!pModel || (!pModel->IsCreatingDataObj() && !pModel->IsPasteResize())) + if (!getSdrModelFromSdrObject().IsCreatingDataObj() && !getSdrModelFromSdrObject().IsPasteResize()) { const bool bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue()); SfxItemSet aSet( @@ -2232,7 +2225,7 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool { // Either we have text or the application has native text and suggested its size to us. bool bHasText = HasText() || (m_aSuggestedTextFrameSize.Width() != 0 && m_aSuggestedTextFrameSize.Height() != 0); - if ( pModel && bHasText && !rR.IsEmpty() ) + if ( bHasText && !rR.IsEmpty() ) { bool bWdtGrow=bWdt && IsAutoGrowWidth(); bool bHgtGrow=bHgt && IsAutoGrowHeight(); @@ -2243,7 +2236,7 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool long nWdt=0,nMinWdt=0,nMaxWdt=0; Size aSiz(rR.GetSize()); aSiz.AdjustWidth( -1 ); aSiz.AdjustHeight( -1 ); Size aMaxSiz(100000,100000); - Size aTmpSiz(pModel->GetMaxObjSize()); + Size aTmpSiz(getSdrModelFromSdrObject().GetMaxObjSize()); if (aTmpSiz.Width()!=0) aMaxSiz.setWidth(aTmpSiz.Width() ); if (aTmpSiz.Height()!=0) aMaxSiz.setHeight(aTmpSiz.Height() ); if (bWdtGrow) @@ -2499,8 +2492,8 @@ void SdrObjCustomShape::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools Size aAnkSiz(aViewInit.GetSize()); aAnkSiz.AdjustWidth( -1 ); aAnkSiz.AdjustHeight( -1 ); // because GetSize() adds 1 Size aMaxSiz(1000000,1000000); - if (pModel!=nullptr) { - Size aTmpSiz(pModel->GetMaxObjSize()); + { + Size aTmpSiz(getSdrModelFromSdrObject().GetMaxObjSize()); if (aTmpSiz.Width()!=0) aMaxSiz.setWidth(aTmpSiz.Width() ); if (aTmpSiz.Height()!=0) aMaxSiz.setHeight(aTmpSiz.Height() ); } @@ -2646,11 +2639,9 @@ void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& if (pPara) { - bool bHitTest = false; - if( pModel ) - bHitTest = &pModel->GetHitTestOutliner() == &rOutliner; - + bool bHitTest(&getSdrModelFromSdrObject().GetHitTestOutliner() == &rOutliner); const SdrTextObj* pTestObj = rOutliner.GetTextObj(); + if( !pTestObj || !bHitTest || pTestObj != this || pTestObj->GetOutlinerParaObject() != GetOutlinerParaObject() ) { @@ -2746,9 +2737,9 @@ void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject InvalidateRenderGeometry(); } -SdrObjCustomShape* SdrObjCustomShape::Clone() const +SdrObjCustomShape* SdrObjCustomShape::Clone(SdrModel* pTargetModel) const { - return CloneHelper< SdrObjCustomShape >(); + return CloneHelper< SdrObjCustomShape >(pTargetModel); } SdrObjCustomShape& SdrObjCustomShape::operator=(const SdrObjCustomShape& rObj) @@ -2815,9 +2806,9 @@ SdrObject* SdrObjCustomShape::DoConvertToPolyObj(bool bBezier, bool bAddText) co if ( pRenderedCustomShape ) { + // Clone to same SdrModel SdrObject* pCandidate = pRenderedCustomShape->Clone(); DBG_ASSERT(pCandidate, "SdrObjCustomShape::DoConvertToPolyObj: Could not clone SdrObject (!)"); - pCandidate->SetModel(GetModel()); pRetval = pCandidate->DoConvertToPolyObj(bBezier, bAddText); SdrObject::Free( pCandidate ); @@ -2948,7 +2939,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, } // if anchor is used, make position relative to it - if( pModel && pModel->IsWriter() ) + if(getSdrModelFromSdrObject().IsWriter()) { if(GetAnchorPos().X() || GetAnchorPos().Y()) { @@ -3065,7 +3056,7 @@ bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top()); // position may be relative to anchorpos, convert - if( pModel && pModel->IsWriter() ) + if(getSdrModelFromSdrObject().IsWriter()) { if(GetAnchorPos().X() || GetAnchorPos().Y()) { |