LCOV - code coverage report
Current view: top level - sd/source/ui/inc - fupoor.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 5 40.0 %
Date: 2014-11-03 Functions: 2 5 40.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             : #ifndef INCLUDED_SD_SOURCE_UI_INC_FUPOOR_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_FUPOOR_HXX
      22             : 
      23             : #include <tools/rtti.hxx>
      24             : #include <vcl/timer.hxx>
      25             : #include <tools/link.hxx>
      26             : #include <tools/gen.hxx>
      27             : #include <vcl/event.hxx>
      28             : #include <rtl/ref.hxx>
      29             : 
      30             : #include "helper/simplereferencecomponent.hxx"
      31             : 
      32             : class SdDrawDocument;
      33             : class SfxRequest;
      34             : class Dialog;
      35             : class SdrObject;
      36             : 
      37             : namespace sd {
      38             : 
      39             : class DrawDocShell;
      40             : class View;
      41             : class ViewShell;
      42             : class Window;
      43             : 
      44             : /**
      45             :  * Base class for all functions
      46             :  */
      47             : class FuPoor : public SimpleReferenceComponent
      48             : {
      49             : public:
      50             :     static const int HITPIX = 2;                   // Hit-Toleranz in Pixel
      51             :     static const int DRGPIX = 2;                   // Drag MinMove in Pixel
      52             : 
      53             :     TYPEINFO();
      54             : 
      55             :     virtual void DoExecute( SfxRequest& rReq );
      56             : 
      57           0 :     void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
      58           0 :     sal_uInt16 GetMouseButtonCode() const { return mnCode; }
      59             : 
      60           0 :     DrawDocShell* GetDocSh() { return mpDocSh; }
      61             :     SdDrawDocument* GetDoc() { return mpDoc; }
      62             : 
      63             :     virtual void DoCut();
      64             :     virtual void DoCopy();
      65             :     virtual void DoPaste();
      66             :     virtual void DoPasteUnformatted();
      67             : 
      68             :     // Mouse- & Key-Events; Returnwert=sal_True: Event wurde bearbeitet
      69             :     virtual bool KeyInput(const KeyEvent& rKEvt);
      70             :     virtual bool MouseMove(const MouseEvent& );
      71             :     virtual bool MouseButtonUp(const MouseEvent& rMEvt);
      72             : 
      73             :     // moved from inline to *.cxx
      74             :     virtual bool MouseButtonDown(const MouseEvent& rMEvt);
      75             : 
      76             :     virtual bool Command(const CommandEvent& rCEvt);
      77             :     virtual bool RequestHelp(const HelpEvent& rHEvt);
      78             :     virtual void Paint(const Rectangle&, ::sd::Window* );
      79             :     virtual void ReceiveRequest(SfxRequest& rReq);
      80             : 
      81             :     virtual void Activate();        ///< activates the function
      82             :     virtual void Deactivate();      ///< deactivates the function
      83             : 
      84         643 :     void SetWindow(::sd::Window* pWin) { mpWindow = pWin; }
      85             : 
      86             :     virtual void SelectionHasChanged();
      87             : 
      88        9318 :     sal_uInt16  GetSlotID() const { return( nSlotId ); }
      89             :     sal_uInt16  GetSlotValue() const { return( nSlotValue ); }
      90             : 
      91             :     void    SetNoScrollUntilInside(bool bNoScroll = true)
      92             :             { bNoScrollUntilInside = bNoScroll; }
      93             : 
      94             :     void StartDelayToScrollTimer ();
      95             : 
      96             :     virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
      97             : 
      98             :     /** is called when the current function should be aborted. <p>
      99             :         This is used when a function gets a KEY_ESCAPE but can also
     100             :         be called directly.
     101             : 
     102             :         @returns true if a active function was aborted
     103             :     */
     104             :     virtual bool cancel();
     105             : 
     106             :     // #i33136#
     107             :     /** Decide if the object to be created should be created
     108             :         orthogonal. Default implementation uses nSlotID
     109             :         to decide. May be overloaded to use other criteria
     110             :         for this decision
     111             : 
     112             :         @returns true if the to be created object should be orthogonal.
     113             :     */
     114             :     virtual bool doConstructOrthogonal() const;
     115             : 
     116             : protected:
     117             :     /**
     118             :         @param pViewSh
     119             :             May be NULL.
     120             :     */
     121             :     FuPoor (ViewShell* pViewSh,
     122             :         ::sd::Window* pWin,
     123             :         ::sd::View* pView,
     124             :         SdDrawDocument* pDoc,
     125             :         SfxRequest& rReq);
     126             :     virtual ~FuPoor (void);
     127             : 
     128             :     DECL_LINK( DelayHdl, void * );
     129             : 
     130             :     void ImpForceQuadratic(Rectangle& rRect);
     131             : 
     132             :     /** Switch to another layer.  The layer to switch to is specified by an
     133             :         offset relative to the active layer.  With respect to the layer bar
     134             :         control at the lower left of the document window positive values
     135             :         move to the right and negative values move to the left.
     136             : 
     137             :         <p>Switching the layer is independent of the view's layer mode.  The
     138             :         layers are switched even when the layer mode is turned off and the
     139             :         layer control is not visible.</p>
     140             :         @param nOffset
     141             :            If the offset is positive skip that many layers in selecting the
     142             :            next layer.  If it is negative then select a previous one.  An
     143             :            offset or zero does not change the current layer.  If the
     144             :            resulting index lies outside the valid range of indices then it
     145             :            is set to either the minimal or maximal valid index, whitchever
     146             :            is nearer.
     147             :     */
     148             :     void SwitchLayer (sal_Int32 nOffset);
     149             : 
     150             :     ::sd::View* mpView;
     151             :     ViewShell* mpViewShell;
     152             :     ::sd::Window* mpWindow;
     153             :     DrawDocShell* mpDocSh;
     154             :     SdDrawDocument* mpDoc;
     155             : 
     156             :     sal_uInt16          nSlotId;
     157             :     sal_uInt16          nSlotValue;
     158             : 
     159             :     Dialog*             pDialog;
     160             : 
     161             :     Timer               aScrollTimer;           ///< for auto-scrolling
     162             :     DECL_LINK( ScrollHdl, void * );
     163             :     void ForceScroll(const Point& aPixPos);
     164             : 
     165             :     Timer               aDragTimer;             ///< for Drag&Drop
     166             :     DECL_LINK(DragHdl, void *);
     167             :     bool            bIsInDragMode;
     168             :     Point               aMDPos;                 ///< position of MouseButtonDown
     169             : 
     170             :     /// Flag to prevent auto-scrolling until one drags from outside into the window
     171             :     bool            bNoScrollUntilInside;
     172             : 
     173             :     /// timer to delay scrolling (~ 1 sec) when dragging out of the window
     174             :     Timer               aDelayToScrollTimer;
     175             :     bool            bScrollable;
     176             :     bool            bDelayActive;
     177             :     bool            bFirstMouseMove;
     178             : 
     179             :     /// member to hold state of the mouse buttons for creation of own MouseEvents (like in ScrollHdl)
     180             : 
     181             : private:
     182             :     sal_uInt16      mnCode;
     183             : 
     184             : };
     185             : 
     186             : } // end of namespace sd
     187             : 
     188             : #endif      // _SD_FUPOOR_HXX
     189             : 
     190             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10