diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 19:15:55 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 19:15:55 +0000 |
commit | 2737a04cfcee67f0457abfca5f96753f18fda7d8 (patch) | |
tree | 6aa55f5113a71db9fd0db3e31dd794ec94b64b05 /tools/inc | |
parent | 9829c0d5b807de79758e98ea7797d964126d48ef (diff) |
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2006/12/12 16:24:51 vg 1.1.2.1: #i72503# gathered global includes in one place
Diffstat (limited to 'tools/inc')
-rw-r--r-- | tools/inc/tools/pstm.hxx | 290 | ||||
-rw-r--r-- | tools/inc/tools/rc.h | 228 |
2 files changed, 518 insertions, 0 deletions
diff --git a/tools/inc/tools/pstm.hxx b/tools/inc/tools/pstm.hxx new file mode 100644 index 000000000000..04ecc1cea4a5 --- /dev/null +++ b/tools/inc/tools/pstm.hxx @@ -0,0 +1,290 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pstm.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 20:15:22 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _PSTM_HXX +#define _PSTM_HXX + +#include <hash_map> + +#ifndef INCLUDED_TOOLSDLLAPI_H +#include "tools/toolsdllapi.h" +#endif + +#ifndef _TABLE_HXX +#include <tools/table.hxx> +#endif + +#ifndef _INQIDX_HXX +#include <tools/unqidx.hxx> +#endif + +#ifndef _REF_HXX +#include <tools/ref.hxx> +#endif + +#ifndef _RTTI_HXX +#include <tools/rtti.hxx> +#endif + +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif + +#define ERRCODE_IO_NOFACTORY ERRCODE_IO_WRONGFORMAT + +/************************************************************************* +*************************************************************************/ +class SvPersistBase; +typedef void * (*SvCreateInstancePersist)( SvPersistBase ** ); +#define SV_CLASS_REGISTER( Class ) \ + Register( Class::StaticClassId(), Class::CreateInstance ) + +class TOOLS_DLLPUBLIC SvClassManager +{ + typedef std::hash_map< USHORT, SvCreateInstancePersist > Map; + Map aAssocTable; +public: + void Register( USHORT nClassId, SvCreateInstancePersist pFunc ); + SvCreateInstancePersist Get( USHORT nClassId ); +}; + +/************************** S v R t t i B a s e **************************/ +/* +#if defined (DOS) && defined (STC) +#ifdef WIN +#error Fuer Win muss der Kram virtual sein (MM/MH) +#endif +class SvRttiBase : public SvRefBase +#else +class SvRttiBase : virtual public SvRefBase +#endif +*/ +class TOOLS_DLLPUBLIC SvRttiBase : public SvRefBase +{ +public: + TYPEINFO(); +}; +SV_DECL_IMPL_REF(SvRttiBase) + +/*************************************************************************/ +#define SV_DECL_PERSIST( Class, CLASS_ID ) \ + TYPEINFO(); \ + static USHORT StaticClassId() { return CLASS_ID; } \ + static void * CreateInstance( SvPersistBase ** ppBase ); \ + friend SvPersistStream& operator >> ( SvPersistStream & rStm, \ + Class *& rpObj); \ + virtual USHORT GetClassId() const; \ + virtual void Load( SvPersistStream & ); \ + virtual void Save( SvPersistStream & ); + +#define SV_DECL_PERSIST1( Class, Super1, CLASS_ID ) \ + SV_DECL_PERSIST( Class, CLASS_ID ) + +#define PRV_SV_IMPL_PERSIST( Class ) \ + void * Class::CreateInstance( SvPersistBase ** ppBase )\ + { \ + Class * p = new Class(); \ + *ppBase = p; \ + return p; \ + } \ + USHORT Class::GetClassId() const \ + { return StaticClassId(); } \ + SvPersistStream& operator >> (SvPersistStream & rStm, Class *& rpObj)\ + { \ + SvPersistBase * pObj; \ + rStm >> pObj; \ + rpObj = PTR_CAST( Class, pObj ); \ + return rStm; \ + } + +#define SV_IMPL_PERSIST( Class ) \ + TYPEINIT0( Class ) \ + PRV_SV_IMPL_PERSIST( Class ) + +#define SV_IMPL_PERSIST1( Class, Super1 ) \ + TYPEINIT1( Class, Super1 ) \ + PRV_SV_IMPL_PERSIST( Class ) + +/*************************************************************************/ +class SvPersistStream; +class SvPersistBase : public SvRttiBase +{ +public: + virtual USHORT GetClassId() const = 0; + virtual void Load( SvPersistStream & ) = 0; + virtual void Save( SvPersistStream & ) = 0; + TOOLS_DLLPUBLIC friend SvPersistStream& operator >> ( SvPersistStream & rStm, + SvPersistBase *& rpObj ); +}; +SV_DECL_IMPL_REF(SvPersistBase) + +/*************************************************************************/ +// Damit die Liste, anders benannt wird +typedef SvPersistBase SuperSvPersistBase; +SV_DECL_REF_LIST_VISIBILITY(SuperSvPersistBase,SuperSvPersistBase*,TOOLS_DLLPUBLIC) +SV_IMPL_REF_LIST(SuperSvPersistBase,SuperSvPersistBase*) + +class TOOLS_DLLPUBLIC SvPersistBaseMemberList : public SuperSvPersistBaseMemberList +{ +public: + SvPersistBaseMemberList(); + SvPersistBaseMemberList(USHORT nInitSz, USHORT nResize ); + + void WriteObjects( SvPersistStream &, BOOL bOnlyStreamedObj = FALSE ) const; + TOOLS_DLLPUBLIC friend SvPersistStream& operator << (SvPersistStream &, const SvPersistBaseMemberList &); + TOOLS_DLLPUBLIC friend SvPersistStream& operator >> (SvPersistStream &, SvPersistBaseMemberList &); +}; + +/*************************************************************************/ +#define SV_DECL_PERSIST_LIST(ClassName,EntryName)\ +class ClassName##MemberList : public SvPersistBaseMemberList\ +{\ +public:\ + PRV_SV_DECL_MEMBER_LIST(ClassName,EntryName)\ +}; + +#define SV_IMPL_PERSIST_LIST(ClassName,EntryName)\ + PRV_SV_IMPL_MEMBER_LIST(ClassName,EntryName,SvPersistBaseMemberList) + +#define SV_DECL_IMPL_PERSIST_LIST(ClassName,EntryName)\ +SV_DECL_PERSIST_LIST(ClassName,EntryName)\ +SV_IMPL_PERSIST_LIST(ClassName,EntryName) + +//#if 0 // _SOLAR__PRIVATE +DECLARE_UNIQUEINDEX( SvPersistUIdx,SvPersistBase *) +//#else +//typedef UniqueIndex SvPersistUIdx; +//#endif + +//========================================================================= +class SvStream; +class TOOLS_DLLPUBLIC SvPersistStream : public SvStream +/* [Beschreibung] + + Mit dieser Klasse k"onnen Laufzeit Objektstrukturen gespeichert + und geladen werden. Es m"ussen immer alle beteiligten Objekte + gespeichert oder geladen werden. Um die Objekte automatisch + laden zu k"onnen, wird eine Factory f"ur jede Klasse von Objekten, + die im Stream vorkommen k"onnen, ben"otigt. Die Liste aller Klassen + wird in einem <SvClassManager> Objekt gespeichert und dem + SvPersistStream "ubergeben, wenn er erzeugt wird. + Weiterhin wird die M"oglichkeit geboten UINT32 Werte komprimiert + zu schreiben und zu lesen (<SvPersistStream::WriteCompressed>, + <SvPersistStream::ReadCompressed>). + Es gibt auch die drei Hilfsmethoden <SvPersistStream::WriteDummyLen>, + <SvPersistStream::WriteLen> und <SvPersistStream::ReadLen> um eine + L"ange vor das Objekt zu schreiben. + + [Beispiel] + + Ein konkretes Beispiel ist im Konstruktor beschrieben. + Objekt A verweist auf B, dieses auf C und das wieder auf A. + C verweist auf D. + + Die Reihenfolge beim Speichern und Laden ist egal, sie muss nur + gleich sein: + Speichern: Laden: + A,B,C,D A,B,C,D richtig + B,A,C,D B,A,C,D richtig + C,A,B,D A,B,C,D falsch + A,B,C,D A,B,C falsch + + [Anmerkung] + + Das Dateiformat zwischen DBG_UTIL und !DBG_UTIL ist unterschiedlich, + kann aber von beiden Versionen gelesen werden. +*/ +{ + SvClassManager & rClassMgr; + SvStream * pStm; + Table aPTable; // Pointer und Key gedreht + SvPersistUIdx aPUIdx; + ULONG nStartIdx; + const SvPersistStream * pRefStm; + UINT32 nFlags; + + virtual ULONG GetData( void* pData, ULONG nSize ); + virtual ULONG PutData( const void* pData, ULONG nSize ); + virtual ULONG SeekPos( ULONG nPos ); + virtual void FlushData(); +protected: + ULONG GetCurMaxIndex( const SvPersistUIdx & ) const; + ULONG GetCurMaxIndex() const + { return GetCurMaxIndex( aPUIdx ); } + + void WriteObj( BYTE nHdr, SvPersistBase * pObj ); + UINT32 ReadObj( SvPersistBase * & rpObj, + BOOL bRegister ); +public: + BOOL IsStreamed( SvPersistBase * pObj ) const + { return 0 != GetIndex( pObj ); } + virtual void ResetError(); + + SvPersistStream( SvClassManager &, SvStream * pStream, + UINT32 nStartIdx = 1 ); + SvPersistStream( SvClassManager &, SvStream * pStream, + const SvPersistStream & rPersStm ); + ~SvPersistStream(); + + void SetStream( SvStream * pStream ); + SvStream * GetStream() const { return pStm; } + virtual USHORT IsA() const; + + SvPersistBase * GetObject( ULONG nIdx ) const; + ULONG GetIndex( SvPersistBase * ) const; + + void SetContextFlags( UINT32 n ) { nFlags = n; } + UINT32 GetContextFlags() const { return nFlags; } + + static void WriteCompressed( SvStream & rStm, UINT32 nVal ); + static UINT32 ReadCompressed( SvStream & rStm ); + + UINT32 WriteDummyLen(); + void WriteLen( UINT32 nLenPos ); + UINT32 ReadLen( UINT32 * pTestPos ); + + SvPersistStream& WritePointer( SvPersistBase * pObj ); + SvPersistStream& ReadPointer( SvPersistBase * & rpObj ); + TOOLS_DLLPUBLIC friend SvPersistStream& operator << (SvPersistStream &, SvPersistBase *); + TOOLS_DLLPUBLIC friend SvPersistStream& operator >> (SvPersistStream &, SvPersistBase * &); + + // Objekte halten ihre Id's w"ahrend geladen und + // gespeichert werden. + friend SvStream& operator >> ( SvStream &, SvPersistStream & ); + friend SvStream& operator << ( SvStream &, SvPersistStream & ); + ULONG InsertObj( SvPersistBase * ); + ULONG RemoveObj( SvPersistBase * ); +}; + +#endif // _PSTM_HXX diff --git a/tools/inc/tools/rc.h b/tools/inc/tools/rc.h new file mode 100644 index 000000000000..48a289eaf49e --- /dev/null +++ b/tools/inc/tools/rc.h @@ -0,0 +1,228 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rc.h,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 20:15:55 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _TOOLS_RC_H +#define _TOOLS_RC_H + +#ifndef _TOOLS_RCID_H +#include <tools/rcid.h> +#endif + +// Definition der Struktur die alle "Window"-Resourcen haben +// Hier sind die Fensterstyles definiert die nicht in WinBits sind +#define RSC_EXTRAMAPUNIT 0xFFFF //Wert nicht veraendern!!! + +typedef short RSWND_STYLE; +#define RSWND_DISABLED 0x01 +#define RSWND_CLIENTSIZE 0x02 + +#define WINDOW_XYMAPMODE 0x0001 +#define WINDOW_X 0x0002 +#define WINDOW_Y 0x0004 +#define WINDOW_WHMAPMODE 0x0008 +#define WINDOW_WIDTH 0x0010 +#define WINDOW_HEIGHT 0x0020 +#define WINDOW_TEXT 0x0080 +#define WINDOW_HELPTEXT 0x0100 +#define WINDOW_QUICKTEXT 0x0200 +#define WINDOW_EXTRALONG 0x0800 +#define WINDOW_UNIQUEID 0x1000 + +// Definition der Struktur die alle "WorkWindow"-Resourcen haben +#define WORKWIN_SHOWNORMAL 0 +#define WORKWIN_SHOWMINIMIZED 1 +#define WORKWIN_SHOWMAXIMIZED 2 + +// Definition der Struktur der FixedBitmap-Resource. +#define RSC_FIXEDBITMAP_BITMAP 0x0001 + +// Definition der Struktur der FixedImage-Resource. +#define RSC_FIXEDIMAGE_IMAGE 0x0001 + +// Definition der Struktur des MenuButtons +#define RSCMENUBUTTON_MENU 0x01 + +// Definition der Struktur die alle Menu-Resourcen haben +#define RSC_MENU_ITEMS 0x01 +#define RSC_MENU_TEXT 0x02 +#define RSC_MENU_DEFAULTITEMID 0x04 + +// Hier sind die MenuItem-Resourceoptionen definiert +#define RSC_MENUITEM_SEPARATOR 0x001 +#define RSC_MENUITEM_ID 0x002 +#define RSC_MENUITEM_STATUS 0x004 +#define RSC_MENUITEM_TEXT 0x008 +#define RSC_MENUITEM_BITMAP 0x010 +#define RSC_MENUITEM_HELPTEXT 0x020 +#define RSC_MENUITEM_HELPID 0x040 +#define RSC_MENUITEM_KEYCODE 0x080 +#define RSC_MENUITEM_MENU 0x100 +#define RSC_MENUITEM_CHECKED 0x200 +#define RSC_MENUITEM_DISABLE 0x400 +#define RSC_MENUITEM_COMMAND 0x800 + +// Hier sind die AccelKey-Resourceoptionen definiert +#define ACCELITEM_ACCEL 0x01 +#define ACCELITEM_KEY 0x02 + +// Definition der Struktur die alle "Field"-Resourcen haben +#define PATTERNFORMATTER_STRICTFORMAT 0x01 +#define PATTERNFORMATTER_EDITMASK 0x02 +#define PATTERNFORMATTER_LITTERALMASK 0x04 + +#define NUMERICFORMATTER_MIN 0x01 +#define NUMERICFORMATTER_MAX 0x02 +#define NUMERICFORMATTER_STRICTFORMAT 0x04 +//#define NUMERICFORMATTER_I12 0x08 // erAck: got rid of class International (2005-06-17) +#define NUMERICFORMATTER_DECIMALDIGITS 0x10 +#define NUMERICFORMATTER_VALUE 0x20 + +#define METRICFORMATTER_UNIT 0x01 +#define METRICFORMATTER_CUSTOMUNITTEXT 0x02 + +#define DATEFORMATTER_MIN 0x01 +#define DATEFORMATTER_MAX 0x02 +#define DATEFORMATTER_LONGFORMAT 0x04 +#define DATEFORMATTER_STRICTFORMAT 0x08 +//#define DATEFORMATTER_I12 0x10 // erAck: got rid of class International (2005-06-17) +#define DATEFORMATTER_VALUE 0x20 + +#define TIMEFORMATTER_MIN 0x01 +#define TIMEFORMATTER_MAX 0x02 +#define TIMEFORMATTER_TIMEFIELDFORMAT 0x04 +#define TIMEFORMATTER_DURATION 0x08 +#define TIMEFORMATTER_STRICTFORMAT 0x10 +//#define TIMEFORMATTER_I12 0x20 // erAck: got rid of class International (2005-06-17) +#define TIMEFORMATTER_VALUE 0x40 + +#define NUMERICFIELD_FIRST 0x01 +#define NUMERICFIELD_LAST 0x02 +#define NUMERICFIELD_SPINSIZE 0x04 + +#define METRICFIELD_FIRST 0x01 +#define METRICFIELD_LAST 0x02 +#define METRICFIELD_SPINSIZE 0x04 + +#define CURRENCYFIELD_FIRST 0x01 +#define CURRENCYFIELD_LAST 0x02 +#define CURRENCYFIELD_SPINSIZE 0x04 + +#define DATEFIELD_FIRST 0x01 +#define DATEFIELD_LAST 0x02 + +#define TIMEFIELD_FIRST 0x01 +#define TIMEFIELD_LAST 0x02 + +// Definition der Struktur die alle "ToolBoxItem"-Resourcen haben +#define RSC_TOOLBOXITEM_ID 0x0001 +#define RSC_TOOLBOXITEM_TYPE 0x0002 +#define RSC_TOOLBOXITEM_STATUS 0x0004 +#define RSC_TOOLBOXITEM_HELPID 0x0008 +#define RSC_TOOLBOXITEM_TEXT 0x0010 +#define RSC_TOOLBOXITEM_HELPTEXT 0x0020 +#define RSC_TOOLBOXITEM_BITMAP 0x0040 +#define RSC_TOOLBOXITEM_IMAGE 0x0080 +#define RSC_TOOLBOXITEM_DISABLE 0x0100 +#define RSC_TOOLBOXITEM_STATE 0x0200 +#define RSC_TOOLBOXITEM_HIDE 0x0400 +#define RSC_TOOLBOXITEM_COMMAND 0x0800 +#define RSC_TOOLBOXITEM_MENUSTRINGS 0x1000 + +// Definition der Struktur die alle ToolBox-Resourcen haben +#define RSC_TOOLBOX_BUTTONTYPE 0x01 +#define RSC_TOOLBOX_ALIGN 0x02 +#define RSC_TOOLBOX_LINECOUNT 0x04 +#define RSC_TOOLBOX_FLOATLINES 0x08 +#define RSC_TOOLBOX_CUSTOMIZE 0x10 +#define RSC_TOOLBOX_MENUSTRINGS 0x20 +#define RSC_TOOLBOX_ITEMIMAGELIST 0x40 +#define RSC_TOOLBOX_ITEMLIST 0x80 + +// Definition der Struktur die alle MoreButton-Resourcen haben +#define RSC_MOREBUTTON_STATE 0x01 +#define RSC_MOREBUTTON_MAPUNIT 0x02 +#define RSC_MOREBUTTON_DELTA 0x04 + +// Definition der Struktur die alle FloatingWindow-Resourcen haben +#define RSC_FLOATINGWINDOW_WHMAPMODE 0x01 +#define RSC_FLOATINGWINDOW_WIDTH 0x02 +#define RSC_FLOATINGWINDOW_HEIGHT 0x04 +#define RSC_FLOATINGWINDOW_ZOOMIN 0x08 + +// Definition der Struktur die alle DockingWindow-Resourcen haben +#define RSC_DOCKINGWINDOW_XYMAPMODE 0x01 +#define RSC_DOCKINGWINDOW_X 0x02 +#define RSC_DOCKINGWINDOW_Y 0x04 +#define RSC_DOCKINGWINDOW_FLOATING 0x08 + +// Definition der Struktur die alle "TabControlItem"-Resourcen haben +#define RSC_TABCONTROLITEM_ID 0x0001 +#define RSC_TABCONTROLITEM_TEXT 0x0002 +#define RSC_TABCONTROLITEM_PAGERESID 0x0008 + +// Definition der Struktur die alle TabControl-Resourcen haben +#define RSC_TABCONTROL_ITEMLIST 0x01 + +// Definition der Struktur des ImageButtons +#define RSC_IMAGEBUTTON_IMAGE 0x01 +#define RSC_IMAGEBUTTON_SYMBOL 0x02 +#define RSC_IMAGEBUTTON_STATE 0x04 + +// Definition der Struktur des ImageRadioButtons +#define RSC_IMAGERADIOBUTTON_IMAGE 0x01 + +// Definition der Struktur des Image +#define RSC_IMAGE_IMAGEBITMAP 0x01 +#define RSC_IMAGE_MASKBITMAP 0x02 +#define RSC_IMAGE_MASKCOLOR 0x04 + +// Definition der Struktur des Image +#define RSC_IMAGELIST_IMAGEBITMAP 0x01 +#define RSC_IMAGELIST_MASKBITMAP 0x02 +#define RSC_IMAGELIST_MASKCOLOR 0x04 +#define RSC_IMAGELIST_IDLIST 0x08 +#define RSC_IMAGELIST_IDCOUNT 0x10 + +// obsolete, should be removed by MM +#define RSC_COLOR (RSC_NOTYPE + 0x16) +#define TIME_HOUR 0x01 +#define TIME_MINUTE 0x02 +#define TIME_SECOND 0x04 +#define TIME_SEC100 0x08 +#define DATE_YEAR 0x01 +#define DATE_MONTH 0x02 +#define DATE_DAY 0x04 + +#endif // _TOOLS_RC_H |