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