xref: /AOO41X/main/svtools/source/hatchwindow/ipwin.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 _IPWIN_HXX
29*cdf0e10cSrcweir #define _IPWIN_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/gen.hxx>
32*cdf0e10cSrcweir #include <vcl/window.hxx>
33*cdf0e10cSrcweir #include <tools/svborder.hxx>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir /********************** SvResizeHelper ***********************************
36*cdf0e10cSrcweir *************************************************************************/
37*cdf0e10cSrcweir class SvResizeHelper
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir 	Size        aBorder;
40*cdf0e10cSrcweir 	Rectangle   aOuter;
41*cdf0e10cSrcweir 	short       nGrab; // -1 kein Grab,  0 - 7, 8 = Move, siehe FillHandle...
42*cdf0e10cSrcweir 	Point       aSelPos;
43*cdf0e10cSrcweir 	sal_Bool		bResizeable;
44*cdf0e10cSrcweir public:
45*cdf0e10cSrcweir 				SvResizeHelper();
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 	void		SetResizeable( sal_Bool b ) { bResizeable = b; }
48*cdf0e10cSrcweir 	short       GetGrab() const { return nGrab; }
49*cdf0e10cSrcweir 	void        SetBorderPixel( const Size & rBorderP )
50*cdf0e10cSrcweir 				{ aBorder = rBorderP; }
51*cdf0e10cSrcweir 	const Size & GetBorderPixel() const { return aBorder; }
52*cdf0e10cSrcweir 	const Rectangle & GetOuterRectPixel() const
53*cdf0e10cSrcweir 				{ return aOuter; }
54*cdf0e10cSrcweir 	void        SetOuterRectPixel( const Rectangle & rRect )
55*cdf0e10cSrcweir 				{ aOuter = rRect; }
56*cdf0e10cSrcweir 	Rectangle   GetInnerRectPixel() const
57*cdf0e10cSrcweir 				{
58*cdf0e10cSrcweir 					Rectangle aRect( aOuter );
59*cdf0e10cSrcweir 					aRect.Top()    += aBorder.Height();
60*cdf0e10cSrcweir 					aRect.Left()   += aBorder.Width();
61*cdf0e10cSrcweir 					aRect.Bottom() -= aBorder.Height();
62*cdf0e10cSrcweir 					aRect.Right()  -= aBorder.Width();
63*cdf0e10cSrcweir 					return aRect;
64*cdf0e10cSrcweir 				}
65*cdf0e10cSrcweir 				// Im Uhrzeigersinn, beginnend bei Linksoben
66*cdf0e10cSrcweir 	void        FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
67*cdf0e10cSrcweir 	void        FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
68*cdf0e10cSrcweir 	void        Draw( OutputDevice * );
69*cdf0e10cSrcweir 	void        InvalidateBorder( Window * );
70*cdf0e10cSrcweir 	sal_Bool        SelectBegin( Window *, const Point & rPos );
71*cdf0e10cSrcweir 	short       SelectMove( Window * pWin, const Point & rPos );
72*cdf0e10cSrcweir 	Point       GetTrackPosPixel( const Rectangle & rRect ) const;
73*cdf0e10cSrcweir 	Rectangle	GetTrackRectPixel( const Point & rTrackPos ) const;
74*cdf0e10cSrcweir 	void        ValidateRect( Rectangle & rValidate ) const;
75*cdf0e10cSrcweir 	sal_Bool        SelectRelease( Window *, const Point & rPos, Rectangle & rOutPosSize );
76*cdf0e10cSrcweir 	void        Release( Window * pWin );
77*cdf0e10cSrcweir };
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir /********************** SvResizeWindow ***********************************
80*cdf0e10cSrcweir *************************************************************************/
81*cdf0e10cSrcweir class VCLXHatchWindow;
82*cdf0e10cSrcweir class SvResizeWindow : public Window
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir 	Pointer         m_aOldPointer;
85*cdf0e10cSrcweir 	short           m_nMoveGrab;  // Letzer Pointertyp
86*cdf0e10cSrcweir 	SvResizeHelper  m_aResizer;
87*cdf0e10cSrcweir     sal_Bool        m_bActive;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 	VCLXHatchWindow* m_pWrapper;
90*cdf0e10cSrcweir public:
91*cdf0e10cSrcweir 	SvResizeWindow( Window* pParent, VCLXHatchWindow* pWrapper );
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	void    SetHatchBorderPixel( const Size & rSize );
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	void    SelectMouse( const Point & rPos );
96*cdf0e10cSrcweir 	virtual void    MouseButtonUp( const MouseEvent & rEvt );
97*cdf0e10cSrcweir 	virtual void    MouseMove( const MouseEvent & rEvt );
98*cdf0e10cSrcweir 	virtual void    MouseButtonDown( const MouseEvent & rEvt );
99*cdf0e10cSrcweir 	virtual void    KeyInput( const KeyEvent & rEvt );
100*cdf0e10cSrcweir 	virtual void    Resize();
101*cdf0e10cSrcweir 	virtual void    Paint( const Rectangle & );
102*cdf0e10cSrcweir     virtual long    Notify( NotifyEvent& rNEvt );
103*cdf0e10cSrcweir     virtual long    PreNotify( NotifyEvent& rNEvt );
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 	void	QueryObjAreaPixel( Rectangle & );
106*cdf0e10cSrcweir 	void    RequestObjAreaPixel( const Rectangle & );
107*cdf0e10cSrcweir };
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir #endif // _IPWIN_HXX
110*cdf0e10cSrcweir 
111