1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_PALETTEMANAGER_HXX
20 #define INCLUDED_SVX_PALETTEMANAGER_HXX
22 #include <svx/Palette.hxx>
23 #include <rtl/ustring.hxx>
24 #include <svx/xtable.hxx>
30 class SvxColorValueSet
;
31 namespace com::sun::star::uno
{ class XComponentContext
; }
32 namespace svx
{ class ToolboxButtonColorUpdater
; }
33 namespace weld
{ class Window
; }
35 class SVX_DLLPUBLIC PaletteManager
37 const sal_uInt16 mnMaxRecentColors
;
39 sal_uInt16 mnNumOfPalettes
;
40 sal_uInt16 mnCurrentPalette
;
43 svx::ToolboxButtonColorUpdater
* mpBtnUpdater
;
45 XColorListRef pColorList
;
46 std::deque
<NamedColor
> maRecentColors
;
47 std::vector
<std::unique_ptr
<Palette
>> m_Palettes
;
49 std::function
<void(const OUString
&, const NamedColor
&)> maColorSelectFunction
;
50 css::uno::Reference
< css::uno::XComponentContext
> m_context
;
54 PaletteManager(const PaletteManager
&) = delete;
55 PaletteManager
& operator=(const PaletteManager
&) = delete;
57 void ReloadColorSet(SvxColorValueSet
& rColorSet
);
58 void ReloadColorSet(ColorValueSet
& rColorSet
);
59 void ReloadRecentColorSet(SvxColorValueSet
& rColorSet
);
60 void ReloadRecentColorSet(ColorValueSet
& rColorSet
);
61 std::vector
<OUString
> GetPaletteList();
62 void SetPalette( sal_Int32 nPos
);
63 sal_Int32
GetPalette();
64 sal_Int32
GetPaletteCount() { return mnNumOfPalettes
; }
65 OUString
GetPaletteName();
66 OUString
GetSelectedPalettePath();
69 long GetRecentColorCount();
70 void AddRecentColor(const Color
& rRecentColor
, const OUString
& rColorName
, bool bFront
= true);
72 void SetBtnUpdater(svx::ToolboxButtonColorUpdater
* pBtnUpdater
);
73 void PopupColorPicker(weld::Window
* pParent
, const OUString
& aCommand
, const Color
& rInitialColor
);
75 void SetColorSelectFunction(const std::function
<void(const OUString
&, const NamedColor
&)>& aColorSelectFunction
);
77 static void DispatchColorCommand(const OUString
& aCommand
, const NamedColor
& rColor
);
80 #endif // INCLUDED_SVX_PALETTEMANAGER_HXX
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */