Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_so3 / ipwin.hxx
blob20dc9b3e36b73f9a3cb5d0d188173b54191f8df6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ipwin.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _IPWIN_HXX
32 #define _IPWIN_HXX
34 #ifndef _GEN_HXX //autogen
35 #include <tools/gen.hxx>
36 #endif
38 #ifndef _WINDOW_HXX //autogen
39 #include <vcl/window.hxx>
40 #endif
41 #include <bf_so3/so2ref.hxx>
42 #include <bf_so3/iface.hxx>
44 #ifndef INCLUDED_SO3DLLAPI_H
45 #include "bf_so3/so3dllapi.h"
46 #endif
48 namespace binfilter {
50 /********************** SvResizeHelper ***********************************
51 *************************************************************************/
52 class SO3_DLLPUBLIC SvResizeHelper
54 private:
55 Size aBorder;
56 Rectangle aOuter;
57 short nGrab; // -1 kein Grab, 0 - 7, 8 = Move, siehe FillHandle...
58 Point aSelPos;
59 BOOL bResizeable;
60 public:
61 SvResizeHelper();
63 void SetResizeable( BOOL b ) { bResizeable = b; }
64 short GetGrab() const { return nGrab; }
65 void SetBorderPixel( const Size & rBorderP )
66 { aBorder = rBorderP; }
67 const Size & GetBorderPixel() const { return aBorder; }
68 const Rectangle & GetOuterRectPixel() const
69 { return aOuter; }
70 void SetOuterRectPixel( const Rectangle & rRect )
71 { aOuter = rRect; }
72 Rectangle GetInnerRectPixel() const
74 Rectangle aRect( aOuter );
75 aRect.Top() += aBorder.Height();
76 aRect.Left() += aBorder.Width();
77 aRect.Bottom() -= aBorder.Height();
78 aRect.Right() -= aBorder.Width();
79 return aRect;
81 // Im Uhrzeigersinn, beginnend bei Linksoben
82 void FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
83 void FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
84 void Draw( OutputDevice * );
85 void InvalidateBorder( Window * );
86 BOOL SelectBegin( Window *, const Point & rPos );
87 short SelectMove( Window * pWin, const Point & rPos );
88 Point GetTrackPosPixel( const Rectangle & rRect ) const;
89 Rectangle GetTrackRectPixel( const Point & rTrackPos ) const;
90 void ValidateRect( Rectangle & rValidate ) const;
91 BOOL SelectRelease( Window *, const Point & rPos, Rectangle & rOutPosSize );
92 void Release( Window * pWin );
95 /********************** SvResizeWindow ***********************************
96 *************************************************************************/
97 class SO3_DLLPUBLIC SvResizeWindow : public Window
99 private:
100 Pointer aOldPointer;
101 short nMoveGrab; // Letzer Pointertyp
102 SvBorder aBorder;
103 Point aPosCorrection;
104 Window * pObjWin;
105 protected:
106 SvResizeHelper aResizer;
107 SO3_DLLPRIVATE void AdjustObjWin();
108 public:
109 SvResizeWindow( Window * pParent );
111 void SetObjWin( Window * pNewWin );
112 Window * GetObjWin() const
113 { return pObjWin; }
115 void SetHatchBorderPixel( const Size & rSize )
117 aResizer.SetBorderPixel( rSize );
118 AdjustObjWin();
120 const Size & GetHatchBorderPixel() const
121 { return aResizer.GetBorderPixel(); }
123 const SvBorder & GetBorderPixel() const
124 { return aBorder; }
126 SvBorder GetAllBorderPixel() const
128 SvBorder aB( aBorder );
129 return aB += GetHatchBorderPixel();
132 void SetPosCorrectionPixel( const Point & rNewCorr )
133 { aPosCorrection = rNewCorr; }
134 const Point & GetPosCorrectionPixel() const
135 { return aPosCorrection; }
137 Rectangle CalcInnerRectPixel( const Point & rPos, const Size & rSize ) const;
138 Rectangle GetInnerRectPixel() const;
140 void SetInnerPosSizePixel( const Point &, const Size & );
142 void TerminateResizing() { aResizer.Release( this ); }
144 void SelectMouse( const Point & rPos );
145 void MouseButtonUp( const MouseEvent & rEvt );
146 void MouseMove( const MouseEvent & rEvt );
147 void MouseButtonDown( const MouseEvent & rEvt );
148 void KeyInput( const KeyEvent & rEvt );
149 void Resize();
150 void Paint( const Rectangle & );
151 virtual void QueryObjAreaPixel( Rectangle & );
152 virtual void RequestObjAreaPixel( const Rectangle & );
155 /********************** SvInPlaceWindow **********************************
156 *************************************************************************/
157 class SvInPlaceEnvironment;
158 class SO3_DLLPUBLIC SvInPlaceWindow : public SvResizeWindow
160 private:
161 SvInPlaceEnvironment * pIPEnv;
162 public:
163 SvInPlaceWindow( Window * pParent, SvInPlaceEnvironment * );
164 void KeyInput( const KeyEvent & rEvt );
165 virtual void QueryObjAreaPixel( Rectangle & );
166 virtual void RequestObjAreaPixel( const Rectangle & );
169 /********************** SvInPlaceClipWindow ******************************
170 *************************************************************************/
171 class SO3_DLLPUBLIC SvInPlaceClipWindow : public Window
173 private:
174 SvResizeWindow * pResizeWin;
175 Rectangle aMaxClip;
176 public:
177 SvInPlaceClipWindow( Window * pParent );
179 void SetResizeWin( SvResizeWindow * pNewWin )
180 { pResizeWin = pNewWin; }
181 SvResizeWindow * GetResizeWin() const
182 { return pResizeWin; }
184 void SetRectsPixel( const Rectangle & rObjRect,
185 const Rectangle & rInPlaceWinMaxRect );
190 #endif // _IPWIN_HXX