diff options
| author | Gulsah Kose <gulsah.1004@gmail.com> | 2016-05-26 03:37:37 +0300 |
|---|---|---|
| committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-06-10 14:15:12 +0000 |
| commit | e9fadde3c56a1e8bbb1ffe3ded861fbcd3252407 (patch) | |
| tree | 5bf753f9948360bb0957fbcdab696d69e32640e6 | |
| parent | 34d9db285589c58e6f0dd1b37adc882252847637 (diff) | |
tdf#87667 If image is cropped, set cropped size as original size.
Change-Id: Ief76037f087a2225442294b972d331fc4476bbec
Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/25486
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
| -rw-r--r-- | include/svx/svdograf.hxx | 2 | ||||
| -rw-r--r-- | sd/source/ui/view/sdview.cxx | 1 | ||||
| -rw-r--r-- | svx/source/svdraw/svdograf.cxx | 29 |
3 files changed, 23 insertions, 9 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 90027f4429ad..22085c95a55a 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 3baf250a4cb1..95c3f569a125 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 6655c4f88f34..93a662ba487e 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; } |
