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 using namespace ::com::sun::star;
35 class SubsetMap;
36 
37 #define CHARMAP_MAXLEN 32
38 
39 namespace svx
40 {
41 struct SvxShowCharSetItem;
42 }
43 
46 {
47 private:
49  OUString m_sText;
50  long mnY;
51  bool mbCenter;
53 
54  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
55  virtual void Resize() override;
56  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
57 
58 public:
59  SvxShowText(const VclPtr<VirtualDevice>& rVirDev);
60 
61  void SetFont(const vcl::Font& rFont);
62  vcl::Font const& GetFont() const { return m_aFont; }
63  void SetText(const OUString& rText);
64  OUString const& GetText() const { return m_sText; }
65  void SetCentered(bool bCenter) { mbCenter = bCenter; }
66 
68 };
69 
73 {
74 private:
75  void init();
76 
79  std::unique_ptr<const SubsetMap> pSubsetMap;
81  css::uno::Reference<css::frame::XFrame> m_xFrame;
82  std::deque<OUString> maRecentCharList;
83  std::deque<OUString> maRecentCharFontList;
84  std::deque<OUString> maFavCharList;
85  std::deque<OUString> maFavCharFontList;
86  uno::Reference<uno::XComponentContext> mxContext;
87 
88  SvxCharView m_aRecentCharView[16];
89  SvxCharView m_aFavCharView[16];
91 
92  std::unique_ptr<weld::Button> m_xOKBtn;
93  std::unique_ptr<weld::Label> m_xFontText;
94  std::unique_ptr<weld::ComboBox> m_xFontLB;
95  std::unique_ptr<weld::Label> m_xSubsetText;
96  std::unique_ptr<weld::ComboBox> m_xSubsetLB;
97  std::unique_ptr<weld::Entry> m_xSearchText;
98  std::unique_ptr<weld::Entry> m_xHexCodeText;
99  std::unique_ptr<weld::Entry> m_xDecimalCodeText;
100  std::unique_ptr<weld::Button> m_xFavouritesBtn;
101  std::unique_ptr<weld::Label> m_xCharName;
102  std::unique_ptr<weld::Widget> m_xRecentGrid;
103  std::unique_ptr<weld::Widget> m_xFavGrid;
104  std::unique_ptr<weld::CustomWeld> m_xShowChar;
105  std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16];
106  std::unique_ptr<weld::CustomWeld> m_xFavCharView[16];
107  std::unique_ptr<SvxShowCharSet> m_xShowSet;
108  std::unique_ptr<weld::CustomWeld> m_xShowSetArea;
109  std::unique_ptr<SvxSearchCharSet> m_xSearchSet;
110  std::unique_ptr<weld::CustomWeld> m_xSearchSetArea;
111 
112  std::unique_ptr<SfxAllItemSet> m_xOutputSet;
113 
114  enum class Radix : sal_Int16
115  {
116  decimal = 10,
117  hexadecimal = 16
118  };
119 
120  DECL_LINK(FontSelectHdl, weld::ComboBox&, void);
121  DECL_LINK(SubsetSelectHdl, weld::ComboBox&, void);
122  DECL_LINK(CharDoubleClickHdl, SvxShowCharSet*, void);
123  DECL_LINK(CharSelectHdl, SvxShowCharSet*, void);
124  DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void);
125  DECL_LINK(CharPreSelectHdl, SvxShowCharSet*, void);
126  DECL_LINK(FavClickHdl, SvxShowCharSet*, void);
127  DECL_LINK(SearchCharDoubleClickHdl, SvxShowCharSet*, void);
128  DECL_LINK(SearchCharSelectHdl, SvxShowCharSet*, void);
129  DECL_LINK(SearchCharHighlightHdl, SvxShowCharSet*, void);
130  DECL_LINK(SearchCharPreSelectHdl, SvxShowCharSet*, void);
131  DECL_LINK(DecimalCodeChangeHdl, weld::Entry&, void);
132  DECL_LINK(HexCodeChangeHdl, weld::Entry&, void);
133  DECL_LINK(CharClickHdl, SvxCharView*, void);
134  DECL_LINK(RecentClearClickHdl, SvxCharView*, void);
135  DECL_LINK(FavClearClickHdl, SvxCharView*, void);
136  DECL_LINK(RecentClearAllClickHdl, SvxCharView*, void);
137  DECL_LINK(FavClearAllClickHdl, SvxCharView*, void);
138  DECL_LINK(InsertClickHdl, weld::Button&, void);
139  DECL_LINK(FavSelectHdl, weld::Button&, void);
140  DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
141  DECL_LINK(SearchFieldGetFocusHdl, weld::Widget&, void);
142 
143  static void fillAllSubsets(weld::ComboBox& rListBox);
144  void selectCharByCode(Radix radix);
145 
146 public:
147  SvxCharacterMap(weld::Widget* pParent, const SfxItemSet* pSet,
148  const css::uno::Reference<css::frame::XFrame>& rFrame);
149  virtual short run() override;
150 
151  void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
152 
153  const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); }
154 
155  void DisableFontSelection();
156 
157  const vcl::Font& GetCharFont() const { return aFont; }
158  void SetCharFont(const vcl::Font& rFont);
159 
160  void SetChar(sal_UCS4);
161  sal_UCS4 GetChar() const;
162 
163  void getRecentCharacterList(); //gets both recent char and recent char font list
164  void updateRecentCharacterList(const OUString& rChar, const OUString& rFont);
165 
166  void getFavCharacterList(); //gets both Fav char and Fav char font list
167  void updateFavCharacterList(const OUString& rChar, const OUString& rFont);
168  void deleteFavCharacterFromList(const OUString& rChar, const OUString& rFont);
169  bool isFavChar(const OUString& sTitle, const OUString& rFont);
170 
171  void updateRecentCharControl();
172  void insertCharToDoc(const OUString& sChar);
173 
174  void updateFavCharControl();
175  void setFavButtonState(const OUString& sTitle, const OUString& rFont);
176 
177  void setCharName(sal_UCS4 nDecimalValue);
178 
179  void toggleSearchView(bool state);
180 };
181 
182 #endif
183 
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxShowText m_aShowChar
Definition: cuicharmap.hxx:90
ScopedVclPtr< VirtualDevice > m_xVirDev
Definition: cuicharmap.hxx:48
std::unique_ptr< const SubsetMap > pSubsetMap
Definition: cuicharmap.hxx:79
std::unique_ptr< weld::CustomWeld > m_xShowChar
Definition: cuicharmap.hxx:104
std::unique_ptr< weld::Widget > m_xFavGrid
Definition: cuicharmap.hxx:103
std::unique_ptr< SvxSearchCharSet > m_xSearchSet
Definition: cuicharmap.hxx:109
std::deque< OUString > maRecentCharList
Definition: cuicharmap.hxx:82
const vcl::Font & GetCharFont() const
Definition: cuicharmap.hxx:157
OUString const & GetText() const
Definition: cuicharmap.hxx:64
ScopedVclPtr< VirtualDevice > m_xVirDev
Definition: cuicharmap.hxx:77
Provides the show characters or texts in a drawing area with special sizes and fonts.
Definition: cuicharmap.hxx:45
std::unique_ptr< SfxAllItemSet > m_xOutputSet
Definition: cuicharmap.hxx:112
OUString m_sText
Definition: cuicharmap.hxx:49
std::unique_ptr< weld::Widget > m_xRecentGrid
Definition: cuicharmap.hxx:102
std::unique_ptr< weld::Label > m_xFontText
Definition: cuicharmap.hxx:93
std::unique_ptr< weld::ComboBox > m_xSubsetLB
Definition: cuicharmap.hxx:96
std::deque< OUString > maFavCharList
Definition: cuicharmap.hxx:84
def run
std::unique_ptr< weld::Entry > m_xDecimalCodeText
Definition: cuicharmap.hxx:99
uno::Reference< uno::XComponentContext > mxContext
Definition: cuicharmap.hxx:86
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: cuicharmap.hxx:81
std::unique_ptr< SvxShowCharSet > m_xShowSet
Definition: cuicharmap.hxx:107
std::unique_ptr< weld::Button > m_xFavouritesBtn
Definition: cuicharmap.hxx:100
vcl::Font m_aFont
Definition: cuicharmap.hxx:52
std::unique_ptr< weld::Entry > m_xHexCodeText
Definition: cuicharmap.hxx:98
const SfxItemSet * GetOutputItemSet() const
Definition: cuicharmap.hxx:153
std::unique_ptr< weld::CustomWeld > m_xSearchSetArea
Definition: cuicharmap.hxx:110
#define CUI_DLLPUBLIC
Definition: cuidllapi.h:18
std::unique_ptr< weld::Entry > m_xSearchText
Definition: cuicharmap.hxx:97
vcl::Font aFont
Definition: cuicharmap.hxx:78
virtual Size get_preferred_size() const =0
void set_title(const OUString &rTitle)
Definition: cuicharmap.hxx:151
std::deque< OUString > maFavCharFontList
Definition: cuicharmap.hxx:85
weld::DrawingArea * GetDrawingArea() const
std::deque< OUString > maRecentCharFontList
Definition: cuicharmap.hxx:83
std::unique_ptr< weld::CustomWeld > m_xShowSetArea
Definition: cuicharmap.hxx:108
Reference< XExecutableDialog > m_xDialog
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
FILE * init(int, char **)
Size get_preferred_size() const
Definition: cuicharmap.hxx:67
std::unique_ptr< weld::ComboBox > m_xFontLB
Definition: cuicharmap.hxx:94
void SetCentered(bool bCenter)
Definition: cuicharmap.hxx:65
vcl::Font const & GetFont() const
Definition: cuicharmap.hxx:62
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
Definition: cuicharmap.hxx:72
sal_uInt32 sal_UCS4
std::unique_ptr< weld::Button > m_xOKBtn
Definition: cuicharmap.hxx:92
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
std::unique_ptr< weld::Label > m_xSubsetText
Definition: cuicharmap.hxx:95
std::unique_ptr< weld::Label > m_xCharName
Definition: cuicharmap.hxx:101