summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-04-21 21:53:11 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-04-21 21:55:48 +0200
commit98ffb94d807625f87bfd27f84958ef10d3a105dc (patch)
treef0bd6375244abe401bc9c6d081ea3929a0afd0f8 /sw
parent922d87535b3413764928b70db159600c4ff2a8c2 (diff)
Extract QueryBox rotation string and InsertGraphic cleanup.
Change-Id: I46bb4b2436407cc2cb084f502ff8fb5ff7754400
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/app/app.src5
-rw-r--r--sw/source/ui/inc/app.hrc4
-rw-r--r--sw/source/ui/uiview/view2.cxx50
3 files changed, 34 insertions, 25 deletions
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index 721251503770..8dbc3096efe6 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -789,4 +789,9 @@ WarningBox MSG_DISABLE_READLINE_QUESTION
Message [ en-US ] = "In the current document, changes are being recorded but not shown as such. In large documents, delays can occur when the document is edited. Do you want to show the changes to avoid delays?";
};
+String STR_ROTATE_TO_STANDARD_ORIENTATION
+{
+ Text [ en-US ] = "This image is rotated. Would you like to rotate it into standard orientation?";
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/inc/app.hrc b/sw/source/ui/inc/app.hrc
index de9dba053b16..d9295e579556 100644
--- a/sw/source/ui/inc/app.hrc
+++ b/sw/source/ui/inc/app.hrc
@@ -118,7 +118,9 @@
#define STR_AUTHMRK_EDIT (RC_APP_BEGIN + 130)
#define STR_AUTHMRK_INSERT (RC_APP_BEGIN + 131)
-#define APP_ACT_END STR_AUTHMRK_INSERT
+#define STR_ROTATE_TO_STANDARD_ORIENTATION (RC_APP_BEGIN + 132)
+
+#define APP_ACT_END STR_ROTATE_TO_STANDARD_ORIENTATION
#if APP_ACT_END > RC_APP_END
#error Resource-Id Ueberlauf in #file, #line
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index b48e4033f4a4..26876d6a0bb9 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -199,44 +199,45 @@ String SwView::GetPageStr( sal_uInt16 nPg, sal_uInt16 nLogPg,
}
int SwView::InsertGraphic( const String &rPath, const String &rFilter,
- sal_Bool bLink, GraphicFilter *pFlt,
+ sal_Bool bLink, GraphicFilter *pFilter,
Graphic* pPreviewGrf, sal_Bool bRule )
{
- SwWait aWait( *GetDocShell(), sal_True );
+ SwWait aWait( *GetDocShell(), true );
- Graphic aGrf;
- int nRes = GRFILTER_OK;
+ Graphic aGraphic;
+ int aResult = GRFILTER_OK;
if ( pPreviewGrf )
- aGrf = *pPreviewGrf;
+ aGraphic = *pPreviewGrf;
else
{
- if( !pFlt )
- pFlt = &GraphicFilter::GetGraphicFilter();
- nRes = GraphicFilter::LoadGraphic( rPath, rFilter, aGrf, pFlt );
+ if( !pFilter )
+ {
+ pFilter = &GraphicFilter::GetGraphicFilter();
+ }
+ aResult = GraphicFilter::LoadGraphic( rPath, rFilter, aGraphic, pFilter );
}
- if( GRFILTER_OK == nRes )
+ if( GRFILTER_OK == aResult )
{
GraphicNativeMetadata aMetadata;
- if (aMetadata.read(aGrf))
+ if ( aMetadata.read(aGraphic) )
{
sal_uInt16 aRotation = aMetadata.getRotation();
if (aRotation != 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);
+ QueryBox aQueryBox(GetWindow(), WB_YES_NO | WB_DEF_YES, SW_RES(STR_ROTATE_TO_STANDARD_ORIENTATION) );
if (aQueryBox.Execute() == RET_YES)
{
- GraphicNativeTransform aTransform(aGrf);
+ GraphicNativeTransform aTransform( aGraphic );
aTransform.rotate( aRotation );
}
}
}
- SwFlyFrmAttrMgr aFrmMgr( sal_True, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
+ SwFlyFrmAttrMgr aFrameManager( sal_True, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
- SwWrtShell &rSh = GetWrtShell();
- rSh.StartAction();
+ SwWrtShell& rShell = GetWrtShell();
+ rShell.StartAction();
if( bLink )
{
SwDocShell* pDocSh = GetDocShell();
@@ -245,18 +246,19 @@ int SwView::InsertGraphic( const String &rPath, const String &rFilter,
pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) :
OUString());
- String sURL = URIHelper::SmartRel2Abs(
- aTemp, rPath, URIHelper::GetMaybeFileHdl() );
+ String sURL = URIHelper::SmartRel2Abs( aTemp, rPath, URIHelper::GetMaybeFileHdl() );
- rSh.Insert( sURL,
- rFilter, aGrf, &aFrmMgr, bRule );
+ rShell.Insert( sURL, rFilter, aGraphic, &aFrameManager, bRule );
}
else
- rSh.Insert( aEmptyStr, aEmptyStr, aGrf, &aFrmMgr );
- // nach dem EndAction ist es zu spaet, weil die Shell dann schon zerstoert sein kann
- rSh.EndAction();
+ {
+ rShell.Insert( aEmptyStr, aEmptyStr, aGraphic, &aFrameManager );
+ }
+
+ // it is too late after "EndAction" because the Shell can already be destroyed.
+ rShell.EndAction();
}
- return nRes;
+ return aResult;
}
sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )