summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/shapes/drawshape.cxx33
-rw-r--r--slideshow/source/engine/shapes/drawshape.hxx2
2 files changed, 32 insertions, 3 deletions
diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx
index ba6f2b0cbfb2..bc50fc695375 100644
--- a/slideshow/source/engine/shapes/drawshape.cxx
+++ b/slideshow/source/engine/shapes/drawshape.cxx
@@ -367,7 +367,8 @@ namespace slideshow::internal
mbIsVisible( true ),
mbForceUpdate( false ),
mbAttributeLayerRevoked( false ),
- mbDrawingLayerAnim( false )
+ mbDrawingLayerAnim( false ),
+ mbContainsPageField( false )
{
ENSURE_OR_THROW( mxShape.is(), "DrawShape::DrawShape(): Invalid XShape" );
ENSURE_OR_THROW( mxPage.is(), "DrawShape::DrawShape(): Invalid containing page" );
@@ -392,6 +393,26 @@ namespace slideshow::internal
maSubsetting.reset( mpCurrMtf );
prepareHyperlinkIndices();
+
+ if(mbContainsPageField && mpCurrMtf && !maBounds.isEmpty())
+ {
+ // tdf#150402 Use mbContainsPageField that gets set in prepareHyperlinkIndices
+ // which has to be run anyways, so this will cause no harm in execution speed.
+ // It lets us detect the potential error case that a PageField is contained in
+ // the Text of the Shape. That is a hint that maBounds contains the wrong Range
+ // and needs to be corrected. The correct size is in the PrefSize of the metafile.
+ // For more backgrund information please refer to tdf#150402, Comment 16.
+ const double fWidthDiff(fabs(mpCurrMtf->GetPrefSize().Width() - maBounds.getWidth()));
+ const double fHeightDiff(fabs(mpCurrMtf->GetPrefSize().Height() - maBounds.getHeight()));
+
+ if(fWidthDiff > 1.0 || fHeightDiff > 1.0)
+ {
+ maBounds = basegfx::B2DRange(
+ maBounds.getMinX(), maBounds.getMinY(),
+ maBounds.getMinX() + mpCurrMtf->GetPrefSize().Width(),
+ maBounds.getMinY() + mpCurrMtf->GetPrefSize().Height());
+ }
+ }
}
DrawShape::DrawShape( const uno::Reference< drawing::XShape >& xShape,
@@ -426,7 +447,8 @@ namespace slideshow::internal
mbIsVisible( true ),
mbForceUpdate( false ),
mbAttributeLayerRevoked( false ),
- mbDrawingLayerAnim( false )
+ mbDrawingLayerAnim( false ),
+ mbContainsPageField( false )
{
ENSURE_OR_THROW( rGraphic.IsAnimated(),
"DrawShape::DrawShape(): Graphic is no animation" );
@@ -476,7 +498,8 @@ namespace slideshow::internal
mbIsVisible( rSrc.mbIsVisible ),
mbForceUpdate( false ),
mbAttributeLayerRevoked( false ),
- mbDrawingLayerAnim( false )
+ mbDrawingLayerAnim( false ),
+ mbContainsPageField( false )
{
ENSURE_OR_THROW( mxShape.is(), "DrawShape::DrawShape(): Invalid XShape" );
ENSURE_OR_THROW( mpCurrMtf, "DrawShape::DrawShape(): Invalid metafile" );
@@ -868,6 +891,10 @@ namespace slideshow::internal
{
maHyperlinkIndices.back().second = nIndex;
}
+ else if (pAct->GetComment().equalsIgnoreAsciiCase("FIELD_SEQ_BEGIN;PageField"))
+ {
+ mbContainsPageField = true;
+ }
++nIndex;
}
else
diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx
index e775a891f679..4ede703cc982 100644
--- a/slideshow/source/engine/shapes/drawshape.hxx
+++ b/slideshow/source/engine/shapes/drawshape.hxx
@@ -349,6 +349,8 @@ namespace slideshow::internal
/// whether a drawing layer animation has to be performed
bool mbDrawingLayerAnim;
+ /// tdf#150402 wether mpCurrMtf contains any Text with a PageField ("FIELD_SEQ_BEGIN;PageField")
+ mutable bool mbContainsPageField;
};
}