summaryrefslogtreecommitdiff
path: root/xmloff/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/core')
-rw-r--r--xmloff/source/core/DocumentSettingsContext.cxx1014
-rw-r--r--xmloff/source/core/DomBuilderContext.cxx264
-rw-r--r--xmloff/source/core/DomExport.cxx305
-rw-r--r--xmloff/source/core/ProgressBarHelper.cxx139
-rw-r--r--xmloff/source/core/PropertySetMerger.cxx267
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx231
-rw-r--r--xmloff/source/core/RDFaImportHelper.cxx501
-rw-r--r--xmloff/source/core/SettingsExportHelper.cxx569
-rw-r--r--xmloff/source/core/XMLBase64Export.cxx95
-rw-r--r--xmloff/source/core/XMLBase64ImportContext.cxx91
-rw-r--r--xmloff/source/core/XMLBasicExportFilter.cxx125
-rw-r--r--xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx182
-rw-r--r--xmloff/source/core/XMLEmbeddedObjectImportContext.cxx395
-rw-r--r--xmloff/source/core/attrlist.cxx301
-rw-r--r--xmloff/source/core/facreg.cxx283
-rw-r--r--xmloff/source/core/i18nmap.cxx126
-rw-r--r--xmloff/source/core/nmspmap.cxx593
-rw-r--r--xmloff/source/core/unoatrcn.cxx315
-rw-r--r--xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx171
-rw-r--r--xmloff/source/core/xmlcnitm.cxx218
-rw-r--r--xmloff/source/core/xmlehelp.cxx500
-rw-r--r--xmloff/source/core/xmlenums.hxx55
-rw-r--r--xmloff/source/core/xmlerror.cxx257
-rw-r--r--xmloff/source/core/xmlexp.cxx2759
-rw-r--r--xmloff/source/core/xmlictxt.cxx84
-rw-r--r--xmloff/source/core/xmlimp.cxx2015
-rw-r--r--xmloff/source/core/xmltkmap.cxx122
-rw-r--r--xmloff/source/core/xmltoken.cxx3199
-rw-r--r--xmloff/source/core/xmluconv.cxx2300
29 files changed, 17476 insertions, 0 deletions
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx
new file mode 100644
index 000000000000..0c90a23ae519
--- /dev/null
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -0,0 +1,1014 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <xmloff/DocumentSettingsContext.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+
+#ifndef __SGI_STL_LIST
+#include <list>
+#endif
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <comphelper/configurationhelper.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmlenums.hxx>
+
+using namespace com::sun::star;
+using namespace ::xmloff::token;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+
+//------------------------------------------------------------------
+
+class XMLMyList
+{
+ std::list<beans::PropertyValue> aProps;
+ sal_uInt32 nCount;
+
+ // #110680#
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+
+public:
+ // #110680#
+ XMLMyList(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory);
+ ~XMLMyList();
+
+ void push_back(beans::PropertyValue& aProp) { aProps.push_back(aProp); nCount++; }
+ uno::Sequence<beans::PropertyValue> GetSequence();
+ uno::Reference<container::XNameContainer> GetNameContainer();
+ uno::Reference<container::XIndexContainer> GetIndexContainer();
+};
+
+// #110680#
+XMLMyList::XMLMyList(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory)
+: nCount(0),
+ mxServiceFactory(xServiceFactory)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+}
+
+// #110680#
+XMLMyList::~XMLMyList()
+{
+}
+
+uno::Sequence<beans::PropertyValue> XMLMyList::GetSequence()
+{
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if(nCount)
+ {
+ DBG_ASSERT(nCount == aProps.size(), "wrong count of PropertyValue");
+ aSeq.realloc(nCount);
+ beans::PropertyValue* pProps = aSeq.getArray();
+ std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
+ while (aItr != aProps.end())
+ {
+ *pProps = *aItr;
+ pProps++;
+ aItr++;
+ }
+ }
+ return aSeq;
+}
+
+uno::Reference<container::XNameContainer> XMLMyList::GetNameContainer()
+{
+ uno::Reference<container::XNameContainer> xNameContainer;
+
+ // #110680#
+ // uno::Reference<lang::XMultiServiceFactory> xServiceFactory = comphelper::getProcessServiceFactory();
+ // DBG_ASSERT( xServiceFactory.is(), "got no service manager" );
+
+ if( mxServiceFactory.is() )
+ {
+ rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.NamedPropertyValues"));
+ xNameContainer = uno::Reference<container::XNameContainer>(mxServiceFactory->createInstance(sName), uno::UNO_QUERY);
+ if (xNameContainer.is())
+ {
+ std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
+ while (aItr != aProps.end())
+ {
+ xNameContainer->insertByName(aItr->Name, aItr->Value);
+ aItr++;
+ }
+ }
+ }
+ return xNameContainer;
+}
+
+uno::Reference<container::XIndexContainer> XMLMyList::GetIndexContainer()
+{
+ uno::Reference<container::XIndexContainer> xIndexContainer;
+ // #110680#
+ // uno::Reference<lang::XMultiServiceFactory> xServiceFactory = comphelper::getProcessServiceFactory();
+ // DBG_ASSERT( xServiceFactory.is(), "got no service manager" );
+
+ if( mxServiceFactory.is() )
+ {
+ rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"));
+ xIndexContainer = uno::Reference<container::XIndexContainer>(mxServiceFactory->createInstance(sName), uno::UNO_QUERY);
+ if (xIndexContainer.is())
+ {
+ std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
+ sal_uInt32 i(0);
+ while (aItr != aProps.end())
+ {
+ xIndexContainer->insertByIndex(i, aItr->Value);
+ aItr++;
+ i++;
+ }
+ }
+ }
+ return xIndexContainer;
+}
+
+//=============================================================================
+
+class XMLConfigBaseContext : public SvXMLImportContext
+{
+protected:
+ XMLMyList maProps;
+ beans::PropertyValue maProp;
+ com::sun::star::uno::Any& mrAny;
+ XMLConfigBaseContext* mpBaseContext;
+public:
+ XMLConfigBaseContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigBaseContext();
+
+ void AddPropertyValue() { maProps.push_back(maProp); }
+};
+
+//=============================================================================
+
+class XMLConfigItemContext : public SvXMLImportContext
+{
+ rtl::OUString msType;
+ rtl::OUString msValue;
+ uno::Sequence<sal_Int8> maDecoded;
+ com::sun::star::uno::Any& mrAny;
+ const rtl::OUString mrItemName;
+ XMLConfigBaseContext* mpBaseContext;
+
+public:
+ XMLConfigItemContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ const rtl::OUString& rItemName,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const ::rtl::OUString& rChars );
+
+ virtual void EndElement();
+
+ virtual void ManipulateConfigItem();
+};
+
+//=============================================================================
+
+class XMLConfigItemSetContext : public XMLConfigBaseContext
+{
+public:
+ XMLConfigItemSetContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemSetContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+//=============================================================================
+
+class XMLConfigItemMapNamedContext : public XMLConfigBaseContext
+{
+public:
+ XMLConfigItemMapNamedContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemMapNamedContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+//=============================================================================
+
+class XMLConfigItemMapIndexedContext : public XMLConfigBaseContext
+{
+private:
+ rtl::OUString maConfigItemName;
+
+public:
+ XMLConfigItemMapIndexedContext(SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rAny,
+ const rtl::OUString& rConfigItemName,
+ XMLConfigBaseContext* pBaseContext);
+ virtual ~XMLConfigItemMapIndexedContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+
+ virtual void EndElement();
+};
+
+//=============================================================================
+
+SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, USHORT p_nPrefix,
+ const rtl::OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ beans::PropertyValue& rProp, XMLConfigBaseContext* pBaseContext)
+{
+ SvXMLImportContext *pContext = 0;
+
+ rProp.Name = rtl::OUString();
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ USHORT nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(aLocalName, XML_NAME))
+ rProp.Name = sValue;
+ }
+ }
+
+ if (p_nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(rLocalName, XML_CONFIG_ITEM))
+ pContext = new XMLConfigItemContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, rProp.Name, pBaseContext);
+ else if((IsXMLToken(rLocalName, XML_CONFIG_ITEM_SET)) ||
+ (IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_ENTRY)) )
+ pContext = new XMLConfigItemSetContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, pBaseContext);
+ else if(IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_NAMED))
+ pContext = new XMLConfigItemMapNamedContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, pBaseContext);
+ else if(IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_INDEXED))
+ pContext = new XMLConfigItemMapIndexedContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, rProp.Name, pBaseContext);
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( rImport, p_nPrefix, rLocalName );
+
+ return pContext;
+}
+
+//=============================================================================
+namespace
+{
+ struct SettingsGroup
+ {
+ ::rtl::OUString sGroupName;
+ uno::Any aSettings;
+
+ SettingsGroup()
+ :sGroupName()
+ ,aSettings()
+ {
+ }
+
+ SettingsGroup( const ::rtl::OUString& _rGroupName, const uno::Any& _rSettings )
+ :sGroupName( _rGroupName )
+ ,aSettings( _rSettings )
+ {
+ }
+ };
+}
+
+struct XMLDocumentSettingsContext_Data
+{
+ com::sun::star::uno::Any aViewProps;
+ com::sun::star::uno::Any aConfigProps;
+ ::std::list< SettingsGroup > aDocSpecificSettings;
+};
+
+//=============================================================================
+
+XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& )
+ : SvXMLImportContext( rImport, nPrfx, rLName )
+ , m_pData( new XMLDocumentSettingsContext_Data )
+{
+ // here are no attributes
+}
+
+XMLDocumentSettingsContext::~XMLDocumentSettingsContext()
+{
+}
+
+SvXMLImportContext *XMLDocumentSettingsContext::CreateChildContext( USHORT p_nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+ rtl::OUString sName;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(aLocalName, XML_NAME))
+ sName = sValue;
+ }
+ }
+
+ if (p_nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(rLocalName, XML_CONFIG_ITEM_SET))
+ {
+ ::rtl::OUString aLocalConfigName;
+ sal_uInt16 nConfigPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sName, &aLocalConfigName );
+
+ if( XML_NAMESPACE_OOO == nConfigPrefix )
+ {
+ if (IsXMLToken(aLocalConfigName, XML_VIEW_SETTINGS))
+ pContext = new XMLConfigItemSetContext(GetImport(),
+ p_nPrefix, rLocalName, xAttrList,
+ m_pData->aViewProps, NULL);
+ else if (IsXMLToken(aLocalConfigName,
+ XML_CONFIGURATION_SETTINGS))
+ pContext = new XMLConfigItemSetContext(GetImport(),
+ p_nPrefix, rLocalName, xAttrList,
+ m_pData->aConfigProps, NULL);
+ else
+ {
+ m_pData->aDocSpecificSettings.push_back( SettingsGroup( aLocalConfigName, uno::Any() ) );
+
+ ::std::list< SettingsGroup >::reverse_iterator settingsPos =
+ m_pData->aDocSpecificSettings.rbegin();
+
+ pContext = new XMLConfigItemSetContext(GetImport(),
+ p_nPrefix, rLocalName, xAttrList,
+ settingsPos->aSettings, NULL);
+ }
+ }
+ }
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
+
+ return pContext;
+}
+
+void XMLDocumentSettingsContext::EndElement()
+{
+ uno::Sequence<beans::PropertyValue> aSeqViewProps;
+ if (m_pData->aViewProps >>= aSeqViewProps)
+ {
+ GetImport().SetViewSettings(aSeqViewProps);
+ sal_Int32 i(aSeqViewProps.getLength() - 1);
+ sal_Bool bFound(sal_False);
+ while((i >= 0) && !bFound)
+ {
+ if (aSeqViewProps[i].Name.compareToAscii("Views") == 0)
+ {
+ bFound = sal_True;
+ uno::Reference<container::XIndexAccess> xIndexAccess;
+ if (aSeqViewProps[i].Value >>= xIndexAccess)
+ {
+ uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetImport().GetModel(), uno::UNO_QUERY);
+ if (xViewDataSupplier.is())
+ xViewDataSupplier->setViewData(xIndexAccess);
+ }
+ }
+ else
+ i--;
+ }
+ }
+
+ sal_Bool bLoadDocPrinter( sal_True );
+ ::comphelper::ConfigurationHelper::readDirectKey(
+ ::comphelper::getProcessServiceFactory(),
+ C2U("org.openoffice.Office.Common/"), C2U("Save/Document"), C2U("LoadPrinter"),
+ ::comphelper::ConfigurationHelper::E_READONLY ) >>= bLoadDocPrinter;
+ uno::Sequence<beans::PropertyValue> aSeqConfigProps;
+ if ( m_pData->aConfigProps >>= aSeqConfigProps )
+ {
+ if ( !bLoadDocPrinter )
+ {
+ sal_Int32 i = aSeqConfigProps.getLength() - 1;
+ int nFound = 0;
+
+ while ( ( i >= 0 ) && nFound < 2 )
+ {
+ rtl::OUString sProp( aSeqConfigProps[i].Name );
+
+ if ( sProp.compareToAscii("PrinterName") == 0 )
+ {
+ rtl::OUString sEmpty;
+ aSeqConfigProps[i].Value = uno::makeAny( sEmpty );
+ nFound++;
+ }
+ else if ( sProp.compareToAscii("PrinterSetup") == 0 )
+ {
+ uno::Sequence< sal_Int8 > aEmpty;
+ aSeqConfigProps[i].Value = uno::makeAny( aEmpty );
+ nFound++;
+ }
+
+ i--;
+ }
+ }
+
+ GetImport().SetConfigurationSettings( aSeqConfigProps );
+ }
+
+ for ( ::std::list< SettingsGroup >::const_iterator settings = m_pData->aDocSpecificSettings.begin();
+ settings != m_pData->aDocSpecificSettings.end();
+ ++settings
+ )
+ {
+ uno::Sequence< beans::PropertyValue > aDocSettings;
+ OSL_VERIFY( settings->aSettings >>= aDocSettings );
+ GetImport().SetDocumentSpecificSettings( settings->sGroupName, aDocSettings );
+ }
+}
+
+//=============================================================================
+
+XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName, com::sun::star::uno::Any& rTempAny,
+ XMLConfigBaseContext* pTempBaseContext)
+ : SvXMLImportContext( rImport, nPrfx, rLName ),
+ // #110680#
+ maProps(rImport.getServiceFactory()),
+ maProp(),
+ mrAny(rTempAny),
+ mpBaseContext(pTempBaseContext)
+{
+}
+
+XMLConfigBaseContext::~XMLConfigBaseContext()
+{
+}
+
+//=============================================================================
+
+XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext)
+ : XMLConfigBaseContext( rImport, nPrfx, rLName, rAny, pBaseContext )
+{
+ // here are no attributes
+}
+
+XMLConfigItemSetContext::~XMLConfigItemSetContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemSetContext::CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
+}
+
+void XMLConfigItemSetContext::EndElement()
+{
+ mrAny <<= maProps.GetSequence();
+ if (mpBaseContext)
+ mpBaseContext->AddPropertyValue();
+}
+
+//=============================================================================
+
+XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
+ com::sun::star::uno::Any& rTempAny,
+ const rtl::OUString& rTempItemName,
+ XMLConfigBaseContext* pTempBaseContext)
+ : SvXMLImportContext(rImport, nPrfx, rLName),
+ mrAny(rTempAny),
+ mrItemName(rTempItemName),
+ mpBaseContext(pTempBaseContext)
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
+ rtl::OUString aLocalName;
+ USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
+ sAttrName, &aLocalName );
+ rtl::OUString sValue = xAttrList->getValueByIndex( i );
+
+ if (nPrefix == XML_NAMESPACE_CONFIG)
+ {
+ if (IsXMLToken(aLocalName, XML_TYPE))
+ msType = sValue;
+ }
+ }
+}
+
+XMLConfigItemContext::~XMLConfigItemContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemContext::CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& )
+{
+ SvXMLImportContext* pContext = new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
+ return pContext;
+}
+
+void XMLConfigItemContext::Characters( const ::rtl::OUString& rChars )
+{
+ if (IsXMLToken(msType, XML_BASE64BINARY))
+ {
+ rtl::OUString sTrimmedChars( rChars.trim() );
+ if( sTrimmedChars.getLength() )
+ {
+ rtl::OUString sChars;
+ if( msValue )
+ {
+ sChars = msValue;
+ sChars += sTrimmedChars;
+ msValue = rtl::OUString();
+ }
+ else
+ {
+ sChars = sTrimmedChars;
+ }
+ uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 );
+ sal_Int32 nCharsDecoded =
+ GetImport().GetMM100UnitConverter().
+ decodeBase64SomeChars( aBuffer, sChars );
+ sal_uInt32 nStartPos(maDecoded.getLength());
+ sal_uInt32 nCount(aBuffer.getLength());
+ maDecoded.realloc(nStartPos + nCount);
+ sal_Int8* pDecoded = maDecoded.getArray();
+ sal_Int8* pBuffer = aBuffer.getArray();
+ for (sal_uInt32 i = 0; i < nCount; i++, pBuffer++)
+ pDecoded[nStartPos + i] = *pBuffer;
+ if( nCharsDecoded != sChars.getLength() )
+ msValue = sChars.copy( nCharsDecoded );
+ }
+ }
+ else
+ msValue += rChars;
+}
+
+
+void XMLConfigItemContext::EndElement()
+{
+ if (mpBaseContext)
+ {
+ if (IsXMLToken(msType, XML_BOOLEAN))
+ {
+ sal_Bool bValue(sal_False);
+ if (IsXMLToken(msValue, XML_TRUE))
+ bValue = sal_True;
+ mrAny <<= bValue;
+ }
+ else if (IsXMLToken(msType, XML_BYTE))
+ {
+ sal_Int32 nValue(0);
+ SvXMLUnitConverter::convertNumber(nValue, msValue);
+ mrAny <<= static_cast<sal_Int8>(nValue);
+ }
+ else if (IsXMLToken(msType, XML_SHORT))
+ {
+ sal_Int32 nValue(0);
+ SvXMLUnitConverter::convertNumber(nValue, msValue);
+ mrAny <<= static_cast<sal_Int16>(nValue);
+ }
+ else if (IsXMLToken(msType, XML_INT))
+ {
+ sal_Int32 nValue(0);
+ SvXMLUnitConverter::convertNumber(nValue, msValue);
+ mrAny <<= nValue;
+ }
+ else if (IsXMLToken(msType, XML_LONG))
+ {
+ sal_Int64 nValue(msValue.toInt64());
+ mrAny <<= nValue;
+ }
+ else if (IsXMLToken(msType, XML_DOUBLE))
+ {
+ double fValue(0.0);
+ SvXMLUnitConverter::convertDouble(fValue, msValue);
+ mrAny <<= fValue;
+ }
+ else if (IsXMLToken(msType, XML_STRING))
+ {
+ mrAny <<= msValue;
+ }
+ else if (IsXMLToken(msType, XML_DATETIME))
+ {
+ util::DateTime aDateTime;
+ SvXMLUnitConverter::convertDateTime(aDateTime, msValue);
+ mrAny <<= aDateTime;
+ }
+ else if (IsXMLToken(msType, XML_BASE64BINARY))
+ {
+ mrAny <<= maDecoded;
+ }
+ else {
+ DBG_ERROR("wrong type");
+ }
+
+ ManipulateConfigItem();
+
+ mpBaseContext->AddPropertyValue();
+ }
+ else {
+ DBG_ERROR("no BaseContext");
+ }
+}
+
+/** There are some instances where there is a mismatch between API and
+ * XML mapping of a setting. In this case, this method allows us to
+ * manipulate the values accordingly. */
+void XMLConfigItemContext::ManipulateConfigItem()
+{
+ if( mrItemName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "PrinterIndependentLayout" ) ) )
+ {
+ rtl::OUString sValue;
+ mrAny >>= sValue;
+
+ sal_Int16 nTmp = document::PrinterIndependentLayout::HIGH_RESOLUTION;
+
+ if( sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("enabled")) ||
+ sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("low-resolution")) )
+ {
+ nTmp = document::PrinterIndependentLayout::LOW_RESOLUTION;
+ }
+ else if( sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("disabled")) )
+ {
+ nTmp = document::PrinterIndependentLayout::DISABLED;
+ }
+ // else: default to high_resolution
+
+ mrAny <<= nTmp;
+ }
+ else if( (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ColorTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineEndTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HatchTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DashTableURL" ) ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GradientTableURL") ) ) ||
+ (mrItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BitmapTableURL" ) ) ) )
+ {
+ if( GetImport().getServiceFactory().is() ) try
+ {
+ uno::Reference< util::XStringSubstitution > xStringSubsitution(
+ GetImport().getServiceFactory()->
+ createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ), uno::UNO_QUERY );
+
+ if( xStringSubsitution.is() )
+ {
+ rtl::OUString aURL;
+ mrAny >>= aURL;
+ aURL = xStringSubsitution->substituteVariables( aURL, sal_False );
+ mrAny <<= aURL;
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
+
+//=============================================================================
+
+XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ com::sun::star::uno::Any& rAny,
+ XMLConfigBaseContext* pBaseContext)
+ : XMLConfigBaseContext(rImport, nPrfx, rLName, rAny, pBaseContext)
+{
+}
+
+XMLConfigItemMapNamedContext::~XMLConfigItemMapNamedContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemMapNamedContext::CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
+}
+
+void XMLConfigItemMapNamedContext::EndElement()
+{
+ if (mpBaseContext)
+ {
+ mrAny <<= maProps.GetNameContainer();
+ mpBaseContext->AddPropertyValue();
+ }
+ else {
+ DBG_ERROR("no BaseContext");
+ }
+}
+
+//=============================================================================
+
+XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>&,
+ com::sun::star::uno::Any& rAny,
+ const ::rtl::OUString& rConfigItemName,
+ XMLConfigBaseContext* pBaseContext)
+ : XMLConfigBaseContext(rImport, nPrfx, rLName, rAny, pBaseContext),
+ maConfigItemName( rConfigItemName )
+{
+}
+
+XMLConfigItemMapIndexedContext::~XMLConfigItemMapIndexedContext()
+{
+}
+
+SvXMLImportContext *XMLConfigItemMapIndexedContext::CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
+{
+ return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
+}
+
+void XMLConfigItemMapIndexedContext::EndElement()
+{
+ if (mpBaseContext)
+ {
+ if( maConfigItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ForbiddenCharacters" ) ) )
+ {
+ uno::Reference< i18n::XForbiddenCharacters > xForbChars;
+
+ // get the forbidden characters from the document
+ uno::Reference< lang::XMultiServiceFactory > xFac( GetImport().GetModel(), uno::UNO_QUERY );
+ if( xFac.is() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), uno::UNO_QUERY );
+ if( xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName( maConfigItemName ) )
+ {
+ xProps->getPropertyValue( maConfigItemName ) >>= xForbChars;
+ }
+ }
+
+ if( xForbChars.is() )
+ {
+
+ uno::Reference< container::XIndexAccess > xIndex( maProps.GetIndexContainer(), uno::UNO_QUERY );
+
+ const sal_Int32 nCount = xIndex->getCount();
+ uno::Sequence < beans::PropertyValue > aProps;
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_FORBIDDEN_CHARACTER_MAX ) )
+ {
+ beans::PropertyValue *pForChar = aProps.getArray();
+ i18n::ForbiddenCharacters aForbid;
+ lang::Locale aLocale;
+ const rtl::OUString sLanguage ( RTL_CONSTASCII_USTRINGPARAM ( "Language" ) );
+ const rtl::OUString sCountry ( RTL_CONSTASCII_USTRINGPARAM ( "Country" ) );
+ const rtl::OUString sVariant ( RTL_CONSTASCII_USTRINGPARAM ( "Variant" ) );
+ const rtl::OUString sBeginLine ( RTL_CONSTASCII_USTRINGPARAM ( "BeginLine" ) );
+ const rtl::OUString sEndLine ( RTL_CONSTASCII_USTRINGPARAM ( "EndLine" ) );
+ sal_Bool bHaveLanguage = sal_False, bHaveCountry = sal_False, bHaveVariant = sal_False,
+ bHaveBegin = sal_False, bHaveEnd = sal_False;
+
+ for ( sal_Int32 j = 0 ; j < XML_FORBIDDEN_CHARACTER_MAX ; j++ )
+ {
+ if (pForChar->Name.equals (sLanguage ) )
+ {
+ pForChar->Value >>= aLocale.Language;
+ bHaveLanguage = sal_True;
+ }
+ else if (pForChar->Name.equals (sCountry ) )
+ {
+ pForChar->Value >>= aLocale.Country;
+ bHaveCountry = sal_True;
+ }
+ else if (pForChar->Name.equals (sVariant ) )
+ {
+ pForChar->Value >>= aLocale.Variant;
+ bHaveVariant = sal_True;
+ }
+ else if (pForChar->Name.equals (sBeginLine ) )
+ {
+ pForChar->Value >>= aForbid.beginLine;
+ bHaveBegin = sal_True;
+ }
+ else if (pForChar->Name.equals (sEndLine ) )
+ {
+ pForChar->Value >>= aForbid.endLine;
+ bHaveEnd = sal_True;
+ }
+ pForChar++;
+ }
+
+ if ( bHaveLanguage && bHaveCountry && bHaveVariant && bHaveBegin && bHaveEnd )
+ {
+ try
+ {
+ xForbChars->setForbiddenCharacters( aLocale, aForbid );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "Exception while importing forbidden characters" );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR( "could not get the XForbiddenCharacters from document!" );
+ mrAny <<= maProps.GetIndexContainer();
+ }
+ }
+ else if( maConfigItemName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Symbols" ) ) )
+ {
+ uno::Reference< container::XIndexAccess > xIndex( maProps.GetIndexContainer(), uno::UNO_QUERY );
+
+ const sal_Int32 nCount = xIndex->getCount();
+ uno::Sequence < beans::PropertyValue > aProps;
+ uno::Sequence < formula::SymbolDescriptor > aSymbolList ( nCount );
+
+ formula::SymbolDescriptor *pDescriptor = aSymbolList.getArray();
+
+ const rtl::OUString sName ( RTL_CONSTASCII_USTRINGPARAM ( "Name" ) );
+ const rtl::OUString sExportName ( RTL_CONSTASCII_USTRINGPARAM ( "ExportName" ) );
+ const rtl::OUString sFontName ( RTL_CONSTASCII_USTRINGPARAM ( "FontName" ) );
+ const rtl::OUString sSymbolSet ( RTL_CONSTASCII_USTRINGPARAM ( "SymbolSet" ) );
+ const rtl::OUString sCharacter ( RTL_CONSTASCII_USTRINGPARAM ( "Character" ) );
+ const rtl::OUString sCharSet ( RTL_CONSTASCII_USTRINGPARAM ( "CharSet" ) );
+ const rtl::OUString sFamily ( RTL_CONSTASCII_USTRINGPARAM ( "Family" ) );
+ const rtl::OUString sPitch ( RTL_CONSTASCII_USTRINGPARAM ( "Pitch" ) );
+ const rtl::OUString sWeight ( RTL_CONSTASCII_USTRINGPARAM ( "Weight" ) );
+ const rtl::OUString sItalic ( RTL_CONSTASCII_USTRINGPARAM ( "Italic" ) );
+ sal_Int16 nNumFullEntries = 0;
+
+ for ( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_SYMBOL_DESCRIPTOR_MAX ) )
+ {
+ sal_Bool bHaveName = sal_False, bHaveExportName = sal_False, bHaveCharSet = sal_False,
+ bHaveFontName = sal_False, bHaveFamily = sal_False, bHavePitch = sal_False,
+ bHaveWeight = sal_False, bHaveItalic = sal_False, bHaveSymbolSet = sal_False,
+ bHaveCharacter = sal_False;
+ beans::PropertyValue *pSymbol = aProps.getArray();
+
+ for ( sal_Int32 j = 0 ; j < XML_SYMBOL_DESCRIPTOR_MAX ; j++ )
+ {
+ if (pSymbol->Name.equals ( sName ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sName;
+ bHaveName = sal_True;
+ }
+ else if (pSymbol->Name.equals (sExportName ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sExportName;
+ bHaveExportName = sal_True;
+ }
+ else if (pSymbol->Name.equals (sFontName ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sFontName;
+ bHaveFontName = sal_True;
+ }
+ else if (pSymbol->Name.equals (sCharSet ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharSet;
+ bHaveCharSet = sal_True;
+ }
+ else if (pSymbol->Name.equals (sFamily ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nFamily;
+ bHaveFamily = sal_True;
+ }
+ else if (pSymbol->Name.equals (sPitch ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nPitch;
+ bHavePitch = sal_True;
+ }
+ else if (pSymbol->Name.equals (sWeight ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nWeight;
+ bHaveWeight = sal_True;
+ }
+ else if (pSymbol->Name.equals (sItalic ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nItalic;
+ bHaveItalic = sal_True;
+ }
+ else if (pSymbol->Name.equals (sSymbolSet ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].sSymbolSet;
+ bHaveSymbolSet = sal_True;
+ }
+ else if (pSymbol->Name.equals (sCharacter ) )
+ {
+ pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharacter;
+ bHaveCharacter = sal_True;
+ }
+ pSymbol++;
+ }
+ if ( bHaveName && bHaveExportName && bHaveCharSet && bHaveFontName && bHaveCharacter
+ && bHaveFamily && bHavePitch && bHaveWeight && bHaveItalic && bHaveSymbolSet)
+ nNumFullEntries++;
+ }
+ }
+ aSymbolList.realloc (nNumFullEntries);
+ mrAny <<= aSymbolList;
+ }
+ else
+ {
+ mrAny <<= maProps.GetIndexContainer();
+ }
+ mpBaseContext->AddPropertyValue();
+ }
+ else {
+ DBG_ERROR("no BaseContext");
+ }
+}
+
diff --git a/xmloff/source/core/DomBuilderContext.cxx b/xmloff/source/core/DomBuilderContext.cxx
new file mode 100644
index 000000000000..317818c6562f
--- /dev/null
+++ b/xmloff/source/core/DomBuilderContext.cxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "DomBuilderContext.hxx"
+
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlerror.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/dom/XAttr.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XElement.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/dom/NodeType.hpp>
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+
+#include <unotools/processfactory.hxx>
+
+
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::UNO_QUERY_THROW;
+using com::sun::star::xml::dom::XAttr;
+using com::sun::star::xml::dom::XDocument;
+using com::sun::star::xml::dom::XDocumentBuilder;
+using com::sun::star::xml::dom::XNode;
+using com::sun::star::xml::dom::XElement;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::dom::NodeType_ELEMENT_NODE;
+using rtl::OUString;
+
+
+// helper functions; implemented below
+Reference<XNode> lcl_createDomInstance();
+Reference<XNode> lcl_createElement( SvXMLImport& rImport,
+ USHORT nPrefix,
+ const OUString rLocalName,
+ Reference<XNode> xParent);
+
+
+DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
+ USHORT nPrefix,
+ const OUString& rLocalName ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mxNode( lcl_createElement( rImport, nPrefix, rLocalName,
+ lcl_createDomInstance() ) )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ DBG_ASSERT( Reference<XElement>( mxNode, UNO_QUERY ).is(), "need element" );
+ DBG_ASSERT( mxNode->getNodeType() == NodeType_ELEMENT_NODE, "need element" );
+}
+
+DomBuilderContext::DomBuilderContext( SvXMLImport& rImport,
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ Reference<XNode>& xParent ) :
+ SvXMLImportContext( rImport, nPrefix, rLocalName ),
+ mxNode( lcl_createElement( rImport, nPrefix, rLocalName, xParent ) )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ DBG_ASSERT( Reference<XElement>( mxNode, UNO_QUERY ).is(), "need element" );
+ DBG_ASSERT( mxNode->getNodeType() == NodeType_ELEMENT_NODE, "need element" );
+}
+
+DomBuilderContext::~DomBuilderContext()
+{
+}
+
+Reference<XDocument> DomBuilderContext::getTree()
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ return mxNode->getOwnerDocument();
+}
+
+Reference<XNode> DomBuilderContext::getNode()
+{
+ return mxNode;
+}
+
+
+SvXMLImportContext* DomBuilderContext::CreateChildContext(
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const Reference<XAttributeList>& )
+{
+ // create DomBuilder for subtree
+ return new DomBuilderContext( GetImport(), nPrefix, rLocalName, mxNode );
+}
+
+
+void DomBuilderContext::StartElement(
+ const Reference<XAttributeList>& xAttrList )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+ DBG_ASSERT( mxNode->getOwnerDocument().is(), "XNode must have XDocument" );
+
+ // add attribute nodes to new node
+ sal_Int16 nAttributeCount = xAttrList->getLength();
+ for( sal_Int16 i = 0; i < nAttributeCount; i++ )
+ {
+ // get name & value for attribute
+ const OUString& rName = xAttrList->getNameByIndex( i );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ // namespace handling: determine namespace & namespace keykey
+ OUString sNamespace;
+ sal_uInt16 nNamespaceKey =
+ GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ rName, NULL, NULL, &sNamespace );
+
+ // create attribute node and set value
+ Reference<XElement> xElement( mxNode, UNO_QUERY_THROW );
+ switch( nNamespaceKey )
+ {
+ case XML_NAMESPACE_NONE:
+ // no namespace: create a non-namespaced attribute
+ xElement->setAttribute( rName, rValue );
+ break;
+ case XML_NAMESPACE_XMLNS:
+ // namespace declaration: ignore, since the DOM tree handles these
+ // declarations implicitly
+ break;
+ case XML_NAMESPACE_UNKNOWN:
+ // unknown namespace: illegal input. Raise Warning.
+ {
+ Sequence<OUString> aSeq(2);
+ aSeq[0] = rName;
+ aSeq[1] = rValue;
+ GetImport().SetError(
+ XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, aSeq );
+ }
+ break;
+ default:
+ // a real and proper namespace: create namespaced attribute
+ xElement->setAttributeNS( sNamespace, rName, rValue );
+ break;
+ }
+ }
+}
+
+void DomBuilderContext::EndElement()
+{
+ // nothing to be done!
+}
+
+void DomBuilderContext::Characters( const OUString& rCharacters )
+{
+ DBG_ASSERT( mxNode.is(), "empty XNode not allowed" );
+
+ // TODO: I assume adjacent text nodes should be joined, to preserve
+ // processinf model? (I.e., if the SAX parser breaks a string into 2
+ // Characters(..) calls, the DOM model would still see only one child.)
+
+ // create text node and append to parent
+ Reference<XNode> xNew(
+ mxNode->getOwnerDocument()->createTextNode( rCharacters ),
+ UNO_QUERY_THROW );
+ mxNode->appendChild( xNew );
+}
+
+
+//
+// helper function implementations
+//
+
+const sal_Char sDocumentBuilder[] = "com.sun.star.xml.dom.DocumentBuilder";
+
+Reference<XNode> lcl_createDomInstance()
+{
+ Reference<XMultiServiceFactory> xFactory = utl::getProcessServiceFactory();
+ DBG_ASSERT( xFactory.is(), "can't get service factory" );
+
+ Reference<XDocumentBuilder> xBuilder(
+ xFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( sDocumentBuilder ) ) ),
+ UNO_QUERY_THROW );
+
+ return Reference<XNode>( xBuilder->newDocument(), UNO_QUERY_THROW );
+}
+
+Reference<XNode> lcl_createElement( SvXMLImport& rImport,
+ USHORT nPrefix,
+ const OUString rLocalName,
+ Reference<XNode> xParent)
+{
+ DBG_ASSERT( xParent.is(), "need parent node" );
+
+ Reference<XDocument> xDocument = xParent->getOwnerDocument();
+ DBG_ASSERT( xDocument.is(), "no XDocument found!" );
+
+ // TODO: come up with proper way of handling namespaces; re-creating the
+ // namespace from the key is NOT a good idea, and will not work for
+ // multiple prefixes for the same namespace. Fortunately, those are rare.
+
+ Reference<XElement> xElement;
+ switch( nPrefix )
+ {
+ case XML_NAMESPACE_NONE:
+ // no namespace: use local name
+ xElement = xDocument->createElement( rLocalName );
+ break;
+ case XML_NAMESPACE_XMLNS:
+ case XML_NAMESPACE_UNKNOWN:
+ // both cases are illegal; raise warning (and use only local name)
+ xElement = xDocument->createElement( rLocalName );
+ {
+ Sequence<OUString> aSeq(1);
+ aSeq[0] = rLocalName;
+ rImport.SetError(
+ XMLERROR_FLAG_WARNING | XMLERROR_NAMESPACE_TROUBLE, aSeq );
+ }
+ break;
+ default:
+ // We are only given the prefix and the local name; thus we have to ask
+ // the namespace map to create a qualified name for us. Technically,
+ // this is a bug, since this will fail for multiple prefixes used for
+ // the same namespace.
+ xElement = xDocument->createElementNS(
+ rImport.GetNamespaceMap().GetNameByKey( nPrefix ),
+ rImport.GetNamespaceMap().GetQNameByKey( nPrefix, rLocalName ) );
+ break;
+ }
+ DBG_ASSERT( xElement.is(), "can't create element" );
+
+ // add new element to parent and return
+ Reference<XNode> xNode( xElement, UNO_QUERY_THROW );
+ xParent->appendChild( xNode );
+ return xNode;
+}
diff --git a/xmloff/source/core/DomExport.cxx b/xmloff/source/core/DomExport.cxx
new file mode 100644
index 000000000000..2936951ac091
--- /dev/null
+++ b/xmloff/source/core/DomExport.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "DomExport.hxx"
+
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlerror.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/xml/dom/XAttr.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XElement.hpp>
+#include <com/sun/star/xml/dom/XEntity.hpp>
+#include <com/sun/star/xml/dom/XNotation.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/dom/NodeType.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/debug.hxx>
+
+#include <unotools/processfactory.hxx>
+
+#include <vector>
+
+
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::UNO_QUERY_THROW;
+using std::vector;
+
+using namespace com::sun::star::xml::dom;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+
+class DomVisitor
+{
+public:
+ DomVisitor() {}
+ virtual ~DomVisitor() {}
+ virtual void element( const Reference<XElement>& ) {}
+ virtual void character( const Reference<XCharacterData>& ) {}
+ virtual void attribute( const Reference<XAttr>& ) {}
+ virtual void cdata( const Reference<XCDATASection>& ) {}
+ virtual void comment( const Reference<XComment>& ) {}
+ virtual void documentFragment( const Reference<XDocumentFragment>& ) {}
+ virtual void document( const Reference<XDocument>& ) {}
+ virtual void documentType( const Reference<XDocumentType>& ) {}
+ virtual void entity( const Reference<XEntity>& ) {}
+ virtual void entityReference( const Reference<XEntityReference>& ) {}
+ virtual void notation( const Reference<XNotation>& ) {}
+ virtual void processingInstruction( const Reference<XProcessingInstruction>& ) {}
+ virtual void endElement( const Reference<XElement>& ) {}
+};
+
+void visit( DomVisitor&, const Reference<XDocument>& );
+void visit( DomVisitor&, const Reference<XNode>& );
+
+
+
+void visitNode( DomVisitor& rVisitor, const Reference<XNode>& xNode )
+{
+ switch( xNode->getNodeType() )
+ {
+ case NodeType_ATTRIBUTE_NODE:
+ rVisitor.attribute( Reference<XAttr>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_CDATA_SECTION_NODE:
+ rVisitor.cdata( Reference<XCDATASection>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_COMMENT_NODE:
+ rVisitor.comment( Reference<XComment>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_DOCUMENT_FRAGMENT_NODE:
+ rVisitor.documentFragment( Reference<XDocumentFragment>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_DOCUMENT_NODE:
+ rVisitor.document( Reference<XDocument>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_DOCUMENT_TYPE_NODE:
+ rVisitor.documentType( Reference<XDocumentType>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_ELEMENT_NODE:
+ rVisitor.element( Reference<XElement>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_ENTITY_NODE:
+ rVisitor.entity( Reference<XEntity>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_ENTITY_REFERENCE_NODE:
+ rVisitor.entityReference( Reference<XEntityReference>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_NOTATION_NODE:
+ rVisitor.notation( Reference<XNotation>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_PROCESSING_INSTRUCTION_NODE:
+ rVisitor.processingInstruction( Reference<XProcessingInstruction>( xNode, UNO_QUERY_THROW ) );
+ break;
+ case NodeType_TEXT_NODE:
+ rVisitor.character( Reference<XCharacterData>( xNode, UNO_QUERY_THROW ) );
+ break;
+ default:
+ DBG_ERROR( "unknown DOM node type" );
+ break;
+ }
+}
+
+void visit( DomVisitor& rVisitor, const Reference<XDocument>& xDocument )
+{
+ visit( rVisitor, Reference<XNode>( xDocument, UNO_QUERY_THROW ) );
+}
+
+void visit( DomVisitor& rVisitor, const Reference<XNode>& xNode )
+{
+ visitNode( rVisitor, xNode );
+ for( Reference<XNode> xChild = xNode->getFirstChild();
+ xChild.is();
+ xChild = xChild->getNextSibling() )
+ {
+ visit( rVisitor, xChild );
+ }
+ if( xNode->getNodeType() == NodeType_ELEMENT_NODE )
+ rVisitor.endElement( Reference<XElement>( xNode, UNO_QUERY_THROW ) );
+}
+
+
+
+class DomExport: public DomVisitor
+{
+ SvXMLExport& mrExport;
+ vector<SvXMLNamespaceMap> maNamespaces;
+
+ void pushNamespace();
+ void popNamespace();
+ void addNamespace( const OUString& sPrefix, const OUString& sURI );
+ OUString qualifiedName( const OUString& sPrefix, const OUString& sURI,
+ const OUString& sLocalName );
+ OUString qualifiedName( const Reference<XNode>& );
+ OUString qualifiedName( const Reference<XElement>& );
+ OUString qualifiedName( const Reference<XAttr>& );
+ void addAttribute( const Reference<XAttr>& );
+
+public:
+
+ DomExport( SvXMLExport& rExport );
+ virtual ~DomExport();
+
+ virtual void element( const Reference<XElement>& );
+ virtual void endElement( const Reference<XElement>& );
+ virtual void character( const Reference<XCharacterData>& );
+};
+
+DomExport::DomExport( SvXMLExport& rExport ) :
+ mrExport( rExport )
+{
+ maNamespaces.push_back( rExport.GetNamespaceMap() );
+}
+
+DomExport::~DomExport()
+{
+ DBG_ASSERT( maNamespaces.size() == 1, "namespace missing" );
+ maNamespaces.clear();
+}
+
+void DomExport::pushNamespace()
+{
+ maNamespaces.push_back( maNamespaces.back() );
+}
+
+void DomExport::popNamespace()
+{
+ maNamespaces.pop_back();
+}
+
+void DomExport::addNamespace( const OUString& sPrefix, const OUString& sURI )
+{
+ SvXMLNamespaceMap& rMap = maNamespaces.back();
+ sal_uInt16 nKey = rMap.GetKeyByPrefix( sPrefix );
+
+ // we need to register the namespace, if either the prefix isn't known or
+ // is used for a different namespace
+ if( nKey == XML_NAMESPACE_UNKNOWN ||
+ rMap.GetNameByKey( nKey ) != sURI )
+ {
+ // add prefix to map, and add declaration
+ rMap.Add( sPrefix, sURI );
+ mrExport.AddAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "xmlns:" ) ) + sPrefix,
+ sURI );
+ }
+}
+
+OUString DomExport::qualifiedName( const OUString& sPrefix,
+ const OUString& sURI,
+ const OUString& sLocalName )
+{
+ OUStringBuffer sBuffer;
+ if( ( sPrefix.getLength() > 0 ) && ( sURI.getLength() > 0 ) )
+ {
+ addNamespace( sPrefix, sURI );
+ sBuffer.append( sPrefix );
+ sBuffer.append( sal_Unicode( ':' ) );
+ }
+ sBuffer.append( sLocalName );
+ return sBuffer.makeStringAndClear();
+}
+
+OUString DomExport::qualifiedName( const Reference<XNode>& xNode )
+{
+ return qualifiedName( xNode->getPrefix(), xNode->getNamespaceURI(),
+ xNode->getNodeName() );
+}
+
+OUString DomExport::qualifiedName( const Reference<XElement>& xElement )
+{
+ return qualifiedName( xElement->getPrefix(), xElement->getNamespaceURI(),
+ xElement->getNodeName() );
+}
+
+OUString DomExport::qualifiedName( const Reference<XAttr>& xAttr )
+{
+ return qualifiedName( xAttr->getPrefix(), xAttr->getNamespaceURI(),
+ xAttr->getNodeName() );
+}
+
+void DomExport::addAttribute( const Reference<XAttr>& xAttribute )
+{
+ mrExport.AddAttribute( qualifiedName( xAttribute ),
+ xAttribute->getNodeValue() );
+}
+
+void DomExport::element( const Reference<XElement>& xElement )
+{
+ pushNamespace();
+
+ // write attributes
+ Reference<XNamedNodeMap> xAttributes = xElement->getAttributes();
+ sal_Int32 nLength = xAttributes.is() ? xAttributes->getLength() : 0;
+ for( sal_Int32 n = 0; n < nLength; n++ )
+ {
+ addAttribute( Reference<XAttr>( xAttributes->item( n ), UNO_QUERY_THROW ) );
+ }
+
+ // write name
+ mrExport.StartElement( qualifiedName( xElement ), sal_False );
+}
+
+void DomExport::endElement( const Reference<XElement>& xElement )
+{
+ mrExport.EndElement( qualifiedName( xElement ), sal_False );
+ popNamespace();
+}
+
+void DomExport::character( const Reference<XCharacterData>& xChars )
+{
+ mrExport.Characters( xChars->getNodeValue() );
+}
+
+
+void exportDom( SvXMLExport& rExport, const Reference<XDocument>& xDocument )
+{
+ DomExport aDomExport( rExport );
+ visit( aDomExport, xDocument );
+}
+
+void exportDom( SvXMLExport& rExport, const Reference<XNode>& xNode )
+{
+ DomExport aDomExport( rExport );
+ visit( aDomExport, xNode );
+}
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx
new file mode 100644
index 000000000000..7e5f8569e964
--- /dev/null
+++ b/xmloff/source/core/ProgressBarHelper.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+
+
+
+
+//___________________________________________________________________
+#include <xmloff/ProgressBarHelper.hxx>
+#include <tools/debug.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <stdlib.h>
+
+using namespace ::com::sun::star;
+
+const sal_Int32 nDefaultProgressBarRange = 1000000;
+const float fProgressStep = 0.5;
+
+ProgressBarHelper::ProgressBarHelper(const ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator>& xTempStatusIndicator,
+ const sal_Bool bTempStrict)
+: xStatusIndicator(xTempStatusIndicator)
+, nRange(nDefaultProgressBarRange)
+, nReference(100)
+, nValue(0)
+, fOldPercent(0.0)
+, bStrict(bTempStrict)
+, bRepeat(sal_True)
+#ifdef DBG_UTIL
+, bFailure(sal_False)
+#endif
+{
+}
+
+ProgressBarHelper::~ProgressBarHelper()
+{
+}
+
+sal_Int32 ProgressBarHelper::ChangeReference(sal_Int32 nNewReference)
+{
+ if((nNewReference > 0) && (nNewReference != nReference))
+ {
+ if (nReference)
+ {
+ double fPercent(nNewReference / nReference);
+ double fValue(nValue * fPercent);
+#if OSL_DEBUG_LEVEL > 0
+ // workaround for toolchain bug on solaris/x86 Sun C++ 5.5
+ // just call some function here
+ (void) abs(nValue);
+#endif
+ nValue = static_cast< sal_Int32 >(fValue);
+ nReference = nNewReference;
+ }
+ else
+ {
+ nReference = nNewReference;
+ nValue = 0;
+ }
+ }
+ return nValue;
+}
+
+void ProgressBarHelper::SetValue(sal_Int32 nTempValue)
+{
+ if (xStatusIndicator.is() && (nReference > 0))
+ {
+ if ((nTempValue >= nValue) && (!bStrict || (bStrict && (nTempValue <= nReference))))
+ {
+ // #91317# no progress bar with values > 100%
+ if (nTempValue > nReference)
+ {
+ if (!bRepeat)
+ nValue = nReference;
+ else
+ {
+// xStatusIndicator->end();
+// xStatusIndicator->start();
+ xStatusIndicator->reset();
+ nValue = 0;
+ }
+ }
+ else
+ nValue = nTempValue;
+
+ double fValue(nValue);
+ double fNewValue ((fValue * nRange) / nReference);
+
+ xmloff::token::IncRescheduleCount();
+
+ xStatusIndicator->setValue((sal_Int32)fNewValue);
+
+ xmloff::token::DecRescheduleCount();
+
+ // #95181# disabled, because we want to call setValue very often to enable a good reschedule
+// double fPercent ((fNewValue * 100) / nRange);
+// if (fPercent >= (fOldPercent + fProgressStep))
+// {
+// xStatusIndicator->setValue((sal_Int32)fNewValue);
+// fOldPercent = fPercent;
+// }
+ }
+#ifdef DBG_UTIL
+ else if (!bFailure)
+ {
+ DBG_ERROR("tried to set a wrong value on the progressbar");
+ bFailure = sal_True;
+ }
+#endif
+ }
+}
+
diff --git a/xmloff/source/core/PropertySetMerger.cxx b/xmloff/source/core/PropertySetMerger.cxx
new file mode 100644
index 000000000000..56fa7ac049fd
--- /dev/null
+++ b/xmloff/source/core/PropertySetMerger.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include "PropertySetMerger.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase3.hxx>
+#endif
+
+class SvXMLAttrContainerItem_Impl;
+
+class PropertySetMergerImpl : public ::cppu::WeakAggImplHelper3< XPropertySet, XPropertyState, XPropertySetInfo >
+{
+private:
+ Reference< XPropertySet > mxPropSet1;
+ Reference< XPropertyState > mxPropSet1State;
+ Reference< XPropertySetInfo > mxPropSet1Info;
+
+ Reference< XPropertySet > mxPropSet2;
+ Reference< XPropertyState > mxPropSet2State;
+ Reference< XPropertySetInfo > mxPropSet2Info;
+
+public:
+ PropertySetMergerImpl( const Reference< XPropertySet > rPropSet1, const Reference< XPropertySet > rPropSet2 );
+ virtual ~PropertySetMergerImpl();
+
+ // XPropertySet
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
+ virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+
+ // XPropertyState
+ virtual PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual Sequence< PropertyState > SAL_CALL getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+
+ // XPropertySetInfo
+ virtual Sequence< Property > SAL_CALL getProperties( ) throw(RuntimeException);
+ virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw(UnknownPropertyException, RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw(RuntimeException);
+};
+
+// --------------------------------------------------------------------
+// Interface implementation
+// --------------------------------------------------------------------
+
+PropertySetMergerImpl::PropertySetMergerImpl( Reference< XPropertySet > rPropSet1, Reference< XPropertySet > rPropSet2 )
+: mxPropSet1( rPropSet1 )
+, mxPropSet1State( rPropSet1, UNO_QUERY )
+, mxPropSet1Info( rPropSet1->getPropertySetInfo() )
+, mxPropSet2( rPropSet2 )
+, mxPropSet2State( rPropSet2, UNO_QUERY )
+, mxPropSet2Info( rPropSet2->getPropertySetInfo() )
+{
+}
+
+PropertySetMergerImpl::~PropertySetMergerImpl()
+{
+}
+
+// XPropertySet
+Reference< XPropertySetInfo > SAL_CALL PropertySetMergerImpl::getPropertySetInfo( ) throw(RuntimeException)
+{
+ return this;
+}
+
+void SAL_CALL PropertySetMergerImpl::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( aPropertyName ) )
+ {
+ mxPropSet1->setPropertyValue( aPropertyName, aValue );
+ }
+ else
+ {
+ mxPropSet2->setPropertyValue( aPropertyName, aValue );
+ }
+}
+
+Any SAL_CALL PropertySetMergerImpl::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( PropertyName ) )
+ {
+ return mxPropSet1->getPropertyValue( PropertyName );
+ }
+ else
+ {
+ return mxPropSet2->getPropertyValue( PropertyName );
+ }
+}
+
+void SAL_CALL PropertySetMergerImpl::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SAL_CALL PropertySetMergerImpl::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SAL_CALL PropertySetMergerImpl::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SAL_CALL PropertySetMergerImpl::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// XPropertyState
+PropertyState SAL_CALL PropertySetMergerImpl::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( PropertyName ) )
+ {
+ if( mxPropSet1State.is() )
+ {
+ return mxPropSet1State->getPropertyState( PropertyName );
+ }
+ else
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ if( mxPropSet2State.is() )
+ {
+ return mxPropSet2State->getPropertyState( PropertyName );
+ }
+ else
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ }
+}
+
+Sequence< PropertyState > SAL_CALL PropertySetMergerImpl::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ const sal_Int32 nCount = aPropertyName.getLength();
+ Sequence< PropertyState > aPropStates( nCount );
+ PropertyState* pPropStates = aPropStates.getArray();
+ const OUString* pPropNames = aPropertyName.getConstArray();
+
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ *pPropStates++ = getPropertyState( *pPropNames++ );
+
+ return aPropStates;
+}
+
+void SAL_CALL PropertySetMergerImpl::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ if( mxPropSet1State.is() && mxPropSet1Info->hasPropertyByName( PropertyName ) )
+ {
+ mxPropSet1State->setPropertyToDefault( PropertyName );
+ }
+ else
+ {
+ if( mxPropSet2State.is() )
+ {
+ mxPropSet2State->setPropertyToDefault( PropertyName );
+ }
+ }
+}
+
+Any SAL_CALL PropertySetMergerImpl::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if( mxPropSet1State.is() && mxPropSet1Info->hasPropertyByName( aPropertyName ) )
+ {
+ return mxPropSet1State->getPropertyDefault( aPropertyName );
+ }
+ else
+ {
+ if( mxPropSet2State.is() )
+ {
+ return mxPropSet2State->getPropertyDefault( aPropertyName );
+ }
+ else
+ {
+ Any aAny;
+ return aAny;
+ }
+ }
+}
+
+// XPropertySetInfo
+Sequence< Property > SAL_CALL PropertySetMergerImpl::getProperties() throw(RuntimeException)
+{
+ Sequence< Property > aProps1( mxPropSet1Info->getProperties() );
+ const Property* pProps1 = aProps1.getArray();
+ const sal_Int32 nCount1 = aProps1.getLength();
+
+ Sequence< Property > aProps2( mxPropSet1Info->getProperties() );
+ const Property* pProps2 = aProps2.getArray();
+ const sal_Int32 nCount2 = aProps2.getLength();
+
+ Sequence< Property > aProperties( nCount1 + nCount2 );
+
+ sal_Int32 nIndex;
+
+ Property* pProperties = aProperties.getArray();
+
+ for( nIndex = 0; nIndex < nCount1; nIndex++ )
+ *pProperties++ = *pProps1++;
+
+ for( nIndex = 0; nIndex < nCount2; nIndex++ )
+ *pProperties++ = *pProps2++;
+
+ return aProperties;
+}
+
+Property SAL_CALL PropertySetMergerImpl::getPropertyByName( const OUString& aName ) throw(UnknownPropertyException, RuntimeException)
+{
+ if( mxPropSet1Info->hasPropertyByName( aName ) )
+ return mxPropSet1Info->getPropertyByName( aName );
+
+ return mxPropSet2Info->getPropertyByName( aName );
+}
+
+sal_Bool SAL_CALL PropertySetMergerImpl::hasPropertyByName( const OUString& Name ) throw(RuntimeException)
+{
+ if(mxPropSet1Info->hasPropertyByName( Name ) )
+ return sal_True;
+
+ return mxPropSet2Info->hasPropertyByName( Name );
+}
+
+Reference< XPropertySet > PropertySetMerger_CreateInstance( Reference< XPropertySet > rPropSet1, Reference< XPropertySet > rPropSet2 ) throw()
+{
+ return new PropertySetMergerImpl( rPropSet1, rPropSet2 );
+}
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
new file mode 100644
index 000000000000..1fbcc506e7ed
--- /dev/null
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaExportHelper.hxx"
+
+#include "xmloff/xmlnmspe.hxx"
+
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <comphelper/stlunosequence.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+static const char s_prefix [] = "_:b";
+
+static ::rtl::OUString
+makeCURIE(SvXMLExport * i_pExport,
+ uno::Reference<rdf::XURI> const & i_xURI)
+{
+ OSL_ENSURE(i_xURI.is(), "makeCURIE: null URI");
+ if (!i_xURI.is()) throw uno::RuntimeException();
+
+ const ::rtl::OUString Namespace( i_xURI->getNamespace() );
+ OSL_ENSURE(Namespace.getLength(), "makeCURIE: no namespace");
+ if (!Namespace.getLength()) throw uno::RuntimeException();
+
+ ::rtl::OUStringBuffer buf;
+ buf.append( i_pExport->EnsureNamespace(Namespace) );
+ buf.append( static_cast<sal_Unicode>(':') );
+ // N.B.: empty LocalName is valid!
+ buf.append( i_xURI->getLocalName() );
+
+ return buf.makeStringAndClear();
+}
+
+// #i112473# SvXMLExport::GetRelativeReference() not right for RDF on SaveAs
+// because the URIs in the repository are not rewritten on SaveAs, the
+// URI of the loaded document has to be used, not the URI of the target doc.
+static ::rtl::OUString
+getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI)
+{
+ uno::Reference< rdf::XURI > const xModelURI(
+ rExport.GetModel(), uno::UNO_QUERY_THROW );
+ ::rtl::OUString const baseURI( xModelURI->getStringValue() );
+
+ uno::Reference<uno::XComponentContext> const xContext(
+ rExport.GetComponentContext());
+ uno::Reference<lang::XMultiComponentFactory> const xServiceFactory(
+ xContext->getServiceManager(), uno::UNO_SET_THROW);
+ uno::Reference<uri::XUriReferenceFactory> const xUriFactory(
+ xServiceFactory->createInstanceWithContext(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.uri.UriReferenceFactory"), xContext),
+ uno::UNO_QUERY_THROW);
+
+ uno::Reference< uri::XUriReference > const xBaseURI(
+ xUriFactory->parse(baseURI), uno::UNO_SET_THROW );
+ uno::Reference< uri::XUriReference > const xAbsoluteURI(
+ xUriFactory->parse(rURI), uno::UNO_SET_THROW );
+ uno::Reference< uri::XUriReference > const xRelativeURI(
+ xUriFactory->makeRelative(xBaseURI, xAbsoluteURI, true, true, false),
+ uno::UNO_SET_THROW );
+ ::rtl::OUString const relativeURI(xRelativeURI->getUriReference());
+
+ return relativeURI;
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport)
+ : m_rExport(i_rExport), m_xRepository(0), m_Counter(0)
+{
+ const uno::Reference<rdf::XRepositorySupplier> xRS( m_rExport.GetModel(),
+ uno::UNO_QUERY);
+ OSL_ENSURE(xRS.is(), "AddRDFa: model is no rdf::XRepositorySupplier");
+ if (!xRS.is()) throw uno::RuntimeException();
+ m_xRepository.set(xRS->getRDFRepository(), uno::UNO_QUERY_THROW);
+}
+
+::rtl::OUString
+RDFaExportHelper::LookupBlankNode(
+ uno::Reference<rdf::XBlankNode> const & i_xBlankNode)
+{
+ OSL_ENSURE(i_xBlankNode.is(), "null BlankNode?");
+ if (!i_xBlankNode.is()) throw uno::RuntimeException();
+ ::rtl::OUString & rEntry(
+ m_BlankNodeMap[ i_xBlankNode->getStringValue() ] );
+ if (!rEntry.getLength())
+ {
+ ::rtl::OUStringBuffer buf;
+ buf.appendAscii(s_prefix);
+ buf.append(++m_Counter);
+ rEntry = buf.makeStringAndClear();
+ }
+ return rEntry;
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+void
+RDFaExportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xMetadatable)
+{
+ try
+ {
+ beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool > const
+ RDFaResult( m_xRepository->getStatementRDFa(i_xMetadatable) );
+
+ uno::Sequence<rdf::Statement> const & rStatements( RDFaResult.First );
+
+ if (0 == rStatements.getLength())
+ {
+ return; // no RDFa
+ }
+
+ // all stmts have the same subject, so we only handle first one
+ const uno::Reference<rdf::XURI> xSubjectURI(rStatements[0].Subject,
+ uno::UNO_QUERY);
+ const uno::Reference<rdf::XBlankNode> xSubjectBNode(
+ rStatements[0].Subject, uno::UNO_QUERY);
+ if (!xSubjectURI.is() && !xSubjectBNode.is())
+ {
+ throw uno::RuntimeException();
+ }
+ static const sal_Unicode s_OpenBracket ('[');
+ static const sal_Unicode s_CloseBracket(']');
+ const ::rtl::OUString about( xSubjectURI.is()
+ ? getRelativeReference(m_rExport, xSubjectURI->getStringValue())
+ : ::rtl::OUStringBuffer().append(s_OpenBracket).append(
+ LookupBlankNode(xSubjectBNode)).append(s_CloseBracket)
+ .makeStringAndClear()
+ );
+
+ const uno::Reference<rdf::XLiteral> xContent(
+ rStatements[0].Object, uno::UNO_QUERY_THROW );
+ const uno::Reference<rdf::XURI> xDatatype(xContent->getDatatype());
+ if (xDatatype.is())
+ {
+ const ::rtl::OUString datatype(
+ makeCURIE(&m_rExport, xDatatype) );
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML,
+ token::XML_DATATYPE, datatype);
+ }
+ if (RDFaResult.Second) // there is xhtml:content
+ {
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_CONTENT,
+ xContent->getValue());
+ }
+
+ ::rtl::OUStringBuffer property;
+ ::comphelper::intersperse(
+ ::boost::make_transform_iterator(
+ ::comphelper::stl_begin(rStatements),
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ ::comphelper::stl_end(rStatements),
+ ::boost::bind(&makeCURIE, &m_rExport,
+ ::boost::bind(&rdf::Statement::Predicate, _1))),
+ ::comphelper::OUStringBufferAppender(property),
+ ::rtl::OUString::createFromAscii(" "));
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_PROPERTY,
+ property.makeStringAndClear());
+
+ m_rExport.AddAttribute(XML_NAMESPACE_XHTML, token::XML_ABOUT, about);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "AddRDFa: exception");
+ }
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx
new file mode 100644
index 000000000000..611889497812
--- /dev/null
+++ b/xmloff/source/core/RDFaImportHelper.cxx
@@ -0,0 +1,501 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_xmloff.hxx"
+
+#include "RDFaImportHelper.hxx"
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+
+#include <comphelper/sequenceasvector.hxx>
+
+#include <tools/string.hxx> // for GetAbsoluteReference
+
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XDocumentRepository.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <boost/bind.hpp>
+#include <boost/iterator_adaptors.hpp>
+#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
+// N.B.: the check for the header guard _of a specific version of boost_
+// is here so this may work on different versions of boost,
+// which sadly put the goods in different header files
+#include <boost/iterator/transform_iterator.hpp>
+#endif
+
+#include <map>
+#include <iterator>
+#include <functional>
+#include <algorithm>
+
+
+using namespace ::com::sun::star;
+
+namespace xmloff {
+
+/** a bit of context for parsing RDFa attributes */
+class SAL_DLLPRIVATE RDFaReader
+{
+ const SvXMLImport & m_rImport;
+
+ const SvXMLImport & GetImport() const { return m_rImport; }
+
+ //FIXME: this is an ugly hack to workaround buggy SvXMLImport::GetAbsolute
+ ::rtl::OUString GetAbsoluteReference(::rtl::OUString const & i_rURI) const
+ {
+ if (!i_rURI.getLength() || i_rURI[0] == '#')
+ {
+ return GetImport().GetBaseURL() + i_rURI;
+ }
+ else
+ {
+ return GetImport().GetAbsoluteReference(i_rURI);
+ }
+ }
+
+public:
+ RDFaReader(SvXMLImport const & i_rImport)
+ : m_rImport(i_rImport)
+ { }
+
+ // returns URI or blank node!
+ ::rtl::OUString ReadCURIE(::rtl::OUString const & i_rCURIE) const;
+
+ std::vector< ::rtl::OUString >
+ ReadCURIEs(::rtl::OUString const & i_rCURIEs) const;
+
+ ::rtl::OUString
+ ReadURIOrSafeCURIE( ::rtl::OUString const & i_rURIOrSafeCURIE) const;
+};
+
+/** helper to insert RDFa statements into the RDF repository */
+class SAL_DLLPRIVATE RDFaInserter
+{
+ const uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference< rdf::XDocumentRepository > m_xRepository;
+
+ typedef ::std::map< ::rtl::OUString, uno::Reference< rdf::XBlankNode > >
+ BlankNodeMap_t;
+
+ BlankNodeMap_t m_BlankNodeMap;
+
+public:
+ RDFaInserter(uno::Reference<uno::XComponentContext> const & i_xContext,
+ uno::Reference< rdf::XDocumentRepository > const & i_xRepository)
+ : m_xContext(i_xContext)
+ , m_xRepository(i_xRepository)
+ {}
+
+ uno::Reference< rdf::XBlankNode >
+ LookupBlankNode(::rtl::OUString const & i_rNodeId );
+
+ uno::Reference< rdf::XURI >
+ MakeURI( ::rtl::OUString const & i_rURI) const;
+
+ uno::Reference< rdf::XResource>
+ MakeResource( ::rtl::OUString const & i_rResource);
+
+ void InsertRDFaEntry(struct RDFaEntry const & i_rEntry);
+};
+
+/** store parsed RDFa attributes */
+struct SAL_DLLPRIVATE ParsedRDFaAttributes
+{
+ ::rtl::OUString m_About;
+ ::std::vector< ::rtl::OUString > m_Properties;
+ ::rtl::OUString m_Content;
+ ::rtl::OUString m_Datatype;
+
+ ParsedRDFaAttributes(
+ ::rtl::OUString const & i_rAbout,
+ ::std::vector< ::rtl::OUString > const & i_rProperties,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+ : m_About(i_rAbout)
+ , m_Properties(i_rProperties)
+ , m_Content(i_rContent)
+ , m_Datatype(i_rDatatype)
+ { }
+};
+
+/** store metadatable object and its RDFa attributes */
+struct SAL_DLLPRIVATE RDFaEntry
+{
+ uno::Reference<rdf::XMetadatable> m_xObject;
+ ::boost::shared_ptr<ParsedRDFaAttributes> m_pRDFaAttributes;
+
+ RDFaEntry(uno::Reference<rdf::XMetadatable> const & i_xObject,
+ ::boost::shared_ptr<ParsedRDFaAttributes> const& i_pRDFaAttributes)
+ : m_xObject(i_xObject)
+ , m_pRDFaAttributes(i_pRDFaAttributes)
+ { }
+};
+
+////////////////////////////////////////////////////////////////////////////
+
+
+static inline bool isWS(const sal_Unicode i_Char)
+{
+ return ('\t' == i_Char) || ('\n' == i_Char) || ('\r' == i_Char)
+ || (' ' == i_Char);
+}
+
+static ::rtl::OUString splitAtWS(::rtl::OUString & io_rString)
+{
+ const sal_Int32 len( io_rString.getLength() );
+ sal_Int32 idxstt(0);
+ while ((idxstt < len) && ( isWS(io_rString[idxstt])))
+ ++idxstt; // skip leading ws
+ sal_Int32 idxend(idxstt);
+ while ((idxend < len) && (!isWS(io_rString[idxend])))
+ ++idxend; // the CURIE
+ const ::rtl::OUString ret(io_rString.copy(idxstt, idxend - idxstt));
+ io_rString = io_rString.copy(idxend); // rest
+ return ret;
+}
+
+::rtl::OUString
+RDFaReader::ReadCURIE(::rtl::OUString const & i_rCURIE) const
+{
+ // the RDFa spec says that a prefix is required (it may be empty: ":foo")
+ const sal_Int32 idx( i_rCURIE.indexOf(':') );
+ if (idx >= 0)
+ {
+ ::rtl::OUString Prefix;
+ ::rtl::OUString LocalName;
+ ::rtl::OUString Namespace;
+ sal_uInt16 nKey( GetImport().GetNamespaceMap()._GetKeyByAttrName(
+ i_rCURIE, &Prefix, &LocalName, &Namespace) );
+ if (Prefix.equalsAscii("_"))
+ {
+ // eeek, it's a bnode!
+ // "_" is not a valid URI scheme => we can identify bnodes
+ return i_rCURIE;
+ }
+ else
+ {
+ OSL_ENSURE(XML_NAMESPACE_NONE != nKey, "no namespace?");
+ if ((XML_NAMESPACE_UNKNOWN != nKey) &&
+ (XML_NAMESPACE_XMLNS != nKey))
+ {
+ // N.B.: empty LocalName is valid!
+ const ::rtl::OUString URI(Namespace + LocalName);
+// return GetImport().GetAbsoluteReference(URI);
+ return GetAbsoluteReference(URI);
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: invalid prefix" );
+ return ::rtl::OUString();
+ }
+ }
+ }
+ else
+ {
+ OSL_TRACE( "ReadCURIE: invalid CURIE: no prefix" );
+ return ::rtl::OUString();
+ }
+}
+
+::std::vector< ::rtl::OUString >
+RDFaReader::ReadCURIEs(::rtl::OUString const & i_rCURIEs) const
+{
+ std::vector< ::rtl::OUString > vec;
+ ::rtl::OUString CURIEs(i_rCURIEs);
+ do {
+ ::rtl::OUString curie( splitAtWS(CURIEs) );
+ if (curie.getLength())
+ {
+ const ::rtl::OUString uri(ReadCURIE(curie));
+ if (uri.getLength())
+ {
+ vec.push_back(uri);
+ }
+ }
+ }
+ while (CURIEs.getLength());
+ if (!vec.size())
+ {
+ OSL_TRACE( "ReadCURIEs: invalid CURIEs" );
+ }
+ return vec;
+}
+
+::rtl::OUString
+RDFaReader::ReadURIOrSafeCURIE(::rtl::OUString const & i_rURIOrSafeCURIE) const
+{
+ const sal_Int32 len(i_rURIOrSafeCURIE.getLength());
+ if (len && (i_rURIOrSafeCURIE[0] == '['))
+ {
+ if ((len >= 2) && (i_rURIOrSafeCURIE[len - 1] == ']'))
+ {
+ return ReadCURIE(i_rURIOrSafeCURIE.copy(1, len - 2));
+ }
+ else
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid SafeCURIE" );
+ return ::rtl::OUString();
+ }
+ }
+ else
+ {
+ if (i_rURIOrSafeCURIE.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE( "ReadURIOrSafeCURIE: invalid URI: scheme is _" );
+ return ::rtl::OUString();
+ }
+ else
+ {
+// return GetImport().GetAbsoluteReference(i_rURIOrSafeCURIE);
+ return GetAbsoluteReference(i_rURIOrSafeCURIE);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+uno::Reference< rdf::XBlankNode >
+RDFaInserter::LookupBlankNode(::rtl::OUString const & i_rNodeId )
+{
+ uno::Reference< rdf::XBlankNode > & rEntry( m_BlankNodeMap[ i_rNodeId ] );
+ if (!rEntry.is())
+ {
+ rEntry = m_xRepository->createBlankNode();
+ }
+ return rEntry;
+}
+
+uno::Reference< rdf::XURI >
+RDFaInserter::MakeURI( ::rtl::OUString const & i_rURI) const
+{
+ if (i_rURI.matchAsciiL("_:", 2)) // blank node
+ {
+ OSL_TRACE("MakeURI: cannot create URI for blank node");
+ return 0;
+ }
+ else
+ {
+ try
+ {
+ return rdf::URI::create( m_xContext, i_rURI );
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "MakeURI: cannot create URI");
+ return 0;
+ }
+ }
+}
+
+uno::Reference< rdf::XResource>
+RDFaInserter::MakeResource( ::rtl::OUString const & i_rResource)
+{
+ if (i_rResource.matchAsciiL("_:", 2)) // blank node
+ {
+ // we cannot use the blank node label as-is: it must be distinct
+ // from labels in other graphs, so create fresh ones per XML stream
+ // N.B.: content.xml and styles.xml are distinct graphs
+ ::rtl::OUString name( i_rResource.copy(2) );
+ const uno::Reference< rdf::XBlankNode > xBNode( LookupBlankNode(name) );
+ OSL_ENSURE(xBNode.is(), "no blank node?");
+ return uno::Reference<rdf::XResource>( xBNode, uno::UNO_QUERY);
+ }
+ else
+ {
+ return uno::Reference<rdf::XResource>( MakeURI( i_rResource ),
+ uno::UNO_QUERY);
+ }
+}
+
+/** i wrote this because c++ implementations cannot agree on which variant
+ of boost::bind and std::mem_fun_ref applied to Reference::is compiles */
+class ref_is_null :
+ public ::std::unary_function<sal_Bool, const uno::Reference<rdf::XURI> & >
+{
+public:
+ sal_Bool operator() (const uno::Reference<rdf::XURI> & i_rRef)
+ {
+ return !i_rRef.is();
+ }
+};
+
+void RDFaInserter::InsertRDFaEntry(
+ struct RDFaEntry const & i_rEntry)
+{
+ OSL_ENSURE(i_rEntry.m_xObject.is(),
+ "InsertRDFaEntry: invalid arg: null object");
+ if (!i_rEntry.m_xObject.is()) return;
+
+ const uno::Reference< rdf::XResource > xSubject(
+ MakeResource( i_rEntry.m_pRDFaAttributes->m_About ) );
+ if (!xSubject.is())
+ {
+ return; // invalid
+ }
+
+ ::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > predicates;
+
+ predicates.reserve(i_rEntry.m_pRDFaAttributes->m_Properties.size());
+
+ ::std::remove_copy_if(
+ ::boost::make_transform_iterator(
+ i_rEntry.m_pRDFaAttributes->m_Properties.begin(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ i_rEntry.m_pRDFaAttributes->m_Properties.end(),
+ ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ ::std::back_inserter(predicates),
+ ref_is_null() );
+ // compiles only on wntmsci12
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool>(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, wntsci12, but not unxlngi6
+// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool, com::sun::star::uno::Reference<rdf::XURI> >(&uno::Reference<rdf::XURI>::is, _1)));
+ // compiles on unxsoli4, unxlngi6, but not wntsci12
+// ::std::not1( ::std::mem_fun_ref(&uno::Reference<rdf::XURI>::is)) );
+
+ if (!predicates.size())
+ {
+ return; // invalid
+ }
+
+ uno::Reference<rdf::XURI> xDatatype;
+ if (i_rEntry.m_pRDFaAttributes->m_Datatype.getLength())
+ {
+ xDatatype = MakeURI( i_rEntry.m_pRDFaAttributes->m_Datatype );
+ }
+
+ try
+ {
+ // N.B.: this will call xMeta->ensureMetadataReference, which is why
+ // this must be done _after_ importing the whole XML file,
+ // to prevent collision between generated ids and ids in the file
+ m_xRepository->setStatementRDFa(xSubject, predicates.getAsConstList(),
+ i_rEntry.m_xObject,
+ i_rEntry.m_pRDFaAttributes->m_Content, xDatatype);
+ }
+ catch (uno::Exception &)
+ {
+ OSL_ENSURE(false, "InsertRDFaEntry: setStatementRDFa failed?");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
+RDFaImportHelper::RDFaImportHelper(const SvXMLImport & i_rImport)
+ : m_rImport(i_rImport)
+{
+}
+
+RDFaImportHelper::~RDFaImportHelper()
+{
+}
+
+::boost::shared_ptr<ParsedRDFaAttributes>
+RDFaImportHelper::ParseRDFa(
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ if (!i_rProperty.getLength())
+ {
+ OSL_TRACE("AddRDFa: invalid input: xhtml:property empty");
+ return ::boost::shared_ptr<ParsedRDFaAttributes>();
+ }
+ // must parse CURIEs here: need namespace declaration context
+ RDFaReader reader(GetImport());
+ const ::rtl::OUString about( reader.ReadURIOrSafeCURIE(i_rAbout) );
+ if (!about.getLength()) {
+ return ::boost::shared_ptr<ParsedRDFaAttributes>();
+ }
+ const ::std::vector< ::rtl::OUString > properties(
+ reader.ReadCURIEs(i_rProperty) );
+ if (!properties.size()) {
+ return ::boost::shared_ptr<ParsedRDFaAttributes>();
+ }
+ const ::rtl::OUString datatype( i_rDatatype.getLength()
+ ? reader.ReadCURIE(i_rDatatype)
+ : ::rtl::OUString() );
+ return ::boost::shared_ptr<ParsedRDFaAttributes>(
+ new ParsedRDFaAttributes(about, properties, i_rContent, datatype));
+}
+
+void
+RDFaImportHelper::AddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xObject,
+ ::boost::shared_ptr<ParsedRDFaAttributes> & i_pRDFaAttributes)
+{
+ if (!i_xObject.is())
+ {
+ OSL_ENSURE(false, "AddRDFa: invalid arg: null textcontent");
+ return;
+ }
+ if (!i_pRDFaAttributes.get())
+ {
+ OSL_ENSURE(false, "AddRDFa: invalid arg: null RDFa attributes");
+ return;
+ }
+ m_RDFaEntries.push_back(RDFaEntry(i_xObject, i_pRDFaAttributes));
+}
+
+void
+RDFaImportHelper::ParseAndAddRDFa(
+ uno::Reference<rdf::XMetadatable> const & i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ ::boost::shared_ptr<ParsedRDFaAttributes> pAttributes(
+ ParseRDFa(i_rAbout, i_rProperty, i_rContent, i_rDatatype) );
+ if (pAttributes.get())
+ {
+ AddRDFa(i_xObject, pAttributes);
+ }
+}
+
+void RDFaImportHelper::InsertRDFa(
+ uno::Reference< rdf::XRepositorySupplier> const & i_xModel)
+{
+ OSL_ENSURE(i_xModel.is(), "InsertRDFa: invalid arg: model null");
+ if (!i_xModel.is()) return;
+ const uno::Reference< rdf::XDocumentRepository > xRepository(
+ i_xModel->getRDFRepository(), uno::UNO_QUERY);
+ OSL_ENSURE(xRepository.is(), "InsertRDFa: no DocumentRepository?");
+ if (!xRepository.is()) return;
+ RDFaInserter inserter(GetImport().GetComponentContext(), xRepository);
+ ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(),
+ ::boost::bind(&RDFaInserter::InsertRDFaEntry, &inserter, _1));
+}
+
+} // namespace xmloff
+
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
new file mode 100644
index 000000000000..7541feb38999
--- /dev/null
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -0,0 +1,569 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/SettingsExportHelper.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/extract.hxx>
+
+#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <xmloff/XMLSettingsExportContext.hxx>
+#include <xmlenums.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+XMLSettingsExportHelper::XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext )
+: m_rContext( i_rContext )
+, msPrinterIndependentLayout( RTL_CONSTASCII_USTRINGPARAM( "PrinterIndependentLayout" ) )
+, msColorTableURL( RTL_CONSTASCII_USTRINGPARAM( "ColorTableURL" ) )
+, msLineEndTableURL( RTL_CONSTASCII_USTRINGPARAM( "LineEndTableURL" ) )
+, msHatchTableURL( RTL_CONSTASCII_USTRINGPARAM( "HatchTableURL" ) )
+, msDashTableURL( RTL_CONSTASCII_USTRINGPARAM( "DashTableURL" ) )
+, msGradientTableURL( RTL_CONSTASCII_USTRINGPARAM( "GradientTableURL" ) )
+, msBitmapTableURL( RTL_CONSTASCII_USTRINGPARAM( "BitmapTableURL" ) )
+{
+}
+
+XMLSettingsExportHelper::~XMLSettingsExportHelper()
+{
+}
+
+void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny,
+ const rtl::OUString& rName) const
+{
+ uno::Any aAny( rAny );
+ ManipulateSetting( aAny, rName );
+
+ uno::TypeClass eClass = aAny.getValueTypeClass();
+ switch (eClass)
+ {
+ case uno::TypeClass_VOID:
+ {
+ /*
+ * This assertion pops up when exporting values which are set to:
+ * PropertyAttribute::MAYBEVOID, and thus are _supposed_ to have
+ * a VOID value...so I'm removing it ...mtg
+ * DBG_ERROR("no type");
+ */
+ }
+ break;
+ case uno::TypeClass_BOOLEAN:
+ {
+ exportBool(::cppu::any2bool(aAny), rName);
+ }
+ break;
+ case uno::TypeClass_BYTE:
+ {
+ sal_Int8 nInt8 = 0;
+ aAny >>= nInt8;
+ exportByte(nInt8, rName);
+ }
+ break;
+ case uno::TypeClass_SHORT:
+ {
+ sal_Int16 nInt16 = 0;
+ aAny >>= nInt16;
+ exportShort(nInt16, rName);
+ }
+ break;
+ case uno::TypeClass_LONG:
+ {
+ sal_Int32 nInt32 = 0;
+ aAny >>= nInt32;
+ exportInt(nInt32, rName);
+ }
+ break;
+ case uno::TypeClass_HYPER:
+ {
+ sal_Int64 nInt64 = 0;
+ aAny >>= nInt64;
+ exportLong(nInt64, rName);
+ }
+ break;
+ case uno::TypeClass_DOUBLE:
+ {
+ double fDouble = 0.0;
+ aAny >>= fDouble;
+ exportDouble(fDouble, rName);
+ }
+ break;
+ case uno::TypeClass_STRING:
+ {
+ rtl::OUString sString;
+ aAny >>= sString;
+ exportString(sString, rName);
+ }
+ break;
+ default:
+ {
+ uno::Type aType = aAny.getValueType();
+ if (aType.equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ) )
+ {
+ uno::Sequence< beans::PropertyValue> aProps;
+ aAny >>= aProps;
+ exportSequencePropertyValue(aProps, rName);
+ }
+ else if( aType.equals(getCppuType( (uno::Sequence<sal_Int8> *)0 ) ) )
+ {
+ uno::Sequence< sal_Int8 > aProps;
+ aAny >>= aProps;
+ exportbase64Binary(aProps, rName);
+ }
+ else if (aType.equals(getCppuType( (uno::Reference<container::XNameContainer> *)0 ) ) ||
+ aType.equals(getCppuType( (uno::Reference<container::XNameAccess> *)0 ) ))
+ {
+ uno::Reference< container::XNameAccess> aNamed;
+ aAny >>= aNamed;
+ exportNameAccess(aNamed, rName);
+ }
+ else if (aType.equals(getCppuType( (uno::Reference<container::XIndexAccess> *)0 ) ) ||
+ aType.equals(getCppuType( (uno::Reference<container::XIndexContainer> *)0 ) ) )
+ {
+ uno::Reference<container::XIndexAccess> aIndexed;
+ aAny >>= aIndexed;
+ exportIndexAccess(aIndexed, rName);
+ }
+ else if (aType.equals(getCppuType( (util::DateTime *)0 ) ) )
+ {
+ util::DateTime aDateTime;
+ aAny >>= aDateTime;
+ exportDateTime(aDateTime, rName);
+ }
+ else if( aType.equals(getCppuType( (uno::Reference<i18n::XForbiddenCharacters> *)0 ) ) )
+ {
+ exportForbiddenCharacters( aAny, rName );
+ }
+ else if( aType.equals(getCppuType( (uno::Sequence<formula::SymbolDescriptor> *)0 ) ) )
+ {
+ uno::Sequence< formula::SymbolDescriptor > aProps;
+ aAny >>= aProps;
+ exportSymbolDescriptors(aProps, rName);
+ }
+ else {
+ DBG_ERROR("this type is not implemented now");
+ }
+ }
+ break;
+ }
+}
+
+void XMLSettingsExportHelper::exportBool(const sal_Bool bValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_BOOLEAN );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUString sValue;
+ if (bValue)
+ sValue = GetXMLToken(XML_TRUE);
+ else
+ sValue = GetXMLToken(XML_FALSE);
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportByte(const sal_Int8 nValue, const rtl::OUString& rName) const
+{
+#if 0
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_BYTE );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue));
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+#else
+ (void) nValue; (void) rName;
+ OSL_ENSURE(false, "XMLSettingsExportHelper::exportByte(): #i114162#:\n"
+ "config-items of type \"byte\" are not valid ODF, "
+ "so storing them is disabled!\n"
+ "Use a different type instead (e.g. \"short\").");
+#endif
+}
+void XMLSettingsExportHelper::exportShort(const sal_Int16 nValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_SHORT );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue));
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportInt(const sal_Int32 nValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_INT );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertNumber(sBuffer, nValue);
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportLong(const sal_Int64 nValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_LONG );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUString sValue(rtl::OUString::valueOf(nValue));
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportDouble(const double fValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_DOUBLE );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertDouble(sBuffer, fValue);
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportString(const rtl::OUString& sValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_STRING );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ if (sValue.getLength())
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportDateTime(const util::DateTime& aValue, const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_DATETIME );
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertDateTime(sBuffer, aValue);
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportSequencePropertyValue(
+ const uno::Sequence<beans::PropertyValue>& aProps,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ sal_Int32 nLength(aProps.getLength());
+ if(nLength)
+ {
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_SET, sal_True );
+ for (sal_Int32 i = 0; i < nLength; i++)
+ CallTypeFunction(aProps[i].Value, aProps[i].Name);
+ m_rContext.EndElement( sal_True );
+ }
+}
+void XMLSettingsExportHelper::exportSymbolDescriptors(
+ const uno::Sequence < formula::SymbolDescriptor > &rProps,
+ const rtl::OUString rName) const
+{
+ // #110680#
+ // uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportSymbolDescriptors: got no service manager" );
+
+ if( xServiceFactory.is() )
+ {
+ uno::Reference< container::XIndexContainer > xBox(xServiceFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), uno::UNO_QUERY);
+ DBG_ASSERT( xBox.is(), "could not create service com.sun.star.document.IndexedPropertyValues" );
+ if (xBox.is() )
+ {
+ const rtl::OUString sName ( RTL_CONSTASCII_USTRINGPARAM ( "Name" ) );
+ const rtl::OUString sExportName ( RTL_CONSTASCII_USTRINGPARAM ( "ExportName" ) );
+ const rtl::OUString sSymbolSet ( RTL_CONSTASCII_USTRINGPARAM ( "SymbolSet" ) );
+ const rtl::OUString sCharacter ( RTL_CONSTASCII_USTRINGPARAM ( "Character" ) );
+ const rtl::OUString sFontName ( RTL_CONSTASCII_USTRINGPARAM ( "FontName" ) );
+ const rtl::OUString sCharSet ( RTL_CONSTASCII_USTRINGPARAM ( "CharSet" ) );
+ const rtl::OUString sFamily ( RTL_CONSTASCII_USTRINGPARAM ( "Family" ) );
+ const rtl::OUString sPitch ( RTL_CONSTASCII_USTRINGPARAM ( "Pitch" ) );
+ const rtl::OUString sWeight ( RTL_CONSTASCII_USTRINGPARAM ( "Weight" ) );
+ const rtl::OUString sItalic ( RTL_CONSTASCII_USTRINGPARAM ( "Italic" ) );
+
+ sal_Int32 nCount = rProps.getLength();
+ const formula::SymbolDescriptor *pDescriptor = rProps.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++, pDescriptor++ )
+ {
+ uno::Sequence < beans::PropertyValue > aSequence ( XML_SYMBOL_DESCRIPTOR_MAX );
+ beans::PropertyValue *pSymbol = aSequence.getArray();
+
+ pSymbol[XML_SYMBOL_DESCRIPTOR_NAME].Name = sName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_NAME].Value <<= pDescriptor->sName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_EXPORT_NAME].Name = sExportName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_EXPORT_NAME].Value<<= pDescriptor->sExportName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FONT_NAME].Name = sFontName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FONT_NAME].Value <<= pDescriptor->sFontName;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHAR_SET].Name = sCharSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHAR_SET].Value <<= pDescriptor->nCharSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FAMILY].Name = sFamily;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_FAMILY].Value <<= pDescriptor->nFamily;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_PITCH].Name = sPitch;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_PITCH].Value <<= pDescriptor->nPitch;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_WEIGHT].Name = sWeight;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_WEIGHT].Value <<= pDescriptor->nWeight;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_ITALIC].Name = sItalic;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_ITALIC].Value <<= pDescriptor->nItalic;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_SYMBOL_SET].Name = sSymbolSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_SYMBOL_SET].Value <<= pDescriptor->sSymbolSet;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHARACTER].Name = sCharacter;
+ pSymbol[XML_SYMBOL_DESCRIPTOR_CHARACTER].Value <<= pDescriptor->nCharacter;
+
+ xBox->insertByIndex(nIndex, uno::makeAny( aSequence ));
+ }
+
+ uno::Reference< container::XIndexAccess > xIA( xBox, uno::UNO_QUERY );
+ exportIndexAccess( xIA, rName );
+ }
+ }
+}
+void XMLSettingsExportHelper::exportbase64Binary(
+ const uno::Sequence<sal_Int8>& aProps,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ sal_Int32 nLength(aProps.getLength());
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_BASE64BINARY );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ if(nLength)
+ {
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::encodeBase64(sBuffer, aProps);
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ }
+ m_rContext.EndElement( sal_False );
+}
+
+void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny,
+ const rtl::OUString& rName,
+ const sal_Bool bNameAccess) const
+{
+ DBG_ASSERT((bNameAccess && rName.getLength()) || !bNameAccess, "no name");
+ uno::Sequence<beans::PropertyValue> aProps;
+ rAny >>= aProps;
+ sal_Int32 nLength = aProps.getLength();
+ if (nLength)
+ {
+ if (bNameAccess)
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_MAP_ENTRY, sal_True );
+ for (sal_Int32 i = 0; i < nLength; i++)
+ CallTypeFunction(aProps[i].Value, aProps[i].Name);
+ m_rContext.EndElement( sal_True );
+ }
+}
+
+void XMLSettingsExportHelper::exportNameAccess(
+ const uno::Reference<container::XNameAccess>& aNamed,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ DBG_ASSERT(aNamed->getElementType().equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ),
+ "wrong NameAccess" );
+ if(aNamed->hasElements())
+ {
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_MAP_NAMED, sal_True );
+ uno::Sequence< rtl::OUString > aNames(aNamed->getElementNames());
+ for (sal_Int32 i = 0; i < aNames.getLength(); i++)
+ exportMapEntry(aNamed->getByName(aNames[i]), aNames[i], sal_True);
+ m_rContext.EndElement( sal_True );
+ }
+}
+
+void XMLSettingsExportHelper::exportIndexAccess(
+ const uno::Reference<container::XIndexAccess> aIndexed,
+ const rtl::OUString rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ DBG_ASSERT(aIndexed->getElementType().equals(getCppuType( (uno::Sequence<beans::PropertyValue> *)0 ) ),
+ "wrong IndexAccess" );
+ rtl::OUString sEmpty;// ( RTLCONSTASCII_USTRINGPARAM( "View" ) );
+ if(aIndexed->hasElements())
+ {
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.StartElement( XML_CONFIG_ITEM_MAP_INDEXED, sal_True );
+ sal_Int32 nCount = aIndexed->getCount();
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ exportMapEntry(aIndexed->getByIndex(i), sEmpty, sal_False);
+ }
+ m_rContext.EndElement( sal_True );
+ }
+}
+
+void XMLSettingsExportHelper::exportForbiddenCharacters(
+ const uno::Any &rAny,
+ const rtl::OUString rName) const
+{
+ uno::Reference<i18n::XForbiddenCharacters> xForbChars;
+ uno::Reference<linguistic2::XSupportedLocales> xLocales;
+
+ rAny >>= xForbChars;
+ rAny >>= xLocales;
+
+ DBG_ASSERT( xForbChars.is() && xLocales.is(),"XMLSettingsExportHelper::exportForbiddenCharacters: got illegal forbidden characters!" );
+
+ if( !xForbChars.is() || !xLocales.is() )
+ return;
+
+ // #110680#
+ // uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() );
+ DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportForbiddenCharacters: got no service manager" );
+
+ if( xServiceFactory.is() )
+ {
+ uno::Reference< container::XIndexContainer > xBox(xServiceFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.document.IndexedPropertyValues") ) ), uno::UNO_QUERY);
+ DBG_ASSERT( xBox.is(), "could not create service com.sun.star.document.IndexedPropertyValues" );
+ if (xBox.is() )
+ {
+ const uno::Sequence< lang::Locale > aLocales( xLocales->getLocales() );
+ const lang::Locale* pLocales = aLocales.getConstArray();
+
+ const sal_Int32 nCount = aLocales.getLength();
+
+ const rtl::OUString sLanguage ( RTL_CONSTASCII_USTRINGPARAM ( "Language" ) );
+ const rtl::OUString sCountry ( RTL_CONSTASCII_USTRINGPARAM ( "Country" ) );
+ const rtl::OUString sVariant ( RTL_CONSTASCII_USTRINGPARAM ( "Variant" ) );
+ const rtl::OUString sBeginLine ( RTL_CONSTASCII_USTRINGPARAM ( "BeginLine" ) );
+ const rtl::OUString sEndLine ( RTL_CONSTASCII_USTRINGPARAM ( "EndLine" ) );
+
+ sal_Int32 nPos = 0;
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++, pLocales++ )
+ {
+ if( xForbChars->hasForbiddenCharacters( *pLocales ) )
+ {
+ const i18n::ForbiddenCharacters aChars( xForbChars->getForbiddenCharacters( *pLocales ) );
+
+
+ uno::Sequence < beans::PropertyValue > aSequence ( XML_FORBIDDEN_CHARACTER_MAX );
+ beans::PropertyValue *pForChar = aSequence.getArray();
+
+ pForChar[XML_FORBIDDEN_CHARACTER_LANGUAGE].Name = sLanguage;
+ pForChar[XML_FORBIDDEN_CHARACTER_LANGUAGE].Value <<= pLocales->Language;
+ pForChar[XML_FORBIDDEN_CHARACTER_COUNTRY].Name = sCountry;
+ pForChar[XML_FORBIDDEN_CHARACTER_COUNTRY].Value <<= pLocales->Country;
+ pForChar[XML_FORBIDDEN_CHARACTER_VARIANT].Name = sVariant;
+ pForChar[XML_FORBIDDEN_CHARACTER_VARIANT].Value <<= pLocales->Variant;
+ pForChar[XML_FORBIDDEN_CHARACTER_BEGIN_LINE].Name = sBeginLine;
+ pForChar[XML_FORBIDDEN_CHARACTER_BEGIN_LINE].Value <<= aChars.beginLine;
+ pForChar[XML_FORBIDDEN_CHARACTER_END_LINE].Name = sEndLine;
+ pForChar[XML_FORBIDDEN_CHARACTER_END_LINE].Value <<= aChars.endLine;
+ xBox->insertByIndex(nPos++, uno::makeAny( aSequence ));
+ }
+ }
+
+ uno::Reference< container::XIndexAccess > xIA( xBox, uno::UNO_QUERY );
+ exportIndexAccess( xIA, rName );
+ }
+ }
+}
+
+void XMLSettingsExportHelper::exportAllSettings(
+ const uno::Sequence<beans::PropertyValue>& aProps,
+ const rtl::OUString& rName) const
+{
+ DBG_ASSERT(rName.getLength(), "no name");
+ exportSequencePropertyValue(aProps, rName);
+}
+
+
+/** For some settings we may want to change their API representation
+ * from their XML settings representation. This is your chance to do
+ * so!
+ */
+void XMLSettingsExportHelper::ManipulateSetting( uno::Any& rAny, const rtl::OUString& rName ) const
+{
+ if( rName == msPrinterIndependentLayout )
+ {
+ sal_Int16 nTmp = sal_Int16();
+ if( rAny >>= nTmp )
+ {
+ if( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
+ rAny <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("low-resolution"));
+ else if( nTmp == document::PrinterIndependentLayout::DISABLED )
+ rAny <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("disabled"));
+ else if( nTmp == document::PrinterIndependentLayout::HIGH_RESOLUTION )
+ rAny <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("high-resolution"));
+ }
+ }
+ else if( (rName == msColorTableURL) || (rName == msLineEndTableURL) || (rName == msHatchTableURL) ||
+ (rName == msDashTableURL) || (rName == msGradientTableURL) || (rName == msBitmapTableURL ) )
+ {
+ if( !mxStringSubsitution.is() )
+ {
+ if( m_rContext.GetServiceFactory().is() ) try
+ {
+ const_cast< XMLSettingsExportHelper* >(this)->mxStringSubsitution =
+ uno::Reference< util::XStringSubstitution >::query(
+ m_rContext.GetServiceFactory()->
+ createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ) );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ if( mxStringSubsitution.is() )
+ {
+ ::rtl::OUString aURL;
+ rAny >>= aURL;
+ aURL = mxStringSubsitution->reSubstituteVariables( aURL );
+ rAny <<= aURL;
+ }
+ }
+}
diff --git a/xmloff/source/core/XMLBase64Export.cxx b/xmloff/source/core/XMLBase64Export.cxx
new file mode 100644
index 000000000000..3833e9924153
--- /dev/null
+++ b/xmloff/source/core/XMLBase64Export.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlexp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "XMLBase64Export.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#define INPUT_BUFFER_SIZE 54
+#define OUTPUT_BUFFER_SIZE 72
+
+XMLBase64Export::XMLBase64Export( SvXMLExport& rExp ) :
+ rExport( rExp ){
+}
+
+sal_Bool XMLBase64Export::exportXML( const Reference < XInputStream> & rIn )
+{
+ sal_Bool bRet = sal_True;
+ try
+ {
+ Sequence < sal_Int8 > aInBuff( INPUT_BUFFER_SIZE );
+ OUStringBuffer aOutBuff( OUTPUT_BUFFER_SIZE );
+ sal_Int32 nRead;
+ do
+ {
+ nRead = rIn->readBytes( aInBuff, INPUT_BUFFER_SIZE );
+ if( nRead > 0 )
+ {
+ GetExport().GetMM100UnitConverter().encodeBase64( aOutBuff,
+ aInBuff );
+ GetExport().Characters( aOutBuff.makeStringAndClear() );
+ if( nRead == INPUT_BUFFER_SIZE )
+ GetExport().IgnorableWhitespace();
+ }
+ }
+ while( nRead == INPUT_BUFFER_SIZE );
+ }
+ catch( ... )
+ {
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLBase64Export::exportElement(
+ const Reference < XInputStream > & rIn,
+ sal_uInt16 nNamespace,
+ enum ::xmloff::token::XMLTokenEnum eName )
+{
+ SvXMLElementExport aElem( GetExport(), nNamespace, eName, sal_True,
+ sal_True );
+ return exportXML( rIn );
+}
+
+sal_Bool XMLBase64Export::exportOfficeBinaryDataElement(
+ const Reference < XInputStream > & rIn )
+{
+ return exportElement( rIn, XML_NAMESPACE_OFFICE,
+ ::xmloff::token::XML_BINARY_DATA );
+}
+
diff --git a/xmloff/source/core/XMLBase64ImportContext.cxx b/xmloff/source/core/XMLBase64ImportContext.cxx
new file mode 100644
index 000000000000..cdfa84e68ac1
--- /dev/null
+++ b/xmloff/source/core/XMLBase64ImportContext.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <xmloff/XMLBase64ImportContext.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::io;
+
+//-----------------------------------------------------------------------------
+
+TYPEINIT1( XMLBase64ImportContext, SvXMLImportContext );
+
+
+XMLBase64ImportContext::XMLBase64ImportContext(
+ SvXMLImport& rImport, USHORT nPrfx, const OUString& rLName,
+ const Reference< XAttributeList >&,
+ const Reference< XOutputStream >& rOut ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xOut( rOut )
+{
+}
+
+XMLBase64ImportContext::~XMLBase64ImportContext()
+{
+}
+
+
+void XMLBase64ImportContext::EndElement()
+{
+ xOut->closeOutput();
+}
+
+void XMLBase64ImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ OUString sTrimmedChars( rChars. trim() );
+ if( sTrimmedChars.getLength() )
+ {
+ OUString sChars;
+ if( sBase64CharsLeft )
+ {
+ sChars = sBase64CharsLeft;
+ sChars += sTrimmedChars;
+ sBase64CharsLeft = OUString();
+ }
+ else
+ {
+ sChars = sTrimmedChars;
+ }
+ Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
+ sal_Int32 nCharsDecoded =
+ GetImport().GetMM100UnitConverter().
+ decodeBase64SomeChars( aBuffer, sChars );
+ xOut->writeBytes( aBuffer );
+ if( nCharsDecoded != sChars.getLength() )
+ sBase64CharsLeft = sChars.copy( nCharsDecoded );
+ }
+}
+
diff --git a/xmloff/source/core/XMLBasicExportFilter.cxx b/xmloff/source/core/XMLBasicExportFilter.cxx
new file mode 100644
index 000000000000..6b7bbff57d6e
--- /dev/null
+++ b/xmloff/source/core/XMLBasicExportFilter.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "XMLBasicExportFilter.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+// =============================================================================
+// XMLBasicExportFilter
+// =============================================================================
+
+XMLBasicExportFilter::XMLBasicExportFilter( const Reference< xml::sax::XDocumentHandler >& rxHandler )
+ :m_xHandler( rxHandler )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XMLBasicExportFilter::~XMLBasicExportFilter()
+{
+}
+
+// -----------------------------------------------------------------------------
+// XDocumentHandler
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::startDocument()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // do nothing, filter this
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::endDocument()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // do nothing, filter this
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::startElement( const ::rtl::OUString& aName,
+ const Reference< xml::sax::XAttributeList >& xAttribs )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->startElement( aName, xAttribs );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::endElement( const ::rtl::OUString& aName )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->endElement( aName );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::characters( const ::rtl::OUString& aChars )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->characters( aChars );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->ignorableWhitespace( aWhitespaces );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::processingInstruction( const ::rtl::OUString& aTarget,
+ const ::rtl::OUString& aData )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->processingInstruction( aTarget, aData );
+}
+
+// -----------------------------------------------------------------------------
+
+void XMLBasicExportFilter::setDocumentLocator( const Reference< xml::sax::XLocator >& xLocator )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ if ( m_xHandler.is() )
+ m_xHandler->setDocumentLocator( xLocator );
+}
+
+// -----------------------------------------------------------------------------
diff --git a/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
new file mode 100644
index 000000000000..a55b6505981f
--- /dev/null
+++ b/xmloff/source/core/XMLEmbeddedObjectExportFilter.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/XMLEmbeddedObjectExportFilter.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+
+XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter() throw()
+{
+}
+
+XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter(
+ const Reference< XDocumentHandler > & rHandler ) throw() :
+ xHandler( rHandler ),
+ xExtHandler( rHandler, UNO_QUERY )
+{
+}
+
+XMLEmbeddedObjectExportFilter::~XMLEmbeddedObjectExportFilter () throw()
+{
+}
+
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::startDocument( void )
+ throw( SAXException, RuntimeException )
+{
+ // do nothing, filter this
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::endDocument( void )
+ throw( SAXException, RuntimeException)
+{
+ // do nothing, filter this
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::startElement(
+ const OUString& rName,
+ const Reference< XAttributeList >& xAttrList )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->startElement( rName, xAttrList );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::endElement( const OUString& rName )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->endElement( rName );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::characters( const OUString& rChars )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->characters( rChars );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::ignorableWhitespace(
+ const OUString& rWhitespaces )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->ignorableWhitespace( rWhitespaces );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::processingInstruction(
+ const OUString& rTarget,
+ const OUString& rData )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->processingInstruction( rTarget, rData );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::setDocumentLocator(
+ const Reference< XLocator >& rLocator )
+ throw(SAXException, RuntimeException)
+{
+ xHandler->setDocumentLocator( rLocator );
+}
+
+// XExtendedDocumentHandler
+void SAL_CALL XMLEmbeddedObjectExportFilter::startCDATA( void )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->startCDATA();
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::endCDATA( void )
+ throw(RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->endCDATA();
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::comment( const OUString& rComment )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->comment( rComment );
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::allowLineBreak( void )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->allowLineBreak();
+}
+
+void SAL_CALL XMLEmbeddedObjectExportFilter::unknown( const OUString& rString )
+ throw(SAXException, RuntimeException)
+{
+ if( xExtHandler.is() )
+ xExtHandler->unknown( rString );
+}
+
+// XInitialize
+void SAL_CALL XMLEmbeddedObjectExportFilter::initialize(
+ const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException)
+{
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ if( pAny->getValueType() ==
+ ::getCppuType((const Reference< XDocumentHandler >*)0))
+ {
+ *pAny >>= xHandler;
+ *pAny >>= xExtHandler;
+ }
+ }
+}
+
+// XServiceInfo
+OUString SAL_CALL XMLEmbeddedObjectExportFilter::getImplementationName()
+ throw(RuntimeException)
+{
+ OUString aStr;
+ return aStr;
+}
+
+sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& )
+ throw(RuntimeException)
+{
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL XMLEmbeddedObjectExportFilter::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence< OUString > aSeq;
+ return aSeq;
+}
diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
new file mode 100644
index 000000000000..e7b3a8b48d19
--- /dev/null
+++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XModifiable2.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+
+// #110680#
+//#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+//#include <comphelper/processfactory.hxx>
+//#endif
+#include <tools/globname.hxx>
+#include <sot/clsids.hxx>
+#include <tools/globname.hxx>
+#include <sot/clsids.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <xmloff/attrlist.hxx>
+#include "xmloff/XMLFilterServiceNames.h"
+#include "XMLEmbeddedObjectImportContext.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+
+struct XMLServiceMapEntry_Impl
+{
+ enum XMLTokenEnum eClass;
+ const sal_Char *sFilterService;
+ sal_Int32 nFilterServiceLen;
+};
+
+#define SERVICE_MAP_ENTRY( cls, app ) \
+ { XML_##cls, \
+ XML_IMPORT_FILTER_##app, sizeof(XML_IMPORT_FILTER_##app)-1}
+
+const XMLServiceMapEntry_Impl aServiceMap[] =
+{
+ SERVICE_MAP_ENTRY( TEXT, WRITER ),
+ SERVICE_MAP_ENTRY( ONLINE_TEXT, WRITER ),
+ SERVICE_MAP_ENTRY( SPREADSHEET, CALC ),
+ SERVICE_MAP_ENTRY( DRAWING, DRAW ),
+ SERVICE_MAP_ENTRY( GRAPHICS, DRAW ),
+ SERVICE_MAP_ENTRY( PRESENTATION, IMPRESS ),
+ SERVICE_MAP_ENTRY( CHART, CHART ),
+ { XML_TOKEN_INVALID, 0, 0 }
+};
+
+class XMLEmbeddedObjectImportContext_Impl : public SvXMLImportContext
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler > xHandler;
+
+public:
+ TYPEINFO();
+
+ XMLEmbeddedObjectImportContext_Impl( SvXMLImport& rImport, USHORT nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XDocumentHandler >& rHandler );
+
+ virtual ~XMLEmbeddedObjectImportContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+ virtual void EndElement();
+
+ virtual void Characters( const ::rtl::OUString& rChars );
+};
+
+TYPEINIT1( XMLEmbeddedObjectImportContext_Impl, SvXMLImportContext );
+
+XMLEmbeddedObjectImportContext_Impl::XMLEmbeddedObjectImportContext_Impl(
+ SvXMLImport& rImport, USHORT nPrfx,
+ const OUString& rLName,
+ const Reference< XDocumentHandler >& rHandler ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ xHandler( rHandler )
+{
+}
+
+XMLEmbeddedObjectImportContext_Impl::~XMLEmbeddedObjectImportContext_Impl()
+{
+}
+
+SvXMLImportContext *XMLEmbeddedObjectImportContext_Impl::CreateChildContext(
+ USHORT nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList >& )
+{
+ return new XMLEmbeddedObjectImportContext_Impl( GetImport(),
+ nPrefix, rLocalName,
+ xHandler );
+}
+
+void XMLEmbeddedObjectImportContext_Impl::StartElement(
+ const Reference< XAttributeList >& xAttrList )
+{
+ xHandler->startElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ),
+ xAttrList );
+}
+
+void XMLEmbeddedObjectImportContext_Impl::EndElement()
+{
+ xHandler->endElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ) );
+}
+
+void XMLEmbeddedObjectImportContext_Impl::Characters( const OUString& rChars )
+{
+ xHandler->characters( rChars );
+}
+
+//-----------------------------------------------------------------------------
+
+TYPEINIT1( XMLEmbeddedObjectImportContext, SvXMLImportContext );
+
+sal_Bool XMLEmbeddedObjectImportContext::SetComponent(
+ Reference< XComponent >& rComp )
+{
+ if( !rComp.is() || !sFilterService.getLength() )
+ return sal_False;
+
+
+ Sequence<Any> aArgs( 0 );
+
+ // #110680#
+ // Reference< XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > xServiceFactory = GetImport().getServiceFactory();
+
+ xHandler = Reference < XDocumentHandler >(
+ xServiceFactory->createInstanceWithArguments( sFilterService, aArgs),
+ UNO_QUERY);
+
+ if( !xHandler.is() )
+ return sal_False;
+
+ try
+ {
+ Reference < XModifiable2 > xModifiable2( rComp, UNO_QUERY_THROW );
+ xModifiable2->disableSetModified();
+ }
+ catch( Exception& )
+ {
+ }
+
+ Reference < XImporter > xImporter( xHandler, UNO_QUERY );
+ xImporter->setTargetDocument( rComp );
+
+ xComp = rComp; // keep ref to component only if there is a handler
+
+ return sal_True;
+}
+
+XMLEmbeddedObjectImportContext::XMLEmbeddedObjectImportContext(
+ SvXMLImport& rImport, USHORT nPrfx, const OUString& rLName,
+ const Reference< XAttributeList >& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ SvGlobalName aName;
+
+ if( nPrfx == XML_NAMESPACE_MATH &&
+ IsXMLToken( rLName, XML_MATH ) )
+ {
+ sFilterService = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_IMPORT_FILTER_MATH) );
+ aName = SvGlobalName(SO3_SM_CLASSID);
+ }
+ else if( nPrfx == XML_NAMESPACE_OFFICE &&
+ IsXMLToken( rLName, XML_DOCUMENT ) )
+ {
+ OUString sMime;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ if( nPrefix == XML_NAMESPACE_OFFICE &&
+ IsXMLToken( aLocalName, XML_MIMETYPE ) )
+ {
+ sMime = xAttrList->getValueByIndex( i );
+ break;
+ }
+ }
+
+ OUString sClass;
+ static const char * aTmp[] =
+ {
+ "application/vnd.oasis.openoffice.",
+ "application/x-vnd.oasis.openoffice.",
+ "application/vnd.oasis.opendocument.",
+ "application/x-vnd.oasis.opendocument.",
+ NULL
+ };
+ for (int k=0; aTmp[k]; k++)
+ {
+ ::rtl::OUString sTmpString = ::rtl::OUString::createFromAscii(aTmp[k]);
+ if( sMime.matchAsciiL( aTmp[k], sTmpString.getLength() ) )
+ {
+ sClass = sMime.copy( sTmpString.getLength() );
+ break;
+ }
+ }
+
+ if( sClass.getLength() )
+ {
+ const XMLServiceMapEntry_Impl *pEntry = aServiceMap;
+ while( pEntry->eClass != XML_TOKEN_INVALID )
+ {
+ if( IsXMLToken( sClass, pEntry->eClass ) )
+ {
+ sFilterService = OUString( pEntry->sFilterService,
+ pEntry->nFilterServiceLen,
+ RTL_TEXTENCODING_ASCII_US );
+
+ switch( pEntry->eClass )
+ {
+ case XML_TEXT: aName = SvGlobalName(SO3_SW_CLASSID); break;
+ case XML_ONLINE_TEXT: aName = SvGlobalName(SO3_SWWEB_CLASSID); break;
+ case XML_SPREADSHEET: aName = SvGlobalName(SO3_SC_CLASSID); break;
+ case XML_DRAWING:
+ case XML_GRAPHICS:
+ case XML_IMAGE: aName = SvGlobalName(SO3_SDRAW_CLASSID); break;
+ case XML_PRESENTATION: aName = SvGlobalName(SO3_SIMPRESS_CLASSID); break;
+ case XML_CHART: aName = SvGlobalName(SO3_SCH_CLASSID); break;
+ default:
+ break;
+ }
+
+ break;
+ }
+ pEntry++;
+ }
+ }
+ }
+
+ sCLSID = aName.GetHexName();
+}
+
+XMLEmbeddedObjectImportContext::~XMLEmbeddedObjectImportContext()
+{
+}
+
+SvXMLImportContext *XMLEmbeddedObjectImportContext::CreateChildContext(
+ USHORT nPrefix, const OUString& rLocalName,
+ const Reference< XAttributeList >& )
+{
+ if( xHandler.is() )
+ return new XMLEmbeddedObjectImportContext_Impl( GetImport(),
+ nPrefix, rLocalName,
+ xHandler );
+ else
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+void XMLEmbeddedObjectImportContext::StartElement(
+ const Reference< XAttributeList >& rAttrList )
+{
+ if( xHandler.is() )
+ {
+ xHandler->startDocument();
+ // #i34042: copy namepspace declarations
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
+ Reference< XAttributeList > xAttrList( pAttrList );
+ const SvXMLNamespaceMap& rNamespaceMap = GetImport().GetNamespaceMap();
+ sal_uInt16 nPos = rNamespaceMap.GetFirstKey();
+ while( USHRT_MAX != nPos )
+ {
+ OUString aAttrName( rNamespaceMap.GetAttrNameByKey( nPos ) );
+ if( 0 == xAttrList->getValueByName( aAttrName ).getLength() )
+ {
+ pAttrList->AddAttribute( aAttrName,
+ rNamespaceMap.GetNameByKey( nPos ) );
+ }
+ nPos = rNamespaceMap.GetNextKey( nPos );
+ }
+ xHandler->startElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ),
+ xAttrList );
+ }
+}
+
+void XMLEmbeddedObjectImportContext::EndElement()
+{
+ if( xHandler.is() )
+ {
+ xHandler->endElement( GetImport().GetNamespaceMap().GetQNameByKey(
+ GetPrefix(), GetLocalName() ) );
+ xHandler->endDocument();
+
+
+ // storing part is commented out since it should be done through the object, not the model
+ // TODO/LATER: probably an object should be provided here an be stored here
+
+// // Save the object. That's required because the object should not be
+// // modified (it has been loaded just now). Setting it to unmodified
+// // only does not work, because it is then assumed that it has been
+// // stored.
+// Reference < XStorable > xStorable( xComp, UNO_QUERY );
+// if( xStorable.is() )
+// {
+// try
+// {
+// xStorable->store();
+// }
+// catch( ::com::sun::star::beans::PropertyVetoException& )
+// {
+// Sequence<OUString> aSeq( 0 );
+// GetImport().SetError( XMLERROR_FLAG_WARNING |
+// XMLERROR_API,
+// aSeq );
+// }
+// }
+
+ try
+ {
+ Reference < XModifiable2 > xModifiable2( xComp, UNO_QUERY_THROW );
+ xModifiable2->enableSetModified();
+ xModifiable2->setModified( sal_True ); // trigger new replacement image generation
+ }
+ catch( Exception& )
+ {
+ }
+
+
+// // reset modifies state for the object since it has been imported
+// // completly and therfor hasn't been modified.
+// Reference < XModifiable > xModifiable( xComp, UNO_QUERY );
+// if( xModifiable.is() )
+// {
+// try
+// {
+// xModifiable->setModified( sal_False );
+// }
+// catch( ::com::sun::star::beans::PropertyVetoException& e )
+// {
+// Sequence<OUString> aSeq( 0 );
+// GetImport().SetError( XMLERROR_FLAG_WARNING |
+// XMLERROR_API,
+// aSeq );
+// }
+// }
+ }
+}
+
+void XMLEmbeddedObjectImportContext::Characters( const ::rtl::OUString& rChars )
+{
+ if( xHandler.is() )
+ xHandler->characters( rChars );
+}
+
diff --git a/xmloff/source/core/attrlist.cxx b/xmloff/source/core/attrlist.cxx
new file mode 100644
index 000000000000..4bf051198c89
--- /dev/null
+++ b/xmloff/source/core/attrlist.cxx
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include <vector>
+#include <osl/mutex.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include <xmloff/attrlist.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+struct SvXMLTagAttribute_Impl
+{
+ SvXMLTagAttribute_Impl(){}
+ SvXMLTagAttribute_Impl( const OUString &rName,
+ const OUString &rValue )
+ : sName(rName),
+ sValue(rValue)
+ {
+ }
+
+ SvXMLTagAttribute_Impl( const SvXMLTagAttribute_Impl& r ) :
+ sName(r.sName),
+ sValue(r.sValue)
+ {
+ }
+
+ OUString sName;
+ OUString sValue;
+};
+
+struct SvXMLAttributeList_Impl
+{
+ SvXMLAttributeList_Impl()
+ {
+ // performance improvement during adding
+ vecAttribute.reserve(20);
+ }
+
+ SvXMLAttributeList_Impl( const SvXMLAttributeList_Impl& r ) :
+ vecAttribute( r.vecAttribute )
+ {
+ }
+
+ ::std::vector<struct SvXMLTagAttribute_Impl> vecAttribute;
+ typedef ::std::vector<struct SvXMLTagAttribute_Impl>::size_type size_type;
+};
+
+
+
+sal_Int16 SAL_CALL SvXMLAttributeList::getLength(void) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return sal::static_int_cast< sal_Int16 >(m_pImpl->vecAttribute.size());
+}
+
+
+SvXMLAttributeList::SvXMLAttributeList( const SvXMLAttributeList &r ) :
+ cppu::WeakImplHelper3<com::sun::star::xml::sax::XAttributeList, com::sun::star::util::XCloneable, com::sun::star::lang::XUnoTunnel>(r),
+ m_pImpl( new SvXMLAttributeList_Impl( *r.m_pImpl ) )
+{
+}
+
+SvXMLAttributeList::SvXMLAttributeList( const uno::Reference<
+ xml::sax::XAttributeList> & rAttrList )
+ : sType( GetXMLToken(XML_CDATA) )
+{
+ m_pImpl = new SvXMLAttributeList_Impl;
+
+ SvXMLAttributeList* pImpl =
+ SvXMLAttributeList::getImplementation( rAttrList );
+
+ if( pImpl )
+ *m_pImpl = *(pImpl->m_pImpl);
+ else
+ AppendAttributeList( rAttrList );
+}
+
+OUString SAL_CALL SvXMLAttributeList::getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return ( static_cast< SvXMLAttributeList_Impl::size_type >( i ) < m_pImpl->vecAttribute.size() ) ? m_pImpl->vecAttribute[i].sName : OUString();
+}
+
+
+OUString SAL_CALL SvXMLAttributeList::getTypeByIndex(sal_Int16) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return sType;
+}
+
+OUString SAL_CALL SvXMLAttributeList::getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return ( static_cast< SvXMLAttributeList_Impl::size_type >( i ) < m_pImpl->vecAttribute.size() ) ? m_pImpl->vecAttribute[i].sValue : OUString();
+}
+
+OUString SAL_CALL SvXMLAttributeList::getTypeByName( const OUString& ) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return sType;
+}
+
+OUString SAL_CALL SvXMLAttributeList::getValueByName(const OUString& sName) throw( ::com::sun::star::uno::RuntimeException )
+{
+ ::std::vector<struct SvXMLTagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) {
+ if( (*ii).sName == sName ) {
+ return (*ii).sValue;
+ }
+ }
+ return OUString();
+}
+
+
+uno::Reference< ::com::sun::star::util::XCloneable > SvXMLAttributeList::createClone() throw( ::com::sun::star::uno::RuntimeException )
+{
+ uno::Reference< ::com::sun::star::util::XCloneable > r = new SvXMLAttributeList( *this );
+ return r;
+}
+
+
+SvXMLAttributeList::SvXMLAttributeList()
+ : sType( GetXMLToken(XML_CDATA) )
+{
+ m_pImpl = new SvXMLAttributeList_Impl;
+}
+
+
+
+SvXMLAttributeList::~SvXMLAttributeList()
+{
+ delete m_pImpl;
+}
+
+
+void SvXMLAttributeList::AddAttribute( const OUString &sName ,
+ const OUString &sValue )
+{
+ m_pImpl->vecAttribute.push_back( SvXMLTagAttribute_Impl( sName , sValue ) );
+}
+
+void SvXMLAttributeList::Clear()
+{
+ m_pImpl->vecAttribute.clear();
+
+ OSL_ASSERT( ! getLength() );
+}
+
+void SvXMLAttributeList::RemoveAttribute( const OUString sName )
+{
+ ::std::vector<struct SvXMLTagAttribute_Impl>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ++ii ) {
+ if( (*ii).sName == sName ) {
+ m_pImpl->vecAttribute.erase( ii );
+ break;
+ }
+ }
+}
+
+
+void SvXMLAttributeList::SetAttributeList( const uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &r )
+{
+ Clear();
+ AppendAttributeList( r );
+}
+
+void SvXMLAttributeList::AppendAttributeList( const uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &r )
+{
+ OSL_ASSERT( r.is() );
+
+ sal_Int16 nMax = r->getLength();
+ SvXMLAttributeList_Impl::size_type nTotalSize =
+ m_pImpl->vecAttribute.size() + nMax;
+ m_pImpl->vecAttribute.reserve( nTotalSize );
+
+ for( sal_Int16 i = 0 ; i < nMax ; ++i ) {
+ m_pImpl->vecAttribute.push_back( SvXMLTagAttribute_Impl(
+ r->getNameByIndex( i ) ,
+ r->getValueByIndex( i )));
+ }
+
+ OSL_ASSERT( nTotalSize == (SvXMLAttributeList_Impl::size_type)getLength());
+}
+
+void SvXMLAttributeList::SetValueByIndex( sal_Int16 i,
+ const ::rtl::OUString& rValue )
+{
+ if( static_cast< SvXMLAttributeList_Impl::size_type >( i )
+ < m_pImpl->vecAttribute.size() )
+ {
+ m_pImpl->vecAttribute[i].sValue = rValue;
+ }
+}
+
+void SvXMLAttributeList::RemoveAttributeByIndex( sal_Int16 i )
+{
+ if( static_cast< SvXMLAttributeList_Impl::size_type >( i )
+ < m_pImpl->vecAttribute.size() )
+ m_pImpl->vecAttribute.erase( m_pImpl->vecAttribute.begin() + i );
+}
+
+void SvXMLAttributeList::RenameAttributeByIndex( sal_Int16 i,
+ const OUString& rNewName )
+{
+ if( static_cast< SvXMLAttributeList_Impl::size_type >( i )
+ < m_pImpl->vecAttribute.size() )
+ {
+ m_pImpl->vecAttribute[i].sName = rNewName;
+ }
+}
+
+sal_Int16 SvXMLAttributeList::GetIndexByName( const OUString& rName ) const
+{
+ ::std::vector<struct SvXMLTagAttribute_Impl>::iterator ii =
+ m_pImpl->vecAttribute.begin();
+
+ for( sal_Int16 nIndex=0; ii!=m_pImpl->vecAttribute.end(); ++ii, ++nIndex )
+ {
+ if( (*ii).sName == rName )
+ {
+ return nIndex;
+ }
+ }
+ return -1;
+}
+
+// XUnoTunnel & co
+const uno::Sequence< sal_Int8 > & SvXMLAttributeList::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvXMLAttributeList* SvXMLAttributeList::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvXMLAttributeList*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvXMLAttributeList::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL SvXMLAttributeList::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw( uno::RuntimeException )
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+
diff --git a/xmloff/source/core/facreg.cxx b/xmloff/source/core/facreg.cxx
new file mode 100644
index 000000000000..5dd1aac9fe12
--- /dev/null
+++ b/xmloff/source/core/facreg.cxx
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#include "sal/config.h"
+
+#include "xmloff/dllapi.h"
+
+#include <string.h>
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <osl/diagnose.h>
+#include <tools/debug.hxx>
+
+#include <cppuhelper/factory.hxx>
+#include <uno/lbnames.h>
+#include "xmloff/xmlreg.hxx"
+
+using namespace rtl;
+using namespace com::sun::star;
+
+#define SERVICE( className ) \
+extern OUString SAL_CALL className##_getImplementationName() throw(); \
+extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
+extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance( \
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) \
+ throw( uno::Exception )
+
+// impress oasis import
+SERVICE( XMLImpressImportOasis );
+SERVICE( XMLImpressStylesImportOasis );
+SERVICE( XMLImpressContentImportOasis );
+SERVICE( XMLImpressMetaImportOasis );
+SERVICE( XMLImpressSettingsImportOasis );
+
+// impress oasis export
+SERVICE( XMLImpressExportOasis );
+SERVICE( XMLImpressStylesExportOasis );
+SERVICE( XMLImpressContentExportOasis );
+SERVICE( XMLImpressMetaExportOasis );
+SERVICE( XMLImpressSettingsExportOasis );
+
+// impress OOo import
+
+// impress OOo export
+SERVICE( XMLImpressExportOOO );
+SERVICE( XMLImpressStylesExportOOO );
+SERVICE( XMLImpressContentExportOOO );
+SERVICE( XMLImpressMetaExportOOO );
+SERVICE( XMLImpressSettingsExportOOO );
+
+// draw oasis import
+SERVICE( XMLDrawImportOasis );
+SERVICE( XMLDrawStylesImportOasis );
+SERVICE( XMLDrawContentImportOasis );
+SERVICE( XMLDrawMetaImportOasis );
+SERVICE( XMLDrawSettingsImportOasis );
+
+// draw oasis export
+SERVICE( XMLDrawExportOasis );
+SERVICE( XMLDrawStylesExportOasis );
+SERVICE( XMLDrawContentExportOasis );
+SERVICE( XMLDrawMetaExportOasis );
+SERVICE( XMLDrawSettingsExportOasis );
+
+// draw OOo import
+
+// draw OOo export
+SERVICE( XMLDrawExportOOO );
+SERVICE( XMLDrawStylesExportOOO );
+SERVICE( XMLDrawContentExportOOO );
+SERVICE( XMLDrawMetaExportOOO );
+SERVICE( XMLDrawSettingsExportOOO );
+
+// impress animation import
+SERVICE( AnimationsImport );
+
+// drawing layer export
+SERVICE( XMLDrawingLayerExport );
+
+// impress xml clipboard export
+SERVICE( XMLImpressClipboardExport );
+
+// chart oasis import
+SERVICE( SchXMLImport );
+SERVICE( SchXMLImport_Meta );
+SERVICE( SchXMLImport_Styles );
+SERVICE( SchXMLImport_Content );
+
+// chart oasis export
+SERVICE( SchXMLExport_Oasis );
+SERVICE( SchXMLExport_Oasis_Meta );
+SERVICE( SchXMLExport_Oasis_Styles );
+SERVICE( SchXMLExport_Oasis_Content );
+
+// chart OOo import
+
+// chart OOo export
+SERVICE( SchXMLExport );
+SERVICE( SchXMLExport_Styles );
+SERVICE( SchXMLExport_Content );
+
+// version list import/export
+SERVICE( XMLVersionListPersistence );
+
+// meta export
+SERVICE( XMLMetaExportComponent );
+
+// meta import
+SERVICE( XMLMetaImportComponent );
+
+// meta export OOo
+SERVICE( XMLMetaExportOOO );
+
+// writer autotext event export
+SERVICE( XMLAutoTextEventExport );
+
+// writer autotext event import
+SERVICE( XMLAutoTextEventImport );
+
+// writer autotext event export OOo
+SERVICE( XMLAutoTextEventExportOOO );
+
+// writer autotext event import OOo
+SERVICE( XMLAutoTextEventImportOOO );
+
+// Oasis2OOo transformer
+SERVICE( Oasis2OOoTransformer );
+
+// OOo2Oasis transformer
+SERVICE( OOo2OasisTransformer );
+
+//
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+XMLOFF_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+#define SINGLEFACTORY(classname)\
+ if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
+ {\
+ xFactory = ::cppu::createSingleFactory( xMSF,\
+ classname##_getImplementationName(),\
+ classname##_createInstance,\
+ classname##_getSupportedServiceNames() );\
+ }
+
+XMLOFF_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+{
+ void * pRet = 0;
+ if( pServiceManager )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ const sal_Int32 nImplNameLen = strlen( pImplName );
+
+ // impress oasis import
+ SINGLEFACTORY( XMLImpressImportOasis )
+ else SINGLEFACTORY( XMLImpressStylesImportOasis )
+ else SINGLEFACTORY( XMLImpressContentImportOasis )
+ else SINGLEFACTORY( XMLImpressMetaImportOasis )
+ else SINGLEFACTORY( XMLImpressSettingsImportOasis )
+
+ // impress oasis export
+ else SINGLEFACTORY( XMLImpressExportOasis )
+ else SINGLEFACTORY( XMLImpressStylesExportOasis )
+ else SINGLEFACTORY( XMLImpressContentExportOasis )
+ else SINGLEFACTORY( XMLImpressMetaExportOasis )
+ else SINGLEFACTORY( XMLImpressSettingsExportOasis )
+
+ else SINGLEFACTORY( AnimationsImport )
+
+ // impress OOo export
+ else SINGLEFACTORY( XMLImpressExportOOO )
+ else SINGLEFACTORY( XMLImpressStylesExportOOO )
+ else SINGLEFACTORY( XMLImpressContentExportOOO )
+ else SINGLEFACTORY( XMLImpressMetaExportOOO )
+ else SINGLEFACTORY( XMLImpressSettingsExportOOO )
+
+ // draw oasis import
+ else SINGLEFACTORY( XMLDrawImportOasis )
+ else SINGLEFACTORY( XMLDrawStylesImportOasis )
+ else SINGLEFACTORY( XMLDrawContentImportOasis )
+ else SINGLEFACTORY( XMLDrawMetaImportOasis )
+ else SINGLEFACTORY( XMLDrawSettingsImportOasis )
+
+ // draw oasis export
+ else SINGLEFACTORY( XMLDrawExportOasis )
+ else SINGLEFACTORY( XMLDrawStylesExportOasis )
+ else SINGLEFACTORY( XMLDrawContentExportOasis )
+ else SINGLEFACTORY( XMLDrawMetaExportOasis )
+ else SINGLEFACTORY( XMLDrawSettingsExportOasis )
+
+ // draw OOo export
+ else SINGLEFACTORY( XMLDrawExportOOO )
+ else SINGLEFACTORY( XMLDrawStylesExportOOO )
+ else SINGLEFACTORY( XMLDrawContentExportOOO )
+ else SINGLEFACTORY( XMLDrawMetaExportOOO )
+ else SINGLEFACTORY( XMLDrawSettingsExportOOO )
+
+ // drawing layer export
+ else SINGLEFACTORY( XMLDrawingLayerExport )
+
+ // impress xml clipboard export
+ else SINGLEFACTORY( XMLImpressClipboardExport )
+
+ // chart oasis import
+ else SINGLEFACTORY( SchXMLImport )
+ else SINGLEFACTORY( SchXMLImport_Meta )
+ else SINGLEFACTORY( SchXMLImport_Styles )
+ else SINGLEFACTORY( SchXMLImport_Content )
+
+ // chart oasis export
+ else SINGLEFACTORY( SchXMLExport_Oasis )
+ else SINGLEFACTORY( SchXMLExport_Oasis_Meta )
+ else SINGLEFACTORY( SchXMLExport_Oasis_Styles )
+ else SINGLEFACTORY( SchXMLExport_Oasis_Content )
+
+ // chart OOo export
+ else SINGLEFACTORY( SchXMLExport )
+ else SINGLEFACTORY( SchXMLExport_Styles )
+ else SINGLEFACTORY( SchXMLExport_Content )
+
+ // meta import/export
+ else SINGLEFACTORY( XMLMetaExportComponent )
+ else SINGLEFACTORY( XMLMetaImportComponent )
+
+ else SINGLEFACTORY( XMLVersionListPersistence )
+
+ // meta import/export OOo
+ else SINGLEFACTORY( XMLMetaExportOOO )
+
+ // auto text import/export
+ else SINGLEFACTORY( XMLAutoTextEventExport )
+ else SINGLEFACTORY( XMLAutoTextEventImport )
+ else SINGLEFACTORY( XMLAutoTextEventExportOOO )
+
+ if( xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/xmloff/source/core/i18nmap.cxx b/xmloff/source/core/i18nmap.cxx
new file mode 100644
index 000000000000..b17a27e03693
--- /dev/null
+++ b/xmloff/source/core/i18nmap.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <svl/svarray.hxx>
+#include "xmloff/i18nmap.hxx"
+
+using namespace rtl;
+
+class SvI18NMapEntry_Impl
+{
+ USHORT nKind;
+ OUString aName;
+ OUString aNewName;
+
+public:
+
+ const OUString& GetNewName() const { return aNewName; }
+
+ SvI18NMapEntry_Impl( USHORT nKnd, const OUString& rName,
+ const OUString& rNewName ) :
+ nKind( nKnd ),
+ aName( rName ),
+ aNewName( rNewName )
+ {}
+
+ SvI18NMapEntry_Impl( USHORT nKnd, const OUString& rName ) :
+ nKind( nKnd ),
+ aName( rName )
+ {}
+
+ BOOL operator==( const SvI18NMapEntry_Impl& r ) const
+ {
+ return nKind == r.nKind &&
+ aName == r.aName;
+ }
+
+ BOOL operator<( const SvI18NMapEntry_Impl& r ) const
+ {
+ return nKind < r.nKind ||
+ ( nKind == r.nKind &&
+ aName < r.aName);
+ }
+};
+
+typedef SvI18NMapEntry_Impl *SvI18NMapEntry_ImplPtr;
+SV_DECL_PTRARR_SORT_DEL( SvI18NMap_Impl, SvI18NMapEntry_ImplPtr, 20, 5 )
+SV_IMPL_OP_PTRARR_SORT( SvI18NMap_Impl, SvI18NMapEntry_ImplPtr )
+
+// ---------------------------------------------------------------------
+
+SvI18NMapEntry_Impl *SvI18NMap::_Find( USHORT nKind,
+ const OUString& rName ) const
+{
+ SvI18NMapEntry_Impl *pRet = 0;
+ SvI18NMapEntry_Impl aTst( nKind, rName );
+
+ USHORT nPos;
+ if( pImpl->Seek_Entry( &aTst, &nPos ) )
+ {
+ pRet = (*pImpl)[nPos];
+ }
+
+ return pRet;
+}
+
+SvI18NMap::SvI18NMap() :
+ pImpl( 0 )
+{
+ pImpl = new SvI18NMap_Impl;
+}
+
+SvI18NMap::~SvI18NMap()
+{
+ delete pImpl;
+}
+
+void SvI18NMap::Add( USHORT nKind, const OUString& rName,
+ const OUString& rNewName )
+{
+ SvI18NMapEntry_Impl *pEntry = _Find( nKind, rName );
+ DBG_ASSERT( !pEntry, "SvI18NMap::Add: item registered already" );
+ if( !pEntry )
+ {
+ pEntry = new SvI18NMapEntry_Impl( nKind, rName, rNewName );
+ pImpl->Insert( pEntry );
+ }
+}
+
+const OUString& SvI18NMap::Get( USHORT nKind, const OUString& rName ) const
+{
+ SvI18NMapEntry_Impl *pEntry = _Find( nKind, rName );
+ if( pEntry )
+ return pEntry->GetNewName();
+ else
+ return rName;
+}
+
+
diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
new file mode 100644
index 000000000000..22e145bc5180
--- /dev/null
+++ b/xmloff/source/core/nmspmap.cxx
@@ -0,0 +1,593 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#ifndef _XMLTOKEN_HXX
+#include <xmloff/xmltoken.hxx>
+#endif
+#include <xmloff/nmspmap.hxx>
+
+#include "xmloff/xmlnmspe.hxx"
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using namespace ::xmloff::token;
+
+/* The basic idea of this class is that we have two two ways to search our
+ * data...by prefix and by key. We use an STL hash_map for fast prefix
+ * searching and an STL map for fast key searching.
+ *
+ * The references to an 'Index' refer to an earlier implementation of the
+ * name space map and remain to support code which uses these interfaces.
+ *
+ * In this implementation, key and index should always be the same number.
+ *
+ * All references to Indices are now deprecated and the corresponding
+ * 'Key' methods should be used instead
+ *
+ * Martin 13/06/01
+ */
+
+SvXMLNamespaceMap::SvXMLNamespaceMap()
+: sXMLNS( GetXMLToken ( XML_XMLNS ) )
+{
+}
+
+SvXMLNamespaceMap::SvXMLNamespaceMap( const SvXMLNamespaceMap& rMap )
+: sXMLNS( GetXMLToken ( XML_XMLNS ) )
+{
+ aNameHash = rMap.aNameHash;
+ aNameMap = rMap.aNameMap;
+}
+
+void SvXMLNamespaceMap::operator=( const SvXMLNamespaceMap& rMap )
+{
+ aNameHash = rMap.aNameHash;
+ aNameMap = rMap.aNameMap;
+}
+
+SvXMLNamespaceMap::~SvXMLNamespaceMap()
+{
+ QNameCache::iterator aIter = aQNameCache.begin(), aEnd = aQNameCache.end();
+ while ( aIter != aEnd )
+ {
+ const OUString *pString = (*aIter).first.second;
+ aIter++;
+ delete pString;
+ }
+}
+
+int SvXMLNamespaceMap::operator ==( const SvXMLNamespaceMap& rCmp ) const
+{
+ return static_cast < int > (aNameHash == rCmp.aNameHash);
+}
+
+sal_uInt16 SvXMLNamespaceMap::_Add( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey )
+{
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // create a new unique key with UNKNOWN flag set
+ nKey = XML_NAMESPACE_UNKNOWN_FLAG;
+ do
+ {
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey );
+ if( aIter == aNameMap.end() )
+ break;
+ nKey++;
+ }
+ while ( sal_True );
+ }
+ ::vos::ORef<NameSpaceEntry> pEntry(new NameSpaceEntry);
+ pEntry->sName = rName;
+ pEntry->nKey = nKey;
+ pEntry->sPrefix = rPrefix;
+ aNameHash[ rPrefix ] = pEntry;
+ aNameMap [ nKey ] = pEntry;
+ return nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::Add( const OUString& rPrefix, const OUString& rName,
+ sal_uInt16 nKey )
+{
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ nKey = GetKeyByName( rName );
+
+ DBG_ASSERT( XML_NAMESPACE_NONE != nKey,
+ "SvXMLNamespaceMap::Add: invalid namespace key" );
+
+ if( XML_NAMESPACE_NONE == nKey )
+ return USHRT_MAX;
+
+ if ( aNameHash.find ( rPrefix ) == aNameHash.end() )
+ nKey = _Add( rPrefix, rName, nKey );
+
+ return nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::AddIfKnown( const OUString& rPrefix, const OUString& rName )
+{
+ sal_uInt16 nKey = GetKeyByName( rName );
+
+ DBG_ASSERT( XML_NAMESPACE_NONE != nKey,
+ "SvXMLNamespaceMap::AddIfKnown: invalid namespace key" );
+
+ if( XML_NAMESPACE_NONE == nKey )
+ return XML_NAMESPACE_UNKNOWN;
+
+ if( XML_NAMESPACE_UNKNOWN != nKey )
+ {
+ NameSpaceHash::const_iterator aIter = aNameHash.find( rPrefix );
+ if( aIter == aNameHash.end() || (*aIter).second->sName != rName )
+ nKey = _Add( rPrefix, rName, nKey );
+ }
+
+ return nKey;
+}
+
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByPrefix( const OUString& rPrefix ) const
+{
+ NameSpaceHash::const_iterator aIter = aNameHash.find(rPrefix);
+ return (aIter != aNameHash.end()) ? (*aIter).second->nKey : USHRT_MAX;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByName( const OUString& rName ) const
+{
+ sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN;
+ NameSpaceHash::const_iterator aIter = aNameHash.begin(), aEnd = aNameHash.end();
+ while (aIter != aEnd )
+ {
+ if ((*aIter).second->sName == rName)
+ {
+ nKey = (*aIter).second->nKey;
+ break;
+ }
+ aIter++;
+ }
+ return nKey;
+}
+
+const OUString& SvXMLNamespaceMap::GetPrefixByKey( sal_uInt16 nKey ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nKey);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sPrefix : sEmpty;
+}
+
+const OUString& SvXMLNamespaceMap::GetNameByKey( sal_uInt16 nKey ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nKey);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sName : sEmpty;
+}
+
+OUString SvXMLNamespaceMap::GetAttrNameByKey( sal_uInt16 nKey ) const
+{
+ OUStringBuffer sAttrName;
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey );
+ if (aIter != aNameMap.end())
+ {
+ sAttrName.append( sXMLNS );
+ const ::rtl::OUString & prefix( (*aIter).second->sPrefix );
+ if (prefix.getLength()) // not default namespace
+ {
+ sAttrName.append( sal_Unicode(':') );
+ sAttrName.append( prefix );
+ }
+ }
+ return sAttrName.makeStringAndClear();
+}
+
+OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey,
+ const OUString& rLocalName,
+ sal_Bool bCache) const
+{
+ // We always want to return at least the rLocalName...
+
+ switch ( nKey )
+ {
+ case XML_NAMESPACE_UNKNOWN:
+ // ...if it's a completely unknown namespace, assert and return the local name
+ DBG_ASSERT( sal_False, "SvXMLNamespaceMap::GetQNameByKey: invalid namespace key" );
+ case XML_NAMESPACE_NONE:
+ // ...if there isn't one, return the local name
+ return rLocalName;
+ case XML_NAMESPACE_XMLNS:
+ {
+ // ...if it's in the xmlns namespace, make the prefix
+ // don't bother caching this, it rarely happens
+ OUStringBuffer sQName;
+ sQName.append ( sXMLNS );
+ if (rLocalName.getLength()) // not default namespace
+ {
+ sQName.append ( sal_Unicode(':') );
+ sQName.append ( rLocalName );
+ }
+ return sQName.makeStringAndClear();;
+ }
+ case XML_NAMESPACE_XML:
+ {
+ // this namespace is reserved, and needs not to be declared
+ OUStringBuffer sQName;
+ sQName.append ( GetXMLToken(XML_XML) );
+ sQName.append ( sal_Unicode(':') );
+ sQName.append ( rLocalName );
+ return sQName.makeStringAndClear();;
+ }
+ default:
+ {
+ QNameCache::const_iterator aQCacheIter;
+ if (bCache)
+ aQCacheIter = aQNameCache.find ( QNamePair ( nKey, &rLocalName ) );
+ else
+ aQCacheIter = aQNameCache.end();
+ if ( aQCacheIter != aQNameCache.end() )
+ return (*aQCacheIter).second;
+ else
+ {
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey );
+ if ( aIter != aNameMap.end() )
+ {
+ OUStringBuffer sQName;
+ // ...if it's in our map, make the prefix
+ const OUString & prefix( (*aIter).second->sPrefix );
+ if (prefix.getLength()) // not default namespace
+ {
+ sQName.append( prefix );
+ sQName.append( sal_Unicode(':') );
+ }
+ sQName.append ( rLocalName );
+ if (bCache)
+ {
+ OUString sString(sQName.makeStringAndClear());
+ OUString *pString = new OUString ( rLocalName );
+ const_cast < QNameCache * > (&aQNameCache)->operator[] ( QNamePair ( nKey, pString ) ) = sString;
+ return sString;
+ }
+ else
+ return sQName.makeStringAndClear();
+ }
+ else
+ {
+ // ... if it isn't, this is a Bad Thing, assert and return the local name
+ DBG_ASSERT( sal_False, "SvXMLNamespaceMap::GetQNameByKey: invalid namespace key" );
+ return rLocalName;
+ }
+ }
+ }
+ }
+}
+
+sal_uInt16 SvXMLNamespaceMap::_GetKeyByAttrName(
+ const OUString& rAttrName,
+ OUString *pLocalName,
+ sal_Bool bCache) const
+{
+ return _GetKeyByAttrName( rAttrName, 0, pLocalName, 0, bCache );
+}
+
+sal_uInt16 SvXMLNamespaceMap::_GetKeyByAttrName( const OUString& rAttrName,
+ OUString *pPrefix,
+ OUString *pLocalName,
+ OUString *pNamespace,
+ sal_Bool bCache) const
+{
+ sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN;
+
+ NameSpaceHash::const_iterator it;
+ if (bCache)
+ it = aNameCache.find ( rAttrName );
+ else
+ it = aNameCache.end();
+ if ( it != aNameCache.end() )
+ {
+ const NameSpaceEntry &rEntry = (*it).second.getBody();
+ if ( pPrefix )
+ *pPrefix = rEntry.sPrefix;
+ if ( pLocalName )
+ *pLocalName = rEntry.sName;
+ nKey = rEntry.nKey;
+ if ( pNamespace )
+ {
+ NameSpaceMap::const_iterator aMapIter = aNameMap.find (nKey);
+ *pNamespace = aMapIter != aNameMap.end() ? (*aMapIter).second->sName : sEmpty;
+ }
+ }
+ else
+ {
+ vos::ORef<NameSpaceEntry> xEntry(new NameSpaceEntry());
+
+ sal_Int32 nColonPos = rAttrName.indexOf( sal_Unicode(':') );
+ if( -1L == nColonPos )
+ {
+ // case: no ':' found -> default namespace
+ xEntry->sPrefix = OUString();
+ xEntry->sName = rAttrName;
+ }
+ else
+ {
+ // normal case: ':' found -> get prefix/suffix
+ xEntry->sPrefix = rAttrName.copy( 0L, nColonPos );
+ xEntry->sName = rAttrName.copy( nColonPos + 1L );
+ }
+
+ if( pPrefix )
+ *pPrefix = xEntry->sPrefix;
+ if( pLocalName )
+ *pLocalName = xEntry->sName;
+
+ NameSpaceHash::const_iterator aIter = aNameHash.find( xEntry->sPrefix );
+ if ( aIter != aNameHash.end() )
+ {
+ // found: retrieve namespace key
+ nKey = xEntry->nKey = (*aIter).second->nKey;
+ if ( pNamespace )
+ *pNamespace = (*aIter).second->sName;
+ }
+ else if ( xEntry->sPrefix == sXMLNS )
+ // not found, but xmlns prefix: return xmlns 'namespace'
+ nKey = xEntry->nKey = XML_NAMESPACE_XMLNS;
+ else if( nColonPos == -1L )
+ // not found, and no namespace: 'namespace' none
+ nKey = xEntry->nKey = XML_NAMESPACE_NONE;
+
+ if (bCache)
+ {
+ typedef std::pair< const rtl::OUString, vos::ORef<NameSpaceEntry> > value_type;
+ (void) const_cast<NameSpaceHash*>(&aNameCache)->insert (value_type (rAttrName, xEntry));
+ }
+ }
+
+ return nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetFirstKey() const
+{
+ return aNameMap.empty() ? USHRT_MAX : (*aNameMap.begin()).second->nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetNextKey( sal_uInt16 nLastKey ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nLastKey );
+ return (++aIter == aNameMap.end()) ? USHRT_MAX : (*aIter).second->nKey;
+}
+
+
+// All methods after this are deprecated...
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByIndex( sal_uInt16 nIdx ) const
+{
+ return nIdx;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetIndexByKey( sal_uInt16 nKey ) const
+{
+ return nKey;
+}
+sal_uInt16 SvXMLNamespaceMap::GetFirstIndex() const
+{
+ return aNameMap.empty() ? USHRT_MAX : (*aNameMap.begin()).second->nKey;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetNextIndex( sal_uInt16 nOldIdx ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find ( nOldIdx );
+ return (++aIter == aNameMap.end()) ? USHRT_MAX : (*aIter).second->nKey;
+}
+
+sal_Bool SvXMLNamespaceMap::AddAtIndex( sal_uInt16 /*nIdx*/, const OUString& rPrefix,
+ const OUString& rName, sal_uInt16 nKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ nKey = GetKeyByName( rName );
+
+ DBG_ASSERT( XML_NAMESPACE_NONE != nKey,
+ "SvXMLNamespaceMap::AddAtIndex: invalid namespace key" );
+ if( XML_NAMESPACE_NONE != nKey && ! ( aNameHash.count ( rPrefix ) ) )
+ {
+ _Add( rPrefix, rName, nKey );
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+sal_Bool SvXMLNamespaceMap::AddAtIndex( sal_uInt16 nIdx, const sal_Char *pPrefix,
+ const sal_Char *pName, sal_uInt16 nKey )
+{
+ OUString sPrefix( OUString::createFromAscii(pPrefix) );
+ OUString sName( OUString::createFromAscii(pName) );
+
+ return AddAtIndex( nIdx, sPrefix, sName, nKey );
+}
+
+OUString SvXMLNamespaceMap::GetAttrNameByIndex( sal_uInt16 nIdx ) const
+{
+ return GetAttrNameByKey( nIdx );
+}
+
+OUString SvXMLNamespaceMap::GetQNameByIndex( sal_uInt16 nIdx,
+ const OUString& rLocalName ) const
+{
+ return GetQNameByKey( nIdx, rLocalName );
+}
+
+const OUString& SvXMLNamespaceMap::GetPrefixByIndex( sal_uInt16 nIdx ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nIdx);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sPrefix : sEmpty;
+}
+
+const OUString& SvXMLNamespaceMap::GetNameByIndex( sal_uInt16 nIdx ) const
+{
+ NameSpaceMap::const_iterator aIter = aNameMap.find (nIdx);
+ return (aIter != aNameMap.end()) ? (*aIter).second->sName : sEmpty;
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetIndexByPrefix( const OUString& rPrefix ) const
+{
+ NameSpaceHash::const_iterator aIter = aNameHash.find(rPrefix);
+ return (aIter != aNameHash.end()) ? (*aIter).second->nKey : USHRT_MAX;
+}
+sal_uInt16 SvXMLNamespaceMap::GetKeyByAttrName(
+ const OUString& rAttrName,
+ OUString *pLocalName,
+ sal_uInt16 /*nIdxGuess*/) const
+{
+ return _GetKeyByAttrName( rAttrName, 0, pLocalName, 0 );
+}
+
+sal_uInt16 SvXMLNamespaceMap::GetKeyByAttrName( const OUString& rAttrName,
+ OUString *pPrefix,
+ OUString *pLocalName,
+ OUString *pNamespace,
+ USHORT /*nIdxGuess*/ ) const
+{
+ return _GetKeyByAttrName ( rAttrName, pPrefix, pLocalName, pNamespace );
+}
+
+sal_Bool SvXMLNamespaceMap::NormalizeURI( ::rtl::OUString& rName )
+{
+ // try OASIS + W3 URI normalization
+ sal_Bool bSuccess = NormalizeOasisURN( rName );
+ if( ! bSuccess )
+ bSuccess = NormalizeW3URI( rName );
+ return bSuccess;
+}
+
+sal_Bool SvXMLNamespaceMap::NormalizeW3URI( ::rtl::OUString& rName )
+{
+ // check if URI matches:
+ // http://www.w3.org/[0-9]*/[:letter:]*
+ // (year)/(WG name)
+ // For the following WG/standards names:
+ // - xforms
+
+ sal_Bool bSuccess = sal_False;
+ const OUString sURIPrefix = GetXMLToken( XML_URI_W3_PREFIX );
+ if( rName.compareTo( sURIPrefix, sURIPrefix.getLength() ) == 0 )
+ {
+ const OUString sURISuffix = GetXMLToken( XML_URI_XFORMS_SUFFIX );
+ sal_Int32 nCompareFrom = rName.getLength() - sURISuffix.getLength();
+ if( rName.copy( nCompareFrom ).equals( sURISuffix ) )
+ {
+ // found W3 prefix, and xforms suffix
+ rName = GetXMLToken( XML_N_XFORMS_1_0 );
+ bSuccess = sal_True;
+ }
+ }
+ return bSuccess;
+}
+
+sal_Bool SvXMLNamespaceMap::NormalizeOasisURN( ::rtl::OUString& rName )
+{
+ // #i38644#
+ // we exported the wrong namespace for smil, so we correct this here on load
+ // for older documents
+ if( IsXMLToken( rName, ::xmloff::token::XML_N_SVG ) )
+ {
+ rName = GetXMLToken( ::xmloff::token::XML_N_SVG_COMPAT );
+ return sal_True;
+ }
+ else if( IsXMLToken( rName, ::xmloff::token::XML_N_FO ) )
+ {
+ rName = GetXMLToken( ::xmloff::token::XML_N_FO_COMPAT );
+ return sal_True;
+ }
+ else if( IsXMLToken( rName, ::xmloff::token::XML_N_SMIL ) ||
+ IsXMLToken( rName, ::xmloff::token::XML_N_SMIL_OLD ) )
+ {
+ rName = GetXMLToken( ::xmloff::token::XML_N_SMIL_COMPAT );
+ return sal_True;
+ }
+
+ //
+ // Check if URN matches
+ // :urn:oasis:names:tc:[^:]*:xmlns:[^:]*:1.[^:]*
+ // |---| |---| |-----|
+ // TC-Id Sub-Id Version
+
+ sal_Int32 nNameLen = rName.getLength();
+ // :urn:oasis:names:tc.*
+ const OUString& rOasisURN = GetXMLToken( XML_URN_OASIS_NAMES_TC );
+ if( 0 != rName.compareTo( rOasisURN, rOasisURN.getLength() ) )
+ return sal_False;
+
+ // :urn:oasis:names:tc:.*
+ sal_Int32 nPos = rOasisURN.getLength();
+ if( nPos >= nNameLen || rName[nPos] != ':' )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:.*
+ sal_Int32 nTCIdStart = nPos+1;
+ sal_Int32 nTCIdEnd = rName.indexOf( ':', nTCIdStart );
+ if( -1 == nTCIdEnd )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns.*
+ nPos = nTCIdEnd + 1;
+ OUString sTmp( rName.copy( nPos ) );
+ const OUString& rXMLNS = GetXMLToken( XML_XMLNS );
+ if( 0!= sTmp.compareTo( rXMLNS, rXMLNS.getLength() ) )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:.*
+ nPos += rXMLNS.getLength();
+ if( nPos >= nNameLen || rName[nPos] != ':' )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:[^:]*:.*
+ nPos = rName.indexOf( ':', nPos+1 );
+ if( -1 == nPos )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:[^:]*:[^:][^:][^:][^:]*
+ sal_Int32 nVersionStart = nPos+1;
+ if( nVersionStart+2 >= nNameLen ||
+ -1 != rName.indexOf( ':', nVersionStart ) )
+ return sal_False;
+
+ // :urn:oasis:names:tc:[^:]:xmlns:[^:]*:1\.[^:][^:]*
+ if( rName[nVersionStart] != '1' || rName[nVersionStart+1] != '.' )
+ return sal_False;
+
+ // replace [tcid] with current TCID and version with current version.
+ OUStringBuffer aNewName( nNameLen +20 );
+ aNewName.append( rName.copy( 0, nTCIdStart ) );
+ aNewName.append( GetXMLToken( XML_OPENDOCUMENT ) );
+ aNewName.append( rName.copy( nTCIdEnd, nVersionStart-nTCIdEnd ) );
+ aNewName.append( GetXMLToken( XML_1_0 ) );
+
+ rName = aNewName.makeStringAndClear();
+
+ return sal_True;
+}
diff --git a/xmloff/source/core/unoatrcn.cxx b/xmloff/source/core/unoatrcn.cxx
new file mode 100644
index 000000000000..9b5ca4106c46
--- /dev/null
+++ b/xmloff/source/core/unoatrcn.cxx
@@ -0,0 +1,315 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+
+#include <xmloff/xmlcnimp.hxx>
+
+#include "xmloff/unoatrcn.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+// --------------------------------------------------------------------
+// Interface implementation
+// --------------------------------------------------------------------
+
+#define IMPL ((AttrContainerImpl*)mpData)
+
+uno::Reference< uno::XInterface > SvUnoAttributeContainer_CreateInstance()
+{
+ return *(new SvUnoAttributeContainer);
+}
+
+SvUnoAttributeContainer::SvUnoAttributeContainer( SvXMLAttrContainerData* pContainer)
+: mpContainer( pContainer )
+{
+ if( mpContainer == NULL )
+ mpContainer = new SvXMLAttrContainerData;
+}
+
+SvUnoAttributeContainer::~SvUnoAttributeContainer()
+{
+ delete mpContainer;
+}
+
+// container::XElementAccess
+uno::Type SAL_CALL SvUnoAttributeContainer::getElementType(void)
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const xml::AttributeData*)0);
+}
+
+sal_Bool SAL_CALL SvUnoAttributeContainer::hasElements(void)
+ throw( uno::RuntimeException )
+{
+ return mpContainer->GetAttrCount() != 0;
+}
+
+sal_uInt16 SvUnoAttributeContainer::getIndexByName(const OUString& aName ) const
+{
+ const sal_uInt16 nAttrCount = mpContainer->GetAttrCount();
+
+ sal_Int32 nPos = aName.indexOf( sal_Unicode(':') );
+ if( nPos == -1L )
+ {
+ for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
+ {
+ if( mpContainer->GetAttrLName(nAttr) == aName &&
+ mpContainer->GetAttrPrefix(nAttr).getLength() == 0L )
+ return nAttr;
+ }
+ }
+ else
+ {
+ const OUString aPrefix( aName.copy( 0L, nPos ) );
+ const OUString aLName( aName.copy( nPos+1L ) );
+
+ for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
+ {
+ if( mpContainer->GetAttrLName(nAttr) == aLName &&
+ mpContainer->GetAttrPrefix(nAttr) == aPrefix )
+ return nAttr;
+ }
+ }
+
+ return USHRT_MAX;
+}
+
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SvUnoAttributeContainer::getUnoTunnelId() throw()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvUnoAttributeContainer* SvUnoAttributeContainer::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvUnoAttributeContainer*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvUnoAttributeContainer::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+sal_Int64 SAL_CALL SvUnoAttributeContainer::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+// container::XNameAccess
+uno::Any SAL_CALL SvUnoAttributeContainer::getByName(const OUString& aName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ sal_uInt16 nAttr = getIndexByName(aName );
+
+ if( nAttr == USHRT_MAX )
+ throw container::NoSuchElementException();
+
+ xml::AttributeData aData;
+ aData.Namespace = mpContainer->GetAttrNamespace(nAttr);
+ aData.Type = OUString::createFromAscii("CDATA");
+ aData.Value = mpContainer->GetAttrValue(nAttr);
+
+ uno::Any aAny;
+ aAny <<= aData;
+ return aAny;
+}
+
+uno::Sequence< OUString > SAL_CALL SvUnoAttributeContainer::getElementNames(void) throw( uno::RuntimeException )
+{
+ const sal_uInt16 nAttrCount = mpContainer->GetAttrCount();
+
+ uno::Sequence< OUString > aElementNames( (sal_Int32)nAttrCount );
+ OUString *pNames = aElementNames.getArray();
+
+ for( sal_uInt16 nAttr = 0; nAttr < nAttrCount; nAttr++ )
+ {
+ OUStringBuffer sBuffer( mpContainer->GetAttrPrefix(nAttr) );
+ if( sBuffer.getLength() != 0L )
+ sBuffer.append( (sal_Unicode)':' );
+ sBuffer.append( mpContainer->GetAttrLName(nAttr) );
+ *pNames++ = sBuffer.makeStringAndClear();
+ }
+
+ return aElementNames;
+}
+
+sal_Bool SAL_CALL SvUnoAttributeContainer::hasByName(const OUString& aName) throw( uno::RuntimeException )
+{
+ return getIndexByName(aName ) != USHRT_MAX;
+}
+
+// container::XNameReplace
+void SAL_CALL SvUnoAttributeContainer::replaceByName(const OUString& aName, const uno::Any& aElement)
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( aElement.hasValue() && aElement.getValueType() == ::getCppuType((const xml::AttributeData*)0) )
+ {
+ sal_uInt16 nAttr = getIndexByName(aName );
+ if( nAttr == USHRT_MAX )
+ throw container::NoSuchElementException();
+
+ xml::AttributeData* pData = (xml::AttributeData*)aElement.getValue();
+
+ sal_Int32 nPos = aName.indexOf( sal_Unicode(':') );
+ if( nPos != -1L )
+ {
+ const OUString aPrefix( aName.copy( 0L, nPos ));
+ const OUString aLName( aName.copy( nPos+1L ));
+
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->SetAt( nAttr, aPrefix, aLName, pData->Value ) )
+ return;
+ }
+ else
+ {
+ if( mpContainer->SetAt( nAttr, aPrefix, pData->Namespace, aLName, pData->Value ) )
+ return;
+ }
+ }
+ else
+ {
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->SetAt( nAttr, aName, pData->Value ) )
+ return;
+ }
+ }
+ }
+
+ throw lang::IllegalArgumentException();
+}
+
+// container::XNameContainer
+void SAL_CALL SvUnoAttributeContainer::insertByName(const OUString& aName, const uno::Any& aElement)
+throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( !aElement.hasValue() || aElement.getValueType() != ::getCppuType((const xml::AttributeData*)0) )
+ throw lang::IllegalArgumentException();
+
+ sal_uInt16 nAttr = getIndexByName(aName );
+ if( nAttr != USHRT_MAX )
+ throw container::ElementExistException();
+
+ xml::AttributeData* pData = (xml::AttributeData*)aElement.getValue();
+
+ sal_Int32 nPos = aName.indexOf( sal_Unicode(':') );
+ if( nPos != -1L )
+ {
+ const OUString aPrefix( aName.copy( 0L, nPos ));
+ const OUString aLName( aName.copy( nPos+1L ));
+
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->AddAttr( aPrefix, aLName, pData->Value ) )
+ return;
+ }
+ else
+ {
+ if( mpContainer->AddAttr( aPrefix, pData->Namespace, aLName, pData->Value ) )
+ return;
+ }
+ }
+ else
+ {
+ if( pData->Namespace.getLength() == 0L )
+ {
+ if( mpContainer->AddAttr( aName, pData->Value ) )
+ return;
+ }
+ }
+}
+
+void SAL_CALL SvUnoAttributeContainer::removeByName(const OUString& Name)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ sal_uInt16 nAttr = getIndexByName(Name);
+ if( nAttr == USHRT_MAX )
+ throw container::NoSuchElementException();
+
+ mpContainer->Remove( nAttr );
+}
+
+//XServiceInfo
+OUString SAL_CALL SvUnoAttributeContainer::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return OUString::createFromAscii( "SvUnoAttributeContainer" );
+}
+
+uno::Sequence< OUString > SvUnoAttributeContainer::getSupportedServiceNames(void)
+ throw( uno::RuntimeException )
+{
+ OUString aSN( OUString::createFromAscii( "com.sun.star.xml.AttributeContainer" ) );
+ uno::Sequence< OUString > aNS( &aSN, 1L );
+ return aNS;
+}
+
+sal_Bool SvUnoAttributeContainer::supportsService(const OUString& ServiceName)
+ throw( uno::RuntimeException )
+{
+ const uno::Sequence < OUString > aServiceNames( getSupportedServiceNames() );
+ const OUString* pNames = aServiceNames.getConstArray();
+ sal_Int32 nCount = aServiceNames.getLength();
+ while( nCount-- )
+ {
+ if( *pNames++ == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
new file mode 100644
index 000000000000..7026ae8cf2e9
--- /dev/null
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "unointerfacetouniqueidentifiermapper.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::XInterface;
+using ::rtl::OUString;
+
+namespace comphelper
+{
+
+UnoInterfaceToUniqueIdentifierMapper::UnoInterfaceToUniqueIdentifierMapper()
+: mnNextId( 1 )
+{
+}
+
+/** returns a unique identifier for the given uno object. IF a uno object is
+ registered more than once, the returned identifier is always the same.
+*/
+const OUString& UnoInterfaceToUniqueIdentifierMapper::registerReference( const Reference< XInterface >& rInterface )
+{
+ IdMap_t::const_iterator aIter;
+ if( findReference( rInterface, aIter ) )
+ {
+ return (*aIter).first;
+ }
+ else
+ {
+ OUString aId( RTL_CONSTASCII_USTRINGPARAM( "id" ) );
+ aId += OUString::valueOf( mnNextId++ );
+ return (*maEntries.insert( IdMap_t::value_type( aId, rInterface ) ).first).first;
+ }
+}
+
+/** registers the given uno object with the given identifier.
+
+ @returns
+ false, if the given identifier already exists and is not associated with the given interface
+*/
+bool UnoInterfaceToUniqueIdentifierMapper::registerReference( const OUString& rIdentifier, const Reference< XInterface >& rInterface )
+{
+ IdMap_t::const_iterator aIter;
+ if( findReference( rInterface, aIter ) )
+ {
+ return rIdentifier != (*aIter).first;
+ }
+ else if( findIdentifier( rIdentifier, aIter ) )
+ {
+ return false;
+ }
+ else
+ {
+ maEntries.insert( IdMap_t::value_type( rIdentifier, rInterface ) );
+
+ // see if this is a reference like something we would generate in the future
+ const sal_Unicode *p = rIdentifier.getStr();
+ sal_Int32 nLength = rIdentifier.getLength();
+
+ // see if the identifier is 'id' followed by a pure integer value
+ if( nLength < 2 || p[0] != 'i' || p[1] != 'd' )
+ return true;
+
+ nLength -= 2;
+ p += 2;
+
+ while(nLength--)
+ {
+ if( (*p < '0') || (*p > '9') )
+ return true; // a custom id, that will never conflict with genereated id's
+
+ p++;
+ }
+
+ // the identifier is a pure integer value
+ // so we make sure we will never generate
+ // an integer value like this one
+ sal_Int32 nId = rIdentifier.copy(2).toInt32();
+ if( mnNextId <= nId )
+ mnNextId = nId + 1;
+
+ return true;
+ }
+}
+
+/** @returns
+ the identifier for the given uno object. If this uno object is not already
+ registered, an empty string is returned
+*/
+const OUString& UnoInterfaceToUniqueIdentifierMapper::getIdentifier( const Reference< XInterface >& rInterface ) const
+{
+ IdMap_t::const_iterator aIter;
+ if( findReference( rInterface, aIter ) )
+ {
+ return (*aIter).first;
+ }
+ else
+ {
+ static const OUString aEmpty;
+ return aEmpty;
+ }
+}
+
+/** @returns
+ the uno object that is registered with the given identifier. If no uno object
+ is registered with the given identifier, an empty reference is returned.
+*/
+const Reference< XInterface >& UnoInterfaceToUniqueIdentifierMapper::getReference( const OUString& rIdentifier ) const
+{
+ IdMap_t::const_iterator aIter;
+ if( findIdentifier( rIdentifier, aIter ) )
+ {
+ return (*aIter).second;
+ }
+ else
+ {
+ static const Reference< XInterface > aEmpty;
+ return aEmpty;
+ }
+}
+
+bool UnoInterfaceToUniqueIdentifierMapper::findReference( const Reference< XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const
+{
+ rIter = maEntries.begin();
+ const IdMap_t::const_iterator aEnd( maEntries.end() );
+ while( rIter != aEnd )
+ {
+ if( (*rIter).second == rInterface )
+ return true;
+
+ rIter++;
+ }
+
+ return false;
+}
+
+bool UnoInterfaceToUniqueIdentifierMapper::findIdentifier( const OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const
+{
+ rIter = maEntries.find( rIdentifier );
+ return rIter != maEntries.end();
+}
+
+}
+
diff --git a/xmloff/source/core/xmlcnitm.cxx b/xmloff/source/core/xmlcnitm.cxx
new file mode 100644
index 000000000000..53ed405fa454
--- /dev/null
+++ b/xmloff/source/core/xmlcnitm.cxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <xmloff/xmlcnimp.hxx>
+#include "xmloff/unoatrcn.hxx"
+
+using namespace rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::xml;
+
+typedef ::rtl::OUString *OUStringPtr;
+SV_DECL_PTRARR_DEL( SvXMLAttrContainerData_Impl, OUStringPtr, 5, 5 )
+SV_IMPL_PTRARR( SvXMLAttrContainerData_Impl, OUStringPtr )
+
+
+SvXMLAttrContainerData::SvXMLAttrContainerData(
+ const SvXMLAttrContainerData& rImpl ) :
+ aNamespaceMap( rImpl.aNamespaceMap ),
+ pLNames( new SvXMLAttrContainerData_Impl ),
+ pValues( new SvXMLAttrContainerData_Impl )
+{
+ USHORT nCount = rImpl.pLNames->Count();
+ for( USHORT i=0; i<nCount; i++ )
+ {
+ aPrefixPoss.Insert( rImpl.aPrefixPoss[i], i );
+ pLNames->Insert( new OUString( *(*rImpl.pLNames)[i] ), i );
+ pValues->Insert( new OUString( *(*rImpl.pValues)[i] ), i );
+ }
+}
+
+SvXMLAttrContainerData::SvXMLAttrContainerData() :
+ pLNames( new SvXMLAttrContainerData_Impl ),
+ pValues( new SvXMLAttrContainerData_Impl )
+{
+}
+
+SvXMLAttrContainerData::~SvXMLAttrContainerData()
+{
+ delete pLNames;
+ delete pValues;
+}
+
+int SvXMLAttrContainerData::operator ==(
+ const SvXMLAttrContainerData& rCmp ) const
+{
+ BOOL bRet = pLNames->Count() == rCmp.pLNames->Count() &&
+ aNamespaceMap == rCmp.aNamespaceMap;
+ if( bRet )
+ {
+ USHORT nCount = pLNames->Count();
+ USHORT i;
+ for( i=0; bRet && i < nCount; i++ )
+ bRet = aPrefixPoss[i] == rCmp.aPrefixPoss[i];
+
+ if( bRet )
+ {
+ for( i=0; bRet && i < nCount; i++ )
+ bRet = *(*pLNames)[i] == *(*rCmp.pLNames)[i] &&
+ *(*pValues)[i] == *(*rCmp.pValues)[i];
+ }
+ }
+
+ return (int)bRet;
+}
+
+BOOL SvXMLAttrContainerData::AddAttr( const OUString& rLName,
+ const OUString& rValue )
+{
+ aPrefixPoss.Insert( USHRT_MAX, aPrefixPoss.Count() );
+ pLNames->Insert( new OUString(rLName), pLNames->Count() );
+ pValues->Insert( new OUString(rValue), pValues->Count() );
+
+ return TRUE;
+}
+
+BOOL SvXMLAttrContainerData::AddAttr( const OUString& rPrefix,
+ const OUString& rNamespace,
+ const OUString& rLName,
+ const OUString& rValue )
+{
+ USHORT nPos = aNamespaceMap.Add( rPrefix, rNamespace );
+ aPrefixPoss.Insert( nPos, aPrefixPoss.Count() );
+ pLNames->Insert( new OUString(rLName), pLNames->Count() );
+ pValues->Insert( new OUString(rValue), pValues->Count() );
+
+ return TRUE;
+}
+
+BOOL SvXMLAttrContainerData::AddAttr( const OUString& rPrefix,
+ const OUString& rLName,
+ const OUString& rValue )
+{
+ USHORT nPos = aNamespaceMap.GetIndexByPrefix( rPrefix );
+ if( USHRT_MAX == nPos )
+ return FALSE;
+
+ aPrefixPoss.Insert( nPos, aPrefixPoss.Count() );
+ pLNames->Insert( new OUString(rLName), pLNames->Count() );
+ pValues->Insert( new OUString(rValue), pValues->Count() );
+
+ return TRUE;
+}
+
+BOOL SvXMLAttrContainerData::SetAt( USHORT i,
+ const rtl::OUString& rLName, const rtl::OUString& rValue )
+{
+ if( i >= GetAttrCount() )
+ return FALSE;
+
+ *(*pLNames)[i] = rLName;
+ *(*pValues)[i] = rValue;
+ aPrefixPoss[i] = USHRT_MAX;
+
+ return TRUE;
+}
+
+BOOL SvXMLAttrContainerData::SetAt( USHORT i,
+ const rtl::OUString& rPrefix, const rtl::OUString& rNamespace,
+ const rtl::OUString& rLName, const rtl::OUString& rValue )
+{
+ if( i >= GetAttrCount() )
+ return FALSE;
+
+ USHORT nPos = aNamespaceMap.Add( rPrefix, rNamespace );
+ if( USHRT_MAX == nPos )
+ return FALSE;
+
+ *(*pLNames)[i] = rLName;
+ *(*pValues)[i] = rValue;
+ aPrefixPoss[i] = nPos;
+
+ return TRUE;
+}
+
+BOOL SvXMLAttrContainerData::SetAt( USHORT i,
+ const rtl::OUString& rPrefix,
+ const rtl::OUString& rLName,
+ const rtl::OUString& rValue )
+{
+ if( i >= GetAttrCount() )
+ return FALSE;
+
+ USHORT nPos = aNamespaceMap.GetIndexByPrefix( rPrefix );
+ if( USHRT_MAX == nPos )
+ return FALSE;
+
+ *(*pLNames)[i] = rLName;
+ *(*pValues)[i] = rValue;
+ aPrefixPoss[i] = nPos;
+
+ return TRUE;
+}
+
+void SvXMLAttrContainerData::Remove( USHORT i )
+{
+ if( i < GetAttrCount() )
+ {
+ delete (*pLNames)[i];
+ pLNames->Remove( i );
+ delete (*pValues)[i];
+ pValues->Remove( i );
+ aPrefixPoss.Remove( i );
+ }
+ else
+ {
+ DBG_ERROR( "illegal index" );
+ }
+}
+
+sal_uInt16 SvXMLAttrContainerData::GetAttrCount() const
+{
+ return pLNames->Count();
+}
+
+const ::rtl::OUString& SvXMLAttrContainerData::GetAttrLName(sal_uInt16 i) const
+{
+ OSL_ENSURE( i < pLNames->Count(), "SvXMLAttrContainerData::GetLName: illegal index" );
+ return *(*pLNames)[i];
+}
+
+const ::rtl::OUString& SvXMLAttrContainerData::GetAttrValue(sal_uInt16 i) const
+{
+ OSL_ENSURE( i < pValues->Count(), "SvXMLAttrContainerData::GetValue: illegal index" );
+ return *(*pValues)[i];
+}
+
diff --git a/xmloff/source/core/xmlehelp.cxx b/xmloff/source/core/xmlehelp.cxx
new file mode 100644
index 000000000000..2a2b1c2257b8
--- /dev/null
+++ b/xmloff/source/core/xmlehelp.cxx
@@ -0,0 +1,500 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <limits.h>
+#include <tools/debug.hxx>
+#include <tools/bigint.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "xmlehelp.hxx"
+
+#ifndef _XMLOFF_XMTOKEN_HXX
+#include <xmloff/xmltoken.hxx>
+#endif
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::xmloff::token;
+
+void SvXMLExportHelper::AddLength( sal_Int32 nValue, MapUnit eValueUnit,
+ OUStringBuffer& rOut,
+ MapUnit eOutUnit )
+{
+ // the sign is processed seperatly
+ if( nValue < 0 )
+ {
+ nValue = -nValue;
+ rOut.append( sal_Unicode('-') );
+ }
+
+ // The new length is (nVal * nMul)/(nDiv*nFac*10)
+ sal_Int32 nMul = 1000;
+ sal_Int32 nDiv = 1;
+ sal_Int32 nFac = 100;
+ enum XMLTokenEnum eUnit = XML_TOKEN_INVALID;
+ switch( eValueUnit )
+ {
+ case MAP_TWIP:
+ switch( eOutUnit )
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for twip values" );
+ case MAP_MM:
+ // 0.01mm = 0.57twip (exactly)
+ nMul = 25400; // 25.4 * 1000
+ nDiv = 1440; // 72 * 20;
+ nFac = 100;
+ eUnit = XML_UNIT_MM;
+ break;
+
+ case MAP_CM:
+ // 0.001cm = 0.57twip (exactly)
+ nMul = 25400; // 2.54 * 10000
+ nDiv = 1440; // 72 * 20;
+ nFac = 1000;
+ eUnit = XML_UNIT_CM;
+ break;
+
+ case MAP_POINT:
+ // 0.01pt = 0.2twip (exactly)
+ nMul = 1000;
+ nDiv = 20;
+ nFac = 100;
+ eUnit = XML_UNIT_PT;
+ break;
+
+ case MAP_INCH:
+ default:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for twip values" );
+ // 0.0001in = 0.144twip (exactly)
+ nMul = 100000;
+ nDiv = 1440; // 72 * 20;
+ nFac = 10000;
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ break;
+
+ case MAP_POINT:
+ // 1pt = 1pt (exactly)
+ DBG_ASSERT( MAP_POINT == eOutUnit,
+ "output unit not supported for pt values" );
+ nMul = 10;
+ nDiv = 1;
+ nFac = 1;
+ eUnit = XML_UNIT_PT;
+ break;
+ case MAP_10TH_MM:
+ case MAP_100TH_MM:
+ {
+ long nFac2 = (MAP_100TH_MM == eValueUnit) ? 100 : 10;
+ switch( eOutUnit )
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for 1/100mm values" );
+ case MAP_MM:
+ // 0.01mm = 1 mm/100 (exactly)
+ nMul = 10;
+ nDiv = 1;
+ nFac = nFac2;
+ eUnit = XML_UNIT_MM;
+ break;
+
+ case MAP_CM:
+ // 0.001mm = 1 mm/100 (exactly)
+ nMul = 10;
+ nDiv = 1; // 72 * 20;
+ nFac = 10*nFac2;
+ eUnit = XML_UNIT_CM;
+ break;
+
+ case MAP_POINT:
+ // 0.01pt = 0.35 mm/100 (exactly)
+ nMul = 72000;
+ nDiv = 2540;
+ nFac = nFac2;
+ eUnit = XML_UNIT_PT;
+ break;
+
+ case MAP_INCH:
+ default:
+ DBG_ASSERT( MAP_INCH == eOutUnit,
+ "output unit not supported for 1/100mm values" );
+ // 0.0001in = 0.254 mm/100 (exactly)
+ nMul = 100000;
+ nDiv = 2540;
+ nFac = 100*nFac2;
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ break;
+ }
+ default:
+ DBG_ASSERT( 0, "input unit not handled" );
+ break;
+ }
+
+
+ sal_Int32 nLongVal = 0;
+ BOOL bOutLongVal = TRUE;
+ if( nValue > SAL_MAX_INT32 / nMul )
+ {
+ // A big int is required for calculation
+ BigInt nBigVal( nValue );
+ nBigVal *= nMul;
+ nBigVal /= nDiv;
+ nBigVal += 5;
+ nBigVal /= 10;
+
+ if( nBigVal.IsLong() )
+ {
+ // To convert the value into a string a sal_Int32 is sufficient
+ nLongVal = sal_Int32( nBigVal );
+ }
+ else
+ {
+ BigInt nBigFac( nFac );
+ BigInt nBig10( 10 );
+ rOut.append( (sal_Int32)(nBigVal / nBigFac) );
+ if( !(nBigVal % nBigFac).IsZero() )
+ {
+ rOut.append( sal_Unicode('.') );
+ while( nFac > 1 && !(nBigVal % nBigFac).IsZero() )
+ {
+ nFac /= 10;
+ nBigFac = nFac;
+ rOut.append( (sal_Int32)((nBigVal / nBigFac) % nBig10 ) );
+ }
+ }
+ bOutLongVal = FALSE;
+ }
+ }
+ else
+ {
+ nLongVal = nValue * nMul;
+ nLongVal /= nDiv;
+ nLongVal += 5;
+ nLongVal /= 10;
+ }
+
+ if( bOutLongVal )
+ {
+ rOut.append( (sal_Int32)(nLongVal / nFac) );
+ if( nFac > 1 && (nLongVal % nFac) != 0 )
+ {
+ rOut.append( sal_Unicode('.') );
+ while( nFac > 1 && (nLongVal % nFac) != 0 )
+ {
+ nFac /= 10;
+ rOut.append( (sal_Int32)((nLongVal / nFac) % 10) );
+ }
+ }
+ }
+
+ if( eUnit != XML_TOKEN_INVALID )
+ rOut.append( GetXMLToken(eUnit) );
+}
+
+void SvXMLExportHelper::AddPercentage( sal_Int32 nValue, OUStringBuffer& rOut )
+{
+ rOut.append( nValue );
+ rOut.append( sal_Unicode('%' ) );
+}
+
+double SvXMLExportHelper::GetConversionFactor(::rtl::OUStringBuffer& rUnit,
+ const MapUnit eCoreUnit, const MapUnit eDestUnit)
+{
+ double fRetval(1.0);
+ rUnit.setLength(0L);
+
+ if(eCoreUnit != eDestUnit)
+ {
+ enum XMLTokenEnum eUnit = XML_TOKEN_INVALID;
+
+ switch(eCoreUnit)
+ {
+ case MAP_TWIP:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for twip values");
+ }
+ case MAP_MM:
+ {
+ // 0.01mm = 0.57twip (exactly)
+ fRetval = ((25400.0 / 1440.0) / 1000.0);
+ eUnit = XML_UNIT_MM;
+ break;
+ }
+ case MAP_CM:
+ {
+ // 0.001cm = 0.57twip (exactly)
+ fRetval = ((25400.0 / 1440.0) / 10000.0);
+ eUnit = XML_UNIT_CM;
+ break;
+ }
+ case MAP_POINT:
+ {
+ // 0.01pt = 0.2twip (exactly)
+ fRetval = ((1000.0 / 20.0) / 1000.0);
+ eUnit = XML_UNIT_PT;
+ break;
+ }
+ case MAP_INCH:
+ default:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for twip values");
+ // 0.0001in = 0.144twip (exactly)
+ fRetval = ((100000.0 / 1440.0) / 100000.0);
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ }
+ break;
+ }
+ case MAP_POINT:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_MM:
+ // 1mm = 72 / 25.4 pt (exactly)
+ fRetval = ( 25.4 / 72.0 );
+ eUnit = XML_UNIT_MM;
+ break;
+
+ case MAP_CM:
+ // 1cm = 72 / 2.54 pt (exactly)
+ fRetval = ( 2.54 / 72.0 );
+ eUnit = XML_UNIT_CM;
+ break;
+
+ case MAP_TWIP:
+ // 1twip = 72 / 1440 pt (exactly)
+ fRetval = 20.0; // 1440.0 / 72.0
+ eUnit = XML_UNIT_PC;
+ break;
+
+ case MAP_INCH:
+ default:
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for pt values");
+ // 1in = 72 pt (exactly)
+ fRetval = ( 1.0 / 72.0 );
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ break;
+ }
+ case MAP_10TH_MM:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ }
+ case MAP_MM:
+ {
+ // 0.01mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 100.0);
+ eUnit = XML_UNIT_MM;
+ break;
+ }
+ case MAP_CM:
+ {
+ // 0.001mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 1000.0);
+ eUnit = XML_UNIT_CM;
+ break;
+ }
+ case MAP_POINT:
+ {
+ // 0.01pt = 0.35 mm/100 (exactly)
+ fRetval = ((72000.0 / 2540.0) / 100.0);
+ eUnit = XML_UNIT_PT;
+ break;
+ }
+ case MAP_INCH:
+ default:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ // 0.0001in = 0.254 mm/100 (exactly)
+ fRetval = ((100000.0 / 2540.0) / 10000.0);
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ }
+ break;
+ }
+ case MAP_100TH_MM:
+ {
+ switch(eDestUnit)
+ {
+ case MAP_100TH_MM:
+ case MAP_10TH_MM:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ }
+ case MAP_MM:
+ {
+ // 0.01mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 1000.0);
+ eUnit = XML_UNIT_MM;
+ break;
+ }
+ case MAP_CM:
+ {
+ // 0.001mm = 1 mm/100 (exactly)
+ fRetval = ((10.0 / 1.0) / 10000.0);
+ eUnit = XML_UNIT_CM;
+ break;
+ }
+ case MAP_POINT:
+ {
+ // 0.01pt = 0.35 mm/100 (exactly)
+ fRetval = ((72000.0 / 2540.0) / 1000.0);
+ eUnit = XML_UNIT_PT;
+ break;
+ }
+ case MAP_INCH:
+ default:
+ {
+ DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values");
+ // 0.0001in = 0.254 mm/100 (exactly)
+ fRetval = ((100000.0 / 2540.0) / 100000.0);
+ eUnit = XML_UNIT_INCH;
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ DBG_ERROR("xmloff::SvXMLExportHelper::GetConversionFactor(), illegal eCoreUnit value!");
+ break;
+ }
+
+ if(eUnit != XML_TOKEN_INVALID)
+ rUnit.append(GetXMLToken(eUnit));
+ }
+
+ return fRetval;
+}
+
+MapUnit SvXMLExportHelper::GetUnitFromString(const ::rtl::OUString& rString, MapUnit eDefaultUnit)
+{
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rString.getLength();
+ MapUnit eRetUnit = eDefaultUnit;
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rString[nPos] )
+ nPos++;
+
+ // skip negative
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ nPos++;
+
+ // skip number
+ while( nPos < nLen && sal_Unicode('0') <= rString[nPos] && sal_Unicode('9') >= rString[nPos] )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('.') == rString[nPos] )
+ {
+ nPos++;
+ while( nPos < nLen && sal_Unicode('0') <= rString[nPos] && sal_Unicode('9') >= rString[nPos] )
+ nPos++;
+ }
+
+ // skip white space
+ while( nPos < nLen && sal_Unicode(' ') == rString[nPos] )
+ nPos++;
+
+ if( nPos < nLen )
+ {
+ switch(rString[nPos])
+ {
+ case sal_Unicode('%') :
+ {
+ eRetUnit = MAP_RELATIVE;
+ break;
+ }
+ case sal_Unicode('c'):
+ case sal_Unicode('C'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('m')
+ || rString[nPos+1] == sal_Unicode('M')))
+ eRetUnit = MAP_CM;
+ break;
+ }
+ case sal_Unicode('e'):
+ case sal_Unicode('E'):
+ {
+ // CSS1_EMS or CSS1_EMX later
+ break;
+ }
+ case sal_Unicode('i'):
+ case sal_Unicode('I'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('n')
+ || rString[nPos+1] == sal_Unicode('n')))
+ eRetUnit = MAP_INCH;
+ break;
+ }
+ case sal_Unicode('m'):
+ case sal_Unicode('M'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('m')
+ || rString[nPos+1] == sal_Unicode('M')))
+ eRetUnit = MAP_MM;
+ break;
+ }
+ case sal_Unicode('p'):
+ case sal_Unicode('P'):
+ {
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('t')
+ || rString[nPos+1] == sal_Unicode('T')))
+ eRetUnit = MAP_POINT;
+ if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('c')
+ || rString[nPos+1] == sal_Unicode('C')))
+ eRetUnit = MAP_TWIP;
+ break;
+ }
+ }
+ }
+
+ return eRetUnit;
+}
diff --git a/xmloff/source/core/xmlenums.hxx b/xmloff/source/core/xmlenums.hxx
new file mode 100644
index 000000000000..9d08d3ba17fa
--- /dev/null
+++ b/xmloff/source/core/xmlenums.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLENUMS_HXX_
+#define _XMLENUMS_HXX_
+
+enum XMLForbiddenCharactersEnum
+{
+ XML_FORBIDDEN_CHARACTER_LANGUAGE,
+ XML_FORBIDDEN_CHARACTER_COUNTRY,
+ XML_FORBIDDEN_CHARACTER_VARIANT,
+ XML_FORBIDDEN_CHARACTER_BEGIN_LINE,
+ XML_FORBIDDEN_CHARACTER_END_LINE,
+ XML_FORBIDDEN_CHARACTER_MAX
+};
+
+enum XMLSymbolDescriptorsEnum
+{
+ XML_SYMBOL_DESCRIPTOR_NAME,
+ XML_SYMBOL_DESCRIPTOR_EXPORT_NAME,
+ XML_SYMBOL_DESCRIPTOR_SYMBOL_SET,
+ XML_SYMBOL_DESCRIPTOR_CHARACTER,
+ XML_SYMBOL_DESCRIPTOR_FONT_NAME,
+ XML_SYMBOL_DESCRIPTOR_CHAR_SET,
+ XML_SYMBOL_DESCRIPTOR_FAMILY,
+ XML_SYMBOL_DESCRIPTOR_PITCH,
+ XML_SYMBOL_DESCRIPTOR_WEIGHT,
+ XML_SYMBOL_DESCRIPTOR_ITALIC,
+ XML_SYMBOL_DESCRIPTOR_MAX
+};
+#endif
diff --git a/xmloff/source/core/xmlerror.cxx b/xmloff/source/core/xmlerror.cxx
new file mode 100644
index 000000000000..7581739aae13
--- /dev/null
+++ b/xmloff/source/core/xmlerror.cxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+
+#include <rtl/ustrbuf.hxx>
+#include <tools/string.hxx>
+
+
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::xml::sax::XLocator;
+using ::com::sun::star::xml::sax::SAXParseException;
+
+
+//
+/// ErrorRecord: contains all information for one error
+//
+
+class ErrorRecord
+{
+public:
+
+ ErrorRecord( sal_Int32 nId,
+ const Sequence<OUString>& rParams,
+ const OUString& rExceptionMessage,
+ sal_Int32 nRow,
+ sal_Int32 nColumn,
+ const OUString& rPublicId,
+ const OUString& rSystemId);
+ ~ErrorRecord();
+
+ sal_Int32 nId; /// error ID
+
+ OUString sExceptionMessage;/// message of original exception (if available)
+
+ // XLocator information:
+ sal_Int32 nRow; /// row number where error occured (or -1 for unknown)
+ sal_Int32 nColumn; /// column number where error occured (or -1)
+ OUString sPublicId; /// public identifier
+ OUString sSystemId; /// public identifier
+
+ /// message Parameters
+ Sequence<OUString> aParams;
+};
+
+
+ErrorRecord::ErrorRecord( sal_Int32 nID, const Sequence<OUString>& rParams,
+ const OUString& rExceptionMessage, sal_Int32 nRowNumber, sal_Int32 nCol,
+ const OUString& rPublicId, const OUString& rSystemId) :
+ nId(nID),
+ sExceptionMessage(rExceptionMessage),
+ nRow(nRowNumber),
+ nColumn(nCol),
+ sPublicId(rPublicId),
+ sSystemId(rSystemId),
+ aParams(rParams)
+{
+}
+
+ErrorRecord::~ErrorRecord()
+{
+}
+
+
+
+
+XMLErrors::XMLErrors()
+{
+}
+
+XMLErrors::~XMLErrors()
+{
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams,
+ const OUString& rExceptionMessage,
+ sal_Int32 nRow,
+ sal_Int32 nColumn,
+ const OUString& rPublicId,
+ const OUString& rSystemId )
+{
+ aErrors.push_back( ErrorRecord( nId, rParams, rExceptionMessage,
+ nRow, nColumn, rPublicId, rSystemId ) );
+
+#ifdef DBG_UTIL
+
+ // give detailed assertion on this message
+
+ OUStringBuffer sMessage;
+
+ sMessage.appendAscii( "An error or a warning has occured during XML import/export!\n" );
+
+ // ID & flags
+ sMessage.appendAscii( "Error-Id: 0x");
+ sMessage.append( nId, 16 );
+ sMessage.appendAscii( "\n Flags: " );
+ sal_Int32 nFlags = (nId & XMLERROR_MASK_FLAG);
+ sMessage.append( nFlags >> 28, 16 );
+ if( (nFlags & XMLERROR_FLAG_WARNING) != 0 )
+ sMessage.appendAscii( " WARNING" );
+ if( (nFlags & XMLERROR_FLAG_ERROR) != 0 )
+ sMessage.appendAscii( " ERRROR" );
+ if( (nFlags & XMLERROR_FLAG_SEVERE) != 0 )
+ sMessage.appendAscii( " SEVERE" );
+ sMessage.appendAscii( "\n Class: " );
+ sal_Int32 nClass = (nId & XMLERROR_MASK_CLASS);
+ sMessage.append( nClass >> 16, 16 );
+ if( (nClass & XMLERROR_CLASS_IO) != 0 )
+ sMessage.appendAscii( " IO" );
+ if( (nClass & XMLERROR_CLASS_FORMAT) != 0 )
+ sMessage.appendAscii( " FORMAT" );
+ if( (nClass & XMLERROR_CLASS_API) != 0 )
+ sMessage.appendAscii( " API" );
+ if( (nClass & XMLERROR_CLASS_OTHER) != 0 )
+ sMessage.appendAscii( " OTHER" );
+ sMessage.appendAscii( "\n Number: " );
+ sal_Int32 nNumber = (nId & XMLERROR_MASK_NUMBER);
+ sMessage.append( nNumber, 16 );
+ sMessage.appendAscii( "\n");
+
+ // the parameters
+ sMessage.appendAscii( "Parameters:\n" );
+ sal_Int32 nLength = rParams.getLength();
+ const OUString* pParams = rParams.getConstArray();
+ for( sal_Int32 i = 0; i < nLength; i++ )
+ {
+ sMessage.appendAscii( " " );
+ sMessage.append( i );
+ sMessage.appendAscii( ": " );
+ sMessage.append( pParams[i] );
+ sMessage.appendAscii( "\n" );
+ }
+
+ // the exception message
+ sMessage.appendAscii( "Exception-Message: " );
+ sMessage.append( rExceptionMessage );
+ sMessage.appendAscii( "\n" );
+
+ // position (if given)
+ if( (nRow != -1) || (nColumn != -1) )
+ {
+ sMessage.appendAscii( "Position:\n Public Identifier: " );
+ sMessage.append( rPublicId );
+ sMessage.appendAscii( "\n System Identifier: " );
+ sMessage.append( rSystemId );
+ sMessage.appendAscii( "\n Row, Column: " );
+ sMessage.append( nRow );
+ sMessage.appendAscii( "," );
+ sMessage.append( nColumn );
+ sMessage.appendAscii( "\n" );
+ }
+
+ // convert to byte string and signal the error
+ ByteString aError( String( sMessage.makeStringAndClear() ),
+ RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams,
+ const OUString& rExceptionMessage,
+ const Reference<XLocator> & rLocator)
+{
+ if ( rLocator.is() )
+ {
+ AddRecord( nId, rParams, rExceptionMessage,
+ rLocator->getLineNumber(), rLocator->getColumnNumber(),
+ rLocator->getPublicId(), rLocator->getSystemId() );
+ }
+ else
+ {
+ OUString sEmpty;
+ AddRecord( nId, rParams, rExceptionMessage,
+ -1, -1, sEmpty, sEmpty );
+ }
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams,
+ const OUString& rExceptionMessage)
+{
+ OUString sEmpty;
+ AddRecord( nId, rParams, rExceptionMessage, -1, -1, sEmpty, sEmpty );
+}
+
+void XMLErrors::AddRecord(
+ sal_Int32 nId,
+ const Sequence<OUString> & rParams)
+{
+ OUString sEmpty;
+ AddRecord( nId, rParams, sEmpty, -1, -1, sEmpty, sEmpty );
+}
+
+void XMLErrors::ThrowErrorAsSAXException(sal_Int32 nIdMask)
+ throw( SAXParseException )
+{
+ // search first error/warning that matches the nIdMask
+ for( ErrorList::iterator aIter = aErrors.begin();
+ aIter != aErrors.end();
+ aIter++ )
+ {
+ if ( (aIter->nId & nIdMask) != 0 )
+ {
+ // we throw the error
+ ErrorRecord& rErr = aErrors[0];
+ Any aAny;
+ aAny <<= rErr.aParams;
+ throw SAXParseException(
+ rErr.sExceptionMessage, NULL, aAny,
+ rErr.sPublicId, rErr.sSystemId, rErr.nRow, rErr.nColumn );
+ }
+ }
+}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
new file mode 100644
index 000000000000..50e0447d4a9d
--- /dev/null
+++ b/xmloff/source/core/xmlexp.cxx
@@ -0,0 +1,2759 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+
+#ifdef PRECOMPILED
+#include "filt_pch.hxx"
+#endif
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <comphelper/genericpropertyset.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/document/XBinaryStreamResolver.hpp>
+#include <com/sun/star/xml/sax/SAXInvalidCharacterException.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/UriReferenceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/xmlnumfe.hxx>
+#include <xmloff/xmlmetae.hxx>
+#include <xmloff/XMLSettingsExportContext.hxx>
+#include <xmloff/families.hxx>
+#include <xmloff/XMLEventExport.hxx>
+#include "XMLStarBasicExportHandler.hxx"
+#include "XMLScriptExportHandler.hxx"
+#include <xmloff/SettingsExportHelper.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <xmloff/GradientStyle.hxx>
+#include <xmloff/HatchStyle.hxx>
+#include <xmloff/ImageStyle.hxx>
+#include <TransGradientStyle.hxx>
+#include <xmloff/MarkerStyle.hxx>
+#include <xmloff/DashStyle.hxx>
+#include <xmloff/XMLFontAutoStylePool.hxx>
+#include "XMLImageMapExport.hxx"
+#include "XMLBase64Export.hxx"
+#include "xmloff/xmlerror.hxx"
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include "xmloff/XMLFilterServiceNames.h"
+#include "xmloff/XMLEmbeddedObjectExportFilter.hxx"
+#include "XMLBasicExportFilter.hxx"
+#include <vos/mutex.hxx>
+#include <rtl/logfile.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/extract.hxx>
+#include "PropertySetMerger.hxx"
+
+#include "svl/urihelper.hxx"
+#include "xmloff/xformsexport.hxx"
+
+#include <unotools/docinfohelper.hxx>
+#include <unotools/bootstrap.hxx>
+#include <unotools/configmgr.hxx>
+#include <tools/inetdef.hxx>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <com/sun/star/rdf/XMetadatable.hpp>
+#include "RDFaExportHelper.hxx"
+
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::io;
+using namespace ::xmloff::token;
+
+sal_Char __READONLY_DATA sXML_1_1[] = "1.1";
+sal_Char __READONLY_DATA sXML_1_2[] = "1.2";
+
+const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project";
+
+const sal_Char s_grddl_xsl[] =
+ "http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl";
+
+#define LOGFILE_AUTHOR "mb93740"
+
+#define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument"
+#define XML_MODEL_SERVICE_CALC "com.sun.star.sheet.SpreadsheetDocument"
+#define XML_MODEL_SERVICE_DRAW "com.sun.star.drawing.DrawingDocument"
+#define XML_MODEL_SERVICE_IMPRESS "com.sun.star.presentation.PresentationDocument"
+#define XML_MODEL_SERVICE_MATH "com.sun.star.formula.FormulaProperties"
+#define XML_MODEL_SERVICE_CHART "com.sun.star.chart.ChartDocument"
+
+#define XML_USEPRETTYPRINTING "UsePrettyPrinting"
+
+#define C2U(cChar) OUString( RTL_CONSTASCII_USTRINGPARAM(cChar) )
+
+struct XMLServiceMapEntry_Impl
+{
+ const sal_Char *sModelService;
+ sal_Int32 nModelServiceLen;
+ const sal_Char *sFilterService;
+ sal_Int32 nFilterServiceLen;
+};
+
+#define SERVICE_MAP_ENTRY( app ) \
+ { XML_MODEL_SERVICE_##app, sizeof(XML_MODEL_SERVICE_##app)-1, \
+ XML_EXPORT_FILTER_##app, sizeof(XML_EXPORT_FILTER_##app)-1 }
+
+const XMLServiceMapEntry_Impl aServiceMap[] =
+{
+ SERVICE_MAP_ENTRY( WRITER ),
+ SERVICE_MAP_ENTRY( CALC ),
+ SERVICE_MAP_ENTRY( IMPRESS ),// Impress supports DrawingDocument, too, so
+ SERVICE_MAP_ENTRY( DRAW ), // it must appear before Draw
+ SERVICE_MAP_ENTRY( MATH ),
+ SERVICE_MAP_ENTRY( CHART ),
+ { 0, 0, 0, 0 }
+};
+
+//==============================================================================
+
+class SAL_DLLPRIVATE SettingsExportFacade : public ::xmloff::XMLSettingsExportContext
+{
+public:
+ SettingsExportFacade( SvXMLExport& i_rExport )
+ :m_rExport( i_rExport )
+ {
+ }
+
+ virtual ~SettingsExportFacade()
+ {
+ }
+
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const ::rtl::OUString& i_rValue );
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ enum ::xmloff::token::XMLTokenEnum i_eValue );
+
+ virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const sal_Bool i_bIgnoreWhitespace );
+ virtual void EndElement( const sal_Bool i_bIgnoreWhitespace );
+
+ virtual void Characters( const ::rtl::OUString& i_rCharacters );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetServiceFactory() const;
+private:
+ SvXMLExport& m_rExport;
+ ::std::stack< ::rtl::OUString > m_aElements;
+};
+
+void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue )
+{
+ m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_rValue );
+}
+
+void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue )
+{
+ m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_eValue );
+}
+
+void SettingsExportFacade::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace )
+{
+ const ::rtl::OUString sElementName( m_rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_CONFIG, GetXMLToken( i_eName ) ) );
+ m_rExport.StartElement( sElementName, i_bIgnoreWhitespace );
+ m_aElements.push( sElementName );
+}
+
+void SettingsExportFacade::EndElement( const sal_Bool i_bIgnoreWhitespace )
+{
+ const ::rtl::OUString sElementName( m_aElements.top() );
+ m_rExport.EndElement( sElementName, i_bIgnoreWhitespace );
+ m_aElements.pop();
+}
+
+void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters )
+{
+ m_rExport.GetDocHandler()->characters( i_rCharacters );
+}
+
+Reference< XMultiServiceFactory > SettingsExportFacade::GetServiceFactory() const
+{
+ return m_rExport.getServiceFactory();
+}
+
+//==============================================================================
+
+class SvXMLExportEventListener : public cppu::WeakImplHelper1<
+ com::sun::star::lang::XEventListener >
+{
+private:
+ SvXMLExport* pExport;
+
+public:
+ SvXMLExportEventListener(SvXMLExport* pExport);
+ virtual ~SvXMLExportEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) throw(::com::sun::star::uno::RuntimeException);
+};
+
+SvXMLExportEventListener::SvXMLExportEventListener(SvXMLExport* pTempExport)
+ : pExport(pTempExport)
+{
+}
+
+SvXMLExportEventListener::~SvXMLExportEventListener()
+{
+}
+
+// XEventListener
+void SAL_CALL SvXMLExportEventListener::disposing( const lang::EventObject& )
+ throw(uno::RuntimeException)
+{
+ if (pExport)
+ {
+ pExport->DisposingModel();
+ pExport = NULL;
+ }
+}
+
+//==============================================================================
+
+class SvXMLExport_Impl
+{
+public:
+ SvXMLExport_Impl();
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
+ uno::Reference< uri::XUriReferenceFactory > mxUriReferenceFactory;
+ rtl::OUString msPackageURI;
+ rtl::OUString msPackageURIScheme;
+ // --> OD 2006-09-27 #i69627#
+ sal_Bool mbOutlineStyleAsNormalListStyle;
+ // <--
+ // --> PB 2007-07-06 #i146851#
+ sal_Bool mbSaveBackwardCompatibleODF;
+ // <--
+
+ uno::Reference< embed::XStorage > mxTargetStorage;
+
+ SvtSaveOptions maSaveOptions;
+
+ /// relative path of stream in package, e.g. "someobject/content.xml"
+ ::rtl::OUString mStreamPath;
+
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
+
+ /// stack of backed up namespace maps
+ /// long: depth at which namespace map has been backed up into the stack
+ ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
+ /// counts depth (number of open elements/start tags)
+ long mDepth;
+
+ ::std::auto_ptr< ::xmloff::RDFaExportHelper> mpRDFaHelper;
+
+ // --> OD 2008-11-26 #158694#
+ sal_Bool mbExportTextNumberElement;
+ // <--
+ sal_Bool mbNullDateInitialized;
+
+ void SetSchemeOf( const ::rtl::OUString& rOrigFileName )
+ {
+ sal_Int32 nSep = rOrigFileName.indexOf(':');
+ if( nSep != -1 )
+ msPackageURIScheme = rOrigFileName.copy( 0, nSep );
+ }
+};
+
+SvXMLExport_Impl::SvXMLExport_Impl()
+ // --> OD 2006-09-27 #i69627#
+ : mbOutlineStyleAsNormalListStyle( false )
+ // <--
+ // --> PB 2007-07-06 #i146851#
+ ,mbSaveBackwardCompatibleODF( sal_True )
+ // <--
+ ,mxComponentContext( ::comphelper::getProcessComponentContext() )
+ ,mStreamName()
+ ,mNamespaceMaps()
+ ,mDepth(0)
+ ,mpRDFaHelper() // lazy
+ // --> OD 2008-11-26 #158694#
+ ,mbExportTextNumberElement( sal_False )
+ // <--
+ ,mbNullDateInitialized( sal_False )
+{
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLExport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
+ mxUriReferenceFactory = uri::UriReferenceFactory::create(
+ mxComponentContext );
+}
+
+//==============================================================================
+
+void SvXMLExport::SetDocHandler( const uno::Reference< xml::sax::XDocumentHandler > &rHandler )
+{
+ mxHandler = rHandler;
+ mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY );
+}
+
+void SvXMLExport::_InitCtor()
+{
+ // note: it is not necessary to add XML_NP_XML (it is declared implicitly)
+ if( (getExportFlags() & ~EXPORT_OASIS) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ }
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
+ }
+ if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ }
+ if( (getExportFlags() & EXPORT_SETTINGS) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
+ }
+
+ if( (getExportFlags() & (EXPORT_META|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META );
+ }
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
+ }
+
+ // namespaces for documents
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_RPT), GetXMLToken(XML_N_RPT), XML_NAMESPACE_REPORT );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_NUMBER),GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOW), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_OF), GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+
+ if (getDefaultVersion() > SvtSaveOptions::ODFVER_012)
+ {
+ mpNamespaceMap->Add(
+ GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT);
+ }
+ }
+ if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_MATH), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
+ }
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_DOM), GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
+ }
+ if( (getExportFlags() & EXPORT_CONTENT ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XFORMS_1_0), GetXMLToken(XML_N_XFORMS_1_0), XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
+ }
+ // RDFa: needed for content and header/footer styles
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_XHTML),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ }
+ // GRDDL: to convert RDFa and meta.xml to RDF
+ if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_GRDDL),
+ GetXMLToken(XML_N_GRDDL), XML_NAMESPACE_GRDDL );
+ }
+
+ mxAttrList = (xml::sax::XAttributeList*)mpAttrList;
+
+ msPicturesPath = OUString( RTL_CONSTASCII_USTRINGPARAM( "#Pictures/" ) );
+ msObjectsPath = OUString( RTL_CONSTASCII_USTRINGPARAM( "#./" ) );
+ msGraphicObjectProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ msEmbeddedObjectProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
+
+ if (mxModel.is() && !mxEventListener.is())
+ {
+ mxEventListener.set( new SvXMLExportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ // --> OD 2006-03-10 #i51726# - determine model type
+ _DetermineModelType();
+ // <--
+
+ mbEnableExperimentalOdfExport = getenv("ENABLE_EXPERIMENTAL_ODF_EXPORT") != NULL;
+
+ // --> PB 2007-07-06 #146851# - load mbSaveBackwardCompatibleODF from configuration
+
+ // cl: but only if we do export to current oasis format, old openoffice format *must* always be compatible
+ if( (getExportFlags() & EXPORT_OASIS) != 0 )
+ {
+ sal_Bool bTemp = sal_True;
+ if ( ::comphelper::ConfigurationHelper::readDirectKey(
+ getServiceFactory(),
+ C2U("org.openoffice.Office.Common/"), C2U("Save/Document"), C2U("SaveBackwardCompatibleODF"),
+ ::comphelper::ConfigurationHelper::E_READONLY ) >>= bTemp )
+ {
+ mpImpl->mbSaveBackwardCompatibleODF = bTemp;
+ }
+ }
+ // <--
+}
+
+// --> OD 2006-03-14 #i51726#
+void SvXMLExport::_DetermineModelType()
+{
+ meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;
+
+ if ( mxModel.is() )
+ {
+ meModelType = SvtModuleOptions::ClassifyFactoryByModel( mxModel );
+ }
+}
+// <--
+
+// #110680#
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ MapUnit eDfltUnit, const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags )
+: mpImpl( new SvXMLExport_Impl ),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mpAttrList( new SvXMLAttributeList ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( eClass ),
+ mnExportFlags( nExportFlags ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+// #110680#
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString &rFileName,
+ const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ MapUnit eDfltUnit )
+: mpImpl( new SvXMLExport_Impl ),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mxHandler( rHandler ),
+ mxExtHandler( rHandler, uno::UNO_QUERY ),
+ mpAttrList( new SvXMLAttributeList ),
+ msOrigFileName( rFileName ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( XML_TOKEN_INVALID ),
+ mnExportFlags( 0 ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ mpImpl->SetSchemeOf( msOrigFileName );
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+}
+
+// #110680#
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString &rFileName,
+ const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ const Reference< XModel >& rModel,
+ sal_Int16 eDfltUnit )
+: mpImpl( new SvXMLExport_Impl ),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mxModel( rModel ),
+ mxHandler( rHandler ),
+ mxExtHandler( rHandler, uno::UNO_QUERY ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mpAttrList( new SvXMLAttributeList ),
+ msOrigFileName( rFileName ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ // pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit) ) ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( XML_TOKEN_INVALID ),
+ mnExportFlags( 0 ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ mpImpl->SetSchemeOf( msOrigFileName );
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+}
+
+// #110680#
+SvXMLExport::SvXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const OUString &rFileName,
+ const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ const Reference< XModel >& rModel,
+ const Reference< document::XGraphicObjectResolver >& rEmbeddedGraphicObjects,
+ sal_Int16 eDfltUnit )
+: mpImpl( new SvXMLExport_Impl ),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mxModel( rModel ),
+ mxHandler( rHandler ),
+ mxExtHandler( rHandler, uno::UNO_QUERY ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mxGraphicResolver( rEmbeddedGraphicObjects ),
+ mpAttrList( new SvXMLAttributeList ),
+ msOrigFileName( rFileName ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ),
+ mpNumExport(0L),
+ mpProgressBarHelper( NULL ),
+ mpEventExport( NULL ),
+ mpImageMapExport( NULL ),
+ mpXMLErrors( NULL ),
+ mbExtended( sal_False ),
+ meClass( XML_TOKEN_INVALID ),
+ mnExportFlags( 0 ),
+ mnErrorFlags( ERROR_NO ),
+ msWS( GetXMLToken(XML_WS) ),
+ mbSaveLinkedSections(sal_True)
+{
+ mpImpl->SetSchemeOf( msOrigFileName );
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+}
+
+SvXMLExport::~SvXMLExport()
+{
+ delete mpXMLErrors;
+ delete mpImageMapExport;
+ delete mpEventExport;
+ delete mpNamespaceMap;
+ delete mpUnitConv;
+ if (mpProgressBarHelper || mpNumExport)
+ {
+ if (mxExportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ if (mpProgressBarHelper)
+ {
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent))
+ {
+ sal_Int32 nProgressMax(mpProgressBarHelper->GetReference());
+ sal_Int32 nProgressCurrent(mpProgressBarHelper->GetValue());
+ uno::Any aAny;
+ aAny <<= nProgressMax;
+ mxExportInfo->setPropertyValue(sProgressMax, aAny);
+ aAny <<= nProgressCurrent;
+ mxExportInfo->setPropertyValue(sProgressCurrent, aAny);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ mxExportInfo->setPropertyValue(sRepeat, cppu::bool2any(mpProgressBarHelper->GetRepeat()));
+ }
+ if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
+ {
+ OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
+ {
+ uno::Sequence<sal_Int32> aWasUsed;
+ mpNumExport->GetWasUsed(aWasUsed);
+ uno::Any aAny;
+ aAny <<= aWasUsed;
+ mxExportInfo->setPropertyValue(sWrittenNumberFormats, aAny);
+ }
+ }
+ }
+ }
+ delete mpProgressBarHelper;
+ delete mpNumExport;
+ }
+
+ xmloff::token::ResetTokens();
+
+ if (mxEventListener.is() && mxModel.is())
+ mxModel->removeEventListener(mxEventListener);
+
+ delete mpImpl;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// XExporter
+void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ mxModel = uno::Reference< frame::XModel >::query( xDoc );
+ if( !mxModel.is() )
+ throw lang::IllegalArgumentException();
+ if (mxModel.is() && ! mxEventListener.is())
+ {
+ mxEventListener.set( new SvXMLExportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ if(!mxNumberFormatsSupplier.is() )
+ {
+ mxNumberFormatsSupplier = mxNumberFormatsSupplier.query( mxModel );
+ if(mxNumberFormatsSupplier.is() && mxHandler.is())
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+ }
+ if (mxExportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM(XML_USEPRETTYPRINTING));
+ if (xPropertySetInfo->hasPropertyByName(sUsePrettyPrinting))
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sUsePrettyPrinting);
+ if (::cppu::any2bool(aAny))
+ mnExportFlags |= EXPORT_PRETTY;
+ else
+ mnExportFlags &= ~EXPORT_PRETTY;
+ }
+
+ if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
+ {
+ OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sWrittenNumberFormats);
+ uno::Sequence<sal_Int32> aWasUsed;
+ if(aAny >>= aWasUsed)
+ mpNumExport->SetWasUsed(aWasUsed);
+ }
+ }
+ }
+ }
+
+ // --> PB 2007-07-06 #i146851#
+ if ( mpImpl->mbSaveBackwardCompatibleODF )
+ mnExportFlags |= EXPORT_SAVEBACKWARDCOMPATIBLE;
+ else
+ mnExportFlags &= ~EXPORT_SAVEBACKWARDCOMPATIBLE;
+ // <--
+
+ // namespaces for user defined attributes
+ Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
+ if( xFactory.is() )
+ {
+ try
+ {
+ Reference < XInterface > xIfc =
+ xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.NamespaceMap")) );
+ if( xIfc.is() )
+ {
+ Reference< XNameAccess > xNamespaceMap( xIfc, UNO_QUERY );
+ if( xNamespaceMap.is() )
+ {
+ Sequence< OUString > aPrefixes( xNamespaceMap->getElementNames() );
+
+ OUString* pPrefix = aPrefixes.getArray();
+ const sal_Int32 nCount = aPrefixes.getLength();
+ sal_Int32 nIndex;
+ OUString aURL;
+
+ for( nIndex = 0; nIndex < nCount; ++nIndex, ++pPrefix )
+ {
+ if( xNamespaceMap->getByName( *pPrefix ) >>= aURL )
+ _GetNamespaceMap().Add( *pPrefix, aURL, XML_NAMESPACE_UNKNOWN );
+ }
+ }
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+
+ // --> OD 2006-03-10 #i51726# - determine model type
+ _DetermineModelType();
+ // <--
+}
+
+// XInitialize
+void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ // #93186# we need to queryInterface every single Any with any expected outcome. This variable hold the queryInterface results.
+
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const uno::Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ Reference<XInterface> xValue;
+ *pAny >>= xValue;
+
+ // status indicator
+ uno::Reference<task::XStatusIndicator> xTmpStatus( xValue, UNO_QUERY );
+ if ( xTmpStatus.is() )
+ mxStatusIndicator = xTmpStatus;
+
+ // graphic resolver
+ uno::Reference<document::XGraphicObjectResolver> xTmpGraphic(
+ xValue, UNO_QUERY );
+ if ( xTmpGraphic.is() )
+ mxGraphicResolver = xTmpGraphic;
+
+ // object resolver
+ uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver(
+ xValue, UNO_QUERY );
+ if ( xTmpObjectResolver.is() )
+ mxEmbeddedResolver = xTmpObjectResolver;
+
+ // document handler
+ uno::Reference<xml::sax::XDocumentHandler> xTmpDocHandler(
+ xValue, UNO_QUERY );
+ if( xTmpDocHandler.is() )
+ {
+ mxHandler = xTmpDocHandler;
+ *pAny >>= mxExtHandler;
+
+ if (mxNumberFormatsSupplier.is() && mpNumExport == NULL)
+ mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
+ }
+
+ // property set to transport data across
+ uno::Reference<beans::XPropertySet> xTmpPropertySet(
+ xValue, UNO_QUERY );
+ if( xTmpPropertySet.is() )
+ mxExportInfo = xTmpPropertySet;
+ }
+
+ if( mxExportInfo.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo =
+ mxExportInfo->getPropertySetInfo();
+ OUString sPropName(
+ RTL_CONSTASCII_USTRINGPARAM("BaseURI" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= msOrigFileName;
+ mpImpl->msPackageURI = msOrigFileName;
+ mpImpl->SetSchemeOf( msOrigFileName );
+ }
+ OUString sRelPath;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamRelPath" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= sRelPath;
+ }
+ OUString sName;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamName" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
+ aAny >>= sName;
+ }
+ if( msOrigFileName.getLength() && sName.getLength() )
+ {
+ INetURLObject aBaseURL( msOrigFileName );
+ if( sRelPath.getLength() )
+ aBaseURL.insertName( sRelPath );
+ aBaseURL.insertName( sName );
+ msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
+ }
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
+
+ // --> OD 2006-09-26 #i69627#
+ const ::rtl::OUString sOutlineStyleAsNormalListStyle(
+ RTL_CONSTASCII_USTRINGPARAM("OutlineStyleAsNormalListStyle") );
+ if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue( sOutlineStyleAsNormalListStyle );
+ aAny >>= (mpImpl->mbOutlineStyleAsNormalListStyle);
+ }
+ // <--
+
+ OUString sTargetStorage( RTL_CONSTASCII_USTRINGPARAM("TargetStorage") );
+ if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) )
+ mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage;
+
+ // --> OD 2008-11-26 #158694#
+ const ::rtl::OUString sExportTextNumberElement(
+ RTL_CONSTASCII_USTRINGPARAM("ExportTextNumberElement") );
+ if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) )
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue( sExportTextNumberElement );
+ aAny >>= (mpImpl->mbExportTextNumberElement);
+ }
+ // <--
+ }
+
+}
+
+// XFilter
+sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) throw(uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", LOGFILE_AUTHOR,
+ "SvXMLExport::filter" );
+
+ // check for xHandler first... should have been supplied in initialize
+ if( !mxHandler.is() )
+ return sal_False;
+
+ try
+ {
+ const sal_uInt32 nTest =
+ EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS;
+ if( (mnExportFlags & nTest) == nTest && !msOrigFileName.getLength() )
+ {
+ // evaluate descriptor only for flat files and if a base URI
+ // has not been provided already
+ const sal_Int32 nPropCount = aDescriptor.getLength();
+ const beans::PropertyValue* pProps = aDescriptor.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nPropCount; nIndex++, pProps++ )
+ {
+ const OUString& rPropName = pProps->Name;
+ const Any& rValue = pProps->Value;
+
+ if( rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FileName" ) ) )
+ {
+ if( !(rValue >>= msOrigFileName ) )
+ return sal_False;
+ }
+ else if (rPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
+ {
+ if( !(rValue >>= msFilterName ) )
+ return sal_False;
+ }
+ }
+ }
+
+#ifdef TIMELOG
+ if (GetModel().is())
+ {
+ // print a trace message with the URL
+ ByteString aUrl( (String) GetModel()->getURL(),
+ RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "%s", aUrl.GetBuffer() );
+
+ // we also want a trace message with the document class
+ ByteString aClass( (String)GetXMLToken(meClass),
+ RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "class=\"%s\"",
+ aClass.GetBuffer() );
+ }
+#endif
+
+ exportDoc( meClass );
+ }
+ catch( uno::Exception e )
+ {
+ // We must catch exceptions, because according to the
+ // API definition export must not throw one!
+ Sequence<OUString> aSeq(0);
+ SetError( XMLERROR_FLAG_ERROR | XMLERROR_FLAG_SEVERE | XMLERROR_API,
+ aSeq, e.Message, NULL );
+ }
+
+ // return true only if no error occured
+ return (GetErrorFlags() & (ERROR_DO_NOTHING|ERROR_ERROR_OCCURED)) == 0;
+}
+
+void SAL_CALL SvXMLExport::cancel() throw(uno::RuntimeException)
+{
+ // stop export
+ Sequence<OUString> aEmptySeq;
+ SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq);
+}
+
+::rtl::OUString SAL_CALL SvXMLExport::getName( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return msFilterName;
+}
+
+void SAL_CALL SvXMLExport::setName( const ::rtl::OUString& )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ // do nothing, because it is not possible to set the FilterName
+}
+
+
+// XServiceInfo
+OUString SAL_CALL SvXMLExport::getImplementationName( ) throw(uno::RuntimeException)
+{
+ OUString aStr;
+ return aStr;
+}
+
+sal_Bool SAL_CALL SvXMLExport::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException)
+{
+ return
+ rServiceName.equalsAsciiL(
+ "com.sun.star.document.ExportFilter",
+ sizeof("com.sun.star.document.ExportFilter")-1 ) ||
+ rServiceName.equalsAsciiL(
+ "com.sun.star.xml.XMLExportFilter",
+ sizeof("com.sun.star.xml.XMLExportFilter")-1);
+}
+
+uno::Sequence< OUString > SAL_CALL SvXMLExport::getSupportedServiceNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<OUString> aSeq(2);
+ aSeq[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportFilter"));
+ aSeq[1] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLExportFilter"));
+ return aSeq;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+::rtl::OUString
+SvXMLExport::EnsureNamespace(::rtl::OUString const & i_rNamespace,
+ ::rtl::OUString const & i_rPreferredPrefix)
+{
+ ::rtl::OUString sPrefix;
+ sal_uInt16 nKey( _GetNamespaceMap().GetKeyByName( i_rNamespace ) );
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ // There is no prefix for the namespace, so
+ // we have to generate one and have to add it.
+ sPrefix = i_rPreferredPrefix;
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ sal_Int32 n( 0 );
+ ::rtl::OUStringBuffer buf;
+ while( nKey != USHRT_MAX )
+ {
+ buf.append( i_rPreferredPrefix );
+ buf.append( ++n );
+ sPrefix = buf.makeStringAndClear();
+ nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
+ }
+
+ if (mpImpl->mNamespaceMaps.empty()
+ || (mpImpl->mNamespaceMaps.top().second != mpImpl->mDepth))
+ {
+ // top was created for lower depth... need a new namespace map!
+ mpImpl->mNamespaceMaps.push(
+ ::std::make_pair(mpNamespaceMap, mpImpl->mDepth) );
+ mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
+ }
+
+ // add the namespace to the map and as attribute
+ mpNamespaceMap->Add( sPrefix, i_rNamespace );
+ buf.append( GetXMLToken(XML_XMLNS) );
+ buf.append( sal_Unicode(':') );
+ buf.append( sPrefix );
+ AddAttribute( buf.makeStringAndClear(), i_rNamespace );
+ }
+ else
+ {
+ // If there is a prefix for the namespace, reuse that.
+ sPrefix = _GetNamespaceMap().GetPrefixByKey( nKey );
+ }
+ return sPrefix;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
+ const sal_Char *pName,
+ const sal_Char *pValue )
+{
+ OUString sName( OUString::createFromAscii( pName ) );
+ OUString sValue( OUString::createFromAscii( pValue ) );
+
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), sValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
+ const OUString& rValue )
+{
+ OUString sName( OUString::createFromAscii( pName ) );
+
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), rValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const OUString& rName,
+ const OUString& rValue )
+{
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, rName ), rValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eName,
+ const OUString& rValue )
+{
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ rValue );
+}
+
+void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eName,
+ enum XMLTokenEnum eValue)
+{
+ mpAttrList->AddAttribute(
+ _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
+ GetXMLToken(eValue) );
+}
+
+void SvXMLExport::AddAttribute( const ::rtl::OUString& rQName,
+ const ::rtl::OUString& rValue )
+{
+ mpAttrList->AddAttribute(
+ rQName,
+ rValue );
+}
+
+void SvXMLExport::AddAttribute( const ::rtl::OUString& rQName,
+ enum ::xmloff::token::XMLTokenEnum eValue )
+{
+ mpAttrList->AddAttribute(
+ rQName,
+ GetXMLToken(eValue) );
+}
+
+void SvXMLExport::AddAttributeList( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ if( xAttrList.is())
+ mpAttrList->AppendAttributeList( xAttrList );
+}
+
+void SvXMLExport::ClearAttrList()
+{
+ mpAttrList->Clear();
+}
+
+#ifdef DBG_UTIL
+void SvXMLExport::CheckAttrList()
+{
+ DBG_ASSERT( !mpAttrList->getLength(),
+ "XMLExport::CheckAttrList: list is not empty" );
+}
+#endif
+
+void SvXMLExport::ImplExportMeta()
+{
+ CheckAttrList();
+
+ _ExportMeta();
+}
+
+void SvXMLExport::ImplExportSettings()
+{
+ CheckAttrList();
+
+ ::std::list< SettingsGroup > aSettings;
+ sal_Int32 nSettingsCount = 0;
+
+ // view settings
+ uno::Sequence< beans::PropertyValue > aViewSettings;
+ GetViewSettingsAndViews( aViewSettings );
+ aSettings.push_back( SettingsGroup( XML_VIEW_SETTINGS, aViewSettings ) );
+ nSettingsCount += aViewSettings.getLength();
+
+ // configuration settings
+ uno::Sequence<beans::PropertyValue> aConfigSettings;
+ GetConfigurationSettings( aConfigSettings );
+ aSettings.push_back( SettingsGroup( XML_CONFIGURATION_SETTINGS, aConfigSettings ) );
+ nSettingsCount += aConfigSettings.getLength();
+
+ // any document specific settings
+ nSettingsCount += GetDocumentSpecificSettings( aSettings );
+
+ {
+ SvXMLElementExport aElem( *this,
+ nSettingsCount != 0,
+ XML_NAMESPACE_OFFICE, XML_SETTINGS,
+ sal_True, sal_True );
+
+ SettingsExportFacade aSettingsExportContext( *this );
+ XMLSettingsExportHelper aSettingsExportHelper( aSettingsExportContext );
+
+ for ( ::std::list< SettingsGroup >::const_iterator settings = aSettings.begin();
+ settings != aSettings.end();
+ ++settings
+ )
+ {
+ if ( !settings->aSettings.getLength() )
+ continue;
+
+ OUString sSettingsName( GetXMLToken( settings->eGroupName ) );
+ OUString sQName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sSettingsName );
+ aSettingsExportHelper.exportAllSettings( settings->aSettings, sQName );
+ }
+ }
+}
+
+void SvXMLExport::ImplExportStyles( sal_Bool )
+{
+ CheckAttrList();
+
+// AddAttribute( XML_NAMESPACE_NONE, XML_ID, XML_STYLES_ID );
+ {
+ // <style:styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_STYLES,
+ sal_True, sal_True );
+
+ _ExportStyles( sal_False );
+ }
+
+ // transfer style names (+ families) TO other components (if appropriate)
+ if( ( ( mnExportFlags & EXPORT_CONTENT ) == 0 ) && mxExportInfo.is() )
+ {
+ static OUString sStyleNames( RTL_CONSTASCII_USTRINGPARAM("StyleNames") );
+ static OUString sStyleFamilies( RTL_CONSTASCII_USTRINGPARAM("StyleFamilies") );
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if ( xPropertySetInfo->hasPropertyByName( sStyleNames ) && xPropertySetInfo->hasPropertyByName( sStyleFamilies ) )
+ {
+ Sequence<sal_Int32> aStyleFamilies;
+ Sequence<OUString> aStyleNames;
+ mxAutoStylePool->GetRegisteredNames( aStyleFamilies, aStyleNames );
+ mxExportInfo->setPropertyValue( sStyleNames, makeAny( aStyleNames ) );
+ mxExportInfo->setPropertyValue( sStyleFamilies,
+ makeAny( aStyleFamilies ) );
+ }
+ }
+}
+
+void SvXMLExport::ImplExportAutoStyles( sal_Bool )
+{
+ // transfer style names (+ families) FROM other components (if appropriate)
+ OUString sStyleNames( RTL_CONSTASCII_USTRINGPARAM("StyleNames") );
+ OUString sStyleFamilies( RTL_CONSTASCII_USTRINGPARAM("StyleFamilies") );
+ if( ( ( mnExportFlags & EXPORT_STYLES ) == 0 )
+ && mxExportInfo.is()
+ && mxExportInfo->getPropertySetInfo()->hasPropertyByName( sStyleNames )
+ && mxExportInfo->getPropertySetInfo()->hasPropertyByName( sStyleFamilies ) )
+ {
+ Sequence<sal_Int32> aStyleFamilies;
+ mxExportInfo->getPropertyValue( sStyleFamilies ) >>= aStyleFamilies;
+ Sequence<OUString> aStyleNames;
+ mxExportInfo->getPropertyValue( sStyleNames ) >>= aStyleNames;
+ mxAutoStylePool->RegisterNames( aStyleFamilies, aStyleNames );
+ }
+
+// AddAttributeASCII( XML_NAMESPACE_NONE, XML_ID, XML_AUTO_STYLES_ID );
+ {
+ // <style:automatic-styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE,
+ XML_AUTOMATIC_STYLES, sal_True, sal_True );
+
+#if 0
+ AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, XML_STYLES_HREF );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_ROLE,
+ pNamespaceMap->GetQNameByKey( XML_NAMESPACE_OFFICE,
+ GetXMLToken(XML_STYLESHEET)) );
+ {
+ // <style:use-styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE,
+ XML_USE_STYLES, sal_True, sal_True );
+ }
+#endif
+ _ExportAutoStyles();
+ }
+}
+
+void SvXMLExport::ImplExportMasterStyles( sal_Bool )
+{
+ {
+ // <style:master-styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_MASTER_STYLES,
+ sal_True, sal_True );
+
+ _ExportMasterStyles();
+ }
+
+#if 0
+ AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, XML_AUTO_STYLES_HREF );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
+ AddAttribute( XML_NAMESPACE_XLINK, XML_ROLE,
+ pNamespaceMap->GetQNameByKey( XML_NAMESPACE_OFFICE,
+ GetXMLToken(XML_STYLESHEET) ) );
+ {
+ // <style:use-styles>
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE,
+ XML_USE_STYLES, sal_True, sal_True );
+ }
+#endif
+}
+
+void SvXMLExport::ImplExportContent()
+{
+ CheckAttrList();
+
+ CheckAttrList();
+
+ {
+ SvXMLElementExport aElemrnt( *this, XML_NAMESPACE_OFFICE, XML_BODY,
+ sal_True, sal_True );
+ {
+ XMLTokenEnum eClass = meClass;
+ if( XML_TEXT_GLOBAL == eClass )
+ {
+ AddAttribute( XML_NAMESPACE_TEXT, XML_GLOBAL,
+ GetXMLToken( XML_TRUE ) );
+ eClass = XML_TEXT;
+ }
+ // <office:body ...>
+ SetBodyAttributes();
+ SvXMLElementExport aElem( *this, meClass != XML_TOKEN_INVALID,
+ XML_NAMESPACE_OFFICE, eClass,
+ sal_True, sal_True );
+
+ _ExportContent();
+ }
+ }
+}
+
+void SvXMLExport::SetBodyAttributes()
+{
+}
+
+static void
+lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 nExportMode)
+{
+ // check version >= 1.2
+ switch (rExport.getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+
+ if (EXPORT_SETTINGS != nExportMode) // meta, content, styles
+ {
+ rExport.AddAttribute( XML_NAMESPACE_GRDDL, XML_TRANSFORMATION,
+ OUString::createFromAscii(s_grddl_xsl) );
+ }
+}
+
+sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
+{
+ bool bOwnGraphicResolver = false;
+ bool bOwnEmbeddedResolver = false;
+
+ if( !mxGraphicResolver.is() || !mxEmbeddedResolver.is() )
+ {
+ Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
+ if( xFactory.is() )
+ {
+ try
+ {
+ if( !mxGraphicResolver.is() )
+ {
+ mxGraphicResolver = Reference< XGraphicObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.document.ExportGraphicObjectResolver"))));
+ bOwnGraphicResolver = mxGraphicResolver.is();
+ }
+
+ if( !mxEmbeddedResolver.is() )
+ {
+ mxEmbeddedResolver = Reference< XEmbeddedObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.document.ExportEmbeddedObjectResolver"))));
+ bOwnEmbeddedResolver = mxEmbeddedResolver.is();
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ if( (getExportFlags() & EXPORT_OASIS) == 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory();
+ if( xFactory.is() )
+ {
+ try
+ {
+ ::comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { "Class", sizeof("Class")-1, 0,
+ &::getCppuType((::rtl::OUString*)0),
+ PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ Reference< XPropertySet > xConvPropSet(
+ ::comphelper::GenericPropertySet_CreateInstance(
+ new ::comphelper::PropertySetInfo( aInfoMap ) ) );
+
+ Any aAny;
+ aAny <<= GetXMLToken( eClass );
+ xConvPropSet->setPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Class")), aAny );
+
+ Reference< XPropertySet > xPropSet =
+ mxExportInfo.is()
+ ? PropertySetMerger_CreateInstance( mxExportInfo,
+ xConvPropSet )
+ : xConvPropSet;
+
+ Sequence<Any> aArgs( 3 );
+ aArgs[0] <<= mxHandler;
+ aArgs[1] <<= xPropSet;
+ aArgs[2] <<= mxModel;
+
+ // get filter component
+ Reference< xml::sax::XDocumentHandler > xTmpDocHandler(
+ xFactory->createInstanceWithArguments(
+ OUString::createFromAscii("com.sun.star.comp.Oasis2OOoTransformer"),
+ aArgs), UNO_QUERY);
+ OSL_ENSURE( xTmpDocHandler.is(),
+ "can't instantiate OASIS transformer component" );
+ if( xTmpDocHandler.is() )
+ {
+ mxHandler = xTmpDocHandler;
+ mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY );
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+
+
+ mxHandler->startDocument();
+
+ // <?xml version="1.0" encoding="UTF-8"?>
+// xHandler->processingInstruction( S2U( sXML_xml ), S2U( sXML_xml_pi ) );
+
+ // <office:document ...>
+ CheckAttrList();
+
+ // namespace attributes
+ // ( The namespace decls should be first attributes in the element;
+ // some faulty XML parsers (JAXP1.1) have a problem with this,
+ // also it's more elegant )
+ sal_uInt16 nPos = mpNamespaceMap->GetFirstKey();
+ while( USHRT_MAX != nPos )
+ {
+ mpAttrList->AddAttribute( mpNamespaceMap->GetAttrNameByKey( nPos ),
+ mpNamespaceMap->GetNameByKey( nPos ) );
+ nPos = mpNamespaceMap->GetNextKey( nPos );
+ }
+
+
+
+ // office:version = ...
+ if( !mbExtended )
+ {
+ const sal_Char* pVersion = 0;
+ switch( getDefaultVersion() )
+ {
+ case SvtSaveOptions::ODFVER_LATEST: pVersion = sXML_1_2; break;
+ case SvtSaveOptions::ODFVER_012: pVersion = sXML_1_2; break;
+ case SvtSaveOptions::ODFVER_011: pVersion = sXML_1_1; break;
+ case SvtSaveOptions::ODFVER_010: break;
+
+ default:
+ DBG_ERROR("xmloff::SvXMLExport::exportDoc(), unexpected odf default version!");
+ }
+
+ if( pVersion )
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION,
+ OUString::createFromAscii(pVersion) );
+ }
+
+ {
+ enum XMLTokenEnum eRootService = XML_TOKEN_INVALID;
+ const sal_Int32 nExportMode = mnExportFlags & (EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS);
+
+ lcl_AddGrddl(*this, nExportMode);
+
+ if( EXPORT_META == nExportMode )
+ {
+ // export only meta
+ eRootService = XML_DOCUMENT_META;
+ }
+ else if ( EXPORT_SETTINGS == nExportMode )
+ {
+ // export only settings
+ eRootService = XML_DOCUMENT_SETTINGS;
+ }
+ else if( EXPORT_STYLES == nExportMode )
+ {
+ // export only styles
+ eRootService = XML_DOCUMENT_STYLES;
+ }
+ else if( EXPORT_CONTENT == nExportMode )
+ {
+ // export only content
+ eRootService = XML_DOCUMENT_CONTENT;
+ }
+ else
+ {
+ // the god'ol one4all element
+ eRootService = XML_DOCUMENT;
+ // office:mimetype = ... (only for stream containing the content)
+ if( eClass != XML_TOKEN_INVALID )
+ {
+ OUString aTmp( RTL_CONSTASCII_USTRINGPARAM("application/vnd.oasis.opendocument.") );
+ aTmp += GetXMLToken( eClass );
+ AddAttribute( XML_NAMESPACE_OFFICE, XML_MIMETYPE, aTmp );
+ }
+ }
+
+// if( (getExportFlags() & EXPORT_NODOCTYPE) == 0 &&
+// xExtHandler.is() )
+// {
+// OUStringBuffer aDocType(
+// GetXMLToken(XML_XML_DOCTYPE_PREFIX).getLength() +
+// GetXMLToken(XML_XML_DOCTYPE_SUFFIX).getLength() + 30 );
+//
+// aDocType.append( GetXMLToken(XML_XML_DOCTYPE_PREFIX) );
+// aDocType.append( GetNamespaceMap().GetQNameByKey(
+// XML_NAMESPACE_OFFICE, GetXMLToken(eRootService) ) );
+// aDocType.append( GetXMLToken(XML_XML_DOCTYPE_SUFFIX) );
+// xExtHandler->unknown( aDocType.makeStringAndClear() );
+// }
+
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, eRootService, sal_True, sal_True );
+
+ // meta information
+ if( mnExportFlags & EXPORT_META )
+ ImplExportMeta();
+
+ // settings
+ if( mnExportFlags & EXPORT_SETTINGS )
+ ImplExportSettings();
+
+ // scripts
+ if( mnExportFlags & EXPORT_SCRIPTS )
+ _ExportScripts();
+
+ // font declerations
+ if( mnExportFlags & EXPORT_FONTDECLS )
+ _ExportFontDecls();
+
+ // styles
+ if( mnExportFlags & EXPORT_STYLES )
+ ImplExportStyles( sal_False );
+
+ // autostyles
+ if( mnExportFlags & EXPORT_AUTOSTYLES )
+ ImplExportAutoStyles( sal_False );
+
+ // masterstyles
+ if( mnExportFlags & EXPORT_MASTERSTYLES )
+ ImplExportMasterStyles( sal_False );
+
+ // contnt
+ if( mnExportFlags & EXPORT_CONTENT )
+ ImplExportContent();
+ }
+
+
+ mxHandler->endDocument();
+
+ if( bOwnGraphicResolver )
+ {
+ Reference< XComponent > xComp( mxGraphicResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+
+ if( bOwnEmbeddedResolver )
+ {
+ Reference< XComponent > xComp( mxEmbeddedResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+
+ return 0;
+}
+
+void SvXMLExport::ResetNamespaceMap()
+{
+ delete mpNamespaceMap; mpNamespaceMap = new SvXMLNamespaceMap;
+}
+
+void SvXMLExport::_ExportMeta()
+{
+ OUString generator( ::utl::DocInfoHelper::GetGeneratorString() );
+ Reference< XDocumentPropertiesSupplier > xDocPropsSupplier(mxModel,
+ UNO_QUERY);
+ if (xDocPropsSupplier.is()) {
+ Reference<XDocumentProperties> xDocProps(
+ xDocPropsSupplier->getDocumentProperties());
+ if (!xDocProps.is()) throw;
+ // update generator here
+ xDocProps->setGenerator(generator);
+ SvXMLMetaExport * pMeta = new SvXMLMetaExport(*this, xDocProps);
+ uno::Reference<xml::sax::XDocumentHandler> xMeta(pMeta);
+ pMeta->Export();
+ } else {
+ // office:meta
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_META,
+ sal_True, sal_True );
+ {
+ // BM: #i60323# export generator even if xInfoProp is empty (which is the
+ // case for charts). The generator does not depend on xInfoProp
+ SvXMLElementExport anElem( *this, XML_NAMESPACE_META, XML_GENERATOR,
+ sal_True, sal_True );
+ Characters(generator);
+ }
+ }
+}
+
+void SvXMLExport::_ExportScripts()
+{
+ SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_SCRIPTS, sal_True, sal_True );
+
+ // export Basic macros (only for FlatXML)
+ if ( mnExportFlags & EXPORT_EMBEDDED )
+ {
+ ::rtl::OUString aValue( GetNamespaceMap().GetPrefixByKey( XML_NAMESPACE_OOO ) );
+ aValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":Basic" ) );
+ AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, aValue );
+
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_SCRIPT, sal_True, sal_True );
+
+ // initialize Basic
+ if ( mxModel.is() )
+ {
+ Reference< beans::XPropertySet > xPSet( mxModel, UNO_QUERY );
+ if ( xPSet.is() )
+ xPSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) );
+ }
+
+ Reference< document::XExporter > xExporter;
+ Reference< lang::XMultiServiceFactory > xMSF( getServiceFactory() );
+ if ( xMSF.is() )
+ {
+ Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) );
+ Sequence < Any > aArgs( 1 );
+ aArgs[0] <<= xHdl;
+ xExporter.set( xMSF->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.XMLOasisBasicExporter" ) ), aArgs ),
+ UNO_QUERY );
+ }
+
+ OSL_ENSURE( xExporter.is(),
+ "SvXMLExport::_ExportScripts: can't instantiate export filter component for Basic macros" );
+
+ if ( xExporter.is() )
+ {
+ Reference< XComponent > xComp( mxModel, UNO_QUERY );
+ xExporter->setSourceDocument( xComp );
+ Reference< XFilter > xFilter( xExporter, UNO_QUERY );
+ if ( xFilter.is() )
+ {
+ Sequence < PropertyValue > aMediaDesc( 0 );
+ xFilter->filter( aMediaDesc );
+ }
+ }
+ }
+
+ // export document events
+ Reference< document::XEventsSupplier > xEvents( GetModel(), UNO_QUERY );
+ GetEventExport().Export( xEvents, sal_True );
+}
+
+void SvXMLExport::_ExportFontDecls()
+{
+ if( mxFontAutoStylePool.is() )
+ mxFontAutoStylePool->exportXML();
+}
+
+void SvXMLExport::_ExportStyles( sal_Bool )
+{
+ uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY );
+ if( xFact.is())
+ {
+ // export (fill-)gradient-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable") ) ), uno::UNO_QUERY );
+ if( xGradient.is() )
+ {
+ XMLGradientStyleExport aGradientStyle( *this );
+
+ if( xGradient->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xGradient->getByName( rStrName );
+
+ aGradientStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export (fill-)hatch-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xHatch( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable") ) ), uno::UNO_QUERY );
+ if( xHatch.is() )
+ {
+ XMLHatchStyleExport aHatchStyle( *this );
+
+ if( xHatch->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xHatch->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xHatch->getByName( rStrName );
+
+ aHatchStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export (fill-)bitmap-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xBitmap( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable") ) ), uno::UNO_QUERY );
+ if( xBitmap.is() )
+ {
+ XMLImageStyle aImageStyle;
+
+ if( xBitmap->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xBitmap->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xBitmap->getByName( rStrName );
+
+ aImageStyle.exportXML( rStrName, aValue, *this );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export transparency-gradient -styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xTransGradient( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ), uno::UNO_QUERY );
+ if( xTransGradient.is() )
+ {
+ XMLTransGradientStyleExport aTransGradientstyle( *this );
+
+ if( xTransGradient->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xTransGradient->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xTransGradient->getByName( rStrName );
+
+ aTransGradientstyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export marker-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xMarker( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable") ) ), uno::UNO_QUERY );
+ if( xMarker.is() )
+ {
+ XMLMarkerStyleExport aMarkerStyle( *this );
+
+ if( xMarker->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xMarker->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xMarker->getByName( rStrName );
+
+ aMarkerStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+
+ // export dash-styles
+ try
+ {
+ uno::Reference< container::XNameAccess > xDashes( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable") ) ), uno::UNO_QUERY );
+ if( xDashes.is() )
+ {
+ XMLDashStyleExport aDashStyle( *this );
+
+ if( xDashes->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xDashes->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const OUString& rStrName = aNamesSeq[ i ];
+
+ try
+ {
+ uno::Any aValue = xDashes->getByName( rStrName );
+
+ aDashStyle.exportXML( rStrName, aValue );
+ }
+ catch( container::NoSuchElementException& )
+ {}
+ }
+ }
+ }
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+}
+
+XMLTextParagraphExport* SvXMLExport::CreateTextParagraphExport()
+{
+ return new XMLTextParagraphExport( *this, *(GetAutoStylePool().get()) );
+}
+
+XMLShapeExport* SvXMLExport::CreateShapeExport()
+{
+ return new XMLShapeExport(*this);
+}
+
+SvXMLAutoStylePoolP* SvXMLExport::CreateAutoStylePool()
+{
+ return new SvXMLAutoStylePoolP(*this);
+}
+
+XMLPageExport* SvXMLExport::CreatePageExport()
+{
+ return new XMLPageExport( *this );
+}
+
+SchXMLExportHelper* SvXMLExport::CreateChartExport()
+{
+ return new SchXMLExportHelper(*this,*GetAutoStylePool().get());
+}
+
+XMLFontAutoStylePool* SvXMLExport::CreateFontAutoStylePool()
+{
+ return new XMLFontAutoStylePool( *this );
+}
+
+xmloff::OFormLayerXMLExport* SvXMLExport::CreateFormExport()
+{
+ return new xmloff::OFormLayerXMLExport(*this);
+}
+
+void SvXMLExport::GetViewSettingsAndViews(uno::Sequence<beans::PropertyValue>& rProps)
+{
+ GetViewSettings(rProps);
+ uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
+ if(xViewDataSupplier.is())
+ {
+ uno::Reference<container::XIndexAccess> xIndexAccess;
+ xViewDataSupplier->setViewData( xIndexAccess ); // make sure we get a newly created sequence
+ xIndexAccess = xViewDataSupplier->getViewData();
+ sal_Bool bAdd = sal_False;
+ uno::Any aAny;
+ if(xIndexAccess.is() && xIndexAccess->hasElements() )
+ {
+ sal_Int32 nCount = xIndexAccess->getCount();
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ aAny = xIndexAccess->getByIndex(i);
+ uno::Sequence<beans::PropertyValue> aProps;
+ if( aAny >>= aProps )
+ {
+ if( aProps.getLength() > 0 )
+ {
+ bAdd = sal_True;
+ break;
+ }
+ }
+ }
+ }
+
+ if( bAdd )
+ {
+ sal_Int32 nOldLength(rProps.getLength());
+ rProps.realloc(nOldLength + 1);
+ beans::PropertyValue aProp;
+ aProp.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Views"));
+ aProp.Value <<= xIndexAccess;
+ rProps[nOldLength] = aProp;
+ }
+ }
+}
+
+void SvXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>&)
+{
+}
+
+void SvXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&)
+{
+}
+
+sal_Int32 SvXMLExport::GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings )
+{
+ (void)_out_rSettings;
+ return 0;
+}
+
+void SvXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool /*bTimeFormat*/ )
+{
+ if(mpNumExport)
+ mpNumExport->SetUsed(nNumberFormat);
+}
+
+void SvXMLExport::exportDataStyles()
+{
+ if(mpNumExport)
+ mpNumExport->Export(sal_False);
+}
+
+void SvXMLExport::exportAutoDataStyles()
+{
+ if(mpNumExport)
+ mpNumExport->Export(sal_True);
+
+ if (mxFormExport.is())
+ mxFormExport->exportAutoControlNumberStyles();
+}
+
+OUString SvXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool /*bTimeFormat*/ ) const
+{
+ OUString sTemp;
+ if(mpNumExport)
+ sTemp = mpNumExport->GetStyleName(nNumberFormat);
+ return sTemp;
+}
+
+void SvXMLExport::exportAnnotationMeta(const uno::Reference<drawing::XShape>&)
+{
+}
+
+sal_Int32 SvXMLExport::dataStyleForceSystemLanguage(sal_Int32 nFormat) const
+{
+ return ( mpNumExport != NULL )
+ ? mpNumExport->ForceSystemLanguage( nFormat ) : nFormat;
+}
+
+
+OUString SvXMLExport::AddEmbeddedGraphicObject( const OUString& rGraphicObjectURL )
+{
+ OUString sRet( rGraphicObjectURL );
+ if( 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) &&
+ mxGraphicResolver.is() )
+ {
+ if( (getExportFlags() & EXPORT_EMBEDDED) == 0 )
+ sRet = mxGraphicResolver->resolveGraphicObjectURL( rGraphicObjectURL );
+ else
+ sRet = OUString();
+ }
+ else
+ sRet = GetRelativeReference( sRet );
+
+ return sRet;
+}
+
+sal_Bool SvXMLExport::AddEmbeddedGraphicObjectAsBase64( const OUString& rGraphicObjectURL )
+{
+ sal_Bool bRet = sal_False;
+
+ if( (getExportFlags() & EXPORT_EMBEDDED) != 0 &&
+ 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) &&
+ mxGraphicResolver.is() )
+ {
+ Reference< XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
+
+ if( xStmResolver.is() )
+ {
+ Reference< XInputStream > xIn( xStmResolver->getInputStream( rGraphicObjectURL ) );
+
+ if( xIn.is() )
+ {
+ XMLBase64Export aBase64Exp( *this );
+ bRet = aBase64Exp.exportOfficeBinaryDataElement( xIn );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL )
+{
+ OUString sRet;
+ if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol,
+ msEmbeddedObjectProtocol.getLength() ) ||
+ 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) ) &&
+ mxEmbeddedResolver.is() )
+ {
+ sRet =
+ mxEmbeddedResolver->resolveEmbeddedObjectURL( rEmbeddedObjectURL );
+ }
+ else
+ sRet = GetRelativeReference( rEmbeddedObjectURL );
+
+ return sRet;
+}
+
+sal_Bool SvXMLExport::AddEmbeddedObjectAsBase64( const OUString& rEmbeddedObjectURL )
+{
+ sal_Bool bRet = sal_False;
+ if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol,
+ msEmbeddedObjectProtocol.getLength() ) ||
+ 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol,
+ msGraphicObjectProtocol.getLength() ) ) &&
+ mxEmbeddedResolver.is() )
+ {
+ Reference < XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
+ if( xNA.is() )
+ {
+ Any aAny = xNA->getByName( rEmbeddedObjectURL );
+ Reference < XInputStream > xIn;
+ aAny >>= xIn;
+ if( xIn.is() )
+ {
+ XMLBase64Export aBase64Exp( *this );
+ bRet = aBase64Exp.exportOfficeBinaryDataElement( xIn );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+OUString SvXMLExport::EncodeStyleName(
+ const OUString& rName,
+ sal_Bool *pEncoded ) const
+{
+ return GetMM100UnitConverter().encodeStyleName( rName, pEncoded );
+}
+
+ProgressBarHelper* SvXMLExport::GetProgressBarHelper()
+{
+ if (!mpProgressBarHelper)
+ {
+ mpProgressBarHelper = new ProgressBarHelper(mxStatusIndicator, sal_True);
+
+ if (mxExportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sProgressRange(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSRANGE));
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent) &&
+ xPropertySetInfo->hasPropertyByName(sProgressRange))
+ {
+ uno::Any aAny;
+ sal_Int32 nProgressMax(0);
+ sal_Int32 nProgressCurrent(0);
+ sal_Int32 nProgressRange(0);
+ aAny = mxExportInfo->getPropertyValue(sProgressRange);
+ if (aAny >>= nProgressRange)
+ mpProgressBarHelper->SetRange(nProgressRange);
+ aAny = mxExportInfo->getPropertyValue(sProgressMax);
+ if (aAny >>= nProgressMax)
+ mpProgressBarHelper->SetReference(nProgressMax);
+ aAny = mxExportInfo->getPropertyValue(sProgressCurrent);
+ if (aAny >>= nProgressCurrent)
+ mpProgressBarHelper->SetValue(nProgressCurrent);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ {
+ uno::Any aAny = mxExportInfo->getPropertyValue(sRepeat);
+ if (aAny.getValueType() == getBooleanCppuType())
+ mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
+ else {
+ DBG_ERRORFILE("why is it no boolean?");
+ }
+ }
+ }
+ }
+ }
+ return mpProgressBarHelper;
+}
+
+XMLEventExport& SvXMLExport::GetEventExport()
+{
+ if( NULL == mpEventExport)
+ {
+ // create EventExport on demand
+ mpEventExport = new XMLEventExport(*this, NULL);
+
+ // and register standard handlers + names
+ OUString sStarBasic(RTL_CONSTASCII_USTRINGPARAM("StarBasic"));
+ mpEventExport->AddHandler(sStarBasic, new XMLStarBasicExportHandler());
+ OUString sScript(RTL_CONSTASCII_USTRINGPARAM("Script"));
+ mpEventExport->AddHandler(sScript, new XMLScriptExportHandler());
+ mpEventExport->AddTranslationTable(aStandardEventTable);
+ }
+
+ return *mpEventExport;
+}
+
+XMLImageMapExport& SvXMLExport::GetImageMapExport()
+{
+ // image map export, create on-demand
+ if( NULL == mpImageMapExport )
+ {
+ mpImageMapExport = new XMLImageMapExport(*this);
+ }
+
+ return *mpImageMapExport;
+}
+
+// XUnoTunnel & co
+const uno::Sequence< sal_Int8 > & SvXMLExport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvXMLExport* SvXMLExport::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvXMLExport*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvXMLExport::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL SvXMLExport::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw( uno::RuntimeException )
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp )
+{
+ OUString sFilterService;
+ bool bIsChart = false;
+
+ Reference < lang::XServiceInfo > xServiceInfo( rComp, UNO_QUERY );
+ if( xServiceInfo.is() )
+ {
+ const XMLServiceMapEntry_Impl *pEntry = aServiceMap;
+ while( pEntry->sModelService )
+ {
+ OUString sModelService( pEntry->sModelService,
+ pEntry->nModelServiceLen,
+ RTL_TEXTENCODING_ASCII_US );
+ if( xServiceInfo->supportsService( sModelService ) )
+ {
+ sFilterService = OUString( pEntry->sFilterService,
+ pEntry->nFilterServiceLen,
+ RTL_TEXTENCODING_ASCII_US );
+ bIsChart = sModelService.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( XML_MODEL_SERVICE_CHART ));
+ break;
+ }
+ pEntry++;
+ }
+ }
+
+ OSL_ENSURE( sFilterService.getLength(), "no export filter for own object" );
+
+ if( !sFilterService.getLength() )
+ return sal_False;
+
+ Reference < XDocumentHandler > xHdl =
+ new XMLEmbeddedObjectExportFilter( mxHandler );
+
+ Sequence < Any > aArgs( 1 );
+ // #144135# the filters for embedded objects in flat format are always
+ // instantiated as Oasis filters and transformed afterwards. Therefore, all
+ // special handling that is done if the exportFlags do not contain
+ // EXPORT_OASIS must be changed to properties being passed in the info
+ // propertyset
+
+ if( ! (getExportFlags() & EXPORT_OASIS) &&
+ bIsChart )
+ {
+ static ::comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM("ExportTableNumberList"), 0, &::getBooleanCppuType(), PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ Reference< XPropertySet > xInfoProp(
+ ::comphelper::GenericPropertySet_CreateInstance(
+ new ::comphelper::PropertySetInfo( aInfoMap )));
+
+ if( bIsChart )
+ xInfoProp->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("ExportTableNumberList")), makeAny( true ));
+
+ aArgs.realloc( 2 );
+ aArgs[1] <<= xInfoProp;
+ }
+ aArgs[0] <<= xHdl;
+
+ // #110680#
+ // Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
+ Reference< lang::XMultiServiceFactory > xServiceFactory = getServiceFactory();
+
+ Reference< document::XExporter > xExporter(
+ xServiceFactory->createInstanceWithArguments( sFilterService, aArgs),
+ UNO_QUERY);
+ OSL_ENSURE( xExporter.is(),
+ "can't instantiate export filter component for own object" );
+ if( !xExporter.is() )
+ return sal_False;
+
+ xExporter->setSourceDocument( rComp );
+
+ Reference<XFilter> xFilter( xExporter, UNO_QUERY );
+
+ Sequence < PropertyValue > aMediaDesc( 0 );
+ return xFilter->filter( aMediaDesc );
+}
+
+OUString SvXMLExport::GetRelativeReference(const OUString& rValue)
+{
+ OUString sValue( rValue );
+ // #i65474# handling of fragment URLs ("#....") is undefined
+ // they are stored 'as is'
+ uno::Reference< uri::XUriReference > xUriRef;
+ if(sValue.getLength() && sValue.getStr()[0] != '#')
+ {
+ try
+ {
+ xUriRef = mpImpl->mxUriReferenceFactory->parse( rValue );
+ if( xUriRef.is() && !xUriRef->isAbsolute() )
+ {
+ //#i61943# relative URLs need special handling
+ INetURLObject aTemp( mpImpl->msPackageURI );
+ bool bWasAbsolute = false;
+ sValue = aTemp.smartRel2Abs(sValue, bWasAbsolute ).GetMainURL(INetURLObject::DECODE_TO_IURI);
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ OUString sRet = sValue;
+ if( xUriRef.is() )//no conversion for empty values or for fragments
+ {
+ //conversion for matching schemes only
+ if( xUriRef->getScheme() == mpImpl->msPackageURIScheme )
+ {
+ sValue = INetURLObject::GetRelURL( msOrigFileName, sValue,
+ INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI, RTL_TEXTENCODING_UTF8, INetURLObject::FSYS_DETECT);
+ }
+ }
+ return sValue;
+}
+
+void SvXMLExport::StartElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSOutside )
+{
+ StartElement(_GetNamespaceMap().GetQNameByKey( nPrefix,
+ GetXMLToken(eName) ), bIgnWSOutside);
+}
+
+void SvXMLExport::StartElement(const OUString& rName,
+ sal_Bool bIgnWSOutside )
+{
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ if( bIgnWSOutside && ((mnExportFlags & EXPORT_PRETTY) == EXPORT_PRETTY))
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->startElement( rName, GetXAttrList() );
+ }
+ catch ( SAXInvalidCharacterException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rName;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rName;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+ ClearAttrList();
+ ++mpImpl->mDepth; // increment nesting depth counter
+}
+
+void SvXMLExport::Characters(const ::rtl::OUString& rChars)
+{
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ mxHandler->characters(rChars);
+ }
+ catch ( SAXInvalidCharacterException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rChars;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rChars;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+}
+
+void SvXMLExport::EndElement(sal_uInt16 nPrefix,
+ enum ::xmloff::token::XMLTokenEnum eName,
+ sal_Bool bIgnWSInside )
+{
+ EndElement(_GetNamespaceMap().GetQNameByKey( nPrefix, GetXMLToken(eName) ),
+ bIgnWSInside);
+}
+
+void SvXMLExport::EndElement(const OUString& rName,
+ sal_Bool bIgnWSInside )
+{
+ // decrement nesting depth counter & (maybe) restore namespace map
+ --mpImpl->mDepth;
+ if (!mpImpl->mNamespaceMaps.empty() &&
+ (mpImpl->mNamespaceMaps.top().second == mpImpl->mDepth))
+ {
+ delete mpNamespaceMap;
+ mpNamespaceMap = mpImpl->mNamespaceMaps.top().first;
+ mpImpl->mNamespaceMaps.pop();
+ }
+ OSL_ENSURE(mpImpl->mNamespaceMaps.empty() ||
+ (mpImpl->mNamespaceMaps.top().second < mpImpl->mDepth),
+ "SvXMLExport: NamespaceMaps corrupted");
+
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ if( bIgnWSInside && ((mnExportFlags & EXPORT_PRETTY) == EXPORT_PRETTY))
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->endElement( rName );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(1);
+ aPars[0] = rName;
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+}
+
+void SvXMLExport::IgnorableWhitespace()
+{
+ if ((mnExportFlags & EXPORT_PRETTY) != EXPORT_PRETTY)
+ return;
+
+ if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
+ {
+ try
+ {
+ mxHandler->ignorableWhitespace( msWS );
+ }
+ catch ( SAXException& e )
+ {
+ Sequence<OUString> aPars(0);
+ SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
+ aPars, e.Message, NULL );
+ }
+ }
+}
+
+
+void SvXMLExport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams,
+ const OUString& rExceptionMessage,
+ const Reference<XLocator>& rLocator )
+{
+ // allow multi-threaded access to the cancel() method
+ static ::vos::OMutex aMutex;
+ ::vos::OGuard aGuard(aMutex);
+
+ // maintain error flags
+ if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )
+ mnErrorFlags |= ERROR_ERROR_OCCURED;
+ if ( ( nId & XMLERROR_FLAG_WARNING ) != 0 )
+ mnErrorFlags |= ERROR_WARNING_OCCURED;
+ if ( ( nId & XMLERROR_FLAG_SEVERE ) != 0 )
+ mnErrorFlags |= ERROR_DO_NOTHING;
+
+ // create error lsit on demand
+ if ( mpXMLErrors == NULL )
+ mpXMLErrors = new XMLErrors();
+
+ // save error information
+ mpXMLErrors->AddRecord( nId, rMsgParams, rExceptionMessage, rLocator );
+}
+
+void SvXMLExport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams)
+{
+ OUString sEmpty;
+ SetError( nId, rMsgParams, sEmpty, NULL );
+}
+
+
+XMLErrors* SvXMLExport::GetErrors()
+{
+ return mpXMLErrors;
+}
+
+void SvXMLExport::DisposingModel()
+{
+ mxModel.clear();
+ // --> OD 2006-03-13 #i51726#
+ meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;;
+ // <--
+ mxEventListener.clear();
+}
+
+// #110680#
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLExport::getServiceFactory()
+{
+ // #110680#
+ return mxServiceFactory;
+}
+
+uno::Reference< uno::XComponentContext >
+SvXMLExport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
+::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper()
+{
+ return mpImpl->maInterfaceToIdentifierMapper;
+}
+
+// --> OD 2006-09-27 #i69627#
+sal_Bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const
+{
+ return mpImpl->mbOutlineStyleAsNormalListStyle;
+}
+// <--
+
+uno::Reference< embed::XStorage > SvXMLExport::GetTargetStorage()
+{
+ return mpImpl->mxTargetStorage;
+}
+
+/// returns the currently configured default version for odf export
+SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
+{
+ if( mpImpl )
+ return mpImpl->maSaveOptions.GetODFDefaultVersion();
+
+ // fatal error, use current version as default
+ return SvtSaveOptions::ODFVER_012;
+}
+
+::rtl::OUString SvXMLExport::GetStreamName() const
+{
+ return mpImpl->mStreamName;
+}
+
+void
+SvXMLExport::AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue)
+{
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: break;
+ default: // ODF 1.2: xml:id
+ AddAttribute(XML_NAMESPACE_XML, XML_ID, rValue);
+ }
+ // in ODF 1.1 this was form:id, anim:id, draw:id, or text:id
+ // backward compatibility: in ODF 1.2 write _both_ id attrs
+ AddAttribute(nLegacyPrefix, XML_ID, rValue);
+ // FIXME: this function simply assumes that rValue is unique
+}
+
+void
+SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
+{
+ // check version >= 1.2
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+ const uno::Reference<rdf::XMetadatable> xMeta(i_xIfc,
+ uno::UNO_QUERY);
+//FIXME not yet...
+// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
+ if ( xMeta.is() )
+ {
+ const beans::StringPair mdref( xMeta->getMetadataReference() );
+ if ( !mdref.Second.equalsAscii("") )
+ {
+ const ::rtl::OUString streamName( GetStreamName() );
+ if ( streamName.getLength() )
+ {
+ if ( streamName.equals(mdref.First) )
+ {
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
+ }
+ else
+ {
+ OSL_ENSURE(false, "SvXMLExport::AddAttributeXmlId: "
+ "invalid stream name");
+ }
+ }
+ else
+ {
+ // FIXME: this is ugly
+ // there is no stream name (e.g. XSLT, flat-xml format)!
+ // but how do we ensure uniqueness in this case?
+ // a) just omit styles.xml ids -- they are unlikely anyway...
+ // b) somehow find out whether we are currently exporting styles
+ // or content, and prefix "s" or "c" => unique
+ if ( mdref.First.equalsAscii("content.xml") )
+ {
+ AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
+ }
+ else
+ {
+ OSL_TRACE("SvXMLExport::AddAttributeXmlId: "
+ "no stream name given: dropping styles.xml xml:id");
+ }
+ }
+ }
+ }
+}
+
+void
+SvXMLExport::AddAttributesRDFa(
+ uno::Reference<text::XTextContent> const & i_xTextContent)
+{
+ // check version >= 1.2
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: return;
+ default: break;
+ }
+
+ const uno::Reference<rdf::XMetadatable> xMeta(
+ i_xTextContent, uno::UNO_QUERY);
+ if (!xMeta.is() || !xMeta->getMetadataReference().Second.getLength())
+ {
+ return; // no xml:id => no RDFa
+ }
+
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaExportHelper(*this) );
+ }
+ mpImpl->mpRDFaHelper->AddRDFa(xMeta);
+}
+
+// --> OD 2008-11-26 #158694#
+sal_Bool SvXMLExport::exportTextNumberElement() const
+{
+ return mpImpl->mbExportTextNumberElement;
+}
+// <--
+
+sal_Bool SvXMLExport::SetNullDateOnUnitConverter()
+{
+ // if the null date has already been set, don't set it again (performance)
+ if (!mpImpl->mbNullDateInitialized)
+ mpImpl->mbNullDateInitialized = GetMM100UnitConverter().setNullDate(GetModel());
+
+ return mpImpl->mbNullDateInitialized;
+}
+
+//=============================================================================
+
+void SvXMLElementExport::StartElement( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ const OUString& rLName,
+ sal_Bool bIWSOutside )
+{
+ aName = rExp.GetNamespaceMap().GetQNameByKey(nPrefixKey, rLName);
+ rExp.StartElement(aName, bIWSOutside);
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ const sal_Char *pLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ OUString sLName( OUString::createFromAscii(pLName) );
+ StartElement( rExp, nPrefixKey, sLName, bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ const OUString& rLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ StartElement( rExp, nPrefixKey, rLName, bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ StartElement( rExp, nPrefixKey, GetXMLToken(eLName), bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_uInt16 nPrefixKey,
+ const sal_Char *pLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( bDoSth )
+{
+ if( bDoSomething )
+ {
+ OUString sLName( OUString::createFromAscii(pLName) );
+ StartElement( rExp, nPrefixKey, sLName, bIWSOutside );
+ }
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_uInt16 nPrefixKey,
+ const OUString& rLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( bDoSth )
+{
+ if( bDoSomething )
+ StartElement( rExp, nPrefixKey, rLName, bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ sal_Bool bDoSth,
+ sal_uInt16 nPrefixKey,
+ enum XMLTokenEnum eLName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( bDoSth )
+{
+ if( bDoSomething )
+ StartElement( rExport, nPrefixKey, GetXMLToken(eLName), bIWSOutside );
+}
+
+SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
+ const OUString& rQName,
+ sal_Bool bIWSOutside,
+ sal_Bool bIWSInside ) :
+ rExport( rExp ),
+ bIgnWS( bIWSInside ),
+ bDoSomething( sal_True )
+{
+ aName = rQName;
+ rExp.StartElement( rQName, bIWSOutside );
+}
+
+SvXMLElementExport::~SvXMLElementExport()
+{
+ if( bDoSomething )
+ {
+ rExport.EndElement( aName, bIgnWS );
+ }
+}
+
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
new file mode 100644
index 000000000000..ebe98e9c0f69
--- /dev/null
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <tools/debug.hxx>
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::com::sun::star;
+
+DBG_NAME(SvXMLImportContext)
+TYPEINIT0( SvXMLImportContext );
+SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp, USHORT nPrfx,
+ const OUString& rLName ) :
+ mrImport( rImp ),
+ mnPrefix( nPrfx ),
+ maLocalName( rLName ),
+ mpRewindMap( 0 )
+{
+ DBG_CTOR(SvXMLImportContext,NULL);
+
+}
+
+SvXMLImportContext::~SvXMLImportContext()
+{
+
+ DBG_DTOR(SvXMLImportContext,NULL);
+}
+
+SvXMLImportContext *SvXMLImportContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ return mrImport.CreateContext( nPrefix, rLocalName, xAttrList );
+}
+
+void SvXMLImportContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& )
+{
+}
+
+void SvXMLImportContext::EndElement()
+{
+}
+
+void SvXMLImportContext::Characters( const OUString& )
+{
+}
+
+
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
new file mode 100644
index 000000000000..f75eec83dbd3
--- /dev/null
+++ b/xmloff/source/core/xmlimp.cxx
@@ -0,0 +1,2015 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <svl/svarray.hxx>
+#include "unointerfacetouniqueidentifiermapper.hxx"
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/XMLFontStylesContext.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumfi.hxx>
+#include "XMLEventImportHelper.hxx"
+#include "XMLStarBasicContextFactory.hxx"
+#include "XMLScriptContextFactory.hxx"
+#include "StyleMap.hxx"
+#include <xmloff/ProgressBarHelper.hxx>
+#include <xmloff/xmltoken.hxx>
+#include "xmloff/xmlerror.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/document/XBinaryStreamResolver.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <comphelper/namecontainer.hxx>
+#include <rtl/logfile.hxx>
+#include <tools/string.hxx> // used in StartElement for logging
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <unotools/fontcvt.hxx>
+
+#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+#include "RDFaImportHelper.hxx"
+
+#define LOGFILE_AUTHOR "unknown"
+
+using ::com::sun::star::beans::XPropertySetInfo;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::xmloff::token;
+
+sal_Char __READONLY_DATA sXML_np__office[] = "_office";
+sal_Char __READONLY_DATA sXML_np__office_ext[] = "_office_ooo";
+sal_Char __READONLY_DATA sXML_np__ooo[] = "_ooo";
+sal_Char __READONLY_DATA sXML_np__ooow[] = "_ooow";
+sal_Char __READONLY_DATA sXML_np__oooc[] = "_oooc";
+sal_Char __READONLY_DATA sXML_np__of[] = "_of";
+sal_Char __READONLY_DATA sXML_np__style[] = "_style";
+sal_Char __READONLY_DATA sXML_np__text[] = "_text";
+sal_Char __READONLY_DATA sXML_np__table[] = "_table";
+sal_Char __READONLY_DATA sXML_np__table_ext[] = "_table_ooo";
+sal_Char __READONLY_DATA sXML_np__draw[] = "_draw";
+sal_Char __READONLY_DATA sXML_np__draw_ext[] = "_draw_ooo";
+sal_Char __READONLY_DATA sXML_np__dr3d[] = "_dr3d";
+sal_Char __READONLY_DATA sXML_np__fo[] = "_fo";
+sal_Char __READONLY_DATA sXML_np__xlink[] = "_xlink";
+sal_Char __READONLY_DATA sXML_np__dc[] = "_dc";
+sal_Char __READONLY_DATA sXML_np__dom[] = "_dom";
+sal_Char __READONLY_DATA sXML_np__meta[] = "_meta";
+sal_Char __READONLY_DATA sXML_np__number[] = "_number";
+sal_Char __READONLY_DATA sXML_np__svg[] = "_svg";
+sal_Char __READONLY_DATA sXML_np__chart[] = "_chart";
+sal_Char __READONLY_DATA sXML_np__math[] = "_math";
+sal_Char __READONLY_DATA sXML_np__form[] = "_form";
+sal_Char __READONLY_DATA sXML_np__script[] = "_script";
+sal_Char __READONLY_DATA sXML_np__config[] = "_config";
+sal_Char __READONLY_DATA sXML_np__db[] = "_db";
+sal_Char __READONLY_DATA sXML_np__xforms[] = "_xforms";
+sal_Char __READONLY_DATA sXML_np__xsd[] = "_xsd";
+sal_Char __READONLY_DATA sXML_np__xsi[] = "_xsi";
+sal_Char __READONLY_DATA sXML_np__field[] = "_field";
+sal_Char __READONLY_DATA sXML_np__xhtml[] = "_xhtml";
+
+sal_Char __READONLY_DATA sXML_np__fo_old[] = "__fo";
+sal_Char __READONLY_DATA sXML_np__xlink_old[] = "__xlink";
+sal_Char __READONLY_DATA sXML_np__office_old[] = "__office";
+sal_Char __READONLY_DATA sXML_np__style_old[] = "__style";
+sal_Char __READONLY_DATA sXML_np__text_old[] = "__text";
+sal_Char __READONLY_DATA sXML_np__table_old[] = "__table";
+sal_Char __READONLY_DATA sXML_np__meta_old[] = "__meta";
+
+
+
+class SvXMLImportEventListener : public cppu::WeakImplHelper1<
+ com::sun::star::lang::XEventListener >
+{
+private:
+ SvXMLImport* pImport;
+
+public:
+ SvXMLImportEventListener(SvXMLImport* pImport);
+ virtual ~SvXMLImportEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) throw(::com::sun::star::uno::RuntimeException);
+};
+
+SvXMLImportEventListener::SvXMLImportEventListener(SvXMLImport* pTempImport)
+ : pImport(pTempImport)
+{
+}
+
+SvXMLImportEventListener::~SvXMLImportEventListener()
+{
+}
+
+// XEventListener
+void SAL_CALL SvXMLImportEventListener::disposing( const lang::EventObject& )
+ throw(uno::RuntimeException)
+{
+ if (pImport)
+ {
+ pImport->DisposingModel();
+ pImport = NULL;
+ }
+}
+
+//==============================================================================
+
+class SvXMLImport_Impl
+{
+public:
+ FontToSubsFontConverter hBatsFontConv;
+ FontToSubsFontConverter hMathFontConv;
+
+ bool mbOwnGraphicResolver;
+ bool mbOwnEmbeddedResolver;
+ INetURLObject aBaseURL;
+ INetURLObject aDocBase;
+
+ /// name of stream in package, e.g., "content.xml"
+ ::rtl::OUString mStreamName;
+
+ ::rtl::OUString aODFVersion;
+
+ // --> OD 2004-08-10 #i28749# - boolean, indicating that position attributes
+ // of shapes are given in horizontal left-to-right layout. This is the case
+ // for the OpenOffice.org file format.
+ sal_Bool mbShapePositionInHoriL2R;
+ // <--
+ // --> OD 2007-12-19 #152540#
+ sal_Bool mbTextDocInOOoFileFormat;
+ // <--
+
+ const uno::Reference< uno::XComponentContext > mxComponentContext;
+
+ std::auto_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
+
+ SvXMLImport_Impl() :
+ hBatsFontConv( 0 ), hMathFontConv( 0 ),
+ mbOwnGraphicResolver( false ),
+ mbOwnEmbeddedResolver( false ),
+ mStreamName(),
+ // --> OD 2004-08-11 #i28749#
+ mbShapePositionInHoriL2R( sal_False ),
+ // <--
+ // --> OD 2007-12-19 #152540#
+ mbTextDocInOOoFileFormat( sal_False ),
+ // <--
+ mxComponentContext( ::comphelper::getProcessComponentContext() ),
+ mpRDFaHelper() // lazy
+ {
+ OSL_ENSURE(mxComponentContext.is(), "SvXMLImport: no ComponentContext");
+ if (!mxComponentContext.is()) throw uno::RuntimeException();
+ }
+
+ ~SvXMLImport_Impl()
+ {
+ if( hBatsFontConv )
+ DestroyFontToSubsFontConverter( hBatsFontConv );
+ if( hMathFontConv )
+ DestroyFontToSubsFontConverter( hMathFontConv );
+ }
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
+};
+
+typedef SvXMLImportContext *SvXMLImportContextPtr;
+SV_DECL_PTRARR( SvXMLImportContexts_Impl, SvXMLImportContextPtr, 20, 5 )
+SV_IMPL_PTRARR( SvXMLImportContexts_Impl, SvXMLImportContextPtr )
+
+SvXMLImportContext *SvXMLImport::CreateContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& )
+{
+ return new SvXMLImportContext( *this, nPrefix, rLocalName );
+}
+
+void SvXMLImport::_InitCtor()
+{
+ if( mnImportFlags != 0 )
+ {
+ // implicit "xml" namespace prefix
+ mpNamespaceMap->Add( GetXMLToken(XML_XML), GetXMLToken(XML_N_XML),
+ XML_NAMESPACE_XML );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ),
+ GetXMLToken(XML_N_OFFICE),
+ XML_NAMESPACE_OFFICE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office_ext ) ),
+ GetXMLToken(XML_N_OFFICE_EXT),
+ XML_NAMESPACE_OFFICE_EXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__ooo ) ), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__style) ),
+ GetXMLToken(XML_N_STYLE),
+ XML_NAMESPACE_STYLE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__text) ),
+ GetXMLToken(XML_N_TEXT),
+ XML_NAMESPACE_TEXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table ) ),
+ GetXMLToken(XML_N_TABLE),
+ XML_NAMESPACE_TABLE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table_ext ) ),
+ GetXMLToken(XML_N_TABLE_EXT),
+ XML_NAMESPACE_TABLE_EXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw ) ),
+ GetXMLToken(XML_N_DRAW),
+ XML_NAMESPACE_DRAW );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw_ext ) ),
+ GetXMLToken(XML_N_DRAW_EXT),
+ XML_NAMESPACE_DRAW_EXT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM (sXML_np__dr3d ) ),
+ GetXMLToken(XML_N_DR3D),
+ XML_NAMESPACE_DR3D );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__fo) ),
+ GetXMLToken(XML_N_FO_COMPAT),
+ XML_NAMESPACE_FO );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xlink) ),
+ GetXMLToken(XML_N_XLINK),
+ XML_NAMESPACE_XLINK );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__dc) ),
+ GetXMLToken(XML_N_DC),
+ XML_NAMESPACE_DC );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__dom ) ),
+ GetXMLToken(XML_N_DOM),
+ XML_NAMESPACE_DOM );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__meta) ),
+ GetXMLToken(XML_N_META),
+ XML_NAMESPACE_META );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__number) ),
+ GetXMLToken(XML_N_NUMBER),
+ XML_NAMESPACE_NUMBER );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__svg) ),
+ GetXMLToken(XML_N_SVG_COMPAT),
+ XML_NAMESPACE_SVG );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__chart) ),
+ GetXMLToken(XML_N_CHART),
+ XML_NAMESPACE_CHART );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__math) ),
+ GetXMLToken(XML_N_MATH),
+ XML_NAMESPACE_MATH );
+ mpNamespaceMap->Add(OUString(RTL_CONSTASCII_USTRINGPARAM( sXML_np__form )),
+ GetXMLToken(XML_N_FORM),
+ XML_NAMESPACE_FORM );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__script) ),
+ GetXMLToken(XML_N_SCRIPT),
+ XML_NAMESPACE_SCRIPT );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__config) ),
+ GetXMLToken(XML_N_CONFIG),
+ XML_NAMESPACE_CONFIG );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xforms) ),
+ GetXMLToken(XML_N_XFORMS_1_0),
+ XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsd) ),
+ GetXMLToken(XML_N_XSD),
+ XML_NAMESPACE_XSD );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsi) ),
+ GetXMLToken(XML_N_XSI),
+ XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__ooow ) ), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__oooc ) ), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__field ) ), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__of ) ),
+ GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+ mpNamespaceMap->Add(
+ OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xhtml ) ),
+ GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
+ }
+
+ msPackageProtocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+
+ if (mxNumberFormatsSupplier.is())
+ mpNumImport = new SvXMLNumFmtHelper(mxNumberFormatsSupplier, getServiceFactory());
+
+ if (mxModel.is() && !mxEventListener.is())
+ {
+ mxEventListener.set(new SvXMLImportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
+
+}
+
+// #110680#
+SvXMLImport::SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ sal_uInt16 nImportFlags ) throw ()
+: mpImpl( new SvXMLImport_Impl() ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+
+ // #110680#
+ // pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM ) ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ),
+
+ mpContexts( new SvXMLImportContexts_Impl ),
+ mpNumImport( NULL ),
+ mpProgressBarHelper( NULL ),
+ mpEventImportHelper( NULL ),
+ mpXMLErrors( NULL ),
+ mpStyleMap(0),
+ mnImportFlags( nImportFlags ),
+ mnErrorFlags(0),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mbIsFormsSupported( sal_True ),
+ mbIsTableShapeSupported( false ),
+ mbIsGraphicLoadOnDemandSupported( true )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+// #110680#
+SvXMLImport::SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XModel > & rModel ) throw ()
+: mxModel( rModel ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mpImpl( new SvXMLImport_Impl() ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ // pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM ) ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ),
+ mpContexts( new SvXMLImportContexts_Impl ),
+ mpNumImport( NULL ),
+ mpProgressBarHelper( NULL ),
+ mpEventImportHelper( NULL ),
+ mpXMLErrors( NULL ),
+ mpStyleMap(0),
+ mnImportFlags( IMPORT_ALL ),
+ mnErrorFlags(0),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mbIsFormsSupported( sal_True ),
+ mbIsTableShapeSupported( false ),
+ mbIsGraphicLoadOnDemandSupported( true )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+// #110680#
+SvXMLImport::SvXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const Reference< XModel > & rModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > & rGraphicObjects ) throw ()
+: mxModel( rModel ),
+ mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ mxGraphicResolver( rGraphicObjects ),
+ mpImpl( new SvXMLImport_Impl() ),
+ mpNamespaceMap( new SvXMLNamespaceMap ),
+ // #110680#
+ // pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM ) ),
+ mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ),
+ mpContexts( new SvXMLImportContexts_Impl ),
+ mpNumImport( NULL ),
+ mpProgressBarHelper( NULL ),
+ mpEventImportHelper( NULL ),
+ mpXMLErrors( NULL ),
+ mpStyleMap(0),
+ mnImportFlags( IMPORT_ALL ),
+ mnErrorFlags(0),
+ // #110680#
+ mxServiceFactory(xServiceFactory),
+ mbIsFormsSupported( sal_True ),
+ mbIsGraphicLoadOnDemandSupported( true )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+ _InitCtor();
+}
+
+SvXMLImport::~SvXMLImport() throw ()
+{
+ delete mpXMLErrors;
+ delete mpNamespaceMap;
+ delete mpUnitConv;
+ delete mpEventImportHelper;
+ if( mpContexts )
+ {
+ while( mpContexts->Count() )
+ {
+ sal_uInt16 n = mpContexts->Count() - 1;
+ SvXMLImportContext *pContext = (*mpContexts)[n];
+ mpContexts->Remove( n, 1 );
+ if( pContext )
+ pContext->ReleaseRef();
+ }
+ delete mpContexts;
+ }
+
+ // delete pImageMapImportHelper;
+
+ // #i9518# the import component might not be deleted until after the document has been closed,
+ // so the stuff that accesses the document has been moved to endDocument.
+
+ // pNumImport is allocated in the ctor, so it must also be deleted here in case the component
+ // is created and deleted without actually importing.
+ delete mpNumImport;
+ delete mpProgressBarHelper;
+
+ xmloff::token::ResetTokens();
+
+ if( mpImpl )
+ delete mpImpl;
+
+ if (mxEventListener.is() && mxModel.is())
+ mxModel->removeEventListener(mxEventListener);
+}
+
+// XUnoTunnel & co
+const uno::Sequence< sal_Int8 > & SvXMLImport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+SvXMLImport* SvXMLImport::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
+ if( xUT.is() )
+ {
+ return
+ reinterpret_cast<SvXMLImport*>(
+ sal::static_int_cast<sal_IntPtr>(
+ xUT->getSomething( SvXMLImport::getUnoTunnelId())));
+ }
+ else
+ return NULL;
+}
+
+// XUnoTunnel
+sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw( uno::RuntimeException )
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ return 0;
+}
+
+void SAL_CALL SvXMLImport::startDocument( void )
+ throw( xml::sax::SAXException, uno::RuntimeException )
+{
+ RTL_LOGFILE_TRACE_AUTHOR( "xmloff", LOGFILE_AUTHOR, "{ SvXMLImport::startDocument" );
+
+ if( !mxGraphicResolver.is() || !mxEmbeddedResolver.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
+ if( xFactory.is() )
+ {
+ try
+ {
+ if( !mxGraphicResolver.is() )
+ {
+ mxGraphicResolver = Reference< XGraphicObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ // #99870# Import... instead of Export...
+ "com.sun.star.document.ImportGraphicObjectResolver"))));
+ mpImpl->mbOwnGraphicResolver = mxGraphicResolver.is();
+ }
+
+ if( !mxEmbeddedResolver.is() )
+ {
+ mxEmbeddedResolver = Reference< XEmbeddedObjectResolver >::query(
+ xFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
+ // #99870# Import... instead of Export...
+ "com.sun.star.document.ImportEmbeddedObjectResolver"))));
+ mpImpl->mbOwnEmbeddedResolver = mxEmbeddedResolver.is();
+ }
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+}
+
+void SAL_CALL SvXMLImport::endDocument( void )
+ throw( xml::sax::SAXException, uno::RuntimeException)
+{
+ RTL_LOGFILE_TRACE_AUTHOR( "xmloff", LOGFILE_AUTHOR, "} SvXMLImport::startDocument" );
+
+ // #i9518# All the stuff that accesses the document has to be done here, not in the dtor,
+ // because the SvXMLImport dtor might not be called until after the document has been closed.
+
+ if (mpImpl->mpRDFaHelper.get())
+ {
+ const uno::Reference<rdf::XRepositorySupplier> xRS(mxModel,
+ uno::UNO_QUERY);
+ if (xRS.is())
+ {
+ mpImpl->mpRDFaHelper->InsertRDFa( xRS );
+ }
+ }
+
+ if (mpNumImport)
+ {
+ delete mpNumImport;
+ mpNumImport = NULL;
+ }
+ if (mxImportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ if (mpProgressBarHelper)
+ {
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent))
+ {
+ sal_Int32 nProgressMax(mpProgressBarHelper->GetReference());
+ sal_Int32 nProgressCurrent(mpProgressBarHelper->GetValue());
+ uno::Any aAny;
+ aAny <<= nProgressMax;
+ mxImportInfo->setPropertyValue(sProgressMax, aAny);
+ aAny <<= nProgressCurrent;
+ mxImportInfo->setPropertyValue(sProgressCurrent, aAny);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ mxImportInfo->setPropertyValue(sRepeat, cppu::bool2any(mpProgressBarHelper->GetRepeat()));
+ // pProgressBarHelper is deleted in dtor
+ }
+ OUString sNumberStyles(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES));
+ if (mxNumberStyles.is() && xPropertySetInfo->hasPropertyByName(sNumberStyles))
+ {
+ uno::Any aAny;
+ aAny <<= mxNumberStyles;
+ mxImportInfo->setPropertyValue(sNumberStyles, aAny);
+ }
+ }
+ }
+
+ if( mxFontDecls.Is() )
+ ((SvXMLStylesContext *)&mxFontDecls)->Clear();
+ if( mxStyles.Is() )
+ ((SvXMLStylesContext *)&mxStyles)->Clear();
+ if( mxAutoStyles.Is() )
+ ((SvXMLStylesContext *)&mxAutoStyles)->Clear();
+ if( mxMasterStyles.Is() )
+ ((SvXMLStylesContext *)&mxMasterStyles)->Clear();
+
+ // possible form-layer related knittings which can only be done when
+ // the whole document exists
+ if ( mxFormImport.is() )
+ mxFormImport->documentDone();
+
+ // The shape import helper does the z-order sorting in the dtor,
+ // so it must be deleted here, too.
+ mxShapeImport = NULL;
+
+ if( mpImpl->mbOwnGraphicResolver )
+ {
+ Reference< lang::XComponent > xComp( mxGraphicResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+
+ if( mpImpl->mbOwnEmbeddedResolver )
+ {
+ Reference< lang::XComponent > xComp( mxEmbeddedResolver, UNO_QUERY );
+ xComp->dispose();
+ }
+ if( mpStyleMap )
+ {
+ mpStyleMap->release();
+ mpStyleMap = 0;
+ }
+
+ if ( mpXMLErrors != NULL )
+ {
+ mpXMLErrors->ThrowErrorAsSAXException( XMLERROR_FLAG_SEVERE );
+ }
+}
+
+void SAL_CALL SvXMLImport::startElement( const OUString& rName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ SvXMLNamespaceMap *pRewindMap = 0;
+
+ // Process namespace attributes. This must happen before creating the
+ // context, because namespace decaration apply to the element name itself.
+ INT16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( INT16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ if ( rAttrName.equalsAscii("office:version") )
+ {
+ mpImpl->aODFVersion = xAttrList->getValueByIndex( i );
+
+ // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
+ if ( mpImpl->mStreamName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ) )
+ && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
+ {
+ throw xml::sax::SAXException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "Inconsistent ODF versions in content.xml and manifest.xml!" ) ),
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny(
+ packages::zip::ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Inconsistent ODF versions in content.xml and manifest.xml!" ) ),
+ Reference< XInterface >() ) ) );
+ }
+ }
+ else if( ( rAttrName.getLength() >= 5 ) &&
+ ( rAttrName.compareTo( GetXMLToken(XML_XMLNS), 5 ) == 0 ) &&
+ ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) )
+ {
+ if( !pRewindMap )
+ {
+ pRewindMap = mpNamespaceMap;
+ mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
+ }
+ const OUString& rAttrValue = xAttrList->getValueByIndex( i );
+
+ OUString aPrefix( ( rAttrName.getLength() == 5 )
+ ? OUString()
+ : rAttrName.copy( 6 ) );
+ // Add namespace, but only if it is known.
+ sal_uInt16 nKey = mpNamespaceMap->AddIfKnown( aPrefix, rAttrValue );
+ // If namespace is unknwon, try to match a name with similar
+ // TC Id an version
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ {
+ OUString aTestName( rAttrValue );
+ if( SvXMLNamespaceMap::NormalizeURI( aTestName ) )
+ nKey = mpNamespaceMap->AddIfKnown( aPrefix, aTestName );
+ }
+ // If that namespace is not known, too, add it as unknown
+ if( XML_NAMESPACE_UNKNOWN == nKey )
+ mpNamespaceMap->Add( aPrefix, rAttrValue );
+
+ }
+ }
+
+ // Get element's namespace and local name.
+ OUString aLocalName;
+ USHORT nPrefix =
+ mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+
+ // If there are contexts already, call a CreateChildContext at the topmost
+ // context. Otherwise, create a default context.
+ SvXMLImportContext *pContext;
+ USHORT nCount = mpContexts->Count();
+ if( nCount > 0 )
+ {
+ pContext = (*mpContexts)[nCount - 1]->CreateChildContext( nPrefix,
+ aLocalName,
+ xAttrList );
+ DBG_ASSERT( pContext && pContext->GetPrefix() == nPrefix,
+ "SvXMLImport::startElement: created context has wrong prefix" );
+ }
+ else
+ {
+#ifdef TIMELOG
+ // If we do profiling, we want a trace message for the first element
+ // in order to identify the stream.
+ ByteString aString( (String)rName, RTL_TEXTENCODING_ASCII_US );
+ RTL_LOGFILE_TRACE_AUTHOR1( "xmloff", LOGFILE_AUTHOR,
+ "SvXMLImport::StartElement( \"%s\", ... )",
+ aString.GetBuffer() );
+#endif
+
+ pContext = CreateContext( nPrefix, aLocalName, xAttrList );
+ if( (nPrefix & XML_NAMESPACE_UNKNOWN_FLAG) != 0 &&
+ IS_TYPE( SvXMLImportContext, pContext ) )
+ {
+ OUString aMsg( RTL_CONSTASCII_USTRINGPARAM( "Root element unknown" ) );
+ Reference<xml::sax::XLocator> xDummyLocator;
+ Sequence < OUString > aParams(1);
+ aParams.getArray()[0] = rName;
+
+ SetError( XMLERROR_FLAG_SEVERE|XMLERROR_UNKNWON_ROOT,
+ aParams, aMsg, xDummyLocator );
+ }
+ }
+
+ DBG_ASSERT( pContext, "SvXMLImport::startElement: missing context" );
+ if( !pContext )
+ pContext = new SvXMLImportContext( *this, nPrefix, aLocalName );
+
+ pContext->AddRef();
+
+ // Remeber old namespace map.
+ if( pRewindMap )
+ pContext->SetRewindMap( pRewindMap );
+
+ // Call a startElement at the new context.
+ pContext->StartElement( xAttrList );
+
+ // Push context on stack.
+ mpContexts->Insert( pContext, nCount );
+}
+
+void SAL_CALL SvXMLImport::endElement( const OUString&
+#ifdef DBG_UTIL
+rName
+#endif
+)
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ USHORT nCount = mpContexts->Count();
+ DBG_ASSERT( nCount, "SvXMLImport::endElement: no context left" );
+ if( nCount > 0 )
+ {
+ // Get topmost context and remove it from the stack.
+ SvXMLImportContext *pContext = (*mpContexts)[nCount-1];
+ mpContexts->Remove( nCount-1, 1 );
+
+#ifdef DBG_UTIL
+ // Non product only: check if endElement call matches startELement call.
+ OUString aLocalName;
+ USHORT nPrefix =
+ mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
+ DBG_ASSERT( pContext->GetPrefix() == nPrefix,
+ "SvXMLImport::endElement: popped context has wrong prefix" );
+ DBG_ASSERT( pContext->GetLocalName() == aLocalName,
+ "SvXMLImport::endElement: popped context has wrong lname" );
+#endif
+
+ // Call a EndElement at the current context.
+ pContext->EndElement();
+
+ // Get a namespace map to rewind.
+ SvXMLNamespaceMap *pRewindMap = pContext->GetRewindMap();
+
+ // Delete the current context.
+ pContext->ReleaseRef();
+ pContext = 0;
+
+ // Rewind a namespace map.
+ if( pRewindMap )
+ {
+ delete mpNamespaceMap;
+ mpNamespaceMap = pRewindMap;
+ }
+ }
+}
+
+void SAL_CALL SvXMLImport::characters( const OUString& rChars )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ USHORT nCount = mpContexts->Count();
+ if( nCount > 0 )
+ {
+ (*mpContexts)[nCount - 1]->Characters( rChars );
+ }
+}
+
+void SAL_CALL SvXMLImport::ignorableWhitespace( const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::processingInstruction( const OUString&,
+ const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& rLocator )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ mxLocator = rLocator;
+}
+
+// XExtendedDocumentHandler
+void SAL_CALL SvXMLImport::startCDATA( void ) throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::endCDATA( void ) throw(uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::comment( const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::allowLineBreak( void )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvXMLImport::unknown( const OUString& )
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+}
+
+void SvXMLImport::SetStatistics(const uno::Sequence< beans::NamedValue> &)
+{
+ GetProgressBarHelper()->SetRepeat(sal_False);
+ GetProgressBarHelper()->SetReference(0);
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// XImporter
+void SAL_CALL SvXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
+ throw(lang::IllegalArgumentException, uno::RuntimeException)
+{
+ mxModel = uno::Reference< frame::XModel >::query( xDoc );
+ if( !mxModel.is() )
+ throw lang::IllegalArgumentException();
+ if (mxModel.is() && !mxEventListener.is())
+ {
+ mxEventListener.set(new SvXMLImportEventListener(this));
+ mxModel->addEventListener(mxEventListener);
+ }
+
+ DBG_ASSERT( !mpNumImport, "number format import already exists." );
+ if( mpNumImport )
+ {
+ delete mpNumImport;
+ mpNumImport = 0;
+ }
+}
+
+// XFilter
+sal_Bool SAL_CALL SvXMLImport::filter( const uno::Sequence< beans::PropertyValue >& )
+ throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SvXMLImport::cancel( )
+ throw (uno::RuntimeException)
+{
+}
+
+// XInitialize
+void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ const sal_Int32 nAnyCount = aArguments.getLength();
+ const uno::Any* pAny = aArguments.getConstArray();
+
+ for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
+ {
+ Reference<XInterface> xValue;
+ *pAny >>= xValue;
+
+ uno::Reference<task::XStatusIndicator> xTmpStatusIndicator(
+ xValue, UNO_QUERY );
+ if( xTmpStatusIndicator.is() )
+ mxStatusIndicator = xTmpStatusIndicator;
+
+ uno::Reference<document::XGraphicObjectResolver> xTmpGraphicResolver(
+ xValue, UNO_QUERY );
+ if( xTmpGraphicResolver.is() )
+ mxGraphicResolver = xTmpGraphicResolver;
+
+ uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver(
+ xValue, UNO_QUERY );
+ if( xTmpObjectResolver.is() )
+ mxEmbeddedResolver = xTmpObjectResolver;
+
+ uno::Reference<beans::XPropertySet> xTmpPropSet( xValue, UNO_QUERY );
+ if( xTmpPropSet.is() )
+ {
+ mxImportInfo = xTmpPropSet;
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sPropName(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sPropName))
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= mxNumberStyles;
+ }
+
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("PrivateData" ) );
+ if (xPropertySetInfo->hasPropertyByName(sPropName))
+ {
+ Reference < XInterface > xIfc;
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= xIfc;
+
+ StyleMap *pSMap = StyleMap::getImplementation( xIfc );
+ if( pSMap )
+ {
+ mpStyleMap = pSMap;
+ mpStyleMap->acquire();
+ }
+ }
+ OUString sBaseURI;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("BaseURI" ) );
+ if (xPropertySetInfo->hasPropertyByName(sPropName))
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= sBaseURI;
+ mpImpl->aBaseURL.SetURL( sBaseURI );
+ mpImpl->aDocBase.SetURL( sBaseURI );
+ }
+ OUString sRelPath;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamRelPath" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= sRelPath;
+ }
+ OUString sName;
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("StreamName" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= sName;
+ }
+ if( sBaseURI.getLength() && sName.getLength() )
+ {
+ if( sRelPath.getLength() )
+ mpImpl->aBaseURL.insertName( sRelPath );
+ mpImpl->aBaseURL.insertName( sName );
+ }
+ mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
+ // --> OD 2004-08-10 #i28749# - retrieve property <ShapePositionInHoriL2R>
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("ShapePositionInHoriL2R" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= (mpImpl->mbShapePositionInHoriL2R);
+ }
+ // <--
+ // --> OD 2007-12-19 #152540#
+ sPropName = OUString( RTL_CONSTASCII_USTRINGPARAM("TextDocInOOoFileFormat" ) );
+ if( xPropertySetInfo->hasPropertyByName(sPropName) )
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
+ aAny >>= (mpImpl->mbTextDocInOOoFileFormat);
+ }
+ // <--
+ }
+ }
+ }
+}
+
+// XServiceInfo
+OUString SAL_CALL SvXMLImport::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ OUString aStr;
+ return aStr;
+}
+
+sal_Bool SAL_CALL SvXMLImport::supportsService( const OUString& rServiceName )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return
+ rServiceName.equalsAsciiL(
+ "com.sun.star.document.ImportFilter",
+ sizeof("com.sun.star.document.ImportFilter")-1 ) ||
+ rServiceName.equalsAsciiL(
+ "com.sun.star.xml.XMLImportFilter",
+ sizeof("com.sun.star.xml.XMLImportFilter")-1);
+}
+
+uno::Sequence< OUString > SAL_CALL SvXMLImport::getSupportedServiceNames( )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<OUString> aSeq(2);
+ aSeq[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportFilter"));
+ aSeq[1] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter"));
+ return aSeq;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+XMLTextImportHelper* SvXMLImport::CreateTextImport()
+{
+ return new XMLTextImportHelper( mxModel, *this );
+}
+
+XMLShapeImportHelper* SvXMLImport::CreateShapeImport()
+{
+ return new XMLShapeImportHelper( *this, mxModel );
+}
+
+#ifndef SVX_LIGHT
+SchXMLImportHelper* SvXMLImport::CreateChartImport()
+{
+ return new SchXMLImportHelper();
+}
+#endif
+
+#ifndef SVX_LIGHT
+::xmloff::OFormLayerXMLImport* SvXMLImport::CreateFormImport()
+{
+ return new ::xmloff::OFormLayerXMLImport(*this);
+}
+#endif // #ifndef SVX_LIGHT
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Get or create fill/line/lineend-style-helper
+//
+
+const Reference< container::XNameContainer > & SvXMLImport::GetGradientHelper()
+{
+ if( !mxGradientHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxGradientHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxGradientHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetHatchHelper()
+{
+ if( !mxHatchHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxHatchHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxHatchHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetBitmapHelper()
+{
+ if( !mxBitmapHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxBitmapHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxBitmapHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetTransGradientHelper()
+{
+ if( !mxTransGradientHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxTransGradientHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TransparencyGradientTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxTransGradientHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetMarkerHelper()
+{
+ if( !mxMarkerHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxMarkerHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MarkerTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxMarkerHelper;
+}
+
+const Reference< container::XNameContainer > & SvXMLImport::GetDashHelper()
+{
+ if( !mxDashHelper.is() )
+ {
+ if( mxModel.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
+ if( xServiceFact.is() )
+ {
+ try
+ {
+ mxDashHelper = Reference< container::XNameContainer >( xServiceFact->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) ) ), UNO_QUERY);
+ }
+ catch( lang::ServiceNotRegisteredException& )
+ {}
+ }
+ }
+ }
+
+ return mxDashHelper;
+}
+
+sal_Bool SvXMLImport::IsPackageURL( const ::rtl::OUString& rURL ) const
+{
+
+ // if, and only if, only parts are imported, then we're in a package
+ const sal_uInt32 nTest = IMPORT_META|IMPORT_STYLES|IMPORT_CONTENT|IMPORT_SETTINGS;
+ if( (mnImportFlags & nTest) == nTest )
+ return sal_False;
+
+ // Some quick tests: Some may rely on the package structure!
+ sal_Int32 nLen = rURL.getLength();
+ if( (nLen > 0 && '/' == rURL[0]) )
+ // RFC2396 net_path or abs_path
+ return sal_False;
+ else if( nLen > 1 && '.' == rURL[0] )
+ {
+ if( '.' == rURL[1] )
+ // ../: We are never going up one level, so we know
+ // it's not an external URI
+ return sal_False;
+ else if( '/' == rURL[1] )
+ // we are remaining on a level, so it's an package URI
+ return sal_True;
+ }
+
+ // Now check for a RFC2396 schema
+ sal_Int32 nPos = 1;
+ while( nPos < nLen )
+ {
+ switch( rURL[nPos] )
+ {
+ case '/':
+ // a relative path segement
+ return sal_True;
+ case ':':
+ // a schema
+ return sal_False;
+ default:
+ break;
+ // we don't care about any other characters
+ }
+ ++nPos;
+ }
+
+ return sal_True;
+}
+
+::rtl::OUString SvXMLImport::ResolveGraphicObjectURL( const ::rtl::OUString& rURL,
+ sal_Bool bLoadOnDemand )
+{
+ ::rtl::OUString sRet;
+
+ if( IsPackageURL( rURL ) )
+ {
+ if( !bLoadOnDemand && mxGraphicResolver.is() )
+ {
+ ::rtl::OUString aTmp( msPackageProtocol );
+ aTmp += rURL;
+ sRet = mxGraphicResolver->resolveGraphicObjectURL( aTmp );
+ }
+
+ if( !sRet.getLength() )
+ {
+ sRet = msPackageProtocol;
+ sRet += rURL;
+ }
+ }
+
+ if( !sRet.getLength() )
+ sRet = GetAbsoluteReference( rURL );
+
+ return sRet;
+}
+
+Reference< XOutputStream > SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
+{
+ Reference< XOutputStream > xOStm;
+ Reference< document::XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
+
+ if( xStmResolver.is() )
+ xOStm = xStmResolver->createOutputStream();
+
+ return xOStm;
+}
+
+::rtl::OUString SvXMLImport::ResolveGraphicObjectURLFromBase64(
+ const Reference < XOutputStream >& rOut )
+{
+ OUString sURL;
+ Reference< document::XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
+ if( xStmResolver.is() )
+ sURL = xStmResolver->resolveOutputStream( rOut );
+
+ return sURL;
+}
+
+::rtl::OUString SvXMLImport::ResolveEmbeddedObjectURL(
+ const ::rtl::OUString& rURL,
+ const ::rtl::OUString& rClassId )
+{
+ ::rtl::OUString sRet;
+
+ if( IsPackageURL( rURL ) )
+ {
+ if ( mxEmbeddedResolver.is() )
+ {
+ OUString sURL( rURL );
+ if( rClassId.getLength() )
+ {
+ sURL += OUString( sal_Unicode('!') );
+ sURL += rClassId;
+ }
+ sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL( sURL );
+ }
+ }
+ else
+ sRet = GetAbsoluteReference( rURL );
+
+ return sRet;
+}
+
+Reference < XOutputStream >
+ SvXMLImport::GetStreamForEmbeddedObjectURLFromBase64()
+{
+ Reference < XOutputStream > xOLEStream;
+
+ if( mxEmbeddedResolver.is() )
+ {
+ Reference< XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
+ if( xNA.is() )
+ {
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "Obj12345678" ) );
+ Any aAny = xNA->getByName( aURL );
+ aAny >>= xOLEStream;
+ }
+ }
+
+ return xOLEStream;
+}
+
+::rtl::OUString SvXMLImport::ResolveEmbeddedObjectURLFromBase64()
+{
+ ::rtl::OUString sRet;
+
+ if( mxEmbeddedResolver.is() )
+ {
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM( "Obj12345678" ) );
+ sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL( aURL );
+ }
+
+ return sRet;
+}
+
+void SvXMLImport::AddStyleDisplayName( sal_uInt16 nFamily,
+ const OUString& rName,
+ const OUString& rDisplayName )
+{
+ if( !mpStyleMap )
+ {
+ mpStyleMap = new StyleMap;
+ mpStyleMap->acquire();
+ if( mxImportInfo.is() )
+ {
+ OUString sPrivateData(
+ RTL_CONSTASCII_USTRINGPARAM("PrivateData" ) );
+ Reference< beans::XPropertySetInfo > xPropertySetInfo =
+ mxImportInfo->getPropertySetInfo();
+ if( xPropertySetInfo.is() &&
+ xPropertySetInfo->hasPropertyByName(sPrivateData) )
+ {
+ Reference < XInterface > xIfc(
+ static_cast< XUnoTunnel *>( mpStyleMap ) );
+ Any aAny;
+ aAny <<= xIfc;
+ mxImportInfo->setPropertyValue( sPrivateData, aAny );
+ }
+ }
+ }
+
+ StyleMap::key_type aKey( nFamily, rName );
+ StyleMap::value_type aValue( aKey, rDisplayName );
+ ::std::pair<StyleMap::iterator,bool> aRes( mpStyleMap->insert( aValue ) );
+ OSL_ENSURE( aRes.second, "duplicate style name" );
+
+}
+
+OUString SvXMLImport::GetStyleDisplayName( sal_uInt16 nFamily,
+ const OUString& rName ) const
+{
+ OUString sName( rName );
+ if( mpStyleMap && rName.getLength() )
+ {
+ StyleMap::key_type aKey( nFamily, rName );
+ StyleMap::const_iterator aIter = mpStyleMap->find( aKey );
+ if( aIter != mpStyleMap->end() )
+ sName = (*aIter).second;
+ }
+ return sName;
+}
+
+void SvXMLImport::SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&)
+{
+}
+
+void SvXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&)
+{
+}
+
+void SvXMLImport::SetDocumentSpecificSettings(const ::rtl::OUString& _rSettingsGroupName, const uno::Sequence<beans::PropertyValue>& _rSettings)
+{
+ (void)_rSettingsGroupName;
+ (void)_rSettings;
+}
+
+ProgressBarHelper* SvXMLImport::GetProgressBarHelper()
+{
+ if (!mpProgressBarHelper)
+ {
+ mpProgressBarHelper = new ProgressBarHelper(mxStatusIndicator, sal_False);
+
+ if (mxImportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sProgressRange(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSRANGE));
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ OUString sRepeat(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSREPEAT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent) &&
+ xPropertySetInfo->hasPropertyByName(sProgressRange))
+ {
+ uno::Any aAny;
+ sal_Int32 nProgressMax(0);
+ sal_Int32 nProgressCurrent(0);
+ sal_Int32 nProgressRange(0);
+ aAny = mxImportInfo->getPropertyValue(sProgressRange);
+ if (aAny >>= nProgressRange)
+ mpProgressBarHelper->SetRange(nProgressRange);
+ aAny = mxImportInfo->getPropertyValue(sProgressMax);
+ if (aAny >>= nProgressMax)
+ mpProgressBarHelper->SetReference(nProgressMax);
+ aAny = mxImportInfo->getPropertyValue(sProgressCurrent);
+ if (aAny >>= nProgressCurrent)
+ mpProgressBarHelper->SetValue(nProgressCurrent);
+ }
+ if (xPropertySetInfo->hasPropertyByName(sRepeat))
+ {
+ uno::Any aAny = mxImportInfo->getPropertyValue(sRepeat);
+ if (aAny.getValueType() == getBooleanCppuType())
+ mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
+ else {
+ DBG_ERRORFILE("why is it no boolean?");
+ }
+ }
+ }
+ }
+ }
+ return mpProgressBarHelper;
+}
+
+void SvXMLImport::AddNumberStyle(sal_Int32 nKey, const OUString& rName)
+{
+ if (!mxNumberStyles.is())
+ mxNumberStyles = uno::Reference< container::XNameContainer >( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
+ if (mxNumberStyles.is())
+ {
+ uno::Any aAny;
+ aAny <<= nKey;
+ try
+ {
+ mxNumberStyles->insertByName(rName, aAny);
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR("Numberformat could not be inserted");
+ }
+ }
+ else {
+ DBG_ERROR("not possible to create NameContainer");
+ }
+}
+
+XMLEventImportHelper& SvXMLImport::GetEventImport()
+{
+#ifndef SVX_LIGHT
+ if (!mpEventImportHelper)
+ {
+ // construct event helper and register StarBasic handler and standard
+ // event tables
+ mpEventImportHelper = new XMLEventImportHelper();
+ OUString sStarBasic(GetXMLToken(XML_STARBASIC));
+ mpEventImportHelper->RegisterFactory(sStarBasic,
+ new XMLStarBasicContextFactory());
+ OUString sScript(GetXMLToken(XML_SCRIPT));
+ mpEventImportHelper->RegisterFactory(sScript,
+ new XMLScriptContextFactory());
+ mpEventImportHelper->AddTranslationTable(aStandardEventTable);
+
+ // register StarBasic event handler with capitalized spelling
+ OUString sStarBasicCap(RTL_CONSTASCII_USTRINGPARAM("StarBasic"));
+ mpEventImportHelper->RegisterFactory(sStarBasicCap,
+ new XMLStarBasicContextFactory());
+ }
+#endif
+
+ return *mpEventImportHelper;
+}
+
+void SvXMLImport::SetFontDecls( XMLFontStylesContext *pFontDecls )
+{
+ mxFontDecls = pFontDecls;
+ GetTextImport()->SetFontDecls( pFontDecls );
+}
+
+void SvXMLImport::SetStyles( SvXMLStylesContext *pStyles )
+{
+ mxStyles = pStyles;
+}
+
+void SvXMLImport::SetAutoStyles( SvXMLStylesContext *pAutoStyles )
+{
+ if (pAutoStyles && mxNumberStyles.is() && (mnImportFlags & IMPORT_CONTENT) )
+ {
+ uno::Reference<xml::sax::XAttributeList> xAttrList;
+ uno::Sequence< ::rtl::OUString > aNames = mxNumberStyles->getElementNames();
+ sal_uInt32 nCount(aNames.getLength());
+ if (nCount)
+ {
+ const OUString* pNames = aNames.getConstArray();
+ if ( pNames )
+ {
+ SvXMLStyleContext* pContext;
+ uno::Any aAny;
+ sal_Int32 nKey(0);
+ for (sal_uInt32 i = 0; i < nCount; i++, pNames++)
+ {
+ aAny = mxNumberStyles->getByName(*pNames);
+ if (aAny >>= nKey)
+ {
+ pContext = new SvXMLNumFormatContext( *this, XML_NAMESPACE_NUMBER,
+ *pNames, xAttrList, nKey, *pAutoStyles );
+ pAutoStyles->AddStyle(*pContext);
+ }
+ }
+ }
+ }
+ }
+ mxAutoStyles = pAutoStyles;
+ GetTextImport()->SetAutoStyles( pAutoStyles );
+ GetShapeImport()->SetAutoStylesContext( pAutoStyles );
+#ifndef SVX_LIGHT
+ GetChartImport()->SetAutoStylesContext( pAutoStyles );
+ GetFormImport()->setAutoStyleContext( pAutoStyles );
+#endif
+}
+
+void SvXMLImport::SetMasterStyles( SvXMLStylesContext *pMasterStyles )
+{
+ mxMasterStyles = pMasterStyles;
+}
+
+XMLFontStylesContext *SvXMLImport::GetFontDecls()
+{
+ return (XMLFontStylesContext *)&mxFontDecls;
+}
+
+SvXMLStylesContext *SvXMLImport::GetStyles()
+{
+ return (SvXMLStylesContext *)&mxStyles;
+}
+
+SvXMLStylesContext *SvXMLImport::GetAutoStyles()
+{
+ return (SvXMLStylesContext *)&mxAutoStyles;
+}
+
+SvXMLStylesContext *SvXMLImport::GetMasterStyles()
+{
+ return (SvXMLStylesContext *)&mxMasterStyles;
+}
+
+const XMLFontStylesContext *SvXMLImport::GetFontDecls() const
+{
+ return (const XMLFontStylesContext *)&mxFontDecls;
+}
+
+const SvXMLStylesContext *SvXMLImport::GetStyles() const
+{
+ return (const SvXMLStylesContext *)&mxStyles;
+}
+
+const SvXMLStylesContext *SvXMLImport::GetAutoStyles() const
+{
+ return (const SvXMLStylesContext *)&mxAutoStyles;
+}
+
+const SvXMLStylesContext *SvXMLImport::GetMasterStyles() const
+{
+ return (const SvXMLStylesContext *)&mxMasterStyles;
+}
+
+OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue) const
+{
+ if( rValue.getLength() == 0 || rValue[0] == '#' )
+ return rValue;
+
+ INetURLObject aAbsURL;
+ if( mpImpl->aBaseURL.GetNewAbsURL( rValue, &aAbsURL ) )
+ return aAbsURL.GetMainURL( INetURLObject::DECODE_TO_IURI );
+ else
+ return rValue;
+}
+
+sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion )
+{
+ // the check returns sal_False only if the storage version could be retrieved
+ sal_Bool bResult = sal_True;
+
+ if ( aODFVersion.getLength() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
+ {
+ // check the consistency only for the ODF1.2 and later ( according to content.xml )
+ // manifest.xml might have no version, it should be checked here and the correct version should be set
+ try
+ {
+ uno::Reference< document::XStorageBasedDocument > xDoc( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< embed::XStorage > xStor = xDoc->getDocumentStorage();
+ uno::Reference< beans::XPropertySet > xStorProps( xStor, uno::UNO_QUERY_THROW );
+
+ // the check should be done only for OASIS format
+ ::rtl::OUString aMediaType;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ) ) >>= aMediaType;
+ if ( ::comphelper::OStorageHelper::GetXStorageFormat( xStor ) >= SOFFICE_FILEFORMAT_8 )
+ {
+ sal_Bool bRepairPackage = sal_False;
+ try
+ {
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ) )
+ >>= bRepairPackage;
+ } catch ( uno::Exception& )
+ {}
+
+ // check only if not in Repair mode
+ if ( !bRepairPackage )
+ {
+ ::rtl::OUString aStorVersion;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) )
+ >>= aStorVersion;
+
+ // if the storage version is set in manifest.xml, it must be the same as in content.xml
+ // if not, set it explicitly to be used further ( it will work even for readonly storage )
+ // This workaround is not nice, but I see no other way to handle it, since there are
+ // ODF1.2 documents without version in manifest.xml
+ if ( aStorVersion.getLength() )
+ bResult = aODFVersion.equals( aStorVersion );
+ else
+ xStorProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ),
+ uno::makeAny( aODFVersion ) );
+
+ if ( bResult )
+ {
+ sal_Bool bInconsistent = sal_False;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsInconsistent" ) ) )
+ >>= bInconsistent;
+ bResult = !bInconsistent;
+ }
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ return bResult;
+}
+
+void SvXMLImport::_CreateNumberFormatsSupplier()
+{
+ DBG_ASSERT( !mxNumberFormatsSupplier.is(),
+ "number formats supplier already exists!" );
+ if(mxModel.is())
+ mxNumberFormatsSupplier =
+ uno::Reference< util::XNumberFormatsSupplier> (mxModel, uno::UNO_QUERY);
+}
+
+
+void SvXMLImport::_CreateDataStylesImport()
+{
+ DBG_ASSERT( mpNumImport == NULL, "data styles import already exists!" );
+ uno::Reference<util::XNumberFormatsSupplier> xNum =
+ GetNumberFormatsSupplier();
+ if ( xNum.is() )
+ mpNumImport = new SvXMLNumFmtHelper(xNum, getServiceFactory());
+}
+
+
+sal_Unicode SvXMLImport::ConvStarBatsCharToStarSymbol( sal_Unicode c )
+{
+ sal_Unicode cNew = c;
+ if( !mpImpl->hBatsFontConv )
+ {
+ OUString sStarBats( RTL_CONSTASCII_USTRINGPARAM( "StarBats" ) );
+ mpImpl->hBatsFontConv = CreateFontToSubsFontConverter( sStarBats,
+ FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+ OSL_ENSURE( mpImpl->hBatsFontConv, "Got no symbol font converter" );
+ }
+ if( mpImpl->hBatsFontConv )
+ {
+ cNew = ConvertFontToSubsFontChar( mpImpl->hBatsFontConv, c );
+ }
+
+ return cNew;
+}
+
+sal_Unicode SvXMLImport::ConvStarMathCharToStarSymbol( sal_Unicode c )
+{
+ sal_Unicode cNew = c;
+ if( !mpImpl->hMathFontConv )
+ {
+ OUString sStarMath( RTL_CONSTASCII_USTRINGPARAM( "StarMath" ) );
+ mpImpl->hMathFontConv = CreateFontToSubsFontConverter( sStarMath,
+ FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+ OSL_ENSURE( mpImpl->hMathFontConv, "Got no symbol font converter" );
+ }
+ if( mpImpl->hMathFontConv )
+ {
+ cNew = ConvertFontToSubsFontChar( mpImpl->hMathFontConv, c );
+ }
+
+ return cNew;
+}
+
+
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams,
+ const OUString& rExceptionMessage,
+ const Reference<xml::sax::XLocator>& rLocator )
+{
+ // maintain error flags
+ if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )
+ mnErrorFlags |= ERROR_ERROR_OCCURED;
+ if ( ( nId & XMLERROR_FLAG_WARNING ) != 0 )
+ mnErrorFlags |= ERROR_WARNING_OCCURED;
+ if ( ( nId & XMLERROR_FLAG_SEVERE ) != 0 )
+ mnErrorFlags |= ERROR_DO_NOTHING;
+
+ // create error list on demand
+ if ( mpXMLErrors == NULL )
+ mpXMLErrors = new XMLErrors();
+
+ // save error information
+ // use document locator (if none supplied)
+ mpXMLErrors->AddRecord( nId, rMsgParams, rExceptionMessage,
+ rLocator.is() ? rLocator : mxLocator );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const Sequence<OUString>& rMsgParams)
+{
+ OUString sEmpty;
+ SetError( nId, rMsgParams, sEmpty, NULL );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId)
+{
+ Sequence<OUString> aSeq(0);
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1)
+{
+ Sequence<OUString> aSeq(1);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1,
+ const OUString& rMsg2)
+{
+ Sequence<OUString> aSeq(2);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ pSeq[1] = rMsg2;
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1,
+ const OUString& rMsg2,
+ const OUString& rMsg3)
+{
+ Sequence<OUString> aSeq(3);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ pSeq[1] = rMsg2;
+ pSeq[2] = rMsg3;
+ SetError( nId, aSeq );
+}
+
+void SvXMLImport::SetError(
+ sal_Int32 nId,
+ const OUString& rMsg1,
+ const OUString& rMsg2,
+ const OUString& rMsg3,
+ const OUString& rMsg4)
+{
+ Sequence<OUString> aSeq(4);
+ OUString* pSeq = aSeq.getArray();
+ pSeq[0] = rMsg1;
+ pSeq[1] = rMsg2;
+ pSeq[2] = rMsg3;
+ pSeq[3] = rMsg4;
+ SetError( nId, aSeq );
+}
+
+XMLErrors* SvXMLImport::GetErrors()
+{
+ return mpXMLErrors;
+}
+
+void SvXMLImport::DisposingModel()
+{
+ if( mxFontDecls.Is() )
+ ((SvXMLStylesContext *)&mxFontDecls)->Clear();
+ if( mxStyles.Is() )
+ ((SvXMLStylesContext *)&mxStyles)->Clear();
+ if( mxAutoStyles.Is() )
+ ((SvXMLStylesContext *)&mxAutoStyles)->Clear();
+ if( mxMasterStyles.Is() )
+ ((SvXMLStylesContext *)&mxMasterStyles)->Clear();
+
+ mxModel.set(0);
+ mxEventListener.set(NULL);
+}
+
+::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLImport::getInterfaceToIdentifierMapper()
+{
+ return mpImpl->maInterfaceToIdentifierMapper;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLImport::getServiceFactory()
+{
+ // #110680#
+ return mxServiceFactory;
+}
+
+uno::Reference< uno::XComponentContext >
+SvXMLImport::GetComponentContext() const
+{
+ return mpImpl->mxComponentContext;
+}
+
+String SvXMLImport::GetBaseURL() const
+{
+ return mpImpl->aBaseURL.GetMainURL( INetURLObject::NO_DECODE );
+}
+
+String SvXMLImport::GetDocumentBase() const
+{
+ return mpImpl->aDocBase.GetMainURL( INetURLObject::NO_DECODE );
+}
+
+::rtl::OUString SvXMLImport::GetStreamName() const
+{
+ return mpImpl->mStreamName;
+}
+
+// --> OD 2004-08-10 #i28749#
+sal_Bool SvXMLImport::IsShapePositionInHoriL2R() const
+{
+ return mpImpl->mbShapePositionInHoriL2R;
+}
+// <--
+
+// --> OD 2007-12-19 #152540#
+sal_Bool SvXMLImport::IsTextDocInOOoFileFormat() const
+{
+ return mpImpl->mbTextDocInOOoFileFormat;
+}
+
+// <--
+
+void SvXMLImport::initXForms()
+{
+ // dummy method; to be implemented by derived classes supporting XForms
+}
+
+bool SvXMLImport::getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const
+{
+ bool bRet = false;
+ if( mxImportInfo.is() ) try
+ {
+ const OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("BuildId"));
+ Reference< XPropertySetInfo > xSetInfo( mxImportInfo->getPropertySetInfo() );
+ if( xSetInfo.is() && xSetInfo->hasPropertyByName( aPropName ) )
+ {
+ OUString aBuildId;
+ mxImportInfo->getPropertyValue( aPropName ) >>= aBuildId;
+ if( aBuildId.getLength() )
+ {
+ sal_Int32 nIndex = aBuildId.indexOf('$');
+ if( nIndex != -1 )
+ {
+ rUPD = aBuildId.copy( 0, nIndex ).toInt32();
+ rBuild = aBuildId.copy( nIndex+1 ).toInt32();
+ bRet = true;
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ return bRet;
+}
+
+sal_uInt16 SvXMLImport::getGeneratorVersion() const
+{
+ sal_Int32 nUPD, nBuild;
+
+ if( getBuildIds( nUPD, nBuild ) )
+ {
+ if( nUPD == 680 )
+ return OOo_2x;
+
+ if( nUPD >= 640 && nUPD <= 645 )
+ return OOo_1x;
+ }
+
+ return OOo_Current;
+}
+
+bool SvXMLImport::isGraphicLoadOnDemandSupported() const
+{
+ return mbIsGraphicLoadOnDemandSupported;
+}
+
+::rtl::OUString SvXMLImport::GetODFVersion() const
+{
+ return mpImpl->aODFVersion;
+}
+
+// xml:id for RDF metadata
+void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
+ ::rtl::OUString const & i_rXmlId)
+{
+ if (i_rXmlId.getLength() > 0) {
+ try {
+ const uno::Reference<rdf::XMetadatable> xMeta(i_xIfc,
+ uno::UNO_QUERY);
+//FIXME: not yet
+// OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
+ if (xMeta.is()) {
+ const beans::StringPair mdref( GetStreamName(), i_rXmlId );
+ try {
+ xMeta->setMetadataReference(mdref);
+ } catch (lang::IllegalArgumentException &) {
+ // probably duplicate; ignore
+ OSL_TRACE("SvXMLImport::SetXmlId: cannot set xml:id");
+ }
+ }
+ } catch (uno::Exception &) {
+ OSL_ENSURE(false, "SvXMLImport::SetXmlId: exception?");
+ }
+ }
+}
+
+SAL_DLLPRIVATE ::xmloff::RDFaImportHelper &
+SvXMLImport::GetRDFaImportHelper()
+{
+ if (!mpImpl->mpRDFaHelper.get())
+ {
+ mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaImportHelper(*this) );
+ }
+ return *mpImpl->mpRDFaHelper;
+}
+
+void
+SvXMLImport::AddRDFa(uno::Reference<rdf::XMetadatable> i_xObject,
+ ::rtl::OUString const & i_rAbout,
+ ::rtl::OUString const & i_rProperty,
+ ::rtl::OUString const & i_rContent,
+ ::rtl::OUString const & i_rDatatype)
+{
+ // N.B.: we only get called if i_xObject had xhtml:about attribute
+ // (an empty attribute value is valid)
+ ::xmloff::RDFaImportHelper & rRDFaHelper( GetRDFaImportHelper() );
+ rRDFaHelper.ParseAndAddRDFa(i_xObject,
+ i_rAbout, i_rProperty, i_rContent, i_rDatatype);
+}
+
diff --git a/xmloff/source/core/xmltkmap.cxx b/xmloff/source/core/xmltkmap.cxx
new file mode 100644
index 000000000000..3d0bc0936e44
--- /dev/null
+++ b/xmloff/source/core/xmltkmap.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <svl/svarray.hxx>
+#include <xmloff/xmltkmap.hxx>
+#include <xmloff/xmltoken.hxx>
+
+using namespace rtl;
+using namespace ::xmloff::token;
+
+class SvXMLTokenMapEntry_Impl
+{
+ sal_uInt16 nPrefixKey;
+ OUString sLocalName;
+ sal_uInt16 nToken;
+
+public:
+
+ sal_uInt16 GetToken() const { return nToken; }
+
+ SvXMLTokenMapEntry_Impl( sal_uInt16 nPrefix, const OUString& rLName,
+ sal_uInt16 nTok=XML_TOK_UNKNOWN ) :
+ nPrefixKey( nPrefix ),
+ sLocalName( rLName ),
+ nToken( nTok )
+ {}
+
+ SvXMLTokenMapEntry_Impl( const SvXMLTokenMapEntry& rEntry ) :
+ nPrefixKey( rEntry.nPrefixKey ),
+ sLocalName( GetXMLToken( rEntry.eLocalName ) ),
+ nToken( rEntry.nToken )
+ {}
+
+ BOOL operator==( const SvXMLTokenMapEntry_Impl& r ) const
+ {
+ return nPrefixKey == r.nPrefixKey &&
+ sLocalName == r.sLocalName;
+ }
+
+ BOOL operator<( const SvXMLTokenMapEntry_Impl& r ) const
+ {
+ return nPrefixKey < r.nPrefixKey ||
+ ( nPrefixKey == r.nPrefixKey &&
+ sLocalName < r.sLocalName);
+ }
+};
+
+typedef SvXMLTokenMapEntry_Impl *SvXMLTokenMapEntry_ImplPtr;
+SV_DECL_PTRARR_SORT_DEL( SvXMLTokenMap_Impl, SvXMLTokenMapEntry_ImplPtr, 5, 5 )
+SV_IMPL_OP_PTRARR_SORT( SvXMLTokenMap_Impl, SvXMLTokenMapEntry_ImplPtr )
+
+// ---------------------------------------------------------------------
+
+SvXMLTokenMapEntry_Impl *SvXMLTokenMap::_Find( sal_uInt16 nKeyPrefix,
+ const OUString& rLName ) const
+{
+ SvXMLTokenMapEntry_Impl *pRet = 0;
+ SvXMLTokenMapEntry_Impl aTst( nKeyPrefix, rLName );
+
+ sal_uInt16 nPos;
+ if( pImpl->Seek_Entry( &aTst, &nPos ) )
+ {
+ pRet = (*pImpl)[nPos];
+ }
+
+ return pRet;
+}
+
+SvXMLTokenMap::SvXMLTokenMap( const SvXMLTokenMapEntry *pMap ) :
+ pImpl( new SvXMLTokenMap_Impl )
+{
+ while( pMap->eLocalName != XML_TOKEN_INVALID )
+ {
+ pImpl->Insert( new SvXMLTokenMapEntry_Impl( *pMap ) );
+ pMap++;
+ }
+}
+
+SvXMLTokenMap::~SvXMLTokenMap()
+{
+ delete pImpl;
+}
+
+sal_uInt16 SvXMLTokenMap::Get( sal_uInt16 nKeyPrefix,
+ const OUString& rLName ) const
+{
+ SvXMLTokenMapEntry_Impl *pEntry = _Find( nKeyPrefix, rLName );
+ if( pEntry )
+ return pEntry->GetToken();
+ else
+ return XML_TOK_UNKNOWN;
+}
+
+
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
new file mode 100644
index 000000000000..6cfacbd93905
--- /dev/null
+++ b/xmloff/source/core/xmltoken.cxx
@@ -0,0 +1,3199 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <xmloff/xmltoken.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+
+using ::rtl::OUString;
+
+namespace xmloff { namespace token {
+
+ // keep the tokens (and their length)
+ namespace
+ {
+ struct XMLTokenEntry
+ {
+ sal_Int32 nLength;
+ const sal_Char* pChar;
+ ::rtl::OUString* pOUString;
+#if OSL_DEBUG_LEVEL > 0
+ XMLTokenEnum eToken;
+#endif
+ };
+ }
+
+
+
+
+#if OSL_DEBUG_LEVEL > 0
+ #define TOKEN( s, e ) { sizeof(s)-1, s, NULL, e }
+#else
+ #define TOKEN( s, e ) { sizeof(s)-1, s, NULL }
+#endif
+
+ struct XMLTokenEntry aTokenList[] =
+ {
+#if OSL_DEBUG_LEVEL > 0
+ { 0, NULL, NULL, XML_TOKEN_START },
+#else
+ { 0, NULL, NULL }, // XML_TOKEN_START
+#endif
+
+ // common XML
+ TOKEN( "CDATA", XML_CDATA ),
+ TOKEN( " ", XML_WS ),
+ TOKEN( "xml", XML_XML ),
+ TOKEN( "xmlns", XML_XMLNS ),
+ TOKEN( "version=\"1.0\" encoding=\"UTF-8\"", XML_XML_PI ),
+ TOKEN( "<!DOCTYPE ", XML_XML_DOCTYPE_PREFIX ),
+ TOKEN( " PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"office.dtd\">", XML_XML_DOCTYPE_SUFFIX ),
+
+ // namespace prefixes and names
+// TOKEN( "xml", XML_NP_XML ),
+ TOKEN( "http://www.w3.org/XML/1998/namespace", XML_N_XML ),
+ TOKEN( "office", XML_NP_OFFICE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:office:1.0", XML_N_OFFICE ),
+ TOKEN( "http://sun.com/xmlns/staroffice/office", XML_N_OFFICE_OLD ),
+ TOKEN( "meta", XML_NP_META ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", XML_N_META ),
+ TOKEN( "http://sun.com/xmlns/staroffice/meta", XML_N_META_OLD ),
+ TOKEN( "style", XML_NP_STYLE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:style:1.0", XML_N_STYLE ),
+ TOKEN( "http://sun.com/xmlns/staroffice/style", XML_N_STYLE_OLD ),
+ TOKEN( "number", XML_NP_NUMBER ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0", XML_N_NUMBER ),
+ TOKEN( "http://sun.com/xmlns/staroffice/number", XML_N_NUMBER_OLD ),
+ TOKEN( "text", XML_NP_TEXT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:text:1.0", XML_N_TEXT ),
+ TOKEN( "http://sun.com/xmlns/staroffice/text", XML_N_TEXT_OLD ),
+ TOKEN( "table", XML_NP_TABLE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:table:1.0", XML_N_TABLE ),
+ TOKEN( "http://sun.com/xmlns/staroffice/table", XML_N_TABLE_OLD ),
+ TOKEN( "draw", XML_NP_DRAW ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0", XML_N_DRAW ),
+ TOKEN( "dr3d", XML_NP_DR3D ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0", XML_N_DR3D ),
+ TOKEN( "http://sun.com/xmlns/staroffice/draw", XML_N_DRAW_OLD ),
+ TOKEN( "presentation", XML_NP_PRESENTATION ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0", XML_N_PRESENTATION ),
+ TOKEN( "http://sun.com/xmlns/staroffice/presentation", XML_N_PRESENTATION_OLD ),
+ TOKEN( "chart", XML_NP_CHART ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:chart:1.0", XML_N_CHART ),
+ TOKEN( "config", XML_NP_CONFIG ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:config:1.0", XML_N_CONFIG ),
+ TOKEN( "http://sun.com/xmlns/staroffice/chart", XML_N_CHART_OLD ),
+ TOKEN( "fo", XML_NP_FO ),
+ TOKEN( "http://www.w3.org/1999/XSL/Format/", XML_N_FO_OLD ),
+ TOKEN( "http://www.w3.org/1999/XSL/Format", XML_N_FO ),
+ TOKEN( "xlink", XML_NP_XLINK ),
+ TOKEN( "http://www.w3.org/1999/xlink", XML_N_XLINK ),
+ TOKEN( "http://www.w3.org/1999/xlink/namespace", XML_N_XLINK_OLD ),
+ TOKEN( "dc", XML_NP_DC ),
+ TOKEN( "http://purl.org/dc/elements/1.1/", XML_N_DC ),
+ TOKEN( "svg", XML_NP_SVG ),
+ TOKEN( "http://www.w3.org/2000/svg", XML_N_SVG ),
+ TOKEN( "form", XML_NP_FORM ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:form:1.0", XML_N_FORM ),
+ TOKEN( "script", XML_NP_SCRIPT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:script:1.0", XML_N_SCRIPT ),
+ TOKEN( "xforms", XML_NP_XFORMS_1_0 ),
+ TOKEN( "http://www.w3.org/2002/xforms", XML_N_XFORMS_1_0 ),
+ TOKEN( "xsd", XML_NP_XSD ),
+ TOKEN( "http://www.w3.org/2001/XMLSchema", XML_N_XSD ),
+ TOKEN( "xsi", XML_NP_XSI ),
+ TOKEN( "http://www.w3.org/2001/XMLSchema-instance", XML_N_XSI ),
+
+ TOKEN( "block-list", XML_NP_BLOCK_LIST ),
+ TOKEN( "http://openoffice.org/2001/block-list", XML_N_BLOCK_LIST ),
+
+ TOKEN( "math", XML_NP_MATH ),
+ TOKEN( "http://www.w3.org/1998/Math/MathML", XML_N_MATH ),
+
+ TOKEN( "VL", XML_NP_VERSIONS_LIST ),
+ TOKEN( "http://openoffice.org/2001/versions-list", XML_N_VERSIONS_LIST ),
+
+ // erAck: 2008-04-09T20:12+0200 OpenFormula aka ODFF
+ TOKEN( "of", XML_NP_OF ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:of:1.2", XML_N_OF ),
+
+ // ODF 1.2 metadata: RDFa and GRDDL
+ TOKEN( "xhtml", XML_NP_XHTML ),
+ TOKEN( "http://www.w3.org/1999/xhtml", XML_N_XHTML ),
+ TOKEN( "grddl", XML_NP_GRDDL ),
+ TOKEN( "http://www.w3.org/2003/g/data-view#", XML_N_GRDDL ),
+
+ // ODF Enhanced namespaces
+ TOKEN( "officeooo", XML_NP_OFFICE_EXT ),
+ TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ),
+
+ TOKEN( "tableooo", XML_NP_TABLE_EXT ),
+ TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ),
+
+ TOKEN( "drawooo", XML_NP_DRAW_EXT ),
+ TOKEN( "http://openoffice.org/2010/draw", XML_N_DRAW_EXT ),
+
+ // units
+ TOKEN( "mm", XML_UNIT_MM ),
+ TOKEN( "m", XML_UNIT_M ),
+ TOKEN( "km", XML_UNIT_KM ),
+ TOKEN( "cm", XML_UNIT_CM ),
+ TOKEN( "pt", XML_UNIT_PT ),
+ TOKEN( "pc", XML_UNIT_PC ),
+ TOKEN( "ft", XML_UNIT_FOOT ),
+ TOKEN( "mi", XML_UNIT_MILES ),
+ TOKEN( "in", XML_UNIT_INCH ),
+
+ // any other
+ TOKEN( "1", XML_1 ),
+ TOKEN( "10", XML_10 ),
+ TOKEN( "2", XML_2 ),
+ TOKEN( "3", XML_3 ),
+ TOKEN( "4", XML_4 ),
+ TOKEN( "5", XML_5 ),
+ TOKEN( "6", XML_6 ),
+ TOKEN( "7", XML_7 ),
+ TOKEN( "8", XML_8 ),
+ TOKEN( "9", XML_9 ),
+ TOKEN( "A", XML_A_UPCASE ),
+ TOKEN( "I", XML_I_UPCASE ),
+ TOKEN( "IBM437", XML_IBM437 ),
+ TOKEN( "IBM850", XML_IBM850 ),
+ TOKEN( "IBM860", XML_IBM860 ),
+ TOKEN( "IBM861", XML_IBM861 ),
+ TOKEN( "IBM863", XML_IBM863 ),
+ TOKEN( "IBM865", XML_IBM865 ),
+ TOKEN( "ISO-8859-1", XML_ISO_8859_1 ),
+ TOKEN( "ole2", XML_OLE2 ),
+ TOKEN( ":", XML__COLON ),
+ TOKEN( "", XML__EMPTY ),
+ TOKEN( "_unknown_", XML__UNKNOWN_ ),
+
+ TOKEN( "a", XML_A ),
+ TOKEN( "abbreviated-name", XML_ABBREVIATED_NAME ),
+ TOKEN( "above", XML_ABOVE ),
+ TOKEN( "abs", XML_ABS ),
+ TOKEN( "accent", XML_ACCENT ),
+ TOKEN( "accentunder", XML_ACCENTUNDER ),
+ TOKEN( "acceptance-state", XML_ACCEPTANCE_STATE ),
+ TOKEN( "accepted", XML_ACCEPTED ),
+ TOKEN( "action", XML_ACTION ),
+ TOKEN( "active", XML_ACTIVE ),
+ TOKEN( "active-split-range", XML_ACTIVE_SPLIT_RANGE ),
+ TOKEN( "active-table", XML_ACTIVE_TABLE ),
+ TOKEN( "actuate", XML_ACTUATE ),
+ TOKEN( "add-in", XML_ADD_IN ),
+ TOKEN( "add-in-name", XML_ADD_IN_NAME ),
+ TOKEN( "address", XML_ADDRESS ),
+ TOKEN( "adjustment", XML_ADJUSTMENT ),
+ TOKEN( "algorithm", XML_ALGORITHM ),
+ TOKEN( "align", XML_ALIGN ),
+ TOKEN( "all", XML_ALL ),
+ TOKEN( "allow-empty-cell", XML_ALLOW_EMPTY_CELL ),
+ TOKEN( "alphabetical-index", XML_ALPHABETICAL_INDEX ),
+ TOKEN( "alphabetical-index-auto-mark-file", XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE ),
+ TOKEN( "alphabetical-index-entry-template", XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "alphabetical-index-mark", XML_ALPHABETICAL_INDEX_MARK ),
+ TOKEN( "alphabetical-index-mark-end", XML_ALPHABETICAL_INDEX_MARK_END ),
+ TOKEN( "alphabetical-index-mark-start", XML_ALPHABETICAL_INDEX_MARK_START ),
+ TOKEN( "alphabetical-index-source", XML_ALPHABETICAL_INDEX_SOURCE ),
+ TOKEN( "alphabetical-separators", XML_ALPHABETICAL_SEPARATORS ),
+ TOKEN( "alternate", XML_ALTERNATE ),
+ TOKEN( "am-pm", XML_AM_PM ),
+ TOKEN( "ambient-color", XML_AMBIENT_COLOR ),
+ TOKEN( "anchor-page-number", XML_ANCHOR_PAGE_NUMBER ),
+ TOKEN( "anchor-type", XML_ANCHOR_TYPE ),
+ TOKEN( "and", XML_AND ),
+ TOKEN( "animation", XML_ANIMATION ),
+ TOKEN( "animation-delay", XML_ANIMATION_DELAY ),
+ TOKEN( "animation-direction", XML_ANIMATION_DIRECTION ),
+ TOKEN( "animation-repeat", XML_ANIMATION_REPEAT ),
+ TOKEN( "animation-start-inside", XML_ANIMATION_START_INSIDE ),
+ TOKEN( "animation-steps", XML_ANIMATION_STEPS ),
+ TOKEN( "animation-stop-inside", XML_ANIMATION_STOP_INSIDE ),
+ TOKEN( "animations", XML_ANIMATIONS ),
+ TOKEN( "annotation", XML_ANNOTATION ),
+ TOKEN( "annotations", XML_ANNOTATIONS ),
+ TOKEN( "annote", XML_ANNOTE ),
+ TOKEN( "appear", XML_APPEAR ),
+ TOKEN( "applet", XML_APPLET ),
+ TOKEN( "applet-name", XML_APPLET_NAME ),
+ TOKEN( "application-data", XML_APPLICATION_DATA ),
+ TOKEN( "application-xml", XML_APPLICATION_XML ),
+ TOKEN( "apply", XML_APPLY ),
+ TOKEN( "apply-style-name", XML_APPLY_STYLE_NAME ),
+ TOKEN( "aqua", XML_AQUA ),
+ TOKEN( "arc", XML_ARC ),
+ TOKEN( "arccos", XML_ARCCOS ),
+ TOKEN( "archive", XML_ARCHIVE ),
+ TOKEN( "arcsin", XML_ARCSIN ),
+ TOKEN( "arctan", XML_ARCTAN ),
+ TOKEN( "area", XML_AREA ),
+ TOKEN( "area-circle", XML_AREA_CIRCLE ),
+ TOKEN( "area-polygon", XML_AREA_POLYGON ),
+ TOKEN( "area-rectangle", XML_AREA_RECTANGLE ),
+ TOKEN( "article", XML_ARTICLE ),
+ TOKEN( "as-char", XML_AS_CHAR ),
+ TOKEN( "ascending", XML_ASCENDING ),
+ TOKEN( "attached-axis", XML_ATTACHED_AXIS ),
+ TOKEN( "attractive", XML_ATTRACTIVE ),
+ TOKEN( "author", XML_AUTHOR ),
+ TOKEN( "author-initials", XML_AUTHOR_INITIALS ),
+ TOKEN( "author-name", XML_AUTHOR_NAME ),
+ TOKEN( "auto", XML_AUTO ),
+ TOKEN( "auto-grow-height", XML_AUTO_GROW_HEIGHT ),
+ TOKEN( "auto-grow-width", XML_AUTO_GROW_WIDTH ),
+ TOKEN( "auto-reload", XML_AUTO_RELOAD ),
+ TOKEN( "auto-text", XML_AUTO_TEXT ),
+ TOKEN( "auto-text-events", XML_AUTO_TEXT_EVENTS ),
+ TOKEN( "auto-text-group", XML_AUTO_TEXT_GROUP ),
+ TOKEN( "auto-text-indent", XML_AUTO_TEXT_INDENT ),
+ TOKEN( "auto-update", XML_AUTO_UPDATE ),
+ TOKEN( "automatic", XML_AUTOMATIC ),
+ TOKEN( "automatic-find-labels", XML_AUTOMATIC_FIND_LABELS ),
+ TOKEN( "automatic-order", XML_AUTOMATIC_ORDER ),
+ TOKEN( "automatic-styles", XML_AUTOMATIC_STYLES ),
+ TOKEN( "automatic-update", XML_AUTOMATIC_UPDATE ),
+ TOKEN( "autosize", XML_AUTOSIZE ),
+ TOKEN( "average", XML_AVERAGE ),
+ TOKEN( "axis", XML_AXIS ),
+ TOKEN( "back-scale", XML_BACK_SCALE ),
+ TOKEN( "backface-culling", XML_BACKFACE_CULLING ),
+ TOKEN( "background", XML_BACKGROUND ),
+ TOKEN( "background-color", XML_BACKGROUND_COLOR ),
+ TOKEN( "background-image", XML_BACKGROUND_IMAGE ),
+ TOKEN( "no-repeat", XML_BACKGROUND_NO_REPEAT ),
+ TOKEN( "repeat", XML_BACKGROUND_REPEAT ),
+ TOKEN( "stretch", XML_BACKGROUND_STRETCH ),
+ TOKEN( "bar", XML_BAR ),
+ TOKEN( "base64Binary", XML_BASE64BINARY ),
+ TOKEN( "base-cell-address", XML_BASE_CELL_ADDRESS ),
+ TOKEN( "baseline", XML_BASELINE ),
+ TOKEN( "before-date-time", XML_BEFORE_DATE_TIME ),
+ TOKEN( "below", XML_BELOW ),
+ TOKEN( "between-date-times", XML_BETWEEN_DATE_TIMES ),
+ TOKEN( "bevel", XML_BEVEL ),
+ TOKEN( "bibiliographic-type", XML_BIBILIOGRAPHIC_TYPE ),
+ TOKEN( "bibliography", XML_BIBLIOGRAPHY ),
+ TOKEN( "bibliography-configuration", XML_BIBLIOGRAPHY_CONFIGURATION ),
+ TOKEN( "bibliography-data-field", XML_BIBLIOGRAPHY_DATA_FIELD ),
+ TOKEN( "bibliography-entry-template", XML_BIBLIOGRAPHY_ENTRY_TEMPLATE ),
+ TOKEN( "bibliography-mark", XML_BIBLIOGRAPHY_MARK ),
+ TOKEN( "bibliography-source", XML_BIBLIOGRAPHY_SOURCE ),
+ TOKEN( "bibliography-type", XML_BIBLIOGRAPHY_TYPE ),
+ TOKEN( "bind-styles-to-content", XML_BIND_STYLES_TO_CONTENT ),
+ TOKEN( "bitmap", XML_BITMAP ),
+ TOKEN( "black", XML_BLACK ),
+ TOKEN( "blend", XML_BLEND ),
+ TOKEN( "blinking", XML_BLINKING ),
+ TOKEN( "block", XML_BLOCK ),
+ TOKEN( "block-list", XML_BLOCK_LIST ),
+ TOKEN( "blue", XML_BLUE ),
+ TOKEN( "body", XML_BODY ),
+ TOKEN( "bold", XML_BOLD ),
+ TOKEN( "book", XML_BOOK ),
+ TOKEN( "booklet", XML_BOOKLET ),
+ TOKEN( "bookmark", XML_BOOKMARK ),
+ TOKEN( "bookmark-end", XML_BOOKMARK_END ),
+ TOKEN( "bookmark-ref", XML_BOOKMARK_REF ),
+ TOKEN( "bookmark-start", XML_BOOKMARK_START ),
+ TOKEN( "booktitle", XML_BOOKTITLE ),
+ TOKEN( "boolean", XML_BOOLEAN ),
+ TOKEN( "boolean-style", XML_BOOLEAN_STYLE ),
+ TOKEN( "boolean-value", XML_BOOLEAN_VALUE ),
+ TOKEN( "border", XML_BORDER ),
+ TOKEN( "border-bottom", XML_BORDER_BOTTOM ),
+ TOKEN( "border-color", XML_BORDER_COLOR ),
+ TOKEN( "border-left", XML_BORDER_LEFT ),
+ TOKEN( "border-line-width", XML_BORDER_LINE_WIDTH ),
+ TOKEN( "border-line-width-bottom", XML_BORDER_LINE_WIDTH_BOTTOM ),
+ TOKEN( "border-line-width-left", XML_BORDER_LINE_WIDTH_LEFT ),
+ TOKEN( "border-line-width-right", XML_BORDER_LINE_WIDTH_RIGHT ),
+ TOKEN( "border-line-width-top", XML_BORDER_LINE_WIDTH_TOP ),
+ TOKEN( "border-right", XML_BORDER_RIGHT ),
+ TOKEN( "border-top", XML_BORDER_TOP ),
+ TOKEN( "both", XML_BOTH ),
+ TOKEN( "bottom", XML_BOTTOM ),
+ TOKEN( "bottom-left", XML_BOTTOM_LEFT ),
+ TOKEN( "bottom percent", XML_BOTTOM_PERCENT ),
+ TOKEN( "bottom-right", XML_BOTTOM_RIGHT ),
+ TOKEN( "bottom values", XML_BOTTOM_VALUES ),
+ TOKEN( "bottom-arc", XML_BOTTOMARC ),
+ TOKEN( "bottom-circle", XML_BOTTOMCIRCLE ),
+ TOKEN( "break-after", XML_BREAK_AFTER ),
+ TOKEN( "break-before", XML_BREAK_BEFORE ),
+ TOKEN( "break-inside", XML_BREAK_INSIDE ),
+ TOKEN( "bubble", XML_BUBBLE ),
+ TOKEN( "bullet-char", XML_BULLET_CHAR ),
+ TOKEN( "bullet-relative-size", XML_BULLET_RELATIVE_SIZE ),
+ TOKEN( "button1", XML_BUTTON1 ),
+ TOKEN( "button2", XML_BUTTON2 ),
+ TOKEN( "button3", XML_BUTTON3 ),
+ TOKEN( "button4", XML_BUTTON4 ),
+ TOKEN( "buttons", XML_BUTTONS ),
+ TOKEN( "bvar", XML_BVAR ),
+ TOKEN( "c", XML_C ),
+ TOKEN( "calculation-settings", XML_CALCULATION_SETTINGS ),
+ TOKEN( "calendar", XML_CALENDAR ),
+ TOKEN( "capitalize-entries", XML_CAPITALIZE_ENTRIES ),
+ TOKEN( "caption", XML_CAPTION ),
+ TOKEN( "caption-point-x", XML_CAPTION_POINT_X ),
+ TOKEN( "caption-point-y", XML_CAPTION_POINT_Y ),
+ TOKEN( "caption-sequence-format", XML_CAPTION_SEQUENCE_FORMAT ),
+ TOKEN( "caption-sequence-name", XML_CAPTION_SEQUENCE_NAME ),
+ TOKEN( "case-sensitive", XML_CASE_SENSITIVE ),
+ TOKEN( "capitalize", XML_CASEMAP_CAPITALIZE ),
+ TOKEN( "lowercase", XML_CASEMAP_LOWERCASE ),
+ TOKEN( "normal", XML_CASEMAP_NORMAL ),
+ TOKEN( "small-caps", XML_CASEMAP_SMALL_CAPS ),
+ TOKEN( "uppercase", XML_CASEMAP_UPPERCASE ),
+ TOKEN( "categories", XML_CATEGORIES ),
+ TOKEN( "category", XML_CATEGORY ),
+ TOKEN( "category-and-value", XML_CATEGORY_AND_VALUE ),
+ TOKEN( "cell-address", XML_CELL_ADDRESS ),
+ TOKEN( "cell-content-change", XML_CELL_CONTENT_CHANGE ),
+ TOKEN( "cell-content-deletion", XML_CELL_CONTENT_DELETION ),
+ TOKEN( "cell-count", XML_CELL_COUNT ),
+ TOKEN( "cell-protect", XML_CELL_PROTECT ),
+ TOKEN( "cell-range-address", XML_CELL_RANGE_ADDRESS ),
+ TOKEN( "cell-range-address-list", XML_CELL_RANGE_ADDRESS_LIST ),
+ TOKEN( "cell-range-source", XML_CELL_RANGE_SOURCE ),
+ TOKEN( "center", XML_CENTER ),
+ TOKEN( "chain-next-name", XML_CHAIN_NEXT_NAME ),
+ TOKEN( "change", XML_CHANGE ),
+ TOKEN( "change-deletion", XML_CHANGE_DELETION ),
+ TOKEN( "change-end", XML_CHANGE_END ),
+ TOKEN( "change-id", XML_CHANGE_ID ),
+ TOKEN( "change-info", XML_CHANGE_INFO ),
+ TOKEN( "change-start", XML_CHANGE_START ),
+ TOKEN( "change-track-table-cell", XML_CHANGE_TRACK_TABLE_CELL ),
+ TOKEN( "change-view-conditions", XML_CHANGE_VIEW_CONDITIONS ),
+ TOKEN( "change-view-settings", XML_CHANGE_VIEW_SETTINGS ),
+ TOKEN( "changed-region", XML_CHANGED_REGION ),
+ TOKEN( "chapter", XML_CHAPTER ),
+ TOKEN( "char", XML_CHAR ),
+ TOKEN( "character-count", XML_CHARACTER_COUNT ),
+ TOKEN( "chart", XML_CHART ),
+ TOKEN( "charts", XML_CHARTS ),
+ TOKEN( "checkerboard", XML_CHECKERBOARD ),
+ TOKEN( "chg-author", XML_CHG_AUTHOR ),
+ TOKEN( "chg-comment", XML_CHG_COMMENT ),
+ TOKEN( "chg-date-time", XML_CHG_DATE_TIME ),
+ TOKEN( "ci", XML_CI ),
+ TOKEN( "circle", XML_CIRCLE ),
+ TOKEN( "citation-body-style-name", XML_CITATION_BODY_STYLE_NAME ),
+ TOKEN( "citation-style-name", XML_CITATION_STYLE_NAME ),
+ TOKEN( "class", XML_CLASS ),
+ TOKEN( "class-id", XML_CLASS_ID ),
+ TOKEN( "clip", XML_CLIP ),
+ TOKEN( "clockwise", XML_CLOCKWISE ),
+ TOKEN( "close", XML_CLOSE ),
+ TOKEN( "close-horizontal", XML_CLOSE_HORIZONTAL ),
+ TOKEN( "close-vertical", XML_CLOSE_VERTICAL ),
+ TOKEN( "cm", XML_CM ),
+ TOKEN( "cn", XML_CN ),
+ TOKEN( "code", XML_CODE ),
+ TOKEN( "codebase", XML_CODEBASE ),
+ TOKEN( "collapse", XML_COLLAPSE ),
+ TOKEN( "color", XML_COLOR ),
+ TOKEN( "color-inversion", XML_COLOR_INVERSION ),
+ TOKEN( "color-mode", XML_COLOR_MODE ),
+ TOKEN( "column", XML_COLUMN ),
+ TOKEN( "column-count", XML_COLUMN_COUNT ),
+ TOKEN( "column-gap", XML_COLUMN_GAP ),
+ TOKEN( "column-name", XML_COLUMN_NAME ),
+ TOKEN( "column-sep", XML_COLUMN_SEP ),
+ TOKEN( "column-width", XML_COLUMN_WIDTH ),
+ TOKEN( "columns", XML_COLUMNS ),
+ TOKEN( "auto", XML_COLUMNSPLIT_AUTO ),
+ TOKEN( "avoid", XML_COLUMNSPLIT_AVOID ),
+ TOKEN( "combine-entries", XML_COMBINE_ENTRIES ),
+ TOKEN( "combine-entries-with-dash", XML_COMBINE_ENTRIES_WITH_DASH ),
+ TOKEN( "combine-entries-with-pp", XML_COMBINE_ENTRIES_WITH_PP ),
+ TOKEN( "comma-separated", XML_COMMA_SEPARATED ),
+ TOKEN( "command", XML_COMMAND ),
+ TOKEN( "comment", XML_COMMENT ),
+ TOKEN( "compose", XML_COMPOSE ),
+ TOKEN( "cond-style-name", XML_COND_STYLE_NAME ),
+ TOKEN( "condition", XML_CONDITION ),
+ TOKEN( "condition-source", XML_CONDITION_SOURCE ),
+ TOKEN( "condition-source-range-address", XML_CONDITION_SOURCE_RANGE_ADDRESS ),
+ TOKEN( "conditional-text", XML_CONDITIONAL_TEXT ),
+ TOKEN( "cone", XML_CONE ),
+ TOKEN( "conference", XML_CONFERENCE ),
+ TOKEN( "config-item", XML_CONFIG_ITEM ),
+ TOKEN( "config-item-map-entry", XML_CONFIG_ITEM_MAP_ENTRY ),
+ TOKEN( "config-item-map-indexed", XML_CONFIG_ITEM_MAP_INDEXED ),
+ TOKEN( "config-item-map-named", XML_CONFIG_ITEM_MAP_NAMED ),
+ TOKEN( "config-item-set", XML_CONFIG_ITEM_SET ),
+ TOKEN( "configuration-settings", XML_CONFIGURATION_SETTINGS ),
+ TOKEN( "conjugate", XML_CONJUGATE ),
+ TOKEN( "connect-bars", XML_CONNECT_BARS ),
+ TOKEN( "connection-name", XML_CONNECTION_NAME ),
+ TOKEN( "connector", XML_CONNECTOR ),
+ TOKEN( "consecutive-numbering", XML_CONSECUTIVE_NUMBERING ),
+ TOKEN( "consolidation", XML_CONSOLIDATION ),
+ TOKEN( "constant", XML_CONSTANT ),
+ TOKEN( "contains-error", XML_CONTAINS_ERROR ),
+ TOKEN( "contains-header", XML_CONTAINS_HEADER ),
+ TOKEN( "content", XML_CONTENT ),
+ TOKEN( "content-validation", XML_CONTENT_VALIDATION ),
+ TOKEN( "content-validation-name", XML_CONTENT_VALIDATION_NAME ),
+ TOKEN( "content-validations", XML_CONTENT_VALIDATIONS ),
+ TOKEN( "continue", XML_CONTINUE ),
+ TOKEN( "continue-numbering", XML_CONTINUE_NUMBERING ),
+ TOKEN( "contour-path", XML_CONTOUR_PATH ),
+ TOKEN( "contour-polygon", XML_CONTOUR_POLYGON ),
+ TOKEN( "contrast", XML_CONTRAST ),
+ TOKEN( "control", XML_CONTROL ),
+ TOKEN( "conversion-mode", XML_CONVERSION_MODE ),
+ TOKEN( "copy-back", XML_COPY_BACK ),
+ TOKEN( "copy-formulas", XML_COPY_FORMULAS ),
+ TOKEN( "copy-outline-levels", XML_COPY_OUTLINE_LEVELS ),
+ TOKEN( "copy-results-only", XML_COPY_RESULTS_ONLY ),
+ TOKEN( "copy-styles", XML_COPY_STYLES ),
+ TOKEN( "corner-radius", XML_CORNER_RADIUS ),
+ TOKEN( "correct", XML_CORRECT ),
+ TOKEN( "cos", XML_COS ),
+ TOKEN( "cosh", XML_COSH ),
+ TOKEN( "cot", XML_COT ),
+ TOKEN( "coth", XML_COTH ),
+ TOKEN( "count", XML_COUNT ),
+ TOKEN( "count-empty-lines", XML_COUNT_EMPTY_LINES ),
+ TOKEN( "count-in-floating-frames", XML_COUNT_IN_FLOATING_FRAMES ),
+ TOKEN( "counter-clockwise", XML_COUNTER_CLOCKWISE ),
+ TOKEN( "counterclockwise", XML_COUNTERCLOCKWISE ),
+ TOKEN( "countnums", XML_COUNTNUMS ),
+ TOKEN( "country", XML_COUNTRY ),
+ TOKEN( "country-asian", XML_COUNTRY_ASIAN ),
+ TOKEN( "country-complex", XML_COUNTRY_COMPLEX ),
+ TOKEN( "covered-table-cell", XML_COVERED_TABLE_CELL ),
+ TOKEN( "create-date", XML_CREATE_DATE ),
+ TOKEN( "create-date-string", XML_CREATE_DATE_STRING ),
+ TOKEN( "creation-date", XML_CREATION_DATE ),
+ TOKEN( "creation-time", XML_CREATION_TIME ),
+ TOKEN( "creator", XML_CREATOR ),
+ TOKEN( "csc", XML_CSC ),
+ TOKEN( "csch", XML_CSCH ),
+ TOKEN( "cube", XML_CUBE ),
+ TOKEN( "cuboid", XML_CUBOID ),
+ TOKEN( "currency", XML_CURRENCY ),
+ TOKEN( "currency-style", XML_CURRENCY_STYLE ),
+ TOKEN( "currency-symbol", XML_CURRENCY_SYMBOL ),
+ TOKEN( "current", XML_CURRENT ),
+ TOKEN( "current-value", XML_CURRENT_VALUE ),
+ TOKEN( "cursor-position", XML_CURSOR_POSITION ),
+ TOKEN( "cursor-position-x", XML_CURSOR_POSITION_X ),
+ TOKEN( "cursor-position-y", XML_CURSOR_POSITION_Y ),
+ TOKEN( "curve", XML_CURVE ),
+ TOKEN( "custom1", XML_CUSTOM1 ),
+ TOKEN( "custom2", XML_CUSTOM2 ),
+ TOKEN( "custom3", XML_CUSTOM3 ),
+ TOKEN( "custom4", XML_CUSTOM4 ),
+ TOKEN( "custom5", XML_CUSTOM5 ),
+ TOKEN( "cut", XML_CUT ),
+ TOKEN( "cut-offs", XML_CUT_OFFS ),
+ TOKEN( "cx", XML_CX ),
+ TOKEN( "cy", XML_CY ),
+ TOKEN( "cylinder", XML_CYLINDER ),
+ TOKEN( "d", XML_D ),
+ TOKEN( "dash", XML_DASH ),
+ TOKEN( "dashed", XML_DASHED ),
+ TOKEN( "data", XML_DATA ),
+ TOKEN( "data-cell-range-address", XML_DATA_CELL_RANGE_ADDRESS ),
+ TOKEN( "data-label-number", XML_DATA_LABEL_NUMBER ),
+ TOKEN( "data-label-symbol", XML_DATA_LABEL_SYMBOL ),
+ TOKEN( "data-label-text", XML_DATA_LABEL_TEXT ),
+ TOKEN( "data-pilot-field", XML_DATA_PILOT_FIELD ),
+ TOKEN( "data-pilot-grand-total", XML_DATA_PILOT_GRAND_TOTAL ),
+ TOKEN( "data-pilot-level", XML_DATA_PILOT_LEVEL ),
+ TOKEN( "data-pilot-member", XML_DATA_PILOT_MEMBER ),
+ TOKEN( "data-pilot-members", XML_DATA_PILOT_MEMBERS ),
+ TOKEN( "data-pilot-subtotal", XML_DATA_PILOT_SUBTOTAL ),
+ TOKEN( "data-pilot-subtotals", XML_DATA_PILOT_SUBTOTALS ),
+ TOKEN( "data-pilot-table", XML_DATA_PILOT_TABLE ),
+ TOKEN( "data-pilot-tables", XML_DATA_PILOT_TABLES ),
+ TOKEN( "data-point", XML_DATA_POINT ),
+ TOKEN( "data-style", XML_DATA_STYLE ),
+ TOKEN( "data-style-name", XML_DATA_STYLE_NAME ),
+ TOKEN( "data-type", XML_DATA_TYPE ),
+ TOKEN( "database-display", XML_DATABASE_DISPLAY ),
+ TOKEN( "database-name", XML_DATABASE_NAME ),
+ TOKEN( "database-next", XML_DATABASE_NEXT ),
+ TOKEN( "database-range", XML_DATABASE_RANGE ),
+ TOKEN( "database-ranges", XML_DATABASE_RANGES ),
+ TOKEN( "database-row-number", XML_DATABASE_ROW_NUMBER ),
+ TOKEN( "database-select", XML_DATABASE_SELECT ),
+ TOKEN( "database-source-query", XML_DATABASE_SOURCE_QUERY ),
+ TOKEN( "database-source-sql", XML_DATABASE_SOURCE_SQL ),
+ TOKEN( "database-source-table", XML_DATABASE_SOURCE_TABLE ),
+ TOKEN( "date", XML_DATE ),
+ TOKEN( "date-adjust", XML_DATE_ADJUST ),
+ TOKEN( "date-style", XML_DATE_STYLE ),
+ TOKEN( "date-time", XML_DATE_TIME ),
+ TOKEN( "date-value", XML_DATE_VALUE ),
+ TOKEN( "datetime", XML_DATETIME ),
+ TOKEN( "day", XML_DAY ),
+ TOKEN( "day-of-week", XML_DAY_OF_WEEK ),
+ TOKEN( "dde-application", XML_DDE_APPLICATION ),
+ TOKEN( "dde-connection", XML_DDE_CONNECTION ),
+ TOKEN( "dde-connection-decl", XML_DDE_CONNECTION_DECL ),
+ TOKEN( "dde-connection-decls", XML_DDE_CONNECTION_DECLS ),
+ TOKEN( "dde-item", XML_DDE_ITEM ),
+ TOKEN( "dde-link", XML_DDE_LINK ),
+ TOKEN( "dde-links", XML_DDE_LINKS ),
+ TOKEN( "dde-source", XML_DDE_SOURCE ),
+ TOKEN( "dde-topic", XML_DDE_TOPIC ),
+ TOKEN( "decimal-places", XML_DECIMAL_PLACES ),
+ TOKEN( "decimal-replacement", XML_DECIMAL_REPLACEMENT ),
+ TOKEN( "declare", XML_DECLARE ),
+ TOKEN( "decorate-words-only", XML_DECORATE_WORDS_ONLY ),
+ TOKEN( "decorative", XML_DECORATIVE ),
+ TOKEN( "deep", XML_DEEP ),
+ TOKEN( "default", XML_DEFAULT ),
+ TOKEN( "default-cell-style-name", XML_DEFAULT_CELL_STYLE_NAME ),
+ TOKEN( "default-style", XML_DEFAULT_STYLE ),
+ TOKEN( "default-style-name", XML_DEFAULT_STYLE_NAME ),
+ TOKEN( "degree", XML_DEGREE ),
+ TOKEN( "delay", XML_DELAY ),
+ TOKEN( "deletion", XML_DELETION ),
+ TOKEN( "deletions", XML_DELETIONS ),
+ TOKEN( "dependence", XML_DEPENDENCE ),
+ TOKEN( "dependences", XML_DEPENDENCES ),
+ TOKEN( "dependencies", XML_DEPENDENCIES ),
+ TOKEN( "depth", XML_DEPTH ),
+ TOKEN( "desc", XML_DESC ),
+ TOKEN( "descending", XML_DESCENDING ),
+ TOKEN( "description", XML_DESCRIPTION ),
+ TOKEN( "detective", XML_DETECTIVE ),
+ TOKEN( "determinant", XML_DETERMINANT ),
+ TOKEN( "diff", XML_DIFF ),
+ TOKEN( "diffuse-color", XML_DIFFUSE_COLOR ),
+ TOKEN( "dim", XML_DIM ),
+ TOKEN( "direction", XML_DIRECTION ),
+ TOKEN( "disabled", XML_DISABLED ),
+ TOKEN( "disc", XML_DISC ),
+ TOKEN( "display", XML_DISPLAY ),
+ TOKEN( "display-border", XML_DISPLAY_BORDER ),
+ TOKEN( "display-details", XML_DISPLAY_DETAILS ),
+ TOKEN( "display-duplicates", XML_DISPLAY_DUPLICATES ),
+ TOKEN( "display-empty", XML_DISPLAY_EMPTY ),
+ TOKEN( "display-filter-buttons", XML_DISPLAY_FILTER_BUTTONS ),
+ TOKEN( "display-formula", XML_DISPLAY_FORMULA ),
+ TOKEN( "display-label", XML_DISPLAY_LABEL ),
+ TOKEN( "display-levels", XML_DISPLAY_LEVELS ),
+ TOKEN( "display-name", XML_DISPLAY_NAME ),
+ TOKEN( "display-outline-level", XML_DISPLAY_OUTLINE_LEVEL ),
+ TOKEN( "dissolve", XML_DISSOLVE ),
+ TOKEN( "distance", XML_DISTANCE ),
+ TOKEN( "distance-after-sep", XML_DISTANCE_AFTER_SEP ),
+ TOKEN( "distance-before-sep", XML_DISTANCE_BEFORE_SEP ),
+ TOKEN( "distribute-letter", XML_DISTRIBUTE_LETTER ),
+ TOKEN( "distribute-space", XML_DISTRIBUTE_SPACE ),
+ TOKEN( "divide", XML_DIVIDE ),
+ TOKEN( "document", XML_DOCUMENT ),
+ TOKEN( "document-content", XML_DOCUMENT_CONTENT ),
+ TOKEN( "document-meta", XML_DOCUMENT_META ),
+ TOKEN( "document-settings", XML_DOCUMENT_SETTINGS ),
+ TOKEN( "document-statistic", XML_DOCUMENT_STATISTIC ),
+ TOKEN( "document-styles", XML_DOCUMENT_STYLES ),
+ TOKEN( "domain", XML_DOMAIN ),
+ TOKEN( "dot", XML_DOT ),
+ TOKEN( "dots1", XML_DOTS1 ),
+ TOKEN( "dots1-length", XML_DOTS1_LENGTH ),
+ TOKEN( "dots2", XML_DOTS2 ),
+ TOKEN( "dots2-length", XML_DOTS2_LENGTH ),
+ TOKEN( "dotted", XML_DOTTED ),
+ TOKEN( "double", XML_DOUBLE ),
+ TOKEN( "double-sided", XML_DOUBLE_SIDED ),
+ TOKEN( "down", XML_DOWN ),
+ TOKEN( "draft", XML_DRAFT ),
+ TOKEN( "draw", XML_DRAW ),
+ TOKEN( "ole-draw-aspect", XML_DRAW_ASPECT ),
+ TOKEN( "drawing", XML_DRAWING ),
+ TOKEN( "drawings", XML_DRAWINGS ),
+ TOKEN( "drawpool", XML_DRAWPOOL ),
+ TOKEN( "drop-cap", XML_DROP_CAP ),
+ TOKEN( "dynamic", XML_DYNAMIC ),
+ TOKEN( "edge-rounding", XML_EDGE_ROUNDING ),
+ TOKEN( "editable", XML_EDITABLE ),
+ TOKEN( "editing-cycles", XML_EDITING_CYCLES ),
+ TOKEN( "editing-duration", XML_EDITING_DURATION ),
+ TOKEN( "edition", XML_EDITION ),
+ TOKEN( "editor", XML_EDITOR ),
+ TOKEN( "effect", XML_EFFECT ),
+ TOKEN( "ellipse", XML_ELLIPSE ),
+ TOKEN( "email", XML_EMAIL ),
+ TOKEN( "embed", XML_EMBED ),
+ TOKEN( "embedded-visible-area", XML_EMBEDDED_VISIBLE_AREA ),
+ TOKEN( "embossed", XML_EMBOSSED ),
+ TOKEN( "emissive-color", XML_EMISSIVE_COLOR ),
+ TOKEN( "empty", XML_EMPTY ),
+ TOKEN( "enable-numbering", XML_ENABLE_NUMBERING ),
+ TOKEN( "enabled", XML_ENABLED ),
+ TOKEN( "encoding", XML_ENCODING ),
+ TOKEN( "end", XML_END ),
+ TOKEN( "end-angle", XML_END_ANGLE ),
+ TOKEN( "end-cell-address", XML_END_CELL_ADDRESS ),
+ TOKEN( "end-color", XML_END_COLOR ),
+ TOKEN( "end-column", XML_END_COLUMN ),
+ TOKEN( "end-glue-point", XML_END_GLUE_POINT ),
+ TOKEN( "end-guide", XML_END_GUIDE ),
+ TOKEN( "end-intensity", XML_END_INTENSITY ),
+ TOKEN( "end-line-spacing-horizontal", XML_END_LINE_SPACING_HORIZONTAL ),
+ TOKEN( "end-line-spacing-vertical", XML_END_LINE_SPACING_VERTICAL ),
+ TOKEN( "end-position", XML_END_POSITION ),
+ TOKEN( "end-row", XML_END_ROW ),
+ TOKEN( "end-shape", XML_END_SHAPE ),
+ TOKEN( "end-table", XML_END_TABLE ),
+ TOKEN( "end-x", XML_END_X ),
+ TOKEN( "end-y", XML_END_Y ),
+ TOKEN( "endless", XML_ENDLESS ),
+ TOKEN( "endnote", XML_ENDNOTE ),
+ TOKEN( "endnote-body", XML_ENDNOTE_BODY ),
+ TOKEN( "endnote-citation", XML_ENDNOTE_CITATION ),
+ TOKEN( "endnote-ref", XML_ENDNOTE_REF ),
+ TOKEN( "endnotes-configuration", XML_ENDNOTES_CONFIGURATION ),
+ TOKEN( "engraved", XML_ENGRAVED ),
+ TOKEN( "eq", XML_EQ ),
+ TOKEN( "equal-author", XML_EQUAL_AUTHOR ),
+ TOKEN( "equal-comment", XML_EQUAL_COMMENT ),
+ TOKEN( "equal-date", XML_EQUAL_DATE ),
+ TOKEN( "era", XML_ERA ),
+ TOKEN( "ergo-sum", XML_ERGO_SUM ),
+ TOKEN( "error-category", XML_ERROR_CATEGORY ),
+ TOKEN( "error-lower-indicator", XML_ERROR_LOWER_INDICATOR ),
+ TOKEN( "error-lower-limit", XML_ERROR_LOWER_LIMIT ),
+ TOKEN( "error-macro", XML_ERROR_MACRO ),
+ TOKEN( "error-margin", XML_ERROR_MARGIN ),
+ TOKEN( "error-message", XML_ERROR_MESSAGE ),
+ TOKEN( "error-percentage", XML_ERROR_PERCENTAGE ),
+ TOKEN( "error-upper-indicator", XML_ERROR_UPPER_INDICATOR ),
+ TOKEN( "error-upper-limit", XML_ERROR_UPPER_LIMIT ),
+ TOKEN( "sub", XML_ESCAPEMENT_SUB ),
+ TOKEN( "super", XML_ESCAPEMENT_SUPER ),
+ TOKEN( "even-page", XML_EVEN_PAGE ),
+ TOKEN( "event", XML_EVENT ),
+ TOKEN( "event-name", XML_EVENT_NAME ),
+ TOKEN( "events", XML_EVENTS ),
+ TOKEN( "execute", XML_EXECUTE ),
+ TOKEN( "execute-macro", XML_EXECUTE_MACRO ),
+ TOKEN( "exists", XML_EXISTS ),
+ TOKEN( "exp", XML_EXP ),
+ TOKEN( "exponential", XML_EXPONENTIAL ),
+ TOKEN( "expression", XML_EXPRESSION ),
+ TOKEN( "extra", XML_EXTRA ),
+ TOKEN( "extrude", XML_EXTRUDE ),
+ TOKEN( "factorial", XML_FACTORIAL ),
+ TOKEN( "fade", XML_FADE ),
+ TOKEN( "fade-from-bottom", XML_FADE_FROM_BOTTOM ),
+ TOKEN( "fade-from-center", XML_FADE_FROM_CENTER ),
+ TOKEN( "fade-from-left", XML_FADE_FROM_LEFT ),
+ TOKEN( "fade-from-lowerleft", XML_FADE_FROM_LOWERLEFT ),
+ TOKEN( "fade-from-lowerright", XML_FADE_FROM_LOWERRIGHT ),
+ TOKEN( "fade-from-right", XML_FADE_FROM_RIGHT ),
+ TOKEN( "fade-from-top", XML_FADE_FROM_TOP ),
+ TOKEN( "fade-from-upperleft", XML_FADE_FROM_UPPERLEFT ),
+ TOKEN( "fade-from-upperright", XML_FADE_FROM_UPPERRIGHT ),
+ TOKEN( "fade-out", XML_FADE_OUT ),
+ TOKEN( "fade-to-center", XML_FADE_TO_CENTER ),
+ TOKEN( "false", XML_FALSE ),
+ TOKEN( "family", XML_FAMILY ),
+ TOKEN( "fast", XML_FAST ),
+ TOKEN( "field-number", XML_FIELD_NUMBER ),
+ TOKEN( "file-name", XML_FILE_NAME ),
+ TOKEN( "fill", XML_FILL ),
+ TOKEN( "fill-color", XML_FILL_COLOR ),
+ TOKEN( "fill-gradient-name", XML_FILL_GRADIENT_NAME ),
+ TOKEN( "fill-hatch-name", XML_FILL_HATCH_NAME ),
+ TOKEN( "fill-hatch-solid", XML_FILL_HATCH_SOLID ),
+ TOKEN( "fill-image", XML_FILL_IMAGE ),
+ TOKEN( "fill-image-height", XML_FILL_IMAGE_HEIGHT ),
+ TOKEN( "fill-image-name", XML_FILL_IMAGE_NAME ),
+ TOKEN( "fill-image-ref-point", XML_FILL_IMAGE_REF_POINT ),
+ TOKEN( "fill-image-ref-point-x", XML_FILL_IMAGE_REF_POINT_X ),
+ TOKEN( "fill-image-ref-point-y", XML_FILL_IMAGE_REF_POINT_Y ),
+ TOKEN( "fill-image-width", XML_FILL_IMAGE_WIDTH ),
+ TOKEN( "filter", XML_FILTER ),
+ TOKEN( "filter-and", XML_FILTER_AND ),
+ TOKEN( "filter-condition", XML_FILTER_CONDITION ),
+ TOKEN( "filter-name", XML_FILTER_NAME ),
+ TOKEN( "filter-options", XML_FILTER_OPTIONS ),
+ TOKEN( "filter-or", XML_FILTER_OR ),
+ TOKEN( "first-date-time", XML_FIRST_DATE_TIME ),
+ TOKEN( "first-page", XML_FIRST_PAGE ),
+ TOKEN( "first-page-number", XML_FIRST_PAGE_NUMBER ),
+ TOKEN( "fit-to-contour", XML_FIT_TO_CONTOUR ),
+ TOKEN( "fit-to-size", XML_FIT_TO_SIZE ),
+ TOKEN( "fix", XML_FIX ),
+ TOKEN( "fixed", XML_FIXED ),
+ TOKEN( "flat", XML_FLAT ),
+ TOKEN( "float", XML_FLOAT ),
+ TOKEN( "floating-frame", XML_FLOATING_FRAME ),
+ TOKEN( "floor", XML_FLOOR ),
+ TOKEN( "fn", XML_FN ),
+ TOKEN( "focal-length", XML_FOCAL_LENGTH ),
+ TOKEN( "font-char-width", XML_FONT_CHAR_WIDTH ),
+ TOKEN( "font-charset", XML_FONT_CHARSET ),
+ TOKEN( "font-charset-asian", XML_FONT_CHARSET_ASIAN ),
+ TOKEN( "font-charset-complex", XML_FONT_CHARSET_COMPLEX ),
+ TOKEN( "font-color", XML_FONT_COLOR ),
+ TOKEN( "font-decl", XML_FONT_DECL ),
+ TOKEN( "font-decls", XML_FONT_DECLS ),
+ TOKEN( "font-family", XML_FONT_FAMILY ),
+ TOKEN( "font-family-asian", XML_FONT_FAMILY_ASIAN ),
+ TOKEN( "font-family-complex", XML_FONT_FAMILY_COMPLEX ),
+ TOKEN( "font-family-generic", XML_FONT_FAMILY_GENERIC ),
+ TOKEN( "font-family-generic-asian", XML_FONT_FAMILY_GENERIC_ASIAN ),
+ TOKEN( "font-family-generic-complex", XML_FONT_FAMILY_GENERIC_COMPLEX ),
+ TOKEN( "font-kerning", XML_FONT_KERNING ),
+ TOKEN( "font-name", XML_FONT_NAME ),
+ TOKEN( "font-name-asian", XML_FONT_NAME_ASIAN ),
+ TOKEN( "font-name-complex", XML_FONT_NAME_COMPLEX ),
+ TOKEN( "font-pitch", XML_FONT_PITCH ),
+ TOKEN( "font-pitch-asian", XML_FONT_PITCH_ASIAN ),
+ TOKEN( "font-pitch-complex", XML_FONT_PITCH_COMPLEX ),
+ TOKEN( "font-relief", XML_FONT_RELIEF ),
+ TOKEN( "font-size", XML_FONT_SIZE ),
+ TOKEN( "font-size-asian", XML_FONT_SIZE_ASIAN ),
+ TOKEN( "font-size-complex", XML_FONT_SIZE_COMPLEX ),
+ TOKEN( "font-size-rel", XML_FONT_SIZE_REL ),
+ TOKEN( "font-size-rel-asian", XML_FONT_SIZE_REL_ASIAN ),
+ TOKEN( "font-size-rel-complex", XML_FONT_SIZE_REL_COMPLEX ),
+ TOKEN( "font-style", XML_FONT_STYLE ),
+ TOKEN( "font-style-asian", XML_FONT_STYLE_ASIAN ),
+ TOKEN( "font-style-complex", XML_FONT_STYLE_COMPLEX ),
+ TOKEN( "font-style-name", XML_FONT_STYLE_NAME ),
+ TOKEN( "font-style-name-asian", XML_FONT_STYLE_NAME_ASIAN ),
+ TOKEN( "font-style-name-complex", XML_FONT_STYLE_NAME_COMPLEX ),
+ TOKEN( "font-variant", XML_FONT_VARIANT ),
+ TOKEN( "font-weight", XML_FONT_WEIGHT ),
+ TOKEN( "font-weight-asian", XML_FONT_WEIGHT_ASIAN ),
+ TOKEN( "font-weight-complex", XML_FONT_WEIGHT_COMPLEX ),
+ TOKEN( "font-width", XML_FONT_WIDTH ),
+ TOKEN( "font-word-line-mode", XML_FONT_WORD_LINE_MODE ),
+ TOKEN( "fontfamily", XML_FONTFAMILY ),
+ TOKEN( "fontsize", XML_FONTSIZE ),
+ TOKEN( "fontstyle", XML_FONTSTYLE ),
+ TOKEN( "fontweight", XML_FONTWEIGHT ),
+ TOKEN( "fontwork-adjust", XML_FONTWORK_ADJUST ),
+ TOKEN( "fontwork-distance", XML_FONTWORK_DISTANCE ),
+ TOKEN( "fontwork-form", XML_FONTWORK_FORM ),
+ TOKEN( "fontwork-hide-form", XML_FONTWORK_HIDE_FORM ),
+ TOKEN( "fontwork-mirror", XML_FONTWORK_MIRROR ),
+ TOKEN( "fontwork-outline", XML_FONTWORK_OUTLINE ),
+ TOKEN( "fontwork-shadow", XML_FONTWORK_SHADOW ),
+ TOKEN( "fontwork-shadow-color", XML_FONTWORK_SHADOW_COLOR ),
+ TOKEN( "fontwork-shadow-offset-x", XML_FONTWORK_SHADOW_OFFSET_X ),
+ TOKEN( "fontwork-shadow-offset-y", XML_FONTWORK_SHADOW_OFFSET_Y ),
+ TOKEN( "fontwork-shadow-transparence", XML_FONTWORK_SHADOW_TRANSPARENCE ),
+ TOKEN( "fontwork-start", XML_FONTWORK_START ),
+ TOKEN( "fontwork-style", XML_FONTWORK_STYLE ),
+ TOKEN( "footer", XML_FOOTER ),
+ TOKEN( "footer-left", XML_FOOTER_LEFT ),
+ TOKEN( "footer-style", XML_FOOTER_STYLE ),
+ TOKEN( "footnote", XML_FOOTNOTE ),
+ TOKEN( "footnote-body", XML_FOOTNOTE_BODY ),
+ TOKEN( "footnote-citation", XML_FOOTNOTE_CITATION ),
+ TOKEN( "footnote-continuation-notice-backward", XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD ),
+ TOKEN( "footnote-continuation-notice-forward", XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD ),
+ TOKEN( "footnote-max-height", XML_FOOTNOTE_MAX_HEIGHT ),
+ TOKEN( "footnote-ref", XML_FOOTNOTE_REF ),
+ TOKEN( "footnote-sep", XML_FOOTNOTE_SEP ),
+ TOKEN( "footnotes-configuration", XML_FOOTNOTES_CONFIGURATION ),
+ TOKEN( "footnotes-position", XML_FOOTNOTES_POSITION ),
+ TOKEN( "forall", XML_FORALL ),
+ TOKEN( "force-manual", XML_FORCE_MANUAL ),
+ TOKEN( "foreground", XML_FOREGROUND ),
+ TOKEN( "foreign-object", XML_FOREIGN_OBJECT ),
+ TOKEN( "format-change", XML_FORMAT_CHANGE ),
+ TOKEN( "format-source", XML_FORMAT_SOURCE ),
+ TOKEN( "forms", XML_FORMS ),
+ TOKEN( "formula", XML_FORMULA ),
+ TOKEN( "formula-hidden", XML_FORMULA_HIDDEN ),
+ TOKEN( "formulas", XML_FORMULAS ),
+ TOKEN( "fraction", XML_FRACTION ),
+ TOKEN( "frame", XML_FRAME ),
+ TOKEN( "frame-content", XML_FRAME_CONTENT ),
+ TOKEN( "frame-display-border", XML_FRAME_DISPLAY_BORDER ),
+ TOKEN( "frame-display-scrollbar", XML_FRAME_DISPLAY_SCROLLBAR ),
+ TOKEN( "frame-end-margin", XML_FRAME_END_MARGIN ),
+ TOKEN( "frame-margin-horizontal", XML_FRAME_MARGIN_HORIZONTAL ),
+ TOKEN( "frame-margin-vertical", XML_FRAME_MARGIN_VERTICAL ),
+ TOKEN( "frame-name", XML_FRAME_NAME ),
+ TOKEN( "frame-start-margin", XML_FRAME_START_MARGIN ),
+ TOKEN( "freeze", XML_FREEZE ),
+ TOKEN( "freeze-position", XML_FREEZE_POSITION ),
+ TOKEN( "from-another-table", XML_FROM_ANOTHER_TABLE ),
+ TOKEN( "from-bottom", XML_FROM_BOTTOM ),
+ TOKEN( "from-center", XML_FROM_CENTER ),
+ TOKEN( "from-inside", XML_FROM_INSIDE ),
+ TOKEN( "from-left", XML_FROM_LEFT ),
+ TOKEN( "from-lower-left", XML_FROM_LOWER_LEFT ),
+ TOKEN( "from-lower-right", XML_FROM_LOWER_RIGHT ),
+ TOKEN( "from-right", XML_FROM_RIGHT ),
+ TOKEN( "from-same-table", XML_FROM_SAME_TABLE ),
+ TOKEN( "from-top", XML_FROM_TOP ),
+ TOKEN( "from-upper-left", XML_FROM_UPPER_LEFT ),
+ TOKEN( "from-upper-right", XML_FROM_UPPER_RIGHT ),
+ TOKEN( "fuchsia", XML_FUCHSIA ),
+ TOKEN( "full", XML_FULL ),
+ TOKEN( "full-screen", XML_FULL_SCREEN ),
+ TOKEN( "function", XML_FUNCTION ),
+ TOKEN( "g", XML_G ),
+ TOKEN( "gamma", XML_GAMMA ),
+ TOKEN( "gap", XML_GAP ),
+ TOKEN( "gap-width", XML_GAP_WIDTH ),
+ TOKEN( "gcd", XML_GCD ),
+ TOKEN( "generator", XML_GENERATOR ),
+ TOKEN( "geq", XML_GEQ ),
+ TOKEN( "gouraud", XML_GOURAUD ),
+ TOKEN( "gradient", XML_GRADIENT ),
+ TOKEN( "angle", XML_GRADIENT_ANGLE ),
+ TOKEN( "border", XML_GRADIENT_BORDER ),
+ TOKEN( "gradient-step-count", XML_GRADIENT_STEP_COUNT ),
+ TOKEN( "gradient-style", XML_GRADIENT_STYLE ),
+ TOKEN( "axial", XML_GRADIENTSTYLE_AXIAL ),
+ TOKEN( "ellipsoid", XML_GRADIENTSTYLE_ELLIPSOID ),
+ TOKEN( "linear", XML_GRADIENTSTYLE_LINEAR ),
+ TOKEN( "radial", XML_GRADIENTSTYLE_RADIAL ),
+ TOKEN( "rectangular", XML_GRADIENTSTYLE_RECTANGULAR ),
+ TOKEN( "square", XML_GRADIENTSTYLE_SQUARE ),
+ TOKEN( "grand-total", XML_GRAND_TOTAL ),
+ TOKEN( "graphic", XML_GRAPHIC ),
+ TOKEN( "gray", XML_GRAY ),
+ TOKEN( "green", XML_GREEN ),
+ TOKEN( "greyscale", XML_GREYSCALE ),
+ TOKEN( "grid", XML_GRID ),
+ TOKEN( "groove", XML_GROOVE ),
+ TOKEN( "group-by-field-number", XML_GROUP_BY_FIELD_NUMBER ),
+ TOKEN( "group-name", XML_GROUP_NAME ),
+ TOKEN( "grouping", XML_GROUPING ),
+ TOKEN( "gt", XML_GT ),
+ TOKEN( "guide-distance", XML_GUIDE_DISTANCE ),
+ TOKEN( "guide-overhang", XML_GUIDE_OVERHANG ),
+ TOKEN( "h", XML_H ),
+ TOKEN( "hanging", XML_HANGING ),
+ TOKEN( "has-persistent-data", XML_HAS_PERSISTENT_DATA ),
+ TOKEN( "hatch", XML_HATCH ),
+ TOKEN( "distance", XML_HATCH_DISTANCE ),
+ TOKEN( "style", XML_HATCH_STYLE ),
+ TOKEN( "double", XML_HATCHSTYLE_DOUBLE ),
+ TOKEN( "single", XML_HATCHSTYLE_SINGLE ),
+ TOKEN( "triple", XML_HATCHSTYLE_TRIPLE ),
+ TOKEN( "header", XML_HEADER ),
+ TOKEN( "header-left", XML_HEADER_LEFT ),
+ TOKEN( "header-style", XML_HEADER_STYLE ),
+ TOKEN( "headers", XML_HEADERS ),
+ TOKEN( "height", XML_HEIGHT ),
+ TOKEN( "help", XML_HELP),
+ TOKEN( "help-file-name", XML_HELP_FILE_NAME ),
+ TOKEN( "help-id", XML_HELP_ID ),
+ TOKEN( "help-message", XML_HELP_MESSAGE ),
+ TOKEN( "hidden", XML_HIDDEN ),
+ TOKEN( "hidden-and-protected", XML_HIDDEN_AND_PROTECTED ),
+ TOKEN( "hidden-paragraph", XML_HIDDEN_PARAGRAPH ),
+ TOKEN( "hidden-text", XML_HIDDEN_TEXT ),
+ TOKEN( "hide", XML_HIDE ),
+ TOKEN( "hide-shape", XML_HIDE_SHAPE ),
+ TOKEN( "hide-text", XML_HIDE_TEXT ),
+ TOKEN( "highlighted-range", XML_HIGHLIGHTED_RANGE ),
+ TOKEN( "hint", XML_HINT),
+ TOKEN( "horizontal", XML_HORIZONTAL ),
+ TOKEN( "horizontal-lines", XML_HORIZONTAL_LINES ),
+ // --> OD 2005-05-12 #i49139#
+ // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
+ // Usage is deprecated, but the old token are needed for the
+ // OpenOffice.org file format import/export filter for the renaming
+ TOKEN( "horizontal-on-left-pages", XML_HORIZONTAL_ON_LEFT_PAGES ),
+ TOKEN( "horizontal-on-right-pages", XML_HORIZONTAL_ON_RIGHT_PAGES ),
+ // <--
+ TOKEN( "horizontal-pos", XML_HORIZONTAL_POS ),
+ TOKEN( "horizontal-rel", XML_HORIZONTAL_REL ),
+ TOKEN( "horizontal-scrollbar-width", XML_HORIZONTAL_SCROLLBAR_WIDTH ),
+ TOKEN( "horizontal-segments", XML_HORIZONTAL_SEGMENTS ),
+ TOKEN( "horizontal-split-mode", XML_HORIZONTAL_SPLIT_MODE ),
+ TOKEN( "horizontal-split-position", XML_HORIZONTAL_SPLIT_POSITION ),
+ TOKEN( "horizontal-stripes", XML_HORIZONTAL_STRIPES ),
+ TOKEN( "hours", XML_HOURS ),
+ TOKEN( "howpublished", XML_HOWPUBLISHED ),
+ TOKEN( "href", XML_HREF ),
+ TOKEN( "html", XML_HTML ),
+ TOKEN( "hyperlink-behaviour", XML_HYPERLINK_BEHAVIOUR ),
+ TOKEN( "hyphenate", XML_HYPHENATE ),
+ TOKEN( "hyphenation-keep", XML_HYPHENATION_KEEP ),
+ TOKEN( "hyphenation-ladder-count", XML_HYPHENATION_LADDER_COUNT ),
+ TOKEN( "hyphenation-push-char-count", XML_HYPHENATION_PUSH_CHAR_COUNT ),
+ TOKEN( "hyphenation-remain-char-count", XML_HYPHENATION_REMAIN_CHAR_COUNT ),
+ TOKEN( "i", XML_I ),
+ TOKEN( "icon", XML_ICON ),
+ TOKEN( "id", XML_ID ),
+ TOKEN( "ident", XML_IDENT ),
+ TOKEN( "identifier", XML_IDENTIFIER ),
+ TOKEN( "identify-categories", XML_IDENTIFY_CATEGORIES ),
+ TOKEN( "ideograph-alpha", XML_IDEOGRAPH_ALPHA ),
+ TOKEN( "ignore-case", XML_IGNORE_CASE ),
+ TOKEN( "ignore-empty-rows", XML_IGNORE_EMPTY_ROWS ),
+ TOKEN( "illustration-index", XML_ILLUSTRATION_INDEX ),
+ TOKEN( "illustration-index-entry-template", XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "illustration-index-source", XML_ILLUSTRATION_INDEX_SOURCE ),
+ TOKEN( "image", XML_IMAGE ),
+ TOKEN( "image-count", XML_IMAGE_COUNT ),
+ TOKEN( "image-map", XML_IMAGE_MAP ),
+ TOKEN( "implies", XML_IMPLIES ),
+ TOKEN( "in", XML_IN ),
+ TOKEN( "in-range", XML_IN_RANGE ),
+ TOKEN( "inbook", XML_INBOOK ),
+ TOKEN( "incollection", XML_INCOLLECTION ),
+ TOKEN( "increment", XML_INCREMENT ),
+ TOKEN( "index", XML_INDEX ),
+ TOKEN( "index-body", XML_INDEX_BODY ),
+ TOKEN( "index-entry-bibliography", XML_INDEX_ENTRY_BIBLIOGRAPHY ),
+ TOKEN( "index-entry-chapter", XML_INDEX_ENTRY_CHAPTER ),
+ TOKEN( "index-entry-chapter-number", XML_INDEX_ENTRY_CHAPTER_NUMBER ),
+ TOKEN( "index-entry-link-end", XML_INDEX_ENTRY_LINK_END ),
+ TOKEN( "index-entry-link-start", XML_INDEX_ENTRY_LINK_START ),
+ TOKEN( "index-entry-page-number", XML_INDEX_ENTRY_PAGE_NUMBER ),
+ TOKEN( "index-entry-span", XML_INDEX_ENTRY_SPAN ),
+ TOKEN( "index-entry-tab-stop", XML_INDEX_ENTRY_TAB_STOP ),
+ TOKEN( "index-entry-template", XML_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "index-entry-text", XML_INDEX_ENTRY_TEXT ),
+ TOKEN( "index-name", XML_INDEX_NAME ),
+ TOKEN( "index-scope", XML_INDEX_SCOPE ),
+ TOKEN( "index-source-style", XML_INDEX_SOURCE_STYLE ),
+ TOKEN( "index-source-styles", XML_INDEX_SOURCE_STYLES ),
+ TOKEN( "index-title", XML_INDEX_TITLE ),
+ TOKEN( "index-title-template", XML_INDEX_TITLE_TEMPLATE ),
+ TOKEN( "information", XML_INFORMATION ),
+ TOKEN( "initial-creator", XML_INITIAL_CREATOR ),
+ TOKEN( "inproceedings", XML_INPROCEEDINGS ),
+ TOKEN( "insertion", XML_INSERTION ),
+ TOKEN( "insertion-cut-off", XML_INSERTION_CUT_OFF ),
+ TOKEN( "inset", XML_INSET ),
+ TOKEN( "inside", XML_INSIDE ),
+ TOKEN( "institution", XML_INSTITUTION ),
+ TOKEN( "int", XML_INT ),
+ TOKEN( "intensity", XML_INTENSITY ),
+ TOKEN( "intersect", XML_INTERSECT ),
+ TOKEN( "interval", XML_INTERVAL ),
+ TOKEN( "interval-major", XML_INTERVAL_MAJOR ),
+ TOKEN( "interval-minor", XML_INTERVAL_MINOR ),
+ TOKEN( "into-english-number", XML_INTO_ENGLISH_NUMBER ),
+ TOKEN( "inverse", XML_INVERSE ),
+ TOKEN( "is-active", XML_IS_ACTIVE ),
+ TOKEN( "is-data-layout-field", XML_IS_DATA_LAYOUT_FIELD ),
+ TOKEN( "is-hidden", XML_IS_HIDDEN ),
+ TOKEN( "is-selection", XML_IS_SELECTION ),
+ TOKEN( "isbn", XML_ISBN ),
+ TOKEN( "italic", XML_ITALIC ),
+ TOKEN( "iteration", XML_ITERATION ),
+ TOKEN( "journal", XML_JOURNAL ),
+ TOKEN( "justified", XML_JUSTIFIED ),
+ TOKEN( "justify", XML_JUSTIFY ),
+ TOKEN( "justify-single-word", XML_JUSTIFY_SINGLE_WORD ),
+ TOKEN( "keep-with-next", XML_KEEP_WITH_NEXT ),
+ TOKEN( "normal", XML_KERNING_NORMAL ),
+ TOKEN( "key", XML_KEY ),
+ TOKEN( "key1", XML_KEY1 ),
+ TOKEN( "key2", XML_KEY2 ),
+ TOKEN( "keyword", XML_KEYWORD ),
+ TOKEN( "keywords", XML_KEYWORDS ),
+ TOKEN( "kind", XML_KIND ),
+ TOKEN( "km", XML_KM ),
+ TOKEN( "label", XML_LABEL ),
+ TOKEN( "label-arrangement", XML_LABEL_ARRANGEMENT ),
+ TOKEN( "label-cell-address", XML_LABEL_CELL_ADDRESS ),
+ TOKEN( "label-cell-range-address", XML_LABEL_CELL_RANGE_ADDRESS ),
+ TOKEN( "label-range", XML_LABEL_RANGE ),
+ TOKEN( "label-ranges", XML_LABEL_RANGES ),
+ TOKEN( "lambda", XML_LAMBDA ),
+ TOKEN( "landscape", XML_LANDSCAPE ),
+ TOKEN( "language", XML_LANGUAGE ),
+ TOKEN( "language-asian", XML_LANGUAGE_ASIAN ),
+ TOKEN( "language-complex", XML_LANGUAGE_COMPLEX ),
+ TOKEN( "laser", XML_LASER ),
+ TOKEN( "last-column-spanned", XML_LAST_COLUMN_SPANNED ),
+ TOKEN( "last-page", XML_LAST_PAGE ),
+ TOKEN( "last-row-spanned", XML_LAST_ROW_SPANNED ),
+ TOKEN( "layer", XML_LAYER ),
+ TOKEN( "layer-set", XML_LAYER_SET ),
+ TOKEN( "leader-char", XML_LEADER_CHAR ),
+ TOKEN( "left", XML_LEFT ),
+ TOKEN( "left-outside", XML_LEFT_OUTSIDE ),
+ TOKEN( "left-top-position", XML_LEFT_TOP_POSITION ),
+ TOKEN( "left-arc", XML_LEFTARC ),
+ TOKEN( "left-circle", XML_LEFTCIRCLE ),
+ TOKEN( "legend", XML_LEGEND ),
+ TOKEN( "legend-position", XML_LEGEND_POSITION ),
+ TOKEN( "length", XML_LENGTH ),
+ TOKEN( "leq", XML_LEQ ),
+ TOKEN( "let-text", XML_LET_TEXT ),
+ TOKEN( "keep-text", XML_KEEP_TEXT ),
+ TOKEN( "letter-kerning", XML_LETTER_KERNING ),
+ TOKEN( "letter-spacing", XML_LETTER_SPACING ),
+ TOKEN( "letters", XML_LETTERS ),
+ TOKEN( "level", XML_LEVEL ),
+ TOKEN( "library", XML_LIBRARY ),
+ TOKEN( "library-embedded", XML_LIBRARY_EMBEDDED ),
+ TOKEN( "library-linked", XML_LIBRARY_LINKED ),
+ TOKEN( "light", XML_LIGHT ),
+ TOKEN( "lighting-mode", XML_LIGHTING_MODE ),
+ TOKEN( "lime", XML_LIME ),
+ TOKEN( "limit", XML_LIMIT ),
+ TOKEN( "line", XML_LINE ),
+ TOKEN( "line-break", XML_LINE_BREAK ),
+ TOKEN( "line-distance", XML_LINE_DISTANCE ),
+ TOKEN( "line-height", XML_LINE_HEIGHT ),
+ TOKEN( "line-height-at-least", XML_LINE_HEIGHT_AT_LEAST ),
+ TOKEN( "line-number", XML_LINE_NUMBER ),
+ TOKEN( "line-skew", XML_LINE_SKEW ),
+ TOKEN( "line-spacing", XML_LINE_SPACING ),
+ TOKEN( "linear", XML_LINEAR ),
+ TOKEN( "linenumbering-configuration", XML_LINENUMBERING_CONFIGURATION ),
+ TOKEN( "linenumbering-separator", XML_LINENUMBERING_SEPARATOR ),
+ TOKEN( "lines", XML_LINES ),
+ TOKEN( "lines-used", XML_LINES_USED ),
+ TOKEN( "link-to-source-data", XML_LINK_TO_SOURCE_DATA ),
+ TOKEN( "list", XML_LIST ),
+ TOKEN( "list-block", XML_LIST_BLOCK ),
+ TOKEN( "list-header", XML_LIST_HEADER ),
+ TOKEN( "list-info", XML_LIST_INFO ),
+ TOKEN( "list-item", XML_LIST_ITEM ),
+ TOKEN( "list-level", XML_LIST_LEVEL ),
+ TOKEN( "list-level-style-bullet", XML_LIST_LEVEL_STYLE_BULLET ),
+ TOKEN( "list-level-style-image", XML_LIST_LEVEL_STYLE_IMAGE ),
+ TOKEN( "list-level-style-number", XML_LIST_LEVEL_STYLE_NUMBER ),
+ TOKEN( "list-name", XML_LIST_NAME ),
+ TOKEN( "list-style", XML_LIST_STYLE ),
+ TOKEN( "list-style-name", XML_LIST_STYLE_NAME ),
+ TOKEN( "ln", XML_LN ),
+ TOKEN( "locked", XML_LOCKED ),
+ TOKEN( "log", XML_LOG ),
+ TOKEN( "logarithmic", XML_LOGARITHMIC ),
+ TOKEN( "logbase", XML_LOGBASE ),
+ TOKEN( "long", XML_LONG ),
+ TOKEN( "lowlimit", XML_LOWLIMIT ),
+ TOKEN( "lr-tb", XML_LR_TB ),
+ TOKEN( "lt", XML_LT ),
+ TOKEN( "ltr", XML_LTR ),
+ TOKEN( "luminance", XML_LUMINANCE ),
+ TOKEN( "macro-name", XML_MACRO_NAME ),
+ TOKEN( "maction", XML_MACTION ),
+ TOKEN( "main-entry-style-name", XML_MAIN_ENTRY_STYLE_NAME ),
+ TOKEN( "major", XML_MAJOR ),
+ TOKEN( "maligngroup", XML_MALIGNGROUP ),
+ TOKEN( "malignmark", XML_MALIGNMARK ),
+ TOKEN( "manual", XML_MANUAL ),
+ TOKEN( "map", XML_MAP ),
+ TOKEN( "margin-bottom", XML_MARGIN_BOTTOM ),
+ TOKEN( "margin-left", XML_MARGIN_LEFT ),
+ TOKEN( "margin-right", XML_MARGIN_RIGHT ),
+ TOKEN( "margin-top", XML_MARGIN_TOP ),
+ TOKEN( "margins", XML_MARGINS ),
+ TOKEN( "marker", XML_MARKER ),
+ TOKEN( "marker-end", XML_MARKER_END ),
+ TOKEN( "marker-end-center", XML_MARKER_END_CENTER ),
+ TOKEN( "marker-end-width", XML_MARKER_END_WIDTH ),
+ TOKEN( "marker-start", XML_MARKER_START ),
+ TOKEN( "marker-start-center", XML_MARKER_START_CENTER ),
+ TOKEN( "marker-start-width", XML_MARKER_START_WIDTH ),
+ TOKEN( "maroon", XML_MAROON ),
+ TOKEN( "master-page", XML_MASTER_PAGE ),
+ TOKEN( "master-page-name", XML_MASTER_PAGE_NAME ),
+ TOKEN( "master-styles", XML_MASTER_STYLES ),
+ TOKEN( "mastersthesis", XML_MASTERSTHESIS ),
+ TOKEN( "match", XML_MATCH ),
+ TOKEN( "math", XML_MATH ),
+ TOKEN( "matrix", XML_MATRIX ),
+ TOKEN( "matrix-covered", XML_MATRIX_COVERED ),
+ TOKEN( "matrixrow", XML_MATRIXROW ),
+ TOKEN( "max", XML_MAX ),
+ TOKEN( "max-edge", XML_MAX_EDGE ),
+ TOKEN( "max-height", XML_MAX_HEIGHT ),
+ TOKEN( "max-width", XML_MAX_WIDTH ),
+ TOKEN( "maximum", XML_MAXIMUM ),
+ TOKEN( "maximum-difference", XML_MAXIMUM_DIFFERENCE ),
+ TOKEN( "may-break-between-rows", XML_MAY_BREAK_BETWEEN_ROWS ),
+ TOKEN( "may-script", XML_MAY_SCRIPT ),
+ TOKEN( "mean", XML_MEAN ),
+ TOKEN( "mean-value", XML_MEAN_VALUE ),
+ TOKEN( "measure", XML_MEASURE ),
+ TOKEN( "measure-align", XML_MEASURE_ALIGN ),
+ TOKEN( "measure-vertical-align", XML_MEASURE_VERTICAL_ALIGN ),
+ TOKEN( "median", XML_MEDIAN ),
+ TOKEN( "medium", XML_MEDIUM ),
+ TOKEN( "merror", XML_MERROR ),
+ TOKEN( "message-type", XML_MESSAGE_TYPE ),
+ TOKEN( "meta", XML_META ),
+ TOKEN( "mfenced", XML_MFENCED ),
+ TOKEN( "mfrac", XML_MFRAC ),
+ TOKEN( "mi", XML_MI ),
+ TOKEN( "middle", XML_MIDDLE ),
+ TOKEN( "mime-type", XML_MIME_TYPE ),
+ TOKEN( "min", XML_MIN ),
+ TOKEN( "min-denominator-digits", XML_MIN_DENOMINATOR_DIGITS ),
+ TOKEN( "min-edge", XML_MIN_EDGE ),
+ TOKEN( "min-exponent-digits", XML_MIN_EXPONENT_DIGITS ),
+ TOKEN( "min-height", XML_MIN_HEIGHT ),
+ TOKEN( "min-integer-digits", XML_MIN_INTEGER_DIGITS ),
+ TOKEN( "min-label-distance", XML_MIN_LABEL_DISTANCE ),
+ TOKEN( "min-label-width", XML_MIN_LABEL_WIDTH ),
+ TOKEN( "min-line-height", XML_MIN_LINE_HEIGHT ),
+ TOKEN( "min-numerator-digits", XML_MIN_NUMERATOR_DIGITS ),
+ TOKEN( "min-row-height", XML_MIN_ROW_HEIGHT ),
+ TOKEN( "min-width", XML_MIN_WIDTH ),
+ TOKEN( "minimum", XML_MINIMUM ),
+ TOKEN( "minor", XML_MINOR ),
+ TOKEN( "minus", XML_MINUS ),
+ TOKEN( "minutes", XML_MINUTES ),
+ TOKEN( "mirror", XML_MIRROR ),
+ TOKEN( "mirrored", XML_MIRRORED ),
+ TOKEN( "misc", XML_MISC ),
+ TOKEN( "miter", XML_MITER ),
+ TOKEN( "mm", XML_MM ),
+ TOKEN( "mmultiscripts", XML_MMULTISCRIPTS ),
+ TOKEN( "mn", XML_MN ),
+ TOKEN( "mo", XML_MO ),
+ TOKEN( "mode", XML_MODE ),
+ TOKEN( "modern", XML_MODERN ),
+ TOKEN( "modification-date", XML_MODIFICATION_DATE ),
+ TOKEN( "modification-time", XML_MODIFICATION_TIME ),
+ TOKEN( "modulate", XML_MODULATE ),
+ TOKEN( "module", XML_MODULE ),
+ TOKEN( "moment", XML_MOMENT ),
+ TOKEN( "mono", XML_MONO ),
+ TOKEN( "month", XML_MONTH ),
+ TOKEN( "mouse-as-pen", XML_MOUSE_AS_PEN ),
+ TOKEN( "mouse-visible", XML_MOUSE_VISIBLE ),
+ TOKEN( "move", XML_MOVE ),
+ TOKEN( "move-from-bottom", XML_MOVE_FROM_BOTTOM ),
+ TOKEN( "move-from-left", XML_MOVE_FROM_LEFT ),
+ TOKEN( "move-from-right", XML_MOVE_FROM_RIGHT ),
+ TOKEN( "move-from-top", XML_MOVE_FROM_TOP ),
+ TOKEN( "move-protect", XML_MOVE_PROTECT ),
+ TOKEN( "move-short", XML_MOVE_SHORT ),
+ TOKEN( "movement", XML_MOVEMENT ),
+ TOKEN( "movement-cut-off", XML_MOVEMENT_CUT_OFF ),
+ TOKEN( "mover", XML_MOVER ),
+ TOKEN( "mpadded", XML_MPADDED ),
+ TOKEN( "mphantom", XML_MPHANTOM ),
+ TOKEN( "mprescripts", XML_MPRESCRIPTS ),
+ TOKEN( "mroot", XML_MROOT ),
+ TOKEN( "mrow", XML_MROW ),
+ TOKEN( "ms", XML_MS ),
+ TOKEN( "mspace", XML_MSPACE ),
+ TOKEN( "msqrt", XML_MSQRT ),
+ TOKEN( "mstyle", XML_MSTYLE ),
+ TOKEN( "msub", XML_MSUB ),
+ TOKEN( "msubsup", XML_MSUBSUP ),
+ TOKEN( "msup", XML_MSUP ),
+ TOKEN( "mtable", XML_MTABLE ),
+ TOKEN( "mtd", XML_MTD ),
+ TOKEN( "mtext", XML_MTEXT ),
+ TOKEN( "mtr", XML_MTR ),
+ TOKEN( "multi-deletion-spanned", XML_MULTI_DELETION_SPANNED ),
+ TOKEN( "munder", XML_MUNDER ),
+ TOKEN( "munderover", XML_MUNDEROVER ),
+ TOKEN( "name", XML_NAME ),
+ TOKEN( "name-and-extension", XML_NAME_AND_EXTENSION ),
+ TOKEN( "named-expression", XML_NAMED_EXPRESSION ),
+ TOKEN( "named-expressions", XML_NAMED_EXPRESSIONS ),
+ TOKEN( "named-range", XML_NAMED_RANGE ),
+ TOKEN( "navy", XML_NAVY ),
+ TOKEN( "neq", XML_NEQ ),
+ TOKEN( "new", XML_NEW ),
+ TOKEN( "next", XML_NEXT ),
+ TOKEN( "next-page", XML_NEXT_PAGE ),
+ TOKEN( "next-style-name", XML_NEXT_STYLE_NAME ),
+ TOKEN( "no-limit", XML_NO_LIMIT ),
+ TOKEN( "no-wrap", XML_NO_WRAP ),
+ TOKEN( "!empty", XML_NOEMPTY ),
+ TOKEN( "nohref", XML_NOHREF ),
+ TOKEN( "!match", XML_NOMATCH ),
+ TOKEN( "none", XML_NONE ),
+ TOKEN( "notprsubset", XML_NOPRTSUBSET ),
+ TOKEN( "normal", XML_NORMAL ),
+ TOKEN( "normals-direction", XML_NORMALS_DIRECTION ),
+ TOKEN( "normals-kind", XML_NORMALS_KIND ),
+ TOKEN( "not", XML_NOT ),
+ TOKEN( "not-equal-date", XML_NOT_EQUAL_DATE ),
+ TOKEN( "note", XML_NOTE ),
+ TOKEN( "notes", XML_NOTES ),
+ TOKEN( "notin", XML_NOTIN ),
+ TOKEN( "notsubset", XML_NOTSUBSET ),
+ TOKEN( "null-date", XML_NULL_DATE ),
+ TOKEN( "null-year", XML_NULL_YEAR ),
+ TOKEN( "num-format", XML_NUM_FORMAT ),
+ TOKEN( "num-letter-sync", XML_NUM_LETTER_SYNC ),
+ TOKEN( "num-prefix", XML_NUM_PREFIX ),
+ TOKEN( "num-suffix", XML_NUM_SUFFIX ),
+ TOKEN( "number", XML_NUMBER ),
+ TOKEN( "number-and-name", XML_NUMBER_AND_NAME ),
+ TOKEN( "number-columns-repeated", XML_NUMBER_COLUMNS_REPEATED ),
+ TOKEN( "number-columns-spanned", XML_NUMBER_COLUMNS_SPANNED ),
+ TOKEN( "number-lines", XML_NUMBER_LINES ),
+ TOKEN( "number-matrix-columns-spanned", XML_NUMBER_MATRIX_COLUMNS_SPANNED ),
+ TOKEN( "number-matrix-rows-spanned", XML_NUMBER_MATRIX_ROWS_SPANNED ),
+ TOKEN( "number-position", XML_NUMBER_POSITION ),
+ TOKEN( "number-rows-repeated", XML_NUMBER_ROWS_REPEATED ),
+ TOKEN( "number-rows-spanned", XML_NUMBER_ROWS_SPANNED ),
+ TOKEN( "number-style", XML_NUMBER_STYLE ),
+ TOKEN( "number-wrapped-paragraphs", XML_NUMBER_WRAPPED_PARAGRAPHS ),
+ TOKEN( "numbered-entries", XML_NUMBERED_ENTRIES ),
+ TOKEN( "object", XML_OBJECT ),
+ TOKEN( "object-count", XML_OBJECT_COUNT ),
+ TOKEN( "object-index", XML_OBJECT_INDEX ),
+ TOKEN( "object-index-entry-template", XML_OBJECT_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "object-index-source", XML_OBJECT_INDEX_SOURCE ),
+ TOKEN( "object-name", XML_OBJECT_NAME ),
+ TOKEN( "object-ole", XML_OBJECT_OLE ),
+ TOKEN( "objects", XML_OBJECTS ),
+ TOKEN( "odd-page", XML_ODD_PAGE ),
+ TOKEN( "offset", XML_OFFSET ),
+ TOKEN( "olive", XML_OLIVE ),
+ TOKEN( "onLoad", XML_ONLOAD ),
+ TOKEN( "onRequest", XML_ONREQUEST ),
+ TOKEN( "on-update-keep-size", XML_ON_UPDATE_KEEP_SIZE ),
+ TOKEN( "on-update-keep-styles", XML_ON_UPDATE_KEEP_STYLES ),
+ TOKEN( "online", XML_ONLINE ),
+ TOKEN( "online-text", XML_ONLINE_TEXT ),
+ TOKEN( "background", XML_OPAQUE_BACKGROUND ),
+ TOKEN( "foreground", XML_OPAQUE_FOREGROUND ),
+ TOKEN( "open", XML_OPEN ),
+ TOKEN( "open-horizontal", XML_OPEN_HORIZONTAL ),
+ TOKEN( "open-vertical", XML_OPEN_VERTICAL ),
+ TOKEN( "operation", XML_OPERATION ),
+ TOKEN( "operator", XML_OPERATOR ),
+ TOKEN( "optimal", XML_OPTIMAL ),
+ TOKEN( "or", XML_OR ),
+ TOKEN( "order", XML_ORDER ),
+ TOKEN( "ordered-list", XML_ORDERED_LIST ),
+ TOKEN( "organizations", XML_ORGANIZATIONS ),
+ TOKEN( "orientation", XML_ORIENTATION ),
+ TOKEN( "orientation-landscape", XML_ORIENTATION_LANDSCAPE ),
+ TOKEN( "orientation-portrait", XML_ORIENTATION_PORTRAIT ),
+ TOKEN( "origin", XML_ORIGIN ),
+ TOKEN( "orphans", XML_ORPHANS ),
+ TOKEN( "outline-level", XML_OUTLINE_LEVEL ),
+ TOKEN( "outline-level-style", XML_OUTLINE_LEVEL_STYLE ),
+ TOKEN( "outline-style", XML_OUTLINE_STYLE ),
+ TOKEN( "outset", XML_OUTSET ),
+ TOKEN( "outside", XML_OUTSIDE ),
+ TOKEN( "overlap", XML_OVERLAP ),
+ TOKEN( "p", XML_P ),
+ TOKEN( "package-name", XML_PACKAGE_NAME ),
+ TOKEN( "padding", XML_PADDING ),
+ TOKEN( "padding-bottom", XML_PADDING_BOTTOM ),
+ TOKEN( "padding-left", XML_PADDING_LEFT ),
+ TOKEN( "padding-right", XML_PADDING_RIGHT ),
+ TOKEN( "padding-top", XML_PADDING_TOP ),
+ TOKEN( "page", XML_PAGE ),
+ TOKEN( "page-adjust", XML_PAGE_ADJUST ),
+ TOKEN( "page-breaks-on-group-change", XML_PAGE_BREAKS_ON_GROUP_CHANGE ),
+ TOKEN( "page-content", XML_PAGE_CONTENT ),
+ TOKEN( "page-continuation-string", XML_PAGE_CONTINUATION_STRING ),
+ TOKEN( "page-count", XML_PAGE_COUNT ),
+ TOKEN( "page-end-margin", XML_PAGE_END_MARGIN ),
+ TOKEN( "page-height", XML_PAGE_HEIGHT ),
+ TOKEN( "page-master", XML_PAGE_MASTER ),
+ TOKEN( "page-master-name", XML_PAGE_MASTER_NAME ),
+ TOKEN( "page-number", XML_PAGE_NUMBER ),
+ TOKEN( "page-start-margin", XML_PAGE_START_MARGIN ),
+ TOKEN( "page-style-name", XML_PAGE_STYLE_NAME ),
+ TOKEN( "page-thumbnail", XML_PAGE_THUMBNAIL ),
+ TOKEN( "page-usage", XML_PAGE_USAGE ),
+ TOKEN( "page-variable-get", XML_PAGE_VARIABLE_GET ),
+ TOKEN( "page-variable-set", XML_PAGE_VARIABLE_SET ),
+ TOKEN( "page-view-zoom-value", XML_PAGE_VIEW_ZOOM_VALUE ),
+ TOKEN( "page-width", XML_PAGE_WIDTH ),
+ TOKEN( "pages", XML_PAGES ),
+ TOKEN( "paper-tray-number", XML_PAPER_TRAY_NUMBER ),
+ TOKEN( "paragraph", XML_PARAGRAPH ),
+ TOKEN( "paragraph-content", XML_PARAGRAPH_CONTENT ),
+ TOKEN( "paragraph-count", XML_PARAGRAPH_COUNT ),
+ TOKEN( "paragraph-end-margin", XML_PARAGRAPH_END_MARGIN ),
+ TOKEN( "paragraph-start-margin", XML_PARAGRAPH_START_MARGIN ),
+ TOKEN( "parallel", XML_PARALLEL ),
+ TOKEN( "param", XML_PARAM ),
+ TOKEN( "parent-style-name", XML_PARENT_STYLE_NAME ),
+ TOKEN( "parse-sql-statement", XML_PARSE_SQL_STATEMENT ),
+ TOKEN( "parsed", XML_PARSED ),
+ TOKEN( "partialdiff", XML_PARTIALDIFF ),
+ TOKEN( "password", XML_PASSWORD ),
+ TOKEN( "passwort", XML_PASSWORT ),
+ TOKEN( "path", XML_PATH ),
+ TOKEN( "path-id", XML_PATH_ID ),
+ TOKEN( "pause", XML_PAUSE ),
+ TOKEN( "pending", XML_PENDING ),
+ TOKEN( "percentage", XML_PERCENTAGE ),
+ TOKEN( "percentage-style", XML_PERCENTAGE_STYLE ),
+ TOKEN( "perspective", XML_PERSPECTIVE ),
+ TOKEN( "phdthesis", XML_PHDTHESIS ),
+ TOKEN( "phong", XML_PHONG ),
+ TOKEN( "pie-offset", XML_PIE_OFFSET ),
+ TOKEN( "placeholder", XML_PLACEHOLDER ),
+ TOKEN( "placeholder-type", XML_PLACEHOLDER_TYPE ),
+ TOKEN( "placing", XML_PLACING ),
+ TOKEN( "plain-number", XML_PLAIN_NUMBER ),
+ TOKEN( "plain-number-and-name", XML_PLAIN_NUMBER_AND_NAME ),
+ TOKEN( "play-full", XML_PLAY_FULL ),
+ TOKEN( "plot-area", XML_PLOT_AREA ),
+ TOKEN( "plugin", XML_PLUGIN ),
+ TOKEN( "plus", XML_PLUS ),
+ TOKEN( "points", XML_POINTS ),
+ TOKEN( "polygon", XML_POLYGON ),
+ TOKEN( "polyline", XML_POLYLINE ),
+ TOKEN( "polynomial", XML_POLYNOMIAL ),
+ TOKEN( "pool-id", XML_POOL_ID ),
+ TOKEN( "portrait", XML_PORTRAIT ),
+ TOKEN( "position", XML_POSITION ),
+ TOKEN( "position-bottom", XML_POSITION_BOTTOM ),
+ TOKEN( "position-left", XML_POSITION_LEFT ),
+ TOKEN( "position-right", XML_POSITION_RIGHT ),
+ TOKEN( "position-top", XML_POSITION_TOP ),
+ TOKEN( "italic", XML_POSTURE_ITALIC ),
+ TOKEN( "normal", XML_POSTURE_NORMAL ),
+ TOKEN( "oblique", XML_POSTURE_OBLIQUE ),
+ TOKEN( "power", XML_POWER ),
+ TOKEN( "precision-as-shown", XML_PRECISION_AS_SHOWN ),
+ TOKEN( "prefix", XML_PREFIX ),
+ TOKEN( "presentation", XML_PRESENTATION ),
+ TOKEN( "chart", XML_PRESENTATION_CHART ),
+ TOKEN( "graphic", XML_PRESENTATION_GRAPHIC ),
+ TOKEN( "notes", XML_PRESENTATION_NOTES ),
+ TOKEN( "object", XML_PRESENTATION_OBJECT ),
+ TOKEN( "orgchart", XML_PRESENTATION_ORGCHART ),
+ TOKEN( "outline", XML_PRESENTATION_OUTLINE ),
+ TOKEN( "page", XML_PRESENTATION_PAGE ),
+ TOKEN( "presentation-page-layout", XML_PRESENTATION_PAGE_LAYOUT ),
+ TOKEN( "presentation-page-layout-name", XML_PRESENTATION_PAGE_LAYOUT_NAME ),
+ TOKEN( "subtitle", XML_PRESENTATION_SUBTITLE ),
+ TOKEN( "table", XML_PRESENTATION_TABLE ),
+ TOKEN( "title", XML_PRESENTATION_TITLE ),
+ TOKEN( "previous", XML_PREVIOUS ),
+ TOKEN( "previous-page", XML_PREVIOUS_PAGE ),
+ TOKEN( "print", XML_PRINT ),
+ TOKEN( "print-content", XML_PRINT_CONTENT ),
+ TOKEN( "print-date", XML_PRINT_DATE ),
+ TOKEN( "print-orientation", XML_PRINT_ORIENTATION ),
+ TOKEN( "print-page-order", XML_PRINT_PAGE_ORDER ),
+ TOKEN( "print-range", XML_PRINT_RANGE ),
+ TOKEN( "print-ranges", XML_PRINT_RANGES ),
+ TOKEN( "print-time", XML_PRINT_TIME ),
+ TOKEN( "printable", XML_PRINTABLE ),
+ TOKEN( "printed-by", XML_PRINTED_BY ),
+ TOKEN( "proceedings", XML_PROCEEDINGS ),
+ TOKEN( "product", XML_PRODUCT ),
+ TOKEN( "projection", XML_PROJECTION ),
+ TOKEN( "properties", XML_PROPERTIES ),
+ TOKEN( "protect", XML_PROTECT ),
+ TOKEN( "content", XML_PROTECT_CONTENT ),
+ TOKEN( "position", XML_PROTECT_POSITION ),
+ TOKEN( "size", XML_PROTECT_SIZE ),
+ TOKEN( "protected", XML_PROTECTED ),
+ TOKEN( "protection-key", XML_PROTECTION_KEY ),
+ TOKEN( "prsubset", XML_PRSUBSET ),
+ TOKEN( "publisher", XML_PUBLISHER ),
+ TOKEN( "punctuation-wrap", XML_PUNCTUATION_WRAP ),
+ TOKEN( "purple", XML_PURPLE ),
+ TOKEN( "pyramid", XML_PYRAMID ),
+ TOKEN( "quarter", XML_QUARTER ),
+ TOKEN( "query-name", XML_QUERY_NAME ),
+ TOKEN( "quo-vadis", XML_QUO_VADIS ),
+ TOKEN( "quotient", XML_QUOTIENT ),
+ TOKEN( "r", XML_R ),
+ TOKEN( "radar", XML_RADAR ),
+ TOKEN( "random", XML_RANDOM ),
+ TOKEN( "range-address", XML_RANGE_ADDRESS ),
+ TOKEN( "range-usable-as", XML_RANGE_USABLE_AS ),
+ TOKEN( "recreate-on-edit", XML_RECREATE_ON_EDIT ),
+ TOKEN( "rect", XML_RECT ),
+ TOKEN( "red", XML_RED ),
+ TOKEN( "ref-name", XML_REF_NAME ),
+ TOKEN( "reference", XML_REFERENCE ),
+ TOKEN( "reference-end", XML_REFERENCE_END ),
+ TOKEN( "reference-format", XML_REFERENCE_FORMAT ),
+ TOKEN( "reference-mark", XML_REFERENCE_MARK ),
+ TOKEN( "reference-mark-end", XML_REFERENCE_MARK_END ),
+ TOKEN( "reference-mark-start", XML_REFERENCE_MARK_START ),
+ TOKEN( "reference-ref", XML_REFERENCE_REF ),
+ TOKEN( "reference-start", XML_REFERENCE_START ),
+ TOKEN( "reference-type", XML_REFERENCE_TYPE ),
+ TOKEN( "refresh-delay", XML_REFRESH_DELAY ),
+ TOKEN( "region-center", XML_REGION_CENTER ),
+ TOKEN( "region-left", XML_REGION_LEFT ),
+ TOKEN( "region-right", XML_REGION_RIGHT ),
+ TOKEN( "register-true", XML_REGISTER_TRUE ),
+ TOKEN( "register-truth-ref-style-name", XML_REGISTER_TRUTH_REF_STYLE_NAME ),
+ TOKEN( "regression-type", XML_REGRESSION_TYPE ),
+ TOKEN( "rejected", XML_REJECTED ),
+ TOKEN( "rejecting-change-id", XML_REJECTING_CHANGE_ID ),
+ TOKEN( "rejection", XML_REJECTION ),
+ TOKEN( "rel-column-width", XML_REL_COLUMN_WIDTH ),
+ TOKEN( "rel-height", XML_REL_HEIGHT ),
+ TOKEN( "rel-width", XML_REL_WIDTH ),
+ TOKEN( "relative", XML_RELATIVE ),
+ TOKEN( "relative-tab-stop-position", XML_RELATIVE_TAB_STOP_POSITION ),
+ TOKEN( "reln", XML_RELN ),
+ TOKEN( "rem", XML_REM ),
+ TOKEN( "remove-dependents", XML_REMOVE_DEPENDENTS ),
+ TOKEN( "remove-precedents", XML_REMOVE_PRECEDENTS ),
+ TOKEN( "repeat", XML_REPEAT ),
+ TOKEN( "repeat-column", XML_REPEAT_COLUMN ),
+ TOKEN( "repeat-row", XML_REPEAT_ROW ),
+ TOKEN( "repeated", XML_REPEATED ),
+ TOKEN( "replace", XML_REPLACE ),
+ TOKEN( "report-type", XML_REPORT_TYPE ),
+ TOKEN( "restart-on-page", XML_RESTART_ON_PAGE ),
+ TOKEN( "revision", XML_REVISION ),
+ TOKEN( "ridge", XML_RIDGE ),
+ TOKEN( "right", XML_RIGHT ),
+ TOKEN( "right-outside", XML_RIGHT_OUTSIDE ),
+ TOKEN( "right-arc", XML_RIGHTARC ),
+ TOKEN( "right-circle", XML_RIGHTCIRCLE ),
+ TOKEN( "ring", XML_RING ),
+ TOKEN( "role", XML_ROLE ),
+ TOKEN( "roll-from-bottom", XML_ROLL_FROM_BOTTOM ),
+ TOKEN( "roll-from-left", XML_ROLL_FROM_LEFT ),
+ TOKEN( "roll-from-right", XML_ROLL_FROM_RIGHT ),
+ TOKEN( "roman", XML_ROMAN ),
+ TOKEN( "root", XML_ROOT ),
+ TOKEN( "rotate", XML_ROTATE ),
+ TOKEN( "rotation", XML_ROTATION ),
+ TOKEN( "rotation-align", XML_ROTATION_ALIGN ),
+ TOKEN( "rotation-angle", XML_ROTATION_ANGLE ),
+ TOKEN( "round", XML_ROUND ),
+ TOKEN( "row", XML_ROW ),
+ TOKEN( "row-height", XML_ROW_HEIGHT ),
+ TOKEN( "row-number", XML_ROW_NUMBER ),
+ TOKEN( "rows", XML_ROWS ),
+ TOKEN( "ruby", XML_RUBY ),
+ TOKEN( "ruby-align", XML_RUBY_ALIGN ),
+ TOKEN( "ruby-base", XML_RUBY_BASE ),
+ TOKEN( "ruby-position", XML_RUBY_POSITION ),
+ TOKEN( "ruby-text", XML_RUBY_TEXT ),
+ TOKEN( "run-through", XML_RUN_THROUGH ),
+ TOKEN( "rx", XML_RX ),
+ TOKEN( "ry", XML_RY ),
+ TOKEN( "s", XML_S ),
+ TOKEN( "scale", XML_SCALE ),
+ TOKEN( "scale-min", XML_SCALE_MIN ),
+ TOKEN( "scale-text", XML_SCALE_TEXT ),
+ TOKEN( "scale-to", XML_SCALE_TO ),
+ TOKEN( "scale-to-pages", XML_SCALE_TO_PAGES ),
+ TOKEN( "scatter", XML_SCATTER ),
+ TOKEN( "scenario", XML_SCENARIO ),
+ TOKEN( "scenario-ranges", XML_SCENARIO_RANGES ),
+ TOKEN( "scene", XML_SCENE ),
+ TOKEN( "school", XML_SCHOOL ),
+ TOKEN( "scientific-number", XML_SCIENTIFIC_NUMBER ),
+ TOKEN( "score-spaces", XML_SCORE_SPACES ),
+ TOKEN( "script", XML_SCRIPT ),
+ TOKEN( "scroll", XML_SCROLL ),
+ TOKEN( "sdev", XML_SDEV ),
+ TOKEN( "search-criteria-must-apply-to-whole-cell", XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL ),
+ TOKEN( "sec", XML_SEC ),
+ TOKEN( "sech", XML_SECH ),
+ TOKEN( "second-date-time", XML_SECOND_DATE_TIME ),
+ TOKEN( "seconds", XML_SECONDS ),
+ TOKEN( "section", XML_SECTION ),
+ TOKEN( "section-desc", XML_SECTION_DESC ),
+ TOKEN( "section-name", XML_SECTION_NAME ),
+ TOKEN( "section-source", XML_SECTION_SOURCE ),
+ TOKEN( "select-page", XML_SELECT_PAGE ),
+ TOKEN( "selector", XML_SELECTOR ),
+ TOKEN( "semantics", XML_SEMANTICS ),
+ TOKEN( "semi-automatic", XML_SEMI_AUTOMATIC ),
+ TOKEN( "sender-city", XML_SENDER_CITY ),
+ TOKEN( "sender-company", XML_SENDER_COMPANY ),
+ TOKEN( "sender-country", XML_SENDER_COUNTRY ),
+ TOKEN( "sender-email", XML_SENDER_EMAIL ),
+ TOKEN( "sender-fax", XML_SENDER_FAX ),
+ TOKEN( "sender-firstname", XML_SENDER_FIRSTNAME ),
+ TOKEN( "sender-initials", XML_SENDER_INITIALS ),
+ TOKEN( "sender-lastname", XML_SENDER_LASTNAME ),
+ TOKEN( "sender-phone-private", XML_SENDER_PHONE_PRIVATE ),
+ TOKEN( "sender-phone-work", XML_SENDER_PHONE_WORK ),
+ TOKEN( "sender-position", XML_SENDER_POSITION ),
+ TOKEN( "sender-postal-code", XML_SENDER_POSTAL_CODE ),
+ TOKEN( "sender-state-or-province", XML_SENDER_STATE_OR_PROVINCE ),
+ TOKEN( "sender-street", XML_SENDER_STREET ),
+ TOKEN( "sender-title", XML_SENDER_TITLE ),
+ TOKEN( "sep", XML_SEP ),
+ TOKEN( "separation-character", XML_SEPARATION_CHARACTER ),
+ TOKEN( "separator", XML_SEPARATOR ),
+ TOKEN( "sequence", XML_SEQUENCE ),
+ TOKEN( "sequence-decl", XML_SEQUENCE_DECL ),
+ TOKEN( "sequence-decls", XML_SEQUENCE_DECLS ),
+ TOKEN( "sequence-ref", XML_SEQUENCE_REF ),
+ TOKEN( "series", XML_SERIES ),
+ TOKEN( "series-source", XML_SERIES_SOURCE ),
+ TOKEN( "server-map", XML_SERVER_MAP ),
+ TOKEN( "set", XML_SET ),
+ TOKEN( "setdiff", XML_SETDIFF ),
+ TOKEN( "settings", XML_SETTINGS ),
+ TOKEN( "shade-mode", XML_SHADE_MODE ),
+ TOKEN( "shadow", XML_SHADOW ),
+ TOKEN( "shadow-color", XML_SHADOW_COLOR ),
+ TOKEN( "shadow-offset-x", XML_SHADOW_OFFSET_X ),
+ TOKEN( "shadow-offset-y", XML_SHADOW_OFFSET_Y ),
+ TOKEN( "shadow-slant", XML_SHADOW_SLANT ),
+ TOKEN( "shadow-transparency", XML_SHADOW_TRANSPARENCY ),
+ TOKEN( "shape", XML_SHAPE ),
+ TOKEN( "shape-id", XML_SHAPE_ID ),
+ TOKEN( "shapes", XML_SHAPES ),
+ TOKEN( "sheet-name", XML_SHEET_NAME ),
+ TOKEN( "shininess", XML_SHININESS ),
+ TOKEN( "short", XML_SHORT ),
+ TOKEN( "show", XML_SHOW ),
+ TOKEN( "show-accepted-changes", XML_SHOW_ACCEPTED_CHANGES ),
+ TOKEN( "show-changes", XML_SHOW_CHANGES ),
+ TOKEN( "show-changes-by-author", XML_SHOW_CHANGES_BY_AUTHOR ),
+ TOKEN( "show-changes-by-author-name", XML_SHOW_CHANGES_BY_AUTHOR_NAME ),
+ TOKEN( "show-changes-by-comment", XML_SHOW_CHANGES_BY_COMMENT ),
+ TOKEN( "show-changes-by-comment-text", XML_SHOW_CHANGES_BY_COMMENT_TEXT ),
+ TOKEN( "show-changes-by-datetime", XML_SHOW_CHANGES_BY_DATETIME ),
+ TOKEN( "show-changes-by-datetime-first-datetime", XML_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME ),
+ TOKEN( "show-changes-by-datetime-mode", XML_SHOW_CHANGES_BY_DATETIME_MODE ),
+ TOKEN( "show-changes-by-datetime-second-datetime", XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME ),
+ TOKEN( "show-changes-by-ranges", XML_SHOW_CHANGES_BY_RANGES ),
+ TOKEN( "show-changes-by-ranges-list", XML_SHOW_CHANGES_BY_RANGES_LIST ),
+ TOKEN( "show-logo", XML_SHOW_LOGO ),
+ TOKEN( "show-rejected-changes", XML_SHOW_REJECTED_CHANGES ),
+ TOKEN( "show-shape", XML_SHOW_SHAPE ),
+ TOKEN( "show-text", XML_SHOW_TEXT ),
+ TOKEN( "show-unit", XML_SHOW_UNIT ),
+ TOKEN( "shows", XML_SHOWS ),
+ TOKEN( "side-by-side", XML_SIDE_BY_SIDE ),
+ TOKEN( "silver", XML_SILVER ),
+ TOKEN( "simple", XML_SIMPLE ),
+ TOKEN( "sin", XML_SIN ),
+ TOKEN( "since-date-time", XML_SINCE_DATE_TIME ),
+ TOKEN( "since-save", XML_SINCE_SAVE ),
+ TOKEN( "sinh", XML_SINH ),
+ TOKEN( "size", XML_SIZE ),
+ TOKEN( "size-protect", XML_SIZE_PROTECT ),
+ TOKEN( "slant", XML_SLANT ),
+ TOKEN( "slant-x", XML_SLANT_X ),
+ TOKEN( "slant-y", XML_SLANT_Y ),
+ TOKEN( "slide", XML_SLIDE ),
+ TOKEN( "slow", XML_SLOW ),
+ TOKEN( "solid", XML_SOLID ),
+ TOKEN( "solid-type", XML_SOLID_TYPE ),
+ TOKEN( "sort", XML_SORT ),
+ TOKEN( "sort-ascending", XML_SORT_ASCENDING ),
+ TOKEN( "sort-by", XML_SORT_BY ),
+ TOKEN( "sort-by-position", XML_SORT_BY_POSITION ),
+ TOKEN( "sort-groups", XML_SORT_GROUPS ),
+ TOKEN( "sort-key", XML_SORT_KEY ),
+ TOKEN( "sound", XML_SOUND ),
+ TOKEN( "source-cell-range", XML_SOURCE_CELL_RANGE ),
+ TOKEN( "source-cell-range-addresses", XML_SOURCE_CELL_RANGE_ADDRESSES ),
+ TOKEN( "source-field-name", XML_SOURCE_FIELD_NAME ),
+ TOKEN( "source-name", XML_SOURCE_NAME ),
+ TOKEN( "source-range-address", XML_SOURCE_RANGE_ADDRESS ),
+ TOKEN( "source-service", XML_SOURCE_SERVICE ),
+ TOKEN( "space-before", XML_SPACE_BEFORE ),
+ TOKEN( "span", XML_SPAN ),
+ TOKEN( "specular", XML_SPECULAR ),
+ TOKEN( "specular-color", XML_SPECULAR_COLOR ),
+ TOKEN( "speed", XML_SPEED ),
+ TOKEN( "sphere", XML_SPHERE ),
+ TOKEN( "spiral", XML_SPIRAL ),
+ TOKEN( "spiral-in", XML_SPIRAL_IN ),
+ TOKEN( "spiral-inward-left", XML_SPIRAL_INWARD_LEFT ),
+ TOKEN( "spiral-inward-right", XML_SPIRAL_INWARD_RIGHT ),
+ TOKEN( "spiral-out", XML_SPIRAL_OUT ),
+ TOKEN( "spiral-outward-left", XML_SPIRAL_OUTWARD_LEFT ),
+ TOKEN( "spiral-outward-right", XML_SPIRAL_OUTWARD_RIGHT ),
+ TOKEN( "spiralin-left", XML_SPIRALIN_LEFT ),
+ TOKEN( "spiralin-right", XML_SPIRALIN_RIGHT ),
+ TOKEN( "spiralout-left", XML_SPIRALOUT_LEFT ),
+ TOKEN( "spiralout-right", XML_SPIRALOUT_RIGHT ),
+ TOKEN( "splines", XML_SPLINES ),
+ TOKEN( "split", XML_SPLIT ),
+ TOKEN( "split-column", XML_SPLIT_COLUMN ),
+ TOKEN( "split-position", XML_SPLIT_POSITION ),
+ TOKEN( "split-row", XML_SPLIT_ROW ),
+ TOKEN( "spreadsheet", XML_SPREADSHEET ),
+ TOKEN( "sql-statement", XML_SQL_STATEMENT ),
+ TOKEN( "stacked", XML_STACKED ),
+ TOKEN( "stagger-even", XML_STAGGER_EVEN ),
+ TOKEN( "stagger-odd", XML_STAGGER_ODD ),
+ TOKEN( "standard", XML_STANDARD ),
+ TOKEN( "standard-deviation", XML_STANDARD_DEVIATION ),
+ TOKEN( "starbasic", XML_STARBASIC ),
+ TOKEN( "start", XML_START ),
+ TOKEN( "start-angle", XML_START_ANGLE ),
+ TOKEN( "start-color", XML_START_COLOR ),
+ TOKEN( "start-column", XML_START_COLUMN ),
+ TOKEN( "start-glue-point", XML_START_GLUE_POINT ),
+ TOKEN( "start-guide", XML_START_GUIDE ),
+ TOKEN( "start-intensity", XML_START_INTENSITY ),
+ TOKEN( "start-line-spacing-horizontal", XML_START_LINE_SPACING_HORIZONTAL ),
+ TOKEN( "start-line-spacing-vertical", XML_START_LINE_SPACING_VERTICAL ),
+ TOKEN( "start-numbering-at", XML_START_NUMBERING_AT ),
+ TOKEN( "start-page", XML_START_PAGE ),
+ TOKEN( "start-position", XML_START_POSITION ),
+ TOKEN( "start-row", XML_START_ROW ),
+ TOKEN( "start-scale", XML_START_SCALE ),
+ TOKEN( "start-shape", XML_START_SHAPE ),
+ TOKEN( "start-table", XML_START_TABLE ),
+ TOKEN( "start-value", XML_START_VALUE ),
+ TOKEN( "start-with-navigator", XML_START_WITH_NAVIGATOR ),
+ TOKEN( "statistics", XML_STATISTICS ),
+ TOKEN( "status", XML_STATUS ),
+ TOKEN( "stay-on-top", XML_STAY_ON_TOP ),
+ TOKEN( "stdev", XML_STDEV ),
+ TOKEN( "stdevp", XML_STDEVP ),
+ TOKEN( "steps", XML_STEPS ),
+ TOKEN( "stock", XML_STOCK ),
+ TOKEN( "stock-updown-bars", XML_STOCK_UPDOWN_BARS ),
+ TOKEN( "stock-with-volume", XML_STOCK_WITH_VOLUME ),
+ TOKEN( "stop", XML_STOP ),
+ TOKEN( "stretch", XML_STRETCH ),
+ TOKEN( "stretch-from-bottom", XML_STRETCH_FROM_BOTTOM ),
+ TOKEN( "stretch-from-left", XML_STRETCH_FROM_LEFT ),
+ TOKEN( "stretch-from-right", XML_STRETCH_FROM_RIGHT ),
+ TOKEN( "stretch-from-top", XML_STRETCH_FROM_TOP ),
+ TOKEN( "stretchy", XML_STRETCHY ),
+ TOKEN( "strict", XML_STRICT ),
+ TOKEN( "string", XML_STRING ),
+ TOKEN( "string-value", XML_STRING_VALUE ),
+ TOKEN( "string-value-if-false", XML_STRING_VALUE_IF_FALSE ),
+ TOKEN( "string-value-if-true", XML_STRING_VALUE_IF_TRUE ),
+ TOKEN( "stripes", XML_STRIPES ),
+ TOKEN( "stroke", XML_STROKE ),
+ TOKEN( "stroke-color", XML_STROKE_COLOR ),
+ TOKEN( "stroke-dash", XML_STROKE_DASH ),
+ TOKEN( "stroke-linejoin", XML_STROKE_LINEJOIN ),
+ TOKEN( "stroke-opacity", XML_STROKE_OPACITY ),
+ TOKEN( "stroke-width", XML_STROKE_WIDTH ),
+ TOKEN( "structure-protected", XML_STRUCTURE_PROTECTED ),
+ TOKEN( "style", XML_STYLE ),
+ TOKEN( "style-name", XML_STYLE_NAME ),
+ TOKEN( "styles", XML_STYLES ),
+ TOKEN( "stylesheet", XML_STYLESHEET ),
+ TOKEN( "sub-table", XML_SUB_TABLE ),
+ TOKEN( "subject", XML_SUBJECT ),
+ TOKEN( "subset", XML_SUBSET ),
+ TOKEN( "subtitle", XML_SUBTITLE ),
+ TOKEN( "subtotal-field", XML_SUBTOTAL_FIELD ),
+ TOKEN( "subtotal-rule", XML_SUBTOTAL_RULE ),
+ TOKEN( "subtotal-rules", XML_SUBTOTAL_RULES ),
+ TOKEN( "suffix", XML_SUFFIX ),
+ TOKEN( "sum", XML_SUM ),
+ TOKEN( "swiss", XML_SWISS ),
+ TOKEN( "symbol", XML_SYMBOL ),
+ TOKEN( "symbol-height", XML_SYMBOL_HEIGHT ),
+ TOKEN( "symbol-image-name", XML_SYMBOL_IMAGE_NAME ),
+ TOKEN( "symbol-width", XML_SYMBOL_WIDTH ),
+ TOKEN( "system", XML_SYSTEM ),
+ TOKEN( "tab-color", XML_TAB_COLOR ),
+ TOKEN( "tab-stop", XML_TAB_STOP ),
+ TOKEN( "tab-stop-distance", XML_TAB_STOP_DISTANCE ),
+ TOKEN( "tab-stops", XML_TAB_STOPS ),
+ TOKEN( "table", XML_TABLE ),
+ TOKEN( "table-background", XML_TABLE_BACKGROUND ),
+ TOKEN( "table-cell", XML_TABLE_CELL ),
+ TOKEN( "table-centering", XML_TABLE_CENTERING ),
+ TOKEN( "table-column", XML_TABLE_COLUMN ),
+ TOKEN( "table-column-group", XML_TABLE_COLUMN_GROUP ),
+ TOKEN( "table-columns", XML_TABLE_COLUMNS ),
+ TOKEN( "table-count", XML_TABLE_COUNT ),
+ TOKEN( "table-header", XML_TABLE_HEADER ),
+ TOKEN( "table-header-columns", XML_TABLE_HEADER_COLUMNS ),
+ TOKEN( "table-header-rows", XML_TABLE_HEADER_ROWS ),
+ TOKEN( "table-index", XML_TABLE_INDEX ),
+ TOKEN( "table-index-entry-template", XML_TABLE_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "table-index-source", XML_TABLE_INDEX_SOURCE ),
+ TOKEN( "table-name", XML_TABLE_NAME ),
+ TOKEN( "table-number-list", XML_TABLE_NUMBER_LIST ),
+ TOKEN( "table-of-content", XML_TABLE_OF_CONTENT ),
+ TOKEN( "table-of-content-entry-template", XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE ),
+ TOKEN( "table-of-content-source", XML_TABLE_OF_CONTENT_SOURCE ),
+ TOKEN( "table-page", XML_TABLE_PAGE ),
+ TOKEN( "table-row", XML_TABLE_ROW ),
+ TOKEN( "table-row-group", XML_TABLE_ROW_GROUP ),
+ TOKEN( "table-rows", XML_TABLE_ROWS ),
+ TOKEN( "table-source", XML_TABLE_SOURCE ),
+ TOKEN( "table-view", XML_TABLE_VIEW ),
+ TOKEN( "tables", XML_TABLES ),
+ TOKEN( "tan", XML_TAN ),
+ TOKEN( "tanh", XML_TANH ),
+ TOKEN( "target-cell-address", XML_TARGET_CELL_ADDRESS ),
+ TOKEN( "target-frame-name", XML_TARGET_FRAME_NAME ),
+ TOKEN( "target-range-address", XML_TARGET_RANGE_ADDRESS ),
+ TOKEN( "tb-rl", XML_TB_RL ),
+ TOKEN( "teal", XML_TEAL ),
+ TOKEN( "techreport", XML_TECHREPORT ),
+ TOKEN( "template", XML_TEMPLATE ),
+ TOKEN( "template-name", XML_TEMPLATE_NAME ),
+ TOKEN( "tendsto", XML_TENDSTO ),
+ TOKEN( "texture-filter", XML_TEX_FILTER ),
+ TOKEN( "texture-generation-mode-x", XML_TEX_GENERATION_MODE_X ),
+ TOKEN( "texture-generation-mode-y", XML_TEX_GENERATION_MODE_Y ),
+ TOKEN( "texture-kind", XML_TEX_KIND ),
+ TOKEN( "texture-mode", XML_TEX_MODE ),
+ TOKEN( "text", XML_TEXT ),
+ TOKEN( "text-align", XML_TEXT_ALIGN ),
+ TOKEN( "text-align-last", XML_TEXT_ALIGN_LAST ),
+ TOKEN( "text-align-source", XML_TEXT_ALIGN_SOURCE ),
+ TOKEN( "text-autospace", XML_TEXT_AUTOSPACE ),
+ TOKEN( "text-background-color", XML_TEXT_BACKGROUND_COLOR ),
+ TOKEN( "text-blinking", XML_TEXT_BLINKING ),
+ TOKEN( "text-box", XML_TEXT_BOX ),
+ TOKEN( "text-combine", XML_TEXT_COMBINE ),
+ TOKEN( "text-combine-end-char", XML_TEXT_COMBINE_END_CHAR ),
+ TOKEN( "text-combine-start-char", XML_TEXT_COMBINE_START_CHAR ),
+ TOKEN( "text-content", XML_TEXT_CONTENT ),
+ TOKEN( "text-crossing-out", XML_TEXT_CROSSING_OUT ),
+ TOKEN( "text-emphasize", XML_TEXT_EMPHASIZE ),
+ TOKEN( "text-global", XML_TEXT_GLOBAL ),
+ TOKEN( "text-indent", XML_TEXT_INDENT ),
+ TOKEN( "text-input", XML_TEXT_INPUT ),
+ TOKEN( "text-outline", XML_TEXT_OUTLINE ),
+ TOKEN( "text-position", XML_TEXT_POSITION ),
+ TOKEN( "text-rotation-angle", XML_TEXT_ROTATION_ANGLE ),
+ TOKEN( "text-rotation-scale", XML_TEXT_ROTATION_SCALE ),
+ TOKEN( "text-scale", XML_TEXT_SCALE ),
+ TOKEN( "text-shadow", XML_TEXT_SHADOW ),
+ TOKEN( "text-style", XML_TEXT_STYLE ),
+ TOKEN( "text-transform", XML_TEXT_TRANSFORM ),
+ TOKEN( "text-underline", XML_TEXT_UNDERLINE ),
+ TOKEN( "text-underline-color", XML_TEXT_UNDERLINE_COLOR ),
+ TOKEN( "textarea-horizontal-align", XML_TEXTAREA_HORIZONTAL_ALIGN ),
+ TOKEN( "textarea-vertical-align", XML_TEXTAREA_VERTICAL_ALIGN ),
+ TOKEN( "textual", XML_TEXTUAL ),
+ TOKEN( "thick", XML_THICK ),
+ TOKEN( "thin", XML_THIN ),
+ TOKEN( "three-dimensional", XML_THREE_DIMENSIONAL ),
+ TOKEN( "thumbnail", XML_THUMBNAIL ),
+ TOKEN( "tick-marks-major-inner", XML_TICK_MARKS_MAJOR_INNER ),
+ TOKEN( "tick-marks-major-outer", XML_TICK_MARKS_MAJOR_OUTER ),
+ TOKEN( "tick-marks-minor-inner", XML_TICK_MARKS_MINOR_INNER ),
+ TOKEN( "tick-marks-minor-outer", XML_TICK_MARKS_MINOR_OUTER ),
+ TOKEN( "tile-repeat-offset", XML_TILE_REPEAT_OFFSET ),
+ TOKEN( "time", XML_TIME ),
+ TOKEN( "time-adjust", XML_TIME_ADJUST ),
+ TOKEN( "time-style", XML_TIME_STYLE ),
+ TOKEN( "time-value", XML_TIME_VALUE ),
+ TOKEN( "times", XML_TIMES ),
+ TOKEN( "title", XML_TITLE ),
+ TOKEN( "to-another-table", XML_TO_ANOTHER_TABLE ),
+ TOKEN( "to-bottom", XML_TO_BOTTOM ),
+ TOKEN( "to-center", XML_TO_CENTER ),
+ TOKEN( "to-left", XML_TO_LEFT ),
+ TOKEN( "to-lower-left", XML_TO_LOWER_LEFT ),
+ TOKEN( "to-lower-right", XML_TO_LOWER_RIGHT ),
+ TOKEN( "to-right", XML_TO_RIGHT ),
+ TOKEN( "to-top", XML_TO_TOP ),
+ TOKEN( "to-upper-left", XML_TO_UPPER_LEFT ),
+ TOKEN( "to-upper-right", XML_TO_UPPER_RIGHT ),
+ TOKEN( "toc-mark", XML_TOC_MARK ),
+ TOKEN( "toc-mark-end", XML_TOC_MARK_END ),
+ TOKEN( "toc-mark-start", XML_TOC_MARK_START ),
+ TOKEN( "top", XML_TOP ),
+ TOKEN( "top-left", XML_TOP_LEFT ),
+ TOKEN( "top percent", XML_TOP_PERCENT ),
+ TOKEN( "top-right", XML_TOP_RIGHT ),
+ TOKEN( "top values", XML_TOP_VALUES ),
+ TOKEN( "top-arc", XML_TOPARC ),
+ TOKEN( "top-circle", XML_TOPCIRCLE ),
+ TOKEN( "trace-dependents", XML_TRACE_DEPENDENTS ),
+ TOKEN( "trace-errors", XML_TRACE_ERRORS ),
+ TOKEN( "trace-precedents", XML_TRACE_PRECEDENTS ),
+ TOKEN( "track-changes", XML_TRACK_CHANGES ),
+ TOKEN( "tracked-changes", XML_TRACKED_CHANGES ),
+ TOKEN( "tracked-changes-view-settings", XML_TRACKED_CHANGES_VIEW_SETTINGS ),
+ TOKEN( "transform", XML_TRANSFORM ),
+ TOKEN( "transition-on-click", XML_TRANSITION_ON_CLICK ),
+ TOKEN( "transparency", XML_TRANSPARENCY ),
+ TOKEN( "transparency-name", XML_TRANSPARENCY_NAME ),
+ TOKEN( "transparent", XML_TRANSPARENT ),
+ TOKEN( "transpose", XML_TRANSPOSE ),
+ TOKEN( "true", XML_TRUE ),
+ TOKEN( "truncate-on-overflow", XML_TRUNCATE_ON_OVERFLOW ),
+ TOKEN( "ttb", XML_TTB ),
+ TOKEN( "type", XML_TYPE ),
+ TOKEN( "dot-dash", XML_DOT_DASH ),
+ TOKEN( "dot-dot-dash", XML_DOT_DOT_DASH ),
+ TOKEN( "long-dash", XML_LONG_DASH ),
+ TOKEN( "single", XML_SINGLE ),
+ TOKEN( "small-wave", XML_SMALL_WAVE ),
+ TOKEN( "wave", XML_WAVE ),
+ TOKEN( "unformatted-text", XML_UNFORMATTED_TEXT ),
+ TOKEN( "union", XML_UNION ),
+ TOKEN( "unit", XML_UNIT ),
+ TOKEN( "unordered-list", XML_UNORDERED_LIST ),
+ TOKEN( "unpublished", XML_UNPUBLISHED ),
+ TOKEN( "up", XML_UP ),
+ TOKEN( "uplimit", XML_UPLIMIT ),
+ TOKEN( "upright", XML_UPRIGHT ),
+ TOKEN( "url", XML_URL ),
+ TOKEN( "use-caption", XML_USE_CAPTION ),
+ TOKEN( "use-cell-protection", XML_USE_CELL_PROTECTION ),
+ TOKEN( "use-chart-objects", XML_USE_CHART_OBJECTS ),
+ TOKEN( "use-condition", XML_USE_CONDITION ),
+ TOKEN( "use-draw-objects", XML_USE_DRAW_OBJECTS ),
+ TOKEN( "use-floating-frames", XML_USE_FLOATING_FRAMES ),
+ TOKEN( "use-graphics", XML_USE_GRAPHICS ),
+ TOKEN( "use-image-objects", XML_USE_IMAGE_OBJECTS ),
+ TOKEN( "use-index-marks", XML_USE_INDEX_MARKS ),
+ TOKEN( "use-index-source-styles", XML_USE_INDEX_SOURCE_STYLES ),
+ TOKEN( "use-keys-as-entries", XML_USE_KEYS_AS_ENTRIES ),
+ TOKEN( "use-label", XML_USE_LABEL ),
+ TOKEN( "use-math-objects", XML_USE_MATH_OBJECTS ),
+ TOKEN( "use-objects", XML_USE_OBJECTS ),
+ TOKEN( "use-optimal-column-width", XML_USE_OPTIMAL_COLUMN_WIDTH ),
+ TOKEN( "use-optimal-row-height", XML_USE_OPTIMAL_ROW_HEIGHT ),
+ TOKEN( "use-other-objects", XML_USE_OTHER_OBJECTS ),
+ TOKEN( "use-spreadsheet-objects", XML_USE_SPREADSHEET_OBJECTS ),
+ TOKEN( "use-styles", XML_USE_STYLES ),
+ TOKEN( "use-tables", XML_USE_TABLES ),
+ TOKEN( "use-window-font-color", XML_USE_WINDOW_FONT_COLOR ),
+ TOKEN( "used-hierarchy", XML_USED_HIERARCHY ),
+ TOKEN( "user-defined", XML_USER_DEFINED ),
+ TOKEN( "user-field-decl", XML_USER_FIELD_DECL ),
+ TOKEN( "user-field-decls", XML_USER_FIELD_DECLS ),
+ TOKEN( "user-field-get", XML_USER_FIELD_GET ),
+ TOKEN( "user-field-input", XML_USER_FIELD_INPUT ),
+ TOKEN( "user-index", XML_USER_INDEX ),
+ TOKEN( "user-index-entry-template", XML_USER_INDEX_ENTRY_TEMPLATE ),
+ TOKEN( "user-index-mark", XML_USER_INDEX_MARK ),
+ TOKEN( "user-index-mark-end", XML_USER_INDEX_MARK_END ),
+ TOKEN( "user-index-mark-start", XML_USER_INDEX_MARK_START ),
+ TOKEN( "user-index-source", XML_USER_INDEX_SOURCE ),
+ TOKEN( "user-transformed", XML_USER_TRANSFORMED ),
+ TOKEN( "username", XML_USERNAME ),
+ TOKEN( "value", XML_VALUE ),
+ TOKEN( "value-type", XML_VALUE_TYPE ),
+ TOKEN( "values-cell-range-address", XML_VALUES_CELL_RANGE_ADDRESS ),
+ TOKEN( "var", XML_VAR ),
+ TOKEN( "variable", XML_VARIABLE ),
+ TOKEN( "variable-decl", XML_VARIABLE_DECL ),
+ TOKEN( "variable-decls", XML_VARIABLE_DECLS ),
+ TOKEN( "variable-get", XML_VARIABLE_GET ),
+ TOKEN( "variable-input", XML_VARIABLE_INPUT ),
+ TOKEN( "variable-set", XML_VARIABLE_SET ),
+ TOKEN( "variance", XML_VARIANCE ),
+ TOKEN( "varp", XML_VARP ),
+ TOKEN( "vector", XML_VECTOR ),
+ TOKEN( "verb", XML_VERB ),
+ TOKEN( "version", XML_VERSION ),
+ TOKEN( "version-entry", XML_VERSION_ENTRY ),
+ TOKEN( "version-list", XML_VERSION_LIST ),
+ TOKEN( "vertical", XML_VERTICAL ),
+ TOKEN( "vertical-align", XML_VERTICAL_ALIGN ),
+ TOKEN( "vertical-lines", XML_VERTICAL_LINES ),
+ TOKEN( "vertical-pos", XML_VERTICAL_POS ),
+ TOKEN( "vertical-rel", XML_VERTICAL_REL ),
+ TOKEN( "vertical-segments", XML_VERTICAL_SEGMENTS ),
+ TOKEN( "vertical-split-mode", XML_VERTICAL_SPLIT_MODE ),
+ TOKEN( "vertical-split-position", XML_VERTICAL_SPLIT_POSITION ),
+ TOKEN( "vertical-stripes", XML_VERTICAL_STRIPES ),
+ TOKEN( "view", XML_VIEW ),
+ TOKEN( "viewBox", XML_VIEWBOX ),
+ TOKEN( "view-id", XML_VIEW_ID ),
+ TOKEN( "view-settings", XML_VIEW_SETTINGS ),
+ TOKEN( "visibility", XML_VISIBILITY ),
+ TOKEN( "visible", XML_VISIBLE ),
+ TOKEN( "visible-area", XML_VISIBLE_AREA ),
+ TOKEN( "visible-area-height", XML_VISIBLE_AREA_HEIGHT ),
+ TOKEN( "visible-area-left", XML_VISIBLE_AREA_LEFT ),
+ TOKEN( "visible-area-top", XML_VISIBLE_AREA_TOP ),
+ TOKEN( "visible-area-width", XML_VISIBLE_AREA_WIDTH ),
+ TOKEN( "visited-style-name", XML_VISITED_STYLE_NAME ),
+ TOKEN( "volatile", XML_VOLATILE ),
+ TOKEN( "volume", XML_VOLUME ),
+ TOKEN( "vpn", XML_VPN ),
+ TOKEN( "vrp", XML_VRP ),
+ TOKEN( "vup", XML_VUP ),
+ TOKEN( "wall", XML_WALL ),
+ TOKEN( "warning", XML_WARNING ),
+ TOKEN( "watermark", XML_WATERMARK ),
+ TOKEN( "wavyline", XML_WAVYLINE ),
+ TOKEN( "wavyline-from-bottom", XML_WAVYLINE_FROM_BOTTOM ),
+ TOKEN( "wavyline-from-left", XML_WAVYLINE_FROM_LEFT ),
+ TOKEN( "wavyline-from-right", XML_WAVYLINE_FROM_RIGHT ),
+ TOKEN( "wavyline-from-top", XML_WAVYLINE_FROM_TOP ),
+ TOKEN( "week-of-year", XML_WEEK_OF_YEAR ),
+ TOKEN( "bold", XML_WEIGHT_BOLD ),
+ TOKEN( "normal", XML_WEIGHT_NORMAL ),
+ TOKEN( "white", XML_WHITE ),
+ TOKEN( "whole-page", XML_WHOLE_PAGE ),
+ TOKEN( "widows", XML_WIDOWS ),
+ TOKEN( "width", XML_WIDTH ),
+ TOKEN( "word", XML_WORD ),
+ TOKEN( "word-count", XML_WORD_COUNT ),
+ TOKEN( "wrap", XML_WRAP ),
+ TOKEN( "wrap-contour", XML_WRAP_CONTOUR ),
+ TOKEN( "wrap-contour-mode", XML_WRAP_CONTOUR_MODE ),
+ TOKEN( "wrap-option", XML_WRAP_OPTION ),
+ TOKEN( "writing-mode", XML_WRITING_MODE ),
+ TOKEN( "www", XML_WWW ),
+ TOKEN( "x", XML_X ),
+ TOKEN( "x1", XML_X1 ),
+ TOKEN( "x2", XML_X2 ),
+ TOKEN( "x-mac-roman", XML_X_MAC_ROMAN ),
+ TOKEN( "x-symbol", XML_X_SYMBOL ),
+ TOKEN( "x-system", XML_X_SYSTEM ),
+ TOKEN( "xor", XML_XOR ),
+ TOKEN( "y", XML_Y ),
+ TOKEN( "y1", XML_Y1 ),
+ TOKEN( "y2", XML_Y2 ),
+ TOKEN( "year", XML_YEAR ),
+ TOKEN( "yellow", XML_YELLOW ),
+ TOKEN( "zero-values", XML_ZERO_VALUES ),
+ TOKEN( "z-index", XML_ZINDEX ),
+ TOKEN( "zoom-type", XML_ZOOM_TYPE ),
+ TOKEN( "zoom-value", XML_ZOOM_VALUE ),
+
+ TOKEN( "enable", XML_ENABLE ),
+ TOKEN( "use-regular-expressions", XML_USE_REGULAR_EXPRESSIONS ),
+ TOKEN( "data-source-has-labels", XML_DATA_SOURCE_HAS_LABELS ),
+ TOKEN( "link-data-style-to-source", XML_LINK_DATA_STYLE_TO_SOURCE ),
+ TOKEN( "sort-algorithm", XML_SORT_ALGORITHM ),
+ TOKEN( "straight-line", XML_STRAIGHT_LINE ),
+ TOKEN( "angled-line", XML_ANGLED_LINE ),
+ TOKEN( "angled-connector-line", XML_ANGLED_CONNECTOR_LINE ),
+
+ TOKEN( "application/x-www-form-urlencoded", XML_APPLICATION_X_WWW_FORM_URLENCODED ),
+ TOKEN( "multipart/formdata", XML_MULTIPART_FORMDATA ),
+ TOKEN( "application/text", XML_APPLICATION_TEXT ),
+ TOKEN( "get", XML_GET ),
+ TOKEN( "post", XML_POST ),
+ TOKEN( "query", XML_QUERY ),
+ TOKEN( "parent", XML_PARENT ),
+ TOKEN( "records", XML_RECORDS ),
+ TOKEN( "push", XML_PUSH ),
+ TOKEN( "submit", XML_SUBMIT ),
+ TOKEN( "reset", XML_RESET ),
+ TOKEN( "value-list", XML_VALUE_LIST ),
+ TOKEN( "sql", XML_SQL ),
+ TOKEN( "sql-pass-through", XML_SQL_PASS_THROUGH ),
+ TOKEN( "table-fields", XML_TABLE_FIELDS ),
+ TOKEN( "unchecked", XML_UNCHECKED ),
+ TOKEN( "checked", XML_CHECKED ),
+ TOKEN( "unknown", XML_UNKNOWN ),
+
+ TOKEN( "roll-from-top", XML_ROLL_FROM_TOP ),
+
+ TOKEN( "binary-data", XML_BINARY_DATA ),
+ TOKEN( "notify-on-update-of-table", XML_NOTIFY_ON_UPDATE_OF_TABLE ),
+
+ TOKEN( "0", XML_0 ),
+ TOKEN( "play", XML_PLAY ),
+ TOKEN( "handout-master", XML_HANDOUT_MASTER ),
+ TOKEN( "text-style-name", XML_TEXT_STYLE_NAME ),
+ TOKEN( "escape-direction", XML_ESCAPE_DIRECTION ),
+ TOKEN( "glue-point", XML_GLUE_POINT ),
+ TOKEN( "primary-x", XML_PRIMARY_X ),
+ TOKEN( "secondary-x", XML_SECONDARY_X ),
+ TOKEN( "primary-y", XML_PRIMARY_Y ),
+ TOKEN( "secondary-y", XML_SECONDARY_Y ),
+ TOKEN( "primary-z", XML_PRIMARY_Z ),
+
+ TOKEN( "caption-type", XML_CAPTION_TYPE ),
+ TOKEN( "caption-angle-type", XML_CAPTION_ANGLE_TYPE ),
+ TOKEN( "caption-angle", XML_CAPTION_ANGLE ),
+ TOKEN( "caption-gap", XML_CAPTION_GAP ),
+ TOKEN( "caption-escape-direction", XML_CAPTION_ESCAPE_DIRECTION ),
+ TOKEN( "caption-escape", XML_CAPTION_ESCAPE ),
+ TOKEN( "caption-line-length", XML_CAPTION_LINE_LENGTH ),
+ TOKEN( "caption-fit-line-length", XML_CAPTION_FIT_LINE_LENGTH ),
+ TOKEN( "free", XML_FREE ),
+ TOKEN( "transition-type", XML_TRANSITION_TYPE ),
+ TOKEN( "transition-style", XML_TRANSITION_STYLE ),
+ TOKEN( "transition-speed", XML_TRANSITION_SPEED ),
+ TOKEN( "duration", XML_DURATION ),
+ TOKEN( "background-size", XML_BACKGROUND_SIZE ),
+ TOKEN( "background-objects-visible", XML_BACKGROUND_OBJECTS_VISIBLE ),
+ TOKEN( "background-visible", XML_BACKGROUND_VISIBLE ),
+
+ TOKEN( "move-from-upperleft", XML_MOVE_FROM_UPPERLEFT ),
+ TOKEN( "move-from-upperright", XML_MOVE_FROM_UPPERRIGHT ),
+ TOKEN( "move-from-lowerright", XML_MOVE_FROM_LOWERRIGHT ),
+ TOKEN( "move-from-lowerleft", XML_MOVE_FROM_LOWERLEFT ),
+ TOKEN( "uncover-to-left", XML_UNCOVER_TO_LEFT ),
+ TOKEN( "uncover-to-upperleft", XML_UNCOVER_TO_UPPERLEFT ),
+ TOKEN( "uncover-to-top", XML_UNCOVER_TO_TOP ),
+ TOKEN( "uncover-to-upperright", XML_UNCOVER_TO_UPPERRIGHT ),
+ TOKEN( "uncover-to-right", XML_UNCOVER_TO_RIGHT ),
+ TOKEN( "uncover-to-lowerright", XML_UNCOVER_TO_LOWERRIGHT ),
+ TOKEN( "uncover-to-bottom", XML_UNCOVER_TO_BOTTOM ),
+ TOKEN( "uncover-to-lowerleft", XML_UNCOVER_TO_LOWERLEFT ),
+ TOKEN( "vertical-checkerboard", XML_VERTICAL_CHECKERBOARD ),
+ TOKEN( "horizontal-checkerboard", XML_HORIZONTAL_CHECKERBOARD ),
+
+ TOKEN( "notify-on-update-of-ranges", XML_NOTIFY_ON_UPDATE_OF_RANGES ),
+
+ TOKEN( "byte", XML_BYTE ),
+ TOKEN( "macro", XML_MACRO ),
+ TOKEN( "location", XML_LOCATION ),
+ TOKEN( "application", XML_APPLICATION ),
+
+ TOKEN( "symbol-image", XML_SYMBOL_IMAGE ),
+ TOKEN( "text-overlap", XML_TEXT_OVERLAP ),
+ TOKEN( "spline-order", XML_SPLINE_ORDER ),
+ TOKEN( "spline-resolution", XML_SPLINE_RESOLUTION ),
+ TOKEN( "paper-tray-name", XML_PAPER_TRAY_NAME ),
+
+ TOKEN( "column-mapping", XML_COLUMN_MAPPING ),
+ TOKEN( "row-mapping", XML_ROW_MAPPING ),
+
+ TOKEN( "table-formula", XML_TABLE_FORMULA ),
+
+ TOKEN( "embedded-text", XML_EMBEDDED_TEXT ),
+
+ TOKEN( "merge-last-paragraph", XML_MERGE_LAST_PARAGRAPH ),
+
+ TOKEN( "stock-loss-marker", XML_STOCK_LOSS_MARKER ),
+ TOKEN( "stock-gain-marker", XML_STOCK_GAIN_MARKER ),
+ TOKEN( "stock-range-line", XML_STOCK_RANGE_LINE ),
+
+ TOKEN( "rl-tb", XML_RL_TB ),
+ TOKEN( "tb-lr", XML_TB_LR ),
+ TOKEN( "lr", XML_LR ),
+ TOKEN( "rl", XML_RL ),
+ TOKEN( "tb", XML_TB ),
+
+ TOKEN( "layout-grid-color", XML_LAYOUT_GRID_COLOR ),
+ TOKEN( "layout-grid-lines", XML_LAYOUT_GRID_LINES ),
+ TOKEN( "layout-grid-base-height", XML_LAYOUT_GRID_BASE_HEIGHT ),
+ TOKEN( "layout-grid-ruby-height", XML_LAYOUT_GRID_RUBY_HEIGHT ),
+ TOKEN( "layout-grid-mode", XML_LAYOUT_GRID_MODE ),
+ TOKEN( "layout-grid-ruby-below", XML_LAYOUT_GRID_RUBY_BELOW ),
+ TOKEN( "layout-grid-print", XML_LAYOUT_GRID_PRINT ),
+ TOKEN( "layout-grid-display", XML_LAYOUT_GRID_DISPLAY ),
+
+ //text grid enhancement for better CJK support
+ TOKEN( "default-page-layout", XML_DEFAULT_PAGE_LAYOUT ),
+ TOKEN( "layout-grid-standard-mode", XML_LAYOUT_GRID_STANDARD_MODE ),
+ TOKEN( "layout-grid-base-width", XML_LAYOUT_GRID_BASE_WIDTH ),
+ TOKEN( "layout-grid-snap-to-characters", XML_LAYOUT_GRID_SNAP_TO_CHARS ),
+
+ TOKEN( "snap-to-layout-grid", XML_SNAP_TO_LAYOUT_GRID ),
+
+ TOKEN( "dont-balance-text-columns", XML_DONT_BALANCE_TEXT_COLUMNS ),
+
+ TOKEN( "glyph-orientation-vertical", XML_GLYPH_ORIENTATION_VERTICAL ),
+
+ TOKEN( "marked-invalid", XML_MARKED_INVALID ),
+
+ TOKEN( "regression-curve", XML_REGRESSION_CURVE ),
+ TOKEN( "error-indicator", XML_ERROR_INDICATOR ),
+
+ TOKEN( "table-type", XML_TABLE_TYPE ),
+
+ TOKEN( "display-factor", XML_DISPLAY_FACTOR ),
+
+ TOKEN( "transliteration-format", XML_TRANSLITERATION_FORMAT ),
+ TOKEN( "transliteration-language", XML_TRANSLITERATION_LANGUAGE ),
+ TOKEN( "transliteration-country", XML_TRANSLITERATION_COUNTRY ),
+ TOKEN( "transliteration-style", XML_TRANSLITERATION_STYLE ),
+
+ TOKEN( "key1-phonetic", XML_KEY1_PHONETIC ),
+ TOKEN( "key2-phonetic", XML_KEY2_PHONETIC ),
+ TOKEN( "string-value-phonetic", XML_STRING_VALUE_PHONETIC ),
+
+ TOKEN( "background-transparency", XML_BACKGROUND_TRANSPARENCY ),
+ TOKEN( "background-image-transparency", XML_BACKGROUND_IMAGE_TRANSPARENCY ),
+
+ TOKEN( "dynamic-spacing", XML_DYNAMIC_SPACING ),
+
+ TOKEN( "main-entry", XML_MAIN_ENTRY ),
+
+ TOKEN( "use-outline-level", XML_USE_OUTLINE_LEVEL ),
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ TOKEN( "close-front", XML_CLOSE_FRONT ),
+ TOKEN( "close-back", XML_CLOSE_BACK ),
+
+ TOKEN( "drop-down", XML_DROPDOWN ),
+ TOKEN( "current-selected", XML_CURRENT_SELECTED ),
+
+ TOKEN( "join-border", XML_JOIN_BORDER ),
+
+ TOKEN( "display-list", XML_DISPLAY_LIST ),
+ TOKEN( "no", XML_NO ),
+ TOKEN( "unsorted", XML_UNSORTED ),
+ TOKEN( "sorted-ascending", XML_SORTED_ASCENDING ),
+ TOKEN( "font-independent-line-spacing", XML_FONT_INDEPENDENT_LINE_SPACING ),
+
+ TOKEN( "database", XML_DATABASE ),
+ TOKEN( "data-source", XML_DATASOURCE ),
+ TOKEN( "queries", XML_QUERIES ),
+ TOKEN( "reports", XML_REPORTS ),
+ TOKEN( "report", XML_REPORT ),
+ TOKEN( "as-template", XML_AS_TEMPLATE ),
+
+ TOKEN( "connection-resource", XML_CONNECTION_RESOURCE ),
+ TOKEN( "suppress-version-columns", XML_SUPPRESS_VERSION_COLUMNS ),
+ TOKEN( "java-driver-class", XML_JAVA_DRIVER_CLASS ),
+ TOKEN( "extension", XML_EXTENSION ),
+ TOKEN( "is-first-row-header-line", XML_IS_FIRST_ROW_HEADER_LINE ),
+ TOKEN( "show-deleted", XML_SHOW_DELETED ),
+ TOKEN( "is-table-name-length-limited", XML_IS_TABLE_NAME_LENGTH_LIMITED ),
+ TOKEN( "system-driver-settings", XML_SYSTEM_DRIVER_SETTINGS ),
+ TOKEN( "enable-sql92-check", XML_ENABLE_SQL92_CHECK ),
+ TOKEN( "append-table-alias-name", XML_APPEND_TABLE_ALIAS_NAME ),
+ TOKEN( "parameter-name-substitution", XML_PARAMETER_NAME_SUBSTITUTION ),
+ TOKEN( "ignore-driver-privileges", XML_IGNORE_DRIVER_PRIVILEGES ),
+ TOKEN( "boolean-comparison-mode", XML_BOOLEAN_COMPARISON_MODE ),
+ TOKEN( "use-catalog", XML_USE_CATALOG ),
+ TOKEN( "base-dn", XML_BASE_DN ),
+ TOKEN( "max-row-count", XML_MAX_ROW_COUNT ),
+ TOKEN( "login", XML_LOGIN ),
+ TOKEN( "user-name", XML_USER_NAME ),
+ TOKEN( "is-password-required", XML_IS_PASSWORD_REQUIRED ),
+ TOKEN( "login-timeout", XML_LOGIN_TIMEOUT ),
+ TOKEN( "delimiter", XML_DELIMITER ),
+ TOKEN( "field", XML_FIELD ),
+ TOKEN( "decimal", XML_DECIMAL ),
+ TOKEN( "thousand", XML_THOUSAND ),
+ TOKEN( "table-filter", XML_TABLE_FILTER ),
+ TOKEN( "table-filter-pattern", XML_TABLE_FILTER_PATTERN ),
+ TOKEN( "table-type-filter", XML_TABLE_TYPE_FILTER ),
+ TOKEN( "auto-increment", XML_AUTO_INCREMENT ),
+ TOKEN( "additional-column-statement", XML_ADDITIONAL_COLUMN_STATEMENT ),
+ TOKEN( "row-retrieving-statement", XML_ROW_RETRIEVING_STATEMENT ),
+ TOKEN( "data-source-settings", XML_DATA_SOURCE_SETTINGS ),
+ TOKEN( "data-source-setting", XML_DATA_SOURCE_SETTING ),
+ TOKEN( "data-source-setting-value", XML_DATA_SOURCE_SETTING_VALUE ),
+ TOKEN( "data-source-setting-is-list", XML_DATA_SOURCE_SETTING_IS_LIST ),
+ TOKEN( "data-source-setting-type", XML_DATA_SOURCE_SETTING_TYPE ),
+ TOKEN( "data-source-setting-name", XML_DATA_SOURCE_SETTING_NAME ),
+ TOKEN( "component", XML_COMPONENT ),
+ TOKEN( "component-collection", XML_COMPONENT_COLLECTION ),
+ TOKEN( "query-collection", XML_QUERY_COLLECTION ),
+ TOKEN( "update-table", XML_UPDATE_TABLE ),
+ TOKEN( "filter-statement", XML_FILTER_STATEMENT ),
+ TOKEN( "order-statement", XML_ORDER_STATEMENT ),
+ TOKEN( "escape-processing", XML_ESCAPE_PROCESSING ),
+ TOKEN( "keys", XML_KEYS ),
+ TOKEN( "indices", XML_INDICES ),
+ TOKEN( "type-name", XML_TYPE_NAME ),
+ TOKEN( "precision", XML_PRECISION ),
+ TOKEN( "is-nullable", XML_IS_NULLABLE ),
+ TOKEN( "is-autoincrement", XML_IS_AUTOINCREMENT ),
+ TOKEN( "default-value", XML_DEFAULT_VALUE ),
+ TOKEN( "referenced-table-name", XML_REFERENCED_TABLE_NAME ),
+ TOKEN( "update-rule", XML_UPDATE_RULE ),
+ TOKEN( "delete-rule", XML_DELETE_RULE ),
+ TOKEN( "key-columns", XML_KEY_COLUMNS ),
+ TOKEN( "key-column", XML_KEY_COLUMN ),
+ TOKEN( "related-column-name", XML_RELATED_COLUMN_NAME ),
+ TOKEN( "catalog-name", XML_CATALOG_NAME ),
+ TOKEN( "is-unique", XML_IS_UNIQUE ),
+ TOKEN( "is-clustered", XML_IS_CLUSTERED ),
+ TOKEN( "index-columns", XML_INDEX_COLUMNS ),
+ TOKEN( "index-column", XML_INDEX_COLUMN ),
+ TOKEN( "is-ascending", XML_IS_ASCENDING ),
+ TOKEN( "schema-name", XML_SCHEMA_NAME ),
+ TOKEN( "db", XML_NP_DB ),
+ TOKEN( "http://openoffice.org/2004/database", XML_N_DB ),
+ TOKEN( "apply-filter", XML_APPLY_FILTER ),
+ TOKEN( "apply-order", XML_APPLY_ORDER ),
+ TOKEN( "automatic-print-range", XML_AUTOMATIC_PRINT_RANGE ),
+
+ TOKEN( "selection", XML_SELECTION ),
+ TOKEN( "selection-indexes", XML_SELECTION_INDEXES ),
+
+ TOKEN( "scale-to-X", XML_SCALE_TO_X ),
+ TOKEN( "scale-to-Y", XML_SCALE_TO_Y ),
+
+ TOKEN( "keep-together", XML_KEEP_TOGETHER ),
+
+ TOKEN( "use-header-name", XML_USE_HEADER_NAME ),
+ TOKEN( "use-footer-name", XML_USE_FOOTER_NAME ),
+ TOKEN( "use-date-time-name", XML_USE_DATE_TIME_NAME ),
+ TOKEN( "display-header", XML_DISPLAY_HEADER ),
+ TOKEN( "display-footer", XML_DISPLAY_FOOTER ),
+ TOKEN( "display-page-number", XML_DISPLAY_PAGE_NUMBER ),
+ TOKEN( "display-date-time", XML_DISPLAY_DATE_TIME ),
+ TOKEN( "source" , XML_SOURCE ),
+ TOKEN( "current-date", XML_CURRENT_DATE ),
+
+ TOKEN( "header-decl", XML_HEADER_DECL ),
+ TOKEN( "footer-decl", XML_FOOTER_DECL ),
+ TOKEN( "date-time-decl", XML_DATE_TIME_DECL ),
+
+ TOKEN( "selected-page", XML_SELECTED_PAGE ),
+
+ // DVO, OD 01.10.2003 #i18732#
+ TOKEN( "flow-with-text", XML_FLOW_WITH_TEXT ),
+ TOKEN( "with-tab", XML_WITH_TAB ), // #i21237#
+
+ TOKEN( "custom-shape" , XML_CUSTOM_SHAPE ),
+ TOKEN( "engine" , XML_ENGINE ),
+ TOKEN( "enhanced-geometry" , XML_ENHANCED_GEOMETRY ),
+ TOKEN( "text-rotate-angle" , XML_TEXT_ROTATE_ANGLE ),
+ TOKEN( "mirror-vertical" , XML_MIRROR_VERTICAL ),
+ TOKEN( "mirror-horizontal" , XML_MIRROR_HORIZONTAL ),
+ TOKEN( "extrusion-allowed" , XML_EXTRUSION_ALLOWED ),
+ TOKEN( "text-path-allowed" , XML_TEXT_PATH_ALLOWED ),
+ TOKEN( "concentric-gradient-fill-allowed" , XML_CONCENTRIC_GRADIENT_FILL_ALLOWED ),
+ TOKEN( "extrusion" , XML_EXTRUSION ),
+ TOKEN( "extrusion-brightness" , XML_EXTRUSION_BRIGHTNESS ),
+ TOKEN( "extrusion-depth" , XML_EXTRUSION_DEPTH ),
+ TOKEN( "extrusion-diffusion" , XML_EXTRUSION_DIFFUSION ),
+ TOKEN( "extrusion-number-of-line-segments" , XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS ),
+ TOKEN( "extrusion-light-face" , XML_EXTRUSION_LIGHT_FACE ),
+ TOKEN( "extrusion-first-light-harsh" , XML_EXTRUSION_FIRST_LIGHT_HARSH ),
+ TOKEN( "extrusion-second-light-harsh" , XML_EXTRUSION_SECOND_LIGHT_HARSH ),
+ TOKEN( "extrusion-first-light-level" , XML_EXTRUSION_FIRST_LIGHT_LEVEL ),
+ TOKEN( "extrusion-second-light-level" , XML_EXTRUSION_SECOND_LIGHT_LEVEL ),
+ TOKEN( "extrusion-first-light-direction" , XML_EXTRUSION_FIRST_LIGHT_DIRECTION ),
+ TOKEN( "extrusion-second-light-direction" , XML_EXTRUSION_SECOND_LIGHT_DIRECTION ),
+ TOKEN( "extrusion-metal" , XML_EXTRUSION_METAL ),
+ TOKEN( "extrusion-rotation-angle" , XML_EXTRUSION_ROTATION_ANGLE ),
+ TOKEN( "extrusion-rotation-center" , XML_EXTRUSION_ROTATION_CENTER ),
+ TOKEN( "extrusion-shininess" , XML_EXTRUSION_SHININESS ),
+ TOKEN( "extrusion-skew" , XML_EXTRUSION_SKEW ),
+ TOKEN( "extrusion-specularity" , XML_EXTRUSION_SPECULARITY ),
+ TOKEN( "extrusion-projection-mode" , XML_EXTRUSION_PROJECTION_MODE ),
+ TOKEN( "extrusion-viewpoint" , XML_EXTRUSION_VIEWPOINT ),
+ TOKEN( "extrusion-origin" , XML_EXTRUSION_ORIGIN ),
+ TOKEN( "extrusion-color" , XML_EXTRUSION_COLOR ),
+ TOKEN( "secondary-fill-color" , XML_SECONDARY_FILL_COLOR ),
+ TOKEN( "enhanced-path" , XML_ENHANCED_PATH ),
+ TOKEN( "path-stretchpoint-x" , XML_PATH_STRETCHPOINT_X ),
+ TOKEN( "path-stretchpoint-y" , XML_PATH_STRETCHPOINT_Y ),
+ TOKEN( "text-areas" , XML_TEXT_AREAS ),
+ TOKEN( "glue-points" , XML_GLUE_POINTS ),
+ TOKEN( "glue-point-type" , XML_GLUE_POINT_TYPE ),
+ TOKEN( "glue-point-leaving-direction" , XML_GLUE_POINT_LEAVING_DIRECTIONS ),
+ TOKEN( "text-path" , XML_TEXT_PATH ),
+ TOKEN( "text-path-mode" , XML_TEXT_PATH_MODE ),
+ TOKEN( "text-path-scale" , XML_TEXT_PATH_SCALE ),
+ TOKEN( "text-path-same-letter-heights" , XML_TEXT_PATH_SAME_LETTER_HEIGHTS ),
+ TOKEN( "modifiers" , XML_MODIFIERS ),
+ TOKEN( "equation" , XML_EQUATION ),
+ TOKEN( "xstretch", XML_XSTRETCH ),
+ TOKEN( "ystretch", XML_YSTRETCH ),
+ TOKEN( "hasstroke", XML_HASSTROKE ),
+ TOKEN( "hasfill", XML_HASFILL ),
+ TOKEN( "logwidth", XML_LOGWIDTH ),
+ TOKEN( "logheight", XML_LOGHEIGHT ),
+ TOKEN( "handle" , XML_HANDLE ),
+ TOKEN( "handle-mirror-vertical" , XML_HANDLE_MIRROR_VERTICAL ),
+ TOKEN( "handle-mirror-horizontal" , XML_HANDLE_MIRROR_HORIZONTAL ),
+ TOKEN( "handle-switched" , XML_HANDLE_SWITCHED ),
+ TOKEN( "handle-position" , XML_HANDLE_POSITION ),
+ TOKEN( "handle-range-x-minimum" , XML_HANDLE_RANGE_X_MINIMUM ),
+ TOKEN( "handle-range-x-maximum" , XML_HANDLE_RANGE_X_MAXIMUM ),
+ TOKEN( "handle-range-y-minimum" , XML_HANDLE_RANGE_Y_MINIMUM ),
+ TOKEN( "handle-range-y-maximum" , XML_HANDLE_RANGE_Y_MAXIMUM ),
+ TOKEN( "handle-polar" , XML_HANDLE_POLAR ),
+ TOKEN( "handle-radius-range-minimum" , XML_HANDLE_RADIUS_RANGE_MINIMUM ),
+ TOKEN( "handle-radius-range-maximum" , XML_HANDLE_RADIUS_RANGE_MAXIMUM ),
+ TOKEN( "rectangle" , XML_RECTANGLE ),
+ TOKEN( "roundrectangle" , XML_ROUNDRECTANGLE ),
+ TOKEN( "oval" , XML_OVAL ),
+ TOKEN( "cloud" , XML_CLOUD ),
+ TOKEN( "boundingcube" , XML_BOUNDINGCUBE ),
+ TOKEN( "wireframe" , XML_WIREFRAME ),
+ TOKEN( "segments" , XML_SEGMENTS ),
+ TOKEN( "word-wrap" , XML_WORD_WRAP ),
+ TOKEN( "collapsing" , XML_COLLAPSING ),
+ TOKEN( "separating" , XML_SEPARATING ),
+ TOKEN( "border-model" , XML_BORDER_MODEL ),
+ TOKEN( "data-pilot-field-reference", XML_DATA_PILOT_FIELD_REFERENCE ),
+ TOKEN( "member-difference", XML_MEMBER_DIFFERENCE ),
+ TOKEN( "member-percentage", XML_MEMBER_PERCENTAGE ),
+ TOKEN( "member-percentage-difference", XML_MEMBER_PERCENTAGE_DIFFERENCE ),
+ TOKEN( "running-total", XML_RUNNING_TOTAL ),
+ TOKEN( "row-percentage", XML_ROW_PERCENTAGE ),
+ TOKEN( "column-percentage", XML_COLUMN_PERCENTAGE ),
+ TOKEN( "total-percentage", XML_TOTAL_PERCENTAGE ),
+ TOKEN( "field-name", XML_FIELD_NAME ),
+ TOKEN( "member-type", XML_MEMBER_TYPE ),
+ TOKEN( "named", XML_NAMED ),
+ TOKEN( "member-name", XML_MEMBER_NAME ),
+ TOKEN( "display-member-mode", XML_DISPLAY_MEMBER_MODE ),
+ TOKEN( "member-count", XML_MEMBER_COUNT ),
+ TOKEN( "data-field", XML_DATA_FIELD ),
+ TOKEN( "data-pilot-display-info", XML_DATA_PILOT_DISPLAY_INFO ),
+ TOKEN( "sort-mode", XML_SORT_MODE ),
+ TOKEN( "data-pilot-sort-info", XML_DATA_PILOT_SORT_INFO ),
+ TOKEN( "add-empty-lines", XML_ADD_EMPTY_LINES ),
+ TOKEN( "tabular-layout", XML_TABULAR_LAYOUT ),
+ TOKEN( "outline-subtotals-top", XML_OUTLINE_SUBTOTALS_TOP ),
+ TOKEN( "outline-subtotals-bottom", XML_OUTLINE_SUBTOTALS_BOTTOM ),
+ TOKEN( "layout-mode", XML_LAYOUT_MODE ),
+ TOKEN( "data-pilot-layout-info", XML_DATA_PILOT_LAYOUT_INFO ),
+ TOKEN( "symbol-color", XML_SYMBOL_COLOR ),
+ TOKEN( "3d" , XML_3D ),
+ TOKEN( "image-position" , XML_IMAGE_POSITION ),
+ TOKEN( "image-align" , XML_IMAGE_ALIGN ),
+ TOKEN( "diagonal-bl-tr", XML_DIAGONAL_BL_TR ),
+ TOKEN( "diagonal-bl-tr-width", XML_DIAGONAL_BL_TR_WIDTH ),
+ TOKEN( "diagonal-tl-br", XML_DIAGONAL_TL_BR ),
+ TOKEN( "diagonal-tl-br-width", XML_DIAGONAL_TL_BR_WIDTH ),
+ TOKEN( "repeat-content", XML_REPEAT_CONTENT ),
+ TOKEN( "shrink-to-fit", XML_SHRINK_TO_FIT ),
+
+ // OD 2004-05-05 #i28701#
+ TOKEN( "wrap-influence-on-position", XML_WRAP_INFLUENCE_ON_POSITION ),
+ // --> OD 2004-10-18 #i35017# - tokens have been renamed and
+ // <XML_ITERATIVE> has been added
+ TOKEN( "once-successive", XML_ONCE_SUCCESSIVE ),
+ TOKEN( "once-concurrent", XML_ONCE_CONCURRENT ),
+
+ // Names for OOo format only
+ TOKEN( "http://openoffice.org/2000/office", XML_N_OFFICE_OOO ),
+ TOKEN( "http://openoffice.org/2000/meta", XML_N_META_OOO ),
+ TOKEN( "http://openoffice.org/2000/style", XML_N_STYLE_OOO ),
+ TOKEN( "http://openoffice.org/2000/datastyle", XML_N_NUMBER_OOO ),
+ TOKEN( "http://openoffice.org/2000/text", XML_N_TEXT_OOO ),
+ TOKEN( "http://openoffice.org/2000/table", XML_N_TABLE_OOO ),
+ TOKEN( "http://openoffice.org/2000/drawing", XML_N_DRAW_OOO ),
+ TOKEN( "http://openoffice.org/2000/dr3d", XML_N_DR3D_OOO ),
+ TOKEN( "http://openoffice.org/2000/presentation",XML_N_PRESENTATION_OOO ),
+ TOKEN( "http://openoffice.org/2000/chart", XML_N_CHART_OOO ),
+ TOKEN( "http://openoffice.org/2001/config", XML_N_CONFIG_OOO ),
+ TOKEN( "http://openoffice.org/2000/form", XML_N_FORM_OOO ),
+ TOKEN( "http://openoffice.org/2000/script", XML_N_SCRIPT_OOO ),
+
+ TOKEN( "global", XML_GLOBAL ),
+
+ TOKEN( "note-class", XML_NOTE_CLASS ),
+ TOKEN( "note-citation", XML_NOTE_CITATION ),
+ TOKEN( "note-body", XML_NOTE_BODY ),
+ TOKEN( "notes-configuration", XML_NOTES_CONFIGURATION ),
+ TOKEN( "note-ref", XML_NOTE_REF ),
+ TOKEN( "is-sub-table", XML_IS_SUB_TABLE ),
+ TOKEN( "page-layout", XML_PAGE_LAYOUT ),
+ TOKEN( "page-layout-name", XML_PAGE_LAYOUT_NAME ),
+ TOKEN( "graphic-properties", XML_GRAPHIC_PROPERTIES ),
+ TOKEN( "drawing-page-properties", XML_DRAWING_PAGE_PROPERTIES ),
+ TOKEN( "page-layout-properties", XML_PAGE_LAYOUT_PROPERTIES ),
+ TOKEN( "header-footer-properties", XML_HEADER_FOOTER_PROPERTIES ),
+ TOKEN( "text-properties", XML_TEXT_PROPERTIES ),
+ TOKEN( "paragraph-properties", XML_PARAGRAPH_PROPERTIES ),
+ TOKEN( "ruby-properties", XML_RUBY_PROPERTIES ),
+ TOKEN( "section-properties", XML_SECTION_PROPERTIES ),
+ TOKEN( "table-properties", XML_TABLE_PROPERTIES ),
+ TOKEN( "table-column-properties", XML_TABLE_COLUMN_PROPERTIES ),
+ TOKEN( "table-row-properties", XML_TABLE_ROW_PROPERTIES ),
+ TOKEN( "table-cell-properties", XML_TABLE_CELL_PROPERTIES ),
+ TOKEN( "list-level-properties", XML_LIST_LEVEL_PROPERTIES ),
+ TOKEN( "chart-properties", XML_CHART_PROPERTIES ),
+ TOKEN( "drawing-page", XML_DRAWING_PAGE ),
+ TOKEN( "graphics", XML_GRAPHICS ),
+ TOKEN( "tab", XML_TAB ),
+ TOKEN( "text-underline-mode", XML_TEXT_UNDERLINE_MODE ),
+ TOKEN( "text-line-through-mode", XML_TEXT_LINE_THROUGH_MODE ),
+ TOKEN( "continuous", XML_CONTINUOUS ),
+ TOKEN( "skip-white-space", XML_SKIP_WHITE_SPACE ),
+ TOKEN( "scripts", XML_SCRIPTS ),
+ TOKEN( "font-face-decls", XML_FONT_FACE_DECLS ),
+ TOKEN( "font-face", XML_FONT_FACE ),
+ TOKEN( "font-adornments", XML_FONT_ADORNMENTS ),
+ TOKEN( "inch", XML_INCH ),
+ TOKEN( "space-after", XML_SPACE_AFTER ),
+ TOKEN( "start-indent", XML_START_INDENT ),
+ TOKEN( "end-indent", XML_END_INDENT ),
+
+ // chart Oasis format additions
+ TOKEN( "interval-minor-divisor", XML_INTERVAL_MINOR_DIVISOR ),
+ TOKEN( "date-string", XML_DATE_STRING ),
+
+ TOKEN( "text-underline-style", XML_TEXT_UNDERLINE_STYLE ),
+ TOKEN( "text-underline-type", XML_TEXT_UNDERLINE_TYPE ),
+ TOKEN( "text-underline-width", XML_TEXT_UNDERLINE_WIDTH ),
+
+ TOKEN( "text-overline-type", XML_TEXT_OVERLINE_TYPE ),
+ TOKEN( "text-overline-style", XML_TEXT_OVERLINE_STYLE ),
+ TOKEN( "text-overline-width", XML_TEXT_OVERLINE_WIDTH ),
+ TOKEN( "text-overline-color", XML_TEXT_OVERLINE_COLOR ),
+ TOKEN( "text-overline-mode", XML_TEXT_OVERLINE_MODE ),
+
+ TOKEN( "text-line-through-style", XML_TEXT_LINE_THROUGH_STYLE ),
+ TOKEN( "text-line-through-type", XML_TEXT_LINE_THROUGH_TYPE ),
+ TOKEN( "text-line-through-width", XML_TEXT_LINE_THROUGH_WIDTH ),
+ TOKEN( "text-line-through-text", XML_TEXT_LINE_THROUGH_TEXT ),
+
+ TOKEN( "leader-style", XML_LEADER_STYLE ),
+ TOKEN( "leader-text", XML_LEADER_TEXT ),
+
+ TOKEN( "bold-dotted", XML_BOLD_DOTTED ),
+ TOKEN( "bold-dash", XML_BOLD_DASH ),
+ TOKEN( "bold-long-dash", XML_BOLD_LONG_DASH ),
+ TOKEN( "bold-dot-dash", XML_BOLD_DOT_DASH ),
+ TOKEN( "bold-dot-dot-dash", XML_BOLD_DOT_DOT_DASH ),
+ TOKEN( "bold-wave", XML_BOLD_WAVE ),
+ TOKEN( "double-wave", XML_DOUBLE_WAVE ),
+ TOKEN( "double-line", XML_DOUBLE_LINE ),
+ TOKEN( "thick-line", XML_THICK_LINE ),
+ TOKEN( "single-line", XML_SINGLE_LINE ),
+ TOKEN( "slash", XML_SLASH ),
+ TOKEN( "text-line-through-color", XML_TEXT_LINE_THROUGH_COLOR ),
+ TOKEN( "text-line-through-text-style", XML_TEXT_LINE_THROUGH_TEXT_STYLE ),
+ TOKEN( "leader-color", XML_LEADER_COLOR ),
+ TOKEN( "leader-type", XML_LEADER_TYPE ),
+ TOKEN( "leader-width", XML_LEADER_WIDTH ),
+ TOKEN( "leader-text-style", XML_LEADER_TEXT_STYLE ),
+
+ TOKEN( "opacity", XML_OPACITY ),
+ TOKEN( "opacity-name", XML_OPACITY_NAME ),
+ TOKEN( "shadow-opacity", XML_SHADOW_OPACITY ),
+ TOKEN( "always", XML_ALWAYS ),
+ TOKEN( "count-in-text-boxes", XML_COUNT_IN_TEXT_BOXES ),
+
+ TOKEN( "ooo", XML_NP_OOO ),
+ TOKEN( "http://openoffice.org/2004/office", XML_N_OOO ),
+ TOKEN( "ooow", XML_NP_OOOW ),
+ TOKEN( "http://openoffice.org/2004/writer", XML_N_OOOW ),
+ TOKEN( "oooc", XML_NP_OOOC ),
+ TOKEN( "http://openoffice.org/2004/calc", XML_N_OOOC ),
+ TOKEN( "dom", XML_NP_DOM ),
+ TOKEN( "http://www.w3.org/2001/xml-events", XML_N_DOM ),
+
+ TOKEN( "event-listeners", XML_EVENT_LISTENERS ),
+ TOKEN( "event-listener", XML_EVENT_LISTENER ),
+
+ TOKEN( "form", XML_FORM ),
+ TOKEN( "void", XML_VOID ),
+ TOKEN( "property", XML_PROPERTY ),
+ TOKEN( "property-name", XML_PROPERTY_NAME ),
+ TOKEN( "list-property", XML_LIST_PROPERTY ),
+ TOKEN( "list-value", XML_LIST_VALUE ),
+ TOKEN( "column-style-name", XML_COLUMN_STYLE_NAME ),
+ TOKEN( "textarea", XML_TEXTAREA ),
+ TOKEN( "fixed-text", XML_FIXED_TEXT ),
+ TOKEN( "file", XML_FILE ),
+ TOKEN( "formatted-text", XML_FORMATTED_TEXT ),
+ TOKEN( "button", XML_BUTTON ),
+ TOKEN( "checkbox", XML_CHECKBOX ),
+ TOKEN( "radio", XML_RADIO ),
+ TOKEN( "listbox", XML_LISTBOX ),
+ TOKEN( "combobox", XML_COMBOBOX ),
+ TOKEN( "image-frame", XML_IMAGE_FRAME ),
+ TOKEN( "value-range", XML_VALUE_RANGE ),
+ TOKEN( "generic-control", XML_GENERIC_CONTROL ),
+ TOKEN( "service-name", XML_SERVICE_NAME ),
+ TOKEN( "property-type", XML_PROPERTY_TYPE ),
+ TOKEN( "integer", XML_INTEGER ),
+ TOKEN( "property-is-void", XML_PROPERTY_IS_VOID ),
+ TOKEN( "property-is-list", XML_PROPERTY_IS_LIST ),
+ TOKEN( "property-value", XML_PROPERTY_VALUE ),
+ TOKEN( "mimetype", XML_MIMETYPE ),
+ TOKEN( "database-row-select", XML_DATABASE_ROW_SELECT ),
+ TOKEN( "control-implementation", XML_CONTROL_IMPLEMENTATION ),
+ TOKEN( "interpolation", XML_INTERPOLATION ),
+ TOKEN( "cubic-spline", XML_CUBIC_SPLINE ),
+ TOKEN( "b-spline", XML_B_SPLINE ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:database:1.0", XML_N_DB_OASIS ),
+
+ TOKEN( "show-filter-button", XML_SHOW_FILTER_BUTTON ),
+ TOKEN( "drill-down-on-double-click", XML_DRILL_DOWN_ON_DOUBLE_CLICK ),
+ TOKEN( "grouped-by", XML_GROUPED_BY ),
+ TOKEN( "days", XML_DAYS ),
+ TOKEN( "months", XML_MONTHS ),
+ TOKEN( "quarters", XML_QUARTERS ),
+ TOKEN( "years", XML_YEARS ),
+ TOKEN( "date-start", XML_DATE_START ),
+ TOKEN( "date-end", XML_DATE_END ),
+ TOKEN( "step", XML_STEP ),
+ TOKEN( "is-group-field", XML_IS_GROUP_FIELD ),
+ TOKEN( "data-pilot-groups", XML_DATA_PILOT_GROUPS ),
+ TOKEN( "data-pilot-group", XML_DATA_PILOT_GROUP ),
+ TOKEN( "japanese-candle-stick", XML_JAPANESE_CANDLE_STICK ),
+ TOKEN( "named-symbol", XML_NAMED_SYMBOL ),
+ TOKEN( "diamond", XML_DIAMOND ),
+ TOKEN( "arrow-down", XML_ARROW_DOWN ),
+ TOKEN( "arrow-up", XML_ARROW_UP ),
+ TOKEN( "arrow-right", XML_ARROW_RIGHT ),
+ TOKEN( "arrow-left", XML_ARROW_LEFT ),
+ TOKEN( "bow-tie", XML_BOW_TIE ),
+ TOKEN( "hourglass", XML_HOURGLASS ),
+ TOKEN( "symbol-name", XML_SYMBOL_NAME ),
+ TOKEN( "symbol-type", XML_SYMBOL_TYPE ),
+ TOKEN( "image-opacity", XML_IMAGE_OPACITY ), // #i25616#
+
+ TOKEN( "default-outline-level", XML_DEFAULT_OUTLINE_LEVEL ),
+ TOKEN( "show-details", XML_SHOW_DETAILS ),
+ TOKEN( "show-empty", XML_SHOW_EMPTY ),
+ TOKEN( "iterative", XML_ITERATIVE ),
+
+ TOKEN( "X", XML_uX ),
+ TOKEN( "dlg", XML_NP_DLG ),
+ TOKEN( "http://openoffice.org/2000/dialog", XML_N_DLG ),
+ TOKEN( "script-data", XML_SCRIPT_DATA ),
+ TOKEN( "libraries", XML_LIBRARIES ),
+ TOKEN( "source-code", XML_SOURCE_CODE ),
+ TOKEN( "readonly", XML_READONLY ),
+ TOKEN( "z", XML_Z ),
+ TOKEN( "dimension", XML_DIMENSION ),
+ TOKEN( "validation-name", XML_VALIDATION_NAME ),
+
+ TOKEN( "screen", XML_SCREEN ),
+ TOKEN( "printer", XML_PRINTER ),
+
+ // XForms token
+ TOKEN( "model", XML_MODEL ),
+ TOKEN( "schema", XML_SCHEMA ),
+ TOKEN( "bind", XML_BIND ),
+ TOKEN( "instance", XML_INSTANCE ),
+ TOKEN( "submission", XML_SUBMISSION ),
+ TOKEN( "ref", XML_REF ),
+ TOKEN( "src", XML_SRC ),
+ TOKEN( "method", XML_METHOD ),
+ TOKEN( "nodeset", XML_NODESET ),
+ TOKEN( "indent", XML_INDENT ),
+ TOKEN( "omit-xml-declaration", XML_OMIT_XML_DECLARATION ),
+ TOKEN( "standalone", XML_STANDALONE ),
+ TOKEN( "cdata-section-elements", XML_CDATA_SECTION_ELEMENTS ),
+ TOKEN( "required", XML_REQUIRED ),
+ TOKEN( "relevant", XML_RELEVANT ),
+ TOKEN( "calculate", XML_CALCULATE ),
+ TOKEN( "constraint", XML_CONSTRAINT ),
+ TOKEN( "maxOccurs", XML_MAXOCCURS /* (maxOccurs) */ ),
+ TOKEN( "minOccurs", XML_MINOCCURS /* (minOccurs) */ ),
+ TOKEN( "p3ptype", XML_P3PTYPE ),
+ TOKEN( "mediatype", XML_MEDIATYPE ),
+ TOKEN( "includenamespaceprefixes", XML_INCLUDENAMESPACEPREFIXES ),
+
+ // XForms/XSD Schema tokens
+ TOKEN( "base", XML_BASE ),
+ TOKEN( "targetNamespace", XML_TARGETNAMESPACE ),
+ TOKEN( "simpleType", XML_SIMPLETYPE ),
+ TOKEN( "restriction", XML_RESTRICTION ),
+ TOKEN( "maxLength", XML_MAXLENGTH ),
+ TOKEN( "minLength", XML_MINLENGTH ),
+ TOKEN( "minInclusive", XML_MININCLUSIVE ),
+ TOKEN( "minExclusive", XML_MINEXCLUSIVE ),
+ TOKEN( "maxInclusive", XML_MAXINCLUSIVE ),
+ TOKEN( "maxExclusive", XML_MAXEXCLUSIVE ),
+ TOKEN( "pattern", XML_PATTERN ),
+ TOKEN( "enumeration", XML_ENUMERATION ),
+ TOKEN( "whiteSpace", XML_WHITESPACE ),
+ TOKEN( "totalDigits", XML_TOTALDIGITS ),
+ TOKEN( "fractionDigits", XML_FRACTIONDIGITS ),
+ TOKEN( "preserve", XML_PRESERVE ),
+ TOKEN( "anyURI", XML_ANYURI ),
+ TOKEN( "dateTime", XML_DATETIME_XSD ),
+ TOKEN( "main-etry", XML_MAIN_ETRY),
+
+ TOKEN( "remove", XML_REMOVE ),
+ TOKEN( "hold", XML_HOLD ),
+ TOKEN( "transition", XML_TRANSITION ),
+ TOKEN( "inherit", XML_INHERIT ),
+ TOKEN( "fillDefault", XML_FILLDEFAULT ),
+ TOKEN( "restart", XML_RESTART ),
+ TOKEN( "restartDefault", XML_RESTARTDEFAULT ),
+ TOKEN( "whenNotActive", XML_WHENNOTACTIVE ),
+ TOKEN( "never", XML_NEVER ),
+ TOKEN( "accelerate", XML_ACCELERATE ),
+ TOKEN( "decelerate", XML_DECELERATE ),
+ TOKEN( "autoReverse", XML_AUTOREVERSE ),
+ TOKEN( "indefinite", XML_INDEFINITE ),
+ TOKEN( "repeatCount", XML_REPEATCOUNT ),
+ TOKEN( "repeatDur", XML_REPEATDUR ),
+ TOKEN( "endsync", XML_ENDSYNC ),
+ TOKEN( "first", XML_FIRST ),
+ TOKEN( "last", XML_LAST ),
+ TOKEN( "media", XML_MEDIA ),
+ TOKEN( "dur", XML_DUR ),
+ TOKEN( "begin", XML_BEGIN ),
+ TOKEN( "whole", XML_WHOLE ),
+ TOKEN( "from", XML_FROM ),
+ TOKEN( "to", XML_TO ),
+ TOKEN( "by", XML_BY ),
+ TOKEN( "values", XML_VALUES ),
+ TOKEN( "keyTimes", XML_KEYTIMES ),
+ TOKEN( "keySplines", XML_KEYSPLINES ),
+ TOKEN( "calcMode", XML_CALCMODE ),
+ TOKEN( "discrete", XML_DISCRETE ),
+ TOKEN( "paced", XML_PACED ),
+ TOKEN( "spline", XML_SPLINE ),
+ TOKEN( "accumulate", XML_ACCUMULATE ),
+ TOKEN( "additive", XML_ADDITIVE ),
+ TOKEN( "multiply", XML_MULTIPLY ),
+ TOKEN( "animate", XML_ANIMATE ),
+ TOKEN( "animateMotion", XML_ANIMATEMOTION ),
+ TOKEN( "animateTransform", XML_ANIMATETRANSFORM ),
+ TOKEN( "animateColor", XML_ANIMATECOLOR ),
+ TOKEN( "transitionFilter", XML_TRANSITIONFILTER ),
+ TOKEN( "attributeName", XML_ATTRIBUTENAME ),
+
+ TOKEN( "smil", XML_NP_SMIL ),
+ TOKEN( "http://www.w3.org/2001/SMIL20/", XML_N_SMIL ),
+
+ TOKEN( "anim", XML_NP_ANIMATION ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:animation:1.0", XML_N_ANIMATION ),
+
+ TOKEN( "par", XML_PAR ),
+ TOKEN( "seq", XML_SEQ ),
+
+ TOKEN( "translate", XML_TRANSLATE ),
+ TOKEN( "skewX", XML_SKEWX ),
+ TOKEN( "skewY", XML_SKEWY ),
+
+ TOKEN( "audio", XML_AUDIO ),
+
+ TOKEN( "color-interpolation", XML_COLOR_INTERPOLATION ),
+ TOKEN( "color-interpolation-direction", XML_COLOR_INTERPOLATION_DIRECTION ),
+ TOKEN( "hsl", XML_HSL ),
+ TOKEN( "rgb", XML_RGB ),
+
+ TOKEN( "barWipe", XML_BARWIPE ),
+ TOKEN( "boxWipe", XML_BOXWIPE ),
+ TOKEN( "fourBoxWipe", XML_FOURBOXWIPE ),
+ TOKEN( "barnDoorWipe", XML_BARNDOORWIPE ),
+ TOKEN( "diagonalWipe", XML_DIAGONALWIPE ),
+ TOKEN( "bowTieWipe", XML_BOWTIEWIPE ),
+ TOKEN( "miscDiagonalWipe", XML_MISCDIAGONALWIPE ),
+ TOKEN( "veeWipe", XML_VEEWIPE ),
+ TOKEN( "barnVeeWipe", XML_BARNVEEWIPE ),
+ TOKEN( "zigZagWipe", XML_ZIGZAGWIPE ),
+ TOKEN( "barnZigZagWipe", XML_BARNZIGZAGWIPE ),
+ TOKEN( "irisWipe", XML_IRISWIPE ),
+ TOKEN( "triangleWipe", XML_TRIANGLEWIPE ),
+ TOKEN( "arrowHeadWipe", XML_ARROWHEADWIPE ),
+ TOKEN( "pentagonWipe", XML_PENTAGONWIPE ),
+ TOKEN( "hexagonWipe", XML_HEXAGONWIPE ),
+ TOKEN( "ellipseWipe", XML_ELLIPSEWIPE ),
+ TOKEN( "eyeWipe", XML_EYEWIPE ),
+ TOKEN( "roundRectWipe", XML_ROUNDRECTWIPE ),
+ TOKEN( "starWipe", XML_STARWIPE ),
+ TOKEN( "miscShapeWipe", XML_MISCSHAPEWIPE ),
+ TOKEN( "clockWipe", XML_CLOCKWIPE ),
+ TOKEN( "pinWheelWipe", XML_PINWHEELWIPE ),
+ TOKEN( "singleSweepWipe", XML_SINGLESWEEPWIPE ),
+ TOKEN( "fanWipe", XML_FANWIPE ),
+ TOKEN( "doubleFanWipe", XML_DOUBLEFANWIPE ),
+ TOKEN( "doubleSweepWipe", XML_DOUBLESWEEPWIPE ),
+ TOKEN( "saloonDoorWipe", XML_SALOONDOORWIPE ),
+ TOKEN( "windshieldWipe", XML_WINDSHIELDWIPE ),
+ TOKEN( "snakeWipe", XML_SNAKEWIPE ),
+ TOKEN( "spiralWipe", XML_SPIRALWIPE ),
+ TOKEN( "parallelSnakesWipe", XML_PARALLELSNAKESWIPE ),
+ TOKEN( "boxSnakesWipe", XML_BOXSNAKESWIPE ),
+ TOKEN( "waterfallWipe", XML_WATERFALLWIPE ),
+ TOKEN( "pushWipe", XML_PUSHWIPE ),
+ TOKEN( "slideWipe", XML_SLIDEWIPE ),
+ TOKEN( "blindsWipe", XML_BLINDSWIPE ),
+ TOKEN( "randomBarWipe", XML_RANDOMBARWIPE ),
+ TOKEN( "checkerBoardWipe", XML_CHECKERBOARDWIPE ),
+ TOKEN( "zoom", XML_ZOOM ),
+
+ TOKEN( "leftToRight", XML_LEFTTORIGHT ),
+ TOKEN( "topToBottom", XML_TOPTOBOTTOM ),
+ TOKEN( "topLeft", XML_TOPLEFT ),
+ TOKEN( "topRight", XML_TOPRIGHT ),
+ TOKEN( "bottomRight", XML_BOTTOMRIGHT ),
+ TOKEN( "bottomLeft", XML_BOTTOMLEFT ),
+ TOKEN( "topCenter", XML_TOPCENTER ),
+ TOKEN( "rightCenter", XML_RIGHTCENTER ),
+ TOKEN( "bottomCenter", XML_BOTTOMCENTER ),
+ TOKEN( "leftCenter", XML_LEFTCENTER ),
+ TOKEN( "cornersIn", XML_CORNERSIN ),
+ TOKEN( "cornersOut", XML_CORNERSOUT ),
+ TOKEN( "diagonalBottomLeft", XML_DIAGONALBOTTOMLEFT ),
+ TOKEN( "diagonalTopLeft", XML_DIAGONALTOPLEFT ),
+ TOKEN( "doubleBarnDoor", XML_DOUBLEBARNDOOR ),
+ TOKEN( "doubleDiamond", XML_DOUBLEDIAMOND ),
+ TOKEN( "fourPoint", XML_FOURPOINT ),
+ TOKEN( "fivePoint", XML_FIVEPOINT ),
+ TOKEN( "sixPoint", XML_SIXPOINT ),
+ TOKEN( "heart", XML_HEART ),
+ TOKEN( "keyhole", XML_KEYHOLE ),
+ TOKEN( "clockwiseTwelve", XML_CLOCKWISETWELVE ),
+ TOKEN( "clockwiseThree", XML_CLOCKWISETHREE ),
+ TOKEN( "clockwiseSix", XML_CLOCKWISESIX ),
+ TOKEN( "clockwiseNine", XML_CLOCKWISENINE ),
+ TOKEN( "twoBladeVertical", XML_TWOBLADEVERTICAL ),
+ TOKEN( "twoBladeHorizontal", XML_TWOBLADEHORIZONTAL ),
+ TOKEN( "fourBlade", XML_FOURBLADE ),
+ TOKEN( "clockwiseTop", XML_CLOCKWISETOP ),
+ TOKEN( "clockwiseRight", XML_CLOCKWISERIGHT ),
+ TOKEN( "clockwiseBottom", XML_CLOCKWISEBOTTOM ),
+ TOKEN( "clockwiseLeft", XML_CLOCKWISELEFT ),
+ TOKEN( "clockwiseTopLeft", XML_CLOCKWISETOPLEFT ),
+ TOKEN( "counterClockwiseBottomLeft", XML_COUNTERCLOCKWISEBOTTOMLEFT ),
+ TOKEN( "clockwiseBottomRight", XML_CLOCKWISEBOTTOMRIGHT ),
+ TOKEN( "counterClockwiseTopRight", XML_COUNTERCLOCKWISETOPRIGHT ),
+ TOKEN( "centerTop", XML_CENTERTOP ),
+ TOKEN( "centerRight", XML_CENTERRIGHT ),
+ TOKEN( "fanOutVertical", XML_FANOUTVERTICAL ),
+ TOKEN( "fanOutHorizontal", XML_FANOUTHORIZONTAL ),
+ TOKEN( "fanInVertical", XML_FANINVERTICAL ),
+ TOKEN( "fanInHorizontal", XML_FANINHORIZONTAL ),
+ TOKEN( "parallelVertical", XML_PARALLELVERTICAL ),
+ TOKEN( "parallelDiagonal", XML_PARALLELDIAGONAL ),
+ TOKEN( "oppositeVertical", XML_OPPOSITEVERTICAL ),
+ TOKEN( "oppositeHorizontal", XML_OPPOSITEHORIZONTAL ),
+ TOKEN( "parallelDiagonalTopLeft", XML_PARALLELDIAGONALTOPLEFT ),
+ TOKEN( "parallelDiagonalBottomLeft", XML_PARALLELDIAGONALBOTTOMLEFT ),
+ TOKEN( "topLeftHorizontal", XML_TOPLEFTHORIZONTAL ),
+ TOKEN( "topLeftDiagonal", XML_TOPLEFTDIAGONAL ),
+ TOKEN( "topLeftVertical", XML_TOPLEFTVERTICAL ),
+ TOKEN( "topRightDiagonal", XML_TOPRIGHTDIAGONAL ),
+ TOKEN( "bottomRightDiagonal", XML_BOTTOMRIGHTDIAGONAL ),
+ TOKEN( "bottomLeftDiagonal", XML_BOTTOMLEFTDIAGONAL ),
+ TOKEN( "topLeftClockwise", XML_TOPLEFTCLOCKWISE ),
+ TOKEN( "topRightClockwise", XML_TOPRIGHTCLOCKWISE ),
+ TOKEN( "bottomRightClockwise", XML_BOTTOMRIGHTCLOCKWISE ),
+ TOKEN( "bottomLeftClockwise", XML_BOTTOMLEFTCLOCKWISE ),
+ TOKEN( "topLeftCounterClockwise", XML_TOPLEFTCOUNTERCLOCKWISE ),
+ TOKEN( "topRightCounterClockwise", XML_TOPRIGHTCOUNTERCLOCKWISE ),
+ TOKEN( "bottomRightCounterClockwise", XML_BOTTOMRIGHTCOUNTERCLOCKWISE ),
+ TOKEN( "bottomLeftCounterClockwise", XML_BOTTOMLEFTCOUNTERCLOCKWISE ),
+ TOKEN( "verticalTopSame", XML_VERTICALTOPSAME ),
+ TOKEN( "verticalBottomSame", XML_VERTICALBOTTOMSAME ),
+ TOKEN( "verticalTopLeftOpposite", XML_VERTICALTOPLEFTOPPOSITE ),
+ TOKEN( "verticalBottomLeftOpposite", XML_VERTICALBOTTOMLEFTOPPOSITE ),
+ TOKEN( "horizontalLeftSame", XML_HORIZONTALLEFTSAME ),
+ TOKEN( "horizontalRightSame", XML_HORIZONTALRIGHTSAME ),
+ TOKEN( "horizontalTopLeftOpposite", XML_HORIZONTALTOPLEFTOPPOSITE ),
+ TOKEN( "horizontalTopRightOpposite", XML_HORIZONTALTOPRIGHTOPPOSITE ),
+ TOKEN( "diagonalBottomLeftOpposite", XML_DIAGONALBOTTOMLEFTOPPOSITE ),
+ TOKEN( "diagonalTopLeftOpposite", XML_DIAGONALTOPLEFTOPPOSITE ),
+ TOKEN( "twoBoxTop", XML_TWOBOXTOP ),
+ TOKEN( "twoBoxBottom", XML_TWOBOXBOTTOM ),
+ TOKEN( "twoBoxLeft", XML_TWOBOXLEFT ),
+ TOKEN( "twoBoxRight", XML_TWOBOXRIGHT ),
+ TOKEN( "fourBoxVertical", XML_FOURBOXVERTICAL ),
+ TOKEN( "fourBoxHorizontal", XML_FOURBOXHORIZONTAL ),
+ TOKEN( "verticalLeft", XML_VERTICALLEFT ),
+ TOKEN( "verticalRight", XML_VERTICALRIGHT ),
+ TOKEN( "horizontalLeft", XML_HORIZONTALLEFT ),
+ TOKEN( "horizontalRight", XML_HORIZONTALRIGHT ),
+ TOKEN( "fromLeft", XML_FROMLEFT ),
+ TOKEN( "fromTop", XML_FROMTOP ),
+ TOKEN( "fromRight", XML_FROMRIGHT ),
+ TOKEN( "fromBottom", XML_FROMBOTTOM ),
+ TOKEN( "crossfade", XML_CROSSFADE ),
+ TOKEN( "fadeToColor", XML_FADETOCOLOR ),
+ TOKEN( "fadeFromColor", XML_FADEFROMCOLOR ),
+ TOKEN( "fadeOverColor", XML_FADEOVERCOLOR ),
+ TOKEN( "threeBlade", XML_THREEBLADE ),
+ TOKEN( "eightBlade", XML_EIGHTBLADE ),
+ TOKEN( "oneBlade", XML_ONEBLADE ),
+ TOKEN( "across", XML_ACROSS ),
+ TOKEN( "combHorizontal", XML_COMBHORIZONTAL ),
+ TOKEN( "combVertical", XML_COMBVERTICAL ),
+ TOKEN( "rotateIn", XML_ROTATEIN ),
+ TOKEN( "rotateOut", XML_ROTATEOUT ),
+ TOKEN( "fromTopLeft", XML_FROMTOPLEFT ),
+ TOKEN( "fromTopRight", XML_FROMTOPRIGHT ),
+ TOKEN( "fromBottomLeft", XML_FROMBOTTOMLEFT ),
+ TOKEN( "fromBottomRight", XML_FROMBOTTOMRIGHT ),
+
+ TOKEN( "subtype", XML_SUBTYPE ),
+ TOKEN( "out", XML_OUT ),
+
+ TOKEN( "forward", XML_FORWARD ),
+ TOKEN( "reverse", XML_REVERSE ),
+
+ TOKEN( "fadeColor", XML_FADECOLOR ),
+
+ TOKEN( "onbegin", XML_ONBEGIN ),
+ TOKEN( "onend", XML_ONEND ),
+ TOKEN( "click", XML_CLICK ),
+ TOKEN( "doubleclick", XML_DOUBLECLICK ),
+ TOKEN( "mouseover", XML_MOUSEOVER ),
+ TOKEN( "mouseout", XML_MOUSEOUT ),
+
+ TOKEN( "node-type", XML_NODE_TYPE ),
+ TOKEN( "preset-id", XML_PRESET_ID ),
+ TOKEN( "preset-sub-type", XML_PRESET_SUB_TYPE ),
+ TOKEN( "preset-class", XML_PRESET_CLASS ),
+ TOKEN( "custom", XML_CUSTOM ),
+ TOKEN( "entrance", XML_ENTRANCE ),
+ TOKEN( "exit", XML_EXIT ),
+ TOKEN( "emphasis", XML_EMPHASIS ),
+ TOKEN( "motion-path", XML_MOTION_PATH ),
+ TOKEN( "ole-action", XML_OLE_ACTION ),
+ TOKEN( "media-call", XML_MEDIA_CALL ),
+ TOKEN( "on-click", XML_ON_CLICK ),
+ TOKEN( "with-previous", XML_WITH_PREVIOUS ),
+ TOKEN( "after-previous", XML_AFTER_PREVIOUS ),
+ TOKEN( "main-sequence", XML_MAIN_SEQUENCE ),
+ TOKEN( "timing-root", XML_TIMING_ROOT ),
+ TOKEN( "interactive-sequence",XML_INTERACTIVE_SEQUENCE ),
+
+ TOKEN( "sub-item", XML_SUB_ITEM ),
+ TOKEN( "iterate-type", XML_ITERATE_TYPE ),
+ TOKEN( "iterate-interval", XML_ITERATE_INTERVAL ),
+ TOKEN( "iterate", XML_ITERATE ),
+ TOKEN( "by-paragraph", XML_BY_PARAGRAPH ),
+ TOKEN( "by-word", XML_BY_WORD ),
+ TOKEN( "by-letter", XML_BY_LETTER ),
+
+ TOKEN( "after-effect", XML_AFTER_EFFECT ),
+ TOKEN( "master", XML_MASTER ),
+
+ TOKEN( "group-id", XML_GROUP_ID ),
+ TOKEN( "targetElement", XML_TARGETELEMENT ),
+ TOKEN( "toggle-pause", XML_TOGGLE_PAUSE ),
+ TOKEN( "master-element", XML_MASTER_ELEMENT ),
+ TOKEN( "stop-audio", XML_STOP_AUDIO ),
+
+ TOKEN( "audio-level", XML_AUDIO_LEVEL ),
+
+ TOKEN( "urn:oasis:names:tc", XML_URN_OASIS_NAMES_TC ),
+ TOKEN( "opendocument", XML_OPENDOCUMENT),
+ TOKEN( "1.0", XML_1_0 ),
+
+ TOKEN( "is-list-header", XML_IS_LIST_HEADER ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", XML_N_SVG_COMPAT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", XML_N_FO_COMPAT ),
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0", XML_N_SMIL_COMPAT ),
+ TOKEN( "http://www.w3.org/2001/SMIL20", XML_N_SMIL_OLD ),
+ TOKEN( "xforms-submission", XML_XFORMS_SUBMISSION ),
+ TOKEN( "xforms-list-source", XML_XFORMS_LIST_SOURCE ),
+
+ TOKEN( "http://www.w3.org/", XML_URI_W3_PREFIX ),
+ TOKEN( "/xforms", XML_URI_XFORMS_SUFFIX ),
+ // --> OD 2005-05-12 #i49139#
+ // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
+ // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
+ TOKEN( "horizontal-on-even", XML_HORIZONTAL_ON_EVEN ),
+ // <--
+ // --> OJ 2005-09-01
+ TOKEN( "urn:oasis:names:tc:opendocument:xmlns:report:1.0", XML_N_RPT_OASIS ),
+ TOKEN( "http://openoffice.org/2005/report", XML_N_RPT ),
+ TOKEN( "group", XML_GROUP ),
+ TOKEN( "groups", XML_GROUPS ),
+ TOKEN( "report-header", XML_REPORT_HEADER ),
+ TOKEN( "page-header", XML_PAGE_HEADER ),
+ TOKEN( "detail", XML_DETAIL ),
+ TOKEN( "page-footer", XML_PAGE_FOOTER ),
+ TOKEN( "report-footer", XML_REPORT_FOOTER ),
+ TOKEN( "start-new-column", XML_START_NEW_COLUMN ),
+ TOKEN( "reset-page-number", XML_RESET_PAGE_NUMBER ),
+ TOKEN( "print-header-on-each-page", XML_PRINT_HEADER_ON_EACH_PAGE ),
+ TOKEN( "group-expression", XML_GROUP_EXPRESSION ),
+ TOKEN( "group-header", XML_GROUP_HEADER ),
+ TOKEN( "group-footer", XML_GROUP_FOOTER ),
+ TOKEN( "header-on-new-page", XML_HEADER_ON_NEW_PAGE),
+ TOKEN( "footer-on-new-page", XML_FOOTER_ON_NEW_PAGE),
+ TOKEN( "page-print-option", XML_PAGE_PRINT_OPTION ),
+ TOKEN( "pre-evaluated", XML_PRE_EVALUATED),
+ TOKEN( "command-type", XML_COMMAND_TYPE ),
+ TOKEN( "master-fields", XML_MASTER_FIELDS ),
+ TOKEN( "detail-fields", XML_DETAIL_FIELDS ),
+ TOKEN( "conditional-print-expression", XML_CONDITIONAL_PRINT_EXPRESSION ),
+ TOKEN( "report-component", XML_REPORT_COMPONENT ),
+ TOKEN( "print-repeated-values", XML_PRINT_REPEATED_VALUES ),
+ TOKEN( "repeat-section", XML_REPEAT_SECTION ),
+ TOKEN( "force-new-column", XML_FORCE_NEW_COLUMN ),
+ TOKEN( "group-on", XML_GROUP_ON),
+ TOKEN( "force-new-page", XML_FORCE_NEW_PAGE),
+ TOKEN( "group-interval", XML_GROUP_INTERVAL),
+ TOKEN( "print-only-when-group-change", XML_PRINT_ONLY_WHEN_GROUP_CHANGE),
+ TOKEN( "report-element", XML_REPORT_ELEMENT),
+ TOKEN( "list-source", XML_LIST_SOURCE),
+ TOKEN( "list-source-type", XML_LIST_SOURCE_TYPE),
+ TOKEN( "image-data", XML_IMAGE_DATA),
+ TOKEN( "selected", XML_SELECTED),
+ TOKEN( "current-state", XML_CURRENT_STATE),
+ TOKEN( "is-tristate", XML_IS_TRISTATE),
+ TOKEN( "all-pages", XML_ALL_PAGES),
+ TOKEN( "not-with-report-header", XML_NOT_WITH_REPORT_HEADER ),
+ TOKEN( "not-with-report-footer", XML_NOT_WITH_REPORT_FOOTER ),
+ TOKEN( "not-with-report-header-nor-footer", XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER ),
+ TOKEN( "before-section", XML_BEFORE_SECTION ),
+ TOKEN( "after-section", XML_AFTER_SECTION ),
+ TOKEN( "before-after-section", XML_BEFORE_AFTER_SECTION),
+ TOKEN( "prefix-characters", XML_PREFIX_CHARACTERS ),
+ TOKEN( "quartal", XML_QUARTAL ),
+ TOKEN( "week", XML_WEEK ),
+ TOKEN( "whole-group", XML_WHOLE_GROUP ),
+ TOKEN( "with-first-detail", XML_WITH_FIRST_DETAIL ),
+ TOKEN( "top-down", XML_TOP_DOWN ),
+ TOKEN( "bottom-up", XML_BOTTOM_UP ),
+ TOKEN( "hour", XML_HOUR ),
+ TOKEN( "minute", XML_MINUTE ),
+ TOKEN( "rpt", XML_NP_RPT ),
+ TOKEN( "format-condition", XML_FORMAT_CONDITION ),
+ TOKEN( "expression1", XML_EXPRESSION1 ),
+ TOKEN( "expression2", XML_EXPRESSION2 ),
+ TOKEN( "equal", XML_EQUAL ),
+ TOKEN( "not_equal", XML_NOT_EQUAL ),
+ TOKEN( "less", XML_LESS ),
+ TOKEN( "greater", XML_GREATER ),
+ TOKEN( "less_equal", XML_LESS_EQUAL ),
+ TOKEN( "greater_equal", XML_GREATER_EQUAL ),
+ TOKEN( "between", XML_BETWEEN ),
+ TOKEN( "not_between", XML_NOT_BETWEEN ),
+ TOKEN( "table-template", XML_TABLE_TEMPLATE ),
+ TOKEN( "first-row", XML_FIRST_ROW ),
+ TOKEN( "last-row", XML_LAST_ROW ),
+ TOKEN( "first-column", XML_FIRST_COLUMN ),
+ TOKEN( "last-column", XML_LAST_COLUMN ),
+ TOKEN( "even-rows", XML_EVEN_ROWS ),
+ TOKEN( "odd-rows", XML_ODD_ROWS ),
+ TOKEN( "even-columns", XML_EVEN_COLUMNS ),
+ TOKEN( "odd-columns", XML_ODD_COLUMNS ),
+
+ // <--
+ TOKEN( "horizontal-on-odd", XML_HORIZONTAL_ON_ODD ),
+ // --> OD 2005-10-10 #i45874#
+ TOKEN( "restart-numbering", XML_RESTART_NUMBERING),
+ // <--
+ // -> FLR #i52127#
+ TOKEN( "numbered-paragraph", XML_NUMBERED_PARAGRAPH),
+ // <--
+ TOKEN( "master-detail-fields", XML_MASTER_DETAIL_FIELDS),
+ TOKEN( "master-detail-field", XML_MASTER_DETAIL_FIELD),
+ TOKEN( "sub-document", XML_SUB_DOCUMENT),
+ TOKEN( "fixed-content", XML_FIXED_CONTENT),
+ TOKEN( "initial-formula", XML_INITIAL_FORMULA),
+ TOKEN( "deep-traversing", XML_DEEP_TRAVERSING),
+ TOKEN( "preserve-IRI", XML_PRESERVE_IRI),
+ TOKEN( "sort-by-x-values", XML_SORT_BY_X_VALUES ),
+ TOKEN( "page-continuation", XML_PAGE_CONTINUATION ),
+ TOKEN( "right-angled-axes", XML_RIGHT_ANGLED_AXES ),
+ TOKEN( "soft-page-break", XML_SOFT_PAGE_BREAK ),
+ TOKEN( "use-soft-page-breaks", XML_USE_SOFT_PAGE_BREAKS ),
+ TOKEN( "percentage-data-style-name", XML_PERCENTAGE_DATA_STYLE_NAME ),
+ TOKEN( "value-and-percentage", XML_VALUE_AND_PERCENTAGE ),
+ TOKEN( "group-bars-per-axis", XML_GROUP_BARS_PER_AXIS ),
+ TOKEN( "include-hidden-cells", XML_INCLUDE_HIDDEN_CELLS ),
+ TOKEN( "auto-position", XML_AUTOMATIC_POSITION ),
+ TOKEN( "auto-size", XML_AUTOMATIC_SIZE ),
+ TOKEN( "reverse-direction", XML_REVERSE_DIRECTION ),
+ TOKEN( "label-separator", XML_LABEL_SEPARATOR ),
+ TOKEN( "label-position", XML_LABEL_POSITION ),
+ TOKEN( "avoid-overlap", XML_AVOID_OVERLAP ),
+ TOKEN( "near-origin", XML_NEAR_ORIGIN ),
+ TOKEN( "dependency", XML_DEPENDENCY ),
+ TOKEN( "nav-order", XML_NAV_ORDER ),
+
+ TOKEN( "use-first-row-styles", XML_USE_FIRST_ROW_STYLES ),
+ TOKEN( "use-last-row-styles", XML_USE_LAST_ROW_STYLES ),
+ TOKEN( "use-first-column-styles", XML_USE_FIRST_COLUMN_STYLES ),
+ TOKEN( "use-last-column-styles", XML_USE_LAST_COLUMN_STYLES ),
+ TOKEN( "use-banding-rows-styles", XML_USE_BANDING_ROWS_STYLES ),
+ TOKEN( "use-banding-columns-styles", XML_USE_BANDING_COLUMNS_STYLES ),
+
+ TOKEN( "automatic-content", XML_AUTOMATIC_CONTENT ),
+ TOKEN( "display-r-square", XML_DISPLAY_R_SQUARE ),
+ TOKEN( "display-equation", XML_DISPLAY_EQUATION ),
+ // db odf 12
+ TOKEN( "table-representations", XML_TABLE_REPRESENTATIONS ),
+ TOKEN( "table-representation", XML_TABLE_REPRESENTATION ),
+ TOKEN( "schema-definition", XML_SCHEMA_DEFINITION ),
+ TOKEN( "connection-data", XML_CONNECTION_DATA ),
+ TOKEN( "database-description", XML_DATABASE_DESCRIPTION ),
+ TOKEN( "compound-database", XML_COMPOUND_DATABASE ),
+ TOKEN( "file-based-database", XML_FILE_BASED_DATABASE ),
+ TOKEN( "server-database", XML_SERVER_DATABASE ),
+ TOKEN( "media-type", XML_MEDIA_TYPE ),
+ TOKEN( "hostname", XML_HOSTNAME ),
+ TOKEN( "port", XML_PORT ),
+ TOKEN( "local-socket", XML_LOCAL_SOCKET ),
+ TOKEN( "use-system-user", XML_USE_SYSTEM_USER ),
+ TOKEN( "driver-settings", XML_DRIVER_SETTINGS ),
+ TOKEN( "java-classpath", XML_JAVA_CLASSPATH ),
+ TOKEN( "character-set", XML_CHARACTER_SET ),
+ TOKEN( "application-connection-settings", XML_APPLICATION_CONNECTION_SETTINGS ),
+ TOKEN( "table-include-filter", XML_TABLE_INCLUDE_FILTER ),
+ TOKEN( "default-row-style-name", XML_DEFAULT_ROW_STYLE_NAME),
+ TOKEN( "angle-offset", XML_ANGLE_OFFSET ),
+ // --> OD 2007-09-14 #i81002#
+ TOKEN( "number-no-superior", XML_NUMBER_NO_SUPERIOR ),
+ TOKEN( "number-all-superior", XML_NUMBER_ALL_SUPERIOR ),
+ // <--
+ // --> OD 2008-01-15 #newlistlevelattrs#
+ TOKEN( "list-level-position-and-space-mode", XML_LIST_LEVEL_POSITION_AND_SPACE_MODE ),
+ TOKEN( "label-width-and-position", XML_LABEL_WIDTH_AND_POSITION ),
+ TOKEN( "label-alignment", XML_LABEL_ALIGNMENT ),
+ TOKEN( "list-level-label-alignment", XML_LIST_LEVEL_LABEL_ALIGNMENT ),
+ TOKEN( "label-followed-by", XML_LABEL_FOLLOWED_BY ),
+ TOKEN( "listtab", XML_LISTTAB ),
+ TOKEN( "space", XML_SPACE ),
+ TOKEN( "nothing", XML_NOTHING ),
+ TOKEN( "list-tab-stop-position", XML_LIST_TAB_STOP_POSITION ),
+ // <--
+
+ // bm: chart error bar extensions (ODF 1.2)
+ TOKEN( "standard-error", XML_STANDARD_ERROR ),
+ TOKEN( "cell-range" , XML_CELL_RANGE ),
+ TOKEN( "error-lower-range", XML_ERROR_LOWER_RANGE ),
+ TOKEN( "error-upper-range", XML_ERROR_UPPER_RANGE ),
+
+ // --> OD 2008-04-22 #refactorlists#
+ TOKEN( "continue-list", XML_CONTINUE_LIST ),
+ TOKEN( "style-override", XML_STYLE_OVERRIDE ),
+ // <--
+ //
+ // fs: #i90243#
+ TOKEN( "xforms-settings", XML_XFORM_MODEL_SETTINGS ),
+
+ // ODF 1.2 metadata
+ TOKEN( "meta-field", XML_META_FIELD ),
+ TOKEN( "about", XML_ABOUT ),
+ TOKEN( "datatype", XML_DATATYPE ),
+ TOKEN( "transformation", XML_TRANSFORMATION ),
+
+ // ODF 1.2 numbered-paragraph
+ TOKEN( "list-id", XML_LIST_ID ),
+
+ TOKEN( "treat-empty-cells", XML_TREAT_EMPTY_CELLS ),
+ TOKEN( "leave-gap", XML_LEAVE_GAP ),
+ TOKEN( "use-zero", XML_USE_ZERO ),
+ TOKEN( "ignore", XML_IGNORE ),
+
+ // enhanced fields
+ TOKEN( "fieldmark", XML_FIELDMARK ),
+ TOKEN( "fieldmark-start", XML_FIELDMARK_START ),
+ TOKEN( "fieldmark-end", XML_FIELDMARK_END ),
+ TOKEN( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", XML_N_FIELD ),
+ TOKEN( "field", XML_NP_FIELD ),
+
+ TOKEN( "image-scale", XML_IMAGE_SCALE ),
+ TOKEN( "isotropic", XML_ISOTROPIC ),
+ TOKEN( "anisotropic", XML_ANISOTROPIC ),
+
+ TOKEN( "axis-position", XML_AXIS_POSITION ),
+ TOKEN( "axis-label-position", XML_AXIS_LABEL_POSITION ),
+ TOKEN( "near-axis", XML_NEAR_AXIS ),
+ TOKEN( "near-axis-other-side", XML_NEAR_AXIS_OTHER_SIDE ),
+ TOKEN( "outside-start", XML_OUTSIDE_START ),
+ TOKEN( "outside-end", XML_OUTSIDE_END ),
+ TOKEN( "tick-mark-position", XML_TICK_MARK_POSITION ),
+ TOKEN( "at-labels", XML_AT_LABELS ),
+ TOKEN( "at-axis", XML_AT_AXIS ),
+ TOKEN( "at-labels-and-axis", XML_AT_LABELS_AND_AXIS ),
+ TOKEN( "filled-radar", XML_FILLED_RADAR ),
+ TOKEN( "surface", XML_SURFACE ),
+
+ TOKEN( "mathvariant", XML_MATHVARIANT ),
+ TOKEN( "mathsize", XML_MATHSIZE ),
+ TOKEN( "mathweight", XML_MATHWEIGHT ),
+ TOKEN( "mathcolor", XML_MATHCOLOR ),
+
+ TOKEN( "contains", XML_CONTAINS ),
+ TOKEN( "does-not-contain", XML_DOES_NOT_CONTAIN ),
+ TOKEN( "begins-with", XML_BEGINS_WITH ),
+ TOKEN( "does-not-begin-with", XML_DOES_NOT_BEGIN_WITH ),
+ TOKEN( "ends-with", XML_ENDS_WITH ),
+ TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ),
+
+ TOKEN( "chartooo", XML_NP_CHART_EXT ),
+ TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ),
+ TOKEN( "coordinate-region", XML_COORDINATE_REGION ),
+
+ TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ),
+ TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ),
+
+ TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ),
+ TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ),
+
+ TOKEN( "min-value", XML_MIN_VALUE ),
+ TOKEN( "max-value", XML_MAX_VALUE ),
+
+#if OSL_DEBUG_LEVEL > 0
+ { 0, NULL, NULL, XML_TOKEN_END }
+#else
+ { 0, NULL, NULL /* XML_TOKEN_END */ }
+#endif
+ };
+
+ sal_Int32 nRescheduleCount = 0;
+
+ // get OUString representation of token
+ const OUString& GetXMLToken( enum XMLTokenEnum eToken )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ // check the consistency of the token list. Below, we use the ordinal value of
+ // the token as index into the token list, so we should make sure that every
+ // entry is at the proper position
+ const XMLTokenEntry* pEntry = aTokenList;
+ const XMLTokenEntry* pEntryEnd = pEntry + sizeof ( aTokenList ) / sizeof ( XMLTokenEntry );
+ sal_uInt16 nPos = 0;
+ while ( pEntry < pEntryEnd )
+ {
+ OSL_ENSURE( nPos == (sal_uInt16)(pEntry->eToken),
+ "xmloff::GetXMLToken: inconsistency in the token list!" );
+ ++pEntry, ++nPos;
+ }
+#endif
+ DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
+ DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" );
+ DBG_ASSERT(sal_uInt16(eToken) < sizeof(aTokenList)/sizeof(aTokenList[0]),"Illegal position!");
+
+ XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
+ if (!pToken->pOUString)
+ pToken->pOUString = new OUString( pToken->pChar, pToken->nLength,
+ RTL_TEXTENCODING_ASCII_US );
+ return *pToken->pOUString;
+ }
+
+ // does rString represent eToken?
+ sal_Bool IsXMLToken(
+ const OUString& rString,
+ enum XMLTokenEnum eToken )
+ {
+ DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
+ DBG_ASSERT( eToken < XML_TOKEN_END, "token value too high!" );
+
+ const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
+ return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
+ }
+
+ // gives all allocated memory for OUString* back
+ void ResetTokens()
+ {
+ if (nRescheduleCount == 0)
+ {
+ for (sal_Int16 i=0, nEnd = sizeof ( aTokenList ) / sizeof ( XMLTokenEntry );
+ i < nEnd;
+ i++)
+ {
+ delete aTokenList[i].pOUString;
+ aTokenList[i].pOUString = NULL;
+ }
+ }
+ }
+
+ void IncRescheduleCount()
+ {
+ ++nRescheduleCount;
+ }
+
+ void DecRescheduleCount()
+ {
+ if (nRescheduleCount > 0)
+ --nRescheduleCount;
+ else {
+ DBG_ERROR("RescheduleCount not increased");
+ }
+ }
+
+}
+}
+
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
new file mode 100644
index 000000000000..5e91a8575b0a
--- /dev/null
+++ b/xmloff/source/core/xmluconv.cxx
@@ -0,0 +1,2300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmloff.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "xmlehelp.hxx"
+#include <xmloff/xmlement.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <rtl/math.hxx>
+#include <rtl/logfile.hxx>
+
+#ifndef _TOOLS_DATE_HXX
+#include <tools/date.hxx>
+
+#include <tools/string.hxx>
+
+#endif
+
+#include <tools/time.hxx>
+#include <tools/fldunit.hxx>
+
+// #110680#
+//#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+//#include <comphelper/processfactory.hxx>
+//#endif
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/i18n/UnicodeType.hpp>
+#include <basegfx/vector/b3dvector.hxx>
+
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::text;
+using namespace com::sun::star::style;
+using namespace ::com::sun::star::i18n;
+using namespace ::xmloff::token;
+
+const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11;
+const sal_Int8 XML_MAXDIGITSCOUNT_DATETIME = 6;
+#define XML_NULLDATE "NullDate"
+
+OUString SvXMLUnitConverter::msXML_true;
+OUString SvXMLUnitConverter::msXML_false;
+
+void SvXMLUnitConverter::initXMLStrings()
+{
+ if( msXML_true.getLength() == 0 )
+ {
+ msXML_true = GetXMLToken(XML_TRUE);
+ msXML_false = GetXMLToken(XML_FALSE);
+ }
+}
+
+void SvXMLUnitConverter::createNumTypeInfo() const
+{
+ // #110680#
+ //Reference< lang::XMultiServiceFactory > xServiceFactory =
+ // comphelper::getProcessServiceFactory();
+ //OSL_ENSURE( xServiceFactory.is(),
+ // "XMLUnitConverter: got no service factory" );
+
+ if( mxServiceFactory.is() )
+ {
+ ((SvXMLUnitConverter *)this)->xNumTypeInfo =
+ Reference < XNumberingTypeInfo > (
+ mxServiceFactory->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.DefaultNumberingProvider") ) ), UNO_QUERY );
+ }
+}
+
+/** constructs a SvXMLUnitConverter. The core measure unit is the
+ default unit for numerical measures, the XML measure unit is
+ the default unit for textual measures
+*/
+
+// #110680#
+//SvXMLUnitConverter::SvXMLUnitConverter( MapUnit eCoreMeasureUnit,
+// MapUnit eXMLMeasureUnit ) :
+SvXMLUnitConverter::SvXMLUnitConverter(
+ MapUnit eCoreMeasureUnit,
+ MapUnit eXMLMeasureUnit,
+ const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory ) :
+ aNullDate(30, 12, 1899),
+ mxServiceFactory( xServiceFactory )
+{
+ DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
+
+ meCoreMeasureUnit = eCoreMeasureUnit;
+ meXMLMeasureUnit = eXMLMeasureUnit;
+}
+
+SvXMLUnitConverter::~SvXMLUnitConverter()
+{
+}
+
+MapUnit SvXMLUnitConverter::GetMapUnit(sal_Int16 nFieldUnit)
+{
+ MapUnit eUnit = MAP_INCH;
+ switch( nFieldUnit )
+ {
+ case FUNIT_MM:
+ eUnit = MAP_MM;
+ break;
+ case FUNIT_CM:
+ case FUNIT_M:
+ case FUNIT_KM:
+ eUnit = MAP_CM;
+ break;
+ case FUNIT_TWIP:
+ eUnit = MAP_TWIP;
+ break;
+ case FUNIT_POINT:
+ case FUNIT_PICA:
+ eUnit = MAP_POINT;
+ break;
+// case FUNIT_INCH:
+// case FUNIT_FOOT:
+// case FUNIT_MILE:
+// eUnit = MAP_INCH;
+// break;
+ case FUNIT_100TH_MM:
+ eUnit = MAP_100TH_MM;
+ break;
+ }
+ return eUnit;
+}
+
+/** convert string to measure using optional min and max values*/
+sal_Bool SvXMLUnitConverter::convertMeasure( sal_Int32& nValue,
+ const OUString& rString,
+ sal_Int32 nMin, sal_Int32 nMax ) const
+{
+ return SvXMLUnitConverter::convertMeasure( nValue, rString,
+ meCoreMeasureUnit,
+ nMin, nMax );
+}
+
+/** convert measure to string */
+void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rString,
+ sal_Int32 nMeasure ) const
+{
+ SvXMLUnitConverter::convertMeasure( rString, nMeasure,
+ meCoreMeasureUnit,
+ meXMLMeasureUnit );
+}
+
+/** convert measure with given unit to string */
+void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rString,
+ sal_Int32 nMeasure,
+ MapUnit eSrcUnit ) const
+{
+ SvXMLUnitConverter::convertMeasure( rString, nMeasure,
+ eSrcUnit,
+ meXMLMeasureUnit );
+}
+
+/** convert the value from the given string to an int value
+ with the given map unit using optional min and max values
+*/
+sal_Bool SvXMLUnitConverter::convertMeasure( sal_Int32& rValue,
+ const OUString& rString,
+ MapUnit eDstUnit,
+ sal_Int32 nMin, sal_Int32 nMax )
+{
+ sal_Bool bNeg = sal_False;
+ double nVal = 0;
+
+ sal_Int32 nPos = 0;
+ const sal_Int32 nLen = rString.getLength();
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ nPos++;
+
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ {
+ bNeg = sal_True;
+ ++nPos;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ nVal *= 10;
+ nVal += (rString[nPos] - sal_Unicode('0'));
+ ++nPos;
+ }
+ double nDiv = 1.;
+ if( nPos < nLen && sal_Unicode('.') == rString[nPos] )
+ {
+ ++nPos;
+
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ nDiv *= 10;
+ nVal += ( ((double)(rString[nPos] - sal_Unicode('0'))) / nDiv );
+ ++nPos;
+ }
+ }
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ ++nPos;
+
+ if( nPos < nLen )
+ {
+
+ if( MAP_RELATIVE == eDstUnit )
+ {
+ if( sal_Unicode('%') != rString[nPos] )
+ return sal_False;
+ }
+ else if( MAP_PIXEL == eDstUnit )
+ {
+ if( nPos + 1 >= nLen ||
+ (sal_Unicode('p') != rString[nPos] &&
+ sal_Unicode('P') != rString[nPos])||
+ (sal_Unicode('x') != rString[nPos+1] &&
+ sal_Unicode('X') != rString[nPos+1]) )
+ return sal_False;
+ }
+ else
+ {
+ DBG_ASSERT( MAP_TWIP == eDstUnit || MAP_POINT == eDstUnit ||
+ MAP_100TH_MM == eDstUnit || MAP_10TH_MM == eDstUnit, "unit is not supported");
+ const sal_Char *aCmpsL[2] = { 0, 0 };
+ const sal_Char *aCmpsU[2] = { 0, 0 };
+ double aScales[2] = { 1., 1. };
+
+ if( MAP_TWIP == eDstUnit )
+ {
+ switch( rString[nPos] )
+ {
+ case sal_Unicode('c'):
+ case sal_Unicode('C'):
+ aCmpsL[0] = "cm";
+ aCmpsU[0] = "CM";
+ aScales[0] = (72.*20.)/2.54; // twip
+ break;
+ case sal_Unicode('e'):
+ case sal_Unicode('E'):
+ // pCmp1 = sXML_unit_em;
+ // nToken1 = CSS1_EMS;
+
+ // pCmp2 = sXML_unit_ex;
+ // nToken2 = CSS1_EMX;
+ break;
+ case sal_Unicode('i'):
+ case sal_Unicode('I'):
+ aCmpsL[0] = "in";
+ aCmpsU[0] = "IN";
+ aScales[0] = 72.*20.; // twip
+ break;
+ case sal_Unicode('m'):
+ case sal_Unicode('M'):
+ aCmpsL[0] = "mm";
+ aCmpsU[0] = "MM";
+ aScales[0] = (72.*20.)/25.4; // twip
+ break;
+ case sal_Unicode('p'):
+ case sal_Unicode('P'):
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = 20.; // twip
+
+ aCmpsL[1] = "pc";
+ aCmpsU[1] = "PC";
+ aScales[1] = 12.*20.; // twip
+
+ // pCmp3 = sXML_unit_px;
+ // nToken3 = CSS1_PIXLENGTH;
+ break;
+ }
+ }
+ else if( MAP_100TH_MM == eDstUnit || MAP_10TH_MM == eDstUnit )
+ {
+ double nScaleFactor = (MAP_100TH_MM == eDstUnit) ? 100.0 : 10.0;
+ switch( rString[nPos] )
+ {
+ case sal_Unicode('c'):
+ case sal_Unicode('C'):
+ aCmpsL[0] = "cm";
+ aCmpsU[0] = "CM";
+ aScales[0] = 10.0 * nScaleFactor; // mm/100
+ break;
+ case sal_Unicode('e'):
+ case sal_Unicode('E'):
+ // pCmp1 = sXML_unit_em;
+ // nToken1 = CSS1_EMS;
+
+ // pCmp2 = sXML_unit_ex;
+ // nToken2 = CSS1_EMX;
+ break;
+ case sal_Unicode('i'):
+ case sal_Unicode('I'):
+ aCmpsL[0] = "in";
+ aCmpsU[0] = "IN";
+ aScales[0] = 1000.*2.54; // mm/100
+ break;
+ case sal_Unicode('m'):
+ case sal_Unicode('M'):
+ aCmpsL[0] = "mm";
+ aCmpsU[0] = "MM";
+ aScales[0] = 1.0 * nScaleFactor; // mm/100
+ break;
+ case sal_Unicode('p'):
+ case sal_Unicode('P'):
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = (10.0 * nScaleFactor*2.54)/72.; // mm/100
+
+ aCmpsL[1] = "pc";
+ aCmpsU[1] = "PC";
+ aScales[1] = (10.0 * nScaleFactor*2.54)/12.; // mm/100
+
+ // pCmp3 = sXML_unit_px;
+ // nToken3 = CSS1_PIXLENGTH;
+ break;
+ }
+ }
+ else if( MAP_POINT == eDstUnit )
+ {
+ if( rString[nPos] == 'p' || rString[nPos] == 'P' )
+ {
+ aCmpsL[0] = "pt";
+ aCmpsU[0] = "PT";
+ aScales[0] = 1;
+ }
+ }
+
+ if( aCmpsL[0] == NULL )
+ return sal_False;
+
+ double nScale = 0.;
+ for( sal_uInt16 i= 0; i < 2; ++i )
+ {
+ const sal_Char *pL = aCmpsL[i];
+ if( pL )
+ {
+ const sal_Char *pU = aCmpsU[i];
+ while( nPos < nLen && *pL )
+ {
+ sal_Unicode c = rString[nPos];
+ if( c != *pL && c != *pU )
+ break;
+ ++pL;
+ ++pU;
+ ++nPos;
+ }
+ if( !*pL && (nPos == nLen || ' ' == rString[nPos]) )
+ {
+ nScale = aScales[i];
+ break;
+ }
+ }
+ }
+
+ if( 0. == nScale )
+ return sal_False;
+
+ // TODO: check overflow
+ if( nScale != 1. )
+ nVal *= nScale;
+ }
+ }
+
+ nVal += .5;
+ if( bNeg )
+ nVal = -nVal;
+
+ if( nVal <= (double)nMin )
+ rValue = nMin;
+ else if( nVal >= (double)nMax )
+ rValue = nMax;
+ else
+ rValue = (sal_Int32)nVal;
+
+ return sal_True;
+}
+
+/** convert measure in given unit to string with given unit */
+void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure,
+ MapUnit eSrcUnit,
+ MapUnit eDstUnit )
+{
+ if( eSrcUnit == MAP_RELATIVE )
+ {
+ DBG_ASSERT( eDstUnit == MAP_RELATIVE,
+ "MAP_RELATIVE only maps to MAP_RELATIVE!" );
+
+ rBuffer.append( nMeasure );
+ rBuffer.append( sal_Unicode('%' ) );
+ }
+ else
+ {
+ SvXMLExportHelper::AddLength( nMeasure, eSrcUnit,
+ rBuffer, eDstUnit );
+ }
+}
+
+/** convert string to boolean */
+sal_Bool SvXMLUnitConverter::convertBool( sal_Bool& rBool,
+ const OUString& rString )
+{
+ rBool = IsXMLToken(rString, XML_TRUE);
+
+ return rBool || IsXMLToken(rString, XML_FALSE);
+}
+
+/** convert boolean to string */
+void SvXMLUnitConverter::convertBool( OUStringBuffer& rBuffer,
+ sal_Bool bValue )
+{
+ rBuffer.append( GetXMLToken( bValue ? XML_TRUE : XML_FALSE ) );
+}
+
+/** convert string to percent */
+sal_Bool SvXMLUnitConverter::convertPercent( sal_Int32& rPercent,
+ const OUString& rString )
+{
+ return convertMeasure( rPercent, rString, MAP_RELATIVE );
+}
+
+/** convert percent to string */
+void SvXMLUnitConverter::convertPercent( OUStringBuffer& rBuffer,
+ sal_Int32 nValue )
+{
+ rBuffer.append( nValue );
+ rBuffer.append( sal_Unicode('%' ) );
+}
+
+/** convert string to pixel measure */
+sal_Bool SvXMLUnitConverter::convertMeasurePx( sal_Int32& rPixel,
+ const OUString& rString )
+{
+ return convertMeasure( rPixel, rString, MAP_PIXEL );
+}
+
+/** convert pixel measure to string */
+void SvXMLUnitConverter::convertMeasurePx( OUStringBuffer& rBuffer,
+ sal_Int32 nValue )
+{
+ rBuffer.append( nValue );
+ rBuffer.append( sal_Unicode('p' ) );
+ rBuffer.append( sal_Unicode('x' ) );
+}
+
+/** convert string to enum using given enum map, if the enum is
+ not found in the map, this method will return false
+*/
+sal_Bool SvXMLUnitConverter::convertEnum( sal_uInt16& rEnum,
+ const OUString& rValue,
+ const SvXMLEnumStringMapEntry *pMap )
+{
+ while( pMap->pName )
+ {
+ if( rValue.equalsAsciiL( pMap->pName, pMap->nNameLength ) )
+ {
+ rEnum = pMap->nValue;
+ return sal_True;
+ }
+ ++pMap;
+ }
+
+ return sal_False;
+}
+
+/** convert string to enum using given token map, if the enum is
+ not found in the map, this method will return false */
+sal_Bool SvXMLUnitConverter::convertEnum(
+ sal_uInt16& rEnum,
+ const OUString& rValue,
+ const SvXMLEnumMapEntry *pMap )
+{
+ while( pMap->eToken != XML_TOKEN_INVALID )
+ {
+ if( IsXMLToken( rValue, pMap->eToken ) )
+ {
+ rEnum = pMap->nValue;
+ return sal_True;
+ }
+ ++pMap;
+ }
+ return sal_False;
+}
+
+/** convert enum to string using given enum map with optional
+ default string. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if not default is set
+*/
+sal_Bool SvXMLUnitConverter::convertEnum( OUStringBuffer& rBuffer,
+ sal_uInt16 nValue,
+ const SvXMLEnumStringMapEntry *pMap,
+ sal_Char * pDefault /* = NULL */ )
+{
+ const sal_Char *pStr = pDefault;
+
+ while( pMap->pName )
+ {
+ if( pMap->nValue == nValue )
+ {
+ pStr = pMap->pName;
+ break;
+ }
+ ++pMap;
+ }
+
+ if( NULL == pStr )
+ pStr = pDefault;
+
+ if( NULL != pStr )
+ rBuffer.appendAscii( pStr );
+
+ return NULL != pStr;
+}
+
+/** convert enum to string using given token map with an optional
+ default token. If the enum is not found in the map,
+ this method will either use the given default or return
+ false if no default is set */
+sal_Bool SvXMLUnitConverter::convertEnum(
+ OUStringBuffer& rBuffer,
+ unsigned int nValue,
+ const SvXMLEnumMapEntry *pMap,
+ enum XMLTokenEnum eDefault)
+{
+ enum XMLTokenEnum eTok = eDefault;
+
+ while( pMap->eToken != XML_TOKEN_INVALID )
+ {
+ if( pMap->nValue == nValue )
+ {
+ eTok = pMap->eToken;
+ break;
+ }
+ ++pMap;
+ }
+
+ // the map may have contained XML_TOKEN_INVALID
+ if( eTok == XML_TOKEN_INVALID )
+ eTok = eDefault;
+
+ if( eTok != XML_TOKEN_INVALID )
+ rBuffer.append( GetXMLToken(eTok) );
+
+ return (eTok != XML_TOKEN_INVALID);
+}
+
+int lcl_gethex( int nChar )
+{
+ if( nChar >= '0' && nChar <= '9' )
+ return nChar - '0';
+ else if( nChar >= 'a' && nChar <= 'f' )
+ return nChar - 'a' + 10;
+ else if( nChar >= 'A' && nChar <= 'F' )
+ return nChar - 'A' + 10;
+ else
+ return 0;
+}
+
+/** convert string to color */
+sal_Bool SvXMLUnitConverter::convertColor( Color& rColor,
+ const OUString& rValue )
+{
+ if( rValue.getLength() != 7 || rValue[0] != '#' )
+ return sal_False;
+
+ rColor.SetRed(
+ sal::static_int_cast< UINT8 >(
+ lcl_gethex( rValue[1] ) * 16 + lcl_gethex( rValue[2] ) ) );
+
+ rColor.SetGreen(
+ sal::static_int_cast< UINT8 >(
+ lcl_gethex( rValue[3] ) * 16 + lcl_gethex( rValue[4] ) ) );
+
+ rColor.SetBlue(
+ sal::static_int_cast< UINT8 >(
+ lcl_gethex( rValue[5] ) * 16 + lcl_gethex( rValue[6] ) ) );
+
+ return sal_True;
+}
+
+static sal_Char aHexTab[] = "0123456789abcdef";
+
+/** convert color to string */
+void SvXMLUnitConverter::convertColor( OUStringBuffer& rBuffer,
+ const Color& rCol )
+{
+ rBuffer.append( sal_Unicode( '#' ) );
+
+ sal_uInt8 nCol = rCol.GetRed();
+ rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
+ rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
+
+ nCol = rCol.GetGreen();
+ rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
+ rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
+
+ nCol = rCol.GetBlue();
+ rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
+ rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
+}
+
+/** convert number to string */
+void SvXMLUnitConverter::convertNumber( OUStringBuffer& rBuffer,
+ sal_Int32 nNumber )
+{
+ rBuffer.append( sal_Int32( nNumber ) );
+}
+
+/** convert string to number with optional min and max values */
+sal_Bool SvXMLUnitConverter::convertNumber( sal_Int32& rValue,
+ const OUString& rString,
+ sal_Int32 nMin, sal_Int32 nMax )
+{
+ rValue = 0;
+ sal_Int64 nNumber = 0;
+ sal_Bool bRet = convertNumber64(nNumber,rString,nMin,nMax);
+ if ( bRet )
+ rValue = static_cast<sal_Int32>(nNumber);
+ return bRet;
+}
+
+/** convert 64-bit number to string */
+void SvXMLUnitConverter::convertNumber64( OUStringBuffer& rBuffer,
+ sal_Int64 nNumber )
+{
+ rBuffer.append( nNumber );
+}
+
+/** convert string to 64-bit number with optional min and max values */
+sal_Bool SvXMLUnitConverter::convertNumber64( sal_Int64& rValue,
+ const OUString& rString,
+ sal_Int64 nMin, sal_Int64 nMax )
+{
+ sal_Bool bNeg = sal_False;
+ rValue = 0;
+
+ sal_Int32 nPos = 0;
+ const sal_Int32 nLen = rString.getLength();
+
+ // skip white space
+ while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) )
+ ++nPos;
+
+ if( nPos < nLen && sal_Unicode('-') == rString[nPos] )
+ {
+ bNeg = sal_True;
+ ++nPos;
+ }
+
+ // get number
+ while( nPos < nLen &&
+ sal_Unicode('0') <= rString[nPos] &&
+ sal_Unicode('9') >= rString[nPos] )
+ {
+ // TODO: check overflow!
+ rValue *= 10;
+ rValue += (rString[nPos] - sal_Unicode('0'));
+ ++nPos;
+ }
+
+ if( bNeg )
+ rValue *= -1;
+
+ return ( nPos == nLen && rValue >= nMin && rValue <= nMax );
+}
+
+/** convert double number to string (using ::rtl::math) */
+void SvXMLUnitConverter::convertDouble(::rtl::OUStringBuffer& rBuffer,
+ double fNumber, BOOL bWriteUnits) const
+{
+ SvXMLUnitConverter::convertDouble(rBuffer, fNumber,
+ bWriteUnits, meCoreMeasureUnit, meXMLMeasureUnit);
+}
+
+/** convert double number to string (using ::rtl::math) */
+void SvXMLUnitConverter::convertDouble( ::rtl::OUStringBuffer& rBuffer,
+ double fNumber, BOOL bWriteUnits, MapUnit eCoreUnit, MapUnit eDstUnit)
+{
+ if(MAP_RELATIVE == eCoreUnit)
+ {
+ DBG_ASSERT(eDstUnit == MAP_RELATIVE, "MAP_RELATIVE only maps to MAP_RELATIVE!" );
+ ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
+ if(bWriteUnits)
+ rBuffer.append(sal_Unicode('%'));
+ }
+ else
+ {
+ OUStringBuffer sUnit;
+ double fFactor = SvXMLExportHelper::GetConversionFactor(sUnit, eCoreUnit, eDstUnit);
+ if(fFactor != 1.0)
+ fNumber *= fFactor;
+ ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
+ if(bWriteUnits)
+ rBuffer.append(sUnit);
+ }
+}
+
+/** convert double number to string (using ::rtl::math) */
+void SvXMLUnitConverter::convertDouble( ::rtl::OUStringBuffer& rBuffer, double fNumber)
+{
+ ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True);
+}
+
+/** convert string to double number (using ::rtl::math) */
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
+ const ::rtl::OUString& rString, BOOL bLookForUnits) const
+{
+ if(bLookForUnits)
+ {
+ MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString(rString, meCoreMeasureUnit);
+
+ return SvXMLUnitConverter::convertDouble(rValue, rString,
+ eSrcUnit, meCoreMeasureUnit);
+ }
+ else
+ {
+ return SvXMLUnitConverter::convertDouble(rValue, rString);
+ }
+}
+
+/** convert string to double number (using ::rtl::math) */
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
+ const ::rtl::OUString& rString, MapUnit eSrcUnit, MapUnit eCoreUnit)
+{
+ rtl_math_ConversionStatus eStatus;
+ rValue = ::rtl::math::stringToDouble( rString, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+
+ if(eStatus == rtl_math_ConversionStatus_Ok)
+ {
+ OUStringBuffer sUnit;
+ const double fFactor = SvXMLExportHelper::GetConversionFactor(sUnit, eCoreUnit, eSrcUnit);
+ if(fFactor != 1.0 && fFactor != 0.0)
+ rValue /= fFactor;
+ }
+
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
+/** convert string to double number (using ::rtl::math) */
+sal_Bool SvXMLUnitConverter::convertDouble(double& rValue, const ::rtl::OUString& rString)
+{
+ rtl_math_ConversionStatus eStatus;
+ rValue = ::rtl::math::stringToDouble( rString, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
+/** get the Null Date of the XModel and set it to the UnitConverter */
+sal_Bool SvXMLUnitConverter::setNullDate(const com::sun::star::uno::Reference <com::sun::star::frame::XModel>& xModel)
+{
+ com::sun::star::uno::Reference <com::sun::star::util::XNumberFormatsSupplier> xNumberFormatsSupplier (xModel, com::sun::star::uno::UNO_QUERY);
+ if (xNumberFormatsSupplier.is())
+ {
+ const com::sun::star::uno::Reference <com::sun::star::beans::XPropertySet> xPropertySet = xNumberFormatsSupplier->getNumberFormatSettings();
+ return xPropertySet.is() && (xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_NULLDATE))) >>= aNullDate);
+ }
+ return sal_False;
+}
+
+/** convert double to ISO Time String; negative durations allowed */
+void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
+ const double& fTime)
+{
+
+ double fValue = fTime;
+
+ // take care of negative durations as specified in:
+ // XML Schema, W3C Working Draft 07 April 2000, section 3.2.6.1
+ if (fValue < 0.0)
+ {
+ rBuffer.append(sal_Unicode('-'));
+ fValue = - fValue;
+ }
+
+ rBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM( "PT" ));
+ fValue *= 24;
+ double fHoursValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fHoursValue;
+ fValue *= 60;
+ double fMinsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fMinsValue;
+ fValue *= 60;
+ double fSecsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fSecsValue;
+ double f100SecsValue;
+ if (fValue > 0.00001)
+ f100SecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - 5);
+ else
+ f100SecsValue = 0.0;
+
+ if (f100SecsValue == 1.0)
+ {
+ f100SecsValue = 0.0;
+ fSecsValue += 1.0;
+ }
+ if (fSecsValue >= 60.0)
+ {
+ fSecsValue -= 60.0;
+ fMinsValue += 1.0;
+ }
+ if (fMinsValue >= 60.0)
+ {
+ fMinsValue -= 60.0;
+ fHoursValue += 1.0;
+ }
+
+ if (fHoursValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fHoursValue));
+ rBuffer.append( sal_Unicode('H'));
+ if (fMinsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fMinsValue));
+ rBuffer.append( sal_Unicode('M'));
+ if (fSecsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fSecsValue));
+ if (f100SecsValue > 0.0)
+ {
+ ::rtl::OUString a100th( ::rtl::math::doubleToUString( fValue,
+ rtl_math_StringFormat_F, XML_MAXDIGITSCOUNT_TIME - 5, '.',
+ sal_True));
+ if ( a100th.getLength() > 2 )
+ {
+ rBuffer.append( sal_Unicode('.'));
+ rBuffer.append( a100th.copy( 2 ) ); // strip 0.
+ }
+ }
+ rBuffer.append( sal_Unicode('S'));
+}
+
+/** convert ISO Time String to double; negative durations allowed */
+static bool lcl_convertTime( const ::rtl::OUString& rString, sal_Int32& o_rDays, sal_Int32& o_rHours, sal_Int32& o_rMins,
+ sal_Int32& o_rSecs, sal_Bool& o_rIsNegativeTime, double& o_rFractionalSecs )
+{
+ rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase();
+ const sal_Unicode* pStr = aTrimmed.getStr();
+
+ // negative time duration?
+ if ( sal_Unicode('-') == (*pStr) )
+ {
+ o_rIsNegativeTime = sal_True;
+ pStr++;
+ }
+
+ if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
+ return false;
+
+ ::rtl::OUString sDoubleStr;
+ sal_Bool bSuccess = true;
+ sal_Bool bDone = sal_False;
+ sal_Bool bTimePart = sal_False;
+ sal_Bool bIsFraction = sal_False;
+ sal_Int32 nTemp = 0;
+
+ while ( bSuccess && !bDone )
+ {
+ sal_Unicode c = *(pStr++);
+ if ( !c ) // end
+ bDone = sal_True;
+ else if ( sal_Unicode('0') <= c && sal_Unicode('9') >= c )
+ {
+ if ( nTemp >= SAL_MAX_INT32 / 10 )
+ bSuccess = false;
+ else
+ {
+ if ( !bIsFraction )
+ {
+ nTemp *= 10;
+ nTemp += (c - sal_Unicode('0'));
+ }
+ else
+ {
+ sDoubleStr += OUString::valueOf(c);
+ }
+ }
+ }
+ else if ( bTimePart )
+ {
+ if ( c == sal_Unicode('H') )
+ {
+ o_rHours = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('M') )
+ {
+ o_rMins = nTemp;
+ nTemp = 0;
+ }
+ else if ( (c == sal_Unicode(',')) || (c == sal_Unicode('.')) )
+ {
+ o_rSecs = nTemp;
+ nTemp = 0;
+ bIsFraction = sal_True;
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0."));
+ }
+ else if ( c == sal_Unicode('S') )
+ {
+ if ( !bIsFraction )
+ {
+ o_rSecs = nTemp;
+ nTemp = 0;
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0.0"));
+ }
+ }
+ else
+ bSuccess = false; // invalid character
+ }
+ else
+ {
+ if ( c == sal_Unicode('T') ) // "T" starts time part
+ bTimePart = sal_True;
+ else if ( c == sal_Unicode('D') )
+ {
+ o_rDays = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('Y') || c == sal_Unicode('M') )
+ {
+ //! how many days is a year or month?
+
+ DBG_ERROR("years or months in duration: not implemented");
+ bSuccess = false;
+ }
+ else
+ bSuccess = false; // invalid character
+ }
+ }
+
+ if ( bSuccess )
+ o_rFractionalSecs = sDoubleStr.toDouble();
+ return bSuccess;
+}
+
+sal_Bool SvXMLUnitConverter::convertTime( double& fTime,
+ const ::rtl::OUString& rString)
+{
+ sal_Int32 nDays = 0;
+ sal_Int32 nHours = 0;
+ sal_Int32 nMins = 0;
+ sal_Int32 nSecs = 0;
+ sal_Bool bIsNegativeDuration = sal_False;
+ double fFractionalSecs = 0.0;
+ if ( lcl_convertTime( rString, nDays, nHours, nMins, nSecs, bIsNegativeDuration, fFractionalSecs ) )
+ {
+ if ( nDays )
+ nHours += nDays * 24; // add the days to the hours part
+ double fTempTime = 0.0;
+ double fHour = nHours;
+ double fMin = nMins;
+ double fSec = nSecs;
+ double fSec100 = 0.0;
+ fTempTime = fHour / 24;
+ fTempTime += fMin / (24 * 60);
+ fTempTime += fSec / (24 * 60 * 60);
+ fTempTime += fSec100 / (24 * 60 * 60 * 60);
+ fTempTime += fFractionalSecs / (24 * 60 * 60);
+
+ // negative duration?
+ if ( bIsNegativeDuration )
+ {
+ fTempTime = -fTempTime;
+ }
+
+ fTime = fTempTime;
+ return sal_True;
+ }
+ return sal_False;
+}
+
+/** convert util::DateTime to ISO Time String */
+void SvXMLUnitConverter::convertTime( ::rtl::OUStringBuffer& rBuffer,
+ const ::com::sun::star::util::DateTime& rDateTime )
+{
+ double fHour = rDateTime.Hours;
+ double fMin = rDateTime.Minutes;
+ double fSec = rDateTime.Seconds;
+ double fSec100 = rDateTime.HundredthSeconds;
+ double fTempTime = fHour / 24;
+ fTempTime += fMin / (24 * 60);
+ fTempTime += fSec / (24 * 60 * 60);
+ fTempTime += fSec100 / (24 * 60 * 60 * 100);
+ convertTime( rBuffer, fTempTime );
+}
+
+/** convert ISO Time String to util::DateTime */
+sal_Bool SvXMLUnitConverter::convertTime( ::com::sun::star::util::DateTime& rDateTime,
+ const ::rtl::OUString& rString )
+{
+ sal_Int32 nDays = 0, nHours = 0, nMins = 0, nSecs = 0;
+ sal_Bool bIsNegativeDuration = sal_False;
+ double fFractionalSecs = 0.0;
+ if ( lcl_convertTime( rString, nDays, nHours, nMins, nSecs, bIsNegativeDuration, fFractionalSecs ) )
+ {
+ rDateTime.Year = 0;
+ rDateTime.Month = 0;
+ rDateTime.Day = 0;
+ rDateTime.Hours = static_cast < sal_uInt16 > ( nHours );
+ rDateTime.Minutes = static_cast < sal_uInt16 > ( nMins );
+ rDateTime.Seconds = static_cast < sal_uInt16 > ( nSecs );
+ rDateTime.HundredthSeconds = static_cast < sal_uInt16 > ( fFractionalSecs * 100.0 );
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+/** convert double to ISO Date Time String */
+void SvXMLUnitConverter::convertDateTime( ::rtl::OUStringBuffer& rBuffer,
+ const double& fDateTime,
+ const com::sun::star::util::Date& aTempNullDate,
+ sal_Bool bAddTimeIf0AM )
+{
+ double fValue = fDateTime;
+ sal_Int32 nValue = static_cast <sal_Int32> (::rtl::math::approxFloor (fValue));
+ Date aDate (aTempNullDate.Day, aTempNullDate.Month, aTempNullDate.Year);
+ aDate += nValue;
+ fValue -= nValue;
+ double fCount;
+ if (nValue > 0)
+ fCount = ::rtl::math::approxFloor (log10((double)nValue)) + 1;
+ else if (nValue < 0)
+ fCount = ::rtl::math::approxFloor (log10((double)(nValue * -1))) + 1;
+ else
+ fCount = 0.0;
+ sal_Int16 nCount = sal_Int16(fCount);
+ sal_Bool bHasTime(sal_False);
+ double fHoursValue = 0;
+ double fMinsValue = 0;
+ double fSecsValue = 0;
+ double f100SecsValue = 0;
+ if (fValue > 0.0)
+ {
+ bHasTime = sal_True;
+ fValue *= 24;
+ fHoursValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fHoursValue;
+ fValue *= 60;
+ fMinsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fMinsValue;
+ fValue *= 60;
+ fSecsValue = ::rtl::math::approxFloor (fValue);
+ fValue -= fSecsValue;
+ if (fValue > 0.0)
+ f100SecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - nCount);
+ else
+ f100SecsValue = 0.0;
+
+ if (f100SecsValue == 1.0)
+ {
+ f100SecsValue = 0.0;
+ fSecsValue += 1.0;
+ }
+ if (fSecsValue >= 60.0)
+ {
+ fSecsValue -= 60.0;
+ fMinsValue += 1.0;
+ }
+ if (fMinsValue >= 60.0)
+ {
+ fMinsValue -= 60.0;
+ fHoursValue += 1.0;
+ }
+ if (fHoursValue >= 24.0)
+ {
+ fHoursValue -= 24.0;
+ aDate += 1;
+ }
+ }
+ rBuffer.append( sal_Int32( aDate.GetYear()));
+ rBuffer.append( sal_Unicode('-'));
+ USHORT nTemp = aDate.GetMonth();
+ if (nTemp < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( nTemp));
+ rBuffer.append( sal_Unicode('-'));
+ nTemp = aDate.GetDay();
+ if (nTemp < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( nTemp));
+ if(bHasTime || bAddTimeIf0AM)
+ {
+ rBuffer.append( sal_Unicode('T'));
+ if (fHoursValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fHoursValue));
+ rBuffer.append( sal_Unicode(':'));
+ if (fMinsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fMinsValue));
+ rBuffer.append( sal_Unicode(':'));
+ if (fSecsValue < 10)
+ rBuffer.append( sal_Unicode('0'));
+ rBuffer.append( sal_Int32( fSecsValue));
+ if (f100SecsValue > 0.0)
+ {
+ ::rtl::OUString a100th( ::rtl::math::doubleToUString( fValue,
+ rtl_math_StringFormat_F,
+ XML_MAXDIGITSCOUNT_TIME - nCount, '.', sal_True));
+ if ( a100th.getLength() > 2 )
+ {
+ rBuffer.append( sal_Unicode('.'));
+ rBuffer.append( a100th.copy( 2 ) ); // strip 0.
+ }
+ }
+ }
+}
+
+/** convert ISO Date Time String to double */
+sal_Bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
+ const ::rtl::OUString& rString, const com::sun::star::util::Date& aTempNullDate)
+{
+ com::sun::star::util::DateTime aDateTime;
+ sal_Bool bSuccess = convertDateTime(aDateTime,rString);
+
+ if (bSuccess)
+ {
+ double fTempDateTime = 0.0;
+ const Date aTmpNullDate(aTempNullDate.Day, aTempNullDate.Month, aTempNullDate.Year);
+ const Date aTempDate((sal_uInt16)aDateTime.Day, (sal_uInt16)aDateTime.Month, (sal_uInt16)aDateTime.Year);
+ const sal_Int32 nTage = aTempDate - aTmpNullDate;
+ fTempDateTime = nTage;
+ double Hour = aDateTime.Hours;
+ double Min = aDateTime.Minutes;
+ double Sec = aDateTime.Seconds;
+ double Sec100 = aDateTime.HundredthSeconds;
+ fTempDateTime += Hour / 24;
+ fTempDateTime += Min / (24 * 60);
+ fTempDateTime += Sec / (24 * 60 * 60);
+ fTempDateTime += Sec100 / (24 * 60 * 60 * 100);
+ fDateTime = fTempDateTime;
+ }
+ return bSuccess;
+}
+
+/** convert util::DateTime to ISO Date String */
+void SvXMLUnitConverter::convertDateTime(
+ ::rtl::OUStringBuffer& rBuffer,
+ const com::sun::star::util::DateTime& rDateTime,
+ sal_Bool bAddTimeIf0AM )
+{
+ String aString( String::CreateFromInt32( rDateTime.Year ) );
+ aString += '-';
+ if( rDateTime.Month < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Month );
+ aString += '-';
+ if( rDateTime.Day < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Day );
+
+ if( rDateTime.Seconds != 0 ||
+ rDateTime.Minutes != 0 ||
+ rDateTime.Hours != 0 ||
+ bAddTimeIf0AM )
+ {
+ aString += 'T';
+ if( rDateTime.Hours < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Hours );
+ aString += ':';
+ if( rDateTime.Minutes < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Minutes );
+ aString += ':';
+ if( rDateTime.Seconds < 10 )
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.Seconds );
+ if ( rDateTime.HundredthSeconds > 0)
+ {
+ aString += '.';
+ if (rDateTime.HundredthSeconds < 10)
+ aString += '0';
+ aString += String::CreateFromInt32( rDateTime.HundredthSeconds );
+ }
+ }
+
+ rBuffer.append( aString );
+}
+
+/** convert ISO Date String to util::DateTime */
+sal_Bool SvXMLUnitConverter::convertDateTime( com::sun::star::util::DateTime& rDateTime,
+ const ::rtl::OUString& rString )
+{
+ sal_Bool bSuccess = sal_True;
+
+ rtl::OUString aDateStr, aTimeStr, sDoubleStr;
+ sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' );
+ sal_Int32 nPos2 = rString.indexOf( (sal_Unicode) ',' );
+ if (nPos2 < 0)
+ nPos2 = rString.indexOf( (sal_Unicode) '.' );
+ if ( nPos >= 0 )
+ {
+ aDateStr = rString.copy( 0, nPos );
+ if ( nPos2 >= 0 )
+ {
+ aTimeStr = rString.copy( nPos + 1, nPos2 - nPos - 1 );
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0."));
+ sDoubleStr += rString.copy( nPos2 + 1 );
+ }
+ else
+ {
+ aTimeStr = rString.copy(nPos + 1);
+ sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0.0"));
+ }
+ }
+ else
+ aDateStr = rString; // no separator: only date part
+
+ sal_Int32 nYear = 1899;
+ sal_Int32 nMonth = 12;
+ sal_Int32 nDay = 30;
+ sal_Int32 nHour = 0;
+ sal_Int32 nMin = 0;
+ sal_Int32 nSec = 0;
+
+ const sal_Unicode* pStr = aDateStr.getStr();
+ sal_Int32 nDateTokens = 1;
+ while ( *pStr )
+ {
+ if ( *pStr == '-' )
+ nDateTokens++;
+ pStr++;
+ }
+ if ( nDateTokens > 3 || aDateStr.getLength() == 0 )
+ bSuccess = sal_False;
+ else
+ {
+ sal_Int32 n = 0;
+ if ( !convertNumber( nYear, aDateStr.getToken( 0, '-', n ), 0, 9999 ) )
+ bSuccess = sal_False;
+ if ( nDateTokens >= 2 )
+ if ( !convertNumber( nMonth, aDateStr.getToken( 0, '-', n ), 0, 12 ) )
+ bSuccess = sal_False;
+ if ( nDateTokens >= 3 )
+ if ( !convertNumber( nDay, aDateStr.getToken( 0, '-', n ), 0, 31 ) )
+ bSuccess = sal_False;
+ }
+
+ if ( aTimeStr.getLength() > 0 ) // time is optional
+ {
+ pStr = aTimeStr.getStr();
+ sal_Int32 nTimeTokens = 1;
+ while ( *pStr )
+ {
+ if ( *pStr == ':' )
+ nTimeTokens++;
+ pStr++;
+ }
+ if ( nTimeTokens > 3 )
+ bSuccess = sal_False;
+ else
+ {
+ sal_Int32 n = 0;
+ if ( !convertNumber( nHour, aTimeStr.getToken( 0, ':', n ), 0, 23 ) )
+ bSuccess = sal_False;
+ if ( nTimeTokens >= 2 )
+ if ( !convertNumber( nMin, aTimeStr.getToken( 0, ':', n ), 0, 59 ) )
+ bSuccess = sal_False;
+ if ( nTimeTokens >= 3 )
+ if ( !convertNumber( nSec, aTimeStr.getToken( 0, ':', n ), 0, 59 ) )
+ bSuccess = sal_False;
+ }
+ }
+
+ if (bSuccess)
+ {
+ rDateTime.Year = (sal_uInt16)nYear;
+ rDateTime.Month = (sal_uInt16)nMonth;
+ rDateTime.Day = (sal_uInt16)nDay;
+ rDateTime.Hours = (sal_uInt16)nHour;
+ rDateTime.Minutes = (sal_uInt16)nMin;
+ rDateTime.Seconds = (sal_uInt16)nSec;
+ rDateTime.HundredthSeconds = (sal_uInt16)(sDoubleStr.toDouble() * 100);
+ }
+ return bSuccess;
+}
+
+/** gets the position of the first comma after npos in the string
+ rStr. Commas inside '"' pairs are not matched */
+sal_Int32 SvXMLUnitConverter::indexOfComma( const OUString& rStr,
+ sal_Int32 nPos )
+{
+ sal_Unicode cQuote = 0;
+ sal_Int32 nLen = rStr.getLength();
+ for( ; nPos < nLen; nPos++ )
+ {
+ sal_Unicode c = rStr[nPos];
+ switch( c )
+ {
+ case sal_Unicode('\''):
+ if( 0 == cQuote )
+ cQuote = c;
+ else if( '\'' == cQuote )
+ cQuote = 0;
+ break;
+
+ case sal_Unicode('"'):
+ if( 0 == cQuote )
+ cQuote = c;
+ else if( '\"' == cQuote )
+ cQuote = 0;
+ break;
+
+ case sal_Unicode(','):
+ if( 0 == cQuote )
+ return nPos;
+ break;
+ }
+ }
+
+ return -1;
+}
+
+// ---
+
+SvXMLTokenEnumerator::SvXMLTokenEnumerator( const OUString& rString, sal_Unicode cSeperator /* = sal_Unicode(' ') */ )
+: maTokenString( rString ), mnNextTokenPos(0), mcSeperator( cSeperator )
+{
+}
+
+sal_Bool SvXMLTokenEnumerator::getNextToken( OUString& rToken )
+{
+ if( -1 == mnNextTokenPos )
+ return sal_False;
+
+ int nTokenEndPos = maTokenString.indexOf( mcSeperator, mnNextTokenPos );
+ if( nTokenEndPos != -1 )
+ {
+ rToken = maTokenString.copy( mnNextTokenPos,
+ nTokenEndPos - mnNextTokenPos );
+ mnNextTokenPos = nTokenEndPos + 1;
+
+ // if the mnNextTokenPos is at the end of the string, we have
+ // to deliver an empty token
+ if( mnNextTokenPos > maTokenString.getLength() )
+ mnNextTokenPos = -1;
+ }
+ else
+ {
+ rToken = maTokenString.copy( mnNextTokenPos );
+ mnNextTokenPos = -1;
+ }
+
+ return sal_True;
+}
+
+// ---
+bool lcl_getPositions(const OUString& _sValue,OUString& _rContentX,OUString& _rContentY,OUString& _rContentZ)
+{
+ if(!_sValue.getLength() || _sValue[0] != '(')
+ return false;
+
+ sal_Int32 nPos(1L);
+ sal_Int32 nFound = _sValue.indexOf(sal_Unicode(' '), nPos);
+
+ if(nFound == -1 || nFound <= nPos)
+ return false;
+
+ _rContentX = _sValue.copy(nPos, nFound - nPos);
+
+ nPos = nFound + 1;
+ nFound = _sValue.indexOf(sal_Unicode(' '), nPos);
+
+ if(nFound == -1 || nFound <= nPos)
+ return false;
+
+ _rContentY = _sValue.copy(nPos, nFound - nPos);
+
+ nPos = nFound + 1;
+ nFound = _sValue.indexOf(sal_Unicode(')'), nPos);
+
+ if(nFound == -1 || nFound <= nPos)
+ return false;
+
+ _rContentZ = _sValue.copy(nPos, nFound - nPos);
+ return true;
+
+}
+/** convert string to ::basegfx::B3DVector */
+sal_Bool SvXMLUnitConverter::convertB3DVector( ::basegfx::B3DVector& rVector, const OUString& rValue )
+{
+ OUString aContentX,aContentY,aContentZ;
+ if ( !lcl_getPositions(rValue,aContentX,aContentY,aContentZ) )
+ return sal_False;
+
+ rtl_math_ConversionStatus eStatus;
+
+ rVector.setX(::rtl::math::stringToDouble(aContentX, sal_Unicode('.'),
+ sal_Unicode(','), &eStatus, NULL));
+
+ if( eStatus != rtl_math_ConversionStatus_Ok )
+ return sal_False;
+
+ rVector.setY(::rtl::math::stringToDouble(aContentY, sal_Unicode('.'),
+ sal_Unicode(','), &eStatus, NULL));
+
+ if( eStatus != rtl_math_ConversionStatus_Ok )
+ return sal_False;
+
+ rVector.setZ(::rtl::math::stringToDouble(aContentZ, sal_Unicode('.'),
+ sal_Unicode(','), &eStatus, NULL));
+
+
+ return ( eStatus == rtl_math_ConversionStatus_Ok );
+}
+
+/** convert ::basegfx::B3DVector to string */
+void SvXMLUnitConverter::convertB3DVector( OUStringBuffer &rBuffer, const ::basegfx::B3DVector& rVector )
+{
+ rBuffer.append(sal_Unicode('('));
+ convertDouble(rBuffer, rVector.getX());
+ rBuffer.append(sal_Unicode(' '));
+ convertDouble(rBuffer, rVector.getY());
+ rBuffer.append(sal_Unicode(' '));
+ convertDouble(rBuffer, rVector.getZ());
+ rBuffer.append(sal_Unicode(')'));
+}
+
+/** convert string to Position3D */
+sal_Bool SvXMLUnitConverter::convertPosition3D( drawing::Position3D& rPosition,
+ const OUString& rValue )
+{
+ OUString aContentX,aContentY,aContentZ;
+ if ( !lcl_getPositions(rValue,aContentX,aContentY,aContentZ) )
+ return sal_False;
+
+ if ( !convertDouble( rPosition.PositionX, aContentX, sal_True ) )
+ return sal_False;
+ if ( !convertDouble( rPosition.PositionY, aContentY, sal_True ) )
+ return sal_False;
+ return convertDouble( rPosition.PositionZ, aContentZ, sal_True );
+}
+
+/** convert Position3D to string */
+void SvXMLUnitConverter::convertPosition3D( OUStringBuffer &rBuffer,
+ const drawing::Position3D& rPosition )
+{
+ rBuffer.append( sal_Unicode('(') );
+ convertDouble( rBuffer, rPosition.PositionX, sal_True );
+ rBuffer.append( sal_Unicode(' ') );
+ convertDouble( rBuffer, rPosition.PositionY, sal_True );
+ rBuffer.append( sal_Unicode(' ') );
+ convertDouble( rBuffer, rPosition.PositionZ, sal_True );
+ rBuffer.append( sal_Unicode(')') );
+}
+
+const
+ sal_Char aBase64EncodeTable[] =
+ { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
+
+const
+ sal_uInt8 aBase64DecodeTable[] =
+ { 62,255,255,255, 63, // 43-47
+// + /
+
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255, 0,255,255, // 48-63
+// 0 1 2 3 4 5 6 7 8 9 =
+
+ 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
+// A B C D E F G H I J K L M N O
+
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255, // 80-95
+// P Q R S T U V W X Y Z
+
+ 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
+// a b c d e f g h i j k l m n o
+
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; // 112-123
+// p q r s t u v w x y z
+
+
+
+void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, rtl::OUStringBuffer& sBuffer)
+{
+ sal_Int32 nLen(nFullLen - nStart);
+ if (nLen > 3)
+ nLen = 3;
+ if (nLen == 0)
+ {
+ sBuffer.setLength(0);
+ return;
+ }
+
+ sal_Int32 nBinaer;
+ switch (nLen)
+ {
+ case 1:
+ {
+ nBinaer = ((sal_uInt8)pBuffer[nStart + 0]) << 16;
+ }
+ break;
+ case 2:
+ {
+ nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
+ (((sal_uInt8)pBuffer[nStart + 1]) << 8);
+ }
+ break;
+ default:
+ {
+ nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
+ (((sal_uInt8)pBuffer[nStart + 1]) << 8) +
+ ((sal_uInt8)pBuffer[nStart + 2]);
+ }
+ break;
+ }
+
+ sBuffer.appendAscii("====");
+
+ sal_uInt8 nIndex (static_cast<sal_uInt8>((nBinaer & 0xFC0000) >> 18));
+ sBuffer.setCharAt(0, aBase64EncodeTable [nIndex]);
+
+ nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F000) >> 12);
+ sBuffer.setCharAt(1, aBase64EncodeTable [nIndex]);
+ if (nLen == 1)
+ return;
+
+ nIndex = static_cast<sal_uInt8>((nBinaer & 0xFC0) >> 6);
+ sBuffer.setCharAt(2, aBase64EncodeTable [nIndex]);
+ if (nLen == 2)
+ return;
+
+ nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F));
+ sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
+}
+
+void SvXMLUnitConverter::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
+{
+ sal_Int32 i(0);
+ sal_Int32 nBufferLength(aPass.getLength());
+ const sal_Int8* pBuffer = aPass.getConstArray();
+ while (i < nBufferLength)
+ {
+ rtl::OUStringBuffer sBuffer;
+ ThreeByteToFourByte (pBuffer, i, nBufferLength, sBuffer);
+ aStrBuffer.append(sBuffer);
+ i += 3;
+ }
+}
+
+void SvXMLUnitConverter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const rtl::OUString& sBuffer)
+{
+ sal_Int32 nCharsDecoded = decodeBase64SomeChars( aBuffer, sBuffer );
+ OSL_ENSURE( nCharsDecoded == sBuffer.getLength(),
+ "some bytes left in base64 decoding!" );
+ (void)nCharsDecoded;
+}
+
+sal_Int32 SvXMLUnitConverter::decodeBase64SomeChars(
+ uno::Sequence<sal_Int8>& rOutBuffer,
+ const rtl::OUString& rInBuffer)
+{
+ sal_Int32 nInBufferLen = rInBuffer.getLength();
+ sal_Int32 nMinOutBufferLen = (nInBufferLen / 4) * 3;
+ if( rOutBuffer.getLength() < nMinOutBufferLen )
+ rOutBuffer.realloc( nMinOutBufferLen );
+
+ const sal_Unicode *pInBuffer = rInBuffer.getStr();
+ sal_Int8 *pOutBuffer = rOutBuffer.getArray();
+ sal_Int8 *pOutBufferStart = pOutBuffer;
+ sal_Int32 nCharsDecoded = 0;
+
+ sal_uInt8 aDecodeBuffer[4];
+ sal_Int32 nBytesToDecode = 0;
+ sal_Int32 nBytesGotFromDecoding = 3;
+ sal_Int32 nInBufferPos= 0;
+ while( nInBufferPos < nInBufferLen )
+ {
+ sal_Unicode cChar = *pInBuffer;
+ if( cChar >= '+' && cChar <= 'z' )
+ {
+ sal_uInt8 nByte = aBase64DecodeTable[cChar-'+'];
+ if( nByte != 255 )
+ {
+ // We have found a valid character!
+ aDecodeBuffer[nBytesToDecode++] = nByte;
+
+ // One '=' character at the end means 2 out bytes
+ // Two '=' characters at the end mean 1 out bytes
+ if( '=' == cChar && nBytesToDecode > 2 )
+ nBytesGotFromDecoding--;
+ if( 4 == nBytesToDecode )
+ {
+ // Four characters found, so we may convert now!
+ sal_uInt32 nOut = (aDecodeBuffer[0] << 18) +
+ (aDecodeBuffer[1] << 12) +
+ (aDecodeBuffer[2] << 6) +
+ aDecodeBuffer[3];
+
+ *pOutBuffer++ = (sal_Int8)((nOut & 0xff0000) >> 16);
+ if( nBytesGotFromDecoding > 1 )
+ *pOutBuffer++ = (sal_Int8)((nOut & 0xff00) >> 8);
+ if( nBytesGotFromDecoding > 2 )
+ *pOutBuffer++ = (sal_Int8)(nOut & 0xff);
+ nCharsDecoded = nInBufferPos + 1;
+ nBytesToDecode = 0;
+ nBytesGotFromDecoding = 3;
+ }
+ }
+ else
+ {
+ nCharsDecoded++;
+ }
+ }
+ else
+ {
+ nCharsDecoded++;
+ }
+
+ nInBufferPos++;
+ pInBuffer++;
+ }
+ if( (pOutBuffer - pOutBufferStart) != rOutBuffer.getLength() )
+ rOutBuffer.realloc( pOutBuffer - pOutBufferStart );
+
+ return nCharsDecoded;
+}
+
+sal_Bool SvXMLUnitConverter::convertNumFormat(
+ sal_Int16& rType,
+ const OUString& rNumFmt,
+ const OUString& rNumLetterSync,
+ sal_Bool bNumberNone ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Bool bExt = sal_False;
+
+ sal_Int32 nLen = rNumFmt.getLength();
+ if( 0 == nLen )
+ {
+ if( bNumberNone )
+ rType = NumberingType::NUMBER_NONE;
+ else
+ bRet = sal_False;
+ }
+ else if( 1 == nLen )
+ {
+ switch( rNumFmt[0] )
+ {
+ case sal_Unicode('1'): rType = NumberingType::ARABIC; break;
+ case sal_Unicode('a'): rType = NumberingType::CHARS_LOWER_LETTER; break;
+ case sal_Unicode('A'): rType = NumberingType::CHARS_UPPER_LETTER; break;
+ case sal_Unicode('i'): rType = NumberingType::ROMAN_LOWER; break;
+ case sal_Unicode('I'): rType = NumberingType::ROMAN_UPPER; break;
+ default: bExt = sal_True; break;
+ }
+ if( !bExt && IsXMLToken( rNumLetterSync, XML_TRUE ) )
+ {
+ switch( rType )
+ {
+ case NumberingType::CHARS_LOWER_LETTER:
+ rType = NumberingType::CHARS_LOWER_LETTER_N;
+ break;
+ case NumberingType::CHARS_UPPER_LETTER:
+ rType = NumberingType::CHARS_UPPER_LETTER_N;
+ break;
+ }
+ }
+ }
+ else
+ {
+ bExt = sal_True;
+ }
+ if( bExt )
+ {
+ Reference < XNumberingTypeInfo > xInfo = getNumTypeInfo();
+ if( xInfo.is() && xInfo->hasNumberingType( rNumFmt ) )
+ {
+ rType = xInfo->getNumberingType( rNumFmt );
+ }
+ else
+ {
+ rType = NumberingType::ARABIC;
+ }
+ }
+
+ return bRet;
+}
+
+void SvXMLUnitConverter::convertNumFormat( OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const
+{
+ enum XMLTokenEnum eFormat = XML_TOKEN_INVALID;
+ sal_Bool bExt = sal_False;
+ switch( nType )
+ {
+ case NumberingType::CHARS_UPPER_LETTER: eFormat = XML_A_UPCASE; break;
+ case NumberingType::CHARS_LOWER_LETTER: eFormat = XML_A; break;
+ case NumberingType::ROMAN_UPPER: eFormat = XML_I_UPCASE; break;
+ case NumberingType::ROMAN_LOWER: eFormat = XML_I; break;
+ case NumberingType::ARABIC: eFormat = XML_1; break;
+ case NumberingType::CHARS_UPPER_LETTER_N: eFormat = XML_A_UPCASE; break;
+ case NumberingType::CHARS_LOWER_LETTER_N: eFormat = XML_A; break;
+ case NumberingType::NUMBER_NONE: eFormat = XML__EMPTY; break;
+
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::PAGE_DESCRIPTOR:
+ case NumberingType::BITMAP:
+ DBG_ASSERT( eFormat != XML_TOKEN_INVALID, "invalid number format" );
+ break;
+ default:
+ bExt = sal_True;
+ break;
+ }
+
+ if( eFormat != XML_TOKEN_INVALID )
+ {
+ rBuffer.append( GetXMLToken(eFormat) );
+ }
+ else
+ {
+ Reference < XNumberingTypeInfo > xInfo = getNumTypeInfo();
+ if( xInfo.is() )
+ rBuffer.append( xInfo->getNumberingIdentifier( nType ) );
+ }
+}
+
+void SvXMLUnitConverter::convertNumLetterSync( OUStringBuffer& rBuffer,
+ sal_Int16 nType ) const
+{
+ enum XMLTokenEnum eSync = XML_TOKEN_INVALID;
+ switch( nType )
+ {
+ case NumberingType::CHARS_UPPER_LETTER:
+ case NumberingType::CHARS_LOWER_LETTER:
+ case NumberingType::ROMAN_UPPER:
+ case NumberingType::ROMAN_LOWER:
+ case NumberingType::ARABIC:
+ case NumberingType::NUMBER_NONE:
+ // default
+ // eSync = XML_FALSE;
+ break;
+
+ case NumberingType::CHARS_UPPER_LETTER_N:
+ case NumberingType::CHARS_LOWER_LETTER_N:
+ eSync = XML_TRUE;
+ break;
+
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::PAGE_DESCRIPTOR:
+ case NumberingType::BITMAP:
+ DBG_ASSERT( eSync != XML_TOKEN_INVALID, "invalid number format" );
+ break;
+ }
+ if( eSync != XML_TOKEN_INVALID )
+ rBuffer.append( GetXMLToken(eSync) );
+}
+
+void SvXMLUnitConverter::convertPropertySet(uno::Sequence<beans::PropertyValue>& rProps,
+ const uno::Reference<beans::XPropertySet>& aProperties)
+{
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = aProperties->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ uno::Sequence< beans::Property > aProps = xPropertySetInfo->getProperties();
+ const sal_Int32 nCount(aProps.getLength());
+ if (nCount)
+ {
+ rProps.realloc(nCount);
+ beans::PropertyValue* pProps = rProps.getArray();
+ for (sal_Int32 i = 0; i < nCount; i++, ++pProps)
+ {
+ pProps->Name = aProps[i].Name;
+ pProps->Value = aProperties->getPropertyValue(aProps[i].Name);
+ }
+ }
+ }
+}
+
+void SvXMLUnitConverter::convertPropertySet(uno::Reference<beans::XPropertySet>& rProperties,
+ const uno::Sequence<beans::PropertyValue>& aProps)
+{
+ sal_Int32 nCount(aProps.getLength());
+ if (nCount)
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = rProperties->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ if (xPropertySetInfo->hasPropertyByName(aProps[i].Name))
+ rProperties->setPropertyValue(aProps[i].Name, aProps[i].Value);
+ }
+ }
+ }
+}
+
+void SvXMLUnitConverter::clearUndefinedChars(rtl::OUString& rTarget, const rtl::OUString& rSource)
+{
+ sal_uInt32 nLength(rSource.getLength());
+ rtl::OUStringBuffer sBuffer(nLength);
+ for (sal_uInt32 i = 0; i < nLength; i++)
+ {
+ sal_Unicode cChar = rSource[i];
+ if (!(cChar < 0x0020) ||
+ (cChar == 0x0009) || // TAB
+ (cChar == 0x000A) || // LF
+ (cChar == 0x000D)) // legal character
+ sBuffer.append(cChar);
+ }
+ rTarget = sBuffer.makeStringAndClear();
+}
+
+OUString SvXMLUnitConverter::encodeStyleName(
+ const OUString& rName,
+ sal_Bool *pEncoded ) const
+{
+ if( pEncoded )
+ *pEncoded = sal_False;
+
+ sal_Int32 nLen = rName.getLength();
+ OUStringBuffer aBuffer( nLen );
+
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ sal_Unicode c = rName[i];
+ sal_Bool bValidChar = sal_False;
+ if( c < 0x00ffU )
+ {
+ bValidChar =
+ (c >= 0x0041 && c <= 0x005a) ||
+ (c >= 0x0061 && c <= 0x007a) ||
+ (c >= 0x00c0 && c <= 0x00d6) ||
+ (c >= 0x00d8 && c <= 0x00f6) ||
+ (c >= 0x00f8 && c <= 0x00ff) ||
+ ( i > 0 && ( (c >= 0x0030 && c <= 0x0039) ||
+ c == 0x00b7 || c == '-' || c == '.') );
+ }
+ else
+ {
+ if( (c >= 0xf900U && c <= 0xfffeU) ||
+ (c >= 0x20ddU && c <= 0x20e0U))
+ {
+ bValidChar = sal_False;
+ }
+ else if( (c >= 0x02bbU && c <= 0x02c1U) || c == 0x0559 ||
+ c == 0x06e5 || c == 0x06e6 )
+ {
+ bValidChar = sal_True;
+ }
+ else if( c == 0x0387 )
+ {
+ bValidChar = i > 0;
+ }
+ else
+ {
+ if( !xCharClass.is() )
+ {
+ if( mxServiceFactory.is() )
+ {
+ try
+ {
+ const_cast < SvXMLUnitConverter * >(this)
+ ->xCharClass =
+ Reference < XCharacterClassification >(
+ mxServiceFactory->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.i18n.CharacterClassification_Unicode") ),
+ UNO_QUERY );
+
+ OSL_ENSURE( xCharClass.is(),
+ "can't instantiate character clossification component" );
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+ if( xCharClass.is() )
+ {
+ sal_Int16 nType = xCharClass->getType( rName, i );
+
+ switch( nType )
+ {
+ case UnicodeType::UPPERCASE_LETTER: // Lu
+ case UnicodeType::LOWERCASE_LETTER: // Ll
+ case UnicodeType::TITLECASE_LETTER: // Lt
+ case UnicodeType::OTHER_LETTER: // Lo
+ case UnicodeType::LETTER_NUMBER: // Nl
+ bValidChar = sal_True;
+ break;
+ case UnicodeType::NON_SPACING_MARK: // Ms
+ case UnicodeType::ENCLOSING_MARK: // Me
+ case UnicodeType::COMBINING_SPACING_MARK: //Mc
+ case UnicodeType::MODIFIER_LETTER: // Lm
+ case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd
+ bValidChar = i > 0;
+ break;
+ }
+ }
+ }
+ }
+ if( bValidChar )
+ {
+ aBuffer.append( c );
+ }
+ else
+ {
+ aBuffer.append( static_cast< sal_Unicode >( '_' ) );
+ if( c > 0x0fff )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 12) & 0x0f ] ) );
+ if( c > 0x00ff )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 8) & 0x0f ] ) );
+ if( c > 0x000f )
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ (c >> 4) & 0x0f ] ) );
+ aBuffer.append( static_cast< sal_Unicode >(
+ aHexTab[ c & 0x0f ] ) );
+ aBuffer.append( static_cast< sal_Unicode >( '_' ) );
+ if( pEncoded )
+ *pEncoded = sal_True;
+ }
+ }
+
+ // check for length
+ if( aBuffer.getLength() > ((1<<15)-1) )
+ {
+ aBuffer = rName;
+ if( pEncoded )
+ *pEncoded = sal_False;
+ }
+
+
+ return aBuffer.makeStringAndClear();
+}
+
+// static
+rtl::OUString SvXMLUnitConverter::convertTimeDuration( const Time& rTime, sal_Int32 nSecondsFraction )
+{
+ // return ISO time period string
+ rtl::OUStringBuffer sTmp;
+ sTmp.append( sal_Unicode('P') ); // "period"
+
+ sal_uInt16 nHours = rTime.GetHour();
+ sal_Bool bHasHours = ( nHours > 0 );
+ if ( nHours >= 24 )
+ {
+ // add days
+
+ sal_uInt16 nDays = nHours / 24;
+ sTmp.append( (sal_Int32) nDays );
+ sTmp.append( sal_Unicode('D') ); // "days"
+
+ nHours -= nDays * 24;
+ }
+ sTmp.append( sal_Unicode('T') ); // "time"
+
+ if ( bHasHours )
+ {
+ sTmp.append( (sal_Int32) nHours );
+ sTmp.append( sal_Unicode('H') ); // "hours"
+ }
+ sal_uInt16 nMinutes = rTime.GetMin();
+ if ( bHasHours || nMinutes > 0 )
+ {
+ sTmp.append( (sal_Int32) nMinutes );
+ sTmp.append( sal_Unicode('M') ); // "minutes"
+ }
+ sal_uInt16 nSeconds = rTime.GetSec();
+ sTmp.append( (sal_Int32) nSeconds );
+ if ( nSecondsFraction )
+ {
+ sTmp.append( sal_Unicode( '.' ) );
+ ::rtl::OUStringBuffer aFractional;
+ convertNumber( aFractional, nSecondsFraction );
+ sTmp.append( aFractional.getStr() );
+ }
+ sTmp.append( sal_Unicode('S') ); // "seconds"
+
+ return sTmp.makeStringAndClear();
+}
+
+// static
+bool SvXMLUnitConverter::convertTimeDuration( const rtl::OUString& rString, Time& rTime, sal_Int32* pSecondsFraction )
+{
+ rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase();
+ const sal_Unicode* pStr = aTrimmed.getStr();
+
+ if ( *(pStr++) != sal_Unicode('P') ) // duration must start with "P"
+ return false;
+
+ bool bSuccess = true;
+ sal_Bool bDone = sal_False;
+ sal_Bool bTimePart = sal_False;
+ sal_Bool bFractional = sal_False;
+ sal_Int32 nDays = 0;
+ sal_Int32 nHours = 0;
+ sal_Int32 nMins = 0;
+ sal_Int32 nSecs = 0;
+ sal_Int32 nTemp = 0;
+ sal_Int32 nSecondsFraction = 0;
+
+ while ( bSuccess && !bDone )
+ {
+ sal_Unicode c = *(pStr++);
+ if ( !c ) // end
+ bDone = sal_True;
+ else if ( sal_Unicode('0') <= c && sal_Unicode('9') >= c )
+ {
+ if ( bFractional )
+ {
+ if ( nSecondsFraction >= SAL_MAX_INT32 / 10 )
+ bSuccess = false;
+ else
+ {
+ nSecondsFraction *= 10;
+ nSecondsFraction += (c - sal_Unicode('0'));
+ }
+ }
+ else
+ {
+ if ( nTemp >= SAL_MAX_INT32 / 10 )
+ bSuccess = false;
+ else
+ {
+ nTemp *= 10;
+ nTemp += (c - sal_Unicode('0'));
+ }
+ }
+ }
+ else if ( bTimePart )
+ {
+ if ( c == sal_Unicode('H') )
+ {
+ nHours = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('M') )
+ {
+ nMins = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('S') )
+ {
+ nSecs = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == '.' )
+ {
+ bFractional = sal_True;
+ }
+ else
+ bSuccess = false; // invalid characted
+ }
+ else
+ {
+ if ( c == sal_Unicode('T') ) // "T" starts time part
+ bTimePart = TRUE;
+ else if ( c == sal_Unicode('D') )
+ {
+ nDays = nTemp;
+ nTemp = 0;
+ }
+ else if ( c == sal_Unicode('Y') || c == sal_Unicode('M') )
+ {
+ //! how many days is a year or month?
+
+ DBG_ERROR("years or months in duration: not implemented");
+ bSuccess = false;
+ }
+ else
+ bSuccess = false; // invalid characted
+ }
+ }
+
+ if ( bSuccess )
+ {
+ if ( nDays )
+ nHours += nDays * 24; // add the days to the hours part
+ rTime = Time( nHours, nMins, nSecs );
+ if ( pSecondsFraction )
+ *pSecondsFraction = nSecondsFraction % 1000;
+ }
+ return bSuccess;
+}
+
+sal_Bool SvXMLUnitConverter::convertAny( ::rtl::OUStringBuffer& sValue,
+ ::rtl::OUStringBuffer& sType ,
+ const com::sun::star::uno::Any& aValue)
+{
+ sal_Bool bConverted = sal_False;
+
+ sValue.setLength(0);
+ sType.setLength (0);
+
+ switch(aValue.getValueTypeClass())
+ {
+ case com::sun::star::uno::TypeClass_BYTE :
+ case com::sun::star::uno::TypeClass_SHORT :
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT :
+ case com::sun::star::uno::TypeClass_LONG :
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG :
+ {
+ sal_Int32 nTempValue = 0;
+ if (aValue >>= nTempValue)
+ {
+ sType.appendAscii("integer");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertNumber(sValue, nTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_BOOLEAN :
+ {
+ sal_Bool bTempValue = sal_False;
+ if (aValue >>= bTempValue)
+ {
+ sType.appendAscii("boolean");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertBool(sValue, bTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_FLOAT :
+ case com::sun::star::uno::TypeClass_DOUBLE :
+ {
+ double fTempValue = 0.0;
+ if (aValue >>= fTempValue)
+ {
+ sType.appendAscii("float");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertDouble(sValue, fTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_STRING :
+ {
+ ::rtl::OUString sTempValue;
+ if (aValue >>= sTempValue)
+ {
+ sType.appendAscii("string");
+ bConverted = sal_True;
+ sValue.append(sTempValue);
+ }
+ }
+ break;
+
+ case com::sun::star::uno::TypeClass_STRUCT :
+ {
+ com::sun::star::util::Date aDate ;
+ com::sun::star::util::Time aTime ;
+ com::sun::star::util::DateTime aDateTime;
+
+ if (aValue >>= aDate)
+ {
+ sType.appendAscii("date");
+ bConverted = sal_True;
+ com::sun::star::util::DateTime aTempValue;
+ aTempValue.Day = aDate.Day;
+ aTempValue.Month = aDate.Month;
+ aTempValue.Year = aDate.Year;
+ aTempValue.HundredthSeconds = 0;
+ aTempValue.Seconds = 0;
+ aTempValue.Minutes = 0;
+ aTempValue.Hours = 0;
+ SvXMLUnitConverter::convertDateTime(sValue, aTempValue);
+ }
+ else
+ if (aValue >>= aTime)
+ {
+ sType.appendAscii("time");
+ bConverted = sal_True;
+ com::sun::star::util::DateTime aTempValue;
+ aTempValue.Day = 0;
+ aTempValue.Month = 0;
+ aTempValue.Year = 0;
+ aTempValue.HundredthSeconds = aTime.HundredthSeconds;
+ aTempValue.Seconds = aTime.Seconds;
+ aTempValue.Minutes = aTime.Minutes;
+ aTempValue.Hours = aTime.Hours;
+ SvXMLUnitConverter::convertTime(sValue, aTempValue);
+ }
+ else
+ if (aValue >>= aDateTime)
+ {
+ sType.appendAscii("date");
+ bConverted = sal_True;
+ SvXMLUnitConverter::convertDateTime(sValue, aDateTime);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return bConverted;
+}
+
+sal_Bool SvXMLUnitConverter::convertAny( com::sun::star::uno::Any& aValue,
+ const ::rtl::OUString& sType ,
+ const ::rtl::OUString& sValue)
+{
+ sal_Bool bConverted = sal_False;
+
+ if (sType.equalsAscii("boolean"))
+ {
+ sal_Bool bTempValue = sal_False;
+ SvXMLUnitConverter::convertBool(bTempValue, sValue);
+ aValue <<= bTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAscii("integer"))
+ {
+ sal_Int32 nTempValue = 0;
+ SvXMLUnitConverter::convertNumber(nTempValue, sValue);
+ aValue <<= nTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAscii("float"))
+ {
+ double fTempValue = 0.0;
+ SvXMLUnitConverter::convertDouble(fTempValue, sValue);
+ aValue <<= fTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAscii("string"))
+ {
+ aValue <<= sValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAscii("date"))
+ {
+ com::sun::star::util::DateTime aTempValue;
+ SvXMLUnitConverter::convertDateTime(aTempValue, sValue);
+ aValue <<= aTempValue;
+ bConverted = sal_True;
+ }
+ else
+ if (sType.equalsAscii("time"))
+ {
+ com::sun::star::util::DateTime aTempValue;
+ com::sun::star::util::Time aConvValue;
+ SvXMLUnitConverter::convertTime(aTempValue, sValue);
+ aConvValue.HundredthSeconds = aTempValue.HundredthSeconds;
+ aConvValue.Seconds = aTempValue.Seconds;
+ aConvValue.Minutes = aTempValue.Minutes;
+ aConvValue.Hours = aTempValue.Hours;
+ aValue <<= aConvValue;
+ bConverted = sal_True;
+ }
+
+ return bConverted;
+}