1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_INC_CHARWIN_HXX
21 #define INCLUDED_SFX2_INC_CHARWIN_HXX
23 #include <sfx2/dllapi.h>
24 #include <vcl/ctrl.hxx>
25 #include <vcl/customweld.hxx>
26 #include <vcl/virdev.hxx>
27 #include <vcl/weld.hxx>
29 class SFX2_DLLPUBLIC SvxCharView final
: public weld::CustomWidgetController
32 VclPtr
<VirtualDevice
> mxVirDev
;
39 Link
<SvxCharView
*, void> maMouseClickHdl
;
40 Link
<SvxCharView
*, void> maClearClickHdl
;
41 Link
<SvxCharView
*, void> maClearAllClickHdl
;
43 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
44 virtual void Resize() override
;
45 virtual bool MouseButtonDown(const MouseEvent
&) override
;
46 virtual void GetFocus() override
;
47 virtual void LoseFocus() override
;
48 virtual bool KeyInput(const KeyEvent
&) override
;
49 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
51 SvxCharView(const VclPtr
<VirtualDevice
>& rVirDev
);
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();
60 void createContextMenu();
62 Size
get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); }
64 void connect_focus_in(const Link
<weld::Widget
&, void>& rLink
);
65 void connect_focus_out(const Link
<weld::Widget
&, void>& rLink
);
67 void setMouseClickHdl(const Link
<SvxCharView
*,void> &rLink
);
68 void setClearClickHdl(const Link
<SvxCharView
*,void> &rLink
);
69 void setClearAllClickHdl(const Link
<SvxCharView
*,void> &rLink
);
71 void ContextMenuSelect(const OString
& rIdent
);
74 class SvxCharViewControl final
: public Control
77 SvxCharViewControl(vcl::Window
* pParent
);
79 void SetFont( const vcl::Font
& rFont
);
80 void SetText( const OUString
& rText
) override
;
81 void InsertCharToDoc();
83 void createContextMenu();
85 virtual void Resize() override
;
87 virtual Size
GetOptimalSize() const override
;
89 void setMouseClickHdl(const Link
<SvxCharViewControl
*,void> &rLink
);
92 virtual void Paint(vcl::RenderContext
& rRenderContext
, const ::tools::Rectangle
&) override
;
94 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
96 virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
102 Link
<SvxCharViewControl
*, void> maMouseClickHdl
;
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */