summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sot/filelist.hxx13
-rw-r--r--include/sot/formats.hxx6
-rw-r--r--include/sot/object.hxx22
-rw-r--r--include/sot/storage.hxx184
-rw-r--r--sot/source/base/filelist.cxx13
-rw-r--r--sot/source/base/object.cxx32
6 files changed, 128 insertions, 142 deletions
diff --git a/include/sot/filelist.hxx b/include/sot/filelist.hxx
index f853fa4757d7..b94eb84d7e9c 100644
--- a/include/sot/filelist.hxx
+++ b/include/sot/filelist.hxx
@@ -24,27 +24,24 @@
#include <rtl/ustring.hxx>
#include <vector>
+
class SvStream;
class SOT_DLLPUBLIC FileList
{
- std::vector< OUString > aStrList;
+ std::vector<OUString> aStrList;
private:
-
- // delete list
void clear() { aStrList.clear(); }
public:
-
- // import/export
+ // import / export
SOT_DLLPUBLIC friend SvStream& ReadFileList( SvStream& rIStm, FileList& rFileList );
// fill in / interrogate list
- void AppendFile( const OUString& rStr );
- OUString GetFile( size_t i ) const;
+ void AppendFile(const OUString& rStr);
+ OUString GetFile(size_t nIndex) const;
size_t Count() const;
-
};
#endif // INCLUDED_SOT_FILELIST_HXX
diff --git a/include/sot/formats.hxx b/include/sot/formats.hxx
index 202c03bbe280..12727ffb34c9 100644
--- a/include/sot/formats.hxx
+++ b/include/sot/formats.hxx
@@ -180,10 +180,10 @@ enum class SotClipboardFormatId : sal_uInt32
};
/** Make it easier to iterate over format IDs */
-inline SotClipboardFormatId& operator++(SotClipboardFormatId& v)
+inline SotClipboardFormatId& operator++(SotClipboardFormatId& eFormat)
{
- v = static_cast<SotClipboardFormatId>(static_cast<sal_uInt32>(v) + 1);
- return v;
+ eFormat = static_cast<SotClipboardFormatId>(static_cast<sal_uInt32>(eFormat) + 1);
+ return eFormat;
}
#define SOT_FORMAT_SYSTEM_START SotClipboardFormatId::NONE
diff --git a/include/sot/object.hxx b/include/sot/object.hxx
index 9680eaba48a9..8b1d7e3d8968 100644
--- a/include/sot/object.hxx
+++ b/include/sot/object.hxx
@@ -27,25 +27,25 @@
class SOT_DLLPUBLIC SotObject : virtual public SvRefBase
{
- sal_uInt16 nOwnerLockCount;
- bool bInClose; // TRUE, in DoClose
+ sal_uInt16 nOwnerLockCount;
+ bool bInClose; // TRUE, in DoClose
protected:
- virtual ~SotObject() override;
- virtual bool Close();
+ virtual ~SotObject() override;
+ virtual bool Close();
public:
- SotObject();
+ SotObject();
- sal_uInt16 GetOwnerLockCount() const { return nOwnerLockCount; }
+ sal_uInt16 GetOwnerLockCount() const { return nOwnerLockCount; }
- void OwnerLock( bool bLock );
- bool DoClose();
- bool IsInClose() const { return bInClose; }
+ void OwnerLock(bool bLock);
+ bool DoClose();
+ bool IsInClose() const { return bInClose; }
private:
- SotObject & operator = ( const SotObject & ) = delete;
- SotObject( const SotObject & ) = delete;
+ SotObject & operator= (const SotObject &) = delete;
+ SotObject(const SotObject &) = delete;
};
#endif
diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx
index cb1c0baa3938..bea06931d089 100644
--- a/include/sot/storage.hxx
+++ b/include/sot/storage.hxx
@@ -34,6 +34,7 @@ namespace com { namespace sun { namespace star { namespace uno { template <typen
enum class SotClipboardFormatId : sal_uInt32;
class BaseStorageStream;
+
class SOT_DLLPUBLIC SotStorageStream : virtual public SotObject, public SvStream
{
friend class SotStorage;
@@ -41,22 +42,23 @@ friend class SotStorage;
protected:
virtual std::size_t GetData(void* pData, std::size_t nSize) override;
virtual std::size_t PutData(const void* pData, std::size_t nSize) override;
- virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override;
- virtual void FlushData() override;
- virtual ~SotStorageStream() override;
+ virtual sal_uInt64 SeekPos(sal_uInt64 nPos) override;
+ virtual void FlushData() override;
+
+ virtual ~SotStorageStream() override;
public:
- SotStorageStream( const OUString &,
- StreamMode = StreamMode::STD_READWRITE );
- SotStorageStream( BaseStorageStream *pStm );
-
- virtual void ResetError() override;
-
- virtual void SetSize( sal_uInt64 nNewSize ) override;
- sal_uInt32 GetSize() const;
- void CopyTo( SotStorageStream * pDestStm );
- bool Commit();
- bool SetProperty( const OUString& rName, const css::uno::Any& rValue );
- virtual sal_uInt64 TellEnd() override;
+ SotStorageStream(OUString const & rString,
+ StreamMode = StreamMode::STD_READWRITE);
+ SotStorageStream(BaseStorageStream *pBaseStream);
+
+ virtual void ResetError() override;
+
+ virtual void SetSize(sal_uInt64 nNewSize) override;
+ sal_uInt32 GetSize() const;
+ void CopyTo(SotStorageStream * pDestStm);
+ bool Commit();
+ bool SetProperty(OUString const & rName, css::uno::Any const & rValue);
+ virtual sal_uInt64 TellEnd() override;
};
class BaseStorage;
@@ -64,96 +66,100 @@ class SOT_DLLPUBLIC SotStorage : virtual public SotObject
{
friend class SotStorageStream;
- BaseStorage * m_pOwnStg; // target storage
- SvStream * m_pStorStm; // only for SDSTORAGES
- ErrCode m_nError;
- OUString m_aName; // name of the storage
- bool m_bIsRoot; // e.g.: File Storage
- bool m_bDelStm;
- OString m_aKey; // aKey.Len != 0 -> encryption
- sal_Int32 m_nVersion;
+ BaseStorage* m_pOwnStg; // target storage
+ SvStream* m_pStorStm; // only for SDSTORAGES
+ ErrCode m_nError;
+ OUString m_aName;// name of the storage
+ bool m_bIsRoot; // e.g.: File Storage
+ bool m_bDelStm;
+ OString m_aKey; // aKey.Len != 0 -> encryption
+ sal_Int32 m_nVersion;
protected:
- virtual ~SotStorage() override;
- void CreateStorage( bool bUCBStorage, StreamMode );
+ virtual ~SotStorage() override;
+ void CreateStorage(bool bUCBStorage, StreamMode);
public:
- SotStorage( const OUString &,
- StreamMode = StreamMode::STD_READWRITE );
- SotStorage( bool bUCBStorage, const OUString &,
- StreamMode = StreamMode::STD_READWRITE );
- SotStorage( BaseStorage * );
- SotStorage( SvStream & rStm );
- SotStorage( bool bUCBStorage, SvStream & rStm );
- SotStorage( SvStream * pStm, bool bDelete );
+ SotStorage(OUString const & rString, StreamMode eMode = StreamMode::STD_READWRITE);
+ SotStorage(bool bUCBStorage, const OUString & rString,
+ StreamMode = StreamMode::STD_READWRITE);
+ SotStorage(BaseStorage * pStorage);
+ SotStorage(SvStream & rStream);
+ SotStorage(bool bUCBStorage, SvStream & rStream);
+ SotStorage(SvStream * rStream, bool bDelete);
std::unique_ptr<SvMemoryStream> CreateMemoryStream();
- static bool IsStorageFile( const OUString & rFileName );
- static bool IsStorageFile( SvStream* pStream );
+ static bool IsStorageFile(OUString const & rFileName);
+ static bool IsStorageFile(SvStream* pStream);
- const OUString& GetName() const;
+ const OUString& GetName() const;
- bool Validate();
+ bool Validate();
- const OString& GetKey() const { return m_aKey;}
+ const OString& GetKey() const { return m_aKey;}
- void SetVersion( sal_Int32 nVers )
- {
- m_nVersion = nVers;
- }
- sal_Int32 GetVersion() const
- {
- return m_nVersion;
- }
+ void SetVersion(sal_Int32 nVersion)
+ {
+ m_nVersion = nVersion;
+ }
+ sal_Int32 GetVersion() const
+ {
+ return m_nVersion;
+ }
- ErrCode GetError() const { return m_nError.IgnoreWarning(); }
- void SetError( ErrCode nErrorCode )
- {
- if( m_nError == ERRCODE_NONE )
- m_nError = nErrorCode;
- }
+ ErrCode GetError() const
+ {
+ return m_nError.IgnoreWarning();
+ }
+ void SetError(ErrCode nErrorCode)
+ {
+ if (m_nError == ERRCODE_NONE)
+ m_nError = nErrorCode;
+ }
- void SignAsRoot( bool b ) { m_bIsRoot = b; }
+ void SignAsRoot(bool bRoot) { m_bIsRoot = bRoot; }
// own data sector
- void SetClass( const SvGlobalName & rClass,
- SotClipboardFormatId bOriginalClipFormat,
- const OUString & rUserTypeName );
- SvGlobalName GetClassName(); // type of data in the storage
+ void SetClass(const SvGlobalName & rClass,
+ SotClipboardFormatId bOriginalClipFormat,
+ const OUString & rUserTypeName);
+
+ SvGlobalName GetClassName(); // type of data in the storage
SotClipboardFormatId GetFormat();
- OUString GetUserName();
-
- // list of all elements
- void FillInfoList( SvStorageInfoList * ) const;
- bool CopyTo( SotStorage * pDestStg );
- bool Commit();
-
- // create stream with connection to Storage,
- // more or less a Parent-Child relationship
- SotStorageStream * OpenSotStream( const OUString & rEleName,
- StreamMode = StreamMode::STD_READWRITE );
- SotStorage * OpenSotStorage( const OUString & rEleName,
- StreamMode = StreamMode::STD_READWRITE,
- bool transacted = true );
- // query whether Storage or Stream
- bool IsStream( const OUString & rEleName ) const;
- bool IsStorage( const OUString & rEleName ) const;
- bool IsContained( const OUString & rEleName ) const;
- // remove element
- bool Remove( const OUString & rEleName );
- bool CopyTo( const OUString & rEleName, SotStorage * pDest,
- const OUString & rNewName );
-
- bool IsOLEStorage() const;
- static bool IsOLEStorage( const OUString & rFileName );
- static bool IsOLEStorage( SvStream* pStream );
-
- static SotStorage* OpenOLEStorage( const css::uno::Reference < css::embed::XStorage >& xStorage,
- const OUString& rEleName, StreamMode = StreamMode::STD_READWRITE );
- static SotClipboardFormatId GetFormatID( const css::uno::Reference < css::embed::XStorage >& xStorage );
- static sal_Int32 GetVersion( const css::uno::Reference < css::embed::XStorage >& xStorage );
+ OUString GetUserName();
+
+ // list of all elements
+ void FillInfoList(SvStorageInfoList *) const;
+ bool CopyTo(SotStorage * pDestStg);
+ bool Commit();
+
+ // create stream with connection to Storage,
+ // more or less a Parent-Child relationship
+ SotStorageStream* OpenSotStream(const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE);
+ SotStorage* OpenSotStorage(const OUString & rEleName,
+ StreamMode = StreamMode::STD_READWRITE,
+ bool transacted = true);
+
+ // query whether Storage or Stream
+ bool IsStream( const OUString & rEleName ) const;
+ bool IsStorage( const OUString & rEleName ) const;
+ bool IsContained( const OUString & rEleName ) const;
+ // remove element
+ bool Remove(const OUString & rEleName);
+ bool CopyTo(const OUString & rEleName, SotStorage* pDest,
+ const OUString & rNewName);
+
+ bool IsOLEStorage() const;
+ static bool IsOLEStorage(const OUString & rFileName);
+ static bool IsOLEStorage(SvStream* pStream);
+
+ static SotStorage* OpenOLEStorage(css::uno::Reference<css::embed::XStorage> const & xStorage,
+ OUString const & rEleName, StreamMode = StreamMode::STD_READWRITE);
+ static SotClipboardFormatId GetFormatID(css::uno::Reference<css::embed::XStorage> const & xStorage);
+ static sal_Int32 GetVersion(css::uno::Reference<css::embed::XStorage> const & xStorage);
};
-#endif // _SVSTOR_HXX
+#endif // INCLUDED_SOT_STORAGE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index 9db281b7d3ce..ac3388858643 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.cxx
@@ -23,11 +23,7 @@
#include <sot/filelist.hxx>
#include <osl/thread.h>
-/******************************************************************************
-|*
-|* Stream operators
-|*
-\******************************************************************************/
+/* Stream operators */
/* #i28176#
The Windows clipboard bridge now provides a double '\0'
@@ -63,12 +59,7 @@ SvStream& ReadFileList( SvStream& rIStm, FileList& rFileList )
return rIStm;
}
-/******************************************************************************
-|*
-|* Fill in / check the list
-|*
-\******************************************************************************/
-
+/* Fill in / check the list */
void FileList::AppendFile( const OUString& rStr )
{
aStrList.push_back( rStr );
diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx
index a33e16f7c281..5c91afeccba9 100644
--- a/sot/source/base/object.cxx
+++ b/sot/source/base/object.cxx
@@ -20,46 +20,40 @@
#include <sot/object.hxx>
SotObject::SotObject()
- : nOwnerLockCount( 0 )
- , bInClose ( false )
+ : nOwnerLockCount(0)
+ , bInClose(false)
{
}
-SotObject::~SotObject()
-{
-}
+SotObject::~SotObject() = default;
-void SotObject::OwnerLock
-(
- bool bLock /* true, lock. false, unlock. */
-)
-/* [Description]
-
- * When the OwnerLock is decremented to zero, the DoClose method is called.
+/** When the OwnerLock is decremented to zero, the DoClose method is called.
* This happens independently of the lock or RefCount. If the OwnerLock
* counter != zero, no DoClose is called by <SotObject::FuzzyLock>.
+ *
+ * bLock - true, lock. false, unlock.
*/
+void SotObject::OwnerLock(bool bLock)
{
- if( bLock )
+ if (bLock)
{
nOwnerLockCount++;
AddFirstRef();
}
- else if ( nOwnerLockCount )
+ else if (nOwnerLockCount)
{
- if( 0 == --nOwnerLockCount )
+ if (0 == --nOwnerLockCount)
DoClose();
ReleaseRef();
}
}
-
bool SotObject::DoClose()
{
bool bRet = false;
- if( !bInClose )
+ if (!bInClose)
{
- tools::SvRef<SotObject> xHoldAlive( this );
+ tools::SvRef<SotObject> xHoldAlive(this);
bInClose = true;
bRet = Close();
bInClose = false;
@@ -67,11 +61,9 @@ bool SotObject::DoClose()
return bRet;
}
-
bool SotObject::Close()
{
return true;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */