summaryrefslogtreecommitdiff
path: root/.gitattributes
blob: f43f23bebdc86a2c0f38ac7c44c6928cfa948817 (plain)
1
2
3
4
5
*.doc binary
*.sdw binary
*.svg binary
*.jcs binary
schema/*/* export-ignore
onchange='this.form.submit();'>mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 12:47:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 14:20:06 +0200
commitbfc298d02ca6275588d5897d97ced9498a3e91aa (patch)
tree45f290e8a753a2e382b940ed7f3c43b2bac959cd /svx
parentee9cb297c583cb5a2e6ed388af31fffc79f282ca (diff)
loplugin:flatten in svx/svdraw
Change-Id: I8379e5ebaee2090d2b4dbd05d55b55000915cd7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100233 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/charthelper.cxx36
-rw-r--r--svx/source/svdraw/clonelist.cxx22
-rw-r--r--svx/source/svdraw/sdrpagewindow.cxx22
-rw-r--r--svx/source/svdraw/svdcrtv.cxx251
-rw-r--r--svx/source/svdraw/svddrgmt.cxx964
-rw-r--r--svx/source/svdraw/svddrgv.cxx164
-rw-r--r--svx/source/svdraw/svdedtv.cxx432
-rw-r--r--svx/source/svdraw/svdedtv1.cxx92
-rw-r--r--svx/source/svdraw/svdedtv2.cxx982
-rw-r--r--svx/source/svdraw/svdedxv.cxx737
-rw-r--r--svx/source/svdraw/svdfmtf.cxx538
-rw-r--r--svx/source/svdraw/svdglev.cxx29
-rw-r--r--svx/source/svdraw/svdglue.cxx28
-rw-r--r--svx/source/svdraw/svdhdl.cxx1071
-rw-r--r--svx/source/svdraw/svdlayer.cxx28
-rw-r--r--svx/source/svdraw/svdmark.cxx204
-rw-r--r--svx/source/svdraw/svdmodel.cxx116
-rw-r--r--svx/source/svdraw/svdmrkv.cxx202
-rw-r--r--svx/source/svdraw/svdoashp.cxx590
-rw-r--r--svx/source/svdraw/svdobj.cxx277
-rw-r--r--svx/source/svdraw/svdocirc.cxx94
-rw-r--r--svx/source/svdraw/svdoedge.cxx141
-rw-r--r--svx/source/svdraw/svdograf.cxx62
-rw-r--r--svx/source/svdraw/svdogrp.cxx134
-rw-r--r--svx/source/svdraw/svdomeas.cxx82
-rw-r--r--svx/source/svdraw/svdomedia.cxx62
-rw-r--r--svx/source/svdraw/svdoole2.cxx620
-rw-r--r--svx/source/svdraw/svdopage.cxx26
-rw-r--r--svx/source/svdraw/svdopath.cxx34
-rw-r--r--svx/source/svdraw/svdorect.cxx30
-rw-r--r--svx/source/svdraw/svdotext.cxx94
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx182
-rw-r--r--svx/source/svdraw/svdotxat.cxx116
-rw-r--r--svx/source/svdraw/svdouno.cxx26
-rw-r--r--svx/source/svdraw/svdoutlinercache.cxx46
-rw-r--r--svx/source/svdraw/svdpage.cxx134
-rw-r--r--svx/source/svdraw/svdpagv.cxx258
-rw-r--r--svx/source/svdraw/svdpdf.cxx168
-rw-r--r--svx/source/svdraw/svdpntv.cxx76
-rw-r--r--svx/source/svdraw/svdpoev.cxx306
-rw-r--r--svx/source/svdraw/svdsnpv.cxx72
-rw-r--r--svx/source/svdraw/svdtext.cxx54
-rw-r--r--svx/source/svdraw/svdundo.cxx156
-rw-r--r--svx/source/svdraw/svdview.cxx36
44 files changed, 4900 insertions, 4894 deletions
diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx
index 0c54a986a142..857eafa6f59c 100644
--- a/svx/source/svdraw/charthelper.cxx
+++ b/svx/source/svdraw/charthelper.cxx
@@ -112,28 +112,28 @@ drawinglayer::primitive2d::Primitive2DContainer ChartHelper::tryToGetChartConten
void ChartHelper::AdaptDefaultsForChart(
const uno::Reference < embed::XEmbeddedObject > & xEmbObj)
{
- if( xEmbObj.is())
- {
- uno::Reference< chart2::XChartDocument > xChartDoc( xEmbObj->getComponent(), uno::UNO_QUERY );
- OSL_ENSURE( xChartDoc.is(), "Trying to set chart property to non-chart OLE" );
- if( !xChartDoc.is())
- return;
+ if( !xEmbObj.is())
+ return;
- try
- {
- if (uno::Reference< beans::XPropertySet > xPageProp = xChartDoc->getPageBackground())
- {
- // set background to transparent (none)
- xPageProp->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_NONE));
- // set no border
- xPageProp->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
- }
- }
- catch( const uno::Exception & )
+ uno::Reference< chart2::XChartDocument > xChartDoc( xEmbObj->getComponent(), uno::UNO_QUERY );
+ OSL_ENSURE( xChartDoc.is(), "Trying to set chart property to non-chart OLE" );
+ if( !xChartDoc.is())
+ return;
+
+ try
+ {
+ if (uno::Reference< beans::XPropertySet > xPageProp = xChartDoc->getPageBackground())
{
- OSL_FAIL( "Exception caught in AdaptDefaultsForChart" );
+ // set background to transparent (none)
+ xPageProp->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_NONE));
+ // set no border
+ xPageProp->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
}
}
+ catch( const uno::Exception & )
+ {
+ OSL_FAIL( "Exception caught in AdaptDefaultsForChart" );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/clonelist.cxx b/svx/source/svdraw/clonelist.cxx
index 22eabf103513..12f395ac1d4b 100644
--- a/svx/source/svdraw/clonelist.cxx
+++ b/svx/source/svdraw/clonelist.cxx
@@ -40,19 +40,19 @@ void CloneList::AddPair(const SdrObject* pOriginal, SdrObject* pClone)
if(bCloneIsGroup && dynamic_cast<const E3dObject* >(pClone) != nullptr && dynamic_cast<const E3dScene* >(pClone) == nullptr)
bCloneIsGroup = false;
- if(bOriginalIsGroup && bCloneIsGroup)
- {
- const SdrObjList* pOriginalList = pOriginal->GetSubList();
- SdrObjList* pCloneList = pClone->GetSubList();
+ if(!(bOriginalIsGroup && bCloneIsGroup))
+ return;
+
+ const SdrObjList* pOriginalList = pOriginal->GetSubList();
+ SdrObjList* pCloneList = pClone->GetSubList();
- if(pOriginalList && pCloneList
- && pOriginalList->GetObjCount() == pCloneList->GetObjCount())
+ if(pOriginalList && pCloneList
+ && pOriginalList->GetObjCount() == pCloneList->GetObjCount())
+ {
+ for(size_t a = 0; a < pOriginalList->GetObjCount(); ++a)
{
- for(size_t a = 0; a < pOriginalList->GetObjCount(); ++a)
- {
- // recursive call
- AddPair(pOriginalList->GetObj(a), pCloneList->GetObj(a));
- }
+ // recursive call
+ AddPair(pOriginalList->GetObj(a), pCloneList->GetObj(a));
}
}
}
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index fb3155c0eb14..823205a22e65 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -127,19 +127,19 @@ SdrPageWindow::~SdrPageWindow()
// #i26631#
ResetObjectContact();
- if (mpImpl->mxControlContainer.is())
- {
- auto & rView = static_cast<SdrPaintView &>(GetPageView().GetView());
+ if (!mpImpl->mxControlContainer.is())
+ return;
- // notify derived views
- FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
- if ( pViewAsFormView )
- pViewAsFormView->RemoveControlContainer(mpImpl->mxControlContainer);
+ auto & rView = static_cast<SdrPaintView &>(GetPageView().GetView());
- // dispose the control container
- uno::Reference< lang::XComponent > xComponent(mpImpl->mxControlContainer, uno::UNO_QUERY);
- xComponent->dispose();
- }
+ // notify derived views
+ FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
+ if ( pViewAsFormView )
+ pViewAsFormView->RemoveControlContainer(mpImpl->mxControlContainer);
+
+ // dispose the control container
+ uno::Reference< lang::XComponent > xComponent(mpImpl->mxControlContainer, uno::UNO_QUERY);
+ xComponent->dispose();
}
SdrPageView& SdrPageWindow::GetPageView() const
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 3f36c0e8c5c0..7cb50a08f685 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -528,45 +528,46 @@ bool SdrCreateView::BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz,
void SdrCreateView::MovCreateObj(const Point& rPnt)
{
- if (pCurrentCreate!=nullptr) {
- Point aPnt(rPnt);
- if (!maDragStat.IsNoSnap())
- {
- aPnt=GetSnapPos(aPnt,pCreatePV);
- }
- if (IsOrtho())
- {
- if (maDragStat.IsOrtho8Possible()) OrthoDistance8(maDragStat.GetPrev(),aPnt,IsBigOrtho());
- else if (maDragStat.IsOrtho4Possible()) OrthoDistance4(maDragStat.GetPrev(),aPnt,IsBigOrtho());
- }
+ if (pCurrentCreate==nullptr)
+ return;
- // If the drag point was limited and Ortho is active, do
- // the small ortho correction (reduction) -> last parameter to FALSE.
- bool bDidLimit(ImpLimitToWorkArea(aPnt));
- if(bDidLimit && IsOrtho())
- {
- if(maDragStat.IsOrtho8Possible())
- OrthoDistance8(maDragStat.GetPrev(), aPnt, false);
- else if(maDragStat.IsOrtho4Possible())
- OrthoDistance4(maDragStat.GetPrev(), aPnt, false);
- }
+ Point aPnt(rPnt);
+ if (!maDragStat.IsNoSnap())
+ {
+ aPnt=GetSnapPos(aPnt,pCreatePV);
+ }
+ if (IsOrtho())
+ {
+ if (maDragStat.IsOrtho8Possible()) OrthoDistance8(maDragStat.GetPrev(),aPnt,IsBigOrtho());
+ else if (maDragStat.IsOrtho4Possible()) OrthoDistance4(maDragStat.GetPrev(),aPnt,IsBigOrtho());
+ }
- if (aPnt==maDragStat.GetNow()) return;
- bool bIsMinMoved(maDragStat.IsMinMoved());
- if (maDragStat.CheckMinMoved(aPnt))
- {
- if (!bIsMinMoved) maDragStat.NextPoint();
- maDragStat.NextMove(aPnt);
- pCurrentCreate->MovCreate(maDragStat);
+ // If the drag point was limited and Ortho is active, do
+ // the small ortho correction (reduction) -> last parameter to FALSE.
+ bool bDidLimit(ImpLimitToWorkArea(aPnt));
+ if(bDidLimit && IsOrtho())
+ {
+ if(maDragStat.IsOrtho8Possible())
+ OrthoDistance8(maDragStat.GetPrev(), aPnt, false);
+ else if(maDragStat.IsOrtho4Possible())
+ OrthoDistance4(maDragStat.GetPrev(), aPnt, false);
+ }
- // MovCreate changes the object, so use ActionChanged() on it
- pCurrentCreate->ActionChanged();
+ if (aPnt==maDragStat.GetNow()) return;
+ bool bIsMinMoved(maDragStat.IsMinMoved());
+ if (!maDragStat.CheckMinMoved(aPnt))
+ return;
- // replace for DrawCreateObjDiff
- HideCreateObj();
- ShowCreateObj();
- }
- }
+ if (!bIsMinMoved) maDragStat.NextPoint();
+ maDragStat.NextMove(aPnt);
+ pCurrentCreate->MovCreate(maDragStat);
+
+ // MovCreate changes the object, so use ActionChanged() on it
+ pCurrentCreate->ActionChanged();
+
+ // replace for DrawCreateObjDiff
+ HideCreateObj();
+ ShowCreateObj();
}
void SdrCreateView::SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj)
@@ -705,24 +706,24 @@ bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
void SdrCreateView::BckCreateObj()
{
- if (pCurrentCreate!=nullptr)
+ if (pCurrentCreate==nullptr)
+ return;
+
+ if (maDragStat.GetPointCount()<=2 )
+ {
+ BrkCreateObj();
+ }
+ else
{
- if (maDragStat.GetPointCount()<=2 )
+ HideCreateObj();
+ maDragStat.PrevPoint();
+ if (pCurrentCreate->BckCreate(maDragStat))
{
- BrkCreateObj();
+ ShowCreateObj();
}
else
{
- HideCreateObj();
- maDragStat.PrevPoint();
- if (pCurrentCreate->BckCreate(maDragStat))
- {
- ShowCreateObj();
- }
- else
- {
- BrkCreateObj();
- }
+ BrkCreateObj();
}
}
}
@@ -741,117 +742,117 @@ void SdrCreateView::BrkCreateObj()
void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/)
{
- if(IsCreateObj() && !maDragStat.IsShown())
+ if(!(IsCreateObj() && !maDragStat.IsShown()))
+ return;
+
+ if(pCurrentCreate)
{
- if(pCurrentCreate)
+ // for migration from XOR, replace DrawDragObj here to create
+ // overlay objects instead.
+ bool bUseSolidDragging(IsSolidDragging());
+
+ // #i101648# check if dragged object is a naked SdrObject (not
+ // a derivation). This is e.g. used in SW Frame construction
+ // as placeholder. Do not use SolidDragging for naked SdrObjects,
+ // they cannot have a valid optical representation
+ if(bUseSolidDragging && OBJ_NONE == pCurrentCreate->GetObjIdentifier())
{
- // for migration from XOR, replace DrawDragObj here to create
- // overlay objects instead.
- bool bUseSolidDragging(IsSolidDragging());
-
- // #i101648# check if dragged object is a naked SdrObject (not
- // a derivation). This is e.g. used in SW Frame construction
- // as placeholder. Do not use SolidDragging for naked SdrObjects,
- // they cannot have a valid optical representation
- if(bUseSolidDragging && OBJ_NONE == pCurrentCreate->GetObjIdentifier())
+ bUseSolidDragging = false;
+ }
+
+ // check for objects with no fill and no line
+ if(bUseSolidDragging)
+ {
+ const SfxItemSet& rSet = pCurrentCreate->GetMergedItemSet();
+ const drawing::FillStyle eFill(rSet.Get(XATTR_FILLSTYLE).GetValue());
+ const drawing::LineStyle eLine(rSet.Get(XATTR_LINESTYLE).GetValue());
+
+ if(drawing::LineStyle_NONE == eLine && drawing::FillStyle_NONE == eFill)
{
bUseSolidDragging = false;
}
+ }
- // check for objects with no fill and no line
- if(bUseSolidDragging)
+ // check for form controls
+ if(bUseSolidDragging)
+ {
+ if(dynamic_cast<const SdrUnoObj*>( pCurrentCreate) != nullptr)
{
- const SfxItemSet& rSet = pCurrentCreate->GetMergedItemSet();
- const drawing::FillStyle eFill(rSet.Get(XATTR_FILLSTYLE).GetValue());
- const drawing::LineStyle eLine(rSet.Get(XATTR_LINESTYLE).GetValue());
-
- if(drawing::LineStyle_NONE == eLine && drawing::FillStyle_NONE == eFill)
- {
- bUseSolidDragging = false;
- }
+ bUseSolidDragging = false;
}
+ }
+
+ // #i101781# force to non-solid dragging when not creating a full circle
+ if(bUseSolidDragging)
+ {
+ SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pCurrentCreate);
- // check for form controls
- if(bUseSolidDragging)
+ if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
{
- if(dynamic_cast<const SdrUnoObj*>( pCurrentCreate) != nullptr)
+ // #i103058# Allow SolidDragging with four points
+ if(maDragStat.GetPointCount() < 4)
{
bUseSolidDragging = false;
}
}
+ }
+
+ if(bUseSolidDragging)
+ {
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
- // #i101781# force to non-solid dragging when not creating a full circle
- if(bUseSolidDragging)
+ if(dynamic_cast<const SdrRectObj*>( pCurrentCreate) != nullptr)
{
- SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pCurrentCreate);
+ // ensure object has some size, necessary for SdrTextObj because
+ // there are still untested divisions by that sizes
+ tools::Rectangle aCurrentSnapRect(pCurrentCreate->GetSnapRect());
- if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
+ if(aCurrentSnapRect.GetWidth() <= 1 || aCurrentSnapRect.GetHeight() <= 1)
{
- // #i103058# Allow SolidDragging with four points
- if(maDragStat.GetPointCount() < 4)
- {
- bUseSolidDragging = false;
- }
+ tools::Rectangle aNewRect(maDragStat.GetStart(), maDragStat.GetStart() + Point(2, 2));
+ pCurrentCreate->NbcSetSnapRect(aNewRect);
}
}
- if(bUseSolidDragging)
+ if(dynamic_cast<const SdrPathObj*>( pCurrentCreate) != nullptr)
{
- basegfx::B2DPolyPolygon aDragPolyPolygon;
+ // The up-to-now created path needs to be set at the object to have something
+ // that can be visualized
+ SdrPathObj& rPathObj(static_cast<SdrPathObj&>(*pCurrentCreate));
+ const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(maDragStat));
- if(dynamic_cast<const SdrRectObj*>( pCurrentCreate) != nullptr)
+ if(aCurrentPolyPolygon.count())
{
- // ensure object has some size, necessary for SdrTextObj because
- // there are still untested divisions by that sizes
- tools::Rectangle aCurrentSnapRect(pCurrentCreate->GetSnapRect());
-
- if(aCurrentSnapRect.GetWidth() <= 1 || aCurrentSnapRect.GetHeight() <= 1)
- {
- tools::Rectangle aNewRect(maDragStat.GetStart(), maDragStat.GetStart() + Point(2, 2));
- pCurrentCreate->NbcSetSnapRect(aNewRect);
- }
+ rPathObj.NbcSetPathPoly(aCurrentPolyPolygon);
}
- if(dynamic_cast<const SdrPathObj*>( pCurrentCreate) != nullptr)
- {
- // The up-to-now created path needs to be set at the object to have something
- // that can be visualized
- SdrPathObj& rPathObj(static_cast<SdrPathObj&>(*pCurrentCreate));
- const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(maDragStat));
-
- if(aCurrentPolyPolygon.count())
- {
- rPathObj.NbcSetPathPoly(aCurrentPolyPolygon);
- }
+ aDragPolyPolygon = rPathObj.getDragPolyPolygon(maDragStat);
+ }
- aDragPolyPolygon = rPathObj.getDragPolyPolygon(maDragStat);
- }
+ // use the SdrObject directly for overlay
+ mpCreateViewExtraData->CreateAndShowOverlay(*this, pCurrentCreate, aDragPolyPolygon);
+ }
+ else
+ {
+ const ::basegfx::B2DPolyPolygon aPoly(pCurrentCreate->TakeCreatePoly(maDragStat));
- // use the SdrObject directly for overlay
- mpCreateViewExtraData->CreateAndShowOverlay(*this, pCurrentCreate, aDragPolyPolygon);
- }
- else
- {
- const ::basegfx::B2DPolyPolygon aPoly(pCurrentCreate->TakeCreatePoly(maDragStat));
+ mpCreateViewExtraData->CreateAndShowOverlay(*this, nullptr, aPoly);
+ }
- mpCreateViewExtraData->CreateAndShowOverlay(*this, nullptr, aPoly);
- }
+ // #i101679# Force changed overlay to be shown
+ for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = GetPaintWindow(a);
+ const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
- // #i101679# Force changed overlay to be shown
- for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
+ if (xOverlayManager.is())
{
- SdrPaintWindow* pCandidate = GetPaintWindow(a);
- const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
-
- if (xOverlayManager.is())
- {
- xOverlayManager->flush();
- }
+ xOverlayManager->flush();
}
}
-
- maDragStat.SetShown(true);
}
+
+ maDragStat.SetShown(true);
}
void SdrCreateView::HideCreateObj()
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 53a1f072ee84..22c70944d2bd 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -295,26 +295,26 @@ void SdrDragMethod::addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew)
void SdrDragMethod::createSdrDragEntries()
{
- if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView())
+ if(!(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView()))
+ return;
+
+ if(getSdrDragView().IsDraggingPoints())
{
- if(getSdrDragView().IsDraggingPoints())
- {
- createSdrDragEntries_PointDrag();
- }
- else if(getSdrDragView().IsDraggingGluePoints())
+ createSdrDragEntries_PointDrag();
+ }
+ else if(getSdrDragView().IsDraggingGluePoints())
+ {
+ createSdrDragEntries_GlueDrag();
+ }
+ else
+ {
+ if(getSolidDraggingActive())
{
- createSdrDragEntries_GlueDrag();
+ createSdrDragEntries_SolidDrag();
}
else
{
- if(getSolidDraggingActive())
- {
- createSdrDragEntries_SolidDrag();
- }
- else
- {
- createSdrDragEntries_PolygonDrag();
- }
+ createSdrDragEntries_PolygonDrag();
}
}
}
@@ -366,51 +366,51 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag()
const size_t nMarkCount(getSdrDragView().GetMarkedObjectCount());
SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- if(pPV)
+ if(!pPV)
+ return;
+
+ for(size_t a = 0; a < nMarkCount; ++a)
{
- for(size_t a = 0; a < nMarkCount; ++a)
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+
+ if(pM->GetPageView() == pPV)
{
- SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+ const SdrObject* pObject = pM->GetMarkedSdrObj();
- if(pM->GetPageView() == pPV)
+ if(pObject)
{
- const SdrObject* pObject = pM->GetMarkedSdrObj();
-
- if(pObject)
+ if(pPV->PageWindowCount())
{
- if(pPV->PageWindowCount())
+ SdrObjListIter aIter(*pObject);
+
+ while(aIter.IsMore())
{
- SdrObjListIter aIter(*pObject);
+ SdrObject* pCandidate = aIter.Next();
- while(aIter.IsMore())
+ if(pCandidate)
{
- SdrObject* pCandidate = aIter.Next();
+ const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
+ bool bAddWireframe(bSuppressFullDrag);
- if(pCandidate)
+ if(!bAddWireframe && !pCandidate->HasLineStyle())
{
- const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
- bool bAddWireframe(bSuppressFullDrag);
-
- if(!bAddWireframe && !pCandidate->HasLineStyle())
- {
- // add wireframe for objects without outline
- bAddWireframe = true;
- }
-
- if(!bSuppressFullDrag)
- {
- // add full object drag; Clone() at the object has to work
- // for this
- createSdrDragEntryForSdrObject(*pCandidate);
- }
-
- if(bAddWireframe)
- {
- // when dragging a 50% transparent copy of a filled or not filled object without
- // outline, this is normally hard to see. Add extra wireframe in that case. This
- // works nice e.g. with text frames etc.
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly())));
- }
+ // add wireframe for objects without outline
+ bAddWireframe = true;
+ }
+
+ if(!bSuppressFullDrag)
+ {
+ // add full object drag; Clone() at the object has to work
+ // for this
+ createSdrDragEntryForSdrObject(*pCandidate);
+ }
+
+ if(bAddWireframe)
+ {
+ // when dragging a 50% transparent copy of a filled or not filled object without
+ // outline, this is normally hard to see. Add extra wireframe in that case. This
+ // works nice e.g. with text frames etc.
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly())));
}
}
}
@@ -809,25 +809,25 @@ void SdrDragMethod::CreateOverlayGeometry(
}
// add DragStripes if necessary (help lines cross the page when dragging)
- if(getSdrDragView().IsDragStripes())
- {
- tools::Rectangle aActionRectangle;
- getSdrDragView().TakeActionRect(aActionRectangle);
+ if(!getSdrDragView().IsDragStripes())
+ return;
- const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
- const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
- std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(
- new sdr::overlay::OverlayRollingRectangleStriped(
- aTopLeft,
- aBottomRight,
- true,
- false));
+ tools::Rectangle aActionRectangle;
+ getSdrDragView().TakeActionRect(aActionRectangle);
- insertNewlyCreatedOverlayObjectForSdrDragMethod(
- std::move(pNew),
- rObjectContact,
- rOverlayManager);
- }
+ const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
+ const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
+ std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(
+ new sdr::overlay::OverlayRollingRectangleStriped(
+ aTopLeft,
+ aBottomRight,
+ true,
+ false));
+
+ insertNewlyCreatedOverlayObjectForSdrDragMethod(
+ std::move(pNew),
+ rObjectContact,
+ rOverlayManager);
}
void SdrDragMethod::destroyOverlayGeometry()
@@ -998,111 +998,111 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
{
Point aPnt(rNoSnapPnt);
- if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
+ if ( !(GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt)))
+ return;
+
+ if (GetDragHdl()->GetKind()==SdrHdlKind::MirrorAxis)
{
- if (GetDragHdl()->GetKind()==SdrHdlKind::MirrorAxis)
- {
- SdrHdl* pH1=GetHdlList().GetHdl(SdrHdlKind::Ref1);
- SdrHdl* pH2=GetHdlList().GetHdl(SdrHdlKind::Ref2);
+ SdrHdl* pH1=GetHdlList().GetHdl(SdrHdlKind::Ref1);
+ SdrHdl* pH2=GetHdlList().GetHdl(SdrHdlKind::Ref2);
- if (pH1==nullptr || pH2==nullptr)
- return;
+ if (pH1==nullptr || pH2==nullptr)
+ return;
- if (!DragStat().IsNoSnap())
- {
- long nBestXSnap=0;
- long nBestYSnap=0;
- bool bXSnapped=false;
- bool bYSnapped=false;
- Point aDif(aPnt-DragStat().GetStart());
- getSdrDragView().CheckSnap(Ref1()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
- getSdrDragView().CheckSnap(Ref2()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
- aPnt.AdjustX(nBestXSnap );
- aPnt.AdjustY(nBestYSnap );
- }
+ if (!DragStat().IsNoSnap())
+ {
+ long nBestXSnap=0;
+ long nBestYSnap=0;
+ bool bXSnapped=false;
+ bool bYSnapped=false;
+ Point aDif(aPnt-DragStat().GetStart());
+ getSdrDragView().CheckSnap(Ref1()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ getSdrDragView().CheckSnap(Ref2()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ aPnt.AdjustX(nBestXSnap );
+ aPnt.AdjustY(nBestYSnap );
+ }
- if (aPnt!=DragStat().GetNow())
- {
- Hide();
- DragStat().NextMove(aPnt);
- Point aDif(DragStat().GetNow()-DragStat().GetStart());
- pH1->SetPos(Ref1()+aDif);
- pH2->SetPos(Ref2()+aDif);
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ Point aDif(DragStat().GetNow()-DragStat().GetStart());
+ pH1->SetPos(Ref1()+aDif);
+ pH2->SetPos(Ref2()+aDif);
- SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
+ SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
- if(pHM)
- pHM->Touch();
+ if(pHM)
+ pHM->Touch();
- Show();
- DragStat().SetActionRect(tools::Rectangle(pH1->GetPos(),pH2->GetPos()));
- }
+ Show();
+ DragStat().SetActionRect(tools::Rectangle(pH1->GetPos(),pH2->GetPos()));
}
- else
- {
- if (!DragStat().IsNoSnap()) SnapPos(aPnt);
- long nSA=0;
+ }
+ else
+ {
+ if (!DragStat().IsNoSnap()) SnapPos(aPnt);
+ long nSA=0;
- if (getSdrDragView().IsAngleSnapEnabled())
- nSA=getSdrDragView().GetSnapAngle();
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
- if (getSdrDragView().IsMirrorAllowed(true,true))
- { // limited
- if (!getSdrDragView().IsMirrorAllowed()) nSA=4500;
- if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000;
- }
+ if (getSdrDragView().IsMirrorAllowed(true,true))
+ { // limited
+ if (!getSdrDragView().IsMirrorAllowed()) nSA=4500;
+ if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000;
+ }
- if (getSdrDragView().IsOrtho() && nSA!=9000)
- nSA=4500;
+ if (getSdrDragView().IsOrtho() && nSA!=9000)
+ nSA=4500;
- if (nSA!=0)
- { // angle snapping
- SdrHdlKind eRef=SdrHdlKind::Ref1;
+ if (nSA!=0)
+ { // angle snapping
+ SdrHdlKind eRef=SdrHdlKind::Ref1;
- if (GetDragHdl()->GetKind()==SdrHdlKind::Ref1)
- eRef=SdrHdlKind::Ref2;
+ if (GetDragHdl()->GetKind()==SdrHdlKind::Ref1)
+ eRef=SdrHdlKind::Ref2;
- SdrHdl* pH=GetHdlList().GetHdl(eRef);
+ SdrHdl* pH=GetHdlList().GetHdl(eRef);
- if (pH!=nullptr)
+ if (pH!=nullptr)
+ {
+ Point aRef(pH->GetPos());
+ long nAngle=NormAngle36000(GetAngle(aPnt-aRef));
+ long nNewAngle=nAngle;
+ nNewAngle+=nSA/2;
+ nNewAngle/=nSA;
+ nNewAngle*=nSA;
+ nNewAngle=NormAngle36000(nNewAngle);
+ double a=(nNewAngle-nAngle)*F_PI18000;
+ double nSin=sin(a);
+ double nCos=cos(a);
+ RotatePoint(aPnt,aRef,nSin,nCos);
+
+ // eliminate rounding errors for certain values
+ if (nSA==9000)
{
- Point aRef(pH->GetPos());
- long nAngle=NormAngle36000(GetAngle(aPnt-aRef));
- long nNewAngle=nAngle;
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
- nNewAngle=NormAngle36000(nNewAngle);
- double a=(nNewAngle-nAngle)*F_PI18000;
- double nSin=sin(a);
- double nCos=cos(a);
- RotatePoint(aPnt,aRef,nSin,nCos);
-
- // eliminate rounding errors for certain values
- if (nSA==9000)
- {
- if (nNewAngle==0 || nNewAngle==18000) aPnt.setY(aRef.Y() );
- if (nNewAngle==9000 || nNewAngle==27000) aPnt.setX(aRef.X() );
- }
-
- if (nSA==4500)
- OrthoDistance8(aRef,aPnt,true);
+ if (nNewAngle==0 || nNewAngle==18000) aPnt.setY(aRef.Y() );
+ if (nNewAngle==9000 || nNewAngle==27000) aPnt.setX(aRef.X() );
}
+
+ if (nSA==4500)
+ OrthoDistance8(aRef,aPnt,true);
}
+ }
- if (aPnt!=DragStat().GetNow())
- {
- Hide();
- DragStat().NextMove(aPnt);
- GetDragHdl()->SetPos(DragStat().GetNow());
- SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ GetDragHdl()->SetPos(DragStat().GetNow());
+ SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
- if(pHM)
- pHM->Touch();
+ if(pHM)
+ pHM->Touch();
- Show();
- DragStat().SetActionRect(tools::Rectangle(aPnt,aPnt));
- }
+ Show();
+ DragStat().SetActionRect(tools::Rectangle(aPnt,aPnt));
}
}
}
@@ -1178,52 +1178,52 @@ SdrDragObjOwn::~SdrDragObjOwn()
void SdrDragObjOwn::createSdrDragEntries()
{
- if(mxClone)
+ if(!mxClone)
+ return;
+
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
+ bool bAddWireframe(true);
+
+ if(getSolidDraggingActive())
{
- basegfx::B2DPolyPolygon aDragPolyPolygon;
- bool bAddWireframe(true);
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- if(getSolidDraggingActive())
+ if(pPV && pPV->PageWindowCount())
{
- SdrPageView* pPV = getSdrDragView().GetSdrPageView();
-
- if(pPV && pPV->PageWindowCount())
- {
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(*mxClone, false)));
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(*mxClone, false)));
- // potentially no wireframe needed, full drag works
- bAddWireframe = false;
- }
+ // potentially no wireframe needed, full drag works
+ bAddWireframe = false;
}
+ }
- if(!bAddWireframe)
+ if(!bAddWireframe)
+ {
+ // check for extra conditions for wireframe, e.g. no border at
+ // objects
+ if(!mxClone->HasLineStyle())
{
- // check for extra conditions for wireframe, e.g. no border at
- // objects
- if(!mxClone->HasLineStyle())
- {
- bAddWireframe = true;
- }
+ bAddWireframe = true;
}
+ }
- if(bAddWireframe)
- {
- // use wireframe poly when full drag is off or did not work
- aDragPolyPolygon = mxClone->TakeXorPoly();
- }
+ if(bAddWireframe)
+ {
+ // use wireframe poly when full drag is off or did not work
+ aDragPolyPolygon = mxClone->TakeXorPoly();
+ }
- // add evtl. extra DragPolyPolygon
- const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mxClone->getSpecialDragPoly(DragStat()));
+ // add evtl. extra DragPolyPolygon
+ const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mxClone->getSpecialDragPoly(DragStat()));
- if(aSpecialDragPolyPolygon.count())
- {
- aDragPolyPolygon.append(aSpecialDragPolyPolygon);
- }
+ if(aSpecialDragPolyPolygon.count())
+ {
+ aDragPolyPolygon.append(aSpecialDragPolyPolygon);
+ }
- if(aDragPolyPolygon.count())
- {
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragPolyPolygon)));
- }
+ if(aDragPolyPolygon.count())
+ {
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragPolyPolygon)));
}
}
@@ -1525,21 +1525,21 @@ void SdrDragMove::ImpCheckSnap(const Point& rPt)
}
}
- if (nRet & SdrSnap::YSNAPPED)
+ if (!(nRet & SdrSnap::YSNAPPED))
+ return;
+
+ if (bYSnapped)
{
- if (bYSnapped)
- {
- if (std::abs(aPt.Y())<std::abs(nBestYSnap))
- {
- nBestYSnap=aPt.Y();
- }
- }
- else
+ if (std::abs(aPt.Y())<std::abs(nBestYSnap))
{
nBestYSnap=aPt.Y();
- bYSnapped=true;
}
}
+ else
+ {
+ nBestYSnap=aPt.Y();
+ bYSnapped=true;
+ }
}
void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
@@ -1571,110 +1571,110 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
if (bOrtho)
OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
- if (DragStat().CheckMinMoved(aNoSnapPnt))
+ if (!DragStat().CheckMinMoved(aNoSnapPnt))
+ return;
+
+ Point aPt1(aPnt);
+ tools::Rectangle aLR(getSdrDragView().GetWorkArea());
+ bool bWorkArea=!aLR.IsEmpty();
+ bool bDragLimit=IsDragLimit();
+
+ if (bDragLimit || bWorkArea)
{
- Point aPt1(aPnt);
- tools::Rectangle aLR(getSdrDragView().GetWorkArea());
- bool bWorkArea=!aLR.IsEmpty();
- bool bDragLimit=IsDragLimit();
+ tools::Rectangle aSR2(GetMarkedRect());
+ Point aD(aPt1-DragStat().GetStart());
- if (bDragLimit || bWorkArea)
+ if (bDragLimit)
{
- tools::Rectangle aSR2(GetMarkedRect());
- Point aD(aPt1-DragStat().GetStart());
-
- if (bDragLimit)
- {
- tools::Rectangle aR2(GetDragLimitRect());
+ tools::Rectangle aR2(GetDragLimitRect());
- if (bWorkArea)
- aLR.Intersection(aR2);
- else
- aLR=aR2;
- }
+ if (bWorkArea)
+ aLR.Intersection(aR2);
+ else
+ aLR=aR2;
+ }
- if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
- { // any space to move to?
- aSR2.Move(aD.X(),0);
+ if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
+ { // any space to move to?
+ aSR2.Move(aD.X(),0);
- if (aSR2.Left()<aLR.Left())
- {
- aPt1.AdjustX( -(aSR2.Left()-aLR.Left()) );
- }
- else if (aSR2.Right()>aLR.Right())
- {
- aPt1.AdjustX( -(aSR2.Right()-aLR.Right()) );
- }
+ if (aSR2.Left()<aLR.Left())
+ {
+ aPt1.AdjustX( -(aSR2.Left()-aLR.Left()) );
}
- else
- aPt1.setX(DragStat().GetStart().X() ); // no space to move to
+ else if (aSR2.Right()>aLR.Right())
+ {
+ aPt1.AdjustX( -(aSR2.Right()-aLR.Right()) );
+ }
+ }
+ else
+ aPt1.setX(DragStat().GetStart().X() ); // no space to move to
- if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
- { // any space to move to?
- aSR2.Move(0,aD.Y());
+ if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
+ { // any space to move to?
+ aSR2.Move(0,aD.Y());
- if (aSR2.Top()<aLR.Top())
- {
- aPt1.AdjustY( -(aSR2.Top()-aLR.Top()) );
- }
- else if (aSR2.Bottom()>aLR.Bottom())
- {
- aPt1.AdjustY( -(aSR2.Bottom()-aLR.Bottom()) );
- }
+ if (aSR2.Top()<aLR.Top())
+ {
+ aPt1.AdjustY( -(aSR2.Top()-aLR.Top()) );
+ }
+ else if (aSR2.Bottom()>aLR.Bottom())
+ {
+ aPt1.AdjustY( -(aSR2.Bottom()-aLR.Bottom()) );
}
- else
- aPt1.setY(DragStat().GetStart().Y() ); // no space to move to
}
+ else
+ aPt1.setY(DragStat().GetStart().Y() ); // no space to move to
+ }
+
+ if (getSdrDragView().IsDraggingGluePoints())
+ { // restrict glue points to the BoundRect of the Obj
+ aPt1-=DragStat().GetStart();
+ const SdrMarkList& rML=GetMarkedObjectList();
+ const size_t nMarkCount=rML.GetMarkCount();
- if (getSdrDragView().IsDraggingGluePoints())
- { // restrict glue points to the BoundRect of the Obj
- aPt1-=DragStat().GetStart();
- const SdrMarkList& rML=GetMarkedObjectList();
- const size_t nMarkCount=rML.GetMarkCount();
+ for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
+ {
+ const SdrMark* pM=rML.GetMark(nMarkNum);
+ const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
- for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
+ if (!rPts.empty())
{
- const SdrMark* pM=rML.GetMark(nMarkNum);
- const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ tools::Rectangle aBound(pObj->GetCurrentBoundRect());
- if (!rPts.empty())
+ for (sal_uInt16 nId : rPts)
{
- const SdrObject* pObj=pM->GetMarkedSdrObj();
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
- tools::Rectangle aBound(pObj->GetCurrentBoundRect());
+ sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
- for (sal_uInt16 nId : rPts)
+ if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
{
- sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
-
- if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
- {
- Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
- aPt+=aPt1; // move by this much
- if (aPt.X()<aBound.Left() ) aPt1.AdjustX( -(aPt.X()-aBound.Left()) ) ;
- if (aPt.X()>aBound.Right() ) aPt1.AdjustX( -(aPt.X()-aBound.Right()) ) ;
- if (aPt.Y()<aBound.Top() ) aPt1.AdjustY( -(aPt.Y()-aBound.Top()) ) ;
- if (aPt.Y()>aBound.Bottom()) aPt1.AdjustY( -(aPt.Y()-aBound.Bottom()) );
- }
+ Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
+ aPt+=aPt1; // move by this much
+ if (aPt.X()<aBound.Left() ) aPt1.AdjustX( -(aPt.X()-aBound.Left()) ) ;
+ if (aPt.X()>aBound.Right() ) aPt1.AdjustX( -(aPt.X()-aBound.Right()) ) ;
+ if (aPt.Y()<aBound.Top() ) aPt1.AdjustY( -(aPt.Y()-aBound.Top()) ) ;
+ if (aPt.Y()>aBound.Bottom()) aPt1.AdjustY( -(aPt.Y()-aBound.Bottom()) );
}
}
}
-
- aPt1+=DragStat().GetStart();
}
- if (bOrtho)
- OrthoDistance8(DragStat().GetStart(),aPt1,false);
+ aPt1+=DragStat().GetStart();
+ }
- if (aPt1!=DragStat().GetNow())
- {
- Hide();
- DragStat().NextMove(aPt1);
- tools::Rectangle aAction(GetMarkedRect());
- aAction.Move(DragStat().GetDX(),DragStat().GetDY());
- DragStat().SetActionRect(aAction);
- Show();
- }
+ if (bOrtho)
+ OrthoDistance8(DragStat().GetStart(),aPt1,false);
+
+ if (aPt1!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPt1);
+ tools::Rectangle aAction(GetMarkedRect());
+ aAction.Move(DragStat().GetDX(),DragStat().GetDY());
+ DragStat().SetActionRect(aAction);
+ Show();
}
}
@@ -2114,48 +2114,48 @@ basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation()
void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
{
Point aPnt(rPnt_);
- if (DragStat().CheckMinMoved(aPnt))
- {
- long nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
- long nSA=0;
+ if (!DragStat().CheckMinMoved(aPnt))
+ return;
- if (getSdrDragView().IsAngleSnapEnabled())
- nSA=getSdrDragView().GetSnapAngle();
+ long nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
+ long nSA=0;
- if (!getSdrDragView().IsRotateAllowed())
- nSA=9000;
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
- if (nSA!=0)
- { // angle snapping
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
- }
+ if (!getSdrDragView().IsRotateAllowed())
+ nSA=9000;
- nNewAngle=NormAngle18000(nNewAngle);
+ if (nSA!=0)
+ { // angle snapping
+ nNewAngle+=nSA/2;
+ nNewAngle/=nSA;
+ nNewAngle*=nSA;
+ }
- if (nAngle!=nNewAngle)
- {
- sal_uInt16 nSekt0=GetAngleSector(nAngle);
- sal_uInt16 nSekt1=GetAngleSector(nNewAngle);
+ nNewAngle=NormAngle18000(nNewAngle);
- if (nSekt0==0 && nSekt1==3)
- bRight=true;
+ if (nAngle==nNewAngle)
+ return;
- if (nSekt0==3 && nSekt1==0)
- bRight=false;
+ sal_uInt16 nSekt0=GetAngleSector(nAngle);
+ sal_uInt16 nSekt1=GetAngleSector(nNewAngle);
- nAngle=nNewAngle;
- double a = nAngle * F_PI18000;
- double nSin1=sin(a); // calculate now, so as little time as possible
- double nCos1=cos(a); // passes between Hide() and Show()
- Hide();
- nSin=nSin1;
- nCos=nCos1;
- DragStat().NextMove(aPnt);
- Show();
- }
- }
+ if (nSekt0==0 && nSekt1==3)
+ bRight=true;
+
+ if (nSekt0==3 && nSekt1==0)
+ bRight=false;
+
+ nAngle=nNewAngle;
+ double a = nAngle * F_PI18000;
+ double nSin1=sin(a); // calculate now, so as little time as possible
+ double nCos1=cos(a); // passes between Hide() and Show()
+ Hide();
+ nSin=nSin1;
+ nCos=nCos1;
+ DragStat().NextMove(aPnt);
+ Show();
}
bool SdrDragRotate::EndSdrDrag(bool bCopy)
@@ -2559,18 +2559,18 @@ basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation()
void SdrDragMirror::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
- {
- bool bNewSide=ImpCheckSide(rPnt);
- bool bNewMirrored=bSide0!=bNewSide;
+ if (!DragStat().CheckMinMoved(rPnt))
+ return;
- if (bMirrored!=bNewMirrored)
- {
- Hide();
- bMirrored=bNewMirrored;
- DragStat().NextMove(rPnt);
- Show();
- }
+ bool bNewSide=ImpCheckSide(rPnt);
+ bool bNewMirrored=bSide0!=bNewSide;
+
+ if (bMirrored!=bNewMirrored)
+ {
+ Hide();
+ bMirrored=bNewMirrored;
+ DragStat().NextMove(rPnt);
+ Show();
}
}
@@ -2678,43 +2678,43 @@ bool SdrDragGradient::BeginSdrDrag()
void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
{
- if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
- {
- DragStat().NextMove(rPnt);
+ if(!(pIAOHandle && DragStat().CheckMinMoved(rPnt)))
+ return;
+
+ DragStat().NextMove(rPnt);
- // Do the Move here!!! DragStat().GetStart()
- Point aMoveDiff = rPnt - DragStat().GetStart();
+ // Do the Move here!!! DragStat().GetStart()
+ Point aMoveDiff = rPnt - DragStat().GetStart();
- if(pIAOHandle->IsMoveSingleHandle())
+ if(pIAOHandle->IsMoveSingleHandle())
+ {
+ if(pIAOHandle->IsMoveFirstHandle())
{
- if(pIAOHandle->IsMoveFirstHandle())
- {
- pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
- if(pIAOHandle->GetColorHdl1())
- pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
- }
- else
- {
- pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
- if(pIAOHandle->GetColorHdl2())
- pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
- }
+ pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
}
else
{
- pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
-
- if(pIAOHandle->GetColorHdl1())
- pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
-
if(pIAOHandle->GetColorHdl2())
pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
}
+ }
+ else
+ {
+ pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
+ pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
+
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
- // new state
- pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
+ if(pIAOHandle->GetColorHdl2())
+ pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
}
+
+ // new state
+ pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
}
bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/)
@@ -2918,117 +2918,117 @@ void SdrDragCrook::MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- if(pPV)
+ if(!pPV)
+ return;
+
+ XPolyPolygon aTempPolyPoly(rTarget);
+
+ if (pPV->HasMarkedObjPageView())
{
- XPolyPolygon aTempPolyPoly(rTarget);
+ sal_uInt16 nPolyCount=aTempPolyPoly.Count();
- if (pPV->HasMarkedObjPageView())
+ if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
{
- sal_uInt16 nPolyCount=aTempPolyPoly.Count();
+ sal_uInt16 n1st=0,nLast=0;
+ Point aC(aCenter);
- if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
+ while (n1st<nPolyCount)
{
- sal_uInt16 n1st=0,nLast=0;
- Point aC(aCenter);
+ nLast=n1st;
+ while (nLast<nPolyCount && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
+ tools::Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
+ sal_uInt16 i;
- while (n1st<nPolyCount)
+ for (i=n1st+1; i<nLast; i++)
{
- nLast=n1st;
- while (nLast<nPolyCount && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
- tools::Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
- sal_uInt16 i;
+ aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
+ }
- for (i=n1st+1; i<nLast; i++)
- {
- aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
- }
+ Point aCtr0(aBound.Center());
+ Point aCtr1(aCtr0);
- Point aCtr0(aBound.Center());
- Point aCtr1(aCtr0);
+ if (bResize)
+ {
+ Fraction aFact1(1,1);
- if (bResize)
+ if (bVertical)
{
- Fraction aFact1(1,1);
-
- if (bVertical)
- {
- ResizePoint(aCtr1,aC,aFact1,aFact);
- }
- else
- {
- ResizePoint(aCtr1,aC,aFact,aFact1);
- }
+ ResizePoint(aCtr1,aC,aFact1,aFact);
}
-
- bool bRotOk=false;
- double nSin=0,nCos=0;
-
- if (aRad.X()!=0 && aRad.Y()!=0)
+ else
{
- bRotOk=bRotate;
-
- switch (eMode)
- {
- case SdrCrookMode::Rotate : CrookRotateXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
- case SdrCrookMode::Slant : CrookSlantXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
- case SdrCrookMode::Stretch: CrookStretchXPoint(aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
- } // switch
+ ResizePoint(aCtr1,aC,aFact,aFact1);
}
+ }
- aCtr1-=aCtr0;
+ bool bRotOk=false;
+ double nSin=0,nCos=0;
- for (i=n1st; i<nLast; i++)
+ if (aRad.X()!=0 && aRad.Y()!=0)
+ {
+ bRotOk=bRotate;
+
+ switch (eMode)
{
- if (bRotOk)
- {
- RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
- }
+ case SdrCrookMode::Rotate : CrookRotateXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
+ case SdrCrookMode::Slant : CrookSlantXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
+ case SdrCrookMode::Stretch: CrookStretchXPoint(aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
+ } // switch
+ }
+
+ aCtr1-=aCtr0;
- aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
+ for (i=n1st; i<nLast; i++)
+ {
+ if (bRotOk)
+ {
+ RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
}
- n1st=nLast+1;
+ aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
}
+
+ n1st=nLast+1;
}
- else
+ }
+ else
+ {
+ sal_uInt16 i,j;
+
+ for (j=0; j<nPolyCount; j++)
{
- sal_uInt16 i,j;
+ XPolygon& aPol=aTempPolyPoly[j];
+ sal_uInt16 nPointCount=aPol.GetPointCount();
+ i=0;
- for (j=0; j<nPolyCount; j++)
+ while (i<nPointCount)
{
- XPolygon& aPol=aTempPolyPoly[j];
- sal_uInt16 nPointCount=aPol.GetPointCount();
- i=0;
-
- while (i<nPointCount)
- {
- Point* pPnt=&aPol[i];
- Point* pC1=nullptr;
- Point* pC2=nullptr;
-
- if (i+1<nPointCount && aPol.IsControl(i))
- { // control point on the left
- pC1=pPnt;
- i++;
- pPnt=&aPol[i];
- }
+ Point* pPnt=&aPol[i];
+ Point* pC1=nullptr;
+ Point* pC2=nullptr;
+ if (i+1<nPointCount && aPol.IsControl(i))
+ { // control point on the left
+ pC1=pPnt;
i++;
+ pPnt=&aPol[i];
+ }
- if (i<nPointCount && aPol.IsControl(i))
- { // control point on the right
- pC2=&aPol[i];
- i++;
- }
+ i++;
- MovCrookPoint(*pPnt,pC1,pC2);
+ if (i<nPointCount && aPol.IsControl(i))
+ { // control point on the right
+ pC2=&aPol[i];
+ i++;
}
+
+ MovCrookPoint(*pPnt,pC1,pC2);
}
}
}
-
- rTarget = aTempPolyPoly.getB2DPolyPolygon();
}
+
+ rTarget = aTempPolyPoly.getB2DPolyPolygon();
}
void SdrDragCrook::MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
@@ -3245,50 +3245,50 @@ void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
const bool bDoResize(aFact!=Fraction(1,1));
const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
- if (bDoCrook || bDoResize)
+ if (!(bDoCrook || bDoResize))
+ return;
+
+ if (bDoResize)
{
- if (bDoResize)
- {
- Fraction aFact1(1,1);
+ Fraction aFact1(1,1);
- if (bContortion)
+ if (bContortion)
+ {
+ if (bVertical)
{
- if (bVertical)
- {
- rTarget.Resize(aCenter,aFact1,aFact);
- }
- else
- {
- rTarget.Resize(aCenter,aFact,aFact1);
- }
+ rTarget.Resize(aCenter,aFact1,aFact);
}
else
{
- Point aCtr0(rTarget.GetSnapRect().Center());
- Point aCtr1(aCtr0);
+ rTarget.Resize(aCenter,aFact,aFact1);
+ }
+ }
+ else
+ {
+ Point aCtr0(rTarget.GetSnapRect().Center());
+ Point aCtr1(aCtr0);
- if (bVertical)
- {
- ResizePoint(aCtr1,aCenter,aFact1,aFact);
- }
- else
- {
- ResizePoint(aCtr1,aCenter,aFact,aFact1);
- }
+ if (bVertical)
+ {
+ ResizePoint(aCtr1,aCenter,aFact1,aFact);
+ }
+ else
+ {
+ ResizePoint(aCtr1,aCenter,aFact,aFact1);
+ }
- Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
+ Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
- rTarget.Move(aSiz);
- }
+ rTarget.Move(aSiz);
}
+ }
- if (bDoCrook)
- {
- const tools::Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
- const bool bLocalRotate(!bContortion && eMode == SdrCrookMode::Rotate && getSdrDragView().IsRotateAllowed());
+ if (bDoCrook)
+ {
+ const tools::Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
+ const bool bLocalRotate(!bContortion && eMode == SdrCrookMode::Rotate && getSdrDragView().IsRotateAllowed());
- SdrEditView::ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
- }
+ SdrEditView::ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
}
}
@@ -3450,44 +3450,44 @@ bool SdrDragDistort::BeginSdrDrag()
void SdrDragDistort::MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
- if (bContortion)
- {
- SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+ if (!bContortion)
+ return;
- if(pPV && pPV->HasMarkedObjPageView())
- {
- basegfx::B2DPolyPolygon aDragPolygon(rTarget);
- const basegfx::B2DRange aOriginalRange = vcl::unotools::b2DRectangleFromRectangle(aMarkRect);
- const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
- const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
- const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
- const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
- rTarget = aDragPolygon;
- }
+ if(pPV && pPV->HasMarkedObjPageView())
+ {
+ basegfx::B2DPolyPolygon aDragPolygon(rTarget);
+ const basegfx::B2DRange aOriginalRange = vcl::unotools::b2DRectangleFromRectangle(aMarkRect);
+ const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
+ const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
+ const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
+ const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
+
+ aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
+ rTarget = aDragPolygon;
}
}
void SdrDragDistort::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
- {
- Point aPnt(GetSnapPos(rPnt));
+ if (!DragStat().CheckMinMoved(rPnt))
+ return;
- if (getSdrDragView().IsOrtho())
- OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+ Point aPnt(GetSnapPos(rPnt));
- bool bNewContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
+ if (getSdrDragView().IsOrtho())
+ OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
- if (bNewContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
- {
- Hide();
- aDistortedRect[nPolyPt]=aPnt;
- bContortion=bNewContortion;
- DragStat().NextMove(aPnt);
- Show();
- }
+ bool bNewContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
+
+ if (bNewContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
+ {
+ Hide();
+ aDistortedRect[nPolyPt]=aPnt;
+ bContortion=bNewContortion;
+ DragStat().NextMove(aPnt);
+ Show();
}
}
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 7002f9447d0d..0be9b5786cb7 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -513,25 +513,25 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
void SdrDragView::MovDragObj(const Point& rPnt)
{
- if (mpCurrentSdrDragMethod)
+ if (!mpCurrentSdrDragMethod)
+ return;
+
+ Point aPnt(rPnt);
+ basegfx::B2DVector aGridOffset(0.0, 0.0);
+
+ // Coordinate maybe affected by GridOffset, so we may need to
+ // adapt to Model-coordinates here
+ if(getPossibleGridOffsetForPosition(
+ aGridOffset,
+ basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
+ GetSdrPageView()))
{
- Point aPnt(rPnt);
- basegfx::B2DVector aGridOffset(0.0, 0.0);
-
- // Coordinate maybe affected by GridOffset, so we may need to
- // adapt to Model-coordinates here
- if(getPossibleGridOffsetForPosition(
- aGridOffset,
- basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
- GetSdrPageView()))
- {
- aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
- aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
- }
-
- ImpLimitToWorkArea(aPnt);
- mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
+ aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
+ aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
}
+
+ ImpLimitToWorkArea(aPnt);
+ mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
}
bool SdrDragView::EndDragObj(bool bCopy)
@@ -607,32 +607,32 @@ bool SdrDragView::EndDragObj(bool bCopy)
void SdrDragView::BrkDragObj()
{
- if (mpCurrentSdrDragMethod)
- {
- mpCurrentSdrDragMethod->CancelSdrDrag();
+ if (!mpCurrentSdrDragMethod)
+ return;
- mpCurrentSdrDragMethod.reset();
+ mpCurrentSdrDragMethod->CancelSdrDrag();
- if (mbInsPolyPoint)
- {
- mpInsPointUndo->Undo(); // delete inserted point again
- delete mpInsPointUndo;
- mpInsPointUndo=nullptr;
- SetMarkHandles(nullptr);
- mbInsPolyPoint=false;
- }
+ mpCurrentSdrDragMethod.reset();
- if (IsInsertGluePoint())
- {
- mpInsPointUndo->Undo(); // delete inserted glue point again
- delete mpInsPointUndo;
- mpInsPointUndo=nullptr;
- SetInsertGluePoint(false);
- }
+ if (mbInsPolyPoint)
+ {
+ mpInsPointUndo->Undo(); // delete inserted point again
+ delete mpInsPointUndo;
+ mpInsPointUndo=nullptr;
+ SetMarkHandles(nullptr);
+ mbInsPolyPoint=false;
+ }
- meDragHdl=SdrHdlKind::Move;
- mpDragHdl=nullptr;
+ if (IsInsertGluePoint())
+ {
+ mpInsPointUndo->Undo(); // delete inserted glue point again
+ delete mpInsPointUndo;
+ mpInsPointUndo=nullptr;
+ SetInsertGluePoint(false);
}
+
+ meDragHdl=SdrHdlKind::Move;
+ mpDragHdl=nullptr;
}
bool SdrDragView::IsInsObjPointPossible() const
@@ -799,42 +799,42 @@ bool SdrDragView::BegInsGluePoint(const Point& rPnt)
void SdrDragView::ShowDragObj()
{
- if(mpCurrentSdrDragMethod && !maDragStat.IsShown())
+ if(!(mpCurrentSdrDragMethod && !maDragStat.IsShown()))
+ return;
+
+ // Changed for the GridOffset stuff: No longer iterate over
+ // SdrPaintWindow(s), but now over SdrPageWindow(s), so doing the
+ // same as the SdrHdl visualizations (see ::CreateB2dIAObject) do.
+ // This is needed to get access to an ObjectContact which is needed
+ // to evtl. process that GridOffset in CreateOverlayGeometry
+ SdrPageView* pPageView(GetSdrPageView());
+
+ if(nullptr != pPageView)
{
- // Changed for the GridOffset stuff: No longer iterate over
- // SdrPaintWindow(s), but now over SdrPageWindow(s), so doing the
- // same as the SdrHdl visualizations (see ::CreateB2dIAObject) do.
- // This is needed to get access to an ObjectContact which is needed
- // to evtl. process that GridOffset in CreateOverlayGeometry
- SdrPageView* pPageView(GetSdrPageView());
-
- if(nullptr != pPageView)
+ for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
{
- for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
+ const SdrPageWindow& rPageWindow(*pPageView->GetPageWindow(a));
+ const SdrPaintWindow& rPaintWindow(rPageWindow.GetPaintWindow());
+
+ if(rPaintWindow.OutputToWindow())
{
- const SdrPageWindow& rPageWindow(*pPageView->GetPageWindow(a));
- const SdrPaintWindow& rPaintWindow(rPageWindow.GetPaintWindow());
+ const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager(
+ rPaintWindow.GetOverlayManager());
- if(rPaintWindow.OutputToWindow())
+ if(xOverlayManager.is())
{
- const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager(
- rPaintWindow.GetOverlayManager());
-
- if(xOverlayManager.is())
- {
- mpCurrentSdrDragMethod->CreateOverlayGeometry(
- *xOverlayManager,
- rPageWindow.GetObjectContact());
+ mpCurrentSdrDragMethod->CreateOverlayGeometry(
+ *xOverlayManager,
+ rPageWindow.GetObjectContact());
- // #i101679# Force changed overlay to be shown
- xOverlayManager->flush();
- }
+ // #i101679# Force changed overlay to be shown
+ xOverlayManager->flush();
}
}
}
-
- maDragStat.SetShown(true);
}
+
+ maDragStat.SetShown(true);
}
void SdrDragView::HideDragObj()
@@ -849,28 +849,28 @@ void SdrDragView::HideDragObj()
void SdrDragView::SetNoDragXorPolys(bool bOn)
{
- if (IsNoDragXorPolys()!=bOn)
- {
- const bool bDragging(mpCurrentSdrDragMethod);
- const bool bShown(bDragging && maDragStat.IsShown());
+ if (IsNoDragXorPolys()==bOn)
+ return;
- if(bShown)
- {
- HideDragObj();
- }
+ const bool bDragging(mpCurrentSdrDragMethod);
+ const bool bShown(bDragging && maDragStat.IsShown());
- mbNoDragXorPolys = bOn;
+ if(bShown)
+ {
+ HideDragObj();
+ }
- if(bDragging)
- {
- // force recreation of drag content
- mpCurrentSdrDragMethod->resetSdrDragEntries();
- }
+ mbNoDragXorPolys = bOn;
- if(bShown)
- {
- ShowDragObj();
- }
+ if(bDragging)
+ {
+ // force recreation of drag content
+ mpCurrentSdrDragMethod->resetSdrDragEntries();
+ }
+
+ if(bShown)
+ {
+ ShowDragObj();
}
}
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 2e63c58d32b4..34b7c58c25b3 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -192,83 +192,83 @@ void SdrEditView::DeleteLayer(const OUString& rName)
SdrLayerAdmin& rLA = mpModel->GetLayerAdmin();
SdrLayer* pLayer = rLA.GetLayer(rName);
- if(pLayer)
- {
- sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer));
- SdrLayerID nDelID = pLayer->GetID();
+ if(!pLayer)
+ return;
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo(SvxResId(STR_UndoDelLayer));
+ sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer));
+ SdrLayerID nDelID = pLayer->GetID();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(SvxResId(STR_UndoDelLayer));
+
+ bool bMaPg(true);
- bool bMaPg(true);
+ for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++)
+ {
+ // MasterPages and DrawPages
+ sal_uInt16 nPgCount(bMaPg ? mpModel->GetMasterPageCount() : mpModel->GetPageCount());
- for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++)
+ for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++)
{
- // MasterPages and DrawPages
- sal_uInt16 nPgCount(bMaPg ? mpModel->GetMasterPageCount() : mpModel->GetPageCount());
+ // over all pages
+ SdrPage* pPage = bMaPg ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum);
+ const size_t nObjCount(pPage->GetObjCount());
- for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++)
- {
- // over all pages
- SdrPage* pPage = bMaPg ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum);
- const size_t nObjCount(pPage->GetObjCount());
+ // make sure OrdNums are correct
+ if(nObjCount)
+ pPage->GetObj(0)->GetOrdNum();
- // make sure OrdNums are correct
- if(nObjCount)
- pPage->GetObj(0)->GetOrdNum();
+ for(size_t nObjNum(nObjCount); nObjNum > 0;)
+ {
+ nObjNum--;
+ SdrObject* pObj = pPage->GetObj(nObjNum);
+ SdrObjList* pSubOL = pObj->GetSubList();
- for(size_t nObjNum(nObjCount); nObjNum > 0;)
+ // explicitly test for group objects and 3d scenes
+ if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr || dynamic_cast<const E3dScene* >(pObj) != nullptr))
{
- nObjNum--;
- SdrObject* pObj = pPage->GetObj(nObjNum);
- SdrObjList* pSubOL = pObj->GetSubList();
-
- // explicitly test for group objects and 3d scenes
- if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr || dynamic_cast<const E3dScene* >(pObj) != nullptr))
+ if(ImpDelLayerCheck(pSubOL, nDelID))
{
- if(ImpDelLayerCheck(pSubOL, nDelID))
- {
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
- pPage->RemoveObject(nObjNum);
- if( !bUndo )
- SdrObject::Free(pObj);
- }
- else
- {
- ImpDelLayerDelObjs(pSubOL, nDelID);
- }
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pPage->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free(pObj);
}
else
{
- if(pObj->GetLayer() == nDelID)
- {
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
- pPage->RemoveObject(nObjNum);
- if( !bUndo )
- SdrObject::Free(pObj);
- }
+ ImpDelLayerDelObjs(pSubOL, nDelID);
+ }
+ }
+ else
+ {
+ if(pObj->GetLayer() == nDelID)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pPage->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free(pObj);
}
}
}
- bMaPg = false;
- }
-
- if( bUndo )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *mpModel));
- rLA.RemoveLayer(nLayerNum).release();
- EndUndo();
- }
- else
- {
- rLA.RemoveLayer(nLayerNum);
}
+ bMaPg = false;
+ }
- mpModel->SetChanged();
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *mpModel));
+ rLA.RemoveLayer(nLayerNum).release();
+ EndUndo();
+ }
+ else
+ {
+ rLA.RemoveLayer(nLayerNum);
}
+
+ mpModel->SetChanged();
}
@@ -464,189 +464,189 @@ void SdrEditView::CheckPossibilities()
CheckMarked();
}
- if (m_bPossibilitiesDirty)
+ if (!m_bPossibilitiesDirty)
+ return;
+
+ ImpResetPossibilityFlags();
+ SortMarkedObjects();
+ const size_t nMarkCount = GetMarkedObjectCount();
+ if (nMarkCount != 0)
{
- ImpResetPossibilityFlags();
- SortMarkedObjects();
- const size_t nMarkCount = GetMarkedObjectCount();
- if (nMarkCount != 0)
- {
- m_bReverseOrderPossible = (nMarkCount >= 2);
+ m_bReverseOrderPossible = (nMarkCount >= 2);
- size_t nMovableCount=0;
- m_bGroupPossible=nMarkCount>=2;
- m_bCombinePossible=nMarkCount>=2;
- if (nMarkCount==1)
- {
- // check bCombinePossible more thoroughly
- // still missing ...
- const SdrObject* pObj=GetMarkedObjectByIndex(0);
- //const SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pObj );
- bool bGroup=pObj->GetSubList()!=nullptr;
- bool bHasText=pObj->GetOutlinerParaObject()!=nullptr;
- if (bGroup || bHasText) {
- m_bCombinePossible=true;
- }
+ size_t nMovableCount=0;
+ m_bGroupPossible=nMarkCount>=2;
+ m_bCombinePossible=nMarkCount>=2;
+ if (nMarkCount==1)
+ {
+ // check bCombinePossible more thoroughly
+ // still missing ...
+ const SdrObject* pObj=GetMarkedObjectByIndex(0);
+ //const SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pObj );
+ bool bGroup=pObj->GetSubList()!=nullptr;
+ bool bHasText=pObj->GetOutlinerParaObject()!=nullptr;
+ if (bGroup || bHasText) {
+ m_bCombinePossible=true;
}
- m_bCombineNoPolyPolyPossible=m_bCombinePossible;
- // accept transformations for now
- m_bMoveAllowed =true;
- m_bResizeFreeAllowed=true;
- m_bResizePropAllowed=true;
- m_bRotateFreeAllowed=true;
- m_bRotate90Allowed =true;
- m_bMirrorFreeAllowed=true;
- m_bMirror45Allowed =true;
- m_bMirror90Allowed =true;
- m_bShearAllowed =true;
- m_bEdgeRadiusAllowed=false;
- m_bContortionPossible=true;
- m_bCanConvToContour = true;
-
- // these ones are only allowed when single object is selected
- m_bTransparenceAllowed = (nMarkCount == 1);
- m_bGradientAllowed = (nMarkCount == 1);
- m_bCropAllowed = (nMarkCount == 1);
- if(m_bGradientAllowed)
- {
- // gradient depends on fill style
- const SdrMark* pM = GetSdrMarkByIndex(0);
- const SdrObject* pObj = pM->GetMarkedSdrObj();
+ }
+ m_bCombineNoPolyPolyPossible=m_bCombinePossible;
+ // accept transformations for now
+ m_bMoveAllowed =true;
+ m_bResizeFreeAllowed=true;
+ m_bResizePropAllowed=true;
+ m_bRotateFreeAllowed=true;
+ m_bRotate90Allowed =true;
+ m_bMirrorFreeAllowed=true;
+ m_bMirror45Allowed =true;
+ m_bMirror90Allowed =true;
+ m_bShearAllowed =true;
+ m_bEdgeRadiusAllowed=false;
+ m_bContortionPossible=true;
+ m_bCanConvToContour = true;
+
+ // these ones are only allowed when single object is selected
+ m_bTransparenceAllowed = (nMarkCount == 1);
+ m_bGradientAllowed = (nMarkCount == 1);
+ m_bCropAllowed = (nMarkCount == 1);
+ if(m_bGradientAllowed)
+ {
+ // gradient depends on fill style
+ const SdrMark* pM = GetSdrMarkByIndex(0);
+ const SdrObject* pObj = pM->GetMarkedSdrObj();
- // may be group object, so get merged ItemSet
- const SfxItemSet& rSet = pObj->GetMergedItemSet();
- SfxItemState eState = rSet.GetItemState(XATTR_FILLSTYLE, false);
+ // may be group object, so get merged ItemSet
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxItemState eState = rSet.GetItemState(XATTR_FILLSTYLE, false);
- if(SfxItemState::DONTCARE != eState)
- {
- // If state is not DONTCARE, test the item
- drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
+ if(SfxItemState::DONTCARE != eState)
+ {
+ // If state is not DONTCARE, test the item
+ drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
- if(eFillStyle != drawing::FillStyle_GRADIENT)
- {
- m_bGradientAllowed = false;
- }
+ if(eFillStyle != drawing::FillStyle_GRADIENT)
+ {
+ m_bGradientAllowed = false;
}
}
+ }
- bool bNoMovRotFound=false;
- const SdrPageView* pPV0=nullptr;
+ bool bNoMovRotFound=false;
+ const SdrPageView* pPV0=nullptr;
- for (size_t nm=0; nm<nMarkCount; ++nm) {
- const SdrMark* pM=GetSdrMarkByIndex(nm);
- const SdrObject* pObj=pM->GetMarkedSdrObj();
- const SdrPageView* pPV=pM->GetPageView();
- if (pPV!=pPV0) {
- if (pPV->IsReadOnly()) m_bReadOnly=true;
- pPV0=pPV;
- }
+ for (size_t nm=0; nm<nMarkCount; ++nm) {
+ const SdrMark* pM=GetSdrMarkByIndex(nm);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrPageView* pPV=pM->GetPageView();
+ if (pPV!=pPV0) {
+ if (pPV->IsReadOnly()) m_bReadOnly=true;
+ pPV0=pPV;
+ }
- SdrObjTransformInfoRec aInfo;
- pObj->TakeObjInfo(aInfo);
- bool bMovPrt=pObj->IsMoveProtect();
- bool bSizPrt=pObj->IsResizeProtect();
- if (!bMovPrt && aInfo.bMoveAllowed) nMovableCount++; // count MovableObjs
- if (bMovPrt) m_bMoveProtect=true;
- if (bSizPrt) m_bResizeProtect=true;
-
- // not allowed when not allowed at one object
- if(!aInfo.bTransparenceAllowed)
- m_bTransparenceAllowed = false;
-
- // If one of these can't do something, none can
- if (!aInfo.bMoveAllowed ) m_bMoveAllowed =false;
- if (!aInfo.bResizeFreeAllowed) m_bResizeFreeAllowed=false;
- if (!aInfo.bResizePropAllowed) m_bResizePropAllowed=false;
- if (!aInfo.bRotateFreeAllowed) m_bRotateFreeAllowed=false;
- if (!aInfo.bRotate90Allowed ) m_bRotate90Allowed =false;
- if (!aInfo.bMirrorFreeAllowed) m_bMirrorFreeAllowed=false;
- if (!aInfo.bMirror45Allowed ) m_bMirror45Allowed =false;
- if (!aInfo.bMirror90Allowed ) m_bMirror90Allowed =false;
- if (!aInfo.bShearAllowed ) m_bShearAllowed =false;
- if (aInfo.bEdgeRadiusAllowed) m_bEdgeRadiusAllowed=true;
- if (aInfo.bNoContortion ) m_bContortionPossible=false;
- // For Crook with Contortion: all objects have to be
- // Movable and Rotatable, except for a maximum of 1 of them
- if (!m_bMoreThanOneNoMovRot) {
- if (!aInfo.bMoveAllowed || !aInfo.bResizeFreeAllowed) {
- m_bMoreThanOneNoMovRot=bNoMovRotFound;
- bNoMovRotFound=true;
- }
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ bool bMovPrt=pObj->IsMoveProtect();
+ bool bSizPrt=pObj->IsResizeProtect();
+ if (!bMovPrt && aInfo.bMoveAllowed) nMovableCount++; // count MovableObjs
+ if (bMovPrt) m_bMoveProtect=true;
+ if (bSizPrt) m_bResizeProtect=true;
+
+ // not allowed when not allowed at one object
+ if(!aInfo.bTransparenceAllowed)
+ m_bTransparenceAllowed = false;
+
+ // If one of these can't do something, none can
+ if (!aInfo.bMoveAllowed ) m_bMoveAllowed =false;
+ if (!aInfo.bResizeFreeAllowed) m_bResizeFreeAllowed=false;
+ if (!aInfo.bResizePropAllowed) m_bResizePropAllowed=false;
+ if (!aInfo.bRotateFreeAllowed) m_bRotateFreeAllowed=false;
+ if (!aInfo.bRotate90Allowed ) m_bRotate90Allowed =false;
+ if (!aInfo.bMirrorFreeAllowed) m_bMirrorFreeAllowed=false;
+ if (!aInfo.bMirror45Allowed ) m_bMirror45Allowed =false;
+ if (!aInfo.bMirror90Allowed ) m_bMirror90Allowed =false;
+ if (!aInfo.bShearAllowed ) m_bShearAllowed =false;
+ if (aInfo.bEdgeRadiusAllowed) m_bEdgeRadiusAllowed=true;
+ if (aInfo.bNoContortion ) m_bContortionPossible=false;
+ // For Crook with Contortion: all objects have to be
+ // Movable and Rotatable, except for a maximum of 1 of them
+ if (!m_bMoreThanOneNoMovRot) {
+ if (!aInfo.bMoveAllowed || !aInfo.bResizeFreeAllowed) {
+ m_bMoreThanOneNoMovRot=bNoMovRotFound;
+ bNoMovRotFound=true;
}
+ }
- // Must be resizable to allow cropping
- if (!aInfo.bResizeFreeAllowed && !aInfo.bResizePropAllowed)
- m_bCropAllowed = false;
+ // Must be resizable to allow cropping
+ if (!aInfo.bResizeFreeAllowed && !aInfo.bResizePropAllowed)
+ m_bCropAllowed = false;
- // if one member cannot be converted, no conversion is possible
- if(!aInfo.bCanConvToContour)
- m_bCanConvToContour = false;
+ // if one member cannot be converted, no conversion is possible
+ if(!aInfo.bCanConvToContour)
+ m_bCanConvToContour = false;
- // Ungroup
- if (!m_bUnGroupPossible) m_bUnGroupPossible=pObj->GetSubList()!=nullptr;
- // ConvertToCurve: If at least one can be converted, that is fine.
- if (aInfo.bCanConvToPath ) m_bCanConvToPath =true;
- if (aInfo.bCanConvToPoly ) m_bCanConvToPoly =true;
+ // Ungroup
+ if (!m_bUnGroupPossible) m_bUnGroupPossible=pObj->GetSubList()!=nullptr;
+ // ConvertToCurve: If at least one can be converted, that is fine.
+ if (aInfo.bCanConvToPath ) m_bCanConvToPath =true;
+ if (aInfo.bCanConvToPoly ) m_bCanConvToPoly =true;
- // Combine/Dismantle
- if(m_bCombinePossible)
- {
- m_bCombinePossible = ImpCanConvertForCombine(pObj);
- m_bCombineNoPolyPolyPossible = m_bCombinePossible;
- }
+ // Combine/Dismantle
+ if(m_bCombinePossible)
+ {
+ m_bCombinePossible = ImpCanConvertForCombine(pObj);
+ m_bCombineNoPolyPolyPossible = m_bCombinePossible;
+ }
- if (!m_bDismantlePossible) m_bDismantlePossible = ImpCanDismantle(pObj, false);
- if (!m_bDismantleMakeLinesPossible) m_bDismantleMakeLinesPossible = ImpCanDismantle(pObj, true);
- // check OrthoDesiredOnMarked
- if (!m_bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) m_bOrthoDesiredOnMarked=true;
- // check ImportMtf
+ if (!m_bDismantlePossible) m_bDismantlePossible = ImpCanDismantle(pObj, false);
+ if (!m_bDismantleMakeLinesPossible) m_bDismantleMakeLinesPossible = ImpCanDismantle(pObj, true);
+ // check OrthoDesiredOnMarked
+ if (!m_bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) m_bOrthoDesiredOnMarked=true;
+ // check ImportMtf
- if (!m_bImportMtfPossible)
+ if (!m_bImportMtfPossible)
+ {
+ const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
+ if (pSdrGrafObj != nullptr)
{
- const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
- if (pSdrGrafObj != nullptr)
- {
- if ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) ||
- pSdrGrafObj->isEmbeddedVectorGraphicData())
- {
- m_bImportMtfPossible = true;
- }
- }
-
- const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
- if (pSdrOle2Obj)
+ if ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) ||
+ pSdrGrafObj->isEmbeddedVectorGraphicData())
{
- m_bImportMtfPossible = pSdrOle2Obj->GetObjRef().is();
+ m_bImportMtfPossible = true;
}
}
- }
- m_bOneOrMoreMovable=nMovableCount!=0;
- m_bGrpEnterPossible=m_bUnGroupPossible;
- }
- ImpCheckToTopBtmPossible();
- static_cast<SdrPolyEditView*>(this)->ImpCheckPolyPossibilities();
- m_bPossibilitiesDirty=false;
-
- if (m_bReadOnly) {
- bool bTemp=m_bGrpEnterPossible;
- ImpResetPossibilityFlags();
- m_bReadOnly=true;
- m_bGrpEnterPossible=bTemp;
- }
- if (m_bMoveAllowed) {
- // Don't allow moving glued connectors.
- // Currently only implemented for single selection.
- if (nMarkCount==1) {
- SdrObject* pObj=GetMarkedObjectByIndex(0);
- SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
- if (pEdge!=nullptr) {
- SdrObject* pNode1=pEdge->GetConnectedNode(true);
- SdrObject* pNode2=pEdge->GetConnectedNode(false);
- if (pNode1!=nullptr || pNode2!=nullptr) m_bMoveAllowed=false;
+ const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
+ if (pSdrOle2Obj)
+ {
+ m_bImportMtfPossible = pSdrOle2Obj->GetObjRef().is();
}
}
}
+
+ m_bOneOrMoreMovable=nMovableCount!=0;
+ m_bGrpEnterPossible=m_bUnGroupPossible;
+ }
+ ImpCheckToTopBtmPossible();
+ static_cast<SdrPolyEditView*>(this)->ImpCheckPolyPossibilities();
+ m_bPossibilitiesDirty=false;
+
+ if (m_bReadOnly) {
+ bool bTemp=m_bGrpEnterPossible;
+ ImpResetPossibilityFlags();
+ m_bReadOnly=true;
+ m_bGrpEnterPossible=bTemp;
+ }
+ if (!m_bMoveAllowed) return;
+
+ // Don't allow moving glued connectors.
+ // Currently only implemented for single selection.
+ if (nMarkCount==1) {
+ SdrObject* pObj=GetMarkedObjectByIndex(0);
+ SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
+ if (pEdge!=nullptr) {
+ SdrObject* pNode1=pEdge->GetConnectedNode(true);
+ SdrObject* pNode2=pEdge->GetConnectedNode(false);
+ if (pNode1!=nullptr || pNode2!=nullptr) m_bMoveAllowed=false;
+ }
}
}
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 439dba1a6ebb..17311eb5ab6c 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -547,34 +547,34 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa
bDone = true;
}
- if(!bDone)
+ if(bDone)
+ return;
+
+ // for all others or if bNoContortion
+ Point aCtr0(pO->GetSnapRect().Center());
+ Point aCtr1(aCtr0);
+ bool bRotOk(false);
+ double nSin(0.0), nCos(1.0);
+ double nAngle(0.0);
+
+ if(0 != rRad.X() && 0 != rRad.Y())
{
- // for all others or if bNoContortion
- Point aCtr0(pO->GetSnapRect().Center());
- Point aCtr1(aCtr0);
- bool bRotOk(false);
- double nSin(0.0), nCos(1.0);
- double nAngle(0.0);
-
- if(0 != rRad.X() && 0 != rRad.Y())
- {
- bRotOk = bRotate;
+ bRotOk = bRotate;
- switch (eMode)
- {
- case SdrCrookMode::Rotate : nAngle=CrookRotateXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
- case SdrCrookMode::Slant : nAngle=CrookSlantXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); break;
- case SdrCrookMode::Stretch: nAngle=CrookStretchXPoint(aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
- }
+ switch (eMode)
+ {
+ case SdrCrookMode::Rotate : nAngle=CrookRotateXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
+ case SdrCrookMode::Slant : nAngle=CrookSlantXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); break;
+ case SdrCrookMode::Stretch: nAngle=CrookStretchXPoint(aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
}
+ }
- aCtr1 -= aCtr0;
+ aCtr1 -= aCtr0;
- if(bRotOk)
- pO->Rotate(aCtr0, FRound(nAngle / F_PI18000), nSin, nCos);
+ if(bRotOk)
+ pO->Rotate(aCtr0, FRound(nAngle / F_PI18000), nSin, nCos);
- pO->Move(Size(aCtr1.X(),aCtr1.Y()));
- }
+ pO->Move(Size(aCtr1.X(),aCtr1.Y()));
}
void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode,
@@ -1279,36 +1279,36 @@ SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const
void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
{
- if (AreObjectsMarked())
+ if (!AreObjectsMarked())
+ return;
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
{
- const bool bUndo = IsUndoEnabled();
+ EndTextEditAllViews();
+ OUString aStr;
+ if (pStyleSheet!=nullptr)
+ aStr = ImpGetDescriptionString(STR_EditSetStylesheet);
+ else
+ aStr = ImpGetDescriptionString(STR_EditDelStylesheet);
+ BegUndo(aStr);
+ }
+ const size_t nMarkCount=GetMarkedObjectCount();
+ for (size_t nm=0; nm<nMarkCount; ++nm)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
if( bUndo )
{
- EndTextEditAllViews();
- OUString aStr;
- if (pStyleSheet!=nullptr)
- aStr = ImpGetDescriptionString(STR_EditSetStylesheet);
- else
- aStr = ImpGetDescriptionString(STR_EditDelStylesheet);
- BegUndo(aStr);
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
}
-
- const size_t nMarkCount=GetMarkedObjectCount();
- for (size_t nm=0; nm<nMarkCount; ++nm)
- {
- SdrMark* pM=GetSdrMarkByIndex(nm);
- if( bUndo )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
- }
- pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
- }
-
- if( bUndo )
- EndUndo();
+ pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
}
+
+ if( bUndo )
+ EndUndo();
}
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index de8c521b3119..92bfe93fed56 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -70,178 +70,178 @@ void SdrEditView::ObjOrderChanged(SdrObject* /*pObj*/, size_t /*nOldPos*/, size_
void SdrEditView::MovMarkedToTop()
{
const size_t nCount=GetMarkedObjectCount();
- if (nCount!=0)
- {
- const bool bUndo = IsUndoEnabled();
+ if (nCount==0)
+ return;
- if( bUndo )
- BegUndo(SvxResId(STR_EditMovToTop),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToTop);
+ const bool bUndo = IsUndoEnabled();
- SortMarkedObjects();
- for (size_t nm=0; nm<nCount; ++nm)
- { // All Ordnums have to be correct!
- GetMarkedObjectByIndex(nm)->GetOrdNum();
+ if( bUndo )
+ BegUndo(SvxResId(STR_EditMovToTop),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToTop);
+
+ SortMarkedObjects();
+ for (size_t nm=0; nm<nCount; ++nm)
+ { // All Ordnums have to be correct!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+ bool bChg=false;
+ SdrObjList* pOL0=nullptr;
+ size_t nNewPos=0;
+ for (size_t nm=nCount; nm>0;)
+ {
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
+ if (pOL!=pOL0)
+ {
+ nNewPos = pOL->GetObjCount()-1;
+ pOL0=pOL;
}
- bool bChg=false;
- SdrObjList* pOL0=nullptr;
- size_t nNewPos=0;
- for (size_t nm=nCount; nm>0;)
+ const size_t nNowPos = pObj->GetOrdNumDirect();
+ const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
+ size_t nCmpPos = nNowPos+1;
+ SdrObject* pMaxObj=GetMaxToTopObj(pObj);
+ if (pMaxObj!=nullptr)
{
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
- if (pOL!=pOL0)
+ size_t nMaxPos=pMaxObj->GetOrdNum();
+ if (nMaxPos!=0)
+ nMaxPos--;
+ if (nNewPos>nMaxPos)
+ nNewPos=nMaxPos; // neither go faster...
+ if (nNewPos<nNowPos)
+ nNewPos=nNowPos; // nor go in the other direction
+ }
+ bool bEnd=false;
+ while (nCmpPos<nNewPos && !bEnd)
+ {
+ SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
+ if (pCmpObj==nullptr)
{
- nNewPos = pOL->GetObjCount()-1;
- pOL0=pOL;
+ OSL_FAIL("MovMarkedToTop(): Reference object not found.");
+ bEnd=true;
}
- const size_t nNowPos = pObj->GetOrdNumDirect();
- const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
- size_t nCmpPos = nNowPos+1;
- SdrObject* pMaxObj=GetMaxToTopObj(pObj);
- if (pMaxObj!=nullptr)
+ else if (pCmpObj==pMaxObj)
{
- size_t nMaxPos=pMaxObj->GetOrdNum();
- if (nMaxPos!=0)
- nMaxPos--;
- if (nNewPos>nMaxPos)
- nNewPos=nMaxPos; // neither go faster...
- if (nNewPos<nNowPos)
- nNewPos=nNowPos; // nor go in the other direction
+ nNewPos=nCmpPos;
+ nNewPos--;
+ bEnd=true;
}
- bool bEnd=false;
- while (nCmpPos<nNewPos && !bEnd)
+ else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
{
- SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
- if (pCmpObj==nullptr)
- {
- OSL_FAIL("MovMarkedToTop(): Reference object not found.");
- bEnd=true;
- }
- else if (pCmpObj==pMaxObj)
- {
- nNewPos=nCmpPos;
- nNewPos--;
- bEnd=true;
- }
- else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
- {
- nNewPos=nCmpPos;
- bEnd=true;
- }
- else
- {
- nCmpPos++;
- }
+ nNewPos=nCmpPos;
+ bEnd=true;
}
- if (nNowPos!=nNewPos)
+ else
{
- bChg=true;
- pOL->SetObjectOrdNum(nNowPos,nNewPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
- ObjOrderChanged(pObj,nNowPos,nNewPos);
+ nCmpPos++;
}
- nNewPos--;
}
+ if (nNowPos!=nNewPos)
+ {
+ bChg=true;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos--;
+ }
- if( bUndo )
- EndUndo();
+ if( bUndo )
+ EndUndo();
- if (bChg)
- MarkListHasChanged();
- }
+ if (bChg)
+ MarkListHasChanged();
}
void SdrEditView::MovMarkedToBtm()
{
const size_t nCount=GetMarkedObjectCount();
- if (nCount!=0)
- {
- const bool bUndo = IsUndoEnabled();
+ if (nCount==0)
+ return;
- if( bUndo )
- BegUndo(SvxResId(STR_EditMovToBtm),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToBottom);
+ const bool bUndo = IsUndoEnabled();
- SortMarkedObjects();
- for (size_t nm=0; nm<nCount; ++nm)
- { // All Ordnums have to be correct!
- GetMarkedObjectByIndex(nm)->GetOrdNum();
- }
+ if( bUndo )
+ BegUndo(SvxResId(STR_EditMovToBtm),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToBottom);
- bool bChg=false;
- SdrObjList* pOL0=nullptr;
- size_t nNewPos=0;
- for (size_t nm=0; nm<nCount; ++nm)
+ SortMarkedObjects();
+ for (size_t nm=0; nm<nCount; ++nm)
+ { // All Ordnums have to be correct!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+
+ bool bChg=false;
+ SdrObjList* pOL0=nullptr;
+ size_t nNewPos=0;
+ for (size_t nm=0; nm<nCount; ++nm)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
+ if (pOL!=pOL0)
{
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
- if (pOL!=pOL0)
+ nNewPos=0;
+ pOL0=pOL;
+ }
+ const size_t nNowPos = pObj->GetOrdNumDirect();
+ const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
+ size_t nCmpPos = nNowPos;
+ if (nCmpPos>0)
+ --nCmpPos;
+ SdrObject* pMaxObj=GetMaxToBtmObj(pObj);
+ if (pMaxObj!=nullptr)
+ {
+ const size_t nMinPos=pMaxObj->GetOrdNum()+1;
+ if (nNewPos<nMinPos)
+ nNewPos=nMinPos; // neither go faster...
+ if (nNewPos>nNowPos)
+ nNewPos=nNowPos; // nor go in the other direction
+ }
+ bool bEnd=false;
+ // nNewPos in this case is the "maximum" position
+ // the object may reach without going faster than the object before
+ // it (multiple selection).
+ while (nCmpPos>nNewPos && !bEnd)
+ {
+ SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
+ if (pCmpObj==nullptr)
{
- nNewPos=0;
- pOL0=pOL;
+ OSL_FAIL("MovMarkedToBtm(): Reference object not found.");
+ bEnd=true;
}
- const size_t nNowPos = pObj->GetOrdNumDirect();
- const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
- size_t nCmpPos = nNowPos;
- if (nCmpPos>0)
- --nCmpPos;
- SdrObject* pMaxObj=GetMaxToBtmObj(pObj);
- if (pMaxObj!=nullptr)
+ else if (pCmpObj==pMaxObj)
{
- const size_t nMinPos=pMaxObj->GetOrdNum()+1;
- if (nNewPos<nMinPos)
- nNewPos=nMinPos; // neither go faster...
- if (nNewPos>nNowPos)
- nNewPos=nNowPos; // nor go in the other direction
+ nNewPos=nCmpPos;
+ nNewPos++;
+ bEnd=true;
}
- bool bEnd=false;
- // nNewPos in this case is the "maximum" position
- // the object may reach without going faster than the object before
- // it (multiple selection).
- while (nCmpPos>nNewPos && !bEnd)
+ else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
{
- SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
- if (pCmpObj==nullptr)
- {
- OSL_FAIL("MovMarkedToBtm(): Reference object not found.");
- bEnd=true;
- }
- else if (pCmpObj==pMaxObj)
- {
- nNewPos=nCmpPos;
- nNewPos++;
- bEnd=true;
- }
- else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
- {
- nNewPos=nCmpPos;
- bEnd=true;
- }
- else
- {
- nCmpPos--;
- }
+ nNewPos=nCmpPos;
+ bEnd=true;
}
- if (nNowPos!=nNewPos)
+ else
{
- bChg=true;
- pOL->SetObjectOrdNum(nNowPos,nNewPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
- ObjOrderChanged(pObj,nNowPos,nNewPos);
+ nCmpPos--;
}
- nNewPos++;
}
+ if (nNowPos!=nNewPos)
+ {
+ bChg=true;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos++;
+ }
- if(bUndo)
- EndUndo();
+ if(bUndo)
+ EndUndo();
- if(bChg)
- MarkListHasChanged();
- }
+ if(bChg)
+ MarkListHasChanged();
}
void SdrEditView::PutMarkedToTop()
@@ -434,52 +434,52 @@ void SdrEditView::ReverseOrderOfMarked()
{
SortMarkedObjects();
const size_t nMarkCount=GetMarkedObjectCount();
- if (nMarkCount>0)
- {
- bool bChg=false;
+ if (nMarkCount<=0)
+ return;
- bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo(SvxResId(STR_EditRevOrder),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ReverseOrder);
-
- size_t a=0;
- do {
- // take into account selection across multiple PageViews
- size_t b=a+1;
- while (b<nMarkCount && GetSdrPageViewOfMarkedByIndex(b) == GetSdrPageViewOfMarkedByIndex(a)) ++b;
- --b;
- SdrObjList* pOL=GetSdrPageViewOfMarkedByIndex(a)->GetObjList();
- size_t c=b;
- if (a<c) { // make sure OrdNums aren't dirty
- GetMarkedObjectByIndex(a)->GetOrdNum();
- }
- while (a<c) {
- SdrObject* pObj1=GetMarkedObjectByIndex(a);
- SdrObject* pObj2=GetMarkedObjectByIndex(c);
- const size_t nOrd1=pObj1->GetOrdNumDirect();
- const size_t nOrd2=pObj2->GetOrdNumDirect();
- if( bUndo )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2));
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1));
- }
- pOL->SetObjectOrdNum(nOrd1,nOrd2);
- // Obj 2 has moved forward by one position, so now nOrd2-1
- pOL->SetObjectOrdNum(nOrd2-1,nOrd1);
- // use Replace instead of SetOrdNum for performance reasons (recalculation of Ordnums)
- ++a;
- --c;
- bChg=true;
+ bool bChg=false;
+
+ bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(SvxResId(STR_EditRevOrder),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ReverseOrder);
+
+ size_t a=0;
+ do {
+ // take into account selection across multiple PageViews
+ size_t b=a+1;
+ while (b<nMarkCount && GetSdrPageViewOfMarkedByIndex(b) == GetSdrPageViewOfMarkedByIndex(a)) ++b;
+ --b;
+ SdrObjList* pOL=GetSdrPageViewOfMarkedByIndex(a)->GetObjList();
+ size_t c=b;
+ if (a<c) { // make sure OrdNums aren't dirty
+ GetMarkedObjectByIndex(a)->GetOrdNum();
+ }
+ while (a<c) {
+ SdrObject* pObj1=GetMarkedObjectByIndex(a);
+ SdrObject* pObj2=GetMarkedObjectByIndex(c);
+ const size_t nOrd1=pObj1->GetOrdNumDirect();
+ const size_t nOrd2=pObj2->GetOrdNumDirect();
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1));
}
- a=b+1;
- } while (a<nMarkCount);
+ pOL->SetObjectOrdNum(nOrd1,nOrd2);
+ // Obj 2 has moved forward by one position, so now nOrd2-1
+ pOL->SetObjectOrdNum(nOrd2-1,nOrd1);
+ // use Replace instead of SetOrdNum for performance reasons (recalculation of Ordnums)
+ ++a;
+ --c;
+ bChg=true;
+ }
+ a=b+1;
+ } while (a<nMarkCount);
- if(bUndo)
- EndUndo();
+ if(bUndo)
+ EndUndo();
- if(bChg)
- MarkListHasChanged();
- }
+ if(bChg)
+ MarkListHasChanged();
}
void SdrEditView::ImpCheckToTopBtmPossible()
@@ -553,21 +553,21 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest)
}
}
- if(pSource && pDest)
- {
- SfxItemSet aSet(mpModel->GetItemPool(),
- svl::Items<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
- SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
- EE_ITEMS_START, EE_ITEMS_END>{});
+ if(!(pSource && pDest))
+ return;
- aSet.Put(pSource->GetMergedItemSet());
+ SfxItemSet aSet(mpModel->GetItemPool(),
+ svl::Items<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
+ SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
+ EE_ITEMS_START, EE_ITEMS_END>{});
- pDest->ClearMergedItem();
- pDest->SetMergedItemSet(aSet);
+ aSet.Put(pSource->GetMergedItemSet());
- pDest->NbcSetLayer(pSource->GetLayer());
- pDest->NbcSetStyleSheet(pSource->GetStyleSheet(), true);
- }
+ pDest->ClearMergedItem();
+ pDest->SetMergedItemSet(aSet);
+
+ pDest->NbcSetLayer(pSource->GetLayer());
+ pDest->NbcSetStyleSheet(pSource->GetStyleSheet(), true);
}
bool SdrEditView::ImpCanConvertForCombine1(const SdrObject* pObj)
@@ -772,216 +772,216 @@ void SdrEditView::DistributeMarkedObjects(weld::Window* pParent)
{
const size_t nMark(GetMarkedObjectCount());
- if(nMark > 2)
- {
- SfxItemSet aNewAttr(mpModel->GetItemPool());
+ if(nMark <= 2)
+ return;
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSvxDistributeDialog> pDlg(pFact->CreateSvxDistributeDialog(pParent, aNewAttr));
+ SfxItemSet aNewAttr(mpModel->GetItemPool());
- sal_uInt16 nResult = pDlg->Execute();
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ScopedVclPtr<AbstractSvxDistributeDialog> pDlg(pFact->CreateSvxDistributeDialog(pParent, aNewAttr));
- if(nResult == RET_OK)
- {
- SvxDistributeHorizontal eHor = pDlg->GetDistributeHor();
- SvxDistributeVertical eVer = pDlg->GetDistributeVer();
- ImpDistributeEntryList aEntryList;
- ImpDistributeEntryList::iterator itEntryList;
- sal_uInt32 nFullLength;
+ sal_uInt16 nResult = pDlg->Execute();
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo();
+ if(nResult != RET_OK)
+ return;
- if(eHor != SvxDistributeHorizontal::NONE)
- {
- // build sorted entry list
- nFullLength = 0;
+ SvxDistributeHorizontal eHor = pDlg->GetDistributeHor();
+ SvxDistributeVertical eVer = pDlg->GetDistributeVer();
+ ImpDistributeEntryList aEntryList;
+ ImpDistributeEntryList::iterator itEntryList;
+ sal_uInt32 nFullLength;
- for( size_t a = 0; a < nMark; ++a )
- {
- SdrMark* pMark = GetSdrMarkByIndex(a);
- ImpDistributeEntry aNew;
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo();
- aNew.mpObj = pMark->GetMarkedSdrObj();
+ if(eHor != SvxDistributeHorizontal::NONE)
+ {
+ // build sorted entry list
+ nFullLength = 0;
- switch(eHor)
- {
- case SvxDistributeHorizontal::Left:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Left();
- break;
- }
- case SvxDistributeHorizontal::Center:
- {
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
- break;
- }
- case SvxDistributeHorizontal::Distance:
- {
- aNew.mnLength = aNew.mpObj->GetSnapRect().GetWidth() + 1;
- nFullLength += aNew.mnLength;
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
- break;
- }
- case SvxDistributeHorizontal::Right:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Right();
- break;
- }
- default: break;
- }
+ for( size_t a = 0; a < nMark; ++a )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ ImpDistributeEntry aNew;
- itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
- [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
- if ( itEntryList < aEntryList.end() )
- aEntryList.insert( itEntryList, aNew );
- else
- aEntryList.push_back( aNew );
- }
+ aNew.mpObj = pMark->GetMarkedSdrObj();
- if(eHor == SvxDistributeHorizontal::Distance)
+ switch(eHor)
+ {
+ case SvxDistributeHorizontal::Left:
{
- // calculate room in-between
- sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1;
- double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
-
- // move entries 1..n-1
- for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i )
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- ImpDistributeEntry& rNext = aEntryList[ i + 1];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(nDelta, 0));
- fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
- }
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Left();
+ break;
}
- else
+ case SvxDistributeHorizontal::Center:
{
- // calculate distances
- sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
- double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth;
-
- // move entries 1..n-1
- for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i )
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(nDelta, 0));
- fStepStart += fStepWidth;
- }
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
+ break;
}
-
- // clear list
- aEntryList.clear();
+ case SvxDistributeHorizontal::Distance:
+ {
+ aNew.mnLength = aNew.mpObj->GetSnapRect().GetWidth() + 1;
+ nFullLength += aNew.mnLength;
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
+ break;
+ }
+ case SvxDistributeHorizontal::Right:
+ {
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Right();
+ break;
+ }
+ default: break;
}
- if(eVer != SvxDistributeVertical::NONE)
+ itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
+ [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
+ if ( itEntryList < aEntryList.end() )
+ aEntryList.insert( itEntryList, aNew );
+ else
+ aEntryList.push_back( aNew );
+ }
+
+ if(eHor == SvxDistributeHorizontal::Distance)
+ {
+ // calculate room in-between
+ sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1;
+ double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
+
+ // move entries 1..n-1
+ for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i )
{
- // build sorted entry list
- nFullLength = 0;
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ ImpDistributeEntry& rNext = aEntryList[ i + 1];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(nDelta, 0));
+ fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
+ }
+ }
+ else
+ {
+ // calculate distances
+ sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
+ double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth;
+
+ // move entries 1..n-1
+ for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i )
+ {
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(nDelta, 0));
+ fStepStart += fStepWidth;
+ }
+ }
- for( size_t a = 0; a < nMark; ++a )
- {
- SdrMark* pMark = GetSdrMarkByIndex(a);
- ImpDistributeEntry aNew;
+ // clear list
+ aEntryList.clear();
+ }
- aNew.mpObj = pMark->GetMarkedSdrObj();
+ if(eVer != SvxDistributeVertical::NONE)
+ {
+ // build sorted entry list
+ nFullLength = 0;
- switch(eVer)
- {
- case SvxDistributeVertical::Top:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Top();
- break;
- }
- case SvxDistributeVertical::Center:
- {
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
- break;
- }
- case SvxDistributeVertical::Distance:
- {
- aNew.mnLength = aNew.mpObj->GetSnapRect().GetHeight() + 1;
- nFullLength += aNew.mnLength;
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
- break;
- }
- case SvxDistributeVertical::Bottom:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Bottom();
- break;
- }
- default: break;
- }
+ for( size_t a = 0; a < nMark; ++a )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ ImpDistributeEntry aNew;
- itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
- [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
- if ( itEntryList < aEntryList.end() )
- aEntryList.insert( itEntryList, aNew );
- else
- aEntryList.push_back( aNew );
- }
+ aNew.mpObj = pMark->GetMarkedSdrObj();
- if(eVer == SvxDistributeVertical::Distance)
+ switch(eVer)
+ {
+ case SvxDistributeVertical::Top:
{
- // calculate room in-between
- sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1;
- double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
-
- // move entries 1..n-1
- for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- ImpDistributeEntry& rNext = aEntryList[ i + 1 ];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(0, nDelta));
- fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
- }
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Top();
+ break;
}
- else
+ case SvxDistributeVertical::Center:
{
- // calculate distances
- sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
- double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth;
-
- // move entries 1..n-1
- for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(0, nDelta));
- fStepStart += fStepWidth;
- }
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
+ break;
}
-
- // clear list
- aEntryList.clear();
+ case SvxDistributeVertical::Distance:
+ {
+ aNew.mnLength = aNew.mpObj->GetSnapRect().GetHeight() + 1;
+ nFullLength += aNew.mnLength;
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
+ break;
+ }
+ case SvxDistributeVertical::Bottom:
+ {
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Bottom();
+ break;
+ }
+ default: break;
}
- // UNDO-Comment and end of UNDO
- mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects));
+ itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
+ [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
+ if ( itEntryList < aEntryList.end() )
+ aEntryList.insert( itEntryList, aNew );
+ else
+ aEntryList.push_back( aNew );
+ }
- if( bUndo )
- EndUndo();
+ if(eVer == SvxDistributeVertical::Distance)
+ {
+ // calculate room in-between
+ sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1;
+ double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
+
+ // move entries 1..n-1
+ for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
+ {
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ ImpDistributeEntry& rNext = aEntryList[ i + 1 ];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(0, nDelta));
+ fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
+ }
+ }
+ else
+ {
+ // calculate distances
+ sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
+ double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth;
+
+ // move entries 1..n-1
+ for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
+ {
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(0, nDelta));
+ fStepStart += fStepWidth;
+ }
}
+
+ // clear list
+ aEntryList.clear();
}
+
+ // UNDO-Comment and end of UNDO
+ mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects));
+
+ if( bUndo )
+ EndUndo();
}
void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode)
@@ -1771,98 +1771,98 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines)
void SdrEditView::GroupMarked()
{
- if (AreObjectsMarked())
+ if (!AreObjectsMarked())
+ return;
+
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
{
- SortMarkedObjects();
+ BegUndo(SvxResId(STR_EditGroup),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::Group);
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
+ for(size_t nm = GetMarkedObjectCount(); nm>0; )
{
- BegUndo(SvxResId(STR_EditGroup),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::Group);
-
- for(size_t nm = GetMarkedObjectCount(); nm>0; )
- {
- // add UndoActions for all affected objects
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj = pM->GetMarkedSdrObj();
- AddUndoActions( CreateConnectorUndo( *pObj ) );
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj ));
- }
+ // add UndoActions for all affected objects
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ AddUndoActions( CreateConnectorUndo( *pObj ) );
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj ));
}
+ }
- SdrMarkList aNewMark;
- SdrPageView* pPV = GetSdrPageView();
+ SdrMarkList aNewMark;
+ SdrPageView* pPV = GetSdrPageView();
- if(pPV)
+ if(pPV)
+ {
+ SdrObjList* pCurrentLst=pPV->GetObjList();
+ SdrObjList* pSrcLst=pCurrentLst;
+ SdrObjList* pSrcLst0=pSrcLst;
+ // make sure OrdNums are correct
+ if (pSrcLst->IsObjOrdNumsDirty())
+ pSrcLst->RecalcObjOrdNums();
+ SdrObject* pGrp=nullptr;
+ SdrObjList* pDstLst=nullptr;
+ // if all selected objects come from foreign object lists.
+ // the group object is the last one in the list.
+ size_t nInsPos=pSrcLst->GetObjCount();
+ bool bNeedInsPos=true;
+ for (size_t nm=GetMarkedObjectCount(); nm>0;)
{
- SdrObjList* pCurrentLst=pPV->GetObjList();
- SdrObjList* pSrcLst=pCurrentLst;
- SdrObjList* pSrcLst0=pSrcLst;
- // make sure OrdNums are correct
- if (pSrcLst->IsObjOrdNumsDirty())
- pSrcLst->RecalcObjOrdNums();
- SdrObject* pGrp=nullptr;
- SdrObjList* pDstLst=nullptr;
- // if all selected objects come from foreign object lists.
- // the group object is the last one in the list.
- size_t nInsPos=pSrcLst->GetObjCount();
- bool bNeedInsPos=true;
- for (size_t nm=GetMarkedObjectCount(); nm>0;)
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if (pM->GetPageView()==pPV)
{
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- if (pM->GetPageView()==pPV)
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (nullptr==pGrp)
{
- SdrObject* pObj=pM->GetMarkedSdrObj();
- if (nullptr==pGrp)
- {
- pGrp = new SdrObjGroup(pObj->getSdrModelFromSdrObject());
- pDstLst=pGrp->GetSubList();
- DBG_ASSERT(pDstLst!=nullptr,"Alleged group object doesn't return object list.");
- }
- pSrcLst=pObj->getParentSdrObjListFromSdrObject();
- if (pSrcLst!=pSrcLst0)
- {
- if (pSrcLst->IsObjOrdNumsDirty())
- pSrcLst->RecalcObjOrdNums();
- }
- bool bForeignList=pSrcLst!=pCurrentLst;
- if (!bForeignList && bNeedInsPos)
- {
- nInsPos=pObj->GetOrdNum(); // this way, all ObjOrdNum of the page are set
- nInsPos++;
- bNeedInsPos=false;
- }
- pSrcLst->RemoveObject(pObj->GetOrdNumDirect());
- if (!bForeignList)
- nInsPos--; // correct InsertPos
- pDstLst->InsertObject(pObj,0);
- GetMarkedObjectListWriteAccess().DeleteMark(nm);
- pSrcLst0=pSrcLst;
+ pGrp = new SdrObjGroup(pObj->getSdrModelFromSdrObject());
+ pDstLst=pGrp->GetSubList();
+ DBG_ASSERT(pDstLst!=nullptr,"Alleged group object doesn't return object list.");
+ }
+ pSrcLst=pObj->getParentSdrObjListFromSdrObject();
+ if (pSrcLst!=pSrcLst0)
+ {
+ if (pSrcLst->IsObjOrdNumsDirty())
+ pSrcLst->RecalcObjOrdNums();
+ }
+ bool bForeignList=pSrcLst!=pCurrentLst;
+ if (!bForeignList && bNeedInsPos)
+ {
+ nInsPos=pObj->GetOrdNum(); // this way, all ObjOrdNum of the page are set
+ nInsPos++;
+ bNeedInsPos=false;
}
+ pSrcLst->RemoveObject(pObj->GetOrdNumDirect());
+ if (!bForeignList)
+ nInsPos--; // correct InsertPos
+ pDstLst->InsertObject(pObj,0);
+ GetMarkedObjectListWriteAccess().DeleteMark(nm);
+ pSrcLst0=pSrcLst;
}
- if (pGrp!=nullptr)
+ }
+ if (pGrp!=nullptr)
+ {
+ aNewMark.InsertEntry(SdrMark(pGrp,pPV));
+ const size_t nCount=pDstLst->GetObjCount();
+ pCurrentLst->InsertObject(pGrp,nInsPos);
+ if( bUndo )
{
- aNewMark.InsertEntry(SdrMark(pGrp,pPV));
- const size_t nCount=pDstLst->GetObjCount();
- pCurrentLst->InsertObject(pGrp,nInsPos);
- if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // no recalculation!
+ for (size_t no=0; no<nCount; ++no)
{
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // no recalculation!
- for (size_t no=0; no<nCount; ++no)
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no)));
- }
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no)));
}
}
}
- GetMarkedObjectListWriteAccess().Merge(aNewMark);
- MarkListHasChanged();
-
- if( bUndo )
- EndUndo();
}
+ GetMarkedObjectListWriteAccess().Merge(aNewMark);
+ MarkListHasChanged();
+
+ if( bUndo )
+ EndUndo();
}
@@ -1987,57 +1987,57 @@ SdrObject* SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLine
void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea)
{
- if (AreObjectsMarked()) {
- bool bMrkChg = false;
- const size_t nMarkCount=GetMarkedObjectCount();
- const char* pDscrID = nullptr;
- if(bLineToArea)
- {
- if(nMarkCount == 1)
- pDscrID = STR_EditConvToContour;
- else
- pDscrID = STR_EditConvToContours;
+ if (!AreObjectsMarked()) return;
- BegUndo(SvxResId(pDscrID), GetDescriptionOfMarkedObjects());
- }
+ bool bMrkChg = false;
+ const size_t nMarkCount=GetMarkedObjectCount();
+ const char* pDscrID = nullptr;
+ if(bLineToArea)
+ {
+ if(nMarkCount == 1)
+ pDscrID = STR_EditConvToContour;
else
- {
- if (bPath) {
- if (nMarkCount==1) pDscrID=STR_EditConvToCurve;
- else pDscrID=STR_EditConvToCurves;
- BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPath);
- } else {
- if (nMarkCount==1) pDscrID=STR_EditConvToPoly;
- else pDscrID=STR_EditConvToPolys;
- BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPoly);
- }
+ pDscrID = STR_EditConvToContours;
+
+ BegUndo(SvxResId(pDscrID), GetDescriptionOfMarkedObjects());
+ }
+ else
+ {
+ if (bPath) {
+ if (nMarkCount==1) pDscrID=STR_EditConvToCurve;
+ else pDscrID=STR_EditConvToCurves;
+ BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPath);
+ } else {
+ if (nMarkCount==1) pDscrID=STR_EditConvToPoly;
+ else pDscrID=STR_EditConvToPolys;
+ BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPoly);
}
- for (size_t nm=nMarkCount; nm>0;) {
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrPageView* pPV=pM->GetPageView();
- if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
- SdrObject* pGrp=pObj;
- SdrObjListIter aIter(*pGrp, SdrIterMode::DeepNoGroups);
- while (aIter.IsMore()) {
- pObj=aIter.Next();
- ImpConvertOneObj(pObj,bPath,bLineToArea);
- }
- } else {
- SdrObject* pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
- if (pNewObj!=nullptr) {
- bMrkChg=true;
- GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj,pPV),nm);
- }
+ }
+ for (size_t nm=nMarkCount; nm>0;) {
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
+ SdrObject* pGrp=pObj;
+ SdrObjListIter aIter(*pGrp, SdrIterMode::DeepNoGroups);
+ while (aIter.IsMore()) {
+ pObj=aIter.Next();
+ ImpConvertOneObj(pObj,bPath,bLineToArea);
+ }
+ } else {
+ SdrObject* pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
+ if (pNewObj!=nullptr) {
+ bMrkChg=true;
+ GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj,pPV),nm);
}
}
- EndUndo();
- if (bMrkChg)
- {
- AdjustMarkHdl();
- MarkListHasChanged();
- }
+ }
+ EndUndo();
+ if (bMrkChg)
+ {
+ AdjustMarkHdl();
+ MarkListHasChanged();
}
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 9551cf985b03..eaf8a89922b5 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -218,22 +218,22 @@ void SdrObjEditView::TakeActionRect(tools::Rectangle& rRect) const
void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
SdrGlueEditView::Notify(rBC, rHint);
- if (pTextEditOutliner != nullptr)
+ if (pTextEditOutliner == nullptr)
+ return;
+
+ // change of printer while editing
+ if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+ return;
+
+ const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+ SdrHintKind eKind = pSdrHint->GetKind();
+ if (eKind == SdrHintKind::RefDeviceChange)
{
- // change of printer while editing
- if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
- {
- const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
- SdrHintKind eKind = pSdrHint->GetKind();
- if (eKind == SdrHintKind::RefDeviceChange)
- {
- pTextEditOutliner->SetRefDevice(mpModel->GetRefDevice());
- }
- if (eKind == SdrHintKind::DefaultTabChange)
- {
- pTextEditOutliner->SetDefTab(mpModel->GetDefaultTabulator());
- }
- }
+ pTextEditOutliner->SetRefDevice(mpModel->GetRefDevice());
+ }
+ if (eKind == SdrHintKind::DefaultTabChange)
+ {
+ pTextEditOutliner->SetDefTab(mpModel->GetDefaultTabulator());
}
}
@@ -243,142 +243,141 @@ void SdrObjEditView::ModelHasChanged()
if (mxTextEditObj.is() && !mxTextEditObj->IsInserted())
SdrEndTextEdit(); // object deleted
// TextEditObj changed?
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ SdrTextObj* pTextObj = mxTextEditObj.get();
+ if (pTextObj != nullptr)
{
- SdrTextObj* pTextObj = mxTextEditObj.get();
- if (pTextObj != nullptr)
- {
- size_t nOutlViewCnt = pTextEditOutliner->GetViewCount();
- bool bAreaChg = false;
- bool bAnchorChg = false;
- bool bColorChg = false;
- bool bContourFrame = pTextObj->IsContourTextFrame();
- EEAnchorMode eNewAnchor(EEAnchorMode::VCenterHCenter);
- tools::Rectangle aOldArea(aMinTextEditArea);
- aOldArea.Union(aTextEditArea);
- Color aNewColor;
- { // check area
- Size aPaperMin1;
- Size aPaperMax1;
- tools::Rectangle aEditArea1;
- tools::Rectangle aMinArea1;
- pTextObj->TakeTextEditArea(&aPaperMin1, &aPaperMax1, &aEditArea1, &aMinArea1);
- Point aPvOfs(pTextObj->GetTextEditOffset());
-
- // add possible GridOffset to up-to-now view-independent EditAreas
- basegfx::B2DVector aGridOffset(0.0, 0.0);
- if (getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, GetSdrPageView()))
- {
- const Point aOffset(basegfx::fround(aGridOffset.getX()),
- basegfx::fround(aGridOffset.getY()));
+ size_t nOutlViewCnt = pTextEditOutliner->GetViewCount();
+ bool bAreaChg = false;
+ bool bAnchorChg = false;
+ bool bColorChg = false;
+ bool bContourFrame = pTextObj->IsContourTextFrame();
+ EEAnchorMode eNewAnchor(EEAnchorMode::VCenterHCenter);
+ tools::Rectangle aOldArea(aMinTextEditArea);
+ aOldArea.Union(aTextEditArea);
+ Color aNewColor;
+ { // check area
+ Size aPaperMin1;
+ Size aPaperMax1;
+ tools::Rectangle aEditArea1;
+ tools::Rectangle aMinArea1;
+ pTextObj->TakeTextEditArea(&aPaperMin1, &aPaperMax1, &aEditArea1, &aMinArea1);
+ Point aPvOfs(pTextObj->GetTextEditOffset());
- aEditArea1 += aOffset;
- aMinArea1 += aOffset;
- }
+ // add possible GridOffset to up-to-now view-independent EditAreas
+ basegfx::B2DVector aGridOffset(0.0, 0.0);
+ if (getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, GetSdrPageView()))
+ {
+ const Point aOffset(basegfx::fround(aGridOffset.getX()),
+ basegfx::fround(aGridOffset.getY()));
- aEditArea1.Move(aPvOfs.X(), aPvOfs.Y());
- aMinArea1.Move(aPvOfs.X(), aPvOfs.Y());
- tools::Rectangle aNewArea(aMinArea1);
- aNewArea.Union(aEditArea1);
+ aEditArea1 += aOffset;
+ aMinArea1 += aOffset;
+ }
- if (aNewArea != aOldArea || aEditArea1 != aTextEditArea
- || aMinArea1 != aMinTextEditArea
- || pTextEditOutliner->GetMinAutoPaperSize() != aPaperMin1
- || pTextEditOutliner->GetMaxAutoPaperSize() != aPaperMax1)
+ aEditArea1.Move(aPvOfs.X(), aPvOfs.Y());
+ aMinArea1.Move(aPvOfs.X(), aPvOfs.Y());
+ tools::Rectangle aNewArea(aMinArea1);
+ aNewArea.Union(aEditArea1);
+
+ if (aNewArea != aOldArea || aEditArea1 != aTextEditArea || aMinArea1 != aMinTextEditArea
+ || pTextEditOutliner->GetMinAutoPaperSize() != aPaperMin1
+ || pTextEditOutliner->GetMaxAutoPaperSize() != aPaperMax1)
+ {
+ aTextEditArea = aEditArea1;
+ aMinTextEditArea = aMinArea1;
+ pTextEditOutliner->SetUpdateMode(false);
+ pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
+ pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
+ pTextEditOutliner->SetPaperSize(Size(0, 0)); // re-format Outliner
+ if (!bContourFrame)
{
- aTextEditArea = aEditArea1;
- aMinTextEditArea = aMinArea1;
- pTextEditOutliner->SetUpdateMode(false);
- pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
- pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
- pTextEditOutliner->SetPaperSize(Size(0, 0)); // re-format Outliner
- if (!bContourFrame)
- {
- pTextEditOutliner->ClearPolygon();
- EEControlBits nStat = pTextEditOutliner->GetControlWord();
- nStat |= EEControlBits::AUTOPAGESIZE;
- pTextEditOutliner->SetControlWord(nStat);
- }
- else
- {
- EEControlBits nStat = pTextEditOutliner->GetControlWord();
- nStat &= ~EEControlBits::AUTOPAGESIZE;
- pTextEditOutliner->SetControlWord(nStat);
- tools::Rectangle aAnchorRect;
- pTextObj->TakeTextAnchorRect(aAnchorRect);
- pTextObj->ImpSetContourPolygon(*pTextEditOutliner, aAnchorRect, true);
- }
- for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++)
- {
- OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
- EVControlBits nStat0 = pOLV->GetControlWord();
- EVControlBits nStat = nStat0;
- // AutoViewSize only if not ContourFrame.
- if (!bContourFrame)
- nStat |= EVControlBits::AUTOSIZE;
- else
- nStat &= ~EVControlBits::AUTOSIZE;
- if (nStat != nStat0)
- pOLV->SetControlWord(nStat);
- }
- pTextEditOutliner->SetUpdateMode(true);
- bAreaChg = true;
+ pTextEditOutliner->ClearPolygon();
+ EEControlBits nStat = pTextEditOutliner->GetControlWord();
+ nStat |= EEControlBits::AUTOPAGESIZE;
+ pTextEditOutliner->SetControlWord(nStat);
+ }
+ else
+ {
+ EEControlBits nStat = pTextEditOutliner->GetControlWord();
+ nStat &= ~EEControlBits::AUTOPAGESIZE;
+ pTextEditOutliner->SetControlWord(nStat);
+ tools::Rectangle aAnchorRect;
+ pTextObj->TakeTextAnchorRect(aAnchorRect);
+ pTextObj->ImpSetContourPolygon(*pTextEditOutliner, aAnchorRect, true);
}
- }
- if (pTextEditOutlinerView != nullptr)
- { // check fill and anchor
- EEAnchorMode eOldAnchor = pTextEditOutlinerView->GetAnchorMode();
- eNewAnchor = pTextObj->GetOutlinerViewAnchorMode();
- bAnchorChg = eOldAnchor != eNewAnchor;
- Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
- aNewColor = GetTextEditBackgroundColor(*this);
- bColorChg = aOldColor != aNewColor;
- }
- // refresh always when it's a contour frame. That
- // refresh is necessary since it triggers the repaint
- // which makes the Handles visible. Changes at TakeTextRect()
- // seem to have resulted in a case where no refresh is executed.
- // Before that, a refresh must have been always executed
- // (else this error would have happened earlier), thus I
- // even think here a refresh should be done always.
- // Since follow-up problems cannot even be guessed I only
- // add this one more case to the if below.
- // BTW: It's VERY bad style that here, inside ModelHasChanged()
- // the outliner is again massively changed for the text object
- // in text edit mode. Normally, all necessary data should be
- // set at SdrBeginTextEdit(). Some changes and value assigns in
- // SdrBeginTextEdit() are completely useless since they are set here
- // again on ModelHasChanged().
- if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
- {
for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++)
{
OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
- { // invalidate old OutlinerView area
- vcl::Window* pWin = pOLV->GetWindow();
- tools::Rectangle aTmpRect(aOldArea);
- sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1;
- Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz)));
- aTmpRect.AdjustLeft(-(aMore.Width()));
- aTmpRect.AdjustRight(aMore.Width());
- aTmpRect.AdjustTop(-(aMore.Height()));
- aTmpRect.AdjustBottom(aMore.Height());
- InvalidateOneWin(*pWin, aTmpRect);
- }
- if (bAnchorChg)
- pOLV->SetAnchorMode(eNewAnchor);
- if (bColorChg)
- pOLV->SetBackgroundColor(aNewColor);
-
- pOLV->SetOutputArea(
- aTextEditArea); // because otherwise, we're not re-anchoring correctly
- ImpInvalidateOutlinerView(*pOLV);
+ EVControlBits nStat0 = pOLV->GetControlWord();
+ EVControlBits nStat = nStat0;
+ // AutoViewSize only if not ContourFrame.
+ if (!bContourFrame)
+ nStat |= EVControlBits::AUTOSIZE;
+ else
+ nStat &= ~EVControlBits::AUTOSIZE;
+ if (nStat != nStat0)
+ pOLV->SetControlWord(nStat);
+ }
+ pTextEditOutliner->SetUpdateMode(true);
+ bAreaChg = true;
+ }
+ }
+ if (pTextEditOutlinerView != nullptr)
+ { // check fill and anchor
+ EEAnchorMode eOldAnchor = pTextEditOutlinerView->GetAnchorMode();
+ eNewAnchor = pTextObj->GetOutlinerViewAnchorMode();
+ bAnchorChg = eOldAnchor != eNewAnchor;
+ Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
+ aNewColor = GetTextEditBackgroundColor(*this);
+ bColorChg = aOldColor != aNewColor;
+ }
+ // refresh always when it's a contour frame. That
+ // refresh is necessary since it triggers the repaint
+ // which makes the Handles visible. Changes at TakeTextRect()
+ // seem to have resulted in a case where no refresh is executed.
+ // Before that, a refresh must have been always executed
+ // (else this error would have happened earlier), thus I
+ // even think here a refresh should be done always.
+ // Since follow-up problems cannot even be guessed I only
+ // add this one more case to the if below.
+ // BTW: It's VERY bad style that here, inside ModelHasChanged()
+ // the outliner is again massively changed for the text object
+ // in text edit mode. Normally, all necessary data should be
+ // set at SdrBeginTextEdit(). Some changes and value assigns in
+ // SdrBeginTextEdit() are completely useless since they are set here
+ // again on ModelHasChanged().
+ if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
+ {
+ for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++)
+ {
+ OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
+ { // invalidate old OutlinerView area
+ vcl::Window* pWin = pOLV->GetWindow();
+ tools::Rectangle aTmpRect(aOldArea);
+ sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1;
+ Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz)));
+ aTmpRect.AdjustLeft(-(aMore.Width()));
+ aTmpRect.AdjustRight(aMore.Width());
+ aTmpRect.AdjustTop(-(aMore.Height()));
+ aTmpRect.AdjustBottom(aMore.Height());
+ InvalidateOneWin(*pWin, aTmpRect);
}
- pTextEditOutlinerView->ShowCursor();
+ if (bAnchorChg)
+ pOLV->SetAnchorMode(eNewAnchor);
+ if (bColorChg)
+ pOLV->SetBackgroundColor(aNewColor);
+
+ pOLV->SetOutputArea(
+ aTextEditArea); // because otherwise, we're not re-anchoring correctly
+ ImpInvalidateOutlinerView(*pOLV);
}
+ pTextEditOutlinerView->ShowCursor();
}
- ImpMakeTextCursorAreaVisible();
}
+ ImpMakeTextCursorAreaVisible();
}
namespace
@@ -590,27 +589,27 @@ void TextEditOverlayObject::checkDataChange(const basegfx::B2DRange& rMinTextEdi
void TextEditOverlayObject::checkSelectionChange()
{
- if (getOverlaySelection() && getOverlayManager())
- {
- std::vector<tools::Rectangle> aLogicRects;
- std::vector<basegfx::B2DRange> aLogicRanges;
- const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)));
+ if (!(getOverlaySelection() && getOverlayManager()))
+ return;
- // get logic selection
- getOutlinerView().GetSelectionRectangles(aLogicRects);
+ std::vector<tools::Rectangle> aLogicRects;
+ std::vector<basegfx::B2DRange> aLogicRanges;
+ const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)));
- aLogicRanges.reserve(aLogicRects.size());
- for (const auto& aRect : aLogicRects)
- {
- // convert from logic Rectangles to logic Ranges, do not forget to add
- // one Unit (in this case logical units for one pixel, pre-calculated)
- aLogicRanges.emplace_back(
- aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(),
- aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height());
- }
+ // get logic selection
+ getOutlinerView().GetSelectionRectangles(aLogicRects);
- mpOverlaySelection->setRanges(aLogicRanges);
+ aLogicRanges.reserve(aLogicRects.size());
+ for (const auto& aRect : aLogicRects)
+ {
+ // convert from logic Rectangles to logic Ranges, do not forget to add
+ // one Unit (in this case logical units for one pixel, pre-calculated)
+ aLogicRanges.emplace_back(
+ aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(),
+ aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height());
}
+
+ mpOverlaySelection->setRanges(aLogicRanges);
}
} // end of anonymous namespace
@@ -621,21 +620,21 @@ void TextEditOverlayObject::checkSelectionChange()
// is an integral part of the text visualization
void SdrObjEditView::EditViewInvalidate(const tools::Rectangle&) const
{
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ // MinTextRange may have changed. Forward it, too
+ const basegfx::B2DRange aMinTextRange
+ = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
+
+ for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
{
- // MinTextRange may have changed. Forward it, too
- const basegfx::B2DRange aMinTextRange
- = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
+ TextEditOverlayObject* pCandidate
+ = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
- for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
+ if (pCandidate)
{
- TextEditOverlayObject* pCandidate
- = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
-
- if (pCandidate)
- {
- pCandidate->checkDataChange(aMinTextRange);
- }
+ pCandidate->checkDataChange(aMinTextRange);
}
}
}
@@ -645,17 +644,17 @@ void SdrObjEditView::EditViewInvalidate(const tools::Rectangle&) const
// which is e.g. used when only the selection is changed, but not the text
void SdrObjEditView::EditViewSelectionChange() const
{
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
{
- for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
- {
- TextEditOverlayObject* pCandidate
- = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
+ TextEditOverlayObject* pCandidate
+ = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
- if (pCandidate)
- {
- pCandidate->checkSelectionChange();
- }
+ if (pCandidate)
+ {
+ pCandidate->checkSelectionChange();
}
}
}
@@ -777,53 +776,53 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const& rOutlView) co
{
vcl::Window* pWin = rOutlView.GetWindow();
- if (pWin)
- {
- const SdrTextObj* pText = GetTextEditObject();
- bool bTextFrame(pText && pText->IsTextFrame());
- bool bFitToSize(pText && pText->IsFitToSize());
+ if (!pWin)
+ return;
- if (bTextFrame && !bFitToSize)
- {
- tools::Rectangle aBlankRect(rOutlView.GetOutputArea());
- aBlankRect.Union(aMinTextEditArea);
- tools::Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
- sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
+ const SdrTextObj* pText = GetTextEditObject();
+ bool bTextFrame(pText && pText->IsTextFrame());
+ bool bFitToSize(pText && pText->IsFitToSize());
- aPixRect.AdjustLeft(-1);
- aPixRect.AdjustTop(-1);
- aPixRect.AdjustRight(1);
- aPixRect.AdjustBottom(1);
+ if (!(bTextFrame && !bFitToSize))
+ return;
- {
- // limit xPixRect because of driver problems when pixel coordinates are too far out
- Size aMaxXY(pWin->GetOutputSizePixel());
- long a(2 * nPixSiz);
- long nMaxX(aMaxXY.Width() + a);
- long nMaxY(aMaxXY.Height() + a);
-
- if (aPixRect.Left() < -a)
- aPixRect.SetLeft(-a);
- if (aPixRect.Top() < -a)
- aPixRect.SetTop(-a);
- if (aPixRect.Right() > nMaxX)
- aPixRect.SetRight(nMaxX);
- if (aPixRect.Bottom() > nMaxY)
- aPixRect.SetBottom(nMaxY);
- }
+ tools::Rectangle aBlankRect(rOutlView.GetOutputArea());
+ aBlankRect.Union(aMinTextEditArea);
+ tools::Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
+ sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
- tools::Rectangle aOuterPix(aPixRect);
- aOuterPix.AdjustLeft(-nPixSiz);
- aOuterPix.AdjustTop(-nPixSiz);
- aOuterPix.AdjustRight(nPixSiz);
- aOuterPix.AdjustBottom(nPixSiz);
+ aPixRect.AdjustLeft(-1);
+ aPixRect.AdjustTop(-1);
+ aPixRect.AdjustRight(1);
+ aPixRect.AdjustBottom(1);
- bool bMapModeEnabled(pWin->IsMapModeEnabled());
- pWin->EnableMapMode(false);
- pWin->Invalidate(aOuterPix);
- pWin->EnableMapMode(bMapModeEnabled);
- }
+ {
+ // limit xPixRect because of driver problems when pixel coordinates are too far out
+ Size aMaxXY(pWin->GetOutputSizePixel());
+ long a(2 * nPixSiz);
+ long nMaxX(aMaxXY.Width() + a);
+ long nMaxY(aMaxXY.Height() + a);
+
+ if (aPixRect.Left() < -a)
+ aPixRect.SetLeft(-a);
+ if (aPixRect.Top() < -a)
+ aPixRect.SetTop(-a);
+ if (aPixRect.Right() > nMaxX)
+ aPixRect.SetRight(nMaxX);
+ if (aPixRect.Bottom() > nMaxY)
+ aPixRect.SetBottom(nMaxY);
}
+
+ tools::Rectangle aOuterPix(aPixRect);
+ aOuterPix.AdjustLeft(-nPixSiz);
+ aOuterPix.AdjustTop(-nPixSiz);
+ aOuterPix.AdjustRight(nPixSiz);
+ aOuterPix.AdjustBottom(nPixSiz);
+
+ bool bMapModeEnabled(pWin->IsMapModeEnabled());
+ pWin->EnableMapMode(false);
+ pWin->Invalidate(aOuterPix);
+ pWin->EnableMapMode(bMapModeEnabled);
}
OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView,
@@ -896,70 +895,70 @@ IMPL_LINK(SdrObjEditView, ImpOutlinerStatusEventHdl, EditStatus&, rEditStat, voi
void SdrObjEditView::ImpChainingEventHdl()
{
- if (pTextEditOutliner)
+ if (!pTextEditOutliner)
+ return;
+
+ SdrTextObj* pTextObj = mxTextEditObj.get();
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+ if (pTextObj && pOLV)
{
- SdrTextObj* pTextObj = mxTextEditObj.get();
- OutlinerView* pOLV = GetTextEditOutlinerView();
- if (pTextObj && pOLV)
- {
- TextChain* pTextChain = pTextObj->GetTextChain();
+ TextChain* pTextChain = pTextObj->GetTextChain();
- // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
- if (!pTextObj->IsChainable())
- {
- return;
- }
- // This is true during an underflow-caused overflow (with pEdtOutl->SetText())
- if (pTextChain->GetNilChainingEvent(pTextObj))
- {
- return;
- }
+ // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
+ if (!pTextObj->IsChainable())
+ {
+ return;
+ }
+ // This is true during an underflow-caused overflow (with pEdtOutl->SetText())
+ if (pTextChain->GetNilChainingEvent(pTextObj))
+ {
+ return;
+ }
- // We prevent to trigger further handling of overflow/underflow for pTextObj
- pTextChain->SetNilChainingEvent(pTextObj, true); // XXX
+ // We prevent to trigger further handling of overflow/underflow for pTextObj
+ pTextChain->SetNilChainingEvent(pTextObj, true); // XXX
- // Save previous selection pos // NOTE: It must be done to have the right CursorEvent in KeyInput
- pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection());
- //maPreChainingSel = new ESelection(pOLV->GetSelection());
+ // Save previous selection pos // NOTE: It must be done to have the right CursorEvent in KeyInput
+ pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection());
+ //maPreChainingSel = new ESelection(pOLV->GetSelection());
- // Handling Undo
- const int nText = 0; // XXX: hardcoded index (SdrTextObj::getText handles only 0)
+ // Handling Undo
+ const int nText = 0; // XXX: hardcoded index (SdrTextObj::getText handles only 0)
- const bool bUndoEnabled = GetModel() && IsUndoEnabled();
- std::unique_ptr<SdrUndoObjSetText> pTxtUndo;
- if (bUndoEnabled)
- pTxtUndo.reset(
- dynamic_cast<SdrUndoObjSetText*>(GetModel()
- ->GetSdrUndoFactory()
- .CreateUndoObjectSetText(*pTextObj, nText)
- .release()));
+ const bool bUndoEnabled = GetModel() && IsUndoEnabled();
+ std::unique_ptr<SdrUndoObjSetText> pTxtUndo;
+ if (bUndoEnabled)
+ pTxtUndo.reset(
+ dynamic_cast<SdrUndoObjSetText*>(GetModel()
+ ->GetSdrUndoFactory()
+ .CreateUndoObjectSetText(*pTextObj, nText)
+ .release()));
- // trigger actual chaining
- pTextObj->onChainingEvent();
+ // trigger actual chaining
+ pTextObj->onChainingEvent();
- if (pTxtUndo)
+ if (pTxtUndo)
+ {
+ pTxtUndo->AfterSetText();
+ if (!pTxtUndo->IsDifferent())
{
- pTxtUndo->AfterSetText();
- if (!pTxtUndo->IsDifferent())
- {
- pTxtUndo.reset();
- }
+ pTxtUndo.reset();
}
+ }
- if (pTxtUndo)
- AddUndo(std::move(pTxtUndo));
+ if (pTxtUndo)
+ AddUndo(std::move(pTxtUndo));
- //maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
- //SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
+ //maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
+ //SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
- // NOTE: Must be called. Don't let the function return if you set it to true and not reset it
- pTextChain->SetNilChainingEvent(pTextObj, false);
- }
- else
- {
- // XXX
- SAL_INFO("svx.chaining", "[OnChaining] No Edit Outliner View");
- }
+ // NOTE: Must be called. Don't let the function return if you set it to true and not reset it
+ pTextChain->SetNilChainingEvent(pTextObj, false);
+ }
+ else
+ {
+ // XXX
+ SAL_INFO("svx.chaining", "[OnChaining] No Edit Outliner View");
}
}
@@ -1677,21 +1676,21 @@ OutlinerView* SdrObjEditView::ImpFindOutlinerView(vcl::Window const* pWin) const
void SdrObjEditView::SetTextEditWin(vcl::Window* pWin)
{
- if (mxTextEditObj.is() && pWin != nullptr && pWin != pTextEditWin)
+ if (!(mxTextEditObj.is() && pWin != nullptr && pWin != pTextEditWin))
+ return;
+
+ OutlinerView* pNewView = ImpFindOutlinerView(pWin);
+ if (pNewView != nullptr && pNewView != pTextEditOutlinerView)
{
- OutlinerView* pNewView = ImpFindOutlinerView(pWin);
- if (pNewView != nullptr && pNewView != pTextEditOutlinerView)
+ if (pTextEditOutlinerView != nullptr)
{
- if (pTextEditOutlinerView != nullptr)
- {
- pTextEditOutlinerView->HideCursor();
- }
- pTextEditOutlinerView = pNewView;
- pTextEditWin = pWin;
- pWin->GrabFocus(); // Make the cursor blink here as well
- pNewView->ShowCursor();
- ImpMakeTextCursorAreaVisible();
+ pTextEditOutlinerView->HideCursor();
}
+ pTextEditOutlinerView = pNewView;
+ pTextEditWin = pWin;
+ pWin->GrabFocus(); // Make the cursor blink here as well
+ pNewView->ShowCursor();
+ ImpMakeTextCursorAreaVisible();
}
}
@@ -2386,19 +2385,19 @@ void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
void SdrObjEditView::MovMacroObj(const Point& rPnt)
{
- if (pMacroObj != nullptr)
- {
- SdrObjMacroHitRec aHitRec;
- aHitRec.aPos = rPnt;
- aHitRec.nTol = nMacroTol;
- aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers();
- aHitRec.pPageView = pMacroPV;
- bool bDown = pMacroObj->IsMacroHit(aHitRec);
- if (bDown)
- ImpMacroDown(rPnt);
- else
- ImpMacroUp(rPnt);
- }
+ if (pMacroObj == nullptr)
+ return;
+
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos = rPnt;
+ aHitRec.nTol = nMacroTol;
+ aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView = pMacroPV;
+ bool bDown = pMacroObj->IsMacroHit(aHitRec);
+ if (bDown)
+ ImpMacroDown(rPnt);
+ else
+ ImpMacroUp(rPnt);
}
void SdrObjEditView::BrkMacroObj()
@@ -2439,28 +2438,25 @@ bool SdrObjEditView::EndMacroObj()
Leaves the any untouched if there currently is no text selected */
void SdrObjEditView::getTextSelection(css::uno::Any& rSelection)
{
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ OutlinerView* pOutlinerView = GetTextEditOutlinerView();
+ if (!(pOutlinerView && pOutlinerView->HasSelection()))
+ return;
+
+ SdrObject* pObj = GetTextEditObject();
+
+ if (!pObj)
+ return;
+
+ css::uno::Reference<css::text::XText> xText(pObj->getUnoShape(), css::uno::UNO_QUERY);
+ if (xText.is())
{
- OutlinerView* pOutlinerView = GetTextEditOutlinerView();
- if (pOutlinerView && pOutlinerView->HasSelection())
+ SvxUnoTextBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>(xText);
+ if (pRange)
{
- SdrObject* pObj = GetTextEditObject();
-
- if (pObj)
- {
- css::uno::Reference<css::text::XText> xText(pObj->getUnoShape(),
- css::uno::UNO_QUERY);
- if (xText.is())
- {
- SvxUnoTextBase* pRange
- = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>(xText);
- if (pRange)
- {
- rSelection
- <<= pRange->createTextCursorBySelection(pOutlinerView->GetSelection());
- }
- }
- }
+ rSelection <<= pRange->createTextCursorBySelection(pOutlinerView->GetSelection());
}
}
}
@@ -2485,24 +2481,23 @@ void SdrObjEditView::MarkListHasChanged()
mxSelectionController.clear();
const SdrMarkList& rMarkList = GetMarkedObjectList();
- if (rMarkList.GetMarkCount() == 1)
+ if (rMarkList.GetMarkCount() != 1)
+ return;
+
+ const SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj());
+ SdrView* pView(dynamic_cast<SdrView*>(this));
+
+ // check for table
+ if (pObj && pView && (pObj->GetObjInventor() == SdrInventor::Default)
+ && (pObj->GetObjIdentifier() == OBJ_TABLE))
{
- const SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj());
- SdrView* pView(dynamic_cast<SdrView*>(this));
+ mxSelectionController = sdr::table::CreateTableController(
+ *pView, static_cast<const sdr::table::SdrTableObj&>(*pObj), mxLastSelectionController);
- // check for table
- if (pObj && pView && (pObj->GetObjInventor() == SdrInventor::Default)
- && (pObj->GetObjIdentifier() == OBJ_TABLE))
+ if (mxSelectionController.is())
{
- mxSelectionController = sdr::table::CreateTableController(
- *pView, static_cast<const sdr::table::SdrTableObj&>(*pObj),
- mxLastSelectionController);
-
- if (mxSelectionController.is())
- {
- mxLastSelectionController.clear();
- mxSelectionController->onSelectionHasChanged();
- }
+ mxLastSelectionController.clear();
+ mxSelectionController->onSelectionHasChanged();
}
}
}
@@ -2637,32 +2632,32 @@ static const sal_uInt16* GetFormatRangeImpl(bool bTextOnly)
void SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSet)
{
const SdrMarkList& rMarkList = GetMarkedObjectList();
- if (rMarkList.GetMarkCount() > 0)
- {
- OutlinerView* pOLV = GetTextEditOutlinerView();
+ if (rMarkList.GetMarkCount() <= 0)
+ return;
- rFormatSet = std::make_shared<SfxItemSet>(GetModel()->GetItemPool(),
- GetFormatRangeImpl(pOLV != nullptr));
- if (pOLV)
- {
- rFormatSet->Put(pOLV->GetAttribs());
- }
- else
- {
- const bool bOnlyHardAttr = false;
- rFormatSet->Put(GetAttrFromMarked(bOnlyHardAttr));
- }
+ OutlinerView* pOLV = GetTextEditOutlinerView();
- // check for cloning from table cell, in which case we need to copy cell-specific formatting attributes
- const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if (pObj && (pObj->GetObjInventor() == SdrInventor::Default)
- && (pObj->GetObjIdentifier() == OBJ_TABLE))
+ rFormatSet = std::make_shared<SfxItemSet>(GetModel()->GetItemPool(),
+ GetFormatRangeImpl(pOLV != nullptr));
+ if (pOLV)
+ {
+ rFormatSet->Put(pOLV->GetAttribs());
+ }
+ else
+ {
+ const bool bOnlyHardAttr = false;
+ rFormatSet->Put(GetAttrFromMarked(bOnlyHardAttr));
+ }
+
+ // check for cloning from table cell, in which case we need to copy cell-specific formatting attributes
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if (pObj && (pObj->GetObjInventor() == SdrInventor::Default)
+ && (pObj->GetObjIdentifier() == OBJ_TABLE))
+ {
+ auto pTable = static_cast<const sdr::table::SdrTableObj*>(pObj);
+ if (mxSelectionController.is() && pTable->getActiveCell().is())
{
- auto pTable = static_cast<const sdr::table::SdrTableObj*>(pObj);
- if (mxSelectionController.is() && pTable->getActiveCell().is())
- {
- mxSelectionController->GetAttributes(*rFormatSet, false);
- }
+ mxSelectionController->GetAttributes(*rFormatSet, false);
}
}
}
@@ -2704,32 +2699,32 @@ void SdrObjEditView::ApplyFormatPaintBrushToText(SfxItemSet const& rFormatSet, S
bool bNoParagraphFormats)
{
OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
- if (pParaObj)
- {
- SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
- rOutliner.SetText(*pParaObj);
+ if (!pParaObj)
+ return;
- sal_Int32 nParaCount(rOutliner.GetParagraphCount());
+ SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
+ rOutliner.SetText(*pParaObj);
- if (nParaCount)
- {
- for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
- {
- if (!bNoCharacterFormats)
- rOutliner.RemoveCharAttribs(nPara);
+ sal_Int32 nParaCount(rOutliner.GetParagraphCount());
- SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
- aSet.Put(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet,
- bNoCharacterFormats, bNoParagraphFormats));
- rOutliner.SetParaAttribs(nPara, aSet);
- }
+ if (!nParaCount)
+ return;
- std::unique_ptr<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
- rOutliner.Clear();
+ for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ if (!bNoCharacterFormats)
+ rOutliner.RemoveCharAttribs(nPara);
- rTextObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText);
- }
+ SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
+ aSet.Put(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet,
+ bNoCharacterFormats, bNoParagraphFormats));
+ rOutliner.SetParaAttribs(nPara, aSet);
}
+
+ std::unique_ptr<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
+ rOutliner.Clear();
+
+ rTextObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText);
}
void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, bool bNoCharacterFormats,
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 4adefe0cb096..1f62442af896 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -422,25 +422,25 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
mbFntDirty = false;
}
- if(pObj)
- {
- pObj->SetLayer(mnLayer);
+ if(!pObj)
+ return;
- if(bLine)
- {
- pObj->SetMergedItemSet(*mpLineAttr);
- }
+ pObj->SetLayer(mnLayer);
- if(bFill)
- {
- pObj->SetMergedItemSet(*mpFillAttr);
- }
+ if(bLine)
+ {
+ pObj->SetMergedItemSet(*mpLineAttr);
+ }
- if(bText)
- {
- pObj->SetMergedItemSet(*mpTextAttr);
- pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
- }
+ if(bFill)
+ {
+ pObj->SetMergedItemSet(*mpFillAttr);
+ }
+
+ if(bText)
+ {
+ pObj->SetMergedItemSet(*mpTextAttr);
+ pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
}
}
@@ -596,65 +596,65 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale)
}
}
- if(pObj)
+ if(!pObj)
+ return;
+
+ // #i111954# check object for visibility
+ // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
+ bool bVisible(false);
+
+ if(pObj->HasLineStyle())
+ {
+ bVisible = true;
+ }
+
+ if(!bVisible && pObj->HasFillStyle())
+ {
+ bVisible = true;
+ }
+
+ if(!bVisible)
{
- // #i111954# check object for visibility
- // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
- bool bVisible(false);
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
- if(pObj->HasLineStyle())
+ if(pTextObj && pTextObj->HasText())
{
bVisible = true;
}
+ }
+
+ if(!bVisible)
+ {
+ SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
- if(!bVisible && pObj->HasFillStyle())
+ if(pGrafObj)
{
+ // this may be refined to check if the graphic really is visible. It
+ // is here to ensure that graphic objects without fill, line and text
+ // get created
bVisible = true;
}
+ }
- if(!bVisible)
- {
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
-
- if(pTextObj && pTextObj->HasText())
- {
- bVisible = true;
- }
- }
+ if(!bVisible)
+ {
+ SdrObject::Free(pObj);
+ }
+ else
+ {
+ maTmpList.push_back(pObj);
- if(!bVisible)
+ if(dynamic_cast< SdrPathObj* >(pObj))
{
- SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
+ const bool bClosed(pObj->IsClosedObj());
- if(pGrafObj)
- {
- // this may be refined to check if the graphic really is visible. It
- // is here to ensure that graphic objects without fill, line and text
- // get created
- bVisible = true;
- }
- }
-
- if(!bVisible)
- {
- SdrObject::Free(pObj);
+ mbLastObjWasPolyWithoutLine = mbNoLine && bClosed;
+ mbLastObjWasLine = !bClosed;
}
else
{
- maTmpList.push_back(pObj);
-
- if(dynamic_cast< SdrPathObj* >(pObj))
- {
- const bool bClosed(pObj->IsClosedObj());
-
- mbLastObjWasPolyWithoutLine = mbNoLine && bClosed;
- mbLastObjWasLine = !bClosed;
- }
- else
- {
- mbLastObjWasPolyWithoutLine = false;
- mbLastObjWasLine = false;
- }
+ mbLastObjWasPolyWithoutLine = false;
+ mbLastObjWasLine = false;
}
}
}
@@ -665,44 +665,44 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction const & rAct)
const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y());
const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y());
- if(!aStart.equal(aEnd))
- {
- basegfx::B2DPolygon aLine;
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ if(aStart.equal(aEnd))
+ return;
- aLine.append(aStart);
- aLine.append(aEnd);
- aLine.transform(aTransform);
+ basegfx::B2DPolygon aLine;
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- const LineInfo& rLineInfo = rAct.GetLineInfo();
- const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
- bool bCreateLineObject(true);
+ aLine.append(aStart);
+ aLine.append(aEnd);
+ aLine.transform(aTransform);
- if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine))
- {
- bCreateLineObject = false;
- }
+ const LineInfo& rLineInfo = rAct.GetLineInfo();
+ const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
+ bool bCreateLineObject(true);
- if(bCreateLineObject)
- {
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_LINE,
- basegfx::B2DPolyPolygon(aLine));
- mnLineWidth = nNewLineWidth;
- maLineJoin = rLineInfo.GetLineJoin();
- maLineCap = rLineInfo.GetLineCap();
- maDash = XDash(css::drawing::DashStyle_RECT,
- rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
- rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
- rLineInfo.GetDistance());
- SetAttributes(pPath);
- mnLineWidth = 0;
- maLineJoin = basegfx::B2DLineJoin::NONE;
- maDash = XDash();
- InsertObj(pPath, false);
- }
+ if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine))
+ {
+ bCreateLineObject = false;
}
+
+ if(!bCreateLineObject)
+ return;
+
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aLine));
+ mnLineWidth = nNewLineWidth;
+ maLineJoin = rLineInfo.GetLineJoin();
+ maLineCap = rLineInfo.GetLineCap();
+ maDash = XDash(css::drawing::DashStyle_RECT,
+ rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
+ rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
+ rLineInfo.GetDistance());
+ SetAttributes(pPath);
+ mnLineWidth = 0;
+ maLineJoin = basegfx::B2DLineJoin::NONE;
+ maDash = XDash();
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction const & rAct)
@@ -883,21 +883,21 @@ bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPo
void ImpSdrGDIMetaFileImport::checkClip()
{
- if(mpVD->IsClipRegion())
- {
- maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
+ if(!mpVD->IsClipRegion())
+ return;
- if(isClip())
- {
- const basegfx::B2DHomMatrix aTransform(
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- mfScaleX,
- mfScaleY,
- maOfs.X(),
- maOfs.Y()));
-
- maClip.transform(aTransform);
- }
+ maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
+
+ if(isClip())
+ {
+ const basegfx::B2DHomMatrix aTransform(
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ mfScaleX,
+ mfScaleY,
+ maOfs.X(),
+ maOfs.Y()));
+
+ maClip.transform(aTransform);
}
}
@@ -930,25 +930,25 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction const & rAct )
bCreateLineObject = false;
}
- if(bCreateLineObject)
- {
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
- basegfx::B2DPolyPolygon(aSource));
- mnLineWidth = nNewLineWidth;
- maLineJoin = rLineInfo.GetLineJoin();
- maLineCap = rLineInfo.GetLineCap();
- maDash = XDash(css::drawing::DashStyle_RECT,
- rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
- rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
- rLineInfo.GetDistance());
- SetAttributes(pPath);
- mnLineWidth = 0;
- maLineJoin = basegfx::B2DLineJoin::NONE;
- maDash = XDash();
- InsertObj(pPath, false);
- }
+ if(!bCreateLineObject)
+ return;
+
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ basegfx::B2DPolyPolygon(aSource));
+ mnLineWidth = nNewLineWidth;
+ maLineJoin = rLineInfo.GetLineJoin();
+ maLineCap = rLineInfo.GetLineCap();
+ maDash = XDash(css::drawing::DashStyle_RECT,
+ rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
+ rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
+ rLineInfo.GetDistance());
+ SetAttributes(pPath);
+ mnLineWidth = 0;
+ maLineJoin = basegfx::B2DLineJoin::NONE;
+ maDash = XDash();
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction const & rAct )
@@ -956,22 +956,22 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction const & rAct )
// #i73407# reformulation to use new B2DPolygon classes
basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
- {
- // #i73407# make sure polygon is closed, it's a filled primitive
- aSource.setClosed(true);
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- basegfx::B2DPolyPolygon(aSource));
- SetAttributes(pPath);
- InsertObj(pPath, false);
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
+ {
+ // #i73407# make sure polygon is closed, it's a filled primitive
+ aSource.setClosed(true);
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ basegfx::B2DPolyPolygon(aSource));
+ SetAttributes(pPath);
+ InsertObj(pPath, false);
}
}
@@ -980,22 +980,22 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction const & rAct)
// #i73407# reformulation to use new B2DPolygon classes
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
- {
- // #i73407# make sure polygon is closed, it's a filled primitive
- aSource.setClosed(true);
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- SetAttributes(pPath);
- InsertObj(pPath, false);
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
+ {
+ // #i73407# make sure polygon is closed, it's a filled primitive
+ aSource.setClosed(true);
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ SetAttributes(pPath);
+ InsertObj(pPath, false);
}
}
@@ -1152,51 +1152,51 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction const & rAct )
// #i73407# reformulation to use new B2DPolygon classes
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
- {
- const Hatch& rHatch = rAct.GetHatch();
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
- SfxItemSet aHatchAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
- css::drawing::HatchStyle eStyle;
-
- switch(rHatch.GetStyle())
- {
- case HatchStyle::Triple :
- {
- eStyle = css::drawing::HatchStyle_TRIPLE;
- break;
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
- case HatchStyle::Double :
- {
- eStyle = css::drawing::HatchStyle_DOUBLE;
- break;
- }
+ if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(aSource))
+ return;
- default:
- {
- eStyle = css::drawing::HatchStyle_SINGLE;
- break;
- }
- }
+ const Hatch& rHatch = rAct.GetHatch();
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
+ SfxItemSet aHatchAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
+ css::drawing::HatchStyle eStyle;
- SetAttributes(pPath);
- aHatchAttr.Put(XFillStyleItem(drawing::FillStyle_HATCH));
- aHatchAttr.Put(XFillHatchItem(XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
- pPath->SetMergedItemSet(aHatchAttr);
+ switch(rHatch.GetStyle())
+ {
+ case HatchStyle::Triple :
+ {
+ eStyle = css::drawing::HatchStyle_TRIPLE;
+ break;
+ }
+
+ case HatchStyle::Double :
+ {
+ eStyle = css::drawing::HatchStyle_DOUBLE;
+ break;
+ }
- InsertObj(pPath, false);
+ default:
+ {
+ eStyle = css::drawing::HatchStyle_SINGLE;
+ break;
}
}
+
+ SetAttributes(pPath);
+ aHatchAttr.Put(XFillStyleItem(drawing::FillStyle_HATCH));
+ aHatchAttr.Put(XFillHatchItem(XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
+ pPath->SetMergedItemSet(aHatchAttr);
+
+ InsertObj(pPath, false);
}
@@ -1479,62 +1479,62 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction const & rAct)
{
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
- aSource.setClosed(true);
+ if(!aSource.count())
+ return;
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- SetAttributes(pPath);
- pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence()));
- InsertObj(pPath, false);
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+ aSource.setClosed(true);
+
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ SetAttributes(pPath);
+ pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence()));
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction const & rAct)
{
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
- {
- const Gradient& rGradient = rAct.GetGradient();
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
- SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
- const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
- const XFillGradientItem aXFillGradientItem(
- XGradient(
- rGradient.GetStartColor(),
- rGradient.GetEndColor(),
- aXGradientStyle,
- rGradient.GetAngle(),
- rGradient.GetOfsX(),
- rGradient.GetOfsY(),
- rGradient.GetBorder(),
- rGradient.GetStartIntensity(),
- rGradient.GetEndIntensity(),
- rGradient.GetSteps()));
-
- SetAttributes(pPath);
- aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
- aGradientAttr.Put(aXFillGradientItem);
- pPath->SetMergedItemSet(aGradientAttr);
-
- InsertObj(pPath, false);
- }
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(aSource))
+ return;
+
+ const Gradient& rGradient = rAct.GetGradient();
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
+ SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
+ const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
+ const XFillGradientItem aXFillGradientItem(
+ XGradient(
+ rGradient.GetStartColor(),
+ rGradient.GetEndColor(),
+ aXGradientStyle,
+ rGradient.GetAngle(),
+ rGradient.GetOfsX(),
+ rGradient.GetOfsY(),
+ rGradient.GetBorder(),
+ rGradient.GetStartIntensity(),
+ rGradient.GetEndIntensity(),
+ rGradient.GetSteps()));
+
+ SetAttributes(pPath);
+ aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
+ aGradientAttr.Put(aXFillGradientItem);
+ pPath->SetMergedItemSet(aGradientAttr);
+
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
@@ -1609,41 +1609,41 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
bHasNewMask = true;
}
- if(bCreateObject)
+ if(!bCreateObject)
+ return;
+
+ if(bHasNewMask || bFixedTransparence)
{
- if(bHasNewMask || bFixedTransparence)
+ if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent())
{
- if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent())
+ // no transparence yet, apply new one
+ if(bFixedTransparence)
{
- // no transparence yet, apply new one
- if(bFixedTransparence)
- {
- sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
-
- aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
- }
+ sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
- aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
+ aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
}
- else
- {
- vcl::bitmap::DrawAlphaBitmapAndAlphaGradient(aBitmapEx, bFixedTransparence, fTransparence, aNewMask);
- }
- }
- // create and add object
- SdrGrafObj* pGraf = new SdrGrafObj(
- *mpModel,
- aBitmapEx,
- aRect);
-
- // for MetaFloatTransparentAction, do not use SetAttributes(...)
- // since these metafile content is not used to draw line/fill
- // dependent of these setting at the device content
- pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
- pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
- InsertObj(pGraf);
+ aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
+ }
+ else
+ {
+ vcl::bitmap::DrawAlphaBitmapAndAlphaGradient(aBitmapEx, bFixedTransparence, fTransparence, aNewMask);
+ }
}
+
+ // create and add object
+ SdrGrafObj* pGraf = new SdrGrafObj(
+ *mpModel,
+ aBitmapEx,
+ aRect);
+
+ // for MetaFloatTransparentAction, do not use SetAttributes(...)
+ // since these metafile content is not used to draw line/fill
+ // dependent of these setting at the device content
+ pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
+ pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
+ InsertObj(pGraf);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index 444517a97ca3..5f81d38575ab 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -169,23 +169,24 @@ static void ImpGetAlign(SdrGluePoint & rGP, const SdrObject* /*pObj*/, const voi
SdrAlign& nRet=*const_cast<SdrAlign *>(static_cast<SdrAlign const *>(pnRet));
bool& bDontCare=*const_cast<bool *>(static_cast<bool const *>(pbDontCare));
bool bVert=*static_cast<bool const *>(pbVert);
- if (!bDontCare) {
- SdrAlign nAlg=SdrAlign::NONE;
+ if (bDontCare)
+ return;
+
+ SdrAlign nAlg=SdrAlign::NONE;
+ if (bVert) {
+ nAlg=rGP.GetVertAlign();
+ } else {
+ nAlg=rGP.GetHorzAlign();
+ }
+ bool& bFirst=*const_cast<bool *>(static_cast<bool const *>(pbFirst));
+ if (bFirst) { nRet=nAlg; bFirst=false; }
+ else if (nRet!=nAlg) {
if (bVert) {
- nAlg=rGP.GetVertAlign();
+ nRet=SdrAlign::VERT_DONTCARE;
} else {
- nAlg=rGP.GetHorzAlign();
- }
- bool& bFirst=*const_cast<bool *>(static_cast<bool const *>(pbFirst));
- if (bFirst) { nRet=nAlg; bFirst=false; }
- else if (nRet!=nAlg) {
- if (bVert) {
- nRet=SdrAlign::VERT_DONTCARE;
- } else {
- nRet=SdrAlign::HORZ_DONTCARE;
- }
- bDontCare=true;
+ nRet=SdrAlign::HORZ_DONTCARE;
}
+ bDontCare=true;
}
}
diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
index 784b3d8bfdc2..a662b99bfe0b 100644
--- a/svx/source/svdraw/svdglue.cxx
+++ b/svx/source/svdraw/svdglue.cxx
@@ -28,20 +28,20 @@ const Size aGlueHalfSize(4,4);
void SdrGluePoint::SetReallyAbsolute(bool bOn, const SdrObject& rObj)
{
- if ( bReallyAbsolute != bOn )
- {
- if ( bOn )
- {
- aPos=GetAbsolutePos(rObj);
- bReallyAbsolute=bOn;
- }
- else
- {
- bReallyAbsolute=bOn;
- Point aPt(aPos);
- SetAbsolutePos(aPt,rObj);
- }
- }
+ if ( bReallyAbsolute == bOn )
+ return;
+
+ if ( bOn )
+ {
+ aPos=GetAbsolutePos(rObj);
+ bReallyAbsolute=bOn;
+ }
+ else
+ {
+ bReallyAbsolute=bOn;
+ Point aPt(aPos);
+ SetAbsolutePos(aPt,rObj);
+ }
}
Point SdrGluePoint::GetAbsolutePos(const SdrObject& rObj) const
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index fab9f7b03d73..bbd2926d36ab 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -404,223 +404,223 @@ void SdrHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
+ if(!pHdlList || !pHdlList->GetView() || pHdlList->GetView()->areMarkHandlesHidden())
+ return;
+
+ BitmapColorIndex eColIndex = BitmapColorIndex::LightGreen;
+ BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+
+ bool bRot = pHdlList->IsRotateShear();
+ if(pObj)
+ eColIndex = bSelect ? BitmapColorIndex::Cyan : BitmapColorIndex::LightCyan;
+ if(bRot)
{
- BitmapColorIndex eColIndex = BitmapColorIndex::LightGreen;
- BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+ // red rotation handles
+ if(pObj && bSelect)
+ eColIndex = BitmapColorIndex::Red;
+ else
+ eColIndex = BitmapColorIndex::LightRed;
+ }
- bool bRot = pHdlList->IsRotateShear();
- if(pObj)
- eColIndex = bSelect ? BitmapColorIndex::Cyan : BitmapColorIndex::LightCyan;
- if(bRot)
+ switch(eKind)
+ {
+ case SdrHdlKind::Move:
{
- // red rotation handles
- if(pObj && bSelect)
- eColIndex = BitmapColorIndex::Red;
- else
- eColIndex = BitmapColorIndex::LightRed;
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
+ break;
}
-
- switch(eKind)
+ case SdrHdlKind::UpperLeft:
+ case SdrHdlKind::UpperRight:
+ case SdrHdlKind::LowerLeft:
+ case SdrHdlKind::LowerRight:
{
- case SdrHdlKind::Move:
- {
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
- break;
- }
- case SdrHdlKind::UpperLeft:
- case SdrHdlKind::UpperRight:
- case SdrHdlKind::LowerLeft:
- case SdrHdlKind::LowerRight:
- {
- // corner handles
- if(bRot)
- {
- eKindOfMarker = BitmapMarkerKind::Circ_7x7;
- }
- else
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::Upper:
- case SdrHdlKind::Lower:
- {
- // Upper/Lower handles
- if(bRot)
- {
- eKindOfMarker = BitmapMarkerKind::Elli_9x7;
- }
- else
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::Left:
- case SdrHdlKind::Right:
- {
- // Left/Right handles
- if(bRot)
- {
- eKindOfMarker = BitmapMarkerKind::Elli_7x9;
- }
- else
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::Poly:
- {
- if(bRot)
- {
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Circ_9x9 : BitmapMarkerKind::Circ_7x7;
- }
- else
- {
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::BezierWeight: // weight at poly
+ // corner handles
+ if(bRot)
{
eKindOfMarker = BitmapMarkerKind::Circ_7x7;
- break;
}
- case SdrHdlKind::Circle:
+ else
{
- eKindOfMarker = BitmapMarkerKind::Rect_11x11;
- break;
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
}
- case SdrHdlKind::Ref1:
- case SdrHdlKind::Ref2:
+ break;
+ }
+ case SdrHdlKind::Upper:
+ case SdrHdlKind::Lower:
+ {
+ // Upper/Lower handles
+ if(bRot)
{
- eKindOfMarker = BitmapMarkerKind::Crosshair;
- break;
+ eKindOfMarker = BitmapMarkerKind::Elli_9x7;
}
- case SdrHdlKind::Glue:
+ else
{
- eKindOfMarker = BitmapMarkerKind::Glue;
- break;
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
}
- case SdrHdlKind::Anchor:
+ break;
+ }
+ case SdrHdlKind::Left:
+ case SdrHdlKind::Right:
+ {
+ // Left/Right handles
+ if(bRot)
{
- eKindOfMarker = BitmapMarkerKind::Anchor;
- break;
+ eKindOfMarker = BitmapMarkerKind::Elli_7x9;
}
- case SdrHdlKind::User:
+ else
{
- break;
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
}
- // top right anchor for SW
- case SdrHdlKind::Anchor_TR:
+ break;
+ }
+ case SdrHdlKind::Poly:
+ {
+ if(bRot)
{
- eKindOfMarker = BitmapMarkerKind::AnchorTR;
- break;
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Circ_9x9 : BitmapMarkerKind::Circ_7x7;
}
-
- // for SJ and the CustomShapeHandles:
- case SdrHdlKind::CustomShape1:
+ else
{
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Customshape_9x9 : BitmapMarkerKind::Customshape_7x7;
- eColIndex = BitmapColorIndex::Yellow;
- break;
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
}
- default:
- break;
+ break;
+ }
+ case SdrHdlKind::BezierWeight: // weight at poly
+ {
+ eKindOfMarker = BitmapMarkerKind::Circ_7x7;
+ break;
+ }
+ case SdrHdlKind::Circle:
+ {
+ eKindOfMarker = BitmapMarkerKind::Rect_11x11;
+ break;
+ }
+ case SdrHdlKind::Ref1:
+ case SdrHdlKind::Ref2:
+ {
+ eKindOfMarker = BitmapMarkerKind::Crosshair;
+ break;
}
+ case SdrHdlKind::Glue:
+ {
+ eKindOfMarker = BitmapMarkerKind::Glue;
+ break;
+ }
+ case SdrHdlKind::Anchor:
+ {
+ eKindOfMarker = BitmapMarkerKind::Anchor;
+ break;
+ }
+ case SdrHdlKind::User:
+ {
+ break;
+ }
+ // top right anchor for SW
+ case SdrHdlKind::Anchor_TR:
+ {
+ eKindOfMarker = BitmapMarkerKind::AnchorTR;
+ break;
+ }
+
+ // for SJ and the CustomShapeHandles:
+ case SdrHdlKind::CustomShape1:
+ {
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Customshape_9x9 : BitmapMarkerKind::Customshape_7x7;
+ eColIndex = BitmapColorIndex::Yellow;
+ break;
+ }
+ default:
+ break;
+ }
+
+ SdrMarkView* pView = pHdlList->GetView();
+ SdrPageView* pPageView = pView->GetSdrPageView();
- SdrMarkView* pView = pHdlList->GetView();
- SdrPageView* pPageView = pView->GetSdrPageView();
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pPageView)
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ Point aMoveOutsideOffset(0, 0);
+ OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
+
+ // add offset if necessary
+ if(pHdlList->IsMoveOutside() || mbMoveOutside)
{
- // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
+
+ if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Upper || eKind == SdrHdlKind::UpperRight)
+ aMoveOutsideOffset.AdjustY( -(aOffset.Width()) );
+ if(eKind == SdrHdlKind::LowerLeft || eKind == SdrHdlKind::Lower || eKind == SdrHdlKind::LowerRight)
+ aMoveOutsideOffset.AdjustY(aOffset.Height() );
+ if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Left || eKind == SdrHdlKind::LowerLeft)
+ aMoveOutsideOffset.AdjustX( -(aOffset.Width()) );
+ if(eKind == SdrHdlKind::UpperRight || eKind == SdrHdlKind::Right || eKind == SdrHdlKind::LowerRight)
+ aMoveOutsideOffset.AdjustX(aOffset.Height() );
+ }
- if(rPageWindow.GetPaintWindow().OutputToWindow())
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject;
+ if (getenv ("SVX_DRAW_HANDLES") && (eKindOfMarker == BitmapMarkerKind::Rect_7x7 || eKindOfMarker == BitmapMarkerKind::Rect_9x9 || eKindOfMarker == BitmapMarkerKind::Rect_11x11))
{
- Point aMoveOutsideOffset(0, 0);
- OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
-
- // add offset if necessary
- if(pHdlList->IsMoveOutside() || mbMoveOutside)
+ double fSize = 7.0;
+ switch (eKindOfMarker)
{
- Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
-
- if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Upper || eKind == SdrHdlKind::UpperRight)
- aMoveOutsideOffset.AdjustY( -(aOffset.Width()) );
- if(eKind == SdrHdlKind::LowerLeft || eKind == SdrHdlKind::Lower || eKind == SdrHdlKind::LowerRight)
- aMoveOutsideOffset.AdjustY(aOffset.Height() );
- if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Left || eKind == SdrHdlKind::LowerLeft)
- aMoveOutsideOffset.AdjustX( -(aOffset.Width()) );
- if(eKind == SdrHdlKind::UpperRight || eKind == SdrHdlKind::Right || eKind == SdrHdlKind::LowerRight)
- aMoveOutsideOffset.AdjustX(aOffset.Height() );
+ case BitmapMarkerKind::Rect_9x9:
+ fSize = 9.0;
+ break;
+ case BitmapMarkerKind::Rect_11x11:
+ fSize = 11.0;
+ break;
+ default:
+ break;
}
+ float fScalingFactor = rOutDev.GetDPIScaleFactor();
+ basegfx::B2DSize aB2DSize(fSize * fScalingFactor, fSize * fScalingFactor);
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
+ Color aHandleFillColor(COL_LIGHTGREEN);
+ switch (eColIndex)
{
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject;
- if (getenv ("SVX_DRAW_HANDLES") && (eKindOfMarker == BitmapMarkerKind::Rect_7x7 || eKindOfMarker == BitmapMarkerKind::Rect_9x9 || eKindOfMarker == BitmapMarkerKind::Rect_11x11))
- {
- double fSize = 7.0;
- switch (eKindOfMarker)
- {
- case BitmapMarkerKind::Rect_9x9:
- fSize = 9.0;
- break;
- case BitmapMarkerKind::Rect_11x11:
- fSize = 11.0;
- break;
- default:
- break;
- }
- float fScalingFactor = rOutDev.GetDPIScaleFactor();
- basegfx::B2DSize aB2DSize(fSize * fScalingFactor, fSize * fScalingFactor);
-
- Color aHandleFillColor(COL_LIGHTGREEN);
- switch (eColIndex)
- {
- case BitmapColorIndex::Cyan:
- aHandleFillColor = COL_CYAN;
- break;
- case BitmapColorIndex::LightCyan:
- aHandleFillColor = COL_LIGHTCYAN;
- break;
- case BitmapColorIndex::Red:
- aHandleFillColor = COL_RED;
- break;
- case BitmapColorIndex::LightRed:
- aHandleFillColor = COL_LIGHTRED;
- break;
- case BitmapColorIndex::Yellow:
- aHandleFillColor = COL_YELLOW;
- break;
- default:
- break;
- }
- pNewOverlayObject.reset(new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor));
- }
- else
- {
- pNewOverlayObject = CreateOverlayObject(
- aPosition, eColIndex, eKindOfMarker,
- aMoveOutsideOffset);
- }
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
+ case BitmapColorIndex::Cyan:
+ aHandleFillColor = COL_CYAN;
+ break;
+ case BitmapColorIndex::LightCyan:
+ aHandleFillColor = COL_LIGHTCYAN;
+ break;
+ case BitmapColorIndex::Red:
+ aHandleFillColor = COL_RED;
+ break;
+ case BitmapColorIndex::LightRed:
+ aHandleFillColor = COL_LIGHTRED;
+ break;
+ case BitmapColorIndex::Yellow:
+ aHandleFillColor = COL_YELLOW;
+ break;
+ default:
+ break;
}
+ pNewOverlayObject.reset(new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor));
}
+ else
+ {
+ pNewOverlayObject = CreateOverlayObject(
+ aPosition, eColIndex, eKindOfMarker,
+ aMoveOutsideOffset);
+ }
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1129,43 +1129,43 @@ void SdrHdlColor::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ BitmapEx aBmpCol(CreateColorDropper(aMarkerColor));
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ aBmpCol,
+ static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1
+ ));
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- BitmapEx aBmpCol(CreateColorDropper(aMarkerColor));
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayBitmapEx(
- aPosition,
- aBmpCol,
- static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1
- ));
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1281,78 +1281,78 @@ void SdrHdlGradient::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ // striped line in between
+ basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
+ double fVecLen = aVec.getLength();
+ double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
+ double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
+ aVec.normalize();
+ basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
+ sal_Int32 nMidX = static_cast<sal_Int32>(aPos.X() + aVec.getX() * fLongPercentArrow);
+ sal_Int32 nMidY = static_cast<sal_Int32>(aPos.Y() + aVec.getY() * fLongPercentArrow);
+ Point aMidPoint(nMidX, nMidY);
+
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
+
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayLineStriped(
+ aPosition, aMidPos
+ ));
+
+ pNewOverlayObject->setBaseColor(IsGradient() ? COL_BLACK : COL_BLUE);
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- // striped line in between
- basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
- double fVecLen = aVec.getLength();
- double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
- double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
- aVec.normalize();
- basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
- sal_Int32 nMidX = static_cast<sal_Int32>(aPos.X() + aVec.getX() * fLongPercentArrow);
- sal_Int32 nMidY = static_cast<sal_Int32>(aPos.Y() + aVec.getY() * fLongPercentArrow);
- Point aMidPoint(nMidX, nMidY);
-
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
-
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayLineStriped(
- aPosition, aMidPos
- ));
-
- pNewOverlayObject->setBaseColor(IsGradient() ? COL_BLACK : COL_BLUE);
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
-
- // arrowhead
- Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
- aMidPoint.Y() + static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
- Point aRight(aMidPoint.X() - static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
- aMidPoint.Y() - static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
-
- basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
- basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
- basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
-
- pNewOverlayObject.reset(new
- sdr::overlay::OverlayTriangle(
- aPositionLeft,
- aPosition2,
- aPositionRight,
- IsGradient() ? COL_BLACK : COL_BLUE
- ));
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
+
+ // arrowhead
+ Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
+ aMidPoint.Y() + static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
+ Point aRight(aMidPoint.X() - static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
+ aMidPoint.Y() - static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
+
+ basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
+ basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
+ basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
+
+ pNewOverlayObject.reset(new
+ sdr::overlay::OverlayTriangle(
+ aPositionLeft,
+ aPosition2,
+ aPositionRight,
+ IsGradient() ? COL_BLACK : COL_BLUE
+ ));
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1443,45 +1443,45 @@ void SdrHdlLine::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
+ basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
- basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
-
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayLineStriped(
- aPosition1,
- aPosition2
- ));
-
- // color(?)
- pNewOverlayObject->setBaseColor(COL_LIGHTRED);
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayLineStriped(
+ aPosition1,
+ aPosition2
+ ));
+
+ // color(?)
+ pNewOverlayObject->setBaseColor(COL_LIGHTRED);
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1501,50 +1501,50 @@ void SdrHdlBezWgt::CreateB2dIAObject()
SdrHdl::CreateB2dIAObject();
// create lines
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
- basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
+ basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
+ basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
- if(!aPosition1.equal(aPosition2))
- {
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayLineStriped(
- aPosition1,
- aPosition2
- ));
+ if(!aPosition1.equal(aPosition2))
+ {
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayLineStriped(
+ aPosition1,
+ aPosition2
+ ));
- // line part is not hittable
- pNewOverlayObject->setHittable(false);
+ // line part is not hittable
+ pNewOverlayObject->setHittable(false);
- // color(?)
- pNewOverlayObject->setBaseColor(COL_LIGHTBLUE);
+ // color(?)
+ pNewOverlayObject->setBaseColor(COL_LIGHTBLUE);
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1560,39 +1560,39 @@ E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
void E3dVolumeMarker::CreateB2dIAObject()
{
// create lines
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is() && aWireframePoly.count())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is() && aWireframePoly.count())
- {
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayPolyPolygonStripedAndFilled(
- aWireframePoly));
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayPolyPolygonStripedAndFilled(
+ aWireframePoly));
- pNewOverlayObject->setBaseColor(COL_BLACK);
+ pNewOverlayObject->setBaseColor(COL_BLACK);
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1726,52 +1726,52 @@ void ImpMeasureHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan;
+ BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_9x9;
+
+ if(nObjHdlNum > 1)
{
- SdrMarkView* pView = pHdlList->GetView();
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+ }
- if(pView && !pView->areMarkHandlesHidden())
- {
- BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan;
- BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_9x9;
+ if(bSelect)
+ {
+ eColIndex = BitmapColorIndex::Cyan;
+ }
- if(nObjHdlNum > 1)
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
+ SdrPageView* pPageView = pView->GetSdrPageView();
- if(bSelect)
- {
- eColIndex = BitmapColorIndex::Cyan;
- }
+ if(!pPageView)
+ return;
- SdrPageView* pPageView = pView->GetSdrPageView();
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pPageView)
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject(
+ aPosition,
+ eColIndex,
+ eKindOfMarker));
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject(
- aPosition,
- eColIndex,
- eKindOfMarker));
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1800,51 +1800,51 @@ void ImpTextframeHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
+ const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
+ const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+
+ std::unique_ptr<sdr::overlay::OverlayRectangle> pNewOverlayObject(new sdr::overlay::OverlayRectangle(
+ aTopLeft,
+ aBottomRight,
+ aHilightColor,
+ fTransparence,
+ 3.0,
+ 3.0,
+ nRotationAngle * -F_PI18000,
+ true)); // allow animation; the Handle is not shown at text edit time
+
+ pNewOverlayObject->setHittable(false);
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
- const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
- const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
-
- std::unique_ptr<sdr::overlay::OverlayRectangle> pNewOverlayObject(new sdr::overlay::OverlayRectangle(
- aTopLeft,
- aBottomRight,
- aHilightColor,
- fTransparence,
- 3.0,
- 3.0,
- nRotationAngle * -F_PI18000,
- true)); // allow animation; the Handle is not shown at text edit time
-
- pNewOverlayObject->setHittable(false);
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -2138,26 +2138,26 @@ SdrHdl* SdrHdlList::GetFocusHdl() const
void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
{
- if(pNew)
- {
- SdrHdl* pActual = GetFocusHdl();
+ if(!pNew)
+ return;
- if(!pActual || pActual != pNew)
- {
- const size_t nNewHdlNum = GetHdlNum(pNew);
+ SdrHdl* pActual = GetFocusHdl();
- if(nNewHdlNum != SAL_MAX_SIZE)
- {
- mnFocusIndex = nNewHdlNum;
+ if(pActual && pActual == pNew)
+ return;
- if(pActual)
- {
- pActual->Touch();
- }
+ const size_t nNewHdlNum = GetHdlNum(pNew);
- pNew->Touch();
- }
+ if(nNewHdlNum != SAL_MAX_SIZE)
+ {
+ mnFocusIndex = nNewHdlNum;
+
+ if(pActual)
+ {
+ pActual->Touch();
}
+
+ pNew->Touch();
}
}
@@ -2264,18 +2264,17 @@ void SdrHdlList::Sort()
// get now and compare
SdrHdl* pNow = GetFocusHdl();
- if(pPrev != pNow)
- {
+ if(pPrev == pNow)
+ return;
- if(pPrev)
- {
- pPrev->Touch();
- }
+ if(pPrev)
+ {
+ pPrev->Touch();
+ }
- if(pNow)
- {
- pNow->Touch();
- }
+ if(pNow)
+ {
+ pNow->Touch();
}
}
@@ -2395,68 +2394,68 @@ void SdrCropHdl::CreateB2dIAObject()
SdrMarkView* pView = pHdlList ? pHdlList->GetView() : nullptr;
SdrPageView* pPageView = pView ? pView->GetSdrPageView() : nullptr;
- if( pPageView && !pView->areMarkHandlesHidden() )
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- int nHdlSize = pHdlList->GetHdlSize();
+ if( !(pPageView && !pView->areMarkHandlesHidden()) )
+ return;
- const BitmapEx aHandlesBitmap(SIP_SA_CROP_MARKERS);
- BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ int nHdlSize = pHdlList->GetHdlSize();
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ const BitmapEx aHandlesBitmap(SIP_SA_CROP_MARKERS);
+ BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- // animate focused handles
- if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
- {
- if( nHdlSize >= 2 )
- nHdlSize = 1;
-
- BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
-
- const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
-
- pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(
- aPosition,
- aBmpEx1,
- aBmpEx2,
- nBlinkTime,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
- mfShearX,
- mfRotation));
- }
- else
- {
- // create centered handle as default
- pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx(
- aPosition,
- aBmpEx1,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- 0.0,
- mfShearX,
- mfRotation));
- }
+ std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
+ // animate focused handles
+ if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
+ {
+ if( nHdlSize >= 2 )
+ nHdlSize = 1;
+
+ BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
+
+ const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
+
+ pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(
+ aPosition,
+ aBmpEx1,
+ aBmpEx2,
+ nBlinkTime,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
+ mfShearX,
+ mfRotation));
+ }
+ else
+ {
+ // create centered handle as default
+ pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ aBmpEx1,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ 0.0,
+ mfShearX,
+ mfRotation));
}
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx
index d70b221ba626..c9ca7041f261 100644
--- a/svx/source/svdraw/svdlayer.cxx
+++ b/svx/source/svdraw/svdlayer.cxx
@@ -46,22 +46,22 @@ void SdrLayerIDSet::operator&=(const SdrLayerIDSet& r2ndSet)
void SdrLayerIDSet::PutValue( const css::uno::Any & rAny )
{
css::uno::Sequence< sal_Int8 > aSeq;
- if( rAny >>= aSeq )
- {
- sal_Int16 nCount = static_cast<sal_Int16>(aSeq.getLength());
- if( nCount > 32 )
- nCount = 32;
+ if( !(rAny >>= aSeq) )
+ return;
- sal_Int16 nIndex;
- for( nIndex = 0; nIndex < nCount; nIndex++ )
- {
- aData[nIndex] = static_cast<sal_uInt8>(aSeq[nIndex]);
- }
+ sal_Int16 nCount = static_cast<sal_Int16>(aSeq.getLength());
+ if( nCount > 32 )
+ nCount = 32;
- for( ; nIndex < 32; nIndex++ )
- {
- aData[nIndex] = 0;
- }
+ sal_Int16 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aData[nIndex] = static_cast<sal_uInt8>(aSeq[nIndex]);
+ }
+
+ for( ; nIndex < 32; nIndex++ )
+ {
+ aData[nIndex] = 0;
}
}
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 3b5988974d18..866de4920c15 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -148,51 +148,51 @@ void SdrMarkList::ForceSort() const
void SdrMarkList::ImpForceSort()
{
- if(!mbSorted)
+ if(mbSorted)
+ return;
+
+ mbSorted = true;
+ size_t nCount = maList.size();
+
+ // remove invalid
+ if(nCount > 0 )
{
- mbSorted = true;
- size_t nCount = maList.size();
+ maList.erase(std::remove_if(maList.begin(), maList.end(),
+ [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; }),
+ maList.end());
+ nCount = maList.size();
+ }
- // remove invalid
- if(nCount > 0 )
- {
- maList.erase(std::remove_if(maList.begin(), maList.end(),
- [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; }),
- maList.end());
- nCount = maList.size();
- }
+ if(nCount <= 1)
+ return;
- if(nCount > 1)
- {
- std::sort(maList.begin(), maList.end(), ImpSdrMarkListSorter);
+ std::sort(maList.begin(), maList.end(), ImpSdrMarkListSorter);
- // remove duplicates
- if(maList.size() > 1)
- {
- SdrMark* pCurrent = maList.back().get();
- for (size_t count = maList.size() - 1; count; --count)
- {
- size_t i = count - 1;
- SdrMark* pCmp = maList[i].get();
- assert(pCurrent->GetMarkedSdrObj());
- if(pCurrent->GetMarkedSdrObj() == pCmp->GetMarkedSdrObj())
- {
- // Con1/Con2 Merging
- if(pCmp->IsCon1())
- pCurrent->SetCon1(true);
+ // remove duplicates
+ if(maList.size() <= 1)
+ return;
- if(pCmp->IsCon2())
- pCurrent->SetCon2(true);
+ SdrMark* pCurrent = maList.back().get();
+ for (size_t count = maList.size() - 1; count; --count)
+ {
+ size_t i = count - 1;
+ SdrMark* pCmp = maList[i].get();
+ assert(pCurrent->GetMarkedSdrObj());
+ if(pCurrent->GetMarkedSdrObj() == pCmp->GetMarkedSdrObj())
+ {
+ // Con1/Con2 Merging
+ if(pCmp->IsCon1())
+ pCurrent->SetCon1(true);
- // delete pCmp
- maList.erase(maList.begin() + i);
- }
- else
- {
- pCurrent = pCmp;
- }
- }
- }
+ if(pCmp->IsCon2())
+ pCurrent->SetCon2(true);
+
+ // delete pCmp
+ maList.erase(maList.begin() + i);
+ }
+ else
+ {
+ pCurrent = pCmp;
}
}
}
@@ -694,96 +694,96 @@ namespace sdr
void ViewSelection::ImplCollectCompleteSelection(SdrObject* pObj)
{
- if(pObj)
+ if(!pObj)
+ return;
+
+ bool bIsGroup(pObj->IsGroupObject());
+
+ if(bIsGroup && dynamic_cast< const E3dObject* >(pObj) != nullptr && dynamic_cast< const E3dScene* >(pObj) == nullptr)
{
- bool bIsGroup(pObj->IsGroupObject());
+ bIsGroup = false;
+ }
- if(bIsGroup && dynamic_cast< const E3dObject* >(pObj) != nullptr && dynamic_cast< const E3dScene* >(pObj) == nullptr)
- {
- bIsGroup = false;
- }
+ if(bIsGroup)
+ {
+ SdrObjList* pList = pObj->GetSubList();
- if(bIsGroup)
+ for(size_t a = 0; a < pList->GetObjCount(); ++a)
{
- SdrObjList* pList = pObj->GetSubList();
-
- for(size_t a = 0; a < pList->GetObjCount(); ++a)
- {
- SdrObject* pObj2 = pList->GetObj(a);
- ImplCollectCompleteSelection(pObj2);
- }
+ SdrObject* pObj2 = pList->GetObj(a);
+ ImplCollectCompleteSelection(pObj2);
}
-
- maAllMarkedObjects.push_back(pObj);
}
+
+ maAllMarkedObjects.push_back(pObj);
}
void ViewSelection::ImpForceEdgesOfMarkedNodes()
{
- if(mbEdgesOfMarkedNodesDirty)
- {
- mbEdgesOfMarkedNodesDirty = false;
- maMarkedObjectList.ForceSort();
- maEdgesOfMarkedNodes.Clear();
- maMarkedEdgesOfMarkedNodes.Clear();
- maAllMarkedObjects.clear();
+ if(!mbEdgesOfMarkedNodesDirty)
+ return;
+
+ mbEdgesOfMarkedNodesDirty = false;
+ maMarkedObjectList.ForceSort();
+ maEdgesOfMarkedNodes.Clear();
+ maMarkedEdgesOfMarkedNodes.Clear();
+ maAllMarkedObjects.clear();
- // GetMarkCount after ForceSort
- const size_t nMarkCount(maMarkedObjectList.GetMarkCount());
+ // GetMarkCount after ForceSort
+ const size_t nMarkCount(maMarkedObjectList.GetMarkCount());
- for(size_t a = 0; a < nMarkCount; ++a)
+ for(size_t a = 0; a < nMarkCount; ++a)
+ {
+ SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
+
+ if(pCandidate)
{
- SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
+ // build transitive hull
+ ImplCollectCompleteSelection(pCandidate);
- if(pCandidate)
- {
- // build transitive hull
- ImplCollectCompleteSelection(pCandidate);
+ // travel over broadcaster/listener to access edges connected to the selected object
+ const SfxBroadcaster* pBC = pCandidate->GetBroadcaster();
- // travel over broadcaster/listener to access edges connected to the selected object
- const SfxBroadcaster* pBC = pCandidate->GetBroadcaster();
+ if(pBC)
+ {
+ const size_t nLstCnt(pBC->GetSizeOfVector());
- if(pBC)
+ for(size_t nl=0; nl < nLstCnt; ++nl)
{
- const size_t nLstCnt(pBC->GetSizeOfVector());
+ SfxListener* pLst = pBC->GetListener(nl);
+ SdrEdgeObj* pEdge = dynamic_cast<SdrEdgeObj*>( pLst );
- for(size_t nl=0; nl < nLstCnt; ++nl)
+ if(pEdge && pEdge->IsInserted() && pEdge->getSdrPageFromSdrObject() == pCandidate->getSdrPageFromSdrObject())
{
- SfxListener* pLst = pBC->GetListener(nl);
- SdrEdgeObj* pEdge = dynamic_cast<SdrEdgeObj*>( pLst );
+ SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
- if(pEdge && pEdge->IsInserted() && pEdge->getSdrPageFromSdrObject() == pCandidate->getSdrPageFromSdrObject())
+ if(pEdge->GetConnectedNode(true) == pCandidate)
{
- SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
-
- if(pEdge->GetConnectedNode(true) == pCandidate)
- {
- aM.SetCon1(true);
- }
-
- if(pEdge->GetConnectedNode(false) == pCandidate)
- {
- aM.SetCon2(true);
- }
-
- if(SAL_MAX_SIZE == maMarkedObjectList.FindObject(pEdge))
- {
- // check if it itself is selected
- maEdgesOfMarkedNodes.InsertEntry(aM);
- }
- else
- {
- maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
- }
+ aM.SetCon1(true);
+ }
+
+ if(pEdge->GetConnectedNode(false) == pCandidate)
+ {
+ aM.SetCon2(true);
+ }
+
+ if(SAL_MAX_SIZE == maMarkedObjectList.FindObject(pEdge))
+ {
+ // check if it itself is selected
+ maEdgesOfMarkedNodes.InsertEntry(aM);
+ }
+ else
+ {
+ maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
}
}
}
}
}
-
- maEdgesOfMarkedNodes.ForceSort();
- maMarkedEdgesOfMarkedNodes.ForceSort();
}
+
+ maEdgesOfMarkedNodes.ForceSort();
+ maMarkedEdgesOfMarkedNodes.ForceSort();
}
} // end of namespace sdr
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index ccab4da45a4a..c3afe2ccb352 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -388,24 +388,24 @@ void SdrModel::Repeat(SfxRepeatTarget& rView)
void SdrModel::ImpPostUndoAction(std::unique_ptr<SdrUndoAction> pUndo)
{
DBG_ASSERT( mpImpl->mpUndoManager == nullptr, "svx::SdrModel::ImpPostUndoAction(), method not supported with application undo manager!" );
- if( IsUndoEnabled() )
+ if( !IsUndoEnabled() )
+ return;
+
+ if (m_aUndoLink)
{
- if (m_aUndoLink)
- {
- m_aUndoLink(std::move(pUndo));
- }
- else
+ m_aUndoLink(std::move(pUndo));
+ }
+ else
+ {
+ if (!m_pUndoStack)
+ m_pUndoStack.reset(new std::deque<std::unique_ptr<SfxUndoAction>>);
+ m_pUndoStack->emplace_front(std::move(pUndo));
+ while (m_pUndoStack->size()>m_nMaxUndoCount)
{
- if (!m_pUndoStack)
- m_pUndoStack.reset(new std::deque<std::unique_ptr<SfxUndoAction>>);
- m_pUndoStack->emplace_front(std::move(pUndo));
- while (m_pUndoStack->size()>m_nMaxUndoCount)
- {
- m_pUndoStack->pop_back();
- }
- if (m_pRedoStack!=nullptr)
- m_pRedoStack->clear();
+ m_pUndoStack->pop_back();
}
+ if (m_pRedoStack!=nullptr)
+ m_pRedoStack->clear();
}
}
@@ -1730,55 +1730,55 @@ void SdrModel::setLock( bool bLock )
void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModelel )
{
assert(pNewModelel != nullptr);
- if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) )
- {
- SfxWhichIter aWhichIter(*pSourceSet);
- sal_uInt16 nWhich(aWhichIter.FirstWhich());
- const SfxPoolItem *pPoolItem;
+ if( !(pSourceSet && pDestSet && (pSourceSet != pDestSet )) )
+ return;
+
+ SfxWhichIter aWhichIter(*pSourceSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ const SfxPoolItem *pPoolItem;
- while(nWhich)
+ while(nWhich)
+ {
+ if(SfxItemState::SET == pSourceSet->GetItemState(nWhich, false, &pPoolItem))
{
- if(SfxItemState::SET == pSourceSet->GetItemState(nWhich, false, &pPoolItem))
- {
- std::unique_ptr<SfxPoolItem> pResultItem;
+ std::unique_ptr<SfxPoolItem> pResultItem;
- switch( nWhich )
- {
- case XATTR_FILLBITMAP:
- pResultItem = static_cast<const XFillBitmapItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINEDASH:
- pResultItem = static_cast<const XLineDashItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINESTART:
- pResultItem = static_cast<const XLineStartItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINEEND:
- pResultItem = static_cast<const XLineEndItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLGRADIENT:
- pResultItem = static_cast<const XFillGradientItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLFLOATTRANSPARENCE:
- // allow all kinds of XFillFloatTransparenceItem to be set
- pResultItem = static_cast<const XFillFloatTransparenceItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLHATCH:
- pResultItem = static_cast<const XFillHatchItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- }
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ pResultItem = static_cast<const XFillBitmapItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINEDASH:
+ pResultItem = static_cast<const XLineDashItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINESTART:
+ pResultItem = static_cast<const XLineStartItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINEEND:
+ pResultItem = static_cast<const XLineEndItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLGRADIENT:
+ pResultItem = static_cast<const XFillGradientItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLFLOATTRANSPARENCE:
+ // allow all kinds of XFillFloatTransparenceItem to be set
+ pResultItem = static_cast<const XFillFloatTransparenceItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLHATCH:
+ pResultItem = static_cast<const XFillHatchItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ }
- // set item
- if( pResultItem )
- {
- pDestSet->Put(*pResultItem);
- pResultItem.reset();
- }
- else
- pDestSet->Put(*pPoolItem);
+ // set item
+ if( pResultItem )
+ {
+ pDestSet->Put(*pResultItem);
+ pResultItem.reset();
}
- nWhich = aWhichIter.NextWhich();
+ else
+ pDestSet->Put(*pPoolItem);
}
+ nWhich = aWhichIter.NextWhich();
}
}
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index b1472651875c..2c85e8be56c0 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -236,47 +236,47 @@ void SdrMarkView::ModelHasChanged()
AdjustMarkHdl();
}
- if (comphelper::LibreOfficeKit::isActive() && GetMarkedObjectCount() > 0)
+ if (!(comphelper::LibreOfficeKit::isActive() && GetMarkedObjectCount() > 0))
+ return;
+
+ //TODO: Is MarkedObjRect valid at this point?
+ tools::Rectangle aSelection(GetMarkedObjRect());
+ OString sSelection;
+ if (aSelection.IsEmpty())
+ sSelection = "EMPTY";
+ else
{
- //TODO: Is MarkedObjRect valid at this point?
- tools::Rectangle aSelection(GetMarkedObjRect());
- OString sSelection;
- if (aSelection.IsEmpty())
- sSelection = "EMPTY";
- else
+ sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
+ if (nTotalPaintWindows == 1)
{
- sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
- if (nTotalPaintWindows == 1)
+ const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
+ if (pWin && pWin->IsChart())
{
- const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
- if (pWin && pWin->IsChart())
+ const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
+ if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
{
- const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
- if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
- {
- Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
- Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
- aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
- }
+ Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
+ Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
+ aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
}
}
+ }
- // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
- if (mpMarkedPV)
+ // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
+ if (mpMarkedPV)
+ {
+ if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
{
- if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
- {
- if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
- }
+ if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+ aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
}
-
- sSelection = aSelection.toString();
}
- if(SfxViewShell* pViewShell = GetSfxViewShell())
- SfxLokHelper::notifyInvalidation(pViewShell, sSelection);
+ sSelection = aSelection.toString();
}
+
+ if(SfxViewShell* pViewShell = GetSfxViewShell())
+ SfxLokHelper::notifyInvalidation(pViewShell, sSelection);
}
@@ -1257,21 +1257,21 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
AddCustomHdl();
// try to restore focus handle index from remembered values
- if(bSaveOldFocus)
+ if(!bSaveOldFocus)
+ return;
+
+ for(size_t a = 0; a < maHdlList.GetHdlCount(); ++a)
{
- for(size_t a = 0; a < maHdlList.GetHdlCount(); ++a)
- {
- SdrHdl* pCandidate = maHdlList.GetHdl(a);
+ SdrHdl* pCandidate = maHdlList.GetHdl(a);
- if(pCandidate->GetObj()
- && pCandidate->GetObj() == pSaveObj
- && pCandidate->GetKind() == eSaveKind
- && pCandidate->GetPolyNum() == nSavePolyNum
- && pCandidate->GetPointNum() == nSavePointNum)
- {
- maHdlList.SetFocusHdl(pCandidate);
- break;
- }
+ if(pCandidate->GetObj()
+ && pCandidate->GetObj() == pSaveObj
+ && pCandidate->GetKind() == eSaveKind
+ && pCandidate->GetPolyNum() == nSavePolyNum
+ && pCandidate->GetPointNum() == nSavePointNum)
+ {
+ maHdlList.SetFocusHdl(pCandidate);
+ break;
}
}
}
@@ -1661,19 +1661,19 @@ void SdrMarkView::SetFrameHandles(bool bOn)
void SdrMarkView::SetEditMode(SdrViewEditMode eMode)
{
- if (eMode!=meEditMode) {
- bool bGlue0=meEditMode==SdrViewEditMode::GluePointEdit;
- bool bEdge0=static_cast<SdrCreateView*>(this)->IsEdgeTool();
- meEditMode0=meEditMode;
- meEditMode=eMode;
- bool bGlue1=meEditMode==SdrViewEditMode::GluePointEdit;
- bool bEdge1=static_cast<SdrCreateView*>(this)->IsEdgeTool();
- // avoid flickering when switching between GlueEdit and EdgeTool
- if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1);
- if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1);
- if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1);
- if (bGlue0 && !bGlue1) UnmarkAllGluePoints();
- }
+ if (eMode==meEditMode) return;
+
+ bool bGlue0=meEditMode==SdrViewEditMode::GluePointEdit;
+ bool bEdge0=static_cast<SdrCreateView*>(this)->IsEdgeTool();
+ meEditMode0=meEditMode;
+ meEditMode=eMode;
+ bool bGlue1=meEditMode==SdrViewEditMode::GluePointEdit;
+ bool bEdge1=static_cast<SdrCreateView*>(this)->IsEdgeTool();
+ // avoid flickering when switching between GlueEdit and EdgeTool
+ if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1);
+ if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1);
+ if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1);
+ if (bGlue0 && !bGlue1) UnmarkAllGluePoints();
}
@@ -1949,31 +1949,32 @@ void collectUIInformation(const SdrObject* pObj)
}
-void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool bDoNoSetMarkHdl,
+ void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark, bool bDoNoSetMarkHdl,
std::vector<basegfx::B2DRectangle> const & rSubSelections)
{
- if (pObj!=nullptr && pPV!=nullptr && IsObjMarkable(pObj, pPV)) {
- BrkAction();
- if (!bUnmark)
- {
- GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
- collectUIInformation(pObj);
- }
- else
+ if (!(pObj!=nullptr && pPV!=nullptr && IsObjMarkable(pObj, pPV)))
+ return;
+
+ BrkAction();
+ if (!bUnmark)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
+ collectUIInformation(pObj);
+ }
+ else
+ {
+ const size_t nPos=TryToFindMarkedObject(pObj);
+ if (nPos!=SAL_MAX_SIZE)
{
- const size_t nPos=TryToFindMarkedObject(pObj);
- if (nPos!=SAL_MAX_SIZE)
- {
- GetMarkedObjectListWriteAccess().DeleteMark(nPos);
- }
+ GetMarkedObjectListWriteAccess().DeleteMark(nPos);
}
+ }
- maSubSelectionList = rSubSelections;
+ maSubSelectionList = rSubSelections;
- if (!bDoNoSetMarkHdl) {
- MarkListHasChanged();
- AdjustMarkHdl();
- }
+ if (!bDoNoSetMarkHdl) {
+ MarkListHasChanged();
+ AdjustMarkHdl();
}
}
@@ -2341,21 +2342,22 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie
void SdrMarkView::UnmarkAllObj(SdrPageView const * pPV)
{
- if (GetMarkedObjectCount()!=0) {
- BrkAction();
- if (pPV!=nullptr)
- {
- GetMarkedObjectListWriteAccess().DeletePageView(*pPV);
- }
- else
- {
- GetMarkedObjectListWriteAccess().Clear();
- }
- mpMarkedObj=nullptr;
- mpMarkedPV=nullptr;
- MarkListHasChanged();
- AdjustMarkHdl();
+ if (GetMarkedObjectCount()==0)
+ return;
+
+ BrkAction();
+ if (pPV!=nullptr)
+ {
+ GetMarkedObjectListWriteAccess().DeletePageView(*pPV);
+ }
+ else
+ {
+ GetMarkedObjectListWriteAccess().Clear();
}
+ mpMarkedObj=nullptr;
+ mpMarkedPV=nullptr;
+ MarkListHasChanged();
+ AdjustMarkHdl();
}
void SdrMarkView::MarkAllObj(SdrPageView* pPV)
@@ -2459,19 +2461,19 @@ void SdrMarkView::EnterMarkedGroup()
// TODO: I'll have to prevent that via a flag.
SdrPageView* pPV = GetSdrPageView();
- if(pPV)
+ if(!pPV)
+ return;
+
+ bool bEnter=false;
+ for (size_t nm = GetMarkedObjectCount(); nm > 0 && !bEnter;)
{
- bool bEnter=false;
- for (size_t nm = GetMarkedObjectCount(); nm > 0 && !bEnter;)
- {
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- if (pM->GetPageView()==pPV) {
- SdrObject* pObj=pM->GetMarkedSdrObj();
- if (pObj->IsGroupObject()) {
- if (pPV->EnterGroup(pObj)) {
- bEnter=true;
- }
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if (pM->GetPageView()==pPV) {
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj->IsGroupObject()) {
+ if (pPV->EnterGroup(pObj)) {
+ bEnter=true;
}
}
}
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 77c2d2d6ae51..ec4ecdff0165 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1320,45 +1320,45 @@ void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bNoContortion =true;
// #i37011#
- if ( mXRenderedCustomShape.is() )
+ if ( !mXRenderedCustomShape.is() )
+ return;
+
+ const SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
+ if ( !pRenderedCustomShape )
+ return;
+
+ // #i37262#
+ // Iterate self over the contained objects, since there are combinations of
+ // polygon and curve objects. In that case, aInfo.bCanConvToPath and
+ // aInfo.bCanConvToPoly would be false. What is needed here is an or, not an and.
+ SdrObjListIter aIterator(*pRenderedCustomShape);
+ while(aIterator.IsMore())
{
- const SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
- if ( pRenderedCustomShape )
+ SdrObject* pCandidate = aIterator.Next();
+ SdrObjTransformInfoRec aInfo;
+ pCandidate->TakeObjInfo(aInfo);
+
+ // set path and poly conversion if one is possible since
+ // this object will first be broken
+ const bool bCanConvToPathOrPoly(aInfo.bCanConvToPath || aInfo.bCanConvToPoly);
+ if(rInfo.bCanConvToPath != bCanConvToPathOrPoly)
{
- // #i37262#
- // Iterate self over the contained objects, since there are combinations of
- // polygon and curve objects. In that case, aInfo.bCanConvToPath and
- // aInfo.bCanConvToPoly would be false. What is needed here is an or, not an and.
- SdrObjListIter aIterator(*pRenderedCustomShape);
- while(aIterator.IsMore())
- {
- SdrObject* pCandidate = aIterator.Next();
- SdrObjTransformInfoRec aInfo;
- pCandidate->TakeObjInfo(aInfo);
-
- // set path and poly conversion if one is possible since
- // this object will first be broken
- const bool bCanConvToPathOrPoly(aInfo.bCanConvToPath || aInfo.bCanConvToPoly);
- if(rInfo.bCanConvToPath != bCanConvToPathOrPoly)
- {
- rInfo.bCanConvToPath = bCanConvToPathOrPoly;
- }
+ rInfo.bCanConvToPath = bCanConvToPathOrPoly;
+ }
- if(rInfo.bCanConvToPoly != bCanConvToPathOrPoly)
- {
- rInfo.bCanConvToPoly = bCanConvToPathOrPoly;
- }
+ if(rInfo.bCanConvToPoly != bCanConvToPathOrPoly)
+ {
+ rInfo.bCanConvToPoly = bCanConvToPathOrPoly;
+ }
- if(rInfo.bCanConvToContour != aInfo.bCanConvToContour)
- {
- rInfo.bCanConvToContour = aInfo.bCanConvToContour;
- }
+ if(rInfo.bCanConvToContour != aInfo.bCanConvToContour)
+ {
+ rInfo.bCanConvToContour = aInfo.bCanConvToContour;
+ }
- if(rInfo.bShearAllowed != aInfo.bShearAllowed)
- {
- rInfo.bShearAllowed = aInfo.bShearAllowed;
- }
- }
+ if(rInfo.bShearAllowed != aInfo.bShearAllowed)
+ {
+ rInfo.bShearAllowed = aInfo.bShearAllowed;
}
}
}
@@ -1372,44 +1372,44 @@ sal_uInt16 SdrObjCustomShape::GetObjIdentifier() const
// state of the ResizeShapeToFitText flag to correctly set TextMinFrameWidth/Height
void SdrObjCustomShape::AdaptTextMinSize()
{
- if (!getSdrModelFromSdrObject().IsCreatingDataObj() && !getSdrModelFromSdrObject().IsPasteResize())
+ if (getSdrModelFromSdrObject().IsCreatingDataObj() || getSdrModelFromSdrObject().IsPasteResize())
+ return;
+
+ const bool bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue());
+ SfxItemSet aSet(
+ *GetObjectItemSet().GetPool(),
+ svl::Items<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
+ SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH>{}); // contains SDRATTR_TEXT_MAXFRAMEWIDTH
+ bool bChanged(false);
+
+ if(bResizeShapeToFitText)
{
- const bool bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue());
- SfxItemSet aSet(
- *GetObjectItemSet().GetPool(),
- svl::Items<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
- SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH>{}); // contains SDRATTR_TEXT_MAXFRAMEWIDTH
- bool bChanged(false);
+ // always reset MinWidthHeight to zero to only rely on text size and frame size
+ // to allow resizing being completely dependent on text size only
+ aSet.Put(makeSdrTextMinFrameWidthItem(0));
+ aSet.Put(makeSdrTextMinFrameHeightItem(0));
+ bChanged = true;
+ }
+ else
+ {
+ // recreate from CustomShape-specific TextBounds
+ tools::Rectangle aTextBound(maRect);
- if(bResizeShapeToFitText)
- {
- // always reset MinWidthHeight to zero to only rely on text size and frame size
- // to allow resizing being completely dependent on text size only
- aSet.Put(makeSdrTextMinFrameWidthItem(0));
- aSet.Put(makeSdrTextMinFrameHeightItem(0));
- bChanged = true;
- }
- else
+ if(GetTextBounds(aTextBound))
{
- // recreate from CustomShape-specific TextBounds
- tools::Rectangle aTextBound(maRect);
+ const long nHDist(GetTextLeftDistance() + GetTextRightDistance());
+ const long nVDist(GetTextUpperDistance() + GetTextLowerDistance());
+ const long nTWdt(std::max(long(0), static_cast<long>(aTextBound.GetWidth() - 1 - nHDist)));
+ const long nTHgt(std::max(long(0), static_cast<long>(aTextBound.GetHeight() - 1 - nVDist)));
- if(GetTextBounds(aTextBound))
- {
- const long nHDist(GetTextLeftDistance() + GetTextRightDistance());
- const long nVDist(GetTextUpperDistance() + GetTextLowerDistance());
- const long nTWdt(std::max(long(0), static_cast<long>(aTextBound.GetWidth() - 1 - nHDist)));
- const long nTHgt(std::max(long(0), static_cast<long>(aTextBound.GetHeight() - 1 - nVDist)));
-
- aSet.Put(makeSdrTextMinFrameWidthItem(nTWdt));
- aSet.Put(makeSdrTextMinFrameHeightItem(nTHgt));
- bChanged = true;
- }
+ aSet.Put(makeSdrTextMinFrameWidthItem(nTWdt));
+ aSet.Put(makeSdrTextMinFrameHeightItem(nTHgt));
+ bChanged = true;
}
-
- if(bChanged)
- SetObjectItemSet(aSet);
}
+
+ if(bChanged)
+ SetObjectItemSet(aSet);
}
void SdrObjCustomShape::NbcSetSnapRect( const tools::Rectangle& rRect )
@@ -1697,100 +1697,100 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
{
const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
- if(pSdrObject)
+ if(!pSdrObject)
+ return;
+
+ const SdrGluePointList* pSource = pSdrObject->GetGluePointList();
+
+ if(!(pSource && pSource->GetCount()))
+ return;
+
+ if(!SdrTextObj::GetGluePointList())
{
- const SdrGluePointList* pSource = pSdrObject->GetGluePointList();
+ SdrTextObj::ForceGluePointList();
+ }
- if(pSource && pSource->GetCount())
- {
- if(!SdrTextObj::GetGluePointList())
- {
- SdrTextObj::ForceGluePointList();
- }
+ const SdrGluePointList* pList = SdrTextObj::GetGluePointList();
- const SdrGluePointList* pList = SdrTextObj::GetGluePointList();
+ if(!pList)
+ return;
- if(pList)
- {
- SdrGluePointList aNewList;
- sal_uInt16 a;
+ SdrGluePointList aNewList;
+ sal_uInt16 a;
- for(a = 0; a < pSource->GetCount(); a++)
- {
- SdrGluePoint aCopy((*pSource)[a]);
- aCopy.SetUserDefined(false);
- aNewList.Insert(aCopy);
- }
+ for(a = 0; a < pSource->GetCount(); a++)
+ {
+ SdrGluePoint aCopy((*pSource)[a]);
+ aCopy.SetUserDefined(false);
+ aNewList.Insert(aCopy);
+ }
- bool bMirroredX = IsMirroredX();
- bool bMirroredY = IsMirroredY();
+ bool bMirroredX = IsMirroredX();
+ bool bMirroredY = IsMirroredY();
- long nShearAngle = aGeo.nShearAngle;
- double fTan = aGeo.nTan;
+ long nShearAngle = aGeo.nShearAngle;
+ double fTan = aGeo.nTan;
- if ( aGeo.nRotationAngle || nShearAngle || bMirroredX || bMirroredY )
- {
- tools::Polygon aPoly( maRect );
- if( nShearAngle )
- {
- sal_uInt16 nPointCount=aPoly.GetSize();
- for (sal_uInt16 i=0; i<nPointCount; i++)
- ShearPoint(aPoly[i],maRect.Center(), fTan );
- }
- if ( aGeo.nRotationAngle )
- aPoly.Rotate( maRect.Center(), aGeo.nRotationAngle / 10 );
+ if ( aGeo.nRotationAngle || nShearAngle || bMirroredX || bMirroredY )
+ {
+ tools::Polygon aPoly( maRect );
+ if( nShearAngle )
+ {
+ sal_uInt16 nPointCount=aPoly.GetSize();
+ for (sal_uInt16 i=0; i<nPointCount; i++)
+ ShearPoint(aPoly[i],maRect.Center(), fTan );
+ }
+ if ( aGeo.nRotationAngle )
+ aPoly.Rotate( maRect.Center(), aGeo.nRotationAngle / 10 );
- tools::Rectangle aBoundRect( aPoly.GetBoundRect() );
- sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left();
- sal_Int32 nYDiff = aBoundRect.Top() - maRect.Top();
+ tools::Rectangle aBoundRect( aPoly.GetBoundRect() );
+ sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left();
+ sal_Int32 nYDiff = aBoundRect.Top() - maRect.Top();
- if (nShearAngle && bMirroredX != bMirroredY)
- {
- nShearAngle = -nShearAngle;
- fTan = -fTan;
- }
+ if (nShearAngle && bMirroredX != bMirroredY)
+ {
+ nShearAngle = -nShearAngle;
+ fTan = -fTan;
+ }
- Point aRef( maRect.GetWidth() / 2, maRect.GetHeight() / 2 );
- for ( a = 0; a < aNewList.GetCount(); a++ )
- {
- SdrGluePoint& rPoint = aNewList[ a ];
- Point aGlue( rPoint.GetPos() );
- if ( nShearAngle )
- ShearPoint( aGlue, aRef, fTan );
-
- RotatePoint(aGlue, aRef, sin(basegfx::deg2rad(fObjectRotation)),
- cos(basegfx::deg2rad(fObjectRotation)));
- if ( bMirroredX )
- aGlue.setX( maRect.GetWidth() - aGlue.X() );
- if ( bMirroredY )
- aGlue.setY( maRect.GetHeight() - aGlue.Y() );
- aGlue.AdjustX( -nXDiff );
- aGlue.AdjustY( -nYDiff );
- rPoint.SetPos( aGlue );
- }
- }
+ Point aRef( maRect.GetWidth() / 2, maRect.GetHeight() / 2 );
+ for ( a = 0; a < aNewList.GetCount(); a++ )
+ {
+ SdrGluePoint& rPoint = aNewList[ a ];
+ Point aGlue( rPoint.GetPos() );
+ if ( nShearAngle )
+ ShearPoint( aGlue, aRef, fTan );
- for(a = 0; a < pList->GetCount(); a++)
- {
- const SdrGluePoint& rCandidate = (*pList)[a];
+ RotatePoint(aGlue, aRef, sin(basegfx::deg2rad(fObjectRotation)),
+ cos(basegfx::deg2rad(fObjectRotation)));
+ if ( bMirroredX )
+ aGlue.setX( maRect.GetWidth() - aGlue.X() );
+ if ( bMirroredY )
+ aGlue.setY( maRect.GetHeight() - aGlue.Y() );
+ aGlue.AdjustX( -nXDiff );
+ aGlue.AdjustY( -nYDiff );
+ rPoint.SetPos( aGlue );
+ }
+ }
- if(rCandidate.IsUserDefined())
- {
- aNewList.Insert(rCandidate);
- }
- }
+ for(a = 0; a < pList->GetCount(); a++)
+ {
+ const SdrGluePoint& rCandidate = (*pList)[a];
- // copy new list to local. This is NOT very convenient behavior, the local
- // GluePointList should not be set, but we delivered by using GetGluePointList(),
- // maybe on demand. Since the local object is changed here, this is assumed to
- // be a result of GetGluePointList and thus the list is copied
- if(pPlusData)
- {
- pPlusData->SetGluePoints(aNewList);
- }
- }
+ if(rCandidate.IsUserDefined())
+ {
+ aNewList.Insert(rCandidate);
}
}
+
+ // copy new list to local. This is NOT very convenient behavior, the local
+ // GluePointList should not be set, but we delivered by using GetGluePointList(),
+ // maybe on demand. Since the local object is changed here, this is assumed to
+ // be a result of GetGluePointList and thus the list is copied
+ if(pPlusData)
+ {
+ pPlusData->SetGluePoints(aNewList);
+ }
}
// #i38892#
@@ -1909,81 +1909,81 @@ void SdrObjCustomShape::DragResizeCustomShape( const tools::Rectangle& rNewRect
if ( aGeo.nRotationAngle ) RotatePoint(aNewPos, aOld.TopLeft(), aGeoStat.nSin, aGeoStat.nCos );
aNewRect.SetPos( aNewPos );
}
- if ( aNewRect != maRect )
- {
- SetLogicRect( aNewRect );
- InvalidateRenderGeometry();
+ if ( aNewRect == maRect )
+ return;
- if ( rNewRect.Left() > rNewRect.Right() )
- {
- Point aTop( ( GetSnapRect().Left() + GetSnapRect().Right() ) >> 1, GetSnapRect().Top() );
- Point aBottom( aTop.X(), aTop.Y() + 1000 );
- NbcMirror( aTop, aBottom );
- }
- if ( rNewRect.Top() > rNewRect.Bottom() )
- {
- Point aLeft( GetSnapRect().Left(), ( GetSnapRect().Top() + GetSnapRect().Bottom() ) >> 1 );
- Point aRight( aLeft.X() + 1000, aLeft.Y() );
- NbcMirror( aLeft, aRight );
- }
+ SetLogicRect( aNewRect );
+ InvalidateRenderGeometry();
- for (const auto& rInteraction : aInteractionHandles)
+ if ( rNewRect.Left() > rNewRect.Right() )
+ {
+ Point aTop( ( GetSnapRect().Left() + GetSnapRect().Right() ) >> 1, GetSnapRect().Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ NbcMirror( aTop, aBottom );
+ }
+ if ( rNewRect.Top() > rNewRect.Bottom() )
+ {
+ Point aLeft( GetSnapRect().Left(), ( GetSnapRect().Top() + GetSnapRect().Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ NbcMirror( aLeft, aRight );
+ }
+
+ for (const auto& rInteraction : aInteractionHandles)
+ {
+ try
{
- try
+ if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
+ rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
+ if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X ||
+ rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
{
- if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
- rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
- if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X ||
- rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
- {
- if (rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX)
- bOldMirroredX = !bOldMirroredX;
+ if (rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX)
+ bOldMirroredX = !bOldMirroredX;
- sal_Int32 nX;
- if ( bOldMirroredX )
- {
- nX = ( rInteraction.aPosition.X - aOld.Right() );
- if ( rNewRect.Left() > rNewRect.Right() )
- nX = maRect.Left() - nX;
- else
- nX += maRect.Right();
- }
+ sal_Int32 nX;
+ if ( bOldMirroredX )
+ {
+ nX = ( rInteraction.aPosition.X - aOld.Right() );
+ if ( rNewRect.Left() > rNewRect.Right() )
+ nX = maRect.Left() - nX;
else
- {
- nX = ( rInteraction.aPosition.X - aOld.Left() );
- if ( rNewRect.Left() > rNewRect.Right() )
- nX = maRect.Right() - nX;
- else
- nX += maRect.Left();
- }
- rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
+ nX += maRect.Right();
}
- if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
+ else
{
- sal_Int32 nY;
- if ( bOldMirroredY )
- {
- nY = ( rInteraction.aPosition.Y - aOld.Bottom() );
- if ( rNewRect.Top() > rNewRect.Bottom() )
- nY = maRect.Top() - nY;
- else
- nY += maRect.Bottom();
- }
+ nX = ( rInteraction.aPosition.X - aOld.Left() );
+ if ( rNewRect.Left() > rNewRect.Right() )
+ nX = maRect.Right() - nX;
else
- {
- nY = ( rInteraction.aPosition.Y - aOld.Top() );
- if ( rNewRect.Top() > rNewRect.Bottom() )
- nY = maRect.Bottom() - nY;
- else
- nY += maRect.Top();
- }
- rInteraction.xInteraction->setControllerPosition( css::awt::Point( rInteraction.xInteraction->getPosition().X, nY ) );
+ nX += maRect.Left();
}
+ rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
}
- catch ( const uno::RuntimeException& )
+ if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
{
+ sal_Int32 nY;
+ if ( bOldMirroredY )
+ {
+ nY = ( rInteraction.aPosition.Y - aOld.Bottom() );
+ if ( rNewRect.Top() > rNewRect.Bottom() )
+ nY = maRect.Top() - nY;
+ else
+ nY += maRect.Bottom();
+ }
+ else
+ {
+ nY = ( rInteraction.aPosition.Y - aOld.Top() );
+ if ( rNewRect.Top() > rNewRect.Bottom() )
+ nY = maRect.Bottom() - nY;
+ else
+ nY += maRect.Top();
+ }
+ rInteraction.xInteraction->setControllerPosition( css::awt::Point( rInteraction.xInteraction->getPosition().X, nY ) );
}
}
+ catch ( const uno::RuntimeException& )
+ {
+ }
}
}
@@ -1991,40 +1991,40 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point& rDestination,
const sal_uInt16 nCustomShapeHdlNum, bool bMoveCalloutRectangle )
{
std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
- if ( nCustomShapeHdlNum < aInteractionHandles.size() )
+ if ( nCustomShapeHdlNum >= aInteractionHandles.size() )
+ return;
+
+ SdrCustomShapeInteraction aInteractionHandle( aInteractionHandles[ nCustomShapeHdlNum ] );
+ if ( !aInteractionHandle.xInteraction.is() )
+ return;
+
+ try
{
- SdrCustomShapeInteraction aInteractionHandle( aInteractionHandles[ nCustomShapeHdlNum ] );
- if ( aInteractionHandle.xInteraction.is() )
+ css::awt::Point aPt( rDestination.X(), rDestination.Y() );
+ if ( aInteractionHandle.nMode & CustomShapeHandleModes::MOVE_SHAPE && bMoveCalloutRectangle )
{
- try
- {
- css::awt::Point aPt( rDestination.X(), rDestination.Y() );
- if ( aInteractionHandle.nMode & CustomShapeHandleModes::MOVE_SHAPE && bMoveCalloutRectangle )
- {
- sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
- sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
+ sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
+ sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
- maRect.Move( nXDiff, nYDiff );
- aOutRect.Move( nXDiff, nYDiff );
- maSnapRect.Move( nXDiff, nYDiff );
- SetRectsDirty(true);
- InvalidateRenderGeometry();
+ maRect.Move( nXDiff, nYDiff );
+ aOutRect.Move( nXDiff, nYDiff );
+ maSnapRect.Move( nXDiff, nYDiff );
+ SetRectsDirty(true);
+ InvalidateRenderGeometry();
- for (const auto& rInteraction : aInteractionHandles)
- {
- if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
- {
- if ( rInteraction.xInteraction.is() )
- rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
- }
- }
- }
- aInteractionHandle.xInteraction->setControllerPosition( aPt );
- }
- catch ( const uno::RuntimeException& )
+ for (const auto& rInteraction : aInteractionHandles)
{
+ if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
+ {
+ if ( rInteraction.xInteraction.is() )
+ rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
+ }
}
}
+ aInteractionHandle.xInteraction->setControllerPosition( aPt );
+ }
+ catch ( const uno::RuntimeException& )
+ {
}
}
@@ -2171,55 +2171,55 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical )
DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" );
- if( pOutlinerParaObject )
- {
- if(pOutlinerParaObject->IsVertical() != bVertical)
- {
- // get item settings
- const SfxItemSet& rSet = GetObjectItemSet();
+ if( !pOutlinerParaObject )
+ return;
- // Also exchange horizontal and vertical adjust items
- SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
- SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
+ if(pOutlinerParaObject->IsVertical() == bVertical)
+ return;
- // rescue object size, SetSnapRect below expects logic rect,
- // not snap rect.
- tools::Rectangle aObjectRect = GetLogicRect();
+ // get item settings
+ const SfxItemSet& rSet = GetObjectItemSet();
- // prepare ItemSet to set exchanged width and height items
- SfxItemSet aNewSet(*rSet.GetPool(),
- svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
- // Expanded item ranges to also support horizontal and vertical adjust.
- SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
- SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST>{});
+ // Also exchange horizontal and vertical adjust items
+ SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
+ SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
- aNewSet.Put(rSet);
+ // rescue object size, SetSnapRect below expects logic rect,
+ // not snap rect.
+ tools::Rectangle aObjectRect = GetLogicRect();
- // Exchange horizontal and vertical adjusts
- switch(eVert)
- {
- case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
- case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
- case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
- case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
- }
- switch(eHorz)
- {
- case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
- case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
- case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
- case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
- }
+ // prepare ItemSet to set exchanged width and height items
+ SfxItemSet aNewSet(*rSet.GetPool(),
+ svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
+ // Expanded item ranges to also support horizontal and vertical adjust.
+ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
+ SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST>{});
- pOutlinerParaObject = GetOutlinerParaObject();
- if ( pOutlinerParaObject )
- pOutlinerParaObject->SetVertical(bVertical);
- SetObjectItemSet( aNewSet );
+ aNewSet.Put(rSet);
- // restore object size
- SetSnapRect(aObjectRect);
- }
+ // Exchange horizontal and vertical adjusts
+ switch(eVert)
+ {
+ case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
+ case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
+ case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
+ case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
+ }
+ switch(eHorz)
+ {
+ case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
+ case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
+ case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
+ case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
}
+
+ pOutlinerParaObject = GetOutlinerParaObject();
+ if ( pOutlinerParaObject )
+ pOutlinerParaObject->SetVertical(bVertical);
+ SetObjectItemSet( aNewSet );
+
+ // restore object size
+ SetSnapRect(aObjectRect);
}
void SdrObjCustomShape::SuggestTextFrameSize(Size aSuggestedTextFrameSize)
@@ -3042,28 +3042,28 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
}
// Apply flipping from enhanced geometry at center of the shape.
- if (bIsMirroredX || bIsMirroredY)
- {
- // create mathematically matrix for the applied transformations
- // aScale was in most cases built from a rectangle including edge
- // and is therefore mathematically too large by 1
- if (aScale.getX() > 2.0 && aScale.getY() > 2.0)
- aScale -= basegfx::B2DTuple(1.0, 1.0);
- basegfx::B2DHomMatrix aMathMat = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
- aScale, -fShearX, basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
- aTranslate);
- // Use matrix to get current center
- basegfx::B2DPoint aCenter(0.5,0.5);
- aCenter = aMathMat * aCenter;
- double fCenterX = aCenter.getX();
- double fCenterY = aCenter.getY();
- if (bIsMirroredX) // vertical axis
- Mirror(Point(FRound(fCenterX),FRound(fCenterY)),
- Point(FRound(fCenterX), FRound(fCenterY + 1000.0)));
- if (bIsMirroredY) // horizontal axis
- Mirror(Point(FRound(fCenterX),FRound(fCenterY)),
- Point(FRound(fCenterX + 1000.0), FRound(fCenterY)));
- }
+ if (!(bIsMirroredX || bIsMirroredY))
+ return;
+
+ // create mathematically matrix for the applied transformations
+ // aScale was in most cases built from a rectangle including edge
+ // and is therefore mathematically too large by 1
+ if (aScale.getX() > 2.0 && aScale.getY() > 2.0)
+ aScale -= basegfx::B2DTuple(1.0, 1.0);
+ basegfx::B2DHomMatrix aMathMat = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale, -fShearX, basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
+ aTranslate);
+ // Use matrix to get current center
+ basegfx::B2DPoint aCenter(0.5,0.5);
+ aCenter = aMathMat * aCenter;
+ double fCenterX = aCenter.getX();
+ double fCenterY = aCenter.getY();
+ if (bIsMirroredX) // vertical axis
+ Mirror(Point(FRound(fCenterX),FRound(fCenterY)),
+ Point(FRound(fCenterX), FRound(fCenterY + 1000.0)));
+ if (bIsMirroredY) // horizontal axis
+ Mirror(Point(FRound(fCenterX),FRound(fCenterY)),
+ Point(FRound(fCenterX + 1000.0), FRound(fCenterY)));
}
// taking fObjectRotation instead of aGeo.nAngle
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 90b41c7d7225..05cbd9ca3b88 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx