diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-05-15 13:38:07 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-05-18 16:51:59 +0200 |
commit | b5e16d8dab070cfef908e7b5ca0417da534b82bf (patch) | |
tree | a7e46b3f133f44b356eb7e585472c8cb5220e38a | |
parent | 7cb8d59769d7f37157929a4176a8f16f6d4610e8 (diff) |
Related tdf#88056: use better-fitting <text:page-name>
Implemented Regina's suggestions:
* this is a text field, therefore it belongs to text namespace
* page-name (evtl. slide-name) describes much better what this
field really contains
This (among other changes) reverts commit 6609de8856519e0e9
Change-Id: Idab3b7c291839a9137f80d325a7d3f5ef0ff2636
-rw-r--r-- | editeng/source/items/flditem.cxx | 4 | ||||
-rw-r--r-- | editeng/source/uno/unofield.cxx | 12 | ||||
-rw-r--r-- | include/editeng/flditem.hxx | 2 | ||||
-rw-r--r-- | include/xmloff/txtimp.hxx | 2 | ||||
-rw-r--r-- | include/xmloff/xmltoken.hxx | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/text/textfield/Type.idl | 8 | ||||
-rw-r--r-- | xmloff/inc/txtflde.hxx | 2 | ||||
-rw-r--r-- | xmloff/inc/txtfldi.hxx | 44 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 31 | ||||
-rw-r--r-- | xmloff/source/text/txtfldi.cxx | 63 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 4 |
12 files changed, 87 insertions, 89 deletions
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 72c74520bdd7..5df2649ca3da 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_NAME: + return new SvxPageTitleField(); case text::textfield::Type::DOCINFO_TITLE: return new SvxFileField(); case text::textfield::Type::TABLE: @@ -208,8 +210,6 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe return new SvxFooterField(); case text::textfield::Type::PRESENTATION_DATE_TIME: return new SvxDateTimeField(); - case text::textfield::Type::PRESENTATION_PAGE_TITLE: - return new SvxPageTitleField(); default: ; }; diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index a52fb11d9cc3..d5df68a302d2 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -508,7 +508,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw() case text::textfield::Type::PRESENTATION_DATE_TIME: pData = new SvxDateTimeField(); break; - case text::textfield::Type::PRESENTATION_PAGE_TITLE: + case text::textfield::Type::PAGE_NAME: pData = new SvxPageTitleField(); break; }; @@ -613,8 +613,8 @@ OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand ) return OUString("Footer"); case text::textfield::Type::PRESENTATION_DATE_TIME: return OUString("DateTime"); - case text::textfield::Type::PRESENTATION_PAGE_TITLE: - return OUString("PageTitle"); + case text::textfield::Type::PAGE_NAME: + return OUString("PageName"); default: return OUString("Unknown"); } @@ -862,9 +862,9 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames() pServices[2] = "com.sun.star.presentation.TextField.DateTime"; pServices[3] = "com.sun.star.presentation.textfield.DateTime"; break; - case text::textfield::Type::PRESENTATION_PAGE_TITLE: - pServices[2] = "com.sun.star.presentation.TextField.PageTitle"; - pServices[3] = "com.sun.star.presentation.textfield.PageTitle"; + case text::textfield::Type::PAGE_NAME: + pServices[2] = "com.sun.star.text.TextField.PageName"; + pServices[3] = "com.sun.star.text.textfield.PageName"; break; default: aSeq.realloc(0); diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx index 5ad726bcb3fb..19cc8eb894c8 100644 --- a/include/editeng/flditem.hxx +++ b/include/editeng/flditem.hxx @@ -194,7 +194,7 @@ public: class EDITENG_DLLPUBLIC SvxPageTitleField : public SvxFieldData { public: - SV_DECL_PERSIST1( SvxPageTitleField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_PAGE_TITLE ) + SV_DECL_PERSIST1( SvxPageTitleField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE_NAME ) SvxPageTitleField(); virtual SvxFieldData* Clone() const SAL_OVERRIDE; diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx index a5721a1c7e0f..ca0ce7ab7e5a 100644 --- a/include/xmloff/txtimp.hxx +++ b/include/xmloff/txtimp.hxx @@ -208,6 +208,7 @@ enum XMLTextPElemTokens XML_TOK_TEXT_SEQUENCE_REF, XML_TOK_TEXT_NOTE_REF, XML_TOK_TEXT_SHEET_NAME, + XML_TOK_TEXT_PAGE_NAME, XML_TOK_TEXT_BIBLIOGRAPHY_MARK, XML_TOK_TEXT_ANNOTATION, XML_TOK_TEXT_ANNOTATION_END, @@ -231,7 +232,6 @@ enum XMLTextPElemTokens XML_TOK_DRAW_FOOTER, XML_TOK_DRAW_DATE_TIME, XML_TOK_TEXT_PAGE_CONTINUATION, - XML_TOK_DRAW_PAGE_TITLE, XML_TOK_TEXT_FIELDMARK, XML_TOK_TEXT_FIELDMARK_START, diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 5b0167116dbc..bf6ad207d953 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -1372,8 +1372,8 @@ namespace xmloff { namespace token { XML_PAGE_HEIGHT, XML_PAGE_MASTER, XML_PAGE_MASTER_NAME, + XML_PAGE_NAME, XML_PAGE_NUMBER, - XML_PAGE_TITLE, XML_PAGE_START_MARGIN, XML_PAGE_STYLE_NAME, XML_PAGE_THUMBNAIL, diff --git a/offapi/com/sun/star/text/textfield/Type.idl b/offapi/com/sun/star/text/textfield/Type.idl index 48d4215dea1c..d2fa81f80938 100644 --- a/offapi/com/sun/star/text/textfield/Type.idl +++ b/offapi/com/sun/star/text/textfield/Type.idl @@ -39,10 +39,10 @@ constants Type const long DOCINFO_TITLE = 10; - const long PRESENTATION_HEADER = 11; - const long PRESENTATION_FOOTER = 12; - const long PRESENTATION_DATE_TIME = 13; - const long PRESENTATION_PAGE_TITLE = 14; + const long PRESENTATION_HEADER = 11; + const long PRESENTATION_FOOTER = 12; + const long PRESENTATION_DATE_TIME = 13; + const long PAGE_NAME = 14; }; }; }; }; }; }; diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx index b37eb3e4066d..9cb74a7d963b 100644 --- a/xmloff/inc/txtflde.hxx +++ b/xmloff/inc/txtflde.hxx @@ -57,6 +57,7 @@ enum FieldIdEnum { FIELD_ID_AUTHOR, FIELD_ID_DATE, // current date FIELD_ID_TIME, // current time (+date) + FIELD_ID_PAGENAME, // page/slide name FIELD_ID_PAGENUMBER, // page number FIELD_ID_PAGESTRING, // page contination string (page number string) FIELD_ID_REFPAGE_SET, // set reference page @@ -143,7 +144,6 @@ enum FieldIdEnum { FIELD_ID_DRAW_HEADER, FIELD_ID_DRAW_FOOTER, FIELD_ID_DRAW_DATE_TIME, - FIELD_ID_DRAW_PAGETITLE, // page/slide title FIELD_ID_UNKNOWN // invalid or unknown field type! }; diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 197285672a98..a3e5ce2b77f9 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -1131,6 +1131,28 @@ protected: ::com::sun::star::beans::XPropertySet> & xPropertySet) SAL_OVERRIDE; }; +/** import page|slide name fields (<text:page-name>) */ +class XMLPageNameFieldImportContext : public XMLTextFieldImportContext +{ +public: + TYPEINFO_OVERRIDE(); + + XMLPageNameFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// Text import helper + sal_uInt16 nPrfx, /// namespace prefix + const OUString& sLocalName); /// element name w/o prefix + + /// process attribute values + virtual void ProcessAttribute( sal_uInt16 nAttrToken, + const OUString& sAttrValue ) SAL_OVERRIDE; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & xPropertySet) SAL_OVERRIDE; +}; + /** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */ class XMLUrlFieldImportContext : public XMLTextFieldImportContext { @@ -1406,28 +1428,6 @@ public: ::com::sun::star::beans::XPropertySet> & xPropertySet) SAL_OVERRIDE; }; -/** import page|slide title fields (<presentation:page-title>) */ -class XMLPageTitleFieldImportContext : public XMLTextFieldImportContext -{ -public: - TYPEINFO_OVERRIDE(); - - XMLPageTitleFieldImportContext( - SvXMLImport& rImport, /// XML Import - XMLTextImportHelper& rHlp, /// Text import helper - sal_uInt16 nPrfx, /// namespace prefix - const OUString& sLocalName); /// element name w/o prefix - - /// process attribute values - virtual void ProcessAttribute( sal_uInt16 nAttrToken, - const OUString& sAttrValue ) SAL_OVERRIDE; - - /// prepare XTextField for insertion into document - virtual void PrepareField( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet> & xPropertySet) SAL_OVERRIDE; -}; - class XMLCustomPropertyFieldImportContext : public XMLTextFieldImportContext { OUString sName; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index b22c1acce855..5e1dd51d3a59 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -1377,8 +1377,8 @@ namespace xmloff { namespace token { TOKEN( "page-height", XML_PAGE_HEIGHT ), TOKEN( "page-master", XML_PAGE_MASTER ), TOKEN( "page-master-name", XML_PAGE_MASTER_NAME ), + TOKEN( "page-name", XML_PAGE_NAME ), TOKEN( "page-number", XML_PAGE_NUMBER ), - TOKEN( "page-title", XML_PAGE_TITLE ), TOKEN( "page-start-margin", XML_PAGE_START_MARGIN ), TOKEN( "page-style-name", XML_PAGE_STYLE_NAME ), TOKEN( "page-thumbnail", XML_PAGE_THUMBNAIL ), diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 14f9d09fbe6b..ca8ead9b26d1 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -141,6 +141,7 @@ static sal_Char const FIELD_SERVICE_OBJECT_COUNT[] = "EmbeddedObjectCount"; static sal_Char const FIELD_SERVICE_REFERENCE_PAGE_SET[] = "ReferencePageSet"; static sal_Char const FIELD_SERVICE_REFERENCE_PAGE_GET[] = "ReferencePageGet"; static sal_Char const FIELD_SERVICE_SHEET_NAME[] = "SheetName"; +static sal_Char const FIELD_SERVICE_PAGE_NAME[] = "PageName"; static sal_Char const FIELD_SERVICE_MACRO[] = "Macro"; static sal_Char const FIELD_SERVICE_GET_REFERENCE[] = "GetReference"; static sal_Char const FIELD_SERVICE_DDE[] = "DDE"; @@ -234,6 +235,7 @@ SvXMLEnumStringMapEntry const aFieldServiceNameMapping[] = // non-writer fields ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_SHEET_NAME, FIELD_ID_SHEET_NAME ), + ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_PAGE_NAME, FIELD_ID_PAGENAME ), ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_URL, FIELD_ID_URL ), ENUM_STRING_MAP_ENTRY( FIELD_SERVICE_MEASURE, FIELD_ID_MEASURE ), @@ -414,10 +416,6 @@ enum FieldIdEnum XMLTextFieldExport::GetFieldID( { return FIELD_ID_DRAW_DATE_TIME; } - else if( sFieldName == "PageTitle" ) - { - return FIELD_ID_DRAW_PAGETITLE; - } } } @@ -615,6 +613,7 @@ enum FieldIdEnum XMLTextFieldExport::MapFieldName( case FIELD_ID_FILE_NAME: case FIELD_ID_META: case FIELD_ID_SHEET_NAME: + case FIELD_ID_PAGENAME: case FIELD_ID_MEASURE: case FIELD_ID_URL: case FIELD_ID_TABLE_FORMULA: @@ -722,6 +721,7 @@ bool XMLTextFieldExport::IsStringField( case FIELD_ID_TEXT_INPUT: case FIELD_ID_SENDER: case FIELD_ID_AUTHOR: + case FIELD_ID_PAGENAME: case FIELD_ID_PAGESTRING: case FIELD_ID_SHEET_NAME: case FIELD_ID_MEASURE: @@ -742,7 +742,6 @@ bool XMLTextFieldExport::IsStringField( case FIELD_ID_DRAW_HEADER: case FIELD_ID_DRAW_FOOTER: case FIELD_ID_DRAW_DATE_TIME: - case FIELD_ID_DRAW_PAGETITLE: default: OSL_FAIL("unknown field type/field has no content"); return true; // invalid info; string in case of doubt @@ -937,6 +936,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle( case FIELD_ID_DOCINFO_REVISION: case FIELD_ID_DOCINFO_SAVE_AUTHOR: case FIELD_ID_SEQUENCE: + case FIELD_ID_PAGENAME: case FIELD_ID_PAGENUMBER: case FIELD_ID_PAGESTRING: case FIELD_ID_AUTHOR: @@ -958,7 +958,6 @@ void XMLTextFieldExport::ExportFieldAutoStyle( case FIELD_ID_DRAW_DATE_TIME: case FIELD_ID_DRAW_FOOTER: case FIELD_ID_DRAW_HEADER: - case FIELD_ID_DRAW_PAGETITLE: ; // no formats for these fields! break; @@ -1675,6 +1674,16 @@ void XMLTextFieldExport::ExportFieldHelper( ExportElement(XML_SHEET_NAME, sPresentation); break; + case FIELD_ID_PAGENAME: + { + if (SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012) + { + SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_LO_EXT, XML_PAGE_NAME, false, false ); + GetExport().Characters( sPresentation ); + } + break; + } + case FIELD_ID_URL: { // this field is a special case because it gets mapped onto a @@ -1854,16 +1863,6 @@ void XMLTextFieldExport::ExportFieldHelper( } break; - case FIELD_ID_DRAW_PAGETITLE: - { - if (SvtSaveOptions().GetODFDefaultVersion() > SvtSaveOptions::ODFVER_012) - { - SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_LO_EXT, XML_PAGE_TITLE, false, false ); - GetExport().Characters( sPresentation ); - } - } - break; - case FIELD_ID_UNKNOWN: default: diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 683acde10bc8..c64ced6f7a2a 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -129,6 +129,7 @@ const sal_Char sAPI_macro[] = "Macro"; const sal_Char sAPI_dde[] = "DDE"; const sal_Char sAPI_get_reference[] = "GetReference"; const sal_Char sAPI_sheet_name[] = "SheetName"; +const sal_Char sAPI_pagename[] = "PageName"; const sal_Char sAPI_url[] = "URL"; const sal_Char sAPI_bibliography[] = "Bibliography"; const sal_Char sAPI_annotation[] = "Annotation"; @@ -138,7 +139,6 @@ const sal_Char sAPI_drop_down[] = "DropDown"; const sal_Char sAPI_header[] = "Header"; const sal_Char sAPI_footer[] = "Footer"; const sal_Char sAPI_datetime[] = "DateTime"; -const sal_Char sAPI_pagetitle[] = "PageTitle"; // property names const sal_Char sAPI_is_fixed[] = "IsFixed"; @@ -539,6 +539,11 @@ XMLTextFieldImportContext::CreateTextFieldImportContext( nPrefix, rName ); break; + case XML_TOK_TEXT_PAGE_NAME: + pContext = new XMLPageNameFieldImportContext( rImport, rHlp, + nPrefix, rName ); + break; + case XML_TOK_TEXT_BIBLIOGRAPHY_MARK: pContext = new XMLBibliographyFieldImportContext( rImport, rHlp, nPrefix, rName ); @@ -581,10 +586,6 @@ XMLTextFieldImportContext::CreateTextFieldImportContext( pContext = new XMLDateTimeFieldImportContext( rImport, rHlp, nPrefix, rName ); break; - case XML_TOK_DRAW_PAGE_TITLE: - pContext = new XMLPageTitleFieldImportContext( rImport, rHlp, - nPrefix, rName ); - break; default: // ignore! May not even be a textfield. @@ -3272,6 +3273,31 @@ void XMLSheetNameImportContext::PrepareField( // no attributes -> nothing to be done } +/** import page|slide name fields (<text:page-name>) */ +TYPEINIT1( XMLPageNameFieldImportContext, XMLTextFieldImportContext ); + +XMLPageNameFieldImportContext::XMLPageNameFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// Text import helper + sal_uInt16 nPrfx, /// namespace prefix + const OUString& sLocalName) /// element name w/o prefix +: XMLTextFieldImportContext(rImport, rHlp, sAPI_pagename, nPrfx, sLocalName ) +{ + bValid = true; +} + +/// process attribute values +void XMLPageNameFieldImportContext::ProcessAttribute( sal_uInt16, + const OUString& ) +{ +} + +/// prepare XTextField for insertion into document +void XMLPageNameFieldImportContext::PrepareField( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> &) +{ +} // URL fields (Calc, Impress, Draw) @@ -4159,31 +4185,4 @@ void XMLDateTimeFieldImportContext::PrepareField( { } -/** import page|slide title fields (<presentation:page-title>) */ -TYPEINIT1( XMLPageTitleFieldImportContext, XMLTextFieldImportContext ); - -XMLPageTitleFieldImportContext::XMLPageTitleFieldImportContext( - SvXMLImport& rImport, /// XML Import - XMLTextImportHelper& rHlp, /// Text import helper - sal_uInt16 nPrfx, /// namespace prefix - const OUString& sLocalName) /// element name w/o prefix -: XMLTextFieldImportContext(rImport, rHlp, sAPI_pagetitle, nPrfx, sLocalName ) -{ - sServicePrefix = sAPI_presentation_prefix; - bValid = true; -} - -/// process attribute values -void XMLPageTitleFieldImportContext::ProcessAttribute( sal_uInt16, - const OUString& ) -{ -} - -/// prepare XTextField for insertion into document -void XMLPageTitleFieldImportContext::PrepareField( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet> &) -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index afd5ec9cfaac..652f2b9735eb 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -268,6 +268,8 @@ static const SvXMLTokenMapEntry aTextPElemTokenMap[] = // draw fields { XML_NAMESPACE_TEXT, XML_MEASURE, XML_TOK_TEXT_MEASURE }, + { XML_NAMESPACE_LO_EXT, XML_PAGE_NAME, XML_TOK_TEXT_PAGE_NAME }, + { XML_NAMESPACE_TEXT, XML_PAGE_NAME, XML_TOK_TEXT_PAGE_NAME }, // RDF metadata { XML_NAMESPACE_TEXT, XML_META, XML_TOK_TEXT_META }, @@ -281,8 +283,6 @@ static const SvXMLTokenMapEntry aTextPElemTokenMap[] = { XML_NAMESPACE_PRESENTATION, XML_HEADER, XML_TOK_DRAW_HEADER }, { XML_NAMESPACE_PRESENTATION, XML_FOOTER, XML_TOK_DRAW_FOOTER }, { XML_NAMESPACE_PRESENTATION, XML_DATE_TIME, XML_TOK_DRAW_DATE_TIME }, - { XML_NAMESPACE_LO_EXT, XML_PAGE_TITLE, XML_TOK_DRAW_PAGE_TITLE }, - { XML_NAMESPACE_PRESENTATION, XML_PAGE_TITLE, XML_TOK_DRAW_PAGE_TITLE }, { XML_NAMESPACE_TEXT, XML_PAGE_CONTINUATION, XML_TOK_TEXT_PAGE_CONTINUATION }, { XML_NAMESPACE_FIELD, XML_FIELDMARK, XML_TOK_TEXT_FIELDMARK }, |