diff --git a/svtools/inc/svtools/lstner.hxx b/svtools/inc/svtools/lstner.hxx new file mode 100644 index 000000000000..6c7d925f7fda --- /dev/null +++ b/svtools/inc/svtools/lstner.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: lstner.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 19:27:44 $ + * + * 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 _SFXLSTNER_HXX +#define _SFXLSTNER_HXX + +#ifndef INCLUDED_SVLDLLAPI_H +#include "svtools/svldllapi.h" +#endif + +#ifndef _RTTI_HXX +#include +#endif + +#ifndef _SVARRAY_HXX +#include +#endif + +class SfxBroadcaster; +class SfxHint; + +#ifndef _SFX_LSTNER_CXX +typedef SvPtrarr SfxBroadcasterArr_Impl; +#endif + +#define SFX_NOTIFY( rBC, rBCT, rHint, rHintT ) \ + Notify( rBC, rHint ) + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxListener +{ + SfxBroadcasterArr_Impl aBCs; + +private: + const SfxListener& operator=(const SfxListener &); // n.i., ist verboten + +public: + TYPEINFO(); + + SfxListener(); + SfxListener( const SfxListener &rCopy ); + virtual ~SfxListener(); + + BOOL StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups = FALSE ); + BOOL EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups = FALSE ); + void EndListening( USHORT nNo ); + void EndListeningAll(); + BOOL IsListening( SfxBroadcaster& rBroadcaster ) const; + + USHORT GetBroadcasterCount() const + { return aBCs.Count(); } + SfxBroadcaster* GetBroadcasterJOE( USHORT nNo ) const + { return (SfxBroadcaster*) aBCs.GetObject(nNo); } + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +#ifndef _NOTIFY_HXX + void RemoveBroadcaster_Impl( SfxBroadcaster& rBC ); +#endif +}; + +#endif diff --git a/svtools/inc/svtools/macitem.hxx b/svtools/inc/svtools/macitem.hxx new file mode 100644 index 000000000000..043141a5d66f --- /dev/null +++ b/svtools/inc/svtools/macitem.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: macitem.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 19:27:53 $ + * + * 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 _SFXMACITEM_HXX +#define _SFXMACITEM_HXX + +// class SvxMacroItem ---------------------------------------------------- + +#ifndef INCLUDED_SVTDLLAPI_H +#include "svtools/svtdllapi.h" +#endif + +#ifndef _SFXPOOLITEM_HXX +#include +#endif + +#ifndef _RTTI_HXX +#include +#endif + +#ifndef _DEBUG_HXX +#include +#endif + +#ifndef _STRING_HXX +#include +#endif + +#ifndef _TABLE_HXX +#include +#endif + +class SvStream; + +#define SVX_MACRO_LANGUAGE_JAVASCRIPT "JavaScript" +#define SVX_MACRO_LANGUAGE_STARBASIC "StarBasic" +#define SVX_MACRO_LANGUAGE_SF "Script" + +DBG_NAMEEX(SvxMacroItem) + +// ----------------------------------------------------------------------- + +//Ein Macro + +enum ScriptType +{ + STARBASIC, + JAVASCRIPT, + EXTENDED_STYPE +}; + +// Basisklasse fuer SjJSbxObject mit virtuellem Destruktor +class SjJSbxObjectBase +{ +public: + virtual ~SjJSbxObjectBase(); + virtual SjJSbxObjectBase* Clone( void ); + //virtual SjJSbxObjectBase& operator=( const SjJSbxObjectBase& rBase ); +}; + +class SjJSbxObject; + +class SVT_DLLPUBLIC SvxMacro +{ + String aMacName; + String aLibName; + // Fuer JavaScript muss ein Function-Objekt gehalten werden + SjJSbxObjectBase* pFunctionObject; + ScriptType eType; + +public: + + SvxMacro( const String &rMacName, const String &rLanguage); + + SvxMacro( const String &rMacName, const String &rLibName, + ScriptType eType); // = STARBASIC entfernt + + SvxMacro( SjJSbxObjectBase* _pFunctionObject, const String &rSource ); + ~SvxMacro(); // noetig fuer pFunctionObject + + const String &GetLibName() const { return aLibName; } + const String &GetMacName() const { return aMacName; } + String GetLanguage()const; + + ScriptType GetScriptType() const { return eType; } + + BOOL HasMacro() const { return aMacName.Len() ? TRUE : FALSE; } + +#ifdef SOLAR_JAVA + // JavaScript-Function-Objekt holen + // ACHTUNG: Implementation in SJ, Source/JScript/sjimpl.cxx + SjJSbxObjectBase* GetFunctionObject( SjJSbxObject* pParent ); +#endif + + SvxMacro& operator=( const SvxMacro& rBase ); +}; + +inline SvxMacro::SvxMacro( const String &rMacName, const String &rLibName, + ScriptType eTyp ) + : aMacName( rMacName ), aLibName( rLibName ), pFunctionObject(NULL), eType( eTyp ) +{} + +inline SvxMacro::SvxMacro( SjJSbxObjectBase* _pFunctionObject, const String &rSource ) + : aMacName( rSource ), pFunctionObject( _pFunctionObject ), eType( JAVASCRIPT ) +{} + +//Macro Table, zerstoert die Pointer im DTor! + +DECLARE_TABLE( _SvxMacroTableDtor, SvxMacro* ) + +#define SVX_MACROTBL_VERSION31 0 +#define SVX_MACROTBL_VERSION40 1 + +#define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40 + +class SVT_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor +{ +public: + inline SvxMacroTableDtor( const USHORT nInitSz = 0, const USHORT nReSz = 1 ); + inline SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : _SvxMacroTableDtor() { *this = rCpy; } + inline ~SvxMacroTableDtor() { DelDtor(); } + SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy ); + + // loescht alle Eintraege + void DelDtor(); + + SvStream& Read( SvStream &, USHORT nVersion = SVX_MACROTBL_AKTVERSION ); + SvStream& Write( SvStream & ) const; + + USHORT GetVersion() const { return SVX_MACROTBL_AKTVERSION; } +}; + +inline SvxMacroTableDtor::SvxMacroTableDtor( const USHORT nInitSz, + const USHORT nReSz) + : _SvxMacroTableDtor( nInitSz, nReSz ) +{} + +#ifdef ITEMID_MACRO + +/* +[Beschreibung] +Dieses Item beschreibt eine Makro-Tabelle. +*/ + +class SVT_DLLPUBLIC SvxMacroItem: public SfxPoolItem +{ +public: + TYPEINFO(); + + inline SvxMacroItem ( const USHORT nId = ITEMID_MACRO ); + + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual USHORT GetVersion( USHORT nFileFormatVersion ) const; + + inline const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;} + inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; } + + inline const SvxMacro& GetMacro( USHORT nEvent ) const; + inline BOOL HasMacro( USHORT nEvent ) const; + void SetMacro( USHORT nEvent, const SvxMacro& ); + inline BOOL DelMacro( USHORT nEvent ); + +private: + SvxMacroTableDtor aMacroTable; + + inline SvxMacroItem( const SvxMacroItem& ); + SvxMacroItem &operator=( const SvxMacroItem & ); +}; + +inline SvxMacroItem::SvxMacroItem( const USHORT nId ) + : SfxPoolItem( nId ) +{} +inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy ) + : SfxPoolItem( rCpy ), + aMacroTable( rCpy.GetMacroTable() ) +{} + +inline BOOL SvxMacroItem::HasMacro( USHORT nEvent ) const +{ + return aMacroTable.IsKeyValid( nEvent ); +} +inline const SvxMacro& SvxMacroItem::GetMacro( USHORT nEvent ) const +{ + return *(aMacroTable.Get(nEvent)); +} +inline BOOL SvxMacroItem::DelMacro( USHORT nEvent ) +{ + SvxMacro *pMacro = aMacroTable.Remove( nEvent ); + delete pMacro; + return ( pMacro != 0 ); +} + +#endif //ITEMID_MACRO + +#endif diff --git a/svtools/inc/svtools/menuoptions.hxx b/svtools/inc/svtools/menuoptions.hxx new file mode 100644 index 000000000000..3cc8b08380f8 --- /dev/null +++ b/svtools/inc/svtools/menuoptions.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: menuoptions.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 19:28:03 $ + * + * 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 INCLUDED_SVTOOLS_MENUOPTIONS_HXX +#define INCLUDED_SVTOOLS_MENUOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#ifndef INCLUDED_SVLDLLAPI_H +#include "svtools/svldllapi.h" +#endif + +#ifndef _SAL_TYPES_H_ +#include +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include +#endif + +#ifndef INCLUDED_SVTOOLS_OPTIONS_HXX +#include +#endif + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class Link; +class SvtMenuOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about menu features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class SVL_DLLPUBLIC SvtMenuOptions: public svt::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtMenuOptions(); + virtual ~SvtMenuOptions(); + + void AddListener( const Link& rLink ); + void RemoveListener( const Link& rLink ); + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Menu/..." + @descr These options describe internal states to enable/disable features of installed office. + + IsEntryHidingEnabled() + SetEntryHidingState() => Activate this field for viewing all deactivated menu entries. + Menu commands that are normally not necessary are hidden by default. + Default=false + + IsFollowMouseEnabled() + SetFollowMouseState() => Automatic selection while moving the mouse on a menu. + Default=true + + @seealso configuration package "org.openoffice.Office.Common/View/Menu" + *//*-*****************************************************************************************************/ + + sal_Bool IsEntryHidingEnabled() const; + sal_Bool IsFollowMouseEnabled() const; + sal_Bool IsMenuIconsEnabled() const; + + void SetEntryHidingState( sal_Bool bState ); + void SetFollowMouseState( sal_Bool bState ); + void SetMenuIconsState( sal_Bool bState ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtMenuOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtMenuOptions + +#endif // #ifndef INCLUDED_SVTOOLS_MENUOPTIONS_HXX diff --git a/svtools/inc/svtools/metitem.hxx b/svtools/inc/svtools/metitem.hxx new file mode 100644 index 000000000000..d5c17d316be7 --- /dev/null +++ b/svtools/inc/svtools/metitem.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: metitem.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 19:28:13 $ + * + * 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 _SFXMETRICITEM_HXX +#define _SFXMETRICITEM_HXX + +#ifndef INCLUDED_SVTDLLAPI_H +#include "svtools/svtdllapi.h" +#endif + +#ifndef _SFXINTITEM_HXX +#include +#endif + +DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVT_DLLPUBLIC) + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxMetricItem: public SfxInt32Item +{ +public: + TYPEINFO(); + SfxMetricItem( USHORT nWhich = 0, UINT32 nValue = 0 ); + SfxMetricItem( USHORT nWhich, SvStream & ); + SfxMetricItem( const SfxMetricItem& ); + ~SfxMetricItem() { + DBG_DTOR(SfxMetricItem, 0); } + + virtual int ScaleMetrics( long lMult, long lDiv ); + virtual int HasMetrics() const; + +}; + +#endif +