1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SMMOD_HXX 29 #define _SMMOD_HXX 30 31 #ifndef _SV_RESARY_HXX 32 #include <tools/resary.hxx> 33 #endif 34 #include <svl/lstner.hxx> 35 #include <svtools/colorcfg.hxx> 36 37 #include <tools/shl.hxx> 38 #include <sfx2/module.hxx> 39 40 #ifndef _STARMATH_HRC 41 #include "starmath.hrc" 42 #endif 43 44 #include <unotools/options.hxx> 45 46 class SvxErrorHandler; 47 class SfxObjectFactory; 48 class SmConfig; 49 class SmModule; 50 class SmSymbolManager; 51 52 /************************************************************************* 53 |* 54 |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is 55 |* linked to the DLL. One instance of this class exists while the DLL is 56 |* loaded. 57 |* 58 |* SdModule is like to be compared with the <SfxApplication>-subclass. 59 |* 60 |* Remember: Don`t export this class! It uses DLL-internal symbols. 61 |* 62 \************************************************************************/ 63 64 class SvtSysLocale; 65 class VirtualDevice; 66 67 ///////////////////////////////////////////////////////////////// 68 69 class SmResId : public ResId 70 { 71 public: 72 SmResId(sal_uInt16 nId); 73 }; 74 75 class SmNamesArray : public Resource 76 { 77 ResStringArray aNamesAry; 78 LanguageType nLanguage; 79 80 public: 81 SmNamesArray( LanguageType nLang, int nRID ) : 82 Resource( SmResId(RID_LOCALIZED_NAMES) ), 83 aNamesAry (SmResId( static_cast < sal_uInt16 > ( nRID ))), 84 nLanguage (nLang) 85 { 86 FreeResource(); 87 } 88 89 LanguageType GetLanguage() const { return nLanguage; } 90 const ResStringArray& GetNamesArray() const { return aNamesAry; } 91 }; 92 93 ///////////////////////////////////////////////////////////////// 94 95 class SmLocalizedSymbolData : public Resource 96 { 97 ResStringArray aUiSymbolNamesAry; 98 ResStringArray aExportSymbolNamesAry; 99 ResStringArray aUiSymbolSetNamesAry; 100 ResStringArray aExportSymbolSetNamesAry; 101 SmNamesArray *p50NamesAry; 102 SmNamesArray *p60NamesAry; 103 LanguageType n50NamesLang; 104 LanguageType n60NamesLang; 105 106 public: 107 SmLocalizedSymbolData(); 108 ~SmLocalizedSymbolData(); 109 110 const ResStringArray& GetUiSymbolNamesArray() const { return aUiSymbolNamesAry; } 111 const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; } 112 const String GetUiSymbolName( const String &rExportName ) const; 113 const String GetExportSymbolName( const String &rUiName ) const; 114 115 const ResStringArray& GetUiSymbolSetNamesArray() const { return aUiSymbolSetNamesAry; } 116 const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; } 117 const String GetUiSymbolSetName( const String &rExportName ) const; 118 const String GetExportSymbolSetName( const String &rUiName ) const; 119 120 const ResStringArray* Get50NamesArray( LanguageType nLang ); 121 const ResStringArray* Get60NamesArray( LanguageType nLang ); 122 }; 123 124 ///////////////////////////////////////////////////////////////// 125 126 class SmModule : public SfxModule, utl::ConfigurationListener 127 { 128 svtools::ColorConfig *pColorConfig; 129 SmConfig *pConfig; 130 SmLocalizedSymbolData *pLocSymbolData; 131 SvtSysLocale *pSysLocale; 132 VirtualDevice *pVirtualDev; 133 134 void _CreateSysLocale() const; 135 void _CreateVirtualDev() const; 136 137 void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ); 138 139 public: 140 TYPEINFO(); 141 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0) 142 143 SmModule(SfxObjectFactory* pObjFact); 144 virtual ~SmModule(); 145 146 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); 147 148 svtools::ColorConfig & GetColorConfig(); 149 150 SmConfig * GetConfig(); 151 SmSymbolManager & GetSymbolManager(); 152 153 SmLocalizedSymbolData & GetLocSymbolData() const; 154 155 void GetState(SfxItemSet&); 156 157 const SvtSysLocale& GetSysLocale() const 158 { 159 if( !pSysLocale ) 160 _CreateSysLocale(); 161 return *pSysLocale; 162 } 163 164 VirtualDevice & GetDefaultVirtualDev() 165 { 166 if (!pVirtualDev) 167 _CreateVirtualDev(); 168 return *pVirtualDev; 169 } 170 171 //virtuelle Methoden fuer den Optionendialog 172 virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); 173 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); 174 virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ); 175 }; 176 177 #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) ) 178 179 #endif // _SDMOD_HXX 180 181