summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2015-04-22 23:31:43 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2015-05-27 09:26:37 +0000
commit42b521f800a08b11432cf906ce1bdf9fcbfffdeb (patch)
treea6cd65cf6b476ad99697a36800c11ecc53b7cf83
parent03f36c0a88d1a87c6febbadca4e549d08c6095b1 (diff)
tdf#88056: Implement ODF import/export of page title field
to/from loext namespace, since new tag's needed for the new field and it isn't approved by ODF-TC yet Change-Id: I70ceb4e16e1199663520dbdf3beae31423bc81d0 Reviewed-on: https://gerrit.libreoffice.org/15485 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--editeng/source/items/flditem.cxx2
-rw-r--r--editeng/source/uno/unofield.cxx9
-rw-r--r--include/editeng/flditem.hxx2
-rw-r--r--include/xmloff/txtimp.hxx1
-rw-r--r--include/xmloff/xmltoken.hxx1
-rw-r--r--offapi/com/sun/star/text/textfield/Type.idl2
-rw-r--r--sd/source/ui/app/sdmod2.cxx6
-rw-r--r--sd/source/ui/app/strings.src10
-rw-r--r--sd/source/ui/inc/strings.hrc2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx6
-rw-r--r--xmloff/inc/txtflde.hxx1
-rw-r--r--xmloff/inc/txtfldi.hxx22
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/text/txtflde.cxx16
-rw-r--r--xmloff/source/text/txtfldi.cxx31
-rw-r--r--xmloff/source/text/txtimp.cxx2
16 files changed, 111 insertions, 3 deletions
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 57f1e2af0427..4e144ed39154 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -117,7 +117,7 @@ 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:
+ case text::textfield::Type::PAGE_NAME:
return new SvxPageTitleField();
case text::textfield::Type::DOCINFO_TITLE:
return new SvxFileField();
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 7c7cae965430..b507d3b7dcd7 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -504,6 +504,9 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
case text::textfield::Type::PRESENTATION_DATE_TIME:
pData = new SvxDateTimeField();
break;
+ case text::textfield::Type::PAGE_NAME:
+ pData = new SvxPageTitleField();
+ break;
};
return pData;
@@ -606,6 +609,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::PAGE_NAME:
+ return OUString("PageName");
default:
return OUString("Unknown");
}
@@ -853,6 +858,10 @@ 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::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 e35e503b0c37..554a2b153661 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::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 592c8343bb51..96df6f121d19 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -210,6 +210,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,
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 96393262b833..21b584d7fa1f 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1368,6 +1368,7 @@ namespace xmloff { namespace token {
XML_PAGE_HEIGHT,
XML_PAGE_MASTER,
XML_PAGE_MASTER_NAME,
+ XML_PAGE_NAME,
XML_PAGE_NUMBER,
XML_PAGE_START_MARGIN,
XML_PAGE_STYLE_NAME,
diff --git a/offapi/com/sun/star/text/textfield/Type.idl b/offapi/com/sun/star/text/textfield/Type.idl
index 42fcb8bfd3ab..d2fa81f80938 100644
--- a/offapi/com/sun/star/text/textfield/Type.idl
+++ b/offapi/com/sun/star/text/textfield/Type.idl
@@ -42,7 +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;
+ const long PAGE_NAME = 14;
};
}; }; }; }; };
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index dd5c666d98c5..8f2d3a2f2c11 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -268,6 +268,12 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo)
{
aRepresentation = pPage->GetName();
}
+ else
+ {
+ aRepresentation = ( ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ ? SdResId(STR_FIELD_PLACEHOLDER_SLIDENAME).toString()
+ : SdResId(STR_FIELD_PLACEHOLDER_PAGENAME).toString() );
+ }
pInfo->SetRepresentation( aRepresentation );
}
diff --git a/sd/source/ui/app/strings.src b/sd/source/ui/app/strings.src
index 06b0fcffa15a..c46b5ef0d771 100644
--- a/sd/source/ui/app/strings.src
+++ b/sd/source/ui/app/strings.src
@@ -1066,6 +1066,16 @@ String STR_FIELD_PLACEHOLDER_COUNT
Text [ en-US ] = "<count>" ;
};
+String STR_FIELD_PLACEHOLDER_SLIDENAME
+{
+ Text [ en-US ] = "<slide-name>" ;
+};
+
+String STR_FIELD_PLACEHOLDER_PAGENAME
+{
+ Text [ en-US ] = "<page-name>" ;
+};
+
String STR_PLACEHOLDER_DESCRIPTION_NOTES
{
Text [ en-US ] = "Notes Area";
diff --git a/sd/source/ui/inc/strings.hrc b/sd/source/ui/inc/strings.hrc
index 1fa282c3acce..2c4c79e350bd 100644
--- a/sd/source/ui/inc/strings.hrc
+++ b/sd/source/ui/inc/strings.hrc
@@ -367,6 +367,8 @@
#define STR_UNDO_HANGULHANJACONVERSION (RID_APP_START+696)
#define STR_FIELD_PLACEHOLDER_COUNT (RID_APP_START+697)
+#define STR_FIELD_PLACEHOLDER_SLIDENAME (RID_APP_START+698)
+#define STR_FIELD_PLACEHOLDER_PAGENAME (RID_APP_START+699)
#define STR_LEFT_PANE_DRAW_TITLE (RID_APP_START+700)
#define STR_LEFT_PANE_IMPRESS_TITLE (RID_APP_START+701)
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b461f8751787..2d72378e84d3 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -929,6 +929,12 @@ css::uno::Reference<css::uno::XInterface> SdXImpressDocument::create(
return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PRESENTATION_DATE_TIME );
}
+ if( aServiceSpecifier == "com.sun.star.text.TextField.PageName" ||
+ aServiceSpecifier == "com.sun.star.text.textfield.PageName" )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( text::textfield::Type::PAGE_NAME );
+ }
+
if( aServiceSpecifier == "com.sun.star.xml.NamespaceMap" )
{
static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 };
diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx
index 50614776caa6..79014b626218 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
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 4023aacf2c93..42a3263c3c49 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
{
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 323e0739dafd..e15cf964ccae 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1373,6 +1373,7 @@ 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-start-margin", XML_PAGE_START_MARGIN ),
TOKEN( "page-style-name", XML_PAGE_STYLE_NAME ),
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index f1f8442dce8b..7c20b5cc087e 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 ),
@@ -611,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:
@@ -718,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:
@@ -932,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:
@@ -1669,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
@@ -1848,6 +1863,7 @@ void XMLTextFieldExport::ExportFieldHelper(
}
break;
+
case FIELD_ID_UNKNOWN:
default:
OSL_FAIL("unknown field type encountered!");
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 6b7c9ad541a8..274ff5293585 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";
@@ -538,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 );
@@ -3267,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)
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 6c74084d08bf..2ea64ce78fe2 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -269,6 +269,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 },