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 0 : const ResStringArray& GetUiSymbolNamesArray() const { return aUiSymbolNamesAry; }
77 0 : const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; }
78 : const OUString GetUiSymbolName( const OUString &rExportName ) const;
79 : const OUString GetExportSymbolName( const OUString &rUiName ) const;
80 :
81 0 : const ResStringArray& GetUiSymbolSetNamesArray() const { return aUiSymbolSetNamesAry; }
82 0 : 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 :
88 :
89 : class SmModule : public SfxModule, utl::ConfigurationListener
90 : {
91 : svtools::ColorConfig *pColorConfig;
92 : SmConfig *pConfig;
93 : SmLocalizedSymbolData *pLocSymbolData;
94 : SvtSysLocale *pSysLocale;
95 : VirtualDevice *pVirtualDev;
96 :
97 : void _CreateSysLocale() const;
98 : void _CreateVirtualDev() const;
99 :
100 : void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
101 :
102 : public:
103 : TYPEINFO_OVERRIDE();
104 0 : SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0)
105 :
106 : SmModule(SfxObjectFactory* pObjFact);
107 : virtual ~SmModule();
108 :
109 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
110 :
111 : svtools::ColorConfig & GetColorConfig();
112 :
113 : SmConfig * GetConfig();
114 : SmSymbolManager & GetSymbolManager();
115 :
116 : SmLocalizedSymbolData & GetLocSymbolData() const;
117 :
118 : void GetState(SfxItemSet&);
119 :
120 0 : const SvtSysLocale& GetSysLocale() const
121 : {
122 0 : if( !pSysLocale )
123 0 : _CreateSysLocale();
124 0 : return *pSysLocale;
125 : }
126 :
127 0 : VirtualDevice & GetDefaultVirtualDev()
128 : {
129 0 : if (!pVirtualDev)
130 0 : _CreateVirtualDev();
131 0 : return *pVirtualDev;
132 : }
133 :
134 : //virtual methods for options dialog
135 : virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
136 : virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
137 : virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
138 : };
139 :
140 : #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) )
141 :
142 : #endif // INCLUDED_STARMATH_INC_SMMOD_HXX
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|