Kaydet (Commit) 5b17d2d7 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 038564c9
......@@ -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">
......
......@@ -63,6 +63,11 @@ interface TextDocument : BaseTextDocument
ExecMethod = Execute;
StateMethod = GetState;
]
FN_OPEN_FILE
[
ExecMethod = Execute;
StateMethod = GetState;
]
}
shell SwDocShell
......
......@@ -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;
]
......@@ -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);
......
......@@ -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");
}
......
......@@ -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"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment