LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - fumark.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 75 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 64 0.0 %

           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 <sfx2/dispatch.hxx>
      31                 :            : #include <sfx2/viewfrm.hxx>
      32                 :            : 
      33                 :            : #include "fumark.hxx"
      34                 :            : #include "sc.hrc"
      35                 :            : #include "tabvwsh.hxx"
      36                 :            : #include "scmod.hxx"
      37                 :            : #include "reffact.hxx"
      38                 :            : #include "document.hxx"
      39                 :            : #include "scresid.hxx"
      40                 :            : #include "drawview.hxx"
      41                 :            : #include "markdata.hxx"
      42                 :            : 
      43                 :            : //------------------------------------------------------------------
      44                 :            : 
      45                 :            : /*************************************************************************
      46                 :            : |*
      47                 :            : |* Funktion zum Aufziehen eines Rechtecks
      48                 :            : |*
      49                 :            : \************************************************************************/
      50                 :            : 
      51                 :          0 : FuMarkRect::FuMarkRect(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
      52                 :            :                SdrModel* pDoc, SfxRequest& rReq) :
      53                 :            :     FuPoor(pViewSh, pWin, pViewP, pDoc, rReq),
      54                 :            :     bVisible(false),
      55         [ #  # ]:          0 :     bStartDrag(false)
      56                 :            : {
      57                 :          0 : }
      58                 :            : 
      59                 :            : /*************************************************************************
      60                 :            : |*
      61                 :            : |* Destruktor
      62                 :            : |*
      63                 :            : \************************************************************************/
      64                 :            : 
      65         [ #  # ]:          0 : FuMarkRect::~FuMarkRect()
      66                 :            : {
      67         [ #  # ]:          0 : }
      68                 :            : 
      69                 :            : /*************************************************************************
      70                 :            : |*
      71                 :            : |* MouseButtonDown-event
      72                 :            : |*
      73                 :            : \************************************************************************/
      74                 :            : 
      75                 :          0 : sal_Bool FuMarkRect::MouseButtonDown(const MouseEvent& rMEvt)
      76                 :            : {
      77                 :            :     // remember button state for creation of own MouseEvents
      78                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
      79                 :            : 
      80                 :          0 :     pWindow->CaptureMouse();
      81                 :          0 :     pView->UnmarkAll();         // der Einheitlichkeit halber und wegen #50558#
      82                 :          0 :     bStartDrag = sal_True;
      83                 :            : 
      84                 :          0 :     aBeginPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
      85         [ #  # ]:          0 :     aZoomRect = Rectangle( aBeginPos, Size() );
      86                 :          0 :     return sal_True;
      87                 :            : }
      88                 :            : 
      89                 :            : /*************************************************************************
      90                 :            : |*
      91                 :            : |* MouseMove-event
      92                 :            : |*
      93                 :            : \************************************************************************/
      94                 :            : 
      95                 :          0 : sal_Bool FuMarkRect::MouseMove(const MouseEvent& rMEvt)
      96                 :            : {
      97         [ #  # ]:          0 :     if ( bStartDrag )
      98                 :            :     {
      99         [ #  # ]:          0 :         if ( bVisible )
     100         [ #  # ]:          0 :             pViewShell->DrawMarkRect(aZoomRect);
     101                 :          0 :         Point aPixPos= rMEvt.GetPosPixel();
     102         [ #  # ]:          0 :         ForceScroll(aPixPos);
     103                 :            : 
     104         [ #  # ]:          0 :         Point aEndPos = pWindow->PixelToLogic(aPixPos);
     105         [ #  # ]:          0 :         Rectangle aRect(aBeginPos, aEndPos);
     106                 :          0 :         aZoomRect = aRect;
     107         [ #  # ]:          0 :         aZoomRect.Justify();
     108         [ #  # ]:          0 :         pViewShell->DrawMarkRect(aZoomRect);
     109                 :          0 :         bVisible = sal_True;
     110                 :            :     }
     111                 :            : 
     112                 :          0 :     ForcePointer(&rMEvt);
     113                 :            : 
     114                 :          0 :     return bStartDrag;
     115                 :            : }
     116                 :            : 
     117                 :            : /*************************************************************************
     118                 :            : |*
     119                 :            : |* MouseButtonUp-event
     120                 :            : |*
     121                 :            : \************************************************************************/
     122                 :            : 
     123                 :          0 : sal_Bool FuMarkRect::MouseButtonUp(const MouseEvent& rMEvt)
     124                 :            : {
     125                 :            :     // remember button state for creation of own MouseEvents
     126                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     127                 :            : 
     128         [ #  # ]:          0 :     if ( bVisible )
     129                 :            :     {
     130                 :            :         // Hide ZoomRect
     131         [ #  # ]:          0 :         pViewShell->DrawMarkRect(aZoomRect);
     132                 :          0 :         bVisible = false;
     133                 :            :     }
     134                 :            : 
     135 [ #  # ][ #  # ]:          0 :     Size aZoomSizePixel = pWindow->LogicToPixel(aZoomRect).GetSize();
     136                 :            : 
     137                 :          0 :     sal_uInt16 nMinMove = pView->GetMinMoveDistancePixel();
     138 [ #  # ][ #  # ]:          0 :     if ( aZoomSizePixel.Width() < nMinMove || aZoomSizePixel.Height() < nMinMove )
                 [ #  # ]
     139                 :            :     {
     140                 :            :         // Klick auf der Stelle
     141                 :            : 
     142         [ #  # ]:          0 :         aZoomRect.SetSize(Size());      // dann ganz leer
     143                 :            :     }
     144                 :            : 
     145                 :          0 :     bStartDrag = false;
     146         [ #  # ]:          0 :     pWindow->ReleaseMouse();
     147                 :            : 
     148         [ #  # ]:          0 :     pViewShell->GetViewData()->GetDispatcher().
     149         [ #  # ]:          0 :         Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
     150                 :            : 
     151                 :            :         //  Daten an der View merken
     152                 :            : 
     153         [ #  # ]:          0 :     pViewShell->SetChartArea( aSourceRange, aZoomRect );
     154                 :            : 
     155                 :            :         //  Chart-Dialog starten:
     156                 :            : 
     157                 :            : //  sal_uInt16 nId  = ScChartDlgWrapper::GetChildWindowId();
     158                 :            : //  SfxChildWindow* pWnd = pViewShell->GetViewFrame()->GetChildWindow( nId );
     159                 :            : //  SC_MOD()->SetRefDialog( nId, pWnd ? sal_False : sal_True );
     160                 :            : 
     161                 :          0 :     return sal_True;
     162                 :            : }
     163                 :            : 
     164                 :            : /*************************************************************************
     165                 :            : |*
     166                 :            : |* Command-event
     167                 :            : |*
     168                 :            : \************************************************************************/
     169                 :            : 
     170                 :          0 : sal_uInt8 FuMarkRect::Command(const CommandEvent& rCEvt)
     171                 :            : {
     172         [ #  # ]:          0 :     if ( COMMAND_STARTDRAG == rCEvt.GetCommand() )
     173                 :            :     {
     174                 :            :         //  nicht anfangen, auf der Tabelle rumzudraggen,
     175                 :            :         //  aber Maus-Status nicht zuruecksetzen
     176                 :          0 :         return SC_CMD_IGNORE;
     177                 :            :     }
     178                 :            :     else
     179                 :          0 :         return FuPoor::Command(rCEvt);
     180                 :            : }
     181                 :            : 
     182                 :            : /*************************************************************************
     183                 :            : |*
     184                 :            : |* Tastaturereignisse bearbeiten
     185                 :            : |*
     186                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     187                 :            : |* FALSE.
     188                 :            : |*
     189                 :            : \************************************************************************/
     190                 :            : 
     191                 :          0 : sal_Bool FuMarkRect::KeyInput(const KeyEvent& rKEvt)
     192                 :            : {
     193                 :          0 :     sal_Bool bReturn = false;
     194                 :            : 
     195         [ #  # ]:          0 :     switch ( rKEvt.GetKeyCode().GetCode() )
     196                 :            :     {
     197                 :            :         case KEY_ESCAPE:
     198                 :            :             //  beenden
     199                 :          0 :             pViewShell->GetViewData()->GetDispatcher().
     200                 :          0 :                 Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     201                 :          0 :             bReturn = sal_True;
     202                 :          0 :             break;
     203                 :            :     }
     204                 :            : 
     205         [ #  # ]:          0 :     if (!bReturn)
     206                 :            :     {
     207                 :          0 :         bReturn = FuPoor::KeyInput(rKEvt);
     208                 :            :     }
     209                 :            : 
     210                 :          0 :     return (bReturn);
     211                 :            : }
     212                 :            : 
     213                 :            : /*************************************************************************
     214                 :            : |*
     215                 :            : |* Function aktivieren
     216                 :            : |*
     217                 :            : \************************************************************************/
     218                 :            : 
     219                 :          0 : void FuMarkRect::Activate()
     220                 :            : {
     221                 :          0 :     FuPoor::Activate();
     222                 :            : 
     223                 :            :         //  Markierung merken, bevor evtl. Tabelle umgeschaltet wird
     224                 :            : 
     225                 :          0 :     ScViewData* pViewData = pViewShell->GetViewData();
     226                 :          0 :     ScMarkData& rMark = pViewData->GetMarkData();
     227                 :            : 
     228 [ #  # ][ #  # ]:          0 :     if ( !rMark.IsMultiMarked() && !rMark.IsMarked() )
                 [ #  # ]
     229                 :          0 :         pViewShell->MarkDataArea( sal_True );
     230                 :            : 
     231                 :          0 :     pViewData->GetMultiArea( aSourceRange );        // Mehrfachselektion erlaubt
     232                 :            : 
     233                 :            : //  pViewShell->Unmark();
     234                 :            : 
     235                 :          0 :     ForcePointer(NULL);
     236                 :          0 : }
     237                 :            : 
     238                 :            : /*************************************************************************
     239                 :            : |*
     240                 :            : |* Function deaktivieren
     241                 :            : |*
     242                 :            : \************************************************************************/
     243                 :            : 
     244                 :          0 : void FuMarkRect::Deactivate()
     245                 :            : {
     246                 :          0 :     FuPoor::Deactivate();
     247                 :            : 
     248         [ #  # ]:          0 :     if (bVisible)
     249                 :            :     {
     250                 :            :         // Hide ZoomRect
     251                 :          0 :         pViewShell->DrawMarkRect(aZoomRect);
     252                 :          0 :         bVisible = false;
     253                 :          0 :         bStartDrag = false;
     254                 :            :     }
     255                 :          0 : }
     256                 :            : 
     257                 :            : /*************************************************************************
     258                 :            : |*
     259                 :            : |* Maus-Pointer umschalten
     260                 :            : |*
     261                 :            : \************************************************************************/
     262                 :            : 
     263                 :          0 : void FuMarkRect::ForcePointer(const MouseEvent* /* pMEvt */)
     264                 :            : {
     265         [ #  # ]:          0 :     pViewShell->SetActivePointer( Pointer( POINTER_CHART ) );
     266                 :          0 : }
     267                 :            : 
     268                 :            : 
     269                 :            : 
     270                 :            : 
     271                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10