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 
31 namespace com::sun::star::uno { class XComponentContext; }
32 namespace svx { class ToolboxButtonColorUpdaterBase; }
33 namespace weld { class Window; }
34 
36 {
37  const sal_uInt16 mnMaxRecentColors;
38 
39  sal_uInt16 mnNumOfPalettes;
40  sal_uInt16 mnCurrentPalette;
41 
44 
46  std::deque<NamedColor> maRecentColors;
47  std::vector<std::unique_ptr<Palette>> m_Palettes;
48 
50 
51  std::unique_ptr<SvColorDialog> m_pColorDlg;
52 public:
54  ~PaletteManager();
55  PaletteManager(const PaletteManager&) = delete;
56  PaletteManager& operator=(const PaletteManager&) = delete;
57  void LoadPalettes();
58  void ReloadColorSet(SvxColorValueSet& rColorSet);
59  void ReloadRecentColorSet(SvxColorValueSet& rColorSet);
60  std::vector<OUString> GetPaletteList();
61  void SetPalette( sal_Int32 nPos );
62  sal_Int32 GetPalette() const;
63  sal_Int32 GetPaletteCount() const { return mnNumOfPalettes; }
64  OUString GetPaletteName();
65  OUString GetSelectedPalettePath();
66 
67  tools::Long GetColorCount() const;
68  tools::Long GetRecentColorCount() const;
69  void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
70 
71  void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
72  void PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
73 
74  void SetColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
75 
76  bool IsThemePaletteSelected() const;
77 
78  static void GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& rThemeIndex,
79  sal_Int16& rLumMod, sal_Int16& rLumOff);
80 
81  static void DispatchColorCommand(const OUString& aCommand, const svx::NamedThemedColor& rColor);
82 };
83 
84 #endif // INCLUDED_SVX_PALETTEMANAGER_HXX
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A color with an optional name and other theming-related properties.
Definition: Palette.hxx:37
XColorListRef pColorList
long Long
svx::ToolboxButtonColorUpdaterBase * mpBtnUpdater
tools::Long mnColorCount
sal_Int32 GetPaletteCount() const
const sal_uInt16 mnMaxRecentColors
ColorSelectFunction maColorSelectFunction
std::deque< NamedColor > maRecentColors
helper class to update a color in a toolbox button image
sal_uInt16 mnCurrentPalette
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
std::vector< std::unique_ptr< Palette > > m_Palettes
sal_uInt16 mnNumOfPalettes
std::unique_ptr< SvColorDialog > m_pColorDlg
std::function< void(const OUString &, const svx::NamedThemedColor &)> ColorSelectFunction
Definition: Palette.hxx:51