[Libreoffice-commits] .: officecfg/registry sc/inc sc/sdi sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue May 8 13:08:05 PDT 2012


 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    5 ++
 sc/inc/sc.hrc                                                     |    3 -
 sc/sdi/editsh.sdi                                                 |    1 
 sc/sdi/scalc.sdi                                                  |   24 ++++++++++
 sc/source/core/tool/editutil.cxx                                  |    9 +++
 sc/source/ui/src/popup.src                                        |    5 ++
 sc/source/ui/unoobj/fielduno.cxx                                  |    3 +
 sc/source/ui/unoobj/servuno.cxx                                   |    4 -
 sc/source/ui/view/editsh.cxx                                      |    8 +++
 9 files changed, 59 insertions(+), 3 deletions(-)

New commits:
commit cd708b56dc614a3e81921f1b28d3102264dfa53a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 8 16:08:02 2012 -0400

    Support document title field in cells.
    
    Change-Id: Ie874ba4c5bffbd36d38868b0602687c64649c3f0

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 97fcfc8..fc5fcaf 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 f7a556d..68a039c 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 d306091..355f158 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 e9a0b7a..a39c884 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 29fe83d..5724202 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 67f4089..e3e9a11 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 1168b12..60c8e75 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 e4c1558..32cfb75 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 adb60bb..79c1e9b 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;
 


More information about the Libreoffice-commits mailing list