LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - fuconuno.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 0.0 %
Date: 2012-12-27 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             : |*
      50             : |* Konstruktor
      51             : |*
      52             : \************************************************************************/
      53             : 
      54           0 : FuConstructUnoControl::FuConstructUnoControl (
      55             :     ViewShell*  pViewSh,
      56             :     ::sd::Window*       pWin,
      57             :     ::sd::View*         pView,
      58             :     SdDrawDocument* pDoc,
      59             :     SfxRequest&     rReq)
      60           0 :     : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
      61             : {
      62           0 : }
      63             : 
      64           0 : FunctionReference FuConstructUnoControl::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
      65             : {
      66             :     FuConstructUnoControl* pFunc;
      67           0 :     FunctionReference xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
      68           0 :     xFunc->DoExecute(rReq);
      69           0 :     pFunc->SetPermanent(bPermanent);
      70           0 :     return xFunc;
      71             : }
      72             : 
      73           0 : void FuConstructUnoControl::DoExecute( SfxRequest& rReq )
      74             : {
      75           0 :     FuConstruct::DoExecute( rReq );
      76             : 
      77           0 :     SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, sal_False );
      78           0 :     SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False );
      79           0 :     if( pInventorItem )
      80           0 :         nInventor = pInventorItem->GetValue();
      81           0 :     if( pIdentifierItem )
      82           0 :         nIdentifier = pIdentifierItem->GetValue();
      83             : 
      84           0 :     mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
      85             :         ToolBarManager::TBG_FUNCTION,
      86           0 :         ToolBarManager::msDrawingObjectToolBar);
      87           0 : }
      88             : 
      89             : /*************************************************************************
      90             : |*
      91             : |* MouseButtonDown-event
      92             : |*
      93             : \************************************************************************/
      94           0 : sal_Bool FuConstructUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
      95             : {
      96           0 :     sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
      97             : 
      98           0 :     if ( rMEvt.IsLeft() && !mpView->IsAction() )
      99             :     {
     100           0 :         Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     101           0 :         mpWindow->CaptureMouse();
     102           0 :         sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
     103           0 :         mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
     104           0 :         bReturn = sal_True;
     105             :     }
     106           0 :     return bReturn;
     107             : }
     108             : 
     109             : /*************************************************************************
     110             : |*
     111             : |* MouseMove-event
     112             : |*
     113             : \************************************************************************/
     114           0 : sal_Bool FuConstructUnoControl::MouseMove(const MouseEvent& rMEvt)
     115             : {
     116           0 :     return FuConstruct::MouseMove(rMEvt);
     117             : }
     118             : 
     119             : /*************************************************************************
     120             : |*
     121             : |* MouseButtonUp-event
     122             : |*
     123             : \************************************************************************/
     124           0 : sal_Bool FuConstructUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
     125             : {
     126           0 :     sal_Bool bReturn = sal_False;
     127             : 
     128           0 :     if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
     129             :     {
     130           0 :         mpView->EndCreateObj(SDRCREATE_FORCEEND);
     131           0 :         bReturn = sal_True;
     132             :     }
     133             : 
     134           0 :     bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
     135             : 
     136           0 :     if (!bPermanent)
     137           0 :         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
     138             : 
     139           0 :     return (bReturn);
     140             : }
     141             : 
     142             : /*************************************************************************
     143             : |*
     144             : |* Tastaturereignisse bearbeiten
     145             : |*
     146             : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     147             : |* sal_False.
     148             : |*
     149             : \************************************************************************/
     150           0 : sal_Bool FuConstructUnoControl::KeyInput(const KeyEvent& rKEvt)
     151             : {
     152           0 :     sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
     153           0 :     return(bReturn);
     154             : }
     155             : 
     156             : /*************************************************************************
     157             : |*
     158             : |* Function aktivieren
     159             : |*
     160             : \************************************************************************/
     161           0 : void FuConstructUnoControl::Activate()
     162             : {
     163           0 :     mpView->SetCurrentObj( nIdentifier, nInventor );
     164             : 
     165           0 :     aNewPointer = Pointer(POINTER_DRAW_RECT);
     166           0 :     aOldPointer = mpWindow->GetPointer();
     167           0 :     mpWindow->SetPointer( aNewPointer );
     168             : 
     169           0 :     aOldLayer = mpView->GetActiveLayer();
     170           0 :     String aStr(SdResId(STR_LAYER_CONTROLS));
     171           0 :     mpView->SetActiveLayer( aStr );
     172             : 
     173           0 :     FuConstruct::Activate();
     174           0 : }
     175             : 
     176             : /*************************************************************************
     177             : |*
     178             : |* Function deaktivieren
     179             : |*
     180             : \************************************************************************/
     181           0 : void FuConstructUnoControl::Deactivate()
     182             : {
     183           0 :     FuConstruct::Deactivate();
     184           0 :     mpView->SetActiveLayer( aOldLayer );
     185           0 :     mpWindow->SetPointer( aOldPointer );
     186           0 : }
     187             : 
     188           0 : SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
     189             : {
     190             :     // case SID_FM_CREATE_CONTROL:
     191             : 
     192             :     SdrObject* pObj = SdrObjFactory::MakeNewObject(
     193           0 :         mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
     194           0 :         0L, mpDoc);
     195             : 
     196           0 :     if(pObj)
     197             :     {
     198           0 :         pObj->SetLogicRect(rRectangle);
     199             :     }
     200             : 
     201           0 :     return pObj;
     202             : }
     203             : 
     204             : } // end of namespace sd
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10