LCOV - code coverage report
Current view: top level - forms/source/richtext - richtextviewport.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 47 0.0 %
Date: 2014-04-14 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      23             : 
      24             : namespace frm
      25             : {
      26             : 
      27             : 
      28             : 
      29             :     //= RichTextViewPort
      30             : 
      31             : 
      32           0 :     RichTextViewPort::RichTextViewPort( Window* _pParent )
      33             :         :Control ( _pParent )
      34             :         ,m_pView(NULL)
      35           0 :         ,m_bHideInactiveSelection( true )
      36             :     {
      37           0 :     }
      38             : 
      39             : 
      40           0 :     void RichTextViewPort::setView( EditView& _rView )
      41             :     {
      42           0 :         m_pView = &_rView;
      43           0 :         SetPointer( _rView.GetPointer() );
      44           0 :     }
      45             : 
      46             : 
      47           0 :     void RichTextViewPort::Paint( const Rectangle& _rRect )
      48             :     {
      49           0 :         m_pView->Paint( _rRect );
      50           0 :     }
      51             : 
      52             : 
      53           0 :     void RichTextViewPort::GetFocus()
      54             :     {
      55           0 :         Control::GetFocus();
      56           0 :         m_pView->SetSelectionMode( EE_SELMODE_STD );
      57           0 :         m_pView->ShowCursor( true );
      58           0 :     }
      59             : 
      60             : 
      61           0 :     void RichTextViewPort::LoseFocus()
      62             :     {
      63           0 :         m_pView->HideCursor();
      64           0 :         m_pView->SetSelectionMode( m_bHideInactiveSelection ? EE_SELMODE_HIDDEN : EE_SELMODE_STD );
      65           0 :         Control::LoseFocus();
      66           0 :     }
      67             : 
      68             : 
      69           0 :     void RichTextViewPort::KeyInput( const KeyEvent& _rKEvt )
      70             :     {
      71           0 :         if ( !m_pView->PostKeyEvent( _rKEvt ) )
      72           0 :             Control::KeyInput( _rKEvt );
      73             :         else
      74           0 :             implInvalidateAttributes();
      75           0 :     }
      76             : 
      77             : 
      78           0 :     void RichTextViewPort::MouseMove( const MouseEvent& _rMEvt )
      79             :     {
      80           0 :         Control::MouseMove( _rMEvt );
      81           0 :         m_pView->MouseMove( _rMEvt );
      82           0 :     }
      83             : 
      84             : 
      85           0 :     void RichTextViewPort::MouseButtonDown( const MouseEvent& _rMEvt )
      86             :     {
      87           0 :         Control::MouseButtonDown( _rMEvt );
      88           0 :         m_pView->MouseButtonDown( _rMEvt );
      89           0 :         GrabFocus();
      90           0 :     }
      91             : 
      92             : 
      93           0 :     void RichTextViewPort::MouseButtonUp( const MouseEvent& _rMEvt )
      94             :     {
      95           0 :         Control::MouseButtonUp( _rMEvt );
      96           0 :         m_pView->MouseButtonUp( _rMEvt );
      97           0 :         implInvalidateAttributes();
      98           0 :     }
      99             : 
     100             : 
     101           0 :     void RichTextViewPort::SetHideInactiveSelection( bool _bHide )
     102             :     {
     103           0 :         if ( m_bHideInactiveSelection == _bHide )
     104           0 :             return;
     105           0 :         m_bHideInactiveSelection = _bHide;
     106           0 :         if ( !HasFocus() )
     107           0 :             m_pView->SetSelectionMode( m_bHideInactiveSelection ? EE_SELMODE_HIDDEN : EE_SELMODE_STD );
     108             :     }
     109             : 
     110             : 
     111           0 :     bool RichTextViewPort::GetHideInactiveSelection() const
     112             :     {
     113           0 :         return m_bHideInactiveSelection;
     114             :     }
     115             : 
     116             : 
     117             : }   // namespace frm
     118             : 
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10