LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/view - selectionstate.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 26 3.8 %
Date: 2012-12-27 Functions: 2 4 50.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 "selectionstate.hxx"
      21             : 
      22             : #include <editeng/editview.hxx>
      23             : #include "viewdata.hxx"
      24             : #include "markdata.hxx"
      25             : 
      26             : // ============================================================================
      27             : 
      28           0 : ScSelectionState::ScSelectionState( ScViewData& rViewData ) :
      29           0 :     meType( SC_SELECTTYPE_NONE )
      30             : {
      31           0 :     maCursor.SetTab( rViewData.GetTabNo() );
      32           0 :     ScSplitPos eWhich = rViewData.GetActivePart();
      33             : 
      34           0 :     if( rViewData.HasEditView( eWhich ) )
      35             :     {
      36           0 :         meType = SC_SELECTTYPE_EDITCELL;
      37           0 :         maCursor.SetCol( rViewData.GetEditViewCol() );
      38           0 :         maCursor.SetRow( rViewData.GetEditViewRow() );
      39           0 :         maEditSel = rViewData.GetEditView( eWhich )->GetSelection();
      40             :     }
      41             :     else
      42             :     {
      43           0 :         maCursor.SetCol( rViewData.GetCurX() );
      44           0 :         maCursor.SetRow( rViewData.GetCurY() );
      45             : 
      46           0 :         ScMarkData& rMarkData = rViewData.GetMarkData();
      47           0 :         rMarkData.MarkToMulti();
      48           0 :         if( rMarkData.IsMultiMarked() )
      49             :         {
      50           0 :             meType = SC_SELECTTYPE_SHEET;
      51           0 :             rMarkData.FillRangeListWithMarks( &maSheetSel, false );
      52             :         }
      53             :         // else type is SC_SELECTTYPE_NONE - already initialized
      54             :     }
      55           0 : }
      56             : 
      57           0 : bool operator==( const ScSelectionState& rL, const ScSelectionState& rR )
      58             : {
      59           0 :     bool bEqual = rL.GetSelectionType() == rR.GetSelectionType();
      60           0 :     if( bEqual ) switch( rL.GetSelectionType() )
      61             :     {
      62             :         case SC_SELECTTYPE_EDITCELL:
      63           0 :             bEqual &= ( rL.GetEditSelection().IsEqual( rR.GetEditSelection() ) != false );
      64             :         // run through!
      65             :         case SC_SELECTTYPE_SHEET:
      66           0 :             bEqual &= (rL.GetSheetSelection() == rR.GetSheetSelection()) == sal_True;
      67             :         // run through!
      68             :         case SC_SELECTTYPE_NONE:
      69           0 :             bEqual &= rL.GetCellCursor() == rR.GetCellCursor();
      70           0 :         break;
      71             :         default:
      72             :         {
      73             :             // added to avoid warnings
      74             :         }
      75             :     }
      76           0 :     return bEqual;
      77          15 : }
      78             : 
      79             : // ============================================================================
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10