summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
authoros <os@openoffice.org>2009-10-12 10:27:34 +0200
committeros <os@openoffice.org>2009-10-12 10:27:34 +0200
commitdabf9345bef57a917dc8f5bc3664b488cf2d727f (patch)
tree1670b29b21682d7fb429c252171dc3ef902de602 /xmloff/source/text
parent5e152b1eb5bd7be05e7cdc8133321d78e80c6c7f (diff)
#i105687# enable number format for custom date/datetime/time data
Diffstat (limited to 'xmloff/source/text')
-rw-r--r--xmloff/source/text/txtflde.cxx11
-rw-r--r--xmloff/source/text/txtfldi.cxx33
2 files changed, 41 insertions, 3 deletions
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 3cc372f171..e17041266b 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -681,6 +681,7 @@ sal_Bool XMLTextFieldExport::IsStringField(
case FIELD_ID_PAGENUMBER:
case FIELD_ID_REFPAGE_SET:
case FIELD_ID_REFPAGE_GET:
+ case FIELD_ID_DOCINFO_CUSTOM:
// always number
return sal_False;
@@ -701,7 +702,6 @@ sal_Bool XMLTextFieldExport::IsStringField(
case FIELD_ID_HIDDEN_PARAGRAPH:
case FIELD_ID_DOCINFO_CREATION_AUTHOR:
case FIELD_ID_DOCINFO_DESCRIPTION:
- case FIELD_ID_DOCINFO_CUSTOM:
case FIELD_ID_DOCINFO_PRINT_AUTHOR:
case FIELD_ID_DOCINFO_TITLE:
case FIELD_ID_DOCINFO_SUBJECT:
@@ -850,6 +850,7 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
case FIELD_ID_USER_GET:
case FIELD_ID_EXPRESSION:
case FIELD_ID_TABLE_FORMULA:
+ case FIELD_ID_DOCINFO_CUSTOM:
// register number format, if this is a numeric field
if (! IsStringField(nToken, xPropSet)) {
@@ -913,7 +914,6 @@ void XMLTextFieldExport::ExportFieldAutoStyle(
case FIELD_ID_HIDDEN_PARAGRAPH:
case FIELD_ID_DOCINFO_CREATION_AUTHOR:
case FIELD_ID_DOCINFO_DESCRIPTION:
- case FIELD_ID_DOCINFO_CUSTOM:
case FIELD_ID_DOCINFO_PRINT_AUTHOR:
case FIELD_ID_DOCINFO_TITLE:
case FIELD_ID_DOCINFO_SUBJECT:
@@ -1473,6 +1473,13 @@ void XMLTextFieldExport::ExportFieldHelper(
case FIELD_ID_DOCINFO_CUSTOM:
{
+ ProcessValueAndType(sal_False, // doesn't happen for text
+ GetIntProperty(sPropertyNumberFormat,rPropSet),
+ sEmpty, sEmpty, 0.0, // not used
+ sal_False, sal_False, sal_True,
+ ! GetOptionalBoolProperty(
+ sPropertyIsFixedLanguage,
+ rPropSet, xPropSetInfo, sal_False ));
uno::Any aAny = rPropSet->getPropertyValue( sPropertyName );
::rtl::OUString sName;
aAny >>= sName;
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 3b8b551b92..d47e813c34 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2048,6 +2048,11 @@ XMLUserDocInfoImportContext::XMLUserDocInfoImportContext(
sLocalName, nToken,
sal_False, sal_False)
, sPropertyName(RTL_CONSTASCII_USTRINGPARAM(sAPI_name))
+ , sPropertyNumberFormat(RTL_CONSTASCII_USTRINGPARAM(sAPI_number_format))
+ , sPropertyIsFixedLanguage(RTL_CONSTASCII_USTRINGPARAM(sAPI_is_fixed_language))
+ , nFormat(0)
+ , bFormatOK(sal_False)
+ , bIsDefaultLanguage( sal_True )
{
bValid = sal_False;
}
@@ -2058,6 +2063,17 @@ void XMLUserDocInfoImportContext::ProcessAttribute(
{
switch (nAttrToken)
{
+ case XML_TOK_TEXTFIELD_DATA_STYLE_NAME:
+ {
+ sal_Int32 nKey = GetImportHelper().GetDataStyleKey(
+ sAttrValue, &bIsDefaultLanguage);
+ if (-1 != nKey)
+ {
+ nFormat = nKey;
+ bFormatOK = sal_True;
+ }
+ break;
+ }
case XML_TOK_TEXTFIELD_NAME:
{
if (!bValid)
@@ -2080,12 +2096,27 @@ void XMLUserDocInfoImportContext::PrepareField(
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet> & xPropertySet)
{
+ uno::Any aAny;
if ( aName.getLength() )
{
- uno::Any aAny;
aAny <<= aName;
xPropertySet->setPropertyValue(sPropertyName, aAny);
}
+ Reference<XPropertySetInfo> xPropertySetInfo(
+ xPropertySet->getPropertySetInfo());
+ if (bFormatOK &&
+ xPropertySetInfo->hasPropertyByName(sPropertyNumberFormat))
+ {
+ aAny <<= nFormat;
+ xPropertySet->setPropertyValue(sPropertyNumberFormat, aAny);
+
+ if( xPropertySetInfo->hasPropertyByName( sPropertyIsFixedLanguage ) )
+ {
+ sal_Bool bIsFixedLanguage = ! bIsDefaultLanguage;
+ aAny.setValue( &bIsFixedLanguage, ::getBooleanCppuType() );
+ xPropertySet->setPropertyValue( sPropertyIsFixedLanguage, aAny );
+ }
+ }
// call superclass to handle "fixed"
XMLSimpleDocInfoImportContext::PrepareField(xPropertySet);