LCOV - code coverage report
Current view: top level - forms/source/richtext - richtextviewport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 47 31.9 %
Date: 2012-08-25 Functions: 4 11 36.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 12 50.0 %

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

Generated by: LCOV version 1.10