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