Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2829

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/29/2829/1

fdo#60780, Save a Copy wip

The saving seems to work fine, but immediately opening the copy
doesn't work, you have to close the program.

TODO:
- Set correct title on dialog
- Write help

Change-Id: I4d7fc9ebc91c2129e8d8dcf9978c324bdddae129
---
M officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
M sfx2/inc/filedlghelper.hrc
M sfx2/inc/sfx2/sfx.hrc
M sfx2/inc/sfx2/sfxsids.hrc
M sfx2/sdi/docslots.sdi
M sfx2/sdi/sfx.sdi
M sfx2/source/dialog/filedlghelper.cxx
M sfx2/source/dialog/filedlghelper.src
M sfx2/source/dialog/filedlgimpl.hxx
M sfx2/source/doc/doc.hrc
M sfx2/source/doc/doc.src
M sfx2/source/doc/guisaveas.cxx
M sfx2/source/doc/objserv.cxx
M sw/source/ui/uiview/srcview.cxx
M sw/uiconfig/swriter/menubar/menubar.xml
15 files changed, 94 insertions(+), 1 deletion(-)



diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 74b99f1..8558ee5 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1895,6 +1895,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 728de09..dd0b112 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/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index 06b0fe9..245daa2 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 1b0d89b..51bfd36 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 111ba6d..243a687 100644
--- a/sfx2/sdi/docslots.sdi
+++ b/sfx2/sdi/docslots.sdi
@@ -139,6 +139,11 @@
         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 607f206..0ffc66c 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5610,6 +5610,34 @@
 ]
 
 //--------------------------------------------------------------------------
+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 164bc7e..36860cb 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -924,6 +924,7 @@
     mbInsert                = SFXWB_INSERT == ( nFlags & SFXWB_INSERT );
     mbExport                = SFXWB_EXPORT == ( nFlags & SFXWB_EXPORT );
     mbIsSaveDlg             = sal_False;
+    mbIsSaveACopyDlg        = sal_False;
     mbPwdCheckBoxState      = sal_False;
     mbSelection             = sal_False;
     mbSelectionEnabled      = sal_True;
@@ -1119,6 +1120,12 @@
         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 220e1e9..8e9c545 100644
--- a/sfx2/source/dialog/filedlghelper.src
+++ b/sfx2/source/dialog/filedlghelper.src
@@ -101,6 +101,12 @@
     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 6888e09..10b8bac 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -87,6 +87,7 @@
         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 9a38284..26947bd 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 b3117c4..fa5889e 100644
--- a/sfx2/source/doc/doc.src
+++ b/sfx2/source/doc/doc.src
@@ -199,6 +199,10 @@
 {
     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 45262eb..278c6b2 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 @@
         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 @@
         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 >(),
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 1d921c7..e4e5bea 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -542,6 +542,7 @@
         case SID_EXPORTDOC:
         case SID_SAVEASDOC:
         case SID_SAVEDOC:
+        case SID_SAVEACOPY:
         {
             // derived class may decide to abort this
             if( !QuerySlotExecutable( nId ) )
@@ -574,6 +575,12 @@
                     SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, 
SID_VIEWONLY, sal_False );
                     if ( pViewOnlyItem && pViewOnlyItem->GetValue() )
                         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
@@ -749,7 +756,7 @@
                 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 @@
                 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 1cceff7..9a345c6 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -291,6 +291,7 @@
     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 108aece..284cfe7 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"/>

-- 
To view, visit https://gerrit.libreoffice.org/2829
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d7fc9ebc91c2129e8d8dcf9978c324bdddae129
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ádám Király <kiraly.adam.csaba@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.