summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJennifer Liebel <jliebel94@gmail.com>2014-09-23 09:14:21 +0000
committerSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-09-24 19:30:05 +0000
commite16c8534f446a7cc311d6d5026aae5457e4f8e6c (patch)
tree1f88836de838d56db0898d60bc732a751a19011e
parent16ea2665cdfa0b3d7b0d7abcdaae8d60f7654d24 (diff)
fdo#47302: Added insert->fields->page title button
Change-Id: Iebc8298a7e6a7d423d2667eec8a46a936cc4d2cd Reviewed-on: https://gerrit.libreoffice.org/11599 Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com> Tested-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
-rw-r--r--editeng/source/items/flditem.cxx36
-rw-r--r--include/editeng/flditem.hxx13
-rw-r--r--offapi/com/sun/star/text/textfield/Type.idl1
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu5
-rw-r--r--scripting/workben/bindings/impressmenubar.xml1
-rw-r--r--sd/inc/app.hrc1
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/sdi/outlnvsh.sdi5
-rw-r--r--sd/sdi/sdraw.sdi24
-rw-r--r--sd/source/ui/app/sdmod2.cxx27
-rw-r--r--sd/source/ui/view/drviews2.cxx8
-rw-r--r--sd/source/ui/view/drviews7.cxx1
-rw-r--r--sd/source/ui/view/outlnvs2.cxx5
-rw-r--r--sd/uiconfig/sdraw/menubar/menubar.xml1
-rw-r--r--sd/uiconfig/simpress/menubar/menubar.xml5
15 files changed, 136 insertions, 2 deletions
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 69a1b2ce0ccf..73074e8e0c60 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 961b5e08b987..96720fe2c065 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 91102afb1944..42fcb8bfd3ab 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 6e32a5ecd43d..b1aecb9a621f 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 a8d7f1518ce7..c0b3a4683853 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 0bbd319ef9fc..213057745ff8 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 151900826d00..216647073923 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 c78b93de3ab2..c1cf57239b79 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 a77402625816..a397d021ad1c 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 2ad2f2b13a94..8a25098858a6 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 59ece90fb2d7..c6e7718021e0 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 67227ba524db..ccb460184933 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 249780c5177e..ca46d998eaf3 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 d0c088a824ce..ddcd289bd84b 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 e2e9d3888812..8e75035dd1c7 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"/>