[Libreoffice-commits] .: sot/inc sot/source
Joseph Powers
jpowers at kemper.freedesktop.org
Tue May 17 19:15:05 PDT 2011
sot/inc/sot/stg.hxx | 25 ++++++++--------
sot/inc/sot/storage.hxx | 4 +-
sot/inc/sot/storinfo.hxx | 14 +++------
sot/source/sdstor/stg.cxx | 10 +++---
sot/source/sdstor/storinfo.cxx | 17 -----------
sot/source/sdstor/ucbstorage.cxx | 2 -
sot/source/sdstor/unostorageholder.cxx | 12 +++----
sot/source/unoolestorage/xolesimplestorage.cxx | 38 ++++++++++++-------------
8 files changed, 52 insertions(+), 70 deletions(-)
New commits:
commit a7b6cb78bc1bd8cdbb09efe6aa2cf3949cc72058
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun May 15 19:48:38 2011 -0700
Change SvStorageInfoList from an OwnList to vector<
The main work is in:
storinfo.hxx
storinfo.cxx
The rest is just simple cleanup.
diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx
index 419f816..e04649c 100644
--- a/sot/inc/sot/stg.hxx
+++ b/sot/inc/sot/stg.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -42,9 +42,11 @@
#include <tools/rtti.hxx>
#include <tools/stream.hxx>
#include <tools/globname.hxx>
+#include "sot/storinfo.hxx"
#include "sot/sotdllapi.h"
#include <list>
+
class UNOStorageHolder;
typedef ::std::list< UNOStorageHolder* > UNOStorageHolderList;
@@ -99,7 +101,6 @@ public:
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0;
};
-class SvStorageInfoList;
class BaseStorage : public StorageBase
{
public:
@@ -307,17 +308,17 @@ public:
static String CreateLinkFile( const String& rName );
UCBStorage( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, sal_Bool bDirect = sal_True, sal_Bool bIsRoot = sal_True );
- UCBStorage( const String& rName,
- StreamMode nMode,
- sal_Bool bDirect = sal_True,
+ UCBStorage( const String& rName,
+ StreamMode nMode,
+ sal_Bool bDirect = sal_True,
sal_Bool bIsRoot = sal_True );
- UCBStorage( const String& rName,
- StreamMode nMode,
- sal_Bool bDirect,
- sal_Bool bIsRoot,
- sal_Bool bIsRepair,
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler >
+ UCBStorage( const String& rName,
+ StreamMode nMode,
+ sal_Bool bDirect,
+ sal_Bool bIsRoot,
+ sal_Bool bIsRepair,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler >
xProgressHandler );
UCBStorage( UCBStorage_Impl* );
@@ -374,7 +375,7 @@ public:
// HACK to avoid incompatible build, can be done since this feature is only for development
// should be removed before release
UNOStorageHolderList* GetUNOStorageHolderList();
-
+
//#if _SOLAR__PRIVATE
UCBStorageElement_Impl* FindElement_Impl( const String& rName ) const;
sal_Bool CopyStorageElement_Impl( UCBStorageElement_Impl& rElement,
diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx
index 140b4fd..e335ef9 100644
--- a/sot/inc/sot/storage.hxx
+++ b/sot/inc/sot/storage.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,6 +38,7 @@
#include <sot/factory.hxx>
#include <tools/stream.hxx>
#include <tools/errcode.hxx>
+#include "sot/storinfo.hxx"
#include "sot/sotdllapi.h"
#define STORAGE_FAILIFTHERE 0x02
@@ -108,7 +109,6 @@ namespace ucbhelper
class Content;
}
-class SvStorageInfoList;
class BaseStorage;
class UNOStorageHolder;
class SOT_DLLPUBLIC SotStorage : virtual public SotObject
diff --git a/sot/inc/sot/storinfo.hxx b/sot/inc/sot/storinfo.hxx
index 200d014..9006233 100644
--- a/sot/inc/sot/storinfo.hxx
+++ b/sot/inc/sot/storinfo.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -31,7 +31,7 @@
#include <tools/pstm.hxx>
#include <tools/globname.hxx>
-#include <tools/ownlist.hxx>
+#include <vector>
#include "sot/sotdllapi.h"
class StgDirEntry;
@@ -40,8 +40,8 @@ class SvStorageInfo
friend class SvStorage;
String aName;
SvGlobalName aClassName;
- sal_uLong nSize;
- sal_Bool bStream:1,
+ sal_uLong nSize;
+ sal_Bool bStream:1,
bStorage:1;
SvStorageInfo(){}; // Fuer SvStorage
@@ -61,11 +61,7 @@ public:
sal_uLong GetSize() const { return nSize; }
};
-class SOT_DLLPUBLIC SvStorageInfoList
-{
- PRV_SV_DECL_OWNER_LIST(SvStorageInfoList,SvStorageInfo)
- const SvStorageInfo * Get( const String & rName );
-};
+typedef ::std::vector< SvStorageInfo > SvStorageInfoList;
SOT_DLLPUBLIC sal_uLong ReadClipboardFormat( SvStream & rStm );
SOT_DLLPUBLIC void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat );
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index c65fcb5..9229fcf 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -437,7 +437,7 @@ Storage::Storage( UCBStorageStream& rStrm, sal_Bool bDirect )
pEntry = NULL;
return;
}
-
+
if( pStream->IsWritable() )
m_nMode = STREAM_READ | STREAM_WRITE;
@@ -549,7 +549,7 @@ void Storage::FillInfoList( SvStorageInfoList* pList ) const
if( !p->bInvalid )
{
SvStorageInfo aInfo( *p );
- pList->Append( aInfo );
+ pList->push_back( aInfo );
}
p = aIter.Next();
}
@@ -806,9 +806,9 @@ sal_Bool Storage::CopyTo( BaseStorage* pDest ) const
SvStorageInfoList aList;
FillInfoList( &aList );
sal_Bool bRes = sal_True;
- for( sal_uInt16 i = 0; i < aList.Count() && bRes; i++ )
+ for( size_t i = 0; i < aList.size() && bRes; i++ )
{
- SvStorageInfo& rInfo = aList.GetObject( i );
+ SvStorageInfo& rInfo = aList[ i ];
bRes = pThis->CopyTo( rInfo.GetName(), pDest, rInfo.GetName() );
}
if( !bRes )
diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx
index 78eb4d5..5f1768b 100644
--- a/sot/source/sdstor/storinfo.cxx
+++ b/sot/source/sdstor/storinfo.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -34,21 +34,6 @@
#include <sot/exchange.hxx>
-/************** class SvStorageInfoList **********************************
-*************************************************************************/
-PRV_SV_IMPL_OWNER_LIST(SvStorageInfoList,SvStorageInfo)
-
-const SvStorageInfo * SvStorageInfoList::Get( const String & rEleName )
-{
- for( sal_uLong i = 0; i < Count(); i++ )
- {
- const SvStorageInfo & rType = GetObject( i );
- if( rType.GetName() == rEleName )
- return &rType;
- }
- return NULL;
-}
-
/************** class SvStorageInfo **************************************
*************************************************************************/
sal_uLong ReadClipboardFormat( SvStream & rStm )
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 8199a5e..198a657 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -2674,7 +2674,7 @@ void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const
if ( pElement->m_xStream.Is() )
nSize = pElement->m_xStream->GetSize();
SvStorageInfo aInfo( pElement->m_aName, nSize, pElement->m_bIsStorage );
- pList->Append( aInfo );
+ pList->push_back( aInfo );
}
}
}
diff --git a/sot/source/sdstor/unostorageholder.cxx b/sot/source/sdstor/unostorageholder.cxx
index 634b246..dbb54e0 100644
--- a/sot/source/sdstor/unostorageholder.cxx
+++ b/sot/source/sdstor/unostorageholder.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +37,7 @@
#include <comphelper/processfactory.hxx>
#include "unostorageholder.hxx"
-#include <sot/storinfo.hxx>
+#include "sot/storinfo.hxx"
using namespace ::com::sun::star;
@@ -127,7 +127,7 @@ void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ )
throw uno::RuntimeException();
m_xStorage->copyToStorage( xTempStorage );
-
+
uno::Reference< lang::XComponent > xComp( xTempStorage, uno::UNO_QUERY );
if ( !xComp.is() )
throw uno::RuntimeException();
@@ -140,7 +140,7 @@ void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ )
SvStorageInfoList aSubStorInfoList;
m_rSotStorage->FillInfoList( &aSubStorInfoList );
- for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.Count(); nInd++ )
+ for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.size(); nInd++ )
{
m_rSotStorage->Remove( aSubStorInfoList[nInd].GetName() );
if ( m_rSotStorage->GetError() )
@@ -157,7 +157,7 @@ void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ )
uno::Any aMediaType;
if ( rTempStorage->GetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType ) )
m_rSotStorage->SetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType );
-
+
m_rSotStorage->Commit();
}
@@ -186,7 +186,7 @@ void SAL_CALL UNOStorageHolder::disposing( const lang::EventObject& /*Source*/ )
if ( m_rSotStorage.Is() )
m_rSotStorage = NULL;
-
+
if ( m_pParentStorage )
{
SotStorage* pTmp = m_pParentStorage;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index c65f716..41b3403 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -72,7 +72,7 @@ OLESimpleStorage::~OLESimpleStorage()
dispose();
} catch( uno::Exception& )
{}
-
+
if ( m_pListenersContainer )
{
delete m_pListenersContainer;
@@ -190,7 +190,7 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::
pStorage->ResetError();
throw io::IOException(); // TODO
}
-
+
try
{
uno::Sequence< ::rtl::OUString > aElements = xNameAccess->getElementNames();
@@ -243,7 +243,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
if ( !( aArguments[1] >>= m_bNoTemporaryCopy ) )
throw lang::IllegalArgumentException(); // TODO:
}
-
+
if ( m_bNoTemporaryCopy )
{
// TODO: ???
@@ -266,14 +266,14 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
}
else
{
- uno::Reference < io::XStream > xTempFile(
+ uno::Reference < io::XStream > xTempFile(
m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile")) ),
uno::UNO_QUERY_THROW );
uno::Reference < io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOut = xTempFile->getOutputStream();
if ( !xTempOut.is() )
throw uno::RuntimeException();
-
+
if ( xInputStream.is() )
{
try
@@ -295,7 +295,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
// not sure that the storage flashes the stream on commit
m_xStream = xStream;
m_xTempStream = xTempFile;
-
+
uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW );
xSeek->seek( 0 );
uno::Reference< io::XInputStream > xInpStream = xStream->getInputStream();
@@ -305,7 +305,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
::comphelper::OStorageHelper::CopyInputToOutput( xInpStream, xTempOut );
xTempOut->flush();
xTempSeek->seek( 0 );
-
+
m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False );
}
else
@@ -364,7 +364,7 @@ void SAL_CALL OLESimpleStorage::insertByName( const ::rtl::OUString& aName, cons
throw;
}
catch( container::ElementExistException& )
- {
+ {
throw;
}
catch( uno::Exception& e )
@@ -391,7 +391,7 @@ void SAL_CALL OLESimpleStorage::removeByName( const ::rtl::OUString& aName )
if ( !m_bNoTemporaryCopy && !m_xStream.is() )
throw lang::WrappedTargetException(); // io::IOException(); // TODO
-
+
if ( !m_pStorage->IsContained( aName ) )
throw container::NoSuchElementException(); // TODO:
@@ -464,7 +464,7 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const ::rtl::OUString& aName )
{
BaseStorage* pStrg = m_pStorage->OpenStorage( aName );
m_pStorage->ResetError();
- if ( !pStrg )
+ if ( !pStrg )
throw io::IOException();
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False ); // do not close the original stream
@@ -481,7 +481,7 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const ::rtl::OUString& aName )
if ( !bSuccess )
throw uno::RuntimeException();
-
+
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] <<= xInputStream; // allow readonly access only
aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
@@ -556,7 +556,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::getElementNames()
if ( !m_pStorage )
throw uno::RuntimeException();
-
+
SvStorageInfoList aList;
m_pStorage->FillInfoList( &aList );
@@ -566,8 +566,8 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::getElementNames()
throw uno::RuntimeException(); // TODO:
}
- uno::Sequence< ::rtl::OUString > aSeq( aList.Count() );
- for ( sal_uInt32 nInd = 0; nInd < aList.Count(); nInd++ )
+ uno::Sequence< ::rtl::OUString > aSeq( aList.size() );
+ for ( sal_uInt32 nInd = 0; nInd < aList.size(); nInd++ )
aSeq[nInd] = aList[nInd].GetName();
return aSeq;
@@ -629,7 +629,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasElements()
throw uno::RuntimeException(); // TODO:
}
- return ( aList.Count() != 0 );
+ return ( aList.size() != 0 );
}
//____________________________________________________________________________________________________
@@ -710,7 +710,7 @@ void SAL_CALL OLESimpleStorage::commit()
if ( !m_bNoTemporaryCopy && !m_xStream.is() )
throw io::IOException(); // TODO
-
+
if ( !m_pStorage->Commit() || m_pStorage->GetError() )
{
m_pStorage->ResetError();
@@ -736,13 +736,13 @@ void SAL_CALL OLESimpleStorage::revert()
if ( !m_bNoTemporaryCopy && !m_xStream.is() )
throw io::IOException(); // TODO
-
+
if ( !m_pStorage->Revert() || m_pStorage->GetError() )
{
m_pStorage->ResetError();
throw io::IOException(); // TODO
}
-
+
UpdateOriginal_Impl();
}
More information about the Libreoffice-commits
mailing list