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

Generated by: LCOV version 1.10