summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-04-21 14:00:26 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-04-21 21:55:45 +0200
commit56b61a3a92e91d5814076ea66bd16fca98ecbd9b (patch)
tree8a07d949aa008d8cb60d049a97bfd274f488e958 /sw
parentb5a9cc71d246c26da8aca4203da84c10c104c222 (diff)
Detect image rotation when inserting images and perform lossless rotation.
If Exif in an Jpeg image indicates that the image is rotated, ask the user if rotate the image to standard orientation. If yes, perform lossless rotation of the image. Change-Id: I164da2b06b7fd114f4d2a5a352719c47497daeae
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/uiview/view2.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index dbc1dae10c0a..3cf7c4acb953 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -134,6 +134,9 @@
#include <docstat.hxx>
#include <wordcountdialog.hxx>
+#include <vcl/GraphicNativeTransform.hxx>
+#include <vcl/GraphicNativeMetadata.hxx>
+
const char sStatusDelim[] = " : ";
const char sStatusComma[] = " , ";//#outlinelevel, define a Variable for "," add by zhaojianwei
@@ -216,6 +219,21 @@ int SwView::InsertGraphic( const String &rPath, const String &rFilter,
if( GRFILTER_OK == nRes )
{
+ GraphicNativeMetadata aMetadata;
+ if (aMetadata.Read(aGrf))
+ {
+ if (aMetadata.GetRotation() != 0)
+ {
+ OUString aMessage("This image is rotated. Would you like LibreOffice to rotate it into standard orientation?");
+ QueryBox aQueryBox(GetWindow(), WB_YES_NO | WB_DEF_YES, aMessage);
+ if (aQueryBox.Execute() == RET_YES)
+ {
+ GraphicNativeTransform aTransform(aGrf);
+ aTransform.Rotate(aMetadata.GetRotation());
+ }
+ }
+ }
+
SwFlyFrmAttrMgr aFrmMgr( sal_True, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
SwWrtShell &rSh = GetWrtShell();