1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <tools/debug.hxx>
24 #include <tools/rcid.h>
25 #include <tools/solar.h>
27 #include <vcl/event.hxx>
28 #include <vcl/wall.hxx>
29 #include <vcl/bitmap.hxx>
30 #include <vcl/decoview.hxx>
31 #include <vcl/image.hxx>
32 #include <vcl/help.hxx>
33 #include <vcl/splitwin.hxx>
35 #include <rsc/rsc-vcl-shared-types.hxx>
40 // =======================================================================
42 // Attention: Must not contain non-PODs because array is enlarged/copied
43 // with the use of memmove/memcpy.
62 SplitWindowItemBits mnBits
;
65 /// Minimal width or height of the item. -1 means no restriction.
67 /// Maximal width or height of the item. -1 means no restriction.
73 ImplSplitItem
* mpItems
;
74 Wallpaper
* mpWallpaper
;
85 /** Check whether the given size is inside the valid range defined by
86 [rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return
87 the upper or lower bound, respectively. Otherwise return the given size
89 Note that either mnMinSize and/or mnMaxSize can be -1 in which case the
90 size has not lower or upper bound.
93 long ValidateSize (const long nSize
, const ImplSplitItem
&rItem
)
95 if (rItem
.mnMinSize
>=0 && nSize
<rItem
.mnMinSize
)
96 return rItem
.mnMinSize
;
97 else if (rItem
.mnMaxSize
>0 && nSize
>rItem
.mnMaxSize
)
98 return rItem
.mnMaxSize
;
105 #define SPLITWIN_SPLITSIZE 3
106 #define SPLITWIN_SPLITSIZEEX 4
107 #define SPLITWIN_SPLITSIZEEXLN 6
108 #define SPLITWIN_SPLITSIZEAUTOHIDE 36
109 #define SPLITWIN_SPLITSIZEFADE 36
111 #define SPLIT_HORZ ((sal_uInt16)0x0001)
112 #define SPLIT_VERT ((sal_uInt16)0x0002)
113 #define SPLIT_WINDOW ((sal_uInt16)0x0004)
114 #define SPLIT_NOSPLIT ((sal_uInt16)0x8000)
116 // =======================================================================
118 static void ImplCalcBorder( WindowAlign eAlign
, sal_Bool bNoAlign
,
119 long& rLeft
, long& rTop
,
120 long& rRight
, long& rBottom
)
133 case WINDOWALIGN_TOP
:
139 case WINDOWALIGN_LEFT
:
145 case WINDOWALIGN_BOTTOM
:
161 // -----------------------------------------------------------------------
163 void SplitWindow::ImplDrawBorder( SplitWindow
* pWin
)
165 const StyleSettings
& rStyleSettings
= pWin
->GetSettings().GetStyleSettings();
166 long nDX
= pWin
->mnDX
;
167 long nDY
= pWin
->mnDY
;
169 if ( pWin
->mbNoAlign
)
171 DecorationView
aDecoView( pWin
);
173 Rectangle
aRect( aTmpPoint
, Size( nDX
, nDY
) );
174 aDecoView
.DrawFrame( aRect
, FRAME_DRAW_DOUBLEIN
);
178 switch ( pWin
->meAlign
)
180 case WINDOWALIGN_BOTTOM
:
181 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
182 pWin
->DrawLine( Point( 0, 0 ), Point( nDX
-1, 0 ) );
183 pWin
->DrawLine( Point( 0, nDY
-2 ), Point( nDX
-1, nDY
-2 ) );
185 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
186 pWin
->DrawLine( Point( 0, 1 ), Point( nDX
-1, 1 ) );
187 pWin
->DrawLine( Point( 0, nDY
-1 ), Point( nDX
-1, nDY
-1 ) );
189 case WINDOWALIGN_TOP
:
190 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
191 pWin
->DrawLine( Point( 0, nDY
-2 ), Point( nDX
-1, nDY
-2 ) );
192 pWin
->DrawLine( Point( 0, 0 ), Point( nDX
-1, 0 ) );
194 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
195 pWin
->DrawLine( Point( 0, nDY
-1 ), Point( nDX
-1, nDY
-1 ) );
196 pWin
->DrawLine( Point( 0, 1 ), Point( nDX
-1, 1 ) );
198 case WINDOWALIGN_LEFT
:
199 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
200 pWin
->DrawLine( Point( nDX
-2, 0 ), Point( nDX
-2, nDY
-2 ) );
201 pWin
->DrawLine( Point( 0, 0 ), Point( nDX
-1, 0 ) );
202 pWin
->DrawLine( Point( 0, nDY
-2 ), Point( nDX
-2, nDY
-2 ) );
204 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
205 pWin
->DrawLine( Point( nDX
-1, 0 ), Point( nDX
-1, nDY
-1 ) );
206 pWin
->DrawLine( Point( 0, 1 ), Point( nDX
-3, 1 ) );
207 pWin
->DrawLine( Point( 0, nDY
-1 ), Point( nDX
-2, nDY
-1 ) );
210 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
211 pWin
->DrawLine( Point( 0, 0 ), Point( 0, nDY
-2 ) );
212 pWin
->DrawLine( Point( 0, 0 ), Point( nDX
-1, 0 ) );
213 pWin
->DrawLine( Point( 0, nDY
-2 ), Point( nDX
-1, nDY
-2 ) );
215 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
216 pWin
->DrawLine( Point( 1, 1 ), Point( 1, nDY
-3 ) );
217 pWin
->DrawLine( Point( 1, 1 ), Point( nDX
-1, 1 ) );
218 pWin
->DrawLine( Point( 0, nDY
-1 ), Point( nDX
-1, nDY
-1 ) );
223 // -----------------------------------------------------------------------
225 void SplitWindow::ImplDrawBorderLine( SplitWindow
* pWin
)
227 if ( pWin
->mbFadeOut
|| pWin
->mbAutoHide
)
229 const StyleSettings
& rStyleSettings
= pWin
->GetSettings().GetStyleSettings();
230 long nDX
= pWin
->mnDX
;
231 long nDY
= pWin
->mnDY
;
233 switch ( pWin
->meAlign
)
235 case WINDOWALIGN_LEFT
:
236 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
237 pWin
->DrawLine( Point( nDX
-SPLITWIN_SPLITSIZEEXLN
-1, 1 ), Point( nDX
-SPLITWIN_SPLITSIZEEXLN
-1, nDY
-2 ) );
239 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
240 pWin
->DrawLine( Point( nDX
-SPLITWIN_SPLITSIZEEXLN
, 1 ), Point( nDX
-SPLITWIN_SPLITSIZEEXLN
, nDY
-3 ) );
242 case WINDOWALIGN_RIGHT
:
243 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
244 pWin
->DrawLine( Point( SPLITWIN_SPLITSIZEEXLN
-1, 0 ), Point( SPLITWIN_SPLITSIZEEXLN
-1, nDY
-2 ) );
246 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
247 pWin
->DrawLine( Point( SPLITWIN_SPLITSIZEEXLN
, 1 ), Point( SPLITWIN_SPLITSIZEEXLN
, nDY
-3 ) );
249 case WINDOWALIGN_TOP
:
250 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
251 pWin
->DrawLine( Point( 0, nDY
-SPLITWIN_SPLITSIZEEXLN
-1 ), Point( nDX
-1, nDY
-SPLITWIN_SPLITSIZEEXLN
-1 ) );
253 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
254 pWin
->DrawLine( Point( 0, nDY
-SPLITWIN_SPLITSIZEEXLN
), Point( nDX
-1, nDY
-SPLITWIN_SPLITSIZEEXLN
) );
256 case WINDOWALIGN_BOTTOM
:
257 pWin
->SetLineColor( rStyleSettings
.GetShadowColor() );
258 pWin
->DrawLine( Point( 0, 5 ), Point( nDX
-1, 5 ) );
260 pWin
->SetLineColor( rStyleSettings
.GetLightColor() );
261 pWin
->DrawLine( Point( 0, SPLITWIN_SPLITSIZEEXLN
), Point( nDX
-1, SPLITWIN_SPLITSIZEEXLN
) );
267 // -----------------------------------------------------------------------
269 static ImplSplitSet
* ImplFindSet( ImplSplitSet
* pSet
, sal_uInt16 nId
)
271 if ( pSet
->mnId
== nId
)
275 sal_uInt16 nItems
= pSet
->mnItems
;
276 ImplSplitItem
* pItems
= pSet
->mpItems
;
278 for ( i
= 0; i
< nItems
; i
++ )
280 if ( pItems
[i
].mnId
== nId
)
281 return pItems
[i
].mpSet
;
284 for ( i
= 0; i
< nItems
; i
++ )
286 if ( pItems
[i
].mpSet
)
288 ImplSplitSet
* pFindSet
= ImplFindSet( pItems
[i
].mpSet
, nId
);
297 // -----------------------------------------------------------------------
299 static ImplSplitSet
* ImplFindItem( ImplSplitSet
* pSet
, sal_uInt16 nId
, sal_uInt16
& rPos
)
302 sal_uInt16 nItems
= pSet
->mnItems
;
303 ImplSplitItem
* pItems
= pSet
->mpItems
;
305 for ( i
= 0; i
< nItems
; i
++ )
307 if ( pItems
[i
].mnId
== nId
)
314 for ( i
= 0; i
< nItems
; i
++ )
316 if ( pItems
[i
].mpSet
)
318 ImplSplitSet
* pFindSet
= ImplFindItem( pItems
[i
].mpSet
, nId
, rPos
);
327 // -----------------------------------------------------------------------
329 static sal_uInt16
ImplFindItem( ImplSplitSet
* pSet
, Window
* pWindow
)
332 sal_uInt16 nItems
= pSet
->mnItems
;
333 ImplSplitItem
* pItems
= pSet
->mpItems
;
335 for ( i
= 0; i
< nItems
; i
++ )
337 if ( pItems
[i
].mpWindow
== pWindow
)
338 return pItems
[i
].mnId
;
341 if ( pItems
[i
].mpSet
)
343 sal_uInt16 nId
= ImplFindItem( pItems
[i
].mpSet
, pWindow
);
353 // -----------------------------------------------------------------------
355 static sal_uInt16
ImplFindItem( ImplSplitSet
* pSet
, const Point
& rPos
,
356 sal_Bool bRows
, sal_Bool bDown
= sal_True
)
359 sal_uInt16 nItems
= pSet
->mnItems
;
360 ImplSplitItem
* pItems
= pSet
->mpItems
;
362 for ( i
= 0; i
< nItems
; i
++ )
364 if ( pItems
[i
].mnWidth
&& pItems
[i
].mnHeight
)
366 // Wegen ICC auftrennen
367 Point
aPoint( pItems
[i
].mnLeft
, pItems
[i
].mnTop
);
368 Size
aSize( pItems
[i
].mnWidth
, pItems
[i
].mnHeight
);
369 Rectangle
aRect( aPoint
, aSize
);
373 aRect
.Bottom() += pSet
->mnSplitSize
;
375 aRect
.Top() -= pSet
->mnSplitSize
;
380 aRect
.Right() += pSet
->mnSplitSize
;
382 aRect
.Left() -= pSet
->mnSplitSize
;
385 if ( aRect
.IsInside( rPos
) )
387 if ( pItems
[i
].mpSet
&& pItems
[i
].mpSet
->mpItems
)
389 return ImplFindItem( pItems
[i
].mpSet
, rPos
,
390 ((pItems
[i
].mnBits
& SWIB_COLSET
) == 0) );
393 return pItems
[i
].mnId
;
401 // -----------------------------------------------------------------------
403 static void ImplDeleteSet( ImplSplitSet
* pSet
)
406 sal_uInt16 nItems
= pSet
->mnItems
;
407 ImplSplitItem
* pItems
= pSet
->mpItems
;
409 for ( i
= 0; i
< nItems
; i
++ )
411 if ( pItems
[i
].mpSet
)
412 ImplDeleteSet( pItems
[i
].mpSet
);
415 if ( pSet
->mpWallpaper
)
416 delete pSet
->mpWallpaper
;
418 if ( pSet
->mpBitmap
)
419 delete pSet
->mpBitmap
;
425 // -----------------------------------------------------------------------
427 static void ImplCalcSet( ImplSplitSet
* pSet
,
428 long nSetLeft
, long nSetTop
,
429 long nSetWidth
, long nSetHeight
,
430 sal_Bool bRows
, sal_Bool bDown
= sal_True
)
432 if ( !pSet
->mpItems
)
438 sal_uInt16 nCalcItems
;
439 sal_uInt16 nItems
= pSet
->mnItems
;
440 sal_uInt16 nVisItems
;
441 sal_uInt16 nAbsItems
;
446 long nNewSizeWinSize
;
454 ImplSplitItem
* pItems
= pSet
->mpItems
;
457 // Anzahl sichtbarer Items ermitteln
459 for ( i
= 0; i
< nItems
; i
++ )
461 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
465 // Groessen berechnen
467 nCalcSize
= nSetHeight
;
469 nCalcSize
= nSetWidth
;
470 nCalcSize
-= (nVisItems
-1)*pSet
->mnSplitSize
;
472 if ( pSet
->mbCalcPix
|| (pSet
->mnLastSize
!= nCalcSize
) )
474 long nPercentFactor
= 10;
477 long nRelPercent
= 0;
479 for ( i
= 0; i
< nItems
; i
++ )
481 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
483 if ( pItems
[i
].mnBits
& SWIB_RELATIVESIZE
)
484 nRelCount
+= pItems
[i
].mnSize
;
485 else if ( pItems
[i
].mnBits
& SWIB_PERCENTSIZE
)
486 nPercent
+= pItems
[i
].mnSize
;
488 nAbsSize
+= pItems
[i
].mnSize
;
491 // Relative-Werte auf prozentual mappen (Percent bei uns 10tel Prozent)
492 nPercent
*= nPercentFactor
;
495 long nRelPercentBase
= 1000;
496 while ( (nRelCount
> nRelPercentBase
) && (nPercentFactor
< 100000) )
498 nRelPercentBase
*= 10;
499 nPercentFactor
*= 10;
501 if ( nPercent
< nRelPercentBase
)
503 nRelPercent
= (nRelPercentBase
-nPercent
)/nRelCount
;
504 nPercent
+= nRelPercent
*nRelCount
;
511 nSizeDelta
= nCalcSize
-nAbsSize
;
512 for ( i
= 0; i
< nItems
; i
++ )
514 if ( pItems
[i
].mnBits
& SWIB_INVISIBLE
)
515 pItems
[i
].mnPixSize
= 0;
516 else if ( pItems
[i
].mnBits
& SWIB_RELATIVESIZE
)
518 if ( nSizeDelta
<= 0 )
519 pItems
[i
].mnPixSize
= 0;
521 pItems
[i
].mnPixSize
= (nSizeDelta
*pItems
[i
].mnSize
*nRelPercent
)/nPercent
;
523 else if ( pItems
[i
].mnBits
& SWIB_PERCENTSIZE
)
525 if ( nSizeDelta
<= 0 )
526 pItems
[i
].mnPixSize
= 0;
528 pItems
[i
].mnPixSize
= (nSizeDelta
*pItems
[i
].mnSize
*nPercentFactor
)/nPercent
;
531 pItems
[i
].mnPixSize
= pItems
[i
].mnSize
;
532 nCurSize
+= pItems
[i
].mnPixSize
;
535 pSet
->mbCalcPix
= sal_False
;
536 pSet
->mnLastSize
= nCalcSize
;
539 nSizeDelta
= nCalcSize
-nCurSize
;
546 // Zuerst die absoluten Items relativ resizen
547 for ( i
= 0; i
< nItems
; i
++ )
549 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
551 if ( !(pItems
[i
].mnBits
& (SWIB_RELATIVESIZE
| SWIB_PERCENTSIZE
)) )
554 nSizeWinSize
+= pItems
[i
].mnPixSize
;
558 // Rundungsfehler werden hier nicht ausgelichen
559 if ( (nAbsItems
< (sal_uInt16
)(std::abs( nSizeDelta
))) && nSizeWinSize
)
561 for ( i
= 0; i
< nItems
; i
++ )
563 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
565 if ( !(pItems
[i
].mnBits
& (SWIB_RELATIVESIZE
| SWIB_PERCENTSIZE
)) )
567 pItems
[i
].mnPixSize
+= (nSizeDelta
*pItems
[i
].mnPixSize
)/nSizeWinSize
;
568 nNewSizeWinSize
+= pItems
[i
].mnPixSize
;
572 nSizeDelta
-= nNewSizeWinSize
-nSizeWinSize
;
575 // Jetzt die Rundunsfehler ausgleichen
578 while ( nSizeDelta
&& (nItems
!= nMins
) )
580 // Feststellen, welche Items berechnet werden duerfen
582 while ( !nCalcItems
)
584 for ( i
= 0; i
< nItems
; i
++ )
586 pItems
[i
].mbSubSize
= sal_False
;
589 pItems
[i
].mbSubSize
= sal_True
;
592 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
594 if ( (nSizeDelta
> 0) || pItems
[i
].mnPixSize
)
597 pItems
[i
].mbSubSize
= sal_True
;
600 if ( (j
== 0) && (pItems
[i
].mnBits
& (SWIB_RELATIVESIZE
| SWIB_PERCENTSIZE
)) )
601 pItems
[i
].mbSubSize
= sal_True
;
607 if ( pItems
[i
].mbSubSize
)
614 // Groessen von den einzelnen Items abziehen
615 nErrorSum
= nSizeDelta
% nCalcItems
;
616 nCurSizeDelta
= nSizeDelta
/ nCalcItems
;
618 for ( i
= 0; i
< nItems
; i
++ )
620 if ( pItems
[i
].mnBits
& SWIB_INVISIBLE
)
622 else if ( pItems
[i
].mbSubSize
)
624 pSize
= &(pItems
[i
].mnPixSize
);
636 if ( (*pSize
+nCurSizeDelta
+nTempErr
) <= 0 )
648 *pSize
+= nCurSizeDelta
;
649 nSizeDelta
-= nCurSizeDelta
;
650 if ( nTempErr
&& (*pSize
|| (nTempErr
> 0)) )
653 nSizeDelta
-= nTempErr
;
654 nErrorSum
-= nTempErr
;
664 for ( i
= 0; i
< nItems
; i
++ )
666 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
667 nCurSize
+= pItems
[i
].mnPixSize
;
671 // Maximale Groesse berechnen
676 nMaxPos
= nSetTop
-nSetHeight
;
678 nMaxPos
= nSetTop
+nSetHeight
;
684 nMaxPos
= nSetLeft
-nSetWidth
;
686 nMaxPos
= nSetLeft
+nSetWidth
;
689 // Fenster anordnen und Werte anpassen
690 for ( i
= 0; i
< nItems
; i
++ )
692 pItems
[i
].mnOldSplitPos
= pItems
[i
].mnSplitPos
;
693 pItems
[i
].mnOldSplitSize
= pItems
[i
].mnSplitSize
;
694 pItems
[i
].mnOldWidth
= pItems
[i
].mnWidth
;
695 pItems
[i
].mnOldHeight
= pItems
[i
].mnHeight
;
697 if ( pItems
[i
].mnBits
& SWIB_INVISIBLE
)
704 if ( nPos
+pItems
[i
].mnPixSize
> nMaxPos
)
709 nPos
-= pItems
[i
].mnPixSize
;
710 if ( nPos
< nMaxPos
)
717 pItems
[i
].mnWidth
= 0;
718 pItems
[i
].mnHeight
= 0;
719 pItems
[i
].mnSplitSize
= 0;
725 pItems
[i
].mnLeft
= nSetLeft
;
726 pItems
[i
].mnTop
= nPos
;
727 pItems
[i
].mnWidth
= nSetWidth
;
728 pItems
[i
].mnHeight
= pItems
[i
].mnPixSize
;
732 pItems
[i
].mnLeft
= nPos
;
733 pItems
[i
].mnTop
= nSetTop
;
734 pItems
[i
].mnWidth
= pItems
[i
].mnPixSize
;
735 pItems
[i
].mnHeight
= nSetHeight
;
739 pItems
[i
].mnSplitSize
= 0;
742 pItems
[i
].mnSplitSize
= pSet
->mnSplitSize
;
745 pItems
[i
].mnSplitPos
= nPos
+pItems
[i
].mnPixSize
;
746 if ( pItems
[i
].mnSplitPos
+pItems
[i
].mnSplitSize
> nMaxPos
)
747 pItems
[i
].mnSplitSize
= nMaxPos
-pItems
[i
].mnSplitPos
;
751 pItems
[i
].mnSplitPos
= nPos
-pSet
->mnSplitSize
;
752 if ( pItems
[i
].mnSplitPos
< nMaxPos
)
753 pItems
[i
].mnSplitSize
= pItems
[i
].mnSplitPos
+pSet
->mnSplitSize
-nMaxPos
;
758 if ( !(pItems
[i
].mnBits
& SWIB_INVISIBLE
) )
761 nPos
-= pSet
->mnSplitSize
;
763 nPos
+= pItems
[i
].mnPixSize
+pSet
->mnSplitSize
;
767 // Sub-Set's berechnen
768 for ( i
= 0; i
< nItems
; i
++ )
770 if ( pItems
[i
].mpSet
&& pItems
[i
].mnWidth
&& pItems
[i
].mnHeight
)
772 ImplCalcSet( pItems
[i
].mpSet
,
773 pItems
[i
].mnLeft
, pItems
[i
].mnTop
,
774 pItems
[i
].mnWidth
, pItems
[i
].mnHeight
,
775 ((pItems
[i
].mnBits
& SWIB_COLSET
) == 0) );
780 for ( i
= 0; i
< nItems
; i
++ )
782 pItems
[i
].mbFixed
= sal_False
;
783 if ( pItems
[i
].mnBits
& SWIB_FIXED
)
784 pItems
[i
].mbFixed
= sal_True
;
787 // Wenn Child-Set vorhanden, ist dieses Item auch Fixed, wenn
788 // ein Child fixed ist
789 if ( pItems
[i
].mpSet
)
791 for ( j
= 0; j
< pItems
[i
].mpSet
->mnItems
; j
++ )
793 if ( pItems
[i
].mpSet
->mpItems
[j
].mbFixed
)
795 pItems
[i
].mbFixed
= sal_True
;
804 // -----------------------------------------------------------------------
806 void SplitWindow::ImplCalcSet2( SplitWindow
* pWindow
, ImplSplitSet
* pSet
, sal_Bool bHide
,
807 sal_Bool bRows
, sal_Bool
/*bDown*/ )
810 sal_uInt16 nItems
= pSet
->mnItems
;
811 ImplSplitItem
* pItems
= pSet
->mpItems
;
813 if ( pWindow
->IsReallyVisible() && pWindow
->IsUpdateMode() && pWindow
->mbInvalidate
)
815 for ( i
= 0; i
< nItems
; i
++ )
817 if ( pItems
[i
].mnSplitSize
)
819 // Evt. alles invalidieren oder nur einen kleinen Teil
820 if ( (pItems
[i
].mnOldSplitPos
!= pItems
[i
].mnSplitPos
) ||
821 (pItems
[i
].mnOldSplitSize
!= pItems
[i
].mnSplitSize
) ||
822 (pItems
[i
].mnOldWidth
!= pItems
[i
].mnWidth
) ||
823 (pItems
[i
].mnOldHeight
!= pItems
[i
].mnHeight
) )
827 // Old Rect invalidieren
830 aRect
.Left() = pItems
[i
].mnLeft
;
831 aRect
.Right() = pItems
[i
].mnLeft
+pItems
[i
].mnOldWidth
-1;
832 aRect
.Top() = pItems
[i
].mnOldSplitPos
;
833 aRect
.Bottom() = aRect
.Top() + pItems
[i
].mnOldSplitSize
;
837 aRect
.Top() = pItems
[i
].mnTop
;
838 aRect
.Bottom() = pItems
[i
].mnTop
+pItems
[i
].mnOldHeight
-1;
839 aRect
.Left() = pItems
[i
].mnOldSplitPos
;
840 aRect
.Right() = aRect
.Left() + pItems
[i
].mnOldSplitSize
;
842 pWindow
->Invalidate( aRect
);
843 // New Rect invalidieren
846 aRect
.Left() = pItems
[i
].mnLeft
;
847 aRect
.Right() = pItems
[i
].mnLeft
+pItems
[i
].mnWidth
-1;
848 aRect
.Top() = pItems
[i
].mnSplitPos
;
849 aRect
.Bottom() = aRect
.Top() + pItems
[i
].mnSplitSize
;
853 aRect
.Top() = pItems
[i
].mnTop
;
854 aRect
.Bottom() = pItems
[i
].mnTop
+pItems
[i
].mnHeight
-1;
855 aRect
.Left() = pItems
[i
].mnSplitPos
;
856 aRect
.Right() = aRect
.Left() + pItems
[i
].mnSplitSize
;
858 pWindow
->Invalidate( aRect
);
860 // Leere Sets komplett invalidieren, da diese Flaechen
861 // nicht von Fenstern ueberladen werden
862 if ( pItems
[i
].mpSet
&& !pItems
[i
].mpSet
->mpItems
)
864 aRect
.Left() = pItems
[i
].mnLeft
;
865 aRect
.Top() = pItems
[i
].mnTop
;
866 aRect
.Right() = pItems
[i
].mnLeft
+pItems
[i
].mnWidth
-1;
867 aRect
.Bottom() = pItems
[i
].mnTop
+pItems
[i
].mnHeight
-1;
868 pWindow
->Invalidate( aRect
);
875 // Fenster positionieren
876 for ( i
= 0; i
< nItems
; i
++ )
878 if ( pItems
[i
].mpSet
)
880 sal_Bool bTempHide
= bHide
;
881 if ( !pItems
[i
].mnWidth
|| !pItems
[i
].mnHeight
)
882 bTempHide
= sal_True
;
883 ImplCalcSet2( pWindow
, pItems
[i
].mpSet
, bTempHide
,
884 ((pItems
[i
].mnBits
& SWIB_COLSET
) == 0) );
888 if ( pItems
[i
].mnWidth
&& pItems
[i
].mnHeight
&& !bHide
)
890 Point
aPos( pItems
[i
].mnLeft
, pItems
[i
].mnTop
);
891 Size
aSize( pItems
[i
].mnWidth
, pItems
[i
].mnHeight
);
892 pItems
[i
].mpWindow
->SetPosSizePixel( aPos
, aSize
);
895 pItems
[i
].mpWindow
->Hide();
899 // Fenster anzeigen und Flag zuruecksetzen
900 for ( i
= 0; i
< nItems
; i
++ )
902 if ( pItems
[i
].mpWindow
&& pItems
[i
].mnWidth
&& pItems
[i
].mnHeight
&& !bHide
)
903 pItems
[i
].mpWindow
->Show();
907 // -----------------------------------------------------------------------
909 static void ImplCalcLogSize( ImplSplitItem
* pItems
, sal_uInt16 nItems
)
911 // Original-Groessen updaten
915 for ( i
= 0; i
< nItems
; i
++ )
917 if ( pItems
[i
].mnBits
& SWIB_RELATIVESIZE
)
918 nRelSize
+= pItems
[i
].mnPixSize
;
919 else if ( pItems
[i
].mnBits
& SWIB_PERCENTSIZE
)
920 nPerSize
+= pItems
[i
].mnPixSize
;
922 nPerSize
+= nRelSize
;
923 for ( i
= 0; i
< nItems
; i
++ )
925 if ( pItems
[i
].mnBits
& SWIB_RELATIVESIZE
)
928 pItems
[i
].mnSize
= (pItems
[i
].mnPixSize
+(nRelSize
/2))/nRelSize
;
930 pItems
[i
].mnSize
= 1;
932 else if ( pItems
[i
].mnBits
& SWIB_PERCENTSIZE
)
935 pItems
[i
].mnSize
= (pItems
[i
].mnPixSize
*100)/nPerSize
;
937 pItems
[i
].mnSize
= 1;
940 pItems
[i
].mnSize
= pItems
[i
].mnPixSize
;
944 // -----------------------------------------------------------------------
946 void SplitWindow::ImplDrawBack( SplitWindow
* pWindow
, const Rectangle
& rRect
,
947 const Wallpaper
* pWall
, const Bitmap
* pBitmap
)
951 Point aPos
= rRect
.TopLeft();
952 Size aBmpSize
= pBitmap
->GetSizePixel();
953 pWindow
->Push( PUSH_CLIPREGION
);
954 pWindow
->IntersectClipRegion( rRect
);
957 aPos
.X() = rRect
.Left();
960 pWindow
->DrawBitmap( aPos
, *pBitmap
);
961 aPos
.X() += aBmpSize
.Width();
963 while ( aPos
.X() < rRect
.Right() );
964 aPos
.Y() += aBmpSize
.Height();
966 while ( aPos
.Y() < rRect
.Bottom() );
970 pWindow
->DrawWallpaper( rRect
, *pWall
);
973 // -----------------------------------------------------------------------
975 void SplitWindow::ImplDrawBack( SplitWindow
* pWindow
, ImplSplitSet
* pSet
)
978 sal_uInt16 nItems
= pSet
->mnItems
;
979 ImplSplitItem
* pItems
= pSet
->mpItems
;
981 // Beim Mainset auch den Hintergrund zeichnen
982 if ( pSet
->mnId
== 0 )
984 if ( pSet
->mpBitmap
)
986 Rectangle
aRect( pWindow
->mnLeftBorder
,
987 pWindow
->mnTopBorder
,
988 pWindow
->mnDX
-pWindow
->mnRightBorder
-1,
989 pWindow
->mnDY
-pWindow
->mnBottomBorder
-1 );
990 ImplDrawBack( pWindow
, aRect
, pSet
->mpWallpaper
, pSet
->mpBitmap
);
994 for ( i
= 0; i
< nItems
; i
++ )
996 pSet
= pItems
[i
].mpSet
;
999 if ( pSet
->mpBitmap
|| pSet
->mpWallpaper
)
1001 // Wegen ICC auftrennen
1002 Point
aPoint( pItems
[i
].mnLeft
, pItems
[i
].mnTop
);
1003 Size
aSize( pItems
[i
].mnWidth
, pItems
[i
].mnHeight
);
1004 Rectangle
aRect( aPoint
, aSize
);
1005 ImplDrawBack( pWindow
, aRect
, pSet
->mpWallpaper
, pSet
->mpBitmap
);
1010 for ( i
= 0; i
< nItems
; i
++ )
1012 if ( pItems
[i
].mpSet
)
1013 ImplDrawBack( pWindow
, pItems
[i
].mpSet
);
1017 // -----------------------------------------------------------------------
1019 static void ImplDrawSplit( SplitWindow
* pWindow
, ImplSplitSet
* pSet
,
1020 sal_Bool bRows
, sal_Bool bDown
= sal_True
)
1022 if ( !pSet
->mpItems
)
1026 sal_uInt16 nItems
= pSet
->mnItems
;
1030 ImplSplitItem
* pItems
= pSet
->mpItems
;
1031 const StyleSettings
& rStyleSettings
= pWindow
->GetSettings().GetStyleSettings();
1033 sal_Bool bFlat
= (pWindow
->GetStyle() & WB_FLATSPLITDRAW
) == WB_FLATSPLITDRAW
;
1035 for ( i
= 0; i
< nItems
-1; i
++ )
1037 if ( pItems
[i
].mnSplitSize
)
1039 nPos
= pItems
[i
].mnSplitPos
;
1041 long nItemSplitSize
= pItems
[i
].mnSplitSize
;
1042 long nSplitSize
= pSet
->mnSplitSize
;
1045 nTop
= pItems
[i
].mnLeft
;
1046 nBottom
= pItems
[i
].mnLeft
+pItems
[i
].mnWidth
-1;
1048 if ( bFlat
) nPos
--;
1050 if ( bDown
|| (nItemSplitSize
>= nSplitSize
) )
1052 pWindow
->SetLineColor( rStyleSettings
.GetLightColor() );
1053 pWindow
->DrawLine( Point( nTop
, nPos
+1 ), Point( nBottom
, nPos
+1 ) );
1055 nPos
+= nSplitSize
-2;
1056 if ( bFlat
) nPos
+=2;
1057 if ( (!bDown
&& (nItemSplitSize
>= 2)) ||
1058 (bDown
&& (nItemSplitSize
>= nSplitSize
-1)) )
1060 pWindow
->SetLineColor( rStyleSettings
.GetShadowColor() );
1061 pWindow
->DrawLine( Point( nTop
, nPos
), Point( nBottom
, nPos
) );
1066 if ( !bDown
|| (nItemSplitSize
>= nSplitSize
) )
1068 pWindow
->SetLineColor( rStyleSettings
.GetDarkShadowColor() );
1069 pWindow
->DrawLine( Point( nTop
, nPos
), Point( nBottom
, nPos
) );
1075 nTop
= pItems
[i
].mnTop
;
1076 nBottom
= pItems
[i
].mnTop
+pSet
->mpItems
[i
].mnHeight
-1;
1078 if ( bFlat
) nPos
--;
1079 if ( bDown
|| (nItemSplitSize
>= nSplitSize
) )
1081 pWindow
->SetLineColor( rStyleSettings
.GetLightColor() );
1082 pWindow
->DrawLine( Point( nPos
+1, nTop
), Point( nPos
+1, nBottom
) );
1084 nPos
+= pSet
->mnSplitSize
-2;
1085 if ( bFlat
) nPos
+=2;
1086 if ( (!bDown
&& (nItemSplitSize
>= 2)) ||
1087 (bDown
&& (nItemSplitSize
>= nSplitSize
-1)) )
1089 pWindow
->SetLineColor( rStyleSettings
.GetShadowColor() );
1090 pWindow
->DrawLine( Point( nPos
, nTop
), Point( nPos
, nBottom
) );
1095 if ( !bDown
|| (nItemSplitSize
>= nSplitSize
) )
1097 pWindow
->SetLineColor( rStyleSettings
.GetDarkShadowColor() );
1098 pWindow
->DrawLine( Point( nPos
, nTop
), Point( nPos
, nBottom
) );
1105 for ( i
= 0; i
< nItems
; i
++ )
1107 if ( pItems
[i
].mpSet
&& pItems
[i
].mnWidth
&& pItems
[i
].mnHeight
)
1108 ImplDrawSplit( pWindow
, pItems
[i
].mpSet
, ((pItems
[i
].mnBits
& SWIB_COLSET
) == 0) );
1112 // -----------------------------------------------------------------------
1114 sal_uInt16
SplitWindow::ImplTestSplit( ImplSplitSet
* pSet
, const Point
& rPos
,
1115 long& rMouseOff
, ImplSplitSet
** ppFoundSet
, sal_uInt16
& rFoundPos
,
1116 sal_Bool bRows
, sal_Bool
/*bDown*/ )
1118 if ( !pSet
->mpItems
)
1122 sal_uInt16 nSplitTest
;
1123 sal_uInt16 nItems
= pSet
->mnItems
;
1129 ImplSplitItem
* pItems
= pSet
->mpItems
;
1142 for ( i
= 0; i
< nItems
-1; i
++ )
1144 if ( pItems
[i
].mnSplitSize
)
1148 nTop
= pItems
[i
].mnLeft
;
1149 nBottom
= pItems
[i
].mnLeft
+pItems
[i
].mnWidth
-1;
1153 nTop
= pItems
[i
].mnTop
;
1154 nBottom
= pItems
[i
].mnTop
+pItems
[i
].mnHeight
-1;
1156 nPos
= pItems
[i
].mnSplitPos
;
1158 if ( (nMPos1
>= nTop
) && (nMPos1
<= nBottom
) &&
1159 (nMPos2
>= nPos
) && (nMPos2
<= nPos
+pItems
[i
].mnSplitSize
) )
1161 if ( !pItems
[i
].mbFixed
&& !pItems
[i
+1].mbFixed
)
1163 rMouseOff
= nMPos2
-nPos
;
1172 return SPLIT_NOSPLIT
;
1177 for ( i
= 0; i
< nItems
; i
++ )
1179 if ( pItems
[i
].mpSet
)
1181 nSplitTest
= ImplTestSplit( pItems
[i
].mpSet
, rPos
,
1182 rMouseOff
, ppFoundSet
, rFoundPos
,
1183 ((pItems
[i
].mnBits
& SWIB_COLSET
) == 0) );
1192 // -----------------------------------------------------------------------
1194 sal_uInt16
SplitWindow::ImplTestSplit( SplitWindow
* pWindow
, const Point
& rPos
,
1195 long& rMouseOff
, ImplSplitSet
** ppFoundSet
, sal_uInt16
& rFoundPos
)
1197 // Resizable SplitWindow muss anders behandelt werden
1198 if ( pWindow
->mnWinStyle
& WB_SIZEABLE
)
1204 if ( pWindow
->mbHorz
)
1206 if ( pWindow
->mbBottomRight
)
1208 nBorder
= pWindow
->mnBottomBorder
;
1213 nBorder
= pWindow
->mnTopBorder
;
1214 nPos
= pWindow
->mnDY
-nBorder
;
1220 if ( pWindow
->mbBottomRight
)
1222 nBorder
= pWindow
->mnRightBorder
;
1227 nBorder
= pWindow
->mnLeftBorder
;
1228 nPos
= pWindow
->mnDX
-nBorder
;
1232 long nSplitSize
= pWindow
->mpMainSet
->mnSplitSize
-2;
1233 if ( pWindow
->mbAutoHide
|| pWindow
->mbFadeOut
)
1234 nSplitSize
+= SPLITWIN_SPLITSIZEEXLN
;
1235 if ( !pWindow
->mbBottomRight
)
1237 if ( (nTPos
>= nPos
) && (nTPos
<= nPos
+nSplitSize
+nBorder
) )
1239 rMouseOff
= nTPos
-nPos
;
1240 *ppFoundSet
= pWindow
->mpMainSet
;
1241 if ( pWindow
->mpMainSet
->mpItems
)
1242 rFoundPos
= pWindow
->mpMainSet
->mnItems
-1;
1245 if ( pWindow
->mbHorz
)
1246 return SPLIT_VERT
| SPLIT_WINDOW
;
1248 return SPLIT_HORZ
| SPLIT_WINDOW
;
1252 return ImplTestSplit( pWindow
->mpMainSet
, rPos
, rMouseOff
, ppFoundSet
, rFoundPos
,
1253 pWindow
->mbHorz
, !pWindow
->mbBottomRight
);
1256 // -----------------------------------------------------------------------
1258 void SplitWindow::ImplDrawSplitTracking( SplitWindow
* pThis
, const Point
& rPos
)
1262 if ( pThis
->mnSplitTest
& SPLIT_HORZ
)
1264 aRect
.Top() = pThis
->maDragRect
.Top();
1265 aRect
.Bottom() = pThis
->maDragRect
.Bottom();
1266 aRect
.Left() = rPos
.X();
1267 aRect
.Right() = aRect
.Left()+pThis
->mpSplitSet
->mnSplitSize
-1;
1268 if ( !(pThis
->mnWinStyle
& WB_NOSPLITDRAW
) )
1270 if ( (pThis
->mnSplitTest
& SPLIT_WINDOW
) &&
1271 (pThis
->mbAutoHide
|| pThis
->mbFadeOut
) )
1273 aRect
.Left() += SPLITWIN_SPLITSIZEEXLN
;
1274 aRect
.Right() += SPLITWIN_SPLITSIZEEXLN
;
1279 aRect
.Left() = pThis
->maDragRect
.Left();
1280 aRect
.Right() = pThis
->maDragRect
.Right();
1281 aRect
.Top() = rPos
.Y();
1282 aRect
.Bottom() = aRect
.Top()+pThis
->mpSplitSet
->mnSplitSize
-1;
1283 if ( !(pThis
->mnWinStyle
& WB_NOSPLITDRAW
) )
1285 if ( (pThis
->mnSplitTest
& SPLIT_WINDOW
) &&
1286 (pThis
->mbAutoHide
|| pThis
->mbFadeOut
) )
1288 aRect
.Top() += SPLITWIN_SPLITSIZEEXLN
;
1289 aRect
.Bottom() += SPLITWIN_SPLITSIZEEXLN
;
1292 pThis
->ShowTracking( aRect
, SHOWTRACK_SPLIT
);
1295 // -----------------------------------------------------------------------
1297 void SplitWindow::ImplInit( Window
* pParent
, WinBits nStyle
)
1299 ImplSplitSet
* pNewSet
= new ImplSplitSet
;
1300 pNewSet
->mpItems
= NULL
;
1301 pNewSet
->mpWallpaper
= NULL
;
1302 pNewSet
->mpBitmap
= NULL
;
1303 pNewSet
->mnLastSize
= 0;
1304 pNewSet
->mnItems
= 0;
1306 pNewSet
->mnSplitSize
= SPLITWIN_SPLITSIZE
;
1307 pNewSet
->mbCalcPix
= sal_True
;
1309 mpMainSet
= pNewSet
;
1310 mpBaseSet
= pNewSet
;
1321 meAlign
= WINDOWALIGN_TOP
;
1322 mnWinStyle
= nStyle
;
1325 mnMouseModifier
= 0;
1328 mbDragFull
= sal_False
;
1330 mbBottomRight
= sal_False
;
1332 mbRecalc
= sal_True
;
1333 mbInvalidate
= sal_True
;
1334 mbAutoHide
= sal_False
;
1335 mbFadeIn
= sal_False
;
1336 mbFadeOut
= sal_False
;
1337 mbAutoHideIn
= sal_False
;
1338 mbAutoHideDown
= sal_False
;
1339 mbFadeInDown
= sal_False
;
1340 mbFadeOutDown
= sal_False
;
1341 mbAutoHidePressed
= sal_False
;
1342 mbFadeInPressed
= sal_False
;
1343 mbFadeOutPressed
= sal_False
;
1344 mbFadeNoButtonMode
= sal_False
;
1345 mbNoAlign
= sal_False
;
1347 if ( nStyle
& WB_NOSPLITDRAW
)
1349 pNewSet
->mnSplitSize
-= 2;
1350 mbInvalidate
= sal_False
;
1353 if ( nStyle
& WB_BORDER
)
1355 ImplCalcBorder( meAlign
, mbNoAlign
, mnLeftBorder
, mnTopBorder
,
1356 mnRightBorder
, mnBottomBorder
);
1366 DockingWindow::ImplInit( pParent
, (nStyle
| WB_CLIPCHILDREN
) & ~(WB_BORDER
| WB_SIZEABLE
) );
1371 // -----------------------------------------------------------------------
1373 void SplitWindow::ImplInitSettings()
1375 // Wenn fuer das MainSet eine Bitmap gesetzt wird, dann
1376 // brauchen wir nicht mehr den Hintergrund loeschen
1377 // Wenn MainSet Wallpaper hat, dann ist das der Hintergrund, ansonsten
1378 // sind es die Standard-Farben
1379 if ( mpMainSet
->mpBitmap
)
1381 else if ( mpMainSet
->mpWallpaper
)
1382 SetBackground( *mpMainSet
->mpWallpaper
);
1385 const StyleSettings
& rStyleSettings
= GetSettings().GetStyleSettings();
1388 if ( IsControlBackground() )
1389 aColor
= GetControlBackground();
1390 else if ( Window::GetStyle() & WB_3DLOOK
)
1391 aColor
= rStyleSettings
.GetFaceColor();
1393 aColor
= rStyleSettings
.GetWindowColor();
1394 SetBackground( aColor
);
1398 // =======================================================================
1400 SplitWindow::SplitWindow( Window
* pParent
, WinBits nStyle
) :
1401 DockingWindow( WINDOW_SPLITWINDOW
)
1403 ImplInit( pParent
, nStyle
);
1406 // -----------------------------------------------------------------------
1408 SplitWindow::~SplitWindow()
1411 ImplDeleteSet( mpMainSet
);
1412 mpMainSet
= NULL
; //NULL for base-class callbacks during dtoring
1415 // -----------------------------------------------------------------------
1417 void SplitWindow::ImplSetWindowSize( long nDelta
)
1422 Size aSize
= GetSizePixel();
1425 case WINDOWALIGN_TOP
:
1426 aSize
.Height() += nDelta
;
1427 SetSizePixel( aSize
);
1429 case WINDOWALIGN_BOTTOM
:
1431 maDragRect
.Top() += nDelta
;
1432 Point aPos
= GetPosPixel();
1434 aSize
.Height() += nDelta
;
1435 SetPosSizePixel( aPos
, aSize
);
1438 case WINDOWALIGN_LEFT
:
1439 aSize
.Width() += nDelta
;
1440 SetSizePixel( aSize
);
1442 case WINDOWALIGN_RIGHT
:
1445 maDragRect
.Left() += nDelta
;
1446 Point aPos
= GetPosPixel();
1448 aSize
.Width() += nDelta
;
1449 SetPosSizePixel( aPos
, aSize
);
1457 // -----------------------------------------------------------------------
1459 Size
SplitWindow::CalcLayoutSizePixel( const Size
& aNewSize
)
1461 Size
aSize( aNewSize
);
1462 long nSplitSize
= mpMainSet
->mnSplitSize
-2;
1464 if ( mbAutoHide
|| mbFadeOut
)
1465 nSplitSize
+= SPLITWIN_SPLITSIZEEXLN
;
1467 // Wenn Fenster sizeable ist, wird die groesse automatisch nach
1468 // dem MainSet festgelegt, wenn kein relatives Fenster enthalten
1470 if ( mnWinStyle
& WB_SIZEABLE
)
1476 for ( i
= 0; i
< mpMainSet
->mnItems
; i
++ )
1478 if ( mpMainSet
->mpItems
[i
].mnBits
& (SWIB_RELATIVESIZE
| SWIB_PERCENTSIZE
) )
1481 nCalcSize
+= mpMainSet
->mpItems
[i
].mnSize
;
1484 if ( i
== mpMainSet
->mnItems
)
1487 Point aPos
= GetPosPixel();
1490 nCurSize
= aNewSize
.Height()-mnTopBorder
-mnBottomBorder
;
1492 nCurSize
= aNewSize
.Width()-mnLeftBorder
-mnRightBorder
;
1493 nCurSize
-= nSplitSize
;
1494 nCurSize
-= (mpMainSet
->mnItems
-1)*mpMainSet
->mnSplitSize
;
1496 nDelta
= nCalcSize
-nCurSize
;
1502 case WINDOWALIGN_TOP
:
1503 aSize
.Height() += nDelta
;
1505 case WINDOWALIGN_BOTTOM
:
1507 aSize
.Height() += nDelta
;
1509 case WINDOWALIGN_LEFT
:
1510 aSize
.Width() += nDelta
;
1512 case WINDOWALIGN_RIGHT
:
1515 aSize
.Width() += nDelta
;
1524 // -----------------------------------------------------------------------
1526 void SplitWindow::ImplCalcLayout()
1528 if ( !mbCalc
|| !mbRecalc
|| !mpMainSet
->mpItems
)
1531 long nSplitSize
= mpMainSet
->mnSplitSize
-2;
1532 if ( mbAutoHide
|| mbFadeOut
)
1533 nSplitSize
+= SPLITWIN_SPLITSIZEEXLN
;
1535 // Wenn Fenster sizeable ist, wird die groesse automatisch nach
1536 // dem MainSet festgelegt, wenn kein relatives Fenster enthalten
1538 if ( mnWinStyle
& WB_SIZEABLE
)
1544 for ( i
= 0; i
< mpMainSet
->mnItems
; i
++ )
1546 if ( mpMainSet
->mpItems
[i
].mnBits
& (SWIB_RELATIVESIZE
| SWIB_PERCENTSIZE
) )
1549 nCalcSize
+= mpMainSet
->mpItems
[i
].mnSize
;
1552 if ( i
== mpMainSet
->mnItems
)
1555 nCurSize
= mnDY
-mnTopBorder
-mnBottomBorder
;
1557 nCurSize
= mnDX
-mnLeftBorder
-mnRightBorder
;
1558 nCurSize
-= nSplitSize
;
1559 nCurSize
-= (mpMainSet
->mnItems
-1)*mpMainSet
->mnSplitSize
;
1561 mbRecalc
= sal_False
;
1562 ImplSetWindowSize( nCalcSize
-nCurSize
);
1563 mbRecalc
= sal_True
;
1567 if ( (mnDX
<= 0) || (mnDY
<= 0) )
1570 // Groessen/Position vorberechnen
1578 if ( mbBottomRight
)
1579 nT
= mnDY
-mnBottomBorder
;
1586 if ( mbBottomRight
)
1587 nL
= mnDX
-mnRightBorder
;
1592 nW
= mnDX
-mnLeftBorder
-mnRightBorder
;
1593 nH
= mnDY
-mnTopBorder
-mnBottomBorder
;
1594 if ( mnWinStyle
& WB_SIZEABLE
)
1602 // Sets rekursiv berechnen
1603 ImplCalcSet( mpMainSet
, nL
, nT
, nW
, nH
, mbHorz
, !mbBottomRight
);
1604 ImplCalcSet2( this, mpMainSet
, sal_False
, mbHorz
, !mbBottomRight
);
1608 // -----------------------------------------------------------------------
1610 void SplitWindow::ImplUpdate()
1614 if ( IsReallyShown() && IsUpdateMode() && mbRecalc
)
1616 if ( mpMainSet
->mpItems
)
1623 // -----------------------------------------------------------------------
1625 void SplitWindow::ImplSplitMousePos( Point
& rMousePos
)
1627 if ( mnSplitTest
& SPLIT_HORZ
)
1629 rMousePos
.X() -= mnMouseOff
;
1630 if ( rMousePos
.X() < maDragRect
.Left() )
1631 rMousePos
.X() = maDragRect
.Left();
1632 else if ( rMousePos
.X()+mpSplitSet
->mnSplitSize
+1 > maDragRect
.Right() )
1633 rMousePos
.X() = maDragRect
.Right()-mpSplitSet
->mnSplitSize
+1;
1634 // Wegen FullDrag in Screen-Koordinaaten merken
1635 mnMSplitPos
= OutputToScreenPixel( rMousePos
).X();
1639 rMousePos
.Y() -= mnMouseOff
;
1640 if ( rMousePos
.Y() < maDragRect
.Top() )
1641 rMousePos
.Y() = maDragRect
.Top();
1642 else if ( rMousePos
.Y()+mpSplitSet
->mnSplitSize
+1 > maDragRect
.Bottom() )
1643 rMousePos
.Y() = maDragRect
.Bottom()-mpSplitSet
->mnSplitSize
+1;
1644 mnMSplitPos
= OutputToScreenPixel( rMousePos
).Y();
1648 // -----------------------------------------------------------------------
1650 void SplitWindow::ImplGetButtonRect( Rectangle
& rRect
, long nEx
, sal_Bool bTest
) const
1652 long nSplitSize
= mpMainSet
->mnSplitSize
-1;
1653 if ( mbAutoHide
|| mbFadeOut
|| mbFadeIn
)
1654 nSplitSize
+= SPLITWIN_SPLITSIZEEX
;
1656 long nButtonSize
= 0;
1658 nButtonSize
+= SPLITWIN_SPLITSIZEFADE
+1;
1660 nButtonSize
+= SPLITWIN_SPLITSIZEFADE
+1;
1662 nButtonSize
+= SPLITWIN_SPLITSIZEAUTOHIDE
+1;
1665 nCenterEx
+= ((mnDX
-mnLeftBorder
-mnRightBorder
)-nButtonSize
)/2;
1667 nCenterEx
+= ((mnDY
-mnTopBorder
-mnBottomBorder
)-nButtonSize
)/2;
1668 if ( nCenterEx
> 0 )
1673 case WINDOWALIGN_TOP
:
1674 rRect
.Left() = mnLeftBorder
+nEx
;
1675 rRect
.Top() = mnDY
-mnBottomBorder
-nSplitSize
;
1676 rRect
.Right() = rRect
.Left()+SPLITWIN_SPLITSIZEAUTOHIDE
;
1677 rRect
.Bottom() = mnDY
-mnBottomBorder
-1;
1680 rRect
.Top() -= mnTopBorder
;
1681 rRect
.Bottom() += mnBottomBorder
;
1684 case WINDOWALIGN_BOTTOM
:
1685 rRect
.Left() = mnLeftBorder
+nEx
;
1686 rRect
.Top() = mnTopBorder
;
1687 rRect
.Right() = rRect
.Left()+SPLITWIN_SPLITSIZEAUTOHIDE
;
1688 rRect
.Bottom() = mnTopBorder
+nSplitSize
-1;
1691 rRect
.Top() -= mnTopBorder
;
1692 rRect
.Bottom() += mnBottomBorder
;
1695 case WINDOWALIGN_LEFT
:
1696 rRect
.Left() = mnDX
-mnRightBorder
-nSplitSize
;
1697 rRect
.Top() = mnTopBorder
+nEx
;
1698 rRect
.Right() = mnDX
-mnRightBorder
-1;
1699 rRect
.Bottom() = rRect
.Top()+SPLITWIN_SPLITSIZEAUTOHIDE
;
1702 rRect
.Left() -= mnLeftBorder
;
1703 rRect
.Right() += mnRightBorder
;
1706 case WINDOWALIGN_RIGHT
:
1707 rRect
.Left() = mnLeftBorder
;
1708 rRect
.Top() = mnTopBorder
+nEx
;
1709 rRect
.Right() = mnLeftBorder
+nSplitSize
-1;
1710 rRect
.Bottom() = rRect
.Top()+SPLITWIN_SPLITSIZEAUTOHIDE
;
1713 rRect
.Left() -= mnLeftBorder
;
1714 rRect
.Right() += mnRightBorder
;
1720 // -----------------------------------------------------------------------
1722 void SplitWindow::ImplGetAutoHideRect( Rectangle
& rRect
, sal_Bool bTest
) const
1729 if ( mbFadeIn
|| mbFadeOut
)
1730 nEx
= SPLITWIN_SPLITSIZEFADE
+1;
1731 ImplGetButtonRect( aRect
, nEx
, bTest
&& mbFadeIn
);
1737 // -----------------------------------------------------------------------
1739 void SplitWindow::ImplGetFadeInRect( Rectangle
& rRect
, sal_Bool bTest
) const
1744 ImplGetButtonRect( aRect
, 0, bTest
);
1749 // -----------------------------------------------------------------------
1751 void SplitWindow::ImplGetFadeOutRect( Rectangle
& rRect
, sal_Bool
) const
1756 ImplGetButtonRect( aRect
, 0, sal_False
);
1761 // -----------------------------------------------------------------------
1763 void SplitWindow::ImplDrawButtonRect( const Rectangle
& rRect
, long nSize
)
1765 const StyleSettings
& rStyleSettings
= GetSettings().GetStyleSettings();
1769 long nLeft
= rRect
.Left();
1770 long nRight
= rRect
.Right();
1771 long nCenter
= rRect
.Center().Y();
1772 long nEx1
= nLeft
+((rRect
.GetWidth()-nSize
)/2)-2;
1773 long nEx2
= nEx1
+nSize
+3;
1774 SetLineColor( rStyleSettings
.GetLightColor() );
1775 DrawLine( Point( rRect
.Left(), rRect
.Top() ), Point( rRect
.Left(), rRect
.Bottom() ) );
1776 DrawLine( Point( rRect
.Left(), rRect
.Top() ), Point( rRect
.Right(), rRect
.Top() ) );
1777 SetLineColor( rStyleSettings
.GetShadowColor() );
1778 DrawLine( Point( rRect
.Right(), rRect
.Top() ), Point( rRect
.Right(), rRect
.Bottom() ) );
1779 DrawLine( Point( rRect
.Left(), rRect
.Bottom() ), Point( rRect
.Right(), rRect
.Bottom() ) );
1781 while ( i
< nRight
-3 )
1783 if ( (i
< nEx1
) || (i
> nEx2
) )
1785 DrawPixel( Point( i
, nCenter
-2 ), rStyleSettings
.GetLightColor() );
1786 DrawPixel( Point( i
+1, nCenter
-2+1 ), rStyleSettings
.GetShadowColor() );
1789 if ( (i
< nEx1
) || ((i
> nEx2
) && (i
< nRight
-3)) )
1791 DrawPixel( Point( i
, nCenter
+2 ), rStyleSettings
.GetLightColor() );
1792 DrawPixel( Point( i
+1, nCenter
+2+1 ), rStyleSettings
.GetShadowColor() );
1799 long nTop
= rRect
.Top();
1800 long nBottom
= rRect
.Bottom();
1801 long nCenter
= rRect
.Center().X();
1802 long nEx1
= nTop
+((rRect
.GetHeight()-nSize
)/2)-2;
1803 long nEx2
= nEx1
+nSize
+3;
1804 SetLineColor( rStyleSettings
.GetLightColor() );
1805 DrawLine( Point( rRect
.Left(), rRect
.Top() ), Point( rRect
.Right(), rRect
.Top() ) );
1806 DrawLine( Point( rRect
.Left(), rRect
.Top() ), Point( rRect
.Left(), rRect
.Bottom() ) );
1807 SetLineColor( rStyleSettings
.GetShadowColor() );
1808 DrawLine( Point( rRect
.Right(), rRect
.Top() ), Point( rRect
.Right(), rRect
.Bottom() ) );
1809 DrawLine( Point( rRect
.Left(), rRect
.Bottom() ), Point( rRect
.Right(), rRect
.Bottom() ) );
1811 while ( i
< nBottom
-3 )
1813 if ( (i
< nEx1
) || (i
> nEx2
) )
1815 DrawPixel( Point( nCenter
-2, i
), rStyleSettings
.GetLightColor() );
1816 DrawPixel( Point( nCenter
-2+1, i
+1 ), rStyleSettings
.GetShadowColor() );
1819 if ( (i
< nEx1
) || ((i
> nEx2
) && (i
< nBottom
-3)) )
1821 DrawPixel( Point( nCenter
+2, i
), rStyleSettings
.GetLightColor() );
1822 DrawPixel( Point( nCenter
+2+1, i
+1 ), rStyleSettings
.GetShadowColor() );
1829 // -----------------------------------------------------------------------
1831 void SplitWindow::ImplDrawAutoHide( sal_Bool bInPaint
)
1835 Rectangle aTempRect
;
1836 ImplGetAutoHideRect( aTempRect
);
1841 // ImageListe laden, wenn noch nicht vorhanden
1842 ImplSVData
* pSVData
= ImplGetSVData();
1843 ImageList
* pImageList
;
1846 if ( !pSVData
->maCtrlData
.mpSplitHPinImgList
)
1848 ResMgr
* pResMgr
= ImplGetResMgr();
1851 Color
aNonAlphaMask( 0x00, 0x00, 0xFF );
1852 pSVData
->maCtrlData
.mpSplitHPinImgList
= new ImageList(4);
1853 pSVData
->maCtrlData
.mpSplitHPinImgList
->InsertFromHorizontalBitmap
1854 ( ResId( SV_RESID_BITMAP_SPLITHPIN
, *pResMgr
), 4, &aNonAlphaMask
);
1857 pImageList
= pSVData
->maCtrlData
.mpSplitHPinImgList
;
1861 if ( !pSVData
->maCtrlData
.mpSplitVPinImgList
)
1863 ResMgr
* pResMgr
= ImplGetResMgr();
1864 pSVData
->maCtrlData
.mpSplitVPinImgList
= new ImageList(4);
1867 Color
aNonAlphaMask( 0x00, 0x00, 0xFF );
1868 pSVData
->maCtrlData
.mpSplitVPinImgList
->InsertFromHorizontalBitmap
1869 ( ResId( SV_RESID_BITMAP_SPLITVPIN
, *pResMgr
), 4, &aNonAlphaMask
);
1872 pImageList
= pSVData
->maCtrlData
.mpSplitVPinImgList
;
1875 // Image ermitteln und zurueckgeben
1877 if ( mbAutoHidePressed
)
1892 Image aImage
= pImageList
->GetImage( nId
);
1893 Size aImageSize
= aImage
.GetSizePixel();
1894 Point
aPos( aTempRect
.Left()+((aTempRect
.GetWidth()-aImageSize
.Width())/2),
1895 aTempRect
.Top()+((aTempRect
.GetHeight()-aImageSize
.Height())/2) );
1898 nSize
= aImageSize
.Width();
1900 nSize
= aImageSize
.Height();
1901 ImplDrawButtonRect( aTempRect
, nSize
);
1902 DrawImage( aPos
, aImage
);
1906 // -----------------------------------------------------------------------
1908 void SplitWindow::ImplDrawFadeArrow( const Point
& rPt
, sal_Bool bHorz
, sal_Bool bLeft
)
1910 const StyleSettings
& rStyleSettings
= GetSettings().GetStyleSettings();
1926 aCol
= Color( COL_WHITE
);
1927 DrawPixel( Point(x
, y
), aCol
);
1928 DrawPixel( Point(x
, y
+1), aCol
);
1929 DrawPixel( Point(x
, y
+2), aCol
);
1930 DrawPixel( Point(x
+dx
, y
+1), aCol
);
1933 aCol
= rStyleSettings
.GetDarkShadowColor();
1934 DrawPixel( Point(x
, y
), rStyleSettings
.GetDarkShadowColor() );
1935 DrawPixel( Point(x
, y
+1), rStyleSettings
.GetDarkShadowColor() );
1936 DrawPixel( Point(x
, y
+2), rStyleSettings
.GetDarkShadowColor() );
1937 DrawPixel( Point(x
+dx
, y
+1), rStyleSettings
.GetDarkShadowColor() );
1949 aCol
= Color( COL_WHITE
);
1950 DrawPixel( Point(x
, y
), aCol
);
1951 DrawPixel( Point(x
+1, y
), aCol
);
1952 DrawPixel( Point(x
+2, y
), aCol
);
1953 DrawPixel( Point(x
+1, y
+dy
), aCol
);
1956 aCol
= rStyleSettings
.GetDarkShadowColor();
1957 DrawPixel( Point(x
, y
), aCol
);
1958 DrawPixel( Point(x
+1, y
), aCol
);
1959 DrawPixel( Point(x
+2, y
), aCol
);
1960 DrawPixel( Point(x
+1, y
+dy
), aCol
);
1964 void SplitWindow::ImplDrawGrip( const Rectangle
& rRect
, sal_Bool bHorz
, sal_Bool bLeft
)
1966 const StyleSettings
& rStyleSettings
= GetSettings().GetStyleSettings();
1968 if( rRect
.IsInside( GetPointerPosPixel() ) )
1970 DrawWallpaper( rRect
, Wallpaper( Color( COL_WHITE
) ) );
1971 DrawSelectionBackground( rRect
, 2, sal_False
, sal_False
, sal_False
);
1976 int width
= (int) (0.5 * rRect
.getWidth() + 0.5);
1977 int i
= rRect
.Left() + (rRect
.getWidth() - width
) / 2;
1979 const int y
= rRect
.Top() + 1;
1980 ImplDrawFadeArrow( Point( i
-8, y
), bHorz
, bLeft
);
1984 DrawPixel( Point(i
, y
), rStyleSettings
.GetDarkShadowColor() );
1985 DrawPixel( Point(i
+1, y
), rStyleSettings
.GetShadowColor() );
1987 DrawPixel( Point(i
, y
+1), rStyleSettings
.GetShadowColor() );
1988 DrawPixel( Point(i
+1, y
+1), rStyleSettings
.GetFaceColor() );
1989 DrawPixel( Point(i
+2, y
+1), Color(COL_WHITE
) );
1991 DrawPixel( Point(i
+1, y
+2), Color(COL_WHITE
) );
1992 DrawPixel( Point(i
+2, y
+2), Color(COL_WHITE
) );
1995 ImplDrawFadeArrow( Point( i
+3, y
), bHorz
, bLeft
);
1999 int height
= (int) (0.5 * rRect
.getHeight() + 0.5);
2000 int i
= rRect
.Top() + (rRect
.getHeight() - height
) / 2;
2002 const int x
= rRect
.Left() + 2;
2003 ImplDrawFadeArrow( Point( x
, i
-8), bHorz
, bLeft
);
2004 while( i
<= height
)
2007 DrawPixel( Point(x
, i
), rStyleSettings
.GetDarkShadowColor() );
2008 DrawPixel( Point(x
+1, i
), rStyleSettings
.GetShadowColor() );
2010 DrawPixel( Point(x
, i
+1), rStyleSettings
.GetShadowColor() );
2011 DrawPixel( Point(x
+1, i
+1), rStyleSettings
.GetFaceColor() );
2012 DrawPixel( Point(x
+2, i
+1), Color(COL_WHITE
) );
2014 DrawPixel( Point(x
+1, i
+2), Color(COL_WHITE
) );
2015 DrawPixel( Point(x
+2, i
+2), Color(COL_WHITE
) );
2018 ImplDrawFadeArrow( Point( x
, i
+3), bHorz
, bLeft
);
2022 void SplitWindow::ImplDrawFadeIn( sal_Bool bInPaint
)
2026 Rectangle aTempRect
;
2027 ImplGetFadeInRect( aTempRect
);
2029 sal_Bool bLeft
= sal_True
;
2032 case WINDOWALIGN_TOP
:
2033 case WINDOWALIGN_LEFT
:
2036 case WINDOWALIGN_BOTTOM
:
2037 case WINDOWALIGN_RIGHT
:
2046 ImplDrawGrip( aTempRect
, (meAlign
== WINDOWALIGN_TOP
) || (meAlign
== WINDOWALIGN_BOTTOM
), bLeft
);
2050 // -----------------------------------------------------------------------
2052 void SplitWindow::ImplDrawFadeOut( sal_Bool bInPaint
)
2056 Rectangle aTempRect
;
2057 ImplGetFadeOutRect( aTempRect
);
2059 sal_Bool bLeft
= sal_True
;
2062 case WINDOWALIGN_BOTTOM
:
2063 case WINDOWALIGN_RIGHT
:
2066 case WINDOWALIGN_TOP
:
2067 case WINDOWALIGN_LEFT
:
2076 ImplDrawGrip( aTempRect
, (meAlign
== WINDOWALIGN_TOP
) || (meAlign
== WINDOWALIGN_BOTTOM
), bLeft
);
2080 // -----------------------------------------------------------------------
2081 void SplitWindow::ImplStartSplit( const MouseEvent
& rMEvt
)
2083 Point aMousePosPixel
= rMEvt
.GetPosPixel();
2084 mnSplitTest
= ImplTestSplit( this, aMousePosPixel
, mnMouseOff
, &mpSplitSet
, mnSplitPos
);
2086 if ( mnSplitTest
&& !(mnSplitTest
& SPLIT_NOSPLIT
) )
2088 ImplSplitItem
* pSplitItem
;
2092 sal_Bool bPropSmaller
;
2094 mnMouseModifier
= rMEvt
.GetModifier();
2095 if ( !(mnMouseModifier
& KEY_SHIFT
) || (mnSplitPos
+1 >= mpSplitSet
->mnItems
) )
2096 bPropSmaller
= sal_False
;
2098 bPropSmaller
= sal_True
;
2100 // Hier kann noch die maximale Groesse gesetzt werden
2104 nCurMaxSize
= mnMaxSize
;
2107 Size aSize
= GetParent()->GetOutputSizePixel();
2109 nCurMaxSize
= aSize
.Height();
2111 nCurMaxSize
= aSize
.Width();
2114 if ( mpSplitSet
->mpItems
)
2117 if ( (mpSplitSet
== mpMainSet
) && mbBottomRight
)
2120 pSplitItem
= &(mpSplitSet
->mpItems
[mnSplitPos
]);
2121 maDragRect
.Left() = pSplitItem
->mnLeft
;
2122 maDragRect
.Top() = pSplitItem
->mnTop
;
2123 maDragRect
.Right() = pSplitItem
->mnLeft
+pSplitItem
->mnWidth
-1;
2124 maDragRect
.Bottom() = pSplitItem
->mnTop
+pSplitItem
->mnHeight
-1;
2126 if ( mnSplitTest
& SPLIT_HORZ
)
2129 maDragRect
.Right() += mpSplitSet
->mnSplitSize
;
2131 maDragRect
.Left() -= mpSplitSet
->mnSplitSize
;
2136 maDragRect
.Bottom() += mpSplitSet
->mnSplitSize
;
2138 maDragRect
.Top() -= mpSplitSet
->mnSplitSize
;
2146 pSplitItem
= &(mpSplitSet
->mpItems
[nTemp
-1]);
2147 if ( pSplitItem
->mbFixed
)
2151 if ( mnSplitTest
& SPLIT_HORZ
)
2154 maDragRect
.Left() -= pSplitItem
->mnPixSize
;
2156 maDragRect
.Right() += pSplitItem
->mnPixSize
;
2161 maDragRect
.Top() -= pSplitItem
->mnPixSize
;
2163 maDragRect
.Bottom() += pSplitItem
->mnPixSize
;
2170 if ( (mpSplitSet
== mpMainSet
) && (mnWinStyle
& WB_SIZEABLE
) && !bPropSmaller
)
2175 maDragRect
.Bottom() += nCurMaxSize
-mnDY
-mnTopBorder
;
2177 maDragRect
.Right() += nCurMaxSize
-mnDX
-mnLeftBorder
;
2182 maDragRect
.Top() -= nCurMaxSize
-mnDY
-mnBottomBorder
;
2184 maDragRect
.Left() -= nCurMaxSize
-mnDX
-mnRightBorder
;
2189 nTemp
= mnSplitPos
+1;
2190 while ( nTemp
< mpSplitSet
->mnItems
)
2192 pSplitItem
= &(mpSplitSet
->mpItems
[nTemp
]);
2193 if ( pSplitItem
->mbFixed
)
2197 if ( mnSplitTest
& SPLIT_HORZ
)
2200 maDragRect
.Right() += pSplitItem
->mnPixSize
;
2202 maDragRect
.Left() -= pSplitItem
->mnPixSize
;
2207 maDragRect
.Bottom() += pSplitItem
->mnPixSize
;
2209 maDragRect
.Top() -= pSplitItem
->mnPixSize
;
2218 maDragRect
.Left() = mnLeftBorder
;
2219 maDragRect
.Top() = mnTopBorder
;
2220 maDragRect
.Right() = mnDX
-mnRightBorder
-1;
2221 maDragRect
.Bottom() = mnDY
-mnBottomBorder
-1;
2224 if ( mbBottomRight
)
2225 maDragRect
.Top() -= nCurMaxSize
-mnDY
-mnBottomBorder
;
2227 maDragRect
.Bottom() += nCurMaxSize
-mnDY
-mnTopBorder
;
2231 if ( mbBottomRight
)
2232 maDragRect
.Left() -= nCurMaxSize
-mnDX
-mnRightBorder
;
2234 maDragRect
.Right() += nCurMaxSize
-mnDX
-mnLeftBorder
;
2240 mbDragFull
= (GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SPLIT
) != 0;
2242 ImplSplitMousePos( aMousePosPixel
);
2245 ImplDrawSplitTracking( this, aMousePosPixel
);
2248 ImplSplitItem
* pItems
= mpSplitSet
->mpItems
;
2249 sal_uInt16 nItems
= mpSplitSet
->mnItems
;
2250 mpLastSizes
= new long[nItems
*2];
2251 for ( sal_uInt16 i
= 0; i
< nItems
; i
++ )
2253 mpLastSizes
[i
*2] = pItems
[i
].mnSize
;
2254 mpLastSizes
[i
*2+1] = pItems
[i
].mnPixSize
;
2257 mnMStartPos
= mnMSplitPos
;
2259 PointerStyle eStyle
= POINTER_ARROW
;
2260 if ( mnSplitTest
& SPLIT_HORZ
)
2261 eStyle
= POINTER_HSPLIT
;
2262 else if ( mnSplitTest
& SPLIT_VERT
)
2263 eStyle
= POINTER_VSPLIT
;
2265 Pointer
aPtr( eStyle
);
2271 // -----------------------------------------------------------------------
2273 void SplitWindow::StartSplit()
2275 maStartSplitHdl
.Call( this );
2278 // -----------------------------------------------------------------------
2280 void SplitWindow::Split()
2282 maSplitHdl
.Call( this );
2285 // -----------------------------------------------------------------------
2287 void SplitWindow::SplitResize()
2289 maSplitResizeHdl
.Call( this );
2292 // -----------------------------------------------------------------------
2294 void SplitWindow::AutoHide()
2296 maAutoHideHdl
.Call( this );
2299 // -----------------------------------------------------------------------
2301 void SplitWindow::FadeIn()
2303 maFadeInHdl
.Call( this );
2306 // -----------------------------------------------------------------------
2308 void SplitWindow::FadeOut()
2310 maFadeOutHdl
.Call( this );
2313 // -----------------------------------------------------------------------
2315 void SplitWindow::MouseButtonDown( const MouseEvent
& rMEvt
)
2317 if ( !rMEvt
.IsLeft() || rMEvt
.IsMod2() )
2319 DockingWindow::MouseButtonDown( rMEvt
);
2323 Point aMousePosPixel
= rMEvt
.GetPosPixel();
2324 Rectangle aTestRect
;
2326 mbFadeNoButtonMode
= sal_False
;
2327 ImplGetAutoHideRect( aTestRect
, sal_True
);
2328 if ( aTestRect
.IsInside( aMousePosPixel
) )
2330 mbAutoHideDown
= sal_True
;
2331 mbAutoHidePressed
= sal_True
;
2332 ImplDrawAutoHide( sal_False
);
2336 ImplGetFadeOutRect( aTestRect
, sal_True
);
2337 if ( aTestRect
.IsInside( aMousePosPixel
) )
2339 mbFadeOutDown
= sal_True
;
2340 mbFadeOutPressed
= sal_True
;
2341 ImplDrawFadeOut( sal_False
);
2345 ImplGetFadeInRect( aTestRect
, sal_True
);
2346 if ( aTestRect
.IsInside( aMousePosPixel
) )
2348 mbFadeInDown
= sal_True
;
2349 mbFadeInPressed
= sal_True
;
2350 ImplDrawFadeIn( sal_False
);
2352 else if ( !aTestRect
.IsEmpty() && !(mnWinStyle
& WB_SIZEABLE
) )
2354 mbFadeNoButtonMode
= sal_True
;
2361 if ( mbAutoHideDown
|| mbFadeInDown
|| mbFadeOutDown
)
2364 ImplStartSplit( rMEvt
);
2367 // -----------------------------------------------------------------------
2369 void SplitWindow::MouseMove( const MouseEvent
& rMEvt
)
2371 if ( !IsTracking() )
2373 Point aPos
= rMEvt
.GetPosPixel();
2375 ImplSplitSet
* pTempSplitSet
;
2376 sal_uInt16 nTempSplitPos
;
2377 sal_uInt16 nSplitTest
= ImplTestSplit( this, aPos
, nTemp
, &pTempSplitSet
, nTempSplitPos
);
2378 PointerStyle eStyle
= POINTER_ARROW
;
2379 Rectangle aAutoHideRect
;
2380 Rectangle aFadeInRect
;
2381 Rectangle aFadeOutRect
;
2383 ImplGetAutoHideRect( aAutoHideRect
);
2384 ImplGetFadeInRect( aFadeInRect
);
2385 ImplGetFadeOutRect( aFadeOutRect
);
2386 if ( !aAutoHideRect
.IsInside( aPos
) &&
2387 !aFadeInRect
.IsInside( aPos
) &&
2388 !aFadeOutRect
.IsInside( aPos
) )
2390 if ( nSplitTest
&& !(nSplitTest
& SPLIT_NOSPLIT
) )
2392 if ( nSplitTest
& SPLIT_HORZ
)
2393 eStyle
= POINTER_HSPLIT
;
2394 else if ( nSplitTest
& SPLIT_VERT
)
2395 eStyle
= POINTER_VSPLIT
;
2399 Pointer
aPtr( eStyle
);
2404 // -----------------------------------------------------------------------
2406 void SplitWindow::Tracking( const TrackingEvent
& rTEvt
)
2408 Point aMousePosPixel
= rTEvt
.GetMouseEvent().GetPosPixel();
2410 if ( mbAutoHideDown
)
2412 if ( rTEvt
.IsTrackingEnded() )
2414 mbAutoHideDown
= sal_False
;
2415 if ( mbAutoHidePressed
)
2417 mbAutoHidePressed
= sal_False
;
2419 if ( !rTEvt
.IsTrackingCanceled() )
2421 mbAutoHideIn
= !mbAutoHideIn
;
2422 ImplDrawAutoHide( sal_False
);
2426 ImplDrawAutoHide( sal_False
);
2431 Rectangle aTestRect
;
2432 ImplGetAutoHideRect( aTestRect
, sal_True
);
2433 sal_Bool bNewPressed
= aTestRect
.IsInside( aMousePosPixel
);
2434 if ( bNewPressed
!= mbAutoHidePressed
)
2436 mbAutoHidePressed
= bNewPressed
;
2437 ImplDrawAutoHide( sal_False
);
2441 else if ( mbFadeInDown
)
2443 if ( rTEvt
.IsTrackingEnded() )
2445 mbFadeInDown
= sal_False
;
2446 if ( mbFadeInPressed
)
2448 mbFadeInPressed
= sal_False
;
2449 ImplDrawFadeIn( sal_False
);
2451 if ( !rTEvt
.IsTrackingCanceled() )
2457 Rectangle aTestRect
;
2458 ImplGetFadeInRect( aTestRect
, sal_True
);
2459 sal_Bool bNewPressed
= aTestRect
.IsInside( aMousePosPixel
);
2460 if ( bNewPressed
!= mbFadeInPressed
)
2462 mbFadeInPressed
= bNewPressed
;
2463 ImplDrawFadeIn( sal_False
);
2467 else if ( mbFadeOutDown
)
2469 if ( rTEvt
.IsTrackingEnded() )
2471 mbFadeOutDown
= sal_False
;
2472 if ( mbFadeOutPressed
)
2474 mbFadeOutPressed
= sal_False
;
2475 ImplDrawFadeOut( sal_False
);
2477 if ( !rTEvt
.IsTrackingCanceled() )
2483 Rectangle aTestRect
;
2484 ImplGetFadeOutRect( aTestRect
, sal_True
);
2485 sal_Bool bNewPressed
= aTestRect
.IsInside( aMousePosPixel
);
2486 if ( bNewPressed
== sal_False
)
2488 mbFadeOutPressed
= bNewPressed
;
2489 ImplDrawFadeOut( sal_False
);
2491 // We need a mouseevent with a position inside the button for the
2492 // ImplStartSplit function!
2493 MouseEvent aOrgMEvt
= rTEvt
.GetMouseEvent();
2494 MouseEvent aNewMEvt
= MouseEvent( aTestRect
.Center(), aOrgMEvt
.GetClicks(),
2495 aOrgMEvt
.GetMode(), aOrgMEvt
.GetButtons(),
2496 aOrgMEvt
.GetModifier() );
2498 ImplStartSplit( aNewMEvt
);
2499 mbFadeOutDown
= sal_False
;
2505 ImplSplitMousePos( aMousePosPixel
);
2506 sal_Bool bSplit
= sal_True
;
2509 if ( rTEvt
.IsTrackingEnded() )
2511 if ( rTEvt
.IsTrackingCanceled() )
2513 ImplSplitItem
* pItems
= mpSplitSet
->mpItems
;
2514 sal_uInt16 nItems
= mpSplitSet
->mnItems
;
2515 for ( sal_uInt16 i
= 0; i
< nItems
; i
++ )
2517 pItems
[i
].mnSize
= mpLastSizes
[i
*2];
2518 pItems
[i
].mnPixSize
= mpLastSizes
[i
*2+1];
2528 if ( rTEvt
.IsTrackingEnded() )
2531 bSplit
= !rTEvt
.IsTrackingCanceled();
2535 ImplDrawSplitTracking( this, aMousePosPixel
);
2542 sal_Bool bPropSmaller
= (mnMouseModifier
& KEY_SHIFT
) ? sal_True
: sal_False
;
2543 sal_Bool bPropGreater
= (mnMouseModifier
& KEY_MOD1
) ? sal_True
: sal_False
;
2544 long nDelta
= mnMSplitPos
-mnMStartPos
;
2546 if ( (mnSplitTest
& SPLIT_WINDOW
) && !mpMainSet
->mpItems
)
2548 if ( (mpSplitSet
== mpMainSet
) && mbBottomRight
)
2550 ImplSetWindowSize( nDelta
);
2554 long nNewSize
= mpSplitSet
->mpItems
[mnSplitPos
].mnPixSize
;
2555 if ( (mpSplitSet
== mpMainSet
) && mbBottomRight
)
2559 SplitItem( mpSplitSet
->mpItems
[mnSplitPos
].mnId
, nNewSize
,
2560 bPropSmaller
, bPropGreater
);
2568 mnMStartPos
= mnMSplitPos
;
2572 if ( rTEvt
.IsTrackingEnded() )
2580 mnMouseModifier
= 0;
2587 // -----------------------------------------------------------------------
2589 long SplitWindow::PreNotify( NotifyEvent
& rNEvt
)
2591 const MouseEvent
* pMouseEvt
= NULL
;
2593 if( (rNEvt
.GetType() == EVENT_MOUSEMOVE
) && (pMouseEvt
= rNEvt
.GetMouseEvent()) != NULL
)
2595 if( !pMouseEvt
->GetButtons() && !pMouseEvt
->IsSynthetic() && !pMouseEvt
->IsModifierChanged() )
2597 // trigger redraw if mouse over state has changed
2598 Rectangle aFadeInRect
;
2599 Rectangle aFadeOutRect
;
2600 ImplGetFadeInRect( aFadeInRect
);
2601 ImplGetFadeOutRect( aFadeOutRect
);
2603 if ( aFadeInRect
.IsInside( GetPointerPosPixel() ) != aFadeInRect
.IsInside( GetLastPointerPosPixel() ) )
2604 Invalidate( aFadeInRect
);
2605 if ( aFadeOutRect
.IsInside( GetPointerPosPixel() ) != aFadeOutRect
.IsInside( GetLastPointerPosPixel() ) )
2606 Invalidate( aFadeOutRect
);
2608 if( pMouseEvt
->IsLeaveWindow() || pMouseEvt
->IsEnterWindow() )
2610 Invalidate( aFadeInRect
);
2611 Invalidate( aFadeOutRect
);
2615 return Window::PreNotify( rNEvt
);
2618 // -----------------------------------------------------------------------
2620 void SplitWindow::Paint( const Rectangle
& )
2622 if ( mnWinStyle
& WB_BORDER
)
2623 ImplDrawBorder( this );
2625 ImplDrawBorderLine( this );
2626 ImplDrawFadeOut( sal_True
);
2627 ImplDrawFadeIn( sal_True
);
2628 ImplDrawAutoHide( sal_True
);
2630 // FrameSet-Hintergruende zeichnen
2631 ImplDrawBack( this, mpMainSet
);
2633 // Splitter zeichnen
2634 if ( !(mnWinStyle
& WB_NOSPLITDRAW
) )
2635 ImplDrawSplit( this, mpMainSet
, mbHorz
, !mbBottomRight
);
2638 // -----------------------------------------------------------------------
2640 void SplitWindow::Move()
2642 DockingWindow::Move();
2645 // -----------------------------------------------------------------------
2647 void SplitWindow::Resize()
2649 Size aSize
= GetOutputSizePixel();
2650 mnDX
= aSize
.Width();
2651 mnDY
= aSize
.Height();
2657 // -----------------------------------------------------------------------
2659 void SplitWindow::RequestHelp( const HelpEvent
& rHEvt
)
2661 // no keyboard help for splitwin
2662 if ( rHEvt
.GetMode() & (HELPMODE_BALLOON
| HELPMODE_QUICK
) && !rHEvt
.KeyboardActivated() )
2664 Point aMousePosPixel
= ScreenToOutputPixel( rHEvt
.GetMousePosPixel() );
2665 Rectangle aHelpRect
;
2666 sal_uInt16 nHelpResId
= 0;
2668 ImplGetAutoHideRect( aHelpRect
, sal_True
);
2669 if ( aHelpRect
.IsInside( aMousePosPixel
) )
2672 nHelpResId
= SV_HELPTEXT_SPLITFIXED
;
2674 nHelpResId
= SV_HELPTEXT_SPLITFLOATING
;
2678 ImplGetFadeInRect( aHelpRect
, sal_True
);
2679 if ( aHelpRect
.IsInside( aMousePosPixel
) )
2680 nHelpResId
= SV_HELPTEXT_FADEIN
;
2683 ImplGetFadeOutRect( aHelpRect
, sal_True
);
2684 if ( aHelpRect
.IsInside( aMousePosPixel
) )
2685 nHelpResId
= SV_HELPTEXT_FADEOUT
;
2689 // Rechteck ermitteln
2692 Point aPt
= OutputToScreenPixel( aHelpRect
.TopLeft() );
2693 aHelpRect
.Left() = aPt
.X();
2694 aHelpRect
.Top() = aPt
.Y();
2695 aPt
= OutputToScreenPixel( aHelpRect
.BottomRight() );
2696 aHelpRect
.Right() = aPt
.X();
2697 aHelpRect
.Bottom() = aPt
.Y();
2699 // Text ermitteln und anzeigen
2701 ResMgr
* pResMgr
= ImplGetResMgr();
2703 aStr
= ResId( nHelpResId
, *pResMgr
).toString();
2704 if ( rHEvt
.GetMode() & HELPMODE_BALLOON
)
2705 Help::ShowBalloon( this, aHelpRect
.Center(), aHelpRect
, aStr
);
2707 Help::ShowQuickHelp( this, aHelpRect
, aStr
);
2712 DockingWindow::RequestHelp( rHEvt
);
2715 // -----------------------------------------------------------------------
2717 void SplitWindow::StateChanged( StateChangedType nType
)
2721 case STATE_CHANGE_INITSHOW
:
2722 if ( IsUpdateMode() )
2725 case STATE_CHANGE_UPDATEMODE
:
2726 if ( IsUpdateMode() && IsReallyShown() )
2729 case STATE_CHANGE_CONTROLBACKGROUND
:
2735 DockingWindow::StateChanged( nType
);
2738 // -----------------------------------------------------------------------
2740 void SplitWindow::DataChanged( const DataChangedEvent
& rDCEvt
)
2742 if ( (rDCEvt
.GetType() == DATACHANGED_SETTINGS
) &&
2743 (rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
2749 DockingWindow::DataChanged( rDCEvt
);
2752 // -----------------------------------------------------------------------
2754 void SplitWindow::InsertItem( sal_uInt16 nId
, Window
* pWindow
, long nSize
,
2755 sal_uInt16 nPos
, sal_uInt16 nSetId
,
2756 SplitWindowItemBits nBits
)
2759 sal_uInt16 nDbgDummy
;
2760 DBG_ASSERT( ImplFindSet( mpMainSet
, nSetId
), "SplitWindow::InsertItem() - Set not exists" );
2761 DBG_ASSERT( !ImplFindItem( mpMainSet
, nId
, nDbgDummy
), "SplitWindow::InsertItem() - Id already exists" );
2764 // Size has to be at least 1.
2768 ImplSplitSet
* pSet
= ImplFindSet( mpMainSet
, nSetId
);
2769 ImplSplitSet
* pNewSet
;
2770 ImplSplitItem
* pItem
;
2772 // Make room for the new item.
2773 if ( nPos
> pSet
->mnItems
)
2774 nPos
= pSet
->mnItems
;
2775 ImplSplitItem
* pNewItems
= new ImplSplitItem
[pSet
->mnItems
+1];
2777 memcpy( pNewItems
, pSet
->mpItems
, sizeof( ImplSplitItem
)*nPos
);
2778 if ( nPos
< pSet
->mnItems
)
2779 memcpy( pNewItems
+nPos
+1, pSet
->mpItems
+nPos
, sizeof( ImplSplitItem
)*(pSet
->mnItems
-nPos
) );
2780 delete[] pSet
->mpItems
;
2781 pSet
->mpItems
= pNewItems
;
2783 pSet
->mbCalcPix
= sal_True
;
2785 // Create and initialize item.
2786 pItem
= &(pSet
->mpItems
[nPos
]);
2787 memset( pItem
, 0, sizeof( ImplSplitItem
) );
2788 pItem
->mnSize
= nSize
;
2790 pItem
->mnBits
= nBits
;
2791 pItem
->mnMinSize
=-1;
2792 pItem
->mnMaxSize
=-1;
2796 pItem
->mpWindow
= pWindow
;
2797 pItem
->mpOrgParent
= pWindow
->GetParent();
2799 // Attach window to SplitWindow.
2801 pWindow
->SetParent( this );
2805 pNewSet
= new ImplSplitSet
;
2806 pNewSet
->mpItems
= NULL
;
2807 pNewSet
->mpWallpaper
= NULL
;
2808 pNewSet
->mpBitmap
= NULL
;
2809 pNewSet
->mnLastSize
= 0;
2810 pNewSet
->mnItems
= 0;
2811 pNewSet
->mnId
= nId
;
2812 pNewSet
->mnSplitSize
= pSet
->mnSplitSize
;
2813 pNewSet
->mbCalcPix
= sal_True
;
2815 pItem
->mpSet
= pNewSet
;
2821 // -----------------------------------------------------------------------
2823 void SplitWindow::InsertItem( sal_uInt16 nId
, long nSize
,
2824 sal_uInt16 nPos
, sal_uInt16 nSetId
,
2825 SplitWindowItemBits nBits
)
2827 InsertItem( nId
, NULL
, nSize
, nPos
, nSetId
, nBits
);
2830 // -----------------------------------------------------------------------
2832 void SplitWindow::RemoveItem( sal_uInt16 nId
, sal_Bool bHide
)
2835 sal_uInt16 nDbgDummy
;
2836 DBG_ASSERT( ImplFindItem( mpMainSet
, nId
, nDbgDummy
), "SplitWindow::RemoveItem() - Id not found" );
2841 ImplSplitSet
* pSet
= ImplFindItem( mpMainSet
, nId
, nPos
);
2842 ImplSplitItem
* pItem
= &(pSet
->mpItems
[nPos
]);
2843 Window
* pWindow
= pItem
->mpWindow
;
2844 Window
* pOrgParent
= pItem
->mpOrgParent
;
2846 // Evt. Set loeschen
2848 ImplDeleteSet( pItem
->mpSet
);
2852 pSet
->mbCalcPix
= sal_True
;
2853 if ( pSet
->mnItems
)
2855 memmove( pSet
->mpItems
+nPos
, pSet
->mpItems
+nPos
+1,
2856 (pSet
->mnItems
-nPos
)*sizeof( ImplSplitItem
) );
2860 delete[] pSet
->mpItems
;
2861 pSet
->mpItems
= NULL
;
2866 // Window erst hier loeschen, um weniger Paints zu haben
2869 // Fenster wieder herstellen
2870 if ( bHide
|| (pOrgParent
!= this) )
2873 pWindow
->SetParent( pOrgParent
);
2878 // -----------------------------------------------------------------------
2880 void SplitWindow::Clear()
2882 // Alle Sets loeschen
2883 ImplDeleteSet( mpMainSet
);
2885 // Main-Set wieder anlegen
2886 mpMainSet
= new ImplSplitSet
;
2887 mpMainSet
->mpItems
= NULL
;
2888 mpMainSet
->mpWallpaper
= NULL
;
2889 mpMainSet
->mpBitmap
= NULL
;
2890 mpMainSet
->mnLastSize
= 0;
2891 mpMainSet
->mnItems
= 0;
2892 mpMainSet
->mnId
= 0;
2893 mpMainSet
->mnSplitSize
= SPLITWIN_SPLITSIZE
;
2894 mpMainSet
->mbCalcPix
= sal_True
;
2895 if ( mnWinStyle
& WB_NOSPLITDRAW
)
2896 mpMainSet
->mnSplitSize
-= 2;
2897 mpBaseSet
= mpMainSet
;
2899 // Und neu invalidieren
2903 // -----------------------------------------------------------------------
2905 void SplitWindow::SplitItem( sal_uInt16 nId
, long nNewSize
,
2906 sal_Bool bPropSmall
, sal_Bool bPropGreat
)
2916 ImplSplitSet
* pSet
= ImplFindItem( mpBaseSet
, nId
, nPos
);
2917 ImplSplitItem
* pItems
;
2922 nItems
= pSet
->mnItems
;
2923 pItems
= pSet
->mpItems
;
2925 // When there is an explicit minimum or maximum size then move nNewSize
2926 // into that range (when it is not yet already in it.)
2927 nNewSize
= ValidateSize(nNewSize
, pItems
[nPos
]);
2931 pItems
[nPos
].mnSize
= nNewSize
;
2935 nDelta
= nNewSize
-pItems
[nPos
].mnPixSize
;
2939 // Bereich berechnen, der beim Splitten betroffen sein kann
2942 for ( i
= 0; i
< nItems
; i
++ )
2944 if ( pItems
[i
].mbFixed
)
2953 // Wenn das Fenster sizeable ist, wird das TopSet anders behandelt
2954 sal_Bool bSmall
= sal_True
;
2955 sal_Bool bGreat
= sal_True
;
2956 if ( (pSet
== mpMainSet
) && (mnWinStyle
& WB_SIZEABLE
) )
2958 if ( nPos
< pSet
->mnItems
-1 )
2960 if ( !((bPropSmall
&& bPropGreat
) ||
2961 ((nDelta
> 0) && bPropSmall
) ||
2962 ((nDelta
< 0) && bPropGreat
)) )
2978 else if ( nPos
>= nMax
)
2983 else if ( nPos
&& (nPos
>= pSet
->mnItems
-1) )
2987 sal_Bool bTemp
= bPropSmall
;
2988 bPropSmall
= bPropGreat
;
2992 // Jetzt die Fenster splitten
2999 nTempDelta
= nDelta
;
3007 pItems
[n
].mnPixSize
++;
3014 while ( nTempDelta
);
3017 pItems
[nPos
+1].mnPixSize
-= nDelta
;
3029 if ( nDelta
&& pItems
[n
-1].mnPixSize
)
3031 pItems
[n
-1].mnPixSize
--;
3046 if ( pItems
[n
-1].mnPixSize
+nDelta
< 0 )
3048 nDelta
+= pItems
[n
-1].mnPixSize
;
3049 pItems
[n
-1].mnPixSize
= 0;
3053 pItems
[n
-1].mnPixSize
+= nDelta
;
3068 nTempDelta
= nDelta
;
3076 pItems
[n
-1].mnPixSize
++;
3083 while ( nTempDelta
);
3086 pItems
[nPos
].mnPixSize
+= nDelta
;
3098 if ( nDelta
&& pItems
[n
].mnPixSize
)
3100 pItems
[n
].mnPixSize
--;
3115 if ( pItems
[n
].mnPixSize
-nDelta
< 0 )
3117 nDelta
-= pItems
[n
].mnPixSize
;
3118 pItems
[n
].mnPixSize
= 0;
3122 pItems
[n
].mnPixSize
-= nDelta
;
3132 // Original-Groessen updaten
3133 ImplCalcLogSize( pItems
, nItems
);
3138 // -----------------------------------------------------------------------
3140 void SplitWindow::SetItemSize( sal_uInt16 nId
, long nNewSize
)
3143 ImplSplitSet
* pSet
= ImplFindItem( mpBaseSet
, nId
, nPos
);
3144 ImplSplitItem
* pItem
;
3149 // Testen, ob sich Groesse aendert
3150 pItem
= &(pSet
->mpItems
[nPos
]);
3151 if ( pItem
->mnSize
!= nNewSize
)
3153 // Neue Groesse setzen und neu durchrechnen
3154 pItem
->mnSize
= nNewSize
;
3155 pSet
->mbCalcPix
= sal_True
;
3160 // -----------------------------------------------------------------------
3162 long SplitWindow::GetItemSize( sal_uInt16 nId
) const
3165 ImplSplitSet
* pSet
= ImplFindItem( mpBaseSet
, nId
, nPos
);
3168 return pSet
->mpItems
[nPos
].mnSize
;
3173 // -----------------------------------------------------------------------
3175 long SplitWindow::GetItemSize( sal_uInt16 nId
, SplitWindowItemBits nBits
) const
3178 ImplSplitSet
* pSet
= ImplFindItem( mpBaseSet
, nId
, nPos
);
3182 if ( nBits
== pSet
->mpItems
[nPos
].mnBits
)
3183 return pSet
->mpItems
[nPos
].mnSize
;
3186 ((SplitWindow
*)this)->ImplCalcLayout();
3190 ImplSplitItem
* pItems
;
3192 SplitWindowItemBits nTempBits
;
3194 nItems
= pSet
->mnItems
;
3195 pItems
= pSet
->mpItems
;
3196 for ( i
= 0; i
< nItems
; i
++ )
3201 nTempBits
= pItems
[i
].mnBits
;
3202 if ( nTempBits
& SWIB_RELATIVESIZE
)
3203 nRelSize
+= pItems
[i
].mnPixSize
;
3204 else if ( nTempBits
& SWIB_PERCENTSIZE
)
3205 nPerSize
+= pItems
[i
].mnPixSize
;
3207 nPerSize
+= nRelSize
;
3208 if ( nBits
& SWIB_RELATIVESIZE
)
3211 return (pItems
[nPos
].mnPixSize
+(nRelSize
/2))/nRelSize
;
3215 else if ( nBits
& SWIB_PERCENTSIZE
)
3218 return (pItems
[nPos
].mnPixSize
*100)/nPerSize
;
3223 return pItems
[nPos
].mnPixSize
;
3233 void SplitWindow::SetItemSizeRange (sal_uInt16 nId
, const Range aRange
)
3236 ImplSplitSet
* pSet
= ImplFindItem(mpBaseSet
, nId
, nPos
);
3240 pSet
->mpItems
[nPos
].mnMinSize
= aRange
.Min();
3241 pSet
->mpItems
[nPos
].mnMaxSize
= aRange
.Max();
3245 // -----------------------------------------------------------------------
3247 sal_uInt16
SplitWindow::GetSet( sal_uInt16 nId
) const
3250 ImplSplitSet
* pSet
= ImplFindItem( mpBaseSet
, nId
, nPos
);
3258 // -----------------------------------------------------------------------
3260 sal_Bool
SplitWindow::IsItemValid( sal_uInt16 nId
) const
3263 ImplSplitSet
* pSet
= mpBaseSet
? ImplFindItem(mpBaseSet
, nId
, nPos
) : NULL
;
3271 // -----------------------------------------------------------------------
3273 sal_uInt16
SplitWindow::GetItemId( Window
* pWindow
) const
3275 return ImplFindItem( mpBaseSet
, pWindow
);
3278 // -----------------------------------------------------------------------
3280 sal_uInt16
SplitWindow::GetItemId( const Point
& rPos
) const
3282 return ImplFindItem( mpBaseSet
, rPos
, mbHorz
, !mbBottomRight
);
3285 // -----------------------------------------------------------------------
3287 sal_uInt16
SplitWindow::GetItemPos( sal_uInt16 nId
, sal_uInt16 nSetId
) const
3289 ImplSplitSet
* pSet
= ImplFindSet( mpBaseSet
, nSetId
);
3290 sal_uInt16 nPos
= SPLITWINDOW_ITEM_NOTFOUND
;
3294 for ( sal_uInt16 i
= 0; i
< pSet
->mnItems
; i
++ )
3296 if ( pSet
->mpItems
[i
].mnId
== nId
)
3307 // -----------------------------------------------------------------------
3309 sal_uInt16
SplitWindow::GetItemId( sal_uInt16 nPos
, sal_uInt16 nSetId
) const
3311 ImplSplitSet
* pSet
= ImplFindSet( mpBaseSet
, nSetId
);
3312 if ( pSet
&& (nPos
< pSet
->mnItems
) )
3313 return pSet
->mpItems
[nPos
].mnId
;
3318 // -----------------------------------------------------------------------
3320 sal_uInt16
SplitWindow::GetItemCount( sal_uInt16 nSetId
) const
3322 ImplSplitSet
* pSet
= ImplFindSet( mpBaseSet
, nSetId
);
3324 return pSet
->mnItems
;
3329 // -----------------------------------------------------------------------
3331 void SplitWindow::ImplNewAlign()
3336 mbBottomRight
= sal_False
;
3342 case WINDOWALIGN_TOP
:
3344 mbBottomRight
= sal_False
;
3346 case WINDOWALIGN_BOTTOM
:
3348 mbBottomRight
= sal_True
;
3350 case WINDOWALIGN_LEFT
:
3352 mbBottomRight
= sal_False
;
3354 case WINDOWALIGN_RIGHT
:
3356 mbBottomRight
= sal_True
;
3361 if ( mnWinStyle
& WB_BORDER
)
3363 ImplCalcBorder( meAlign
, mbNoAlign
, mnLeftBorder
, mnTopBorder
,
3364 mnRightBorder
, mnBottomBorder
);
3367 if ( IsReallyVisible() && IsUpdateMode() )
3372 // -----------------------------------------------------------------------
3374 void SplitWindow::SetAlign( WindowAlign eNewAlign
)
3376 if ( meAlign
!= eNewAlign
)
3378 meAlign
= eNewAlign
;
3383 // -----------------------------------------------------------------------
3385 void SplitWindow::ShowAutoHideButton( sal_Bool bShow
)
3391 // -----------------------------------------------------------------------
3393 void SplitWindow::ShowFadeInHideButton( sal_Bool bShow
)
3399 // -----------------------------------------------------------------------
3401 void SplitWindow::ShowFadeOutButton( sal_Bool bShow
)
3407 // -----------------------------------------------------------------------
3409 void SplitWindow::SetAutoHideState( sal_Bool bAutoHide
)
3411 mbAutoHideIn
= bAutoHide
;
3412 if ( IsReallyVisible() )
3415 ImplGetAutoHideRect( aRect
);
3416 Invalidate( aRect
);
3420 // -----------------------------------------------------------------------
3422 long SplitWindow::GetFadeInSize() const
3427 n
= mnTopBorder
+mnBottomBorder
;
3429 n
= mnLeftBorder
+mnRightBorder
;
3431 return n
+SPLITWIN_SPLITSIZE
+SPLITWIN_SPLITSIZEEX
-2;
3434 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */