diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/sot | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/sot')
-rw-r--r-- | include/sot/exchange.hxx | 224 | ||||
-rw-r--r-- | include/sot/factory.hxx | 76 | ||||
-rw-r--r-- | include/sot/filelist.hxx | 65 | ||||
-rw-r--r-- | include/sot/formats.hxx | 182 | ||||
-rw-r--r-- | include/sot/object.hxx | 307 | ||||
-rw-r--r-- | include/sot/sotdata.hxx | 57 | ||||
-rw-r--r-- | include/sot/sotdllapi.h | 34 | ||||
-rw-r--r-- | include/sot/stg.hxx | 366 | ||||
-rw-r--r-- | include/sot/storage.hxx | 223 | ||||
-rw-r--r-- | include/sot/storinfo.hxx | 61 |
10 files changed, 1595 insertions, 0 deletions
diff --git a/include/sot/exchange.hxx b/include/sot/exchange.hxx new file mode 100644 index 000000000000..b4273682de40 --- /dev/null +++ b/include/sot/exchange.hxx @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_EXCHANGE_HXX +#define _SOT_EXCHANGE_HXX + +#include <list> +#include <vector> +#include <tools/string.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#include "sot/sotdllapi.h" + +class SotDataObject; + +namespace com { namespace sun { namespace star { namespace datatransfer { + class XTransferable; +} } } } + +// --------------------- +// - SotFormatStringId - +// --------------------- + +typedef sal_uLong SotFormatStringId; + +// ---------------- +// - DataFlavorEx - +// ---------------- + +struct DataFlavorEx : public ::com::sun::star::datatransfer::DataFlavor +{ + SotFormatStringId mnSotId; +}; + +typedef ::std::vector< ::com::sun::star::datatransfer::DataFlavor > DataFlavorVector; +typedef ::std::vector< DataFlavorEx > _DataFlavorExVector; + +// JP 23.03.2001 - this struct is only for "hide" the STD of the vetor, +// because our makefile filter all this symbols and so nowbody can use +// these struct in any interfacses. +struct DataFlavorExVector : public _DataFlavorExVector +{ +}; + +typedef ::std::list< ::com::sun::star::datatransfer::DataFlavor > DataFlavorList; +typedef ::std::list< DataFlavorEx > DataFlavorExList; + +SOT_DLLPUBLIC sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, + sal_uLong nId ); + +// ------------------------- +// - Vordefinierte Formate - +// ------------------------- + +// Die Reihenfolge und die Werte d�rfen nicht ge�ndert werden, +// da die Implementation sich darauf verl��t. +// Standard-Formate fuer die es auch Copy/Paste-Methoden gibt +#define FORMAT_STRING 1 +#define FORMAT_BITMAP 2 +#define FORMAT_GDIMETAFILE 3 +#define FORMAT_PRIVATE 4 +#define FORMAT_FILE 5 +#define FORMAT_FILE_LIST 6 + +// Weitere Standardformate (diese gehen nur ueber CopyData/PasteData) +#define FORMAT_RTF 10 + +// Source-Options +#define EXCHG_SOURCE_MOVEABLE ((sal_uInt16)0x0001) +#define EXCHG_SOURCE_COPYABLE ((sal_uInt16)0x0002) +#define EXCHG_SOURCE_LINKABLE ((sal_uInt16)0x0004) +#define EXCHG_SOURCE_PRINTABLE ((sal_uInt16)0x0008) +#define EXCHG_SOURCE_DISCARDABLE ((sal_uInt16)0x0010) +#define EXCHG_SOURCE_ALL ((sal_uInt16)0x001F) +#define EXCHG_SOURCE_DEF_COPYABLE ((sal_uInt16)0x0020) + +// Aktionen +#define EXCHG_ACTION_MASK ((sal_uInt16)0x00FF) +#define EXCHG_INOUT_ACTION_NONE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE) +#define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE +#define EXCHG_IN_ACTION_MOVE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE) +#define EXCHG_IN_ACTION_COPY ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY) +#define EXCHG_IN_ACTION_LINK ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK) +#define EXCHG_INOUT_ACTION_PRINT ((sal_uInt16)8) +#define EXCHG_INOUT_ACTION_DISCARD ((sal_uInt16)16) +#define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt16)17) +#define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt16)18) +#define EXCHG_OUT_ACTION_INSERT_FILELINK ((sal_uInt16)19) +#define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt16)20) +#define EXCHG_OUT_ACTION_INSERT_FILELIST ((sal_uInt16)21) +#define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt16)22) +#define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt16)23) +#define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt16)24) +#define EXCHG_OUT_ACTION_INSERT_URLBUTTON ((sal_uInt16)25) +#define EXCHG_OUT_ACTION_INSERT_CHAOSOBJ ((sal_uInt16)26) // OBSOLET ab 500.b ? +#define EXCHG_OUT_ACTION_REPLACE_OBJ ((sal_uInt16)27) +#define EXCHG_OUT_ACTION_REPLACE_LINK ((sal_uInt16)28) +#define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt16)29) +#define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt16)30) +#define EXCHG_OUT_ACTION_UPLOAD ((sal_uInt16)31) // OBSOLET ab 500.b ? +#define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt16)32) +#define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt16)33) +#define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt16)34) +#define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt16)35) +#define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt16)36) +#define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt16)37) +#define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt16)38) +#define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt16)39) +#define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt16)40) +#define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt16)41) +#define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt16)42) +#define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt16)43) +#define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt16)44) +#define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt16)45) +#define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt16)46) +#define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt16)47) +#define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt16)48) +#define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt16)49) +#define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt16)50) +#define EXCHG_OUT_ACTION_INSERT_MSGATTACH ((sal_uInt16)51) // obsolet ab 500.b ? +#define EXCHG_OUT_ACTION_COPY_CHAOSOBJ ((sal_uInt16)52) +#define EXCHG_OUT_ACTION_MOVE_CHAOSOBJ ((sal_uInt16)53) +#define EXCHG_OUT_ACTION_COPY_MSGATTACH ((sal_uInt16)54) +#define EXCHG_OUT_ACTION_COPY_BOOKMARK ((sal_uInt16)55) +#define EXCHG_OUT_ACTION_COPY_FILE ((sal_uInt16)56) + +#define EXCHG_OUT_ACTION_FLAG_CREATE_THEME ((sal_uInt16)0x0100) +#define EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE ((sal_uInt16)0x0200) +#define EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP ((sal_uInt16)0x0400) +#define EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ((sal_uInt16)0x0800) +#define EXCHG_OUT_ACTION_FLAG_FILL ((sal_uInt16)0x1000) +#define EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL ((sal_uInt16)0x2000) + +// Ziele +#define EXCHG_DEST_DOC_OLEOBJ 1 +#define EXCHG_DEST_CHARTDOC_OLEOBJ 2 +#define EXCHG_DEST_DOC_TEXTFRAME 3 +#define EXCHG_DEST_DOC_GRAPHOBJ 4 +#define EXCHG_DEST_DOC_LNKD_GRAPHOBJ 5 +#define EXCHG_DEST_DOC_GRAPH_W_IMAP 6 +#define EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP 7 +#define EXCHG_DEST_DOC_IMAPREGION 8 +#define EXCHG_DEST_DOC_DRAWOBJ 9 +#define EXCHG_DEST_DOC_URLBUTTON 10 +#define EXCHG_DEST_DOC_URLFIELD 11 +#define EXCHG_DEST_DOC_GROUPOBJ 12 +#define EXCHG_DEST_SWDOC_FREE_AREA 13 +#define EXCHG_DEST_SCDOC_FREE_AREA 14 +#define EXCHG_DEST_SDDOC_FREE_AREA 15 +#define EXCHG_DEST_DOC_TEXTFRAME_WEB 16 +#define EXCHG_DEST_SWDOC_FREE_AREA_WEB 17 + +// ------------ +// - Exchange - +// ------------ +class SvGlobalName; +class SOT_DLLPUBLIC SotExchange +{ +public: + static sal_uLong RegisterFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + static sal_uLong RegisterFormatName( const String& rName ); + static sal_uLong RegisterFormatMimeType( const String& rMimeType ); + + static sal_uLong GetFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + static String GetFormatName( sal_uLong nFormat ); + static sal_Bool GetFormatDataFlavor( sal_uLong nFormat, ::com::sun::star::datatransfer::DataFlavor& rFlavor ); + static String GetFormatMimeType( sal_uLong nFormat ); + static sal_Bool IsInternal( const SvGlobalName& ); + static sal_uLong GetFormatIdFromMimeType( const String& rMimeType ); + + // bestimme die SotFormatStringId von dem registrierten Format + //JP 12.11.98: diese 3 Methoden sind ab sofort ueberfluessig, da + // die ClipboardIds statisch sind und aequivalent zur + // SotFormatStringId ist! + static SotFormatStringId GetFormatStringId( sal_uLong nFormat ) + { return nFormat; } + static SotFormatStringId GetFormatStringId( const String& rName ) + { return SotExchange::RegisterFormatMimeType( rName ); } + static sal_uLong RegisterSotFormatName( SotFormatStringId nId ) + { return nId; } + + // same for XTransferable interface + static sal_uInt16 GetExchangeAction( + // XTransferable + const DataFlavorExVector& rDataFlavorExVector, + // Ziel der Aktion (EXCHG_DEST_*) + sal_uInt16 nDestination, + // Aktionen, die Quelle unterstuetzt (EXCHG_SOURCE_...) + sal_uInt16 nSourceOptions, + // vom Anwender gewaehlte Aktion (EXCHG_IN_*, EXCHG_INOUT_*) + sal_uInt16 nUserAction, + // In:- Out: Zu benutzendes Format + sal_uLong& rFormat, + // In:- Out: Default-Action (EXCHG_IN_*, EXCHG_INOUT_*) + sal_uInt16& rDefaultAction, + // In:- optional - check only for this specific format + sal_uLong nOnlyTestFormat = 0, + // In:- optional - check the contents of Xtransferable + const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >* pxTransferable = NULL ); + + static sal_uInt16 IsChart( const SvGlobalName& rName ); + static sal_uInt16 IsMath( const SvGlobalName& rName ); +}; + +#endif // _EXCHANGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/factory.hxx b/include/sot/factory.hxx new file mode 100644 index 000000000000..726b24382756 --- /dev/null +++ b/include/sot/factory.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_FACTORY_HXX +#define _SOT_FACTORY_HXX + +#include <tools/globname.hxx> +#include <tools/rtti.hxx> +#include "sot/sotdllapi.h" +#include <vector> + +/************************************************************************* +*************************************************************************/ +class SotObject; +class SotFactory; + +typedef ::std::vector< SotFactory* > SotFactoryList; +typedef void * (*CreateInstanceType)( SotObject ** ); + +//==================class SotFactory======================================= +class SOT_DLLPUBLIC SotFactory : public SvGlobalName +{ + sal_uInt16 nSuperCount; // Anzahl der Superklassen + const SotFactory ** pSuperClasses; // Superklassen + CreateInstanceType pCreateFunc; + + String aClassName; + + static sal_Bool ExistTest( const SvGlobalName & ); +protected: + virtual ~SotFactory(); +public: + TYPEINFO(); + static void IncSvObjectCount( SotObject * = NULL ); + static void DecSvObjectCount( SotObject * = NULL ); + + static const SotFactory * Find( const SvGlobalName & ); + + SotFactory( const SvGlobalName &, + const String & rClassName, CreateInstanceType ); + + void PutSuperClass( const SotFactory * ); + virtual void * CreateInstance( SotObject ** ppObj = NULL ) const; + + sal_Bool Is( const SotFactory * pSuperClass ) const; + const SotFactory * GetSuper( sal_uInt16 nPos ) const + { + return nPos < nSuperCount ? + pSuperClasses[ nPos ] + : NULL; + } + +private: + SOT_DLLPRIVATE SotFactory( const SotFactory & ); + SOT_DLLPRIVATE SotFactory & operator = ( const SotFactory & ); +}; + +#endif // _FACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/filelist.hxx b/include/sot/filelist.hxx new file mode 100644 index 000000000000..2e69a95e5498 --- /dev/null +++ b/include/sot/filelist.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _FILELIST_HXX +#define _FILELIST_HXX + +#include <tools/stream.hxx> +#include "sot/sotdllapi.h" + +#include <vector> +typedef ::std::vector< String* > FileStringList; + +class SOT_DLLPUBLIC FileList : public SvDataCopyStream +{ + FileStringList aStrList; + +protected: + + // SvData-Methoden + virtual void Load( SvStream& ); + virtual void Save( SvStream& ); + virtual void Assign( const SvDataCopyStream& ); + + // Liste loeschen; + void ClearAll( void ); + +public: + + TYPEINFO(); + FileList() {}; + ~FileList(); + + // Zuweisungsoperator + FileList& operator=( const FileList& rFileList ); + + // Im-/Export + SOT_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const FileList& rFileList ); + SOT_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, FileList& rFileList ); + + // Liste fuellen/abfragen + void AppendFile( const String& rStr ); + String GetFile( size_t i ) const; + size_t Count( void ) const; + +}; + +#endif // _FILELIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/formats.hxx b/include/sot/formats.hxx new file mode 100644 index 000000000000..912947669e53 --- /dev/null +++ b/include/sot/formats.hxx @@ -0,0 +1,182 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_FORMATS_HXX +#define _SOT_FORMATS_HXX + +#ifdef _SOT_FORMATS_INCLUDE_SYSTEMFORMATS + +#ifdef WNT +#ifdef _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable: 4917) +#endif +#include <shlobj.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif + +#endif +#include <sot/exchange.hxx> + +#define SOT_FORMAT_SYSTEM_START ((sal_uLong)0) +#define SOT_FORMAT_STRING ((sal_uLong)FORMAT_STRING) +#define SOT_FORMAT_BITMAP ((sal_uLong)FORMAT_BITMAP) +#define SOT_FORMAT_GDIMETAFILE ((sal_uLong)FORMAT_GDIMETAFILE) +#define SOT_FORMAT_PRIVATE ((sal_uLong)FORMAT_PRIVATE) +#define SOT_FORMAT_FILE ((sal_uLong)FORMAT_FILE) +#define SOT_FORMAT_FILE_LIST ((sal_uLong)FORMAT_FILE_LIST) +#define SOT_FORMAT_RTF ((sal_uLong)FORMAT_RTF) + +#define SOT_FORMATSTR_ID_DRAWING ((sal_uLong)11) +#define SOT_FORMATSTR_ID_SVXB ((sal_uLong)12) +#define SOT_FORMATSTR_ID_SVIM ((sal_uLong)13) +#define SOT_FORMATSTR_ID_XFA ((sal_uLong)14) +#define SOT_FORMATSTR_ID_EDITENGINE ((sal_uLong)15) +#define SOT_FORMATSTR_ID_INTERNALLINK_STATE ((sal_uLong)16) +#define SOT_FORMATSTR_ID_SOLK ((sal_uLong)17) +#define SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ((sal_uLong)18) +#define SOT_FORMATSTR_ID_TREELISTBOX ((sal_uLong)19) +#define SOT_FORMATSTR_ID_NATIVE ((sal_uLong)20) +#define SOT_FORMATSTR_ID_OWNERLINK ((sal_uLong)21) +#define SOT_FORMATSTR_ID_STARSERVER ((sal_uLong)22) +#define SOT_FORMATSTR_ID_STAROBJECT ((sal_uLong)23) +#define SOT_FORMATSTR_ID_APPLETOBJECT ((sal_uLong)24) +#define SOT_FORMATSTR_ID_PLUGIN_OBJECT ((sal_uLong)25) +#define SOT_FORMATSTR_ID_STARWRITER_30 ((sal_uLong)26) +#define SOT_FORMATSTR_ID_STARWRITER_40 ((sal_uLong)27) +#define SOT_FORMATSTR_ID_STARWRITER_50 ((sal_uLong)28) +#define SOT_FORMATSTR_ID_STARWRITERWEB_40 ((sal_uLong)29) +#define SOT_FORMATSTR_ID_STARWRITERWEB_50 ((sal_uLong)30) +#define SOT_FORMATSTR_ID_STARWRITERGLOB_40 ((sal_uLong)31) +#define SOT_FORMATSTR_ID_STARWRITERGLOB_50 ((sal_uLong)32) +#define SOT_FORMATSTR_ID_STARDRAW ((sal_uLong)33) +#define SOT_FORMATSTR_ID_STARDRAW_40 ((sal_uLong)34) +#define SOT_FORMATSTR_ID_STARIMPRESS_50 ((sal_uLong)35) +#define SOT_FORMATSTR_ID_STARDRAW_50 ((sal_uLong)36) +#define SOT_FORMATSTR_ID_STARCALC ((sal_uLong)37) +#define SOT_FORMATSTR_ID_STARCALC_40 ((sal_uLong)38) +#define SOT_FORMATSTR_ID_STARCALC_50 ((sal_uLong)39) +#define SOT_FORMATSTR_ID_STARCHART ((sal_uLong)40) +#define SOT_FORMATSTR_ID_STARCHART_40 ((sal_uLong)41) +#define SOT_FORMATSTR_ID_STARCHART_50 ((sal_uLong)42) +#define SOT_FORMATSTR_ID_STARIMAGE ((sal_uLong)43) +#define SOT_FORMATSTR_ID_STARIMAGE_40 ((sal_uLong)44) +#define SOT_FORMATSTR_ID_STARIMAGE_50 ((sal_uLong)45) +#define SOT_FORMATSTR_ID_STARMATH ((sal_uLong)46) +#define SOT_FORMATSTR_ID_STARMATH_40 ((sal_uLong)47) +#define SOT_FORMATSTR_ID_STARMATH_50 ((sal_uLong)48) +#define SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC ((sal_uLong)49) +#define SOT_FORMATSTR_ID_FILLED_AREA ((sal_uLong)50) +#define SOT_FORMATSTR_ID_HTML ((sal_uLong)51) +#define SOT_FORMATSTR_ID_HTML_SIMPLE ((sal_uLong)52) +#define SOT_FORMATSTR_ID_CHAOS ((sal_uLong)53) +#define SOT_FORMATSTR_ID_CNT_MSGATTACHFILE ((sal_uLong)54) +#define SOT_FORMATSTR_ID_BIFF_5 ((sal_uLong)55) +#define SOT_FORMATSTR_ID_BIFF__5 ((sal_uLong)56) +#define SOT_FORMATSTR_ID_SYLK ((sal_uLong)57) +#define SOT_FORMATSTR_ID_SYLK_BIGCAPS ((sal_uLong)58) +#define SOT_FORMATSTR_ID_LINK ((sal_uLong)59) +#define SOT_FORMATSTR_ID_DIF ((sal_uLong)60) +#define SOT_FORMATSTR_ID_STARDRAW_TABBAR ((sal_uLong)61) +#define SOT_FORMATSTR_ID_SONLK ((sal_uLong)62) +#define SOT_FORMATSTR_ID_MSWORD_DOC ((sal_uLong)63) +#define SOT_FORMATSTR_ID_STAR_FRAMESET_DOC ((sal_uLong)64) +#define SOT_FORMATSTR_ID_OFFICE_DOC ((sal_uLong)65) +#define SOT_FORMATSTR_ID_NOTES_DOCINFO ((sal_uLong)66) +#define SOT_FORMATSTR_ID_NOTES_HNOTE ((sal_uLong)67) +#define SOT_FORMATSTR_ID_NOTES_NATIVE ((sal_uLong)68) +#define SOT_FORMATSTR_ID_SFX_DOC ((sal_uLong)69) +#define SOT_FORMATSTR_ID_EVDF ((sal_uLong)70) +#define SOT_FORMATSTR_ID_ESDF ((sal_uLong)71) +#define SOT_FORMATSTR_ID_IDF ((sal_uLong)72) +#define SOT_FORMATSTR_ID_EFTP ((sal_uLong)73) +#define SOT_FORMATSTR_ID_EFD ((sal_uLong)74) +#define SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH ((sal_uLong)75) +#define SOT_FORMATSTR_ID_EXTENDED_TABBAR ((sal_uLong)76) +#define SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ((sal_uLong)77) +#define SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ((sal_uLong)78) +#define SOT_FORMATSTR_ID_SBA_PRIVATE_URL ((sal_uLong)79) +#define SOT_FORMATSTR_ID_SBA_TABED ((sal_uLong)80) +#define SOT_FORMATSTR_ID_SBA_TABID ((sal_uLong)81) +#define SOT_FORMATSTR_ID_SBA_JOIN ((sal_uLong)82) +#define SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ((sal_uLong)83) +#define SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR ((sal_uLong)84) +#define SOT_FORMATSTR_ID_EMBED_SOURCE ((sal_uLong)85) +#define SOT_FORMATSTR_ID_LINK_SOURCE ((sal_uLong)86) +#define SOT_FORMATSTR_ID_EMBEDDED_OBJ ((sal_uLong)87) +#define SOT_FORMATSTR_ID_FILECONTENT ((sal_uLong)88) +#define SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ((sal_uLong)89) +#define SOT_FORMATSTR_ID_FILENAME ((sal_uLong)90) +#define SOT_FORMATSTR_ID_SD_OLE ((sal_uLong)91) +#define SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ((sal_uLong)92) +#define SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ((sal_uLong)93) +#define SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ((sal_uLong)94) +#define SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE ((sal_uLong)95) +#define SOT_FORMATSTR_ID_LINK_SOURCE_OLE ((sal_uLong)96) +#define SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE ((sal_uLong)97) +#define SOT_FORMATSTR_ID_OUTPLACE_OBJ ((sal_uLong)98) +#define SOT_FORMATSTR_ID_CNT_OWN_CLIP ((sal_uLong)99) +#define SOT_FORMATSTR_ID_INET_IMAGE ((sal_uLong)100) +#define SOT_FORMATSTR_ID_NETSCAPE_IMAGE ((sal_uLong)101) +#define SOT_FORMATSTR_ID_SBA_FORMEXCHANGE ((sal_uLong)102) +#define SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE ((sal_uLong)103) +#define SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ((sal_uLong)104) +#define SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50 ((sal_uLong)105) +#define SOT_FORMATSTR_ID_GRAPHOBJ ((sal_uLong)106) +#define SOT_FORMATSTR_ID_STARWRITER_60 ((sal_uLong)107) +#define SOT_FORMATSTR_ID_STARWRITERWEB_60 ((sal_uLong)108) +#define SOT_FORMATSTR_ID_STARWRITERGLOB_60 ((sal_uLong)109) +#define SOT_FORMATSTR_ID_STARDRAW_60 ((sal_uLong)110) +#define SOT_FORMATSTR_ID_STARIMPRESS_60 ((sal_uLong)111) +#define SOT_FORMATSTR_ID_STARCALC_60 ((sal_uLong)112) +#define SOT_FORMATSTR_ID_STARCHART_60 ((sal_uLong)113) +#define SOT_FORMATSTR_ID_STARMATH_60 ((sal_uLong)114) +#define SOT_FORMATSTR_ID_WMF ((sal_uLong)115) +#define SOT_FORMATSTR_ID_DBACCESS_QUERY ((sal_uLong)116) +#define SOT_FORMATSTR_ID_DBACCESS_TABLE ((sal_uLong)117) +#define SOT_FORMATSTR_ID_DBACCESS_COMMAND ((sal_uLong)118) +#define SOT_FORMATSTR_ID_DIALOG_60 ((sal_uLong)119) +#define SOT_FORMATSTR_ID_EMF ((sal_uLong)120) +#define SOT_FORMATSTR_ID_BIFF_8 ((sal_uLong)121) +#define SOT_FORMATSTR_ID_BMP ((sal_uLong)122) +#define SOT_FORMATSTR_ID_HTML_NO_COMMENT ((sal_uLong)123) +#define SOT_FORMATSTR_ID_STARWRITER_8 ((sal_uLong)124) +#define SOT_FORMATSTR_ID_STARWRITERWEB_8 ((sal_uLong)125) +#define SOT_FORMATSTR_ID_STARWRITERGLOB_8 ((sal_uLong)126) +#define SOT_FORMATSTR_ID_STARDRAW_8 ((sal_uLong)127) +#define SOT_FORMATSTR_ID_STARIMPRESS_8 ((sal_uLong)128) +#define SOT_FORMATSTR_ID_STARCALC_8 ((sal_uLong)129) +#define SOT_FORMATSTR_ID_STARCHART_8 ((sal_uLong)130) +#define SOT_FORMATSTR_ID_STARMATH_8 ((sal_uLong)131) +#define SOT_FORMATSTR_ID_XFORMS ((sal_uLong)132) +#define SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE ((sal_uLong)133) +#define SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE ((sal_uLong)134) +#define SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE ((sal_uLong)135) +#define SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE ((sal_uLong)136) +#define SOT_FORMATSTR_ID_STARCHART_8_TEMPLATE ((sal_uLong)137) +#define SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE ((sal_uLong)138) +#define SOT_FORMATSTR_ID_STARBASE_8 ((sal_uLong)139) +#define SOT_FORMATSTR_ID_HC_GDIMETAFILE ((sal_uLong)140) +#define SOT_FORMATSTR_ID_USER_END SOT_FORMATSTR_ID_HC_GDIMETAFILE + +#endif // _SOT_FORMATS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/object.hxx b/include/sot/object.hxx new file mode 100644 index 000000000000..435dda8d4626 --- /dev/null +++ b/include/sot/object.hxx @@ -0,0 +1,307 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_OBJECT_HXX +#define _SOT_OBJECT_HXX + +#include <sot/sotdata.hxx> +#include <tools/globname.hxx> +#include <tools/ref.hxx> +#include "sot/sotdllapi.h" + +/************************************************************************* +*************************************************************************/ + +#define SO2_DECL_BASIC_CLASS_DLL(ClassName,FacName) \ +private: \ + static SotFactory ** GetFactoryAdress() \ + { return &(FacName->p##ClassName##Factory); } \ +public: \ + static void * CreateInstance( SotObject ** = NULL ); \ + static SotFactory * ClassFactory(); \ + virtual const SotFactory * GetSvFactory() const; \ + virtual void * Cast( const SotFactory * ); + +#define SO2_DECL_BASIC_CLASS(ClassName) \ +private: \ + static SotFactory * pFactory; \ + static SotFactory ** GetFactoryAdress() { return &pFactory; } \ +public: \ + static void * CreateInstance( SotObject ** = NULL ); \ + static SotFactory * ClassFactory(); \ + virtual const SotFactory * GetSvFactory() const; \ + virtual void * Cast( const SotFactory * ); + +/************************************************************************** +**************************************************************************/ +#define SO2_IMPL_BASIC_CLASS_DLL(ClassName,FactoryName,GlobalName) \ +SotFactory * ClassName::ClassFactory() \ +{ \ + SotFactory **ppFactory = GetFactoryAdress(); \ + if( !*ppFactory ) \ + { \ + *ppFactory = new FactoryName( GlobalName, \ + OUString( #ClassName ), ClassName::CreateInstance ); \ + } \ + return *ppFactory; \ +} \ +void * ClassName::CreateInstance( SotObject ** ppObj ) \ +{ \ + ClassName * p = new ClassName(); \ + if( ppObj ) \ + *ppObj = p; \ + return p; \ +} \ +const SotFactory * ClassName::GetSvFactory() const \ +{ \ + return ClassFactory(); \ +} \ +void * ClassName::Cast( const SotFactory * pFact ) \ +{ \ + void * pRet = NULL; \ + if( !pFact || pFact == ClassFactory() ) \ + pRet = this; \ + return pRet; \ +} + +#define SO2_IMPL_BASIC_CLASS(ClassName,FactoryName,GlobalName) \ +SotFactory * ClassName::pFactory = NULL; \ + SO2_IMPL_BASIC_CLASS_DLL(ClassName,FactoryName,GlobalName) + +/************************************************************************** +**************************************************************************/ +#define SO2_IMPL_BASIC_CLASS1_DLL(ClassName,FactoryName,Super1,GlobalName)\ +SotFactory * ClassName::ClassFactory() \ +{ \ + SotFactory **ppFactory = GetFactoryAdress(); \ + if( !*ppFactory ) \ + { \ + *ppFactory = new FactoryName( GlobalName, \ + OUString( #ClassName ), ClassName::CreateInstance ); \ + (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \ + } \ + return *ppFactory; \ +} \ +void * ClassName::CreateInstance( SotObject ** ppObj ) \ +{ \ + ClassName * p = new ClassName(); \ + Super1* pSuper1 = p; \ + SotObject* pBasicObj = pSuper1; \ + if( ppObj ) \ + *ppObj = pBasicObj; \ + return p; \ +} \ +const SotFactory * ClassName::GetSvFactory() const \ +{ \ + return ClassFactory(); \ +} \ +void * ClassName::Cast( const SotFactory * pFact ) \ +{ \ + void * pRet = NULL; \ + if( !pFact || pFact == ClassFactory() ) \ + pRet = this; \ + if( !pRet ) \ + pRet = Super1::Cast( pFact ); \ + return pRet; \ +} + +#define SO2_IMPL_BASIC_CLASS1(ClassName,FactoryName,Super1,GlobalName) \ +SotFactory * ClassName::pFactory = NULL; \ + SO2_IMPL_BASIC_CLASS1_DLL(ClassName,FactoryName,Super1,GlobalName) + +/************************************************************************** +**************************************************************************/ +#define SO2_IMPL_BASIC_CLASS2_DLL(ClassName,FactoryName,Super1,Super2,GlobalName) \ +SotFactory * ClassName::ClassFactory() \ +{ \ + SotFactory **ppFactory = GetFactoryAdress(); \ + if( !*ppFactory ) \ + { \ + *ppFactory = new FactoryName( GlobalName, \ + OUString( #ClassName ), ClassName::CreateInstance ); \ + (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \ + (*ppFactory)->PutSuperClass( Super2::ClassFactory() ); \ + } \ + return *ppFactory; \ +} \ +void * ClassName::CreateInstance( SotObject ** ppObj ) \ +{ \ + ClassName * p = new ClassName(); \ + if( ppObj ) \ + *ppObj = p; \ + return p; \ +} \ +const SotFactory * ClassName::GetSvFactory() const \ +{ \ + return ClassFactory(); \ +} \ +void * ClassName::Cast( const SotFactory * pFact ) \ +{ \ + void * pRet = NULL; \ + if( !pFact || pFact == ClassFactory() ) \ + pRet = this; \ + if( !pRet ) \ + pRet = Super1::Cast( pFact ); \ + if( !pRet ) \ + pRet = Super2::Cast( pFact ); \ + return pRet; \ +} +#define SO2_IMPL_BASIC_CLASS2(ClassName,FactoryName,Super1,Super2,GlobalName) \ +SotFactory * ClassName::pFactory = NULL; \ + SO2_IMPL_BASIC_CLASS2_DLL(ClassName,FactoryName,Super1,Super2,GlobalName) + +/************************************************************************** +**************************************************************************/ +#define SO2_IMPL_BASIC_CLASS3_DLL(ClassName,FactoryName,Super1,Super2,Super3,GlobalName) \ +SotFactory * ClassName::ClassFactory() \ +{ \ + SotFactory **ppFactory = GetFactoryAdress(); \ + if( !*ppFactory ) \ + { \ + *ppFactory = new FactoryName( GlobalName, \ + OUString( #ClassName ), ClassName::CreateInstance ); \ + (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \ + (*ppFactory)->PutSuperClass( Super2::ClassFactory() ); \ + (*ppFactory)->PutSuperClass( Super3::ClassFactory() ); \ + } \ + return *pFactory; \ +} \ +void * ClassName::CreateInstance( SotObject ** ppObj ) \ +{ \ + ClassName * p = new ClassName(); \ + if( ppObj ) \ + *ppObj = p; \ + return p; \ +} \ +const SotFactory * ClassName::GetSvFactory() const \ +{ \ + return ClassFactory(); \ +} \ +void * ClassName::Cast( const SotFactory * pFact ) \ +{ \ + void * pRet = NULL; \ + if( !pFact || pFact == ClassFactory() ) \ + pRet = this; \ + if( !pRet ) \ + pRet = Super1::Cast( pFact ); \ + if( !pRet ) \ + pRet = Super2::Cast( pFact ); \ + if( !pRet ) \ + pRet = Super3::Cast( pFact ); \ + return pRet; \ +} + +#define SO2_IMPL_BASIC_CLASS3(ClassName,FactoryName,Super1,Super2,Super3,GlobalName) \ +SotFactory * ClassName::pFactory = NULL; \ + SO2_IMPL_BASIC_CLASS3_DLL(ClassName,FactoryName,Super1,Super2,Super3,GlobalName) + +/************************************************************************** +**************************************************************************/ +#define SO2_IMPL_BASIC_CLASS4_DLL(ClassName,FactoryName,Super1,Super2,Super3,Super4,GlobalName) \ +SotFactory * ClassName::ClassFactory() \ +{ \ + SotFactory **ppFactory = GetFactoryAdress(); \ + if( !*ppFactory ) \ + { \ + *ppFactory = new SotFactory( GlobalName, \ + OUString( #ClassName ), ClassName::CreateInstance ); \ + (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \ + (*ppFactory)->PutSuperClass( Super2::ClassFactory() ); \ + (*ppFactory)->PutSuperClass( Super3::ClassFactory() ); \ + (*ppFactory)->PutSuperClass( Super4::ClassFactory() ); \ + } \ + return *ppFactory; \ +} \ +void * ClassName::CreateInstance( SotObject ** ppObj ) \ +{ \ + ClassName * p = new ClassName(); \ + if( ppObj ) \ + *ppObj = p; \ + return p; \ +} \ +const SotFactory * ClassName::GetSvFactory() const \ +{ \ + return ClassFactory(); \ +} \ +void * ClassName::Cast( const SotFactory * pFact ) \ +{ \ + void * pRet = NULL; \ + if( !pFact || pFact == ClassFactory() ) \ + pRet = this; \ + if( !pRet ) \ + pRet = Super1::Cast( pFact ); \ + if( !pRet ) \ + pRet = Super2::Cast( pFact ); \ + if( !pRet ) \ + pRet = Super3::Cast( pFact ); \ + if( !pRet ) \ + pRet = Super4::Cast( pFact ); \ + return pRet; \ +} + +#define SO2_IMPL_BASIC_CLASS4(ClassName,FactoryName,Super1,Super2,Super3,Super4,GlobalName) \ +SotFactory * ClassName::pFactory = NULL; \ + SO2_IMPL_BASIC_CLASS4_DLL(ClassName,FactoryName,Super1,Super2,Super3,Super4,GlobalName) + +//==================class SotObject======================================== +#ifdef _MSC_VER +#pragma warning(disable: 4250) +#endif + +struct IUnknown; +class SOT_DLLPUBLIC SotObject : virtual public SvRefBase +{ +friend class SotFactory; +friend class SvObject; + sal_uInt16 nOwnerLockCount; + sal_Bool bOwner:1, + bSVObject:1, // Ist Proxy, dann TRUE wenn andere Seite SV ist + bInClose:1; // TRUE, im DoClose + +protected: + virtual ~SotObject(); + void SetExtern() { bOwner = sal_False; } + virtual sal_Bool Close(); +public: + SotObject(); + SO2_DECL_BASIC_CLASS_DLL(SotObject,SOTDATA()) + + // Nur damit die Makros in So3 nicht ganz ausufern + virtual IUnknown * GetInterface( const SvGlobalName & ); + + sal_Bool Owner() const { return bOwner; } + + sal_uInt16 GetOwnerLockCount() const { return nOwnerLockCount; } + + void OwnerLock( sal_Bool bLock ); + sal_Bool DoClose(); + sal_Bool IsInClose() const { return bInClose; } + +private: + // Kopieren und Zuweisen dieses Objekttyps ist nicht erlaubt + SOT_DLLPRIVATE SotObject & operator = ( const SotObject & ); + SOT_DLLPRIVATE SotObject( const SotObject & ); +}; + +//==================class SotObjectRef====================================== +SV_DECL_IMPL_REF(SotObject) + +#endif // _IFACE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/sotdata.hxx b/include/sot/sotdata.hxx new file mode 100644 index 000000000000..da045079c76e --- /dev/null +++ b/include/sot/sotdata.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_DATA_HXX +#define _SOT_DATA_HXX + +/************************************************************************* +*************************************************************************/ + +#include <tools/solar.h> +#include "sot/sotdllapi.h" +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <vector> +#include <list> + +//==================class SotData_Impl==================================== + +class SotFactory; +class SotObject; + +typedef ::std::vector< SotFactory* > SotFactoryList; +typedef ::std::vector< com::sun::star::datatransfer::DataFlavor* > tDataFlavorList; + +struct SotData_Impl +{ + sal_uInt32 nSvObjCount; + std::list<SotObject*> aObjectList; + SotFactoryList * pFactoryList; + SotFactory * pSotObjectFactory; + SotFactory * pSotStorageStreamFactory; + SotFactory * pSotStorageFactory; + tDataFlavorList* pDataFlavorList; + SotData_Impl(); + ~SotData_Impl(); +}; + +SOT_DLLPUBLIC SotData_Impl* SOTDATA(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/sotdllapi.h b/include/sot/sotdllapi.h new file mode 100644 index 000000000000..722d2ee25f47 --- /dev/null +++ b/include/sot/sotdllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SOTDLLAPI_H +#define INCLUDED_SOTDLLAPI_H + +#include "sal/types.h" + +#if defined(SOT_DLLIMPLEMENTATION) +#define SOT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define SOT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define SOT_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_SOTDLLAPI_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx new file mode 100644 index 000000000000..bd124cc8df00 --- /dev/null +++ b/include/sot/stg.hxx @@ -0,0 +1,366 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _STG_HXX +#define _STG_HXX + +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Reference.h> + +#include <com/sun/star/io/XInputStream.hpp> + +#include <com/sun/star/ucb/XCommandEnvironment.hpp> + +#include <com/sun/star/embed/XStorage.hpp> + + +#include <tools/rtti.hxx> +#include <tools/stream.hxx> +#include <tools/globname.hxx> +#include "sot/storinfo.hxx" +#include "sot/sotdllapi.h" + +class Storage; +class StorageStream; +class StgIo; +class StgDirEntry; +class StgStrm; +class SvGlobalName; +struct ClsId +{ + sal_Int32 n1; + sal_Int16 n2, n3; + sal_uInt8 n4, n5, n6, n7, n8, n9, n10, n11; +}; + +class SOT_DLLPUBLIC StorageBase : public SvRefBase +{ +protected: + sal_uLong m_nError; // error code + StreamMode m_nMode; // open mode + sal_Bool m_bAutoCommit; + StorageBase(); + virtual ~StorageBase(); +public: + TYPEINFO(); + virtual const SvStream* GetSvStream() const = 0; + virtual sal_Bool Validate( sal_Bool=sal_False ) const = 0; + virtual sal_Bool ValidateMode( StreamMode ) const = 0; + void ResetError() const; + void SetError( sal_uLong ) const; + sal_uLong GetError() const; + sal_Bool Good() const { return sal_Bool( m_nError == SVSTREAM_OK ); } + StreamMode GetMode() const { return m_nMode; } + void SetAutoCommit( sal_Bool bSet ) + { m_bAutoCommit = bSet; } +}; + +class BaseStorageStream : public StorageBase +{ +public: + TYPEINFO(); + virtual sal_uLong Read( void * pData, sal_uLong nSize ) = 0; + virtual sal_uLong Write( const void* pData, sal_uLong nSize ) = 0; + virtual sal_uLong Seek( sal_uLong nPos ) = 0; + virtual sal_uLong Tell() = 0; + virtual void Flush() = 0; + virtual sal_Bool SetSize( sal_uLong nNewSize ) = 0; + virtual sal_uLong GetSize() const = 0; + virtual sal_Bool CopyTo( BaseStorageStream * pDestStm ) = 0; + virtual sal_Bool Commit() = 0; + virtual sal_Bool Revert() = 0; + virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0; +}; + +class BaseStorage : public StorageBase +{ +public: + TYPEINFO(); + virtual const String& GetName() const = 0; + virtual sal_Bool IsRoot() const = 0; + virtual void SetClassId( const ClsId& ) = 0; + virtual const ClsId& GetClassId() const = 0; + virtual void SetDirty() = 0; + virtual void SetClass( const SvGlobalName & rClass, + sal_uLong nOriginalClipFormat, + const String & rUserTypeName ) = 0; + virtual void SetConvertClass( const SvGlobalName & rConvertClass, + sal_uLong nOriginalClipFormat, + const String & rUserTypeName ) = 0; + virtual SvGlobalName GetClassName() = 0; + virtual sal_uLong GetFormat() = 0; + virtual String GetUserName() = 0; + virtual sal_Bool ShouldConvert() = 0; + virtual void FillInfoList( SvStorageInfoList* ) const = 0; + virtual sal_Bool CopyTo( BaseStorage* pDestStg ) const = 0; + virtual sal_Bool Commit() = 0; + virtual sal_Bool Revert() = 0; + virtual BaseStorageStream* OpenStream( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_True, const OString* pKey=0 ) = 0; + virtual BaseStorage* OpenStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + bool bDirect = false ) = 0; + virtual BaseStorage* OpenUCBStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_False ) = 0; + virtual BaseStorage* OpenOLEStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_False ) = 0; + virtual sal_Bool IsStream( const String& rEleName ) const = 0; + virtual sal_Bool IsStorage( const String& rEleName ) const = 0; + virtual sal_Bool IsContained( const String& rEleName ) const = 0; + virtual sal_Bool Remove( const String & rEleName ) = 0; + virtual sal_Bool Rename( const String & rEleName, const String & rNewName ) = 0; + virtual sal_Bool CopyTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ) = 0; + virtual sal_Bool MoveTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ) = 0; + virtual sal_Bool ValidateFAT() = 0; + virtual sal_Bool Equals( const BaseStorage& rStream ) const = 0; +}; + +class OLEStorageBase +{ +protected: + StreamMode& nStreamMode; // open mode + StgIo* pIo; // I/O subsystem + StgDirEntry* pEntry; // the dir entry + OLEStorageBase( StgIo*, StgDirEntry*, StreamMode& ); + ~OLEStorageBase(); + sal_Bool Validate_Impl( sal_Bool=sal_False ) const; + sal_Bool ValidateMode_Impl( StreamMode, StgDirEntry* p = NULL ) const ; + const SvStream* GetSvStream_Impl() const; +public: +}; + +class StorageStream : public BaseStorageStream, public OLEStorageBase +{ +//friend class Storage; + sal_uLong nPos; // current position +protected: + ~StorageStream(); +public: + TYPEINFO(); + StorageStream( StgIo*, StgDirEntry*, StreamMode ); + virtual sal_uLong Read( void * pData, sal_uLong nSize ); + virtual sal_uLong Write( const void* pData, sal_uLong nSize ); + virtual sal_uLong Seek( sal_uLong nPos ); + virtual sal_uLong Tell() { return nPos; } + virtual void Flush(); + virtual sal_Bool SetSize( sal_uLong nNewSize ); + virtual sal_uLong GetSize() const; + virtual sal_Bool CopyTo( BaseStorageStream * pDestStm ); + virtual sal_Bool Commit(); + virtual sal_Bool Revert(); + virtual sal_Bool Validate( sal_Bool=sal_False ) const; + virtual sal_Bool ValidateMode( StreamMode ) const; + const SvStream* GetSvStream() const; + virtual sal_Bool Equals( const BaseStorageStream& rStream ) const; +}; + +class UCBStorageStream; + +class SOT_DLLPUBLIC Storage : public BaseStorage, public OLEStorageBase +{ + String aName; + sal_Bool bIsRoot; + void Init( sal_Bool bCreate ); + Storage( StgIo*, StgDirEntry*, StreamMode ); +protected: + ~Storage(); +public: + TYPEINFO(); + Storage( const String &, StreamMode = STREAM_STD_READWRITE, sal_Bool bDirect = sal_True ); + Storage( SvStream& rStrm, sal_Bool bDirect = sal_True ); + Storage( UCBStorageStream& rStrm, sal_Bool bDirect = sal_True ); + + static sal_Bool IsStorageFile( const String & rFileName ); + static sal_Bool IsStorageFile( SvStream* ); + + virtual const String& GetName() const; + virtual sal_Bool IsRoot() const { return bIsRoot; } + virtual void SetClassId( const ClsId& ); + virtual const ClsId& GetClassId() const; + virtual void SetDirty(); + virtual void SetClass( const SvGlobalName & rClass, + sal_uLong nOriginalClipFormat, + const String & rUserTypeName ); + virtual void SetConvertClass( const SvGlobalName & rConvertClass, + sal_uLong nOriginalClipFormat, + const String & rUserTypeName ); + virtual SvGlobalName GetClassName(); + virtual sal_uLong GetFormat(); + virtual String GetUserName(); + virtual sal_Bool ShouldConvert(); + virtual void FillInfoList( SvStorageInfoList* ) const; + virtual sal_Bool CopyTo( BaseStorage* pDestStg ) const; + virtual sal_Bool Commit(); + virtual sal_Bool Revert(); + virtual BaseStorageStream* OpenStream( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_True, const OString* pKey=0 ); + virtual BaseStorage* OpenStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + bool bDirect = false ); + virtual BaseStorage* OpenUCBStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_False ); + virtual BaseStorage* OpenOLEStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_False ); + virtual sal_Bool IsStream( const String& rEleName ) const; + virtual sal_Bool IsStorage( const String& rEleName ) const; + virtual sal_Bool IsContained( const String& rEleName ) const; + virtual sal_Bool Remove( const String & rEleName ); + virtual sal_Bool Rename( const String & rEleName, const String & rNewName ); + virtual sal_Bool CopyTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ); + virtual sal_Bool MoveTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ); + virtual sal_Bool ValidateFAT(); + virtual sal_Bool Validate( sal_Bool=sal_False ) const; + virtual sal_Bool ValidateMode( StreamMode ) const; + sal_Bool ValidateMode( StreamMode, StgDirEntry* p ) const; + virtual const SvStream* GetSvStream() const; + virtual sal_Bool Equals( const BaseStorage& rStream ) const; +}; + +class UCBStorageStream_Impl; +class UCBStorageStream : public BaseStorageStream +{ +friend class UCBStorage; + + UCBStorageStream_Impl* + pImp; +protected: + ~UCBStorageStream(); +public: + TYPEINFO(); + UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const OString* pKey, sal_Bool bRepair, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > xProgress ); + UCBStorageStream( UCBStorageStream_Impl* ); + + virtual sal_uLong Read( void * pData, sal_uLong nSize ); + virtual sal_uLong Write( const void* pData, sal_uLong nSize ); + virtual sal_uLong Seek( sal_uLong nPos ); + virtual sal_uLong Tell(); + virtual void Flush(); + virtual sal_Bool SetSize( sal_uLong nNewSize ); + virtual sal_uLong GetSize() const; + virtual sal_Bool CopyTo( BaseStorageStream * pDestStm ); + virtual sal_Bool Commit(); + virtual sal_Bool Revert(); + virtual sal_Bool Validate( sal_Bool=sal_False ) const; + virtual sal_Bool ValidateMode( StreamMode ) const; + const SvStream* GetSvStream() const; + virtual sal_Bool Equals( const BaseStorageStream& rStream ) const; + sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ); + + SvStream* GetModifySvStream(); +}; + +namespace ucbhelper +{ + class Content; +} + +class UCBStorage_Impl; +struct UCBStorageElement_Impl; +class SOT_DLLPUBLIC UCBStorage : public BaseStorage +{ + UCBStorage_Impl* pImp; + +protected: + ~UCBStorage(); +public: + static sal_Bool IsStorageFile( SvStream* ); + static sal_Bool IsDiskSpannedFile( SvStream* ); + static String GetLinkedFile( SvStream& ); + static String CreateLinkFile( const String& rName ); + + UCBStorage( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, sal_Bool bDirect = sal_True, sal_Bool bIsRoot = sal_True ); + UCBStorage( const String& rName, + StreamMode nMode, + sal_Bool bDirect = sal_True, + sal_Bool bIsRoot = sal_True ); + + UCBStorage( const String& rName, + StreamMode nMode, + sal_Bool bDirect, + sal_Bool bIsRoot, + sal_Bool bIsRepair, + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > + xProgressHandler ); + + UCBStorage( UCBStorage_Impl* ); + UCBStorage( SvStream& rStrm, sal_Bool bDirect = sal_True ); + + TYPEINFO(); + virtual const String& GetName() const; + virtual sal_Bool IsRoot() const; + virtual void SetClassId( const ClsId& ); + virtual const ClsId& GetClassId() const; + virtual void SetDirty(); + virtual void SetClass( const SvGlobalName & rClass, + sal_uLong nOriginalClipFormat, + const String & rUserTypeName ); + virtual void SetConvertClass( const SvGlobalName & rConvertClass, + sal_uLong nOriginalClipFormat, + const String & rUserTypeName ); + virtual SvGlobalName GetClassName(); + virtual sal_uLong GetFormat(); + virtual String GetUserName(); + virtual sal_Bool ShouldConvert(); + virtual void FillInfoList( SvStorageInfoList* ) const; + virtual sal_Bool CopyTo( BaseStorage* pDestStg ) const; + virtual sal_Bool Commit(); + virtual sal_Bool Revert(); + virtual BaseStorageStream* OpenStream( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_True, const OString* pKey=0 ); + virtual BaseStorage* OpenStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + bool bDirect = false ); + virtual BaseStorage* OpenUCBStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_False ); + virtual BaseStorage* OpenOLEStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + sal_Bool bDirect = sal_False ); + virtual sal_Bool IsStream( const String& rEleName ) const; + virtual sal_Bool IsStorage( const String& rEleName ) const; + virtual sal_Bool IsContained( const String& rEleName ) const; + virtual sal_Bool Remove( const String & rEleName ); + virtual sal_Bool Rename( const String & rEleName, const String & rNewName ); + virtual sal_Bool CopyTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ); + virtual sal_Bool MoveTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ); + virtual sal_Bool ValidateFAT(); + virtual sal_Bool Validate( sal_Bool=sal_False ) const; + virtual sal_Bool ValidateMode( StreamMode ) const; + virtual const SvStream* GetSvStream() const; + virtual sal_Bool Equals( const BaseStorage& rStream ) const; + sal_Bool GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ); + + UCBStorageElement_Impl* FindElement_Impl( const String& rName ) const; + sal_Bool CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, + BaseStorage* pDest, const String& rNew ) const; + BaseStorage* OpenStorage_Impl( const String & rEleName, + StreamMode, sal_Bool bDirect, sal_Bool bForceUCBStorage ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx new file mode 100644 index 000000000000..db3995dfc374 --- /dev/null +++ b/include/sot/storage.hxx @@ -0,0 +1,223 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_STORAGE_HXX +#define _SOT_STORAGE_HXX + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.h> + +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <sot/object.hxx> +#include <sot/factory.hxx> +#include <tools/stream.hxx> +#include <tools/errcode.hxx> +#include "sot/storinfo.hxx" +#include "sot/sotdllapi.h" + +#define STORAGE_FAILIFTHERE 0x02 +#define STORAGE_TRANSACTED 0x04 +#define STORAGE_PRIORITY 0x08 +#define STORAGE_DELETEONRELEASE 0x10 +#define STORAGE_CONVERT 0x20 +#define STORAGE_UNPACKED_MODE 0x40 +#define STORAGE_DISKSPANNED_MODE 0x80 +#define STORAGE_CREATE_UNPACKED 0x44 +typedef short StorageMode; + +class SvStorage; + + +/************************************************************************* +*************************************************************************/ +class SotStorage; +class BaseStorageStream; +class SOT_DLLPUBLIC SotStorageStream : virtual public SotObject, public SvStream +{ +friend class SotStorage; + BaseStorageStream * pOwnStm;// Zeiger auf den eigenen Stream +protected: + virtual sal_uLong GetData( void* pData, sal_uLong nSize ); + virtual sal_uLong PutData( const void* pData, sal_uLong nSize ); + virtual sal_uLong SeekPos( sal_uLong nPos ); + virtual void FlushData(); + ~SotStorageStream(); +public: + SotStorageStream( const String &, + StreamMode = STREAM_STD_READWRITE, + StorageMode = 0 ); + SotStorageStream( BaseStorageStream *pStm ); + SotStorageStream(); + SO2_DECL_BASIC_CLASS_DLL(SotStorageStream,SOTDATA()) + + virtual void ResetError(); + + virtual void SetSize( sal_uLong nNewSize ); + sal_uInt32 GetSize() const; + sal_Bool CopyTo( SotStorageStream * pDestStm ); + virtual sal_Bool Commit(); + virtual sal_Bool Revert(); + sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ); + virtual sal_Size remainingSize(); +}; + +#ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED +#define SOT_DECL_SOTSTORAGESTREAM_DEFINED +SV_DECL_REF(SotStorageStream) +#endif +SV_IMPL_REF(SotStorageStream) + +namespace ucbhelper +{ + class Content; +} + +class BaseStorage; +class UNOStorageHolder; +class SOT_DLLPUBLIC SotStorage : virtual public SotObject +{ +friend class SotStorageStream; +friend class SvStorage; + + BaseStorage * m_pTmpStg; // Temp-Storage fuer Transacted, nur auf diesem schreiben! ??? Useless ??? + BaseStorage * m_pOwnStg; // Zielstorage + SvStream * m_pStorStm; // nur fuer SDSTORAGES + sal_uLong m_nError; + String m_aName; // Name des Storage + sal_Bool m_bIsRoot:1, // z.B.: File-Storage + m_bDelStm:1; + OString m_aKey; // aKey.Len != 0 -> Verschluesselung + long m_nVersion; + +protected: + ~SotStorage(); + void CreateStorage( sal_Bool bUCBStorage, StreamMode, StorageMode ); +public: + SotStorage( const String &, + StreamMode = STREAM_STD_READWRITE, + StorageMode = 0 ); + SotStorage( sal_Bool bUCBStorage, const String &, + StreamMode = STREAM_STD_READWRITE, + StorageMode = 0 ); + SotStorage( BaseStorage * ); + SotStorage( SvStream & rStm ); + SotStorage( sal_Bool bUCBStorage, SvStream & rStm ); + SotStorage( SvStream * pStm, sal_Bool bDelete ); + SotStorage(); + SO2_DECL_BASIC_CLASS_DLL(SotStorage,SOTDATA()) + + SvMemoryStream * CreateMemoryStream(); + + static sal_Bool IsStorageFile( const String & rFileName ); + static sal_Bool IsStorageFile( SvStream* pStream ); + + virtual const String & GetName() const; + + virtual sal_Bool Validate(); + + const OString& GetKey() const; + + void SetVersion( long nVers ) + { + m_nVersion = nVers; + } + long GetVersion() const + { + return m_nVersion; + } + + sal_uLong GetErrorCode() const { return m_nError; } + sal_uLong GetError() const { return ERRCODE_TOERROR(m_nError); } + void SetError( sal_uLong nErrorCode ) + { + if( m_nError == SVSTREAM_OK ) + m_nError = nErrorCode; + } + virtual void ResetError(); + + sal_Bool IsRoot() const { return m_bIsRoot; } + void SignAsRoot( sal_Bool b = sal_True ) { m_bIsRoot = b; } + void SetDeleteStream( sal_Bool bDelete ) { m_bDelStm = bDelete; } + + // eigener Datenbereich + virtual void SetClass( const SvGlobalName & rClass, + sal_uLong bOriginalClipFormat, + const String & rUserTypeName ); + virtual void SetConvertClass( const SvGlobalName & rConvertClass, + sal_uLong bOriginalClipFormat, + const String & rUserTypeName ); + virtual SvGlobalName GetClassName();// Typ der Daten im Storage + virtual sal_uLong GetFormat(); + virtual String GetUserName(); + virtual sal_Bool ShouldConvert(); + + // Liste aller Elemente + virtual void FillInfoList( SvStorageInfoList * ) const; + virtual sal_Bool CopyTo( SotStorage * pDestStg ); + virtual sal_Bool Commit(); + virtual sal_Bool Revert(); + + /* Element Methoden */ + // Stream mit Verbindung zu Storage erzeugen, + // in etwa eine Parent-Child Beziehung + SotStorageStream * OpenSotStream( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + StorageMode = 0 ); + SotStorage * OpenSotStorage( const String & rEleName, + StreamMode = STREAM_STD_READWRITE, + StorageMode = STORAGE_TRANSACTED ); + // Abfrage auf Storage oder Stream + virtual sal_Bool IsStream( const String & rEleName ) const; + virtual sal_Bool IsStorage( const String & rEleName ) const; + virtual sal_Bool IsContained( const String & rEleName ) const; + // Element loeschen + virtual sal_Bool Remove( const String & rEleName ); + // Elementnamen aendern + virtual sal_Bool Rename( const String & rEleName, + const String & rNewName ); + virtual sal_Bool CopyTo( const String & rEleName, SotStorage * pDest, + const String & rNewName ); + virtual sal_Bool MoveTo( const String & rEleName, SotStorage * pDest, + const String & rNewName ); + + sal_Bool IsOLEStorage() const; + static sal_Bool IsOLEStorage( const String & rFileName ); + static sal_Bool IsOLEStorage( SvStream* pStream ); + + static SotStorage* OpenOLEStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage, + const String& rEleName, StreamMode = STREAM_STD_READWRITE ); + static sal_Int32 GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ); + static sal_Int32 GetVersion( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ); +}; + +#ifndef SOT_DECL_SOTSTORAGE_DEFINED +#define SOT_DECL_SOTSTORAGE_DEFINED +SV_DECL_REF(SotStorage) +#endif +SV_IMPL_REF(SotStorage) + +#define SvStorage SotStorage +#define SvStorageRef SotStorageRef +#define SvStorageStream SotStorageStream +#define SvStorageStreamRef SotStorageStreamRef + +#endif // _SVSTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sot/storinfo.hxx b/include/sot/storinfo.hxx new file mode 100644 index 000000000000..5518d618bf36 --- /dev/null +++ b/include/sot/storinfo.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SOT_STORINFO_HXX +#define _SOT_STORINFO_HXX + +#include <tools/globname.hxx> +#include <vector> +#include "sot/sotdllapi.h" + +class StgDirEntry; +class SvStorageInfo +{ +friend class SvStorage; + String aName; + SvGlobalName aClassName; + sal_uLong nSize; + sal_Bool bStream:1, + bStorage:1; + + SvStorageInfo(){}; // Fuer SvStorage +public: + SvStorageInfo( const StgDirEntry& ); + SvStorageInfo( const String& rName, sal_uLong nSz, sal_Bool bIsStorage ) + : aName( rName ) + , nSize( nSz ) + , bStream( !bIsStorage ) + , bStorage( bIsStorage ) + {} + + const SvGlobalName & GetClassName() const { return aClassName; } + const String & GetName() const { return aName; } + sal_Bool IsStream() const { return bStream; } + sal_Bool IsStorage() const { return bStorage; } + sal_uLong GetSize() const { return nSize; } +}; + +typedef ::std::vector< SvStorageInfo > SvStorageInfoList; + +SOT_DLLPUBLIC sal_uLong ReadClipboardFormat( SvStream & rStm ); +SOT_DLLPUBLIC void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat ); + +#endif // _STORINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |