LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/drawfunc - fuconuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 58 1.7 %
Date: 2012-12-27 Functions: 2 12 16.7 %
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 "fuconuno.hxx"
      22             : #include "tabvwsh.hxx"
      23             : #include "sc.hrc"
      24             : #include "drawview.hxx"
      25             : 
      26             : /*************************************************************************
      27             : |*
      28             : |* Konstruktor
      29             : |*
      30             : \************************************************************************/
      31             : 
      32           0 : FuConstUnoControl::FuConstUnoControl(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
      33             :                    SdrModel* pDoc, SfxRequest& rReq)
      34           0 :     : FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq)
      35             : {
      36           0 :     SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, false );
      37           0 :     SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, false );
      38           0 :     if( pInventorItem )
      39           0 :         nInventor = pInventorItem->GetValue();
      40           0 :     if( pIdentifierItem )
      41           0 :         nIdentifier = pIdentifierItem->GetValue();
      42           0 : }
      43             : 
      44             : /*************************************************************************
      45             : |*
      46             : |* Destruktor
      47             : |*
      48             : \************************************************************************/
      49             : 
      50           0 : FuConstUnoControl::~FuConstUnoControl()
      51             : {
      52           0 : }
      53             : 
      54             : /*************************************************************************
      55             : |*
      56             : |* MouseButtonDown-event
      57             : |*
      58             : \************************************************************************/
      59             : 
      60           0 : sal_Bool FuConstUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
      61             : {
      62             :     // remember button state for creation of own MouseEvents
      63           0 :     SetMouseButtonCode(rMEvt.GetButtons());
      64             : 
      65           0 :     sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
      66             : 
      67           0 :     if ( rMEvt.IsLeft() && !pView->IsAction() )
      68             :     {
      69           0 :         Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
      70             :         // Hack  to align object to nearest grid position where object
      71             :         // would be anchored ( if it were cell anchored )
      72             :         // Get grid offset for current position ( note: aPnt is
      73             :         // also adjusted )
      74           0 :         Point aGridOff = CurrentGridSyncOffsetAndPos( aPnt );
      75             : 
      76           0 :         pWindow->CaptureMouse();
      77           0 :         pView->BegCreateObj(aPnt);
      78           0 :         pView->GetCreateObj()->SetGridOffset( aGridOff );
      79           0 :         bReturn = sal_True;
      80             :     }
      81           0 :     return bReturn;
      82             : }
      83             : 
      84             : /*************************************************************************
      85             : |*
      86             : |* MouseMove-event
      87             : |*
      88             : \************************************************************************/
      89             : 
      90           0 : sal_Bool FuConstUnoControl::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 FuConstUnoControl::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_FORCEEND);
     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 FuConstUnoControl::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 FuConstUnoControl::Activate()
     138             : {
     139           0 :     pView->SetCurrentObj( nIdentifier, nInventor );
     140             : 
     141           0 :     aNewPointer = Pointer( POINTER_DRAW_RECT );
     142           0 :     aOldPointer = pWindow->GetPointer();
     143           0 :     pViewShell->SetActivePointer( aNewPointer );
     144             : 
     145           0 :     SdrLayer* pLayer = pView->GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_CONTROLS);
     146           0 :     if (pLayer)
     147           0 :         pView->SetActiveLayer( pLayer->GetName() );
     148             : 
     149           0 :     FuConstruct::Activate();
     150           0 : }
     151             : 
     152             : /*************************************************************************
     153             : |*
     154             : |* Function deaktivieren
     155             : |*
     156             : \************************************************************************/
     157             : 
     158           0 : void FuConstUnoControl::Deactivate()
     159             : {
     160           0 :     FuConstruct::Deactivate();
     161             : 
     162           0 :     SdrLayer* pLayer = pView->GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_FRONT);
     163           0 :     if (pLayer)
     164           0 :         pView->SetActiveLayer( pLayer->GetName() );
     165             : 
     166           0 :     pViewShell->SetActivePointer( aOldPointer );
     167           0 : }
     168             : 
     169             : // Create default drawing objects via keyboard
     170           0 : SdrObject* FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, const Rectangle& rRectangle)
     171             : {
     172             :     // case SID_FM_CREATE_CONTROL:
     173             : 
     174             :     SdrObject* pObj = SdrObjFactory::MakeNewObject(
     175           0 :         pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
     176           0 :         0L, pDrDoc);
     177             : 
     178           0 :     if(pObj)
     179             :     {
     180           0 :         pObj->SetLogicRect(rRectangle);
     181             :     }
     182             : 
     183           0 :     return pObj;
     184          15 : }
     185             : 
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10