summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-07-03 16:33:36 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-05 09:48:19 +0200
commit970a2517d27336deb8b140f31371f37ea1c890f6 (patch)
tree2598ca7da9d0727b60b95c1e25875bc8aa0393c9 /sc
parent89d56ad70a5b43509d647d89d0cd12e481642954 (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 rotation, 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/39487 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/drawfunc/graphsh.cxx26
1 files changed, 23 insertions, 3 deletions
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index 254cb0649a4d..8c11655da76a 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -261,11 +261,31 @@ void ScGraphicShell::ExecuteSaveGraphic(SfxRequest& /*rReq*/)
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast<const SdrGrafObj*>( pObj) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
+ const SdrGrafObj* pObj = dynamic_cast<const SdrGrafObj*>(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
+ if( pObj && pObj->GetGraphicType() == GraphicType::Bitmap )
{
- GraphicObject aGraphicObject( static_cast<SdrGrafObj*>( pObj )->GetGraphicObject() );
+ GraphicAttr aGraphicAttr = pObj->GetGraphicAttr();
+ short nState = RET_CANCEL;
+ if (aGraphicAttr != GraphicAttr()) // the image has been modified
+ {
+ vcl::Window* pWin = GetViewData()->GetActiveWin();
+ 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(), "" );
}
}