LibreOffice Module cui (master) 1
cuicharmap.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_CUI_CUICHARMAP_HXX
20#define INCLUDED_CUI_CUICHARMAP_HXX
21
22#include <vcl/customweld.hxx>
23#include <vcl/weld.hxx>
24#include <vcl/virdev.hxx>
25#include <sfx2/basedlgs.hxx>
26#include <svl/itemset.hxx>
27#include <svx/charmap.hxx>
28#include <svx/searchcharmap.hxx>
29#include <svx/ucsubset.hxx>
30#include <sfx2/charwin.hxx>
31#include <cui/cuidllapi.h>
32#include <com/sun/star/frame/XFrame.hpp>
33
34#include <deque>
35#include <memory>
36#include <utility>
37
38using namespace ::com::sun::star;
39class SubsetMap;
40
41#define CHARMAP_MAXLEN 32
42
43namespace svx
44{
45struct SvxShowCharSetItem;
46}
47
50{
51private:
53 OUString m_sText;
57
58 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
59 virtual void Resize() override;
60 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
61
62public:
63 SvxShowText(const VclPtr<VirtualDevice>& rVirDev);
64
65 void SetFont(const vcl::Font& rFont);
66 vcl::Font const& GetFont() const { return m_aFont; }
67 void SetText(const OUString& rText);
68 OUString const& GetText() const { return m_sText; }
69 void SetCentered(bool bCenter) { mbCenter = bCenter; }
70
72};
73
77{
78private:
79 void init();
80
83 std::unique_ptr<const SubsetMap> pSubsetMap;
85 css::uno::Reference<css::frame::XFrame> m_xFrame;
86
88
90
91 std::unique_ptr<weld::Button> m_xOKBtn;
92 std::unique_ptr<weld::Label> m_xFontText;
93 std::unique_ptr<weld::ComboBox> m_xFontLB;
94 std::unique_ptr<weld::Label> m_xSubsetText;
95 std::unique_ptr<weld::ComboBox> m_xSubsetLB;
96 std::unique_ptr<weld::Entry> m_xSearchText;
97 std::unique_ptr<weld::Entry> m_xHexCodeText;
98 std::unique_ptr<weld::Entry> m_xDecimalCodeText;
99 std::unique_ptr<weld::Button> m_xFavouritesBtn;
100 std::unique_ptr<weld::Label> m_xCharName;
101 std::unique_ptr<weld::CustomWeld> m_xShowChar;
102 std::unique_ptr<SvxShowCharSet> m_xShowSet;
103 std::unique_ptr<weld::CustomWeld> m_xShowSetArea;
104 std::unique_ptr<SvxSearchCharSet> m_xSearchSet;
105 std::unique_ptr<weld::CustomWeld> m_xSearchSetArea;
106
107 std::unique_ptr<SfxAllItemSet> m_xOutputSet;
108
109 enum class Radix : sal_Int16
110 {
111 decimal = 10,
112 hexadecimal = 16
113 };
114
115 // inserts the character that is currently selected in the given SvxShowCharSet
116 void insertSelectedCharacter(const SvxShowCharSet* pCharSet);
117
118 DECL_DLLPRIVATE_LINK(FontSelectHdl, weld::ComboBox&, void);
119 DECL_DLLPRIVATE_LINK(SubsetSelectHdl, weld::ComboBox&, void);
120 DECL_DLLPRIVATE_LINK(CharDoubleClickHdl, SvxShowCharSet*, void);
121 DECL_DLLPRIVATE_LINK(CharSelectHdl, SvxShowCharSet*, void);
122 DECL_DLLPRIVATE_LINK(CharHighlightHdl, SvxShowCharSet*, void);
123 DECL_DLLPRIVATE_LINK(CharPreSelectHdl, SvxShowCharSet*, void);
124 DECL_DLLPRIVATE_LINK(ReturnKeypressOnCharHdl, SvxShowCharSet*, void);
126 DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void);
127 DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry&, void);
128 DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry&, void);
129 DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView*, void);
130 DECL_DLLPRIVATE_LINK(InsertClickHdl, weld::Button&, void);
131 DECL_DLLPRIVATE_LINK(FavSelectHdl, weld::Button&, void);
132 DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void);
133 DECL_DLLPRIVATE_LINK(SearchFieldGetFocusHdl, weld::Widget&, void);
134 DECL_DLLPRIVATE_LINK(UpdateFavHdl, void*, void);
135
136 static void fillAllSubsets(weld::ComboBox& rListBox);
137 void selectCharByCode(Radix radix);
138
139public:
140 SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet,
141 css::uno::Reference<css::frame::XFrame> xFrame);
142 virtual short run() override;
143
144 void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
145
146 const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
147
148 void DisableFontSelection();
149
150 const vcl::Font& GetCharFont() const { return aFont; }
151 void SetCharFont(const vcl::Font& rFont);
152
153 void SetChar(sal_UCS4);
154 sal_UCS4 GetChar() const;
155
156 void insertCharToDoc(const OUString& sChar);
157
158 void setFavButtonState(std::u16string_view sTitle, std::u16string_view rFont);
159
160 void setCharName(sal_UCS4 nDecimalValue);
161
162 void toggleSearchView(bool state);
163};
164
165#endif
166
167/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
FILE * init(int, char **)
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
Definition: cuicharmap.hxx:77
std::unique_ptr< SvxShowCharSet > m_xShowSet
Definition: cuicharmap.hxx:102
SvxShowText m_aShowChar
Definition: cuicharmap.hxx:89
DECL_DLLPRIVATE_LINK(InsertClickHdl, weld::Button &, void)
DECL_DLLPRIVATE_LINK(FavClickHdl, SvxShowCharSet *, void)
void set_title(const OUString &rTitle)
Definition: cuicharmap.hxx:144
vcl::Font aFont
Definition: cuicharmap.hxx:82
std::unique_ptr< weld::Label > m_xFontText
Definition: cuicharmap.hxx:92
std::unique_ptr< weld::Entry > m_xDecimalCodeText
Definition: cuicharmap.hxx:98
std::unique_ptr< weld::CustomWeld > m_xSearchSetArea
Definition: cuicharmap.hxx:105
DECL_DLLPRIVATE_LINK(FavSelectHdl, weld::Button &, void)
DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry &, void)
ScopedVclPtr< VirtualDevice > m_xVirDev
Definition: cuicharmap.hxx:81
DECL_DLLPRIVATE_LINK(CharPreSelectHdl, SvxShowCharSet *, void)
std::unique_ptr< weld::ComboBox > m_xFontLB
Definition: cuicharmap.hxx:93
DECL_DLLPRIVATE_LINK(ReturnKeypressOnCharHdl, SvxShowCharSet *, void)
std::unique_ptr< weld::Entry > m_xHexCodeText
Definition: cuicharmap.hxx:97
DECL_DLLPRIVATE_LINK(DecimalCodeChangeHdl, weld::Entry &, void)
DECL_DLLPRIVATE_LINK(CharSelectHdl, SvxShowCharSet *, void)
std::unique_ptr< weld::Label > m_xCharName
Definition: cuicharmap.hxx:100
const vcl::Font & GetCharFont() const
Definition: cuicharmap.hxx:150
std::unique_ptr< weld::CustomWeld > m_xShowChar
Definition: cuicharmap.hxx:101
std::unique_ptr< const SubsetMap > pSubsetMap
Definition: cuicharmap.hxx:83
std::unique_ptr< SvxSearchCharSet > m_xSearchSet
Definition: cuicharmap.hxx:104
DECL_DLLPRIVATE_LINK(SubsetSelectHdl, weld::ComboBox &, void)
DECL_DLLPRIVATE_LINK(HexCodeChangeHdl, weld::Entry &, void)
std::unique_ptr< weld::ComboBox > m_xSubsetLB
Definition: cuicharmap.hxx:95
std::unique_ptr< weld::Button > m_xOKBtn
Definition: cuicharmap.hxx:91
std::unique_ptr< weld::CustomWeld > m_xShowSetArea
Definition: cuicharmap.hxx:103
const SfxItemSet * GetOutputItemSet() const
Definition: cuicharmap.hxx:146
DECL_DLLPRIVATE_LINK(FontSelectHdl, weld::ComboBox &, void)
SfxCharmapContainer m_aCharmapContents
Definition: cuicharmap.hxx:87
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: cuicharmap.hxx:85
std::unique_ptr< weld::Entry > m_xSearchText
Definition: cuicharmap.hxx:96
DECL_DLLPRIVATE_LINK(SearchCharHighlightHdl, SvxShowCharSet *, void)
std::unique_ptr< weld::Button > m_xFavouritesBtn
Definition: cuicharmap.hxx:99
std::unique_ptr< weld::Label > m_xSubsetText
Definition: cuicharmap.hxx:94
DECL_DLLPRIVATE_LINK(CharClickHdl, SvxCharView *, void)
std::unique_ptr< SfxAllItemSet > m_xOutputSet
Definition: cuicharmap.hxx:107
DECL_DLLPRIVATE_LINK(SearchFieldGetFocusHdl, weld::Widget &, void)
DECL_DLLPRIVATE_LINK(CharDoubleClickHdl, SvxShowCharSet *, void)
DECL_DLLPRIVATE_LINK(CharHighlightHdl, SvxShowCharSet *, void)
DECL_DLLPRIVATE_LINK(UpdateFavHdl, void *, void)
Provides the show characters or texts in a drawing area with special sizes and fonts.
Definition: cuicharmap.hxx:50
Size get_preferred_size() const
Definition: cuicharmap.hxx:71
OUString m_sText
Definition: cuicharmap.hxx:53
tools::Long mnY
Definition: cuicharmap.hxx:54
vcl::Font m_aFont
Definition: cuicharmap.hxx:56
ScopedVclPtr< VirtualDevice > m_xVirDev
Definition: cuicharmap.hxx:52
vcl::Font const & GetFont() const
Definition: cuicharmap.hxx:66
OUString const & GetText() const
Definition: cuicharmap.hxx:68
void SetCentered(bool bCenter)
Definition: cuicharmap.hxx:69
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
weld::DrawingArea * GetDrawingArea() const
virtual Size get_preferred_size() const=0
#define CUI_DLLPUBLIC
Definition: cuidllapi.h:18
virtual void SetText(const OUString &rStr) override
Font m_aFont
def run(arg=None, arg2=-1)
long Long
sal_uInt32 sal_UCS4