xref: /aoo42x/main/starmath/inc/smmod.hxx (revision f6a9d5ca)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SMMOD_HXX
25 #define _SMMOD_HXX
26 
27 #ifndef _SV_RESARY_HXX
28 #include <tools/resary.hxx>
29 #endif
30 #include <svl/lstner.hxx>
31 #include <svtools/colorcfg.hxx>
32 
33 #include <tools/shl.hxx>
34 #include <sfx2/module.hxx>
35 
36 #ifndef _STARMATH_HRC
37 #include "starmath.hrc"
38 #endif
39 
40 #include <unotools/options.hxx>
41 
42 class SvxErrorHandler;
43 class SfxObjectFactory;
44 class SmConfig;
45 class SmModule;
46 class SmSymbolManager;
47 
48 /*************************************************************************
49 |*
50 |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
51 |* linked to the DLL. One instance of this class exists while the DLL is
52 |* loaded.
53 |*
54 |* SdModule is like to be compared with the <SfxApplication>-subclass.
55 |*
56 |* Remember: Don`t export this class! It uses DLL-internal symbols.
57 |*
58 \************************************************************************/
59 
60 class SvtSysLocale;
61 class VirtualDevice;
62 
63 /////////////////////////////////////////////////////////////////
64 
65 class SmResId : public ResId
66 {
67 public:
68 	SmResId(sal_uInt16 nId);
69 };
70 
71 class SmNamesArray : public Resource
72 {
73     ResStringArray      aNamesAry;
74     LanguageType        nLanguage;
75 
76 public:
SmNamesArray(LanguageType nLang,int nRID)77     SmNamesArray( LanguageType nLang, int nRID ) :
78         Resource( SmResId(RID_LOCALIZED_NAMES) ),
79         aNamesAry   (SmResId( static_cast < sal_uInt16 > ( nRID ))),
80         nLanguage   (nLang)
81     {
82         FreeResource();
83     }
84 
GetLanguage() const85     LanguageType            GetLanguage() const     { return nLanguage; }
GetNamesArray() const86     const ResStringArray&   GetNamesArray() const   { return aNamesAry; }
87 };
88 
89 /////////////////////////////////////////////////////////////////
90 
91 class SmLocalizedSymbolData : public Resource
92 {
93 	ResStringArray		aUiSymbolNamesAry;
94 	ResStringArray		aExportSymbolNamesAry;
95     ResStringArray      aUiSymbolSetNamesAry;
96     ResStringArray      aExportSymbolSetNamesAry;
97     SmNamesArray       *p50NamesAry;
98     SmNamesArray       *p60NamesAry;
99     LanguageType        n50NamesLang;
100     LanguageType        n60NamesLang;
101 
102 public:
103     SmLocalizedSymbolData();
104     ~SmLocalizedSymbolData();
105 
GetUiSymbolNamesArray() const106     const ResStringArray& GetUiSymbolNamesArray() const     { return aUiSymbolNamesAry; }
GetExportSymbolNamesArray() const107     const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; }
108     const String          GetUiSymbolName( const String &rExportName ) const;
109     const String          GetExportSymbolName( const String &rUiName ) const;
110 
GetUiSymbolSetNamesArray() const111     const ResStringArray& GetUiSymbolSetNamesArray() const     { return aUiSymbolSetNamesAry; }
GetExportSymbolSetNamesArray() const112     const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; }
113     const String          GetUiSymbolSetName( const String &rExportName ) const;
114     const String          GetExportSymbolSetName( const String &rUiName ) const;
115 
116     const ResStringArray* Get50NamesArray( LanguageType nLang );
117     const ResStringArray* Get60NamesArray( LanguageType nLang );
118 };
119 
120 /////////////////////////////////////////////////////////////////
121 
122 class SmModule : public SfxModule, utl::ConfigurationListener
123 {
124     svtools::ColorConfig        *pColorConfig;
125     SmConfig                *pConfig;
126     SmLocalizedSymbolData   *pLocSymbolData;
127     SvtSysLocale            *pSysLocale;
128     VirtualDevice           *pVirtualDev;
129 
130 	void _CreateSysLocale() const;
131     void _CreateVirtualDev() const;
132 
133     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
134 
135 public:
136 	TYPEINFO();
137     SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0)
138 
139 	SmModule(SfxObjectFactory* pObjFact);
140 	virtual ~SmModule();
141 
142     virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
143 
144     svtools::ColorConfig &  GetColorConfig();
145 
146     SmConfig *              GetConfig();
147     SmSymbolManager &       GetSymbolManager();
148 
149     SmLocalizedSymbolData &   GetLocSymbolData() const;
150 
151     void GetState(SfxItemSet&);
152 
GetSysLocale() const153 	const SvtSysLocale& GetSysLocale() const
154 	{
155 		if( !pSysLocale )
156 			_CreateSysLocale();
157 		return *pSysLocale;
158 	}
159 
GetDefaultVirtualDev()160     VirtualDevice &     GetDefaultVirtualDev()
161     {
162         if (!pVirtualDev)
163             _CreateVirtualDev();
164         return *pVirtualDev;
165     }
166 
167 	//virtuelle Methoden fuer den Optionendialog
168 	virtual SfxItemSet*	 CreateItemSet( sal_uInt16 nId );
169 	virtual void		 ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
170 	virtual	SfxTabPage*	 CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
171 };
172 
173 #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) )
174 
175 #endif                                 // _SDMOD_HXX
176 
177