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 namespace com::sun::star::uno
{ class XComponentContext
; }
31 namespace svx
{ class ToolboxButtonColorUpdaterBase
; }
32 namespace weld
{ class Window
; }
34 class SVXCORE_DLLPUBLIC PaletteManager
36 const sal_uInt16 mnMaxRecentColors
;
38 sal_uInt16 mnNumOfPalettes
;
39 sal_uInt16 mnCurrentPalette
;
41 tools::Long mnColorCount
;
42 svx::ToolboxButtonColorUpdaterBase
* mpBtnUpdater
;
44 XColorListRef pColorList
;
45 std::deque
<NamedColor
> maRecentColors
;
46 std::vector
<std::unique_ptr
<Palette
>> m_Palettes
;
48 ColorSelectFunction maColorSelectFunction
;
49 css::uno::Reference
< css::uno::XComponentContext
> m_context
;
53 PaletteManager(const PaletteManager
&) = delete;
54 PaletteManager
& operator=(const PaletteManager
&) = delete;
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();
65 tools::Long
GetColorCount() const;
66 tools::Long
GetRecentColorCount() const;
67 void AddRecentColor(const Color
& rRecentColor
, const OUString
& rColorName
, bool bFront
= true);
69 void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase
* pBtnUpdater
);
70 void PopupColorPicker(weld::Window
* pParent
, const OUString
& aCommand
, const Color
& rInitialColor
);
72 void SetColorSelectFunction(const ColorSelectFunction
& aColorSelectFunction
);
74 static void DispatchColorCommand(const OUString
& aCommand
, const NamedColor
& rColor
);
77 #endif // INCLUDED_SVX_PALETTEMANAGER_HXX
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */