LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/func - fuconuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 65 1.5 %
Date: 2013-07-09 Functions: 2 17 11.8 %
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 <svl/aeitem.hxx>
      23             : #include <sfx2/dispatch.hxx>
      24             : #include <sfx2/viewfrm.hxx>
      25             : #include <sfx2/request.hxx>
      26             : #include <svl/intitem.hxx>
      27             : 
      28             : 
      29             : #include <svx/fmglob.hxx>
      30             : 
      31             : #include <svx/dialogs.hrc>
      32             : 
      33             : #include "app.hrc"
      34             : #include "glob.hrc"
      35             : #include "ViewShell.hxx"
      36             : #include "View.hxx"
      37             : #include "Window.hxx"
      38             : #include "ViewShellBase.hxx"
      39             : #include "ToolBarManager.hxx"
      40             : #include "drawdoc.hxx"
      41             : #include "sdresid.hxx"
      42             : #include "res_bmp.hrc"
      43             : 
      44             : namespace sd {
      45             : 
      46           0 : TYPEINIT1( FuConstructUnoControl, FuConstruct );
      47             : 
      48             : 
      49           0 : FuConstructUnoControl::FuConstructUnoControl (
      50             :     ViewShell*  pViewSh,
      51             :     ::sd::Window*       pWin,
      52             :     ::sd::View*         pView,
      53             :     SdDrawDocument* pDoc,
      54             :     SfxRequest&     rReq)
      55           0 :     : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
      56             : {
      57           0 : }
      58             : 
      59           0 : FunctionReference FuConstructUnoControl::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
      60             : {
      61             :     FuConstructUnoControl* pFunc;
      62           0 :     FunctionReference xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
      63           0 :     xFunc->DoExecute(rReq);
      64           0 :     pFunc->SetPermanent(bPermanent);
      65           0 :     return xFunc;
      66             : }
      67             : 
      68           0 : void FuConstructUnoControl::DoExecute( SfxRequest& rReq )
      69             : {
      70           0 :     FuConstruct::DoExecute( rReq );
      71             : 
      72           0 :     SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, sal_False );
      73           0 :     SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False );
      74           0 :     if( pInventorItem )
      75           0 :         nInventor = pInventorItem->GetValue();
      76           0 :     if( pIdentifierItem )
      77           0 :         nIdentifier = pIdentifierItem->GetValue();
      78             : 
      79           0 :     mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
      80             :         ToolBarManager::TBG_FUNCTION,
      81           0 :         ToolBarManager::msDrawingObjectToolBar);
      82           0 : }
      83             : 
      84           0 : sal_Bool FuConstructUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
      85             : {
      86           0 :     sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
      87             : 
      88           0 :     if ( rMEvt.IsLeft() && !mpView->IsAction() )
      89             :     {
      90           0 :         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
      91           0 :         mpWindow->CaptureMouse();
      92           0 :         sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
      93           0 :         mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
      94           0 :         bReturn = sal_True;
      95             :     }
      96           0 :     return bReturn;
      97             : }
      98             : 
      99           0 : sal_Bool FuConstructUnoControl::MouseMove(const MouseEvent& rMEvt)
     100             : {
     101           0 :     return FuConstruct::MouseMove(rMEvt);
     102             : }
     103             : 
     104           0 : sal_Bool FuConstructUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
     105             : {
     106           0 :     sal_Bool bReturn = sal_False;
     107             : 
     108           0 :     if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
     109             :     {
     110           0 :         mpView->EndCreateObj(SDRCREATE_FORCEEND);
     111           0 :         bReturn = sal_True;
     112             :     }
     113             : 
     114           0 :     bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
     115             : 
     116           0 :     if (!bPermanent)
     117           0 :         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
     118             : 
     119           0 :     return (bReturn);
     120             : }
     121             : 
     122             : /**
     123             :  * Process keyboard input
     124             :  * @returns sal_True if a KeyEvent is being processed, sal_False otherwise
     125             :  */
     126           0 : sal_Bool FuConstructUnoControl::KeyInput(const KeyEvent& rKEvt)
     127             : {
     128           0 :     sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
     129           0 :     return(bReturn);
     130             : }
     131             : 
     132           0 : void FuConstructUnoControl::Activate()
     133             : {
     134           0 :     mpView->SetCurrentObj( nIdentifier, nInventor );
     135             : 
     136           0 :     aNewPointer = Pointer(POINTER_DRAW_RECT);
     137           0 :     aOldPointer = mpWindow->GetPointer();
     138           0 :     mpWindow->SetPointer( aNewPointer );
     139             : 
     140           0 :     aOldLayer = mpView->GetActiveLayer();
     141           0 :     String aStr(SdResId(STR_LAYER_CONTROLS));
     142           0 :     mpView->SetActiveLayer( aStr );
     143             : 
     144           0 :     FuConstruct::Activate();
     145           0 : }
     146             : 
     147           0 : void FuConstructUnoControl::Deactivate()
     148             : {
     149           0 :     FuConstruct::Deactivate();
     150           0 :     mpView->SetActiveLayer( aOldLayer );
     151           0 :     mpWindow->SetPointer( aOldPointer );
     152           0 : }
     153             : 
     154           0 : SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
     155             : {
     156             :     // case SID_FM_CREATE_CONTROL:
     157             : 
     158             :     SdrObject* pObj = SdrObjFactory::MakeNewObject(
     159           0 :         mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
     160           0 :         0L, mpDoc);
     161             : 
     162           0 :     if(pObj)
     163             :     {
     164           0 :         pObj->SetLogicRect(rRectangle);
     165             :     }
     166             : 
     167           0 :     return pObj;
     168             : }
     169             : 
     170          33 : } // end of namespace sd
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10