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