summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-07-03 16:33:36 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2017-07-04 10:28:35 +0200
commitdd74a659c60c1f0e7733d4244e808865377c6316 (patch)
tree402e767710ede69c40de175d26b3e2e8d3f57ac1 /sd
parentabc440a691efb872afac385ce5ed28cd5db56c8c (diff)
support for saving a modified image instead of original version
Normally when you save an image through the "Save..." entry in the context menu for an image, the saved image is the original one more eventually applied filters (which are not removeable). Further applied transformations like rotations, cropping, color effects are not included in the saved image. This patch offers the user to choose if saving the original image (with filters) or the modified version through a pop-up dialog. The new feature is available in Writer, Draw and Calc. Change-Id: I4f983e3a5e8a6839fa5789a96c4d8c44477c1fd7 Reviewed-on: https://gerrit.libreoffice.org/39480 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/view/drviews2.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c960e4c4c7cb..c144cf9ea251 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -928,8 +928,28 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
const SdrGrafObj* pObj = dynamic_cast<const SdrGrafObj*>(rMarkList.GetMark(0)->GetMarkedSdrObj());
if (pObj && pObj->GetGraphicType() == GraphicType::Bitmap)
{
- GraphicObject aGraphicObject(pObj->GetGraphicObject());
+ GraphicAttr aGraphicAttr = pObj->GetGraphicAttr();
+ short nState = RET_CANCEL;
+ if (aGraphicAttr != GraphicAttr()) // the image has been modified
{
+ vcl::Window* pWin = GetActiveWindow();
+ if (pWin)
+ {
+ nState = GraphicHelper::HasToSaveTransformedImage(pWin);
+ }
+ }
+ else
+ {
+ nState = RET_NO;
+ }
+
+ if (nState == RET_YES)
+ {
+ GraphicHelper::ExportGraphic( pObj->GetTransformedGraphic(), "" );
+ }
+ else if (nState == RET_NO)
+ {
+ GraphicObject aGraphicObject(pObj->GetGraphicObject());
GraphicHelper::ExportGraphic( aGraphicObject.GetGraphic(), "" );
}
}