20#include <com/sun/star/io/NotConnectedException.hpp>
21#include <com/sun/star/io/BufferSizeExceededException.hpp>
22#include <com/sun/star/uno/RuntimeException.hpp>
24#include <com/sun/star/uno/Reference.h>
25#include <com/sun/star/ucb/NameClash.hpp>
28#include <com/sun/star/io/XInputStream.hpp>
29#include <com/sun/star/ucb/InsertCommandArgument.hpp>
30#include <com/sun/star/ucb/ResultSetException.hpp>
31#include <com/sun/star/uno/Sequence.h>
32#include <com/sun/star/sdbc/XResultSet.hpp>
33#include <com/sun/star/sdbc/XRow.hpp>
34#include <com/sun/star/ucb/CommandAbortedException.hpp>
35#include <com/sun/star/datatransfer/DataFlavor.hpp>
36#include <com/sun/star/ucb/ContentInfo.hpp>
37#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
38#include <com/sun/star/beans/Property.hpp>
39#include <com/sun/star/packages/manifest/ManifestWriter.hpp>
40#include <com/sun/star/packages/manifest/ManifestReader.hpp>
41#include <com/sun/star/ucb/InteractiveIOException.hpp>
42#include <com/sun/star/ucb/ContentCreationException.hpp>
47#include <osl/diagnose.h>
48#include <osl/file.hxx>
81#if OSL_DEBUG_LEVEL > 0
95 std::unique_ptr<SvStream> m_pSvStream;
98 explicit FileStreamWrapper_Impl(OUString
aName);
99 virtual ~FileStreamWrapper_Impl()
override;
101 virtual void SAL_CALL seek( sal_Int64 _nLocation )
override;
102 virtual sal_Int64 SAL_CALL getPosition( )
override;
103 virtual sal_Int64 SAL_CALL
getLength( )
override;
106 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
override;
107 virtual sal_Int32 SAL_CALL available()
override;
108 virtual void SAL_CALL closeInput()
override;
111 void checkConnected();
117FileStreamWrapper_Impl::FileStreamWrapper_Impl( OUString aName )
124FileStreamWrapper_Impl::~FileStreamWrapper_Impl()
129#if OSL_DEBUG_LEVEL > 0
135 osl::File::remove(m_aURL);
139sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(
Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
149 if (nBytesToRead < 0)
150 throw BufferSizeExceededException(OUString(), getXWeak());
152 std::scoped_lock aGuard( m_aMutex );
154 if (
aData.getLength() < nBytesToRead)
155 aData.realloc(nBytesToRead);
157 sal_uInt32 nRead = m_pSvStream->ReadBytes(
static_cast<void*
>(
aData.getArray()), nBytesToRead);
162 aData.realloc( nRead );
168sal_Int32 SAL_CALL FileStreamWrapper_Impl::readSomeBytes(
Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead)
178 if (nMaxBytesToRead < 0)
179 throw BufferSizeExceededException(OUString(), getXWeak());
181 if (m_pSvStream->eof())
187 return readBytes(aData, nMaxBytesToRead);
191void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 nBytesToSkip)
196 std::scoped_lock aGuard( m_aMutex );
199 m_pSvStream->SeekRel(nBytesToSkip);
204sal_Int32 SAL_CALL FileStreamWrapper_Impl::available()
209 std::scoped_lock aGuard( m_aMutex );
212 sal_Int64 nAvailable = m_pSvStream->remainingSize();
215 return std::min<sal_Int64>(SAL_MAX_INT32, nAvailable);
219void SAL_CALL FileStreamWrapper_Impl::closeInput()
224 std::scoped_lock aGuard( m_aMutex );
227#if OSL_DEBUG_LEVEL > 0
230 osl::File::remove(m_aURL);
235void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 _nLocation )
240 std::scoped_lock aGuard( m_aMutex );
243 m_pSvStream->Seek(
static_cast<sal_uInt32
>(_nLocation));
248sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition( )
253 std::scoped_lock aGuard( m_aMutex );
256 sal_uInt32
nPos = m_pSvStream->Tell();
258 return static_cast<sal_Int64
>(
nPos);
262sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength( )
267 std::scoped_lock aGuard( m_aMutex );
272 sal_Int64 nEndPos = m_pSvStream->TellEnd();
278void FileStreamWrapper_Impl::checkConnected()
281 throw NotConnectedException(OUString(), getXWeak());
285#if OSL_DEBUG_LEVEL > 0
292void FileStreamWrapper_Impl::checkError()
296 if (m_pSvStream->SvStream::GetError() != ERRCODE_NONE)
298 throw NotConnectedException(OUString(), getXWeak());
302#define COMMIT_RESULT_FAILURE 0
303#define COMMIT_RESULT_NOTHING_TO_DO 1
304#define COMMIT_RESULT_SUCCESS 2
332 OSL_FAIL(
"Unknown UCB storage format!" );
394 virtual std::size_t
GetData(
void*
pData, std::size_t nSize)
override;
395 virtual std::size_t
PutData(
const void*
pData, std::size_t nSize)
override;
396 virtual sal_uInt64
SeekPos( sal_uInt64
nPos )
override;
397 virtual void SetSize( sal_uInt64 nSize )
override;
425 bool bRepair, Reference< XProgressHandler >
const & xProgress );
484 bool,
bool =
false, Reference< XProgressHandler >
const & = Reference< XProgressHandler >() );
486 bool, Reference< XProgressHandler >
const & );
494 void SetProps(
const Sequence < Sequence < PropertyValue > >& rSequence,
const OUString& );
495 void GetProps( sal_Int32&, Sequence < Sequence < PropertyValue > >& rSequence,
const OUString& );
509 if (
m_nMode & StreamMode::WRITE )
540 bool bIsFolder =
false, sal_uInt64 nSize = 0 )
578 OSL_FAIL(
"Element not loaded!");
592 OSL_FAIL(
"Element not loaded!");
599 return m_xStream->m_aOriginalContentType;
621 : m_pAntiImpl( pStream )
623 , m_pContent( nullptr )
627 , m_bModified( false )
628 , m_bCommited( false )
629 , m_bDirect( bDirect )
630 , m_bIsOLEStorage( false )
638 Reference< css::ucb::XCommandEnvironment > xComEnv;
640 OUString aTemp( rName );
644 xComEnv = new ::ucbhelper::CommandEnvironment( Reference< css::task::XInteractionHandler >(), xProgress );
645 aTemp +=
"?repairpackage";
650 catch (
const ContentCreationException&)
687#if OSL_DEBUG_LEVEL > 0
693 OSL_FAIL(
"Suspicious temporary stream creation!" );
723 catch (
const BufferSizeExceededException&)
732 OSL_FAIL(
"Can not operate original stream!" );
758 Sequence<sal_Int8>
aData(32000);
767 }
while( aReaded == 32000 );
783 sal_uInt64 aResult = 0;
787 Sequence<sal_Int8>
aData(32000);
792 sal_Int32 aReaded = 32000;
794 for (sal_uInt64 nInd = 0; nInd < aLength && aReaded == 32000 ; nInd += 32000)
796 sal_Int32 aToCopy = std::min<sal_Int32>( aLength - nInd, 32000 );
801 if( aResult < aLength )
829 std::size_t aResult = 0;
842 std::size_t aToRead = nSize - aResult;
843 pData =
static_cast<void*
>(
static_cast<char*
>(
pData) + aResult );
847 Sequence<sal_Int8>
aData( aToRead );
849 aResult +=
m_pStream->WriteBytes(
static_cast<const void*
>(
aData.getConstArray()), aReaded);
857 if( aResult < nSize )
866 if ( !(
m_nMode & StreamMode::WRITE) )
872 if( !nSize || !
Init() )
945 if ( !(
m_nMode & StreamMode::WRITE) )
958 sal_uInt64
const aPos =
m_pStream->Tell();
1020 const ErrCode nTmpErr = pStorage->GetError();
1021 pStorage->SetError( nTmpErr );
1053 InsertCommandArgument aArg;
1055 aArg.ReplaceExisting =
true;
1067 catch (
const CommandAbortedException&)
1099 OSL_FAIL(
"Revert while commit is in progress!" );
1128 catch (
const ContentCreationException&)
1159#if OSL_DEBUG_LEVEL > 0
1175 bool isWritable = bool(
m_nMode & StreamMode::WRITE );
1179 nMode |= StreamMode::WRITE;
1185 if ( nMode & StreamMode::TRUNC )
1262 return ( !bWrite || (
pImp->
m_nMode & StreamMode::WRITE ) );
1268 if(
m == ( StreamMode::READ | StreamMode::TRUNC ) )
1270 if( (
m & StreamMode::READWRITE) == StreamMode::READ )
1273 if( (
m & StreamMode::SHARE_DENYWRITE )
1274 || (
m & StreamMode::SHARE_DENYALL ) )
1282 if(
m & StreamMode::SHARE_DENYALL )
1318 sal_Int32
n =
Tell();
1325 std::unique_ptr<sal_uInt8[]>
p(
new sal_uInt8[ 4096 ]);
1327 pDestStm->
Seek( 0 );
1333 if(
Read(
p.get(), nn ) != nn )
1335 if( pDestStm->
Write(
p.get(), nn ) != nn )
1343 if ( rName ==
"Title")
1346 if ( rName ==
"MediaType")
1394UCBStorage::UCBStorage(
const OUString& rName,
StreamMode nMode,
bool bDirect,
bool bIsRoot,
bool bIsRepair, Reference< XProgressHandler >
const & xProgressHandler )
1398 pImp =
new UCBStorage_Impl( rName, nMode,
this, bDirect, bIsRoot, bIsRepair, xProgressHandler );
1408 pImp =
new UCBStorage_Impl( rName, nMode,
this, bDirect, bIsRoot,
false, Reference< XProgressHandler >() );
1434 : m_pAntiImpl( pStorage )
1435 , m_oContent( rContent )
1436 , m_pSource( nullptr )
1440 , m_bCommited( false )
1441 , m_bDirect( bDirect )
1442 , m_bIsRoot( bIsRoot )
1443 , m_bIsLinked( true )
1444 , m_bListCreated( false )
1446 , m_bRepairPackage( bIsRepair )
1449 OUString
aName( rName );
1450 if(
aName.isEmpty() )
1463 : m_pAntiImpl( pStorage )
1464 , m_pSource( nullptr )
1468 , m_bCommited( false )
1469 , m_bDirect( bDirect )
1470 , m_bIsRoot( bIsRoot )
1471 , m_bIsLinked( false )
1472 , m_bListCreated( false )
1474 , m_bRepairPackage( bIsRepair )
1477 OUString
aName( rName );
1478 if(
aName.isEmpty() )
1490 m_aURL =
"vnd.sun.star.pkg://" +
1493 if (
m_nMode & StreamMode::WRITE )
1503 if ( !
m_aURL.startsWith(
"vnd.sun.star.pkg://") )
1509 : m_pAntiImpl( pStorage )
1510 , m_pTempFile( new ::
utl::TempFileNamed )
1511 , m_pSource( &rStream )
1513 , m_bCommited( false )
1514 , m_bDirect( bDirect )
1516 , m_bIsLinked( false )
1517 , m_bListCreated( false )
1519 , m_bRepairPackage( false )
1524 DBG_ASSERT( !bDirect,
"Storage on a stream must not be opened in direct mode!" );
1529 m_aURL =
"vnd.sun.star.pkg://" +
1548 m_nMode = StreamMode::READ | StreamMode::WRITE;
1573 aObj.
Append(
u"manifest.xml" );
1580 if ( !pStream->GetError() )
1585 Reference < css::packages::manifest::XManifestReader > xReader =
1586 css::packages::manifest::ManifestReader::create(
1587 ::comphelper::getProcessComponentContext() ) ;
1588 Sequence < Sequence < PropertyValue > > aProps = xReader->readManifestSequence( pHelper );
1607 if ( ( aAny >>= aTmp ) && !aTmp.isEmpty() )
1613 "getPropertyValue has thrown an exception! Please let developers know the scenario!" );
1622 css::datatransfer::DataFlavor aDataFlavor;
1642 Reference< css::ucb::XCommandEnvironment > xComEnv;
1644 OUString aTemp(
m_aURL );
1648 xComEnv = new ::ucbhelper::CommandEnvironment( Reference< css::task::XInteractionHandler >(),
1650 aTemp +=
"?repairpackage";
1655 catch (
const ContentCreationException&)
1681 Reference< XResultSet > xResultSet =
m_oContent->createCursor( {
"Title",
"IsFolder",
"MediaType",
"Size" }, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
1682 Reference< XRow > xRow( xResultSet, UNO_QUERY );
1683 if ( xResultSet.is() )
1685 while ( xResultSet->next() )
1688 OUString aTitle( xRow->getString(1) );
1692 if ( aTitle ==
"META-INF" )
1696 bool bIsFolder( xRow->getBoolean(2) );
1697 sal_Int64 nSize = xRow->getLong(4);
1709 else if ( bIsOfficeDocument )
1712 OUString
aName(
m_aURL +
"/" + xRow->getString(1));
1714 Reference< css::ucb::XCommandEnvironment > xComEnv;
1717 xComEnv = new ::ucbhelper::CommandEnvironment( Reference< css::task::XInteractionHandler >(),
1719 aName +=
"?repairpackage";
1724 OUString aMediaType;
1726 if ( ( aAny >>= aMediaType ) && ( aMediaType ==
"application/vnd.sun.star.oleobject" ) )
1728 else if ( aMediaType.isEmpty() )
1732 if ( Storage::IsStorageFile( pElement->
m_xStream.
get() ) )
1741 catch (
const InteractiveIOException& r)
1743 if ( r.Code != IOErrorCode_NOT_EXISTING )
1746 catch (
const CommandAbortedException&)
1749 if ( !(
m_nMode & StreamMode::WRITE ) )
1758 catch (
const ResultSetException&)
1763 catch (
const SQLException&)
1789 DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.is(),
"Storage should be open!" );
1790 if ( pElement->m_bIsFolder && pElement->m_xStorage.is() )
1791 nCount += pElement->m_xStorage->GetObjectCount();
1797static OUString
Find_Impl(
const Sequence < Sequence < PropertyValue > >& rSequence, std::u16string_view rPath )
1799 bool bFound =
false;
1800 for (
const Sequence < PropertyValue >& rMyProps : rSequence )
1804 for (
const PropertyValue& rAny : rMyProps )
1806 if ( rAny.Name ==
"FullPath" )
1809 if ( ( rAny.Value >>= aTmp ) && aTmp == rPath )
1811 if ( !aType.isEmpty() )
1814 else if ( rAny.Name ==
"MediaType" )
1816 if ( ( rAny.Value >>= aType ) && !aType.isEmpty() && bFound )
1830 OUString aPath( rPath );
1843 DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.is(),
"Storage should be open!" );
1844 if ( pElement->m_bIsFolder && pElement->m_xStorage.is() )
1845 pElement->m_xStorage->SetProps( rSequence, aPath );
1848 OUString aElementPath = aPath + pElement->m_aName;
1849 pElement->SetContentType(
Find_Impl( rSequence, aElementPath ) );
1857 css::datatransfer::DataFlavor aDataFlavor;
1871 auto pSequence = rSequence.getArray();
1876 OUString aPath( rPath );
1882 pSequence[nProps++] = aProps;
1891 DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.is(),
"Storage should be open!" );
1892 if ( pElement->m_bIsFolder && pElement->m_xStorage.is() )
1894 pElement->m_xStorage->GetProps( nProps, rSequence, aPath );
1898 OUString aElementPath = aPath + pElement->m_aName;
1901 pSequence[ nProps++ ] = aProps;
1923 if ( !aInfo.hasElements() )
1929 if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER )
1932 const Sequence< Property > & rProps = rCurr.Properties;
1933 if ( rProps.getLength() != 1 )
1936 if ( rProps[ 0 ].
Name !=
"Title" )
1940 if ( !pContent->
insertNewContent( rCurr.Type, {
"Title" }, { Any(m_aName) }, aNewFolder ) )
1949 catch (
const CommandAbortedException&)
1984 std::unique_ptr< ::ucbhelper::Content > xDeleteContent;
1985 if ( !pContent && pElement->IsModified() )
1988 OUString
aName =
m_aURL +
"/" + pElement->m_aOriginalName;
1990 xDeleteContent.reset(pContent);
1993 if ( pElement->m_bIsRemoved )
1996 if ( !pElement->m_bIsInserted )
1999 if (pContent && (!pElement->m_xStream.is() || pElement->m_xStream->Clear()))
2012 if ( pElement->m_xStorage.is() )
2022 nLocalRet = pElement->m_xStorage->Commit();
2023 pContent = pElement->GetContent();
2026 else if ( pElement->m_xStream.is() )
2029 nLocalRet = pElement->m_xStream->Commit();
2030 if ( pElement->m_xStream->m_bIsOLEStorage )
2033 pElement->m_xStream->m_aContentType =
"application/vnd.sun.star.oleobject";
2036 pElement->m_xStream->m_pContent->setPropertyValue(
"Encrypted", aValue );
2039 pContent = pElement->GetContent();
2042 if (pContent && pElement->m_aName != pElement->m_aOriginalName)
2049 if (pContent && pElement->IsLoaded() && pElement->GetContentType() != pElement->GetOriginalContentType())
2064 catch (
const ContentCreationException&)
2070 catch (
const CommandAbortedException&)
2100 m_oContent->setPropertyValue(
"MediaType", aType );
2107 bool bRet = ::utl::UCBContentHelper::MakeFolder( *
m_oContent,
"META-INF", aNewSubFolder );
2111 OUString
aURL( aNewSubFolder.getURL() );
2112 std::optional< ::utl::TempFileNamed > pTempFile(&
aURL );
2115 SvStream* pStream = pTempFile->GetStream( StreamMode::STD_READWRITE );
2119 Reference < css::packages::manifest::XManifestWriter > xWriter =
2120 css::packages::manifest::ManifestWriter::create(
2121 ::comphelper::getProcessComponentContext() );
2123 Sequence < Sequence < PropertyValue > > aProps(
nCount );
2124 sal_Int32 nProps = 0;
2125 GetProps( nProps, aProps, OUString() );
2126 xWriter->writeManifestSequence( xOutputStream, aProps );
2131 xOutputStream =
nullptr;
2133 aNewSubFolder.transferContent( aSource, InsertOperation::Move,
"manifest.xml", NameClash::OVERWRITE );
2138#if OSL_DEBUG_LEVEL > 0
2156 catch (
const CommandAbortedException&)
2172 catch (
const InteractiveIOException& r)
2174 if ( r.Code == IOErrorCode_ACCESS_DENIED || r.Code == IOErrorCode_LOCKING_VIOLATION )
2176 else if ( r.Code == IOErrorCode_NOT_EXISTING )
2178 else if ( r.Code == IOErrorCode_CANT_READ )
2180 else if ( r.Code == IOErrorCode_CANT_WRITE )
2208 if ( pInnerElement->m_bIsRemoved )
2212 pInnerElement->m_aOriginalName = pInnerElement->m_aName;
2213 pInnerElement->m_bIsInserted =
false;
2230 pElement->m_bIsRemoved =
false;
2231 if ( pElement->m_bIsInserted )
2235 if ( pElement->m_xStream.is() )
2237 pElement->m_xStream->m_bCommited =
false;
2238 pElement->m_xStream->Revert();
2240 else if ( pElement->m_xStorage.is() )
2242 pElement->m_xStorage->m_bCommited =
false;
2243 pElement->m_xStorage->Revert();
2246 pElement->m_aName = pElement->m_aOriginalName;
2247 pElement->m_bIsRemoved =
false;
2275 css::datatransfer::DataFlavor aDataFlavor;
2294 css::datatransfer::DataFlavor aDataFlavor;
2318 OSL_FAIL(
"UserName is not implemented in UCB storages!" );
2327 if ( !pElement->m_bIsRemoved )
2330 sal_uInt64 nSize = pElement->m_nSize;
2331 if ( pElement->m_xStream.is() )
2332 nSize = pElement->m_xStream->GetSize();
2333 SvStorageInfo aInfo( pElement->m_aName, nSize, pElement->m_bIsStorage );
2334 pList->push_back( aInfo );
2350 bool bDeleteStream =
false;
2354 pStream = rElement.
m_xStream->m_pAntiImpl;
2358 bDeleteStream =
true;
2363 if( pOtherStream->GetError() )
2364 pDest->
SetError( pOtherStream->GetError() );
2366 pOtherStream->Commit();
2368 if ( bDeleteStream )
2378 bool bDeleteStorage =
false;
2384 bDeleteStorage =
true;
2390 bool bOpenUCBStorage = pUCBDest && pUCBCopy;
2397 if( bOpenUCBStorage )
2402 pOtherStorage->SetClassId( pStorage->
GetClassId() );
2403 pStorage->
CopyTo( pOtherStorage.
get() );
2405 if( pOtherStorage->GetError() )
2406 pDest->
SetError( pOtherStorage->GetError() );
2408 pOtherStorage->Commit();
2410 if ( bDeleteStorage )
2419 DBG_ASSERT( !rName.empty(),
"Name is empty!" );
2422 if ( pElement->m_aName == rName && !pElement->m_bIsRemoved )
2423 return pElement.get();
2431 if ( pDestStg ==
static_cast<BaseStorage const *
>(
this) )
2439 if(
dynamic_cast<const UCBStorage *
>(pDestStg) !=
nullptr )
2450 if ( !pElement->m_bIsRemoved )
2461 if( rElemName.isEmpty() )
2502 if( rEleName.isEmpty() )
2510 if( nMode & StreamMode::NOCREATE )
2536 OSL_FAIL(
"Stream is already open!" );
2544 if ( pElement->
m_xStream->m_aKey.isEmpty() )
2546 pElement->
m_xStream->PrepareCachedForReopen( nMode );
2557 pElement->
m_xStream->m_aName = rEleName;
2572 if( rEleName.isEmpty() )
2580 if( rEleName.isEmpty() )
2588 if( rEleName.isEmpty() )
2601 if( nMode & StreamMode::NOCREATE )
2640 pElement->
m_xStream->PrepareCachedForReopen( nMode );
2641 bool bInited = pElement->
m_xStream->Init();
2649 return pElement->
m_xStream->CreateStorage();
2656 OSL_FAIL(
"Storage is already open!" );
2661 bool bIsWritable = bool( pElement->
m_xStorage->m_nMode & StreamMode::WRITE );
2662 if ( !bIsWritable && ( nMode & StreamMode::WRITE ) )
2678 bool bIsWritable = bool(
pImp->
m_nMode & StreamMode::WRITE);
2745 if( rEleName.isEmpty() )
2754 if( rEleName.isEmpty() )
2763 if( rEleName.isEmpty() )
2766 return ( pElement !=
nullptr );
2771 if( rEleName.isEmpty() )
2792 return ( !bWrite || (
pImp->
m_nMode & StreamMode::WRITE ) );
2798 if(
m == ( StreamMode::READ | StreamMode::TRUNC ) )
2803 if(
m & StreamMode::SHARE_DENYALL )
2812 return static_cast<BaseStorage const *
>(
this) == &rStorage;
2825 sal_uInt32 nBytes(0);
2829 bool bRet = ( nBytes == 0x04034b50 );
2833 bRet = ( nBytes == 0x08074b50 );
2838 bRet = ( nBytes == 0x04034b50 );
virtual sal_uInt64 Seek(sal_uInt64 nPos)=0
virtual sal_Int32 Write(const void *pData, sal_Int32 nSize)=0
virtual bool SetSize(sal_uInt64 nNewSize)=0
virtual void CopyTo(BaseStorageStream *pDestStm)=0
virtual void SetClass(const SvGlobalName &rClass, SotClipboardFormatId nOriginalClipFormat, const OUString &rUserTypeName)=0
virtual const ClsId & GetClassId() const =0
virtual BaseStorageStream * OpenStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=true)=0
virtual BaseStorage * OpenOLEStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=false)=0
virtual void SetDirty()=0
virtual BaseStorage * OpenUCBStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=false)=0
virtual SvGlobalName GetClassName()=0
virtual bool CopyTo(BaseStorage *pDestStg) const =0
virtual void SetClassId(const ClsId &)=0
virtual SotClipboardFormatId GetFormat()=0
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool setName(std::u16string_view rTheName, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static OUString encode(std::u16string_view rText, Part ePart, EncodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
void SetError(ErrCode) const
const SvGUID & GetCLSID() const
virtual void ResetError()
SvStream & ReadStream(SvStream &rStream)
virtual sal_uInt64 TellEnd()
bool SetStreamSize(sal_uInt64 nSize)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
void SetError(ErrCode nErrorCode)
sal_uInt64 Seek(sal_uInt64 nPos)
::ucbhelper::Content * m_pContent
virtual void ResetError() override
virtual std::size_t GetData(void *pData, std::size_t nSize) override
void SetError(ErrCode nError)
UCBStorageStream * m_pAntiImpl
std::unique_ptr< SvStream > m_pStream
void ReadSourceWriteTemporary()
virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override
OUString m_aOriginalContentType
virtual void SetSize(sal_uInt64 nSize) override
virtual void FlushData() override
virtual std::size_t PutData(const void *pData, std::size_t nSize) override
void CopySourceToTemporary()
void PrepareCachedForReopen(StreamMode nMode)
Reference< XInputStream > m_rSource
UCBStorageStream_Impl(const OUString &, StreamMode, UCBStorageStream *, bool, bool bRepair, Reference< XProgressHandler > const &xProgress)
BaseStorage * CreateStorage()
virtual ~UCBStorageStream_Impl() override
SvStream * GetModifySvStream()
UCBStorageStream(const OUString &rName, StreamMode nMode, bool bDirect, bool bRepair, css::uno::Reference< css::ucb::XProgressHandler > const &xProgress)
virtual void Flush() override
virtual ~UCBStorageStream() override
virtual void CopyTo(BaseStorageStream *pDestStm) override
virtual sal_uInt64 Seek(sal_uInt64 nPos) override
virtual bool Commit() override
virtual bool Validate(bool=false) const override
virtual bool ValidateMode(StreamMode) const override
virtual sal_uInt64 Tell() override
virtual sal_uInt64 GetSize() const override
virtual bool Equals(const BaseStorageStream &rStream) const override
virtual bool SetSize(sal_uInt64 nNewSize) override
UCBStorageStream_Impl * pImp
virtual sal_Int32 Read(void *pData, sal_Int32 nSize) override
bool SetProperty(const OUString &rName, const css::uno::Any &rValue)
virtual sal_Int32 Write(const void *pData, sal_Int32 nSize) override
SotClipboardFormatId m_nFormat
UCBStorageElementList_Impl m_aChildrenList
::ucbhelper::Content * GetContent()
std::unique_ptr<::utl::TempFileNamed > m_pTempFile
virtual ~UCBStorage_Impl() override
UCBStorage_Impl * OpenStorage(UCBStorageElement_Impl *pElement, StreamMode nMode, bool bDirect)
sal_Int32 GetObjectCount()
OUString m_aOriginalContentType
void SetProps(const Sequence< Sequence< PropertyValue > > &rSequence, const OUString &)
void GetProps(sal_Int32 &, Sequence< Sequence< PropertyValue > > &rSequence, const OUString &)
Reference< XProgressHandler > m_xProgressHandler
UCBStorageElementList_Impl & GetChildrenList()
void SetError(ErrCode nError)
bool Insert(::ucbhelper::Content *pContent)
void OpenStream(UCBStorageElement_Impl *, StreamMode, bool)
UCBStorage_Impl(const ::ucbhelper::Content &, const OUString &, StreamMode, UCBStorage *, bool, bool, bool=false, Reference< XProgressHandler > const &=Reference< XProgressHandler >())
std::optional<::ucbhelper::Content > m_oContent
virtual bool IsStream(const OUString &rEleName) const override
virtual bool ValidateFAT() override
virtual const OUString & GetName() const override
virtual void SetDirty() override
virtual void Remove(const OUString &rEleName) override
virtual bool Revert() override
virtual void SetClass(const SvGlobalName &rClass, SotClipboardFormatId nOriginalClipFormat, const OUString &rUserTypeName) override
virtual const ClsId & GetClassId() const override
virtual bool CopyTo(BaseStorage *pDestStg) const override
UCBStorageElement_Impl * FindElement_Impl(std::u16string_view rName) const
bool CopyStorageElement_Impl(UCBStorageElement_Impl const &rElement, BaseStorage *pDest, const OUString &rNew) const
virtual void SetClassId(const ClsId &) override
virtual BaseStorage * OpenUCBStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=false) override
virtual bool Validate(bool=false) const override
static bool IsStorageFile(SvStream *)
virtual BaseStorageStream * OpenStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=true) override
virtual BaseStorage * OpenStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=false) override
virtual bool ValidateMode(StreamMode) const override
virtual bool IsRoot() const override
virtual SvGlobalName GetClassName() override
virtual bool IsStorage(const OUString &rEleName) const override
virtual bool IsContained(const OUString &rEleName) const override
UCBStorage(const ::ucbhelper::Content &rContent, const OUString &rName, StreamMode nMode, bool bDirect, bool bIsRoot)
virtual ~UCBStorage() override
virtual OUString GetUserName() override
BaseStorage * OpenStorage_Impl(const OUString &rEleName, StreamMode, bool bDirect, bool bForceUCBStorage)
virtual bool Equals(const BaseStorage &rStream) const override
virtual bool Commit() final override
virtual BaseStorage * OpenOLEStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool bDirect=false) override
virtual void FillInfoList(SvStorageInfoList *) const override
virtual SotClipboardFormatId GetFormat() override
#define SO3_PLUGIN_CLASSID
#define SO3_SDRAW_CLASSID_60
#define SO3_IFRAME_CLASSID
#define SO3_SC_CLASSID_60
#define SO3_SM_CLASSID_60
#define SO3_SW_CLASSID_60
#define SO3_SWGLOB_CLASSID_60
#define SO3_SCH_CLASSID_60
#define SO3_SIMPRESS_CLASSID_60
#define SO3_SWWEB_CLASSID_60
#define SO3_APPLET_CLASSID
css::uno::Any setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue)
css::uno::Any getPropertyValue(const OUString &rPropertyName)
css::uno::Any executeCommand(const OUString &rCommandName, const css::uno::Any &rCommandArgument)
bool insertNewContent(const OUString &rContentType, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues, Content &rNewContent)
css::uno::Sequence< css::ucb::ContentInfo > queryCreatableContentsInfo()
css::uno::Reference< css::io::XInputStream > openStream()
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_WARN_EXCEPTION(area, stream)
#define ERRCODE_IO_ACCESSDENIED
#define SVSTREAM_ACCESS_DENIED
#define ERRCODE_IO_CANTREAD
#define ERRCODE_IO_GENERAL
#define ERRCODE_IO_BROKENPACKAGE
#define ERRCODE_IO_CANTWRITE
#define ERRCODE_IO_WRONGFORMAT
#define ERRCODE_IO_NOTEXISTS
#define SVSTREAM_CANNOT_MAKE
#define SVSTREAM_FILE_NOT_FOUND
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
double getLength(const B2DPolygon &rCandidate)
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
sal_uInt16 const m_nFormat
std::vector< SvStorageInfo > SvStorageInfoList
#define STREAM_SEEK_TO_END
UCBStorageElement_Impl(const OUString &rName, bool bIsFolder=false, sal_uInt64 nSize=0)
UCBStorage_ImplRef m_xStorage
OUString GetContentType() const
::ucbhelper::Content * GetContent()
UCBStorageStream_ImplRef m_xStream
void SetContentType(const OUString &)
OUString GetOriginalContentType() const
Reference< XProgressHandler > m_xProgressHandler
tools::SvRef< UCBStorage_Impl > UCBStorage_ImplRef
std::vector< std::unique_ptr< UCBStorageElement_Impl > > UCBStorageElementList_Impl
static OUString Find_Impl(const Sequence< Sequence< PropertyValue > > &rSequence, std::u16string_view rPath)
static SotClipboardFormatId GetFormatId_Impl(const SvGlobalName &aName)
::cppu::WeakImplHelper< XInputStream, XSeekable > FileInputStreamWrapper_Base
static SvGlobalName GetClassId_Impl(SotClipboardFormatId nFormat)
#define COMMIT_RESULT_FAILURE
#define COMMIT_RESULT_NOTHING_TO_DO
tools::SvRef< UCBStorageStream_Impl > UCBStorageStream_ImplRef
#define COMMIT_RESULT_SUCCESS