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

Support document title field in cells.

Change-Id: Ie874ba4c5bffbd36d38868b0602687c64649c3f0
üst aceff352
...@@ -1519,6 +1519,11 @@ ...@@ -1519,6 +1519,11 @@
<value xml:lang="en-US">Insert Sheet Name Field</value> <value xml:lang="en-US">Insert Sheet Name Field</value>
</prop> </prop>
</node> </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"> <node oor:name=".uno:InsertFieldDateVariable" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string"> <prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Insert Date Field (variable)</value> <value xml:lang="en-US">Insert Date Field (variable)</value>
......
...@@ -717,7 +717,8 @@ ...@@ -717,7 +717,8 @@
#define SID_DELETE_SCENARIO (SID_NEW_SLOTS+95) #define SID_DELETE_SCENARIO (SID_NEW_SLOTS+95)
#define SID_EDIT_SCENARIO (SID_NEW_SLOTS+96) #define SID_EDIT_SCENARIO (SID_NEW_SLOTS+96)
#define SID_INSERT_FIELD_SHEET (SID_NEW_SLOTS+97) #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 // idl parameter
......
...@@ -100,6 +100,7 @@ interface TableText ...@@ -100,6 +100,7 @@ interface TableText
SID_INSERT_ZWNBSP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_INSERT_ZWNBSP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_INSERT_FIELD_SHEET [ ExecMethod = Execute; StateMethod = GetState; ] 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; ] SID_INSERT_FIELD_DATE_VAR [ ExecMethod = Execute; StateMethod = GetState; ]
} }
......
...@@ -8025,6 +8025,30 @@ SfxVoidItem InsertFieldSheet SID_INSERT_FIELD_SHEET ...@@ -8025,6 +8025,30 @@ SfxVoidItem InsertFieldSheet SID_INSERT_FIELD_SHEET
GroupId = GID_OPTIONS; 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 SfxVoidItem InsertFieldDateVariable SID_INSERT_FIELD_DATE_VAR
() ()
[ [
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <unotools/syslocale.hxx> #include <unotools/syslocale.hxx>
#include <com/sun/star/text/textfield/Type.hpp> #include <com/sun/star/text/textfield/Type.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include "editutil.hxx" #include "editutil.hxx"
#include "global.hxx" #include "global.hxx"
...@@ -762,6 +763,14 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField, ...@@ -762,6 +763,14 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField,
aRet = ScGlobal::pLocaleData->getDate(aDate); aRet = ScGlobal::pLocaleData->getDate(aDate);
} }
break; 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: case text::textfield::Type::TABLE:
{ {
const SvxTableField* pField = static_cast<const SvxTableField*>(pFieldData); const SvxTableField* pField = static_cast<const SvxTableField*>(pFieldData);
......
...@@ -446,6 +446,11 @@ Menu RID_POPUP_EDIT ...@@ -446,6 +446,11 @@ Menu RID_POPUP_EDIT
Identifier = SID_INSERT_FIELD_SHEET ; Identifier = SID_INSERT_FIELD_SHEET ;
Text [ en-US ] = "Sheet Name" ; Text [ en-US ] = "Sheet Name" ;
}; };
MenuItem
{
Identifier = SID_INSERT_FIELD_TITLE ;
Text [ en-US ] = "Title" ;
};
}; };
}; };
}; };
......
...@@ -972,6 +972,7 @@ ScEditFieldObj::ScEditFieldObj( ...@@ -972,6 +972,7 @@ ScEditFieldObj::ScEditFieldObj(
{ {
switch (meType) switch (meType)
{ {
case text::textfield::Type::FILE:
case text::textfield::Type::EXTENDED_FILE: case text::textfield::Type::EXTENDED_FILE:
pPropSet = lcl_GetFileFieldPropertySet(); pPropSet = lcl_GetFileFieldPropertySet();
break; break;
...@@ -1151,6 +1152,7 @@ void SAL_CALL ScEditFieldObj::setPropertyValue( ...@@ -1151,6 +1152,7 @@ void SAL_CALL ScEditFieldObj::setPropertyValue(
case text::textfield::Type::URL: case text::textfield::Type::URL:
setPropertyValueURL(aPropertyName, aValue); setPropertyValueURL(aPropertyName, aValue);
break; break;
case text::textfield::Type::FILE:
case text::textfield::Type::EXTENDED_FILE: case text::textfield::Type::EXTENDED_FILE:
setPropertyValueFile(aPropertyName, aValue); setPropertyValueFile(aPropertyName, aValue);
break; break;
...@@ -1204,6 +1206,7 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper ...@@ -1204,6 +1206,7 @@ uno::Any SAL_CALL ScEditFieldObj::getPropertyValue( const rtl::OUString& aProper
{ {
case text::textfield::Type::URL: case text::textfield::Type::URL:
return getPropertyValueURL(aPropertyName); return getPropertyValueURL(aPropertyName);
case text::textfield::Type::FILE:
case text::textfield::Type::EXTENDED_FILE: case text::textfield::Type::EXTENDED_FILE:
return getPropertyValueFile(aPropertyName); return getPropertyValueFile(aPropertyName);
case text::textfield::Type::DATE: case text::textfield::Type::DATE:
......
...@@ -274,7 +274,7 @@ static const ProvNamesId_Type aProvNamesId[] = ...@@ -274,7 +274,7 @@ static const ProvNamesId_Type aProvNamesId[] =
{ "com.sun.star.text.TextField.Date", SC_SERVICE_DATEFIELD }, { "com.sun.star.text.TextField.Date", SC_SERVICE_DATEFIELD },
{ "com.sun.star.text.TextField.Time", SC_SERVICE_TIMEFIELD }, { "com.sun.star.text.TextField.Time", SC_SERVICE_TIMEFIELD },
{ "com.sun.star.text.TextField.DateTime", SC_SERVICE_EXT_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.FileName", SC_SERVICE_FILEFIELD },
{ "com.sun.star.text.TextField.SheetName", SC_SERVICE_SHEETFIELD }, { "com.sun.star.text.TextField.SheetName", SC_SERVICE_SHEETFIELD },
{ "com.sun.star.style.CellStyle", SC_SERVICE_CELLSTYLE }, { "com.sun.star.style.CellStyle", SC_SERVICE_CELLSTYLE },
...@@ -324,7 +324,7 @@ static const ProvNamesId_Type aProvNamesId[] = ...@@ -324,7 +324,7 @@ static const ProvNamesId_Type aProvNamesId[] =
{ "com.sun.star.text.textfield.Date", SC_SERVICE_DATEFIELD }, { "com.sun.star.text.textfield.Date", SC_SERVICE_DATEFIELD },
{ "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD }, { "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
{ "com.sun.star.text.textfield.DateTime", SC_SERVICE_EXT_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.FileName", SC_SERVICE_FILEFIELD },
{ "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }, { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
{ "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS }, { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
......
...@@ -621,6 +621,13 @@ void ScEditShell::Execute( SfxRequest& rReq ) ...@@ -621,6 +621,13 @@ void ScEditShell::Execute( SfxRequest& rReq )
pTableView->InsertField(aItem); pTableView->InsertField(aItem);
} }
break; break;
case SID_INSERT_FIELD_TITLE:
{
SvxFileField aField;
SvxFieldItem aItem(aField, EE_FEATURE_FIELD);
pTableView->InsertField(aItem);
}
break;
case SID_INSERT_FIELD_DATE_VAR: case SID_INSERT_FIELD_DATE_VAR:
{ {
SvxDateField aField; SvxDateField aField;
...@@ -729,6 +736,7 @@ void ScEditShell::GetState( SfxItemSet& rSet ) ...@@ -729,6 +736,7 @@ void ScEditShell::GetState( SfxItemSet& rSet )
} }
break; break;
case SID_INSERT_FIELD_SHEET: case SID_INSERT_FIELD_SHEET:
case SID_INSERT_FIELD_TITLE:
case SID_INSERT_FIELD_DATE_VAR: case SID_INSERT_FIELD_DATE_VAR:
break; break;
......
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