[Libreoffice-commits] core.git: editeng/source include/editeng offapi/com officecfg/registry scripting/workben sd/inc sd/sdi sd/source sd/uiconfig
Jennifer Liebel
jliebel94 at gmail.com
Wed Sep 24 12:30:38 PDT 2014
editeng/source/items/flditem.cxx | 36 ++++++++++
include/editeng/flditem.hxx | 13 +++
offapi/com/sun/star/text/textfield/Type.idl | 1
officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 5 +
scripting/workben/bindings/impressmenubar.xml | 1
sd/inc/app.hrc | 1
sd/sdi/_drvwsh.sdi | 5 +
sd/sdi/outlnvsh.sdi | 5 +
sd/sdi/sdraw.sdi | 24 ++++++
sd/source/ui/app/sdmod2.cxx | 27 +++++++
sd/source/ui/view/drviews2.cxx | 8 ++
sd/source/ui/view/drviews7.cxx | 1
sd/source/ui/view/outlnvs2.cxx | 5 +
sd/uiconfig/sdraw/menubar/menubar.xml | 1
sd/uiconfig/simpress/menubar/menubar.xml | 5 -
15 files changed, 136 insertions(+), 2 deletions(-)
New commits:
commit e16c8534f446a7cc311d6d5026aae5457e4f8e6c
Author: Jennifer Liebel <jliebel94 at gmail.com>
Date: Tue Sep 23 09:14:21 2014 +0000
fdo#47302: Added insert->fields->page title button
Change-Id: Iebc8298a7e6a7d423d2667eec8a46a936cc4d2cd
Reviewed-on: https://gerrit.libreoffice.org/11599
Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Tested-by: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 69a1b2c..73074e8 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -117,6 +117,8 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe
return new SvxPageField();
case text::textfield::Type::PAGES:
return new SvxPagesField();
+ case text::textfield::Type::PAGE_TITLE:
+ return new SvxPageTitleField();
case text::textfield::Type::DOCINFO_TITLE:
return new SvxFileField();
case text::textfield::Type::TABLE:
@@ -607,7 +609,40 @@ MetaAction* SvxURLField::createBeginComment() const
2*aURL.getLength() );
}
+//
+// SvxPageTitleField methods
+//
+SV_IMPL_PERSIST1( SvxPageTitleField, SvxFieldData );
+
+SvxPageTitleField::SvxPageTitleField() {}
+
+SvxFieldData* SvxPageTitleField::Clone() const
+{
+ return new SvxPageTitleField();
+}
+
+bool SvxPageTitleField::operator==( const SvxFieldData& rCmp ) const
+{
+ return ( rCmp.Type() == TYPE(SvxPageTitleField) );
+}
+
+void SvxPageTitleField::Load( SvPersistStream & /*rStm*/ )
+{
+}
+
+void SvxPageTitleField::Save( SvPersistStream & /*rStm*/ )
+{
+}
+
+MetaAction* SvxPageTitleField::createBeginComment() const
+{
+ return new MetaCommentAction( "FIELD_SEQ_BEGIN;PageTitleField" );
+}
+
+//
+// SvxPagesField
+//
// The fields that were removed from Calc:
@@ -1152,6 +1187,7 @@ SvClassManager& SvxFieldItem::GetClassManager()
pClassMgr->Register(SvxURLField::StaticClassId(), SvxURLField::CreateInstance);
pClassMgr->Register(SvxDateField::StaticClassId(), SvxDateField::CreateInstance);
pClassMgr->Register(SvxPageField::StaticClassId(), SvxPageField::CreateInstance);
+ pClassMgr->Register(SvxPageTitleField::StaticClassId(), SvxPageTitleField::CreateInstance);
pClassMgr->Register(SvxTimeField::StaticClassId(), SvxTimeField::CreateInstance);
pClassMgr->Register(SvxExtTimeField::StaticClassId(), SvxExtTimeField::CreateInstance);
pClassMgr->Register(SvxExtFileField::StaticClassId(), SvxExtFileField::CreateInstance);
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
index 961b5e0..96720fe 100644
--- a/include/editeng/flditem.hxx
+++ b/include/editeng/flditem.hxx
@@ -25,6 +25,7 @@
#include <svl/poolitem.hxx>
#include <tools/pstm.hxx>
#include <editeng/editengdllapi.h>
+#include <../sd/inc/sdpage.hxx> // for Page Title field
#include <com/sun/star/text/textfield/Type.hpp>
@@ -191,6 +192,18 @@ public:
virtual MetaAction* createBeginComment() const SAL_OVERRIDE;
};
+class EDITENG_DLLPUBLIC SvxPageTitleField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxPageTitleField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE_TITLE )
+ SvxPageTitleField();
+
+ virtual SvxFieldData* Clone() const SAL_OVERRIDE;
+ virtual bool operator==( const SvxFieldData& ) const SAL_OVERRIDE;
+
+ virtual MetaAction* createBeginComment() const SAL_OVERRIDE;
+};
+
class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
{
public:
diff --git a/offapi/com/sun/star/text/textfield/Type.idl b/offapi/com/sun/star/text/textfield/Type.idl
index 91102af..42fcb8b 100644
--- a/offapi/com/sun/star/text/textfield/Type.idl
+++ b/offapi/com/sun/star/text/textfield/Type.idl
@@ -42,6 +42,7 @@ constants Type
const long PRESENTATION_HEADER = 11;
const long PRESENTATION_FOOTER = 12;
const long PRESENTATION_DATE_TIME = 13;
+ const long PAGE_TITLE = 14;
};
}; }; }; }; };
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 6e32a5e..b1aecb9 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -488,6 +488,11 @@
<value xml:lang="en-US">~Page Number</value>
</prop>
</node>
+ <node oor:name=".uno:InsertPageTitleField" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Page Tit~le</value>
+ </prop>
+ </node>
<node oor:name=".uno:InsertPagesField" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Page ~Count</value>
diff --git a/scripting/workben/bindings/impressmenubar.xml b/scripting/workben/bindings/impressmenubar.xml
index a8d7f15..c0b3a46 100644
--- a/scripting/workben/bindings/impressmenubar.xml
+++ b/scripting/workben/bindings/impressmenubar.xml
@@ -187,6 +187,7 @@
<menu:menuseparator/>
<menu:menuitem menu:id="slot:27364" menu:helpid="27364" menu:label="~Author"/>
<menu:menuitem menu:id="slot:27361" menu:helpid="27361" menu:label="~Page Number"/>
+ <menu:menuitem menu:id="slot:27465" menu:helpid="27465" menu:label="~Page Title"/>
<menu:menuitem menu:id="slot:27363" menu:helpid="27363" menu:label="~File Name"/>
</menu:menupopup>
</menu:menu>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 0bbd319..2130577 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -368,6 +368,7 @@
#define SID_TITLE_MASTERPAGE (SID_SD_START+351)
#define SID_INSERTPAGE_QUICK (SID_SD_START+352)
// free
+#define SID_INSERT_FLD_PAGE_TITLE (SID_SD_START+356)
#define SID_INSERT_FLD_DATE_VAR (SID_SD_START+357)
#define SID_INSERT_FLD_DATE_FIX (SID_SD_START+358)
#define SID_INSERT_FLD_TIME_VAR (SID_SD_START+359)
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 1519008..2166470 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2257,6 +2257,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ SID_INSERT_FLD_PAGE_TITLE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
SID_INSERT_FLD_PAGES // ole : no, status : play rec
[
ExecMethod = FuTemporary ;
diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi
index c78b93d..c1cf572 100644
--- a/sd/sdi/outlnvsh.sdi
+++ b/sd/sdi/outlnvsh.sdi
@@ -411,6 +411,11 @@ interface OutlineView
ExecMethod = FuTemporaryModify ;
StateMethod = GetMenuState ;
]
+ SID_INSERT_FLD_PAGE_TITLE // ole : no, status : play rec
+ [
+ ExecMethod = FuTemporaryModify ;
+ StateMethod = GetMenuState ;
+ ]
SID_INSERT_FLD_PAGE // ole : no, status : play rec
[
ExecMethod = FuTemporaryModify ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index a774026..a397d02 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -3362,6 +3362,30 @@ SfxVoidItem InsertPageField SID_INSERT_FLD_PAGE
GroupId = GID_INSERT;
]
+SfxVoidItem InsertPageTitleField SID_INSERT_FLD_PAGE_TITLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
SfxVoidItem InsertPagesField SID_INSERT_FLD_PAGES
()
[
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 2ad2f2b..8a25098 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -246,6 +246,33 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo)
pInfo->SetRepresentation( aRepresentation );
}
+
+ else if( dynamic_cast< const SvxPageTitleField* >(pField) )
+ {
+ OUString aRepresentation(" ");
+
+ ::sd::ViewShell* pViewSh = pDocShell ? pDocShell->GetViewShell() : NULL;
+ if(pViewSh == NULL)
+ {
+ ::sd::ViewShellBase* pBase = PTR_CAST(::sd::ViewShellBase, SfxViewShell::Current());
+ if(pBase)
+ pViewSh = pBase->GetMainViewShell().get();
+ }
+ if( !pDoc && pViewSh )
+ pDoc = pViewSh->GetDoc();
+
+ bool bMasterView;
+ SdPage* pPage = GetCurrentPage( pViewSh, pInfo, bMasterView );
+
+ if( pPage && pDoc && !bMasterView )
+ {
+ aRepresentation = pPage->GetName();
+ }
+
+ pInfo->SetRepresentation( aRepresentation );
+ }
+ else if( dynamic_cast< const SvxPagesField* >(pField) )
+ OUString aRepresentation;
else if( dynamic_cast< const SvxPagesField* >(pField) )
{
OUString aRepresentation(" ");
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 59ece90..c6e7718 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1873,6 +1873,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_INSERT_FLD_TIME_VAR:
case SID_INSERT_FLD_AUTHOR:
case SID_INSERT_FLD_PAGE:
+ case SID_INSERT_FLD_PAGE_TITLE:
case SID_INSERT_FLD_PAGES:
case SID_INSERT_FLD_FILE:
{
@@ -1915,6 +1916,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
break;
+ case SID_INSERT_FLD_PAGE_TITLE:
+ {
+ pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
+ nMul = 3;
+ }
+ break;
+
case SID_INSERT_FLD_PAGES:
{
pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 67227ba..ccb4601 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1114,6 +1114,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
rSet.DisableItem( SID_INSERT_FLD_PAGE );
+ rSet.DisableItem( SID_INSERT_FLD_PAGE_TITLE );
rSet.DisableItem( SID_INSERT_FLD_PAGES );
rSet.DisableItem( SID_INSERT_FLD_FILE );
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index 249780c..ca46d99 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -484,6 +484,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
case SID_INSERT_FLD_TIME_VAR:
case SID_INSERT_FLD_AUTHOR:
case SID_INSERT_FLD_PAGE:
+ case SID_INSERT_FLD_PAGE_TITLE:
case SID_INSERT_FLD_PAGES:
case SID_INSERT_FLD_FILE:
{
@@ -523,6 +524,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
pFieldItem.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ));
break;
+ case SID_INSERT_FLD_PAGE_TITLE:
+ pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
+ break;
+
case SID_INSERT_FLD_PAGES:
pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
break;
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
index d0c088a..ddcd289 100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -164,6 +164,7 @@
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:InsertAuthorField"/>
<menu:menuitem menu:id=".uno:InsertPageField"/>
+ <menu:menuitem menu:id=".uno:InsertPageTitleField"/>
<menu:menuitem menu:id=".uno:InsertPagesField"/>
<menu:menuitem menu:id=".uno:InsertFileField"/>
</menu:menupopup>
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index e2e9d38..8e75035 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -180,8 +180,9 @@
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:InsertAuthorField"/>
<menu:menuitem menu:id=".uno:InsertPageField"/>
- <menu:menuitem menu:id=".uno:InsertPagesField"/>
- <menu:menuitem menu:id=".uno:InsertFileField"/>
+ <menu:menuitem menu:id=".uno:InsertPageTitleField"/>
+ <menu:menuitem menu:id=".uno:InsertPagesField"/>
+ <menu:menuitem menu:id=".uno:InsertFileField"/>
</menu:menupopup>
</menu:menu>
<menu:menuitem menu:id=".uno:InsertAnnotation"/>
More information about the Libreoffice-commits
mailing list