LCOV - code coverage report
Current view: top level - svtools/source/brwbox - brwhead.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 38 18.4 %
Date: 2012-08-25 Functions: 1 4 25.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 42 11.9 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <svtools/brwhead.hxx>
      31                 :            : #include <svtools/brwbox.hxx>
      32                 :            : 
      33                 :            : //===================================================================
      34                 :            : 
      35                 :         80 : BrowserHeader::BrowserHeader( BrowseBox* pParent, WinBits nWinBits )
      36                 :            :  :HeaderBar( pParent, nWinBits )
      37                 :         80 :  ,_pBrowseBox( pParent )
      38                 :            : {
      39 [ -  + ][ #  # ]:         80 :     long nHeight = pParent->IsZoom() ? pParent->CalcZoom(pParent->GetTitleHeight()) : pParent->GetTitleHeight();
         [ #  # ][ +  - ]
                 [ +  - ]
      40                 :            : 
      41                 :            :     SetPosSizePixel( Point( 0, 0),
      42                 :         80 :                      Size( pParent->GetOutputSizePixel().Width(),
      43         [ +  - ]:         80 :                            nHeight ) );
      44         [ +  - ]:         80 :     Show();
      45                 :         80 : }
      46                 :            : 
      47                 :            : //-------------------------------------------------------------------
      48                 :            : 
      49                 :          0 : void BrowserHeader::Command( const CommandEvent& rCEvt )
      50                 :            : {
      51 [ #  # ][ #  # ]:          0 :     if ( !GetCurItemId() && COMMAND_CONTEXTMENU == rCEvt.GetCommand() )
                 [ #  # ]
      52                 :            :     {
      53                 :          0 :         Point aPos( rCEvt.GetMousePosPixel() );
      54 [ #  # ][ #  # ]:          0 :         if ( _pBrowseBox->IsFrozen(0) )
      55         [ #  # ]:          0 :             aPos.X() += _pBrowseBox->GetColumnWidth(0);
      56                 :          0 :         _pBrowseBox->GetDataWindow().Command( CommandEvent(
      57         [ #  # ]:          0 :                 Point( aPos.X(), aPos.Y() - GetSizePixel().Height() ),
      58 [ #  # ][ #  # ]:          0 :                 COMMAND_CONTEXTMENU, rCEvt.IsMouseEvent() ) );
      59                 :            :     }
      60                 :          0 : }
      61                 :            : 
      62                 :            : //-------------------------------------------------------------------
      63                 :            : 
      64                 :          0 : void BrowserHeader::Select()
      65                 :            : {
      66                 :          0 :     HeaderBar::Select();
      67                 :          0 : }
      68                 :            : 
      69                 :            : //-------------------------------------------------------------------
      70                 :            : 
      71                 :          0 : void BrowserHeader::EndDrag()
      72                 :            : {
      73                 :            :     // call before other actions, it looks more nice in most cases
      74                 :          0 :     HeaderBar::EndDrag();
      75                 :          0 :     Update();
      76                 :            : 
      77                 :            :     // not aborted?
      78                 :          0 :     sal_uInt16 nId = GetCurItemId();
      79         [ #  # ]:          0 :     if ( nId )
      80                 :            :     {
      81                 :            :         // handle column?
      82         [ #  # ]:          0 :         if ( nId == USHRT_MAX-1 )
      83                 :          0 :             nId = 0;
      84                 :            : 
      85         [ #  # ]:          0 :         if ( !IsItemMode() )
      86                 :            :         {
      87                 :            :             // column resize
      88                 :          0 :             _pBrowseBox->SetColumnWidth( nId, GetItemSize( nId ) );
      89                 :          0 :             _pBrowseBox->ColumnResized( nId );
      90                 :          0 :             SetItemSize( nId, _pBrowseBox->GetColumnWidth( nId ) );
      91                 :            :         }
      92                 :            :         else
      93                 :            :         {
      94                 :            :             // column drag
      95                 :            :             // did the position actually change?
      96                 :            :             // take the handle column into account
      97                 :          0 :             sal_uInt16 nOldPos = _pBrowseBox->GetColumnPos(nId),
      98                 :          0 :                 nNewPos = GetItemPos( nId );
      99                 :            : 
     100         [ #  # ]:          0 :             if (_pBrowseBox->GetColumnId(0) == BrowseBox::HandleColumnId)
     101                 :          0 :                 nNewPos++;
     102                 :            : 
     103         [ #  # ]:          0 :             if (nOldPos != nNewPos)
     104                 :            :             {
     105                 :          0 :                 _pBrowseBox->SetColumnPos( nId, nNewPos );
     106                 :          0 :                 _pBrowseBox->ColumnMoved( nId );
     107                 :            :             }
     108                 :            :         }
     109                 :            :     }
     110                 :          0 : }
     111                 :            : // -----------------------------------------------------------------------------
     112                 :            : 
     113                 :            : 
     114                 :            : 
     115                 :            : 
     116                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10