LibreOffice Module svx (master) 1
colorwindow.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
20#pragma once
21
23#include <rtl/ustring.hxx>
25#include <svx/Palette.hxx>
26#include <vcl/toolboxid.hxx>
27
28typedef std::function<weld::Window*()> TopLevelParentFunction;
29
30namespace com::sun::star::frame { class XFrame; }
31
32class PaletteManager;
33class ToolBox;
34
36{
40public:
42 void statusChanged( const css::frame::FeatureStateEvent& rEvent );
43 Color GetColor();
44};
45
46class Button;
47
48#define COL_NONE_COLOR ::Color(ColorTransparency, 0x80, 0xFF, 0xFF, 0xFF)
49
51
53{
54private:
55 // either
57 // or
59 OUString m_aIdent;
60 // or
64public:
66 MenuOrToolMenuButton(weld::Toolbar* pToolbar, OUString sIdent);
69
72 MenuOrToolMenuButton & operator =(MenuOrToolMenuButton const &) = default;
73 MenuOrToolMenuButton & operator =(MenuOrToolMenuButton &&) = default;
74
75 bool get_active() const;
76 void set_inactive() const;
77 weld::Widget* get_widget() const;
78};
79
81{
82private:
83 const sal_uInt16 theSlotId;
84 OUString maCommand;
86 std::shared_ptr<PaletteManager> mxPaletteManager;
90
91 std::unique_ptr<SvxColorValueSet> mxColorSet;
92 std::unique_ptr<SvxColorValueSet> mxRecentColorSet;
93 std::unique_ptr<weld::ComboBox> mxPaletteListBox;
94 std::unique_ptr<weld::Button> mxButtonAutoColor;
95 std::unique_ptr<weld::Button> mxButtonNoneColor;
96 std::unique_ptr<weld::Button> mxButtonPicker;
97 std::unique_ptr<weld::Widget> mxAutomaticSeparator;
98 std::unique_ptr<weld::CustomWeld> mxColorSetWin;
99 std::unique_ptr<weld::CustomWeld> mxRecentColorSetWin;
101
102 DECL_DLLPRIVATE_LINK(SelectHdl, ValueSet*, void);
103 DECL_DLLPRIVATE_LINK(SelectPaletteHdl, weld::ComboBox&, void);
104 DECL_DLLPRIVATE_LINK(AutoColorClickHdl, weld::Button&, void);
105 DECL_DLLPRIVATE_LINK(OpenPickerClickHdl, weld::Button&, void);
106
107 static bool SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor);
108 static NamedColor GetSelectEntryColor(ValueSet const * pColorSet);
109 NamedColor GetAutoColor() const;
110
111public:
112 ColorWindow(OUString rCommand,
113 std::shared_ptr<PaletteManager> xPaletteManager,
114 ColorStatus& rColorStatus,
115 sal_uInt16 nSlotId,
116 const css::uno::Reference<css::frame::XFrame>& rFrame,
117 const MenuOrToolMenuButton &rMenuButton,
118 TopLevelParentFunction aTopLevelParentFunction,
119 ColorSelectFunction aColorSelectFunction);
120 virtual ~ColorWindow() override;
121 void ShowNoneButton();
122 void SetNoSelection();
123 bool IsNoSelection() const;
124 void SelectEntry(const NamedColor& rColor);
125 void SelectEntry(const Color& rColor);
126 NamedColor GetSelectEntryColor() const;
127
128 virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
129
130 virtual void GrabFocus() override;
131};
132
133/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::function< void(const OUString &, const NamedColor &)> ColorSelectFunction
Definition: Palette.hxx:27
Color maTLBRColor
Definition: colorwindow.hxx:38
Color maBLTRColor
Definition: colorwindow.hxx:39
std::unique_ptr< weld::Button > mxButtonAutoColor
Definition: colorwindow.hxx:94
std::unique_ptr< weld::CustomWeld > mxColorSetWin
Definition: colorwindow.hxx:98
DECL_DLLPRIVATE_LINK(AutoColorClickHdl, weld::Button &, void)
std::shared_ptr< PaletteManager > mxPaletteManager
Definition: colorwindow.hxx:86
std::unique_ptr< SvxColorValueSet > mxRecentColorSet
Definition: colorwindow.hxx:92
std::unique_ptr< weld::CustomWeld > mxRecentColorSetWin
Definition: colorwindow.hxx:99
weld::Button * mpDefaultButton
std::unique_ptr< weld::ComboBox > mxPaletteListBox
Definition: colorwindow.hxx:93
DECL_DLLPRIVATE_LINK(SelectHdl, ValueSet *, void)
DECL_DLLPRIVATE_LINK(OpenPickerClickHdl, weld::Button &, void)
ColorSelectFunction maColorSelectFunction
Definition: colorwindow.hxx:89
ColorStatus & mrColorStatus
Definition: colorwindow.hxx:87
OUString maCommand
Definition: colorwindow.hxx:84
const sal_uInt16 theSlotId
Definition: colorwindow.hxx:83
TopLevelParentFunction maTopLevelParentFunction
Definition: colorwindow.hxx:88
DECL_DLLPRIVATE_LINK(SelectPaletteHdl, weld::ComboBox &, void)
std::unique_ptr< SvxColorValueSet > mxColorSet
Definition: colorwindow.hxx:91
std::unique_ptr< weld::Widget > mxAutomaticSeparator
Definition: colorwindow.hxx:97
MenuOrToolMenuButton maMenuButton
Definition: colorwindow.hxx:85
std::unique_ptr< weld::Button > mxButtonPicker
Definition: colorwindow.hxx:96
std::unique_ptr< weld::Button > mxButtonNoneColor
Definition: colorwindow.hxx:95
MenuOrToolMenuButton(MenuOrToolMenuButton &&)=default
ToolBoxItemId m_nId
Definition: colorwindow.hxx:63
weld::Toolbar * m_pToolbar
Definition: colorwindow.hxx:58
weld::MenuButton * m_pMenuButton
Definition: colorwindow.hxx:56
MenuOrToolMenuButton(MenuOrToolMenuButton const &)=default
VclPtr< ToolBox > m_xToolBox
Definition: colorwindow.hxx:62
SvxColorToolBoxControl * m_pControl
Definition: colorwindow.hxx:61
std::function< weld::Window *()> TopLevelParentFunction
Definition: colorwindow.hxx:28
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35