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 : #include <memory>
35 :
36 : class SfxObjectFactory;
37 : class SmModule;
38 : class SmSymbolManager;
39 : class SmMathConfig;
40 :
41 : /*************************************************************************
42 : |*
43 : |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
44 : |* linked to the DLL. One instance of this class exists while the DLL is
45 : |* loaded.
46 : |*
47 : |* SdModule is like to be compared with the <SfxApplication>-subclass.
48 : |*
49 : |* Remember: Don`t export this class! It uses DLL-internal symbols.
50 : |*
51 : \************************************************************************/
52 :
53 : class SvtSysLocale;
54 : class VirtualDevice;
55 :
56 :
57 :
58 : class SmResId : public ResId
59 : {
60 : public:
61 : SmResId(sal_uInt16 nId);
62 : };
63 :
64 : #define SM_RESSTR(x) SmResId(x).toString()
65 :
66 : class SmLocalizedSymbolData : public Resource
67 : {
68 : ResStringArray aUiSymbolNamesAry;
69 : ResStringArray aExportSymbolNamesAry;
70 : ResStringArray aUiSymbolSetNamesAry;
71 : ResStringArray aExportSymbolSetNamesAry;
72 :
73 : public:
74 : SmLocalizedSymbolData();
75 : ~SmLocalizedSymbolData();
76 :
77 660 : const ResStringArray& GetUiSymbolNamesArray() const { return aUiSymbolNamesAry; }
78 660 : const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; }
79 : static const OUString GetUiSymbolName( const OUString &rExportName );
80 : static const OUString GetExportSymbolName( const OUString &rUiName );
81 :
82 800 : const ResStringArray& GetUiSymbolSetNamesArray() const { return aUiSymbolSetNamesAry; }
83 800 : const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; }
84 : static const OUString GetUiSymbolSetName( const OUString &rExportName );
85 : static const OUString GetExportSymbolSetName( const OUString &rUiName );
86 : };
87 :
88 : class SmModule : public SfxModule, utl::ConfigurationListener
89 : {
90 : std::unique_ptr<svtools::ColorConfig> mpColorConfig;
91 : std::unique_ptr<SmMathConfig> mpConfig;
92 : std::unique_ptr<SmLocalizedSymbolData> mpLocSymbolData;
93 : std::unique_ptr<SvtSysLocale> mpSysLocale;
94 : VclPtr<VirtualDevice> mpVirtualDev;
95 :
96 : static void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
97 :
98 : public:
99 : TYPEINFO_OVERRIDE();
100 14 : SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0)
101 :
102 : private:
103 : /// SfxInterface initializer.
104 : static void InitInterface_Impl();
105 :
106 : public:
107 : SmModule(SfxObjectFactory* pObjFact);
108 : virtual ~SmModule();
109 :
110 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
111 :
112 : svtools::ColorConfig & GetColorConfig();
113 :
114 : SmMathConfig * GetConfig();
115 : SmSymbolManager & GetSymbolManager();
116 :
117 : SmLocalizedSymbolData & GetLocSymbolData();
118 :
119 : static void GetState(SfxItemSet&);
120 :
121 : const SvtSysLocale& GetSysLocale();
122 :
123 : VirtualDevice & GetDefaultVirtualDev();
124 :
125 : //virtual methods for options dialog
126 : virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
127 : virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
128 : virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
129 : };
130 :
131 : #define SM_MOD() ( *reinterpret_cast<SmModule**>(GetAppData(SHL_SM)) )
132 :
133 : #endif // INCLUDED_STARMATH_INC_SMMOD_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|