LCOV - code coverage report
Current view: top level - sd/source/ui/func - fuconuno.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 63 0.0 %
Date: 2014-04-14 Functions: 0 15 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 "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             :     : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
      56             :     , nInventor(0)
      57           0 :     , nIdentifier(0)
      58             : {
      59           0 : }
      60             : 
      61           0 : rtl::Reference<FuPoor> FuConstructUnoControl::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
      62             : {
      63             :     FuConstructUnoControl* pFunc;
      64           0 :     rtl::Reference<FuPoor> xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
      65           0 :     xFunc->DoExecute(rReq);
      66           0 :     pFunc->SetPermanent(bPermanent);
      67           0 :     return xFunc;
      68             : }
      69             : 
      70           0 : void FuConstructUnoControl::DoExecute( SfxRequest& rReq )
      71             : {
      72           0 :     FuConstruct::DoExecute( rReq );
      73             : 
      74           0 :     SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, false );
      75           0 :     SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, false );
      76           0 :     if( pInventorItem )
      77           0 :         nInventor = pInventorItem->GetValue();
      78           0 :     if( pIdentifierItem )
      79           0 :         nIdentifier = pIdentifierItem->GetValue();
      80             : 
      81           0 :     mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
      82             :         ToolBarManager::TBG_FUNCTION,
      83           0 :         ToolBarManager::msDrawingObjectToolBar);
      84           0 : }
      85             : 
      86           0 : sal_Bool FuConstructUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
      87             : {
      88           0 :     sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
      89             : 
      90           0 :     if ( rMEvt.IsLeft() && !mpView->IsAction() )
      91             :     {
      92           0 :         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
      93           0 :         mpWindow->CaptureMouse();
      94           0 :         sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
      95           0 :         mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
      96           0 :         bReturn = sal_True;
      97             :     }
      98           0 :     return bReturn;
      99             : }
     100             : 
     101           0 : sal_Bool FuConstructUnoControl::MouseMove(const MouseEvent& rMEvt)
     102             : {
     103           0 :     return FuConstruct::MouseMove(rMEvt);
     104             : }
     105             : 
     106           0 : sal_Bool FuConstructUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
     107             : {
     108           0 :     sal_Bool bReturn = sal_False;
     109             : 
     110           0 :     if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
     111             :     {
     112           0 :         mpView->EndCreateObj(SDRCREATE_FORCEEND);
     113           0 :         bReturn = sal_True;
     114             :     }
     115             : 
     116           0 :     bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
     117             : 
     118           0 :     if (!bPermanent)
     119           0 :         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
     120             : 
     121           0 :     return (bReturn);
     122             : }
     123             : 
     124             : /**
     125             :  * Process keyboard input
     126             :  * @returns sal_True if a KeyEvent is being processed, sal_False otherwise
     127             :  */
     128           0 : sal_Bool FuConstructUnoControl::KeyInput(const KeyEvent& rKEvt)
     129             : {
     130           0 :     sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
     131           0 :     return(bReturn);
     132             : }
     133             : 
     134           0 : void FuConstructUnoControl::Activate()
     135             : {
     136           0 :     mpView->SetCurrentObj( nIdentifier, nInventor );
     137             : 
     138           0 :     aNewPointer = Pointer(POINTER_DRAW_RECT);
     139           0 :     aOldPointer = mpWindow->GetPointer();
     140           0 :     mpWindow->SetPointer( aNewPointer );
     141             : 
     142           0 :     aOldLayer = mpView->GetActiveLayer();
     143           0 :     mpView->SetActiveLayer( SD_RESSTR(STR_LAYER_CONTROLS) );
     144             : 
     145           0 :     FuConstruct::Activate();
     146           0 : }
     147             : 
     148           0 : void FuConstructUnoControl::Deactivate()
     149             : {
     150           0 :     FuConstruct::Deactivate();
     151           0 :     mpView->SetActiveLayer( aOldLayer );
     152           0 :     mpWindow->SetPointer( aOldPointer );
     153           0 : }
     154             : 
     155           0 : SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
     156             : {
     157             :     // case SID_FM_CREATE_CONTROL:
     158             : 
     159             :     SdrObject* pObj = SdrObjFactory::MakeNewObject(
     160           0 :         mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
     161           0 :         0L, mpDoc);
     162             : 
     163           0 :     if(pObj)
     164             :     {
     165           0 :         pObj->SetLogicRect(rRectangle);
     166             :     }
     167             : 
     168           0 :     return pObj;
     169             : }
     170             : 
     171             : } // end of namespace sd
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10