summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-12 12:08:41 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-12 12:08:41 +0100
commit00cde21c20fdb754368700af92db1c49346813ad (patch)
tree9fd48b3b7965679328cb798b36ff7f14b67b58e5 /xmloff
parentbec6c2b0014b2b5f0d291914db4957c57eac4642 (diff)
autorecovery: let the XMLSettingsExportHelper work on an abstract interface for actual writing, instead of an SvXMLExport.
This way, it can also be used in contexts where we do not have a full blown SvXMLExport instance.
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/xmloff/SettingsExportHelper.hxx12
-rw-r--r--xmloff/inc/xmloff/XMLSettingsExportContext.hxx66
-rw-r--r--xmloff/prj/d.lst1
-rw-r--r--xmloff/source/core/SettingsExportHelper.cxx129
-rw-r--r--xmloff/source/core/xmlexp.cxx74
5 files changed, 216 insertions, 66 deletions
diff --git a/xmloff/inc/xmloff/SettingsExportHelper.hxx b/xmloff/inc/xmloff/SettingsExportHelper.hxx
index 4c6329e58fdb..e0a8960c5336 100644
--- a/xmloff/inc/xmloff/SettingsExportHelper.hxx
+++ b/xmloff/inc/xmloff/SettingsExportHelper.hxx
@@ -43,9 +43,15 @@ namespace com
namespace util { struct DateTime; }
} }
}
+
+namespace xmloff
+{
+ class XMLSettingsExportContext;
+}
+
class XMLSettingsExportHelper
{
- SvXMLExport& rExport;
+ ::xmloff::XMLSettingsExportContext& m_rContext;
::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubsitution;
@@ -94,10 +100,10 @@ class XMLSettingsExportHelper
const rtl::OUString rName) const;
public:
- XMLSettingsExportHelper(SvXMLExport& rExport);
+ XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext );
~XMLSettingsExportHelper();
- void exportSettings(
+ void exportAllSettings(
const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps,
const rtl::OUString& rName) const;
};
diff --git a/xmloff/inc/xmloff/XMLSettingsExportContext.hxx b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx
new file mode 100644
index 000000000000..d3e0b6a8c5ee
--- /dev/null
+++ b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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 XML_SETTINGS_EXPORT_CONTEXT_HXX
+#define XML_SETTINGS_EXPORT_CONTEXT_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+/** === end UNO includes === **/
+
+#include "xmloff/xmltoken.hxx"
+
+//........................................................................
+namespace xmloff
+{
+//........................................................................
+
+ //====================================================================
+ //= XMLExporter
+ //====================================================================
+ class SAL_NO_VTABLE XMLSettingsExportContext
+ {
+ public:
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const ::rtl::OUString& i_rValue ) = 0;
+ virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
+ enum ::xmloff::token::XMLTokenEnum i_eValue ) = 0;
+
+ virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName,
+ const sal_Bool i_bIgnoreWhitespace ) = 0;
+ virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ) = 0;
+
+ virtual void Characters( const ::rtl::OUString& i_rCharacters ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetServiceFactory() const = 0;
+
+ };
+
+//........................................................................
+} // namespace xmloff
+//........................................................................
+
+#endif // XML_SETTINGS_EXPORT_CONTEXT_HXX
diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst
index 686b4b70a0ae..98ab3c3e5cd1 100644
--- a/xmloff/prj/d.lst
+++ b/xmloff/prj/d.lst
@@ -87,6 +87,7 @@ mkdir: %_DEST%\inc%_EXT%\xmloff
..\inc\HatchStyle.hxx %_DEST%\inc%_EXT%\xmloff\HatchStyle.hxx
..\inc\ImageStyle.hxx %_DEST%\inc%_EXT%\xmloff\ImageStyle.hxx
..\inc\xmloff\SettingsExportHelper.hxx %_DEST%\inc%_EXT%\xmloff\SettingsExportHelper.hxx
+..\inc\xmloff\XMLSettingsExportContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLSettingsExportContext.hxx
..\inc\xmloff\DocumentSettingsContext.hxx %_DEST%\inc%_EXT%\xmloff\DocumentSettingsContext.hxx
..\inc\xmloff\XMLGraphicsDefaultStyle.hxx %_DEST%\inc%_EXT%\xmloff\XMLGraphicsDefaultStyle.hxx
..\inc\XMLEmbeddedObjectExportFilter.hxx %_DEST%\inc%_EXT%\xmloff\XMLEmbeddedObjectExportFilter.hxx
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
index e8bb000942d1..79d8cede571c 100644
--- a/xmloff/source/core/SettingsExportHelper.cxx
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -35,32 +35,27 @@
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmluconv.hxx>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <comphelper/extract.hxx>
-// #110680#
-//#ifndef _COMPHELPER_PROCESSFACTORYHXX_
-//#include <comphelper/processfactory.hxx>
-//#endif
#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>
-#ifndef _COM_SUN_STAR_CONTAINER_XIndexCONTAINER_HPP_
#include <com/sun/star/container/XIndexContainer.hpp>
-#endif
#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/nmspmap.hxx>
+#include <xmloff/XMLSettingsExportContext.hxx>
#include <xmlenums.hxx>
using namespace ::com::sun::star;
using namespace ::xmloff::token;
-XMLSettingsExportHelper::XMLSettingsExportHelper(SvXMLExport& rTempExport)
-: rExport(rTempExport)
+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" ) )
@@ -197,89 +192,97 @@ void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny,
void XMLSettingsExportHelper::exportBool(const sal_Bool bValue, const rtl::OUString& rName) const
{
DBG_ASSERT(rName.getLength(), "no name");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BOOLEAN);
- SvXMLElementExport aBoolElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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);
- rExport.GetDocHandler()->characters(sValue);
+ m_rContext.Characters( sValue );
+ m_rContext.EndElement( sal_False );
}
void XMLSettingsExportHelper::exportByte(const sal_Int8 nValue, const rtl::OUString& rName) const
{
DBG_ASSERT(rName.getLength(), "no name");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BYTE);
- SvXMLElementExport aShortElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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));
- rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
}
void XMLSettingsExportHelper::exportShort(const sal_Int16 nValue, const rtl::OUString& rName) const
{
DBG_ASSERT(rName.getLength(), "no name");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_SHORT);
- SvXMLElementExport aShortElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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));
- rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
+ 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");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_INT);
- SvXMLElementExport aIntElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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);
- rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
+ 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");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_LONG);
- SvXMLElementExport aIntElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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));
- rExport.GetDocHandler()->characters(sValue);
+ 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");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_DOUBLE);
- SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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);
- rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
+ 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");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_STRING);
- SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_STRING );
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
if (sValue.getLength())
- rExport.GetDocHandler()->characters(sValue);
+ 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");
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_DATETIME);
+ m_rContext.AddAttribute( XML_NAME, rName );
+ m_rContext.AddAttribute( XML_TYPE, XML_DATETIME );
rtl::OUStringBuffer sBuffer;
SvXMLUnitConverter::convertDateTime(sBuffer, aValue);
- SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
- rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
+ m_rContext.StartElement( XML_CONFIG_ITEM, sal_True );
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
+ m_rContext.EndElement( sal_False );
}
void XMLSettingsExportHelper::exportSequencePropertyValue(
@@ -290,10 +293,11 @@ void XMLSettingsExportHelper::exportSequencePropertyValue(
sal_Int32 nLength(aProps.getLength());
if(nLength)
{
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- SvXMLElementExport aSequenceElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_SET, sal_True, sal_True);
+ 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(
@@ -302,7 +306,7 @@ void XMLSettingsExportHelper::exportSymbolDescriptors(
{
// #110680#
// uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory( rExport.getServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() );
DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportSymbolDescriptors: got no service manager" );
if( xServiceFactory.is() )
@@ -365,15 +369,16 @@ void XMLSettingsExportHelper::exportbase64Binary(
{
DBG_ASSERT(rName.getLength(), "no name");
sal_Int32 nLength(aProps.getLength());
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BASE64BINARY);
- SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False);
+ 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);
- rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
+ m_rContext.Characters( sBuffer.makeStringAndClear() );
}
+ m_rContext.EndElement( sal_False );
}
void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny,
@@ -387,10 +392,11 @@ void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny,
if (nLength)
{
if (bNameAccess)
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- SvXMLElementExport aEntryElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_ENTRY, sal_True, sal_True);
+ 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 );
}
}
@@ -403,11 +409,12 @@ void XMLSettingsExportHelper::exportNameAccess(
"wrong NameAccess" );
if(aNamed->hasElements())
{
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- SvXMLElementExport aNamedElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_NAMED, sal_True, sal_True);
+ 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 );
}
}
@@ -421,13 +428,14 @@ void XMLSettingsExportHelper::exportIndexAccess(
rtl::OUString sEmpty;// ( RTLCONSTASCII_USTRINGPARAM( "View" ) );
if(aIndexed->hasElements())
{
- rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName);
- SvXMLElementExport aIndexedElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_INDEXED, sal_True, sal_True);
+ 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 );
}
}
@@ -448,7 +456,7 @@ void XMLSettingsExportHelper::exportForbiddenCharacters(
// #110680#
// uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory( rExport.getServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() );
DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportForbiddenCharacters: got no service manager" );
if( xServiceFactory.is() )
@@ -499,14 +507,12 @@ void XMLSettingsExportHelper::exportForbiddenCharacters(
}
}
-void XMLSettingsExportHelper::exportSettings(
+void XMLSettingsExportHelper::exportAllSettings(
const uno::Sequence<beans::PropertyValue>& aProps,
const rtl::OUString& rName) const
{
DBG_ASSERT(rName.getLength(), "no name");
- ::rtl::OUString aQName =
- rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, rName );
- exportSequencePropertyValue(aProps, aQName);
+ exportSequencePropertyValue(aProps, rName);
}
@@ -534,15 +540,16 @@ void XMLSettingsExportHelper::ManipulateSetting( uno::Any& rAny, const rtl::OUSt
{
if( !mxStringSubsitution.is() )
{
- if( rExport.getServiceFactory().is() ) try
+ if( m_rContext.GetServiceFactory().is() ) try
{
const_cast< XMLSettingsExportHelper* >(this)->mxStringSubsitution =
uno::Reference< util::XStringSubstitution >::query(
- rExport.getServiceFactory()->
+ m_rContext.GetServiceFactory()->
createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ) );
}
catch( uno::Exception& )
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index e96759c3e470..84294a905105 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -56,6 +56,7 @@
#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"
@@ -160,6 +161,72 @@ const XMLServiceMapEntry_Impl aServiceMap[] =
//==============================================================================
+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 >
{
@@ -1103,7 +1170,9 @@ void SvXMLExport::ImplExportSettings()
nSettingsCount != 0,
XML_NAMESPACE_OFFICE, XML_SETTINGS,
sal_True, sal_True );
- XMLSettingsExportHelper aSettingsExportHelper(*this);
+
+ SettingsExportFacade aSettingsExportContext( *this );
+ XMLSettingsExportHelper aSettingsExportHelper( aSettingsExportContext );
for ( ::std::list< SettingsGroup >::const_iterator settings = aSettings.begin();
settings != aSettings.end();
@@ -1114,7 +1183,8 @@ void SvXMLExport::ImplExportSettings()
continue;
OUString sSettingsName( GetXMLToken( settings->eGroupName ) );
- aSettingsExportHelper.exportSettings( settings->aSettings, sSettingsName );
+ OUString sQName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sSettingsName );
+ aSettingsExportHelper.exportAllSettings( settings->aSettings, sQName );
}
}
}