xref: /aoo41x/main/vcl/source/window/splitwin.cxx (revision f1dd8134)
19f62ea84SAndrew Rist /**************************************************************
2789f9e36Smseidel  *
39f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59f62ea84SAndrew Rist  * distributed with this work for additional information
69f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
99f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10789f9e36Smseidel  *
119f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12789f9e36Smseidel  *
139f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149f62ea84SAndrew Rist  * software distributed under the License is distributed on an
159f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
179f62ea84SAndrew Rist  * specific language governing permissions and limitations
189f62ea84SAndrew Rist  * under the License.
19789f9e36Smseidel  *
209f62ea84SAndrew Rist  *************************************************************/
219f62ea84SAndrew Rist 
229f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <string.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <tools/list.hxx>
30cdf0e10cSrcweir #include <tools/debug.hxx>
31cdf0e10cSrcweir #include <tools/rcid.h>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vcl/event.hxx>
34cdf0e10cSrcweir #include <vcl/wall.hxx>
35cdf0e10cSrcweir #include <vcl/bitmap.hxx>
36cdf0e10cSrcweir #include <vcl/decoview.hxx>
37cdf0e10cSrcweir #include <vcl/symbol.hxx>
38cdf0e10cSrcweir #include <vcl/image.hxx>
39cdf0e10cSrcweir #include <vcl/help.hxx>
40cdf0e10cSrcweir #include <vcl/splitwin.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <svdata.hxx>
43cdf0e10cSrcweir #include <svids.hrc>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // =======================================================================
47cdf0e10cSrcweir 
48cdf0e10cSrcweir // Attention: Must not contain non-PODs because array is enlarged/copied
49cdf0e10cSrcweir // with the use of memmove/memcpy.
50cdf0e10cSrcweir struct ImplSplitItem
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	long				mnSize;
53cdf0e10cSrcweir 	long				mnPixSize;
54cdf0e10cSrcweir 	long				mnLeft;
55cdf0e10cSrcweir 	long				mnTop;
56cdf0e10cSrcweir 	long				mnWidth;
57cdf0e10cSrcweir 	long				mnHeight;
58cdf0e10cSrcweir 	long				mnSplitPos;
59cdf0e10cSrcweir 	long				mnSplitSize;
60cdf0e10cSrcweir 	long				mnOldSplitPos;
61cdf0e10cSrcweir 	long				mnOldSplitSize;
62cdf0e10cSrcweir 	long				mnOldWidth;
63cdf0e10cSrcweir 	long				mnOldHeight;
64cdf0e10cSrcweir 	ImplSplitSet*		mpSet;
65cdf0e10cSrcweir 	Window* 			mpWindow;
66cdf0e10cSrcweir 	Window* 			mpOrgParent;
67789f9e36Smseidel 	sal_uInt16			mnId;
68cdf0e10cSrcweir 	SplitWindowItemBits mnBits;
69789f9e36Smseidel 	sal_Bool			mbFixed;
70789f9e36Smseidel 	sal_Bool			mbSubSize;
71789f9e36Smseidel 	/// Minimal width or height of the item. -1 means no restriction.
72789f9e36Smseidel 	long				mnMinSize;
73789f9e36Smseidel 	/// Maximal width or height of the item. -1 means no restriction.
74789f9e36Smseidel 	long				mnMaxSize;
75cdf0e10cSrcweir };
76cdf0e10cSrcweir 
77cdf0e10cSrcweir struct ImplSplitSet
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 	ImplSplitItem*		mpItems;
80cdf0e10cSrcweir 	Wallpaper*			mpWallpaper;
81cdf0e10cSrcweir 	Bitmap* 			mpBitmap;
82cdf0e10cSrcweir 	long				mnLastSize;
83cdf0e10cSrcweir 	long				mnSplitSize;
84789f9e36Smseidel 	sal_uInt16			mnItems;
85789f9e36Smseidel 	sal_uInt16			mnId;
86789f9e36Smseidel 	sal_Bool			mbCalcPix;
87cdf0e10cSrcweir };
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 
91cdf0e10cSrcweir /** Check whether the given size is inside the valid range defined by
92789f9e36Smseidel     [rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return
93cdf0e10cSrcweir     the upper or lower bound, respectively. Otherwise return the given size
94cdf0e10cSrcweir     unmodified.
95cdf0e10cSrcweir     Note that either mnMinSize and/or mnMaxSize can be -1 in which case the
96cdf0e10cSrcweir     size has not lower or upper bound.
97cdf0e10cSrcweir */
98cdf0e10cSrcweir namespace {
ValidateSize(const long nSize,const ImplSplitItem & rItem)99789f9e36Smseidel 	long ValidateSize (const long nSize, const ImplSplitItem& rItem)
100789f9e36Smseidel 	{
101789f9e36Smseidel 		if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize)
102789f9e36Smseidel 			return rItem.mnMinSize;
103789f9e36Smseidel 		else if (rItem.mnMaxSize>0 && nSize>rItem.mnMaxSize)
104789f9e36Smseidel 			return rItem.mnMaxSize;
105789f9e36Smseidel 		else
106789f9e36Smseidel 			return nSize;
107789f9e36Smseidel 	}
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
111cdf0e10cSrcweir #define SPLITWIN_SPLITSIZE				3
112cdf0e10cSrcweir #define SPLITWIN_SPLITSIZEEX			4
113cdf0e10cSrcweir #define SPLITWIN_SPLITSIZEEXLN			6
114cdf0e10cSrcweir #define SPLITWIN_SPLITSIZEAUTOHIDE		36
115cdf0e10cSrcweir #define SPLITWIN_SPLITSIZEFADE			36
116cdf0e10cSrcweir 
117cdf0e10cSrcweir #define SPLIT_HORZ				((sal_uInt16)0x0001)
118cdf0e10cSrcweir #define SPLIT_VERT				((sal_uInt16)0x0002)
119cdf0e10cSrcweir #define SPLIT_WINDOW			((sal_uInt16)0x0004)
120cdf0e10cSrcweir #define SPLIT_NOSPLIT			((sal_uInt16)0x8000)
121cdf0e10cSrcweir 
122cdf0e10cSrcweir // -----------------------------------------------------------------------
123cdf0e10cSrcweir 
DECLARE_LIST(ImplSplitList,SplitWindow *)124cdf0e10cSrcweir DECLARE_LIST( ImplSplitList, SplitWindow* )
125cdf0e10cSrcweir 
126cdf0e10cSrcweir // =======================================================================
127cdf0e10cSrcweir 
128cdf0e10cSrcweir static void ImplCalcBorder( WindowAlign eAlign, sal_Bool bNoAlign,
129cdf0e10cSrcweir 							long& rLeft, long& rTop,
130cdf0e10cSrcweir 							long& rRight, long& rBottom )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir 	if ( bNoAlign )
133cdf0e10cSrcweir 	{
134cdf0e10cSrcweir 		rLeft	= 2;
135cdf0e10cSrcweir 		rTop	= 2;
136cdf0e10cSrcweir 		rRight	= 2;
137cdf0e10cSrcweir 		rBottom = 2;
138cdf0e10cSrcweir 	}
139cdf0e10cSrcweir 	else
140cdf0e10cSrcweir 	{
141cdf0e10cSrcweir 		if ( eAlign == WINDOWALIGN_TOP )
142cdf0e10cSrcweir 		{
143cdf0e10cSrcweir 			rLeft	= 2;
144cdf0e10cSrcweir 			rTop	= 2;
145cdf0e10cSrcweir 			rRight	= 2;
146cdf0e10cSrcweir 			rBottom = 0;
147cdf0e10cSrcweir 		}
148cdf0e10cSrcweir 		else if ( eAlign == WINDOWALIGN_LEFT )
149cdf0e10cSrcweir 		{
150cdf0e10cSrcweir 			rLeft	= 2;
151cdf0e10cSrcweir 			rTop	= 2;
152cdf0e10cSrcweir 			rRight	= 0;
153cdf0e10cSrcweir 			rBottom = 2;
154cdf0e10cSrcweir 		}
155cdf0e10cSrcweir 		else if ( eAlign == WINDOWALIGN_BOTTOM )
156cdf0e10cSrcweir 		{
157cdf0e10cSrcweir 			rLeft	= 2;
158cdf0e10cSrcweir 			rTop	= 0;
159cdf0e10cSrcweir 			rRight	= 2;
160cdf0e10cSrcweir 			rBottom = 2;
161cdf0e10cSrcweir 		}
162cdf0e10cSrcweir 		else
163cdf0e10cSrcweir 		{
164cdf0e10cSrcweir 			rLeft	= 0;
165cdf0e10cSrcweir 			rTop	= 2;
166cdf0e10cSrcweir 			rRight	= 2;
167cdf0e10cSrcweir 			rBottom = 2;
168cdf0e10cSrcweir 		}
169cdf0e10cSrcweir 	}
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir // -----------------------------------------------------------------------
173cdf0e10cSrcweir 
ImplDrawBorder(SplitWindow * pWin)174cdf0e10cSrcweir void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
175cdf0e10cSrcweir {
176cdf0e10cSrcweir 	const StyleSettings&	rStyleSettings = pWin->GetSettings().GetStyleSettings();
177cdf0e10cSrcweir 	long					nDX = pWin->mnDX;
178cdf0e10cSrcweir 	long					nDY = pWin->mnDY;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	if ( pWin->mbNoAlign )
181cdf0e10cSrcweir 	{
182cdf0e10cSrcweir 		DecorationView	aDecoView( pWin );
183cdf0e10cSrcweir 		Point			aTmpPoint;
184cdf0e10cSrcweir 		Rectangle		aRect( aTmpPoint, Size( nDX, nDY ) );
185cdf0e10cSrcweir 		aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
186cdf0e10cSrcweir 	}
187cdf0e10cSrcweir 	else
188cdf0e10cSrcweir 	{/*
189cdf0e10cSrcweir 		if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
190cdf0e10cSrcweir 		{
191cdf0e10cSrcweir 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
192cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
193cdf0e10cSrcweir 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
194cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
195cdf0e10cSrcweir 		}
196cdf0e10cSrcweir 		else
197cdf0e10cSrcweir 		{
198cdf0e10cSrcweir 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
199cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
200cdf0e10cSrcweir 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
201cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 1 ), Point( nDX-1, 1 ) );
202cdf0e10cSrcweir 			if ( (pWin->meAlign == WINDOWALIGN_LEFT) || (pWin->meAlign == WINDOWALIGN_RIGHT) )
203cdf0e10cSrcweir 			{
204cdf0e10cSrcweir 				if ( pWin->meAlign == WINDOWALIGN_LEFT )
205cdf0e10cSrcweir 				{
206cdf0e10cSrcweir 					pWin->SetLineColor( rStyleSettings.GetShadowColor() );
207cdf0e10cSrcweir 					pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
208cdf0e10cSrcweir 					pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
209cdf0e10cSrcweir 					pWin->SetLineColor( rStyleSettings.GetLightColor() );
210cdf0e10cSrcweir 					pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
211cdf0e10cSrcweir 					pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
212cdf0e10cSrcweir 				}
213cdf0e10cSrcweir 				else
214cdf0e10cSrcweir 				{
215cdf0e10cSrcweir 					pWin->SetLineColor( rStyleSettings.GetShadowColor() );
216cdf0e10cSrcweir 					pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
217cdf0e10cSrcweir 					pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) );
218cdf0e10cSrcweir 					pWin->SetLineColor( rStyleSettings.GetLightColor() );
219cdf0e10cSrcweir 					pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
220cdf0e10cSrcweir 					pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
221cdf0e10cSrcweir 				}
222cdf0e10cSrcweir 			}
223cdf0e10cSrcweir 		}*/
224cdf0e10cSrcweir 		if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
225cdf0e10cSrcweir 		{
226cdf0e10cSrcweir 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
227cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
228cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
229789f9e36Smseidel 			pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
230cdf0e10cSrcweir 
231789f9e36Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
232cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
233cdf0e10cSrcweir 			pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
234cdf0e10cSrcweir 			pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
235cdf0e10cSrcweir 		}
236cdf0e10cSrcweir 		else if ( pWin->meAlign == WINDOWALIGN_TOP )
237cdf0e10cSrcweir 		{
238cdf0e10cSrcweir 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
239cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
240cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
241789f9e36Smseidel 			pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-1 ) );
242cdf0e10cSrcweir 
243789f9e36Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
244cdf0e10cSrcweir 			pWin->DrawLine( Point( 1, 1 ), Point( nDX-3, 1 ) );
245cdf0e10cSrcweir 			pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-1 ) );
246cdf0e10cSrcweir 			pWin->DrawLine( Point( nDX-1, 1 ), Point( nDX-1, nDY-1 ) );
247789f9e36Smseidel 		}
248789f9e36Smseidel 		else if ( pWin->meAlign == WINDOWALIGN_LEFT )
249789f9e36Smseidel 		{
250789f9e36Smseidel 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
251cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
252cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
253cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
254cdf0e10cSrcweir 
255789f9e36Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
256cdf0e10cSrcweir 			pWin->DrawLine( Point( 1, 1 ), Point( nDX-1, 1 ) );
257cdf0e10cSrcweir 			pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
258cdf0e10cSrcweir 			pWin->DrawLine( Point( 1, nDY-1 ), Point( nDX-1, nDY-1 ) );
259cdf0e10cSrcweir 		}
260789f9e36Smseidel 		else
261789f9e36Smseidel 		{
262789f9e36Smseidel 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
263cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 0 ), Point( nDX-2, 0 ) );
264cdf0e10cSrcweir 			pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
265cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) );
266cdf0e10cSrcweir 
267789f9e36Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
268cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, 1 ), Point( nDX-3, 1 ) );
269cdf0e10cSrcweir 			pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
270cdf0e10cSrcweir 			pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir // -----------------------------------------------------------------------
276cdf0e10cSrcweir 
ImplDrawBorderLine(SplitWindow * pWin)277cdf0e10cSrcweir void SplitWindow::ImplDrawBorderLine( SplitWindow* pWin )
278cdf0e10cSrcweir {
27961648e64Smseidel 	if ( pWin->mbFadeOut || pWin->mbAutoHide )
28061648e64Smseidel 	{
28161648e64Smseidel 		const StyleSettings&	rStyleSettings = pWin->GetSettings().GetStyleSettings();
28261648e64Smseidel 		long					nDX = pWin->mnDX;
28361648e64Smseidel 		long					nDY = pWin->mnDY;
284cdf0e10cSrcweir 
28561648e64Smseidel 		if ( pWin->meAlign == WINDOWALIGN_LEFT )
28661648e64Smseidel 		{
28761648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
28861648e64Smseidel 			pWin->DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, nDY-3 ) );
28961648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
29061648e64Smseidel 			pWin->DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN, 1 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN, nDY-4 ) );
29161648e64Smseidel 		}
29261648e64Smseidel 		else if ( pWin->meAlign == WINDOWALIGN_RIGHT )
29361648e64Smseidel 		{
29461648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
29561648e64Smseidel 			pWin->DrawLine( Point( SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( SPLITWIN_SPLITSIZEEXLN-1, nDY-3 ) );
29661648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
29761648e64Smseidel 			pWin->DrawLine( Point( SPLITWIN_SPLITSIZEEXLN, 1 ), Point( SPLITWIN_SPLITSIZEEXLN, nDY-4 ) );
29861648e64Smseidel 		}
29961648e64Smseidel 		else if ( pWin->meAlign == WINDOWALIGN_TOP )
30061648e64Smseidel 		{
30161648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
30261648e64Smseidel 			pWin->DrawLine( Point( 0, nDY-SPLITWIN_SPLITSIZEEXLN-1 ), Point( nDX-3, nDY-SPLITWIN_SPLITSIZEEXLN-1 ) );
30361648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
30461648e64Smseidel 			pWin->DrawLine( Point( 1, nDY-SPLITWIN_SPLITSIZEEXLN ), Point( nDX-4, nDY-SPLITWIN_SPLITSIZEEXLN ) );
30561648e64Smseidel 		}
30661648e64Smseidel 		else if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
30761648e64Smseidel 		{
30861648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetShadowColor() );
30961648e64Smseidel 			pWin->DrawLine( Point( 0, SPLITWIN_SPLITSIZEEXLN-1 ), Point( nDX-3, SPLITWIN_SPLITSIZEEXLN-1 ) );
31061648e64Smseidel 			pWin->SetLineColor( rStyleSettings.GetLightColor() );
31161648e64Smseidel 			pWin->DrawLine( Point( 1, SPLITWIN_SPLITSIZEEXLN ), Point( nDX-4, SPLITWIN_SPLITSIZEEXLN ) );
31261648e64Smseidel 		}
31361648e64Smseidel 	}
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
316cdf0e10cSrcweir // -----------------------------------------------------------------------
317cdf0e10cSrcweir 
ImplFindSet(ImplSplitSet * pSet,sal_uInt16 nId)318cdf0e10cSrcweir static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
319cdf0e10cSrcweir {
320cdf0e10cSrcweir 	if ( pSet->mnId == nId )
321cdf0e10cSrcweir 		return pSet;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	sal_uInt16			i;
324cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
325cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
328cdf0e10cSrcweir 	{
329cdf0e10cSrcweir 		if ( pItems[i].mnId == nId )
330cdf0e10cSrcweir 			return pItems[i].mpSet;
331cdf0e10cSrcweir 	}
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
334cdf0e10cSrcweir 	{
335cdf0e10cSrcweir 		if ( pItems[i].mpSet )
336cdf0e10cSrcweir 		{
337cdf0e10cSrcweir 			ImplSplitSet* pFindSet = ImplFindSet( pItems[i].mpSet, nId );
338cdf0e10cSrcweir 			if ( pFindSet )
339cdf0e10cSrcweir 				return pFindSet;
340cdf0e10cSrcweir 		}
341cdf0e10cSrcweir 	}
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	return NULL;
344cdf0e10cSrcweir }
345cdf0e10cSrcweir 
346cdf0e10cSrcweir // -----------------------------------------------------------------------
347cdf0e10cSrcweir 
ImplFindItem(ImplSplitSet * pSet,sal_uInt16 nId,sal_uInt16 & rPos)348cdf0e10cSrcweir static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt16& rPos )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir 	sal_uInt16			i;
351cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
352cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
355cdf0e10cSrcweir 	{
356cdf0e10cSrcweir 		if ( pItems[i].mnId == nId )
357cdf0e10cSrcweir 		{
358cdf0e10cSrcweir 			rPos = i;
359cdf0e10cSrcweir 			return pSet;
360cdf0e10cSrcweir 		}
361cdf0e10cSrcweir 	}
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
364cdf0e10cSrcweir 	{
365cdf0e10cSrcweir 		if ( pItems[i].mpSet )
366cdf0e10cSrcweir 		{
367cdf0e10cSrcweir 			ImplSplitSet* pFindSet = ImplFindItem( pItems[i].mpSet, nId, rPos );
368cdf0e10cSrcweir 			if ( pFindSet )
369cdf0e10cSrcweir 				return pFindSet;
370cdf0e10cSrcweir 		}
371cdf0e10cSrcweir 	}
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 	return NULL;
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir // -----------------------------------------------------------------------
377cdf0e10cSrcweir 
ImplFindItem(ImplSplitSet * pSet,Window * pWindow)378cdf0e10cSrcweir static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, Window* pWindow )
379cdf0e10cSrcweir {
380cdf0e10cSrcweir 	sal_uInt16			i;
381cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
382cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
385cdf0e10cSrcweir 	{
386cdf0e10cSrcweir 		if ( pItems[i].mpWindow == pWindow )
387cdf0e10cSrcweir 			return pItems[i].mnId;
388cdf0e10cSrcweir 		else
389cdf0e10cSrcweir 		{
390cdf0e10cSrcweir 			if ( pItems[i].mpSet )
391cdf0e10cSrcweir 			{
392cdf0e10cSrcweir 				sal_uInt16 nId = ImplFindItem( pItems[i].mpSet, pWindow );
393cdf0e10cSrcweir 				if ( nId )
394cdf0e10cSrcweir 					return nId;
395cdf0e10cSrcweir 			}
396cdf0e10cSrcweir 		}
397cdf0e10cSrcweir 	}
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 	return 0;
400cdf0e10cSrcweir }
401cdf0e10cSrcweir 
402cdf0e10cSrcweir // -----------------------------------------------------------------------
403cdf0e10cSrcweir 
ImplFindItem(ImplSplitSet * pSet,const Point & rPos,sal_Bool bRows,sal_Bool bDown=sal_True)404cdf0e10cSrcweir static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
405cdf0e10cSrcweir 							sal_Bool bRows, sal_Bool bDown = sal_True )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir 	sal_uInt16			i;
408cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
409cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
412cdf0e10cSrcweir 	{
413cdf0e10cSrcweir 		if ( pItems[i].mnWidth && pItems[i].mnHeight )
414cdf0e10cSrcweir 		{
415cdf0e10cSrcweir 			// Wegen ICC auftrennen
416cdf0e10cSrcweir 			Point		aPoint( pItems[i].mnLeft, pItems[i].mnTop );
417cdf0e10cSrcweir 			Size		aSize( pItems[i].mnWidth, pItems[i].mnHeight );
418cdf0e10cSrcweir 			Rectangle	aRect( aPoint, aSize );
419cdf0e10cSrcweir 			if ( bRows )
420cdf0e10cSrcweir 			{
421cdf0e10cSrcweir 				if ( bDown )
422cdf0e10cSrcweir 					aRect.Bottom() += pSet->mnSplitSize;
423cdf0e10cSrcweir 				else
424cdf0e10cSrcweir 					aRect.Top() -= pSet->mnSplitSize;
425cdf0e10cSrcweir 			}
426cdf0e10cSrcweir 			else
427cdf0e10cSrcweir 			{
428cdf0e10cSrcweir 				if ( bDown )
429cdf0e10cSrcweir 					aRect.Right() += pSet->mnSplitSize;
430cdf0e10cSrcweir 				else
431cdf0e10cSrcweir 					aRect.Left() -= pSet->mnSplitSize;
432cdf0e10cSrcweir 			}
433cdf0e10cSrcweir 
434cdf0e10cSrcweir 			if ( aRect.IsInside( rPos ) )
435cdf0e10cSrcweir 			{
436cdf0e10cSrcweir 				if ( pItems[i].mpSet && pItems[i].mpSet->mpItems )
437cdf0e10cSrcweir 				{
438cdf0e10cSrcweir 					return ImplFindItem( pItems[i].mpSet, rPos,
439cdf0e10cSrcweir 										((pItems[i].mnBits & SWIB_COLSET) == 0) );
440cdf0e10cSrcweir 				}
441cdf0e10cSrcweir 				else
442cdf0e10cSrcweir 					return pItems[i].mnId;
443cdf0e10cSrcweir 			}
444cdf0e10cSrcweir 		}
445cdf0e10cSrcweir 	}
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 	return 0;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir // -----------------------------------------------------------------------
451cdf0e10cSrcweir 
ImplDeleteSet(ImplSplitSet * pSet)452cdf0e10cSrcweir static void ImplDeleteSet( ImplSplitSet* pSet )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir 	sal_uInt16			i;
455cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
456cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
459cdf0e10cSrcweir 	{
460cdf0e10cSrcweir 		if ( pItems[i].mpSet )
461cdf0e10cSrcweir 			ImplDeleteSet( pItems[i].mpSet );
462cdf0e10cSrcweir 	}
463cdf0e10cSrcweir 
464cdf0e10cSrcweir 	if ( pSet->mpWallpaper )
465cdf0e10cSrcweir 		delete pSet->mpWallpaper;
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	if ( pSet->mpBitmap )
468cdf0e10cSrcweir 		delete pSet->mpBitmap;
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	delete [] pItems;
471cdf0e10cSrcweir 	delete pSet;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir 
474cdf0e10cSrcweir // -----------------------------------------------------------------------
475cdf0e10cSrcweir 
ImplSetSplitSize(ImplSplitSet * pSet,long nNewSize)476cdf0e10cSrcweir static void ImplSetSplitSize( ImplSplitSet* pSet, long nNewSize )
477cdf0e10cSrcweir {
478cdf0e10cSrcweir 	pSet->mnSplitSize = nNewSize;
479cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < pSet->mnItems; i++ )
480cdf0e10cSrcweir 	{
481cdf0e10cSrcweir 		if ( pSet->mpItems[i].mpSet )
482cdf0e10cSrcweir 			ImplSetSplitSize( pSet->mpItems[i].mpSet, nNewSize );
483cdf0e10cSrcweir 	}
484cdf0e10cSrcweir }
485cdf0e10cSrcweir 
486cdf0e10cSrcweir // -----------------------------------------------------------------------
487cdf0e10cSrcweir 
ImplCalcSet(ImplSplitSet * pSet,long nSetLeft,long nSetTop,long nSetWidth,long nSetHeight,sal_Bool bRows,sal_Bool bDown=sal_True)488cdf0e10cSrcweir static void ImplCalcSet( ImplSplitSet* pSet,
489cdf0e10cSrcweir 						 long nSetLeft, long nSetTop,
490cdf0e10cSrcweir 						 long nSetWidth, long nSetHeight,
491cdf0e10cSrcweir 						 sal_Bool bRows, sal_Bool bDown = sal_True )
492cdf0e10cSrcweir {
493cdf0e10cSrcweir 	if ( !pSet->mpItems )
494cdf0e10cSrcweir 		return;
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 	sal_uInt16				i;
497cdf0e10cSrcweir 	sal_uInt16				j;
498cdf0e10cSrcweir 	sal_uInt16				nMins;
499cdf0e10cSrcweir 	sal_uInt16				nCalcItems;
500cdf0e10cSrcweir 	sal_uInt16				nItems = pSet->mnItems;
501cdf0e10cSrcweir 	sal_uInt16				nVisItems;
502cdf0e10cSrcweir 	sal_uInt16				nAbsItems;
503cdf0e10cSrcweir 	long				nCalcSize;
504cdf0e10cSrcweir 	long				nSizeDelta;
505cdf0e10cSrcweir 	long				nCurSize;
506cdf0e10cSrcweir 	long				nSizeWinSize;
507cdf0e10cSrcweir 	long				nNewSizeWinSize;
508cdf0e10cSrcweir 	long				nTemp;
509cdf0e10cSrcweir 	long				nTempErr;
510cdf0e10cSrcweir 	long				nErrorSum;
511cdf0e10cSrcweir 	long				nCurSizeDelta;
512cdf0e10cSrcweir 	long				nPos;
513cdf0e10cSrcweir 	long				nMaxPos;
514cdf0e10cSrcweir 	long*				pSize;
515cdf0e10cSrcweir 	ImplSplitItem*		pItems = pSet->mpItems;
516cdf0e10cSrcweir 	sal_Bool				bEmpty;
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 	// Anzahl sichtbarer Items ermitteln
519cdf0e10cSrcweir 	nVisItems = 0;
520cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
521cdf0e10cSrcweir 	{
522cdf0e10cSrcweir 		if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
523cdf0e10cSrcweir 			nVisItems++;
524cdf0e10cSrcweir 	}
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 	// Groessen berechnen
527cdf0e10cSrcweir 	if ( bRows )
528cdf0e10cSrcweir 		nCalcSize = nSetHeight;
529cdf0e10cSrcweir 	else
530cdf0e10cSrcweir 		nCalcSize = nSetWidth;
531cdf0e10cSrcweir 	nCalcSize -= (nVisItems-1)*pSet->mnSplitSize;
532cdf0e10cSrcweir 	nCurSize   = 0;
533cdf0e10cSrcweir 	if ( pSet->mbCalcPix || (pSet->mnLastSize != nCalcSize) )
534cdf0e10cSrcweir 	{
535cdf0e10cSrcweir 		long nPercentFactor = 10;
536cdf0e10cSrcweir 		long nRelCount		= 0;
537cdf0e10cSrcweir 		long nPercent		= 0;
538cdf0e10cSrcweir 		long nRelPercent	= 0;
539cdf0e10cSrcweir 		long nAbsSize		= 0;
540cdf0e10cSrcweir 		for ( i = 0; i < nItems; i++ )
541cdf0e10cSrcweir 		{
542cdf0e10cSrcweir 			if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
543cdf0e10cSrcweir 			{
544cdf0e10cSrcweir 				if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
545cdf0e10cSrcweir 					nRelCount += pItems[i].mnSize;
546cdf0e10cSrcweir 				else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
547cdf0e10cSrcweir 					nPercent += pItems[i].mnSize;
548cdf0e10cSrcweir 				else
549cdf0e10cSrcweir 					nAbsSize += pItems[i].mnSize;
550cdf0e10cSrcweir 			}
551cdf0e10cSrcweir 		}
552cdf0e10cSrcweir 		// Relative-Werte auf prozentual mappen (Percent bei uns 10tel Prozent)
553cdf0e10cSrcweir 		nPercent *= nPercentFactor;
554cdf0e10cSrcweir 		if ( nRelCount )
555cdf0e10cSrcweir 		{
556cdf0e10cSrcweir 			long nRelPercentBase = 1000;
557cdf0e10cSrcweir 			while ( (nRelCount > nRelPercentBase) && (nPercentFactor < 100000) )
558cdf0e10cSrcweir 			{
559cdf0e10cSrcweir 				nRelPercentBase *= 10;
560cdf0e10cSrcweir 				nPercentFactor *= 10;
561cdf0e10cSrcweir 			}
562cdf0e10cSrcweir 			if ( nPercent < nRelPercentBase )
563cdf0e10cSrcweir 			{
564cdf0e10cSrcweir 				nRelPercent = (nRelPercentBase-nPercent)/nRelCount;
565cdf0e10cSrcweir 				nPercent += nRelPercent*nRelCount;
566cdf0e10cSrcweir 			}
567cdf0e10cSrcweir 			else
568cdf0e10cSrcweir 				nRelPercent = 0;
569cdf0e10cSrcweir 		}
570cdf0e10cSrcweir 		if ( !nPercent )
571cdf0e10cSrcweir 			nPercent = 1;
572cdf0e10cSrcweir 		nSizeDelta = nCalcSize-nAbsSize;
573cdf0e10cSrcweir 		for ( i = 0; i < nItems; i++ )
574cdf0e10cSrcweir 		{
575cdf0e10cSrcweir 			if ( pItems[i].mnBits & SWIB_INVISIBLE )
576cdf0e10cSrcweir 				pItems[i].mnPixSize = 0;
577cdf0e10cSrcweir 			else if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
578cdf0e10cSrcweir 			{
579cdf0e10cSrcweir 				if ( nSizeDelta <= 0 )
580cdf0e10cSrcweir 					pItems[i].mnPixSize = 0;
581cdf0e10cSrcweir 				else
582cdf0e10cSrcweir 					pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nRelPercent)/nPercent;
583cdf0e10cSrcweir 			}
584cdf0e10cSrcweir 			else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
585cdf0e10cSrcweir 			{
586cdf0e10cSrcweir 				if ( nSizeDelta <= 0 )
587cdf0e10cSrcweir 					pItems[i].mnPixSize = 0;
588cdf0e10cSrcweir 				else
589cdf0e10cSrcweir 					pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nPercentFactor)/nPercent;
590cdf0e10cSrcweir 			}
591cdf0e10cSrcweir 			else
592cdf0e10cSrcweir 				pItems[i].mnPixSize = pItems[i].mnSize;
593cdf0e10cSrcweir 			nCurSize += pItems[i].mnPixSize;
594cdf0e10cSrcweir 		}
595cdf0e10cSrcweir 
596cdf0e10cSrcweir 		pSet->mbCalcPix  = sal_False;
597cdf0e10cSrcweir 		pSet->mnLastSize = nCalcSize;
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 		// Fenster einpassen
600cdf0e10cSrcweir 		nSizeDelta	= nCalcSize-nCurSize;
601cdf0e10cSrcweir 		if ( nSizeDelta )
602cdf0e10cSrcweir 		{
603cdf0e10cSrcweir 			nAbsItems		= 0;
604cdf0e10cSrcweir 			nSizeWinSize	= 0;
605cdf0e10cSrcweir 			nNewSizeWinSize = 0;
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 			// Zuerst die absoluten Items relativ resizen
608cdf0e10cSrcweir 			for ( i = 0; i < nItems; i++ )
609cdf0e10cSrcweir 			{
610cdf0e10cSrcweir 				if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
611cdf0e10cSrcweir 				{
612cdf0e10cSrcweir 					if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
613cdf0e10cSrcweir 					{
614cdf0e10cSrcweir 						nAbsItems++;
615cdf0e10cSrcweir 						nSizeWinSize += pItems[i].mnPixSize;
616cdf0e10cSrcweir 					}
617cdf0e10cSrcweir 				}
618cdf0e10cSrcweir 			}
61961648e64Smseidel 			// Rundungsfehler werden hier nicht ausgeglichen
620cdf0e10cSrcweir 			if ( (nAbsItems < (sal_uInt16)(Abs( nSizeDelta ))) && nSizeWinSize )
621cdf0e10cSrcweir 			{
622cdf0e10cSrcweir 				for ( i = 0; i < nItems; i++ )
623cdf0e10cSrcweir 				{
624cdf0e10cSrcweir 					if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
625cdf0e10cSrcweir 					{
626cdf0e10cSrcweir 						if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
627cdf0e10cSrcweir 						{
628cdf0e10cSrcweir 							pItems[i].mnPixSize += (nSizeDelta*pItems[i].mnPixSize)/nSizeWinSize;
629cdf0e10cSrcweir 							nNewSizeWinSize += pItems[i].mnPixSize;
630cdf0e10cSrcweir 						}
631cdf0e10cSrcweir 					}
632cdf0e10cSrcweir 				}
633cdf0e10cSrcweir 				nSizeDelta -= nNewSizeWinSize-nSizeWinSize;
634cdf0e10cSrcweir 			}
635cdf0e10cSrcweir 
636789f9e36Smseidel 			// Jetzt die Rundungsfehler ausgleichen
637cdf0e10cSrcweir 			j			= 0;
638cdf0e10cSrcweir 			nMins		= 0;
639cdf0e10cSrcweir 			while ( nSizeDelta && (nItems != nMins) )
640cdf0e10cSrcweir 			{
641cdf0e10cSrcweir 				// Feststellen, welche Items berechnet werden duerfen
642cdf0e10cSrcweir 				nCalcItems = 0;
643cdf0e10cSrcweir 				while ( !nCalcItems )
644cdf0e10cSrcweir 				{
645cdf0e10cSrcweir 					for ( i = 0; i < nItems; i++ )
646cdf0e10cSrcweir 					{
647cdf0e10cSrcweir 						pItems[i].mbSubSize = sal_False;
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 						if ( j >= 2 )
650cdf0e10cSrcweir 							pItems[i].mbSubSize = sal_True;
651cdf0e10cSrcweir 						else
652cdf0e10cSrcweir 						{
653cdf0e10cSrcweir 							if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
654cdf0e10cSrcweir 							{
655cdf0e10cSrcweir 								if ( (nSizeDelta > 0) || pItems[i].mnPixSize )
656cdf0e10cSrcweir 								{
657cdf0e10cSrcweir 									if ( j >= 1 )
658cdf0e10cSrcweir 										pItems[i].mbSubSize = sal_True;
659cdf0e10cSrcweir 									else
660cdf0e10cSrcweir 									{
661cdf0e10cSrcweir 										if ( (j == 0) && (pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
662cdf0e10cSrcweir 											pItems[i].mbSubSize = sal_True;
663cdf0e10cSrcweir 									}
664cdf0e10cSrcweir 								}
665cdf0e10cSrcweir 							}
666cdf0e10cSrcweir 						}
667cdf0e10cSrcweir 
668cdf0e10cSrcweir 						if ( pItems[i].mbSubSize )
669cdf0e10cSrcweir 							nCalcItems++;
670cdf0e10cSrcweir 					}
671cdf0e10cSrcweir 
672cdf0e10cSrcweir 					j++;
673cdf0e10cSrcweir 				}
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 				// Groessen von den einzelnen Items abziehen
676cdf0e10cSrcweir 				nErrorSum		= nSizeDelta % nCalcItems;
677cdf0e10cSrcweir 				nCurSizeDelta	= nSizeDelta / nCalcItems;
678cdf0e10cSrcweir 				nMins			= 0;
679cdf0e10cSrcweir 				for ( i = 0; i < nItems; i++ )
680cdf0e10cSrcweir 				{
681cdf0e10cSrcweir 					if ( pItems[i].mnBits & SWIB_INVISIBLE )
682cdf0e10cSrcweir 						nMins++;
683cdf0e10cSrcweir 					else if ( pItems[i].mbSubSize )
684cdf0e10cSrcweir 					{
685cdf0e10cSrcweir 						pSize = &(pItems[i].mnPixSize);
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 						if ( nErrorSum )
688cdf0e10cSrcweir 						{
689cdf0e10cSrcweir 							if ( nErrorSum < 0 )
690cdf0e10cSrcweir 								nTempErr = -1;
691cdf0e10cSrcweir 							else
692cdf0e10cSrcweir 								nTempErr = 1;
693cdf0e10cSrcweir 						}
694cdf0e10cSrcweir 						else
695cdf0e10cSrcweir 							nTempErr = 0;
696cdf0e10cSrcweir 
697cdf0e10cSrcweir 						if ( (*pSize+nCurSizeDelta+nTempErr) <= 0 )
698cdf0e10cSrcweir 						{
699cdf0e10cSrcweir 							nTemp = *pSize;
700cdf0e10cSrcweir 							if ( nTemp )
701cdf0e10cSrcweir 							{
702cdf0e10cSrcweir 								*pSize -= nTemp;
703cdf0e10cSrcweir 								nSizeDelta += nTemp;
704cdf0e10cSrcweir 							}
705cdf0e10cSrcweir 							nMins++;
706cdf0e10cSrcweir 						}
707cdf0e10cSrcweir 						else
708cdf0e10cSrcweir 						{
709cdf0e10cSrcweir 							*pSize += nCurSizeDelta;
710cdf0e10cSrcweir 							nSizeDelta -= nCurSizeDelta;
711cdf0e10cSrcweir 							if ( nTempErr && (*pSize || (nTempErr > 0)) )
712cdf0e10cSrcweir 							{
713cdf0e10cSrcweir 								*pSize += nTempErr;
714cdf0e10cSrcweir 								nSizeDelta -= nTempErr;
715cdf0e10cSrcweir 								nErrorSum -= nTempErr;
716cdf0e10cSrcweir 							}
717cdf0e10cSrcweir 						}
718cdf0e10cSrcweir 					}
719cdf0e10cSrcweir 				}
720cdf0e10cSrcweir 			}
721cdf0e10cSrcweir 		}
722cdf0e10cSrcweir 	}
723cdf0e10cSrcweir 	else
724cdf0e10cSrcweir 	{
725cdf0e10cSrcweir 		for ( i = 0; i < nItems; i++ )
726cdf0e10cSrcweir 		{
727cdf0e10cSrcweir 			if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
728cdf0e10cSrcweir 				nCurSize += pItems[i].mnPixSize;
729cdf0e10cSrcweir 		}
730cdf0e10cSrcweir 	}
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 	// Maximale Groesse berechnen
733cdf0e10cSrcweir 	if ( bRows )
734cdf0e10cSrcweir 	{
735cdf0e10cSrcweir 		nPos = nSetTop;
736cdf0e10cSrcweir 		if ( !bDown )
737cdf0e10cSrcweir 			nMaxPos = nSetTop-nSetHeight;
738cdf0e10cSrcweir 		else
739cdf0e10cSrcweir 			nMaxPos = nSetTop+nSetHeight;
740cdf0e10cSrcweir 	}
741cdf0e10cSrcweir 	else
742cdf0e10cSrcweir 	{
743cdf0e10cSrcweir 		nPos = nSetLeft;
744cdf0e10cSrcweir 		if ( !bDown )
745cdf0e10cSrcweir 			nMaxPos = nSetLeft-nSetWidth;
746cdf0e10cSrcweir 		else
747cdf0e10cSrcweir 			nMaxPos = nSetLeft+nSetWidth;
748cdf0e10cSrcweir 	}
749cdf0e10cSrcweir 
750cdf0e10cSrcweir 	// Fenster anordnen und Werte anpassen
751cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
752cdf0e10cSrcweir 	{
753cdf0e10cSrcweir 		pItems[i].mnOldSplitPos    = pItems[i].mnSplitPos;
754cdf0e10cSrcweir 		pItems[i].mnOldSplitSize   = pItems[i].mnSplitSize;
755cdf0e10cSrcweir 		pItems[i].mnOldWidth	   = pItems[i].mnWidth;
756cdf0e10cSrcweir 		pItems[i].mnOldHeight	   = pItems[i].mnHeight;
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 		if ( pItems[i].mnBits & SWIB_INVISIBLE )
759cdf0e10cSrcweir 			bEmpty = sal_True;
760cdf0e10cSrcweir 		else
761cdf0e10cSrcweir 		{
762cdf0e10cSrcweir 			bEmpty = sal_False;
763cdf0e10cSrcweir 			if ( bDown )
764cdf0e10cSrcweir 			{
765cdf0e10cSrcweir 				if ( nPos+pItems[i].mnPixSize > nMaxPos )
766cdf0e10cSrcweir 					bEmpty = sal_True;
767cdf0e10cSrcweir 			}
768cdf0e10cSrcweir 			else
769cdf0e10cSrcweir 			{
770cdf0e10cSrcweir 				nPos -= pItems[i].mnPixSize;
771cdf0e10cSrcweir 				if ( nPos < nMaxPos )
772cdf0e10cSrcweir 					bEmpty = sal_True;
773cdf0e10cSrcweir 			}
774cdf0e10cSrcweir 		}
775cdf0e10cSrcweir 
776cdf0e10cSrcweir 		if ( bEmpty )
777cdf0e10cSrcweir 		{
778cdf0e10cSrcweir 			pItems[i].mnWidth	  = 0;
779cdf0e10cSrcweir 			pItems[i].mnHeight	  = 0;
780cdf0e10cSrcweir 			pItems[i].mnSplitSize = 0;
781cdf0e10cSrcweir 		}
782cdf0e10cSrcweir 		else
783cdf0e10cSrcweir 		{
784cdf0e10cSrcweir 			if ( bRows )
785cdf0e10cSrcweir 			{
786cdf0e10cSrcweir 				pItems[i].mnLeft   = nSetLeft;
787cdf0e10cSrcweir 				pItems[i].mnTop    = nPos;
788cdf0e10cSrcweir 				pItems[i].mnWidth  = nSetWidth;
789cdf0e10cSrcweir 				pItems[i].mnHeight = pItems[i].mnPixSize;
790cdf0e10cSrcweir 			}
791cdf0e10cSrcweir 			else
792cdf0e10cSrcweir 			{
793cdf0e10cSrcweir 				pItems[i].mnLeft   = nPos;
794cdf0e10cSrcweir 				pItems[i].mnTop    = nSetTop;
795cdf0e10cSrcweir 				pItems[i].mnWidth  = pItems[i].mnPixSize;
796cdf0e10cSrcweir 				pItems[i].mnHeight = nSetHeight;
797cdf0e10cSrcweir 			}
798cdf0e10cSrcweir 
799cdf0e10cSrcweir 			if ( i > nItems-1 )
800cdf0e10cSrcweir 				pItems[i].mnSplitSize = 0;
801cdf0e10cSrcweir 			else
802cdf0e10cSrcweir 			{
803cdf0e10cSrcweir 				pItems[i].mnSplitSize = pSet->mnSplitSize;
804cdf0e10cSrcweir 				if ( bDown )
805cdf0e10cSrcweir 				{
80661648e64Smseidel 					pItems[i].mnSplitPos = nPos+pItems[i].mnPixSize;
807cdf0e10cSrcweir 					if ( pItems[i].mnSplitPos+pItems[i].mnSplitSize > nMaxPos )
808cdf0e10cSrcweir 						pItems[i].mnSplitSize = nMaxPos-pItems[i].mnSplitPos;
809cdf0e10cSrcweir 				}
810cdf0e10cSrcweir 				else
811cdf0e10cSrcweir 				{
812cdf0e10cSrcweir 					pItems[i].mnSplitPos = nPos-pSet->mnSplitSize;
813cdf0e10cSrcweir 					if ( pItems[i].mnSplitPos < nMaxPos )
814cdf0e10cSrcweir 						pItems[i].mnSplitSize = pItems[i].mnSplitPos+pSet->mnSplitSize-nMaxPos;
815cdf0e10cSrcweir 				}
816cdf0e10cSrcweir 			}
817cdf0e10cSrcweir 		}
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 		if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
820cdf0e10cSrcweir 		{
821cdf0e10cSrcweir 			if ( !bDown )
822cdf0e10cSrcweir 				nPos -= pSet->mnSplitSize;
823cdf0e10cSrcweir 			else
824cdf0e10cSrcweir 				nPos += pItems[i].mnPixSize+pSet->mnSplitSize;
825cdf0e10cSrcweir 		}
826cdf0e10cSrcweir 	}
827cdf0e10cSrcweir 
828cdf0e10cSrcweir 	// Sub-Set's berechnen
829cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
830cdf0e10cSrcweir 	{
831cdf0e10cSrcweir 		if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
832cdf0e10cSrcweir 		{
833cdf0e10cSrcweir 			ImplCalcSet( pItems[i].mpSet,
834cdf0e10cSrcweir 						 pItems[i].mnLeft, pItems[i].mnTop,
835cdf0e10cSrcweir 						 pItems[i].mnWidth, pItems[i].mnHeight,
836cdf0e10cSrcweir 						 ((pItems[i].mnBits & SWIB_COLSET) == 0) );
837cdf0e10cSrcweir 		}
838cdf0e10cSrcweir 	}
839cdf0e10cSrcweir 
840cdf0e10cSrcweir 	// Fixed setzen
841cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
842cdf0e10cSrcweir 	{
843cdf0e10cSrcweir 		pItems[i].mbFixed = sal_False;
844cdf0e10cSrcweir 		if ( pItems[i].mnBits & SWIB_FIXED )
845cdf0e10cSrcweir 			pItems[i].mbFixed = sal_True;
846cdf0e10cSrcweir 		else
847cdf0e10cSrcweir 		{
848cdf0e10cSrcweir 			// Wenn Child-Set vorhanden, ist dieses Item auch Fixed, wenn
849cdf0e10cSrcweir 			// ein Child fixed ist
850cdf0e10cSrcweir 			if ( pItems[i].mpSet )
851cdf0e10cSrcweir 			{
852cdf0e10cSrcweir 				for ( j = 0; j < pItems[i].mpSet->mnItems; j++ )
853cdf0e10cSrcweir 				{
854cdf0e10cSrcweir 					if ( pItems[i].mpSet->mpItems[j].mbFixed )
855cdf0e10cSrcweir 					{
856cdf0e10cSrcweir 						pItems[i].mbFixed = sal_True;
857cdf0e10cSrcweir 						break;
858cdf0e10cSrcweir 					}
859cdf0e10cSrcweir 				}
860cdf0e10cSrcweir 			}
861cdf0e10cSrcweir 		}
862cdf0e10cSrcweir 	}
863cdf0e10cSrcweir }
864cdf0e10cSrcweir 
865cdf0e10cSrcweir // -----------------------------------------------------------------------
866cdf0e10cSrcweir 
ImplCalcSet2(SplitWindow * pWindow,ImplSplitSet * pSet,sal_Bool bHide,sal_Bool bRows,sal_Bool)867cdf0e10cSrcweir void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, sal_Bool bHide,
868cdf0e10cSrcweir 						        sal_Bool bRows, sal_Bool /*bDown*/ )
869cdf0e10cSrcweir {
870cdf0e10cSrcweir 	sal_uInt16			i;
871cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
872cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
873cdf0e10cSrcweir 
874cdf0e10cSrcweir 	if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate )
875cdf0e10cSrcweir 	{
876cdf0e10cSrcweir 		for ( i = 0; i < nItems; i++ )
877cdf0e10cSrcweir 		{
878cdf0e10cSrcweir 			if ( pItems[i].mnSplitSize )
879cdf0e10cSrcweir 			{
880cdf0e10cSrcweir 				// Evt. alles invalidieren oder nur einen kleinen Teil
881cdf0e10cSrcweir 				if ( (pItems[i].mnOldSplitPos  != pItems[i].mnSplitPos)  ||
882cdf0e10cSrcweir 					 (pItems[i].mnOldSplitSize != pItems[i].mnSplitSize) ||
883cdf0e10cSrcweir 					 (pItems[i].mnOldWidth	   != pItems[i].mnWidth)	 ||
884cdf0e10cSrcweir 					 (pItems[i].mnOldHeight    != pItems[i].mnHeight) )
885cdf0e10cSrcweir 				{
886cdf0e10cSrcweir 					Rectangle aRect;
887cdf0e10cSrcweir 
888cdf0e10cSrcweir 					// Old Rect invalidieren
889cdf0e10cSrcweir 					if ( bRows )
890cdf0e10cSrcweir 					{
891cdf0e10cSrcweir 						aRect.Left()	= pItems[i].mnLeft;
892cdf0e10cSrcweir 						aRect.Right()	= pItems[i].mnLeft+pItems[i].mnOldWidth-1;
893cdf0e10cSrcweir 						aRect.Top() 	= pItems[i].mnOldSplitPos;
894cdf0e10cSrcweir 						aRect.Bottom()	= aRect.Top() + pItems[i].mnOldSplitSize;
895cdf0e10cSrcweir 					}
896cdf0e10cSrcweir 					else
897cdf0e10cSrcweir 					{
898cdf0e10cSrcweir 						aRect.Top() 	= pItems[i].mnTop;
899cdf0e10cSrcweir 						aRect.Bottom()	= pItems[i].mnTop+pItems[i].mnOldHeight-1;
900cdf0e10cSrcweir 						aRect.Left()	= pItems[i].mnOldSplitPos;
901cdf0e10cSrcweir 						aRect.Right()	= aRect.Left() + pItems[i].mnOldSplitSize;
902cdf0e10cSrcweir 					}
903cdf0e10cSrcweir 					pWindow->Invalidate( aRect );
904cdf0e10cSrcweir 					// New Rect invalidieren
905cdf0e10cSrcweir 					if ( bRows )
906cdf0e10cSrcweir 					{
907cdf0e10cSrcweir 						aRect.Left()	= pItems[i].mnLeft;
908cdf0e10cSrcweir 						aRect.Right()	= pItems[i].mnLeft+pItems[i].mnWidth-1;
909cdf0e10cSrcweir 						aRect.Top() 	= pItems[i].mnSplitPos;
910cdf0e10cSrcweir 						aRect.Bottom()	= aRect.Top() + pItems[i].mnSplitSize;
911cdf0e10cSrcweir 					}
912cdf0e10cSrcweir 					else
913cdf0e10cSrcweir 					{
914cdf0e10cSrcweir 						aRect.Top() 	= pItems[i].mnTop;
915cdf0e10cSrcweir 						aRect.Bottom()	= pItems[i].mnTop+pItems[i].mnHeight-1;
916cdf0e10cSrcweir 						aRect.Left()	= pItems[i].mnSplitPos;
917cdf0e10cSrcweir 						aRect.Right()	= aRect.Left() + pItems[i].mnSplitSize;
918cdf0e10cSrcweir 					}
919cdf0e10cSrcweir 					pWindow->Invalidate( aRect );
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 					// Leere Sets komplett invalidieren, da diese Flaechen
922cdf0e10cSrcweir 					// nicht von Fenstern ueberladen werden
923cdf0e10cSrcweir 					if ( pItems[i].mpSet && !pItems[i].mpSet->mpItems )
924cdf0e10cSrcweir 					{
925cdf0e10cSrcweir 						aRect.Left()	= pItems[i].mnLeft;
926cdf0e10cSrcweir 						aRect.Top() 	= pItems[i].mnTop;
927cdf0e10cSrcweir 						aRect.Right()	= pItems[i].mnLeft+pItems[i].mnWidth-1;
928cdf0e10cSrcweir 						aRect.Bottom()	= pItems[i].mnTop+pItems[i].mnHeight-1;
929cdf0e10cSrcweir 						pWindow->Invalidate( aRect );
930cdf0e10cSrcweir 					}
931cdf0e10cSrcweir 				}
932cdf0e10cSrcweir 			}
933cdf0e10cSrcweir 		}
934cdf0e10cSrcweir 	}
935cdf0e10cSrcweir 
936cdf0e10cSrcweir 	// Fenster positionieren
937cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
938cdf0e10cSrcweir 	{
939cdf0e10cSrcweir 		if ( pItems[i].mpSet )
940cdf0e10cSrcweir 		{
941cdf0e10cSrcweir 			sal_Bool bTempHide = bHide;
942cdf0e10cSrcweir 			if ( !pItems[i].mnWidth || !pItems[i].mnHeight )
943cdf0e10cSrcweir 				bTempHide = sal_True;
944cdf0e10cSrcweir 			ImplCalcSet2( pWindow, pItems[i].mpSet, bTempHide,
945cdf0e10cSrcweir 						  ((pItems[i].mnBits & SWIB_COLSET) == 0) );
946cdf0e10cSrcweir 		}
947cdf0e10cSrcweir 		else
948cdf0e10cSrcweir 		{
949cdf0e10cSrcweir 			if ( pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
950cdf0e10cSrcweir 			{
951cdf0e10cSrcweir 				Point aPos( pItems[i].mnLeft, pItems[i].mnTop );
952cdf0e10cSrcweir 				Size  aSize( pItems[i].mnWidth, pItems[i].mnHeight );
953cdf0e10cSrcweir 				pItems[i].mpWindow->SetPosSizePixel( aPos, aSize );
954cdf0e10cSrcweir 			}
955cdf0e10cSrcweir 			else
956cdf0e10cSrcweir 				pItems[i].mpWindow->Hide();
957cdf0e10cSrcweir 		}
958cdf0e10cSrcweir 	}
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 	// Fenster anzeigen und Flag zuruecksetzen
961cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
962cdf0e10cSrcweir 	{
963cdf0e10cSrcweir 		if ( pItems[i].mpWindow && pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
964cdf0e10cSrcweir 			pItems[i].mpWindow->Show();
965cdf0e10cSrcweir 	}
966cdf0e10cSrcweir }
967cdf0e10cSrcweir 
968cdf0e10cSrcweir // -----------------------------------------------------------------------
969cdf0e10cSrcweir 
ImplCalcLogSize(ImplSplitItem * pItems,sal_uInt16 nItems)970cdf0e10cSrcweir static void ImplCalcLogSize( ImplSplitItem* pItems, sal_uInt16 nItems )
971cdf0e10cSrcweir {
972cdf0e10cSrcweir 	// Original-Groessen updaten
973cdf0e10cSrcweir 	sal_uInt16	i;
974cdf0e10cSrcweir 	long	nRelSize = 0;
975cdf0e10cSrcweir 	long	nPerSize = 0;
976cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
977cdf0e10cSrcweir 	{
978cdf0e10cSrcweir 		if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
979cdf0e10cSrcweir 			nRelSize += pItems[i].mnPixSize;
980cdf0e10cSrcweir 		else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
981cdf0e10cSrcweir 			nPerSize += pItems[i].mnPixSize;
982cdf0e10cSrcweir 	}
983cdf0e10cSrcweir 	nPerSize += nRelSize;
984cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
985cdf0e10cSrcweir 	{
986cdf0e10cSrcweir 		if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
987cdf0e10cSrcweir 		{
988cdf0e10cSrcweir 			if ( nRelSize )
989cdf0e10cSrcweir 				pItems[i].mnSize = (pItems[i].mnPixSize+(nRelSize/2))/nRelSize;
990cdf0e10cSrcweir 			else
991cdf0e10cSrcweir 				pItems[i].mnSize = 1;
992cdf0e10cSrcweir 		}
993cdf0e10cSrcweir 		else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
994cdf0e10cSrcweir 		{
995cdf0e10cSrcweir 			if ( nPerSize )
996cdf0e10cSrcweir 				pItems[i].mnSize = (pItems[i].mnPixSize*100)/nPerSize;
997cdf0e10cSrcweir 			else
998cdf0e10cSrcweir 				pItems[i].mnSize = 1;
999cdf0e10cSrcweir 		}
1000cdf0e10cSrcweir 		else
1001cdf0e10cSrcweir 			pItems[i].mnSize = pItems[i].mnPixSize;
1002cdf0e10cSrcweir 	}
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir // -----------------------------------------------------------------------
1006cdf0e10cSrcweir 
ImplDrawBack(SplitWindow * pWindow,const Rectangle & rRect,const Wallpaper * pWall,const Bitmap * pBitmap)1007cdf0e10cSrcweir void SplitWindow::ImplDrawBack( SplitWindow* pWindow, const Rectangle& rRect,
1008cdf0e10cSrcweir                                 const Wallpaper* pWall, const Bitmap* pBitmap )
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir 	if ( pBitmap )
1011cdf0e10cSrcweir 	{
1012cdf0e10cSrcweir 		Point	aPos = rRect.TopLeft();
1013cdf0e10cSrcweir 		Size	aBmpSize = pBitmap->GetSizePixel();
1014cdf0e10cSrcweir 		pWindow->Push( PUSH_CLIPREGION );
1015cdf0e10cSrcweir 		pWindow->IntersectClipRegion( rRect );
1016cdf0e10cSrcweir 		do
1017cdf0e10cSrcweir 		{
1018cdf0e10cSrcweir 			aPos.X() = rRect.Left();
1019cdf0e10cSrcweir 			do
1020cdf0e10cSrcweir 			{
1021cdf0e10cSrcweir 				pWindow->DrawBitmap( aPos, *pBitmap );
1022cdf0e10cSrcweir 				aPos.X() += aBmpSize.Width();
1023cdf0e10cSrcweir 			}
1024cdf0e10cSrcweir 			while ( aPos.X() < rRect.Right() );
1025cdf0e10cSrcweir 			aPos.Y() += aBmpSize.Height();
1026cdf0e10cSrcweir 		}
1027cdf0e10cSrcweir 		while ( aPos.Y() < rRect.Bottom() );
1028cdf0e10cSrcweir 		pWindow->Pop();
1029cdf0e10cSrcweir 	}
1030cdf0e10cSrcweir 	else
1031cdf0e10cSrcweir 		pWindow->DrawWallpaper( rRect, *pWall );
1032cdf0e10cSrcweir }
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir // -----------------------------------------------------------------------
1035cdf0e10cSrcweir 
ImplDrawBack(SplitWindow * pWindow,ImplSplitSet * pSet)1036cdf0e10cSrcweir void SplitWindow::ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet )
1037cdf0e10cSrcweir {
1038cdf0e10cSrcweir 	sal_uInt16			i;
1039cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
1040cdf0e10cSrcweir 	ImplSplitItem*	pItems = pSet->mpItems;
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 	// Beim Mainset auch den Hintergrund zeichnen
1043cdf0e10cSrcweir 	if ( pSet->mnId == 0 )
1044cdf0e10cSrcweir 	{
1045cdf0e10cSrcweir 		if ( pSet->mpBitmap )
1046cdf0e10cSrcweir 		{
1047cdf0e10cSrcweir 			Rectangle aRect( pWindow->mnLeftBorder,
1048cdf0e10cSrcweir 							 pWindow->mnTopBorder,
1049cdf0e10cSrcweir 							 pWindow->mnDX-pWindow->mnRightBorder-1,
1050cdf0e10cSrcweir 							 pWindow->mnDY-pWindow->mnBottomBorder-1 );
1051cdf0e10cSrcweir 			ImplDrawBack( pWindow, aRect, pSet->mpWallpaper, pSet->mpBitmap );
1052cdf0e10cSrcweir 		}
1053cdf0e10cSrcweir 	}
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
1056cdf0e10cSrcweir 	{
1057cdf0e10cSrcweir 		pSet = pItems[i].mpSet;
1058cdf0e10cSrcweir 		if ( pSet )
1059cdf0e10cSrcweir 		{
1060cdf0e10cSrcweir 			if ( pSet->mpBitmap || pSet->mpWallpaper )
1061cdf0e10cSrcweir 			{
1062cdf0e10cSrcweir 				// Wegen ICC auftrennen
1063cdf0e10cSrcweir 				Point		aPoint( pItems[i].mnLeft, pItems[i].mnTop );
1064cdf0e10cSrcweir 				Size		aSize( pItems[i].mnWidth, pItems[i].mnHeight );
1065cdf0e10cSrcweir 				Rectangle	aRect( aPoint, aSize );
1066cdf0e10cSrcweir 				ImplDrawBack( pWindow, aRect, pSet->mpWallpaper, pSet->mpBitmap );
1067cdf0e10cSrcweir 			}
1068cdf0e10cSrcweir 		}
1069cdf0e10cSrcweir 	}
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
1072cdf0e10cSrcweir 	{
1073cdf0e10cSrcweir 		if ( pItems[i].mpSet )
1074cdf0e10cSrcweir 			ImplDrawBack( pWindow, pItems[i].mpSet );
1075cdf0e10cSrcweir 	}
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir // -----------------------------------------------------------------------
1079cdf0e10cSrcweir 
ImplDrawSplit(SplitWindow * pWindow,ImplSplitSet * pSet,sal_Bool bRows,sal_Bool bDown=sal_True)1080cdf0e10cSrcweir static void ImplDrawSplit( SplitWindow* pWindow, ImplSplitSet* pSet,
1081cdf0e10cSrcweir 						   sal_Bool bRows, sal_Bool bDown = sal_True )
1082cdf0e10cSrcweir {
1083cdf0e10cSrcweir 	if ( !pSet->mpItems )
1084cdf0e10cSrcweir 		return;
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 	sal_uInt16					i;
1087cdf0e10cSrcweir 	sal_uInt16					nItems = pSet->mnItems;
1088cdf0e10cSrcweir 	long					nPos;
1089cdf0e10cSrcweir 	long					nTop;
1090cdf0e10cSrcweir 	long					nBottom;
1091cdf0e10cSrcweir 	ImplSplitItem*			pItems = pSet->mpItems;
1092cdf0e10cSrcweir 	const StyleSettings&	rStyleSettings = pWindow->GetSettings().GetStyleSettings();
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir 	sal_Bool bFlat = (pWindow->GetStyle() & WB_FLATSPLITDRAW) == WB_FLATSPLITDRAW;
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir 	for ( i = 0; i < nItems-1; i++ )
1097cdf0e10cSrcweir 	{
1098cdf0e10cSrcweir 		if ( pItems[i].mnSplitSize )
1099cdf0e10cSrcweir 		{
1100cdf0e10cSrcweir 			nPos = pItems[i].mnSplitPos;
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir 			long nItemSplitSize = pItems[i].mnSplitSize;
1103cdf0e10cSrcweir 			long nSplitSize = pSet->mnSplitSize;
1104cdf0e10cSrcweir 			if ( bRows )
1105cdf0e10cSrcweir 			{
1106cdf0e10cSrcweir 				nTop	= pItems[i].mnLeft;
1107cdf0e10cSrcweir 				nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
1108cdf0e10cSrcweir 
1109cdf0e10cSrcweir 				if ( bFlat ) nPos--;
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir 				if ( bDown || (nItemSplitSize >= nSplitSize) )
1112cdf0e10cSrcweir 				{
1113cdf0e10cSrcweir 					pWindow->SetLineColor( rStyleSettings.GetLightColor() );
1114cdf0e10cSrcweir 					pWindow->DrawLine( Point( nTop, nPos+1 ), Point( nBottom, nPos+1 ) );
1115cdf0e10cSrcweir 				}
1116cdf0e10cSrcweir 				nPos += nSplitSize-2;
1117cdf0e10cSrcweir 				if ( bFlat ) nPos+=2;
1118cdf0e10cSrcweir 				if ( (!bDown && (nItemSplitSize >= 2)) ||
1119cdf0e10cSrcweir 					 (bDown  && (nItemSplitSize >= nSplitSize-1)) )
1120cdf0e10cSrcweir 				{
1121cdf0e10cSrcweir 					pWindow->SetLineColor( rStyleSettings.GetShadowColor() );
1122cdf0e10cSrcweir 					pWindow->DrawLine( Point( nTop, nPos ), Point( nBottom, nPos ) );
1123cdf0e10cSrcweir 				}
1124cdf0e10cSrcweir 				if ( !bFlat )
1125cdf0e10cSrcweir 				{
1126cdf0e10cSrcweir 					nPos++;
1127cdf0e10cSrcweir 					if ( !bDown || (nItemSplitSize >= nSplitSize) )
1128cdf0e10cSrcweir 					{
1129cdf0e10cSrcweir 						pWindow->SetLineColor( rStyleSettings.GetDarkShadowColor() );
1130cdf0e10cSrcweir 						pWindow->DrawLine( Point( nTop, nPos ), Point( nBottom, nPos ) );
1131cdf0e10cSrcweir 					}
1132cdf0e10cSrcweir 				}
1133cdf0e10cSrcweir 			}
1134cdf0e10cSrcweir 			else
1135cdf0e10cSrcweir 			{
1136cdf0e10cSrcweir 				nTop	= pItems[i].mnTop;
1137cdf0e10cSrcweir 				nBottom = pItems[i].mnTop+pSet->mpItems[i].mnHeight-1;
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir 				if ( bFlat ) nPos--;
1140cdf0e10cSrcweir 				if ( bDown || (nItemSplitSize >= nSplitSize) )
1141cdf0e10cSrcweir 				{
1142cdf0e10cSrcweir 					pWindow->SetLineColor( rStyleSettings.GetLightColor() );
1143cdf0e10cSrcweir 					pWindow->DrawLine( Point( nPos+1, nTop ), Point( nPos+1, nBottom ) );
1144cdf0e10cSrcweir 				}
1145cdf0e10cSrcweir 				nPos += pSet->mnSplitSize-2;
1146cdf0e10cSrcweir 				if ( bFlat ) nPos+=2;
1147cdf0e10cSrcweir 				if ( (!bDown && (nItemSplitSize >= 2)) ||
1148cdf0e10cSrcweir 					 (bDown  && (nItemSplitSize >= nSplitSize-1)) )
1149cdf0e10cSrcweir 				{
1150cdf0e10cSrcweir 					pWindow->SetLineColor( rStyleSettings.GetShadowColor() );
1151cdf0e10cSrcweir 					pWindow->DrawLine( Point( nPos, nTop ), Point( nPos, nBottom ) );
1152cdf0e10cSrcweir 				}
1153cdf0e10cSrcweir 				if( !bFlat )
1154cdf0e10cSrcweir 				{
1155cdf0e10cSrcweir 					nPos++;
1156cdf0e10cSrcweir 					if ( !bDown || (nItemSplitSize >= nSplitSize) )
1157cdf0e10cSrcweir 					{
1158cdf0e10cSrcweir 						pWindow->SetLineColor( rStyleSettings.GetDarkShadowColor() );
1159cdf0e10cSrcweir 						pWindow->DrawLine( Point( nPos, nTop ), Point( nPos, nBottom ) );
1160cdf0e10cSrcweir 					}
1161cdf0e10cSrcweir 				}
1162cdf0e10cSrcweir 			}
1163cdf0e10cSrcweir 		}
1164cdf0e10cSrcweir 	}
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
1167cdf0e10cSrcweir 	{
1168cdf0e10cSrcweir 		if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
1169cdf0e10cSrcweir 			ImplDrawSplit( pWindow, pItems[i].mpSet, ((pItems[i].mnBits & SWIB_COLSET) == 0) );
1170cdf0e10cSrcweir 	}
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir // -----------------------------------------------------------------------
1174cdf0e10cSrcweir 
ImplTestSplit(ImplSplitSet * pSet,const Point & rPos,long & rMouseOff,ImplSplitSet ** ppFoundSet,sal_uInt16 & rFoundPos,sal_Bool bRows,sal_Bool)1175cdf0e10cSrcweir sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
1176cdf0e10cSrcweir                                    long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
1177cdf0e10cSrcweir                                    sal_Bool bRows, sal_Bool /*bDown*/ )
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir 	if ( !pSet->mpItems )
1180cdf0e10cSrcweir 		return 0;
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir 	sal_uInt16			i;
1183cdf0e10cSrcweir 	sal_uInt16			nSplitTest;
1184cdf0e10cSrcweir 	sal_uInt16			nItems = pSet->mnItems;
1185cdf0e10cSrcweir 	long			nMPos1;
1186cdf0e10cSrcweir 	long			nMPos2;
1187cdf0e10cSrcweir 	long			nPos;
1188cdf0e10cSrcweir 	long			nTop;
1189cdf0e10cSrcweir 	long			nBottom;
1190cdf0e10cSrcweir 	ImplSplitItem*	 pItems = pSet->mpItems;
1191cdf0e10cSrcweir 
1192cdf0e10cSrcweir 	if ( bRows )
1193cdf0e10cSrcweir 	{
1194cdf0e10cSrcweir 		nMPos1 = rPos.X();
1195cdf0e10cSrcweir 		nMPos2 = rPos.Y();
1196cdf0e10cSrcweir 	}
1197cdf0e10cSrcweir 	else
1198cdf0e10cSrcweir 	{
1199cdf0e10cSrcweir 		nMPos1 = rPos.Y();
1200cdf0e10cSrcweir 		nMPos2 = rPos.X();
1201cdf0e10cSrcweir 	}
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir 	for ( i = 0; i < nItems-1; i++ )
1204cdf0e10cSrcweir 	{
1205cdf0e10cSrcweir 		if ( pItems[i].mnSplitSize )
1206cdf0e10cSrcweir 		{
1207cdf0e10cSrcweir 			if ( bRows )
1208cdf0e10cSrcweir 			{
1209cdf0e10cSrcweir 				nTop	= pItems[i].mnLeft;
1210cdf0e10cSrcweir 				nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
1211cdf0e10cSrcweir 			}
1212cdf0e10cSrcweir 			else
1213cdf0e10cSrcweir 			{
1214cdf0e10cSrcweir 				nTop	= pItems[i].mnTop;
1215cdf0e10cSrcweir 				nBottom = pItems[i].mnTop+pItems[i].mnHeight-1;
1216cdf0e10cSrcweir 			}
1217cdf0e10cSrcweir 			nPos = pItems[i].mnSplitPos;
1218cdf0e10cSrcweir 
1219cdf0e10cSrcweir 			if ( (nMPos1 >= nTop) && (nMPos1 <= nBottom) &&
1220cdf0e10cSrcweir 				 (nMPos2 >= nPos) && (nMPos2 <= nPos+pItems[i].mnSplitSize) )
1221cdf0e10cSrcweir 			{
1222cdf0e10cSrcweir 				if ( !pItems[i].mbFixed && !pItems[i+1].mbFixed )
1223cdf0e10cSrcweir 				{
1224cdf0e10cSrcweir 					rMouseOff = nMPos2-nPos;
1225cdf0e10cSrcweir 					*ppFoundSet = pSet;
1226cdf0e10cSrcweir 					rFoundPos = i;
1227cdf0e10cSrcweir 					if ( bRows )
1228cdf0e10cSrcweir 						return SPLIT_VERT;
1229cdf0e10cSrcweir 					else
1230cdf0e10cSrcweir 						return SPLIT_HORZ;
1231cdf0e10cSrcweir 				}
1232cdf0e10cSrcweir 				else
1233cdf0e10cSrcweir 					return SPLIT_NOSPLIT;
1234cdf0e10cSrcweir 			}
1235cdf0e10cSrcweir 		}
1236cdf0e10cSrcweir 	}
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
1239cdf0e10cSrcweir 	{
1240cdf0e10cSrcweir 		if ( pItems[i].mpSet )
1241cdf0e10cSrcweir 		{
1242cdf0e10cSrcweir 			nSplitTest = ImplTestSplit( pItems[i].mpSet, rPos,
1243cdf0e10cSrcweir 									   rMouseOff, ppFoundSet, rFoundPos,
1244cdf0e10cSrcweir 									   ((pItems[i].mnBits & SWIB_COLSET) == 0) );
1245cdf0e10cSrcweir 			if ( nSplitTest )
1246cdf0e10cSrcweir 				return nSplitTest;
1247cdf0e10cSrcweir 		}
1248cdf0e10cSrcweir 	}
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir 	return 0;
1251cdf0e10cSrcweir }
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir // -----------------------------------------------------------------------
1254cdf0e10cSrcweir 
ImplTestSplit(SplitWindow * pWindow,const Point & rPos,long & rMouseOff,ImplSplitSet ** ppFoundSet,sal_uInt16 & rFoundPos)1255cdf0e10cSrcweir sal_uInt16 SplitWindow::ImplTestSplit( SplitWindow* pWindow, const Point& rPos,
1256cdf0e10cSrcweir                                    long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos )
1257cdf0e10cSrcweir {
1258cdf0e10cSrcweir 	// Resizeable SplitWindow muss anders behandelt werden
1259cdf0e10cSrcweir 	if ( pWindow->mnWinStyle & WB_SIZEABLE )
1260cdf0e10cSrcweir 	{
1261cdf0e10cSrcweir 		long	nTPos;
1262cdf0e10cSrcweir 		long	nPos;
1263cdf0e10cSrcweir 		long	nBorder;
1264cdf0e10cSrcweir 
1265cdf0e10cSrcweir 		if ( pWindow->mbHorz )
1266cdf0e10cSrcweir 		{
1267cdf0e10cSrcweir 			if ( pWindow->mbBottomRight )
1268cdf0e10cSrcweir 			{
1269cdf0e10cSrcweir 				nBorder = pWindow->mnBottomBorder;
1270cdf0e10cSrcweir 				nPos = 0;
1271cdf0e10cSrcweir 			}
1272cdf0e10cSrcweir 			else
1273cdf0e10cSrcweir 			{
1274cdf0e10cSrcweir 				nBorder = pWindow->mnTopBorder;
1275cdf0e10cSrcweir 				nPos = pWindow->mnDY-nBorder;
1276cdf0e10cSrcweir 			}
1277cdf0e10cSrcweir 			nTPos = rPos.Y();
1278cdf0e10cSrcweir 		}
1279cdf0e10cSrcweir 		else
1280cdf0e10cSrcweir 		{
1281cdf0e10cSrcweir 			if ( pWindow->mbBottomRight )
1282cdf0e10cSrcweir 			{
1283cdf0e10cSrcweir 				nBorder = pWindow->mnRightBorder;
1284cdf0e10cSrcweir 				nPos = 0;
1285cdf0e10cSrcweir 			}
1286cdf0e10cSrcweir 			else
1287cdf0e10cSrcweir 			{
1288cdf0e10cSrcweir 				nBorder = pWindow->mnLeftBorder;
1289cdf0e10cSrcweir 				nPos = pWindow->mnDX-nBorder;
1290cdf0e10cSrcweir 			}
1291cdf0e10cSrcweir 			nTPos = rPos.X();
1292cdf0e10cSrcweir 		}
1293cdf0e10cSrcweir 		long nSplitSize = pWindow->mpMainSet->mnSplitSize-2;
1294cdf0e10cSrcweir 		if ( pWindow->mbAutoHide || pWindow->mbFadeOut )
1295cdf0e10cSrcweir 			nSplitSize += SPLITWIN_SPLITSIZEEXLN;
1296cdf0e10cSrcweir 		if ( !pWindow->mbBottomRight )
1297cdf0e10cSrcweir 			nPos -= nSplitSize;
1298cdf0e10cSrcweir 		if ( (nTPos >= nPos) && (nTPos <= nPos+nSplitSize+nBorder) )
1299cdf0e10cSrcweir 		{
1300cdf0e10cSrcweir 			rMouseOff = nTPos-nPos;
1301cdf0e10cSrcweir 			*ppFoundSet = pWindow->mpMainSet;
1302cdf0e10cSrcweir 			if ( pWindow->mpMainSet->mpItems )
1303cdf0e10cSrcweir 				rFoundPos = pWindow->mpMainSet->mnItems-1;
1304cdf0e10cSrcweir 			else
1305cdf0e10cSrcweir 				rFoundPos = 0;
1306cdf0e10cSrcweir 			if ( pWindow->mbHorz )
1307cdf0e10cSrcweir 				return SPLIT_VERT | SPLIT_WINDOW;
1308cdf0e10cSrcweir 			else
1309cdf0e10cSrcweir 				return SPLIT_HORZ | SPLIT_WINDOW;
1310cdf0e10cSrcweir 		}
1311cdf0e10cSrcweir 	}
1312cdf0e10cSrcweir 
1313cdf0e10cSrcweir 	return ImplTestSplit( pWindow->mpMainSet, rPos, rMouseOff, ppFoundSet, rFoundPos,
1314cdf0e10cSrcweir 						 pWindow->mbHorz, !pWindow->mbBottomRight );
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir // -----------------------------------------------------------------------
1318cdf0e10cSrcweir 
ImplDrawSplitTracking(SplitWindow * pThis,const Point & rPos)1319cdf0e10cSrcweir void SplitWindow::ImplDrawSplitTracking( SplitWindow* pThis, const Point& rPos )
1320cdf0e10cSrcweir {
1321cdf0e10cSrcweir 	Rectangle aRect;
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir 	if ( pThis->mnSplitTest & SPLIT_HORZ )
1324cdf0e10cSrcweir 	{
1325cdf0e10cSrcweir 		aRect.Top()    = pThis->maDragRect.Top();
1326cdf0e10cSrcweir 		aRect.Bottom() = pThis->maDragRect.Bottom();
1327cdf0e10cSrcweir 		aRect.Left()   = rPos.X();
1328cdf0e10cSrcweir 		aRect.Right()  = aRect.Left()+pThis->mpSplitSet->mnSplitSize-1;
1329cdf0e10cSrcweir 		if ( !(pThis->mnWinStyle & WB_NOSPLITDRAW) )
1330cdf0e10cSrcweir 			aRect.Right()--;
1331cdf0e10cSrcweir 		if ( (pThis->mnSplitTest & SPLIT_WINDOW) &&
1332cdf0e10cSrcweir 			 (pThis->mbAutoHide || pThis->mbFadeOut) )
1333cdf0e10cSrcweir 		{
1334cdf0e10cSrcweir 			aRect.Left()  += SPLITWIN_SPLITSIZEEXLN;
1335cdf0e10cSrcweir 			aRect.Right() += SPLITWIN_SPLITSIZEEXLN;
1336cdf0e10cSrcweir 		}
1337cdf0e10cSrcweir 	}
1338cdf0e10cSrcweir 	else
1339cdf0e10cSrcweir 	{
1340cdf0e10cSrcweir 		aRect.Left()	= pThis->maDragRect.Left();
1341cdf0e10cSrcweir 		aRect.Right()	= pThis->maDragRect.Right();
1342cdf0e10cSrcweir 		aRect.Top() 	= rPos.Y();
1343cdf0e10cSrcweir 		aRect.Bottom()	= aRect.Top()+pThis->mpSplitSet->mnSplitSize-1;
1344cdf0e10cSrcweir 		if ( !(pThis->mnWinStyle & WB_NOSPLITDRAW) )
1345cdf0e10cSrcweir 			aRect.Bottom()--;
1346cdf0e10cSrcweir 		if ( (pThis->mnSplitTest & SPLIT_WINDOW) &&
1347cdf0e10cSrcweir 			 (pThis->mbAutoHide || pThis->mbFadeOut) )
1348cdf0e10cSrcweir 		{
1349cdf0e10cSrcweir 			aRect.Top()    += SPLITWIN_SPLITSIZEEXLN;
1350cdf0e10cSrcweir 			aRect.Bottom() += SPLITWIN_SPLITSIZEEXLN;
1351cdf0e10cSrcweir 		}
1352cdf0e10cSrcweir 	}
1353cdf0e10cSrcweir 	pThis->ShowTracking( aRect, SHOWTRACK_SPLIT );
1354cdf0e10cSrcweir }
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir // -----------------------------------------------------------------------
1357cdf0e10cSrcweir 
ImplInit(Window * pParent,WinBits nStyle)1358cdf0e10cSrcweir void SplitWindow::ImplInit( Window* pParent, WinBits nStyle )
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir 	ImplSplitSet* pNewSet	= new ImplSplitSet;
1361cdf0e10cSrcweir 	pNewSet->mpItems		= NULL;
1362cdf0e10cSrcweir 	pNewSet->mpWallpaper	= NULL;
1363cdf0e10cSrcweir 	pNewSet->mpBitmap		= NULL;
1364cdf0e10cSrcweir 	pNewSet->mnLastSize 	= 0;
1365cdf0e10cSrcweir 	pNewSet->mnItems		= 0;
1366cdf0e10cSrcweir 	pNewSet->mnId			= 0;
1367cdf0e10cSrcweir 	pNewSet->mnSplitSize	= SPLITWIN_SPLITSIZE;
1368cdf0e10cSrcweir 	pNewSet->mbCalcPix		= sal_True;
1369cdf0e10cSrcweir 
1370cdf0e10cSrcweir 	mpMainSet				= pNewSet;
1371cdf0e10cSrcweir 	mpBaseSet				= pNewSet;
1372cdf0e10cSrcweir 	mpSplitSet				= NULL;
1373cdf0e10cSrcweir 	mpLastSizes 			= NULL;
1374cdf0e10cSrcweir 	mnDX					= 0;
1375cdf0e10cSrcweir 	mnDY					= 0;
1376cdf0e10cSrcweir 	mnLeftBorder			= 0;
1377cdf0e10cSrcweir 	mnTopBorder 			= 0;
1378cdf0e10cSrcweir 	mnRightBorder			= 0;
1379cdf0e10cSrcweir 	mnBottomBorder			= 0;
1380cdf0e10cSrcweir 	mnMaxSize				= 0;
1381cdf0e10cSrcweir 	mnMouseOff				= 0;
1382cdf0e10cSrcweir 	meAlign 				= WINDOWALIGN_TOP;
1383cdf0e10cSrcweir 	mnWinStyle				= nStyle;
1384cdf0e10cSrcweir 	mnSplitTest 			= 0;
1385cdf0e10cSrcweir 	mnSplitPos				= 0;
1386cdf0e10cSrcweir 	mnMouseModifier 		= 0;
1387cdf0e10cSrcweir 	mnMStartPos 			= 0;
1388cdf0e10cSrcweir 	mnMSplitPos 			= 0;
1389cdf0e10cSrcweir 	mbDragFull				= sal_False;
1390cdf0e10cSrcweir 	mbHorz					= sal_True;
1391cdf0e10cSrcweir 	mbBottomRight			= sal_False;
1392cdf0e10cSrcweir 	mbCalc					= sal_False;
1393cdf0e10cSrcweir 	mbRecalc				= sal_True;
1394cdf0e10cSrcweir 	mbInvalidate			= sal_True;
1395cdf0e10cSrcweir 	mbAutoHide				= sal_False;
1396cdf0e10cSrcweir 	mbFadeIn				= sal_False;
1397cdf0e10cSrcweir 	mbFadeOut				= sal_False;
1398cdf0e10cSrcweir 	mbAutoHideIn			= sal_False;
1399cdf0e10cSrcweir 	mbAutoHideDown			= sal_False;
1400cdf0e10cSrcweir 	mbFadeInDown			= sal_False;
1401cdf0e10cSrcweir 	mbFadeOutDown			= sal_False;
1402cdf0e10cSrcweir 	mbAutoHidePressed		= sal_False;
1403cdf0e10cSrcweir 	mbFadeInPressed 		= sal_False;
1404cdf0e10cSrcweir 	mbFadeOutPressed		= sal_False;
1405cdf0e10cSrcweir 	mbFadeNoButtonMode		= sal_False;
1406cdf0e10cSrcweir 	mbNoAlign				= sal_False;
1407cdf0e10cSrcweir 
1408cdf0e10cSrcweir 	if ( nStyle & WB_NOSPLITDRAW )
1409cdf0e10cSrcweir 	{
1410cdf0e10cSrcweir 		pNewSet->mnSplitSize -= 2;
1411cdf0e10cSrcweir 		mbInvalidate = sal_False;
1412cdf0e10cSrcweir 	}
1413cdf0e10cSrcweir 
1414cdf0e10cSrcweir 	if ( nStyle & WB_BORDER )
1415cdf0e10cSrcweir 	{
1416cdf0e10cSrcweir 		ImplCalcBorder( meAlign, mbNoAlign, mnLeftBorder, mnTopBorder,
1417cdf0e10cSrcweir 						mnRightBorder, mnBottomBorder );
1418cdf0e10cSrcweir 	}
1419cdf0e10cSrcweir 	else
1420cdf0e10cSrcweir 	{
1421cdf0e10cSrcweir 		mnLeftBorder   = 0;
1422cdf0e10cSrcweir 		mnTopBorder    = 0;
1423cdf0e10cSrcweir 		mnRightBorder  = 0;
1424cdf0e10cSrcweir 		mnBottomBorder = 0;
1425cdf0e10cSrcweir 	}
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir 	DockingWindow::ImplInit( pParent, (nStyle | WB_CLIPCHILDREN) & ~(WB_BORDER | WB_SIZEABLE) );
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir 	ImplInitSettings();
1430cdf0e10cSrcweir }
1431cdf0e10cSrcweir 
1432cdf0e10cSrcweir // -----------------------------------------------------------------------
1433cdf0e10cSrcweir 
ImplInitSettings()1434cdf0e10cSrcweir void SplitWindow::ImplInitSettings()
1435cdf0e10cSrcweir {
1436cdf0e10cSrcweir 	// Wenn fuer das MainSet eine Bitmap gesetzt wird, dann
1437cdf0e10cSrcweir 	// brauchen wir nicht mehr den Hintergrund loeschen
1438cdf0e10cSrcweir 	// Wenn MainSet Wallpaper hat, dann ist das der Hintergrund, ansonsten
1439cdf0e10cSrcweir 	// sind es die Standard-Farben
1440cdf0e10cSrcweir 	if ( mpMainSet->mpBitmap )
1441cdf0e10cSrcweir 		SetBackground();
1442cdf0e10cSrcweir 	else if ( mpMainSet->mpWallpaper )
1443cdf0e10cSrcweir 		SetBackground( *mpMainSet->mpWallpaper );
1444cdf0e10cSrcweir 	else
1445cdf0e10cSrcweir 	{
1446cdf0e10cSrcweir 		const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1447cdf0e10cSrcweir 
1448cdf0e10cSrcweir 		Color aColor;
1449cdf0e10cSrcweir 		if ( IsControlBackground() )
1450cdf0e10cSrcweir 			aColor = GetControlBackground();
1451cdf0e10cSrcweir 		else if ( Window::GetStyle() & WB_3DLOOK )
1452cdf0e10cSrcweir 			aColor = rStyleSettings.GetFaceColor();
1453cdf0e10cSrcweir 		else
1454cdf0e10cSrcweir 			aColor = rStyleSettings.GetWindowColor();
1455cdf0e10cSrcweir 		SetBackground( aColor );
1456cdf0e10cSrcweir 	}
1457cdf0e10cSrcweir }
1458cdf0e10cSrcweir 
1459cdf0e10cSrcweir // =======================================================================
1460cdf0e10cSrcweir 
SplitWindow(Window * pParent,WinBits nStyle)1461cdf0e10cSrcweir SplitWindow::SplitWindow( Window* pParent, WinBits nStyle ) :
1462cdf0e10cSrcweir 	DockingWindow( WINDOW_SPLITWINDOW )
1463cdf0e10cSrcweir {
1464cdf0e10cSrcweir 	ImplInit( pParent, nStyle );
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir // -----------------------------------------------------------------------
1468cdf0e10cSrcweir 
SplitWindow(Window * pParent,const ResId & rResId)1469cdf0e10cSrcweir SplitWindow::SplitWindow( Window* pParent, const ResId& rResId ) :
1470cdf0e10cSrcweir 	DockingWindow( WINDOW_SPLITWINDOW )
1471cdf0e10cSrcweir {
1472cdf0e10cSrcweir 	rResId.SetRT( RSC_SPLITWINDOW );
1473cdf0e10cSrcweir 	WinBits nStyle = ImplInitRes( rResId );
1474cdf0e10cSrcweir 	ImplInit( pParent, nStyle );
1475cdf0e10cSrcweir 	ImplLoadRes( rResId );
1476cdf0e10cSrcweir 
1477cdf0e10cSrcweir 	if ( !(nStyle & WB_HIDE) )
1478cdf0e10cSrcweir 		Show();
1479cdf0e10cSrcweir }
1480cdf0e10cSrcweir 
1481cdf0e10cSrcweir // -----------------------------------------------------------------------
1482cdf0e10cSrcweir 
~SplitWindow()1483cdf0e10cSrcweir SplitWindow::~SplitWindow()
1484cdf0e10cSrcweir {
1485cdf0e10cSrcweir 	// Sets loeschen
1486cdf0e10cSrcweir 	ImplDeleteSet( mpMainSet );
1487cdf0e10cSrcweir }
1488cdf0e10cSrcweir 
1489cdf0e10cSrcweir // -----------------------------------------------------------------------
1490cdf0e10cSrcweir 
ImplSetWindowSize(long nDelta)1491cdf0e10cSrcweir void SplitWindow::ImplSetWindowSize( long nDelta )
1492cdf0e10cSrcweir {
1493cdf0e10cSrcweir 	if ( !nDelta )
1494cdf0e10cSrcweir 		return;
1495cdf0e10cSrcweir 
1496cdf0e10cSrcweir 	Size aSize = GetSizePixel();
1497cdf0e10cSrcweir 	if ( meAlign == WINDOWALIGN_TOP )
1498cdf0e10cSrcweir 	{
1499cdf0e10cSrcweir 		aSize.Height() += nDelta;
1500cdf0e10cSrcweir 		SetSizePixel( aSize );
1501cdf0e10cSrcweir 	}
1502cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_BOTTOM )
1503cdf0e10cSrcweir 	{
150461648e64Smseidel 		maDragRect.Top() += nDelta;
1505cdf0e10cSrcweir 		Point aPos = GetPosPixel();
1506cdf0e10cSrcweir 		aPos.Y() -= nDelta;
1507cdf0e10cSrcweir 		aSize.Height() += nDelta;
1508cdf0e10cSrcweir 		SetPosSizePixel( aPos, aSize );
1509cdf0e10cSrcweir 	}
1510cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_LEFT )
1511cdf0e10cSrcweir 	{
1512cdf0e10cSrcweir 		aSize.Width() += nDelta;
1513cdf0e10cSrcweir 		SetSizePixel( aSize );
1514cdf0e10cSrcweir 	}
1515cdf0e10cSrcweir 	else // meAlign == WINDOWALIGN_RIGHT
1516cdf0e10cSrcweir 	{
151761648e64Smseidel 		maDragRect.Left() += nDelta;
1518cdf0e10cSrcweir 		Point aPos = GetPosPixel();
1519cdf0e10cSrcweir 		aPos.X() -= nDelta;
1520cdf0e10cSrcweir 		aSize.Width() += nDelta;
1521cdf0e10cSrcweir 		SetPosSizePixel( aPos, aSize );
1522cdf0e10cSrcweir 	}
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir 	SplitResize();
1525cdf0e10cSrcweir }
1526cdf0e10cSrcweir 
1527cdf0e10cSrcweir // -----------------------------------------------------------------------
1528cdf0e10cSrcweir 
CalcLayoutSizePixel(const Size & aNewSize)1529cdf0e10cSrcweir Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize )
1530cdf0e10cSrcweir {
1531cdf0e10cSrcweir 	Size aSize( aNewSize );
1532cdf0e10cSrcweir 	long nSplitSize = mpMainSet->mnSplitSize-2;
1533789f9e36Smseidel 
1534cdf0e10cSrcweir 	if ( mbAutoHide || mbFadeOut )
1535cdf0e10cSrcweir 		nSplitSize += SPLITWIN_SPLITSIZEEXLN;
1536cdf0e10cSrcweir 
153761648e64Smseidel 	// Wenn Fenster sizeable ist, wird die Groesse automatisch nach
1538cdf0e10cSrcweir 	// dem MainSet festgelegt, wenn kein relatives Fenster enthalten
1539cdf0e10cSrcweir 	// ist
1540cdf0e10cSrcweir 	if ( mnWinStyle & WB_SIZEABLE )
1541cdf0e10cSrcweir 	{
1542cdf0e10cSrcweir 		long	nCurSize;
1543cdf0e10cSrcweir 		long	nCalcSize = 0;
1544cdf0e10cSrcweir 		sal_uInt16	i;
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir 		for ( i = 0; i < mpMainSet->mnItems; i++ )
1547cdf0e10cSrcweir 		{
1548cdf0e10cSrcweir 			if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
1549cdf0e10cSrcweir 				break;
1550cdf0e10cSrcweir 			else
1551cdf0e10cSrcweir 				nCalcSize += mpMainSet->mpItems[i].mnSize;
1552cdf0e10cSrcweir 		}
1553cdf0e10cSrcweir 
1554cdf0e10cSrcweir 		if ( i == mpMainSet->mnItems )
1555cdf0e10cSrcweir 		{
1556cdf0e10cSrcweir 			long	nDelta = 0;
1557cdf0e10cSrcweir 			Point	aPos = GetPosPixel();
1558789f9e36Smseidel 
1559cdf0e10cSrcweir 			if ( mbHorz )
1560cdf0e10cSrcweir 				nCurSize = aNewSize.Height()-mnTopBorder-mnBottomBorder;
1561cdf0e10cSrcweir 			else
1562cdf0e10cSrcweir 				nCurSize = aNewSize.Width()-mnLeftBorder-mnRightBorder;
1563cdf0e10cSrcweir 			nCurSize -= nSplitSize;
1564cdf0e10cSrcweir 			nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
1565cdf0e10cSrcweir 
1566cdf0e10cSrcweir 			nDelta = nCalcSize-nCurSize;
1567cdf0e10cSrcweir 			if ( !nDelta )
1568cdf0e10cSrcweir 				return aSize;
1569cdf0e10cSrcweir 
1570cdf0e10cSrcweir 			if ( meAlign == WINDOWALIGN_TOP )
1571cdf0e10cSrcweir 			{
1572cdf0e10cSrcweir 				aSize.Height() += nDelta;
1573cdf0e10cSrcweir 			}
1574cdf0e10cSrcweir 			else if ( meAlign == WINDOWALIGN_BOTTOM )
1575cdf0e10cSrcweir 			{
1576cdf0e10cSrcweir 				aPos.Y() -= nDelta;
1577cdf0e10cSrcweir 				aSize.Height() += nDelta;
1578cdf0e10cSrcweir 			}
1579cdf0e10cSrcweir 			else if ( meAlign == WINDOWALIGN_LEFT )
1580cdf0e10cSrcweir 			{
1581cdf0e10cSrcweir 				aSize.Width() += nDelta;
1582cdf0e10cSrcweir 			}
1583cdf0e10cSrcweir 			else // meAlign == WINDOWALIGN_RIGHT
1584cdf0e10cSrcweir 			{
1585cdf0e10cSrcweir 				aPos.X() -= nDelta;
1586cdf0e10cSrcweir 				aSize.Width() += nDelta;
1587cdf0e10cSrcweir 			}
1588cdf0e10cSrcweir 		}
1589cdf0e10cSrcweir 	}
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir 	return aSize;
1592cdf0e10cSrcweir }
1593cdf0e10cSrcweir 
1594cdf0e10cSrcweir // -----------------------------------------------------------------------
1595cdf0e10cSrcweir 
ImplCalcLayout()1596cdf0e10cSrcweir void SplitWindow::ImplCalcLayout()
1597cdf0e10cSrcweir {
1598cdf0e10cSrcweir 	if ( !mbCalc || !mbRecalc || !mpMainSet->mpItems )
1599cdf0e10cSrcweir 		return;
1600cdf0e10cSrcweir 
1601cdf0e10cSrcweir 	long nSplitSize = mpMainSet->mnSplitSize-2;
1602cdf0e10cSrcweir 	if ( mbAutoHide || mbFadeOut )
1603cdf0e10cSrcweir 		nSplitSize += SPLITWIN_SPLITSIZEEXLN;
1604cdf0e10cSrcweir 
160561648e64Smseidel 	// Wenn Fenster sizeable ist, wird die Groesse automatisch nach
1606cdf0e10cSrcweir 	// dem MainSet festgelegt, wenn kein relatives Fenster enthalten
1607cdf0e10cSrcweir 	// ist
1608cdf0e10cSrcweir 	if ( mnWinStyle & WB_SIZEABLE )
1609cdf0e10cSrcweir 	{
1610cdf0e10cSrcweir 		long	nCurSize;
1611cdf0e10cSrcweir 		long	nCalcSize = 0;
1612cdf0e10cSrcweir 		sal_uInt16	i;
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir 		for ( i = 0; i < mpMainSet->mnItems; i++ )
1615cdf0e10cSrcweir 		{
1616cdf0e10cSrcweir 			if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
1617cdf0e10cSrcweir 				break;
1618cdf0e10cSrcweir 			else
1619cdf0e10cSrcweir 				nCalcSize += mpMainSet->mpItems[i].mnSize;
1620cdf0e10cSrcweir 		}
1621cdf0e10cSrcweir 
1622cdf0e10cSrcweir 		if ( i == mpMainSet->mnItems )
1623cdf0e10cSrcweir 		{
1624cdf0e10cSrcweir 			if ( mbHorz )
1625cdf0e10cSrcweir 				nCurSize = mnDY-mnTopBorder-mnBottomBorder;
1626cdf0e10cSrcweir 			else
1627cdf0e10cSrcweir 				nCurSize = mnDX-mnLeftBorder-mnRightBorder;
1628cdf0e10cSrcweir 			nCurSize -= nSplitSize;
1629cdf0e10cSrcweir 			nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
1630cdf0e10cSrcweir 
1631cdf0e10cSrcweir 			mbRecalc = sal_False;
1632cdf0e10cSrcweir 			ImplSetWindowSize( nCalcSize-nCurSize );
1633cdf0e10cSrcweir 			mbRecalc = sal_True;
1634cdf0e10cSrcweir 		}
1635cdf0e10cSrcweir 	}
1636cdf0e10cSrcweir 
1637cdf0e10cSrcweir 	if ( (mnDX <= 0) || (mnDY <= 0) )
1638cdf0e10cSrcweir 		return;
1639cdf0e10cSrcweir 
1640cdf0e10cSrcweir 	// Groessen/Position vorberechnen
1641cdf0e10cSrcweir 	long	nL;
1642cdf0e10cSrcweir 	long	nT;
1643cdf0e10cSrcweir 	long	nW;
1644cdf0e10cSrcweir 	long	nH;
1645cdf0e10cSrcweir 
1646cdf0e10cSrcweir 	if ( mbHorz )
1647cdf0e10cSrcweir 	{
1648cdf0e10cSrcweir 		if ( mbBottomRight )
1649cdf0e10cSrcweir 			nT = mnDY-mnBottomBorder;
1650cdf0e10cSrcweir 		else
1651cdf0e10cSrcweir 			nT = mnTopBorder;
1652cdf0e10cSrcweir 		nL = mnLeftBorder;
1653cdf0e10cSrcweir 	}
1654cdf0e10cSrcweir 	else
1655cdf0e10cSrcweir 	{
1656cdf0e10cSrcweir 		if ( mbBottomRight )
1657cdf0e10cSrcweir 			nL = mnDX-mnRightBorder;
1658cdf0e10cSrcweir 		else
1659cdf0e10cSrcweir 			nL = mnLeftBorder;
1660cdf0e10cSrcweir 		nT = mnTopBorder;
1661cdf0e10cSrcweir 	}
1662cdf0e10cSrcweir 	nW = mnDX-mnLeftBorder-mnRightBorder;
1663cdf0e10cSrcweir 	nH = mnDY-mnTopBorder-mnBottomBorder;
1664cdf0e10cSrcweir 	if ( mnWinStyle & WB_SIZEABLE )
1665cdf0e10cSrcweir 	{
1666cdf0e10cSrcweir 		if ( mbHorz )
1667cdf0e10cSrcweir 			nH -= nSplitSize;
1668cdf0e10cSrcweir 		else
1669cdf0e10cSrcweir 			nW -= nSplitSize;
1670cdf0e10cSrcweir 	}
1671cdf0e10cSrcweir 
1672cdf0e10cSrcweir 	// Sets rekursiv berechnen
1673cdf0e10cSrcweir 	ImplCalcSet( mpMainSet, nL, nT, nW, nH, mbHorz, !mbBottomRight );
1674cdf0e10cSrcweir 	ImplCalcSet2( this, mpMainSet, sal_False, mbHorz, !mbBottomRight );
1675cdf0e10cSrcweir 	mbCalc = sal_False;
1676cdf0e10cSrcweir }
1677cdf0e10cSrcweir 
1678cdf0e10cSrcweir // -----------------------------------------------------------------------
1679cdf0e10cSrcweir 
ImplUpdate()1680cdf0e10cSrcweir void SplitWindow::ImplUpdate()
1681cdf0e10cSrcweir {
1682cdf0e10cSrcweir 	mbCalc = sal_True;
1683cdf0e10cSrcweir 
1684cdf0e10cSrcweir 	if ( IsReallyShown() && IsUpdateMode() && mbRecalc )
1685cdf0e10cSrcweir 	{
1686cdf0e10cSrcweir 		if ( mpMainSet->mpItems )
1687cdf0e10cSrcweir 			ImplCalcLayout();
1688cdf0e10cSrcweir 		else
1689cdf0e10cSrcweir 			Invalidate();
1690cdf0e10cSrcweir 	}
1691cdf0e10cSrcweir }
1692cdf0e10cSrcweir 
1693cdf0e10cSrcweir // -----------------------------------------------------------------------
1694cdf0e10cSrcweir 
ImplUpdateSet(ImplSplitSet * pSet)1695cdf0e10cSrcweir void SplitWindow::ImplUpdateSet( ImplSplitSet* pSet )
1696cdf0e10cSrcweir {
1697cdf0e10cSrcweir 	if ( IsReallyShown() && IsUpdateMode() && mbRecalc )
1698cdf0e10cSrcweir 	{
1699cdf0e10cSrcweir 		// Wenn wir noch berechnen muessen, dann alles invalidieren.
1700cdf0e10cSrcweir 		if ( mbCalc )
1701cdf0e10cSrcweir 		{
1702cdf0e10cSrcweir 			// Wenn nicht NOSPLITDRAW gesetzt ist, koennen wir uns das
170361648e64Smseidel 			// invalidieren sparen, da bei ImplCalcSet2() die freien Flaechen
1704cdf0e10cSrcweir 			// sowieso invalidiert werden
1705cdf0e10cSrcweir 			if ( !mpMainSet->mpItems || (mnWinStyle & WB_NOSPLITDRAW) )
1706cdf0e10cSrcweir 				pSet = mpMainSet;
1707cdf0e10cSrcweir 			else
1708cdf0e10cSrcweir 				return;
1709cdf0e10cSrcweir 		}
1710cdf0e10cSrcweir 
1711cdf0e10cSrcweir 		Rectangle aRect;
1712cdf0e10cSrcweir 		if ( pSet == mpMainSet )
1713cdf0e10cSrcweir 		{
1714cdf0e10cSrcweir 			aRect.Left()	= mnLeftBorder;
1715cdf0e10cSrcweir 			aRect.Top() 	= mnTopBorder;
1716cdf0e10cSrcweir 			aRect.Right()	= mnDX-mnRightBorder-1;
1717cdf0e10cSrcweir 			aRect.Bottom()	= mnDY-mnBottomBorder-1;
1718cdf0e10cSrcweir 		}
1719cdf0e10cSrcweir 		else
1720cdf0e10cSrcweir 		{
1721cdf0e10cSrcweir 			ImplSplitItem*	pItem;
1722cdf0e10cSrcweir 			sal_uInt16			nPos;
1723cdf0e10cSrcweir 
1724cdf0e10cSrcweir 			pSet = ImplFindItem( mpMainSet, pSet->mnId, nPos );
1725cdf0e10cSrcweir 			pItem = &(pSet->mpItems[nPos]);
1726cdf0e10cSrcweir 			aRect.Left()	= pItem->mnLeft;
1727cdf0e10cSrcweir 			aRect.Top() 	= pItem->mnTop;
1728cdf0e10cSrcweir 			aRect.Right()	= aRect.Left()+pItem->mnWidth;
1729cdf0e10cSrcweir 			aRect.Bottom()	= aRect.Top()+pItem->mnHeight;
1730cdf0e10cSrcweir 		}
1731cdf0e10cSrcweir 		Invalidate( aRect );
1732cdf0e10cSrcweir 	}
1733cdf0e10cSrcweir }
1734cdf0e10cSrcweir 
1735cdf0e10cSrcweir // -----------------------------------------------------------------------
1736cdf0e10cSrcweir 
ImplSplitMousePos(Point & rMousePos)1737cdf0e10cSrcweir void SplitWindow::ImplSplitMousePos( Point& rMousePos )
1738cdf0e10cSrcweir {
1739cdf0e10cSrcweir 	if ( mnSplitTest & SPLIT_HORZ )
1740cdf0e10cSrcweir 	{
1741cdf0e10cSrcweir 		rMousePos.X() -= mnMouseOff;
1742cdf0e10cSrcweir 		if ( rMousePos.X() < maDragRect.Left() )
1743cdf0e10cSrcweir 			rMousePos.X() = maDragRect.Left();
1744cdf0e10cSrcweir 		else if ( rMousePos.X()+mpSplitSet->mnSplitSize+1 > maDragRect.Right() )
1745cdf0e10cSrcweir 			rMousePos.X() = maDragRect.Right()-mpSplitSet->mnSplitSize+1;
1746cdf0e10cSrcweir 		// Wegen FullDrag in Screen-Koordinaaten merken
1747cdf0e10cSrcweir 		mnMSplitPos = OutputToScreenPixel( rMousePos ).X();
1748cdf0e10cSrcweir 	}
1749cdf0e10cSrcweir 	else
1750cdf0e10cSrcweir 	{
1751cdf0e10cSrcweir 		rMousePos.Y() -= mnMouseOff;
1752cdf0e10cSrcweir 		if ( rMousePos.Y() < maDragRect.Top() )
1753cdf0e10cSrcweir 			rMousePos.Y() = maDragRect.Top();
1754cdf0e10cSrcweir 		else if ( rMousePos.Y()+mpSplitSet->mnSplitSize+1 > maDragRect.Bottom() )
1755cdf0e10cSrcweir 			rMousePos.Y() = maDragRect.Bottom()-mpSplitSet->mnSplitSize+1;
1756cdf0e10cSrcweir 		mnMSplitPos = OutputToScreenPixel( rMousePos ).Y();
1757cdf0e10cSrcweir 	}
1758cdf0e10cSrcweir }
1759cdf0e10cSrcweir 
1760cdf0e10cSrcweir // -----------------------------------------------------------------------
1761cdf0e10cSrcweir 
ImplGetButtonRect(Rectangle & rRect,long nEx,sal_Bool bTest) const1762cdf0e10cSrcweir void SplitWindow::ImplGetButtonRect( Rectangle& rRect, long nEx, sal_Bool bTest ) const
1763cdf0e10cSrcweir {
1764cdf0e10cSrcweir 	long nSplitSize = mpMainSet->mnSplitSize-2;
1765cdf0e10cSrcweir 	if ( mbAutoHide || mbFadeOut || mbFadeIn )
1766cdf0e10cSrcweir 		nSplitSize += SPLITWIN_SPLITSIZEEX;
1767cdf0e10cSrcweir 
1768cdf0e10cSrcweir 	long nButtonSize = 0;
1769cdf0e10cSrcweir 	if ( mbFadeIn )
1770cdf0e10cSrcweir 		nButtonSize += SPLITWIN_SPLITSIZEFADE+1;
1771cdf0e10cSrcweir 	if ( mbFadeOut )
1772cdf0e10cSrcweir 		nButtonSize += SPLITWIN_SPLITSIZEFADE+1;
1773cdf0e10cSrcweir 	if ( mbAutoHide )
1774cdf0e10cSrcweir 		nButtonSize += SPLITWIN_SPLITSIZEAUTOHIDE+1;
1775cdf0e10cSrcweir 	long nCenterEx = 0;
1776cdf0e10cSrcweir 	if ( mbHorz )
1777cdf0e10cSrcweir 		nCenterEx += ((mnDX-mnLeftBorder-mnRightBorder)-nButtonSize)/2;
1778cdf0e10cSrcweir 	else
1779cdf0e10cSrcweir 		nCenterEx += ((mnDY-mnTopBorder-mnBottomBorder)-nButtonSize)/2;
1780cdf0e10cSrcweir 	if ( nCenterEx > 0 )
1781cdf0e10cSrcweir 		nEx += nCenterEx;
1782cdf0e10cSrcweir 
1783cdf0e10cSrcweir 	if ( meAlign == WINDOWALIGN_TOP )
1784cdf0e10cSrcweir 	{
1785cdf0e10cSrcweir 		rRect.Left()	= mnLeftBorder+nEx;
1786cdf0e10cSrcweir 		rRect.Top() 	= mnDY-mnBottomBorder-nSplitSize;
1787cdf0e10cSrcweir 		rRect.Right()	= rRect.Left()+SPLITWIN_SPLITSIZEAUTOHIDE;
1788cdf0e10cSrcweir 		rRect.Bottom()	= mnDY-mnBottomBorder-1;
1789cdf0e10cSrcweir 		if ( bTest )
1790cdf0e10cSrcweir 		{
1791cdf0e10cSrcweir 			rRect.Top() 	-= mnTopBorder;
1792cdf0e10cSrcweir 			rRect.Bottom()	+= mnBottomBorder;
1793cdf0e10cSrcweir 		}
1794cdf0e10cSrcweir 	}
1795cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_BOTTOM )
1796cdf0e10cSrcweir 	{
1797cdf0e10cSrcweir 		rRect.Left()	= mnLeftBorder+nEx;
1798cdf0e10cSrcweir 		rRect.Top() 	= mnTopBorder;
1799cdf0e10cSrcweir 		rRect.Right()	= rRect.Left()+SPLITWIN_SPLITSIZEAUTOHIDE;
1800cdf0e10cSrcweir 		rRect.Bottom()	= mnTopBorder+nSplitSize-1;
1801cdf0e10cSrcweir 		if ( bTest )
1802cdf0e10cSrcweir 		{
1803cdf0e10cSrcweir 			rRect.Top() 	-= mnTopBorder;
1804cdf0e10cSrcweir 			rRect.Bottom()	+= mnBottomBorder;
1805cdf0e10cSrcweir 		}
1806cdf0e10cSrcweir 	}
1807cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_LEFT )
1808cdf0e10cSrcweir 	{
1809cdf0e10cSrcweir 		rRect.Left()	= mnDX-mnRightBorder-nSplitSize;
1810cdf0e10cSrcweir 		rRect.Top() 	= mnTopBorder+nEx;
1811cdf0e10cSrcweir 		rRect.Right()	= mnDX-mnRightBorder-1;
1812cdf0e10cSrcweir 		rRect.Bottom()	= rRect.Top()+SPLITWIN_SPLITSIZEAUTOHIDE;
1813cdf0e10cSrcweir 		if ( bTest )
1814cdf0e10cSrcweir 		{
1815cdf0e10cSrcweir 			rRect.Left()	-= mnLeftBorder;
1816cdf0e10cSrcweir 			rRect.Right()	+= mnRightBorder;
1817cdf0e10cSrcweir 		}
1818cdf0e10cSrcweir 	}
1819cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_RIGHT )
1820cdf0e10cSrcweir 	{
1821cdf0e10cSrcweir 		rRect.Left()	= mnLeftBorder;
1822cdf0e10cSrcweir 		rRect.Top() 	= mnTopBorder+nEx;
1823cdf0e10cSrcweir 		rRect.Right()	= mnLeftBorder+nSplitSize-1;
1824cdf0e10cSrcweir 		rRect.Bottom()	= rRect.Top()+SPLITWIN_SPLITSIZEAUTOHIDE;
1825cdf0e10cSrcweir 		if ( bTest )
1826cdf0e10cSrcweir 		{
1827cdf0e10cSrcweir 			rRect.Left()	-= mnLeftBorder;
1828cdf0e10cSrcweir 			rRect.Right()	+= mnRightBorder;
1829cdf0e10cSrcweir 		}
1830cdf0e10cSrcweir 	}
1831cdf0e10cSrcweir }
1832cdf0e10cSrcweir 
1833cdf0e10cSrcweir // -----------------------------------------------------------------------
1834cdf0e10cSrcweir 
ImplGetAutoHideRect(Rectangle & rRect,sal_Bool bTest) const1835cdf0e10cSrcweir void SplitWindow::ImplGetAutoHideRect( Rectangle& rRect, sal_Bool bTest ) const
1836cdf0e10cSrcweir {
1837cdf0e10cSrcweir 	Rectangle aRect;
1838cdf0e10cSrcweir 
1839cdf0e10cSrcweir 	if ( mbAutoHide )
1840cdf0e10cSrcweir 	{
1841cdf0e10cSrcweir 		long nEx = 0;
1842cdf0e10cSrcweir 		if ( mbFadeIn || mbFadeOut )
1843cdf0e10cSrcweir 			nEx = SPLITWIN_SPLITSIZEFADE+1;
1844cdf0e10cSrcweir 		ImplGetButtonRect( aRect, nEx, bTest && mbFadeIn );
1845cdf0e10cSrcweir 	}
1846cdf0e10cSrcweir 
1847cdf0e10cSrcweir 	rRect = aRect;
1848cdf0e10cSrcweir }
1849cdf0e10cSrcweir 
1850cdf0e10cSrcweir // -----------------------------------------------------------------------
1851cdf0e10cSrcweir 
ImplGetFadeInRect(Rectangle & rRect,sal_Bool bTest) const1852cdf0e10cSrcweir void SplitWindow::ImplGetFadeInRect( Rectangle& rRect, sal_Bool bTest ) const
1853cdf0e10cSrcweir {
1854cdf0e10cSrcweir 	Rectangle aRect;
1855cdf0e10cSrcweir 
1856cdf0e10cSrcweir 	if ( mbFadeIn )
1857cdf0e10cSrcweir 		ImplGetButtonRect( aRect, 0, bTest );
1858cdf0e10cSrcweir 
1859cdf0e10cSrcweir 	rRect = aRect;
1860cdf0e10cSrcweir }
1861cdf0e10cSrcweir 
1862cdf0e10cSrcweir // -----------------------------------------------------------------------
1863cdf0e10cSrcweir 
ImplGetFadeOutRect(Rectangle & rRect,sal_Bool) const1864cdf0e10cSrcweir void SplitWindow::ImplGetFadeOutRect( Rectangle& rRect, sal_Bool ) const
1865cdf0e10cSrcweir {
1866cdf0e10cSrcweir 	Rectangle aRect;
1867cdf0e10cSrcweir 
1868cdf0e10cSrcweir 	if ( mbFadeOut )
1869cdf0e10cSrcweir 		ImplGetButtonRect( aRect, 0, sal_False );
1870cdf0e10cSrcweir 
1871cdf0e10cSrcweir 	rRect = aRect;
1872cdf0e10cSrcweir }
1873cdf0e10cSrcweir 
1874cdf0e10cSrcweir // -----------------------------------------------------------------------
1875cdf0e10cSrcweir 
ImplDrawButtonRect(const Rectangle & rRect,long nSize)1876cdf0e10cSrcweir void SplitWindow::ImplDrawButtonRect( const Rectangle& rRect, long nSize )
1877cdf0e10cSrcweir {
1878cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1879cdf0e10cSrcweir 
1880cdf0e10cSrcweir 	if ( mbHorz )
1881cdf0e10cSrcweir 	{
1882cdf0e10cSrcweir 		long nLeft = rRect.Left();
1883cdf0e10cSrcweir 		long nRight = rRect.Right();
1884cdf0e10cSrcweir 		long nCenter = rRect.Center().Y();
1885cdf0e10cSrcweir 		long nEx1 = nLeft+((rRect.GetWidth()-nSize)/2)-2;
1886cdf0e10cSrcweir 		long nEx2 = nEx1+nSize+3;
1887cdf0e10cSrcweir 		SetLineColor( rStyleSettings.GetLightColor() );
1888cdf0e10cSrcweir 		DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Left(), rRect.Bottom() ) );
1889cdf0e10cSrcweir 		DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Right(), rRect.Top() ) );
1890cdf0e10cSrcweir 		SetLineColor( rStyleSettings.GetShadowColor() );
1891cdf0e10cSrcweir 		DrawLine( Point( rRect.Right(), rRect.Top() ), Point( rRect.Right(), rRect.Bottom() ) );
1892cdf0e10cSrcweir 		DrawLine( Point( rRect.Left(), rRect.Bottom() ), Point( rRect.Right(), rRect.Bottom() ) );
1893cdf0e10cSrcweir 		long i = nLeft+2;
1894cdf0e10cSrcweir 		while ( i < nRight-3 )
1895cdf0e10cSrcweir 		{
1896cdf0e10cSrcweir 			if ( (i < nEx1) || (i > nEx2 ) )
1897cdf0e10cSrcweir 			{
1898cdf0e10cSrcweir 				DrawPixel( Point( i, nCenter-2 ), rStyleSettings.GetLightColor() );
1899cdf0e10cSrcweir 				DrawPixel( Point( i+1, nCenter-2+1 ), rStyleSettings.GetShadowColor() );
1900cdf0e10cSrcweir 			}
1901cdf0e10cSrcweir 			i++;
1902cdf0e10cSrcweir 			if ( (i < nEx1) || ((i > nEx2 ) && (i < nRight-3)) )
1903cdf0e10cSrcweir 			{
1904cdf0e10cSrcweir 				DrawPixel( Point( i, nCenter+2 ), rStyleSettings.GetLightColor() );
1905cdf0e10cSrcweir 				DrawPixel( Point( i+1, nCenter+2+1 ), rStyleSettings.GetShadowColor() );
1906cdf0e10cSrcweir 			}
1907cdf0e10cSrcweir 			i += 2;
1908cdf0e10cSrcweir 		}
1909cdf0e10cSrcweir 	}
1910cdf0e10cSrcweir 	else
1911cdf0e10cSrcweir 	{
1912cdf0e10cSrcweir 		long nTop = rRect.Top();
1913cdf0e10cSrcweir 		long nBottom = rRect.Bottom();
1914cdf0e10cSrcweir 		long nCenter = rRect.Center().X();
1915cdf0e10cSrcweir 		long nEx1 = nTop+((rRect.GetHeight()-nSize)/2)-2;
1916cdf0e10cSrcweir 		long nEx2 = nEx1+nSize+3;
1917cdf0e10cSrcweir 		SetLineColor( rStyleSettings.GetLightColor() );
1918cdf0e10cSrcweir 		DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Right(), rRect.Top() ) );
1919cdf0e10cSrcweir 		DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Left(), rRect.Bottom() ) );
1920cdf0e10cSrcweir 		SetLineColor( rStyleSettings.GetShadowColor() );
1921cdf0e10cSrcweir 		DrawLine( Point( rRect.Right(), rRect.Top() ), Point( rRect.Right(), rRect.Bottom() ) );
1922cdf0e10cSrcweir 		DrawLine( Point( rRect.Left(), rRect.Bottom() ), Point( rRect.Right(), rRect.Bottom() ) );
1923cdf0e10cSrcweir 		long i = nTop+2;
1924cdf0e10cSrcweir 		while ( i < nBottom-3 )
1925cdf0e10cSrcweir 		{
1926cdf0e10cSrcweir 			if ( (i < nEx1) || (i > nEx2 ) )
1927cdf0e10cSrcweir 			{
1928cdf0e10cSrcweir 				DrawPixel( Point( nCenter-2, i ), rStyleSettings.GetLightColor() );
1929cdf0e10cSrcweir 				DrawPixel( Point( nCenter-2+1, i+1 ), rStyleSettings.GetShadowColor() );
1930cdf0e10cSrcweir 			}
1931cdf0e10cSrcweir 			i++;
1932cdf0e10cSrcweir 			if ( (i < nEx1) || ((i > nEx2 ) && (i < nBottom-3)) )
1933cdf0e10cSrcweir 			{
1934cdf0e10cSrcweir 				DrawPixel( Point( nCenter+2, i ), rStyleSettings.GetLightColor() );
1935cdf0e10cSrcweir 				DrawPixel( Point( nCenter+2+1, i+1 ), rStyleSettings.GetShadowColor() );
1936cdf0e10cSrcweir 			}
1937cdf0e10cSrcweir 			i += 2;
1938cdf0e10cSrcweir 		}
1939cdf0e10cSrcweir 	}
1940cdf0e10cSrcweir }
1941cdf0e10cSrcweir 
1942cdf0e10cSrcweir // -----------------------------------------------------------------------
1943cdf0e10cSrcweir 
ImplDrawAutoHide(sal_Bool bInPaint)1944cdf0e10cSrcweir void SplitWindow::ImplDrawAutoHide( sal_Bool bInPaint )
1945cdf0e10cSrcweir {
1946cdf0e10cSrcweir 	if ( mbAutoHide )
1947cdf0e10cSrcweir 	{
1948cdf0e10cSrcweir 		Rectangle aTempRect;
1949cdf0e10cSrcweir 		ImplGetAutoHideRect( aTempRect );
1950cdf0e10cSrcweir 
1951cdf0e10cSrcweir 		if ( !bInPaint )
1952cdf0e10cSrcweir 			Erase( aTempRect );
1953cdf0e10cSrcweir 
1954cdf0e10cSrcweir 		// ImageListe laden, wenn noch nicht vorhanden
1955cdf0e10cSrcweir 		ImplSVData* pSVData = ImplGetSVData();
1956cdf0e10cSrcweir 		ImageList*	pImageList;
1957cdf0e10cSrcweir 		if ( mbHorz )
1958cdf0e10cSrcweir 		{
1959cdf0e10cSrcweir 			if ( !pSVData->maCtrlData.mpSplitHPinImgList )
1960cdf0e10cSrcweir 			{
196161648e64Smseidel 				ResMgr* pResMgr = ImplGetResMgr();
196261648e64Smseidel 				if( pResMgr )
1963cdf0e10cSrcweir 				{
1964cdf0e10cSrcweir 					Color aNonAlphaMask( 0x00, 0x00, 0xFF );
1965cdf0e10cSrcweir 					pSVData->maCtrlData.mpSplitHPinImgList = new ImageList(4);
1966cdf0e10cSrcweir 					pSVData->maCtrlData.mpSplitHPinImgList->InsertFromHorizontalBitmap
1967cdf0e10cSrcweir 						( ResId( SV_RESID_BITMAP_SPLITHPIN, *pResMgr ), 4, &aNonAlphaMask );
1968cdf0e10cSrcweir 				}
196961648e64Smseidel 			}
1970cdf0e10cSrcweir 			pImageList = pSVData->maCtrlData.mpSplitHPinImgList;
1971cdf0e10cSrcweir 		}
1972cdf0e10cSrcweir 		else
1973cdf0e10cSrcweir 		{
1974cdf0e10cSrcweir 			if ( !pSVData->maCtrlData.mpSplitVPinImgList )
1975cdf0e10cSrcweir 			{
197661648e64Smseidel 				ResMgr* pResMgr = ImplGetResMgr();
1977cdf0e10cSrcweir 				pSVData->maCtrlData.mpSplitVPinImgList = new ImageList(4);
197861648e64Smseidel 				if( pResMgr )
1979cdf0e10cSrcweir 				{
1980cdf0e10cSrcweir 					Color aNonAlphaMask( 0x00, 0x00, 0xFF );
1981cdf0e10cSrcweir 					pSVData->maCtrlData.mpSplitVPinImgList->InsertFromHorizontalBitmap
1982cdf0e10cSrcweir 						( ResId( SV_RESID_BITMAP_SPLITVPIN, *pResMgr ), 4, &aNonAlphaMask );
1983cdf0e10cSrcweir 				}
1984cdf0e10cSrcweir 			}
1985cdf0e10cSrcweir 			pImageList = pSVData->maCtrlData.mpSplitVPinImgList;
198661648e64Smseidel 		}
1987cdf0e10cSrcweir 
1988cdf0e10cSrcweir 		// Image ermitteln und zurueckgeben
1989cdf0e10cSrcweir 		sal_uInt16 nId;
1990cdf0e10cSrcweir 		if ( mbAutoHidePressed )
1991cdf0e10cSrcweir 		{
1992cdf0e10cSrcweir 			if ( mbAutoHideIn )
1993cdf0e10cSrcweir 				nId = 3;
1994cdf0e10cSrcweir 			else
1995cdf0e10cSrcweir 				nId = 4;
1996cdf0e10cSrcweir 		}
1997cdf0e10cSrcweir 		else
1998cdf0e10cSrcweir 		{
1999cdf0e10cSrcweir 			if ( mbAutoHideIn )
2000cdf0e10cSrcweir 				nId = 1;
2001cdf0e10cSrcweir 			else
2002cdf0e10cSrcweir 				nId = 2;
2003cdf0e10cSrcweir 		}
2004cdf0e10cSrcweir 
2005cdf0e10cSrcweir 		Image	aImage = pImageList->GetImage( nId );
2006cdf0e10cSrcweir 		Size	aImageSize = aImage.GetSizePixel();
2007cdf0e10cSrcweir 		Point	aPos( aTempRect.Left()+((aTempRect.GetWidth()-aImageSize.Width())/2),
2008cdf0e10cSrcweir 					  aTempRect.Top()+((aTempRect.GetHeight()-aImageSize.Height())/2) );
2009cdf0e10cSrcweir 		long	nSize;
2010cdf0e10cSrcweir 		if ( mbHorz )
2011cdf0e10cSrcweir 			nSize = aImageSize.Width();
2012cdf0e10cSrcweir 		else
2013cdf0e10cSrcweir 			nSize = aImageSize.Height();
2014cdf0e10cSrcweir 		ImplDrawButtonRect( aTempRect, nSize );
2015cdf0e10cSrcweir 		DrawImage( aPos, aImage );
2016cdf0e10cSrcweir 	}
2017cdf0e10cSrcweir }
2018cdf0e10cSrcweir 
2019cdf0e10cSrcweir // -----------------------------------------------------------------------
2020cdf0e10cSrcweir 
ImplDrawFadeArrow(const Point & rPt,sal_Bool bHorz,sal_Bool bLeft)2021cdf0e10cSrcweir void SplitWindow::ImplDrawFadeArrow( const Point& rPt, sal_Bool bHorz, sal_Bool bLeft )
2022cdf0e10cSrcweir {
202361648e64Smseidel 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
2024cdf0e10cSrcweir 
202561648e64Smseidel 	int x( rPt.X() );
202661648e64Smseidel 	int y( rPt.Y() );
2027cdf0e10cSrcweir 
2028cdf0e10cSrcweir     Color aCol;
2029cdf0e10cSrcweir     if( !bHorz )
2030cdf0e10cSrcweir     {
2031cdf0e10cSrcweir         int dx = 1;
2032cdf0e10cSrcweir         if( bLeft )
2033cdf0e10cSrcweir         {
2034*f1dd8134Smseidel             x = x+3;
2035cdf0e10cSrcweir             dx = -1;
2036cdf0e10cSrcweir         }
2037cdf0e10cSrcweir 
2038*f1dd8134Smseidel         x = x-1;
2039*f1dd8134Smseidel         aCol = rStyleSettings.GetDarkShadowColor();
2040cdf0e10cSrcweir         DrawPixel( Point(x, y), aCol );
2041*f1dd8134Smseidel         DrawPixel( Point(x, y+6), aCol );
2042cdf0e10cSrcweir         DrawPixel( Point(x+dx, y+1), aCol );
2043*f1dd8134Smseidel         DrawPixel( Point(x+dx, y+5), aCol );
2044*f1dd8134Smseidel         DrawPixel( Point(x+dx+dx, y+2), aCol );
2045*f1dd8134Smseidel         DrawPixel( Point(x+dx+dx, y+4), aCol );
2046*f1dd8134Smseidel         DrawPixel( Point(x+dx+dx+dx, y+3), aCol );
2047cdf0e10cSrcweir 
2048*f1dd8134Smseidel         aCol = rStyleSettings.GetShadowColor();
2049789f9e36Smseidel         DrawPixel( Point(x, y+1), aCol );
2050*f1dd8134Smseidel         DrawPixel( Point(x, y+5), aCol );
2051*f1dd8134Smseidel         DrawPixel( Point(x+dx, y+2), aCol );
2052*f1dd8134Smseidel         DrawPixel( Point(x+dx, y+4), aCol );
2053*f1dd8134Smseidel         DrawPixel( Point(x+dx+dx, y+3), aCol );
2054cdf0e10cSrcweir     }
2055cdf0e10cSrcweir     else
2056cdf0e10cSrcweir     {
2057cdf0e10cSrcweir         int dy = 1;
2058cdf0e10cSrcweir         if( bLeft )
2059cdf0e10cSrcweir         {
2060*f1dd8134Smseidel             y = y+3;
2061cdf0e10cSrcweir             dy = -1;
2062cdf0e10cSrcweir         }
2063cdf0e10cSrcweir 
2064*f1dd8134Smseidel         y = y-1;
2065*f1dd8134Smseidel         aCol = rStyleSettings.GetDarkShadowColor();
2066cdf0e10cSrcweir         DrawPixel( Point(x, y), aCol );
2067*f1dd8134Smseidel         DrawPixel( Point(x+6, y), aCol );
2068cdf0e10cSrcweir         DrawPixel( Point(x+1, y+dy), aCol );
2069*f1dd8134Smseidel         DrawPixel( Point(x+5, y+dy), aCol );
2070*f1dd8134Smseidel         DrawPixel( Point(x+2, y+dy+dy), aCol );
2071*f1dd8134Smseidel         DrawPixel( Point(x+4, y+dy+dy), aCol );
2072*f1dd8134Smseidel         DrawPixel( Point(x+3, y+dy+dy+dy), aCol );
2073cdf0e10cSrcweir 
2074*f1dd8134Smseidel         aCol = rStyleSettings.GetShadowColor();
2075cdf0e10cSrcweir         DrawPixel( Point(x+1, y), aCol );
2076*f1dd8134Smseidel         DrawPixel( Point(x+5, y), aCol );
2077*f1dd8134Smseidel         DrawPixel( Point(x+2, y+dy), aCol );
2078*f1dd8134Smseidel         DrawPixel( Point(x+4, y+dy), aCol );
2079*f1dd8134Smseidel         DrawPixel( Point(x+3, y+dy+dy), aCol );
2080cdf0e10cSrcweir     }
2081cdf0e10cSrcweir }
2082cdf0e10cSrcweir 
ImplDrawGrip(const Rectangle & rRect,sal_Bool bHorz,sal_Bool bLeft)2083cdf0e10cSrcweir void SplitWindow::ImplDrawGrip( const Rectangle& rRect, sal_Bool bHorz, sal_Bool bLeft )
2084cdf0e10cSrcweir {
2085cdf0e10cSrcweir     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
2086cdf0e10cSrcweir 
2087cdf0e10cSrcweir     if( rRect.IsInside( GetPointerPosPixel() ) )
2088cdf0e10cSrcweir     {
2089cdf0e10cSrcweir         DrawWallpaper( rRect, Wallpaper( Color( COL_WHITE ) ) );
2090cdf0e10cSrcweir         DrawSelectionBackground( rRect, 2, sal_False, sal_False, sal_False );
2091cdf0e10cSrcweir     }
2092cdf0e10cSrcweir 
2093cdf0e10cSrcweir     if( bHorz )
2094cdf0e10cSrcweir     {
2095cdf0e10cSrcweir         int width = (int) (0.5 * rRect.getWidth() + 0.5);
2096cdf0e10cSrcweir         int i = rRect.nLeft + (rRect.getWidth() - width) / 2;
2097cdf0e10cSrcweir         width += i;
2098cdf0e10cSrcweir         const int y = rRect.nTop + 1;
2099*f1dd8134Smseidel         ImplDrawFadeArrow( Point( i-9, y), bHorz, bLeft );
2100cdf0e10cSrcweir         while( i <= width )
2101cdf0e10cSrcweir         {
2102cdf0e10cSrcweir 
2103cdf0e10cSrcweir             DrawPixel( Point(i, y), rStyleSettings.GetDarkShadowColor() );
210461648e64Smseidel             DrawPixel( Point(i+1, y), rStyleSettings.GetDarkShadowColor() );
2105cdf0e10cSrcweir 
2106cdf0e10cSrcweir             DrawPixel( Point(i, y+1), rStyleSettings.GetShadowColor() );
2107e73de291Smseidel             DrawPixel( Point(i+1, y+1), rStyleSettings.GetShadowColor() );
2108cdf0e10cSrcweir             i+=4;
2109cdf0e10cSrcweir         }
2110*f1dd8134Smseidel         ImplDrawFadeArrow( Point( i, y), bHorz, bLeft );
2111cdf0e10cSrcweir     }
2112cdf0e10cSrcweir     else
2113cdf0e10cSrcweir     {
2114cdf0e10cSrcweir         int height = (int) (0.5 * rRect.getHeight() + 0.5);
2115cdf0e10cSrcweir         int i = rRect.nTop + (rRect.getHeight() - height) / 2;
2116cdf0e10cSrcweir         height += i;
2117cdf0e10cSrcweir         const int x = rRect.nLeft + 1;
2118*f1dd8134Smseidel         ImplDrawFadeArrow( Point( x, i-9), bHorz, bLeft );
2119cdf0e10cSrcweir         while( i <= height )
2120cdf0e10cSrcweir         {
2121cdf0e10cSrcweir 
2122cdf0e10cSrcweir             DrawPixel( Point(x, i), rStyleSettings.GetDarkShadowColor() );
212361648e64Smseidel             DrawPixel( Point(x+1, i), rStyleSettings.GetDarkShadowColor() );
2124cdf0e10cSrcweir 
2125cdf0e10cSrcweir             DrawPixel( Point(x, i+1), rStyleSettings.GetShadowColor() );
212661648e64Smseidel             DrawPixel( Point(x+1, i+1), rStyleSettings.GetShadowColor() );
2127cdf0e10cSrcweir             i+=4;
2128cdf0e10cSrcweir         }
2129*f1dd8134Smseidel         ImplDrawFadeArrow( Point( x, i), bHorz, bLeft );
2130cdf0e10cSrcweir     }
2131cdf0e10cSrcweir }
2132cdf0e10cSrcweir 
ImplDrawFadeIn(sal_Bool bInPaint)2133cdf0e10cSrcweir void SplitWindow::ImplDrawFadeIn( sal_Bool bInPaint )
2134cdf0e10cSrcweir {
2135cdf0e10cSrcweir 	if ( mbFadeIn )
2136cdf0e10cSrcweir 	{
2137cdf0e10cSrcweir 		Rectangle		aTempRect;
2138cdf0e10cSrcweir 		Image			aImage;
2139cdf0e10cSrcweir 		ImplGetFadeInRect( aTempRect );
2140cdf0e10cSrcweir 
2141cdf0e10cSrcweir 		sal_Bool bLeft;
2142cdf0e10cSrcweir 		if ( meAlign == WINDOWALIGN_TOP )
2143cdf0e10cSrcweir 			bLeft	= sal_False;
2144cdf0e10cSrcweir 		else if ( meAlign == WINDOWALIGN_BOTTOM )
2145cdf0e10cSrcweir 			bLeft	= sal_True;
2146cdf0e10cSrcweir 		else if ( meAlign == WINDOWALIGN_LEFT )
2147cdf0e10cSrcweir 			bLeft	= sal_False;
2148cdf0e10cSrcweir 		else if ( meAlign == WINDOWALIGN_RIGHT )
2149cdf0e10cSrcweir 			bLeft	= sal_True;
2150cdf0e10cSrcweir 		else
2151*f1dd8134Smseidel 			bLeft	= sal_True;
2152cdf0e10cSrcweir 
2153cdf0e10cSrcweir 		if ( !bInPaint )
2154cdf0e10cSrcweir 			Erase( aTempRect );
2155cdf0e10cSrcweir 
215661648e64Smseidel 		ImplDrawGrip( aTempRect, (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM), bLeft );
2157cdf0e10cSrcweir 	}
2158cdf0e10cSrcweir }
2159cdf0e10cSrcweir 
2160cdf0e10cSrcweir // -----------------------------------------------------------------------
2161cdf0e10cSrcweir 
ImplDrawFadeOut(sal_Bool bInPaint)2162cdf0e10cSrcweir void SplitWindow::ImplDrawFadeOut( sal_Bool bInPaint )
2163cdf0e10cSrcweir {
2164cdf0e10cSrcweir 	if ( mbFadeOut )
2165cdf0e10cSrcweir 	{
2166cdf0e10cSrcweir 		Rectangle		aTempRect;
2167cdf0e10cSrcweir 		Image			aImage;
2168cdf0e10cSrcweir 		ImplGetFadeOutRect( aTempRect );
2169cdf0e10cSrcweir 
2170cdf0e10cSrcweir 		sal_Bool bLeft;
2171cdf0e10cSrcweir 		if ( meAlign == WINDOWALIGN_TOP )
2172cdf0e10cSrcweir 			bLeft	= sal_True;
2173cdf0e10cSrcweir 		else if ( meAlign == WINDOWALIGN_BOTTOM )
2174cdf0e10cSrcweir 			bLeft	= sal_False;
2175cdf0e10cSrcweir 		else if ( meAlign == WINDOWALIGN_LEFT )
2176cdf0e10cSrcweir 			bLeft	= sal_True;
2177cdf0e10cSrcweir 		else if ( meAlign == WINDOWALIGN_RIGHT )
2178cdf0e10cSrcweir 			bLeft	= sal_False;
2179cdf0e10cSrcweir 		else
2180*f1dd8134Smseidel 			bLeft	= sal_True;
2181cdf0e10cSrcweir 
2182cdf0e10cSrcweir 		if ( !bInPaint )
2183cdf0e10cSrcweir 			Erase( aTempRect );
2184cdf0e10cSrcweir 
218561648e64Smseidel 		ImplDrawGrip( aTempRect, (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM), bLeft );
2186cdf0e10cSrcweir 	}
2187cdf0e10cSrcweir }
2188cdf0e10cSrcweir 
2189cdf0e10cSrcweir // -----------------------------------------------------------------------
ImplStartSplit(const MouseEvent & rMEvt)2190cdf0e10cSrcweir void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
2191cdf0e10cSrcweir {
219261648e64Smseidel 	Point aMousePosPixel = rMEvt.GetPosPixel();
219361648e64Smseidel 	mnSplitTest = ImplTestSplit( this, aMousePosPixel, mnMouseOff, &mpSplitSet, mnSplitPos );
2194cdf0e10cSrcweir 
219561648e64Smseidel 	if ( mnSplitTest && !(mnSplitTest & SPLIT_NOSPLIT) )
219661648e64Smseidel 	{
219761648e64Smseidel 		ImplSplitItem*	pSplitItem;
219861648e64Smseidel 		long			nCurMaxSize;
219961648e64Smseidel 		sal_uInt16			nTemp;
220061648e64Smseidel 		sal_Bool			bDown;
220161648e64Smseidel 		sal_Bool			bPropSmaller;
2202cdf0e10cSrcweir 
220361648e64Smseidel 		mnMouseModifier = rMEvt.GetModifier();
220461648e64Smseidel 		if ( !(mnMouseModifier & KEY_SHIFT) || (mnSplitPos+1 >= mpSplitSet->mnItems) )
220561648e64Smseidel 			bPropSmaller = sal_False;
220661648e64Smseidel 		else
220761648e64Smseidel 			bPropSmaller = sal_True;
220861648e64Smseidel 
220961648e64Smseidel 		// Hier kann noch die maximale Groesse gesetzt werden
221061648e64Smseidel 		StartSplit();
221161648e64Smseidel 
221261648e64Smseidel 		if ( mnMaxSize )
221361648e64Smseidel 			nCurMaxSize = mnMaxSize;
221461648e64Smseidel 		else
221561648e64Smseidel 		{
221661648e64Smseidel 			Size aSize = GetParent()->GetOutputSizePixel();
221761648e64Smseidel 			if ( mbHorz )
221861648e64Smseidel 				nCurMaxSize = aSize.Height();
221961648e64Smseidel 			else
222061648e64Smseidel 				nCurMaxSize = aSize.Width();
222161648e64Smseidel 		}
222261648e64Smseidel 
222361648e64Smseidel 		if ( mpSplitSet->mpItems )
222461648e64Smseidel 		{
222561648e64Smseidel 			bDown = sal_True;
222661648e64Smseidel 			if ( (mpSplitSet == mpMainSet) && mbBottomRight )
222761648e64Smseidel 				bDown = sal_False;
2228cdf0e10cSrcweir 
2229cdf0e10cSrcweir             pSplitItem			= &(mpSplitSet->mpItems[mnSplitPos]);
2230cdf0e10cSrcweir             maDragRect.Left()	= pSplitItem->mnLeft;
2231cdf0e10cSrcweir             maDragRect.Top()	= pSplitItem->mnTop;
2232cdf0e10cSrcweir             maDragRect.Right()	= pSplitItem->mnLeft+pSplitItem->mnWidth-1;
2233cdf0e10cSrcweir             maDragRect.Bottom() = pSplitItem->mnTop+pSplitItem->mnHeight-1;
2234cdf0e10cSrcweir 
2235cdf0e10cSrcweir             if ( mnSplitTest & SPLIT_HORZ )
2236cdf0e10cSrcweir             {
2237cdf0e10cSrcweir                 if ( bDown )
2238cdf0e10cSrcweir                     maDragRect.Right() += mpSplitSet->mnSplitSize;
2239cdf0e10cSrcweir                 else
2240cdf0e10cSrcweir                     maDragRect.Left() -= mpSplitSet->mnSplitSize;
2241cdf0e10cSrcweir             }
2242cdf0e10cSrcweir             else
2243cdf0e10cSrcweir             {
2244cdf0e10cSrcweir                 if ( bDown )
2245cdf0e10cSrcweir                     maDragRect.Bottom() += mpSplitSet->mnSplitSize;
2246cdf0e10cSrcweir                 else
2247cdf0e10cSrcweir                     maDragRect.Top() -= mpSplitSet->mnSplitSize;
2248cdf0e10cSrcweir             }
2249cdf0e10cSrcweir 
2250cdf0e10cSrcweir             if ( mnSplitPos )
2251cdf0e10cSrcweir             {
2252cdf0e10cSrcweir                 nTemp = mnSplitPos;
2253cdf0e10cSrcweir                 while ( nTemp )
2254cdf0e10cSrcweir                 {
2255cdf0e10cSrcweir                     pSplitItem = &(mpSplitSet->mpItems[nTemp-1]);
2256cdf0e10cSrcweir                     if ( pSplitItem->mbFixed )
2257cdf0e10cSrcweir                         break;
2258cdf0e10cSrcweir                     else
2259cdf0e10cSrcweir                     {
2260cdf0e10cSrcweir                         if ( mnSplitTest & SPLIT_HORZ )
2261cdf0e10cSrcweir                         {
2262cdf0e10cSrcweir                             if ( bDown )
2263cdf0e10cSrcweir                                 maDragRect.Left() -= pSplitItem->mnPixSize;
2264cdf0e10cSrcweir                             else
2265cdf0e10cSrcweir                                 maDragRect.Right() += pSplitItem->mnPixSize;
2266cdf0e10cSrcweir                         }
2267cdf0e10cSrcweir                         else
2268cdf0e10cSrcweir                         {
2269cdf0e10cSrcweir                             if ( bDown )
2270cdf0e10cSrcweir                                 maDragRect.Top() -= pSplitItem->mnPixSize;
2271cdf0e10cSrcweir                             else
2272cdf0e10cSrcweir                                 maDragRect.Bottom() += pSplitItem->mnPixSize;
2273cdf0e10cSrcweir                         }
2274cdf0e10cSrcweir                     }
2275cdf0e10cSrcweir                     nTemp--;
2276cdf0e10cSrcweir                 }
2277cdf0e10cSrcweir             }
2278cdf0e10cSrcweir 
2279cdf0e10cSrcweir             if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
2280cdf0e10cSrcweir             {
2281cdf0e10cSrcweir                 if ( bDown )
2282cdf0e10cSrcweir                 {
2283cdf0e10cSrcweir                     if ( mbHorz )
2284cdf0e10cSrcweir                         maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
2285cdf0e10cSrcweir                     else
2286cdf0e10cSrcweir                         maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
2287cdf0e10cSrcweir                 }
2288cdf0e10cSrcweir                 else
2289cdf0e10cSrcweir                 {
2290cdf0e10cSrcweir                     if ( mbHorz )
2291cdf0e10cSrcweir                         maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
2292cdf0e10cSrcweir                     else
2293cdf0e10cSrcweir                         maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
2294cdf0e10cSrcweir                 }
2295cdf0e10cSrcweir             }
2296cdf0e10cSrcweir             else
2297cdf0e10cSrcweir             {
2298cdf0e10cSrcweir                 nTemp = mnSplitPos+1;
2299cdf0e10cSrcweir                 while ( nTemp < mpSplitSet->mnItems )
2300cdf0e10cSrcweir                 {
2301cdf0e10cSrcweir                     pSplitItem = &(mpSplitSet->mpItems[nTemp]);
2302cdf0e10cSrcweir                     if ( pSplitItem->mbFixed )
2303cdf0e10cSrcweir                         break;
2304cdf0e10cSrcweir                     else
2305cdf0e10cSrcweir                     {
2306cdf0e10cSrcweir                         if ( mnSplitTest & SPLIT_HORZ )
2307cdf0e10cSrcweir                         {
2308cdf0e10cSrcweir                             if ( bDown )
2309cdf0e10cSrcweir                                 maDragRect.Right() += pSplitItem->mnPixSize;
2310cdf0e10cSrcweir                             else
2311cdf0e10cSrcweir                                 maDragRect.Left() -= pSplitItem->mnPixSize;
2312cdf0e10cSrcweir                         }
2313cdf0e10cSrcweir                         else
2314cdf0e10cSrcweir                         {
2315cdf0e10cSrcweir                             if ( bDown )
2316cdf0e10cSrcweir                                 maDragRect.Bottom() += pSplitItem->mnPixSize;
2317cdf0e10cSrcweir                             else
2318cdf0e10cSrcweir                                 maDragRect.Top() -= pSplitItem->mnPixSize;
2319cdf0e10cSrcweir                         }
2320cdf0e10cSrcweir                     }
2321cdf0e10cSrcweir                     nTemp++;
2322cdf0e10cSrcweir                 }
2323cdf0e10cSrcweir             }
232461648e64Smseidel 		}
232561648e64Smseidel 		else
232661648e64Smseidel 		{
2327cdf0e10cSrcweir             maDragRect.Left()	= mnLeftBorder;
2328cdf0e10cSrcweir             maDragRect.Top()	= mnTopBorder;
2329cdf0e10cSrcweir             maDragRect.Right()	= mnDX-mnRightBorder-1;
2330cdf0e10cSrcweir             maDragRect.Bottom() = mnDY-mnBottomBorder-1;
2331cdf0e10cSrcweir             if ( mbHorz )
2332cdf0e10cSrcweir             {
2333cdf0e10cSrcweir                 if ( mbBottomRight )
2334cdf0e10cSrcweir                     maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
2335cdf0e10cSrcweir                 else
2336cdf0e10cSrcweir                     maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
2337cdf0e10cSrcweir             }
2338cdf0e10cSrcweir             else
2339cdf0e10cSrcweir             {
2340cdf0e10cSrcweir                 if ( mbBottomRight )
2341cdf0e10cSrcweir                     maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
2342cdf0e10cSrcweir                 else
2343cdf0e10cSrcweir                     maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
2344cdf0e10cSrcweir             }
234561648e64Smseidel 		}
2346cdf0e10cSrcweir 
234761648e64Smseidel 		StartTracking();
2348cdf0e10cSrcweir 
234961648e64Smseidel 		mbDragFull = (GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SPLIT) != 0;
2350cdf0e10cSrcweir 
235161648e64Smseidel 		ImplSplitMousePos( aMousePosPixel );
2352cdf0e10cSrcweir 
235361648e64Smseidel 		if ( !mbDragFull )
235461648e64Smseidel 			ImplDrawSplitTracking( this, aMousePosPixel );
235561648e64Smseidel 		else
235661648e64Smseidel 		{
235761648e64Smseidel 			ImplSplitItem*	pItems = mpSplitSet->mpItems;
235861648e64Smseidel 			sal_uInt16			nItems = mpSplitSet->mnItems;
235961648e64Smseidel 			mpLastSizes = new long[nItems*2];
236061648e64Smseidel 			for ( sal_uInt16 i = 0; i < nItems; i++ )
236161648e64Smseidel 			{
236261648e64Smseidel 				mpLastSizes[i*2]   = pItems[i].mnSize;
236361648e64Smseidel 				mpLastSizes[i*2+1] = pItems[i].mnPixSize;
236461648e64Smseidel 			}
236561648e64Smseidel 		}
236661648e64Smseidel 		mnMStartPos = mnMSplitPos;
2367cdf0e10cSrcweir 
2368cdf0e10cSrcweir 		PointerStyle eStyle = POINTER_ARROW;
236961648e64Smseidel 		if ( mnSplitTest & SPLIT_HORZ )
237061648e64Smseidel 			eStyle = POINTER_HSPLIT;
237161648e64Smseidel 		else if ( mnSplitTest & SPLIT_VERT )
237261648e64Smseidel 			eStyle = POINTER_VSPLIT;
2373cdf0e10cSrcweir 
2374cdf0e10cSrcweir 		Pointer aPtr( eStyle );
2375cdf0e10cSrcweir 		SetPointer( aPtr );
237661648e64Smseidel 	}
2377cdf0e10cSrcweir }
2378cdf0e10cSrcweir 
2379cdf0e10cSrcweir 
2380cdf0e10cSrcweir // -----------------------------------------------------------------------
2381cdf0e10cSrcweir 
StartSplit()2382cdf0e10cSrcweir void SplitWindow::StartSplit()
2383cdf0e10cSrcweir {
2384cdf0e10cSrcweir 	maStartSplitHdl.Call( this );
2385cdf0e10cSrcweir }
2386cdf0e10cSrcweir 
2387cdf0e10cSrcweir // -----------------------------------------------------------------------
2388cdf0e10cSrcweir 
Split()2389cdf0e10cSrcweir void SplitWindow::Split()
2390cdf0e10cSrcweir {
2391cdf0e10cSrcweir 	maSplitHdl.Call( this );
2392cdf0e10cSrcweir }
2393cdf0e10cSrcweir 
2394cdf0e10cSrcweir // -----------------------------------------------------------------------
2395cdf0e10cSrcweir 
SplitResize()2396cdf0e10cSrcweir void SplitWindow::SplitResize()
2397cdf0e10cSrcweir {
2398cdf0e10cSrcweir 	maSplitResizeHdl.Call( this );
2399cdf0e10cSrcweir }
2400cdf0e10cSrcweir 
2401cdf0e10cSrcweir // -----------------------------------------------------------------------
2402cdf0e10cSrcweir 
AutoHide()2403cdf0e10cSrcweir void SplitWindow::AutoHide()
2404cdf0e10cSrcweir {
2405cdf0e10cSrcweir 	maAutoHideHdl.Call( this );
2406cdf0e10cSrcweir }
2407cdf0e10cSrcweir 
2408cdf0e10cSrcweir // -----------------------------------------------------------------------
2409cdf0e10cSrcweir 
FadeIn()2410cdf0e10cSrcweir void SplitWindow::FadeIn()
2411cdf0e10cSrcweir {
2412cdf0e10cSrcweir 	maFadeInHdl.Call( this );
2413cdf0e10cSrcweir }
2414cdf0e10cSrcweir 
2415cdf0e10cSrcweir // -----------------------------------------------------------------------
2416cdf0e10cSrcweir 
FadeOut()2417cdf0e10cSrcweir void SplitWindow::FadeOut()
2418cdf0e10cSrcweir {
2419cdf0e10cSrcweir 	maFadeOutHdl.Call( this );
2420cdf0e10cSrcweir }
2421cdf0e10cSrcweir 
2422cdf0e10cSrcweir // -----------------------------------------------------------------------
2423cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)2424cdf0e10cSrcweir void SplitWindow::MouseButtonDown( const MouseEvent& rMEvt )
2425cdf0e10cSrcweir {
2426cdf0e10cSrcweir 	if ( !rMEvt.IsLeft() || rMEvt.IsMod2() )
2427cdf0e10cSrcweir 	{
2428cdf0e10cSrcweir 		DockingWindow::MouseButtonDown( rMEvt );
2429cdf0e10cSrcweir 		return;
2430cdf0e10cSrcweir 	}
2431cdf0e10cSrcweir 
2432cdf0e10cSrcweir 	Point			aMousePosPixel = rMEvt.GetPosPixel();
2433cdf0e10cSrcweir 	Rectangle		aTestRect;
2434cdf0e10cSrcweir 
2435cdf0e10cSrcweir 	mbFadeNoButtonMode = sal_False;
2436cdf0e10cSrcweir 	ImplGetAutoHideRect( aTestRect, sal_True );
2437cdf0e10cSrcweir 	if ( aTestRect.IsInside( aMousePosPixel ) )
2438cdf0e10cSrcweir 	{
2439cdf0e10cSrcweir 		mbAutoHideDown = sal_True;
2440cdf0e10cSrcweir 		mbAutoHidePressed = sal_True;
2441cdf0e10cSrcweir 		ImplDrawAutoHide( sal_False );
2442cdf0e10cSrcweir 	}
2443cdf0e10cSrcweir 	else
2444cdf0e10cSrcweir 	{
2445cdf0e10cSrcweir 		ImplGetFadeOutRect( aTestRect, sal_True );
2446cdf0e10cSrcweir 		if ( aTestRect.IsInside( aMousePosPixel ) )
2447cdf0e10cSrcweir 		{
2448cdf0e10cSrcweir 			mbFadeOutDown = sal_True;
2449cdf0e10cSrcweir 			mbFadeOutPressed = sal_True;
2450cdf0e10cSrcweir 			ImplDrawFadeOut( sal_False );
2451cdf0e10cSrcweir 		}
2452cdf0e10cSrcweir 		else
2453cdf0e10cSrcweir 		{
2454cdf0e10cSrcweir 			ImplGetFadeInRect( aTestRect, sal_True );
2455cdf0e10cSrcweir 			if ( aTestRect.IsInside( aMousePosPixel ) )
2456cdf0e10cSrcweir 			{
2457cdf0e10cSrcweir 				mbFadeInDown = sal_True;
2458cdf0e10cSrcweir 				mbFadeInPressed = sal_True;
2459cdf0e10cSrcweir 				ImplDrawFadeIn( sal_False );
2460cdf0e10cSrcweir 			}
2461cdf0e10cSrcweir 			else if ( !aTestRect.IsEmpty() && !(mnWinStyle & WB_SIZEABLE) )
2462cdf0e10cSrcweir 			{
2463cdf0e10cSrcweir 				mbFadeNoButtonMode = sal_True;
2464cdf0e10cSrcweir 				FadeIn();
2465cdf0e10cSrcweir 				return;
2466cdf0e10cSrcweir 			}
2467cdf0e10cSrcweir 		}
2468cdf0e10cSrcweir 	}
2469cdf0e10cSrcweir 
2470cdf0e10cSrcweir 	if ( mbAutoHideDown || mbFadeInDown || mbFadeOutDown )
2471cdf0e10cSrcweir 		StartTracking();
2472cdf0e10cSrcweir 	else
247361648e64Smseidel 		ImplStartSplit( rMEvt );
2474cdf0e10cSrcweir }
2475cdf0e10cSrcweir 
2476cdf0e10cSrcweir // -----------------------------------------------------------------------
2477cdf0e10cSrcweir 
MouseMove(const MouseEvent & rMEvt)2478cdf0e10cSrcweir void SplitWindow::MouseMove( const MouseEvent& rMEvt )
2479cdf0e10cSrcweir {
2480cdf0e10cSrcweir 	if ( !IsTracking() )
2481cdf0e10cSrcweir 	{
2482cdf0e10cSrcweir 		Point			aPos = rMEvt.GetPosPixel();
2483cdf0e10cSrcweir 		long			nTemp;
2484cdf0e10cSrcweir 		ImplSplitSet*	pTempSplitSet;
2485cdf0e10cSrcweir 		sal_uInt16			nTempSplitPos;
2486cdf0e10cSrcweir 		sal_uInt16			nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos );
2487cdf0e10cSrcweir 		PointerStyle	eStyle = POINTER_ARROW;
2488cdf0e10cSrcweir 		Rectangle		aAutoHideRect;
2489cdf0e10cSrcweir 		Rectangle		aFadeInRect;
2490cdf0e10cSrcweir 		Rectangle		aFadeOutRect;
2491cdf0e10cSrcweir 
2492cdf0e10cSrcweir 		ImplGetAutoHideRect( aAutoHideRect );
2493cdf0e10cSrcweir 		ImplGetFadeInRect( aFadeInRect );
2494cdf0e10cSrcweir 		ImplGetFadeOutRect( aFadeOutRect );
2495cdf0e10cSrcweir 		if ( !aAutoHideRect.IsInside( aPos ) &&
2496cdf0e10cSrcweir 			 !aFadeInRect.IsInside( aPos ) &&
2497cdf0e10cSrcweir 			 !aFadeOutRect.IsInside( aPos ) )
2498cdf0e10cSrcweir 		{
2499cdf0e10cSrcweir 			if ( nSplitTest && !(nSplitTest & SPLIT_NOSPLIT) )
2500cdf0e10cSrcweir 			{
2501cdf0e10cSrcweir 				if ( nSplitTest & SPLIT_HORZ )
2502cdf0e10cSrcweir 					eStyle = POINTER_HSPLIT;
2503cdf0e10cSrcweir 				else if ( nSplitTest & SPLIT_VERT )
2504cdf0e10cSrcweir 					eStyle = POINTER_VSPLIT;
2505cdf0e10cSrcweir 			}
2506cdf0e10cSrcweir 		}
2507cdf0e10cSrcweir 
2508cdf0e10cSrcweir 		Pointer aPtr( eStyle );
2509cdf0e10cSrcweir 		SetPointer( aPtr );
2510cdf0e10cSrcweir 	}
2511cdf0e10cSrcweir }
2512cdf0e10cSrcweir 
2513cdf0e10cSrcweir // -----------------------------------------------------------------------
2514cdf0e10cSrcweir 
Tracking(const TrackingEvent & rTEvt)2515cdf0e10cSrcweir void SplitWindow::Tracking( const TrackingEvent& rTEvt )
2516cdf0e10cSrcweir {
2517cdf0e10cSrcweir 	Point aMousePosPixel = rTEvt.GetMouseEvent().GetPosPixel();
2518cdf0e10cSrcweir 
2519cdf0e10cSrcweir 	if ( mbAutoHideDown )
2520cdf0e10cSrcweir 	{
2521cdf0e10cSrcweir 		if ( rTEvt.IsTrackingEnded() )
2522cdf0e10cSrcweir 		{
2523cdf0e10cSrcweir 			mbAutoHideDown = sal_False;
2524cdf0e10cSrcweir 			if ( mbAutoHidePressed )
2525cdf0e10cSrcweir 			{
2526cdf0e10cSrcweir 				mbAutoHidePressed = sal_False;
2527cdf0e10cSrcweir 
2528cdf0e10cSrcweir 				if ( !rTEvt.IsTrackingCanceled() )
2529cdf0e10cSrcweir 				{
2530cdf0e10cSrcweir 					mbAutoHideIn = !mbAutoHideIn;
2531cdf0e10cSrcweir 					ImplDrawAutoHide( sal_False );
2532cdf0e10cSrcweir 					AutoHide();
2533cdf0e10cSrcweir 				}
2534cdf0e10cSrcweir 				else
2535cdf0e10cSrcweir 					ImplDrawAutoHide( sal_False );
2536cdf0e10cSrcweir 			}
2537cdf0e10cSrcweir 		}
2538cdf0e10cSrcweir 		else
2539cdf0e10cSrcweir 		{
2540cdf0e10cSrcweir 			Rectangle aTestRect;
2541cdf0e10cSrcweir 			ImplGetAutoHideRect( aTestRect, sal_True );
2542cdf0e10cSrcweir 			sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel );
2543cdf0e10cSrcweir 			if ( bNewPressed != mbAutoHidePressed )
2544cdf0e10cSrcweir 			{
2545cdf0e10cSrcweir 				mbAutoHidePressed = bNewPressed;
2546cdf0e10cSrcweir 				ImplDrawAutoHide( sal_False );
2547cdf0e10cSrcweir 			}
2548cdf0e10cSrcweir 		}
2549cdf0e10cSrcweir 	}
2550cdf0e10cSrcweir 	else if ( mbFadeInDown )
2551cdf0e10cSrcweir 	{
2552cdf0e10cSrcweir 		if ( rTEvt.IsTrackingEnded() )
2553cdf0e10cSrcweir 		{
2554cdf0e10cSrcweir 			mbFadeInDown = sal_False;
2555cdf0e10cSrcweir 			if ( mbFadeInPressed )
2556cdf0e10cSrcweir 			{
2557cdf0e10cSrcweir 				mbFadeInPressed = sal_False;
2558cdf0e10cSrcweir 				ImplDrawFadeIn( sal_False );
2559cdf0e10cSrcweir 
2560cdf0e10cSrcweir 				if ( !rTEvt.IsTrackingCanceled() )
2561cdf0e10cSrcweir 					FadeIn();
2562cdf0e10cSrcweir 			}
2563cdf0e10cSrcweir 		}
2564cdf0e10cSrcweir 		else
2565cdf0e10cSrcweir 		{
2566cdf0e10cSrcweir 			Rectangle aTestRect;
2567cdf0e10cSrcweir 			ImplGetFadeInRect( aTestRect, sal_True );
2568cdf0e10cSrcweir 			sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel );
2569cdf0e10cSrcweir 			if ( bNewPressed != mbFadeInPressed )
2570cdf0e10cSrcweir 			{
2571cdf0e10cSrcweir 				mbFadeInPressed = bNewPressed;
2572cdf0e10cSrcweir 				ImplDrawFadeIn( sal_False );
2573cdf0e10cSrcweir 			}
2574cdf0e10cSrcweir 		}
2575cdf0e10cSrcweir 	}
2576cdf0e10cSrcweir 	else if ( mbFadeOutDown )
2577cdf0e10cSrcweir 	{
2578cdf0e10cSrcweir 		if ( rTEvt.IsTrackingEnded() )
2579cdf0e10cSrcweir 		{
2580cdf0e10cSrcweir 			mbFadeOutDown = sal_False;
2581cdf0e10cSrcweir 			if ( mbFadeOutPressed )
2582cdf0e10cSrcweir 			{
2583cdf0e10cSrcweir 				mbFadeOutPressed = sal_False;
2584cdf0e10cSrcweir 				ImplDrawFadeOut( sal_False );
2585cdf0e10cSrcweir 
2586cdf0e10cSrcweir 				if ( !rTEvt.IsTrackingCanceled() )
2587cdf0e10cSrcweir 					FadeOut();
2588cdf0e10cSrcweir 			}
2589cdf0e10cSrcweir 		}
2590cdf0e10cSrcweir 		else
2591cdf0e10cSrcweir 		{
2592cdf0e10cSrcweir 			Rectangle aTestRect;
2593cdf0e10cSrcweir 			ImplGetFadeOutRect( aTestRect, sal_True );
2594cdf0e10cSrcweir 			sal_Bool bNewPressed = aTestRect.IsInside( aMousePosPixel );
2595cdf0e10cSrcweir 			if ( bNewPressed == sal_False )
2596cdf0e10cSrcweir 			{
2597cdf0e10cSrcweir 				mbFadeOutPressed = bNewPressed;
2598cdf0e10cSrcweir 				ImplDrawFadeOut( sal_False );
2599cdf0e10cSrcweir 
2600cdf0e10cSrcweir                 // We need a mouseevent with a position inside the button for the
2601cdf0e10cSrcweir                 // ImplStartSplit function!
2602cdf0e10cSrcweir                 MouseEvent aOrgMEvt = rTEvt.GetMouseEvent();
2603cdf0e10cSrcweir                 MouseEvent aNewMEvt = MouseEvent( aTestRect.Center(), aOrgMEvt.GetClicks(),
2604cdf0e10cSrcweir                                                   aOrgMEvt.GetMode(), aOrgMEvt.GetButtons(),
2605cdf0e10cSrcweir                                                   aOrgMEvt.GetModifier() );
2606cdf0e10cSrcweir 
2607cdf0e10cSrcweir                 ImplStartSplit( aNewMEvt );
2608cdf0e10cSrcweir                 mbFadeOutDown = sal_False;
2609cdf0e10cSrcweir 			}
2610cdf0e10cSrcweir 		}
2611cdf0e10cSrcweir 	}
2612cdf0e10cSrcweir 	else
2613cdf0e10cSrcweir 	{
2614cdf0e10cSrcweir 		ImplSplitMousePos( aMousePosPixel );
2615cdf0e10cSrcweir 		sal_Bool bSplit = sal_True;
2616cdf0e10cSrcweir 		if ( mbDragFull )
2617cdf0e10cSrcweir 		{
2618cdf0e10cSrcweir 			if ( rTEvt.IsTrackingEnded() )
2619cdf0e10cSrcweir 			{
2620cdf0e10cSrcweir 				if ( rTEvt.IsTrackingCanceled() )
2621cdf0e10cSrcweir 				{
2622cdf0e10cSrcweir 					ImplSplitItem*	pItems = mpSplitSet->mpItems;
2623cdf0e10cSrcweir 					sal_uInt16			nItems = mpSplitSet->mnItems;
2624cdf0e10cSrcweir 					for ( sal_uInt16 i = 0; i < nItems; i++ )
2625cdf0e10cSrcweir 					{
2626cdf0e10cSrcweir 						pItems[i].mnSize	 = mpLastSizes[i*2];
2627cdf0e10cSrcweir 						pItems[i].mnPixSize  = mpLastSizes[i*2+1];
2628cdf0e10cSrcweir 					}
2629cdf0e10cSrcweir 					ImplUpdate();
2630cdf0e10cSrcweir 					Split();
2631cdf0e10cSrcweir 				}
2632cdf0e10cSrcweir 				bSplit = sal_False;
2633cdf0e10cSrcweir 			}
2634cdf0e10cSrcweir 		}
2635cdf0e10cSrcweir 		else
2636cdf0e10cSrcweir 		{
2637cdf0e10cSrcweir 			if ( rTEvt.IsTrackingEnded() )
2638cdf0e10cSrcweir 			{
2639cdf0e10cSrcweir 				HideTracking();
2640cdf0e10cSrcweir 				bSplit = !rTEvt.IsTrackingCanceled();
2641cdf0e10cSrcweir 			}
2642cdf0e10cSrcweir 			else
2643cdf0e10cSrcweir 			{
2644cdf0e10cSrcweir 				ImplDrawSplitTracking( this, aMousePosPixel );
2645cdf0e10cSrcweir 				bSplit = sal_False;
2646cdf0e10cSrcweir 			}
2647cdf0e10cSrcweir 		}
2648cdf0e10cSrcweir 
2649cdf0e10cSrcweir 		if ( bSplit )
2650cdf0e10cSrcweir 		{
2651cdf0e10cSrcweir 			sal_Bool	bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? sal_True : sal_False;
2652cdf0e10cSrcweir 			sal_Bool	bPropGreater = (mnMouseModifier & KEY_MOD1) ? sal_True : sal_False;
2653cdf0e10cSrcweir 			long	nDelta = mnMSplitPos-mnMStartPos;
2654cdf0e10cSrcweir 
2655cdf0e10cSrcweir 			if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
2656cdf0e10cSrcweir 			{
2657cdf0e10cSrcweir 				if ( (mpSplitSet == mpMainSet) && mbBottomRight )
2658cdf0e10cSrcweir 					nDelta *= -1;
2659cdf0e10cSrcweir 				ImplSetWindowSize( nDelta );
2660cdf0e10cSrcweir 			}
2661cdf0e10cSrcweir 			else
2662cdf0e10cSrcweir 			{
2663cdf0e10cSrcweir 				long nNewSize = mpSplitSet->mpItems[mnSplitPos].mnPixSize;
2664cdf0e10cSrcweir 				if ( (mpSplitSet == mpMainSet) && mbBottomRight )
2665cdf0e10cSrcweir 					nNewSize -= nDelta;
2666cdf0e10cSrcweir 				else
2667cdf0e10cSrcweir 					nNewSize += nDelta;
2668cdf0e10cSrcweir 				SplitItem( mpSplitSet->mpItems[mnSplitPos].mnId, nNewSize,
2669cdf0e10cSrcweir 						   bPropSmaller, bPropGreater );
2670cdf0e10cSrcweir 			}
2671cdf0e10cSrcweir 
2672cdf0e10cSrcweir 			Split();
2673cdf0e10cSrcweir 
2674cdf0e10cSrcweir 			if ( mbDragFull )
2675cdf0e10cSrcweir 			{
2676cdf0e10cSrcweir 				Update();
2677cdf0e10cSrcweir 				mnMStartPos = mnMSplitPos;
2678cdf0e10cSrcweir 			}
2679cdf0e10cSrcweir 		}
2680cdf0e10cSrcweir 
2681cdf0e10cSrcweir 		if ( rTEvt.IsTrackingEnded() )
2682cdf0e10cSrcweir 		{
2683cdf0e10cSrcweir 			if ( mpLastSizes )
2684cdf0e10cSrcweir 				delete mpLastSizes;
2685cdf0e10cSrcweir 			mpLastSizes 	= NULL;
2686cdf0e10cSrcweir 			mpSplitSet		= NULL;
2687cdf0e10cSrcweir 			mnMouseOff		= 0;
2688cdf0e10cSrcweir 			mnMStartPos 	= 0;
2689cdf0e10cSrcweir 			mnMSplitPos 	= 0;
2690cdf0e10cSrcweir 			mnMouseModifier = 0;
2691cdf0e10cSrcweir 			mnSplitTest 	= 0;
2692cdf0e10cSrcweir 			mnSplitPos		= 0;
2693cdf0e10cSrcweir 		}
2694cdf0e10cSrcweir 	}
2695cdf0e10cSrcweir }
2696cdf0e10cSrcweir 
2697cdf0e10cSrcweir // -----------------------------------------------------------------------
2698cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)2699cdf0e10cSrcweir long SplitWindow::PreNotify( NotifyEvent& rNEvt )
2700cdf0e10cSrcweir {
270161648e64Smseidel 	const MouseEvent* pMouseEvt = NULL;
2702cdf0e10cSrcweir 
2703cdf0e10cSrcweir     if( (rNEvt.GetType() == EVENT_MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL )
2704cdf0e10cSrcweir     {
2705cdf0e10cSrcweir         if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() )
2706cdf0e10cSrcweir         {
2707cdf0e10cSrcweir             // trigger redraw if mouse over state has changed
2708cdf0e10cSrcweir             Rectangle aFadeInRect;
2709cdf0e10cSrcweir             Rectangle aFadeOutRect;
2710cdf0e10cSrcweir 		    ImplGetFadeInRect( aFadeInRect );
2711cdf0e10cSrcweir 		    ImplGetFadeOutRect( aFadeOutRect );
2712789f9e36Smseidel 
2713cdf0e10cSrcweir 		    if ( aFadeInRect.IsInside( GetPointerPosPixel() ) != aFadeInRect.IsInside( GetLastPointerPosPixel() ) )
2714cdf0e10cSrcweir                 Invalidate( aFadeInRect );
2715cdf0e10cSrcweir 		    if ( aFadeOutRect.IsInside( GetPointerPosPixel() ) != aFadeOutRect.IsInside( GetLastPointerPosPixel() ) )
2716cdf0e10cSrcweir                 Invalidate( aFadeOutRect );
2717cdf0e10cSrcweir 
2718cdf0e10cSrcweir             if( pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() )
2719cdf0e10cSrcweir             {
2720cdf0e10cSrcweir                 Invalidate( aFadeInRect );
2721cdf0e10cSrcweir                 Invalidate( aFadeOutRect );
2722cdf0e10cSrcweir             }
2723cdf0e10cSrcweir         }
2724cdf0e10cSrcweir     }
2725cdf0e10cSrcweir     return Window::PreNotify( rNEvt );
2726cdf0e10cSrcweir }
2727cdf0e10cSrcweir 
2728cdf0e10cSrcweir // -----------------------------------------------------------------------
2729cdf0e10cSrcweir 
Paint(const Rectangle &)2730cdf0e10cSrcweir void SplitWindow::Paint( const Rectangle& )
2731cdf0e10cSrcweir {
2732cdf0e10cSrcweir 	if ( mnWinStyle & WB_BORDER )
2733cdf0e10cSrcweir 		ImplDrawBorder( this );
2734cdf0e10cSrcweir 
2735cdf0e10cSrcweir 	ImplDrawBorderLine( this );
273661648e64Smseidel 	ImplDrawFadeOut( sal_True );
2737cdf0e10cSrcweir 	ImplDrawFadeIn( sal_True );
2738cdf0e10cSrcweir 	ImplDrawAutoHide( sal_True );
2739cdf0e10cSrcweir 
2740cdf0e10cSrcweir 	// FrameSet-Hintergruende zeichnen
2741cdf0e10cSrcweir 	ImplDrawBack( this, mpMainSet );
2742cdf0e10cSrcweir 
2743cdf0e10cSrcweir 	// Splitter zeichnen
2744cdf0e10cSrcweir 	if ( !(mnWinStyle & WB_NOSPLITDRAW) )
2745cdf0e10cSrcweir 		ImplDrawSplit( this, mpMainSet, mbHorz, !mbBottomRight );
2746cdf0e10cSrcweir }
2747cdf0e10cSrcweir 
2748cdf0e10cSrcweir // -----------------------------------------------------------------------
2749cdf0e10cSrcweir 
Move()2750cdf0e10cSrcweir void SplitWindow::Move()
2751cdf0e10cSrcweir {
2752cdf0e10cSrcweir 	DockingWindow::Move();
2753cdf0e10cSrcweir }
2754cdf0e10cSrcweir 
2755cdf0e10cSrcweir // -----------------------------------------------------------------------
2756cdf0e10cSrcweir 
Resize()2757cdf0e10cSrcweir void SplitWindow::Resize()
2758cdf0e10cSrcweir {
2759cdf0e10cSrcweir 	Size aSize = GetOutputSizePixel();
2760cdf0e10cSrcweir 	mnDX = aSize.Width();
2761cdf0e10cSrcweir 	mnDY = aSize.Height();
2762cdf0e10cSrcweir 
2763cdf0e10cSrcweir 	ImplUpdate();
2764cdf0e10cSrcweir 	Invalidate();
2765cdf0e10cSrcweir }
2766cdf0e10cSrcweir 
2767cdf0e10cSrcweir // -----------------------------------------------------------------------
2768cdf0e10cSrcweir 
RequestHelp(const HelpEvent & rHEvt)2769cdf0e10cSrcweir void SplitWindow::RequestHelp( const HelpEvent& rHEvt )
2770cdf0e10cSrcweir {
2771cdf0e10cSrcweir 	// no keyboard help for splitwin
2772cdf0e10cSrcweir 	if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) && !rHEvt.KeyboardActivated() )
2773cdf0e10cSrcweir 	{
2774cdf0e10cSrcweir 		Point		aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
2775cdf0e10cSrcweir 		Rectangle	aHelpRect;
2776cdf0e10cSrcweir 		sal_uInt16		nHelpResId = 0;
2777cdf0e10cSrcweir 
2778cdf0e10cSrcweir 		ImplGetAutoHideRect( aHelpRect, sal_True );
2779cdf0e10cSrcweir 		if ( aHelpRect.IsInside( aMousePosPixel ) )
2780cdf0e10cSrcweir 		{
2781cdf0e10cSrcweir 			if ( mbAutoHideIn )
2782cdf0e10cSrcweir 				nHelpResId = SV_HELPTEXT_SPLITFIXED;
2783cdf0e10cSrcweir 			else
2784cdf0e10cSrcweir 				nHelpResId = SV_HELPTEXT_SPLITFLOATING;
2785cdf0e10cSrcweir 		}
2786cdf0e10cSrcweir 		else
2787cdf0e10cSrcweir 		{
2788cdf0e10cSrcweir 			ImplGetFadeInRect( aHelpRect, sal_True );
2789cdf0e10cSrcweir 			if ( aHelpRect.IsInside( aMousePosPixel ) )
2790cdf0e10cSrcweir 				nHelpResId = SV_HELPTEXT_FADEIN;
2791cdf0e10cSrcweir 			else
2792cdf0e10cSrcweir 			{
2793cdf0e10cSrcweir 				ImplGetFadeOutRect( aHelpRect, sal_True );
2794cdf0e10cSrcweir 				if ( aHelpRect.IsInside( aMousePosPixel ) )
2795cdf0e10cSrcweir 					nHelpResId = SV_HELPTEXT_FADEOUT;
2796cdf0e10cSrcweir 			}
2797cdf0e10cSrcweir 		}
2798cdf0e10cSrcweir 
2799cdf0e10cSrcweir 		// Rechteck ermitteln
2800cdf0e10cSrcweir 		if ( nHelpResId )
2801cdf0e10cSrcweir 		{
2802cdf0e10cSrcweir 			Point aPt = OutputToScreenPixel( aHelpRect.TopLeft() );
2803cdf0e10cSrcweir 			aHelpRect.Left()   = aPt.X();
2804cdf0e10cSrcweir 			aHelpRect.Top()    = aPt.Y();
2805cdf0e10cSrcweir 			aPt = OutputToScreenPixel( aHelpRect.BottomRight() );
2806cdf0e10cSrcweir 			aHelpRect.Right()  = aPt.X();
2807cdf0e10cSrcweir 			aHelpRect.Bottom() = aPt.Y();
2808cdf0e10cSrcweir 
2809cdf0e10cSrcweir 			// Text ermitteln und anzeigen
2810cdf0e10cSrcweir 			XubString aStr;
281161648e64Smseidel 			ResMgr* pResMgr = ImplGetResMgr();
281261648e64Smseidel 			if( pResMgr )
281361648e64Smseidel 				aStr = XubString( ResId( nHelpResId, *pResMgr ) );
2814cdf0e10cSrcweir 			if ( rHEvt.GetMode() & HELPMODE_BALLOON )
2815cdf0e10cSrcweir 				Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aStr );
2816cdf0e10cSrcweir 			else
2817cdf0e10cSrcweir 				Help::ShowQuickHelp( this, aHelpRect, aStr );
2818cdf0e10cSrcweir 			return;
2819cdf0e10cSrcweir 		}
2820cdf0e10cSrcweir 	}
2821cdf0e10cSrcweir 
2822cdf0e10cSrcweir 	DockingWindow::RequestHelp( rHEvt );
2823cdf0e10cSrcweir }
2824cdf0e10cSrcweir 
2825cdf0e10cSrcweir // -----------------------------------------------------------------------
2826cdf0e10cSrcweir 
StateChanged(StateChangedType nType)2827cdf0e10cSrcweir void SplitWindow::StateChanged( StateChangedType nType )
2828cdf0e10cSrcweir {
2829cdf0e10cSrcweir 	if ( nType == STATE_CHANGE_INITSHOW )
2830cdf0e10cSrcweir 	{
2831cdf0e10cSrcweir 		if ( IsUpdateMode() )
2832cdf0e10cSrcweir 			ImplCalcLayout();
2833cdf0e10cSrcweir 	}
2834cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_UPDATEMODE )
2835cdf0e10cSrcweir 	{
2836cdf0e10cSrcweir 		if ( IsUpdateMode() && IsReallyShown() )
2837cdf0e10cSrcweir 			ImplCalcLayout();
2838cdf0e10cSrcweir 	}
2839cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
2840cdf0e10cSrcweir 	{
2841cdf0e10cSrcweir 		ImplInitSettings();
2842cdf0e10cSrcweir 		Invalidate();
2843cdf0e10cSrcweir 	}
2844cdf0e10cSrcweir 
2845cdf0e10cSrcweir 	DockingWindow::StateChanged( nType );
2846cdf0e10cSrcweir }
2847cdf0e10cSrcweir 
2848cdf0e10cSrcweir // -----------------------------------------------------------------------
2849cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)2850cdf0e10cSrcweir void SplitWindow::DataChanged( const DataChangedEvent& rDCEvt )
2851cdf0e10cSrcweir {
2852cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
2853cdf0e10cSrcweir 		 (rDCEvt.GetFlags() & SETTINGS_STYLE) )
2854cdf0e10cSrcweir 	{
2855cdf0e10cSrcweir 		ImplInitSettings();
2856cdf0e10cSrcweir 		Invalidate();
2857cdf0e10cSrcweir 	}
2858cdf0e10cSrcweir 	else
2859cdf0e10cSrcweir 		DockingWindow::DataChanged( rDCEvt );
2860cdf0e10cSrcweir }
2861cdf0e10cSrcweir 
2862cdf0e10cSrcweir // -----------------------------------------------------------------------
2863cdf0e10cSrcweir 
InsertItem(sal_uInt16 nId,Window * pWindow,long nSize,sal_uInt16 nPos,sal_uInt16 nSetId,SplitWindowItemBits nBits)2864cdf0e10cSrcweir void SplitWindow::InsertItem( sal_uInt16 nId, Window* pWindow, long nSize,
2865cdf0e10cSrcweir 							  sal_uInt16 nPos, sal_uInt16 nSetId,
2866cdf0e10cSrcweir 							  SplitWindowItemBits nBits )
2867cdf0e10cSrcweir {
2868cdf0e10cSrcweir #ifdef DBG_UTIL
2869cdf0e10cSrcweir 	sal_uInt16 nDbgDummy;
2870cdf0e10cSrcweir 	DBG_ASSERT( ImplFindSet( mpMainSet, nSetId ), "SplitWindow::InsertItem() - Set not exists" );
2871cdf0e10cSrcweir 	DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" );
2872cdf0e10cSrcweir #endif
2873cdf0e10cSrcweir 
2874cdf0e10cSrcweir 	// Size has to be at least 1.
2875cdf0e10cSrcweir 	if ( nSize < 1 )
2876cdf0e10cSrcweir 		nSize = 1;
2877cdf0e10cSrcweir 
2878cdf0e10cSrcweir 	ImplSplitSet* pSet		 = ImplFindSet( mpMainSet, nSetId );
2879cdf0e10cSrcweir 	ImplSplitSet* pNewSet;
2880cdf0e10cSrcweir 	ImplSplitItem* pItem;
2881cdf0e10cSrcweir 
2882cdf0e10cSrcweir 	// Make room for the new item.
2883cdf0e10cSrcweir 	if ( nPos > pSet->mnItems )
2884cdf0e10cSrcweir 		nPos = pSet->mnItems;
2885cdf0e10cSrcweir 	ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1];
2886cdf0e10cSrcweir 	if ( nPos )
2887cdf0e10cSrcweir 		memcpy( pNewItems, pSet->mpItems, sizeof( ImplSplitItem )*nPos );
2888cdf0e10cSrcweir 	if ( nPos < pSet->mnItems )
2889cdf0e10cSrcweir 		memcpy( pNewItems+nPos+1, pSet->mpItems+nPos, sizeof( ImplSplitItem )*(pSet->mnItems-nPos) );
2890cdf0e10cSrcweir 	delete[] pSet->mpItems;
2891cdf0e10cSrcweir 	pSet->mpItems = pNewItems;
2892cdf0e10cSrcweir 	pSet->mnItems++;
2893cdf0e10cSrcweir 	pSet->mbCalcPix = sal_True;
2894cdf0e10cSrcweir 
2895cdf0e10cSrcweir 	// Create and initialize item.
2896cdf0e10cSrcweir 	pItem			= &(pSet->mpItems[nPos]);
2897cdf0e10cSrcweir 	memset( pItem, 0, sizeof( ImplSplitItem ) );
2898cdf0e10cSrcweir 	pItem->mnSize	= nSize;
2899cdf0e10cSrcweir 	pItem->mnId 	= nId;
2900cdf0e10cSrcweir 	pItem->mnBits	= nBits;
290161648e64Smseidel 	pItem->mnMinSize=-1;
290261648e64Smseidel 	pItem->mnMaxSize=-1;
2903cdf0e10cSrcweir 
2904cdf0e10cSrcweir 	if ( pWindow )
2905cdf0e10cSrcweir 	{
2906cdf0e10cSrcweir 		pItem->mpWindow 		= pWindow;
2907cdf0e10cSrcweir 		pItem->mpOrgParent		= pWindow->GetParent();
2908cdf0e10cSrcweir 
2909cdf0e10cSrcweir 		// Attach window to SplitWindow.
2910cdf0e10cSrcweir 		pWindow->Hide();
2911cdf0e10cSrcweir 		pWindow->SetParent( this );
2912cdf0e10cSrcweir 	}
2913cdf0e10cSrcweir 	else
2914cdf0e10cSrcweir 	{
2915cdf0e10cSrcweir 		pNewSet 				= new ImplSplitSet;
2916cdf0e10cSrcweir 		pNewSet->mpItems		= NULL;
2917cdf0e10cSrcweir 		pNewSet->mpWallpaper	= NULL;
2918cdf0e10cSrcweir 		pNewSet->mpBitmap		= NULL;
2919cdf0e10cSrcweir 		pNewSet->mnLastSize 	= 0;
2920cdf0e10cSrcweir 		pNewSet->mnItems		= 0;
2921cdf0e10cSrcweir 		pNewSet->mnId			= nId;
2922cdf0e10cSrcweir 		pNewSet->mnSplitSize	= pSet->mnSplitSize;
2923cdf0e10cSrcweir 		pNewSet->mbCalcPix		= sal_True;
2924cdf0e10cSrcweir 
2925cdf0e10cSrcweir 		pItem->mpSet			= pNewSet;
2926cdf0e10cSrcweir 	}
2927cdf0e10cSrcweir 
2928cdf0e10cSrcweir 	ImplUpdate();
2929cdf0e10cSrcweir }
2930cdf0e10cSrcweir 
2931cdf0e10cSrcweir // -----------------------------------------------------------------------
2932cdf0e10cSrcweir 
InsertItem(sal_uInt16 nId,long nSize,sal_uInt16 nPos,sal_uInt16 nSetId,SplitWindowItemBits nBits)2933cdf0e10cSrcweir void SplitWindow::InsertItem( sal_uInt16 nId, long nSize,
2934cdf0e10cSrcweir 							  sal_uInt16 nPos, sal_uInt16 nSetId,
2935cdf0e10cSrcweir 							  SplitWindowItemBits nBits )
2936cdf0e10cSrcweir {
2937cdf0e10cSrcweir 	InsertItem( nId, NULL, nSize, nPos, nSetId, nBits );
2938cdf0e10cSrcweir }
2939cdf0e10cSrcweir 
2940cdf0e10cSrcweir // -----------------------------------------------------------------------
2941cdf0e10cSrcweir 
MoveItem(sal_uInt16 nId,sal_uInt16 nNewPos,sal_uInt16 nNewSetId)2942cdf0e10cSrcweir void SplitWindow::MoveItem( sal_uInt16 nId, sal_uInt16 nNewPos, sal_uInt16 nNewSetId )
2943cdf0e10cSrcweir {
2944cdf0e10cSrcweir #ifdef DBG_UTIL
2945cdf0e10cSrcweir 	sal_uInt16 nDbgDummy;
2946cdf0e10cSrcweir 	DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::MoveItem() - Id not found" );
2947cdf0e10cSrcweir 	DBG_ASSERT( ImplFindSet( mpMainSet, nNewSetId ), "SplitWindow::MoveItem() - Set not exists" );
2948cdf0e10cSrcweir #endif
2949cdf0e10cSrcweir 
2950cdf0e10cSrcweir 	sal_uInt16			nPos;
2951cdf0e10cSrcweir 	ImplSplitSet*	 pNewSet = ImplFindSet( mpMainSet, nNewSetId );
2952cdf0e10cSrcweir 	ImplSplitSet*	 pSet	 = ImplFindItem( mpMainSet, nId, nPos );
2953cdf0e10cSrcweir 	ImplSplitItem	 aTempItem;
2954cdf0e10cSrcweir 
2955cdf0e10cSrcweir 	if ( pNewSet == pSet )
2956cdf0e10cSrcweir 	{
2957cdf0e10cSrcweir 		if ( nNewPos >= pNewSet->mnItems )
2958cdf0e10cSrcweir 			nNewPos = pNewSet->mnItems-1;
2959cdf0e10cSrcweir 		if ( nPos != nNewPos )
2960cdf0e10cSrcweir 		{
2961cdf0e10cSrcweir 			memcpy( &aTempItem, &(pSet->mpItems[nPos]), sizeof( aTempItem ) );
2962cdf0e10cSrcweir 			if ( nPos < nNewPos )
2963cdf0e10cSrcweir 			{
2964cdf0e10cSrcweir 				memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
2965cdf0e10cSrcweir 						 (nNewPos-nPos)*sizeof( ImplSplitItem ) );
2966cdf0e10cSrcweir 			}
2967cdf0e10cSrcweir 			else
2968cdf0e10cSrcweir 			{
2969cdf0e10cSrcweir 				memmove( pSet->mpItems+nNewPos+1, pSet->mpItems+nNewPos,
2970cdf0e10cSrcweir 						 (nPos-nNewPos)*sizeof( ImplSplitItem ) );
2971cdf0e10cSrcweir 			}
2972cdf0e10cSrcweir 			memcpy( &(pSet->mpItems[nNewPos]), &aTempItem, sizeof( aTempItem ) );
2973cdf0e10cSrcweir 
2974cdf0e10cSrcweir 			ImplUpdate();
2975cdf0e10cSrcweir 		}
2976cdf0e10cSrcweir 	}
2977cdf0e10cSrcweir 	else
2978cdf0e10cSrcweir 	{
2979cdf0e10cSrcweir 		if ( nNewPos >= pNewSet->mnItems )
2980cdf0e10cSrcweir 			nNewPos = pNewSet->mnItems;
2981cdf0e10cSrcweir 		memcpy( &aTempItem, &(pSet->mpItems[nPos]), sizeof( aTempItem ) );
2982cdf0e10cSrcweir 		pSet->mnItems--;
2983cdf0e10cSrcweir 		pSet->mbCalcPix = sal_True;
2984cdf0e10cSrcweir 		if ( pSet->mnItems )
2985cdf0e10cSrcweir 		{
2986cdf0e10cSrcweir 			memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
2987cdf0e10cSrcweir 					 (pSet->mnItems-nPos)*sizeof( ImplSplitItem ) );
2988cdf0e10cSrcweir 		}
2989cdf0e10cSrcweir 		else
2990cdf0e10cSrcweir 		{
2991cdf0e10cSrcweir 			delete[] pSet->mpItems;
2992cdf0e10cSrcweir 			pSet->mpItems = NULL;
2993cdf0e10cSrcweir 		}
2994cdf0e10cSrcweir 		ImplSplitItem* pNewItems = new ImplSplitItem[pNewSet->mnItems+1];
2995cdf0e10cSrcweir 		if ( nNewPos )
2996cdf0e10cSrcweir 			memcpy( pNewItems, pNewSet->mpItems, sizeof( ImplSplitItem )*nNewPos );
2997cdf0e10cSrcweir 		if ( nNewPos < pNewSet->mnItems )
2998cdf0e10cSrcweir 		{
2999cdf0e10cSrcweir 			memcpy( pNewItems+nNewPos+1, pNewSet->mpItems+nNewPos,
3000cdf0e10cSrcweir 					sizeof( ImplSplitItem )*(pNewSet->mnItems-nNewPos) );
3001cdf0e10cSrcweir 		}
3002cdf0e10cSrcweir 		delete[] pNewSet->mpItems;
3003cdf0e10cSrcweir 		pNewSet->mpItems = pNewItems;
3004cdf0e10cSrcweir 		pNewSet->mnItems++;
3005cdf0e10cSrcweir 		pNewSet->mbCalcPix = sal_True;
3006cdf0e10cSrcweir 		memcpy( &(pNewSet->mpItems[nNewPos]), &aTempItem, sizeof( aTempItem ) );
3007cdf0e10cSrcweir 		ImplUpdate();
3008cdf0e10cSrcweir 	}
3009cdf0e10cSrcweir }
3010cdf0e10cSrcweir 
3011cdf0e10cSrcweir // -----------------------------------------------------------------------
3012cdf0e10cSrcweir 
RemoveItem(sal_uInt16 nId,sal_Bool bHide)3013cdf0e10cSrcweir void SplitWindow::RemoveItem( sal_uInt16 nId, sal_Bool bHide )
3014cdf0e10cSrcweir {
3015cdf0e10cSrcweir #ifdef DBG_UTIL
3016cdf0e10cSrcweir 	sal_uInt16 nDbgDummy;
3017cdf0e10cSrcweir 	DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::RemoveItem() - Id not found" );
3018cdf0e10cSrcweir #endif
3019cdf0e10cSrcweir 
3020cdf0e10cSrcweir 	// Set suchen
3021cdf0e10cSrcweir 	sal_uInt16			nPos;
3022cdf0e10cSrcweir 	ImplSplitSet*	 pSet	 = ImplFindItem( mpMainSet, nId, nPos );
3023cdf0e10cSrcweir 	ImplSplitItem*	 pItem	 = &(pSet->mpItems[nPos]);
3024cdf0e10cSrcweir 	Window* 		pWindow = pItem->mpWindow;
3025cdf0e10cSrcweir 	Window* 		pOrgParent = pItem->mpOrgParent;
3026cdf0e10cSrcweir 
302761648e64Smseidel 	// Evtl. Set loeschen
3028cdf0e10cSrcweir 	if ( !pWindow )
3029cdf0e10cSrcweir 		ImplDeleteSet( pItem->mpSet );
3030cdf0e10cSrcweir 
3031cdf0e10cSrcweir 	// Item entfernen
3032cdf0e10cSrcweir 	pSet->mnItems--;
3033cdf0e10cSrcweir 	pSet->mbCalcPix = sal_True;
3034cdf0e10cSrcweir 	if ( pSet->mnItems )
3035cdf0e10cSrcweir 	{
3036cdf0e10cSrcweir 		memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
3037cdf0e10cSrcweir 				 (pSet->mnItems-nPos)*sizeof( ImplSplitItem ) );
3038cdf0e10cSrcweir 	}
3039cdf0e10cSrcweir 	else
3040cdf0e10cSrcweir 	{
3041cdf0e10cSrcweir 		delete[] pSet->mpItems;
3042cdf0e10cSrcweir 		pSet->mpItems = NULL;
3043cdf0e10cSrcweir 	}
3044cdf0e10cSrcweir 
3045cdf0e10cSrcweir 	ImplUpdate();
3046cdf0e10cSrcweir 
3047cdf0e10cSrcweir 	// Window erst hier loeschen, um weniger Paints zu haben
3048cdf0e10cSrcweir 	if ( pWindow )
3049cdf0e10cSrcweir 	{
3050cdf0e10cSrcweir 		// Fenster wieder herstellen
3051cdf0e10cSrcweir 		if ( bHide || (pOrgParent != this) )
3052cdf0e10cSrcweir 		{
3053cdf0e10cSrcweir 			pWindow->Hide();
3054cdf0e10cSrcweir 			pWindow->SetParent( pOrgParent );
3055cdf0e10cSrcweir 		}
3056cdf0e10cSrcweir 	}
3057cdf0e10cSrcweir }
3058cdf0e10cSrcweir 
3059cdf0e10cSrcweir // -----------------------------------------------------------------------
3060cdf0e10cSrcweir 
Clear()3061cdf0e10cSrcweir void SplitWindow::Clear()
3062cdf0e10cSrcweir {
3063cdf0e10cSrcweir 	// Alle Sets loeschen
3064cdf0e10cSrcweir 	ImplDeleteSet( mpMainSet );
3065cdf0e10cSrcweir 
3066cdf0e10cSrcweir 	// Main-Set wieder anlegen
3067cdf0e10cSrcweir 	mpMainSet					= new ImplSplitSet;
3068cdf0e10cSrcweir 	mpMainSet->mpItems			= NULL;
3069cdf0e10cSrcweir 	mpMainSet->mpWallpaper		= NULL;
3070cdf0e10cSrcweir 	mpMainSet->mpBitmap 		= NULL;
3071cdf0e10cSrcweir 	mpMainSet->mnLastSize		= 0;
3072cdf0e10cSrcweir 	mpMainSet->mnItems			= 0;
3073cdf0e10cSrcweir 	mpMainSet->mnId 			= 0;
3074cdf0e10cSrcweir 	mpMainSet->mnSplitSize		= SPLITWIN_SPLITSIZE;
3075cdf0e10cSrcweir 	mpMainSet->mbCalcPix		= sal_True;
3076cdf0e10cSrcweir 	if ( mnWinStyle & WB_NOSPLITDRAW )
3077cdf0e10cSrcweir 		mpMainSet->mnSplitSize -= 2;
3078cdf0e10cSrcweir 	mpBaseSet					= mpMainSet;
3079cdf0e10cSrcweir 
3080cdf0e10cSrcweir 	// Und neu invalidieren
3081cdf0e10cSrcweir 	ImplUpdate();
3082cdf0e10cSrcweir }
3083cdf0e10cSrcweir 
3084cdf0e10cSrcweir // -----------------------------------------------------------------------
3085cdf0e10cSrcweir 
SetBaseSet(sal_uInt16 nSetId)3086cdf0e10cSrcweir void SplitWindow::SetBaseSet( sal_uInt16 nSetId )
3087cdf0e10cSrcweir {
3088cdf0e10cSrcweir 	mpBaseSet = ImplFindSet( mpMainSet, nSetId );
3089cdf0e10cSrcweir }
3090cdf0e10cSrcweir 
3091cdf0e10cSrcweir // -----------------------------------------------------------------------
3092cdf0e10cSrcweir 
GetBaseSet() const3093cdf0e10cSrcweir sal_uInt16 SplitWindow::GetBaseSet() const
3094cdf0e10cSrcweir {
3095cdf0e10cSrcweir 	return mpBaseSet->mnId;
3096cdf0e10cSrcweir }
3097cdf0e10cSrcweir 
3098cdf0e10cSrcweir // -----------------------------------------------------------------------
3099cdf0e10cSrcweir 
SetSplitSize(sal_uInt16 nSetId,long nSplitSize,sal_Bool bWithChilds)3100cdf0e10cSrcweir void SplitWindow::SetSplitSize( sal_uInt16 nSetId, long nSplitSize,
3101cdf0e10cSrcweir 								sal_Bool bWithChilds )
3102cdf0e10cSrcweir {
3103cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3104cdf0e10cSrcweir 	if ( pSet )
3105cdf0e10cSrcweir 	{
3106cdf0e10cSrcweir 		if ( bWithChilds )
3107cdf0e10cSrcweir 			ImplSetSplitSize( pSet, nSplitSize );
3108cdf0e10cSrcweir 		else
3109cdf0e10cSrcweir 			pSet->mnSplitSize = nSplitSize;
3110cdf0e10cSrcweir 	}
3111cdf0e10cSrcweir 	ImplUpdate();
3112cdf0e10cSrcweir }
3113cdf0e10cSrcweir 
3114cdf0e10cSrcweir // -----------------------------------------------------------------------
3115cdf0e10cSrcweir 
GetSplitSize(sal_uInt16 nSetId) const3116cdf0e10cSrcweir long SplitWindow::GetSplitSize( sal_uInt16 nSetId ) const
3117cdf0e10cSrcweir {
3118cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3119cdf0e10cSrcweir 	if ( pSet )
3120cdf0e10cSrcweir 		return pSet->mnSplitSize;
3121cdf0e10cSrcweir 	else
3122cdf0e10cSrcweir 		return 0;
3123cdf0e10cSrcweir }
3124cdf0e10cSrcweir 
3125cdf0e10cSrcweir // -----------------------------------------------------------------------
3126cdf0e10cSrcweir 
SetItemBackground(sal_uInt16 nSetId)3127cdf0e10cSrcweir void SplitWindow::SetItemBackground( sal_uInt16 nSetId )
3128cdf0e10cSrcweir {
3129cdf0e10cSrcweir 	Wallpaper aWall;
3130cdf0e10cSrcweir 	SetItemBackground( nSetId, aWall );
3131cdf0e10cSrcweir }
3132cdf0e10cSrcweir 
3133cdf0e10cSrcweir // -----------------------------------------------------------------------
3134cdf0e10cSrcweir 
SetItemBackground(sal_uInt16 nSetId,const Wallpaper & rWallpaper)3135cdf0e10cSrcweir void SplitWindow::SetItemBackground( sal_uInt16 nSetId, const Wallpaper& rWallpaper )
3136cdf0e10cSrcweir {
3137cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3138cdf0e10cSrcweir 
3139cdf0e10cSrcweir 	if ( pSet )
3140cdf0e10cSrcweir 	{
3141cdf0e10cSrcweir 		sal_Bool bUpdate = sal_True;
3142cdf0e10cSrcweir 
3143cdf0e10cSrcweir 		if ( rWallpaper.GetStyle() == WALLPAPER_NULL )
3144cdf0e10cSrcweir 		{
3145cdf0e10cSrcweir 			if ( pSet->mpWallpaper )
3146cdf0e10cSrcweir 			{
3147cdf0e10cSrcweir 				delete pSet->mpWallpaper;
3148cdf0e10cSrcweir 				pSet->mpWallpaper = NULL;
3149cdf0e10cSrcweir 			}
3150cdf0e10cSrcweir 			else
3151cdf0e10cSrcweir 				bUpdate = sal_False;
3152cdf0e10cSrcweir 		}
3153cdf0e10cSrcweir 		else
3154cdf0e10cSrcweir 		{
3155cdf0e10cSrcweir 			// Ab jetzt muss immer invalidiert werden
3156cdf0e10cSrcweir 			mbInvalidate = sal_True;
3157cdf0e10cSrcweir 
3158cdf0e10cSrcweir 			if ( !pSet->mpWallpaper )
3159cdf0e10cSrcweir 				pSet->mpWallpaper = new Wallpaper( rWallpaper );
3160cdf0e10cSrcweir 			else
3161cdf0e10cSrcweir 				*(pSet->mpWallpaper) = rWallpaper;
3162cdf0e10cSrcweir 		}
3163cdf0e10cSrcweir 
3164cdf0e10cSrcweir 		// Beim MainSet koennen wir den Background umsetzen
3165cdf0e10cSrcweir 		if ( pSet == mpMainSet )
3166cdf0e10cSrcweir 			ImplInitSettings();
3167cdf0e10cSrcweir 
3168cdf0e10cSrcweir 		if ( bUpdate )
3169cdf0e10cSrcweir 			ImplUpdateSet( pSet );
3170cdf0e10cSrcweir 	}
3171cdf0e10cSrcweir }
3172cdf0e10cSrcweir 
3173cdf0e10cSrcweir // -----------------------------------------------------------------------
3174cdf0e10cSrcweir 
GetItemBackground(sal_uInt16 nSetId) const3175cdf0e10cSrcweir Wallpaper SplitWindow::GetItemBackground( sal_uInt16 nSetId ) const
3176cdf0e10cSrcweir {
3177cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3178cdf0e10cSrcweir 
3179cdf0e10cSrcweir 	if ( pSet && pSet->mpWallpaper )
3180cdf0e10cSrcweir 		return *(pSet->mpWallpaper);
3181cdf0e10cSrcweir 	else
3182cdf0e10cSrcweir 	{
3183cdf0e10cSrcweir 		Wallpaper aWall;
3184cdf0e10cSrcweir 		return aWall;
3185cdf0e10cSrcweir 	}
3186cdf0e10cSrcweir }
3187cdf0e10cSrcweir 
3188cdf0e10cSrcweir // -----------------------------------------------------------------------
3189cdf0e10cSrcweir 
IsItemBackground(sal_uInt16 nSetId) const3190cdf0e10cSrcweir sal_Bool SplitWindow::IsItemBackground( sal_uInt16 nSetId ) const
3191cdf0e10cSrcweir {
3192cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3193cdf0e10cSrcweir 
3194cdf0e10cSrcweir 	if ( pSet && pSet->mpWallpaper )
3195cdf0e10cSrcweir 		return sal_True;
3196cdf0e10cSrcweir 	else
3197cdf0e10cSrcweir 		return sal_False;
3198cdf0e10cSrcweir }
3199cdf0e10cSrcweir 
3200cdf0e10cSrcweir // -----------------------------------------------------------------------
3201cdf0e10cSrcweir 
SetItemBitmap(sal_uInt16 nSetId,const Bitmap & rBitmap)3202cdf0e10cSrcweir void SplitWindow::SetItemBitmap( sal_uInt16 nSetId, const Bitmap& rBitmap )
3203cdf0e10cSrcweir {
3204cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3205cdf0e10cSrcweir 
3206cdf0e10cSrcweir 	if ( pSet )
3207cdf0e10cSrcweir 	{
3208cdf0e10cSrcweir 		sal_Bool bUpdate = sal_True;
3209cdf0e10cSrcweir 
3210cdf0e10cSrcweir 		if ( !rBitmap )
3211cdf0e10cSrcweir 		{
3212cdf0e10cSrcweir 			if ( pSet->mpBitmap )
3213cdf0e10cSrcweir 			{
3214cdf0e10cSrcweir 				delete pSet->mpBitmap;
3215cdf0e10cSrcweir 				pSet->mpBitmap = NULL;
3216cdf0e10cSrcweir 			}
3217cdf0e10cSrcweir 			else
3218cdf0e10cSrcweir 				bUpdate = sal_False;
3219cdf0e10cSrcweir 		}
3220cdf0e10cSrcweir 		else
3221cdf0e10cSrcweir 		{
3222cdf0e10cSrcweir 			// Ab jetzt muss immer invalidiert werden
3223cdf0e10cSrcweir 			mbInvalidate = sal_True;
3224cdf0e10cSrcweir 
3225cdf0e10cSrcweir 			if ( !pSet->mpBitmap )
3226cdf0e10cSrcweir 				pSet->mpBitmap = new Bitmap( rBitmap );
3227cdf0e10cSrcweir 			else
3228cdf0e10cSrcweir 				*(pSet->mpBitmap) = rBitmap;
3229cdf0e10cSrcweir 		}
3230cdf0e10cSrcweir 
3231cdf0e10cSrcweir 		// Beim MainSet koennen wir den Background umsetzen
3232cdf0e10cSrcweir 		if ( pSet == mpMainSet )
3233cdf0e10cSrcweir 			ImplInitSettings();
3234cdf0e10cSrcweir 
3235cdf0e10cSrcweir 		if ( bUpdate )
3236cdf0e10cSrcweir 			ImplUpdateSet( pSet );
3237cdf0e10cSrcweir 	}
3238cdf0e10cSrcweir }
3239cdf0e10cSrcweir 
3240cdf0e10cSrcweir // -----------------------------------------------------------------------
3241cdf0e10cSrcweir 
GetItemBitmap(sal_uInt16 nSetId) const3242cdf0e10cSrcweir Bitmap SplitWindow::GetItemBitmap( sal_uInt16 nSetId ) const
3243cdf0e10cSrcweir {
3244cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
3245cdf0e10cSrcweir 
3246cdf0e10cSrcweir 	if ( pSet && pSet->mpBitmap )
3247cdf0e10cSrcweir 		return *(pSet->mpBitmap);
3248cdf0e10cSrcweir 	else
3249cdf0e10cSrcweir 	{
3250cdf0e10cSrcweir 		Bitmap aBitmap;
3251cdf0e10cSrcweir 		return aBitmap;
3252cdf0e10cSrcweir 	}
3253cdf0e10cSrcweir }
3254cdf0e10cSrcweir 
3255cdf0e10cSrcweir // -----------------------------------------------------------------------
3256cdf0e10cSrcweir 
SplitItem(sal_uInt16 nId,long nNewSize,sal_Bool bPropSmall,sal_Bool bPropGreat)3257cdf0e10cSrcweir void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize,
3258cdf0e10cSrcweir 							 sal_Bool bPropSmall, sal_Bool bPropGreat )
3259cdf0e10cSrcweir {
3260cdf0e10cSrcweir 	sal_uInt16			nItems;
3261cdf0e10cSrcweir 	sal_uInt16			nPos;
3262cdf0e10cSrcweir 	sal_uInt16			nMin;
3263cdf0e10cSrcweir 	sal_uInt16			nMax;
3264cdf0e10cSrcweir 	sal_uInt16			i;
3265cdf0e10cSrcweir 	sal_uInt16			n;
3266cdf0e10cSrcweir 	long			nDelta;
3267cdf0e10cSrcweir 	long			nTempDelta;
3268cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3269cdf0e10cSrcweir 	ImplSplitItem*	pItems;
3270cdf0e10cSrcweir 
3271cdf0e10cSrcweir 	if ( !pSet )
3272cdf0e10cSrcweir 		return;
3273cdf0e10cSrcweir 
3274cdf0e10cSrcweir 	nItems = pSet->mnItems;
3275cdf0e10cSrcweir 	pItems = pSet->mpItems;
3276cdf0e10cSrcweir 
3277789f9e36Smseidel 	// When there is an explicit minimum or maximum size then move nNewSize
3278789f9e36Smseidel 	// into that range (when it is not yet already in it.)
3279789f9e36Smseidel 	nNewSize = ValidateSize(nNewSize, pItems[nPos]);
3280cdf0e10cSrcweir 
3281cdf0e10cSrcweir 	if ( mbCalc )
3282cdf0e10cSrcweir 	{
3283cdf0e10cSrcweir 		pItems[nPos].mnSize = nNewSize;
3284cdf0e10cSrcweir 		return;
3285cdf0e10cSrcweir 	}
3286cdf0e10cSrcweir 
3287cdf0e10cSrcweir 	nDelta = nNewSize-pItems[nPos].mnPixSize;
3288cdf0e10cSrcweir 	if ( !nDelta )
3289cdf0e10cSrcweir 		return;
3290cdf0e10cSrcweir 
3291cdf0e10cSrcweir 	// Bereich berechnen, der beim Splitten betroffen sein kann
3292cdf0e10cSrcweir 	nMin = 0;
3293cdf0e10cSrcweir 	nMax = nItems;
3294cdf0e10cSrcweir 	for ( i = 0; i < nItems; i++ )
3295cdf0e10cSrcweir 	{
3296cdf0e10cSrcweir 		if ( pItems[i].mbFixed )
3297cdf0e10cSrcweir 		{
3298cdf0e10cSrcweir 			if ( i < nPos )
3299cdf0e10cSrcweir 				nMin = i+1;
3300cdf0e10cSrcweir 			else
3301cdf0e10cSrcweir 				nMax = i;
3302cdf0e10cSrcweir 		}
3303cdf0e10cSrcweir 	}
3304cdf0e10cSrcweir 
3305cdf0e10cSrcweir 	// Wenn das Fenster sizeable ist, wird das TopSet anders behandelt
3306789f9e36Smseidel 	sal_Bool bSmall = sal_True;
3307789f9e36Smseidel 	sal_Bool bGreat = sal_True;
3308cdf0e10cSrcweir 	if ( (pSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) )
3309cdf0e10cSrcweir 	{
3310cdf0e10cSrcweir 		if ( nPos < pSet->mnItems-1 )
3311cdf0e10cSrcweir 		{
3312cdf0e10cSrcweir 			if ( !((bPropSmall && bPropGreat) ||
3313cdf0e10cSrcweir 				   ((nDelta > 0) && bPropSmall) ||
3314cdf0e10cSrcweir 				   ((nDelta < 0) && bPropGreat)) )
3315cdf0e10cSrcweir 			{
3316cdf0e10cSrcweir 				if ( nDelta < 0 )
3317cdf0e10cSrcweir 					bGreat = sal_False;
3318cdf0e10cSrcweir 				else
3319cdf0e10cSrcweir 					bSmall = sal_False;
3320cdf0e10cSrcweir 			}
3321cdf0e10cSrcweir 		}
3322cdf0e10cSrcweir 		else
3323cdf0e10cSrcweir 		{
3324cdf0e10cSrcweir 			if ( nDelta < 0 )
3325cdf0e10cSrcweir 				bGreat = sal_False;
3326cdf0e10cSrcweir 			else
3327cdf0e10cSrcweir 				bSmall = sal_False;
3328cdf0e10cSrcweir 		}
3329cdf0e10cSrcweir 	}
3330cdf0e10cSrcweir 	else if ( nPos >= nMax )
3331cdf0e10cSrcweir 	{
3332cdf0e10cSrcweir 		bSmall = sal_False;
3333cdf0e10cSrcweir 		bGreat = sal_False;
3334cdf0e10cSrcweir 	}
3335cdf0e10cSrcweir 	else if ( nPos && (nPos >= pSet->mnItems-1) )
3336cdf0e10cSrcweir 	{
3337cdf0e10cSrcweir 		nPos--;
3338cdf0e10cSrcweir 		nDelta *= -1;
3339cdf0e10cSrcweir 		sal_Bool bTemp = bPropSmall;
3340cdf0e10cSrcweir 		bPropSmall = bPropGreat;
3341cdf0e10cSrcweir 		bPropGreat = bTemp;
3342cdf0e10cSrcweir 	}
3343cdf0e10cSrcweir 
3344cdf0e10cSrcweir 	// Jetzt die Fenster splitten
3345cdf0e10cSrcweir 	if ( nDelta < 0 )
3346cdf0e10cSrcweir 	{
3347cdf0e10cSrcweir 		if ( bGreat )
3348cdf0e10cSrcweir 		{
3349cdf0e10cSrcweir 			if ( bPropGreat )
3350cdf0e10cSrcweir 			{
3351cdf0e10cSrcweir 				nTempDelta = nDelta;
3352cdf0e10cSrcweir 				do
3353cdf0e10cSrcweir 				{
3354cdf0e10cSrcweir 					n = nPos+1;
3355cdf0e10cSrcweir 					do
3356cdf0e10cSrcweir 					{
3357cdf0e10cSrcweir 						if ( nTempDelta )
3358cdf0e10cSrcweir 						{
3359cdf0e10cSrcweir 							pItems[n].mnPixSize++;
3360cdf0e10cSrcweir 							nTempDelta++;
3361cdf0e10cSrcweir 						}
3362cdf0e10cSrcweir 						n++;
3363cdf0e10cSrcweir 					}
3364cdf0e10cSrcweir 					while ( n < nMax );
3365cdf0e10cSrcweir 				}
3366cdf0e10cSrcweir 				while ( nTempDelta );
3367cdf0e10cSrcweir 			}
3368cdf0e10cSrcweir 			else
3369cdf0e10cSrcweir 				pItems[nPos+1].mnPixSize -= nDelta;
3370cdf0e10cSrcweir 		}
3371cdf0e10cSrcweir 
3372cdf0e10cSrcweir 		if ( bSmall )
3373cdf0e10cSrcweir 		{
3374cdf0e10cSrcweir 			if ( bPropSmall )
3375cdf0e10cSrcweir 			{
3376cdf0e10cSrcweir 				do
3377cdf0e10cSrcweir 				{
3378cdf0e10cSrcweir 					n = nPos+1;
3379cdf0e10cSrcweir 					do
3380cdf0e10cSrcweir 					{
3381cdf0e10cSrcweir 						if ( nDelta && pItems[n-1].mnPixSize )
3382cdf0e10cSrcweir 						{
3383cdf0e10cSrcweir 							pItems[n-1].mnPixSize--;
3384cdf0e10cSrcweir 							nDelta++;
3385cdf0e10cSrcweir 						}
3386cdf0e10cSrcweir 
3387cdf0e10cSrcweir 						n--;
3388cdf0e10cSrcweir 					}
3389cdf0e10cSrcweir 					while ( n > nMin );
3390cdf0e10cSrcweir 				}
3391cdf0e10cSrcweir 				while ( nDelta );
3392cdf0e10cSrcweir 			}
3393cdf0e10cSrcweir 			else
3394cdf0e10cSrcweir 			{
3395cdf0e10cSrcweir 				n = nPos+1;
3396cdf0e10cSrcweir 				do
3397cdf0e10cSrcweir 				{
3398cdf0e10cSrcweir 					if ( pItems[n-1].mnPixSize+nDelta < 0 )
3399cdf0e10cSrcweir 					{
3400cdf0e10cSrcweir 						nDelta += pItems[n-1].mnPixSize;
3401cdf0e10cSrcweir 						pItems[n-1].mnPixSize = 0;
3402cdf0e10cSrcweir 					}
3403cdf0e10cSrcweir 					else
3404cdf0e10cSrcweir 					{
3405cdf0e10cSrcweir 						pItems[n-1].mnPixSize += nDelta;
3406cdf0e10cSrcweir 						break;
3407cdf0e10cSrcweir 					}
3408cdf0e10cSrcweir 					n--;
3409cdf0e10cSrcweir 				}
3410cdf0e10cSrcweir 				while ( n > nMin );
3411cdf0e10cSrcweir 			}
3412cdf0e10cSrcweir 		}
3413cdf0e10cSrcweir 	}
3414cdf0e10cSrcweir 	else
3415cdf0e10cSrcweir 	{
3416cdf0e10cSrcweir 		if ( bGreat )
3417cdf0e10cSrcweir 		{
3418cdf0e10cSrcweir 			if ( bPropGreat )
3419cdf0e10cSrcweir 			{
3420cdf0e10cSrcweir 				nTempDelta = nDelta;
3421cdf0e10cSrcweir 				do
3422cdf0e10cSrcweir 				{
3423cdf0e10cSrcweir 					n = nPos+1;
3424cdf0e10cSrcweir 					do
3425cdf0e10cSrcweir 					{
3426cdf0e10cSrcweir 						if ( nTempDelta )
3427cdf0e10cSrcweir 						{
3428cdf0e10cSrcweir 							pItems[n-1].mnPixSize++;
3429cdf0e10cSrcweir 							nTempDelta--;
3430cdf0e10cSrcweir 						}
3431cdf0e10cSrcweir 						n--;
3432cdf0e10cSrcweir 					}
3433cdf0e10cSrcweir 					while ( n > nMin );
3434cdf0e10cSrcweir 				}
3435cdf0e10cSrcweir 				while ( nTempDelta );
3436cdf0e10cSrcweir 			}
3437cdf0e10cSrcweir 			else
3438cdf0e10cSrcweir 				pItems[nPos].mnPixSize += nDelta;
3439cdf0e10cSrcweir 		}
3440cdf0e10cSrcweir 
3441cdf0e10cSrcweir 		if ( bSmall )
3442cdf0e10cSrcweir 		{
3443cdf0e10cSrcweir 			if ( bPropSmall )
3444cdf0e10cSrcweir 			{
3445cdf0e10cSrcweir 				do
3446cdf0e10cSrcweir 				{
3447cdf0e10cSrcweir 					n = nPos+1;
3448cdf0e10cSrcweir 					do
3449cdf0e10cSrcweir 					{
3450cdf0e10cSrcweir 						if ( nDelta && pItems[n].mnPixSize )
3451cdf0e10cSrcweir 						{
3452cdf0e10cSrcweir 							pItems[n].mnPixSize--;
3453cdf0e10cSrcweir 							nDelta--;
3454cdf0e10cSrcweir 						}
3455cdf0e10cSrcweir 
3456cdf0e10cSrcweir 						n++;
3457cdf0e10cSrcweir 					}
3458cdf0e10cSrcweir 					while ( n < nMax );
3459cdf0e10cSrcweir 				}
3460cdf0e10cSrcweir 				while ( nDelta );
3461cdf0e10cSrcweir 			}
3462cdf0e10cSrcweir 			else
3463cdf0e10cSrcweir 			{
3464cdf0e10cSrcweir 				n = nPos+1;
3465cdf0e10cSrcweir 				do
3466cdf0e10cSrcweir 				{
3467cdf0e10cSrcweir 					if ( pItems[n].mnPixSize-nDelta < 0 )
3468cdf0e10cSrcweir 					{
3469cdf0e10cSrcweir 						nDelta -= pItems[n].mnPixSize;
3470cdf0e10cSrcweir 						pItems[n].mnPixSize = 0;
3471cdf0e10cSrcweir 					}
3472cdf0e10cSrcweir 					else
3473cdf0e10cSrcweir 					{
3474cdf0e10cSrcweir 						pItems[n].mnPixSize -= nDelta;
3475cdf0e10cSrcweir 						break;
3476cdf0e10cSrcweir 					}
3477cdf0e10cSrcweir 					n++;
3478cdf0e10cSrcweir 				}
3479cdf0e10cSrcweir 				while ( n < nMax );
3480cdf0e10cSrcweir 			}
3481cdf0e10cSrcweir 		}
3482cdf0e10cSrcweir 	}
3483cdf0e10cSrcweir 
3484cdf0e10cSrcweir 	// Original-Groessen updaten
3485cdf0e10cSrcweir 	ImplCalcLogSize( pItems, nItems );
3486cdf0e10cSrcweir 
3487cdf0e10cSrcweir 	ImplUpdate();
3488cdf0e10cSrcweir }
3489cdf0e10cSrcweir 
3490cdf0e10cSrcweir // -----------------------------------------------------------------------
3491cdf0e10cSrcweir 
SetItemSize(sal_uInt16 nId,long nNewSize)3492cdf0e10cSrcweir void SplitWindow::SetItemSize( sal_uInt16 nId, long nNewSize )
3493cdf0e10cSrcweir {
3494cdf0e10cSrcweir 	sal_uInt16			nPos;
3495cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3496cdf0e10cSrcweir 	ImplSplitItem*	pItem;
3497cdf0e10cSrcweir 
3498cdf0e10cSrcweir 	if ( !pSet )
3499cdf0e10cSrcweir 		return;
3500cdf0e10cSrcweir 
3501cdf0e10cSrcweir 	// Testen, ob sich Groesse aendert
3502cdf0e10cSrcweir 	pItem = &(pSet->mpItems[nPos]);
3503cdf0e10cSrcweir 	if ( pItem->mnSize != nNewSize )
3504cdf0e10cSrcweir 	{
3505cdf0e10cSrcweir 		// Neue Groesse setzen und neu durchrechnen
3506cdf0e10cSrcweir 		pItem->mnSize = nNewSize;
3507cdf0e10cSrcweir 		pSet->mbCalcPix = sal_True;
3508cdf0e10cSrcweir 		ImplUpdate();
3509cdf0e10cSrcweir 	}
3510cdf0e10cSrcweir }
3511cdf0e10cSrcweir 
3512cdf0e10cSrcweir // -----------------------------------------------------------------------
3513cdf0e10cSrcweir 
GetItemSize(sal_uInt16 nId) const3514cdf0e10cSrcweir long SplitWindow::GetItemSize( sal_uInt16 nId ) const
3515cdf0e10cSrcweir {
3516cdf0e10cSrcweir 	sal_uInt16			nPos;
3517cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3518cdf0e10cSrcweir 
3519cdf0e10cSrcweir 	if ( pSet )
3520cdf0e10cSrcweir 		return pSet->mpItems[nPos].mnSize;
3521cdf0e10cSrcweir 	else
3522cdf0e10cSrcweir 		return 0;
3523cdf0e10cSrcweir }
3524cdf0e10cSrcweir 
3525cdf0e10cSrcweir // -----------------------------------------------------------------------
3526cdf0e10cSrcweir 
GetItemSize(sal_uInt16 nId,SplitWindowItemBits nBits) const3527cdf0e10cSrcweir long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const
3528cdf0e10cSrcweir {
3529cdf0e10cSrcweir 	sal_uInt16			nPos;
3530cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3531cdf0e10cSrcweir 
3532cdf0e10cSrcweir 	if ( pSet )
3533cdf0e10cSrcweir 	{
3534cdf0e10cSrcweir 		if ( nBits == pSet->mpItems[nPos].mnBits )
3535cdf0e10cSrcweir 			return pSet->mpItems[nPos].mnSize;
3536cdf0e10cSrcweir 		else
3537cdf0e10cSrcweir 		{
3538cdf0e10cSrcweir 			((SplitWindow*)this)->ImplCalcLayout();
3539cdf0e10cSrcweir 
3540cdf0e10cSrcweir 			long				nRelSize = 0;
3541cdf0e10cSrcweir 			long				nPerSize = 0;
3542cdf0e10cSrcweir 			ImplSplitItem*		pItems;
3543cdf0e10cSrcweir 			sal_uInt16				nItems;
3544cdf0e10cSrcweir 			SplitWindowItemBits nTempBits;
3545cdf0e10cSrcweir 			sal_uInt16				i;
3546cdf0e10cSrcweir 			nItems = pSet->mnItems;
3547cdf0e10cSrcweir 			pItems = pSet->mpItems;
3548cdf0e10cSrcweir 			for ( i = 0; i < nItems; i++ )
3549cdf0e10cSrcweir 			{
3550cdf0e10cSrcweir 				if ( i == nPos )
3551cdf0e10cSrcweir 					nTempBits = nBits;
3552cdf0e10cSrcweir 				else
3553cdf0e10cSrcweir 					nTempBits = pItems[i].mnBits;
3554cdf0e10cSrcweir 				if ( nTempBits & SWIB_RELATIVESIZE )
3555cdf0e10cSrcweir 					nRelSize += pItems[i].mnPixSize;
3556cdf0e10cSrcweir 				else if ( nTempBits & SWIB_PERCENTSIZE )
3557cdf0e10cSrcweir 					nPerSize += pItems[i].mnPixSize;
3558cdf0e10cSrcweir 			}
3559cdf0e10cSrcweir 			nPerSize += nRelSize;
3560cdf0e10cSrcweir 			if ( nBits & SWIB_RELATIVESIZE )
3561cdf0e10cSrcweir 			{
3562cdf0e10cSrcweir 				if ( nRelSize )
3563cdf0e10cSrcweir 					return (pItems[nPos].mnPixSize+(nRelSize/2))/nRelSize;
3564cdf0e10cSrcweir 				else
3565cdf0e10cSrcweir 					return 1;
3566cdf0e10cSrcweir 			}
3567cdf0e10cSrcweir 			else if ( nBits & SWIB_PERCENTSIZE )
3568cdf0e10cSrcweir 			{
3569cdf0e10cSrcweir 				if ( nPerSize )
3570cdf0e10cSrcweir 					return (pItems[nPos].mnPixSize*100)/nPerSize;
3571cdf0e10cSrcweir 				else
3572cdf0e10cSrcweir 					return 1;
3573cdf0e10cSrcweir 			}
3574cdf0e10cSrcweir 			else
3575cdf0e10cSrcweir 				return pItems[nPos].mnPixSize;
3576cdf0e10cSrcweir 		}
3577cdf0e10cSrcweir 	}
3578cdf0e10cSrcweir 	else
3579cdf0e10cSrcweir 		return 0;
3580cdf0e10cSrcweir }
3581cdf0e10cSrcweir 
3582cdf0e10cSrcweir 
3583cdf0e10cSrcweir 
3584cdf0e10cSrcweir 
SetItemSizeRange(sal_uInt16 nId,const Range aRange)3585cdf0e10cSrcweir void SplitWindow::SetItemSizeRange (sal_uInt16 nId, const Range aRange)
3586cdf0e10cSrcweir {
3587cdf0e10cSrcweir 	sal_uInt16 nPos;
3588789f9e36Smseidel 	ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
3589cdf0e10cSrcweir 
3590cdf0e10cSrcweir 	if (pSet != NULL)
3591789f9e36Smseidel 	{
3592cdf0e10cSrcweir 		pSet->mpItems[nPos].mnMinSize = aRange.Min();
3593cdf0e10cSrcweir 		pSet->mpItems[nPos].mnMaxSize = aRange.Max();
3594789f9e36Smseidel 	}
3595cdf0e10cSrcweir }
3596cdf0e10cSrcweir 
3597cdf0e10cSrcweir 
3598cdf0e10cSrcweir 
3599cdf0e10cSrcweir 
GetItemSizeRange(sal_uInt16 nId) const3600cdf0e10cSrcweir Range SplitWindow::GetItemSizeRange (sal_uInt16 nId) const
3601cdf0e10cSrcweir {
3602cdf0e10cSrcweir 	sal_uInt16 nPos;
3603789f9e36Smseidel 	ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
3604cdf0e10cSrcweir 
3605cdf0e10cSrcweir 	if (pSet != NULL)
3606789f9e36Smseidel 		return Range (pSet->mpItems[nPos].mnMinSize, pSet->mpItems[nPos].mnMaxSize);
3607789f9e36Smseidel 	else
3608789f9e36Smseidel 		return Range(-1,-1);
3609cdf0e10cSrcweir }
3610cdf0e10cSrcweir 
3611cdf0e10cSrcweir 
3612cdf0e10cSrcweir // -----------------------------------------------------------------------
3613cdf0e10cSrcweir 
SetItemBits(sal_uInt16 nId,SplitWindowItemBits nNewBits)3614cdf0e10cSrcweir void SplitWindow::SetItemBits( sal_uInt16 nId, SplitWindowItemBits nNewBits )
3615cdf0e10cSrcweir {
3616cdf0e10cSrcweir 	sal_uInt16			nPos;
3617cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3618cdf0e10cSrcweir 	ImplSplitItem*	pItem;
3619cdf0e10cSrcweir 
3620cdf0e10cSrcweir 	if ( !pSet )
3621cdf0e10cSrcweir 		return;
3622cdf0e10cSrcweir 
3623cdf0e10cSrcweir 	pItem = &(pSet->mpItems[nPos]);
3624cdf0e10cSrcweir 	if ( pItem->mpWindow )
3625cdf0e10cSrcweir 		nNewBits &= ~SWIB_COLSET;
3626cdf0e10cSrcweir 
3627cdf0e10cSrcweir 	if ( pItem->mnBits != nNewBits )
3628cdf0e10cSrcweir 	{
3629cdf0e10cSrcweir 		// Neue Bits setzen und neu durchrechnen
3630cdf0e10cSrcweir 		pItem->mnBits = nNewBits;
3631cdf0e10cSrcweir 		pSet->mbCalcPix = sal_True;
3632cdf0e10cSrcweir 		ImplUpdate();
3633cdf0e10cSrcweir 	}
3634cdf0e10cSrcweir }
3635cdf0e10cSrcweir 
3636cdf0e10cSrcweir // -----------------------------------------------------------------------
3637cdf0e10cSrcweir 
GetItemBits(sal_uInt16 nId) const3638cdf0e10cSrcweir SplitWindowItemBits SplitWindow::GetItemBits( sal_uInt16 nId ) const
3639cdf0e10cSrcweir {
3640cdf0e10cSrcweir 	sal_uInt16			nPos;
3641cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3642cdf0e10cSrcweir 
3643cdf0e10cSrcweir 	if ( pSet )
3644cdf0e10cSrcweir 		return pSet->mpItems[nPos].mnBits;
3645cdf0e10cSrcweir 	else
3646cdf0e10cSrcweir 		return 0;
3647cdf0e10cSrcweir }
3648cdf0e10cSrcweir 
3649cdf0e10cSrcweir // -----------------------------------------------------------------------
3650cdf0e10cSrcweir 
GetItemWindow(sal_uInt16 nId) const3651cdf0e10cSrcweir Window* SplitWindow::GetItemWindow( sal_uInt16 nId ) const
3652cdf0e10cSrcweir {
3653cdf0e10cSrcweir 	sal_uInt16			nPos;
3654cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3655cdf0e10cSrcweir 
3656cdf0e10cSrcweir 	if ( pSet )
3657cdf0e10cSrcweir 		return pSet->mpItems[nPos].mpWindow;
3658cdf0e10cSrcweir 	else
3659cdf0e10cSrcweir 		return NULL;
3660cdf0e10cSrcweir }
3661cdf0e10cSrcweir 
3662cdf0e10cSrcweir // -----------------------------------------------------------------------
3663cdf0e10cSrcweir 
GetSet(sal_uInt16 nId) const3664cdf0e10cSrcweir sal_uInt16 SplitWindow::GetSet( sal_uInt16 nId ) const
3665cdf0e10cSrcweir {
3666cdf0e10cSrcweir 	sal_uInt16			nPos;
3667cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3668cdf0e10cSrcweir 
3669cdf0e10cSrcweir 	if ( pSet )
3670cdf0e10cSrcweir 		return pSet->mnId;
3671cdf0e10cSrcweir 	else
3672cdf0e10cSrcweir 		return 0;
3673cdf0e10cSrcweir }
3674cdf0e10cSrcweir 
3675cdf0e10cSrcweir // -----------------------------------------------------------------------
3676cdf0e10cSrcweir 
GetSet(sal_uInt16 nId,sal_uInt16 & rSetId,sal_uInt16 & rPos) const3677cdf0e10cSrcweir sal_Bool SplitWindow::GetSet( sal_uInt16 nId, sal_uInt16& rSetId, sal_uInt16& rPos ) const
3678cdf0e10cSrcweir {
3679cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, rPos );
3680cdf0e10cSrcweir 	if ( pSet )
3681cdf0e10cSrcweir 	{
3682cdf0e10cSrcweir 		rSetId = pSet->mnId;
3683cdf0e10cSrcweir 		return sal_True;
3684cdf0e10cSrcweir 	}
3685cdf0e10cSrcweir 	else
3686cdf0e10cSrcweir 		return sal_False;
3687cdf0e10cSrcweir }
3688cdf0e10cSrcweir 
3689cdf0e10cSrcweir // -----------------------------------------------------------------------
3690cdf0e10cSrcweir 
IsItemValid(sal_uInt16 nId) const3691cdf0e10cSrcweir sal_Bool SplitWindow::IsItemValid( sal_uInt16 nId ) const
3692cdf0e10cSrcweir {
3693cdf0e10cSrcweir 	sal_uInt16			nPos;
3694cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindItem( mpBaseSet, nId, nPos );
3695cdf0e10cSrcweir 
3696cdf0e10cSrcweir 	if ( pSet )
3697cdf0e10cSrcweir 		return sal_True;
3698cdf0e10cSrcweir 	else
3699cdf0e10cSrcweir 		return sal_False;
3700cdf0e10cSrcweir }
3701cdf0e10cSrcweir 
3702cdf0e10cSrcweir // -----------------------------------------------------------------------
3703cdf0e10cSrcweir 
GetItemId(Window * pWindow) const3704cdf0e10cSrcweir sal_uInt16 SplitWindow::GetItemId( Window* pWindow ) const
3705cdf0e10cSrcweir {
3706cdf0e10cSrcweir 	return ImplFindItem( mpBaseSet, pWindow );
3707cdf0e10cSrcweir }
3708cdf0e10cSrcweir 
3709cdf0e10cSrcweir // -----------------------------------------------------------------------
3710cdf0e10cSrcweir 
GetItemId(const Point & rPos) const3711cdf0e10cSrcweir sal_uInt16 SplitWindow::GetItemId( const Point& rPos ) const
3712cdf0e10cSrcweir {
3713cdf0e10cSrcweir 	return ImplFindItem( mpBaseSet, rPos, mbHorz, !mbBottomRight );
3714cdf0e10cSrcweir }
3715cdf0e10cSrcweir 
3716cdf0e10cSrcweir // -----------------------------------------------------------------------
3717cdf0e10cSrcweir 
GetItemPos(sal_uInt16 nId,sal_uInt16 nSetId) const3718cdf0e10cSrcweir sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const
3719cdf0e10cSrcweir {
3720cdf0e10cSrcweir 	ImplSplitSet*	pSet = ImplFindSet( mpBaseSet, nSetId );
3721cdf0e10cSrcweir 	sal_uInt16			nPos = SPLITWINDOW_ITEM_NOTFOUND;
3722cdf0e10cSrcweir 
3723cdf0e10cSrcweir 	if ( pSet )
3724cdf0e10cSrcweir 	{
3725cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; i < pSet->mnItems; i++ )
3726cdf0e10cSrcweir 		{
3727cdf0e10cSrcweir 			if ( pSet->mpItems[i].mnId == nId )
3728cdf0e10cSrcweir 			{
3729cdf0e10cSrcweir 				nPos = i;
3730cdf0e10cSrcweir 				break;
3731cdf0e10cSrcweir 			}
3732cdf0e10cSrcweir 		}
3733cdf0e10cSrcweir 	}
3734cdf0e10cSrcweir 
3735cdf0e10cSrcweir 	return nPos;
3736cdf0e10cSrcweir }
3737cdf0e10cSrcweir 
3738cdf0e10cSrcweir // -----------------------------------------------------------------------
3739cdf0e10cSrcweir 
GetItemId(sal_uInt16 nPos,sal_uInt16 nSetId) const3740cdf0e10cSrcweir sal_uInt16 SplitWindow::GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId ) const
3741cdf0e10cSrcweir {
3742cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
3743cdf0e10cSrcweir 	if ( pSet && (nPos < pSet->mnItems) )
3744cdf0e10cSrcweir 		return pSet->mpItems[nPos].mnId;
3745cdf0e10cSrcweir 	else
3746cdf0e10cSrcweir 		return 0;
3747cdf0e10cSrcweir }
3748cdf0e10cSrcweir 
3749cdf0e10cSrcweir // -----------------------------------------------------------------------
3750cdf0e10cSrcweir 
GetItemCount(sal_uInt16 nSetId) const3751cdf0e10cSrcweir sal_uInt16 SplitWindow::GetItemCount( sal_uInt16 nSetId ) const
3752cdf0e10cSrcweir {
3753cdf0e10cSrcweir 	ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
3754cdf0e10cSrcweir 	if ( pSet )
3755cdf0e10cSrcweir 		return pSet->mnItems;
3756cdf0e10cSrcweir 	else
3757cdf0e10cSrcweir 		return 0;
3758cdf0e10cSrcweir }
3759cdf0e10cSrcweir 
3760cdf0e10cSrcweir // -----------------------------------------------------------------------
3761cdf0e10cSrcweir 
ImplNewAlign()3762cdf0e10cSrcweir void SplitWindow::ImplNewAlign()
3763cdf0e10cSrcweir {
3764cdf0e10cSrcweir 	if ( mbNoAlign )
3765cdf0e10cSrcweir 	{
3766cdf0e10cSrcweir 		mbHorz		  = sal_False;
3767cdf0e10cSrcweir 		mbBottomRight = sal_False;
3768cdf0e10cSrcweir 	}
3769cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_TOP )
3770cdf0e10cSrcweir 	{
3771cdf0e10cSrcweir 		mbHorz		  = sal_True;
3772cdf0e10cSrcweir 		mbBottomRight = sal_False;
3773cdf0e10cSrcweir 	}
3774cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_BOTTOM )
3775cdf0e10cSrcweir 	{
3776cdf0e10cSrcweir 		mbHorz		  = sal_True;
3777cdf0e10cSrcweir 		mbBottomRight = sal_True;
3778cdf0e10cSrcweir 	}
3779cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_LEFT )
3780cdf0e10cSrcweir 	{
3781cdf0e10cSrcweir 		mbHorz		  = sal_False;
3782cdf0e10cSrcweir 		mbBottomRight = sal_False;
3783cdf0e10cSrcweir 	}
3784cdf0e10cSrcweir 	else if ( meAlign == WINDOWALIGN_RIGHT )
3785cdf0e10cSrcweir 	{
3786cdf0e10cSrcweir 		mbHorz		  = sal_False;
3787cdf0e10cSrcweir 		mbBottomRight = sal_True;
3788cdf0e10cSrcweir 	}
3789cdf0e10cSrcweir 
3790cdf0e10cSrcweir 	if ( mnWinStyle & WB_BORDER )
3791cdf0e10cSrcweir 	{
3792cdf0e10cSrcweir 		ImplCalcBorder( meAlign, mbNoAlign, mnLeftBorder, mnTopBorder,
3793cdf0e10cSrcweir 						mnRightBorder, mnBottomBorder );
3794cdf0e10cSrcweir 	}
3795cdf0e10cSrcweir 
3796cdf0e10cSrcweir 	if ( IsReallyVisible() && IsUpdateMode() )
3797cdf0e10cSrcweir 		Invalidate();
3798cdf0e10cSrcweir 	ImplUpdate();
3799cdf0e10cSrcweir }
3800cdf0e10cSrcweir 
3801cdf0e10cSrcweir // -----------------------------------------------------------------------
3802cdf0e10cSrcweir 
SetNoAlign(sal_Bool bNoAlign)3803cdf0e10cSrcweir void SplitWindow::SetNoAlign( sal_Bool bNoAlign )
3804cdf0e10cSrcweir {
3805cdf0e10cSrcweir 	bNoAlign = bNoAlign != 0;
3806cdf0e10cSrcweir 	if ( mbNoAlign != bNoAlign )
3807cdf0e10cSrcweir 	{
3808cdf0e10cSrcweir 		mbNoAlign = bNoAlign;
3809cdf0e10cSrcweir 		ImplNewAlign();
3810cdf0e10cSrcweir 	}
3811cdf0e10cSrcweir }
3812cdf0e10cSrcweir 
3813cdf0e10cSrcweir // -----------------------------------------------------------------------
3814cdf0e10cSrcweir 
SetAlign(WindowAlign eNewAlign)3815cdf0e10cSrcweir void SplitWindow::SetAlign( WindowAlign eNewAlign )
3816cdf0e10cSrcweir {
3817cdf0e10cSrcweir 	if ( meAlign != eNewAlign )
3818cdf0e10cSrcweir 	{
3819cdf0e10cSrcweir 		meAlign = eNewAlign;
3820cdf0e10cSrcweir 		ImplNewAlign();
3821cdf0e10cSrcweir 	}
3822cdf0e10cSrcweir }
3823cdf0e10cSrcweir 
3824cdf0e10cSrcweir // -----------------------------------------------------------------------
3825cdf0e10cSrcweir 
CalcWindowSizePixel(const Size & rSize,WindowAlign eAlign,WinBits nWinStyle,sal_Bool bExtra)3826cdf0e10cSrcweir Size SplitWindow::CalcWindowSizePixel( const Size& rSize, WindowAlign eAlign,
3827cdf0e10cSrcweir 									   WinBits nWinStyle, sal_Bool bExtra )
3828cdf0e10cSrcweir {
3829cdf0e10cSrcweir 	long	nLeft;
3830cdf0e10cSrcweir 	long	nTop;
3831cdf0e10cSrcweir 	long	nRight;
3832cdf0e10cSrcweir 	long	nBottom;
3833cdf0e10cSrcweir 	Size	aSize = rSize;
3834cdf0e10cSrcweir 
3835cdf0e10cSrcweir 	ImplCalcBorder( eAlign, sal_False, nLeft, nTop, nRight, nBottom );
3836cdf0e10cSrcweir 	aSize.Width()	+= nLeft+nRight;
3837cdf0e10cSrcweir 	aSize.Height()	+= nTop+nBottom;
3838cdf0e10cSrcweir 
3839cdf0e10cSrcweir 	if ( nWinStyle & WB_SIZEABLE )
3840cdf0e10cSrcweir 	{
3841cdf0e10cSrcweir 		if ( (eAlign == WINDOWALIGN_TOP) || (eAlign == WINDOWALIGN_BOTTOM) )
3842cdf0e10cSrcweir 		{
3843cdf0e10cSrcweir 			aSize.Height() += SPLITWIN_SPLITSIZE-2;
3844cdf0e10cSrcweir 			if ( bExtra )
3845cdf0e10cSrcweir 				aSize.Height() += SPLITWIN_SPLITSIZEEXLN;
3846cdf0e10cSrcweir 		}
3847cdf0e10cSrcweir 		else
3848cdf0e10cSrcweir 		{
3849cdf0e10cSrcweir 			aSize.Width() += SPLITWIN_SPLITSIZE-2;
3850cdf0e10cSrcweir 			if ( bExtra )
3851cdf0e10cSrcweir 				aSize.Width() += SPLITWIN_SPLITSIZEEXLN;
3852cdf0e10cSrcweir 		}
3853cdf0e10cSrcweir 	}
3854cdf0e10cSrcweir 
3855cdf0e10cSrcweir 	return aSize;
3856cdf0e10cSrcweir }
3857cdf0e10cSrcweir 
3858cdf0e10cSrcweir // -----------------------------------------------------------------------
3859cdf0e10cSrcweir 
ShowAutoHideButton(sal_Bool bShow)3860cdf0e10cSrcweir void SplitWindow::ShowAutoHideButton( sal_Bool bShow )
3861cdf0e10cSrcweir {
3862cdf0e10cSrcweir 	mbAutoHide = bShow;
3863cdf0e10cSrcweir 	ImplUpdate();
3864cdf0e10cSrcweir }
3865cdf0e10cSrcweir 
3866cdf0e10cSrcweir // -----------------------------------------------------------------------
3867cdf0e10cSrcweir 
ShowFadeInHideButton(sal_Bool bShow)3868cdf0e10cSrcweir void SplitWindow::ShowFadeInHideButton( sal_Bool bShow )
3869cdf0e10cSrcweir {
3870cdf0e10cSrcweir 	mbFadeIn = bShow;
3871cdf0e10cSrcweir 	ImplUpdate();
3872cdf0e10cSrcweir }
3873cdf0e10cSrcweir 
3874cdf0e10cSrcweir // -----------------------------------------------------------------------
3875cdf0e10cSrcweir 
ShowFadeOutButton(sal_Bool bShow)3876cdf0e10cSrcweir void SplitWindow::ShowFadeOutButton( sal_Bool bShow )
3877cdf0e10cSrcweir {
3878cdf0e10cSrcweir 	mbFadeOut = bShow;
3879cdf0e10cSrcweir 	ImplUpdate();
3880cdf0e10cSrcweir }
3881cdf0e10cSrcweir 
3882cdf0e10cSrcweir // -----------------------------------------------------------------------
3883cdf0e10cSrcweir 
SetAutoHideState(sal_Bool bAutoHide)3884cdf0e10cSrcweir void SplitWindow::SetAutoHideState( sal_Bool bAutoHide )
3885cdf0e10cSrcweir {
3886cdf0e10cSrcweir 	mbAutoHideIn = bAutoHide;
3887cdf0e10cSrcweir 	if ( IsReallyVisible() )
3888cdf0e10cSrcweir 	{
3889cdf0e10cSrcweir 		Rectangle aRect;
3890cdf0e10cSrcweir 		ImplGetAutoHideRect( aRect );
3891cdf0e10cSrcweir 		Invalidate( aRect );
3892cdf0e10cSrcweir 	}
3893cdf0e10cSrcweir }
3894cdf0e10cSrcweir 
3895cdf0e10cSrcweir // -----------------------------------------------------------------------
3896cdf0e10cSrcweir 
GetFadeInSize() const3897cdf0e10cSrcweir long SplitWindow::GetFadeInSize() const
3898cdf0e10cSrcweir {
3899cdf0e10cSrcweir 	long n = 0;
3900cdf0e10cSrcweir 
3901cdf0e10cSrcweir 	if ( mbHorz )
3902cdf0e10cSrcweir 		n = mnTopBorder+mnBottomBorder;
3903cdf0e10cSrcweir 	else
3904cdf0e10cSrcweir 		n = mnLeftBorder+mnRightBorder;
3905cdf0e10cSrcweir 
3906cdf0e10cSrcweir 	return n+SPLITWIN_SPLITSIZE+SPLITWIN_SPLITSIZEEX-2;
3907cdf0e10cSrcweir }
3908cdf0e10cSrcweir 
3909cdf0e10cSrcweir // -----------------------------------------------------------------------
3910cdf0e10cSrcweir 
GetAutoHideRect() const3911cdf0e10cSrcweir Rectangle SplitWindow::GetAutoHideRect() const
3912cdf0e10cSrcweir {
3913cdf0e10cSrcweir 	Rectangle aRect;
3914cdf0e10cSrcweir 	ImplGetAutoHideRect( aRect, sal_True );
3915cdf0e10cSrcweir 	return aRect;
3916cdf0e10cSrcweir }
3917cdf0e10cSrcweir 
3918cdf0e10cSrcweir // -----------------------------------------------------------------------
3919cdf0e10cSrcweir 
GetFadeInRect() const3920cdf0e10cSrcweir Rectangle SplitWindow::GetFadeInRect() const
3921cdf0e10cSrcweir {
3922cdf0e10cSrcweir 	Rectangle aRect;
3923cdf0e10cSrcweir 	ImplGetFadeInRect( aRect, sal_True );
3924cdf0e10cSrcweir 	return aRect;
3925cdf0e10cSrcweir }
3926cdf0e10cSrcweir 
3927cdf0e10cSrcweir // -----------------------------------------------------------------------
3928cdf0e10cSrcweir 
GetFadeOutRect() const3929cdf0e10cSrcweir Rectangle SplitWindow::GetFadeOutRect() const
3930cdf0e10cSrcweir {
3931cdf0e10cSrcweir 	Rectangle aRect;
3932cdf0e10cSrcweir 	ImplGetFadeOutRect( aRect, sal_True );
3933cdf0e10cSrcweir 	return aRect;
3934cdf0e10cSrcweir }
3935