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