diff options
author | Ádám Csaba Király <kiraly.adam.csaba@gmail.com> | 2013-03-22 21:37:25 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2013-03-25 21:44:02 +0100 |
commit | 0e1617554c34e62a467a5e1a188353178211e8fe (patch) | |
tree | d6bfe2e4c2982b65bc32b7fe2ffe94b41f2e8abd | |
parent | 6013fe19a40dd16ce435a2428f7405b51930689e (diff) |
fdo#60780, Save a Copy wip
GUIStoreModel now correctly calls storeToUrl
instead of storeAsUrl, when saving a copy.
Dialog title is correctly set.
TODO:
- Write help
Change-Id: I4d7fc9ebc91c2129e8d8dcf9978c324bdddae129
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 8 | ||||
-rw-r--r-- | sfx2/inc/filedlghelper.hrc | 2 | ||||
-rw-r--r-- | sfx2/inc/sfx2/filedlghelper.hxx | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/sfx.hrc | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/sfxsids.hrc | 1 | ||||
-rw-r--r-- | sfx2/sdi/docslots.sdi | 5 | ||||
-rw-r--r-- | sfx2/sdi/sfx.sdi | 28 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.src | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlgimpl.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/doc/doc.hrc | 1 | ||||
-rw-r--r-- | sfx2/source/doc/doc.src | 4 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 23 | ||||
-rw-r--r-- | sw/source/ui/uiview/srcview.cxx | 1 | ||||
-rw-r--r-- | sw/uiconfig/swriter/menubar/menubar.xml | 1 |
16 files changed, 102 insertions, 3 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index eb0f41be5f07..dc3d21d4717a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1894,6 +1894,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:SaveACopy" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Save a Copy...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:CheckOut" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Check-Out</value> diff --git a/sfx2/inc/filedlghelper.hrc b/sfx2/inc/filedlghelper.hrc index 728de09a396c..dd0b112d4af8 100644 --- a/sfx2/inc/filedlghelper.hrc +++ b/sfx2/inc/filedlghelper.hrc @@ -36,6 +36,8 @@ #define STR_LB_IMAGE_TEMPLATE (RID_SFX_EXPLORER_START + 62) #define STR_LB_TEMPLATES (RID_SFX_EXPLORER_START + 63) #define STR_LB_VERSION (RID_SFX_EXPLORER_START + 64) +#define STR_PB_SAVEACOPY (RID_SFX_EXPLORER_START + 65) + #endif diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index 30ab36ba6207..d576c208dbb1 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -64,6 +64,7 @@ class Window; // the SFXWB constants are for the nFlags parameter of the constructor #define SFXWB_INSERT 0x04000000L // turn Open into Insert dialog #define SFXWB_EXPORT 0x40000000L // turn Save into Export dialog +#define SFXWB_SAVEACOPY 0x00400000L // turn Save into Save a Copy dialog #define SFXWB_MULTISELECTION 0x20000000L #define SFXWB_GRAPHIC 0x00800000L // register graphic formats diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc index 06b0fe9c26c3..245daa2f062a 100644 --- a/sfx2/inc/sfx2/sfx.hrc +++ b/sfx2/inc/sfx2/sfx.hrc @@ -52,6 +52,7 @@ #define SFX_EVENT_ACTIVATEDOC (EVENT_SFX_START + 7) #define SFX_EVENT_DEACTIVATEDOC (EVENT_SFX_START + 8) #define SFX_EVENT_PRINTDOC (EVENT_SFX_START + 9) +#define SFX_EVENT_SAVEACOPY (EVENT_SFX_START + 10) #define SFX_EVENT_LOADFINISHED (EVENT_SFX_START + 11) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 1b0d89bacb6b..51bfd36b1d94 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -117,6 +117,7 @@ #define SID_JUMPTOMARK (SID_SFX_START + 598) #define SID_OPENTEMPLATE (SID_SFX_START + 594) #define SID_SAVEASDOC (SID_SFX_START + 502) +#define SID_SAVEACOPY (SID_SFX_START + 999) #define SID_CLOSING (SID_SFX_START +1539) #define SID_CLOSEDOC (SID_SFX_START + 503) #define SID_CLOSEDOCS (SID_SFX_START + 595) diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi index 111ba6ddf690..243a68798432 100644 --- a/sfx2/sdi/docslots.sdi +++ b/sfx2/sdi/docslots.sdi @@ -139,6 +139,11 @@ interface OfficeDocument : Document ExecMethod = ExecFile_Impl ; StateMethod = GetState_Impl ; ] + SID_SAVEACOPY // ole(req) api(final/play/rec) + [ + ExecMethod = ExecFile_Impl ; + StateMethod = GetState_Impl ; + ] SID_DOCTEMPLATE // ole(no) api(final/play/rec) [ ExecMethod = ExecFile_Impl ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 607f2060af38..0ffc66c66398 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5610,6 +5610,34 @@ SfxBoolItem SaveAsTemplate SID_DOCTEMPLATE ] //-------------------------------------------------------------------------- +SfxBoolItem SaveACopy SID_SAVEACOPY +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxBoolItem PasswordInteraction SID_PASSWORDINTERACTION,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* status: */ + SlotType = SfxStringItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + +//-------------------------------------------------------------------------- SfxVoidItem SaveBasicAs SID_BASICSAVEAS () [ diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 6108a62022a6..1712f5108561 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -924,6 +924,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( mbInsert = SFXWB_INSERT == ( nFlags & SFXWB_INSERT ); mbExport = SFXWB_EXPORT == ( nFlags & SFXWB_EXPORT ); mbIsSaveDlg = sal_False; + mbIsSaveACopyDlg = SFXWB_SAVEACOPY == ( nFlags & SFXWB_SAVEACOPY ); mbPwdCheckBoxState = sal_False; mbSelection = sal_False; mbSelectionEnabled = sal_True; @@ -1119,6 +1120,12 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( catch( const Exception & ) { } } + // Save a copy dialog + if ( mbIsSaveACopyDlg ) + { + mxFileDlg->setTitle( SfxResId( STR_PB_SAVEACOPY ).toString() ); + } + // the "insert file" dialog needs another title if ( mbInsert ) { diff --git a/sfx2/source/dialog/filedlghelper.src b/sfx2/source/dialog/filedlghelper.src index 220e1e97a8e0..8e9c54537127 100644 --- a/sfx2/source/dialog/filedlghelper.src +++ b/sfx2/source/dialog/filedlghelper.src @@ -101,6 +101,12 @@ String STR_PB_SAVE Text [ en-US ] = "~Save" ; }; +String STR_PB_SAVEACOPY +{ + Text [ en-US ] = "Save a Copy" ; +}; + + String STR_LB_IMAGE_TEMPLATE { Text [ en-US ] = "Style:" ; diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 6888e09076ad..10b8bac3d8cb 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -87,6 +87,7 @@ namespace sfx2 sal_Bool mbHasPreview : 1; sal_Bool mbShowPreview : 1; sal_Bool mbIsSaveDlg : 1; + sal_Bool mbIsSaveACopyDlg : 1; sal_Bool mbExport : 1; sal_Bool mbDeleteMatcher : 1; diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index 9a38284ec6f9..26947bd366f3 100644 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -88,6 +88,7 @@ #define RID_STR_FILTCONFIG (RID_SFX_DOC_START+ 52) #define RID_STR_FILTBASIC (RID_SFX_DOC_START+ 53) #define RID_STR_WARNSTYLEOVERWRITE (RID_SFX_DOC_START+ 54) +#define STR_SAVEACOPY (RID_SFX_DOC_START+ 55) #define MSG_OPEN_READONLY (RID_SFX_DOC_START+ 58) diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index b3117c47abe0..fa5889e0bcda 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -199,6 +199,10 @@ String STR_SAVECOPYDOC { Text [ en-US ] = "Save Copy ~as..." ; }; +String STR_SAVEACOPY +{ + Text [ en-US ] = "Save a Copy..." ; +}; String STR_CLOSEDOC { Text [ en-US ] = "~Close" ; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index c873e46d7574..d0f02acd2450 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -98,12 +98,14 @@ #define WIDEEXPORT_REQUESTED 8 #define SAVE_REQUESTED 16 #define SAVEAS_REQUESTED 32 +#define SAVEACOPY_REQUESTED 64 // possible statuses of save operation #define STATUS_NO_ACTION 0 #define STATUS_SAVE 1 #define STATUS_SAVEAS 2 #define STATUS_SAVEAS_STANDARDNAME 3 +#define STATUS_SAVEACOPY 4 const char aFilterNameString[] = "FilterName"; const char aFilterOptionsString[] = "FilterOptions"; @@ -128,6 +130,8 @@ static sal_uInt16 getSlotIDFromMode( sal_Int8 nStoreMode ) nResult = SID_DIRECTEXPORTDOCASPDF; else if ( nStoreMode == SAVEAS_REQUESTED || nStoreMode == ( EXPORT_REQUESTED | WIDEEXPORT_REQUESTED ) ) nResult = SID_SAVEASDOC; + else if ( nStoreMode == SAVEACOPY_REQUESTED || nStoreMode == ( EXPORT_REQUESTED | WIDEEXPORT_REQUESTED ) ) + nResult = SID_SAVEACOPY; else { DBG_ASSERT( sal_False, "Unacceptable slot name is provided!\n" ); } @@ -149,6 +153,8 @@ static sal_uInt8 getStoreModeFromSlotName( const ::rtl::OUString& aSlotName ) nResult = SAVE_REQUESTED; else if ( aSlotName == "SaveAs" ) nResult = SAVEAS_REQUESTED; + else if ( aSlotName == "SaveACopy" ) + nResult = SAVEACOPY_REQUESTED; else throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), @@ -922,6 +928,11 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, aDialogFlags = SFXWB_EXPORT; } + if ( nStoreMode & SAVEACOPY_REQUESTED) + { + aDialogFlags = SFXWB_SAVEACOPY; + } + boost::scoped_ptr<sfx2::FileDialogHelper> pFileDlg; ::rtl::OUString aDocServiceName = GetDocServiceName(); @@ -1662,7 +1673,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel try { // Document properties can contain streams that should be freed before storing aModelData.FreeDocumentProps(); - if ( ( nStoreMode & EXPORT_REQUESTED ) ) + if ( ( (nStoreMode & EXPORT_REQUESTED) || (nStoreMode & SAVEACOPY_REQUESTED) ) ) aModelData.GetStorable()->storeToURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aArgsSequence ); else aModelData.GetStorable()->storeAsURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aArgsSequence ); @@ -1688,7 +1699,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel // this is actually a save operation with different parameters // so storeTo or storeAs without DocInfo operations are used - if ( ( nStoreMode & EXPORT_REQUESTED ) ) + if ( ( nStoreMode & EXPORT_REQUESTED ) || ( nStoreMode & SAVEACOPY_REQUESTED ) ) aModelData.GetStorable()->storeToURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aArgsSequence ); else aModelData.GetStorable()->storeAsURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), aArgsSequence ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 492c366348e3..48599b88243c 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -542,6 +542,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_EXPORTDOC: case SID_SAVEASDOC: case SID_SAVEDOC: + case SID_SAVEACOPY: { // derived class may decide to abort this if( !QuerySlotExecutable( nId ) ) @@ -576,6 +577,12 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) rReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) ); } + if ( nId == SID_SAVEACOPY ) + { + SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, sal_False ); + rReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) ); + } + // TODO/LATER: do the following GUI related actions in standalown method // ======================================================================================================== // Introduce a status indicator for GUI operation @@ -749,7 +756,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) nErrorCode = ( lErr != ERRCODE_IO_ABORT ) && ( nErrorCode == ERRCODE_NONE ) ? nErrorCode : lErr; } - if (nId == SID_SAVEASDOC && nErrorCode == ERRCODE_NONE) + if ( (nId == SID_SAVEASDOC || nId == SID_SAVEACOPY) && nErrorCode == ERRCODE_NONE ) { SetReadOnlyUI(false); } @@ -1054,6 +1061,20 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) break; } + case SID_SAVEACOPY: + { + if( ( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) != SFX_LOADED_MAINDOCUMENT ) + { + rSet.DisableItem( nWhich ); + break; + } + if ( /*!pCombinedFilters ||*/ !GetMedium() ) + rSet.DisableItem( nWhich ); + else + rSet.Put( SfxStringItem( nWhich, SfxResId(STR_SAVEACOPY).toString() ) ); + break; + } + case SID_EXPORTDOCASPDF: case SID_DIRECTEXPORTDOCASPDF: { diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 1cceff7c7594..9a345c6458a0 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -291,6 +291,7 @@ void SwSrcView::Execute(SfxRequest& rReq) TextView* pTextView = aEditWin.GetTextView(); switch( nSlot ) { + case SID_SAVEACOPY: case SID_SAVEASDOC: { SvtPathOptions aPathOpt; diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 108aece2046c..284cfe713aeb 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -29,6 +29,7 @@ <menu:menuitem menu:id=".uno:Save"/> <menu:menuitem menu:id=".uno:SaveAs"/> <menu:menuitem menu:id=".uno:SaveAsTemplate"/> + <menu:menuitem menu:id=".uno:SaveACopy"/> <menu:menuitem menu:id=".uno:SaveAll"/> <menu:menuitem menu:id=".uno:CheckOut"/> <menu:menuitem menu:id=".uno:CancelCheckOut"/> |