summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-25 14:55:09 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-27 05:20:38 +0000
commitdb39c653e5de92bc371040a3f81cc5c4ea6dedf3 (patch)
treee8637f47a9465294f86367b9f3d6d53ed7fc77a5 /drawinglayer
parent78ca0ce54a2cd79736247ea8cf69ad5fc797ee1a (diff)
loplugin:singlevalfields in drawinglayer
Change-Id: I19f50b0afa624391bd0d8ada7afca822298e10cc Reviewed-on: https://gerrit.libreoffice.org/26655 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx65
-rw-r--r--drawinglayer/source/processor2d/hittestprocessor2d.cxx6
-rw-r--r--drawinglayer/source/processor3d/cutfindprocessor3d.cxx20
3 files changed, 29 insertions, 62 deletions
diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
index 3c2db2f6e91c..5cb7232e9af0 100644
--- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
@@ -66,48 +66,37 @@ namespace drawinglayer
// create a mapping from content to object.
basegfx::B2DHomMatrix aPageTrans;
- if(getKeepAspectRatio())
+ // #i101075# when keeping the aspect ratio is wanted, it is necessary to calculate
+ // an equidistant scaling in X and Y and a corresponding translation to
+ // center the output. Calculate needed scale factors
+ const double fScaleX(aScale.getX() / getContentWidth());
+ const double fScaleY(aScale.getY() / getContentHeight());
+
+ // to keep the aspect, use the smaller scale and adapt missing size by translation
+ if(fScaleX < fScaleY)
{
- // #i101075# when keeping the aspect ratio is wanted, it is necessary to calculate
- // an equidistant scaling in X and Y and a corresponding translation to
- // center the output. Calculate needed scale factors
- const double fScaleX(aScale.getX() / getContentWidth());
- const double fScaleY(aScale.getY() / getContentHeight());
-
- // to keep the aspect, use the smaller scale and adapt missing size by translation
- if(fScaleX < fScaleY)
- {
- // height needs to be adapted
- const double fNeededHeight(aScale.getY() / fScaleX);
- const double fSpaceToAdd(fNeededHeight - getContentHeight());
-
- aPageTrans.translate(0.0, fSpaceToAdd * 0.5);
- aPageTrans.scale(fScaleX, aScale.getY() / fNeededHeight);
- }
- else
- {
- // width needs to be adapted
- const double fNeededWidth(aScale.getX() / fScaleY);
- const double fSpaceToAdd(fNeededWidth - getContentWidth());
-
- aPageTrans.translate(fSpaceToAdd * 0.5, 0.0);
- aPageTrans.scale(aScale.getX() / fNeededWidth, fScaleY);
- }
-
- // add the missing object transformation aspects
- const basegfx::B2DHomMatrix aCombined(basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
- fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
- aPageTrans = aCombined * aPageTrans;
+ // height needs to be adapted
+ const double fNeededHeight(aScale.getY() / fScaleX);
+ const double fSpaceToAdd(fNeededHeight - getContentHeight());
+
+ aPageTrans.translate(0.0, fSpaceToAdd * 0.5);
+ aPageTrans.scale(fScaleX, aScale.getY() / fNeededHeight);
}
else
{
- // completely scale to PageObject size. Scale to unit size.
- aPageTrans.scale(1.0/ getContentWidth(), 1.0 / getContentHeight());
+ // width needs to be adapted
+ const double fNeededWidth(aScale.getX() / fScaleY);
+ const double fSpaceToAdd(fNeededWidth - getContentWidth());
- // apply object matrix
- aPageTrans *= getTransform();
+ aPageTrans.translate(fSpaceToAdd * 0.5, 0.0);
+ aPageTrans.scale(aScale.getX() / fNeededWidth, fScaleY);
}
+ // add the missing object transformation aspects
+ const basegfx::B2DHomMatrix aCombined(basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
+ fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
+ aPageTrans = aCombined * aPageTrans;
+
// embed in necessary transformation to map from SdrPage to SdrPageObject
const Primitive2DReference xReferenceB(new TransformPrimitive2D(aPageTrans, aContent));
xRetval = Primitive2DContainer { xReferenceB };
@@ -128,8 +117,7 @@ namespace drawinglayer
maPageContent(rPageContent),
maTransform(rTransform),
mfContentWidth(fContentWidth),
- mfContentHeight(fContentHeight),
- mbKeepAspectRatio(true)
+ mfContentHeight(fContentHeight)
{
}
@@ -143,8 +131,7 @@ namespace drawinglayer
&& getPageContent() == rCompare.getPageContent()
&& getTransform() == rCompare.getTransform()
&& getContentWidth() == rCompare.getContentWidth()
- && getContentHeight() == rCompare.getContentHeight()
- && getKeepAspectRatio() == rCompare.getKeepAspectRatio());
+ && getContentHeight() == rCompare.getContentHeight());
}
return false;
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 4853a2838aff..fc20f0a51f9f 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -47,7 +47,6 @@ namespace drawinglayer
mfDiscreteHitTolerance(0.0),
mbHit(false),
mbHitToleranceUsed(false),
- mbUseInvisiblePrimitiveContent(true),
mbHitTextOnly(bHitTextOnly)
{
// init hit tolerance
@@ -506,10 +505,7 @@ namespace drawinglayer
if(!rChildren.empty())
{
- if(getUseInvisiblePrimitiveContent())
- {
- process(rChildren);
- }
+ process(rChildren);
}
break;
diff --git a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx
index b54f6de3a44e..2321437f9ecf 100644
--- a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx
@@ -41,8 +41,7 @@ namespace drawinglayer
maBack(rBack),
maResult(),
maCombinedTransform(),
- mbAnyHit(bAnyHit),
- mbUseInvisiblePrimitiveContent(true)
+ mbAnyHit(bAnyHit)
{
}
@@ -123,10 +122,7 @@ namespace drawinglayer
if(!rChildren.empty())
{
- if(getUseInvisiblePrimitiveContent())
- {
process(rChildren);
- }
}
break;
@@ -138,19 +134,7 @@ namespace drawinglayer
if(rChildren.size())
{
- if(1.0 <= rPrimitive.getTransparence())
- {
- // not visible, but use for HitTest
- if(getUseInvisiblePrimitiveContent())
- {
- process(rChildren);
- }
- }
- else if(rPrimitive.getTransparence() >= 0.0 && rPrimitive.getTransparence() < 1.0)
- {
- // visible; use content
- process(rChildren);
- }
+ process(rChildren);
}
break;