Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / inc / CommonStylePreviewRenderer.hxx
blob0e99421b4bfefe461a7befe0ee5819d4d4b75d5d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
12 #include <optional>
13 #include <vector>
15 #include <editeng/editeng.hxx>
16 #include <editeng/svxfont.hxx>
17 #include <sfx2/objsh.hxx>
18 #include <sfx2/StylePreviewRenderer.hxx>
19 #include <rtl/ustring.hxx>
20 #include <tools/color.hxx>
21 #include <tools/gen.hxx>
23 class OutputDevice;
24 class SfxStyleSheetBase;
26 using namespace css;
28 namespace svx
30 class CommonStylePreviewRenderer final : public sfx2::StylePreviewRenderer
32 std::optional<SvxFont> m_oFont;
33 std::optional<SvxFont> m_oCJKFont;
34 std::optional<SvxFont> m_oCTLFont;
35 Color maFontColor;
36 Color maHighlightColor;
37 Color maBackgroundColor;
38 tools::Long mnHeight;
39 tools::Long mnBaseLine;
40 OUString maStyleName;
41 OUString maScriptText;
42 struct ScriptInfo
44 tools::Long textWidth;
45 SvtScriptType scriptType;
46 sal_Int32 changePos;
47 ScriptInfo(SvtScriptType scrptType, sal_Int32 position)
48 : textWidth(0)
49 , scriptType(scrptType)
50 , changePos(position)
54 std::vector<ScriptInfo> maScriptChanges;
56 bool SetFontSize(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont);
57 void CalcRenderSize();
58 void CheckScript();
60 public:
61 CommonStylePreviewRenderer(const SfxObjectShell& rShell, OutputDevice& rOutputDev,
62 SfxStyleSheetBase* pStyle, tools::Long nMaxHeight);
63 virtual ~CommonStylePreviewRenderer() override;
65 virtual bool recalculate() override;
66 virtual bool render(const tools::Rectangle& aRectangle,
67 RenderAlign eRenderAlign = RenderAlign::CENTER) override;
70 } // end namespace svx
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */