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>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
16ea2665cd
commit
e16c8534f4
@@ -117,6 +117,8 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe
|
|||||||
return new SvxPageField();
|
return new SvxPageField();
|
||||||
case text::textfield::Type::PAGES:
|
case text::textfield::Type::PAGES:
|
||||||
return new SvxPagesField();
|
return new SvxPagesField();
|
||||||
|
case text::textfield::Type::PAGE_TITLE:
|
||||||
|
return new SvxPageTitleField();
|
||||||
case text::textfield::Type::DOCINFO_TITLE:
|
case text::textfield::Type::DOCINFO_TITLE:
|
||||||
return new SvxFileField();
|
return new SvxFileField();
|
||||||
case text::textfield::Type::TABLE:
|
case text::textfield::Type::TABLE:
|
||||||
@@ -607,7 +609,40 @@ MetaAction* SvxURLField::createBeginComment() const
|
|||||||
2*aURL.getLength() );
|
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:
|
// The fields that were removed from Calc:
|
||||||
|
|
||||||
|
|
||||||
@@ -1152,6 +1187,7 @@ SvClassManager& SvxFieldItem::GetClassManager()
|
|||||||
pClassMgr->Register(SvxURLField::StaticClassId(), SvxURLField::CreateInstance);
|
pClassMgr->Register(SvxURLField::StaticClassId(), SvxURLField::CreateInstance);
|
||||||
pClassMgr->Register(SvxDateField::StaticClassId(), SvxDateField::CreateInstance);
|
pClassMgr->Register(SvxDateField::StaticClassId(), SvxDateField::CreateInstance);
|
||||||
pClassMgr->Register(SvxPageField::StaticClassId(), SvxPageField::CreateInstance);
|
pClassMgr->Register(SvxPageField::StaticClassId(), SvxPageField::CreateInstance);
|
||||||
|
pClassMgr->Register(SvxPageTitleField::StaticClassId(), SvxPageTitleField::CreateInstance);
|
||||||
pClassMgr->Register(SvxTimeField::StaticClassId(), SvxTimeField::CreateInstance);
|
pClassMgr->Register(SvxTimeField::StaticClassId(), SvxTimeField::CreateInstance);
|
||||||
pClassMgr->Register(SvxExtTimeField::StaticClassId(), SvxExtTimeField::CreateInstance);
|
pClassMgr->Register(SvxExtTimeField::StaticClassId(), SvxExtTimeField::CreateInstance);
|
||||||
pClassMgr->Register(SvxExtFileField::StaticClassId(), SvxExtFileField::CreateInstance);
|
pClassMgr->Register(SvxExtFileField::StaticClassId(), SvxExtFileField::CreateInstance);
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include <svl/poolitem.hxx>
|
#include <svl/poolitem.hxx>
|
||||||
#include <tools/pstm.hxx>
|
#include <tools/pstm.hxx>
|
||||||
#include <editeng/editengdllapi.h>
|
#include <editeng/editengdllapi.h>
|
||||||
|
#include <../sd/inc/sdpage.hxx> // for Page Title field
|
||||||
|
|
||||||
#include <com/sun/star/text/textfield/Type.hpp>
|
#include <com/sun/star/text/textfield/Type.hpp>
|
||||||
|
|
||||||
@@ -191,6 +192,18 @@ public:
|
|||||||
virtual MetaAction* createBeginComment() const SAL_OVERRIDE;
|
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
|
class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -42,6 +42,7 @@ constants Type
|
|||||||
const long PRESENTATION_HEADER = 11;
|
const long PRESENTATION_HEADER = 11;
|
||||||
const long PRESENTATION_FOOTER = 12;
|
const long PRESENTATION_FOOTER = 12;
|
||||||
const long PRESENTATION_DATE_TIME = 13;
|
const long PRESENTATION_DATE_TIME = 13;
|
||||||
|
const long PAGE_TITLE = 14;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; }; }; }; };
|
}; }; }; }; };
|
||||||
|
@@ -488,6 +488,11 @@
|
|||||||
<value xml:lang="en-US">~Page Number</value>
|
<value xml:lang="en-US">~Page Number</value>
|
||||||
</prop>
|
</prop>
|
||||||
</node>
|
</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">
|
<node oor:name=".uno:InsertPagesField" oor:op="replace">
|
||||||
<prop oor:name="Label" oor:type="xs:string">
|
<prop oor:name="Label" oor:type="xs:string">
|
||||||
<value xml:lang="en-US">Page ~Count</value>
|
<value xml:lang="en-US">Page ~Count</value>
|
||||||
|
@@ -187,6 +187,7 @@
|
|||||||
<menu:menuseparator/>
|
<menu:menuseparator/>
|
||||||
<menu:menuitem menu:id="slot:27364" menu:helpid="27364" menu:label="~Author"/>
|
<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: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:menuitem menu:id="slot:27363" menu:helpid="27363" menu:label="~File Name"/>
|
||||||
</menu:menupopup>
|
</menu:menupopup>
|
||||||
</menu:menu>
|
</menu:menu>
|
||||||
|
@@ -368,6 +368,7 @@
|
|||||||
#define SID_TITLE_MASTERPAGE (SID_SD_START+351)
|
#define SID_TITLE_MASTERPAGE (SID_SD_START+351)
|
||||||
#define SID_INSERTPAGE_QUICK (SID_SD_START+352)
|
#define SID_INSERTPAGE_QUICK (SID_SD_START+352)
|
||||||
// free
|
// 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_VAR (SID_SD_START+357)
|
||||||
#define SID_INSERT_FLD_DATE_FIX (SID_SD_START+358)
|
#define SID_INSERT_FLD_DATE_FIX (SID_SD_START+358)
|
||||||
#define SID_INSERT_FLD_TIME_VAR (SID_SD_START+359)
|
#define SID_INSERT_FLD_TIME_VAR (SID_SD_START+359)
|
||||||
|
@@ -2257,6 +2257,11 @@ interface DrawView
|
|||||||
ExecMethod = FuTemporary ;
|
ExecMethod = FuTemporary ;
|
||||||
StateMethod = GetMenuState ;
|
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
|
SID_INSERT_FLD_PAGES // ole : no, status : play rec
|
||||||
[
|
[
|
||||||
ExecMethod = FuTemporary ;
|
ExecMethod = FuTemporary ;
|
||||||
|
@@ -411,6 +411,11 @@ interface OutlineView
|
|||||||
ExecMethod = FuTemporaryModify ;
|
ExecMethod = FuTemporaryModify ;
|
||||||
StateMethod = GetMenuState ;
|
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
|
SID_INSERT_FLD_PAGE // ole : no, status : play rec
|
||||||
[
|
[
|
||||||
ExecMethod = FuTemporaryModify ;
|
ExecMethod = FuTemporaryModify ;
|
||||||
|
@@ -3362,6 +3362,30 @@ SfxVoidItem InsertPageField SID_INSERT_FLD_PAGE
|
|||||||
GroupId = GID_INSERT;
|
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
|
SfxVoidItem InsertPagesField SID_INSERT_FLD_PAGES
|
||||||
()
|
()
|
||||||
[
|
[
|
||||||
|
@@ -246,6 +246,33 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo)
|
|||||||
|
|
||||||
pInfo->SetRepresentation( aRepresentation );
|
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) )
|
else if( dynamic_cast< const SvxPagesField* >(pField) )
|
||||||
{
|
{
|
||||||
OUString aRepresentation(" ");
|
OUString aRepresentation(" ");
|
||||||
|
@@ -1873,6 +1873,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
|||||||
case SID_INSERT_FLD_TIME_VAR:
|
case SID_INSERT_FLD_TIME_VAR:
|
||||||
case SID_INSERT_FLD_AUTHOR:
|
case SID_INSERT_FLD_AUTHOR:
|
||||||
case SID_INSERT_FLD_PAGE:
|
case SID_INSERT_FLD_PAGE:
|
||||||
|
case SID_INSERT_FLD_PAGE_TITLE:
|
||||||
case SID_INSERT_FLD_PAGES:
|
case SID_INSERT_FLD_PAGES:
|
||||||
case SID_INSERT_FLD_FILE:
|
case SID_INSERT_FLD_FILE:
|
||||||
{
|
{
|
||||||
@@ -1915,6 +1916,13 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SID_INSERT_FLD_PAGE_TITLE:
|
||||||
|
{
|
||||||
|
pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
|
||||||
|
nMul = 3;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case SID_INSERT_FLD_PAGES:
|
case SID_INSERT_FLD_PAGES:
|
||||||
{
|
{
|
||||||
pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
|
pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
|
||||||
|
@@ -1114,6 +1114,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
|
|||||||
rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
|
rSet.DisableItem( SID_INSERT_FLD_TIME_VAR );
|
||||||
rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
|
rSet.DisableItem( SID_INSERT_FLD_AUTHOR );
|
||||||
rSet.DisableItem( SID_INSERT_FLD_PAGE );
|
rSet.DisableItem( SID_INSERT_FLD_PAGE );
|
||||||
|
rSet.DisableItem( SID_INSERT_FLD_PAGE_TITLE );
|
||||||
rSet.DisableItem( SID_INSERT_FLD_PAGES );
|
rSet.DisableItem( SID_INSERT_FLD_PAGES );
|
||||||
rSet.DisableItem( SID_INSERT_FLD_FILE );
|
rSet.DisableItem( SID_INSERT_FLD_FILE );
|
||||||
|
|
||||||
|
@@ -484,6 +484,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
|
|||||||
case SID_INSERT_FLD_TIME_VAR:
|
case SID_INSERT_FLD_TIME_VAR:
|
||||||
case SID_INSERT_FLD_AUTHOR:
|
case SID_INSERT_FLD_AUTHOR:
|
||||||
case SID_INSERT_FLD_PAGE:
|
case SID_INSERT_FLD_PAGE:
|
||||||
|
case SID_INSERT_FLD_PAGE_TITLE:
|
||||||
case SID_INSERT_FLD_PAGES:
|
case SID_INSERT_FLD_PAGES:
|
||||||
case SID_INSERT_FLD_FILE:
|
case SID_INSERT_FLD_FILE:
|
||||||
{
|
{
|
||||||
@@ -523,6 +524,10 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
|
|||||||
pFieldItem.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ));
|
pFieldItem.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SID_INSERT_FLD_PAGE_TITLE:
|
||||||
|
pFieldItem.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD));
|
||||||
|
break;
|
||||||
|
|
||||||
case SID_INSERT_FLD_PAGES:
|
case SID_INSERT_FLD_PAGES:
|
||||||
pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
|
pFieldItem.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ));
|
||||||
break;
|
break;
|
||||||
|
@@ -164,6 +164,7 @@
|
|||||||
<menu:menuseparator/>
|
<menu:menuseparator/>
|
||||||
<menu:menuitem menu:id=".uno:InsertAuthorField"/>
|
<menu:menuitem menu:id=".uno:InsertAuthorField"/>
|
||||||
<menu:menuitem menu:id=".uno:InsertPageField"/>
|
<menu:menuitem menu:id=".uno:InsertPageField"/>
|
||||||
|
<menu:menuitem menu:id=".uno:InsertPageTitleField"/>
|
||||||
<menu:menuitem menu:id=".uno:InsertPagesField"/>
|
<menu:menuitem menu:id=".uno:InsertPagesField"/>
|
||||||
<menu:menuitem menu:id=".uno:InsertFileField"/>
|
<menu:menuitem menu:id=".uno:InsertFileField"/>
|
||||||
</menu:menupopup>
|
</menu:menupopup>
|
||||||
|
@@ -180,8 +180,9 @@
|
|||||||
<menu:menuseparator/>
|
<menu:menuseparator/>
|
||||||
<menu:menuitem menu:id=".uno:InsertAuthorField"/>
|
<menu:menuitem menu:id=".uno:InsertAuthorField"/>
|
||||||
<menu:menuitem menu:id=".uno:InsertPageField"/>
|
<menu:menuitem menu:id=".uno:InsertPageField"/>
|
||||||
<menu:menuitem menu:id=".uno:InsertPagesField"/>
|
<menu:menuitem menu:id=".uno:InsertPageTitleField"/>
|
||||||
<menu:menuitem menu:id=".uno:InsertFileField"/>
|
<menu:menuitem menu:id=".uno:InsertPagesField"/>
|
||||||
|
<menu:menuitem menu:id=".uno:InsertFileField"/>
|
||||||
</menu:menupopup>
|
</menu:menupopup>
|
||||||
</menu:menu>
|
</menu:menu>
|
||||||
<menu:menuitem menu:id=".uno:InsertAnnotation"/>
|
<menu:menuitem menu:id=".uno:InsertAnnotation"/>
|
||||||
|
Reference in New Issue
Block a user