summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-11-17 12:05:00 +0000
committerOliver Bolte <obo@openoffice.org>2004-11-17 12:05:00 +0000
commita0a8b8ee8f4ba747d931abf8a20eec95e8aeac33 (patch)
tree2807dd1d6a7cafb187fb7f8de8b19f68d92514da
parentba88b9c91451c3aa65937fb03af691dec93bde8e (diff)
INTEGRATION: CWS fwkbugfix03 (1.11.52); FILE MERGED
2004/10/11 11:55:10 as 1.11.52.2: RESYNC: (1.11-1.12); FILE MERGED 2004/09/20 07:50:54 as 1.11.52.1: #116963# support typesafe user props inside file format
-rw-r--r--xmloff/source/meta/xmlmetai.cxx43
1 files changed, 39 insertions, 4 deletions
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 1dc241de78f8..2ad5063e2126 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlmetai.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: kz $ $Date: 2004-10-04 18:11:51 $
+ * last change: $Author: obo $ $Date: 2004-11-17 13:05:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
#include "xmlmetai.hxx"
#include "xmltkmap.hxx"
@@ -77,6 +78,10 @@
#include "xmltoken.hxx"
#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include <xmluconv.hxx>
+#endif
+
using namespace com::sun::star;
using namespace ::xmloff::token;
@@ -113,7 +118,8 @@ private:
SfxXMLMetaContext& rParent;
sal_uInt16 nElementType;
rtl::OUString sContent;
- rtl::OUString sFieldName; // for <meta:user-defined>
+ rtl::OUString sFieldName; // prop name of <meta:user-defined>
+ rtl::OUString sTypeName; // type name of (some!) <meta:user-defined>
public:
SfxXMLMetaElementContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
@@ -559,6 +565,11 @@ SfxXMLMetaElementContext::SfxXMLMetaElementContext( SvXMLImport& rImport, sal_uI
{
sFieldName = xAttrList->getValueByIndex( i );
}
+ if ( nPrefix == XML_NAMESPACE_META &&
+ IsXMLToken(aLocalName, XML_VALUE_TYPE) )
+ {
+ sTypeName = xAttrList->getValueByIndex( i );
+ }
}
}
else if ( nElementType == XML_TOK_META_DOCUMENT_STATISTIC )
@@ -695,7 +706,16 @@ void SfxXMLMetaElementContext::EndElement()
rParent.AddKeyword( sContent );
break;
case XML_TOK_META_USERDEFINED:
- rParent.AddUserField( sFieldName, sContent );
+ {
+ if (sTypeName.getLength())
+ {
+ uno::Any aValue;
+ if (SvXMLUnitConverter::convertAny(aValue, sTypeName, sContent))
+ rParent.AddUserField( sFieldName, aValue );
+ }
+ else
+ rParent.AddUserField( sFieldName, sContent );
+ }
break;
case XML_TOK_META_DOCUMENT_STATISTIC:
break;
@@ -809,4 +829,19 @@ void SfxXMLMetaContext::AddUserField( const rtl::OUString& rName, const rtl::OUS
}
}
+void SfxXMLMetaContext::AddUserField( const ::rtl::OUString& rName ,
+ const uno::Any& rContent )
+{
+ if ( !xInfoProp.is() )
+ return;
+
+ uno::Reference< beans::XPropertySetInfo > xSetInfo = xInfoProp->getPropertySetInfo();
+ if (xSetInfo->hasPropertyByName(rName))
+ xInfoProp->setPropertyValue(rName, rContent);
+ else
+ {
+ uno::Reference< beans::XPropertyContainer > xPropCont(xInfoProp, uno::UNO_QUERY_THROW);
+ xPropCont->addProperty(rName, 0, rContent);
+ }
+}