summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2011-09-10 09:36:23 +0100
committerMichael Meeks <michael.meeks@novell.com>2011-09-11 09:27:02 +0200
commit313b8b0db3b68b7938f5cd138c6a226d00a47b67 (patch)
treeb91fd3b443dc6b0d914a032fce96c4d22f6e8cbd /xmloff
parentcbcfda9b2079ea4ef83b2a42828408b5f70f7692 (diff)
initial DocumentSettingsSerializer interface impl.
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/Package_inc.mk1
-rw-r--r--xmloff/inc/xmloff/settingsstore.hxx56
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx5
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx11
4 files changed, 73 insertions, 0 deletions
diff --git a/xmloff/Package_inc.mk b/xmloff/Package_inc.mk
index 3bcdc39367bf..4c62e7e65a63 100644
--- a/xmloff/Package_inc.mk
+++ b/xmloff/Package_inc.mk
@@ -85,6 +85,7 @@ $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/numehelp.hxx,xmloff/nume
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/odffields.hxx,xmloff/odffields.hxx))
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/prhdlfac.hxx,xmloff/prhdlfac.hxx))
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/prstylei.hxx,xmloff/prstylei.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/settingsstore.hxx,xmloff/settingsstore.hxx))
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/shapeexport.hxx,xmloff/shapeexport.hxx))
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/shapeimport.hxx,xmloff/shapeimport.hxx))
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/styleexp.hxx,xmloff/styleexp.hxx))
diff --git a/xmloff/inc/xmloff/settingsstore.hxx b/xmloff/inc/xmloff/settingsstore.hxx
new file mode 100644
index 000000000000..af9ac084d20f
--- /dev/null
+++ b/xmloff/inc/xmloff/settingsstore.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Novell, Inc. <michael.meeks@novell.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+// Simple interface to allow serialization of document settings
+
+#ifndef _XMLOFF_SETTINGS_STORE_HXX
+#define _XMLOFF_SETTINGS_STORE_HXX
+
+#include <vector>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+
+// Scans list of properties for certain URL properties that could refer
+// to internal objects, and initializes from these.
+class DocumentSettingsSerializer {
+public:
+ // Import objects and update properties (eliding URLs)
+ virtual com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
+ filterStreamsFromStorage(
+ const com::sun::star::uno::Reference< com::sun::star::embed::XStorage > &xStorage,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps ) = 0;
+ // Export objects and update properties with relative URLs into this storage
+ virtual com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
+ filterStreamsToStorage(
+ const com::sun::star::uno::Reference< com::sun::star::embed::XStorage > &xStorage,
+ const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps ) = 0;
+};
+
+#endif // _XMLOFF_SETTINGS_STORE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index dc6bc8fe73a6..67a007c88d56 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -64,6 +64,7 @@
#include <xmloff/xmlaustp.hxx>
#include <xmloff/families.hxx>
#include <xmloff/styleexp.hxx>
+#include <xmloff/settingsstore.hxx>
#include "sdpropls.hxx"
#include <xmloff/xmlexppr.hxx>
#include <com/sun/star/beans/XPropertyState.hpp>
@@ -2654,6 +2655,10 @@ void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&
Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
if( xProps.is() )
SvXMLUnitConverter::convertPropertySet( rProps, xProps );
+ DocumentSettingsSerializer *pFilter;
+ pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
+ if( pFilter )
+ rProps = pFilter->filterStreamsToStorage( GetTargetStorage(), rProps );
}
}
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 9da00b9b2eb6..2bc5245c3740 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -50,6 +50,7 @@
#include <xmloff/xmlexppr.hxx>
#include "xmloff/xmlerror.hxx"
#include <tools/debug.hxx>
+#include <xmloff/settingsstore.hxx>
#include <com/sun/star/style/XStyle.hpp>
#include <xmloff/XMLFontStylesContext.hxx>
@@ -925,6 +926,16 @@ void SdXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<c
sal_Int32 nCount = aConfigProps.getLength();
const beans::PropertyValue* pValues = aConfigProps.getConstArray();
+ DocumentSettingsSerializer *pFilter;
+ pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
+ uno::Sequence<beans::PropertyValue> aFiltered;
+ if( pFilter )
+ {
+ aFiltered = pFilter->filterStreamsFromStorage( GetSourceStorage(), aConfigProps );
+ nCount = aFiltered.getLength();
+ pValues = aFiltered.getConstArray();
+ }
+
while( nCount-- )
{
try