summaryrefslogtreecommitdiff
path: root/framework/source/xml/imagesconfiguration.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-07-06 16:03:47 +0000
committerOliver Bolte <obo@openoffice.org>2004-07-06 16:03:47 +0000
commit0446c57cb38232002af2f20ff30d4963c67045d0 (patch)
treee34b687d52291914fb5f3446375d424d673aa4bb /framework/source/xml/imagesconfiguration.cxx
parent3f03cb71c31da316686c7fa67b16888da27376ab (diff)
INTEGRATION: CWS docking1 (1.3.20); FILE MERGED
2004/06/16 13:43:11 cd 1.3.20.1: #i30169# First implementation of an UNO based module image manager
Diffstat (limited to 'framework/source/xml/imagesconfiguration.cxx')
-rw-r--r--framework/source/xml/imagesconfiguration.cxx76
1 files changed, 74 insertions, 2 deletions
diff --git a/framework/source/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx
index 37f8a1e4a8c8..fd8336eaf290 100644
--- a/framework/source/xml/imagesconfiguration.cxx
+++ b/framework/source/xml/imagesconfiguration.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: imagesconfiguration.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: rt $ $Date: 2004-05-03 13:23:14 $
+ * last change: $Author: obo $ $Date: 2004-07-06 17:03:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -225,4 +225,76 @@ sal_Bool ImagesConfiguration::StoreImages(
return sal_False;
}
+sal_Bool ImagesConfiguration::LoadImages(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
+ ImageListsDescriptor& rItems )
+{
+ Reference< XParser > xParser( GetSaxParser( xServiceFactory ) );
+
+ // connect stream to input stream to the parser
+ InputSource aInputSource;
+
+ aInputSource.aInputStream = rInputStream;
+
+ // create namespace filter and set document handler inside to support xml namespaces
+ Reference< XDocumentHandler > xDocHandler( new OReadImagesDocumentHandler( rItems ));
+ Reference< XDocumentHandler > xFilter( new SaxNamespaceFilter( xDocHandler ));
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ try
+ {
+ xParser->parseStream( aInputSource );
+ return sal_True;
+ }
+ catch ( RuntimeException& )
+ {
+ return sal_False;
+ }
+ catch( SAXException& )
+ {
+ return sal_False;
+ }
+ catch( ::com::sun::star::io::IOException& )
+ {
+ return sal_False;
+ }
+
+ return sal_False;
+}
+
+sal_Bool ImagesConfiguration::StoreImages(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream,
+ const ImageListsDescriptor& rItems )
+{
+ Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) );
+
+ Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY );
+ xDataSource->setOutputStream( rOutputStream );
+
+ try
+ {
+ OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xWriter );
+ aWriteImagesDocumentHandler.WriteImagesDocument();
+ return sal_True;
+ }
+ catch ( RuntimeException& )
+ {
+ return sal_False;
+ }
+ catch ( SAXException& )
+ {
+ return sal_False;
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ return sal_False;
+ }
+
+ return sal_False;
+}
+
}