summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-10-13 10:50:37 +0000
committerOliver Bolte <obo@openoffice.org>2006-10-13 10:50:37 +0000
commit3c7feeb3d35200c631e71ae7166cce126a0882f8 (patch)
treec5fc96ec53278108cdd5a536642f8e0b242724e2
parentdf0e9333199e8aed571b0c38f56c5024933c2a0c (diff)
INTEGRATION: CWS opofxmlstorage (1.6.30); FILE MERGED
2006/06/29 15:45:13 mav 1.6.30.2: RESYNC: (1.6-1.7); FILE MERGED 2006/04/21 11:36:59 mav 1.6.30.1: #i64612# support OFOPXML format
-rw-r--r--package/source/xstor/xfactory.cxx36
1 files changed, 28 insertions, 8 deletions
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index e5600e59ef2b..425d36e1b8a5 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: xfactory.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: obo $ $Date: 2006-09-17 17:25:20 $
+ * last change: $Author: obo $ $Date: 2006-10-13 11:50:37 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -120,7 +120,8 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstance()
static_cast< OWeakObject* >( new OStorage( xTempStream,
embed::ElementModes::READWRITE,
uno::Sequence< beans::PropertyValue >(),
- m_xFactory ) ),
+ m_xFactory,
+ PACKAGE_STORAGE ) ),
uno::UNO_QUERY );
}
@@ -151,12 +152,16 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
if( !( aArguments[1] >>= nStorageMode ) )
{
OSL_ENSURE( sal_False, "Wrong second argument!\n" );
- throw uno::Exception(); // TODO: Illegal argument
+ throw lang::IllegalArgumentException(); // TODO:
}
// it's allways possible to read written storage in this implementation
nStorageMode |= embed::ElementModes::READ;
}
+ if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE
+ && ( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE )
+ throw lang::IllegalArgumentException(); // TODO:
+
// retrieve storage source stream
::rtl::OUString aURL;
uno::Reference< io::XStream > xStream;
@@ -167,13 +172,13 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
if ( !aURL.getLength() )
{
OSL_ENSURE( sal_False, "Empty URL is provided!\n" );
- throw uno::Exception(); // TODO: illegal argument
+ throw lang::IllegalArgumentException(); // TODO:
}
if ( aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.pkg", 16 ) )
{
OSL_ENSURE( sal_False, "Packages URL's are not valid for storages!\n" ); // ???
- throw uno::Exception(); // TODO: illegal argument
+ throw lang::IllegalArgumentException(); // TODO:
}
uno::Reference < ::com::sun::star::ucb::XSimpleFileAccess > xTempAccess(
@@ -199,6 +204,8 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
uno::Sequence< beans::PropertyValue > aDescr;
uno::Sequence< beans::PropertyValue > aPropsToSet;
+ sal_Int16 nStorageType = PACKAGE_STORAGE;
+
if ( nArgNum >= 3 )
{
if( aArguments[2] >>= aDescr )
@@ -222,6 +229,19 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
aPropsToSet[nNumArgs-1].Name = aDescr[nInd].Name;
aPropsToSet[nNumArgs-1].Value = aDescr[nInd].Value;
}
+ else if ( aDescr[nInd].Name.equalsAscii( "StorageFormat" ) )
+ {
+ ::rtl::OUString aFormatName;
+ aDescr[nInd].Value >>= aFormatName;
+ if ( aFormatName.equalsAscii( "PackageFormat" ) )
+ nStorageType = PACKAGE_STORAGE;
+ else if ( aFormatName.equalsAscii( "ZipFormat" ) )
+ nStorageType = ZIP_STORAGE;
+ else if ( aFormatName.equalsAscii( "OFOPXMLFormat" ) )
+ nStorageType = OFOPXML_STORAGE;
+ else
+ throw lang::IllegalArgumentException(); // TODO:
+ }
else
OSL_ENSURE( sal_False, "Unacceptable property, will be ignored!\n" );
}
@@ -252,7 +272,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
throw io::IOException(); // TODO: this is not a package file
return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >( new OStorage( xInputStream, nStorageMode, aPropsToSet, m_xFactory ) ),
+ static_cast< OWeakObject* >( new OStorage( xInputStream, nStorageMode, aPropsToSet, m_xFactory, nStorageType ) ),
uno::UNO_QUERY );
}
else if ( xStream.is() )
@@ -272,7 +292,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
throw io::IOException(); // TODO: this is not a package file
return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >( new OStorage( xStream, nStorageMode, aPropsToSet, m_xFactory ) ),
+ static_cast< OWeakObject* >( new OStorage( xStream, nStorageMode, aPropsToSet, m_xFactory, nStorageType ) ),
uno::UNO_QUERY );
}