[Libreoffice-commits] .: 2 commits - officecfg/registry sc/inc sc/sdi sc/source sc/uiconfig sfx2/inc sfx2/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue May 22 23:20:17 PDT 2012
officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 5 ++
sc/inc/sc.hrc | 1
sc/inc/sccommands.h | 1
sc/sdi/docsh.sdi | 1
sc/sdi/scalc.sdi | 25 ++++++++++
sc/source/ui/docshell/docsh4.cxx | 11 ++++
sc/uiconfig/scalc/menubar/menubar.xml | 2
sfx2/inc/sfx2/sfxsids.hrc | 1
sfx2/source/appl/appopen.cxx | 11 ++++
sfx2/source/appl/appuno.cxx | 19 +++++++
10 files changed, 74 insertions(+), 3 deletions(-)
New commits:
commit 124c020f4290911d2bfb8216c9680734722c8db7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed May 23 01:41:42 2012 -0400
Receive the file open command in Calc in order to pass doc service name.
This way the type detection is guaranteed to receive the document service
name whenever a file is being opened from Calc.
Change-Id: I0eec06d4ca1f3f30bcbc5685af73392276990d69
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index fc5fcaf..3104810 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1529,6 +1529,11 @@
<value xml:lang="en-US">Insert Date Field (variable)</value>
</prop>
</node>
+ <node oor:name=".uno:OpenFromCalc" 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:AuditMenu" oor:op="replace">
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 59b6564..1860bcf 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -296,6 +296,7 @@
#define FID_DOC_MANAGER (SC_FUNCTION_START + 1)
#define FID_CURSOR_ENTER (SC_FUNCTION_START + 2)
#define SID_MAIL (SC_FUNCTION_START + 3)
+#define SID_OPEN_CALC (SC_FUNCTION_START + 4)
#define FILE_MENU_END (SC_FUNCTION_START + 20)
#define EDIT_MENU_START (FILE_MENU_END)
diff --git a/sc/inc/sccommands.h b/sc/inc/sccommands.h
index c16902e..3bac2d8 100644
--- a/sc/inc/sccommands.h
+++ b/sc/inc/sccommands.h
@@ -334,6 +334,7 @@
#define CMD_FID_TAB_EVENTS ".uno:TableEvents"
#define CMD_FID_TAB_MENU_SET_TAB_BG_COLOR ".uno:SetTabBgColor"
#define CMD_FID_TAB_SET_TAB_BG_COLOR ".uno:TabBgColor"
+#define CMD_SID_OPEN_CALC ".uno:OpenFromCalc"
#endif
diff --git a/sc/sdi/docsh.sdi b/sc/sdi/docsh.sdi
index 3cc5609..5891c10 100644
--- a/sc/sdi/docsh.sdi
+++ b/sc/sdi/docsh.sdi
@@ -73,6 +73,7 @@ interface TableDocument
uuid = "BA338A42-064E-11d0-89CB-008029E4B0B1" ;
]
{
+ SID_OPEN_CALC [ ExecMethod = Execute; ]
SID_SBA_IMPORT [ ExecMethod = Execute; ]
SID_SC_CELLS [ ExecMethod = Execute; ]
SID_SC_CELLTEXT [ ExecMethod = Execute; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index a39c884..b924b8e 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -8072,3 +8072,28 @@ SfxVoidItem InsertFieldDateVariable SID_INSERT_FIELD_DATE_VAR
ToolBoxConfig = FALSE,
GroupId = GID_OPTIONS;
]
+
+
+SfxVoidItem OpenFromCalc SID_OPEN_CALC
+()
+[
+ /* 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 = FALSE,
+ GroupId = GID_OPTIONS;
+]
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f01b510..a55f46f 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -30,7 +30,7 @@
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
-
+
using namespace ::com::sun::star;
@@ -67,6 +67,7 @@ using namespace ::com::sun::star;
#include <sfx2/passwd.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/docinsert.hxx>
+#include "sfx2/dispatch.hxx"
#include <svl/PasswordHelper.hxx>
#include <svl/documentlockfile.hxx>
#include <svl/sharecontrolfile.hxx>
@@ -1096,6 +1097,14 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
break;
+ case SID_OPEN_CALC:
+ {
+ SfxStringItem aApp(SID_DOC_SERVICE, rtl::OUString("com.sun.star.sheet.SpreadsheetDocument"));
+ SfxStringItem aTarget(SID_TARGETNAME, rtl::OUString("_blank"));
+ GetViewData()->GetDispatcher().Execute(
+ SID_OPENDOC, SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON, &aApp, &aTarget, 0L);
+ }
+ break;
default:
{
// kleiner (?) Hack -> forward der Slots an TabViewShell
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index 45bafb9..ce3e3f2 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/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:OpenFromCalc"/>
<menu:menuitem menu:id=".uno:RecentFileList"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:AutoPilotMenu"/>
commit e58eb031374fb18aa82654c01d0f0841a437c667
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue May 22 23:47:11 2012 -0400
Add mechanism to pass doc service name to the descriptor when opening a file.
This info will be used during type detection for more clever filter
selection.
Change-Id: I66a52ff6f425e97884afd1c85831c11381fb695d
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index fbd8995..53fd3ee 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -160,6 +160,7 @@
#define SID_RELOAD (SID_SFX_START + 508)
#define SID_PRINTDOCDIRECT (SID_SFX_START + 509)
#define SID_PICKLIST (SID_SFX_START + 510)
+#define SID_DOC_SERVICE (SID_SFX_START + 511)
#define SID_ATTR_XWINDOW (SID_SFX_START + 777)
#define SID_PLUGIN_MODE (SID_SFX_START + 827)
#define SID_EXPORTDOC (SID_SFX_START + 829)
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index ae5a696..33b5183 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -689,6 +689,11 @@ bool lcl_isFilterNativelySupported(const SfxFilter& rFilter)
void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
{
+ rtl::OUString aDocService;
+ SFX_REQUEST_ARG(rReq, pDocSrvItem, SfxStringItem, SID_DOC_SERVICE, false);
+ if (pDocSrvItem)
+ aDocService = pDocSrvItem->GetValue();
+
sal_uInt16 nSID = rReq.GetSlot();
SFX_REQUEST_ARG( rReq, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False );
if ( pFileNameItem )
@@ -798,6 +803,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
::framework::PreventDuplicateInteraction::InteractionInfo aRule (aInteraction, 1);
pHandler->addInteractionRule(aRule);
+ if (!aDocService.isEmpty())
+ {
+ rReq.RemoveItem(SID_DOC_SERVICE);
+ rReq.AppendItem(SfxStringItem(SID_DOC_SERVICE, aDocService));
+ }
+
for(std::vector<rtl::OUString>::const_iterator i = pURLList.begin(); i != pURLList.end(); ++i)
{
rReq.RemoveItem( SID_FILE_NAME );
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 8dfb849..5d13416 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -185,6 +185,7 @@ static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
static char const sEncryptionData[] = "EncryptionData";
+static char const sDocumentService[] = "DocumentService";
void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
@@ -871,6 +872,13 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque
if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
}
+ else if (aName == sDocumentService)
+ {
+ rtl::OUString aVal;
+ bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
+ if (bOK)
+ rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
+ }
#ifdef DBG_UTIL
else
--nFoundArgs;
@@ -1094,6 +1102,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
nAdditional++;
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
nAdditional++;
+ if ( rSet.GetItemState( SID_DOC_SERVICE ) == SFX_ITEM_SET )
+ nAdditional++;
// consider additional arguments
nProps += nAdditional;
@@ -1229,7 +1239,9 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
continue;
if ( nId == SID_NOAUTOSAVE )
continue;
- if ( nId == SID_ENCRYPTIONDATA )
+ if ( nId == SID_ENCRYPTIONDATA )
+ continue;
+ if ( nId == SID_DOC_SERVICE )
continue;
// used only internally
@@ -1629,6 +1641,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
+ if ( rSet.GetItemState( SID_DOC_SERVICE, sal_False, &pItem ) == SFX_ITEM_SET )
+ {
+ pValue[nActProp].Name = rtl::OUString(sDocumentService);
+ pValue[nActProp++].Value <<= rtl::OUString(static_cast<const SfxStringItem*>(pItem)->GetValue());
+ }
}
}
More information about the Libreoffice-commits
mailing list