Kaydet (Commit) 313b8b0d authored tarafından Michael Meeks's avatar Michael Meeks

initial DocumentSettingsSerializer interface impl.

üst cbcfda9b
sd sd : filter TRANSLATIONS:translations animations svx sfx2 stoc canvas LIBXSLT:libxslt oox ure test NULL sd sd : filter TRANSLATIONS:translations animations svx sfx2 stoc canvas LIBXSLT:libxslt oox ure test xmloff NULL
sd sd usr1 - all sd_mkout NULL sd sd usr1 - all sd_mkout NULL
sd sd\prj nmake - all sd_prj NULL sd sd\prj nmake - all sd_prj NULL
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "../inc/ViewShell.hxx" #include "../inc/ViewShell.hxx"
#include "../inc/FrameView.hxx" #include "../inc/FrameView.hxx"
#include "Outliner.hxx" #include "Outliner.hxx"
#include <xmloff/settingsstore.hxx>
#include <editeng/editstat.hxx> #include <editeng/editstat.hxx>
#include <svx/unoapi.hxx> #include <svx/unoapi.hxx>
...@@ -78,7 +79,8 @@ using namespace ::com::sun::star::i18n; ...@@ -78,7 +79,8 @@ using namespace ::com::sun::star::i18n;
namespace sd namespace sd
{ {
class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >, class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >,
public comphelper::PropertySetHelper public comphelper::PropertySetHelper,
public DocumentSettingsSerializer
{ {
public: public:
DocumentSettings( SdXImpressDocument* pModel ); DocumentSettings( SdXImpressDocument* pModel );
...@@ -110,6 +112,14 @@ namespace sd ...@@ -110,6 +112,14 @@ namespace sd
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
// DocumentSettingsSerializer cf. xmloff
virtual uno::Sequence<beans::PropertyValue>
filterStreamsFromStorage(const uno::Reference< embed::XStorage > &xStorage,
const uno::Sequence<beans::PropertyValue>& aConfigProps );
virtual uno::Sequence<beans::PropertyValue>
filterStreamsToStorage(const uno::Reference< embed::XStorage > &xStorage,
const uno::Sequence<beans::PropertyValue>& aConfigProps );
protected: protected:
virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
...@@ -279,6 +289,26 @@ void DocumentSettings::AssignURL( XPropertyListType t, const Any* pValue, bool * ...@@ -279,6 +289,26 @@ void DocumentSettings::AssignURL( XPropertyListType t, const Any* pValue, bool *
delete pList; delete pList;
} }
uno::Sequence<beans::PropertyValue>
DocumentSettings::filterStreamsFromStorage(
const uno::Reference< embed::XStorage > &xStorage,
const uno::Sequence<beans::PropertyValue>& aConfigProps )
{
(void) xStorage;
// fprintf( stderr, "filter streams from storage\n" );
return aConfigProps;
}
uno::Sequence<beans::PropertyValue>
DocumentSettings::filterStreamsToStorage(
const uno::Reference< embed::XStorage > &xStorage,
const uno::Sequence<beans::PropertyValue>& aConfigProps )
{
(void) xStorage;
// fprintf( stderr, "filter streams to storage\n" );
return aConfigProps;
}
void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException ) void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
{ {
::SolarMutexGuard aGuard; ::SolarMutexGuard aGuard;
......
...@@ -85,6 +85,7 @@ $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/numehelp.hxx,xmloff/nume ...@@ -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/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/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/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/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/shapeimport.hxx,xmloff/shapeimport.hxx))
$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/styleexp.hxx,xmloff/styleexp.hxx)) $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/styleexp.hxx,xmloff/styleexp.hxx))
......
/* -*- 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: */
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <xmloff/xmlaustp.hxx> #include <xmloff/xmlaustp.hxx>
#include <xmloff/families.hxx> #include <xmloff/families.hxx>
#include <xmloff/styleexp.hxx> #include <xmloff/styleexp.hxx>
#include <xmloff/settingsstore.hxx>
#include "sdpropls.hxx" #include "sdpropls.hxx"
#include <xmloff/xmlexppr.hxx> #include <xmloff/xmlexppr.hxx>
#include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertyState.hpp>
...@@ -2654,6 +2655,10 @@ void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& ...@@ -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 ); Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
if( xProps.is() ) if( xProps.is() )
SvXMLUnitConverter::convertPropertySet( rProps, xProps ); SvXMLUnitConverter::convertPropertySet( rProps, xProps );
DocumentSettingsSerializer *pFilter;
pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
if( pFilter )
rProps = pFilter->filterStreamsToStorage( GetTargetStorage(), rProps );
} }
} }
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <xmloff/xmlexppr.hxx> #include <xmloff/xmlexppr.hxx>
#include "xmloff/xmlerror.hxx" #include "xmloff/xmlerror.hxx"
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <xmloff/settingsstore.hxx>
#include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/style/XStyle.hpp>
#include <xmloff/XMLFontStylesContext.hxx> #include <xmloff/XMLFontStylesContext.hxx>
...@@ -925,6 +926,16 @@ void SdXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<c ...@@ -925,6 +926,16 @@ void SdXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<c
sal_Int32 nCount = aConfigProps.getLength(); sal_Int32 nCount = aConfigProps.getLength();
const beans::PropertyValue* pValues = aConfigProps.getConstArray(); 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-- ) while( nCount-- )
{ {
try try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment