1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _IPWIN_HXX
29 #define _IPWIN_HXX
30 
31 #include <tools/gen.hxx>
32 #include <vcl/window.hxx>
33 #include <tools/svborder.hxx>
34 
35 /********************** SvResizeHelper ***********************************
36 *************************************************************************/
37 class SvResizeHelper
38 {
39 	Size        aBorder;
40 	Rectangle   aOuter;
41 	short       nGrab; // -1 kein Grab,  0 - 7, 8 = Move, siehe FillHandle...
42 	Point       aSelPos;
43 	sal_Bool		bResizeable;
44 public:
45 				SvResizeHelper();
46 
47 	void		SetResizeable( sal_Bool b ) { bResizeable = b; }
48 	short       GetGrab() const { return nGrab; }
49 	void        SetBorderPixel( const Size & rBorderP )
50 				{ aBorder = rBorderP; }
51 	const Size & GetBorderPixel() const { return aBorder; }
52 	const Rectangle & GetOuterRectPixel() const
53 				{ return aOuter; }
54 	void        SetOuterRectPixel( const Rectangle & rRect )
55 				{ aOuter = rRect; }
56 	Rectangle   GetInnerRectPixel() const
57 				{
58 					Rectangle aRect( aOuter );
59 					aRect.Top()    += aBorder.Height();
60 					aRect.Left()   += aBorder.Width();
61 					aRect.Bottom() -= aBorder.Height();
62 					aRect.Right()  -= aBorder.Width();
63 					return aRect;
64 				}
65 				// Im Uhrzeigersinn, beginnend bei Linksoben
66 	void        FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
67 	void        FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
68 	void        Draw( OutputDevice * );
69 	void        InvalidateBorder( Window * );
70 	sal_Bool        SelectBegin( Window *, const Point & rPos );
71 	short       SelectMove( Window * pWin, const Point & rPos );
72 	Point       GetTrackPosPixel( const Rectangle & rRect ) const;
73 	Rectangle	GetTrackRectPixel( const Point & rTrackPos ) const;
74 	void        ValidateRect( Rectangle & rValidate ) const;
75 	sal_Bool        SelectRelease( Window *, const Point & rPos, Rectangle & rOutPosSize );
76 	void        Release( Window * pWin );
77 };
78 
79 /********************** SvResizeWindow ***********************************
80 *************************************************************************/
81 class VCLXHatchWindow;
82 class SvResizeWindow : public Window
83 {
84 	Pointer         m_aOldPointer;
85 	short           m_nMoveGrab;  // Letzer Pointertyp
86 	SvResizeHelper  m_aResizer;
87     sal_Bool        m_bActive;
88 
89 	VCLXHatchWindow* m_pWrapper;
90 public:
91 	SvResizeWindow( Window* pParent, VCLXHatchWindow* pWrapper );
92 
93 	void    SetHatchBorderPixel( const Size & rSize );
94 
95 	void    SelectMouse( const Point & rPos );
96 	virtual void    MouseButtonUp( const MouseEvent & rEvt );
97 	virtual void    MouseMove( const MouseEvent & rEvt );
98 	virtual void    MouseButtonDown( const MouseEvent & rEvt );
99 	virtual void    KeyInput( const KeyEvent & rEvt );
100 	virtual void    Resize();
101 	virtual void    Paint( const Rectangle & );
102     virtual long    Notify( NotifyEvent& rNEvt );
103     virtual long    PreNotify( NotifyEvent& rNEvt );
104 
105 	void	QueryObjAreaPixel( Rectangle & );
106 	void    RequestObjAreaPixel( const Rectangle & );
107 };
108 
109 #endif // _IPWIN_HXX
110 
111