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 
26 #include <deque>
27 #include <vector>
28 #include <memory>
29 
30 namespace com::sun::star::uno { class XComponentContext; }
31 namespace svx { class ToolboxButtonColorUpdaterBase; }
32 namespace weld { class Window; }
33 
35 {
36  const sal_uInt16 mnMaxRecentColors;
37 
38  sal_uInt16 mnNumOfPalettes;
39  sal_uInt16 mnCurrentPalette;
40 
43 
45  std::deque<NamedColor> maRecentColors;
46  std::vector<std::unique_ptr<Palette>> m_Palettes;
47 
48  std::function<void(const OUString&, const NamedColor&)> maColorSelectFunction;
49  css::uno::Reference < css::uno::XComponentContext > m_context;
50 public:
52  ~PaletteManager();
53  PaletteManager(const PaletteManager&) = delete;
54  PaletteManager& operator=(const PaletteManager&) = delete;
55  void LoadPalettes();
56  void ReloadColorSet(SvxColorValueSet& rColorSet);
57  void ReloadRecentColorSet(SvxColorValueSet& rColorSet);
58  std::vector<OUString> GetPaletteList();
59  void SetPalette( sal_Int32 nPos );
60  sal_Int32 GetPalette() const;
61  sal_Int32 GetPaletteCount() const { return mnNumOfPalettes; }
62  OUString GetPaletteName();
63  OUString GetSelectedPalettePath();
64 
65  long GetColorCount() const;
66  long GetRecentColorCount() const;
67  void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
68 
69  void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
70  void PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
71 
72  void SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction);
73 
74  static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor);
75 };
76 
77 #endif // INCLUDED_SVX_PALETTEMANAGER_HXX
78 
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::pair< Color, OUString > NamedColor
Definition: Palette.hxx:26
XColorListRef pColorList
svx::ToolboxButtonColorUpdaterBase * mpBtnUpdater
sal_Int32 GetPaletteCount() const
css::uno::Reference< css::uno::XComponentContext > m_context
const sal_uInt16 mnMaxRecentColors
std::function< void(const OUString &, const NamedColor &)> 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