| 1 | /* This file is part of the LibreOffice project. |
| 2 | * |
| 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <editeng/editeng.hxx> |
| 11 | #include <unotools/lingucfg.hxx> |
| 12 | |
| 13 | class SmEditEngine final : public EditEngine |
| 14 | { |
| 15 | public: |
| 16 | SmEditEngine(SfxItemPool* pItemPool); |
| 17 | SmEditEngine(const SmEditEngine&) = delete; |
| 18 | |
| 19 | public: |
| 20 | /** |
| 21 | * Runs checkZoom and if true runs updateZoom |
| 22 | */ |
| 23 | void executeZoom(EditView* pEditView = nullptr); |
| 24 | |
| 25 | /** |
| 26 | * Sets up default font parameters for the item pool. |
| 27 | */ |
| 28 | static void setSmItemPool(SfxItemPool* mpItemPool, const SvtLinguOptions& maLangOptions); |
| 29 | |
| 30 | // Deal with text scaling |
| 31 | private: |
| 32 | sal_Int32 m_nOldZoom; |
| 33 | sal_Int32 m_nNewZoom; |
| 34 | sal_Int32 m_nDefaultFontSize; |
| 35 | |
| 36 | /** |
| 37 | * Checks if the zoom of smeditwindow has changed. |
| 38 | * m_nNewZoom is updated. |
| 39 | * @return zoom has changed |
| 40 | */ |
| 41 | bool checkZoom(); |
| 42 | |
| 43 | /** |
| 44 | * Updates the zoom of smeditwindow. |
| 45 | * m_nOldZoom is set to m_nNewZoom. |
| 46 | */ |
| 47 | |
| 48 | void updateZoom(); |
| 49 | |
| 50 | // Gather information for more complex tasks |
| 51 | private: |
| 52 | ESelection m_aAllSelection; |
| 53 | |
| 54 | /** |
| 55 | * Finds the ESelection which contains all the text. |
| 56 | */ |
| 57 | void updateAllESelection(); |
| 58 | }; |
| 59 | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |