summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-07-03 15:54:21 -0500
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-04 09:58:22 +0000
commit7c136e7ba27382d5f73454bdf5fa78d0b779e0b7 (patch)
tree2d200cc67d4442e7f87b119905de9b5c522be619 /sot
parente2f002c044243ddd79eea7837167a72c82b98599 (diff)
module sot: String, bool and other clean-up
Change-Id: Ibe2bfdf20c500e9fd98c3baef66d36aa79ca4b52 Reviewed-on: https://gerrit.libreoffice.org/4710 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sot')
-rw-r--r--sot/qa/cppunit/test_sot.cxx4
-rw-r--r--sot/source/base/exchange.cxx59
-rw-r--r--sot/source/base/factory.cxx13
-rw-r--r--sot/source/base/filelist.cxx24
-rw-r--r--sot/source/base/formats.cxx12
-rw-r--r--sot/source/base/object.cxx25
-rw-r--r--sot/source/sdstor/stg.cxx279
-rw-r--r--sot/source/sdstor/stgavl.cxx43
-rw-r--r--sot/source/sdstor/stgavl.hxx8
-rw-r--r--sot/source/sdstor/stgcache.cxx46
-rw-r--r--sot/source/sdstor/stgcache.hxx31
-rw-r--r--sot/source/sdstor/stgdir.cxx9
-rw-r--r--sot/source/sdstor/stgdir.hxx14
-rw-r--r--sot/source/sdstor/stgelem.cxx81
-rw-r--r--sot/source/sdstor/stgelem.hxx70
-rw-r--r--sot/source/sdstor/stgio.cxx42
-rw-r--r--sot/source/sdstor/stgio.hxx13
-rw-r--r--sot/source/sdstor/stgole.cxx43
-rw-r--r--sot/source/sdstor/stgole.hxx26
-rw-r--r--sot/source/sdstor/stgstrms.hxx2
-rw-r--r--sot/source/sdstor/storage.cxx440
-rw-r--r--sot/source/sdstor/storinfo.cxx10
-rw-r--r--sot/source/sdstor/ucbstorage.cxx713
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx38
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.hxx4
25 files changed, 956 insertions, 1093 deletions
diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index c88bcacb7842..66f1d5ede2e6 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -27,7 +27,7 @@ namespace
SotTest() {}
bool checkStream( const SotStorageRef &xObjStor,
- const String &rStreamName,
+ const OUString &rStreamName,
sal_uLong nSize );
bool checkStorage( const SotStorageRef &xObjStor );
@@ -43,7 +43,7 @@ namespace
};
bool SotTest::checkStream( const SotStorageRef &xObjStor,
- const String &rStreamName,
+ const OUString &rStreamName,
sal_uLong nSize )
{
unsigned char *pData = (unsigned char*)malloc( nSize );
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 8aba2381776e..5b13c741d20d 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -21,7 +21,6 @@
#include <tools/debug.hxx>
#include <tools/solar.h>
#include <tools/globname.hxx>
-#include <tools/string.hxx>
#include <sot/sotdata.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
@@ -229,13 +228,13 @@ static tDataFlavorList& InitFormats_Impl()
|*
|* Beschreibung CLIP.SDW
*************************************************************************/
-sal_uLong SotExchange::RegisterFormatName( const String& rName )
+sal_uLong SotExchange::RegisterFormatName( const OUString& rName )
{
const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
// teste zuerst die Standard - Name
sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
for( i = SOT_FORMAT_STRING; i <= nMax; ++i )
- if( COMPARE_EQUAL == rName.CompareToAscii( pFormatArray_Impl[ i ].pName ) )
+ if( rName.equalsAscii( pFormatArray_Impl[ i ].pName ) )
return i;
// BM: the chart format 105 ("StarChartDocument 5.0") was written
@@ -243,7 +242,7 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName )
// The registry only contains the entry for the 42 format id.
nMax = SOT_FORMATSTR_ID_USER_END;
for( i = SOT_FORMAT_RTF; i <= nMax; ++i )
- if( rName.EqualsAscii( pFormatArray_Impl[ i ].pName ) )
+ if( rName.equalsAscii( pFormatArray_Impl[ i ].pName ) )
return ( (i == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50)
? SOT_FORMATSTR_ID_STARCHART_50
: i );
@@ -253,7 +252,7 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName )
for( i = 0, nMax = rL.size(); i < nMax; i++ )
{
DataFlavor* pFlavor = rL[ i ];
- if( pFlavor && rName == String( pFlavor->HumanPresentableName ) )
+ if( pFlavor && rName == OUString( pFlavor->HumanPresentableName ) )
return i + SOT_FORMATSTR_ID_USER_END + 1;
}
@@ -269,18 +268,18 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName )
return nMax + SOT_FORMATSTR_ID_USER_END + 1;
}
-sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType )
+sal_uLong SotExchange::RegisterFormatMimeType( const OUString& rMimeType )
{
const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
// teste zuerst die Standard - Name
sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
for( i = SOT_FORMAT_STRING; i <= nMax; ++i )
- if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
+ if( rMimeType.equalsAscii( pFormatArray_Impl[ i ].pMimeType ) )
return i;
nMax = SOT_FORMATSTR_ID_USER_END;
for( i = SOT_FORMAT_RTF; i <= nMax; ++i )
- if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
+ if( rMimeType.equalsAscii( pFormatArray_Impl[ i ].pMimeType ) )
return i;
// dann in der dynamischen Liste
@@ -288,7 +287,7 @@ sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType )
for( i = 0, nMax = rL.size(); i < nMax; i++ )
{
DataFlavor* pFlavor = rL[ i ];
- if( pFlavor && rMimeType == String( pFlavor->MimeType ) )
+ if( pFlavor && rMimeType == OUString( pFlavor->MimeType ) )
return i + SOT_FORMATSTR_ID_USER_END + 1;
}
@@ -330,9 +329,9 @@ sal_uLong SotExchange::RegisterFormat( const DataFlavor& rFlavor )
|*
*************************************************************************/
-sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavor )
+bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavor )
{
- sal_Bool bRet;
+ bool bRet;
if( SOT_FORMATSTR_ID_USER_END >= nFormat )
{
@@ -341,7 +340,7 @@ sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavo
rFlavor.HumanPresentableName = OUString::createFromAscii( rData.pName );
rFlavor.DataType = *rData.pType;
- bRet = sal_True;
+ bRet = true;
}
else
{
@@ -352,12 +351,12 @@ sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavo
if( rL.size() > nFormat )
{
rFlavor = *rL[ nFormat ];
- bRet = sal_True;
+ bRet = true;
}
else
{
rFlavor = DataFlavor();
- bRet = sal_False;
+ bRet = false;
}
}
@@ -372,11 +371,11 @@ sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavo
|*
*************************************************************************/
-String SotExchange::GetFormatMimeType( sal_uLong nFormat )
+OUString SotExchange::GetFormatMimeType( sal_uLong nFormat )
{
- String sMimeType;
+ OUString sMimeType;
if( SOT_FORMATSTR_ID_USER_END >= nFormat )
- sMimeType.AssignAscii( FormatArray_Impl::get()[nFormat].pMimeType );
+ sMimeType = OUString::createFromAscii( FormatArray_Impl::get()[nFormat].pMimeType );
else
{
tDataFlavorList& rL = InitFormats_Impl();
@@ -398,12 +397,12 @@ String SotExchange::GetFormatMimeType( sal_uLong nFormat )
|*
*************************************************************************/
-sal_uLong SotExchange::GetFormatIdFromMimeType( const String& rMimeType )
+sal_uLong SotExchange::GetFormatIdFromMimeType( const OUString& rMimeType )
{
const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
for( i = SOT_FORMAT_STRING; i <= nMax; ++i )
- if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
+ if( rMimeType.equalsAscii( pFormatArray_Impl[ i ].pMimeType ) )
return i;
// BM: the chart format 105 ("StarChartDocument 5.0") was written
@@ -411,18 +410,18 @@ sal_uLong SotExchange::GetFormatIdFromMimeType( const String& rMimeType )
// The registry only contains the entry for the 42 format id.
nMax = SOT_FORMATSTR_ID_USER_END;
for( i = SOT_FORMAT_RTF; i <= nMax; ++i )
- if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
+ if( rMimeType.equalsAscii( pFormatArray_Impl[ i ].pMimeType ) )
return ( (i == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50)
? SOT_FORMATSTR_ID_STARCHART_50
: i );
// dann in der dynamischen Liste
tDataFlavorList& rL = InitFormats_Impl();
- OUString aMimeType( rMimeType );
+
for( i = 0, nMax = rL.size(); i < nMax; i++ )
{
DataFlavor* pFlavor = rL[ i ];
- if( pFlavor && aMimeType == pFlavor->MimeType )
+ if( pFlavor && rMimeType == pFlavor->MimeType )
return i + SOT_FORMATSTR_ID_USER_END + 1;
}
@@ -439,11 +438,11 @@ sal_uLong SotExchange::GetFormat( const DataFlavor& rFlavor )
{
// teste zuerst die Standard - Name
const OUString& rMimeType = rFlavor.MimeType;
- const String aMimeType( rMimeType );
+
sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
for( i = SOT_FORMAT_STRING; i <= nMax; ++i )
- if( aMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
+ if( rMimeType.equalsAscii( pFormatArray_Impl[ i ].pMimeType ) )
return i;
// BM: the chart format 105 ("StarChartDocument 5.0") was written
@@ -451,7 +450,7 @@ sal_uLong SotExchange::GetFormat( const DataFlavor& rFlavor )
// The registry only contains the entry for the 42 format id.
nMax = SOT_FORMATSTR_ID_USER_END;
for( i = SOT_FORMAT_RTF; i <= nMax; ++i )
- if( aMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
+ if( rMimeType.equalsAscii( pFormatArray_Impl[ i ].pMimeType ) )
return ( (i == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50)
? SOT_FORMATSTR_ID_STARCHART_50
: i );
@@ -474,10 +473,10 @@ sal_uLong SotExchange::GetFormat( const DataFlavor& rFlavor )
|*
|* Beschreibung CLIP.SDW
*************************************************************************/
-String SotExchange::GetFormatName( sal_uLong nFormat )
+OUString SotExchange::GetFormatName( sal_uLong nFormat )
{
DataFlavor aFlavor;
- String aRet;
+ OUString aRet;
if( GetFormatDataFlavor( nFormat, aFlavor ) )
aRet = aFlavor.HumanPresentableName;
@@ -485,7 +484,7 @@ String SotExchange::GetFormatName( sal_uLong nFormat )
return aRet;
}
-sal_Bool SotExchange::IsInternal( const SvGlobalName& rName )
+bool SotExchange::IsInternal( const SvGlobalName& rName )
{
if ( rName == SvGlobalName(SO3_SW_CLASSID_60) ||
rName == SvGlobalName(SO3_SC_CLASSID_60) ||
@@ -495,8 +494,8 @@ sal_Bool SotExchange::IsInternal( const SvGlobalName& rName )
rName == SvGlobalName(SO3_SM_CLASSID_60) ||
rName == SvGlobalName(SO3_SWWEB_CLASSID_60) ||
rName == SvGlobalName(SO3_SWGLOB_CLASSID_60) )
- return sal_True;
- return sal_False;
+ return true;
+ return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx
index 6aa6cd03dae5..0cd94cd97439 100644
--- a/sot/source/base/factory.cxx
+++ b/sot/source/base/factory.cxx
@@ -19,7 +19,6 @@
#include <sot/factory.hxx>
#include <tools/debug.hxx>
-#include <tools/string.hxx>
#include <sot/object.hxx>
#include <sot/sotdata.hxx>
#include <comphelper/classids.hxx>
@@ -76,8 +75,8 @@ SotData_Impl * SOTDATA()
TYPEINIT0(SotFactory);
SotFactory::SotFactory( const SvGlobalName & rName,
- const String & rClassName,
- CreateInstanceType pCreateFuncP )
+ const OUString & rClassName,
+ CreateInstanceType pCreateFuncP )
: SvGlobalName ( rName )
, nSuperCount ( 0 )
, pSuperClasses ( NULL )
@@ -200,17 +199,17 @@ void * SotFactory::CreateInstance( SotObject ** ppObj ) const
|*
|* Beschreibung
*************************************************************************/
-sal_Bool SotFactory::Is( const SotFactory * pSuperCl ) const
+bool SotFactory::Is( const SotFactory * pSuperCl ) const
{
if( this == pSuperCl )
- return sal_True;
+ return true;
for( sal_uInt16 i = 0; i < nSuperCount; i++ )
{
if( pSuperClasses[ i ]->Is( pSuperCl ) )
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index d9f85d509e75..da4cd9f446a1 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.cxx
@@ -17,12 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
+#include <rtl/ustrbuf.hxx>
#include <tools/stream.hxx>
-#include <tools/string.hxx>
#include <tools/rtti.hxx>
#include <sot/exchange.hxx>
-#include<sot/filelist.hxx>
+#include <sot/filelist.hxx>
#include <osl/thread.h>
TYPEINIT1_AUTOFACTORY( FileList, SvDataCopyStream );
@@ -54,7 +53,7 @@ void FileList::ClearAll( void )
FileList& FileList::operator=( const FileList& rFileList )
{
for ( size_t i = 0, n = rFileList.aStrList.size(); i < n; ++i )
- aStrList.push_back( new String( *rFileList.aStrList[ i ] ) );
+ aStrList.push_back( new OUString( *rFileList.aStrList[ i ] ) );
return *this;
}
@@ -106,13 +105,11 @@ SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
{
rFileList.ClearAll();
- String aStr;
+ OUStringBuffer sBuf(512);
sal_uInt16 c;
while (!rIStm.IsEof())
{
- aStr.Erase();
-
// read first character of filepath; c==0 > reach end of stream
rIStm >> c;
if (!c)
@@ -121,12 +118,13 @@ SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
// read string till c==0
while (c && !rIStm.IsEof())
{
- aStr += (sal_Unicode)c;
+ sBuf.append((sal_Unicode)c);
rIStm >> c;
}
// append the filepath
- rFileList.AppendFile(aStr);
+ rFileList.AppendFile(sBuf.toString());
+ sBuf.truncate();
}
return rIStm;
}
@@ -137,14 +135,14 @@ SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
|*
\******************************************************************************/
-void FileList::AppendFile( const String& rStr )
+void FileList::AppendFile( const OUString& rStr )
{
- aStrList.push_back( new String( rStr ) );
+ aStrList.push_back( new OUString( rStr ) );
}
-String FileList::GetFile( size_t i ) const
+OUString FileList::GetFile( size_t i ) const
{
- String aStr;
+ OUString aStr;
if( i < aStrList.size() )
aStr = *aStrList[ i ];
return aStr;
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index f4d473f93114..7f7d1016fd1c 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -1256,17 +1256,17 @@ static SotDestinationEntry_Impl const aDestinationArray[] = \
// - new style GetExchange methods -
// ---------------------------------
-sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, sal_uLong nId )
+bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, sal_uLong nId )
{
DataFlavorExVector::iterator aIter( ( (DataFlavorExVector&) rDataFlavorExVector ).begin() );
DataFlavorExVector::iterator aEnd( ( (DataFlavorExVector&) rDataFlavorExVector ).end() );
- sal_Bool bRet = sal_False;
+ bool bRet = false;
while( aIter != aEnd )
{
if( nId == (*aIter++).mnSotId )
{
- bRet = sal_True;
+ bRet = true;
aIter = aEnd;
}
}
@@ -1276,10 +1276,10 @@ sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, sal_u
// -----------------------------------------------------------------------------
-static sal_Bool CheckTransferableContext_Impl( const Reference< XTransferable >* pxTransferable, const SotAction_Impl& rEntry )
+static bool CheckTransferableContext_Impl( const Reference< XTransferable >* pxTransferable, const SotAction_Impl& rEntry )
{
DataFlavor aFlavor;
- sal_Bool bRet = sal_True;
+ bool bRet = true;
try
{
@@ -1292,7 +1292,7 @@ static sal_Bool CheckTransferableContext_Impl( const Reference< XTransferable >*
{
case FILEGRPDSC_ONLY_URL:
{
- bRet = sal_False;
+ bRet = false;
if( SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_FILECONTENT, aFlavor ) &&
(*pxTransferable)->isDataFlavorSupported( aFlavor ) &&
diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx
index 5c49251a4128..cd14c740d6a7 100644
--- a/sot/source/base/object.cxx
+++ b/sot/source/base/object.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/string.hxx>
#include <sot/object.hxx>
#include <sot/factory.hxx>
@@ -27,8 +26,8 @@ class SotObjectFactory : public SotFactory
public:
TYPEINFO();
SotObjectFactory( const SvGlobalName & rName,
- const String & rClassName,
- CreateInstanceType pCreateFuncP )
+ const OUString & rClassName,
+ CreateInstanceType pCreateFuncP )
: SotFactory( rName, rClassName, pCreateFuncP )
{}
};
@@ -46,9 +45,9 @@ SO2_IMPL_BASIC_CLASS_DLL(SotObject,SotObjectFactory,
*************************************************************************/
SotObject::SotObject()
: nOwnerLockCount( 0 )
- , bOwner ( sal_True )
- , bSVObject ( sal_False )
- , bInClose ( sal_False )
+ , bOwner ( true )
+ , bSVObject ( false )
+ , bInClose ( false )
{
SotFactory::IncSvObjectCount( this );
}
@@ -76,7 +75,7 @@ IUnknown * SotObject::GetInterface( const SvGlobalName & )
//=========================================================================
void SotObject::OwnerLock
(
- sal_Bool bLock /* sal_True, lock. sal_False, unlock. */
+ bool bLock /* true, lock. false, unlock. */
)
/* [Beschreibung]
@@ -100,23 +99,23 @@ void SotObject::OwnerLock
}
//=========================================================================
-sal_Bool SotObject::DoClose()
+bool SotObject::DoClose()
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
if( !bInClose )
{
SotObjectRef xHoldAlive( this );
- bInClose = sal_True;
+ bInClose = true;
bRet = Close();
- bInClose = sal_False;
+ bInClose = false;
}
return bRet;
}
//=========================================================================
-sal_Bool SotObject::Close()
+bool SotObject::Close()
{
- return sal_True;
+ return true;
}
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 635272acdd6f..4606aa1743d3 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -21,7 +21,6 @@
#include <sot/storinfo.hxx>
#include <osl/file.hxx>
#include <tools/tempfile.hxx>
-#include <tools/string.hxx>
#include <tools/stream.hxx>
#include <tools/debug.hxx>
@@ -49,7 +48,7 @@ TYPEINIT1( BaseStorageStream, StorageBase );
TYPEINIT1( BaseStorage, StorageBase );
StorageBase::StorageBase()
- : m_bAutoCommit( sal_False )
+ : m_bAutoCommit( false )
{
m_nMode = STREAM_READ;
m_nError = SVSTREAM_OK;
@@ -122,21 +121,21 @@ OLEStorageBase::~OLEStorageBase()
// Validate the instance for I/O
-sal_Bool OLEStorageBase::Validate_Impl( sal_Bool bWrite ) const
+bool OLEStorageBase::Validate_Impl( bool bWrite ) const
{
if( pIo
&& pIo->pTOC
&& pEntry
&& !pEntry->bInvalid
&& ( !bWrite || !pEntry->bDirect || ( nStreamMode & STREAM_WRITE ) ) )
- return sal_True;
- return sal_False;
+ return true;
+ return false;
}
-sal_Bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const
+bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const
{
if( m == INTERNAL_MODE )
- return sal_True;
+ return true;
sal_uInt16 nCurMode = ( p && p->nRefCnt ) ? p->nMode : 0xFFFF;
if( ( m & 3 ) == STREAM_READ )
{
@@ -145,7 +144,7 @@ sal_Bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const
&& ( nCurMode & STREAM_SHARE_DENYWRITE ) )
|| ( ( m & STREAM_SHARE_DENYALL )
&& ( nCurMode & STREAM_SHARE_DENYALL ) ) )
- return sal_True;
+ return true;
}
else
{
@@ -154,9 +153,9 @@ sal_Bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p ) const
// the commit may fail
if( ( m & STREAM_SHARE_DENYALL )
&& ( nCurMode & STREAM_SHARE_DENYALL ) )
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
@@ -190,7 +189,7 @@ StorageStream::~StorageStream()
pEntry->Commit();
}
-sal_Bool StorageStream::Equals( const BaseStorageStream& rStream ) const
+bool StorageStream::Equals( const BaseStorageStream& rStream ) const
{
const StorageStream* pOther = PTR_CAST( StorageStream, &rStream );
return pOther && ( pOther->pEntry == pEntry );
@@ -212,7 +211,7 @@ sal_uLong StorageStream::Read( void* pData, sal_uLong nSize )
sal_uLong StorageStream::Write( const void* pData, sal_uLong nSize )
{
- if( Validate( sal_True ) )
+ if( Validate( true ) )
{
pEntry->Seek( nPos );
nSize = pEntry->Write( pData, (sal_Int32) nSize );
@@ -238,16 +237,16 @@ void StorageStream::Flush()
Commit();
}
-sal_Bool StorageStream::SetSize( sal_uLong nNewSize )
+bool StorageStream::SetSize( sal_uLong nNewSize )
{
- if( Validate( sal_True ) )
+ if( Validate( true ) )
{
- sal_Bool b = pEntry->SetSize( (sal_Int32) nNewSize );
+ bool b = pEntry->SetSize( (sal_Int32) nNewSize );
pIo->MoveError( *this );
return b;
}
else
- return sal_False;
+ return false;
}
sal_uLong StorageStream::GetSize() const
@@ -257,14 +256,14 @@ sal_uLong StorageStream::GetSize() const
return 0;
}
-sal_Bool StorageStream::Commit()
+bool StorageStream::Commit()
{
if( !Validate() )
- return sal_False;
+ return false;
if( !( m_nMode & STREAM_WRITE ) )
{
SetError( SVSTREAM_ACCESS_DENIED );
- return sal_False;
+ return false;
}
else
{
@@ -274,9 +273,9 @@ sal_Bool StorageStream::Commit()
}
}
-sal_Bool StorageStream::Revert()
+bool StorageStream::Revert()
{
- sal_Bool bResult = sal_False;
+ bool bResult = false;
if ( Validate() )
{
@@ -288,15 +287,15 @@ sal_Bool StorageStream::Revert()
return bResult;
}
-sal_Bool StorageStream::CopyTo( BaseStorageStream* pDest )
+bool StorageStream::CopyTo( BaseStorageStream* pDest )
{
- if( !Validate() || !pDest || !pDest->Validate( sal_True ) || Equals( *pDest ) )
- return sal_False;
+ if( !Validate() || !pDest || !pDest->Validate( true ) || Equals( *pDest ) )
+ return false;
pEntry->Copy( *pDest );
pDest->Commit();
pIo->MoveError( *this );
SetError( pDest->GetError() );
- return sal_Bool( Good() && pDest->Good() );
+ return Good() && pDest->Good();
}
const SvStream* StorageStream::GetSvStream() const
@@ -304,17 +303,17 @@ const SvStream* StorageStream::GetSvStream() const
return GetSvStream_Impl();
}
-sal_Bool StorageStream::Validate( sal_Bool bValidate ) const
+bool StorageStream::Validate( bool bValidate ) const
{
- sal_Bool bRet = Validate_Impl( bValidate );
+ bool bRet = Validate_Impl( bValidate );
if ( !bRet )
SetError( SVSTREAM_ACCESS_DENIED );
return bRet;
}
-sal_Bool StorageStream::ValidateMode( StreamMode nMode ) const
+bool StorageStream::ValidateMode( StreamMode nMode ) const
{
- sal_Bool bRet = ValidateMode_Impl( nMode, NULL );
+ bool bRet = ValidateMode_Impl( nMode, NULL );
if ( !bRet )
SetError( SVSTREAM_ACCESS_DENIED );
return bRet;
@@ -325,24 +324,24 @@ sal_Bool StorageStream::ValidateMode( StreamMode nMode ) const
SvStorageInfo::SvStorageInfo( const StgDirEntry& rE )
{
rE.aEntry.GetName( aName );
- bStorage = sal_Bool( rE.aEntry.GetType() == STG_STORAGE );
- bStream = sal_Bool( rE.aEntry.GetType() == STG_STREAM );
+ bStorage = rE.aEntry.GetType() == STG_STORAGE;
+ bStream = rE.aEntry.GetType() == STG_STREAM;
nSize = bStorage ? 0 : rE.aEntry.GetSize();
}
/////////////////////////// class Storage ////////////////////////////////
-sal_Bool Storage::IsStorageFile( const String & rFileName )
+bool Storage::IsStorageFile( const OUString & rFileName )
{
StgIo aIo;
if( aIo.Open( rFileName, STREAM_STD_READ ) )
return aIo.Load();
- return sal_False;
+ return false;
}
-sal_Bool Storage::IsStorageFile( SvStream* pStream )
+bool Storage::IsStorageFile( SvStream* pStream )
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
if ( pStream )
{
@@ -364,21 +363,22 @@ sal_Bool Storage::IsStorageFile( SvStream* pStream )
TYPEINIT1( Storage, BaseStorage );
-Storage::Storage( const String& rFile, StreamMode m, sal_Bool bDirect )
- : OLEStorageBase( new StgIo, NULL, m_nMode ), aName( rFile ), bIsRoot( sal_False )
+Storage::Storage( const OUString& rFile, StreamMode m, bool bDirect )
+ : OLEStorageBase( new StgIo, NULL, m_nMode )
+ , aName( rFile ), bIsRoot( false )
{
- sal_Bool bTemp = sal_False;
- if( !aName.Len() )
+ bool bTemp = false;
+ if( aName.isEmpty() )
{
// no name = temporary name!
aName = TempFile::CreateTempName();
- bTemp = sal_True;
+ bTemp = true;
}
// the root storage creates the I/O system
m_nMode = m;
if( pIo->Open( aName, m ) )
{
- Init( sal_Bool( ( m & ( STREAM_TRUNC | STREAM_NOCREATE ) ) == STREAM_TRUNC ) );
+ Init( ( m & ( STREAM_TRUNC | STREAM_NOCREATE ) ) == STREAM_TRUNC );
if( pEntry )
{
pEntry->bDirect = bDirect;
@@ -395,19 +395,20 @@ Storage::Storage( const String& rFile, StreamMode m, sal_Bool bDirect )
// Create a storage on a given stream.
-Storage::Storage( SvStream& r, sal_Bool bDirect )
- : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( sal_False )
+Storage::Storage( SvStream& r, bool bDirect )
+ : OLEStorageBase( new StgIo, NULL, m_nMode )
+ , bIsRoot( false )
{
m_nMode = STREAM_READ;
if( r.IsWritable() )
m_nMode = STREAM_READ | STREAM_WRITE;
if( r.GetError() == SVSTREAM_OK )
{
- pIo->SetStrm( &r, sal_False );
+ pIo->SetStrm( &r, false );
sal_uLong nSize = r.Seek( STREAM_SEEK_TO_END );
r.Seek( 0L );
// Initializing is OK if the stream is empty
- Init( sal_Bool( nSize == 0 ) );
+ Init( nSize == 0 );
if( pEntry )
{
pEntry->bDirect = bDirect;
@@ -423,8 +424,8 @@ Storage::Storage( SvStream& r, sal_Bool bDirect )
}
-Storage::Storage( UCBStorageStream& rStrm, sal_Bool bDirect )
- : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( sal_False )
+Storage::Storage( UCBStorageStream& rStrm, bool bDirect )
+ : OLEStorageBase( new StgIo, NULL, m_nMode ), bIsRoot( false )
{
m_nMode = STREAM_READ;
@@ -452,7 +453,7 @@ Storage::Storage( UCBStorageStream& rStrm, sal_Bool bDirect )
sal_uLong nSize = pStream->Seek( STREAM_SEEK_TO_END );
pStream->Seek( 0L );
// Initializing is OK if the stream is empty
- Init( sal_Bool( nSize == 0 ) );
+ Init( nSize == 0 );
if( pEntry )
{
pEntry->bDirect = bDirect;
@@ -465,11 +466,11 @@ Storage::Storage( UCBStorageStream& rStrm, sal_Bool bDirect )
// Perform common code for both ctors above.
-void Storage::Init( sal_Bool bCreate )
+void Storage::Init( bool bCreate )
{
pEntry = NULL;
- sal_Bool bHdrLoaded = sal_False;
- bIsRoot = sal_True;
+ bool bHdrLoaded = false;
+ bIsRoot = true;
OSL_ENSURE( pIo, "The pointer may not be empty at this point!" );
if( pIo->Good() && pIo->GetStrm() )
@@ -503,7 +504,7 @@ void Storage::Init( sal_Bool bCreate )
// Internal ctor
Storage::Storage( StgIo* p, StgDirEntry* q, StreamMode m )
- : OLEStorageBase( p, q, m_nMode ), bIsRoot( sal_False )
+ : OLEStorageBase( p, q, m_nMode ), bIsRoot( false )
{
if( q )
q->aEntry.GetName( aName );
@@ -537,7 +538,7 @@ Storage::~Storage()
}
}
-const String& Storage::GetName() const
+const OUString& Storage::GetName() const
{
if( !bIsRoot && Validate() )
pEntry->aEntry.GetName( ((Storage*) this)->aName );
@@ -566,18 +567,18 @@ void Storage::FillInfoList( SvStorageInfoList* pList ) const
// Open or create a substorage
-BaseStorage* Storage::OpenUCBStorage( const String& rName, StreamMode m, sal_Bool bDirect )
+BaseStorage* Storage::OpenUCBStorage( const OUString& rName, StreamMode m, bool bDirect )
{
OSL_FAIL("Not supported!");
return OpenStorage( rName, m, bDirect );
}
-BaseStorage* Storage::OpenOLEStorage( const String& rName, StreamMode m, sal_Bool bDirect )
+BaseStorage* Storage::OpenOLEStorage( const OUString& rName, StreamMode m, bool bDirect )
{
return OpenStorage( rName, m, bDirect );
}
-BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, bool bDirect )
+BaseStorage* Storage::OpenStorage( const OUString& rName, StreamMode m, bool bDirect )
{
if( !Validate() || !ValidateMode( m ) )
return new Storage( pIo, NULL, m );
@@ -589,14 +590,13 @@ BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, bool bDire
{
if( !( m & STREAM_NOCREATE ) )
{
- sal_Bool bTemp = sal_False;
+ bool bTemp = false;
// create a new storage
- String aNewName = rName;
- if( !aNewName.Len() )
+ OUString aNewName = rName;
+ if( aNewName.isEmpty() )
{
- aNewName.AssignAscii( "Temp Stg " );
- aNewName.Append( OUString::number( ++nTmpCount ) );
- bTemp = sal_True;
+ aNewName = OUString( "Temp Stg " ) + OUString::number( ++nTmpCount );
+ bTemp = true;
}
p = pIo->pTOC->Create( *pEntry, aNewName, STG_STORAGE );
if( p )
@@ -626,16 +626,16 @@ BaseStorage* Storage::OpenStorage( const String& rName, StreamMode m, bool bDire
}
Storage* pStg = new Storage( pIo, p, m );
pIo->MoveError( *pStg );
- if( m & STREAM_WRITE ) pStg->m_bAutoCommit = sal_True;
+ if( m & STREAM_WRITE ) pStg->m_bAutoCommit = true;
return pStg;
}
// Open a stream
-BaseStorageStream* Storage::OpenStream( const String& rName, StreamMode m, sal_Bool,
-const OString*
+BaseStorageStream* Storage::OpenStream( const OUString& rName, StreamMode m, bool,
+ const OString*
#ifdef DBG_UTIL
-pB
+ pB
#endif
)
{
@@ -644,19 +644,18 @@ pB
if( !Validate() || !ValidateMode( m ) )
return new StorageStream( pIo, NULL, m );
StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
- sal_Bool bTemp = sal_False;
+ bool bTemp = false;
if( !p )
{
if( !( m & STREAM_NOCREATE ) )
{
// create a new stream
// make a name if the stream is temporary (has no name)
- String aNewName( rName );
- if( !aNewName.Len() )
+ OUString aNewName( rName );
+ if( aNewName.isEmpty() )
{
- aNewName.AssignAscii( "Temp Strm " );
- aNewName.Append( OUString::number( ++nTmpCount ) );
- bTemp = sal_True;
+ aNewName = OUString( "Temp Strm " ) + OUString::number( ++nTmpCount );
+ bTemp = true;
}
p = pIo->pTOC->Create( *pEntry, aNewName, STG_STREAM );
}
@@ -678,50 +677,50 @@ pB
}
StorageStream* pStm = new StorageStream( pIo, p, m );
if( p && !p->bDirect )
- pStm->SetAutoCommit( sal_True );
+ pStm->SetAutoCommit( true );
pIo->MoveError( *pStm );
return pStm;
}
// Delete a stream or substorage by setting the temp bit.
-sal_Bool Storage::Remove( const String& rName )
+bool Storage::Remove( const OUString& rName )
{
- if( !Validate( sal_True ) )
- return sal_False;
+ if( !Validate( true ) )
+ return false;
StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
if( p )
{
- p->Invalidate( sal_True );
- return sal_True;
+ p->Invalidate( true );
+ return true;
}
else
{
SetError( SVSTREAM_FILE_NOT_FOUND );
- return sal_False;
+ return false;
}
}
// Rename a storage element
-sal_Bool Storage::Rename( const String& rOld, const String& rNew )
+bool Storage::Rename( const OUString& rOld, const OUString& rNew )
{
- if( Validate( sal_True ) )
+ if( Validate( true ) )
{
- sal_Bool b = pIo->pTOC->Rename( *pEntry, rOld, rNew );
+ bool b = pIo->pTOC->Rename( *pEntry, rOld, rNew );
pIo->MoveError( *this );
return b;
}
else
- return sal_False;
+ return false;
}
// Copy one element
-sal_Bool Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String& rNew )
+bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString& rNew )
{
- if( !Validate() || !pDest || !pDest->Validate( sal_True ) )
- return sal_False;
+ if( !Validate() || !pDest || !pDest->Validate( true ) )
+ return false;
StgDirEntry* pElem = pIo->pTOC->Find( *pEntry, rElem );
if( pElem )
{
@@ -752,7 +751,7 @@ sal_Bool Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String&
delete p1;
delete p2;
- return sal_Bool( Good() && pDest->Good() );
+ return Good() && pDest->Good();
}
else
{
@@ -780,26 +779,26 @@ sal_Bool Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String&
delete p1;
delete p2;
- return sal_Bool( Good() && pDest->Good() );
+ return Good() && pDest->Good();
}
}
SetError( SVSTREAM_FILE_NOT_FOUND );
- return sal_False;
+ return false;
}
-sal_Bool Storage::CopyTo( BaseStorage* pDest ) const
+bool Storage::CopyTo( BaseStorage* pDest ) const
{
- if( !Validate() || !pDest || !pDest->Validate( sal_True ) || Equals( *pDest ) )
+ if( !Validate() || !pDest || !pDest->Validate( true ) || Equals( *pDest ) )
{
SetError( SVSTREAM_ACCESS_DENIED );
- return sal_False;
+ return false;
}
Storage* pThis = (Storage*) this;
pDest->SetClassId( GetClassId() );
pDest->SetDirty();
SvStorageInfoList aList;
FillInfoList( &aList );
- sal_Bool bRes = sal_True;
+ bool bRes = true;
for( size_t i = 0; i < aList.size() && bRes; i++ )
{
SvStorageInfo& rInfo = aList[ i ];
@@ -807,24 +806,24 @@ sal_Bool Storage::CopyTo( BaseStorage* pDest ) const
}
if( !bRes )
SetError( pDest->GetError() );
- return sal_Bool( Good() && pDest->Good() );
+ return Good() && pDest->Good();
}
// Move one element
-sal_Bool Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String& rNew )
+bool Storage::MoveTo( const OUString& rElem, BaseStorage* pODest, const OUString& rNew )
{
- if( !Validate() || !pODest || !pODest->Validate( sal_True ) || Equals( *pODest ) )
+ if( !Validate() || !pODest || !pODest->Validate( true ) || Equals( *pODest ) )
{
SetError( SVSTREAM_ACCESS_DENIED );
- return sal_False;
+ return false;
}
StgDirEntry* pElem = pIo->pTOC->Find( *pEntry, rElem );
if( pElem )
{
// Simplest case: both storages share the same file
- sal_Bool bRes;
+ bool bRes;
Storage *pOther = PTR_CAST( Storage, pODest );
if( pOther && pIo == pOther->pIo && rElem == rNew )
{
@@ -835,7 +834,7 @@ sal_Bool Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String
{
// cyclic move
SetError( SVSTREAM_ACCESS_DENIED );
- return sal_False;
+ return false;
}
bRes = pIo->pTOC->Move( *pEntry, *pDest->pEntry, rNew );
if( !bRes )
@@ -860,51 +859,51 @@ sal_Bool Storage::MoveTo( const String& rElem, BaseStorage* pODest, const String
return bRes;
}
SetError( SVSTREAM_FILE_NOT_FOUND );
- return sal_False;
+ return false;
}
-sal_Bool Storage::IsStorage( const String& rName ) const
+bool Storage::IsStorage( const OUString& rName ) const
{
if( Validate() )
{
StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
if( p )
- return sal_Bool( p->aEntry.GetType() == STG_STORAGE );
+ return p->aEntry.GetType() == STG_STORAGE;
}
- return sal_False;
+ return false;
}
-sal_Bool Storage::IsStream( const String& rName ) const
+bool Storage::IsStream( const OUString& rName ) const
{
if( Validate() )
{
StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
if( p )
- return sal_Bool( p->aEntry.GetType() == STG_STREAM );
+ return p->aEntry.GetType() == STG_STREAM;
}
- return sal_False;
+ return false;
}
-sal_Bool Storage::IsContained( const String& rName ) const
+bool Storage::IsContained( const OUString& rName ) const
{
if( Validate() )
- return sal_Bool( pIo->pTOC->Find( *pEntry, rName ) != NULL );
+ return pIo->pTOC->Find( *pEntry, rName ) != NULL;
else
- return sal_False;
+ return false;
}
// Commit all sub-elements within this storage. If this is
// the root, commit the FAT, the TOC and the header as well.
-sal_Bool Storage::Commit()
+bool Storage::Commit()
{
- sal_Bool bRes = sal_True;
+ bool bRes = true;
if( !Validate() )
- return sal_False;
+ return false;
if( !( m_nMode & STREAM_WRITE ) )
{
SetError( SVSTREAM_ACCESS_DENIED );
- return sal_False;
+ return false;
}
else
{
@@ -923,9 +922,9 @@ sal_Bool Storage::Commit()
return bRes;
}
-sal_Bool Storage::Revert()
+bool Storage::Revert()
{
- return sal_True;
+ return true;
}
///////////////////////////// OLE Support ////////////////////////////////
@@ -933,16 +932,16 @@ sal_Bool Storage::Revert()
// Set the storage type
void Storage::SetClass( const SvGlobalName & rClass,
- sal_uLong nOriginalClipFormat,
- const String & rUserTypeName )
+ sal_uLong nOriginalClipFormat,
+ const OUString & rUserTypeName )
{
- if( Validate( sal_True ) )
+ if( Validate( true ) )
{
// set the class name in the root entry
pEntry->aEntry.SetClassId( (const ClsId&) rClass.GetCLSID() );
pEntry->SetDirty();
// then create the streams
- StgCompObjStream aCompObj( *this, sal_True );
+ StgCompObjStream aCompObj( *this, true );
aCompObj.GetClsId() = (const ClsId&) rClass.GetCLSID();
aCompObj.GetCbFormat() = nOriginalClipFormat;
aCompObj.GetUserName() = rUserTypeName;
@@ -960,14 +959,14 @@ void Storage::SetClass( const SvGlobalName & rClass,
}
void Storage::SetConvertClass( const SvGlobalName & rConvertClass,
- sal_uLong nOriginalClipFormat,
- const String & rUserTypeName )
+ sal_uLong nOriginalClipFormat,
+ const OUString & rUserTypeName )
{
- if( Validate( sal_True ) )
+ if( Validate( true ) )
{
SetClass( rConvertClass, nOriginalClipFormat, rUserTypeName );
// plus the convert flag:
- StgOleStream aOle( *this, sal_True );
+ StgOleStream aOle( *this, true );
aOle.GetFlags() |= 4;
if( !aOle.Store() )
SetError( aOle.GetError() );
@@ -976,7 +975,7 @@ void Storage::SetConvertClass( const SvGlobalName & rConvertClass,
SvGlobalName Storage::GetClassName()
{
- StgCompObjStream aCompObj( *this, sal_False );
+ StgCompObjStream aCompObj( *this, false );
if( aCompObj.Load() )
return SvGlobalName( (const CLSID&) aCompObj.GetClsId() );
pIo->ResetError();
@@ -989,35 +988,35 @@ SvGlobalName Storage::GetClassName()
sal_uLong Storage::GetFormat()
{
- StgCompObjStream aCompObj( *this, sal_False );
+ StgCompObjStream aCompObj( *this, false );
if( aCompObj.Load() )
return aCompObj.GetCbFormat();
pIo->ResetError();
return 0;
}
-String Storage::GetUserName()
+OUString Storage::GetUserName()
{
- StgCompObjStream aCompObj( *this, sal_False );
+ StgCompObjStream aCompObj( *this, false );
if( aCompObj.Load() )
return aCompObj.GetUserName();
pIo->ResetError();
- return String();
+ return OUString();
}
-sal_Bool Storage::ShouldConvert()
+bool Storage::ShouldConvert()
{
- StgOleStream aOle( *this, sal_False );
+ StgOleStream aOle( *this, false );
if( aOle.Load() )
- return sal_Bool( ( aOle.GetFlags() & 4 ) != 0 );
+ return ( aOle.GetFlags() & 4 ) != 0;
else
{
pIo->ResetError();
- return sal_False;
+ return false;
}
}
-sal_Bool Storage::ValidateFAT()
+bool Storage::ValidateFAT()
{
Link aLink = StgIo::GetErrorLink();
ErrCode nErr = pIo->ValidateFATs();
@@ -1051,31 +1050,31 @@ const SvStream* Storage::GetSvStream() const
return GetSvStream_Impl();
}
-sal_Bool Storage::Validate( sal_Bool bValidate ) const
+bool Storage::Validate( bool bValidate ) const
{
- sal_Bool bRet = Validate_Impl( bValidate );
+ bool bRet = Validate_Impl( bValidate );
if ( !bRet )
SetError( SVSTREAM_ACCESS_DENIED );
return bRet;
}
-sal_Bool Storage::ValidateMode( StreamMode nMode ) const
+bool Storage::ValidateMode( StreamMode nMode ) const
{
- sal_Bool bRet = ValidateMode_Impl( nMode );
+ bool bRet = ValidateMode_Impl( nMode );
if ( !bRet )
SetError( SVSTREAM_ACCESS_DENIED );
return bRet;
}
-sal_Bool Storage::ValidateMode( StreamMode nMode, StgDirEntry* p ) const
+bool Storage::ValidateMode( StreamMode nMode, StgDirEntry* p ) const
{
- sal_Bool bRet = ValidateMode_Impl( nMode, p );
+ bool bRet = ValidateMode_Impl( nMode, p );
if ( !bRet )
SetError( SVSTREAM_ACCESS_DENIED );
return bRet;
}
-sal_Bool Storage::Equals( const BaseStorage& rStorage ) const
+bool Storage::Equals( const BaseStorage& rStorage ) const
{
const Storage* pOther = PTR_CAST( Storage, &rStorage );
return pOther && ( pOther->pEntry == pEntry );
diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx
index eb43a7a60791..807f023d6f19 100644
--- a/sot/source/sdstor/stgavl.cxx
+++ b/sot/source/sdstor/stgavl.cxx
@@ -214,7 +214,7 @@ StgAvlNode* StgAvlNode::RotRL()
// Remove a tree element. Return the removed element or NULL.
-StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, sal_Bool bPtrs )
+StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, bool bPtrs )
{
if( p && *p && pDel )
{
@@ -278,24 +278,24 @@ void StgAvlNode::StgEnum( short& n )
}
// Add node to AVL tree.
-// Return sal_False if the element already exists.
+// Return false if the element already exists.
-sal_Bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns )
+bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns )
{
StgAvlNode* pPivot, *pHeavy, *pNewRoot, *pParent, *pPrev;
if ( !pRoot )
- return sal_False;
+ return false;
// special case - empty tree
if( *pRoot == NULL )
{
*pRoot = pIns;
- return sal_True;
+ return true;
}
// find insertion point and return if already present
short nRes = (*pRoot)->Locate( pIns, &pPivot, &pParent, &pPrev );
if( !nRes )
- return sal_False;
+ return false;
OSL_ENSURE( pPivot && pPrev, "The pointers may not be NULL!" );
// add new node
@@ -327,22 +327,22 @@ sal_Bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns )
else if( pPivot == pParent->pRight )
pParent->pRight = pNewRoot;
}
- return sal_True;
+ return true;
}
-// Remove node from tree. Returns sal_True is found and removed.
+// Remove node from tree. Returns true is found and removed.
// Actually delete if bDel
-sal_Bool StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, sal_Bool bDel )
+bool StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, bool bDel )
{
if ( !pRoot )
- return sal_False;
+ return false;
// special case - empty tree
if( *pRoot == NULL )
- return sal_False;
+ return false;
// delete the element
- pDel = Rem( pRoot, pDel, sal_False );
+ pDel = Rem( pRoot, pDel, false );
if( pDel )
{
if( bDel )
@@ -352,33 +352,32 @@ sal_Bool StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, sal_Bool bDel
/* StgAvlNode* pNew = NULL;
while( *pRoot )
{
- StgAvlNode* p = Rem( pRoot, *pRoot, sal_False );
+ StgAvlNode* p = Rem( pRoot, *pRoot, false );
Insert( &pNew, p );
}
*pRoot = pNew;*/
- return sal_True;
+ return true;
}
else
- return sal_False;
+ return false;
}
-// Move node to a different tree. Returns sal_True is found and moved. This routine
+// Move node to a different tree. Returns true is found and moved. This routine
// may be called when the key has changed.
-sal_Bool StgAvlNode::Move
- ( StgAvlNode** pRoot1, StgAvlNode** pRoot2, StgAvlNode* pMove )
+bool StgAvlNode::Move( StgAvlNode** pRoot1, StgAvlNode** pRoot2, StgAvlNode* pMove )
{
if ( !pRoot1 )
- return sal_False;
+ return false;
// special case - empty tree
if( *pRoot1 == NULL )
- return sal_False;
- pMove = Rem( pRoot1, pMove, sal_False );
+ return false;
+ pMove = Rem( pRoot1, pMove, false );
if( pMove )
return Insert( pRoot2, pMove );
else
- return sal_False;
+ return false;
}
////////////////////////// class AvlIterator /////////////////////////
diff --git a/sot/source/sdstor/stgavl.hxx b/sot/source/sdstor/stgavl.hxx
index 0926542d4d57..31d1c0f2f049 100644
--- a/sot/source/sdstor/stgavl.hxx
+++ b/sot/source/sdstor/stgavl.hxx
@@ -36,7 +36,7 @@ private:
StgAvlNode* RotRR();
StgAvlNode* RotRL();
void StgEnum( short& );
- static StgAvlNode* Rem( StgAvlNode**, StgAvlNode*, sal_Bool );
+ static StgAvlNode* Rem( StgAvlNode**, StgAvlNode*, bool );
protected:
short nId; // iterator ID
short nBalance; // indicates tree balance
@@ -45,9 +45,9 @@ protected:
public:
virtual ~StgAvlNode();
StgAvlNode* Find( StgAvlNode* );
- static sal_Bool Insert( StgAvlNode**, StgAvlNode* );
- static sal_Bool Remove( StgAvlNode**, StgAvlNode*, sal_Bool bDel = sal_True );
- static sal_Bool Move( StgAvlNode**, StgAvlNode**, StgAvlNode* );
+ static bool Insert( StgAvlNode**, StgAvlNode* );
+ static bool Remove( StgAvlNode**, StgAvlNode*, bool bDel = true );
+ static bool Move( StgAvlNode**, StgAvlNode**, StgAvlNode* );
virtual short Compare( const StgAvlNode* ) const = 0;
};
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 0a2371c02ccf..02f8e38ac358 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -19,7 +19,7 @@
#include <string.h>
#include <osl/endian.h>
-#include <tools/string.hxx>
+#include <tools/solar.h>
#include "sot/stg.hxx"
#include "stgelem.hxx"
@@ -96,15 +96,15 @@ StgCache::StgCache()
, nPageSize( 512 )
, pStorageStream( NULL )
, pStrm( NULL )
- , bMyStream( sal_False )
- , bFile( sal_False )
+ , bMyStream( false )
+ , bFile( false )
{
}
StgCache::~StgCache()
{
Clear();
- SetStrm( NULL, sal_False );
+ SetStrm( NULL, false );
}
void StgCache::SetPhysPageSize( short n )
@@ -168,7 +168,7 @@ rtl::Reference< StgPage > StgCache::Find( sal_Int32 nPage )
// Load a page into the cache
-rtl::Reference< StgPage > StgCache::Get( sal_Int32 nPage, sal_Bool bForce )
+rtl::Reference< StgPage > StgCache::Get( sal_Int32 nPage, bool bForce )
{
rtl::Reference< StgPage > p = Find( nPage );
if( !p.is() )
@@ -196,7 +196,7 @@ rtl::Reference< StgPage > StgCache::Copy( sal_Int32 nNew, sal_Int32 nOld )
if( nOld >= 0 )
{
// old page: we must have this data!
- rtl::Reference< StgPage > q = Get( nOld, sal_True );
+ rtl::Reference< StgPage > q = Get( nOld, true );
if( q.is() )
{
OSL_ENSURE( p->GetSize() == q->GetSize(), "Unexpected page size!" );
@@ -210,7 +210,7 @@ rtl::Reference< StgPage > StgCache::Copy( sal_Int32 nNew, sal_Int32 nOld )
// Historically this wrote pages in a sorted, ascending order;
// continue that tradition.
-sal_Bool StgCache::Commit()
+bool StgCache::Commit()
{
if ( Good() ) // otherwise Write does nothing
{
@@ -225,7 +225,7 @@ sal_Bool StgCache::Commit()
{
const rtl::Reference< StgPage > &pPage = *aWr;
if ( !Write( pPage->GetPage(), pPage->GetData(), 1 ) )
- return sal_False;
+ return false;
}
}
@@ -234,12 +234,12 @@ sal_Bool StgCache::Commit()
pStrm->Flush();
SetError( pStrm->GetError() );
- return sal_True;
+ return true;
}
// Set a stream
-void StgCache::SetStrm( SvStream* p, sal_Bool bMy )
+void StgCache::SetStrm( SvStream* p, bool bMy )
{
if( pStorageStream )
{
@@ -270,7 +270,7 @@ void StgCache::SetStrm( UCBStorageStream* pStgStream )
pStrm = pStorageStream->GetModifySvStream();
}
- bMyStream = sal_False;
+ bMyStream = false;
}
void StgCache::SetDirty( const rtl::Reference< StgPage > &xPage )
@@ -281,20 +281,20 @@ void StgCache::SetDirty( const rtl::Reference< StgPage > &xPage )
// Open/close the disk file
-sal_Bool StgCache::Open( const String& rName, StreamMode nMode )
+bool StgCache::Open( const OUString& rName, StreamMode nMode )
{
// do not open in exclusive mode!
if( nMode & STREAM_SHARE_DENYALL )
nMode = ( ( nMode & ~STREAM_SHARE_DENYALL ) | STREAM_SHARE_DENYWRITE );
SvFileStream* pFileStrm = new SvFileStream( rName, nMode );
// SvStream "Feature" Write Open auch erfolgreich, wenns nicht klappt
- sal_Bool bAccessDenied = sal_False;
+ bool bAccessDenied = false;
if( ( nMode & STREAM_WRITE ) && !pFileStrm->IsWritable() )
{
pFileStrm->Close();
- bAccessDenied = sal_True;
+ bAccessDenied = true;
}
- SetStrm( pFileStrm, sal_True );
+ SetStrm( pFileStrm, true );
if( pFileStrm->IsOpen() )
{
sal_uLong nFileSize = pStrm->Seek( STREAM_SEEK_TO_END );
@@ -303,7 +303,7 @@ sal_Bool StgCache::Open( const String& rName, StreamMode nMode )
}
else
nPages = 0;
- bFile = sal_True;
+ bFile = true;
SetError( bAccessDenied ? ERRCODE_IO_ACCESSDENIED : pStrm->GetError() );
return Good();
}
@@ -319,7 +319,7 @@ void StgCache::Close()
// low level I/O
-sal_Bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
+bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
{
if( Good() )
{
@@ -344,7 +344,7 @@ sal_Bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
{
if( pStrm->Seek( nPos ) != nPos ) {
#ifdef CHECK_DIRTY
- ErrorBox( NULL, WB_OK, String("SO2: Seek failed") ).Execute();
+ ErrorBox( NULL, WB_OK, OUString("SO2: Seek failed") ).Execute();
#endif
}
}
@@ -358,7 +358,7 @@ sal_Bool StgCache::Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
return Good();
}
-sal_Bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
+bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
{
if( Good() )
{
@@ -375,7 +375,7 @@ sal_Bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
{
if( pStrm->Seek( nPos ) != nPos ) {
#ifdef CHECK_DIRTY
- ErrorBox( NULL, WB_OK, String("SO2: Seek failed") ).Execute();
+ ErrorBox( NULL, WB_OK, OUString("SO2: Seek failed") ).Execute();
#endif
}
}
@@ -388,12 +388,12 @@ sal_Bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
sal_uInt8 cBuf[ 512 ];
pStrm->Flush();
pStrm->Seek( nPos );
- sal_Bool bRes = ( pStrm->Read( cBuf, 512 ) == 512 );
+ bool bRes = ( pStrm->Read( cBuf, 512 ) == 512 );
if( bRes )
bRes = !memcmp( cBuf, pBuf, 512 );
if( !bRes )
{
- ErrorBox( NULL, WB_OK, String("SO2: Read after Write failed") ).Execute();
+ ErrorBox( NULL, WB_OK, OUString("SO2: Read after Write failed") ).Execute();
pStrm->SetError( SVSTREAM_WRITE_ERROR );
}
#endif
@@ -403,7 +403,7 @@ sal_Bool StgCache::Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPg )
// set the file size in pages
-sal_Bool StgCache::SetSize( sal_Int32 n )
+bool StgCache::SetSize( sal_Int32 n )
{
// Add the file header
sal_Int32 nSize = n * nPageSize + 512;
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index e134e2576258..b7fea66b919c 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -33,7 +33,8 @@ class StgPage;
class StgDirEntry;
class StorageBase;
-class StgCache {
+class StgCache
+{
typedef boost::unordered_map
<
sal_Int32, rtl::Reference< StgPage >,
@@ -55,8 +56,8 @@ class StgCache {
rtl::Reference< StgPage > Create( sal_Int32 ); // create a cached page
protected:
SvStream* pStrm; // physical stream
- sal_Bool bMyStream; // sal_True: delete stream in dtor
- sal_Bool bFile; // sal_True: file stream
+ bool bMyStream; // true: delete stream in dtor
+ bool bFile; // true: file stream
sal_Int32 Page2Pos( sal_Int32 ); // page address --> file position
public:
StgCache();
@@ -67,30 +68,30 @@ public:
sal_Int32 GetPhysPages() { return nPages; }
short GetPhysPageSize() { return nPageSize; }
SvStream* GetStrm() { return pStrm; }
- void SetStrm( SvStream*, sal_Bool );
+ void SetStrm( SvStream*, bool );
void SetStrm( UCBStorageStream* );
- sal_Bool IsWritable() { return ( pStrm && pStrm->IsWritable() ); }
- sal_Bool Good() { return sal_Bool( nError == SVSTREAM_OK ); }
- sal_Bool Bad() { return sal_Bool( nError != SVSTREAM_OK ); }
+ bool IsWritable() { return ( pStrm && pStrm->IsWritable() ); }
+ bool Good() { return nError == SVSTREAM_OK; }
+ bool Bad() { return nError != SVSTREAM_OK; }
sal_uLong GetError() { return nError; }
void MoveError( StorageBase& );
void SetError( sal_uLong );
void ResetError();
- sal_Bool Open( const String& rName, StreamMode );
+ bool Open( const OUString& rName, StreamMode );
void Close();
- sal_Bool Read ( sal_Int32 nPage, void* pBuf, sal_Int32 nPages );
- sal_Bool Write ( sal_Int32 nPage, void* pBuf, sal_Int32 nPages );
+ bool Read( sal_Int32 nPage, void* pBuf, sal_Int32 nPages );
+ bool Write( sal_Int32 nPage, void* pBuf, sal_Int32 nPages );
// two routines for accessing FAT pages
// Assume that the data is a FAT page and get/put FAT data.
- void SetToPage ( const rtl::Reference< StgPage > xPage, short nOff, sal_Int32 nVal );
+ void SetToPage ( const rtl::Reference< StgPage > xPage, short nOff, sal_Int32 nVal );
inline sal_Int32 GetFromPage ( const rtl::Reference< StgPage > xPage, short nOff );
- void SetDirty ( const rtl::Reference< StgPage > &xPage );
- sal_Bool SetSize( sal_Int32 nPages );
+ void SetDirty ( const rtl::Reference< StgPage > &xPage );
+ bool SetSize( sal_Int32 nPages );
rtl::Reference< StgPage > Find( sal_Int32 ); // find a cached page
- rtl::Reference< StgPage > Get( sal_Int32, sal_Bool ); // get a cached page
+ rtl::Reference< StgPage > Get( sal_Int32, bool ); // get a cached page
rtl::Reference< StgPage > Copy( sal_Int32, sal_Int32=STG_FREE ); // copy a page
- sal_Bool Commit(); // flush all pages
+ bool Commit(); // flush all pages
void Clear(); // clear the cache
};
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index e79e8f0a880e..e9860b980a78 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -977,7 +977,7 @@ void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty )
// Find a dir entry.
-StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const String& rName )
+StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const OUString& rName )
{
if( rStg.pDown )
{
@@ -998,8 +998,7 @@ StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const String& rName )
// Create a new entry.
-StgDirEntry* StgDirStrm::Create
- ( StgDirEntry& rStg, const String& rName, StgEntryType eType )
+StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEntryType eType )
{
StgEntry aEntry;
aEntry.Init();
@@ -1044,7 +1043,7 @@ StgDirEntry* StgDirStrm::Create
// Rename the given entry.
-bool StgDirStrm::Rename( StgDirEntry& rStg, const String& rOld, const String& rNew )
+bool StgDirStrm::Rename( StgDirEntry& rStg, const OUString& rOld, const OUString& rNew )
{
StgDirEntry* p = Find( rStg, rOld );
if( p )
@@ -1067,7 +1066,7 @@ bool StgDirStrm::Rename( StgDirEntry& rStg, const String& rOld, const String& rN
// Move the given entry to a different storage.
-bool StgDirStrm::Move( StgDirEntry& rStg1, StgDirEntry& rStg2, const String& rName )
+bool StgDirStrm::Move( StgDirEntry& rStg1, StgDirEntry& rStg2, const OUString& rName )
{
StgDirEntry* p = Find( rStg1, rName );
if( p )
diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
index d2196d33be45..f0ff40d4d355 100644
--- a/sot/source/sdstor/stgdir.hxx
+++ b/sot/source/sdstor/stgdir.hxx
@@ -41,8 +41,8 @@ class StgDirEntry : public StgAvlNode
StgStrm* pStgStrm; // storage stream
StgTmpStrm* pTmpStrm; // temporary stream
StgTmpStrm* pCurStrm; // temp stream after commit
- sal_Int32 nEntry; // entry # in TOC stream (temp)
- sal_Int32 nPos; // current position
+ sal_Int32 nEntry; // entry # in TOC stream (temp)
+ sal_Int32 nPos; // current position
bool bDirty; // dirty directory entry
bool bCreated; // newly created entry
bool bRemoved; // removed per Invalidate()
@@ -103,11 +103,11 @@ public:
bool Store();
void* GetEntry( sal_Int32 n, bool=false );// get an entry
StgDirEntry* GetRoot() { return pRoot; }
- StgDirEntry* Find( StgDirEntry&, const String& );
- StgDirEntry* Create( StgDirEntry&, const String&, StgEntryType );
- bool Remove( StgDirEntry&, const String& );
- bool Rename( StgDirEntry&, const String&, const String& );
- bool Move( StgDirEntry&, StgDirEntry&, const String& );
+ StgDirEntry* Find( StgDirEntry&, const OUString& );
+ StgDirEntry* Create( StgDirEntry&, const OUString&, StgEntryType );
+ bool Remove( StgDirEntry&, const OUString& );
+ bool Rename( StgDirEntry&, const OUString&, const OUString& );
+ bool Move( StgDirEntry&, StgDirEntry&, const OUString& );
};
class StgIterator : public StgAvlIterator
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index e34f0689f588..37013ac20be8 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -114,9 +114,9 @@ void StgHeader::Init()
SetFATPage( i, STG_FREE );
}
-sal_Bool StgHeader::Load( StgIo& rIo )
+bool StgHeader::Load( StgIo& rIo )
{
- sal_Bool bResult = sal_False;
+ bool bResult = false;
if ( rIo.GetStrm() )
{
SvStream& r = *rIo.GetStrm();
@@ -127,7 +127,7 @@ sal_Bool StgHeader::Load( StgIo& rIo )
return bResult;
}
-sal_Bool StgHeader::Load( SvStream& r )
+bool StgHeader::Load( SvStream& r )
{
r.Seek( 0L );
r.Read( cSignature, 8 );
@@ -148,13 +148,14 @@ sal_Bool StgHeader::Load( SvStream& r )
for( short i = 0; i < cFATPagesInHeader; i++ )
r >> nMasterFAT[ i ];
- return ( r.GetErrorCode() == ERRCODE_NONE && Check() );
+ return (r.GetErrorCode() == ERRCODE_NONE) && Check();
}
-sal_Bool StgHeader::Store( StgIo& rIo )
+bool StgHeader::Store( StgIo& rIo )
{
if( !bDirty )
- return sal_True;
+ return true;
+
SvStream& r = *rIo.GetStrm();
r.Seek( 0L );
r.Write( cSignature, 8 );
@@ -175,7 +176,7 @@ sal_Bool StgHeader::Store( StgIo& rIo )
for( short i = 0; i < cFATPagesInHeader; i++ )
r << nMasterFAT[ i ];
bDirty = !rIo.Good();
- return sal_Bool( !bDirty );
+ return !bDirty;
}
static bool lcl_wontoverflow(short shift)
@@ -192,10 +193,10 @@ static bool isKnownSpecial(sal_Int32 nLocation)
}
// Perform thorough checks also on unknown variables
-sal_Bool StgHeader::Check()
+bool StgHeader::Check()
{
- return sal_Bool( memcmp( cSignature, cStgSignature, 8 ) == 0
- && (short) ( nVersion >> 16 ) == 3 )
+ return memcmp( cSignature, cStgSignature, 8 ) == 0
+ && (short) ( nVersion >> 16 ) == 3
&& nPageSize == 9
&& lcl_wontoverflow(nPageSize)
&& lcl_wontoverflow(nDataPageSize)
@@ -257,7 +258,7 @@ void StgHeader::SetMasters( sal_Int32 n )
///////////////////////////// class StgEntry /////////////////////////////
-sal_Bool StgEntry::Init()
+bool StgEntry::Init()
{
memset( nName, 0, sizeof( nName ) );
nNameLen = 0;
@@ -281,26 +282,33 @@ sal_Bool StgEntry::Init()
return sal_True;
}
-static String ToUpperUnicode( const String & rStr )
+static OUString ToUpperUnicode( const OUString & rStr )
{
// I don't know the locale, so en_US is hopefully fine
static CharClass aCC( LanguageTag( com::sun::star::lang::Locale( "en", "US", "" )) );
return aCC.uppercase( rStr );
}
-sal_Bool StgEntry::SetName( const String& rName )
+bool StgEntry::SetName( const OUString& rName )
{
// I don't know the locale, so en_US is hopefully fine
aName = ToUpperUnicode( rName );
- aName.Erase( nMaxLegalStr );
+ if(aName.getLength() > nMaxLegalStr)
+ {
+ aName = aName.copy(0, nMaxLegalStr);
+ }
int i;
- for( i = 0; i < aName.Len() && i < 32; i++ )
- nName[ i ] = rName.GetChar( sal_uInt16( i ));
+ for( i = 0; i < aName.getLength() && i < 32; i++ )
+ {
+ nName[ i ] = rName[ i ];
+ }
while( i < 32 )
+ {
nName[ i++ ] = 0;
- nNameLen = ( aName.Len() + 1 ) << 1;
- return sal_True;
+ }
+ nNameLen = ( aName.getLength() + 1 ) << 1;
+ return true;
}
sal_Int32 StgEntry::GetLeaf( StgEntryRef eRef ) const
@@ -308,10 +316,10 @@ sal_Int32 StgEntry::GetLeaf( StgEntryRef eRef ) const
sal_Int32 n = -1;
switch( eRef )
{
- case STG_LEFT: n = nLeft; break;
- case STG_RIGHT: n = nRight; break;
- case STG_CHILD: n = nChild; break;
- case STG_DATA: n = nPage1; break;
+ case STG_LEFT: n = nLeft; break;
+ case STG_RIGHT: n = nRight; break;
+ case STG_CHILD: n = nChild; break;
+ case STG_DATA: n = nPage1; break;
}
return n;
}
@@ -320,10 +328,10 @@ void StgEntry::SetLeaf( StgEntryRef eRef, sal_Int32 nPage )
{
switch( eRef )
{
- case STG_LEFT: nLeft = nPage; break;
- case STG_RIGHT: nRight = nPage; break;
- case STG_CHILD: nChild = nPage; break;
- case STG_DATA: nPage1 = nPage; break;
+ case STG_LEFT: nLeft = nPage; break;
+ case STG_RIGHT: nRight = nPage; break;
+ case STG_CHILD: nChild = nPage; break;
+ case STG_DATA: nPage1 = nPage; break;
}
}
@@ -332,7 +340,7 @@ void StgEntry::SetClassId( const ClsId& r )
memcpy( &aClsId, &r, sizeof( ClsId ) );
}
-void StgEntry::GetName( String& rName ) const
+void StgEntry::GetName( OUString& rName ) const
{
sal_uInt16 n = nNameLen;
if( n )
@@ -351,7 +359,7 @@ short StgEntry::Compare( const StgEntry& r ) const
*/
sal_Int32 nRes = r.nNameLen - nNameLen;
if( !nRes )
- nRes = r.aName.CompareTo( aName );
+ nRes = r.aName.compareTo( aName );
return (short)nRes;
//return aName.CompareTo( r.aName );
}
@@ -359,10 +367,10 @@ short StgEntry::Compare( const StgEntry& r ) const
// These load/store operations are a bit more complicated,
// since they have to copy their contents into a packed structure.
-sal_Bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize )
+bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize )
{
if ( nBufSize < 128 )
- return sal_False;
+ return false;
SvMemoryStream r( (sal_Char*) pFrom, nBufSize, STREAM_READ );
for( short i = 0; i < 32; i++ )
@@ -388,21 +396,24 @@ sal_Bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize )
n = ( n >> 1 ) - 1;
if (n > nMaxLegalStr)
- return sal_False;
+ return false;
if ((cType != STG_STORAGE) && ((nSize < 0) || (nPage1 < 0 && !isKnownSpecial(nPage1))))
{
// the size makes no sense for the substorage
// TODO/LATER: actually the size should be an unsigned value, but in this case it would mean a stream of more than 2Gb
- return sal_False;
+ return false;
}
- aName = OUString( nName, n );
+ aName = OUString(nName , n);
// I don't know the locale, so en_US is hopefully fine
aName = ToUpperUnicode( aName );
- aName.Erase( nMaxLegalStr );
+ if(aName.getLength() > nMaxLegalStr)
+ {
+ aName = aName.copy(0, nMaxLegalStr);
+ }
- return sal_True;
+ return true;
}
void StgEntry::Store( void* pTo )
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index 5e7b6c4d7fc7..7cdd546b8f85 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -29,7 +29,6 @@
class StgIo;
class SvStream;
-class String;
SvStream& operator>>( SvStream&, ClsId& );
SvStream& operator<<( SvStream&, const ClsId& );
@@ -59,30 +58,30 @@ public:
StgHeader();
void Init(); // initialize the header
- sal_Bool Load( StgIo& );
- sal_Bool Load( SvStream& );
- sal_Bool Store( StgIo& );
- sal_Bool Check(); // check the signature and version
- short GetByteOrder() const { return nByteOrder; }
+ bool Load( StgIo& );
+ bool Load( SvStream& );
+ bool Store( StgIo& );
+ bool Check(); // check the signature and version
+ short GetByteOrder() const { return nByteOrder; }
sal_Int32 GetTOCStart() const { return nTOCstrm; }
- void SetTOCStart( sal_Int32 n );
+ void SetTOCStart( sal_Int32 n );
sal_Int32 GetDataFATStart() const { return nDataFAT; }
- void SetDataFATStart( sal_Int32 n );
+ void SetDataFATStart( sal_Int32 n );
sal_Int32 GetDataFATSize() const { return nDataFATSize; }
- void SetDataFATSize( sal_Int32 n );
+ void SetDataFATSize( sal_Int32 n );
sal_Int32 GetThreshold() const { return nThreshold; }
- short GetPageSize() const { return nPageSize; }
- short GetDataPageSize() const { return nDataPageSize; }
+ short GetPageSize() const { return nPageSize; }
+ short GetDataPageSize() const { return nDataPageSize; }
sal_Int32 GetFATSize() const { return nFATSize; }
- void SetFATSize( sal_Int32 n );
+ void SetFATSize( sal_Int32 n );
sal_Int32 GetFATChain() const { return nMasterChain; }
- void SetFATChain( sal_Int32 n );
+ void SetFATChain( sal_Int32 n );
sal_Int32 GetMasters() const { return nMaster; }
- void SetMasters( sal_Int32 n );
- short GetFAT1Size() const { return cFATPagesInHeader; }
- const ClsId& GetClassId() const { return aClsId; }
+ void SetMasters( sal_Int32 n );
+ short GetFAT1Size() const { return cFATPagesInHeader; }
+ const ClsId& GetClassId() const { return aClsId; }
sal_Int32 GetFATPage( short ) const;
- void SetFATPage( short, sal_Int32 );
+ void SetFATPage( short, sal_Int32 );
};
enum StgEntryType { // dir entry types:
@@ -109,7 +108,8 @@ enum StgEntryTime { // time codes:
#define STGENTRY_SIZE 128
//StructuredStorageDirectoryEntry
-class StgEntry { // directory enty
+class StgEntry
+{ // directory enty
sal_uInt16 nName[ 32 ]; // 00 name as WCHAR
sal_uInt16 nNameLen; // 40 size of name in bytes including 00H
sal_uInt8 cType; // 42 entry type
@@ -117,33 +117,33 @@ class StgEntry { // directory enty
sal_Int32 nLeft; // 44 left node entry
sal_Int32 nRight; // 48 right node entry
sal_Int32 nChild; // 4C 1st child entry if storage
- ClsId aClsId; // 50 class ID (optional)
+ ClsId aClsId; // 50 class ID (optional)
sal_Int32 nFlags; // 60 state flags(?)
sal_Int32 nMtime[ 2 ]; // 64 modification time
sal_Int32 nAtime[ 2 ]; // 6C creation and access time
sal_Int32 nPage1; // 74 starting block (either direct or translated)
sal_Int32 nSize; // 78 file size
sal_Int32 nUnknown; // 7C unknown
- String aName; // Name as Compare String (ascii, upper)
+ OUString aName; // Name as Compare String (ascii, upper)
public:
- sal_Bool Init(); // initialize the data
- sal_Bool SetName( const String& ); // store a name (ASCII, up to 32 chars)
- void GetName( String& rName ) const;
+ bool Init(); // initialize the data
+ bool SetName( const OUString& ); // store a name (ASCII, up to 32 chars)
+ void GetName( OUString& rName ) const;
// fill in the name
- short Compare( const StgEntry& ) const; // compare two entries
- sal_Bool Load( const void* pBuffer, sal_uInt32 nBufSize );
- void Store( void* );
- StgEntryType GetType() const { return (StgEntryType) cType; }
+ short Compare( const StgEntry& ) const; // compare two entries
+ bool Load( const void* pBuffer, sal_uInt32 nBufSize );
+ void Store( void* );
+ StgEntryType GetType() const { return (StgEntryType) cType; }
sal_Int32 GetStartPage() const { return nPage1; }
- void SetType( StgEntryType t ) { cType = (sal_uInt8) t; }
- sal_uInt8 GetFlags() const { return cFlags; }
- void SetFlags( sal_uInt8 c ) { cFlags = c; }
- sal_Int32 GetSize() const { return nSize; }
- void SetSize( sal_Int32 n ) { nSize = n; }
- const ClsId& GetClassId() const { return aClsId; }
- void SetClassId( const ClsId& );
+ void SetType( StgEntryType t ) { cType = (sal_uInt8) t; }
+ sal_uInt8 GetFlags() const { return cFlags; }
+ void SetFlags( sal_uInt8 c ) { cFlags = c; }
+ sal_Int32 GetSize() const { return nSize; }
+ void SetSize( sal_Int32 n ) { nSize = n; }
+ const ClsId& GetClassId() const { return aClsId; }
+ void SetClassId( const ClsId& );
sal_Int32 GetLeaf( StgEntryRef ) const;
- void SetLeaf( StgEntryRef, sal_Int32 );
+ void SetLeaf( StgEntryRef, sal_Int32 );
};
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index acd0a32b0cf1..84da972da50c 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -36,7 +36,7 @@ StgIo::StgIo() : StgCache()
pDataFAT = NULL;
pDataStrm = NULL;
pFAT = NULL;
- bCopied = sal_False;
+ bCopied = false;
}
StgIo::~StgIo()
@@ -49,7 +49,7 @@ StgIo::~StgIo()
// Load the header. Do not set an error code if the header is invalid.
-sal_Bool StgIo::Load()
+bool StgIo::Load()
{
if( pStrm )
{
@@ -58,17 +58,17 @@ sal_Bool StgIo::Load()
if( aHdr.Check() )
SetupStreams();
else
- return sal_False;
+ return false;
}
else
- return sal_False;
+ return false;
}
return Good();
}
// Set up an initial, empty storage
-sal_Bool StgIo::Init()
+bool StgIo::Init()
{
aHdr.Init();
SetupStreams();
@@ -114,7 +114,7 @@ short StgIo::GetDataPageSize()
// Commit everything
-sal_Bool StgIo::CommitAll()
+bool StgIo::CommitAll()
{
// Store the data (all streams and the TOC)
if( pTOC && pTOC->Store() && pDataFAT )
@@ -132,19 +132,19 @@ sal_Bool StgIo::CommitAll()
#ifdef DBG_UTIL
if( n==0 ) ValidateFATs();
#endif
- return sal_Bool( n == 0 );
+ return n == 0;
}
}
}
SetError( SVSTREAM_WRITE_ERROR );
- return sal_False;
+ return false;
}
class EasyFat
{
sal_Int32 *pFat;
- sal_Bool *pFree;
+ bool *pFree;
sal_Int32 nPages;
sal_Int32 nPageSize;
@@ -161,7 +161,7 @@ public:
}
sal_uLong Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect );
- sal_Bool HasUnrefChains();
+ bool HasUnrefChains();
};
EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, sal_Int32 nPSize )
@@ -169,7 +169,7 @@ EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, sal_Int32 nPSize )
nPages = pFatStream->GetSize() >> 2;
nPageSize = nPSize;
pFat = new sal_Int32[ nPages ];
- pFree = new sal_Bool[ nPages ];
+ pFree = new bool[ nPages ];
rtl::Reference< StgPage > pPage;
sal_Int32 nFatPageSize = (1 << rIo.aHdr.GetPageSize()) - 2;
@@ -180,22 +180,22 @@ EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, sal_Int32 nPSize )
{
pFatStream->Pos2Page( nPage << 2 );
sal_Int32 nPhysPage = pFatStream->GetPage();
- pPage = rIo.Get( nPhysPage, sal_True );
+ pPage = rIo.Get( nPhysPage, true );
}
pFat[ nPage ] = rIo.GetFromPage( pPage, short( nPage % nFatPageSize ) );
- pFree[ nPage ] = sal_True;
+ pFree[ nPage ] = true;
}
}
-sal_Bool EasyFat::HasUnrefChains()
+bool EasyFat::HasUnrefChains()
{
for( sal_Int32 nPage = 0; nPage < nPages; nPage++ )
{
if( pFree[ nPage ] && pFat[ nPage ] != -1 )
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
sal_uLong EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect )
@@ -208,7 +208,7 @@ sal_uLong EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect )
{
if( nCurPage < 0 || nCurPage >= nPages )
return FAT_OUTOFBOUNDS;
- pFree[ nCurPage ] = sal_False;
+ pFree[ nCurPage ] = false;
nCurPage = pFat[ nCurPage ];
//Stream zu lang
if( nCurPage != nExpect && nCount == 1 )
@@ -242,7 +242,7 @@ class Validator
public:
Validator( StgIo &rIo );
- sal_Bool IsError() { return nError != 0; }
+ bool IsError() { return nError != 0; }
};
Validator::Validator( StgIo &rIoP )
@@ -269,7 +269,7 @@ sal_uLong Validator::ValidateMasterFATs()
for( sal_Int32 i = 0; i < nCount; i++ )
{
- if( ( nErr = aFat.Mark(rIo.pFAT->GetPage( short(i), sal_False ), aFat.GetPageSize(), -3 )) != FAT_OK )
+ if( ( nErr = aFat.Mark(rIo.pFAT->GetPage( short(i), false ), aFat.GetPageSize(), -3 )) != FAT_OK )
return nErr;
}
if( rIo.aHdr.GetMasters() )
@@ -360,7 +360,7 @@ sal_uLong StgIo::ValidateFATs()
if( bFile )
{
Validator *pV = new Validator( *this );
- sal_Bool bRet1 = !pV->IsError(), bRet2 = sal_True ;
+ bool bRet1 = !pV->IsError(), bRet2 = true ;
delete pV;
SvFileStream *pFileStrm = ( SvFileStream *) GetStrm();
@@ -387,7 +387,7 @@ sal_uLong StgIo::ValidateFATs()
aArg.aFile = pFileStrm->GetFileName();
aArg.nErr = nErr;
ErrorLink::get().Call( &aArg );
- bCopied = sal_True;
+ bCopied = true;
}
// DBG_ASSERT( nErr == FAT_OK ,"Storage kaputt");
return nErr;
diff --git a/sot/source/sdstor/stgio.hxx b/sot/source/sdstor/stgio.hxx
index 6854ae715634..845df861a78d 100644
--- a/sot/source/sdstor/stgio.hxx
+++ b/sot/source/sdstor/stgio.hxx
@@ -23,12 +23,11 @@
#include <stgcache.hxx>
#include <stgelem.hxx>
#include <tools/link.hxx>
-#include <tools/string.hxx>
+#include <tools/solar.h>
class StgFATStrm;
class StgDataStrm;
class StgDirStrm;
-class String;
enum FAT_ERROR
{
@@ -45,13 +44,13 @@ enum FAT_ERROR
struct StgLinkArg
{
- String aFile;
+ OUString aFile;
sal_uLong nErr;
};
class StgIo : public StgCache {
void SetupStreams(); // load all internal streams
- sal_Bool bCopied;
+ bool bCopied;
public:
StgIo();
~StgIo();
@@ -61,9 +60,9 @@ public:
StgDataStrm* pDataFAT; // small data FAT stream
StgDataStrm* pDataStrm; // small data stream
short GetDataPageSize(); // get the logical data page size
- sal_Bool Load(); // load a storage file
- sal_Bool Init(); // set up an empty file
- sal_Bool CommitAll(); // commit everything (root commit)
+ bool Load(); // load a storage file
+ bool Init(); // set up an empty file
+ bool CommitAll(); // commit everything (root commit)
static void SetErrorLink( const Link& );
static const Link& GetErrorLink();
diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index ac7682b4af10..b2f092fb845a 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -26,10 +26,9 @@
#endif
///////////////////////// class StgInternalStream ////////////////////////
-StgInternalStream::StgInternalStream
- ( BaseStorage& rStg, const String& rName, sal_Bool bWr )
+StgInternalStream::StgInternalStream( BaseStorage& rStg, const OUString& rName, bool bWr )
{
- bIsWritable = sal_True;
+ bIsWritable = true;
sal_uInt16 nMode = bWr
? STREAM_WRITE | STREAM_SHARE_DENYALL
: STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE;
@@ -91,20 +90,20 @@ void StgInternalStream::Commit()
///////////////////////// class StgCompObjStream /////////////////////////
-StgCompObjStream::StgCompObjStream( BaseStorage& rStg, sal_Bool bWr )
- : StgInternalStream( rStg, OUString("\1CompObj"), bWr )
+StgCompObjStream::StgCompObjStream( BaseStorage& rStg, bool bWr )
+ : StgInternalStream( rStg, OUString("\1CompObj"), bWr )
{
memset( &aClsId, 0, sizeof( ClsId ) );
nCbFormat = 0;
}
-sal_Bool StgCompObjStream::Load()
+bool StgCompObjStream::Load()
{
memset( &aClsId, 0, sizeof( ClsId ) );
nCbFormat = 0;
- aUserName.Erase();
+ aUserName = "";
if( GetError() != SVSTREAM_OK )
- return sal_False;
+ return false;
Seek( 8L ); // skip the first part
sal_Int32 nMarker = 0;
*this >> nMarker;
@@ -128,7 +127,7 @@ sal_Bool StgCompObjStream::Load()
//all platforms and envs
//http://www.openoffice.org/nonav/issues/showattachment.cgi/68668/Orginal%20Document.doc
//for a good edge-case example
- aUserName = nStrLen ? String( p, RTL_TEXTENCODING_MS_1252 ) : String();
+ aUserName = nStrLen ? OUString( p, nStrLen, RTL_TEXTENCODING_MS_1252 ) : OUString();
nCbFormat = ReadClipboardFormat( *this );
}
else
@@ -136,13 +135,13 @@ sal_Bool StgCompObjStream::Load()
delete [] p;
}
}
- return sal_Bool( GetError() == SVSTREAM_OK );
+ return GetError() == SVSTREAM_OK;
}
-sal_Bool StgCompObjStream::Store()
+bool StgCompObjStream::Store()
{
if( GetError() != SVSTREAM_OK )
- return sal_False;
+ return false;
Seek( 0L );
OString aAsciiUserName(OUStringToOString(aUserName, RTL_TEXTENCODING_MS_1252));
*this << (sal_Int16) 1 // Version?
@@ -156,32 +155,34 @@ sal_Bool StgCompObjStream::Store()
WriteClipboardFormat( *this, nCbFormat );
*this << (sal_Int32) 0; // terminator
Commit();
- return sal_Bool( GetError() == SVSTREAM_OK );
+ return GetError() == SVSTREAM_OK;
}
/////////////////////////// class StgOleStream ///////////////////////////
-StgOleStream::StgOleStream( BaseStorage& rStg, sal_Bool bWr )
- : StgInternalStream( rStg, OUString("\1Ole"), bWr )
+StgOleStream::StgOleStream( BaseStorage& rStg, bool bWr )
+ : StgInternalStream( rStg, OUString("\1Ole"), bWr )
{
nFlags = 0;
}
-sal_Bool StgOleStream::Load()
+bool StgOleStream::Load()
{
nFlags = 0;
if( GetError() != SVSTREAM_OK )
- return sal_False;
+ return false;
+
sal_Int32 version = 0;
Seek( 0L );
*this >> version >> nFlags;
- return sal_Bool( GetError() == SVSTREAM_OK );
+ return GetError() == SVSTREAM_OK;
}
-sal_Bool StgOleStream::Store()
+bool StgOleStream::Store()
{
if( GetError() != SVSTREAM_OK )
- return sal_False;
+ return false;
+
Seek( 0L );
*this << (sal_Int32) 0x02000001 // OLE version, format
<< (sal_Int32) nFlags // Object flags
@@ -189,7 +190,7 @@ sal_Bool StgOleStream::Store()
<< (sal_Int32) 0 // reserved
<< (sal_Int32) 0; // Moniker 1
Commit();
- return sal_Bool( GetError() == SVSTREAM_OK );
+ return GetError() == SVSTREAM_OK;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/sdstor/stgole.hxx b/sot/source/sdstor/stgole.hxx
index 068af6e1814b..c5e7a5f2ab5a 100644
--- a/sot/source/sdstor/stgole.hxx
+++ b/sot/source/sdstor/stgole.hxx
@@ -31,9 +31,9 @@ class StgInternalStream : public SvStream
virtual sal_uLong GetData( void* pData, sal_uLong nSize );
virtual sal_uLong PutData( const void* pData, sal_uLong nSize );
virtual sal_uLong SeekPos( sal_uLong nPos );
- virtual void FlushData();
+ virtual void FlushData();
public:
- StgInternalStream( BaseStorage&, const String&, sal_Bool );
+ StgInternalStream( BaseStorage&, const OUString&, bool );
~StgInternalStream();
void Commit();
};
@@ -42,16 +42,16 @@ public:
class StgCompObjStream : public StgInternalStream
{
- ClsId aClsId;
- String aUserName;
+ ClsId aClsId;
+ OUString aUserName;
sal_uLong nCbFormat;
public:
- StgCompObjStream( BaseStorage&, sal_Bool );
- ClsId& GetClsId() { return aClsId; }
- String& GetUserName() { return aUserName; }
- sal_uLong& GetCbFormat() { return nCbFormat; }
- sal_Bool Load();
- sal_Bool Store();
+ StgCompObjStream( BaseStorage&, bool );
+ ClsId& GetClsId() { return aClsId; }
+ OUString& GetUserName() { return aUserName; }
+ sal_uLong& GetCbFormat() { return nCbFormat; }
+ bool Load();
+ bool Store();
};
// standard stream "\1Ole"
@@ -60,10 +60,10 @@ class StgOleStream : public StgInternalStream
{
sal_uInt32 nFlags;
public:
- StgOleStream( BaseStorage&, sal_Bool );
+ StgOleStream( BaseStorage&, bool );
sal_uInt32& GetFlags() { return nFlags; }
- sal_Bool Load();
- sal_Bool Store();
+ bool Load();
+ bool Store();
};
#endif
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index dfd39080393a..2d8d4de51d4f 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -145,7 +145,7 @@ public:
class StgTmpStrm : public SvMemoryStream
{
- String aName;
+ OUString aName;
SvFileStream* pStrm;
using SvMemoryStream::GetData;
virtual sal_uLong GetData( void* pData, sal_uLong nSize );
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 7a8c90a86416..68da44187e44 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -46,8 +46,8 @@ class SotStorageStreamFactory : public SotFactory
public:
TYPEINFO();
SotStorageStreamFactory( const SvGlobalName & rName,
- const String & rClassName,
- CreateInstanceType pCreateFuncP )
+ const OUString & rClassName,
+ CreateInstanceType pCreateFuncP )
: SotFactory( rName, rClassName, pCreateFuncP )
{}
};
@@ -58,40 +58,35 @@ SO2_IMPL_BASIC_CLASS1_DLL(SotStorageStream,SotStorageStreamFactory,SotObject,
SvGlobalName( 0xd7deb420, 0xf902, 0x11d0,
0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
-/************************************************************************
-|* SotStorageStream::SotStorageStream()
-|*
-|* Beschreibung
-*************************************************************************/
-SvLockBytesRef MakeLockBytes_Impl( const String & rName, StreamMode nMode )
+SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode )
{
SvLockBytesRef xLB;
- if( rName.Len() )
+ if( !rName.isEmpty() )
{
SvStream * pFileStm = new SvFileStream( rName, nMode );
- xLB = new SvLockBytes( pFileStm, sal_True );
+ xLB = new SvLockBytes( pFileStm, true );
}
else
{
SvStream * pCacheStm = new SvCacheStream();
- xLB = new SvLockBytes( pCacheStm, sal_True );
+ xLB = new SvLockBytes( pCacheStm, true );
}
return xLB;
}
-SotStorageStream::SotStorageStream( const String & rName, StreamMode nMode,
- StorageMode
- #ifdef DBG_UTIL
- nStorageMode
- #endif
+SotStorageStream::SotStorageStream( const OUString & rName, StreamMode nMode,
+ StorageMode
+ #ifdef DBG_UTIL
+ nStorageMode
+ #endif
)
: SvStream( MakeLockBytes_Impl( rName, nMode ) )
, pOwnStm( NULL )
{
if( nMode & STREAM_WRITE )
- bIsWritable = sal_True;
+ bIsWritable = true;
else
- bIsWritable = sal_False;
+ bIsWritable = false;
DBG_ASSERT( !nStorageMode,"StorageModes ignored" );
}
@@ -101,9 +96,9 @@ SotStorageStream::SotStorageStream( BaseStorageStream * pStm )
if( pStm )
{
if( STREAM_WRITE & pStm->GetMode() )
- bIsWritable = sal_True;
+ bIsWritable = true;
else
- bIsWritable = sal_False;
+ bIsWritable = false;
pOwnStm = pStm;
SetError( pStm->GetError() );
@@ -112,7 +107,7 @@ SotStorageStream::SotStorageStream( BaseStorageStream * pStm )
else
{
pOwnStm = NULL;
- bIsWritable = sal_True;
+ bIsWritable = true;
SetError( SVSTREAM_INVALID_PARAMETER );
}
}
@@ -121,25 +116,15 @@ SotStorageStream::SotStorageStream()
: pOwnStm( NULL )
{
// ??? wenn Init virtuell ist, entsprechen setzen
- bIsWritable = sal_True;
+ bIsWritable = true;
}
-/************************************************************************
-|* SotStorageStream::~SotStorageStream()
-|*
-|* Beschreibung
-*************************************************************************/
SotStorageStream::~SotStorageStream()
{
Flush(); //SetBufferSize(0);
delete pOwnStm;
}
-/*************************************************************************
-|* SotStorageStream::ResetError()
-|*
-|* Beschreibung
-*************************************************************************/
void SotStorageStream::ResetError()
{
SvStream::ResetError();
@@ -147,11 +132,6 @@ void SotStorageStream::ResetError()
pOwnStm->ResetError();
}
-/*************************************************************************
-|* SotStorageStream::GetData()
-|*
-|* Beschreibung
-*************************************************************************/
sal_uLong SotStorageStream::GetData( void* pData, sal_uLong nSize )
{
sal_uLong nRet = 0;
@@ -163,14 +143,10 @@ sal_uLong SotStorageStream::GetData( void* pData, sal_uLong nSize )
}
else
nRet = SvStream::GetData( (sal_Char *)pData, nSize );
+
return nRet;
}
-/*************************************************************************
-|* SotStorageStream::PutData()
-|*
-|* Beschreibung
-*************************************************************************/
sal_uLong SotStorageStream::PutData( const void* pData, sal_uLong nSize )
{
sal_uLong nRet = 0;
@@ -185,11 +161,6 @@ sal_uLong SotStorageStream::PutData( const void* pData, sal_uLong nSize )
return nRet;
}
-/*************************************************************************
-|* SotStorageStream::SeekPos()
-|*
-|* Beschreibung
-*************************************************************************/
sal_uLong SotStorageStream::SeekPos( sal_uLong nPos )
{
sal_uLong nRet = 0;
@@ -201,14 +172,10 @@ sal_uLong SotStorageStream::SeekPos( sal_uLong nPos )
}
else
nRet = SvStream::SeekPos( nPos );
+
return nRet;
}
-/*************************************************************************
-|* SotStorageStream::Flush()
-|*
-|* Beschreibung
-*************************************************************************/
void SotStorageStream::FlushData()
{
if( pOwnStm )
@@ -220,11 +187,6 @@ void SotStorageStream::FlushData()
SvStream::FlushData();
}
-/*************************************************************************
-|* SotStorageStream::SetSize()
-|*
-|* Beschreibung
-*************************************************************************/
void SotStorageStream::SetSize( sal_uLong nNewSize )
{
sal_uLong nPos = Tell();
@@ -239,17 +201,8 @@ void SotStorageStream::SetSize( sal_uLong nNewSize )
if( nNewSize < nPos )
// ans Ende setzen
Seek( nNewSize );
-
- //return GetError() == SVSTREAM_OK;
}
-/*************************************************************************
-|*
-|* SotStorageStream::GetSize()
-|*
-|* Beschreibung
-|*
-*************************************************************************/
sal_uInt32 SotStorageStream::GetSize() const
{
sal_uLong nPos = Tell();
@@ -263,21 +216,17 @@ sal_Size SotStorageStream::remainingSize()
{
if (pOwnStm)
return pOwnStm->GetSize() - Tell();
+
return SvStream::remainingSize();
}
-/*************************************************************************
-|* SotStorageStream::CopyTo()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorageStream::CopyTo( SotStorageStream * pDestStm )
+bool SotStorageStream::CopyTo( SotStorageStream * pDestStm )
{
Flush(); // alle Daten schreiben
pDestStm->ClearBuffer();
if( !pOwnStm || !pDestStm->pOwnStm )
- { // Wenn Ole2 oder nicht nur eigene StorageStreams
-
+ {
+ // Wenn Ole2 oder nicht nur eigene StorageStreams
sal_uLong nPos = Tell(); // Position merken
Seek( 0L );
pDestStm->SetSize( 0 ); // Ziel-Stream leeren
@@ -299,31 +248,13 @@ sal_Bool SotStorageStream::CopyTo( SotStorageStream * pDestStm )
}
else
{
- /*
- // Kopieren
- nErr = pObjI->CopyTo( pDestStm->pObjI, uSize, NULL, &uWrite );
- if( SUCCEEDED( nErr ) )
- {
- // Ziel-Streamzeiger steht hinter den Daten
- // SvSeek abgleichen
- pDestStm->Seek( uWrite.LowPart );
- }
- else if( GetScode( nErr ) == E_NOTIMPL )
- { // Eines Tages werden alle MS... ?!#
- */
pOwnStm->CopyTo( pDestStm->pOwnStm );
SetError( pOwnStm->GetError() );
}
return GetError() == SVSTREAM_OK;
}
-/*************************************************************************
-|* SotStorageStream::Commit()
-|* SotStorageStream::Revert()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorageStream::Commit()
+bool SotStorageStream::Commit()
{
if( pOwnStm )
{
@@ -335,7 +266,7 @@ sal_Bool SotStorageStream::Commit()
return GetError() == SVSTREAM_OK;
}
-sal_Bool SotStorageStream::Revert()
+bool SotStorageStream::Revert()
{
if( pOwnStm )
{
@@ -345,7 +276,7 @@ sal_Bool SotStorageStream::Revert()
return GetError() == SVSTREAM_OK;
}
-sal_Bool SotStorageStream::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue )
+bool SotStorageStream::SetProperty( const OUString& rName, const ::com::sun::star::uno::Any& rValue )
{
UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pOwnStm );
if ( pStg )
@@ -355,7 +286,7 @@ sal_Bool SotStorageStream::SetProperty( const String& rName, const ::com::sun::s
else
{
OSL_FAIL("Not implemented!");
- return sal_False;
+ return false;
}
}
@@ -366,8 +297,8 @@ class SotStorageFactory : public SotFactory
public:
TYPEINFO();
SotStorageFactory( const SvGlobalName & rName,
- const String & rClassName,
- CreateInstanceType pCreateFuncP )
+ const OUString & rClassName,
+ CreateInstanceType pCreateFuncP )
: SotFactory( rName, rClassName, pCreateFuncP )
{}
};
@@ -375,8 +306,8 @@ TYPEINIT1(SotStorageFactory,SotFactory);
SO2_IMPL_BASIC_CLASS1_DLL(SotStorage,SotStorageFactory,SotObject,
- SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
- 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+ SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
/************************************************************************
|*
@@ -385,7 +316,7 @@ SO2_IMPL_BASIC_CLASS1_DLL(SotStorage,SotStorageFactory,SotObject,
|* Beschreibung Es muss ein I... Objekt an SvObject uebergeben
|* werden, da es sonst selbst ein IUnknown anlegt und
|* festlegt, dass alle weiteren I... Objekte mit
-|* delete zerstoert werden (Owner() == sal_True).
+|* delete zerstoert werden (Owner() == true).
|* Es werden aber nur IStorage Objekte benutzt und nicht
|* selbst implementiert, deshalb wird so getan, als ob
|* das IStorage Objekt von aussen kam und es wird mit
@@ -399,12 +330,12 @@ SO2_IMPL_BASIC_CLASS1_DLL(SotStorage,SotStorageFactory,SotObject,
|* ist NULL, wenn es nicht geklappt hat.
|*
*************************************************************************/
-#define INIT_SotStorage() \
+#define INIT_SotStorage() \
: m_pOwnStg( NULL ) \
, m_pStorStm( NULL ) \
- , m_nError( SVSTREAM_OK ) \
- , m_bIsRoot( sal_False ) \
- , m_bDelStm( sal_False ) \
+ , m_nError( SVSTREAM_OK ) \
+ , m_bIsRoot( false ) \
+ , m_bDelStm( false ) \
, m_nVersion( SOFFICE_FILEFORMAT_CURRENT )
SotStorage::SotStorage()
@@ -418,19 +349,19 @@ SotStorage::SotStorage()
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <ucbhelper/content.hxx>
-SotStorage::SotStorage( const String & rName, StreamMode nMode, StorageMode nStorageMode )
+SotStorage::SotStorage( const OUString & rName, StreamMode nMode, StorageMode nStorageMode )
INIT_SotStorage()
{
m_aName = rName; // Namen merken
- CreateStorage( sal_True, nMode, nStorageMode );
+ CreateStorage( true, nMode, nStorageMode );
if ( IsOLEStorage() )
m_nVersion = SOFFICE_FILEFORMAT_50;
}
-void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, StorageMode nStorageMode )
+void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode, StorageMode nStorageMode )
{
DBG_ASSERT( !m_pStorStm && !m_pOwnStg, "Use only in ctor!" );
- if( m_aName.Len() )
+ if( !m_aName.isEmpty() )
{
// named storage
if( ( ( nMode & ERASEMASK ) == ERASEMASK ) )
@@ -449,15 +380,15 @@ void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, Sto
if ( nStorageMode == STORAGE_CREATE_UNPACKED )
{
// don't open stream readwrite, content provider may not support this !
- String aURL = UCBStorage::CreateLinkFile( m_aName );
- if ( aURL.Len() )
+ OUString aURL = UCBStorage::CreateLinkFile( m_aName );
+ if ( !aURL.isEmpty() )
{
::ucbhelper::Content aContent( aURL, ::com::sun::star::uno::Reference < ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
- m_pOwnStg = new UCBStorage( aContent, aURL, nMode, sal_False );
+ m_pOwnStg = new UCBStorage( aContent, aURL, nMode, false );
}
else
{
- m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
SetError( ERRCODE_IO_NOTSUPPORTED );
}
}
@@ -471,18 +402,18 @@ void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, Sto
if ( m_pStorStm )
{
// try as UCBStorage, next try as OLEStorage
- sal_Bool bIsUCBStorage = UCBStorage::IsStorageFile( m_pStorStm );
+ bool bIsUCBStorage = UCBStorage::IsStorageFile( m_pStorStm );
if ( !bIsUCBStorage && bForceUCBStorage )
// if UCBStorage has priority, it should not be used only if it is really an OLEStorage
bIsUCBStorage = !Storage::IsStorageFile( m_pStorStm );
if ( bIsUCBStorage )
{
- if ( UCBStorage::GetLinkedFile( *m_pStorStm ).Len() )
+ if ( !(UCBStorage::GetLinkedFile( *m_pStorStm ).isEmpty()) )
{
// detect special unpacked storages
- m_pOwnStg = new UCBStorage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
- m_bDelStm = sal_True;
+ m_pOwnStg = new UCBStorage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
+ m_bDelStm = true;
}
else
{
@@ -492,24 +423,24 @@ void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, Sto
// UCBStorage always works directly on the UCB content, so discard the stream first
DELETEZ( m_pStorStm );
- m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
}
}
else
{
// OLEStorage can be opened with a stream
- m_pOwnStg = new Storage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
- m_bDelStm = sal_True;
+ m_pOwnStg = new Storage( *m_pStorStm, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
+ m_bDelStm = true;
}
}
else if ( bForceUCBStorage )
{
- m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
SetError( ERRCODE_IO_NOTSUPPORTED );
}
else
{
- m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
SetError( ERRCODE_IO_NOTSUPPORTED );
}
}
@@ -518,9 +449,9 @@ void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, Sto
{
// temporary storage
if ( bForceUCBStorage )
- m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ m_pOwnStg = new UCBStorage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
else
- m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ m_pOwnStg = new Storage( m_aName, nMode, (nStorageMode & STORAGE_TRANSACTED) ? false : true );
m_aName = m_pOwnStg->GetName();
}
@@ -529,7 +460,7 @@ void SotStorage::CreateStorage( sal_Bool bForceUCBStorage, StreamMode nMode, Sto
SignAsRoot( m_pOwnStg->IsRoot() );
}
-SotStorage::SotStorage( sal_Bool bUCBStorage, const String & rName, StreamMode nMode, StorageMode nStorageMode )
+SotStorage::SotStorage( bool bUCBStorage, const OUString & rName, StreamMode nMode, StorageMode nStorageMode )
INIT_SotStorage()
{
m_aName = rName;
@@ -555,16 +486,16 @@ SotStorage::SotStorage( BaseStorage * pStor )
m_nVersion = SOFFICE_FILEFORMAT_50;
}
-SotStorage::SotStorage( sal_Bool bUCBStorage, SvStream & rStm )
+SotStorage::SotStorage( bool bUCBStorage, SvStream & rStm )
INIT_SotStorage()
{
SetError( rStm.GetError() );
// try as UCBStorage, next try as OLEStorage
if ( UCBStorage::IsStorageFile( &rStm ) || bUCBStorage )
- m_pOwnStg = new UCBStorage( rStm, sal_False );
+ m_pOwnStg = new UCBStorage( rStm, false );
else
- m_pOwnStg = new Storage( rStm, sal_False );
+ m_pOwnStg = new Storage( rStm, false );
SetError( m_pOwnStg->GetError() );
@@ -581,9 +512,9 @@ SotStorage::SotStorage( SvStream & rStm )
// try as UCBStorage, next try as OLEStorage
if ( UCBStorage::IsStorageFile( &rStm ) )
- m_pOwnStg = new UCBStorage( rStm, sal_False );
+ m_pOwnStg = new UCBStorage( rStm, false );
else
- m_pOwnStg = new Storage( rStm, sal_False );
+ m_pOwnStg = new Storage( rStm, false );
SetError( m_pOwnStg->GetError() );
@@ -593,16 +524,16 @@ SotStorage::SotStorage( SvStream & rStm )
SignAsRoot( m_pOwnStg->IsRoot() );
}
-SotStorage::SotStorage( SvStream * pStm, sal_Bool bDelete )
+SotStorage::SotStorage( SvStream * pStm, bool bDelete )
INIT_SotStorage()
{
SetError( pStm->GetError() );
// try as UCBStorage, next try as OLEStorage
if ( UCBStorage::IsStorageFile( pStm ) )
- m_pOwnStg = new UCBStorage( *pStm, sal_False );
+ m_pOwnStg = new UCBStorage( *pStm, false );
else
- m_pOwnStg = new Storage( *pStm, sal_False );
+ m_pOwnStg = new Storage( *pStm, false );
SetError( m_pOwnStg->GetError() );
@@ -614,11 +545,6 @@ SotStorage::SotStorage( SvStream * pStm, sal_Bool bDelete )
SignAsRoot( m_pOwnStg->IsRoot() );
}
-/*************************************************************************
-|* SotStorage::~SotStorage()
-|*
-|* Beschreibung
-*************************************************************************/
SotStorage::~SotStorage()
{
delete m_pOwnStg;
@@ -626,18 +552,15 @@ SotStorage::~SotStorage()
delete m_pStorStm;
}
-/*************************************************************************
-|* SotStorage::CreateMemoryStream()
-|*
-|* Beschreibung
-*************************************************************************/
SvMemoryStream * SotStorage::CreateMemoryStream()
{
SvMemoryStream * pStm = NULL;
pStm = new SvMemoryStream( 0x8000, 0x8000 );
SotStorageRef aStg = new SotStorage( *pStm );
if( CopyTo( aStg ) )
+ {
aStg->Commit();
+ }
else
{
aStg.Clear(); // Storage vorher freigeben
@@ -647,14 +570,9 @@ SvMemoryStream * SotStorage::CreateMemoryStream()
return pStm;
}
-/*************************************************************************
-|* SotStorage::GetStorage()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::IsStorageFile( const String & rFileName )
+bool SotStorage::IsStorageFile( const OUString & rFileName )
{
- String aName( rFileName );
+ OUString aName( rFileName );
INetURLObject aObj( aName );
if ( aObj.GetProtocol() == INET_PROT_NOT_VALID )
{
@@ -665,34 +583,30 @@ sal_Bool SotStorage::IsStorageFile( const String & rFileName )
}
SvStream * pStm = ::utl::UcbStreamHelper::CreateStream( aName, STREAM_STD_READ );
- sal_Bool bRet = SotStorage::IsStorageFile( pStm );
+ bool bRet = SotStorage::IsStorageFile( pStm );
delete pStm;
return bRet;
}
-sal_Bool SotStorage::IsStorageFile( SvStream* pStream )
+bool SotStorage::IsStorageFile( SvStream* pStream )
{
/** code for new storages must come first! **/
if ( pStream )
{
long nPos = pStream->Tell();
- sal_Bool bRet = UCBStorage::IsStorageFile( pStream );
+ bool bRet = UCBStorage::IsStorageFile( pStream );
if ( !bRet )
bRet = Storage::IsStorageFile( pStream );
pStream->Seek( nPos );
return bRet;
}
else
- return sal_False;
+ return false;
}
-/*************************************************************************
-|* SotStorage::GetStorage()
-|*
-|* Beschreibung
-*************************************************************************/
-const String & SotStorage::GetName() const
+
+const OUString & SotStorage::GetName() const
{
- if( !m_aName.Len() )
+ if( m_aName.isEmpty() )
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -706,11 +620,6 @@ const OString& SotStorage::GetKey() const
return m_aKey;
}
-/*************************************************************************
-|* SotStorage::ResetError()
-|*
-|* Beschreibung
-*************************************************************************/
void SotStorage::ResetError()
{
m_nError = SVSTREAM_OK;
@@ -718,15 +627,9 @@ void SotStorage::ResetError()
m_pOwnStg->ResetError();
}
-/*************************************************************************
-|* SotStorage::SetClass()
-|* SotStorage::SetConvertClass()
-|*
-|* Beschreibung
-*************************************************************************/
void SotStorage::SetClass( const SvGlobalName & rName,
- sal_uLong nOriginalClipFormat,
- const String & rUserTypeName )
+ sal_uLong nOriginalClipFormat,
+ const OUString & rUserTypeName )
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -736,8 +639,8 @@ void SotStorage::SetClass( const SvGlobalName & rName,
}
void SotStorage::SetConvertClass( const SvGlobalName & rName,
- sal_uLong nOriginalClipFormat,
- const String & rUserTypeName )
+ sal_uLong nOriginalClipFormat,
+ const OUString & rUserTypeName )
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -746,14 +649,6 @@ void SotStorage::SetConvertClass( const SvGlobalName & rName,
SetError( SVSTREAM_GENERALERROR );
}
-/*************************************************************************
-|* SotStorage::GetClassName()
-|* SotStorage::GetFormat()
-|* SotStorage::GetUserName()
-|* SotStorage::ShouldConvert()
-|*
-|* Beschreibung
-*************************************************************************/
SvGlobalName SotStorage::GetClassName()
{
SvGlobalName aGN;
@@ -776,9 +671,9 @@ sal_uLong SotStorage::GetFormat()
return nFormat;
}
-String SotStorage::GetUserName()
+OUString SotStorage::GetUserName()
{
- String aName;
+ OUString aName;
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
aName = m_pOwnStg->GetUserName();
@@ -787,21 +682,16 @@ String SotStorage::GetUserName()
return aName;
}
-sal_Bool SotStorage::ShouldConvert()
+bool SotStorage::ShouldConvert()
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
return m_pOwnStg->ShouldConvert();
else
SetError( SVSTREAM_GENERALERROR );
- return sal_False;
+ return false;
}
-/*************************************************************************
-|* SotStorage::FillInfoList()
-|*
-|* Beschreibung
-*************************************************************************/
void SotStorage::FillInfoList( SvStorageInfoList * pFillList ) const
{
DBG_ASSERT( Owner(), "must be owner" );
@@ -809,12 +699,7 @@ void SotStorage::FillInfoList( SvStorageInfoList * pFillList ) const
m_pOwnStg->FillInfoList( pFillList );
}
-/*************************************************************************
-|* SotStorage::CopyTo()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::CopyTo( SotStorage * pDestStg )
+bool SotStorage::CopyTo( SotStorage * pDestStg )
{
DBG_ASSERT( Owner(), "must be owner" );
DBG_ASSERT( pDestStg->Owner(), "must be owner" );
@@ -827,15 +712,11 @@ sal_Bool SotStorage::CopyTo( SotStorage * pDestStg )
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-/*************************************************************************
-|* SotStorage::Commit()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::Commit()
+bool SotStorage::Commit()
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -845,15 +726,11 @@ sal_Bool SotStorage::Commit()
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-/*************************************************************************
-|* SotStorage::Revert()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::Revert()
+bool SotStorage::Revert()
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -863,12 +740,13 @@ sal_Bool SotStorage::Revert()
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-SotStorageStream * SotStorage::OpenSotStream( const String & rEleName,
- StreamMode nMode,
- StorageMode nStorageMode )
+SotStorageStream * SotStorage::OpenSotStream( const OUString & rEleName,
+ StreamMode nMode,
+ StorageMode nStorageMode )
{
DBG_ASSERT( !nStorageMode, "StorageModes ignored" );
SotStorageStream * pStm = NULL;
@@ -880,7 +758,7 @@ SotStorageStream * SotStorage::OpenSotStream( const String & rEleName,
nMode |= STREAM_SHARE_DENYALL;
ErrCode nE = m_pOwnStg->GetError();
BaseStorageStream * p = m_pOwnStg->OpenStream( rEleName, nMode,
- (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True );
+ (nStorageMode & STORAGE_TRANSACTED) ? false : true );
pStm = new SotStorageStream( p );
if( !nE )
@@ -890,17 +768,13 @@ SotStorageStream * SotStorage::OpenSotStream( const String & rEleName,
}
else
SetError( SVSTREAM_GENERALERROR );
+
return pStm;
}
-/*************************************************************************
-|* SotStorage::OpenStorage()
-|*
-|* Beschreibung
-*************************************************************************/
-SotStorage * SotStorage::OpenSotStorage( const String & rEleName,
- StreamMode nMode,
- StorageMode nStorageMode )
+SotStorage * SotStorage::OpenSotStorage( const OUString & rEleName,
+ StreamMode nMode,
+ StorageMode nStorageMode )
{
SotStorage * pStor = NULL;
DBG_ASSERT( Owner(), "must be owner" );
@@ -925,46 +799,37 @@ SotStorage * SotStorage::OpenSotStorage( const String & rEleName,
return NULL;
}
-/*************************************************************************
-|* SotStorage::IsStream()
-|* SotStorage::IsStorage()
-|* SotStorage::IsContained()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::IsStorage( const String & rEleName ) const
+bool SotStorage::IsStorage( const OUString & rEleName ) const
{
DBG_ASSERT( Owner(), "must be owner" );
// ein bisschen schneller
if( m_pOwnStg )
return m_pOwnStg->IsStorage( rEleName );
- return sal_False;
+
+ return false;
}
-sal_Bool SotStorage::IsStream( const String & rEleName ) const
+bool SotStorage::IsStream( const OUString & rEleName ) const
{
DBG_ASSERT( Owner(), "must be owner" );
// ein bisschen schneller
if( m_pOwnStg )
return m_pOwnStg->IsStream( rEleName );
- return sal_False;
+
+ return false;
}
-sal_Bool SotStorage::IsContained( const String & rEleName ) const
+bool SotStorage::IsContained( const OUString & rEleName ) const
{
DBG_ASSERT( Owner(), "must be owner" );
// ein bisschen schneller
if( m_pOwnStg )
return m_pOwnStg->IsContained( rEleName );
- return sal_False;
+
+ return false;
}
-/*************************************************************************
-|* SotStorage::Remove()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::Remove( const String & rEleName )
+bool SotStorage::Remove( const OUString & rEleName )
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -974,15 +839,11 @@ sal_Bool SotStorage::Remove( const String & rEleName )
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-/*************************************************************************
-|* SotStorage::Rename()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::Rename( const String & rEleName, const String & rNewName )
+bool SotStorage::Rename( const OUString & rEleName, const OUString & rNewName )
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
@@ -992,16 +853,12 @@ sal_Bool SotStorage::Rename( const String & rEleName, const String & rNewName )
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-/*************************************************************************
-|* SotStorage::CopyTo()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::CopyTo( const String & rEleName,
- SotStorage * pNewSt, const String & rNewName )
+bool SotStorage::CopyTo( const OUString & rEleName,
+ SotStorage * pNewSt, const OUString & rNewName )
{
DBG_ASSERT( Owner(), "must be owner" );
DBG_ASSERT( pNewSt->Owner(), "must be owner" );
@@ -1013,16 +870,12 @@ sal_Bool SotStorage::CopyTo( const String & rEleName,
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-/*************************************************************************
-|* SotStorage::MoveTo()
-|*
-|* Beschreibung
-*************************************************************************/
-sal_Bool SotStorage::MoveTo( const String & rEleName,
- SotStorage * pNewSt, const String & rNewName )
+bool SotStorage::MoveTo( const OUString & rEleName,
+ SotStorage * pNewSt, const OUString & rNewName )
{
DBG_ASSERT( Owner(), "must be owner" );
DBG_ASSERT( pNewSt->Owner(), "must be owner" );
@@ -1034,36 +887,37 @@ sal_Bool SotStorage::MoveTo( const String & rEleName,
}
else
SetError( SVSTREAM_GENERALERROR );
+
return SVSTREAM_OK == GetError();
}
-sal_Bool SotStorage::Validate()
+bool SotStorage::Validate()
{
DBG_ASSERT( m_bIsRoot, "Validate nur an Rootstorage" );
if( m_pOwnStg )
return m_pOwnStg->ValidateFAT();
else
- return sal_True;
+ return true;
}
-sal_Bool SotStorage::IsOLEStorage() const
+bool SotStorage::IsOLEStorage() const
{
UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg );
return !pStg;
}
-sal_Bool SotStorage::IsOLEStorage( const String & rFileName )
+bool SotStorage::IsOLEStorage( const OUString & rFileName )
{
return Storage::IsStorageFile( rFileName );
}
-sal_Bool SotStorage::IsOLEStorage( SvStream* pStream )
+bool SotStorage::IsOLEStorage( SvStream* pStream )
{
return Storage::IsStorageFile( pStream );
}
SotStorage* SotStorage::OpenOLEStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage,
- const String& rEleName, StreamMode nMode )
+ const OUString& rEleName, StreamMode nMode )
{
sal_Int32 nEleMode = embed::ElementModes::SEEKABLEREAD;
if ( nMode & STREAM_WRITE )
@@ -1096,7 +950,7 @@ SotStorage* SotStorage::OpenOLEStorage( const com::sun::star::uno::Reference < c
pStream->SetError( ERRCODE_IO_GENERAL );
}
- return new SotStorage( pStream, sal_True );
+ return new SotStorage( pStream, true );
}
sal_Int32 SotStorage::GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage )
@@ -1122,30 +976,30 @@ sal_Int32 SotStorage::GetVersion( const com::sun::star::uno::Reference < com::su
sal_Int32 nSotFormatID = SotStorage::GetFormatID( xStorage );
switch( nSotFormatID )
{
- case SOT_FORMATSTR_ID_STARWRITER_8:
- case SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE:
- case SOT_FORMATSTR_ID_STARWRITERWEB_8:
- case SOT_FORMATSTR_ID_STARWRITERGLOB_8:
- case SOT_FORMATSTR_ID_STARDRAW_8:
- case SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE:
- case SOT_FORMATSTR_ID_STARIMPRESS_8:
- case SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE:
- case SOT_FORMATSTR_ID_STARCALC_8:
- case SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE:
- case SOT_FORMATSTR_ID_STARCHART_8:
- case SOT_FORMATSTR_ID_STARCHART_8_TEMPLATE:
- case SOT_FORMATSTR_ID_STARMATH_8:
- case SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE:
- return SOFFICE_FILEFORMAT_8;
- case SOT_FORMATSTR_ID_STARWRITER_60:
- case SOT_FORMATSTR_ID_STARWRITERWEB_60:
- case SOT_FORMATSTR_ID_STARWRITERGLOB_60:
- case SOT_FORMATSTR_ID_STARDRAW_60:
- case SOT_FORMATSTR_ID_STARIMPRESS_60:
- case SOT_FORMATSTR_ID_STARCALC_60:
- case SOT_FORMATSTR_ID_STARCHART_60:
- case SOT_FORMATSTR_ID_STARMATH_60:
- return SOFFICE_FILEFORMAT_60;
+ case SOT_FORMATSTR_ID_STARWRITER_8:
+ case SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE:
+ case SOT_FORMATSTR_ID_STARWRITERWEB_8:
+ case SOT_FORMATSTR_ID_STARWRITERGLOB_8:
+ case SOT_FORMATSTR_ID_STARDRAW_8:
+ case SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE:
+ case SOT_FORMATSTR_ID_STARIMPRESS_8:
+ case SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE:
+ case SOT_FORMATSTR_ID_STARCALC_8:
+ case SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE:
+ case SOT_FORMATSTR_ID_STARCHART_8:
+ case SOT_FORMATSTR_ID_STARCHART_8_TEMPLATE:
+ case SOT_FORMATSTR_ID_STARMATH_8:
+ case SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE:
+ return SOFFICE_FILEFORMAT_8;
+ case SOT_FORMATSTR_ID_STARWRITER_60:
+ case SOT_FORMATSTR_ID_STARWRITERWEB_60:
+ case SOT_FORMATSTR_ID_STARWRITERGLOB_60:
+ case SOT_FORMATSTR_ID_STARDRAW_60:
+ case SOT_FORMATSTR_ID_STARIMPRESS_60:
+ case SOT_FORMATSTR_ID_STARCALC_60:
+ case SOT_FORMATSTR_ID_STARCHART_60:
+ case SOT_FORMATSTR_ID_STARMATH_60:
+ return SOFFICE_FILEFORMAT_60;
}
return 0;
diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx
index 34a664fde425..bd785d96902d 100644
--- a/sot/source/sdstor/storinfo.cxx
+++ b/sot/source/sdstor/storinfo.cxx
@@ -66,22 +66,26 @@ sal_uLong ReadClipboardFormat( SvStream & rStm )
void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat )
{
// determine the clipboard format string
- String aCbFmt;
+ OUString aCbFmt;
if( nFormat > FORMAT_GDIMETAFILE )
aCbFmt = SotExchange::GetFormatName( nFormat );
- if( aCbFmt.Len() )
+ if( !aCbFmt.isEmpty() )
{
OString aAsciiCbFmt(OUStringToOString(aCbFmt,
- RTL_TEXTENCODING_ASCII_US));
+ RTL_TEXTENCODING_ASCII_US));
rStm << (sal_Int32) (aAsciiCbFmt.getLength() + 1);
rStm << (const char *)aAsciiCbFmt.getStr();
rStm << (sal_uInt8) 0;
}
else if( nFormat )
+ {
rStm << (sal_Int32) -1 // for Windows
<< (sal_Int32) nFormat;
+ }
else
+ {
rStm << (sal_Int32) 0; // no clipboard format
+ }
}
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index f36304414424..0e428dab4b25 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -83,11 +83,11 @@ class FileStreamWrapper_Impl : public FileInputStreamWrapper_Base
{
protected:
::osl::Mutex m_aMutex;
- String m_aURL;
+ OUString m_aURL;
SvStream* m_pSvStream;
public:
- FileStreamWrapper_Impl( const String& rName );
+ FileStreamWrapper_Impl( const OUString& rName );
virtual ~FileStreamWrapper_Impl();
virtual void SAL_CALL seek( sal_Int64 _nLocation ) throw ( IllegalArgumentException, IOException, RuntimeException);
@@ -105,7 +105,7 @@ protected:
};
//------------------------------------------------------------------
-FileStreamWrapper_Impl::FileStreamWrapper_Impl( const String& rName )
+FileStreamWrapper_Impl::FileStreamWrapper_Impl( const OUString& rName )
: m_aURL( rName )
, m_pSvStream(0)
{
@@ -123,7 +123,7 @@ FileStreamWrapper_Impl::~FileStreamWrapper_Impl()
#endif
}
- if ( m_aURL.Len() )
+ if ( !m_aURL.isEmpty() )
::utl::UCBContentHelper::Kill( m_aURL );
}
@@ -131,7 +131,7 @@ FileStreamWrapper_Impl::~FileStreamWrapper_Impl()
sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
throw( NotConnectedException, BufferSizeExceededException, RuntimeException )
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
{
aData.realloc( 0 );
return 0;
@@ -159,7 +159,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
//------------------------------------------------------------------------------
sal_Int32 SAL_CALL FileStreamWrapper_Impl::readSomeBytes(Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( NotConnectedException, BufferSizeExceededException, RuntimeException )
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
{
aData.realloc( 0 );
return 0;
@@ -182,7 +182,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readSomeBytes(Sequence< sal_Int8 >& a
//------------------------------------------------------------------------------
void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 nBytesToSkip) throw( NotConnectedException, BufferSizeExceededException, RuntimeException )
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
return;
::osl::MutexGuard aGuard( m_aMutex );
@@ -195,7 +195,7 @@ void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 nBytesToSkip) throw( N
//------------------------------------------------------------------------------
sal_Int32 SAL_CALL FileStreamWrapper_Impl::available() throw( NotConnectedException, RuntimeException )
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
return 0;
::osl::MutexGuard aGuard( m_aMutex );
@@ -217,7 +217,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::available() throw( NotConnectedExcept
//------------------------------------------------------------------------------
void SAL_CALL FileStreamWrapper_Impl::closeInput() throw( NotConnectedException, RuntimeException )
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
return;
::osl::MutexGuard aGuard( m_aMutex );
@@ -227,13 +227,13 @@ void SAL_CALL FileStreamWrapper_Impl::closeInput() throw( NotConnectedException,
--nOpenFiles;
#endif
::utl::UCBContentHelper::Kill( m_aURL );
- m_aURL.Erase();
+ m_aURL = "";
}
//------------------------------------------------------------------------------
void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation ) throw (IllegalArgumentException, IOException, RuntimeException)
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
return;
::osl::MutexGuard aGuard( m_aMutex );
@@ -246,7 +246,7 @@ void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation ) throw (Illega
//------------------------------------------------------------------------------
sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( ) throw (IOException, RuntimeException)
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
return 0;
::osl::MutexGuard aGuard( m_aMutex );
@@ -260,7 +260,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( ) throw (IOException, R
//------------------------------------------------------------------------------
sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( ) throw (IOException, RuntimeException)
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
return 0;
::osl::MutexGuard aGuard( m_aMutex );
@@ -281,7 +281,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( ) throw (IOException, Run
//------------------------------------------------------------------------------
void FileStreamWrapper_Impl::checkConnected()
{
- if ( !m_aURL.Len() )
+ if ( m_aURL.isEmpty() )
throw NotConnectedException(OUString(), const_cast<XWeak*>(static_cast<const XWeak*>(this)));
if ( !m_pSvStream )
{
@@ -404,52 +404,53 @@ class UCBStorageStream_Impl : public SvRefBase, public SvStream
~UCBStorageStream_Impl();
public:
- virtual sal_uLong GetData( void* pData, sal_uLong nSize );
- virtual sal_uLong PutData( const void* pData, sal_uLong nSize );
- virtual sal_uLong SeekPos( sal_uLong nPos );
+ virtual sal_uLong GetData( void* pData, sal_uLong nSize );
+ virtual sal_uLong PutData( const void* pData, sal_uLong nSize );
+ virtual sal_uLong SeekPos( sal_uLong nPos );
virtual void SetSize( sal_uLong nSize );
virtual void FlushData();
virtual void ResetError();
UCBStorageStream* m_pAntiImpl; // only valid if an external reference exists
- String m_aOriginalName;// the original name before accessing the stream
- String m_aName; // the actual name ( changed with a Rename command at the parent )
- String m_aURL; // the full path name to create the content
- String m_aContentType;
- String m_aOriginalContentType;
- OString m_aKey;
+ OUString m_aOriginalName;// the original name before accessing the stream
+ OUString m_aName; // the actual name ( changed with a Rename command at the parent )
+ OUString m_aURL; // the full path name to create the content
+ OUString m_aContentType;
+ OUString m_aOriginalContentType;
+ OString m_aKey;
::ucbhelper::Content* m_pContent; // the content that provides the data
Reference<XInputStream> m_rSource; // the stream covering the original data of the content
SvStream* m_pStream; // the stream worked on; for readonly streams it is the original stream of the content
// for read/write streams it's a copy into a temporary file
- String m_aTempURL; // URL of this temporary stream
+ OUString m_aTempURL; // URL of this temporary stream
RepresentModes m_nRepresentMode; // should it be used as XInputStream or as SvStream
long m_nError;
StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing )
- sal_Bool m_bSourceRead; // Source still contains useful information
- sal_Bool m_bModified; // only modified streams will be sent to the original content
- sal_Bool m_bCommited; // sending the streams is coordinated by the root storage of the package
- sal_Bool m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages
+ bool m_bSourceRead; // Source still contains useful information
+ bool m_bModified; // only modified streams will be sent to the original content
+ bool m_bCommited; // sending the streams is coordinated by the root storage of the package
+ bool m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages
// this means that the root storage does an autocommit when its external
// reference is destroyed
- sal_Bool m_bIsOLEStorage;// an OLEStorage on a UCBStorageStream makes this an Autocommit-stream
+ bool m_bIsOLEStorage;// an OLEStorage on a UCBStorageStream makes this an Autocommit-stream
- UCBStorageStream_Impl( const String&, StreamMode, UCBStorageStream*, sal_Bool, const OString* pKey=0, sal_Bool bRepair = sal_False, Reference< XProgressHandler > xProgress = Reference< XProgressHandler >() );
+ UCBStorageStream_Impl( const OUString&, StreamMode, UCBStorageStream*, bool, const OString* pKey=0,
+ bool bRepair = false, Reference< XProgressHandler > xProgress = Reference< XProgressHandler >() );
void Free();
- sal_Bool Init();
- sal_Bool Clear();
+ bool Init();
+ bool Clear();
sal_Int16 Commit(); // if modified and commited: transfer an XInputStream to the content
- sal_Bool Revert(); // discard all changes
+ bool Revert(); // discard all changes
BaseStorage* CreateStorage();// create an OLE Storage on the UCBStorageStream
- sal_uLong GetSize();
+ sal_uLong GetSize();
- sal_uLong ReadSourceWriteTemporary( sal_uLong aLength ); // read aLength from source and copy to temporary,
+ sal_uLong ReadSourceWriteTemporary( sal_uLong aLength ); // read aLength from source and copy to temporary,
// no seeking is produced
- sal_uLong ReadSourceWriteTemporary(); // read source till the end and copy to temporary,
+ sal_uLong ReadSourceWriteTemporary(); // read source till the end and copy to temporary,
- sal_uLong CopySourceToTemporary(); // same as ReadSourceWriteToTemporary()
+ sal_uLong CopySourceToTemporary(); // same as ReadSourceWriteToTemporary()
// but the writing is done at the end of temporary
// pointer position is not changed
using SvStream::SetError;
@@ -468,45 +469,47 @@ class UCBStorage_Impl : public SvRefBase
public:
UCBStorage* m_pAntiImpl; // only valid if external references exists
- String m_aOriginalName;// the original name before accessing the storage
- String m_aName; // the actual name ( changed with a Rename command at the parent )
- String m_aURL; // the full path name to create the content
- String m_aContentType;
- String m_aOriginalContentType;
+ OUString m_aOriginalName;// the original name before accessing the storage
+ OUString m_aName; // the actual name ( changed with a Rename command at the parent )
+ OUString m_aURL; // the full path name to create the content
+ OUString m_aContentType;
+ OUString m_aOriginalContentType;
::ucbhelper::Content* m_pContent; // the content that provides the storage elements
::utl::TempFile* m_pTempFile; // temporary file, only for storages on stream
SvStream* m_pSource; // original stream, only for storages on a stream
long m_nError;
StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing )
- sal_Bool m_bModified; // only modified elements will be sent to the original content
- sal_Bool m_bCommited; // sending the streams is coordinated by the root storage of the package
- sal_Bool m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages
+ bool m_bModified; // only modified elements will be sent to the original content
+ bool m_bCommited; // sending the streams is coordinated by the root storage of the package
+ bool m_bDirect; // the storage and its streams are opened in direct mode; for UCBStorages
// this means that the root storage does an autocommit when its external
// reference is destroyed
- sal_Bool m_bIsRoot; // marks this storage as root storages that manages all oommits and reverts
- sal_Bool m_bDirty; // ???
- sal_Bool m_bIsLinked;
- sal_Bool m_bListCreated;
- sal_uLong m_nFormat;
- String m_aUserTypeName;
+ bool m_bIsRoot; // marks this storage as root storages that manages all oommits and reverts
+ bool m_bDirty; // ???
+ bool m_bIsLinked;
+ bool m_bListCreated;
+ sal_uLong m_nFormat;
+ OUString m_aUserTypeName;
SvGlobalName m_aClassId;
UCBStorageElementList_Impl m_aChildrenList;
- sal_Bool m_bRepairPackage;
+ bool m_bRepairPackage;
Reference< XProgressHandler > m_xProgressHandler;
- UCBStorage_Impl( const ::ucbhelper::Content&, const String&, StreamMode, UCBStorage*, sal_Bool, sal_Bool, sal_Bool = sal_False, Reference< XProgressHandler > = Reference< XProgressHandler >() );
- UCBStorage_Impl( const String&, StreamMode, UCBStorage*, sal_Bool, sal_Bool, sal_Bool = sal_False, Reference< XProgressHandler > = Reference< XProgressHandler >() );
- UCBStorage_Impl( SvStream&, UCBStorage*, sal_Bool );
+ UCBStorage_Impl( const ::ucbhelper::Content&, const OUString&, StreamMode, UCBStorage*, bool,
+ bool, bool = false, Reference< XProgressHandler > = Reference< XProgressHandler >() );
+ UCBStorage_Impl( const OUString&, StreamMode, UCBStorage*, bool, bool,
+ bool = false, Reference< XProgressHandler > = Reference< XProgressHandler >() );
+ UCBStorage_Impl( SvStream&, UCBStorage*, bool );
void Init();
sal_Int16 Commit();
- sal_Bool Revert();
- sal_Bool Insert( ::ucbhelper::Content *pContent );
+ bool Revert();
+ bool Insert( ::ucbhelper::Content *pContent );
UCBStorage_Impl* OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect );
- UCBStorageStream_Impl* OpenStream( UCBStorageElement_Impl*, StreamMode, sal_Bool, const OString* pKey=0 );
- void SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const String& );
- void GetProps( sal_Int32&, Sequence < Sequence < PropertyValue > >& rSequence, const String& );
+ UCBStorageStream_Impl* OpenStream( UCBStorageElement_Impl*, StreamMode, bool, const OString* pKey=0 );
+ void SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& );
+ void GetProps( sal_Int32&, Sequence < Sequence < PropertyValue > >& rSequence, const OUString& );
sal_Int32 GetObjectCount();
void ReadContent();
void CreateContent();
@@ -537,34 +540,34 @@ SV_DECL_IMPL_REF( UCBStorage_Impl );
// this struct contains all necessary information on an element inside a UCBStorage
struct UCBStorageElement_Impl
{
- String m_aName; // the actual URL relative to the root "folder"
- String m_aOriginalName;// the original name in the content
- sal_uLong m_nSize;
- sal_Bool m_bIsFolder; // Only sal_True when it is a UCBStorage !
- sal_Bool m_bIsStorage; // Also sal_True when it is an OLEStorage !
- sal_Bool m_bIsRemoved; // element will be removed on commit
- sal_Bool m_bIsInserted; // element will be removed on revert
+ OUString m_aName; // the actual URL relative to the root "folder"
+ OUString m_aOriginalName;// the original name in the content
+ sal_uLong m_nSize;
+ bool m_bIsFolder; // Only true when it is a UCBStorage !
+ bool m_bIsStorage; // Also true when it is an OLEStorage !
+ bool m_bIsRemoved; // element will be removed on commit
+ bool m_bIsInserted; // element will be removed on revert
UCBStorage_ImplRef m_xStorage; // reference to the "real" storage
UCBStorageStream_ImplRef m_xStream; // reference to the "real" stream
UCBStorageElement_Impl( const OUString& rName,
- sal_Bool bIsFolder = sal_False, sal_uLong nSize = 0 )
+ bool bIsFolder = false, sal_uLong nSize = 0 )
: m_aName( rName )
, m_aOriginalName( rName )
, m_nSize( nSize )
, m_bIsFolder( bIsFolder )
, m_bIsStorage( bIsFolder )
- , m_bIsRemoved( sal_False )
- , m_bIsInserted( sal_False )
+ , m_bIsRemoved( false )
+ , m_bIsInserted( false )
{
}
::ucbhelper::Content* GetContent();
- sal_Bool IsModified();
- String GetContentType();
- void SetContentType( const String& );
- String GetOriginalContentType();
- sal_Bool IsLoaded()
+ bool IsModified();
+ OUString GetContentType();
+ void SetContentType( const OUString& );
+ OUString GetOriginalContentType();
+ bool IsLoaded()
{ return m_xStream.Is() || m_xStorage.Is(); }
};
@@ -578,7 +581,7 @@ struct UCBStorageElement_Impl
return NULL;
}
-String UCBStorageElement_Impl::GetContentType()
+OUString UCBStorageElement_Impl::GetContentType()
{
if ( m_xStream.Is() )
return m_xStream->m_aContentType;
@@ -587,11 +590,11 @@ String UCBStorageElement_Impl::GetContentType()
else
{
OSL_FAIL("Element not loaded!");
- return String();
+ return OUString();
}
}
-void UCBStorageElement_Impl::SetContentType( const String& rType )
+void UCBStorageElement_Impl::SetContentType( const OUString& rType )
{
if ( m_xStream.Is() ) {
m_xStream->m_aContentType = m_xStream->m_aOriginalContentType = rType;
@@ -604,19 +607,19 @@ void UCBStorageElement_Impl::SetContentType( const String& rType )
}
}
-String UCBStorageElement_Impl::GetOriginalContentType()
+OUString UCBStorageElement_Impl::GetOriginalContentType()
{
if ( m_xStream.Is() )
return m_xStream->m_aOriginalContentType;
else if ( m_xStorage.Is() )
return m_xStorage->m_aOriginalContentType;
else
- return String();
+ return OUString();
}
-sal_Bool UCBStorageElement_Impl::IsModified()
+bool UCBStorageElement_Impl::IsModified()
{
- sal_Bool bModified = m_bIsRemoved || m_bIsInserted || m_aName != m_aOriginalName;
+ bool bModified = m_bIsRemoved || m_bIsInserted || m_aName != m_aOriginalName;
if ( bModified )
{
if ( m_xStream.Is() )
@@ -628,7 +631,7 @@ sal_Bool UCBStorageElement_Impl::IsModified()
return bModified;
}
-UCBStorageStream_Impl::UCBStorageStream_Impl( const String& rName, StreamMode nMode, UCBStorageStream* pStream, sal_Bool bDirect, const OString* pKey, sal_Bool bRepair, Reference< XProgressHandler > xProgress )
+UCBStorageStream_Impl::UCBStorageStream_Impl( const OUString& rName, StreamMode nMode, UCBStorageStream* pStream, bool bDirect, const OString* pKey, bool bRepair, Reference< XProgressHandler > xProgress )
: m_pAntiImpl( pStream )
, m_aURL( rName )
, m_pContent( NULL )
@@ -637,10 +640,10 @@ UCBStorageStream_Impl::UCBStorageStream_Impl( const String& rName, StreamMode nM
, m_nError( 0 )
, m_nMode( nMode )
, m_bSourceRead( !( nMode & STREAM_TRUNC ) )
- , m_bModified( sal_False )
- , m_bCommited( sal_False )
+ , m_bModified( false )
+ , m_bCommited( false )
, m_bDirect( bDirect )
- , m_bIsOLEStorage( sal_False )
+ , m_bIsOLEStorage( false )
{
// name is last segment in URL
INetURLObject aObj( rName );
@@ -698,7 +701,7 @@ UCBStorageStream_Impl::~UCBStorageStream_Impl()
if( m_pStream )
delete m_pStream;
- if ( m_aTempURL.Len() )
+ if ( !m_aTempURL.isEmpty() )
::utl::UCBContentHelper::Kill( m_aTempURL );
if( m_pContent )
@@ -706,13 +709,13 @@ UCBStorageStream_Impl::~UCBStorageStream_Impl()
}
-sal_Bool UCBStorageStream_Impl::Init()
+bool UCBStorageStream_Impl::Init()
{
if( m_nRepresentMode == xinputstream )
{
OSL_FAIL( "XInputStream misuse!" );
SetError( ERRCODE_IO_ACCESSDENIED );
- return sal_False;
+ return false;
}
if( !m_pStream )
@@ -722,10 +725,10 @@ sal_Bool UCBStorageStream_Impl::Init()
m_nRepresentMode = svstream; // can not be used as XInputStream
- if ( !m_aTempURL.Len() )
+ if ( m_aTempURL.isEmpty() )
m_aTempURL = ::utl::TempFile().GetURL();
- m_pStream = ::utl::UcbStreamHelper::CreateStream( m_aTempURL, STREAM_STD_READWRITE, sal_True /* bFileExists */ );
+ m_pStream = ::utl::UcbStreamHelper::CreateStream( m_aTempURL, STREAM_STD_READWRITE, true /* bFileExists */ );
#if OSL_DEBUG_LEVEL > 1
++nOpenFiles;
#endif
@@ -734,7 +737,7 @@ sal_Bool UCBStorageStream_Impl::Init()
{
OSL_FAIL( "Suspicious temporary stream creation!" );
SetError( SVSTREAM_CANNOT_MAKE );
- return sal_False;
+ return false;
}
SetError( m_pStream->GetError() );
@@ -765,12 +768,12 @@ sal_Bool UCBStorageStream_Impl::Init()
catch (const BufferSizeExceededException&)
{
// the temporary stream already contain all the data
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
}
catch (const Exception&)
{
// something is really wrong
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
OSL_FAIL( "Can not operate original stream!" );
SetError( SVSTREAM_CANNOT_MAKE );
}
@@ -780,14 +783,14 @@ sal_Bool UCBStorageStream_Impl::Init()
else
{
// if the new file is edited than no source exist
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
//SetError( SVSTREAM_CANNOT_MAKE );
}
}
DBG_ASSERT( m_rSource.is() || !m_bSourceRead, "Unreadable source stream!" );
- return sal_True;
+ return true;
}
sal_uLong UCBStorageStream_Impl::ReadSourceWriteTemporary()
@@ -817,7 +820,7 @@ sal_uLong UCBStorageStream_Impl::ReadSourceWriteTemporary()
}
}
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
return aResult;
@@ -847,7 +850,7 @@ sal_uLong UCBStorageStream_Impl::ReadSourceWriteTemporary( sal_uLong aLength )
}
if( aResult < aLength )
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
}
catch( const Exception & e )
{
@@ -910,7 +913,7 @@ sal_uLong UCBStorageStream_Impl::GetData( void* pData, sal_uLong nSize )
}
if( aResult < nSize )
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
}
return aResult;
@@ -971,7 +974,7 @@ sal_uLong UCBStorageStream_Impl::SeekPos( sal_uLong nPos )
{
aResult += ReadSourceWriteTemporary( nPos - aResult );
if( aResult < nPos )
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
DBG_ASSERT( aResult == m_pStream->Tell(), "Error in stream arithmetic!\n" );
}
@@ -1003,7 +1006,7 @@ void UCBStorageStream_Impl::SetSize( sal_uLong nSize )
if( !Init() )
return;
- m_bModified = sal_True;
+ m_bModified = true;
if( m_bSourceRead )
{
@@ -1015,7 +1018,7 @@ void UCBStorageStream_Impl::SetSize( sal_uLong nSize )
}
m_pStream->SetStreamSize( nSize );
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
}
void UCBStorageStream_Impl::FlushData()
@@ -1026,7 +1029,7 @@ void UCBStorageStream_Impl::FlushData()
m_pStream->Flush();
}
- m_bCommited = sal_True;
+ m_bCommited = true;
}
void UCBStorageStream_Impl::SetError( sal_uInt32 nErr )
@@ -1095,8 +1098,8 @@ sal_Int16 UCBStorageStream_Impl::Commit()
Free();
// the temporary file does not exist only for truncated streams
- DBG_ASSERT( m_aTempURL.Len() || ( m_nMode & STREAM_TRUNC ), "No temporary file to read from!");
- if ( !m_aTempURL.Len() && !( m_nMode & STREAM_TRUNC ) )
+ DBG_ASSERT( !m_aTempURL.isEmpty() || ( m_nMode & STREAM_TRUNC ), "No temporary file to read from!");
+ if ( m_aTempURL.isEmpty() && !( m_nMode & STREAM_TRUNC ) )
throw RuntimeException();
// create wrapper to stream that is only used while reading inside package component
@@ -1105,18 +1108,18 @@ sal_Int16 UCBStorageStream_Impl::Commit()
Any aAny;
InsertCommandArgument aArg;
aArg.Data = xStream;
- aArg.ReplaceExisting = sal_True;
+ aArg.ReplaceExisting = true;
aAny <<= aArg;
m_pContent->executeCommand( OUString("insert"), aAny );
// wrapper now controls lifetime of temporary file
- m_aTempURL.Erase();
+ m_aTempURL = "";
INetURLObject aObj( m_aURL );
aObj.SetName( m_aName );
m_aURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
- m_bModified = sal_False;
- m_bSourceRead = sal_True;
+ m_bModified = false;
+ m_bSourceRead = true;
}
catch (const CommandAbortedException&)
{
@@ -1137,7 +1140,7 @@ sal_Int16 UCBStorageStream_Impl::Commit()
return COMMIT_RESULT_FAILURE;
}
- m_bCommited = sal_False;
+ m_bCommited = false;
return COMMIT_RESULT_SUCCESS;
}
}
@@ -1145,23 +1148,23 @@ sal_Int16 UCBStorageStream_Impl::Commit()
return COMMIT_RESULT_NOTHING_TO_DO;
}
-sal_Bool UCBStorageStream_Impl::Revert()
+bool UCBStorageStream_Impl::Revert()
{
// if an OLEStorage is created on this stream, no "revert" is necessary because OLEStorages do nothing on "Revert" !
if ( m_bCommited )
{
OSL_FAIL("Revert while commit is in progress!" );
- return sal_False; // ???
+ return false; // ???
}
Free();
- if ( m_aTempURL.Len() )
+ if ( !m_aTempURL.isEmpty() )
{
::utl::UCBContentHelper::Kill( m_aTempURL );
- m_aTempURL.Erase();
+ m_aTempURL = "";
}
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
try
{
m_rSource = m_pContent->openStream();
@@ -1169,11 +1172,11 @@ sal_Bool UCBStorageStream_Impl::Revert()
{
if ( m_pAntiImpl && ( m_nMode & STREAM_TRUNC ) )
// stream is in use and should be truncated
- m_bSourceRead = sal_False;
+ m_bSourceRead = false;
else
{
m_nMode &= ~STREAM_TRUNC;
- m_bSourceRead = sal_True;
+ m_bSourceRead = true;
}
}
else
@@ -1191,15 +1194,15 @@ sal_Bool UCBStorageStream_Impl::Revert()
{
}
- m_bModified = sal_False;
+ m_bModified = false;
m_aName = m_aOriginalName;
m_aContentType = m_aOriginalContentType;
return ( GetError() == ERRCODE_NONE );
}
-sal_Bool UCBStorageStream_Impl::Clear()
+bool UCBStorageStream_Impl::Clear()
{
- sal_Bool bRet = ( m_pAntiImpl == NULL );
+ bool bRet = ( m_pAntiImpl == NULL );
DBG_ASSERT( bRet, "Removing used stream!" );
if( bRet )
{
@@ -1214,7 +1217,7 @@ void UCBStorageStream_Impl::Free()
#if OSL_DEBUG_LEVEL > 1
if ( m_pStream )
{
- if ( m_aTempURL.Len() )
+ if ( !m_aTempURL.isEmpty() )
--nOpenFiles;
else
--nOpenStreams;
@@ -1228,7 +1231,7 @@ void UCBStorageStream_Impl::Free()
void UCBStorageStream_Impl::PrepareCachedForReopen( StreamMode nMode )
{
- sal_Bool isWritable = (( m_nMode & STREAM_WRITE ) != 0 );
+ bool isWritable = (( m_nMode & STREAM_WRITE ) != 0 );
if ( isWritable )
{
// once stream was writable, never reset to readonly
@@ -1242,15 +1245,15 @@ void UCBStorageStream_Impl::PrepareCachedForReopen( StreamMode nMode )
{
m_bSourceRead = 0; // usually it should be 0 already but just in case...
- if ( m_aTempURL.Len() )
+ if ( !m_aTempURL.isEmpty() )
{
::utl::UCBContentHelper::Kill( m_aTempURL );
- m_aTempURL.Erase();
+ m_aTempURL = "";
}
}
}
-UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const OString* pKey, sal_Bool bRepair, Reference< XProgressHandler > xProgress )
+UCBStorageStream::UCBStorageStream( const OUString& rName, StreamMode nMode, bool bDirect, const OString* pKey, bool bRepair, Reference< XProgressHandler > xProgress )
{
// pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized
// to class UCBStorageStream !
@@ -1307,22 +1310,22 @@ void UCBStorageStream::Flush()
Commit();
}
-sal_Bool UCBStorageStream::SetSize( sal_uLong nNewSize )
+bool UCBStorageStream::SetSize( sal_uLong nNewSize )
{
pImp->SetSize( nNewSize );
return !pImp->GetError();
}
-sal_Bool UCBStorageStream::Validate( sal_Bool bWrite ) const
+bool UCBStorageStream::Validate( bool bWrite ) const
{
return ( !bWrite || ( pImp->m_nMode & STREAM_WRITE ) );
}
-sal_Bool UCBStorageStream::ValidateMode( StreamMode m ) const
+bool UCBStorageStream::ValidateMode( StreamMode m ) const
{
// ???
if( m == ( STREAM_READ | STREAM_TRUNC ) ) // from stg.cxx
- return sal_True;
+ return true;
sal_uInt16 nCurMode = 0xFFFF;
if( ( m & 3 ) == STREAM_READ )
{
@@ -1331,7 +1334,7 @@ sal_Bool UCBStorageStream::ValidateMode( StreamMode m ) const
&& ( nCurMode & STREAM_SHARE_DENYWRITE ) )
|| ( ( m & STREAM_SHARE_DENYALL )
&& ( nCurMode & STREAM_SHARE_DENYALL ) ) )
- return sal_True;
+ return true;
}
else
{
@@ -1340,10 +1343,10 @@ sal_Bool UCBStorageStream::ValidateMode( StreamMode m ) const
// the commit may fail
if( ( m & STREAM_SHARE_DENYALL )
&& ( nCurMode & STREAM_SHARE_DENYALL ) )
- return sal_True;
+ return true;
}
- return sal_True;
+ return true;
}
const SvStream* UCBStorageStream::GetSvStream() const
@@ -1360,28 +1363,28 @@ SvStream* UCBStorageStream::GetModifySvStream()
return (SvStream*)pImp;
}
-sal_Bool UCBStorageStream::Equals( const BaseStorageStream& rStream ) const
+bool UCBStorageStream::Equals( const BaseStorageStream& rStream ) const
{
// ???
return ((BaseStorageStream*) this ) == &rStream;
}
-sal_Bool UCBStorageStream::Commit()
+bool UCBStorageStream::Commit()
{
// mark this stream for sending it on root commit
pImp->FlushData();
- return sal_True;
+ return true;
}
-sal_Bool UCBStorageStream::Revert()
+bool UCBStorageStream::Revert()
{
return pImp->Revert();
}
-sal_Bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
+bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
{
if( !pImp->Init() )
- return sal_False;
+ return false;
UCBStorageStream* pStg = PTR_CAST( UCBStorageStream, pDestStm );
if ( pStg )
@@ -1391,7 +1394,7 @@ sal_Bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
Seek( STREAM_SEEK_TO_END );
sal_Int32 n = Tell();
if( n < 0 )
- return sal_False;
+ return false;
if( pDestStm->SetSize( n ) && n )
{
@@ -1413,15 +1416,15 @@ sal_Bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
delete[] p;
}
- return sal_True;
+ return true;
}
-sal_Bool UCBStorageStream::SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue )
+bool UCBStorageStream::SetProperty( const OUString& rName, const ::com::sun::star::uno::Any& rValue )
{
- if ( rName.CompareToAscii("Title") == COMPARE_EQUAL )
- return sal_False;
+ if ( rName == "Title")
+ return false;
- if ( rName.CompareToAscii("MediaType") == COMPARE_EQUAL )
+ if ( rName == "MediaType")
{
OUString aTmp;
rValue >>= aTmp;
@@ -1433,14 +1436,14 @@ sal_Bool UCBStorageStream::SetProperty( const String& rName, const ::com::sun::s
if ( pImp->m_pContent )
{
pImp->m_pContent->setPropertyValue( rName, rValue );
- return sal_True;
+ return true;
}
}
catch (const Exception&)
{
}
- return sal_False;
+ return false;
}
sal_uLong UCBStorageStream::GetSize() const
@@ -1448,17 +1451,17 @@ sal_uLong UCBStorageStream::GetSize() const
return pImp->GetSize();
}
-UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect )
+UCBStorage::UCBStorage( SvStream& rStrm, bool bDirect )
{
- String aURL = GetLinkedFile( rStrm );
- if ( aURL.Len() )
+ OUString aURL = GetLinkedFile( rStrm );
+ if ( !aURL.isEmpty() )
{
StreamMode nMode = STREAM_READ;
if( rStrm.IsWritable() )
nMode = STREAM_READ | STREAM_WRITE;
::ucbhelper::Content aContent( aURL, Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
- pImp = new UCBStorage_Impl( aContent, aURL, nMode, this, bDirect, sal_True );
+ pImp = new UCBStorage_Impl( aContent, aURL, nMode, this, bDirect, true );
}
else
{
@@ -1472,7 +1475,7 @@ UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect )
StorageBase::m_nMode = pImp->m_nMode;
}
-UCBStorage::UCBStorage( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, sal_Bool bDirect, sal_Bool bIsRoot )
+UCBStorage::UCBStorage( const ::ucbhelper::Content& rContent, const OUString& rName, StreamMode nMode, bool bDirect, bool bIsRoot )
{
// pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized
// to class UCBStorage !
@@ -1482,7 +1485,7 @@ UCBStorage::UCBStorage( const ::ucbhelper::Content& rContent, const String& rNam
StorageBase::m_nMode = pImp->m_nMode;
}
-UCBStorage::UCBStorage( const String& rName, StreamMode nMode, sal_Bool bDirect, sal_Bool bIsRoot, sal_Bool bIsRepair, Reference< XProgressHandler > xProgressHandler )
+UCBStorage::UCBStorage( const OUString& rName, StreamMode nMode, bool bDirect, bool bIsRoot, bool bIsRepair, Reference< XProgressHandler > xProgressHandler )
{
// pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized
// to class UCBStorage !
@@ -1492,11 +1495,11 @@ UCBStorage::UCBStorage( const String& rName, StreamMode nMode, sal_Bool bDirect,
StorageBase::m_nMode = pImp->m_nMode;
}
-UCBStorage::UCBStorage( const String& rName, StreamMode nMode, sal_Bool bDirect, sal_Bool bIsRoot )
+UCBStorage::UCBStorage( const OUString& rName, StreamMode nMode, bool bDirect, bool bIsRoot )
{
// pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized
// to class UCBStorage !
- pImp = new UCBStorage_Impl( rName, nMode, this, bDirect, bIsRoot, sal_False, Reference< XProgressHandler >() );
+ pImp = new UCBStorage_Impl( rName, nMode, this, bDirect, bIsRoot, false, Reference< XProgressHandler >() );
pImp->AddRef();
pImp->Init();
StorageBase::m_nMode = pImp->m_nMode;
@@ -1521,7 +1524,7 @@ UCBStorage::~UCBStorage()
pImp->ReleaseRef();
}
-UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, UCBStorage* pStorage, sal_Bool bDirect, sal_Bool bIsRoot, sal_Bool bIsRepair, Reference< XProgressHandler > xProgressHandler )
+UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const OUString& rName, StreamMode nMode, UCBStorage* pStorage, bool bDirect, bool bIsRoot, bool bIsRepair, Reference< XProgressHandler > xProgressHandler )
: m_pAntiImpl( pStorage )
, m_pContent( new ::ucbhelper::Content( rContent ) )
, m_pTempFile( NULL )
@@ -1529,32 +1532,32 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const St
//, m_pStream( NULL )
, m_nError( 0 )
, m_nMode( nMode )
- , m_bModified( sal_False )
- , m_bCommited( sal_False )
+ , m_bModified( false )
+ , m_bCommited( false )
, m_bDirect( bDirect )
, m_bIsRoot( bIsRoot )
- , m_bDirty( sal_False )
- , m_bIsLinked( sal_True )
- , m_bListCreated( sal_False )
+ , m_bDirty( false )
+ , m_bIsLinked( true )
+ , m_bListCreated( false )
, m_nFormat( 0 )
, m_aClassId( SvGlobalName() )
, m_bRepairPackage( bIsRepair )
, m_xProgressHandler( xProgressHandler )
{
- String aName( rName );
- if( !aName.Len() )
+ OUString aName( rName );
+ if( aName.isEmpty() )
{
// no name given = use temporary name!
DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" );
m_pTempFile = new ::utl::TempFile;
- m_pTempFile->EnableKillingFile( sal_True );
+ m_pTempFile->EnableKillingFile( true );
m_aName = m_aOriginalName = aName = m_pTempFile->GetURL();
}
m_aURL = rName;
}
-UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStorage* pStorage, sal_Bool bDirect, sal_Bool bIsRoot, sal_Bool bIsRepair, Reference< XProgressHandler > xProgressHandler )
+UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBStorage* pStorage, bool bDirect, bool bIsRoot, bool bIsRepair, Reference< XProgressHandler > xProgressHandler )
: m_pAntiImpl( pStorage )
, m_pContent( NULL )
, m_pTempFile( NULL )
@@ -1562,33 +1565,33 @@ UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStor
//, m_pStream( NULL )
, m_nError( 0 )
, m_nMode( nMode )
- , m_bModified( sal_False )
- , m_bCommited( sal_False )
+ , m_bModified( false )
+ , m_bCommited( false )
, m_bDirect( bDirect )
, m_bIsRoot( bIsRoot )
- , m_bDirty( sal_False )
- , m_bIsLinked( sal_False )
- , m_bListCreated( sal_False )
+ , m_bDirty( false )
+ , m_bIsLinked( false )
+ , m_bListCreated( false )
, m_nFormat( 0 )
, m_aClassId( SvGlobalName() )
, m_bRepairPackage( bIsRepair )
, m_xProgressHandler( xProgressHandler )
{
- String aName( rName );
- if( !aName.Len() )
+ OUString aName( rName );
+ if( aName.isEmpty() )
{
// no name given = use temporary name!
DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" );
m_pTempFile = new ::utl::TempFile;
- m_pTempFile->EnableKillingFile( sal_True );
+ m_pTempFile->EnableKillingFile( true );
m_aName = m_aOriginalName = aName = m_pTempFile->GetURL();
}
if ( m_bIsRoot )
{
// create the special package URL for the package content
- String aTemp = OUString("vnd.sun.star.pkg://");
- aTemp += String(INetURLObject::encode( aName, INetURLObject::PART_AUTHORITY, '%', INetURLObject::ENCODE_ALL ));
+ OUString aTemp = OUString("vnd.sun.star.pkg://");
+ aTemp += OUString(INetURLObject::encode( aName, INetURLObject::PART_AUTHORITY, '%', INetURLObject::ENCODE_ALL ));
m_aURL = aTemp;
if ( m_nMode & STREAM_WRITE )
@@ -1602,42 +1605,42 @@ UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStor
{
// substorages are opened like streams: the URL is a "child URL" of the root package URL
m_aURL = rName;
- if ( m_aURL.CompareToAscii( "vnd.sun.star.pkg://", 19 ) != 0 )
- m_bIsLinked = sal_True;
+ if ( !m_aURL.startsWith( "vnd.sun.star.pkg://") )
+ m_bIsLinked = true;
}
}
-UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, sal_Bool bDirect )
+UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool bDirect )
: m_pAntiImpl( pStorage )
, m_pContent( NULL )
, m_pTempFile( new ::utl::TempFile )
, m_pSource( &rStream )
, m_nError( 0 )
- , m_bModified( sal_False )
- , m_bCommited( sal_False )
+ , m_bModified( false )
+ , m_bCommited( false )
, m_bDirect( bDirect )
- , m_bIsRoot( sal_True )
- , m_bDirty( sal_False )
- , m_bIsLinked( sal_False )
- , m_bListCreated( sal_False )
+ , m_bIsRoot( true )
+ , m_bDirty( false )
+ , m_bIsLinked( false )
+ , m_bListCreated( false )
, m_nFormat( 0 )
, m_aClassId( SvGlobalName() )
- , m_bRepairPackage( sal_False )
+ , m_bRepairPackage( false )
{
// opening in direct mode is too fuzzy because the data is transferred to the stream in the Commit() call,
// which will be called in the storages' dtor
- m_pTempFile->EnableKillingFile( sal_True );
+ m_pTempFile->EnableKillingFile( true );
DBG_ASSERT( !bDirect, "Storage on a stream must not be opened in direct mode!" );
// UCBStorages work on a content, so a temporary file for a content must be created, even if the stream is only
// accessed readonly
// the root storage opens the package; create the special package URL for the package content
- String aTemp = OUString("vnd.sun.star.pkg://");
- aTemp += String(INetURLObject::encode( m_pTempFile->GetURL(), INetURLObject::PART_AUTHORITY, '%', INetURLObject::ENCODE_ALL ));
+ OUString aTemp = OUString("vnd.sun.star.pkg://");
+ aTemp += OUString(INetURLObject::encode( m_pTempFile->GetURL(), INetURLObject::PART_AUTHORITY, '%', INetURLObject::ENCODE_ALL ));
m_aURL = aTemp;
// copy data into the temporary file
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( m_pTempFile->GetURL(), STREAM_STD_READWRITE, sal_True /* bFileExists */ );
+ SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( m_pTempFile->GetURL(), STREAM_STD_READWRITE, true /* bFileExists */ );
if ( pStream )
{
rStream.Seek(0);
@@ -1659,7 +1662,7 @@ void UCBStorage_Impl::Init()
{
// name is last segment in URL
INetURLObject aObj( m_aURL );
- if ( !m_aName.Len() )
+ if ( m_aName.isEmpty() )
// if the name was not already set to a temp name
m_aName = m_aOriginalName = aObj.GetLastName();
@@ -1683,8 +1686,8 @@ void UCBStorage_Impl::Init()
if ( m_nError == ERRCODE_NONE )
{
// read the manifest.xml file
- aObj.Append( String( "META-INF" ) );
- aObj.Append( String( "manifest.xml" ) );
+ aObj.Append( OUString( "META-INF" ) );
+ aObj.Append( OUString( "manifest.xml" ) );
// create input stream
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READ );
@@ -1705,7 +1708,7 @@ void UCBStorage_Impl::Init()
// cleanup
xReader = NULL;
xInputStream = NULL;
- SetProps( aProps, String() );
+ SetProps( aProps, OUString() );
}
delete pStream;
@@ -1726,13 +1729,13 @@ void UCBStorage_Impl::Init()
}
catch (const Exception&)
{
- DBG_ASSERT( sal_False,
+ DBG_ASSERT( false,
"getPropertyValue has thrown an exception! Please let developers know the scenario!" );
}
}
}
- if ( m_aContentType.Len() )
+ if ( !m_aContentType.isEmpty() )
{
// get the clipboard format using the content type
::com::sun::star::datatransfer::DataFlavor aDataFlavor;
@@ -1786,7 +1789,7 @@ void UCBStorage_Impl::ReadContent()
if ( m_bListCreated )
return;
- m_bListCreated = sal_True;
+ m_bListCreated = true;
// create cursor for access to children
Sequence< OUString > aProps(4);
@@ -1824,12 +1827,12 @@ void UCBStorage_Impl::ReadContent()
aContentType = xRow->getString(3);
}
- sal_Bool bIsFolder( xRow->getBoolean(2) );
+ bool bIsFolder( xRow->getBoolean(2) );
sal_Int64 nSize = xRow->getLong(4);
UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( aTitle, bIsFolder, (sal_uLong) nSize );
m_aChildrenList.push_back( pElement );
- sal_Bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != SvGlobalName() );
+ bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != SvGlobalName() );
if ( bIsFolder )
{
if ( m_bIsLinked )
@@ -1840,30 +1843,28 @@ void UCBStorage_Impl::ReadContent()
else if ( bIsOfficeDocument )
{
// streams can be external OLE objects, so they are now folders, but storages!
- String aName( m_aURL );
- aName += '/';
- aName += String( xRow->getString(1) );
+ OUString aName( m_aURL + OUString("/") + xRow->getString(1));
Reference< ::com::sun::star::ucb::XCommandEnvironment > xComEnv;
if ( m_bRepairPackage )
{
xComEnv = new ::ucbhelper::CommandEnvironment( Reference< ::com::sun::star::task::XInteractionHandler >(),
m_xProgressHandler );
- aName += String( "?repairpackage" );
+ aName += "?repairpackage";
}
::ucbhelper::Content aContent( aName, xComEnv, comphelper::getProcessComponentContext() );
OUString aMediaType;
Any aAny = aContent.getPropertyValue("MediaType");
- if ( ( aAny >>= aMediaType ) && ( aMediaType.compareToAscii("application/vnd.sun.star.oleobject") == 0 ) )
- pElement->m_bIsStorage = sal_True;
+ if ( ( aAny >>= aMediaType ) && ( aMediaType == "application/vnd.sun.star.oleobject" ) )
+ pElement->m_bIsStorage = true;
else if ( aMediaType.isEmpty() )
{
// older files didn't have that special content type, so they must be detected
OpenStream( pElement, STREAM_STD_READ, m_bDirect );
if ( Storage::IsStorageFile( pElement->m_xStream ) )
- pElement->m_bIsStorage = sal_True;
+ pElement->m_bIsStorage = true;
else
pElement->m_xStream->Free();
}
@@ -1930,7 +1931,7 @@ sal_Int32 UCBStorage_Impl::GetObjectCount()
OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath )
{
- sal_Bool bFound = sal_False;
+ bool bFound = false;
for ( sal_Int32 nSeqs=0; nSeqs<rSequence.getLength(); nSeqs++ )
{
const Sequence < PropertyValue >& rMyProps = rSequence[nSeqs];
@@ -1943,7 +1944,7 @@ OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, co
{
OUString aTmp;
if ( ( rAny.Value >>= aTmp ) && aTmp == rPath )
- bFound = sal_True;
+ bFound = true;
if ( !aType.isEmpty() )
break;
}
@@ -1961,18 +1962,18 @@ OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, co
return OUString();
}
-void UCBStorage_Impl::SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const String& rPath )
+void UCBStorage_Impl::SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath )
{
- String aPath( rPath );
+ OUString aPath( rPath );
if ( !m_bIsRoot )
aPath += m_aName;
- aPath += '/';
+ aPath += "/";
m_aContentType = m_aOriginalContentType = Find_Impl( rSequence, aPath );
if ( m_bIsRoot )
// the "FullPath" of a child always starts without '/'
- aPath.Erase();
+ aPath = "";
for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
{
@@ -1982,13 +1983,13 @@ void UCBStorage_Impl::SetProps( const Sequence < Sequence < PropertyValue > >& r
pElement->m_xStorage->SetProps( rSequence, aPath );
else
{
- String aElementPath( aPath );
+ OUString aElementPath( aPath );
aElementPath += pElement->m_aName;
pElement->SetContentType( Find_Impl( rSequence, aElementPath ) );
}
}
- if ( m_aContentType.Len() )
+ if ( !m_aContentType.isEmpty() )
{
// get the clipboard format using the content type
::com::sun::star::datatransfer::DataFlavor aDataFlavor;
@@ -2004,17 +2005,17 @@ void UCBStorage_Impl::SetProps( const Sequence < Sequence < PropertyValue > >& r
}
}
-void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < PropertyValue > >& rSequence, const String& rPath )
+void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath )
{
// first my own properties
Sequence < PropertyValue > aProps(2);
// first property is the "FullPath" name
// it's '/' for the root storage and m_aName for each element, followed by a '/' if it's a folder
- String aPath( rPath );
+ OUString aPath( rPath );
if ( !m_bIsRoot )
aPath += m_aName;
- aPath += '/';
+ aPath += "/";
aProps[0].Name = OUString("MediaType");
aProps[0].Value <<= (OUString ) m_aContentType;
aProps[1].Name = OUString("FullPath");
@@ -2023,7 +2024,7 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
if ( m_bIsRoot )
// the "FullPath" of a child always starts without '/'
- aPath.Erase();
+ aPath = "";
// now the properties of my elements
for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
@@ -2036,7 +2037,7 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
else
{
// properties of streams
- String aElementPath( aPath );
+ OUString aElementPath( aPath );
aElementPath += pElement->m_aName;
aProps[0].Name = OUString("MediaType");
aProps[0].Value <<= (OUString ) pElement->GetContentType();
@@ -2058,18 +2059,18 @@ UCBStorage_Impl::~UCBStorage_Impl()
delete m_pTempFile;
}
-sal_Bool UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent )
+bool UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent )
{
// a new substorage is inserted into a UCBStorage ( given by the parameter pContent )
// it must be inserted with a title and a type
- sal_Bool bRet = sal_False;
+ bool bRet = false;
try
{
Sequence< ContentInfo > aInfo = pContent->queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
if ( nCount == 0 )
- return sal_False;
+ return false;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
@@ -2099,7 +2100,7 @@ sal_Bool UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent )
// remove old content, create an "empty" new one and initialize it with the new inserted
DELETEZ( m_pContent );
m_pContent = new ::ucbhelper::Content( aNewFolder );
- bRet = sal_True;
+ bRet = true;
}
}
}
@@ -2138,13 +2139,13 @@ sal_Int16 UCBStorage_Impl::Commit()
{
UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
::ucbhelper::Content* pContent = pElement->GetContent();
- sal_Bool bDeleteContent = sal_False;
+ bool bDeleteContent = false;
if ( !pContent && pElement->IsModified() )
{
// if the element has never been opened, no content has been created until now
- bDeleteContent = sal_True; // remember to delete it later
- String aName( m_aURL );
- aName += '/';
+ bDeleteContent = true; // remember to delete it later
+ OUString aName( m_aURL );
+ aName += "/";
aName += pElement->m_aOriginalName;
pContent = new ::ucbhelper::Content( aName, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
}
@@ -2190,7 +2191,7 @@ sal_Int16 UCBStorage_Impl::Commit()
// OLE storage should be stored encrytped, if the storage uses encryption
pElement->m_xStream->m_aContentType = OUString("application/vnd.sun.star.oleobject");
Any aValue;
- aValue <<= (sal_Bool) sal_True;
+ aValue <<= (sal_Bool)sal_True;
pElement->m_xStream->m_pContent->setPropertyValue("Encrypted", aValue );
}
@@ -2270,7 +2271,7 @@ sal_Int16 UCBStorage_Impl::Commit()
// write a manifest file
// first create a subfolder "META-inf"
Content aNewSubFolder;
- sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, OUString("META-INF"), aNewSubFolder );
+ bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, OUString("META-INF"), aNewSubFolder );
if ( bRet )
{
// create a stream to write the manifest file - use a temp file
@@ -2289,7 +2290,7 @@ sal_Int16 UCBStorage_Impl::Commit()
sal_Int32 nCount = GetObjectCount() + 1;
Sequence < Sequence < PropertyValue > > aProps( nCount );
sal_Int32 nProps = 0;
- GetProps( nProps, aProps, String() );
+ GetProps( nProps, aProps, OUString() );
xWriter->writeManifestSequence( xOutputStream, aProps );
// move the stream to its desired location
@@ -2382,24 +2383,24 @@ sal_Int16 UCBStorage_Impl::Commit()
else
{
pInnerElement->m_aOriginalName = pInnerElement->m_aName;
- pInnerElement->m_bIsInserted = sal_False;
+ pInnerElement->m_bIsInserted = false;
++i;
}
}
}
- m_bCommited = sal_False;
+ m_bCommited = false;
}
return nRet;
}
-sal_Bool UCBStorage_Impl::Revert()
+bool UCBStorage_Impl::Revert()
{
for ( size_t i = 0; i < m_aChildrenList.size(); )
{
UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
- pElement->m_bIsRemoved = sal_False;
+ pElement->m_bIsRemoved = false;
if ( pElement->m_bIsInserted )
{
UCBStorageElementList_Impl::iterator it = m_aChildrenList.begin();
@@ -2411,39 +2412,39 @@ sal_Bool UCBStorage_Impl::Revert()
{
if ( pElement->m_xStream.Is() )
{
- pElement->m_xStream->m_bCommited = sal_False;
+ pElement->m_xStream->m_bCommited = false;
pElement->m_xStream->Revert();
}
else if ( pElement->m_xStorage.Is() )
{
- pElement->m_xStorage->m_bCommited = sal_False;
+ pElement->m_xStorage->m_bCommited = false;
pElement->m_xStorage->Revert();
}
pElement->m_aName = pElement->m_aOriginalName;
- pElement->m_bIsRemoved = sal_False;
+ pElement->m_bIsRemoved = false;
++i;
}
}
- return sal_True;
+ return true;
}
-const String& UCBStorage::GetName() const
+const OUString& UCBStorage::GetName() const
{
return pImp->m_aName; // pImp->m_aURL ?!
}
-sal_Bool UCBStorage::IsRoot() const
+bool UCBStorage::IsRoot() const
{
return pImp->m_bIsRoot;
}
void UCBStorage::SetDirty()
{
- pImp->m_bDirty = sal_True;
+ pImp->m_bDirty = true;
}
-void UCBStorage::SetClass( const SvGlobalName & rClass, sal_uLong nOriginalClipFormat, const String & rUserTypeName )
+void UCBStorage::SetClass( const SvGlobalName & rClass, sal_uLong nOriginalClipFormat, const OUString & rUserTypeName )
{
pImp->m_aClassId = rClass;
pImp->m_nFormat = nOriginalClipFormat;
@@ -2482,15 +2483,15 @@ const ClsId& UCBStorage::GetClassId() const
return ( const ClsId& ) pImp->m_aClassId.GetCLSID();
}
-void UCBStorage::SetConvertClass( const SvGlobalName & /*rConvertClass*/, sal_uLong /*nOriginalClipFormat*/, const String & /*rUserTypeName*/ )
+void UCBStorage::SetConvertClass( const SvGlobalName & /*rConvertClass*/, sal_uLong /*nOriginalClipFormat*/, const OUString & /*rUserTypeName*/ )
{
// ???
}
-sal_Bool UCBStorage::ShouldConvert()
+bool UCBStorage::ShouldConvert()
{
// ???
- return sal_False;
+ return false;
}
SvGlobalName UCBStorage::GetClassName()
@@ -2503,7 +2504,7 @@ sal_uLong UCBStorage::GetFormat()
return pImp->m_nFormat;
}
-String UCBStorage::GetUserName()
+OUString UCBStorage::GetUserName()
{
OSL_FAIL("UserName is not implemented in UCB storages!" );
return pImp->m_aUserTypeName;
@@ -2527,7 +2528,7 @@ void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const
}
}
-sal_Bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, BaseStorage* pDest, const String& rNew ) const
+bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, BaseStorage* pDest, const OUString& rNew ) const
{
// insert stream or storage into the list or stream of the destination storage
// not into the content, this will be done on commit !
@@ -2538,7 +2539,7 @@ sal_Bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement,
// the destination stream must not be open
BaseStorageStream* pOtherStream = pDest->OpenStream( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pImp->m_bDirect );
BaseStorageStream* pStream = NULL;
- sal_Bool bDeleteStream = sal_False;
+ bool bDeleteStream = false;
// if stream is already open, it is allowed to copy it, so be aware of this
if ( rElement.m_xStream.Is() )
@@ -2546,7 +2547,7 @@ sal_Bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement,
if ( !pStream )
{
pStream = ( const_cast < UCBStorage* > (this) )->OpenStream( rElement.m_aName, STREAM_STD_READ, pImp->m_bDirect );
- bDeleteStream = sal_True;
+ bDeleteStream = true;
}
pStream->CopyTo( pOtherStream );
@@ -2567,19 +2568,19 @@ sal_Bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement,
BaseStorage* pStorage = NULL;
// if stream is already open, it is allowed to copy it, so be aware of this
- sal_Bool bDeleteStorage = sal_False;
+ bool bDeleteStorage = false;
if ( rElement.m_xStorage.Is() )
pStorage = rElement.m_xStorage->m_pAntiImpl;
if ( !pStorage )
{
pStorage = ( const_cast < UCBStorage* > (this) )->OpenStorage( rElement.m_aName, pImp->m_nMode, pImp->m_bDirect );
- bDeleteStorage = sal_True;
+ bDeleteStorage = true;
}
UCBStorage* pUCBDest = PTR_CAST( UCBStorage, pDest );
UCBStorage* pUCBCopy = PTR_CAST( UCBStorage, pStorage );
- sal_Bool bOpenUCBStorage = pUCBDest && pUCBCopy;
+ bool bOpenUCBStorage = pUCBDest && pUCBCopy;
BaseStorage* pOtherStorage = bOpenUCBStorage ?
pDest->OpenUCBStorage( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pImp->m_bDirect ) :
pDest->OpenOLEStorage( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pImp->m_bDirect );
@@ -2604,12 +2605,12 @@ sal_Bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement,
delete pOtherStorage;
}
- return sal_Bool( Good() && pDest->Good() );
+ return Good() && pDest->Good();
}
-UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const String& rName ) const
+UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const OUString& rName ) const
{
- DBG_ASSERT( rName.Len(), "Name is empty!" );
+ DBG_ASSERT( !rName.isEmpty(), "Name is empty!" );
for ( size_t i = 0, n = pImp->GetChildrenList().size(); i < n; ++i )
{
UCBStorageElement_Impl* pElement = pImp->GetChildrenList()[ i ];
@@ -2619,11 +2620,11 @@ UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const String& rName ) cons
return NULL;
}
-sal_Bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const
+bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const
{
DBG_ASSERT( pDestStg != ((BaseStorage*)this), "Self-Copying is not possible!" );
if ( pDestStg == ((BaseStorage*)this) )
- return sal_False;
+ return false;
// perhaps it's also a problem if one storage is a parent of the other ?!
// or if not: could be optimized ?!
@@ -2637,7 +2638,7 @@ sal_Bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const
pDestStg->SetClassId( GetClassId() );
pDestStg->SetDirty();
- sal_Bool bRet = sal_True;
+ bool bRet = true;
for ( size_t i = 0; i < pImp->GetChildrenList().size() && bRet; ++i )
{
UCBStorageElement_Impl* pElement = pImp->GetChildrenList()[ i ];
@@ -2647,18 +2648,18 @@ sal_Bool UCBStorage::CopyTo( BaseStorage* pDestStg ) const
if( !bRet )
SetError( pDestStg->GetError() );
- return sal_Bool( Good() && pDestStg->Good() );
+ return Good() && pDestStg->Good();
}
-sal_Bool UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const String& rNew )
+bool UCBStorage::CopyTo( const OUString& rElemName, BaseStorage* pDest, const OUString& rNew )
{
- if( !rElemName.Len() )
- return sal_False;
+ if( rElemName.isEmpty() )
+ return false;
if ( pDest == ((BaseStorage*) this) )
{
// can't double an element
- return sal_False;
+ return false;
}
else
{
@@ -2669,30 +2670,30 @@ sal_Bool UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const
else
{
SetError( SVSTREAM_FILE_NOT_FOUND );
- return sal_False;
+ return false;
}
}
}
-sal_Bool UCBStorage::Commit()
+bool UCBStorage::Commit()
{
// mark this storage for sending it on root commit
- pImp->m_bCommited = sal_True;
+ pImp->m_bCommited = true;
if ( pImp->m_bIsRoot )
// the root storage coordinates commiting by sending a Commit command to its content
return ( pImp->Commit() != COMMIT_RESULT_FAILURE );
else
- return sal_True;
+ return true;
}
-sal_Bool UCBStorage::Revert()
+bool UCBStorage::Revert()
{
return pImp->Revert();
}
-BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nMode, sal_Bool bDirect, const OString* pKey )
+BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode nMode, bool bDirect, const OString* pKey )
{
- if( !rEleName.Len() )
+ if( rEleName.isEmpty() )
return NULL;
// try to find the storage element
@@ -2703,8 +2704,8 @@ BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nM
if( ( nMode & STREAM_NOCREATE ) )
{
SetError( ( nMode & STREAM_WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND );
- String aName( pImp->m_aURL );
- aName += '/';
+ OUString aName( pImp->m_aURL );
+ aName += "/";
aName += rEleName;
UCBStorageStream* pStream = new UCBStorageStream( aName, nMode, bDirect, pKey, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
pStream->SetError( GetError() );
@@ -2715,7 +2716,7 @@ BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nM
{
// create a new UCBStorageElement and insert it into the list
pElement = new UCBStorageElement_Impl( rEleName );
- pElement->m_bIsInserted = sal_True;
+ pElement->m_bIsInserted = true;
pImp->m_aChildrenList.push_back( pElement );
}
}
@@ -2759,40 +2760,40 @@ BaseStorageStream* UCBStorage::OpenStream( const String& rEleName, StreamMode nM
return NULL;
}
-UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, sal_Bool bDirect, const OString* pKey )
+UCBStorageStream_Impl* UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect, const OString* pKey )
{
- String aName( m_aURL );
- aName += '/';
+ OUString aName( m_aURL );
+ aName += "/";
aName += pElement->m_aOriginalName;
pElement->m_xStream = new UCBStorageStream_Impl( aName, nMode, NULL, bDirect, pKey, m_bRepairPackage, m_xProgressHandler );
return pElement->m_xStream;
}
-BaseStorage* UCBStorage::OpenUCBStorage( const String& rEleName, StreamMode nMode, sal_Bool bDirect )
+BaseStorage* UCBStorage::OpenUCBStorage( const OUString& rEleName, StreamMode nMode, bool bDirect )
{
- if( !rEleName.Len() )
+ if( rEleName.isEmpty() )
return NULL;
- return OpenStorage_Impl( rEleName, nMode, bDirect, sal_True );
+ return OpenStorage_Impl( rEleName, nMode, bDirect, true );
}
-BaseStorage* UCBStorage::OpenOLEStorage( const String& rEleName, StreamMode nMode, sal_Bool bDirect )
+BaseStorage* UCBStorage::OpenOLEStorage( const OUString& rEleName, StreamMode nMode, bool bDirect )
{
- if( !rEleName.Len() )
+ if( rEleName.isEmpty() )
return NULL;
- return OpenStorage_Impl( rEleName, nMode, bDirect, sal_False );
+ return OpenStorage_Impl( rEleName, nMode, bDirect, false );
}
-BaseStorage* UCBStorage::OpenStorage( const String& rEleName, StreamMode nMode, bool bDirect )
+BaseStorage* UCBStorage::OpenStorage( const OUString& rEleName, StreamMode nMode, bool bDirect )
{
- if( !rEleName.Len() )
+ if( rEleName.isEmpty() )
return NULL;
- return OpenStorage_Impl( rEleName, nMode, bDirect, sal_True );
+ return OpenStorage_Impl( rEleName, nMode, bDirect, true );
}
-BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nMode, sal_Bool bDirect, sal_Bool bForceUCBStorage )
+BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode nMode, bool bDirect, bool bForceUCBStorage )
{
// try to find the storage element
UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName );
@@ -2802,12 +2803,12 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
if( ( nMode & STREAM_NOCREATE ) )
{
SetError( ( nMode & STREAM_WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND );
- String aName( pImp->m_aURL );
- aName += '/';
+ OUString aName( pImp->m_aURL );
+ aName += "/";
aName += rEleName; // ???
- UCBStorage *pStorage = new UCBStorage( aName, nMode, bDirect, sal_False, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
- pStorage->pImp->m_bIsRoot = sal_False;
- pStorage->pImp->m_bListCreated = sal_True; // the storage is pretty new, nothing to read
+ UCBStorage *pStorage = new UCBStorage( aName, nMode, bDirect, false, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
+ pStorage->pImp->m_bIsRoot = false;
+ pStorage->pImp->m_bListCreated = true; // the storage is pretty new, nothing to read
pStorage->SetError( GetError() );
return pStorage;
}
@@ -2816,7 +2817,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
// problem: perhaps an OLEStorage should be created ?!
// Because nothing is known about the element that should be created, an external parameter is needed !
pElement = new UCBStorageElement_Impl( rEleName );
- pElement->m_bIsInserted = sal_True;
+ pElement->m_bIsInserted = true;
pImp->m_aChildrenList.push_back( pElement );
}
@@ -2843,7 +2844,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
pElement->m_xStream->PrepareCachedForReopen( nMode );
pElement->m_xStream->Init();
- pElement->m_bIsStorage = sal_True;
+ pElement->m_bIsStorage = true;
return pElement->m_xStream->CreateStorage(); // can only be created in transacted mode
}
else if ( pElement->m_xStorage.Is() )
@@ -2856,13 +2857,13 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
}
else
{
- sal_Bool bIsWritable = (( pElement->m_xStorage->m_nMode & STREAM_WRITE ) != 0);
+ bool bIsWritable = (( pElement->m_xStorage->m_nMode & STREAM_WRITE ) != 0);
if ( !bIsWritable && (( nMode & STREAM_WRITE ) != 0 ))
{
- String aName( pImp->m_aURL );
- aName += '/';
+ OUString aName( pImp->m_aURL );
+ aName += "/";
aName += pElement->m_aOriginalName;
- UCBStorage* pStorage = new UCBStorage( aName, nMode, bDirect, sal_False, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
+ UCBStorage* pStorage = new UCBStorage( aName, nMode, bDirect, false, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
pElement->m_xStorage = pStorage->pImp;
return pStorage;
}
@@ -2875,7 +2876,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
else if ( !pElement->m_xStream.Is() )
{
// storage is opened the first time
- sal_Bool bIsWritable = (( pImp->m_nMode & STREAM_WRITE ) != 0 );
+ bool bIsWritable = (( pImp->m_nMode & STREAM_WRITE ) != 0 );
if ( pImp->m_bIsLinked && pImp->m_bIsRoot && bIsWritable )
{
// make sure that the root storage object has been created before substorages will be created
@@ -2884,7 +2885,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
Content aFolder( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ), Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
pImp->m_pContent = new Content;
- sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, pImp->m_aName, *pImp->m_pContent );
+ bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, pImp->m_aName, *pImp->m_pContent );
if ( !bRet )
{
SetError( SVSTREAM_CANNOT_MAKE );
@@ -2896,7 +2897,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
if ( pStor )
{
if ( pElement->m_bIsInserted )
- pStor->m_bListCreated = sal_True; // the storage is pretty new, nothing to read
+ pStor->m_bListCreated = true; // the storage is pretty new, nothing to read
return new UCBStorage( pStor );
}
@@ -2908,28 +2909,28 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const String& rEleName, StreamMode nM
UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect )
{
UCBStorage_Impl* pRet = NULL;
- String aName( m_aURL );
- aName += '/';
+ OUString aName( m_aURL );
+ aName += "/";
aName += pElement->m_aOriginalName; // ???
- pElement->m_bIsStorage = pElement->m_bIsFolder = sal_True;
+ pElement->m_bIsStorage = pElement->m_bIsFolder = true;
if ( m_bIsLinked && !::utl::UCBContentHelper::Exists( aName ) )
{
Content aNewFolder;
- sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, pElement->m_aOriginalName, aNewFolder );
+ bool bRet = ::utl::UCBContentHelper::MakeFolder( *m_pContent, pElement->m_aOriginalName, aNewFolder );
if ( bRet )
- pRet = new UCBStorage_Impl( aNewFolder, aName, nMode, NULL, bDirect, sal_False, m_bRepairPackage, m_xProgressHandler );
+ pRet = new UCBStorage_Impl( aNewFolder, aName, nMode, NULL, bDirect, false, m_bRepairPackage, m_xProgressHandler );
}
else
{
- pRet = new UCBStorage_Impl( aName, nMode, NULL, bDirect, sal_False, m_bRepairPackage, m_xProgressHandler );
+ pRet = new UCBStorage_Impl( aName, nMode, NULL, bDirect, false, m_bRepairPackage, m_xProgressHandler );
}
if ( pRet )
{
pRet->m_bIsLinked = m_bIsLinked;
- pRet->m_bIsRoot = sal_False;
+ pRet->m_bIsRoot = false;
// if name has been changed before creating the stream: set name!
pRet->m_aName = pElement->m_aOriginalName;
@@ -2942,41 +2943,41 @@ UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement,
return pRet;
}
-sal_Bool UCBStorage::IsStorage( const String& rEleName ) const
+bool UCBStorage::IsStorage( const OUString& rEleName ) const
{
- if( !rEleName.Len() )
- return sal_False;
+ if( rEleName.isEmpty() )
+ return false;
const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName );
return ( pElement && pElement->m_bIsStorage );
}
-sal_Bool UCBStorage::IsStream( const String& rEleName ) const
+bool UCBStorage::IsStream( const OUString& rEleName ) const
{
- if( !rEleName.Len() )
- return sal_False;
+ if( rEleName.isEmpty() )
+ return false;
const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName );
return ( pElement && !pElement->m_bIsStorage );
}
-sal_Bool UCBStorage::IsContained( const String & rEleName ) const
+bool UCBStorage::IsContained( const OUString & rEleName ) const
{
- if( !rEleName.Len() )
- return sal_False;
+ if( rEleName.isEmpty() )
+ return false;
const UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName );
return ( pElement != NULL );
}
-sal_Bool UCBStorage::Remove( const String& rEleName )
+bool UCBStorage::Remove( const OUString& rEleName )
{
- if( !rEleName.Len() )
- return sal_False;
+ if( rEleName.isEmpty() )
+ return false;
UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName );
if ( pElement )
{
- pElement->m_bIsRemoved = sal_True;
+ pElement->m_bIsRemoved = true;
}
else
SetError( SVSTREAM_FILE_NOT_FOUND );
@@ -2984,16 +2985,16 @@ sal_Bool UCBStorage::Remove( const String& rEleName )
return ( pElement != NULL );
}
-sal_Bool UCBStorage::Rename( const String& rEleName, const String& rNewName )
+bool UCBStorage::Rename( const OUString& rEleName, const OUString& rNewName )
{
- if( !rEleName.Len()|| !rNewName.Len() )
- return sal_False;
+ if( rEleName.isEmpty()|| rNewName.isEmpty() )
+ return false;
UCBStorageElement_Impl *pAlreadyExisting = FindElement_Impl( rNewName );
if ( pAlreadyExisting )
{
SetError( SVSTREAM_ACCESS_DENIED );
- return sal_False; // can't change to a name that is already used
+ return false; // can't change to a name that is already used
}
UCBStorageElement_Impl *pElement = FindElement_Impl( rEleName );
@@ -3007,10 +3008,10 @@ sal_Bool UCBStorage::Rename( const String& rEleName, const String& rNewName )
return pElement != NULL;
}
-sal_Bool UCBStorage::MoveTo( const String& rEleName, BaseStorage* pNewSt, const String& rNewName )
+bool UCBStorage::MoveTo( const OUString& rEleName, BaseStorage* pNewSt, const OUString& rNewName )
{
- if( !rEleName.Len() || !rNewName.Len() )
- return sal_False;
+ if( rEleName.isEmpty() || rNewName.isEmpty() )
+ return false;
if ( pNewSt == ((BaseStorage*) this) && !FindElement_Impl( rNewName ) )
{
@@ -3034,30 +3035,30 @@ sal_Bool UCBStorage::MoveTo( const String& rEleName, BaseStorage* pNewSt, const
}
*/
// MoveTo is done by first copying to the new destination and then removing the old element
- sal_Bool bRet = CopyTo( rEleName, pNewSt, rNewName );
+ bool bRet = CopyTo( rEleName, pNewSt, rNewName );
if ( bRet )
bRet = Remove( rEleName );
return bRet;
}
}
-sal_Bool UCBStorage::ValidateFAT()
+bool UCBStorage::ValidateFAT()
{
// ???
- return sal_True;
+ return true;
}
-sal_Bool UCBStorage::Validate( sal_Bool bWrite ) const
+bool UCBStorage::Validate( bool bWrite ) const
{
// ???
return ( !bWrite || ( pImp->m_nMode & STREAM_WRITE ) );
}
-sal_Bool UCBStorage::ValidateMode( StreamMode m ) const
+bool UCBStorage::ValidateMode( StreamMode m ) const
{
// ???
if( m == ( STREAM_READ | STREAM_TRUNC ) ) // from stg.cxx
- return sal_True;
+ return true;
sal_uInt16 nCurMode = 0xFFFF;
if( ( m & 3 ) == STREAM_READ )
{
@@ -3066,7 +3067,7 @@ sal_Bool UCBStorage::ValidateMode( StreamMode m ) const
&& ( nCurMode & STREAM_SHARE_DENYWRITE ) )
|| ( ( m & STREAM_SHARE_DENYALL )
&& ( nCurMode & STREAM_SHARE_DENYALL ) ) )
- return sal_True;
+ return true;
}
else
{
@@ -3075,10 +3076,10 @@ sal_Bool UCBStorage::ValidateMode( StreamMode m ) const
// the commit may fail
if( ( m & STREAM_SHARE_DENYALL )
&& ( nCurMode & STREAM_SHARE_DENYALL ) )
- return sal_True;
+ return true;
}
- return sal_True;
+ return true;
}
const SvStream* UCBStorage::GetSvStream() const
@@ -3088,28 +3089,28 @@ const SvStream* UCBStorage::GetSvStream() const
return pImp->m_pSource;
}
-sal_Bool UCBStorage::Equals( const BaseStorage& rStorage ) const
+bool UCBStorage::Equals( const BaseStorage& rStorage ) const
{
// ???
return ((BaseStorage*)this) == &rStorage;
}
-sal_Bool UCBStorage::IsStorageFile( SvStream* pFile )
+bool UCBStorage::IsStorageFile( SvStream* pFile )
{
if ( !pFile )
- return sal_False;
+ return false;
sal_uLong nPos = pFile->Tell();
pFile->Seek( STREAM_SEEK_TO_END );
if ( pFile->Tell() < 4 )
- return sal_False;
+ return false;
pFile->Seek(0);
sal_uInt32 nBytes(0);
*pFile >> nBytes;
// search for the magic bytes
- sal_Bool bRet = ( nBytes == 0x04034b50 );
+ bool bRet = ( nBytes == 0x04034b50 );
if ( !bRet )
{
// disk spanned file have an additional header in front of the usual one
@@ -3126,22 +3127,22 @@ sal_Bool UCBStorage::IsStorageFile( SvStream* pFile )
return bRet;
}
-sal_Bool UCBStorage::IsDiskSpannedFile( SvStream* pFile )
+bool UCBStorage::IsDiskSpannedFile( SvStream* pFile )
{
if ( !pFile )
- return sal_False;
+ return false;
sal_uLong nPos = pFile->Tell();
pFile->Seek( STREAM_SEEK_TO_END );
if ( !pFile->Tell() )
- return sal_False;
+ return false;
pFile->Seek(0);
sal_uInt32 nBytes;
*pFile >> nBytes;
// disk spanned file have an additional header in front of the usual one
- sal_Bool bRet = ( nBytes == 0x08074b50 );
+ bool bRet = ( nBytes == 0x08074b50 );
if ( bRet )
{
*pFile >> nBytes;
@@ -3152,9 +3153,9 @@ sal_Bool UCBStorage::IsDiskSpannedFile( SvStream* pFile )
return bRet;
}
-String UCBStorage::GetLinkedFile( SvStream &rStream )
+OUString UCBStorage::GetLinkedFile( SvStream &rStream )
{
- String aString;
+ OUString aString;
sal_uLong nPos = rStream.Tell();
rStream.Seek( STREAM_SEEK_TO_END );
if ( !rStream.Tell() )
@@ -3176,11 +3177,11 @@ String UCBStorage::GetLinkedFile( SvStream &rStream )
return aString;
}
-String UCBStorage::CreateLinkFile( const String& rName )
+OUString UCBStorage::CreateLinkFile( const OUString& rName )
{
// create a stream to write the link file - use a temp file, because it may be no file content
INetURLObject aFolderObj( rName );
- String aName = aFolderObj.GetName();
+ OUString aName = aFolderObj.GetName();
aFolderObj.removeSegment();
OUString aFolderURL( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ) );
::utl::TempFile* pTempFile = new ::utl::TempFile( &aFolderURL );
@@ -3193,14 +3194,14 @@ String UCBStorage::CreateLinkFile( const String& rName )
// assemble a new folder name in the destination folder
INetURLObject aObj( rName );
- String aTmpName = aObj.GetName();
- String aTitle = OUString( "content." );
+ OUString aTmpName = aObj.GetName();
+ OUString aTitle = OUString( "content." );
aTitle += aTmpName;
// create a folder and store its URL
Content aFolder( aFolderURL, Reference < XCommandEnvironment >(), comphelper::getProcessComponentContext() );
Content aNewFolder;
- sal_Bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, aTitle, aNewFolder );
+ bool bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, aTitle, aNewFolder );
if ( !bRet )
{
aFolderObj.insertName( aTitle );
@@ -3208,10 +3209,10 @@ String UCBStorage::CreateLinkFile( const String& rName )
{
// Hack, because already existing files give the same CommandAbortedException as any other error !
// append a number until the name can be used for a new folder
- aTitle += '.';
+ aTitle += ".";
for ( sal_Int32 i=0; !bRet; i++ )
{
- String aTmp( aTitle );
+ OUString aTmp( aTitle );
aTmp += OUString::number( i );
bRet = ::utl::UCBContentHelper::MakeFolder( aFolder, aTmp, aNewFolder );
if ( bRet )
@@ -3231,10 +3232,10 @@ String UCBStorage::CreateLinkFile( const String& rName )
{
// get the URL
aObj.SetName( aTitle );
- String aURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ OUString aURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
// store it as key/value pair
- String aLink = OUString("ContentURL=");
+ OUString aLink = OUString("ContentURL=");
aLink += aURL;
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(*pStream, aLink, RTL_TEXTENCODING_UTF8);
pStream->Flush();
@@ -3246,9 +3247,9 @@ String UCBStorage::CreateLinkFile( const String& rName )
return aURL;
}
- pTempFile->EnableKillingFile( sal_True );
+ pTempFile->EnableKillingFile( true );
delete pTempFile;
- return String();
+ return OUString();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index 27411fb1512d..d2fbf3296e62 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -43,12 +43,12 @@ const sal_Int32 nBytesCount = 32000;
// --------------------------------------------------------------------------------
OLESimpleStorage::OLESimpleStorage( uno::Reference< lang::XMultiServiceFactory > xFactory )
-: m_bDisposed( sal_False )
+: m_bDisposed( false )
, m_pStream( NULL )
, m_pStorage( NULL )
, m_pListenersContainer( NULL )
, m_xFactory( xFactory )
-, m_bNoTemporaryCopy( sal_False )
+, m_bNoTemporaryCopy( false )
{
OSL_ENSURE( m_xFactory.is(), "No factory is provided on creation!\n" );
if ( !m_xFactory.is() )
@@ -244,13 +244,13 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
{
// the stream must be seekable for direct access
uno::Reference< io::XSeekable > xSeek( xInputStream, uno::UNO_QUERY_THROW );
- m_pStream = ::utl::UcbStreamHelper::CreateStream( xInputStream, sal_False );
+ m_pStream = ::utl::UcbStreamHelper::CreateStream( xInputStream, false );
}
else if ( xStream.is() )
{
// the stream must be seekable for direct access
uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW );
- m_pStream = ::utl::UcbStreamHelper::CreateStream( xStream, sal_False );
+ m_pStream = ::utl::UcbStreamHelper::CreateStream( xStream, false );
}
else
throw lang::IllegalArgumentException(); // TODO:
@@ -279,7 +279,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
xTempOut->closeOutput();
xTempSeek->seek( 0 );
uno::Reference< io::XInputStream > xTempInput = xTempFile->getInputStream();
- m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempInput, sal_False );
+ m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempInput, false );
}
else if ( xStream.is() )
{
@@ -297,7 +297,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
xTempOut->flush();
xTempSeek->seek( 0 );
- m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False );
+ m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, false );
}
else
throw lang::IllegalArgumentException(); // TODO:
@@ -306,7 +306,7 @@ void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aAr
if ( !m_pStream || m_pStream->GetError() )
throw io::IOException(); // TODO
- m_pStorage = new Storage( *m_pStream, sal_False );
+ m_pStorage = new Storage( *m_pStream, false );
}
@@ -458,13 +458,13 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const OUString& aName )
if ( !pStrg )
throw io::IOException();
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False ); // do not close the original stream
+ SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, false ); // do not close the original stream
if ( !pStream )
throw uno::RuntimeException();
- BaseStorage* pNewStor = new Storage( *pStream, sal_False );
- sal_Bool bSuccess =
- ( pStrg->CopyTo( pNewStor ) && pNewStor->Commit() && !pNewStor->GetError() && !pStrg->GetError() );
+ BaseStorage* pNewStor = new Storage( *pStream, false );
+ bool bSuccess = ( pStrg->CopyTo( pNewStor ) && pNewStor->Commit() &&
+ !pNewStor->GetError() && !pStrg->GetError() );
DELETEZ( pNewStor );
DELETEZ( pStrg );
@@ -576,7 +576,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasByName( const OUString& aName )
if ( !m_pStorage )
throw uno::RuntimeException();
- sal_Bool bResult = m_pStorage->IsContained( aName );
+ bool bResult = m_pStorage->IsContained( aName );
if ( m_pStorage->GetError() )
{
@@ -584,7 +584,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasByName( const OUString& aName )
throw uno::RuntimeException(); // TODO:
}
- return bResult;
+ return bResult ? sal_True : sal_False;
}
// --------------------------------------------------------------------------------
@@ -620,7 +620,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasElements()
throw uno::RuntimeException(); // TODO:
}
- return ( aList.size() != 0 );
+ return aList.size() != 0 ? sal_True : sal_False;
}
//____________________________________________________________________________________________________
@@ -763,8 +763,8 @@ OUString SAL_CALL OLESimpleStorage::getClassName()
void SAL_CALL OLESimpleStorage::setClassInfo( const uno::Sequence< sal_Int8 >& /*aClassID*/,
const OUString& /*sClassName*/ )
- throw ( lang::NoSupportException,
- uno::RuntimeException )
+ throw ( lang::NoSupportException,
+ uno::RuntimeException )
{
throw lang::NoSupportException();
}
@@ -775,14 +775,14 @@ void SAL_CALL OLESimpleStorage::setClassInfo( const uno::Sequence< sal_Int8 >& /
// --------------------------------------------------------------------------------
OUString SAL_CALL OLESimpleStorage::getImplementationName()
- throw ( uno::RuntimeException )
+ throw ( uno::RuntimeException )
{
return impl_staticGetImplementationName();
}
// --------------------------------------------------------------------------------
-::sal_Bool SAL_CALL OLESimpleStorage::supportsService( const OUString& ServiceName )
- throw ( uno::RuntimeException )
+sal_Bool SAL_CALL OLESimpleStorage::supportsService( const OUString& ServiceName )
+ throw ( uno::RuntimeException )
{
uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames();
diff --git a/sot/source/unoolestorage/xolesimplestorage.hxx b/sot/source/unoolestorage/xolesimplestorage.hxx
index a2872778fb39..79251d9fdc3e 100644
--- a/sot/source/unoolestorage/xolesimplestorage.hxx
+++ b/sot/source/unoolestorage/xolesimplestorage.hxx
@@ -45,7 +45,7 @@ class OLESimpleStorage : public ::cppu::WeakImplHelper3
{
::osl::Mutex m_aMutex;
- sal_Bool m_bDisposed;
+ bool m_bDisposed;
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xTempStream;
@@ -55,7 +55,7 @@ class OLESimpleStorage : public ::cppu::WeakImplHelper3
::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
- sal_Bool m_bNoTemporaryCopy;
+ bool m_bNoTemporaryCopy;
void UpdateOriginal_Impl();