LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - fuconstr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 112 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 129 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 <editeng/outliner.hxx>
      31                 :            : #include <editeng/outlobj.hxx>
      32                 :            : #include <svx/svdotext.hxx>
      33                 :            : #include <svx/svdouno.hxx>
      34                 :            : #include <sfx2/dispatch.hxx>
      35                 :            : 
      36                 :            : #include "fuconstr.hxx"
      37                 :            : #include "fudraw.hxx"
      38                 :            : #include "tabvwsh.hxx"
      39                 :            : #include "futext.hxx"
      40                 :            : #include "sc.hrc"
      41                 :            : #include "drawview.hxx"
      42                 :            : 
      43                 :            : //  Maximal erlaubte Mausbewegung um noch Drag&Drop zu starten
      44                 :            : //! fusel,fuconstr,futext - zusammenfassen!
      45                 :            : #define SC_MAXDRAGMOVE  3
      46                 :            : 
      47                 :            : //------------------------------------------------------------------------
      48                 :            : 
      49                 :            : /*************************************************************************
      50                 :            : |*
      51                 :            : |* Konstruktor
      52                 :            : |*
      53                 :            : \************************************************************************/
      54                 :            : 
      55                 :          0 : FuConstruct::FuConstruct(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
      56                 :            :                    SdrModel* pDoc, SfxRequest& rReq) :
      57                 :          0 :     FuDraw(pViewSh, pWin, pViewP, pDoc, rReq)
      58                 :            : {
      59                 :          0 : }
      60                 :            : 
      61                 :            : /*************************************************************************
      62                 :            : |*
      63                 :            : |* Destruktor
      64                 :            : |*
      65                 :            : \************************************************************************/
      66                 :            : 
      67                 :          0 : FuConstruct::~FuConstruct()
      68                 :            : {
      69         [ #  # ]:          0 : }
      70                 :            : 
      71                 :          0 : sal_uInt8 FuConstruct::Command(const CommandEvent& rCEvt)
      72                 :            : {
      73                 :            :     //  special code for non-VCL OS2/UNX removed
      74                 :            : 
      75                 :          0 :     return FuDraw::Command( rCEvt );
      76                 :            : }
      77                 :            : 
      78                 :            : /*************************************************************************
      79                 :            : |*
      80                 :            : |* MouseButtonDown-event
      81                 :            : |*
      82                 :            : \************************************************************************/
      83                 :            : 
      84                 :          0 : sal_Bool FuConstruct::MouseButtonDown(const MouseEvent& rMEvt)
      85                 :            : {
      86                 :            :     // remember button state for creation of own MouseEvents
      87                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
      88                 :            : 
      89                 :          0 :     sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
      90                 :            : 
      91         [ #  # ]:          0 :     if ( pView->IsAction() )
      92                 :            :     {
      93         [ #  # ]:          0 :         if ( rMEvt.IsRight() )
      94                 :          0 :             pView->BckAction();
      95                 :          0 :         return sal_True;
      96                 :            :     }
      97                 :            : 
      98                 :          0 :     aDragTimer.Start();
      99                 :            : 
     100                 :          0 :     aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
     101                 :            : 
     102         [ #  # ]:          0 :     if ( rMEvt.IsLeft() )
     103                 :            :     {
     104                 :          0 :         pWindow->CaptureMouse();
     105                 :            : 
     106                 :          0 :         SdrHdl* pHdl = pView->PickHandle(aMDPos);
     107                 :            : 
     108 [ #  # ][ #  # ]:          0 :         if ( pHdl != NULL || pView->IsMarkedHit(aMDPos) )
                 [ #  # ]
     109                 :            :         {
     110                 :          0 :             pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, 1);
     111                 :          0 :             bReturn = sal_True;
     112                 :            :         }
     113         [ #  # ]:          0 :         else if ( pView->AreObjectsMarked() )
     114                 :            :         {
     115                 :          0 :             pView->UnmarkAll();
     116                 :          0 :             bReturn = sal_True;
     117                 :            :         }
     118                 :            :     }
     119                 :            : 
     120                 :          0 :     bIsInDragMode = false;
     121                 :            : 
     122                 :          0 :     return bReturn;
     123                 :            : }
     124                 :            : 
     125                 :            : /*************************************************************************
     126                 :            : |*
     127                 :            : |* MouseMove-event
     128                 :            : |*
     129                 :            : \************************************************************************/
     130                 :            : 
     131                 :          0 : sal_Bool FuConstruct::MouseMove(const MouseEvent& rMEvt)
     132                 :            : {
     133         [ #  # ]:          0 :     FuDraw::MouseMove(rMEvt);
     134                 :            : 
     135         [ #  # ]:          0 :     if (aDragTimer.IsActive() )
     136                 :            :     {
     137         [ #  # ]:          0 :         Point aOldPixel = pWindow->LogicToPixel( aMDPos );
     138                 :          0 :         Point aNewPixel = rMEvt.GetPosPixel();
     139         [ #  # ]:          0 :         if ( Abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE ||
           [ #  #  #  # ]
     140                 :          0 :              Abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE )
     141         [ #  # ]:          0 :             aDragTimer.Stop();
     142                 :            :     }
     143                 :            : 
     144                 :          0 :     Point aPix(rMEvt.GetPosPixel());
     145         [ #  # ]:          0 :     Point aPnt( pWindow->PixelToLogic(aPix) );
     146                 :            : 
     147 [ #  # ][ #  # ]:          0 :     if ( pView->IsAction() )
     148                 :            :     {
     149         [ #  # ]:          0 :         ForceScroll(aPix);
     150         [ #  # ]:          0 :         pView->MovAction(aPnt);
     151                 :            :     }
     152                 :            :     else
     153                 :            :     {
     154         [ #  # ]:          0 :         SdrHdl* pHdl=pView->PickHandle(aPnt);
     155                 :            : 
     156         [ #  # ]:          0 :         if ( pHdl != NULL )
     157                 :            :         {
     158 [ #  # ][ #  # ]:          0 :             pViewShell->SetActivePointer(pHdl->GetPointer());
     159                 :            :         }
     160 [ #  # ][ #  # ]:          0 :         else if ( pView->IsMarkedHit(aPnt) )
     161                 :            :         {
     162         [ #  # ]:          0 :             pViewShell->SetActivePointer(Pointer(POINTER_MOVE));
     163                 :            :         }
     164                 :            :         else
     165                 :            :         {
     166         [ #  # ]:          0 :             pViewShell->SetActivePointer( aNewPointer );
     167                 :            :         }
     168                 :            :     }
     169                 :          0 :     return sal_True;
     170                 :            : }
     171                 :            : 
     172                 :            : /*************************************************************************
     173                 :            : |*
     174                 :            : |* MouseButtonUp-event
     175                 :            : |*
     176                 :            : \************************************************************************/
     177                 :            : 
     178                 :          0 : sal_Bool FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
     179                 :            : {
     180                 :            :     // remember button state for creation of own MouseEvents
     181                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     182                 :            : 
     183                 :          0 :     sal_Bool bReturn = SimpleMouseButtonUp( rMEvt );
     184                 :            : 
     185                 :            :     //      Doppelklick auf Textobjekt? (->fusel)
     186                 :            : 
     187                 :          0 :     sal_uInt16 nClicks = rMEvt.GetClicks();
     188 [ #  # ][ #  # ]:          0 :     if ( nClicks == 2 && rMEvt.IsLeft() )
                 [ #  # ]
     189                 :            :     {
     190         [ #  # ]:          0 :         if ( pView->AreObjectsMarked() )
     191                 :            :         {
     192                 :          0 :             const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     193         [ #  # ]:          0 :             if (rMarkList.GetMarkCount() == 1)
     194                 :            :             {
     195                 :          0 :                 SdrMark* pMark = rMarkList.GetMark(0);
     196                 :          0 :                 SdrObject* pObj = pMark->GetMarkedSdrObj();
     197                 :            : 
     198                 :            :                 //  bei Uno-Controls nicht in Textmodus
     199 [ #  # ][ #  # ]:          0 :                 if ( pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) )
                 [ #  # ]
     200                 :            :                 {
     201                 :          0 :                     OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     202 [ #  # ][ #  # ]:          0 :                     sal_Bool bVertical = ( pOPO && pOPO->IsVertical() );
     203         [ #  # ]:          0 :                     sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
     204                 :            : 
     205                 :          0 :                     pViewShell->GetViewData()->GetDispatcher().
     206                 :          0 :                         Execute(nTextSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     207                 :            : 
     208                 :            :                     // jetzt den erzeugten FuText holen und in den EditModus setzen
     209                 :          0 :                     FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
     210 [ #  # ][ #  # ]:          0 :                     if ( pPoor && pPoor->GetSlotID() == nTextSlotId )    // hat keine RTTI
                 [ #  # ]
     211                 :            :                     {
     212                 :          0 :                         FuText* pText = (FuText*)pPoor;
     213                 :          0 :                         Point aMousePixel = rMEvt.GetPosPixel();
     214         [ #  # ]:          0 :                         pText->SetInEditMode( pObj, &aMousePixel );
     215                 :            :                     }
     216                 :          0 :                     bReturn = sal_True;
     217                 :            :                 }
     218                 :            :             }
     219                 :            :         }
     220                 :            :     }
     221                 :            : 
     222                 :          0 :     FuDraw::MouseButtonUp(rMEvt);
     223                 :            : 
     224                 :          0 :     return bReturn;
     225                 :            : }
     226                 :            : 
     227                 :            : //      SimpleMouseButtonUp - ohne Test auf Doppelklick
     228                 :            : 
     229                 :          0 : sal_Bool FuConstruct::SimpleMouseButtonUp(const MouseEvent& rMEvt)
     230                 :            : {
     231                 :          0 :     sal_Bool    bReturn = sal_True;
     232                 :            : 
     233         [ #  # ]:          0 :     if (aDragTimer.IsActive() )
     234                 :            :     {
     235         [ #  # ]:          0 :         aDragTimer.Stop();
     236                 :            :     }
     237                 :            : 
     238         [ #  # ]:          0 :     Point   aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     239                 :            : 
     240         [ #  # ]:          0 :     if ( pView->IsDragObj() )
     241         [ #  # ]:          0 :          pView->EndDragObj( rMEvt.IsMod1() );
     242                 :            : 
     243         [ #  # ]:          0 :     else if ( pView->IsMarkObj() )
     244         [ #  # ]:          0 :         pView->EndMarkObj();
     245                 :            : 
     246                 :          0 :     else bReturn = false;
     247                 :            : 
     248 [ #  # ][ #  # ]:          0 :     if ( !pView->IsAction() )
     249                 :            :     {
     250         [ #  # ]:          0 :         pWindow->ReleaseMouse();
     251                 :            : 
     252 [ #  # ][ #  # ]:          0 :         if ( !pView->AreObjectsMarked() && rMEvt.GetClicks() < 2 )
                 [ #  # ]
     253                 :            :         {
     254         [ #  # ]:          0 :             pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
     255                 :            : 
     256         [ #  # ]:          0 :             SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher();
     257         [ #  # ]:          0 :             if ( pView->AreObjectsMarked() )
     258         [ #  # ]:          0 :                 rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     259                 :            :             else
     260         [ #  # ]:          0 :                 rDisp.Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     261                 :            :         }
     262                 :            :     }
     263                 :            : 
     264                 :          0 :     return bReturn;
     265                 :            : }
     266                 :            : 
     267                 :            : /*************************************************************************
     268                 :            : |*
     269                 :            : |* Tastaturereignisse bearbeiten
     270                 :            : |*
     271                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     272                 :            : |* FALSE.
     273                 :            : |*
     274                 :            : \************************************************************************/
     275                 :            : 
     276                 :          0 : sal_Bool FuConstruct::KeyInput(const KeyEvent& rKEvt)
     277                 :            : {
     278                 :          0 :     sal_Bool bReturn = false;
     279                 :            : 
     280      [ #  #  # ]:          0 :     switch ( rKEvt.GetKeyCode().GetCode() )
     281                 :            :     {
     282                 :            :         case KEY_ESCAPE:
     283         [ #  # ]:          0 :             if ( pView->IsAction() )
     284                 :            :             {
     285                 :          0 :                 pView->BrkAction();
     286                 :          0 :                 pWindow->ReleaseMouse();
     287                 :          0 :                 bReturn = sal_True;
     288                 :            :             }
     289                 :            :             else                            // Zeichenmodus beenden
     290                 :            :             {
     291                 :          0 :                 pViewShell->GetViewData()->GetDispatcher().
     292                 :          0 :                     Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     293                 :            :             }
     294                 :          0 :             break;
     295                 :            : 
     296                 :            :         case KEY_DELETE:
     297                 :          0 :             pView->DeleteMarked();
     298                 :          0 :             bReturn = sal_True;
     299                 :          0 :             break;
     300                 :            :     }
     301                 :            : 
     302         [ #  # ]:          0 :     if ( !bReturn )
     303                 :            :     {
     304                 :          0 :         bReturn = FuDraw::KeyInput(rKEvt);
     305                 :            :     }
     306                 :            : 
     307                 :          0 :     return(bReturn);
     308                 :            : }
     309                 :            : 
     310                 :            : /*************************************************************************
     311                 :            : |*
     312                 :            : |* Function aktivieren
     313                 :            : |*
     314                 :            : \************************************************************************/
     315                 :            : 
     316                 :          0 : void FuConstruct::Activate()
     317                 :            : {
     318                 :          0 :     FuDraw::Activate();
     319                 :          0 : }
     320                 :            : 
     321                 :            : /*************************************************************************
     322                 :            : |*
     323                 :            : |* Function deaktivieren
     324                 :            : |*
     325                 :            : \************************************************************************/
     326                 :            : 
     327                 :          0 : void FuConstruct::Deactivate()
     328                 :            : {
     329                 :          0 :     FuDraw::Deactivate();
     330                 :          0 : }
     331                 :            : 
     332                 :            : 
     333                 :            : 
     334                 :            : 
     335                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10