| 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 | #pragma once |
| 21 | |
| 22 | #include <sfx2/module.hxx> |
| 23 | #include <sfx2/app.hxx> |
| 24 | #include <vcl/vclptr.hxx> |
| 25 | #include <unotools/options.hxx> |
| 26 | #include <optional> |
| 27 | |
| 28 | namespace svtools { class ColorConfig; } |
| 29 | |
| 30 | class SfxObjectFactory; |
| 31 | class SmSymbolManager; |
| 32 | class SmMathConfig; |
| 33 | |
| 34 | /************************************************************************* |
| 35 | |* |
| 36 | |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is |
| 37 | |* linked to the DLL. One instance of this class exists while the DLL is |
| 38 | |* loaded. |
| 39 | |* |
| 40 | |* SdModule is like to be compared with the <SfxApplication>-subclass. |
| 41 | |* |
| 42 | |* Remember: Don`t export this class! It uses DLL-internal symbols. |
| 43 | |* |
| 44 | \************************************************************************/ |
| 45 | |
| 46 | class VirtualDevice; |
| 47 | |
| 48 | |
| 49 | OUString SmResId(TranslateId aId); |
| 50 | |
| 51 | namespace SmLocalizedSymbolData |
| 52 | { |
| 53 | OUString GetUiSymbolName( std::u16string_view rExportName ); |
| 54 | OUString GetExportSymbolName( std::u16string_view rUiName ); |
| 55 | |
| 56 | OUString GetUiSymbolSetName( std::u16string_view rExportName ); |
| 57 | OUString GetExportSymbolSetName( std::u16string_view rUiName ); |
| 58 | }; |
| 59 | |
| 60 | class SmModule final : public SfxModule, public utl::ConfigurationListener |
| 61 | { |
| 62 | std::unique_ptr<svtools::ColorConfig> mpColorConfig; |
| 63 | std::unique_ptr<SmMathConfig> mpConfig; |
| 64 | std::optional<SvtSysLocale> moSysLocale; |
| 65 | VclPtr<VirtualDevice> mpVirtualDev; |
| 66 | |
| 67 | public: |
| 68 | SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + SfxInterfaceId(0)) |
| 69 | |
| 70 | private: |
| 71 | /// SfxInterface initializer. |
| 72 | static void InitInterface_Impl(); |
| 73 | |
| 74 | public: |
| 75 | explicit SmModule(SfxObjectFactory* pObjFact); |
| 76 | virtual ~SmModule() override; |
| 77 | |
| 78 | virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override; |
| 79 | |
| 80 | svtools::ColorConfig & GetColorConfig(); |
| 81 | |
| 82 | SmMathConfig * GetConfig(); |
| 83 | SmSymbolManager & GetSymbolManager(); |
| 84 | |
| 85 | static void GetState(SfxItemSet&); |
| 86 | |
| 87 | const SvtSysLocale& GetSysLocale(); |
| 88 | |
| 89 | VirtualDevice & GetDefaultVirtualDev(); |
| 90 | |
| 91 | //virtual methods for options dialog |
| 92 | virtual std::optional<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override; |
| 93 | virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override; |
| 94 | virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override; |
| 95 | |
| 96 | static auto get() { return static_cast<SmModule*>(SfxApplication::GetModule(SfxToolsModule::Math)); } |
| 97 | }; |
| 98 | |
| 99 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |