summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-07-15 10:09:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-07-15 10:36:37 +0100
commit83b3349bb94d4c48db4da8fe5f8fdb9b19e633b9 (patch)
tree142f82329e4c67a0f10857b22c26da9baaf4ff6a /svx/source/sdr
parent8d5f4717064da45476ca2cb79fe1f778d346b241 (diff)
refactor ensuring polygon has at least a line in it
just split that out into a standalone function, no logic change Change-Id: I061d5d716b3fc2a9fb6385e7fb249ce300752130
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx39
1 files changed, 23 insertions, 16 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 3926b82d744b..c0e48b94df7f 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -40,26 +40,14 @@ namespace sdr
{
}
- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
+ static sal_uInt32 ensureGeometry(basegfx::B2DPolyPolygon& rUnitPolyPolygon)
{
- const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
- const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
- drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
- rItemSet,
- GetPathObj().getText(0),
- false));
- basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
- Point aGridOff = GetPathObj().GetGridOffset();
- // Hack for calc, transform position of object according
- // to current zoom so as objects relative position to grid
- // appears stable
- aUnitPolyPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) );
- sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
+ sal_uInt32 nPolyCount(rUnitPolyPolygon.count());
sal_uInt32 nPointCount(0);
for(sal_uInt32 a(0); a < nPolyCount; a++)
{
- nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count();
+ nPointCount += rUnitPolyPolygon.getB2DPolygon(a).count();
}
if(!nPointCount)
@@ -68,11 +56,30 @@ namespace sdr
basegfx::B2DPolygon aFallbackLine;
aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0));
aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0));
- aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
+ rUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
nPolyCount = 1;
}
+ return nPolyCount;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetPathObj().getText(0),
+ false));
+ basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
+ Point aGridOff = GetPathObj().GetGridOffset();
+ // Hack for calc, transform position of object according
+ // to current zoom so as objects relative position to grid
+ // appears stable
+ aUnitPolyPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix( aGridOff.X(), aGridOff.Y() ) );
+ sal_uInt32 nPolyCount(ensureGeometry(aUnitPolyPolygon));
+
// prepare object transformation and unit polygon (direct model data)
basegfx::B2DHomMatrix aObjectMatrix;
const bool bIsLine(