00001 /************************************************************************* 00002 * 00003 * OpenOffice.org - a multi-platform office productivity suite 00004 * 00005 * $RCSfile: smmod.hxx,v $ 00006 * 00007 * $Revision: 1.17 $ 00008 * 00009 * last change: $Author: rt $ $Date: 2007/05/31 10:33:19 $ 00010 * 00011 * The Contents of this file are made available subject to 00012 * the terms of GNU Lesser General Public License Version 2.1. 00013 * 00014 * 00015 * GNU Lesser General Public License Version 2.1 00016 * ============================================= 00017 * Copyright 2005 by Sun Microsystems, Inc. 00018 * 901 San Antonio Road, Palo Alto, CA 94303, USA 00019 * 00020 * This library is free software; you can redistribute it and/or 00021 * modify it under the terms of the GNU Lesser General Public 00022 * License version 2.1, as published by the Free Software Foundation. 00023 * 00024 * This library is distributed in the hope that it will be useful, 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00027 * Lesser General Public License for more details. 00028 * 00029 * You should have received a copy of the GNU Lesser General Public 00030 * License along with this library; if not, write to the Free Software 00031 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00032 * MA 02111-1307 USA 00033 * 00034 ************************************************************************/ 00035 00036 #ifndef _SMMOD_HXX 00037 #define _SMMOD_HXX 00038 00039 #ifndef _SV_RESARY_HXX 00040 #include <tools/resary.hxx> 00041 #endif 00042 #ifndef _SFXLSTNER_HXX 00043 #include <svtools/lstner.hxx> 00044 #endif 00045 #ifndef INCLUDED_SVTOOLS_COLORCFG_HXX 00046 #include <svtools/colorcfg.hxx> 00047 #endif 00048 00049 #include <tools/shl.hxx> 00050 #include <sfx2/module.hxx> 00051 00052 #ifndef _STARMATH_HRC 00053 #include "starmath.hrc" 00054 #endif 00055 00056 class SvxErrorHandler; 00057 class SfxObjectFactory; 00058 class SmConfig; 00059 class SmModule; 00060 class SmSymSetManager; 00061 00062 /************************************************************************* 00063 |* 00064 |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is 00065 |* linked to the DLL. One instance of this class exists while the DLL is 00066 |* loaded. 00067 |* 00068 |* SdModule is like to be compared with the <SfxApplication>-subclass. 00069 |* 00070 |* Remember: Don`t export this class! It uses DLL-internal symbols. 00071 |* 00072 \************************************************************************/ 00073 00074 class SvtSysLocale; 00075 class VirtualDevice; 00076 00078 00079 class SmResId : public ResId 00080 { 00081 public: 00082 SmResId(USHORT nId); 00083 }; 00084 00085 class SmNamesArray : public Resource 00086 { 00087 ResStringArray aNamesAry; 00088 LanguageType nLanguage; 00089 00090 public: 00091 SmNamesArray( LanguageType nLang, int nRID ) : 00092 Resource( SmResId(RID_LOCALIZED_NAMES) ), 00093 aNamesAry (SmResId( static_cast < USHORT > ( nRID ))), 00094 nLanguage (nLang) 00095 { 00096 FreeResource(); 00097 } 00098 00099 LanguageType GetLanguage() const { return nLanguage; } 00100 const ResStringArray& GetNamesArray() const { return aNamesAry; } 00101 }; 00102 00104 00105 class SmLocalizedSymbolData : public Resource 00106 { 00107 ResStringArray aUiSymbolNamesAry; 00108 ResStringArray aExportSymbolNamesAry; 00109 ResStringArray aUiSymbolSetNamesAry; 00110 ResStringArray aExportSymbolSetNamesAry; 00111 SmNamesArray *p50NamesAry; 00112 SmNamesArray *p60NamesAry; 00113 LanguageType n50NamesLang; 00114 LanguageType n60NamesLang; 00115 00116 public: 00117 SmLocalizedSymbolData(); 00118 ~SmLocalizedSymbolData(); 00119 00120 const ResStringArray& GetUiSymbolNamesArray() const { return aUiSymbolNamesAry; } 00121 const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; } 00122 const String GetUiSymbolName( const String &rExportName ) const; 00123 const String GetExportSymbolName( const String &rUiName ) const; 00124 00125 const ResStringArray& GetUiSymbolSetNamesArray() const { return aUiSymbolSetNamesAry; } 00126 const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; } 00127 const String GetUiSymbolSetName( const String &rExportName ) const; 00128 const String GetExportSymbolSetName( const String &rUiName ) const; 00129 00130 const ResStringArray* Get50NamesArray( LanguageType nLang ); 00131 const ResStringArray* Get60NamesArray( LanguageType nLang ); 00132 }; 00133 00135 00136 class SmModule : public SfxModule, public SfxListener 00137 { 00138 svtools::ColorConfig *pColorConfig; 00139 SmConfig *pConfig; 00140 SmLocalizedSymbolData *pLocSymbolData; 00141 SvtSysLocale *pSysLocale; 00142 VirtualDevice *pVirtualDev; 00143 00144 virtual void FillStatusBar(StatusBar &rBar); 00145 void _CreateSysLocale() const; 00146 void _CreateVirtualDev() const; 00147 00148 void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ); 00149 00150 public: 00151 TYPEINFO(); 00152 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0) 00153 00154 SmModule(SfxObjectFactory* pObjFact); 00155 virtual ~SmModule(); 00156 00157 // SfxListener 00158 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 00159 00160 svtools::ColorConfig & GetColorConfig(); 00161 00162 SmConfig * GetConfig(); 00163 SmSymSetManager & GetSymSetManager(); 00164 00165 SmLocalizedSymbolData & GetLocSymbolData() const; 00166 00167 void GetState(SfxItemSet&); 00168 00169 const SvtSysLocale& GetSysLocale() const 00170 { 00171 if( !pSysLocale ) 00172 _CreateSysLocale(); 00173 return *pSysLocale; 00174 } 00175 00176 VirtualDevice & GetDefaultVirtualDev() 00177 { 00178 if (!pVirtualDev) 00179 _CreateVirtualDev(); 00180 return *pVirtualDev; 00181 } 00182 00183 //virtuelle Methoden fuer den Optionendialog 00184 virtual SfxItemSet* CreateItemSet( USHORT nId ); 00185 virtual void ApplyItemSet( USHORT nId, const SfxItemSet& rSet ); 00186 virtual SfxTabPage* CreateTabPage( USHORT nId, Window* pParent, const SfxItemSet& rSet ); 00187 }; 00188 00189 #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) ) 00190 #define SM_MOD1() ( *(SmModule**) GetAppData(SHL_SM) ) 00191 00192 #endif // _SDMOD_HXX 00193