summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorhimajin100000 <himajin100000@gmail.com>2018-03-17 07:00:02 +0900
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-03-27 15:06:09 +0200
commite97ab52a83d2440ca42c85229ef794549208cb7d (patch)
treeae53c67d057fe0ee1a4d7c3cf89565a280f1a10d /sd
parent6d05579c7fceb0f3ce83abe25bdfe62b26c29671 (diff)
tdf#116438:Apps should ask if rotation should be applied
For Calc,Draw,Impress. Writer already does this. Change-Id: I92512719673fb39a973b8a68378e93f30d82c327 Reviewed-on: https://gerrit.libreoffice.org/51447 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/pch/precompiled_sd.hxx3
-rw-r--r--sd/inc/strings.hrc1
-rw-r--r--sd/source/ui/func/fuinsert.cxx19
3 files changed, 22 insertions, 1 deletions
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
index e02b65cbae48..0f42d8defb23 100644
--- a/sd/inc/pch/precompiled_sd.hxx
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -138,7 +138,10 @@
#include <vcl/waitobj.hxx>
#include <vcl/window.hxx>
#include <vcl/wrkwin.hxx>
+#include <vcl/weld.hxx>
#include <Annotation.hxx>
+#include <vcl/GraphicNativeTransform.hxx>
+#include <vcl/GraphicNativeMetadata.hxx>
#include <CustomAnimationEffect.hxx>
#include <CustomAnimationPreset.hxx>
#include <EffectMigration.hxx>
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 52b5d6796cdd..1a5a829044ec 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -31,6 +31,7 @@
#define STR_UNDO_REPLACE NC_("STR_UNDO_REPLACE", "Replace")
#define STR_UNDO_DRAGDROP NC_("STR_UNDO_DRAGDROP", "Drag and Drop")
#define STR_INSERTGRAPHIC NC_("STR_INSERTGRAPHIC", "Insert Image")
+#define STR_QUERYROTATION NC_("STR_QUERYROTATION", "This image is rotated. Would you like to rotate it into standard orientation?")
#define STR_UNDO_BEZCLOSE NC_("STR_UNDO_BEZCLOSE", "Close Polygon")
#define STR_SLIDE_SORTER_MODE NC_("STR_SLIDE_SORTER_MODE", "Slide Sorter")
#define STR_NORMAL_MODE NC_("STR_NORMAL_MODE", "Normal")
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index fa6cbcc8f0f3..4cb2845d13fe 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -20,7 +20,6 @@
#include <config_features.h>
#include <fuinsert.hxx>
-
#include <comphelper/storagehelper.hxx>
#include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -84,6 +83,10 @@
#include <vcl/svapp.hxx>
#include <undo/undoobjects.hxx>
#include <memory>
+#include <vcl/weld.hxx>
+
+#include <vcl/GraphicNativeTransform.hxx>
+#include <vcl/GraphicNativeMetadata.hxx>
using namespace com::sun::star;
@@ -150,6 +153,20 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
if( nError == ERRCODE_NONE )
{
+ GraphicNativeMetadata aMetadata;
+ if ( aMetadata.read(aGraphic) )
+ {
+ const sal_uInt16 aRotation = aMetadata.getRotation();
+ if (aRotation != 0)
+ {
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, VclMessageType::Question,VclButtonsType::YesNo,SdResId(STR_QUERYROTATION)));
+ if (xQueryBox->run() == RET_YES)
+ {
+ GraphicNativeTransform aTransform( aGraphic );
+ aTransform.rotate( aRotation );
+ }
+ }
+ }
if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr)
{
sal_Int8 nAction = DND_ACTION_COPY;