[Libreoffice-commits] core.git: svx/source
Caolán McNamara
caolanm at redhat.com
Wed Jul 15 02:37:04 PDT 2015
svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 39 ++++++++++++---------
1 file changed, 23 insertions(+), 16 deletions(-)
New commits:
commit 83b3349bb94d4c48db4da8fe5f8fdb9b19e633b9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jul 15 10:09:16 2015 +0100
refactor ensuring polygon has at least a line in it
just split that out into a standalone function, no logic
change
Change-Id: I061d5d716b3fc2a9fb6385e7fb249ce300752130
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 3926b82..c0e48b9 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(
More information about the Libreoffice-commits
mailing list