LibreOffice Module sot (master) 1
storage.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21#include <sal/log.hxx>
22
23#include <com/sun/star/embed/XStorage.hpp>
24#include <com/sun/star/embed/ElementModes.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26
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>
35#include <tools/debug.hxx>
36#include <tools/urlobj.hxx>
39#include <com/sun/star/uno/Reference.h>
40
41#include <memory>
42
43using namespace ::com::sun::star;
44
45static SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode )
46{
48 if( !rName.isEmpty() )
49 {
50 SvStream * pFileStm = new SvFileStream( rName, nMode );
51 xLB = new SvLockBytes( pFileStm, true );
52 }
53 else
54 {
55 SvStream * pCacheStm = new SvMemoryStream();
56 xLB = new SvLockBytes( pCacheStm, true );
57 }
58 return xLB;
59}
60
61SotTempStream::SotTempStream( const OUString & rName, StreamMode nMode )
62 : SvStream( MakeLockBytes_Impl( rName, nMode ).get() )
63{
64 if( nMode & StreamMode::WRITE )
65 m_isWritable = true;
66 else
67 m_isWritable = false;
68}
69
71{
73}
74
76{
77 FlushBuffer(); // write all data
78
79 sal_uInt64 nPos = Tell(); // save position
80 Seek( 0 );
81 pDestStm->SetSize( 0 ); // empty target stream
82
83 constexpr int BUFSIZE = 64 * 1024;
84 std::unique_ptr<sal_uInt8[]> pMem(new sal_uInt8[ BUFSIZE ]);
85 sal_Int32 nRead;
86 while (0 != (nRead = ReadBytes(pMem.get(), BUFSIZE)))
87 {
88 if (nRead != static_cast<sal_Int32>(pDestStm->WriteBytes(pMem.get(), nRead)))
89 {
91 break;
92 }
93 }
94 pMem.reset();
95
96 // set position
97 pDestStm->Seek( nPos );
98 Seek( nPos );
99}
100
102 : pOwnStm(pStm)
103{
104 assert( pStm );
105 if( StreamMode::WRITE & pStm->GetMode() )
106 m_isWritable = true;
107 else
108 m_isWritable = false;
109
110 SetError( pStm->GetError() );
111 pStm->ResetError();
112}
113
115{
116 Flush();
117 delete pOwnStm;
118}
119
121{
124}
125
126std::size_t SotStorageStream::GetData(void* pData, std::size_t const nSize)
127{
128 std::size_t nRet = pOwnStm->Read( pData, nSize );
130 return nRet;
131}
132
133std::size_t SotStorageStream::PutData(const void* pData, std::size_t const nSize)
134{
135 std::size_t nRet = pOwnStm->Write( pData, nSize );
137 return nRet;
138}
139
140sal_uInt64 SotStorageStream::SeekPos(sal_uInt64 nPos)
141{
142 sal_uInt64 nRet = pOwnStm->Seek( nPos );
144 return nRet;
145}
146
148{
149 pOwnStm->Flush();
151}
152
153void SotStorageStream::SetSize(sal_uInt64 const nNewSize)
154{
155 sal_uInt64 const nPos = Tell();
156 pOwnStm->SetSize( nNewSize );
158
159 if( nNewSize < nPos )
160 // jump to the end
161 Seek( nNewSize );
162}
163
165{
166 sal_uInt64 nSize = const_cast<SotStorageStream*>(this)->TellEnd();
167 return nSize;
168}
169
171{
172 // Need to flush the buffer so we materialise the stream and return the correct answer
173 // otherwise we return a 0 value from StgEntry::GetSize
174 FlushBuffer();
175
176 return pOwnStm->GetSize();
177}
178
180{
181 pOwnStm->Flush();
182 if( pOwnStm->GetError() == ERRCODE_NONE )
183 pOwnStm->Commit();
185}
186
187bool SotStorageStream::SetProperty( const OUString& rName, const css::uno::Any& rValue )
188{
189 UCBStorageStream* pStg = dynamic_cast<UCBStorageStream*>( pOwnStm );
190 if ( pStg )
191 {
192 return pStg->SetProperty( rName, rValue );
193 }
194 else
195 {
196 OSL_FAIL("Not implemented!");
197 return false;
198 }
199}
200
217#define INIT_SotStorage() \
218 : m_pOwnStg( nullptr ) \
219 , m_pStorStm( nullptr ) \
220 , m_nError( ERRCODE_NONE ) \
221 , m_bIsRoot( false ) \
222 , m_bDelStm( false ) \
223 , m_nVersion( SOFFICE_FILEFORMAT_CURRENT )
224
225#define ERASEMASK ( StreamMode::TRUNC | StreamMode::WRITE | StreamMode::SHARE_DENYALL )
226
227SotStorage::SotStorage( const OUString & rName, StreamMode nMode )
229{
230 m_aName = rName; // save name
231 CreateStorage( true, nMode );
232 if ( IsOLEStorage() )
233 m_nVersion = SOFFICE_FILEFORMAT_50;
234}
235
236void SotStorage::CreateStorage( bool bForceUCBStorage, StreamMode nMode )
237{
238 DBG_ASSERT( !m_pStorStm && !m_pOwnStg, "Use only in ctor!" );
239 if( !m_aName.isEmpty() )
240 {
241 // named storage
242 if( ( nMode & ERASEMASK ) == ERASEMASK )
243 ::utl::UCBContentHelper::Kill( m_aName );
244
245 INetURLObject aObj( m_aName );
246 if ( aObj.GetProtocol() == INetProtocol::NotValid )
247 {
248 OUString aURL;
249 osl::FileBase::getFileURLFromSystemPath( m_aName, aURL );
250 aObj.SetURL( aURL );
252 }
253
254 // check the stream
256 if ( m_pStorStm && m_pStorStm->GetError() )
257 {
258 delete m_pStorStm;
259 m_pStorStm = nullptr;
260 }
261
262 if ( m_pStorStm )
263 {
264 // try as UCBStorage, next try as OLEStorage
265 bool bIsUCBStorage = UCBStorage::IsStorageFile( m_pStorStm );
266 if ( !bIsUCBStorage && bForceUCBStorage )
267 // if UCBStorage has priority, it should not be used only if it is really an OLEStorage
268 bIsUCBStorage = !Storage::IsStorageFile( m_pStorStm );
269
270 if ( bIsUCBStorage )
271 {
272 // UCBStorage always works directly on the UCB content, so discard the stream first
273 delete m_pStorStm;
274 m_pStorStm = nullptr;
275 m_pOwnStg = new UCBStorage( m_aName, nMode, true, true/*bIsRoot*/ );
276 }
277 else
278 {
279 // OLEStorage can be opened with a stream
280 m_pOwnStg = new Storage( *m_pStorStm, true );
281 m_bDelStm = true;
282 }
283 }
284 else if ( bForceUCBStorage )
285 {
286 m_pOwnStg = new UCBStorage( m_aName, nMode, true, true/*bIsRoot*/ );
288 }
289 else
290 {
291 m_pOwnStg = new Storage( m_aName, nMode, true );
293 }
294 }
295 else
296 {
297 // temporary storage
298 if ( bForceUCBStorage )
299 m_pOwnStg = new UCBStorage( m_aName, nMode, true, true/*bIsRoot*/ );
300 else
301 m_pOwnStg = new Storage( m_aName, nMode, true );
303 }
304
306
308}
309
310SotStorage::SotStorage( bool bUCBStorage, const OUString & rName, StreamMode nMode )
312{
313 m_aName = rName;
314 CreateStorage( bUCBStorage, nMode );
315 if ( IsOLEStorage() )
316 m_nVersion = SOFFICE_FILEFORMAT_50;
317}
318
321{
322 if ( pStor )
323 {
324 m_aName = pStor->GetName(); // save name
325 SignAsRoot( pStor->IsRoot() );
326 SetError( pStor->GetError() );
327 }
328
329 m_pOwnStg = pStor;
330 const ErrCode nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE;
331 SetError( nErr );
332 if ( IsOLEStorage() )
333 m_nVersion = SOFFICE_FILEFORMAT_50;
334}
335
336SotStorage::SotStorage( bool bUCBStorage, SvStream & rStm )
338{
339 SetError( rStm.GetError() );
340
341 // try as UCBStorage, next try as OLEStorage
342 if ( UCBStorage::IsStorageFile( &rStm ) || bUCBStorage )
343 m_pOwnStg = new UCBStorage( rStm, false );
344 else
345 m_pOwnStg = new Storage( rStm, false );
346
347 SetError( m_pOwnStg->GetError() );
348
349 if ( IsOLEStorage() )
350 m_nVersion = SOFFICE_FILEFORMAT_50;
351
352 SignAsRoot( m_pOwnStg->IsRoot() );
353}
354
357{
358 SetError( rStm.GetError() );
359
360 // try as UCBStorage, next try as OLEStorage
361 if ( UCBStorage::IsStorageFile( &rStm ) )
362 m_pOwnStg = new UCBStorage( rStm, false );
363 else
364 m_pOwnStg = new Storage( rStm, false );
365
366 SetError( m_pOwnStg->GetError() );
367
368 if ( IsOLEStorage() )
369 m_nVersion = SOFFICE_FILEFORMAT_50;
370
371 SignAsRoot( m_pOwnStg->IsRoot() );
372}
373
374SotStorage::SotStorage( SvStream * pStm, bool bDelete )
376{
377 SetError( pStm->GetError() );
378
379 // try as UCBStorage, next try as OLEStorage
380 if ( UCBStorage::IsStorageFile( pStm ) )
381 m_pOwnStg = new UCBStorage( *pStm, false );
382 else
383 m_pOwnStg = new Storage( *pStm, false );
384
385 SetError( m_pOwnStg->GetError() );
386
387 m_pStorStm = pStm;
388 m_bDelStm = bDelete;
389 if ( IsOLEStorage() )
390 m_nVersion = SOFFICE_FILEFORMAT_50;
391
392 SignAsRoot( m_pOwnStg->IsRoot() );
393}
394
396{
397 delete m_pOwnStg;
398 if( m_bDelStm )
399 delete m_pStorStm;
400}
401
402std::unique_ptr<SvMemoryStream> SotStorage::CreateMemoryStream()
403{
404 std::unique_ptr<SvMemoryStream> pStm(new SvMemoryStream( 0x8000, 0x8000 ));
405 tools::SvRef<SotStorage> aStg = new SotStorage( *pStm );
406 if( CopyTo( aStg.get() ) )
407 {
408 aStg->Commit();
409 }
410 else
411 {
412 aStg.clear(); // release storage beforehand
413 pStm.reset();
414 }
415 return pStm;
416}
417
418bool SotStorage::IsStorageFile( const OUString & rFileName )
419{
420 OUString aName( rFileName );
421 INetURLObject aObj( aName );
422 if ( aObj.GetProtocol() == INetProtocol::NotValid )
423 {
424 OUString aURL;
425 osl::FileBase::getFileURLFromSystemPath( aName, aURL );
426 aObj.SetURL( aURL );
428 }
429
430 std::unique_ptr<SvStream> pStm(::utl::UcbStreamHelper::CreateStream( aName, StreamMode::STD_READ ));
431 bool bRet = SotStorage::IsStorageFile( pStm.get() );
432 return bRet;
433}
434
436{
438 if ( pStream )
439 {
440 sal_uInt64 nPos = pStream->Tell();
441 bool bRet = UCBStorage::IsStorageFile( pStream );
442 if ( !bRet )
443 bRet = Storage::IsStorageFile( pStream );
444 pStream->Seek( nPos );
445 return bRet;
446 }
447 else
448 return false;
449}
450
451const OUString & SotStorage::GetName() const
452{
453 if( m_aName.isEmpty() && m_pOwnStg )
454 const_cast<SotStorage *>(this)->m_aName = m_pOwnStg->GetName();
455 return m_aName;
456}
457
459 SotClipboardFormatId nOriginalClipFormat,
460 const OUString & rUserTypeName )
461{
462 if( m_pOwnStg )
463 m_pOwnStg->SetClass( rName, nOriginalClipFormat, rUserTypeName );
464 else
466}
467
469{
470 SvGlobalName aGN;
471 if( m_pOwnStg )
472 aGN = m_pOwnStg->GetClassName();
473 else
475 return aGN;
476}
477
479{
481 if( m_pOwnStg )
482 nFormat = m_pOwnStg->GetFormat();
483 else
485 return nFormat;
486}
487
489{
490 OUString aName;
491 if( m_pOwnStg )
493 else
495 return aName;
496}
497
499{
500 if( m_pOwnStg )
501 m_pOwnStg->FillInfoList( pFillList );
502}
503
505{
506 if( m_pOwnStg && pDestStg->m_pOwnStg )
507 {
508 m_pOwnStg->CopyTo( pDestStg->m_pOwnStg );
510 pDestStg->m_aKey = m_aKey;
511 pDestStg->m_nVersion = m_nVersion;
512 }
513 else
515
516 return ERRCODE_NONE == GetError();
517}
518
520{
521 if( m_pOwnStg )
522 {
523 if( !m_pOwnStg->Commit() )
525 }
526 else
528
529 return ERRCODE_NONE == GetError();
530}
531
533 StreamMode nMode )
534{
536 if( m_pOwnStg )
537 {
538 // enable full Ole patches,
539 // regardless what is coming, only exclusively allowed
540 nMode |= StreamMode::SHARE_DENYALL;
541 ErrCode nE = m_pOwnStg->GetError();
542 BaseStorageStream * p = m_pOwnStg->OpenStream( rEleName, nMode );
543 pStm = new SotStorageStream( p );
544
545 if( !nE )
546 m_pOwnStg->ResetError(); // don't set error
547 if( nMode & StreamMode::TRUNC )
548 pStm->SetSize( 0 );
549 }
550 else
552
553 return pStm;
554}
555
556SotStorage * SotStorage::OpenSotStorage( const OUString & rEleName,
557 StreamMode nMode,
558 bool transacted )
559{
560 if( m_pOwnStg )
561 {
562 nMode |= StreamMode::SHARE_DENYALL;
563 ErrCode nE = m_pOwnStg->GetError();
564 BaseStorage * p = m_pOwnStg->OpenStorage(rEleName, nMode, !transacted);
565 if( p )
566 {
567 SotStorage * pStor = new SotStorage( p );
568 if( !nE )
569 m_pOwnStg->ResetError(); // don't set error
570
571 return pStor;
572 }
573 }
574
576
577 return nullptr;
578}
579
580bool SotStorage::IsStorage( const OUString & rEleName ) const
581{
582 // a little bit faster
583 if( m_pOwnStg )
584 return m_pOwnStg->IsStorage( rEleName );
585
586 return false;
587}
588
589bool SotStorage::IsStream( const OUString & rEleName ) const
590{
591 // a little bit faster
592 if( m_pOwnStg )
593 return m_pOwnStg->IsStream( rEleName );
594
595 return false;
596}
597
598bool SotStorage::IsContained( const OUString & rEleName ) const
599{
600 // a little bit faster
601 if( m_pOwnStg )
602 return m_pOwnStg->IsContained( rEleName );
603
604 return false;
605}
606
607bool SotStorage::Remove( const OUString & rEleName )
608{
609 if( m_pOwnStg )
610 {
611 m_pOwnStg->Remove( rEleName );
613 }
614 else
616
617 return ERRCODE_NONE == GetError();
618}
619
620bool SotStorage::CopyTo( const OUString & rEleName,
621 SotStorage * pNewSt, const OUString & rNewName )
622{
623 if( m_pOwnStg )
624 {
625 m_pOwnStg->CopyTo( rEleName, pNewSt->m_pOwnStg, rNewName );
627 SetError( pNewSt->GetError() );
628 }
629 else
631
632 return ERRCODE_NONE == GetError();
633}
634
636{
637 DBG_ASSERT( m_bIsRoot, "Validate only if root storage" );
638 if( m_pOwnStg )
639 return m_pOwnStg->ValidateFAT();
640 else
641 return true;
642}
643
645{
646 UCBStorage* pStg = dynamic_cast<UCBStorage*>( m_pOwnStg );
647 return !pStg;
648}
649
650bool SotStorage::IsOLEStorage( const OUString & rFileName )
651{
652 return Storage::IsStorageFile( rFileName );
653}
654
656{
657 return Storage::IsStorageFile( pStream );
658}
659
660SotStorage* SotStorage::OpenOLEStorage( const css::uno::Reference < css::embed::XStorage >& xStorage,
661 const OUString& rEleName, StreamMode nMode )
662{
663 sal_Int32 nEleMode = embed::ElementModes::SEEKABLEREAD;
664 if ( nMode & StreamMode::WRITE )
665 nEleMode |= embed::ElementModes::WRITE;
666 if ( nMode & StreamMode::TRUNC )
667 nEleMode |= embed::ElementModes::TRUNCATE;
668 if ( nMode & StreamMode::NOCREATE )
669 nEleMode |= embed::ElementModes::NOCREATE;
670
671 std::unique_ptr<SvStream> pStream;
672 try
673 {
674 uno::Reference < io::XStream > xStream = xStorage->openStreamElement( rEleName, nEleMode );
675
676 // TODO/LATER: should it be done this way?
677 if ( nMode & StreamMode::WRITE )
678 {
679 uno::Reference < beans::XPropertySet > xStreamProps( xStream, uno::UNO_QUERY_THROW );
680 xStreamProps->setPropertyValue( "MediaType",
681 uno::Any( OUString( "application/vnd.sun.star.oleobject" ) ) );
682 }
683
685 }
686 catch ( uno::Exception& )
687 {
688 //TODO/LATER: ErrorHandling
689 pStream.reset( new SvMemoryStream );
690 pStream->SetError( ERRCODE_IO_GENERAL );
691 }
692
693 return new SotStorage( pStream.release(), true );
694}
695
696SotClipboardFormatId SotStorage::GetFormatID( const css::uno::Reference < css::embed::XStorage >& xStorage )
697{
698 uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY );
699 if ( !xProps.is() )
701
702 OUString aMediaType;
703 try
704 {
705 xProps->getPropertyValue("MediaType") >>= aMediaType;
706 }
707 catch (uno::Exception const&)
708 {
709 TOOLS_INFO_EXCEPTION("sot", "SotStorage::GetFormatID");
710 }
711
712 if ( !aMediaType.isEmpty() )
713 {
714 css::datatransfer::DataFlavor aDataFlavor;
715 aDataFlavor.MimeType = aMediaType;
716 return SotExchange::GetFormat( aDataFlavor );
717 }
718
720}
721
722sal_Int32 SotStorage::GetVersion( const css::uno::Reference < css::embed::XStorage >& xStorage )
723{
724 SotClipboardFormatId nSotFormatID = SotStorage::GetFormatID( xStorage );
725 switch( nSotFormatID )
726 {
752 default: break;
753 }
754
755 return 0;
756}
757
758namespace
759{
760 void traverse(const tools::SvRef<SotStorage>& rStorage, std::vector<unsigned char>& rBuf)
761 {
762 SvStorageInfoList infos;
763
764 rStorage->FillInfoList(&infos);
765
766 for (const auto& info: infos)
767 {
768 if (info.IsStream())
769 {
770 // try to open and read all content
771 tools::SvRef<SotStorageStream> xStream(rStorage->OpenSotStream(info.GetName(), StreamMode::STD_READ));
772 const size_t nSize = xStream->GetSize();
773 const size_t nRead = xStream->ReadBytes(rBuf.data(), nSize);
774 SAL_INFO("sot", "Read " << nRead << "bytes");
775 }
776 else if (info.IsStorage())
777 {
778 tools::SvRef<SotStorage> xStorage(rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ));
779
780 // continue with children
781 traverse(xStorage, rBuf);
782 }
783 }
784 }
785}
786
787extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportOLE2(SvStream &rStream)
788{
789 try
790 {
791 size_t nSize = rStream.remainingSize();
792 tools::SvRef<SotStorage> xRootStorage(new SotStorage(&rStream, false));
793 std::vector<unsigned char> aTmpBuf(nSize);
794 traverse(xRootStorage, aTmpBuf);
795 }
796 catch (...)
797 {
798 return false;
799 }
800 return true;
801}
802
803/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XInputStream > xStream
virtual void Flush()=0
virtual sal_uInt64 Seek(sal_uInt64 nPos)=0
virtual sal_Int32 Read(void *pData, sal_Int32 nSize)=0
virtual sal_Int32 Write(const void *pData, sal_Int32 nSize)=0
virtual sal_uInt64 GetSize() const =0
virtual bool SetSize(sal_uInt64 nNewSize)=0
virtual bool Commit()=0
virtual void Remove(const OUString &rEleName)=0
virtual void FillInfoList(SvStorageInfoList *) const =0
virtual bool IsStream(const OUString &rEleName) const =0
virtual bool IsRoot() const =0
virtual void SetClass(const SvGlobalName &rClass, SotClipboardFormatId nOriginalClipFormat, const OUString &rUserTypeName)=0
virtual BaseStorage * OpenStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=false)=0
virtual bool Commit()=0
virtual BaseStorageStream * OpenStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=true)=0
virtual bool ValidateFAT()=0
virtual OUString GetUserName()=0
virtual bool IsContained(const OUString &rEleName) const =0
virtual const OUString & GetName() const =0
virtual bool IsStorage(const OUString &rEleName) const =0
virtual SvGlobalName GetClassName()=0
virtual bool CopyTo(BaseStorage *pDestStg) const =0
virtual SotClipboardFormatId GetFormat()=0
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
bool SetURL(std::u16string_view rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
Definition: exchange.cxx:419
BaseStorageStream * pOwnStm
Definition: storage.hxx:52
sal_uInt32 GetSize() const
Definition: storage.cxx:164
virtual void ResetError() override
Definition: storage.cxx:120
virtual void SetSize(sal_uInt64 nNewSize) override
Definition: storage.cxx:153
SotStorageStream(BaseStorageStream *pBaseStream)
Definition: storage.cxx:101
virtual void FlushData() override
Definition: storage.cxx:147
virtual std::size_t PutData(const void *pData, std::size_t nSize) override
Definition: storage.cxx:133
virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override
Definition: storage.cxx:140
virtual std::size_t GetData(void *pData, std::size_t nSize) override
Definition: storage.cxx:126
virtual ~SotStorageStream() override
Definition: storage.cxx:114
virtual sal_uInt64 TellEnd() override
Definition: storage.cxx:170
bool SetProperty(OUString const &rName, css::uno::Any const &rValue)
Definition: storage.cxx:187
std::unique_ptr< SvMemoryStream > CreateMemoryStream()
Definition: storage.cxx:402
bool m_bDelStm
Definition: storage.hxx:82
bool m_bIsRoot
Definition: storage.hxx:81
bool IsContained(const OUString &rEleName) const
Definition: storage.cxx:598
bool Remove(const OUString &rEleName)
Definition: storage.cxx:607
sal_Int32 GetVersion() const
Definition: storage.hxx:112
SvStream * m_pStorStm
Definition: storage.hxx:78
bool Validate()
Definition: storage.cxx:635
bool IsStream(const OUString &rEleName) const
Definition: storage.cxx:589
bool CopyTo(SotStorage *pDestStg)
Definition: storage.cxx:504
OUString GetUserName()
Definition: storage.cxx:488
void CreateStorage(bool bUCBStorage, StreamMode)
Definition: storage.cxx:236
bool IsStorage(const OUString &rEleName) const
Definition: storage.cxx:580
static SotClipboardFormatId GetFormatID(css::uno::Reference< css::embed::XStorage > const &xStorage)
Definition: storage.cxx:696
BaseStorage * m_pOwnStg
Definition: storage.hxx:77
OUString m_aName
Definition: storage.hxx:80
void FillInfoList(SvStorageInfoList *) const
Definition: storage.cxx:498
const OUString & GetName() const
Definition: storage.cxx:451
virtual ~SotStorage() override
Definition: storage.cxx:395
tools::SvRef< SotStorageStream > OpenSotStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE)
Definition: storage.cxx:532
bool Commit()
Definition: storage.cxx:519
static bool IsStorageFile(OUString const &rFileName)
Definition: storage.cxx:418
SotStorage(OUString const &rString, StreamMode eMode=StreamMode::STD_READWRITE)
Definition: storage.cxx:227
SotClipboardFormatId GetFormat()
Definition: storage.cxx:478
bool IsOLEStorage() const
Definition: storage.cxx:644
SvGlobalName GetClassName()
Definition: storage.cxx:468
sal_Int32 m_nVersion
Definition: storage.hxx:84
ErrCode GetError() const
Definition: storage.hxx:117
void SetClass(const SvGlobalName &rClass, SotClipboardFormatId bOriginalClipFormat, const OUString &rUserTypeName)
Definition: storage.cxx:458
void SignAsRoot(bool bRoot)
Definition: storage.hxx:127
void SetError(ErrCode nErrorCode)
Definition: storage.hxx:121
static SotStorage * OpenOLEStorage(css::uno::Reference< css::embed::XStorage > const &xStorage, OUString const &rEleName, StreamMode=StreamMode::STD_READWRITE)
Definition: storage.cxx:660
SotStorage * OpenSotStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool transacted=true)
Definition: storage.cxx:556
OString m_aKey
Definition: storage.hxx:83
friend class SotStorageStream
Definition: storage.hxx:75
void CopyTo(SotTempStream *pDestStm)
Definition: storage.cxx:75
SotTempStream(OUString const &rString, StreamMode=StreamMode::STD_READWRITE)
Definition: storage.cxx:61
virtual ~SotTempStream() override
Definition: storage.cxx:70
StreamMode GetMode() const
Definition: stg.hxx:52
void ResetError() const
Definition: stg.cxx:73
ErrCode GetError() const
Definition: stg.cxx:60
virtual void ResetError()
sal_uInt64 Tell() const
bool m_isWritable
virtual void SetSize(sal_uInt64 nSize)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
void SetError(ErrCode nErrorCode)
sal_uInt64 Seek(sal_uInt64 nPos)
void Flush()
std::size_t ReadBytes(void *pData, std::size_t nSize)
ErrCode GetError() const
void FlushBuffer()
sal_uInt64 remainingSize()
bool SetProperty(const OUString &rName, const css::uno::Any &rValue)
static bool IsStorageFile(SvStream *)
T * get() const
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define DBG_ASSERT(sCon, aError)
#define TOOLS_INFO_EXCEPTION(area, stream)
URL aURL
#define ERRCODE_IO_GENERAL
#define SVSTREAM_GENERALERROR
#define ERRCODE_IO_NOTSUPPORTED
#define ERRCODE_NONE
#define SVSTREAM_CANNOT_MAKE
#define SOFFICE_FILEFORMAT_50
#define SOFFICE_FILEFORMAT_8
#define SOFFICE_FILEFORMAT_60
SotClipboardFormatId
Definition: formats.hxx:28
const size_t BUFSIZE
OUString aName
void * p
sal_uInt16 nPos
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString m_aName
static SvLockBytesRef MakeLockBytes_Impl(const OUString &rName, StreamMode nMode)
Definition: storage.cxx:45
#define INIT_SotStorage()
SotStorage::SotStorage()
Definition: storage.cxx:217
SAL_DLLPUBLIC_EXPORT bool TestImportOLE2(SvStream &rStream)
Definition: storage.cxx:787
#define ERASEMASK
Definition: storage.cxx:225
std::vector< SvStorageInfo > SvStorageInfoList
Definition: storinfo.hxx:56
StreamMode
unsigned char sal_uInt8
int SetError()