summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-23 12:04:06 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-23 12:10:26 -0400
commit5b17d2d731e014d79cbba716fcbc8fbd357094e8 (patch)
tree759ee8e332a536d1cad68beaaa563fe2623ea35d /sw/source/ui
parent038564c910e43f569b7c6abebffe2ad6ec9a1822 (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/source/ui')
-rw-r--r--sw/source/ui/app/docsh.cxx5
-rw-r--r--sw/source/ui/app/docsh2.cxx16
2 files changed, 21 insertions, 0 deletions
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");
}