LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - fuconuno.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 57 1.8 %
Date: 2015-06-13 12:38:46 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             : #include "fuconuno.hxx"
      21             : #include "tabvwsh.hxx"
      22             : #include "sc.hrc"
      23             : #include "drawview.hxx"
      24             : 
      25             : /*************************************************************************
      26             : |*
      27             : |* Konstruktor
      28             : |*
      29             : \************************************************************************/
      30             : 
      31           0 : FuConstUnoControl::FuConstUnoControl(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pViewP,
      32             :                    SdrModel* pDoc, SfxRequest& rReq)
      33             :     : FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq)
      34             :     , nInventor(0)
      35           0 :     , nIdentifier(0)
      36             : {
      37           0 :     SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, false );
      38           0 :     SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, false );
      39           0 :     if( pInventorItem )
      40           0 :         nInventor = pInventorItem->GetValue();
      41           0 :     if( pIdentifierItem )
      42           0 :         nIdentifier = pIdentifierItem->GetValue();
      43           0 : }
      44             : 
      45             : /*************************************************************************
      46             : |*
      47             : |* Destruktor
      48             : |*
      49             : \************************************************************************/
      50             : 
      51           0 : FuConstUnoControl::~FuConstUnoControl()
      52             : {
      53           0 : }
      54             : 
      55             : /*************************************************************************
      56             : |*
      57             : |* MouseButtonDown-event
      58             : |*
      59             : \************************************************************************/
      60             : 
      61           0 : bool FuConstUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
      62             : {
      63             :     // remember button state for creation of own MouseEvents
      64           0 :     SetMouseButtonCode(rMEvt.GetButtons());
      65             : 
      66           0 :     bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
      67             : 
      68           0 :     if ( rMEvt.IsLeft() && !pView->IsAction() )
      69             :     {
      70           0 :         Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
      71             :         // Hack  to align object to nearest grid position where object
      72             :         // would be anchored ( if it were cell anchored )
      73             :         // Get grid offset for current position ( note: aPnt is
      74             :         // also adjusted )
      75           0 :         Point aGridOff = CurrentGridSyncOffsetAndPos( aPnt );
      76             : 
      77           0 :         pWindow->CaptureMouse();
      78           0 :         pView->BegCreateObj(aPnt);
      79           0 :         pView->GetCreateObj()->SetGridOffset( aGridOff );
      80           0 :         bReturn = true;
      81             :     }
      82           0 :     return bReturn;
      83             : }
      84             : 
      85             : /*************************************************************************
      86             : |*
      87             : |* MouseMove-event
      88             : |*
      89             : \************************************************************************/
      90             : 
      91           0 : bool FuConstUnoControl::MouseMove(const MouseEvent& rMEvt)
      92             : {
      93           0 :     return FuConstruct::MouseMove(rMEvt);
      94             : }
      95             : 
      96             : /*************************************************************************
      97             : |*
      98             : |* MouseButtonUp-event
      99             : |*
     100             : \************************************************************************/
     101             : 
     102           0 : bool FuConstUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
     103             : {
     104             :     // remember button state for creation of own MouseEvents
     105           0 :     SetMouseButtonCode(rMEvt.GetButtons());
     106             : 
     107           0 :     bool bReturn = false;
     108             : 
     109           0 :     if ( pView->IsCreateObj() && rMEvt.IsLeft() )
     110             :     {
     111           0 :         pView->EndCreateObj(SDRCREATE_FORCEEND);
     112           0 :         bReturn = true;
     113             :     }
     114           0 :     return (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
     115             : }
     116             : 
     117             : /*************************************************************************
     118             : |*
     119             : |* Tastaturereignisse bearbeiten
     120             : |*
     121             : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     122             : |* FALSE.
     123             : |*
     124             : \************************************************************************/
     125             : 
     126           0 : bool FuConstUnoControl::KeyInput(const KeyEvent& rKEvt)
     127             : {
     128           0 :     return FuConstruct::KeyInput(rKEvt);
     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( PointerStyle::DrawRect );
     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         156 : }
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11