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
This commit is contained in:
parent
7cb8d59769
commit
b5e16d8dab
@ -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:
|
||||
;
|
||||
};
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}; }; }; }; };
|
||||
|
@ -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!
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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 ),
|
||||
|
@ -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:
|
||||
|
@ -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: */
|
||||
|
@ -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 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user