1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _IPWIN_HXX
25 #define _IPWIN_HXX
26 
27 #include <tools/gen.hxx>
28 #include <vcl/window.hxx>
29 #include <tools/svborder.hxx>
30 
31 /********************** SvResizeHelper ***********************************
32 *************************************************************************/
33 class SvResizeHelper
34 {
35 	Size        aBorder;
36 	Rectangle   aOuter;
37 	short       nGrab; // -1 kein Grab,  0 - 7, 8 = Move, siehe FillHandle...
38 	Point       aSelPos;
39 	sal_Bool		bResizeable;
40 public:
41 				SvResizeHelper();
42 
SetResizeable(sal_Bool b)43 	void		SetResizeable( sal_Bool b ) { bResizeable = b; }
GetGrab() const44 	short       GetGrab() const { return nGrab; }
SetBorderPixel(const Size & rBorderP)45 	void        SetBorderPixel( const Size & rBorderP )
46 				{ aBorder = rBorderP; }
GetBorderPixel() const47 	const Size & GetBorderPixel() const { return aBorder; }
GetOuterRectPixel() const48 	const Rectangle & GetOuterRectPixel() const
49 				{ return aOuter; }
SetOuterRectPixel(const Rectangle & rRect)50 	void        SetOuterRectPixel( const Rectangle & rRect )
51 				{ aOuter = rRect; }
GetInnerRectPixel() const52 	Rectangle   GetInnerRectPixel() const
53 				{
54 					Rectangle aRect( aOuter );
55 					aRect.Top()    += aBorder.Height();
56 					aRect.Left()   += aBorder.Width();
57 					aRect.Bottom() -= aBorder.Height();
58 					aRect.Right()  -= aBorder.Width();
59 					return aRect;
60 				}
61 				// Im Uhrzeigersinn, beginnend bei Linksoben
62 	void        FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
63 	void        FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
64 	void        Draw( OutputDevice * );
65 	void        InvalidateBorder( Window * );
66 	sal_Bool        SelectBegin( Window *, const Point & rPos );
67 	short       SelectMove( Window * pWin, const Point & rPos );
68 	Point       GetTrackPosPixel( const Rectangle & rRect ) const;
69 	Rectangle	GetTrackRectPixel( const Point & rTrackPos ) const;
70 	void        ValidateRect( Rectangle & rValidate ) const;
71 	sal_Bool        SelectRelease( Window *, const Point & rPos, Rectangle & rOutPosSize );
72 	void        Release( Window * pWin );
73 };
74 
75 /********************** SvResizeWindow ***********************************
76 *************************************************************************/
77 class VCLXHatchWindow;
78 class SvResizeWindow : public Window
79 {
80 	Pointer         m_aOldPointer;
81 	short           m_nMoveGrab;  // Letzer Pointertyp
82 	SvResizeHelper  m_aResizer;
83     sal_Bool        m_bActive;
84 
85 	VCLXHatchWindow* m_pWrapper;
86 public:
87 	SvResizeWindow( Window* pParent, VCLXHatchWindow* pWrapper );
88 
89 	void    SetHatchBorderPixel( const Size & rSize );
90 
91 	void    SelectMouse( const Point & rPos );
92 	virtual void    MouseButtonUp( const MouseEvent & rEvt );
93 	virtual void    MouseMove( const MouseEvent & rEvt );
94 	virtual void    MouseButtonDown( const MouseEvent & rEvt );
95 	virtual void    KeyInput( const KeyEvent & rEvt );
96 	virtual void    Resize();
97 	virtual void    Paint( const Rectangle & );
98     virtual long    Notify( NotifyEvent& rNEvt );
99     virtual long    PreNotify( NotifyEvent& rNEvt );
100 
101 	void	QueryObjAreaPixel( Rectangle & );
102 	void    RequestObjAreaPixel( const Rectangle & );
103 };
104 
105 #endif // _IPWIN_HXX
106 
107