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#pragma once
20
21#include <svx/Palette.hxx>
22#include <rtl/ustring.hxx>
23#include <svx/xtable.hxx>
24#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; }
34namespace model { class ColorSet; }
35
37{
38 const sal_uInt16 mnMaxRecentColors;
39
40 sal_uInt16 mnNumOfPalettes;
41 sal_uInt16 mnCurrentPalette;
42
45
47 std::deque<NamedColor> maRecentColors;
48 std::vector<std::unique_ptr<Palette>> m_Palettes;
49
51
52 std::unique_ptr<SvColorDialog> m_pColorDlg;
53 std::optional<svx::ThemePaletteCollection> moThemePaletteCollection;
54
55 PaletteManager(const PaletteManager* pClone);
56public:
61 void LoadPalettes();
62 void ReloadColorSet(SvxColorValueSet& rColorSet);
63 void ReloadRecentColorSet(SvxColorValueSet& rColorSet);
64 std::vector<OUString> GetPaletteList();
65 void SetPalette( sal_Int32 nPos );
66 sal_Int32 GetPalette() const;
67 sal_Int32 GetPaletteCount() const { return mnNumOfPalettes; }
68 OUString GetPaletteName();
69 OUString GetSelectedPalettePath();
70
71 tools::Long GetColorCount() const;
72 tools::Long GetRecentColorCount() const;
73 void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
74 void SetSplitButtonColor(const NamedColor& rColor);
75
76 void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
77 void PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
78
79 void SetColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
80
81 bool IsThemePaletteSelected() const;
82
83 PaletteManager* Clone() const;
84
85 static bool GetThemeAndEffectIndex(sal_uInt16 nItemId, sal_uInt16& rThemeIndex, sal_uInt16& rEffectIndex);
86 bool GetLumModOff(sal_uInt16 nThemeIndex, sal_uInt16 nEffect, sal_Int16& rLumMod, sal_Int16& rLumOff);
87
88 static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor);
89};
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::function< void(const OUString &, const NamedColor &)> ColorSelectFunction
Definition: Palette.hxx:27
const sal_uInt16 mnMaxRecentColors
svx::ToolboxButtonColorUpdaterBase * mpBtnUpdater
tools::Long mnColorCount
sal_Int32 GetPaletteCount() const
std::deque< NamedColor > maRecentColors
std::optional< svx::ThemePaletteCollection > moThemePaletteCollection
sal_uInt16 mnNumOfPalettes
XColorListRef pColorList
sal_uInt16 mnCurrentPalette
ColorSelectFunction maColorSelectFunction
std::vector< std::unique_ptr< Palette > > m_Palettes
std::unique_ptr< SvColorDialog > m_pColorDlg
PaletteManager & operator=(const PaletteManager &)=delete
PaletteManager(const PaletteManager &)=delete
helper class to update a color in a toolbox button image
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
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35