Kaydet (Commit) e97ab52a authored tarafından himajin100000's avatar himajin100000 Kaydeden (comit) Thorsten Behrens

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/51447Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 6d05579c
......@@ -45,6 +45,9 @@
#include <vcl/svapp.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/window.hxx>
#include <vcl/weld.hxx>
#include <vcl/GraphicNativeTransform.hxx>
#include <vcl/GraphicNativeMetadata.hxx>
#include <appoptio.hxx>
#include <attrib.hxx>
#include <autoform.hxx>
......
......@@ -47,6 +47,7 @@
#define SCSTR_NO_TAB_BG_COLOR NC_("SCSTR_NO_TAB_BG_COLOR", "Default")
#define SCSTR_RENAMEOBJECT NC_("SCSTR_RENAMEOBJECT", "Name Object")
#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 SCSTR_TOTAL NC_("SCSTR_TOTAL", "%1 results found")
#define SCSTR_SKIPPED NC_("SCSTR_SKIPPED", "(only %1 are listed)")
// Attribute
......
......@@ -31,7 +31,9 @@
#include <svtools/miscopt.hxx>
#include <avmedia/mediawindow.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <vcl/GraphicNativeTransform.hxx>
#include <vcl/GraphicNativeMetadata.hxx>
#include <fuinsert.hxx>
#include <tabvwsh.hxx>
#include <drwlayer.hxx>
......@@ -100,6 +102,21 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
ScTabViewShell* pViewSh, const vcl::Window* pWindow, SdrView* pView,
ScAnchorType aAnchorType = SCA_CELL )
{
Graphic& rGraphic1 = const_cast<Graphic &>(rGraphic);
GraphicNativeMetadata aMetadata;
if ( aMetadata.read(rGraphic1) )
{
const sal_uInt16 aRotation = aMetadata.getRotation();
if (aRotation != 0)
{
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, VclMessageType::Question,VclButtonsType::YesNo,ScResId(STR_QUERYROTATION)));
if (xQueryBox->run() == RET_YES)
{
GraphicNativeTransform aTransform( rGraphic1 );
aTransform.rotate( aRotation );
}
}
}
ScDrawView* pDrawView = pViewSh->GetScDrawView();
// #i123922# check if an existing object is selected; if yes, evtl. replace
......@@ -117,7 +134,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
SdrObject* pResult = pDrawView->ApplyGraphicToObject(
*pPickObj,
rGraphic,
rGraphic1,
aBeginUndo,
bAsLink ? rFileName : OUString(),
bAsLink ? rFilterName : OUString());
......@@ -160,7 +177,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
tools::Rectangle aRect ( aInsertPos, aLogicSize );
SdrGrafObj* pObj = new SdrGrafObj( rGraphic, aRect );
SdrGrafObj* pObj = new SdrGrafObj( rGraphic1, aRect );
// calling SetGraphicLink here doesn't work
......
......@@ -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>
......
......@@ -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")
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment