LibreOffice Module sfx2 (master) 1
charwin.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#ifndef INCLUDED_SFX2_INC_CHARWIN_HXX
21#define INCLUDED_SFX2_INC_CHARWIN_HXX
22
23#include <sfx2/dllapi.h>
24#include <vcl/customweld.hxx>
25#include <vcl/virdev.hxx>
26#include <vcl/weld.hxx>
27#include <deque>
28
30{
31private:
36 OUString m_sText;
37
41
42 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
43 virtual void Resize() override;
44 virtual bool MouseButtonDown(const MouseEvent&) override;
45 virtual void GetFocus() override;
46 virtual void LoseFocus() override;
47 virtual bool KeyInput(const KeyEvent&) override;
48 virtual bool Command(const CommandEvent&) override;
49 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
50public:
51 SvxCharView(const VclPtr<VirtualDevice>& rVirDev);
52
53 void SetFont( const vcl::Font& rFont );
54 vcl::Font const & GetFont() const { return maFont; }
55 void SetText( const OUString& rText );
56 OUString const & GetText() const { return m_sText; }
57 void SetHasInsert( bool bInsert );
58 void InsertCharToDoc();
59
60 void createContextMenu(const Point& rPosition);
61
63
64 void setMouseClickHdl(const Link<SvxCharView*,void> &rLink);
65 void setClearClickHdl(const Link<SvxCharView*,void> &rLink);
66 void setClearAllClickHdl(const Link<SvxCharView*,void> &rLink);
67
68 void ContextMenuSelect(std::u16string_view rIdent);
69};
70
72{
73 std::deque<OUString> m_aRecentCharList;
74 std::deque<OUString> m_aRecentCharFontList;
75 std::deque<OUString> m_aFavCharList;
76 std::deque<OUString> m_aFavCharFontList;
77
78 SvxCharView m_aRecentCharView[16];
79 SvxCharView m_aFavCharView[16];
80 std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16];
81 std::unique_ptr<weld::CustomWeld> m_xFavCharView[16];
82
83 std::unique_ptr<weld::Widget> m_xRecentGrid;
84 std::unique_ptr<weld::Widget> m_xFavGrid;
85
88
89 DECL_DLLPRIVATE_LINK(RecentClearClickHdl, SvxCharView*, void);
90 DECL_DLLPRIVATE_LINK(FavClearClickHdl, SvxCharView*, void);
91 DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, SvxCharView*, void);
92 DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, SvxCharView*, void);
93
94public:
96
97 void init(bool bHasInsert, const Link<SvxCharView*,void> &rMouseClickHdl,
98 const Link<void*,void> &rUpdateFavHdl,
99 const Link<void*,void> &rUpdateRecentHdl);
100
101 void getFavCharacterList();
102 void updateFavCharControl();
103
104 void getRecentCharacterList(); //gets both recent char and recent char font list
105 void updateRecentCharControl();
106
107 void updateRecentCharacterList(const OUString& sTitle, const OUString& rFont);
108 void updateFavCharacterList(const OUString& sTitle, const OUString& rFont);
109 void deleteFavCharacterFromList(std::u16string_view sTitle, std::u16string_view rFont);
110
111 bool isFavChar(std::u16string_view sTitle, std::u16string_view rFont);
112 bool hasRecentChars() const;
113
114 bool FavCharListIsFull() const;
115
116 void GrabFocusToFirstFavorite();
117
118private:
119 std::pair<std::deque<OUString>::const_iterator, std::deque<OUString>::const_iterator>
120 getRecentChar(std::u16string_view sTitle, std::u16string_view rFont) const;
121
122 std::pair<std::deque<OUString>::const_iterator, std::deque<OUString>::const_iterator>
123 getFavChar(std::u16string_view sTitle, std::u16string_view rFont) const;
124};
125
126#endif
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
std::unique_ptr< weld::Widget > m_xRecentGrid
Definition: charwin.hxx:83
DECL_DLLPRIVATE_LINK(RecentClearAllClickHdl, SvxCharView *, void)
std::deque< OUString > m_aFavCharList
Definition: charwin.hxx:75
DECL_DLLPRIVATE_LINK(FavClearAllClickHdl, SvxCharView *, void)
DECL_DLLPRIVATE_LINK(FavClearClickHdl, SvxCharView *, void)
std::deque< OUString > m_aFavCharFontList
Definition: charwin.hxx:76
std::unique_ptr< weld::Widget > m_xFavGrid
Definition: charwin.hxx:84
DECL_DLLPRIVATE_LINK(RecentClearClickHdl, SvxCharView *, void)
Link< void *, void > m_aUpdateFavHdl
Definition: charwin.hxx:86
std::deque< OUString > m_aRecentCharFontList
Definition: charwin.hxx:74
std::deque< OUString > m_aRecentCharList
Definition: charwin.hxx:73
Link< void *, void > m_aUpdateRecentHdl
Definition: charwin.hxx:87
Size get_preferred_size() const
Definition: charwin.hxx:62
vcl::Font const & GetFont() const
Definition: charwin.hxx:54
Link< SvxCharView *, void > maClearClickHdl
Definition: charwin.hxx:39
bool maHasInsert
Definition: charwin.hxx:35
vcl::Font maFont
Definition: charwin.hxx:34
tools::Long mnY
Definition: charwin.hxx:33
Link< SvxCharView *, void > maMouseClickHdl
Definition: charwin.hxx:38
VclPtr< VirtualDevice > mxVirDev
Definition: charwin.hxx:32
Link< SvxCharView *, void > maClearAllClickHdl
Definition: charwin.hxx:40
OUString const & GetText() const
Definition: charwin.hxx:56
OUString m_sText
Definition: charwin.hxx:36
virtual bool KeyInput(const KeyEvent &)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
virtual bool MouseButtonDown(const MouseEvent &)
weld::DrawingArea * GetDrawingArea() const
virtual bool Command(const CommandEvent &)
virtual Size get_preferred_size() const=0
virtual void SetText(const OUString &rStr) override
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
static void init(struct DocumentMetadataAccess_Impl &i_rImpl)
init Impl struct
long Long