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