LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - fuconarc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 63 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 58 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 "fuconarc.hxx"
      31                 :            : #include "sc.hrc"
      32                 :            : #include "tabvwsh.hxx"
      33                 :            : #include "drawview.hxx"
      34                 :            : 
      35                 :            : // Create default drawing objects via keyboard
      36                 :            : #include <svx/svdocirc.hxx>
      37                 :            : #include <svx/sxciaitm.hxx>
      38                 :            : 
      39                 :            : /*************************************************************************
      40                 :            : |*
      41                 :            : |* Konstruktor
      42                 :            : |*
      43                 :            : \************************************************************************/
      44                 :            : 
      45                 :          0 : FuConstArc::FuConstArc( ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
      46                 :            :                    SdrModel* pDoc, SfxRequest& rReq )
      47                 :          0 :     : FuConstruct( pViewSh, pWin, pViewP, pDoc, rReq )
      48                 :            : {
      49                 :          0 : }
      50                 :            : 
      51                 :            : /*************************************************************************
      52                 :            : |*
      53                 :            : |* Destruktor
      54                 :            : |*
      55                 :            : \************************************************************************/
      56                 :            : 
      57                 :          0 : FuConstArc::~FuConstArc()
      58                 :            : {
      59         [ #  # ]:          0 : }
      60                 :            : 
      61                 :            : /*************************************************************************
      62                 :            : |*
      63                 :            : |* MouseButtonDown-event
      64                 :            : |*
      65                 :            : \************************************************************************/
      66                 :            : 
      67                 :          0 : sal_Bool FuConstArc::MouseButtonDown( const MouseEvent& rMEvt )
      68                 :            : {
      69                 :            :     // remember button state for creation of own MouseEvents
      70                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
      71                 :            : 
      72                 :          0 :     sal_Bool bReturn = FuConstruct::MouseButtonDown( rMEvt );
      73                 :            : 
      74 [ #  # ][ #  # ]:          0 :     if ( rMEvt.IsLeft() && !pView->IsAction() )
                 [ #  # ]
      75                 :            :     {
      76         [ #  # ]:          0 :         Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
      77         [ #  # ]:          0 :         pWindow->CaptureMouse();
      78         [ #  # ]:          0 :         pView->BegCreateObj( aPnt );
      79                 :          0 :         bReturn = sal_True;
      80                 :            :     }
      81                 :          0 :     return bReturn;
      82                 :            : }
      83                 :            : 
      84                 :            : /*************************************************************************
      85                 :            : |*
      86                 :            : |* MouseMove-event
      87                 :            : |*
      88                 :            : \************************************************************************/
      89                 :            : 
      90                 :          0 : sal_Bool FuConstArc::MouseMove( const MouseEvent& rMEvt )
      91                 :            : {
      92                 :          0 :     return FuConstruct::MouseMove(rMEvt);
      93                 :            : }
      94                 :            : 
      95                 :            : /*************************************************************************
      96                 :            : |*
      97                 :            : |* MouseButtonUp-event
      98                 :            : |*
      99                 :            : \************************************************************************/
     100                 :            : 
     101                 :          0 : sal_Bool FuConstArc::MouseButtonUp( const MouseEvent& rMEvt )
     102                 :            : {
     103                 :            :     // remember button state for creation of own MouseEvents
     104                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     105                 :            : 
     106                 :          0 :     sal_Bool bReturn = false;
     107                 :            : 
     108 [ #  # ][ #  # ]:          0 :     if ( pView->IsCreateObj() && rMEvt.IsLeft() )
                 [ #  # ]
     109                 :            :     {
     110                 :          0 :         pView->EndCreateObj( SDRCREATE_NEXTPOINT );
     111                 :          0 :         bReturn = sal_True;
     112                 :            :     }
     113 [ #  # ][ #  # ]:          0 :     return (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
     114                 :            : }
     115                 :            : 
     116                 :            : /*************************************************************************
     117                 :            : |*
     118                 :            : |* Tastaturereignisse bearbeiten
     119                 :            : |*
     120                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     121                 :            : |* FALSE.
     122                 :            : |*
     123                 :            : \************************************************************************/
     124                 :            : 
     125                 :          0 : sal_Bool FuConstArc::KeyInput(const KeyEvent& rKEvt)
     126                 :            : {
     127                 :          0 :     sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
     128                 :          0 :     return(bReturn);
     129                 :            : }
     130                 :            : 
     131                 :            : /*************************************************************************
     132                 :            : |*
     133                 :            : |* Function aktivieren
     134                 :            : |*
     135                 :            : \************************************************************************/
     136                 :            : 
     137                 :          0 : void FuConstArc::Activate()
     138                 :            : {
     139                 :            :     SdrObjKind aObjKind;
     140                 :            : 
     141   [ #  #  #  # ]:          0 :     switch (aSfxRequest.GetSlot() )
     142                 :            :     {
     143                 :            :         case SID_DRAW_ARC:
     144                 :          0 :             aNewPointer = Pointer( POINTER_DRAW_ARC );
     145                 :          0 :             aObjKind = OBJ_CARC;
     146                 :          0 :             break;
     147                 :            : 
     148                 :            :         case SID_DRAW_PIE:
     149                 :          0 :             aNewPointer = Pointer( POINTER_DRAW_PIE );
     150                 :          0 :             aObjKind = OBJ_SECT;
     151                 :          0 :             break;
     152                 :            : 
     153                 :            :         case SID_DRAW_CIRCLECUT:
     154                 :          0 :             aNewPointer = Pointer( POINTER_DRAW_CIRCLECUT );
     155                 :          0 :             aObjKind = OBJ_CCUT;
     156                 :          0 :             break;
     157                 :            : 
     158                 :            :         default:
     159                 :          0 :             aNewPointer = Pointer( POINTER_CROSS );
     160                 :          0 :             aObjKind = OBJ_CARC;
     161                 :          0 :             break;
     162                 :            :     }
     163                 :            : 
     164                 :          0 :     pView->SetCurrentObj( sal::static_int_cast<sal_uInt16>( aObjKind ) );
     165                 :            : 
     166                 :          0 :     aOldPointer = pWindow->GetPointer();
     167                 :          0 :     pViewShell->SetActivePointer( aNewPointer );
     168                 :            : 
     169                 :          0 :     FuDraw::Activate();
     170                 :          0 : }
     171                 :            : 
     172                 :            : /*************************************************************************
     173                 :            : |*
     174                 :            : |* Function deaktivieren
     175                 :            : |*
     176                 :            : \************************************************************************/
     177                 :            : 
     178                 :          0 : void FuConstArc::Deactivate()
     179                 :            : {
     180                 :          0 :     FuDraw::Deactivate();
     181                 :          0 :     pViewShell->SetActivePointer( aOldPointer );
     182                 :          0 : }
     183                 :            : 
     184                 :            : // Create default drawing objects via keyboard
     185                 :          0 : SdrObject* FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
     186                 :            : {
     187                 :            :     // case SID_DRAW_ARC:
     188                 :            :     // case SID_DRAW_PIE:
     189                 :            :     // case SID_DRAW_CIRCLECUT:
     190                 :            : 
     191                 :            :     SdrObject* pObj = SdrObjFactory::MakeNewObject(
     192                 :          0 :         pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
     193                 :          0 :         0L, pDrDoc);
     194                 :            : 
     195         [ #  # ]:          0 :     if(pObj)
     196                 :            :     {
     197         [ #  # ]:          0 :         if(pObj->ISA(SdrCircObj))
     198                 :            :         {
     199                 :          0 :             Rectangle aRect(rRectangle);
     200                 :            : 
     201 [ #  # ][ #  # ]:          0 :             if(SID_DRAW_ARC == nID || SID_DRAW_CIRCLECUT == nID)
     202                 :            :             {
     203                 :            :                 // force quadratic
     204         [ #  # ]:          0 :                 ImpForceQuadratic(aRect);
     205                 :            :             }
     206                 :            : 
     207         [ #  # ]:          0 :             pObj->SetLogicRect(aRect);
     208                 :            : 
     209         [ #  # ]:          0 :             SfxItemSet aAttr(pDrDoc->GetItemPool());
     210 [ #  # ][ #  # ]:          0 :             aAttr.Put(SdrCircStartAngleItem(9000));
                 [ #  # ]
     211 [ #  # ][ #  # ]:          0 :             aAttr.Put(SdrCircEndAngleItem(0));
                 [ #  # ]
     212                 :            : 
     213 [ #  # ][ #  # ]:          0 :             pObj->SetMergedItemSet(aAttr);
     214                 :            :         }
     215                 :            :         else
     216                 :            :         {
     217                 :            :             OSL_FAIL("Object is NO circle object");
     218                 :            :         }
     219                 :            :     }
     220                 :            : 
     221                 :          0 :     return pObj;
     222                 :            : }
     223                 :            : 
     224                 :            : 
     225                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10