LibreOffice Module forms (master) 1
richtextviewport.cxx
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#include "richtextviewport.hxx"
21#include <editeng/editview.hxx>
22
23namespace frm
24{
26 : Control ( _pParent )
27 , m_pView(nullptr)
28 , m_bHideInactiveSelection( true )
29 {
30 }
31
33 {
34 m_pView = &_rView;
35 SetPointer( _rView.GetPointer() );
36 }
37
38 void RichTextViewPort::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& _rRect )
39 {
40 m_pView->Paint(_rRect, &rRenderContext);
41 }
42
44 {
46 if (m_pView)
47 {
48 m_pView->SetSelectionMode( EESelectionMode::Std );
50 }
51 }
52
54 {
55 if (m_pView)
56 {
58 m_pView->SetSelectionMode( m_bHideInactiveSelection ? EESelectionMode::Hidden : EESelectionMode::Std );
59 }
61 }
62
64 {
65 if ( !m_pView->PostKeyEvent( _rKEvt ) )
66 Control::KeyInput( _rKEvt );
67 else
69 }
70
72 {
73 Control::MouseMove( _rMEvt );
74 m_pView->MouseMove( _rMEvt );
75 }
76
78 {
80 m_pView->MouseButtonDown( _rMEvt );
81 GrabFocus();
82 }
83
85 {
86 Control::MouseButtonUp( _rMEvt );
87 m_pView->MouseButtonUp( _rMEvt );
89 }
90
92 {
93 if ( m_bHideInactiveSelection == _bHide )
94 return;
96 if ( !HasFocus() )
97 m_pView->SetSelectionMode( m_bHideInactiveSelection ? EESelectionMode::Hidden : EESelectionMode::Std );
98 }
99
100} // namespace frm
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool MouseButtonUp(const MouseEvent &rMouseEvent)
void SetSelectionMode(EESelectionMode eMode)
void HideCursor(bool bDeactivate=false)
bool MouseButtonDown(const MouseEvent &rMouseEvent)
bool PostKeyEvent(const KeyEvent &rKeyEvent, vcl::Window const *pFrameWin=nullptr)
void ShowCursor(bool bGotoCursor=true, bool bForceVisCursor=true, bool bActivate=false)
PointerStyle GetPointer() const
bool MouseMove(const MouseEvent &rMouseEvent)
void Paint(const tools::Rectangle &rRect, OutputDevice *pTargetDevice=nullptr)
void SetHideInactiveSelection(bool _bHide)
virtual void KeyInput(const KeyEvent &_rKEvt) override
RichTextViewPort(vcl::Window *_pParent)
virtual void MouseButtonUp(const MouseEvent &_rMEvt) override
void implInvalidateAttributes() const
virtual void MouseMove(const MouseEvent &_rMEvt) override
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual void MouseButtonDown(const MouseEvent &_rMEvt) override
virtual void GetFocus() override
void setView(EditView &_rView)
virtual void LoseFocus() override
virtual void GetFocus()
void GrabFocus()
bool HasFocus() const
virtual void MouseButtonDown(const MouseEvent &rMEvt)
virtual void MouseButtonUp(const MouseEvent &rMEvt)
virtual void KeyInput(const KeyEvent &rKEvt)
virtual void MouseMove(const MouseEvent &rMEvt)
virtual void LoseFocus()
virtual void SetPointer(PointerStyle)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25