summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-05-08 16:08:02 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-05-08 16:08:02 -0400
commitcd708b56dc614a3e81921f1b28d3102264dfa53a (patch)
tree1a142ed6f27d58cdc2ffef8992cfd83853b097b3
parentaceff35230dab8d22a5fdd4cd9a7a982b9754fa2 (diff)
Support document title field in cells.
Change-Id: Ie874ba4c5bffbd36d38868b0602687c64649c3f0
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu5
-rw-r--r--sc/inc/sc.hrc3
-rw-r--r--sc/sdi/editsh.sdi1
-rw-r--r--sc/sdi/scalc.sdi24
-rw-r--r--sc/source/core/tool/editutil.cxx9
-rw-r--r--sc/source/ui/src/popup.src5
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx3
-rw-r--r--sc/source/ui/unoobj/servuno.cxx4
-rw-r--r--sc/source/ui/view/editsh.cxx8
9 files changed, 59 insertions, 3 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 97fcfc86e4e8..fc5fcaf7e170 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1519,6 +1519,11 @@
<value xml:lang="en-US">Insert Sheet Name Field</value>
</prop>
</node>
+ <node oor:name=".uno:InsertFieldDocTitle" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Insert Document Title Field</value>
+ </prop>
+ </node>
<node oor:name=".uno:InsertFieldDateVariable" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Insert Date Field (variable)</value>
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index f7a556d0594d..68a039ce1f0a 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -717,7 +717,8 @@
#define SID_DELETE_SCENARIO (SID_NEW_SLOTS+95)
#define SID_EDIT_SCENARIO (SID_NEW_SLOTS+96)
#define SID_INSERT_FIELD_SHEET (SID_NEW_SLOTS+97)
-#define SID_INSERT_FIELD_DATE_VAR (SID_NEW_SLOTS+98)
+#define SID_INSERT_FIELD_TITLE (SID_NEW_SLOTS+98)
+#define SID_INSERT_FIELD_DATE_VAR (SID_NEW_SLOTS+99)
// idl parameter
diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi
index d306091fa94b..355f158d6af7 100644
--- a/sc/sdi/editsh.sdi
+++ b/sc/sdi/editsh.sdi
@@ -100,6 +100,7 @@ interface TableText
SID_INSERT_ZWNBSP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_INSERT_FIELD_SHEET [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_INSERT_FIELD_TITLE [ ExecMethod = Execute; StateMethod = GetState; ]
SID_INSERT_FIELD_DATE_VAR [ ExecMethod = Execute; StateMethod = GetState; ]
}
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index e9a0b7a5c383..a39c8842db07 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -8025,6 +8025,30 @@ SfxVoidItem InsertFieldSheet SID_INSERT_FIELD_SHEET
GroupId = GID_OPTIONS;
]
+SfxVoidItem InsertFieldDocTitle SID_INSERT_FIELD_TITLE
+()
+[
+ /* 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;
+]
+
SfxVoidItem InsertFieldDateVariable SID_INSERT_FIELD_DATE_VAR
()
[
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 29fe83d1f474..5724202375c8 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -51,6 +51,7 @@
#include <unotools/syslocale.hxx>
#include <com/sun/star/text/textfield/Type.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
#include "editutil.hxx"
#include "global.hxx"
@@ -762,6 +763,14 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
aRet = ScGlobal::pLocaleData->getDate(aDate);
}
break;
+ case text::textfield::Type::FILE:
+ {
+ SfxObjectShell* pDocShell = mpDoc->GetDocumentShell();
+ aRet = pDocShell->getDocProperties()->getTitle();
+ if (aRet.isEmpty())
+ aRet = pDocShell->GetTitle();
+ }
+ break;
case text::textfield::Type::TABLE:
{
const SvxTableField* pField = static_cast<const SvxTableField*>(pFieldData);
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
index 67f4089a3380..e3e9a112878d 100644
--- a/sc/source/ui/src/popup.src
+++ b/sc/source/ui/src/popup.src
@@ -446,6 +446,11 @@ Menu RID_POPUP_EDIT
Identifier = SID_INSERT_FIELD_SHEET ;
Text [ en-US ] = "Sheet Name" ;
};
+ MenuItem
+ {
+ Identifier = SID_INSERT_FIELD_TITLE ;
+ Text [ en-US ] = "Title" ;
+ };
};
};
};
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 1168b12589a5..60c8e755f535 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -972,6 +972,7 @@ ScEditFieldObj::ScEditFieldObj(
{
switch (meType)
{
+ case text::textfield::Type::FILE:
case text::textfield::Type::EXTENDED_FILE:
pPropSet = lcl_GetFileFieldPropertySet();
break;
@@ -1151,6 +1152,7 @@ void SAL_CALL ScEditFieldObj::setPropertyValue(
case text::textfield::Type::URL:
setPropertyValueURL(aPropertyName, aValue);
break;
+ case text::textfield::Type::FILE:
case text::textfield::Type::EXTENDED_FILE:
setPropertyValueFile(aPropertyName, aValue);
break;
@@ -1204,6 +1206,7 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper
{
case text::textfield::Type::URL:
return getPropertyValueURL(aPropertyName);
+ case text::textfield::Type::FILE:
case text::textfield::Type::EXTENDED_FILE:
return getPropertyValueFile(aPropertyName);
case text::textfield::Type::DATE:
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index e4c1558fc4fc..32cfb755cc45 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -274,7 +274,7 @@ static const ProvNamesId_Type aProvNamesId[] =
{ "com.sun.star.text.TextField.Date", SC_SERVICE_DATEFIELD },
{ "com.sun.star.text.TextField.Time", SC_SERVICE_TIMEFIELD },
{ "com.sun.star.text.TextField.DateTime", SC_SERVICE_EXT_TIMEFIELD },
- { "com.sun.star.text.TextField.DocumentTitle", SC_SERVICE_TITLEFIELD },
+ { "com.sun.star.text.TextField.DocInfo.Title", SC_SERVICE_TITLEFIELD },
{ "com.sun.star.text.TextField.FileName", SC_SERVICE_FILEFIELD },
{ "com.sun.star.text.TextField.SheetName", SC_SERVICE_SHEETFIELD },
{ "com.sun.star.style.CellStyle", SC_SERVICE_CELLSTYLE },
@@ -324,7 +324,7 @@ static const ProvNamesId_Type aProvNamesId[] =
{ "com.sun.star.text.textfield.Date", SC_SERVICE_DATEFIELD },
{ "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
{ "com.sun.star.text.textfield.DateTime", SC_SERVICE_EXT_TIMEFIELD },
- { "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
+ { "com.sun.star.text.textfield.docinfo.Title", SC_SERVICE_TITLEFIELD },
{ "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
{ "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
{ "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index adb60bb5a485..79c1e9bc466a 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -621,6 +621,13 @@ void ScEditShell::Execute( SfxRequest& rReq )
pTableView->InsertField(aItem);
}
break;
+ case SID_INSERT_FIELD_TITLE:
+ {
+ SvxFileField aField;
+ SvxFieldItem aItem(aField, EE_FEATURE_FIELD);
+ pTableView->InsertField(aItem);
+ }
+ break;
case SID_INSERT_FIELD_DATE_VAR:
{
SvxDateField aField;
@@ -729,6 +736,7 @@ void ScEditShell::GetState( SfxItemSet& rSet )
}
break;
case SID_INSERT_FIELD_SHEET:
+ case SID_INSERT_FIELD_TITLE:
case SID_INSERT_FIELD_DATE_VAR:
break;