summaryrefslogtreecommitdiff
path: root/package/source/zippackage/ZipPackageFolder.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'package/source/zippackage/ZipPackageFolder.cxx')
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx152
1 files changed, 75 insertions, 77 deletions
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index ba83b34910ed..6200cb61d0a1 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -46,23 +46,22 @@
#include <rtl/instance.hxx>
#include <memory>
+using namespace com::sun::star;
using namespace com::sun::star::packages::zip::ZipConstants;
using namespace com::sun::star::packages::zip;
using namespace com::sun::star::container;
using namespace com::sun::star::packages;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
using namespace com::sun::star::io;
using namespace cppu;
-using namespace rtl;
using namespace std;
using namespace ::com::sun::star;
using vos::ORef;
-namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
+namespace { struct lcl_CachedImplId : public rtl::Static< uno::Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
-ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory,
+ZipPackageFolder::ZipPackageFolder ( const uno::Reference< XMultiServiceFactory >& xFactory,
sal_Int32 nFormat,
sal_Bool bAllowRemoveOnInsert )
: m_xFactory( xFactory )
@@ -81,7 +80,7 @@ ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xF
aEntry.nCompressedSize = 0;
aEntry.nSize = 0;
aEntry.nOffset = -1;
- Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
+ uno::Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
if ( !rCachedImplId.getLength() )
rCachedImplId = getImplementationId();
}
@@ -99,7 +98,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
!bHasUnexpected && aCI != aEnd;
aCI++)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( rInfo.bFolder )
@@ -111,7 +110,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
}
else
{
- OUString sOwnPath = aPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ::rtl::OUString sOwnPath = aPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
bHasUnexpected = rInfo.pFolder->LookForUnexpectedODF12Streams( sOwnPath );
}
}
@@ -157,7 +156,7 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair&
aCI != aEnd;
aCI++)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( rInfo.bFolder )
@@ -193,14 +192,14 @@ const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_get
}
// XNameContainer
-void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
if (hasByName(aName))
throw ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
{
- Reference < XUnoTunnel > xRef;
+ uno::Reference < XUnoTunnel > xRef;
aElement >>= xRef;
if ( ( aElement >>= xRef ) )
{
@@ -227,8 +226,8 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any&
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
}
}
-void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( Name );
if ( aIter == maContents.end() )
@@ -236,55 +235,55 @@ void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
maContents.erase( aIter );
}
// XEnumerationAccess
-Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
- throw(RuntimeException)
+uno::Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
+ throw(uno::RuntimeException)
{
- return Reference < XEnumeration> (new ZipPackageFolderEnumeration(maContents));
+ return uno::Reference < XEnumeration> (new ZipPackageFolderEnumeration(maContents));
}
// XElementAccess
-Type SAL_CALL ZipPackageFolder::getElementType( )
- throw(RuntimeException)
+uno::Type SAL_CALL ZipPackageFolder::getElementType( )
+ throw(uno::RuntimeException)
{
- return ::getCppuType ((const Reference< XUnoTunnel > *) 0);
+ return ::getCppuType ((const uno::Reference< XUnoTunnel > *) 0);
}
sal_Bool SAL_CALL ZipPackageFolder::hasElements( )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
return maContents.size() > 0;
}
// XNameAccess
-ContentInfo& ZipPackageFolder::doGetByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+ContentInfo& ZipPackageFolder::doGetByName( const ::rtl::OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( aName );
if ( aIter == maContents.end())
throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return *(*aIter).second;
}
-Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL ZipPackageFolder::getByName( const ::rtl::OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
- return makeAny ( doGetByName ( aName ).xTunnel );
+ return uno::makeAny ( doGetByName ( aName ).xTunnel );
}
-Sequence< OUString > SAL_CALL ZipPackageFolder::getElementNames( )
- throw(RuntimeException)
+uno::Sequence< ::rtl::OUString > SAL_CALL ZipPackageFolder::getElementNames( )
+ throw(uno::RuntimeException)
{
sal_uInt32 i=0, nSize = maContents.size();
- Sequence < OUString > aSequence ( nSize );
+ uno::Sequence < ::rtl::OUString > aSequence ( nSize );
for ( ContentHash::const_iterator aIterator = maContents.begin(), aEnd = maContents.end();
aIterator != aEnd;
++i, ++aIterator)
aSequence[i] = (*aIterator).first;
return aSequence;
}
-sal_Bool SAL_CALL ZipPackageFolder::hasByName( const OUString& aName )
- throw(RuntimeException)
+sal_Bool SAL_CALL ZipPackageFolder::hasByName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
{
return maContents.find ( aName ) != maContents.end ();
}
// XNameReplace
-void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
if ( hasByName( aName ) )
removeByName( aName );
@@ -293,7 +292,7 @@ void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any&
insertByName(aName, aElement);
}
-static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rStream )
+static void ImplSetStoredData( ZipEntry & rEntry, uno::Reference< XInputStream> & rStream )
{
// It's very annoying that we have to do this, but lots of zip packages
// don't allow data descriptors for STORED streams, meaning we have to
@@ -305,20 +304,20 @@ static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rS
rEntry.nCrc = aCRC32.getValue();
}
-void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
- throw(RuntimeException)
+void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >&rEncryptionKey, rtlRandomPool &rRandomPool)
+ throw(uno::RuntimeException)
{
sal_Bool bWritingFailed = sal_False;
ZipPackageFolder *pFolder = NULL;
ZipPackageStream *pStream = NULL;
- const OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
- const OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
- const OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
- const OUString sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
- const OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
- const OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
- const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
- const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const ::rtl::OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
+ const ::rtl::OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
+ const ::rtl::OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
+ const ::rtl::OUString sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
+ const ::rtl::OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
+ const ::rtl::OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
+ const ::rtl::OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
+ const ::rtl::OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
sal_Bool bHaveEncryptionKey = rEncryptionKey.getLength() ? sal_True : sal_False;
@@ -333,8 +332,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
try
{
- vos::ORef < EncryptionData > aEmptyEncr;
- rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
+ rZipOut.putNextEntry( *pTempEntry, NULL, sal_False );
rZipOut.rawCloseEntry();
}
catch ( ZipException& )
@@ -353,10 +351,10 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
aCI != aEnd;
aCI++)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
- Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
+ uno::Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
if ( rInfo.bFolder )
pFolder = rInfo.pFolder;
@@ -365,7 +363,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
if ( rInfo.bFolder )
{
- OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ::rtl::OUString sTempName = rPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
if ( pFolder->GetMediaType().getLength() )
{
@@ -420,7 +418,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
sal_Int32 nOwnStreamOrigSize = bRawStream ? pStream->GetMagicalHackSize() : pStream->getSize();
sal_Bool bUseNonSeekableAccess = sal_False;
- Reference < XInputStream > xStream;
+ uno::Reference < XInputStream > xStream;
if ( !pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
{
// the stream is not a package member, not a raw stream,
@@ -428,7 +426,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
// in this case nonseekable access can be used
xStream = pStream->GetOwnStreamNoWrap();
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ uno::Reference < XSeekable > xSeek ( xStream, uno::UNO_QUERY );
bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
}
@@ -444,7 +442,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
continue;
}
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ uno::Reference < XSeekable > xSeek ( xStream, uno::UNO_QUERY );
try
{
if ( xSeek.is() )
@@ -497,7 +495,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
}
}
}
- catch ( Exception& )
+ catch ( uno::Exception& )
{
VOS_ENSURE( 0, "The stream provided to the package component has problems!" );
bWritingFailed = sal_True;
@@ -508,7 +506,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
{
if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
{
- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
+ uno::Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
sal_Int32 nIterationCount = 1024;
@@ -571,11 +569,11 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
if ( bRawStream )
xStream->skipBytes( pStream->GetMagicalHackPos() );
- rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), sal_False );
+ rZipOut.putNextEntry( *pTempEntry, pStream, sal_False );
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
- Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
+ uno::Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
sal_Int32 nLength;
do
@@ -629,12 +627,12 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
try
{
- rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), bToBeEncrypted);
+ rZipOut.putNextEntry ( *pTempEntry, pStream, bToBeEncrypted);
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
sal_Int32 nLength;
- Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
+ uno::Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
do
{
nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
@@ -703,7 +701,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
}
if( bWritingFailed )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void ZipPackageFolder::releaseUpwardRef( void )
@@ -735,8 +733,8 @@ void ZipPackageFolder::releaseUpwardRef( void )
#endif
}
-sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(uno::RuntimeException)
{
sal_Int64 nMe = 0;
if ( aIdentifier.getLength() == 16 &&
@@ -744,8 +742,8 @@ sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const Sequence< sal_Int8 >& a
nMe = reinterpret_cast < sal_Int64 > ( this );
return nMe;
}
-void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
{
if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType")))
{
@@ -762,8 +760,8 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName,
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
-Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, uno::RuntimeException)
{
if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
{
@@ -771,18 +769,18 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName )
// if ( m_nFormat != embed::StorageFormats::PACKAGE )
// throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- return makeAny ( sMediaType );
+ return uno::makeAny ( sMediaType );
}
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Version" ) ) )
- return makeAny( m_sVersion );
+ return uno::makeAny( m_sVersion );
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
- return makeAny ( aEntry.nSize );
+ return uno::makeAny ( aEntry.nSize );
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
try
{
@@ -799,21 +797,21 @@ void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetPa
if ( bSetParent )
pEntry->setParent ( *this );
}
-OUString ZipPackageFolder::getImplementationName()
- throw (RuntimeException)
+::rtl::OUString ZipPackageFolder::getImplementationName()
+ throw (uno::RuntimeException)
{
- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolder" ) );
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolder" ) );
}
-Sequence< OUString > ZipPackageFolder::getSupportedServiceNames()
- throw (RuntimeException)
+uno::Sequence< ::rtl::OUString > ZipPackageFolder::getSupportedServiceNames()
+ throw (uno::RuntimeException)
{
- Sequence< OUString > aNames(1);
- aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolder" ) );
+ uno::Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolder" ) );
return aNames;
}
-sal_Bool SAL_CALL ZipPackageFolder::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+sal_Bool SAL_CALL ZipPackageFolder::supportsService( ::rtl::OUString const & rServiceName )
+ throw (uno::RuntimeException)
{
return rServiceName == getSupportedServiceNames()[0];
}