1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SD_FU_POOR_HXX 29*cdf0e10cSrcweir #define SD_FU_POOR_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <tools/rtti.hxx> 32*cdf0e10cSrcweir #include <vcl/timer.hxx> 33*cdf0e10cSrcweir #include <tools/link.hxx> 34*cdf0e10cSrcweir #include <tools/gen.hxx> 35*cdf0e10cSrcweir #include <vcl/event.hxx> 36*cdf0e10cSrcweir #include <rtl/ref.hxx> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #ifndef _SALHELPER_SIMPLEREFERENCECOMPONENT_HXX_ 39*cdf0e10cSrcweir #include "helper/simplereferencecomponent.hxx" 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir class SdDrawDocument; 43*cdf0e10cSrcweir class SfxRequest; 44*cdf0e10cSrcweir class Dialog; 45*cdf0e10cSrcweir class SdrObject; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir namespace sd { 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir class DrawDocShell; 50*cdf0e10cSrcweir class View; 51*cdf0e10cSrcweir class ViewShell; 52*cdf0e10cSrcweir class Window; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir /************************************************************************* 55*cdf0e10cSrcweir |* 56*cdf0e10cSrcweir |* Basisklasse fuer alle Funktionen 57*cdf0e10cSrcweir |* 58*cdf0e10cSrcweir \************************************************************************/ 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir class FuPoor : public SimpleReferenceComponent 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir public: 63*cdf0e10cSrcweir static const int HITPIX = 2; // Hit-Toleranz in Pixel 64*cdf0e10cSrcweir static const int DRGPIX = 2; // Drag MinMove in Pixel 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir TYPEINFO(); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir virtual void DoExecute( SfxRequest& rReq ); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir // #95491# see member 71*cdf0e10cSrcweir void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; } 72*cdf0e10cSrcweir sal_uInt16 GetMouseButtonCode() const { return mnCode; } 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir DrawDocShell* GetDocSh() { return mpDocSh; } 75*cdf0e10cSrcweir SdDrawDocument* GetDoc() { return mpDoc; } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir virtual void DoCut(); 78*cdf0e10cSrcweir virtual void DoCopy(); 79*cdf0e10cSrcweir virtual void DoPaste(); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // Mouse- & Key-Events; Returnwert=sal_True: Event wurde bearbeitet 82*cdf0e10cSrcweir virtual sal_Bool KeyInput(const KeyEvent& rKEvt); 83*cdf0e10cSrcweir virtual sal_Bool MouseMove(const MouseEvent& ); 84*cdf0e10cSrcweir virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // #95491# moved from inline to *.cxx 87*cdf0e10cSrcweir virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual sal_Bool Command(const CommandEvent& rCEvt); 90*cdf0e10cSrcweir virtual sal_Bool RequestHelp(const HelpEvent& rHEvt); 91*cdf0e10cSrcweir virtual void Paint(const Rectangle&, ::sd::Window* ); 92*cdf0e10cSrcweir virtual void ReceiveRequest(SfxRequest& rReq); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir virtual void Activate(); // Function aktivieren 95*cdf0e10cSrcweir virtual void Deactivate(); // Function deaktivieren 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir virtual void ScrollStart() {} // diese Funktionen werden von 98*cdf0e10cSrcweir virtual void ScrollEnd() {} // ForceScroll aufgerufen 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir void SetWindow(::sd::Window* pWin) { mpWindow = pWin; } 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // #97016# II 103*cdf0e10cSrcweir virtual void SelectionHasChanged(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir sal_uInt16 GetSlotID() const { return( nSlotId ); } 106*cdf0e10cSrcweir sal_uInt16 GetSlotValue() const { return( nSlotValue ); } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void SetNoScrollUntilInside(sal_Bool bNoScroll = sal_True) 109*cdf0e10cSrcweir { bNoScrollUntilInside = bNoScroll; } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir void StartDelayToScrollTimer (); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // #97016# 114*cdf0e10cSrcweir virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir /** is called when the currenct function should be aborted. <p> 117*cdf0e10cSrcweir This is used when a function gets a KEY_ESCAPE but can also 118*cdf0e10cSrcweir be called directly. 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir @returns true if a active function was aborted 121*cdf0e10cSrcweir */ 122*cdf0e10cSrcweir virtual bool cancel(); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir // #i33136# 125*cdf0e10cSrcweir /** Decide if the object to be created should be created 126*cdf0e10cSrcweir orthogonal. Default implementation uses nSlotID 127*cdf0e10cSrcweir to decide. May be overloaded to use other criterias 128*cdf0e10cSrcweir for this decision 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir @returns true if the to be created object should be orthogonal. 131*cdf0e10cSrcweir */ 132*cdf0e10cSrcweir virtual bool doConstructOrthogonal() const; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir protected: 135*cdf0e10cSrcweir /** 136*cdf0e10cSrcweir @param pViewSh 137*cdf0e10cSrcweir May be NULL. 138*cdf0e10cSrcweir */ 139*cdf0e10cSrcweir FuPoor (ViewShell* pViewSh, 140*cdf0e10cSrcweir ::sd::Window* pWin, 141*cdf0e10cSrcweir ::sd::View* pView, 142*cdf0e10cSrcweir SdDrawDocument* pDoc, 143*cdf0e10cSrcweir SfxRequest& rReq); 144*cdf0e10cSrcweir virtual ~FuPoor (void); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir DECL_LINK( DelayHdl, Timer * ); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir void ImpForceQuadratic(Rectangle& rRect); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir /** Switch to another layer. The layer to switch to is specified by an 151*cdf0e10cSrcweir offset relative to the active layer. With respect to the layer bar 152*cdf0e10cSrcweir control at the lower left of the document window positive values 153*cdf0e10cSrcweir move to the right and negative values move to the left. 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir <p>Switching the layer is independant of the view's layer mode. The 156*cdf0e10cSrcweir layers are switched even when the layer mode is turned off and the 157*cdf0e10cSrcweir layer control is not visible.</p> 158*cdf0e10cSrcweir @param nOffset 159*cdf0e10cSrcweir If the offset is positive skip that many layers in selecting the 160*cdf0e10cSrcweir next layer. If it is negative then select a previous one. An 161*cdf0e10cSrcweir offset or zero does not change the current layer. If the 162*cdf0e10cSrcweir resulting index lies outside the valid range of indices then it 163*cdf0e10cSrcweir is set to either the minimal or maximal valid index, whitchever 164*cdf0e10cSrcweir is nearer. 165*cdf0e10cSrcweir */ 166*cdf0e10cSrcweir void SwitchLayer (sal_Int32 nOffset); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir ::sd::View* mpView; 169*cdf0e10cSrcweir ViewShell* mpViewShell; 170*cdf0e10cSrcweir ::sd::Window* mpWindow; 171*cdf0e10cSrcweir DrawDocShell* mpDocSh; 172*cdf0e10cSrcweir SdDrawDocument* mpDoc; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir sal_uInt16 nSlotId; 175*cdf0e10cSrcweir sal_uInt16 nSlotValue; 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir Dialog* pDialog; 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir Timer aScrollTimer; // fuer Autoscrolling 180*cdf0e10cSrcweir DECL_LINK( ScrollHdl, Timer * ); 181*cdf0e10cSrcweir void ForceScroll(const Point& aPixPos); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir Timer aDragTimer; // fuer Drag&Drop 184*cdf0e10cSrcweir DECL_LINK( DragHdl, Timer * ); 185*cdf0e10cSrcweir sal_Bool bIsInDragMode; 186*cdf0e10cSrcweir Point aMDPos; // Position von MouseButtonDown 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir // Flag, um AutoScrolling zu verhindern, bis von ausserhalb in das 189*cdf0e10cSrcweir // Fenster hinein gedragt wurde 190*cdf0e10cSrcweir sal_Bool bNoScrollUntilInside; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // Timer um das scrolling zu verzoegern, wenn aus dem fenster 193*cdf0e10cSrcweir // herausgedraggt wird (ca. 1 sec.) 194*cdf0e10cSrcweir Timer aDelayToScrollTimer; // fuer Verzoegerung bis scroll 195*cdf0e10cSrcweir sal_Bool bScrollable; 196*cdf0e10cSrcweir sal_Bool bDelayActive; 197*cdf0e10cSrcweir sal_Bool bFirstMouseMove; 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir // #95491# member to hold state of the mouse buttons for creation 200*cdf0e10cSrcweir // of own MouseEvents (like in ScrollHdl) 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir private: 203*cdf0e10cSrcweir sal_uInt16 mnCode; 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir }; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir typedef rtl::Reference< FuPoor > FunctionReference; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir } // end of namespace sd 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir #endif // _SD_FUPOOR_HXX 212*cdf0e10cSrcweir 213