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 #include "richtextviewport.hxx"
21 #include <editeng/editview.hxx>
23 //........................................................................
26 //........................................................................
28 //====================================================================
30 //====================================================================
31 //--------------------------------------------------------------------
32 RichTextViewPort::RichTextViewPort( Window
* _pParent
)
35 ,m_bHideInactiveSelection( true )
39 //--------------------------------------------------------------------
40 void RichTextViewPort::setView( EditView
& _rView
)
43 SetPointer( _rView
.GetPointer() );
46 //--------------------------------------------------------------------
47 void RichTextViewPort::Paint( const Rectangle
& _rRect
)
49 m_pView
->Paint( _rRect
);
52 //--------------------------------------------------------------------
53 void RichTextViewPort::GetFocus()
56 m_pView
->SetSelectionMode( EE_SELMODE_STD
);
57 m_pView
->ShowCursor( sal_True
);
60 //--------------------------------------------------------------------
61 void RichTextViewPort::LoseFocus()
63 m_pView
->HideCursor();
64 m_pView
->SetSelectionMode( m_bHideInactiveSelection
? EE_SELMODE_HIDDEN
: EE_SELMODE_STD
);
68 //--------------------------------------------------------------------
69 void RichTextViewPort::KeyInput( const KeyEvent
& _rKEvt
)
71 if ( !m_pView
->PostKeyEvent( _rKEvt
) )
72 Control::KeyInput( _rKEvt
);
74 implInvalidateAttributes();
77 //--------------------------------------------------------------------
78 void RichTextViewPort::MouseMove( const MouseEvent
& _rMEvt
)
80 Control::MouseMove( _rMEvt
);
81 m_pView
->MouseMove( _rMEvt
);
84 //--------------------------------------------------------------------
85 void RichTextViewPort::MouseButtonDown( const MouseEvent
& _rMEvt
)
87 Control::MouseButtonDown( _rMEvt
);
88 m_pView
->MouseButtonDown( _rMEvt
);
92 //--------------------------------------------------------------------
93 void RichTextViewPort::MouseButtonUp( const MouseEvent
& _rMEvt
)
95 Control::MouseButtonUp( _rMEvt
);
96 m_pView
->MouseButtonUp( _rMEvt
);
97 implInvalidateAttributes();
100 //--------------------------------------------------------------------
101 void RichTextViewPort::SetHideInactiveSelection( bool _bHide
)
103 if ( m_bHideInactiveSelection
== _bHide
)
105 m_bHideInactiveSelection
= _bHide
;
107 m_pView
->SetSelectionMode( m_bHideInactiveSelection
? EE_SELMODE_HIDDEN
: EE_SELMODE_STD
);
110 //--------------------------------------------------------------------
111 bool RichTextViewPort::GetHideInactiveSelection() const
113 return m_bHideInactiveSelection
;
116 //........................................................................
118 //........................................................................
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */