[Libreoffice-commits] core.git: include/svx sd/source svx/source
Gulsah Kose
gulsah.1004 at gmail.com
Fri Jun 10 14:15:36 UTC 2016
include/svx/svdograf.hxx | 2 ++
sd/source/ui/view/sdview.cxx | 1 -
svx/source/svdraw/svdograf.cxx | 29 +++++++++++++++++++++--------
3 files changed, 23 insertions(+), 9 deletions(-)
New commits:
commit e9fadde3c56a1e8bbb1ffe3ded861fbcd3252407
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date: Thu May 26 03:37:37 2016 +0300
tdf#87667 If image is cropped, set cropped size as original size.
Change-Id: Ief76037f087a2225442294b972d331fc4476bbec
Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/25486
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 90027f4..22085c9 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -138,6 +138,8 @@ public:
bool IsEPS() const;
bool IsSwappedOut() const;
+ bool IsCropped() const;
+
const MapMode& GetGrafPrefMapMode() const;
const Size& GetGrafPrefSize() const;
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 3baf250..95c3f56 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -892,7 +892,6 @@ void View::SetMarkedOriginalSize()
Rectangle aRect( pObj->GetLogicRect() );
aRect.SetSize( aSize );
pObj->SetLogicRect( aRect );
-
bOK = true;
}
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 6655c4f..93a662b 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -531,6 +531,11 @@ bool SdrGrafObj::IsSwappedOut() const
return mbIsPreview || pGraphic->IsSwappedOut();
}
+bool SdrGrafObj::IsCropped() const
+{
+ return aGrafInfo.IsCropped();
+}
+
const MapMode& SdrGrafObj::GetGrafPrefMapMode() const
{
return pGraphic->GetPrefMapMode();
@@ -561,18 +566,26 @@ OUString SdrGrafObj::GetGrafStreamURL() const
Size SdrGrafObj::getOriginalSize() const
{
- Size aSize;
+ Size aSize = GetGrafPrefSize();
- if ( GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
- aSize = Application::GetDefaultDevice()->PixelToLogic( GetGrafPrefSize(),
- GetModel()->GetScaleUnit() );
- else
+ if (IsCropped())
{
- aSize = OutputDevice::LogicToLogic( GetGrafPrefSize(),
- GetGrafPrefMapMode(),
- GetModel()->GetScaleUnit() );
+ long aCroppedTop = OutputDevice::LogicToLogic( aGrafInfo.GetTopCrop(), GetModel()->GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit());
+ long aCroppedBottom = OutputDevice::LogicToLogic( aGrafInfo.GetBottomCrop(), GetModel()->GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit());
+ long aCroppedLeft = OutputDevice::LogicToLogic( aGrafInfo.GetLeftCrop(), GetModel()->GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit());
+ long aCroppedRight = OutputDevice::LogicToLogic( aGrafInfo.GetRightCrop(), GetModel()->GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit());
+
+ long aCroppedWidth = aSize.getWidth() - aCroppedLeft + aCroppedRight;
+ long aCroppedHeight = aSize.getHeight() - aCroppedTop + aCroppedBottom;
+
+ aSize = Size ( aCroppedWidth, aCroppedHeight);
}
+ if ( GetGrafPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, GetModel()->GetScaleUnit() );
+ else
+ aSize = OutputDevice::LogicToLogic( aSize, GetGrafPrefMapMode(), GetModel()->GetScaleUnit() );
+
return aSize;
}
More information about the Libreoffice-commits
mailing list