diff options
Diffstat (limited to 'sot/source/sdstor')
-rw-r--r-- | sot/source/sdstor/stg.cxx | 9 | ||||
-rw-r--r-- | sot/source/sdstor/stgole.cxx | 5 | ||||
-rw-r--r-- | sot/source/sdstor/stgole.hxx | 8 | ||||
-rw-r--r-- | sot/source/sdstor/storage.cxx | 61 | ||||
-rw-r--r-- | sot/source/sdstor/storinfo.cxx | 24 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 86 |
6 files changed, 101 insertions, 92 deletions
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index a199f2e7989b..eb708bc82136 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -19,6 +19,7 @@ #include <sot/storinfo.hxx> +#include <sot/exchange.hxx> #include <osl/file.hxx> #include <unotools/tempfile.hxx> #include <tools/stream.hxx> @@ -932,7 +933,7 @@ bool Storage::Revert() // Set the storage type void Storage::SetClass( const SvGlobalName & rClass, - sal_uLong nOriginalClipFormat, + SotClipboardFormatId nOriginalClipFormat, const OUString & rUserTypeName ) { if( Validate( true ) ) @@ -959,7 +960,7 @@ void Storage::SetClass( const SvGlobalName & rClass, } void Storage::SetConvertClass( const SvGlobalName & rConvertClass, - sal_uLong nOriginalClipFormat, + SotClipboardFormatId nOriginalClipFormat, const OUString & rUserTypeName ) { if( Validate( true ) ) @@ -986,13 +987,13 @@ SvGlobalName Storage::GetClassName() return SvGlobalName(); } -sal_uLong Storage::GetFormat() +SotClipboardFormatId Storage::GetFormat() { StgCompObjStream aCompObj( *this, false ); if( aCompObj.Load() ) return aCompObj.GetCbFormat(); pIo->ResetError(); - return 0; + return SotClipboardFormatId::NONE; } OUString Storage::GetUserName() diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx index f52dff841cd8..2fcbffabf1e5 100644 --- a/sot/source/sdstor/stgole.cxx +++ b/sot/source/sdstor/stgole.cxx @@ -23,6 +23,7 @@ #include "stgole.hxx" #include "sot/storinfo.hxx" #include <boost/scoped_array.hpp> +#include <sot/exchange.hxx> #ifdef _MSC_VER #pragma warning(disable: 4342) @@ -97,13 +98,13 @@ StgCompObjStream::StgCompObjStream( BaseStorage& rStg, bool bWr ) : StgInternalStream( rStg, OUString("\1CompObj"), bWr ) { memset( &aClsId, 0, sizeof( ClsId ) ); - nCbFormat = 0; + nCbFormat = SotClipboardFormatId::NONE; } bool StgCompObjStream::Load() { memset( &aClsId, 0, sizeof( ClsId ) ); - nCbFormat = 0; + nCbFormat = SotClipboardFormatId::NONE; aUserName.clear(); if( GetError() != SVSTREAM_OK ) return false; diff --git a/sot/source/sdstor/stgole.hxx b/sot/source/sdstor/stgole.hxx index 035041d632a8..0ba992f70641 100644 --- a/sot/source/sdstor/stgole.hxx +++ b/sot/source/sdstor/stgole.hxx @@ -42,14 +42,14 @@ public: class StgCompObjStream : public StgInternalStream { - ClsId aClsId; - OUString aUserName; - sal_uLong nCbFormat; + ClsId aClsId; + OUString aUserName; + SotClipboardFormatId nCbFormat; public: StgCompObjStream( BaseStorage&, bool ); ClsId& GetClsId() { return aClsId; } OUString& GetUserName() { return aUserName; } - sal_uLong& GetCbFormat() { return nCbFormat; } + SotClipboardFormatId& GetCbFormat() { return nCbFormat; } bool Load(); bool Store(); }; diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 6de540de9d3b..d6e9bc1085f7 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -606,7 +606,7 @@ const OUString & SotStorage::GetName() const } void SotStorage::SetClass( const SvGlobalName & rName, - sal_uLong nOriginalClipFormat, + SotClipboardFormatId nOriginalClipFormat, const OUString & rUserTypeName ) { DBG_ASSERT( Owner(), "must be owner" ); @@ -627,9 +627,9 @@ SvGlobalName SotStorage::GetClassName() return aGN; } -sal_uLong SotStorage::GetFormat() +SotClipboardFormatId SotStorage::GetFormat() { - sal_uLong nFormat = 0; + SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) nFormat = m_pOwnStg->GetFormat(); @@ -863,11 +863,11 @@ SotStorage* SotStorage::OpenOLEStorage( const com::sun::star::uno::Reference < c return new SotStorage( pStream, true ); } -sal_Int32 SotStorage::GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) +SotClipboardFormatId SotStorage::GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) { uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY ); if ( !xProps.is() ) - return 0; + return SotClipboardFormatId::NONE; OUString aMediaType; xProps->getPropertyValue("MediaType") >>= aMediaType; @@ -878,39 +878,40 @@ sal_Int32 SotStorage::GetFormatID( const com::sun::star::uno::Reference < com::s return SotExchange::GetFormat( aDataFlavor ); } - return 0; + return SotClipboardFormatId::NONE; } sal_Int32 SotStorage::GetVersion( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) { - sal_Int32 nSotFormatID = SotStorage::GetFormatID( xStorage ); + SotClipboardFormatId 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_STARWRITERGLOB_8_TEMPLATE: - 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: + case SotClipboardFormatId::STARWRITER_8: + case SotClipboardFormatId::STARWRITER_8_TEMPLATE: + case SotClipboardFormatId::STARWRITERWEB_8: + case SotClipboardFormatId::STARWRITERGLOB_8: + case SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE: + case SotClipboardFormatId::STARDRAW_8: + case SotClipboardFormatId::STARDRAW_8_TEMPLATE: + case SotClipboardFormatId::STARIMPRESS_8: + case SotClipboardFormatId::STARIMPRESS_8_TEMPLATE: + case SotClipboardFormatId::STARCALC_8: + case SotClipboardFormatId::STARCALC_8_TEMPLATE: + case SotClipboardFormatId::STARCHART_8: + case SotClipboardFormatId::STARCHART_8_TEMPLATE: + case SotClipboardFormatId::STARMATH_8: + case SotClipboardFormatId::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: + case SotClipboardFormatId::STARWRITER_60: + case SotClipboardFormatId::STARWRITERWEB_60: + case SotClipboardFormatId::STARWRITERGLOB_60: + case SotClipboardFormatId::STARDRAW_60: + case SotClipboardFormatId::STARIMPRESS_60: + case SotClipboardFormatId::STARCALC_60: + case SotClipboardFormatId::STARCHART_60: + case SotClipboardFormatId::STARMATH_60: return SOFFICE_FILEFORMAT_60; + default: break; } return 0; diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx index a12b353e94ae..7ff16c38f5a6 100644 --- a/sot/source/sdstor/storinfo.cxx +++ b/sot/source/sdstor/storinfo.cxx @@ -25,9 +25,9 @@ /************** class SvStorageInfo ************************************** *************************************************************************/ -sal_uLong ReadClipboardFormat( SvStream & rStm ) +SotClipboardFormatId ReadClipboardFormat( SvStream & rStm ) { - sal_uInt32 nFormat = 0; + SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; sal_Int32 nLen = 0; rStm.ReadInt32( nLen ); if( rStm.IsEof() ) @@ -44,12 +44,18 @@ sal_uLong ReadClipboardFormat( SvStream & rStm ) rStm.SetError( SVSTREAM_GENERALERROR ); } else if( nLen == -1L ) + { // Windows clipboard format - // SV und Win stimmen ueberein (bis einschl. FORMAT_GDIMETAFILE) - rStm.ReadUInt32( nFormat ); + // SV und Win stimmen ueberein (bis einschl. SotClipboardFormatId::GDIMETAFILE) + sal_uInt32 nTmp; + rStm.ReadUInt32( nTmp ); + nFormat = static_cast<SotClipboardFormatId>(nTmp); + } else if( nLen == -2L ) { - rStm.ReadUInt32( nFormat ); + sal_uInt32 nTmp; + rStm.ReadUInt32( nTmp ); + nFormat = static_cast<SotClipboardFormatId>(nTmp); // Mac clipboard format // ??? not implemented rStm.SetError( SVSTREAM_GENERALERROR ); @@ -62,11 +68,11 @@ sal_uLong ReadClipboardFormat( SvStream & rStm ) return nFormat; } -void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat ) +void WriteClipboardFormat( SvStream & rStm, SotClipboardFormatId nFormat ) { // determine the clipboard format string OUString aCbFmt; - if( nFormat > FORMAT_GDIMETAFILE ) + if( nFormat > SotClipboardFormatId::GDIMETAFILE ) aCbFmt = SotExchange::GetFormatName( nFormat ); if( !aCbFmt.isEmpty() ) { @@ -76,10 +82,10 @@ void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat ) rStm.WriteCharPtr( (const char *)aAsciiCbFmt.getStr() ); rStm.WriteUChar( 0 ); } - else if( nFormat ) + else if( nFormat != SotClipboardFormatId::NONE ) { rStm.WriteInt32( -1 ) // for Windows - .WriteInt32( nFormat ); + .WriteInt32( static_cast<sal_Int32>(nFormat) ); } else { diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 69d75df14e70..11a6f61ce483 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -314,80 +314,80 @@ TYPEINIT1( UCBStorage, BaseStorage ); #define min( x, y ) (( x < y ) ? x : y) -sal_Int32 GetFormatId_Impl( SvGlobalName aName ) +SotClipboardFormatId GetFormatId_Impl( SvGlobalName aName ) { if ( aName == SvGlobalName( SO3_SW_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARWRITER_60; + return SotClipboardFormatId::STARWRITER_60; if ( aName == SvGlobalName( SO3_SWWEB_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARWRITERWEB_60; + return SotClipboardFormatId::STARWRITERWEB_60; if ( aName == SvGlobalName( SO3_SWGLOB_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARWRITERGLOB_60; + return SotClipboardFormatId::STARWRITERGLOB_60; if ( aName == SvGlobalName( SO3_SDRAW_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARDRAW_60; + return SotClipboardFormatId::STARDRAW_60; if ( aName == SvGlobalName( SO3_SIMPRESS_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARIMPRESS_60; + return SotClipboardFormatId::STARIMPRESS_60; if ( aName == SvGlobalName( SO3_SC_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARCALC_60; + return SotClipboardFormatId::STARCALC_60; if ( aName == SvGlobalName( SO3_SCH_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARCHART_60; + return SotClipboardFormatId::STARCHART_60; if ( aName == SvGlobalName( SO3_SM_CLASSID_60 ) ) - return SOT_FORMATSTR_ID_STARMATH_60; + return SotClipboardFormatId::STARMATH_60; if ( aName == SvGlobalName( SO3_OUT_CLASSID ) || aName == SvGlobalName( SO3_APPLET_CLASSID ) || aName == SvGlobalName( SO3_PLUGIN_CLASSID ) || aName == SvGlobalName( SO3_IFRAME_CLASSID ) ) // allowed, but not supported - return 0; + return SotClipboardFormatId::NONE; else { OSL_FAIL( "Unknown UCB storage format!" ); - return 0; + return SotClipboardFormatId::NONE; } } -SvGlobalName GetClassId_Impl( sal_Int32 nFormat ) +SvGlobalName GetClassId_Impl( SotClipboardFormatId nFormat ) { switch ( nFormat ) { - case SOT_FORMATSTR_ID_STARWRITER_8 : - case SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE : + case SotClipboardFormatId::STARWRITER_8 : + case SotClipboardFormatId::STARWRITER_8_TEMPLATE : return SvGlobalName( SO3_SW_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARWRITERWEB_8 : + case SotClipboardFormatId::STARWRITERWEB_8 : return SvGlobalName( SO3_SWWEB_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARWRITERGLOB_8 : - case SOT_FORMATSTR_ID_STARWRITERGLOB_8_TEMPLATE : + case SotClipboardFormatId::STARWRITERGLOB_8 : + case SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE : return SvGlobalName( SO3_SWGLOB_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARDRAW_8 : - case SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE : + case SotClipboardFormatId::STARDRAW_8 : + case SotClipboardFormatId::STARDRAW_8_TEMPLATE : return SvGlobalName( SO3_SDRAW_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARIMPRESS_8 : - case SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE : + case SotClipboardFormatId::STARIMPRESS_8 : + case SotClipboardFormatId::STARIMPRESS_8_TEMPLATE : return SvGlobalName( SO3_SIMPRESS_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARCALC_8 : - case SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE : + case SotClipboardFormatId::STARCALC_8 : + case SotClipboardFormatId::STARCALC_8_TEMPLATE : return SvGlobalName( SO3_SC_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARCHART_8 : - case SOT_FORMATSTR_ID_STARCHART_8_TEMPLATE : + case SotClipboardFormatId::STARCHART_8 : + case SotClipboardFormatId::STARCHART_8_TEMPLATE : return SvGlobalName( SO3_SCH_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARMATH_8 : - case SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE : + case SotClipboardFormatId::STARMATH_8 : + case SotClipboardFormatId::STARMATH_8_TEMPLATE : return SvGlobalName( SO3_SM_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARWRITER_60 : + case SotClipboardFormatId::STARWRITER_60 : return SvGlobalName( SO3_SW_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARWRITERWEB_60 : + case SotClipboardFormatId::STARWRITERWEB_60 : return SvGlobalName( SO3_SWWEB_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARWRITERGLOB_60 : + case SotClipboardFormatId::STARWRITERGLOB_60 : return SvGlobalName( SO3_SWGLOB_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARDRAW_60 : + case SotClipboardFormatId::STARDRAW_60 : return SvGlobalName( SO3_SDRAW_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARIMPRESS_60 : + case SotClipboardFormatId::STARIMPRESS_60 : return SvGlobalName( SO3_SIMPRESS_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARCALC_60 : + case SotClipboardFormatId::STARCALC_60 : return SvGlobalName( SO3_SC_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARCHART_60 : + case SotClipboardFormatId::STARCHART_60 : return SvGlobalName( SO3_SCH_CLASSID_60 ); - case SOT_FORMATSTR_ID_STARMATH_60 : + case SotClipboardFormatId::STARMATH_60 : return SvGlobalName( SO3_SM_CLASSID_60 ); default : return SvGlobalName(); @@ -492,7 +492,7 @@ public: bool m_bDirty; // ??? bool m_bIsLinked; bool m_bListCreated; - sal_uLong m_nFormat; + SotClipboardFormatId m_nFormat; OUString m_aUserTypeName; SvGlobalName m_aClassId; @@ -1540,7 +1540,7 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const OU , m_bDirty( false ) , m_bIsLinked( true ) , m_bListCreated( false ) - , m_nFormat( 0 ) + , m_nFormat( SotClipboardFormatId::NONE ) , m_aClassId( SvGlobalName() ) , m_bRepairPackage( bIsRepair ) , m_xProgressHandler( xProgressHandler ) @@ -1573,7 +1573,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBSt , m_bDirty( false ) , m_bIsLinked( false ) , m_bListCreated( false ) - , m_nFormat( 0 ) + , m_nFormat( SotClipboardFormatId::NONE ) , m_aClassId( SvGlobalName() ) , m_bRepairPackage( bIsRepair ) , m_xProgressHandler( xProgressHandler ) @@ -1624,7 +1624,7 @@ UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool , m_bDirty( false ) , m_bIsLinked( false ) , m_bListCreated( false ) - , m_nFormat( 0 ) + , m_nFormat( SotClipboardFormatId::NONE ) , m_aClassId( SvGlobalName() ) , m_bRepairPackage( false ) { @@ -2429,7 +2429,7 @@ void UCBStorage::SetDirty() pImp->m_bDirty = true; } -void UCBStorage::SetClass( const SvGlobalName & rClass, sal_uLong nOriginalClipFormat, const OUString & rUserTypeName ) +void UCBStorage::SetClass( const SvGlobalName & rClass, SotClipboardFormatId nOriginalClipFormat, const OUString & rUserTypeName ) { pImp->m_aClassId = rClass; pImp->m_nFormat = nOriginalClipFormat; @@ -2454,7 +2454,7 @@ void UCBStorage::SetClassId( const ClsId& rClsId ) // kept up to date, and also the other type information that is hold only at runtime because it can be reconstructed from // the content type pImp->m_nFormat = GetFormatId_Impl( pImp->m_aClassId ); - if ( pImp->m_nFormat ) + if ( pImp->m_nFormat != SotClipboardFormatId::NONE ) { ::com::sun::star::datatransfer::DataFlavor aDataFlavor; SotExchange::GetFormatDataFlavor( pImp->m_nFormat, aDataFlavor ); @@ -2468,7 +2468,7 @@ const ClsId& UCBStorage::GetClassId() const return ( const ClsId& ) pImp->m_aClassId.GetCLSID(); } -void UCBStorage::SetConvertClass( const SvGlobalName & /*rConvertClass*/, sal_uLong /*nOriginalClipFormat*/, const OUString & /*rUserTypeName*/ ) +void UCBStorage::SetConvertClass( const SvGlobalName & /*rConvertClass*/, SotClipboardFormatId /*nOriginalClipFormat*/, const OUString & /*rUserTypeName*/ ) { // ??? } @@ -2484,7 +2484,7 @@ SvGlobalName UCBStorage::GetClassName() return pImp->m_aClassId; } -sal_uLong UCBStorage::GetFormat() +SotClipboardFormatId UCBStorage::GetFormat() { return pImp->m_nFormat; } |