1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/uno/Sequence.hxx>
21 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
22 #include <com/sun/star/embed/XStorage.hpp>
23 #include <com/sun/star/embed/ElementModes.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <rtl/digest.h>
27 #include <osl/file.hxx>
28 #include <sot/stg.hxx>
29 #include <sot/storinfo.hxx>
30 #include <sot/storage.hxx>
31 #include <sot/formats.hxx>
32 #include <sot/exchange.hxx>
33 #include <unotools/ucbstreamhelper.hxx>
34 #include <tools/debug.hxx>
35 #include <tools/urlobj.hxx>
36 #include <unotools/localfilehelper.hxx>
37 #include <unotools/ucbhelper.hxx>
38 #include <comphelper/processfactory.hxx>
39 #include <boost/scoped_array.hpp>
40 #include <boost/scoped_ptr.hpp>
42 using namespace ::com::sun::star
;
44 /************** class SotStorageStream ***********************************/
45 class SotStorageStreamFactory
: public SotFactory
49 SotStorageStreamFactory( const SvGlobalName
& rName
,
50 const OUString
& rClassName
,
51 CreateInstanceType pCreateFuncP
)
52 : SotFactory( rName
, rClassName
, pCreateFuncP
)
55 TYPEINIT1(SotStorageStreamFactory
,SotFactory
);
58 SO2_IMPL_BASIC_CLASS1_DLL(SotStorageStream
,SotStorageStreamFactory
,SotObject
,
59 SvGlobalName( 0xd7deb420, 0xf902, 0x11d0,
60 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
62 SvLockBytesRef
MakeLockBytes_Impl( const OUString
& rName
, StreamMode nMode
)
65 if( !rName
.isEmpty() )
67 SvStream
* pFileStm
= new SvFileStream( rName
, nMode
);
68 xLB
= new SvLockBytes( pFileStm
, true );
72 SvStream
* pCacheStm
= new SvMemoryStream();
73 xLB
= new SvLockBytes( pCacheStm
, true );
78 SotStorageStream::SotStorageStream( const OUString
& rName
, StreamMode nMode
)
79 : SvStream( MakeLockBytes_Impl( rName
, nMode
) )
82 if( nMode
& StreamMode::WRITE
)
88 SotStorageStream::SotStorageStream( BaseStorageStream
* pStm
)
92 if( StreamMode::WRITE
& pStm
->GetMode() )
98 SetError( pStm
->GetError() );
105 SetError( SVSTREAM_INVALID_PARAMETER
);
109 SotStorageStream::SotStorageStream()
112 // ??? wenn Init virtuell ist, entsprechen setzen
116 SotStorageStream::~SotStorageStream()
118 Flush(); //SetBufferSize(0);
122 void SotStorageStream::ResetError()
124 SvStream::ResetError();
126 pOwnStm
->ResetError();
129 sal_uLong
SotStorageStream::GetData( void* pData
, sal_uLong nSize
)
135 nRet
= pOwnStm
->Read( pData
, nSize
);
136 SetError( pOwnStm
->GetError() );
139 nRet
= SvStream::GetData( pData
, nSize
);
144 sal_uLong
SotStorageStream::PutData( const void* pData
, sal_uLong nSize
)
150 nRet
= pOwnStm
->Write( pData
, nSize
);
151 SetError( pOwnStm
->GetError() );
154 nRet
= SvStream::PutData( pData
, nSize
);
158 sal_uInt64
SotStorageStream::SeekPos(sal_uInt64 nPos
)
164 nRet
= pOwnStm
->Seek( nPos
);
165 SetError( pOwnStm
->GetError() );
168 nRet
= SvStream::SeekPos( nPos
);
173 void SotStorageStream::FlushData()
178 SetError( pOwnStm
->GetError() );
181 SvStream::FlushData();
184 void SotStorageStream::SetSize(sal_uInt64
const nNewSize
)
186 sal_uInt64
const nPos
= Tell();
189 pOwnStm
->SetSize( nNewSize
);
190 SetError( pOwnStm
->GetError() );
193 SvStream::SetSize( nNewSize
);
195 if( nNewSize
< nPos
)
200 sal_uInt32
SotStorageStream::GetSize() const
202 sal_uLong nPos
= Tell();
203 const_cast<SotStorageStream
*>(this)->Seek( STREAM_SEEK_TO_END
);
204 sal_uLong nSize
= Tell();
205 const_cast<SotStorageStream
*>(this)->Seek( nPos
);
209 sal_uInt64
SotStorageStream::remainingSize()
212 return pOwnStm
->GetSize() - Tell();
214 return SvStream::remainingSize();
217 bool SotStorageStream::CopyTo( SotStorageStream
* pDestStm
)
219 Flush(); // alle Daten schreiben
220 pDestStm
->ClearBuffer();
221 if( !pOwnStm
|| !pDestStm
->pOwnStm
)
223 // Wenn Ole2 oder nicht nur eigene StorageStreams
224 sal_uLong nPos
= Tell(); // Position merken
226 pDestStm
->SetSize( 0 ); // Ziel-Stream leeren
228 boost::scoped_array
<sal_uInt8
> pMem(new sal_uInt8
[ 8192 ]);
230 while( 0 != (nRead
= Read( pMem
.get(), 8192 )) )
232 if( nRead
!= pDestStm
->Write( pMem
.get(), nRead
) )
234 SetError( SVSTREAM_GENERALERROR
);
240 pDestStm
->Seek( nPos
);
245 pOwnStm
->CopyTo( pDestStm
->pOwnStm
);
246 SetError( pOwnStm
->GetError() );
248 return GetError() == SVSTREAM_OK
;
251 bool SotStorageStream::Commit()
256 if( pOwnStm
->GetError() == SVSTREAM_OK
)
258 SetError( pOwnStm
->GetError() );
260 return GetError() == SVSTREAM_OK
;
263 bool SotStorageStream::SetProperty( const OUString
& rName
, const ::com::sun::star::uno::Any
& rValue
)
265 UCBStorageStream
* pStg
= PTR_CAST( UCBStorageStream
, pOwnStm
);
268 return pStg
->SetProperty( rName
, rValue
);
272 OSL_FAIL("Not implemented!");
277 /************** class SotStorage ******************************************
278 *************************************************************************/
279 class SotStorageFactory
: public SotFactory
283 SotStorageFactory( const SvGlobalName
& rName
,
284 const OUString
& rClassName
,
285 CreateInstanceType pCreateFuncP
)
286 : SotFactory( rName
, rClassName
, pCreateFuncP
)
289 TYPEINIT1(SotStorageFactory
,SotFactory
);
292 SO2_IMPL_BASIC_CLASS1_DLL(SotStorage
,SotStorageFactory
,SotObject
,
293 SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
294 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
296 /************************************************************************
298 |* SotStorage::SotStorage()
300 |* Beschreibung Es muss ein I... Objekt an SvObject uebergeben
301 |* werden, da es sonst selbst ein IUnknown anlegt und
302 |* festlegt, dass alle weiteren I... Objekte mit
303 |* delete zerstoert werden (Owner() == true).
304 |* Es werden aber nur IStorage Objekte benutzt und nicht
305 |* selbst implementiert, deshalb wird so getan, als ob
306 |* das IStorage Objekt von aussen kam und es wird mit
307 |* Release() freigegeben.
308 |* Die CreateStorage Methoden werden benoetigt, um
309 |* ein IStorage Objekt vor dem Aufruf von SvObject
310 |* zu erzeugen (Own, !Own automatik).
311 |* Hat CreateStorage ein Objekt erzeugt, dann wurde
312 |* der RefCounter schon um 1 erhoet.
313 |* Die Uebergabe erfolgt in pStorageCTor. Die Variable
314 |* ist NULL, wenn es nicht geklappt hat.
316 *************************************************************************/
317 #define INIT_SotStorage() \
318 : m_pOwnStg( NULL ) \
319 , m_pStorStm( NULL ) \
320 , m_nError( SVSTREAM_OK ) \
321 , m_bIsRoot( false ) \
322 , m_bDelStm( false ) \
323 , m_nVersion( SOFFICE_FILEFORMAT_CURRENT )
325 SotStorage::SotStorage()
328 // ??? What's this ???
331 #define ERASEMASK ( StreamMode::TRUNC | StreamMode::WRITE | StreamMode::SHARE_DENYALL )
332 #include <com/sun/star/uno/Reference.h>
333 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
334 #include <ucbhelper/content.hxx>
336 SotStorage::SotStorage( const OUString
& rName
, StreamMode nMode
, bool transacted
)
339 m_aName
= rName
; // Namen merken
340 CreateStorage( true, nMode
, transacted
);
341 if ( IsOLEStorage() )
342 m_nVersion
= SOFFICE_FILEFORMAT_50
;
345 void SotStorage::CreateStorage( bool bForceUCBStorage
, StreamMode nMode
, bool transacted
)
347 DBG_ASSERT( !m_pStorStm
&& !m_pOwnStg
, "Use only in ctor!" );
348 if( !m_aName
.isEmpty() )
351 if( ( ( nMode
& ERASEMASK
) == ERASEMASK
) )
352 ::utl::UCBContentHelper::Kill( m_aName
);
354 INetURLObject
aObj( m_aName
);
355 if ( aObj
.GetProtocol() == INetProtocol::NotValid
)
358 ::utl::LocalFileHelper::ConvertPhysicalNameToURL( m_aName
, aURL
);
360 m_aName
= aObj
.GetMainURL( INetURLObject::NO_DECODE
);
364 m_pStorStm
= ::utl::UcbStreamHelper::CreateStream( m_aName
, nMode
);
365 if ( m_pStorStm
&& m_pStorStm
->GetError() )
366 DELETEZ( m_pStorStm
);
370 // try as UCBStorage, next try as OLEStorage
371 bool bIsUCBStorage
= UCBStorage::IsStorageFile( m_pStorStm
);
372 if ( !bIsUCBStorage
&& bForceUCBStorage
)
373 // if UCBStorage has priority, it should not be used only if it is really an OLEStorage
374 bIsUCBStorage
= !Storage::IsStorageFile( m_pStorStm
);
378 if ( !(UCBStorage::GetLinkedFile( *m_pStorStm
).isEmpty()) )
380 // detect special unpacked storages
381 m_pOwnStg
= new UCBStorage( *m_pStorStm
, !transacted
);
386 // UCBStorage always works directly on the UCB content, so discard the stream first
387 DELETEZ( m_pStorStm
);
388 m_pOwnStg
= new UCBStorage( m_aName
, nMode
, !transacted
);
393 // OLEStorage can be opened with a stream
394 m_pOwnStg
= new Storage( *m_pStorStm
, !transacted
);
398 else if ( bForceUCBStorage
)
400 m_pOwnStg
= new UCBStorage( m_aName
, nMode
, !transacted
);
401 SetError( ERRCODE_IO_NOTSUPPORTED
);
405 m_pOwnStg
= new Storage( m_aName
, nMode
, !transacted
);
406 SetError( ERRCODE_IO_NOTSUPPORTED
);
412 if ( bForceUCBStorage
)
413 m_pOwnStg
= new UCBStorage( m_aName
, nMode
, !transacted
);
415 m_pOwnStg
= new Storage( m_aName
, nMode
, !transacted
);
416 m_aName
= m_pOwnStg
->GetName();
419 SetError( m_pOwnStg
->GetError() );
421 SignAsRoot( m_pOwnStg
->IsRoot() );
424 SotStorage::SotStorage( bool bUCBStorage
, const OUString
& rName
, StreamMode nMode
)
428 CreateStorage( bUCBStorage
, nMode
, false );
429 if ( IsOLEStorage() )
430 m_nVersion
= SOFFICE_FILEFORMAT_50
;
433 SotStorage::SotStorage( BaseStorage
* pStor
)
438 m_aName
= pStor
->GetName(); // Namen merken
439 SignAsRoot( pStor
->IsRoot() );
440 SetError( pStor
->GetError() );
444 sal_uLong nErr
= m_pOwnStg
? m_pOwnStg
->GetError() : SVSTREAM_CANNOT_MAKE
;
446 if ( IsOLEStorage() )
447 m_nVersion
= SOFFICE_FILEFORMAT_50
;
450 SotStorage::SotStorage( bool bUCBStorage
, SvStream
& rStm
)
453 SetError( rStm
.GetError() );
455 // try as UCBStorage, next try as OLEStorage
456 if ( UCBStorage::IsStorageFile( &rStm
) || bUCBStorage
)
457 m_pOwnStg
= new UCBStorage( rStm
, false );
459 m_pOwnStg
= new Storage( rStm
, false );
461 SetError( m_pOwnStg
->GetError() );
463 if ( IsOLEStorage() )
464 m_nVersion
= SOFFICE_FILEFORMAT_50
;
466 SignAsRoot( m_pOwnStg
->IsRoot() );
469 SotStorage::SotStorage( SvStream
& rStm
)
472 SetError( rStm
.GetError() );
474 // try as UCBStorage, next try as OLEStorage
475 if ( UCBStorage::IsStorageFile( &rStm
) )
476 m_pOwnStg
= new UCBStorage( rStm
, false );
478 m_pOwnStg
= new Storage( rStm
, false );
480 SetError( m_pOwnStg
->GetError() );
482 if ( IsOLEStorage() )
483 m_nVersion
= SOFFICE_FILEFORMAT_50
;
485 SignAsRoot( m_pOwnStg
->IsRoot() );
488 SotStorage::SotStorage( SvStream
* pStm
, bool bDelete
)
491 SetError( pStm
->GetError() );
493 // try as UCBStorage, next try as OLEStorage
494 if ( UCBStorage::IsStorageFile( pStm
) )
495 m_pOwnStg
= new UCBStorage( *pStm
, false );
497 m_pOwnStg
= new Storage( *pStm
, false );
499 SetError( m_pOwnStg
->GetError() );
503 if ( IsOLEStorage() )
504 m_nVersion
= SOFFICE_FILEFORMAT_50
;
506 SignAsRoot( m_pOwnStg
->IsRoot() );
509 SotStorage::~SotStorage()
516 SvMemoryStream
* SotStorage::CreateMemoryStream()
518 SvMemoryStream
* pStm
= NULL
;
519 pStm
= new SvMemoryStream( 0x8000, 0x8000 );
520 tools::SvRef
<SotStorage
> aStg
= new SotStorage( *pStm
);
527 aStg
.Clear(); // Storage vorher freigeben
534 bool SotStorage::IsStorageFile( const OUString
& rFileName
)
536 OUString
aName( rFileName
);
537 INetURLObject
aObj( aName
);
538 if ( aObj
.GetProtocol() == INetProtocol::NotValid
)
541 ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName
, aURL
);
543 aName
= aObj
.GetMainURL( INetURLObject::NO_DECODE
);
546 boost::scoped_ptr
<SvStream
> pStm(::utl::UcbStreamHelper::CreateStream( aName
, STREAM_STD_READ
));
547 bool bRet
= SotStorage::IsStorageFile( pStm
.get() );
551 bool SotStorage::IsStorageFile( SvStream
* pStream
)
553 /** code for new storages must come first! **/
556 long nPos
= pStream
->Tell();
557 bool bRet
= UCBStorage::IsStorageFile( pStream
);
559 bRet
= Storage::IsStorageFile( pStream
);
560 pStream
->Seek( nPos
);
567 const OUString
& SotStorage::GetName() const
569 if( m_aName
.isEmpty() )
571 DBG_ASSERT( Owner(), "must be owner" );
573 const_cast<SotStorage
*>(this)->m_aName
= m_pOwnStg
->GetName();
578 void SotStorage::SetClass( const SvGlobalName
& rName
,
579 SotClipboardFormatId nOriginalClipFormat
,
580 const OUString
& rUserTypeName
)
582 DBG_ASSERT( Owner(), "must be owner" );
584 m_pOwnStg
->SetClass( rName
, nOriginalClipFormat
, rUserTypeName
);
586 SetError( SVSTREAM_GENERALERROR
);
589 SvGlobalName
SotStorage::GetClassName()
592 DBG_ASSERT( Owner(), "must be owner" );
594 aGN
= m_pOwnStg
->GetClassName();
596 SetError( SVSTREAM_GENERALERROR
);
600 SotClipboardFormatId
SotStorage::GetFormat()
602 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
;
603 DBG_ASSERT( Owner(), "must be owner" );
605 nFormat
= m_pOwnStg
->GetFormat();
607 SetError( SVSTREAM_GENERALERROR
);
611 OUString
SotStorage::GetUserName()
614 DBG_ASSERT( Owner(), "must be owner" );
616 aName
= m_pOwnStg
->GetUserName();
618 SetError( SVSTREAM_GENERALERROR
);
622 void SotStorage::FillInfoList( SvStorageInfoList
* pFillList
) const
624 DBG_ASSERT( Owner(), "must be owner" );
626 m_pOwnStg
->FillInfoList( pFillList
);
629 bool SotStorage::CopyTo( SotStorage
* pDestStg
)
631 DBG_ASSERT( Owner(), "must be owner" );
632 DBG_ASSERT( pDestStg
->Owner(), "must be owner" );
633 if( m_pOwnStg
&& pDestStg
->m_pOwnStg
)
635 m_pOwnStg
->CopyTo( pDestStg
->m_pOwnStg
);
636 SetError( m_pOwnStg
->GetError() );
637 pDestStg
->m_aKey
= m_aKey
;
638 pDestStg
->m_nVersion
= m_nVersion
;
641 SetError( SVSTREAM_GENERALERROR
);
643 return SVSTREAM_OK
== GetError();
646 bool SotStorage::Commit()
648 DBG_ASSERT( Owner(), "must be owner" );
651 if( !m_pOwnStg
->Commit() )
652 SetError( m_pOwnStg
->GetError() );
655 SetError( SVSTREAM_GENERALERROR
);
657 return SVSTREAM_OK
== GetError();
660 SotStorageStream
* SotStorage::OpenSotStream( const OUString
& rEleName
,
663 SotStorageStream
* pStm
= NULL
;
664 DBG_ASSERT( Owner(), "must be owner" );
667 // volle Ole-Patches einschalten
668 // egal was kommt, nur exclusiv gestattet
669 nMode
|= StreamMode::SHARE_DENYALL
;
670 ErrCode nE
= m_pOwnStg
->GetError();
671 BaseStorageStream
* p
= m_pOwnStg
->OpenStream( rEleName
, nMode
, true );
672 pStm
= new SotStorageStream( p
);
675 m_pOwnStg
->ResetError(); // kein Fehler setzen
676 if( nMode
& StreamMode::TRUNC
)
680 SetError( SVSTREAM_GENERALERROR
);
685 SotStorage
* SotStorage::OpenSotStorage( const OUString
& rEleName
,
689 DBG_ASSERT( Owner(), "must be owner" );
692 nMode
|= StreamMode::SHARE_DENYALL
;
693 ErrCode nE
= m_pOwnStg
->GetError();
694 BaseStorage
* p
= m_pOwnStg
->OpenStorage(rEleName
, nMode
, !transacted
);
697 SotStorage
* pStor
= new SotStorage( p
);
699 m_pOwnStg
->ResetError(); // kein Fehler setzen
705 SetError( SVSTREAM_GENERALERROR
);
710 bool SotStorage::IsStorage( const OUString
& rEleName
) const
712 DBG_ASSERT( Owner(), "must be owner" );
713 // ein bisschen schneller
715 return m_pOwnStg
->IsStorage( rEleName
);
720 bool SotStorage::IsStream( const OUString
& rEleName
) const
722 DBG_ASSERT( Owner(), "must be owner" );
723 // ein bisschen schneller
725 return m_pOwnStg
->IsStream( rEleName
);
730 bool SotStorage::IsContained( const OUString
& rEleName
) const
732 DBG_ASSERT( Owner(), "must be owner" );
733 // ein bisschen schneller
735 return m_pOwnStg
->IsContained( rEleName
);
740 bool SotStorage::Remove( const OUString
& rEleName
)
742 DBG_ASSERT( Owner(), "must be owner" );
745 m_pOwnStg
->Remove( rEleName
);
746 SetError( m_pOwnStg
->GetError() );
749 SetError( SVSTREAM_GENERALERROR
);
751 return SVSTREAM_OK
== GetError();
754 bool SotStorage::CopyTo( const OUString
& rEleName
,
755 SotStorage
* pNewSt
, const OUString
& rNewName
)
757 DBG_ASSERT( Owner(), "must be owner" );
758 DBG_ASSERT( pNewSt
->Owner(), "must be owner" );
761 m_pOwnStg
->CopyTo( rEleName
, pNewSt
->m_pOwnStg
, rNewName
);
762 SetError( m_pOwnStg
->GetError() );
763 SetError( pNewSt
->GetError() );
766 SetError( SVSTREAM_GENERALERROR
);
768 return SVSTREAM_OK
== GetError();
771 bool SotStorage::Validate()
773 DBG_ASSERT( m_bIsRoot
, "Validate nur an Rootstorage" );
775 return m_pOwnStg
->ValidateFAT();
780 bool SotStorage::IsOLEStorage() const
782 UCBStorage
* pStg
= PTR_CAST( UCBStorage
, m_pOwnStg
);
786 bool SotStorage::IsOLEStorage( const OUString
& rFileName
)
788 return Storage::IsStorageFile( rFileName
);
791 bool SotStorage::IsOLEStorage( SvStream
* pStream
)
793 return Storage::IsStorageFile( pStream
);
796 SotStorage
* SotStorage::OpenOLEStorage( const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xStorage
,
797 const OUString
& rEleName
, StreamMode nMode
)
799 sal_Int32 nEleMode
= embed::ElementModes::SEEKABLEREAD
;
800 if ( nMode
& StreamMode::WRITE
)
801 nEleMode
|= embed::ElementModes::WRITE
;
802 if ( nMode
& StreamMode::TRUNC
)
803 nEleMode
|= embed::ElementModes::TRUNCATE
;
804 if ( nMode
& StreamMode::NOCREATE
)
805 nEleMode
|= embed::ElementModes::NOCREATE
;
807 SvStream
* pStream
= NULL
;
810 uno::Reference
< io::XStream
> xStream
= xStorage
->openStreamElement( rEleName
, nEleMode
);
812 // TODO/LATER: should it be done this way?
813 if ( nMode
& StreamMode::WRITE
)
815 uno::Reference
< beans::XPropertySet
> xStreamProps( xStream
, uno::UNO_QUERY_THROW
);
816 xStreamProps
->setPropertyValue(
817 OUString( "MediaType" ),
818 uno::makeAny( OUString( "application/vnd.sun.star.oleobject" ) ) );
821 pStream
= utl::UcbStreamHelper::CreateStream( xStream
);
823 catch ( uno::Exception
& )
825 //TODO/LATER: ErrorHandling
826 pStream
= new SvMemoryStream
;
827 pStream
->SetError( ERRCODE_IO_GENERAL
);
830 return new SotStorage( pStream
, true );
833 SotClipboardFormatId
SotStorage::GetFormatID( const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xStorage
)
835 uno::Reference
< beans::XPropertySet
> xProps( xStorage
, uno::UNO_QUERY
);
837 return SotClipboardFormatId::NONE
;
840 xProps
->getPropertyValue("MediaType") >>= aMediaType
;
841 if ( !aMediaType
.isEmpty() )
843 ::com::sun::star::datatransfer::DataFlavor aDataFlavor
;
844 aDataFlavor
.MimeType
= aMediaType
;
845 return SotExchange::GetFormat( aDataFlavor
);
848 return SotClipboardFormatId::NONE
;
851 sal_Int32
SotStorage::GetVersion( const com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
>& xStorage
)
853 SotClipboardFormatId nSotFormatID
= SotStorage::GetFormatID( xStorage
);
854 switch( nSotFormatID
)
856 case SotClipboardFormatId::STARWRITER_8
:
857 case SotClipboardFormatId::STARWRITER_8_TEMPLATE
:
858 case SotClipboardFormatId::STARWRITERWEB_8
:
859 case SotClipboardFormatId::STARWRITERGLOB_8
:
860 case SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE
:
861 case SotClipboardFormatId::STARDRAW_8
:
862 case SotClipboardFormatId::STARDRAW_8_TEMPLATE
:
863 case SotClipboardFormatId::STARIMPRESS_8
:
864 case SotClipboardFormatId::STARIMPRESS_8_TEMPLATE
:
865 case SotClipboardFormatId::STARCALC_8
:
866 case SotClipboardFormatId::STARCALC_8_TEMPLATE
:
867 case SotClipboardFormatId::STARCHART_8
:
868 case SotClipboardFormatId::STARCHART_8_TEMPLATE
:
869 case SotClipboardFormatId::STARMATH_8
:
870 case SotClipboardFormatId::STARMATH_8_TEMPLATE
:
871 return SOFFICE_FILEFORMAT_8
;
872 case SotClipboardFormatId::STARWRITER_60
:
873 case SotClipboardFormatId::STARWRITERWEB_60
:
874 case SotClipboardFormatId::STARWRITERGLOB_60
:
875 case SotClipboardFormatId::STARDRAW_60
:
876 case SotClipboardFormatId::STARIMPRESS_60
:
877 case SotClipboardFormatId::STARCALC_60
:
878 case SotClipboardFormatId::STARCHART_60
:
879 case SotClipboardFormatId::STARMATH_60
:
880 return SOFFICE_FILEFORMAT_60
;
887 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */