LibreOffice Module svx (master) 1
PaletteManager.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_SVX_PALETTEMANAGER_HXX
20#define INCLUDED_SVX_PALETTEMANAGER_HXX
21
22#include <svx/Palette.hxx>
23#include <rtl/ustring.hxx>
24#include <svx/xtable.hxx>
25#include <svtools/colrdlg.hxx>
26
27#include <deque>
28#include <vector>
29#include <memory>
30
31namespace com::sun::star::uno { class XComponentContext; }
32namespace svx { class ToolboxButtonColorUpdaterBase; }
33namespace weld { class Window; }
34
36{
37 Black,
38 White,
39 Low,
40 High,
41 Normal
42};
43
45{
48};
49
51{
52 std::array<ThemePaletteData, 12> maData;
53};
54
56{
57 const sal_uInt16 mnMaxRecentColors;
58
59 sal_uInt16 mnNumOfPalettes;
60 sal_uInt16 mnCurrentPalette;
61
64
66 std::deque<NamedColor> maRecentColors;
67 std::vector<std::unique_ptr<Palette>> m_Palettes;
68
70
71 std::unique_ptr<SvColorDialog> m_pColorDlg;
72 std::optional<ThemePaletteCollection> moThemePaletteCollection;
73
74 PaletteManager(const PaletteManager* pClone);
75public:
80 void LoadPalettes();
81 void ReloadColorSet(SvxColorValueSet& rColorSet);
82 void ReloadRecentColorSet(SvxColorValueSet& rColorSet);
83 std::vector<OUString> GetPaletteList();
84 void SetPalette( sal_Int32 nPos );
85 sal_Int32 GetPalette() const;
86 sal_Int32 GetPaletteCount() const { return mnNumOfPalettes; }
87 OUString GetPaletteName();
88 OUString GetSelectedPalettePath();
89
90 tools::Long GetColorCount() const;
91 tools::Long GetRecentColorCount() const;
92 void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
93
94 void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
95 void PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
96
97 void SetColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
98
99 bool IsThemePaletteSelected() const;
100
101 PaletteManager* Clone() const;
102
103 static bool GetThemeAndEffectIndex(sal_uInt16 nItemId, sal_uInt16& rThemeIndex, sal_uInt16& rEffectIndex);
104 bool GetLumModOff(sal_uInt16 nThemeIndex, sal_uInt16 nEffect, sal_Int16& rLumMod, sal_Int16& rLumOff);
105
106 static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor);
107};
108
109#endif // INCLUDED_SVX_PALETTEMANAGER_HXX
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ThemePaletteColorType
std::function< void(const OUString &, const NamedColor &)> ColorSelectFunction
Definition: Palette.hxx:73
const sal_uInt16 mnMaxRecentColors
svx::ToolboxButtonColorUpdaterBase * mpBtnUpdater
tools::Long mnColorCount
sal_Int32 GetPaletteCount() const
std::deque< NamedColor > maRecentColors
sal_uInt16 mnNumOfPalettes
XColorListRef pColorList
sal_uInt16 mnCurrentPalette
ColorSelectFunction maColorSelectFunction
std::vector< std::unique_ptr< Palette > > m_Palettes
std::unique_ptr< SvColorDialog > m_pColorDlg
std::optional< ThemePaletteCollection > moThemePaletteCollection
PaletteManager & operator=(const PaletteManager &)=delete
PaletteManager(const PaletteManager &)=delete
helper class to update a color in a toolbox button image
const Color Black(0x000000)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
long Long
std::array< ThemePaletteData, 12 > maData
ThemePaletteColorType meType
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35