Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_STARMATH_INC_SMMOD_HXX
21 : #define INCLUDED_STARMATH_INC_SMMOD_HXX
22 :
23 : #include <tools/resary.hxx>
24 : #include <svl/lstner.hxx>
25 : #include <svtools/colorcfg.hxx>
26 :
27 : #include <tools/shl.hxx>
28 : #include "tools/rc.hxx"
29 : #include <sfx2/module.hxx>
30 :
31 : #include "starmath.hrc"
32 :
33 : #include <unotools/options.hxx>
34 :
35 : class SfxObjectFactory;
36 : class SmConfig;
37 : class SmModule;
38 : class SmSymbolManager;
39 :
40 : /*************************************************************************
41 : |*
42 : |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
43 : |* linked to the DLL. One instance of this class exists while the DLL is
44 : |* loaded.
45 : |*
46 : |* SdModule is like to be compared with the <SfxApplication>-subclass.
47 : |*
48 : |* Remember: Don`t export this class! It uses DLL-internal symbols.
49 : |*
50 : \************************************************************************/
51 :
52 : class SvtSysLocale;
53 : class VirtualDevice;
54 :
55 :
56 :
57 : class SmResId : public ResId
58 : {
59 : public:
60 : SmResId(sal_uInt16 nId);
61 : };
62 :
63 : #define SM_RESSTR(x) SmResId(x).toString()
64 :
65 : class SmLocalizedSymbolData : public Resource
66 : {
67 : ResStringArray aUiSymbolNamesAry;
68 : ResStringArray aExportSymbolNamesAry;
69 : ResStringArray aUiSymbolSetNamesAry;
70 : ResStringArray aExportSymbolSetNamesAry;
71 :
72 : public:
73 : SmLocalizedSymbolData();
74 : ~SmLocalizedSymbolData();
75 :
76 1320 : const ResStringArray& GetUiSymbolNamesArray() const { return aUiSymbolNamesAry; }
77 1320 : const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; }
78 : const OUString GetUiSymbolName( const OUString &rExportName ) const;
79 : const OUString GetExportSymbolName( const OUString &rUiName ) const;
80 :
81 1600 : const ResStringArray& GetUiSymbolSetNamesArray() const { return aUiSymbolSetNamesAry; }
82 1600 : const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; }
83 : const OUString GetUiSymbolSetName( const OUString &rExportName ) const;
84 : const OUString GetExportSymbolSetName( const OUString &rUiName ) const;
85 : };
86 :
87 : class SmModule : public SfxModule, utl::ConfigurationListener
88 : {
89 : svtools::ColorConfig *pColorConfig;
90 : SmConfig *pConfig;
91 : SmLocalizedSymbolData *pLocSymbolData;
92 : SvtSysLocale *pSysLocale;
93 : VirtualDevice *pVirtualDev;
94 :
95 : void _CreateSysLocale() const;
96 : void _CreateVirtualDev() const;
97 :
98 : void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
99 :
100 : public:
101 : TYPEINFO_OVERRIDE();
102 24 : SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0)
103 :
104 : private:
105 : /// SfxInterface initializer.
106 : static void InitInterface_Impl();
107 :
108 : public:
109 : SmModule(SfxObjectFactory* pObjFact);
110 : virtual ~SmModule();
111 :
112 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
113 :
114 : svtools::ColorConfig & GetColorConfig();
115 :
116 : SmConfig * GetConfig();
117 : SmSymbolManager & GetSymbolManager();
118 :
119 : SmLocalizedSymbolData & GetLocSymbolData() const;
120 :
121 : void GetState(SfxItemSet&);
122 :
123 37806 : const SvtSysLocale& GetSysLocale() const
124 : {
125 37806 : if( !pSysLocale )
126 24 : _CreateSysLocale();
127 37806 : return *pSysLocale;
128 : }
129 :
130 798 : VirtualDevice & GetDefaultVirtualDev()
131 : {
132 798 : if (!pVirtualDev)
133 24 : _CreateVirtualDev();
134 798 : return *pVirtualDev;
135 : }
136 :
137 : //virtual methods for options dialog
138 : virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
139 : virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
140 : virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
141 : };
142 :
143 : #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) )
144 :
145 : #endif // INCLUDED_STARMATH_INC_SMMOD_HXX
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|