diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-23 12:04:06 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-23 12:10:26 -0400 |
commit | 5b17d2d731e014d79cbba716fcbc8fbd357094e8 (patch) | |
tree | 759ee8e332a536d1cad68beaaa563fe2623ea35d /sw | |
parent | 038564c910e43f569b7c6abebffe2ad6ec9a1822 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/sdi/docsh.sdi | 5 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 25 | ||||
-rw-r--r-- | sw/source/ui/app/docsh.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/app/docsh2.cxx | 16 | ||||
-rw-r--r-- | sw/uiconfig/swriter/menubar/menubar.xml | 2 |
5 files changed, 52 insertions, 1 deletions
diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi index 5925edd7528c..ddca15e5750b 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 d7cb8b3b3bbb..edb780916471 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 cf1d32762947..c5f633d50508 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 54d39f910c85..24b4c9d20922 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 206af98a1e6d..b0f707646712 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"/> |