[Libreoffice-commits] .: officecfg/registry sw/sdi sw/source sw/uiconfig

Kohei Yoshida kohei at kemper.freedesktop.org
Wed May 23 09:12:32 PDT 2012


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |    5 ++
 sw/sdi/docsh.sdi                                                    |    5 ++
 sw/sdi/swriter.sdi                                                  |   25 ++++++++++
 sw/source/ui/app/docsh.cxx                                          |    5 ++
 sw/source/ui/app/docsh2.cxx                                         |   16 ++++++
 sw/uiconfig/swriter/menubar/menubar.xml                             |    2 
 6 files changed, 57 insertions(+), 1 deletion(-)

New commits:
commit 5b17d2d731e014d79cbba716fcbc8fbd357094e8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed May 23 12:04:06 2012 -0400

    Pass document service to the dispatcher when opening file from writer.
    
    This is similar to what I did earlier for calc.  This info will be
    used later in the type detection code.
    
    Change-Id: I7ba7dcdc03cbfe77eba5c7594fc0385ad3775541

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 9153d94..31a6867 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -2212,6 +2212,11 @@
                     <value>8</value>
                 </prop>
             </node>
+            <node oor:name=".uno:OpenFromWriter" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">~Open...</value>
+                </prop>
+            </node>
         </node>
         <node oor:name="Popups">
             <node oor:name=".uno:TableMenu" oor:op="replace">
diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi
index 5925edd..ddca15e 100644
--- a/sw/sdi/docsh.sdi
+++ b/sw/sdi/docsh.sdi
@@ -63,6 +63,11 @@ interface TextDocument : BaseTextDocument
         ExecMethod = Execute;
         StateMethod = GetState;
     ]
+    FN_OPEN_FILE
+    [
+        ExecMethod = Execute;
+        StateMethod = GetState;
+    ]
 }
 
 shell SwDocShell
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index d7cb8b3..edb7809 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -10417,3 +10417,28 @@ SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD
     ToolBoxConfig = TRUE,
     GroupId = GID_NAVIGATION;
 ]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OpenFromWriter FN_OPEN_FILE
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_APPLICATION;
+]
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index cf1d327..c5f633d 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -1035,6 +1035,11 @@ void SwDocShell::GetState(SfxItemSet& rSet)
                 rSet.DisableItem( nWhich );
             break;
 
+        case FN_OPEN_FILE:
+            if( ISA( SwWebDocShell ) )
+                rSet.DisableItem( nWhich );
+            break;
+
         case SID_ATTR_YEAR2000:
             {
                 const SvNumberFormatter* pFmtr = pDoc->GetNumberFormatter(sal_False);
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 54d39f9..24b4c9d 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -1427,6 +1427,22 @@ void SwDocShell::Execute(SfxRequest& rReq)
                 pDoc->GetNumberFormatter(sal_True)->SetYear2000(nYear2K);
             }
         break;
+        case FN_OPEN_FILE:
+        {
+            SfxViewShell* pViewShell = GetView();
+            if (!pViewShell)
+                pViewShell = SfxViewShell::Current();
+
+            if (!pViewShell)
+                // Ok.  I did my best.
+                break;
+
+            SfxStringItem aApp(SID_DOC_SERVICE, rtl::OUString("com.sun.star.text.TextDocument"));
+            SfxStringItem aTarget(SID_TARGETNAME, rtl::OUString("_blank"));
+            pViewShell->GetDispatcher()->Execute(
+                SID_OPENDOC, SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON, &aApp, &aTarget, 0L);
+        }
+        break;
 
         default: OSL_FAIL("wrong Dispatcher");
     }
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index 206af98..b0f7076 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -3,7 +3,7 @@
   <menu:menu menu:id=".uno:PickList">
     <menu:menupopup>
       <menu:menuitem menu:id=".uno:AddDirect"/>
-      <menu:menuitem menu:id=".uno:Open"/>
+      <menu:menuitem menu:id=".uno:OpenFromWriter"/>
       <menu:menuitem menu:id=".uno:RecentFileList"/>
       <menu:menuseparator/>
       <menu:menuitem menu:id=".uno:AutoPilotMenu"/>


More information about the Libreoffice-commits mailing list