Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifdef SOLARIS
21 : #include <ctime>
22 : #endif
23 :
24 : #include <string>
25 :
26 : #include <vcl/wrkwin.hxx>
27 : #include <unotools/viewoptions.hxx>
28 :
29 : #include <vcl/timer.hxx>
30 :
31 : #include "splitwin.hxx"
32 : #include "workwin.hxx"
33 : #include <sfx2/dockwin.hxx>
34 : #include <sfx2/app.hxx>
35 : #include "dialog.hrc"
36 : #include "sfx2/sfxresid.hxx"
37 : #include <sfx2/mnumgr.hxx>
38 : #include "virtmenu.hxx"
39 : #include <sfx2/msgpool.hxx>
40 : #include <sfx2/viewfrm.hxx>
41 :
42 : using namespace ::com::sun::star::uno;
43 : using namespace ::rtl;
44 :
45 : #define VERSION 1
46 : #define nPixel 30L
47 : #define USERITEM_NAME OUString("UserItem")
48 :
49 : struct SfxDock_Impl
50 : {
51 : sal_uInt16 nType;
52 : SfxDockingWindow* pWin; // SplitWindow has this window
53 : sal_Bool bNewLine;
54 : sal_Bool bHide; // SplitWindow had this window
55 : long nSize;
56 : };
57 :
58 960 : class SfxDockArr_Impl : public std::vector<SfxDock_Impl*>
59 : {
60 : public:
61 252 : ~SfxDockArr_Impl()
62 252 : {
63 252 : for(const_iterator it = begin(); it != end(); ++it)
64 0 : delete *it;
65 252 : }
66 :
67 : };
68 :
69 : class SfxEmptySplitWin_Impl : public SplitWindow
70 : {
71 : /* [Description]
72 :
73 : The SfxEmptySplitWin_Impldow is an empty SplitWindow, that replaces the
74 : SfxSplitWindow AutoHide mode. It only serves as a placeholder to receive
75 : mouse moves and if possible blend in the true SplitWindow display.
76 : */
77 : friend class SfxSplitWindow;
78 :
79 : SfxSplitWindow* pOwner;
80 : sal_Bool bFadeIn;
81 : sal_Bool bAutoHide;
82 : sal_Bool bSplit;
83 : sal_Bool bEndAutoHide;
84 : Timer aTimer;
85 : Point aLastPos;
86 : sal_uInt16 nState;
87 :
88 960 : SfxEmptySplitWin_Impl( SfxSplitWindow *pParent )
89 : : SplitWindow( pParent->GetParent(), WinBits( WB_BORDER | WB_3DLOOK ) )
90 : , pOwner( pParent )
91 : , bFadeIn( sal_False )
92 : , bAutoHide( sal_False )
93 : , bSplit( sal_False )
94 : , bEndAutoHide( sal_False )
95 960 : , nState( 1 )
96 : {
97 : aTimer.SetTimeoutHdl(
98 960 : LINK(pOwner, SfxSplitWindow, TimerHdl ) );
99 960 : aTimer.SetTimeout( 200 );
100 960 : SetAlign( pOwner->GetAlign() );
101 960 : Actualize();
102 960 : ShowAutoHideButton( pOwner->IsAutoHideButtonVisible() );
103 960 : ShowFadeInHideButton( sal_True );
104 960 : }
105 :
106 504 : ~SfxEmptySplitWin_Impl()
107 504 : {
108 252 : aTimer.Stop();
109 504 : }
110 :
111 : virtual void MouseMove( const MouseEvent& );
112 : virtual void AutoHide();
113 : virtual void FadeIn();
114 : void Actualize();
115 : };
116 :
117 960 : void SfxEmptySplitWin_Impl::Actualize()
118 : {
119 960 : Size aSize( pOwner->GetSizePixel() );
120 960 : switch ( pOwner->GetAlign() )
121 : {
122 : case WINDOWALIGN_LEFT:
123 : case WINDOWALIGN_RIGHT:
124 480 : aSize.Width() = GetFadeInSize();
125 480 : break;
126 : case WINDOWALIGN_TOP:
127 : case WINDOWALIGN_BOTTOM:
128 480 : aSize.Height() = GetFadeInSize();
129 480 : break;
130 : }
131 :
132 960 : SetSizePixel( aSize );
133 960 : }
134 :
135 0 : void SfxEmptySplitWin_Impl::AutoHide()
136 : {
137 0 : pOwner->SetPinned_Impl( !pOwner->bPinned );
138 0 : pOwner->SaveConfig_Impl();
139 0 : bAutoHide = sal_True;
140 0 : FadeIn();
141 0 : }
142 :
143 0 : void SfxEmptySplitWin_Impl::FadeIn()
144 : {
145 0 : if (!bAutoHide )
146 0 : bAutoHide = IsFadeNoButtonMode();
147 0 : pOwner->SetFadeIn_Impl( sal_True );
148 0 : pOwner->Show_Impl();
149 0 : if ( bAutoHide )
150 : {
151 : // Set Timer to close; the caller has to ensure themselves that the
152 : // Window is not closed instantly (eg by setting the focus or a modal
153 : // mode.
154 0 : aLastPos = GetPointerPosPixel();
155 0 : aTimer.Start();
156 : }
157 : else
158 0 : pOwner->SaveConfig_Impl();
159 0 : }
160 :
161 : //-------------------------------------------------------------------------
162 :
163 0 : void SfxSplitWindow::MouseButtonDown( const MouseEvent& rMEvt )
164 : {
165 0 : if ( rMEvt.GetClicks() != 2 )
166 0 : SplitWindow::MouseButtonDown( rMEvt );
167 0 : }
168 :
169 0 : void SfxEmptySplitWin_Impl::MouseMove( const MouseEvent& rMEvt )
170 : {
171 0 : SplitWindow::MouseMove( rMEvt );
172 0 : }
173 :
174 : //-------------------------------------------------------------------------
175 :
176 960 : SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl,
177 : SfxWorkWindow *pW, sal_Bool bWithButtons, WinBits nBits )
178 :
179 : /* [Description]
180 :
181 : A SfxSplitWindow brings the recursive structure of the SV-SplitWindows to
182 : the outside by simulating a table-like structure with rows and columns
183 : (maximum recursion depth 2). Furthermore, it ensures the persistence of
184 : the arrangement of the SfxDockingWindows.
185 : */
186 :
187 : : SplitWindow ( pParent, nBits | WB_HIDE ),
188 : eAlign(eAl),
189 : pWorkWin(pW),
190 960 : pDockArr( new SfxDockArr_Impl ),
191 : bLocked(sal_False),
192 : bPinned(sal_True),
193 : pEmptyWin(NULL),
194 1920 : pActive(NULL)
195 : {
196 960 : if ( bWithButtons )
197 : {
198 960 : ShowAutoHideButton( sal_False ); // no autohide button (pin) anymore
199 960 : ShowFadeOutButton( sal_True );
200 : }
201 :
202 : // Set SV-Alignment
203 : WindowAlign eTbxAlign;
204 960 : switch ( eAlign )
205 : {
206 : case SFX_ALIGN_LEFT:
207 240 : eTbxAlign = WINDOWALIGN_LEFT;
208 240 : break;
209 : case SFX_ALIGN_RIGHT:
210 240 : eTbxAlign = WINDOWALIGN_RIGHT;
211 240 : break;
212 : case SFX_ALIGN_TOP:
213 240 : eTbxAlign = WINDOWALIGN_TOP;
214 240 : break;
215 : case SFX_ALIGN_BOTTOM:
216 240 : eTbxAlign = WINDOWALIGN_BOTTOM;
217 240 : bPinned = sal_True;
218 240 : break;
219 : default:
220 0 : eTbxAlign = WINDOWALIGN_TOP; // some sort of default...
221 0 : break; // -Wall lots not handled..
222 : }
223 :
224 960 : SetAlign (eTbxAlign);
225 960 : pEmptyWin = new SfxEmptySplitWin_Impl( this );
226 960 : if ( bPinned )
227 : {
228 960 : pEmptyWin->bFadeIn = sal_True;
229 960 : pEmptyWin->nState = 2;
230 : }
231 :
232 960 : if ( bWithButtons )
233 : {
234 : // Read Configuration
235 960 : String aWindowId = rtl::OUString("SplitWindow");
236 960 : aWindowId += String::CreateFromInt32( (sal_Int32) eTbxAlign );
237 960 : SvtViewOptions aWinOpt( E_WINDOW, aWindowId );
238 960 : String aWinData;
239 960 : Any aUserItem = aWinOpt.GetUserItem( USERITEM_NAME );
240 960 : OUString aTemp;
241 960 : if ( aUserItem >>= aTemp )
242 428 : aWinData = String( aTemp );
243 960 : if ( aWinData.Len() && aWinData.GetChar( (sal_uInt16) 0 ) == 'V' )
244 : {
245 428 : pEmptyWin->nState = (sal_uInt16) aWinData.GetToken( 1, ',' ).ToInt32();
246 428 : if ( pEmptyWin->nState & 2 )
247 428 : pEmptyWin->bFadeIn = sal_True;
248 428 : bPinned = sal_True; // always assume pinned - floating mode not used anymore
249 :
250 428 : sal_uInt16 i=2;
251 428 : sal_uInt16 nCount = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32();
252 428 : for ( sal_uInt16 n=0; n<nCount; n++ )
253 : {
254 0 : SfxDock_Impl *pDock = new SfxDock_Impl;
255 0 : pDock->pWin = 0;
256 0 : pDock->bNewLine = sal_False;
257 0 : pDock->bHide = sal_True;
258 0 : pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32();
259 0 : if ( !pDock->nType )
260 : {
261 : // could mean NewLine
262 0 : pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32();
263 0 : if ( !pDock->nType )
264 : {
265 : // Read error
266 0 : delete pDock;
267 : break;
268 : }
269 : else
270 0 : pDock->bNewLine = sal_True;
271 : }
272 :
273 0 : pDockArr->insert(pDockArr->begin() + n, pDock);
274 : }
275 960 : }
276 : }
277 : else
278 : {
279 0 : bPinned = sal_True;
280 0 : pEmptyWin->bFadeIn = sal_True;
281 0 : pEmptyWin->nState = 2;
282 : }
283 :
284 960 : SetAutoHideState( !bPinned );
285 960 : pEmptyWin->SetAutoHideState( !bPinned );
286 960 : }
287 :
288 : //-------------------------------------------------------------------------
289 :
290 756 : SfxSplitWindow::~SfxSplitWindow()
291 : {
292 252 : if ( !pWorkWin->GetParent_Impl() )
293 252 : SaveConfig_Impl();
294 :
295 252 : if ( pEmptyWin )
296 : {
297 : // Set pOwner to NULL, otherwise try to delete pEmptyWin once more. The
298 : // window that is just beeing docked is always deleted from the outside.
299 252 : pEmptyWin->pOwner = NULL;
300 252 : delete pEmptyWin;
301 : }
302 :
303 252 : delete pDockArr;
304 504 : }
305 :
306 252 : void SfxSplitWindow::SaveConfig_Impl()
307 : {
308 : // Save configuration
309 252 : rtl::OUStringBuffer aWinData;
310 252 : aWinData.append('V');
311 252 : aWinData.append(static_cast<sal_Int32>(VERSION));
312 252 : aWinData.append(',');
313 252 : aWinData.append(static_cast<sal_Int32>(pEmptyWin->nState));
314 252 : aWinData.append(',');
315 :
316 252 : sal_uInt16 nCount = 0;
317 : sal_uInt16 n;
318 252 : for ( n=0; n<pDockArr->size(); n++ )
319 : {
320 0 : SfxDock_Impl *pDock = (*pDockArr)[n];
321 0 : if ( pDock->bHide || pDock->pWin )
322 0 : nCount++;
323 : }
324 :
325 252 : aWinData.append(static_cast<sal_Int32>(nCount));
326 :
327 252 : for ( n=0; n<pDockArr->size(); n++ )
328 : {
329 0 : SfxDock_Impl *pDock = (*pDockArr)[n];
330 0 : if ( !pDock->bHide && !pDock->pWin )
331 0 : continue;
332 0 : if ( pDock->bNewLine )
333 0 : aWinData.append(",0");
334 0 : aWinData.append(',');
335 0 : aWinData.append(static_cast<sal_Int32>(pDock->nType));
336 : }
337 :
338 252 : String aWindowId = rtl::OUString("SplitWindow");
339 252 : aWindowId += String::CreateFromInt32( (sal_Int32) GetAlign() );
340 252 : SvtViewOptions aWinOpt( E_WINDOW, aWindowId );
341 252 : aWinOpt.SetUserItem( USERITEM_NAME, makeAny( aWinData.makeStringAndClear() ) );
342 252 : }
343 :
344 : //-------------------------------------------------------------------------
345 :
346 0 : void SfxSplitWindow::StartSplit()
347 : {
348 0 : long nSize = 0;
349 0 : Size aSize = GetSizePixel();
350 :
351 0 : if ( pEmptyWin )
352 : {
353 0 : pEmptyWin->bFadeIn = sal_True;
354 0 : pEmptyWin->bSplit = sal_True;
355 : }
356 :
357 0 : Rectangle aRect = pWorkWin->GetFreeArea( !bPinned );
358 0 : switch ( GetAlign() )
359 : {
360 : case WINDOWALIGN_LEFT:
361 : case WINDOWALIGN_RIGHT:
362 0 : nSize = aSize.Width() + aRect.GetWidth();
363 0 : break;
364 : case WINDOWALIGN_TOP:
365 : case WINDOWALIGN_BOTTOM:
366 0 : nSize = aSize.Height() + aRect.GetHeight();
367 0 : break;
368 : }
369 :
370 0 : SetMaxSizePixel( nSize );
371 0 : }
372 :
373 : //-------------------------------------------------------------------------
374 :
375 0 : void SfxSplitWindow::SplitResize()
376 : {
377 0 : if ( bPinned )
378 : {
379 0 : pWorkWin->ArrangeChildren_Impl();
380 0 : pWorkWin->ShowChildren_Impl();
381 : }
382 : else
383 0 : pWorkWin->ArrangeAutoHideWindows( this );
384 0 : }
385 :
386 : //-------------------------------------------------------------------------
387 :
388 0 : void SfxSplitWindow::Split()
389 : {
390 0 : if ( pEmptyWin )
391 0 : pEmptyWin->bSplit = sal_False;
392 :
393 0 : SplitWindow::Split();
394 :
395 0 : sal_uInt16 nCount = pDockArr->size();
396 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
397 : {
398 0 : SfxDock_Impl *pD = (*pDockArr)[n];
399 0 : if ( pD->pWin )
400 : {
401 0 : sal_uInt16 nId = pD->nType;
402 0 : long nSize = GetItemSize( nId, SWIB_FIXED );
403 0 : long nSetSize = GetItemSize( GetSet( nId ) );
404 0 : Size aSize;
405 :
406 0 : if ( IsHorizontal() )
407 : {
408 0 : aSize.Width() = nSize;
409 0 : aSize.Height() = nSetSize;
410 : }
411 : else
412 : {
413 0 : aSize.Width() = nSetSize;
414 0 : aSize.Height() = nSize;
415 : }
416 :
417 0 : pD->pWin->SetItemSize_Impl( aSize );
418 : }
419 : }
420 :
421 0 : SaveConfig_Impl();
422 0 : }
423 :
424 : //-------------------------------------------------------------------------
425 :
426 0 : void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize)
427 :
428 : /*
429 : To insert SfxDockingWindows just pass no position. The SfxSplitWindow
430 : searches the last marked one to the passed SfxDockingWindow or appends a
431 : new one at the end.
432 : */
433 : {
434 0 : short nLine = -1; // so that the first window cab set nline to 0
435 : sal_uInt16 nL;
436 0 : sal_uInt16 nPos = 0;
437 0 : sal_Bool bNewLine = sal_True;
438 0 : sal_Bool bSaveConfig = sal_False;
439 0 : SfxDock_Impl *pFoundDock=0;
440 0 : sal_uInt16 nCount = pDockArr->size();
441 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
442 : {
443 0 : SfxDock_Impl *pDock = (*pDockArr)[n];
444 0 : if ( pDock->bNewLine )
445 : {
446 : // The window opens a new line
447 0 : if ( pFoundDock )
448 : // But after the just inserted window
449 0 : break;
450 :
451 : // New line
452 0 : nPos = 0;
453 0 : bNewLine = sal_True;
454 : }
455 :
456 0 : if ( pDock->pWin )
457 : {
458 : // Does there exist a window now at this position
459 0 : if ( bNewLine && !pFoundDock )
460 : {
461 : // Not known until now in which real line it is located
462 0 : GetWindowPos( pDock->pWin, nL, nPos );
463 0 : nLine = (short) nL;
464 : }
465 :
466 0 : if ( !pFoundDock )
467 : {
468 : // The window is located before the inserted one
469 0 : nPos++;
470 : }
471 :
472 : // Line is opened
473 0 : bNewLine = sal_False;
474 0 : if ( pFoundDock )
475 0 : break;
476 : }
477 :
478 0 : if ( pDock->nType == pDockWin->GetType() )
479 : {
480 : DBG_ASSERT( !pFoundDock && !pDock->pWin, "Window already exists!");
481 0 : pFoundDock = pDock;
482 0 : if ( !bNewLine )
483 0 : break;
484 : else
485 : {
486 : // A new line has been created but no window was found there;
487 : // continue searching for a window in this line in-order to set
488 : // bNewLine correctly. While doing so nline or nPos are not
489 : // to be changed!
490 0 : nLine++;
491 : }
492 : }
493 : }
494 :
495 0 : if ( !pFoundDock )
496 : {
497 : // Not found, insert at end
498 0 : pFoundDock = new SfxDock_Impl;
499 0 : pFoundDock->bHide = sal_True;
500 0 : pDockArr->push_back( pFoundDock );
501 0 : pFoundDock->nType = pDockWin->GetType();
502 0 : nLine++;
503 0 : nPos = 0;
504 0 : bNewLine = sal_True;
505 0 : pFoundDock->bNewLine = bNewLine;
506 0 : bSaveConfig = sal_True;
507 : }
508 :
509 0 : pFoundDock->pWin = pDockWin;
510 0 : pFoundDock->bHide = sal_False;
511 0 : InsertWindow_Impl( pFoundDock, rSize, nLine, nPos, bNewLine );
512 0 : if ( bSaveConfig )
513 0 : SaveConfig_Impl();
514 0 : }
515 :
516 : //-------------------------------------------------------------------------
517 :
518 0 : void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, sal_Bool bSave)
519 : {
520 : // The docking window is no longer stored in the internal data.
521 0 : SfxDock_Impl *pDock=0;
522 0 : sal_uInt16 nCount = pDockArr->size();
523 0 : sal_Bool bFound = sal_False;
524 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
525 : {
526 0 : pDock = (*pDockArr)[n];
527 0 : if ( pDock->nType == pDockWin->GetType() )
528 : {
529 0 : if ( pDock->bNewLine && n<nCount-1 )
530 0 : (*pDockArr)[n+1]->bNewLine = sal_True;
531 :
532 : // Window has a position, this we forget
533 0 : bFound = sal_True;
534 0 : pDockArr->erase(pDockArr->begin() + n);
535 0 : break;
536 : }
537 : }
538 :
539 0 : if ( bFound )
540 0 : delete pDock;
541 :
542 0 : if ( bSave )
543 0 : SaveConfig_Impl();
544 0 : }
545 :
546 : //-------------------------------------------------------------------------
547 :
548 0 : void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize,
549 : sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine)
550 :
551 : /* [Description]
552 :
553 : The docking window is moved within the SplitWindows.
554 : */
555 :
556 : {
557 : sal_uInt16 nL, nP;
558 0 : GetWindowPos( pDockWin, nL, nP );
559 :
560 0 : if ( nLine > nL && GetItemCount( GetItemId( nL, 0 ) ) == 1 )
561 : {
562 : // If the last window is removed from its line, then everything slips
563 : // one line to the front!
564 0 : nLine--;
565 : }
566 0 : RemoveWindow( pDockWin );
567 0 : InsertWindow( pDockWin, rSize, nLine, nPos, bNewLine );
568 0 : }
569 :
570 : //-------------------------------------------------------------------------
571 :
572 0 : void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize,
573 : sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine)
574 :
575 : /* [Description]
576 :
577 : The DockingWindow that is pushed on this SplitWindow and shall hold the
578 : given position and size.
579 : */
580 : {
581 0 : ReleaseWindow_Impl( pDockWin, sal_False );
582 0 : SfxDock_Impl *pDock = new SfxDock_Impl;
583 0 : pDock->bHide = sal_False;
584 0 : pDock->nType = pDockWin->GetType();
585 0 : pDock->bNewLine = bNewLine;
586 0 : pDock->pWin = pDockWin;
587 :
588 : DBG_ASSERT( nPos==0 || !bNewLine, "Wrong Paramenter!");
589 0 : if ( bNewLine )
590 0 : nPos = 0;
591 :
592 : // The window must be inserted before the first window so that it has the
593 : // same or a greater position than pDockWin.
594 0 : sal_uInt16 nCount = pDockArr->size();
595 0 : sal_uInt16 nLastWindowIdx(0);
596 :
597 : // If no window is found, a first window is inserted
598 0 : sal_uInt16 nInsertPos = 0;
599 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
600 : {
601 0 : SfxDock_Impl *pD = (*pDockArr)[n];
602 :
603 0 : if (pD->pWin)
604 : {
605 : // A docked window has been found. If no suitable window behind the
606 : // the desired insertion point s found, then insertion is done at
607 : // the end.
608 0 : nInsertPos = nCount;
609 0 : nLastWindowIdx = n;
610 0 : sal_uInt16 nL=0, nP=0;
611 0 : GetWindowPos( pD->pWin, nL, nP );
612 :
613 0 : if ( (nL == nLine && nP == nPos) || nL > nLine )
614 : {
615 : DBG_ASSERT( nL == nLine || bNewLine || nPos > 0, "Wrong Parameter!" );
616 0 : if ( nL == nLine && nPos == 0 && !bNewLine )
617 : {
618 : DBG_ASSERT(pD->bNewLine, "No new line?");
619 :
620 : // The posption is pushed to nPos==0
621 0 : pD->bNewLine = sal_False;
622 0 : pDock->bNewLine = sal_True;
623 : }
624 :
625 0 : nInsertPos = n != 0 ? nLastWindowIdx + 1 : 0; // ignore all non-windows after the last window
626 : break;
627 : }
628 : }
629 : }
630 0 : if (nCount != 0 && nInsertPos == nCount && nLastWindowIdx != nCount - 1)
631 : {
632 0 : nInsertPos = nLastWindowIdx + 1; // ignore all non-windows after the last window
633 : }
634 :
635 0 : pDockArr->insert(pDockArr->begin() + nInsertPos, pDock);
636 0 : InsertWindow_Impl( pDock, rSize, nLine, nPos, bNewLine );
637 0 : SaveConfig_Impl();
638 0 : }
639 :
640 : //-------------------------------------------------------------------------
641 :
642 0 : void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
643 : const Size& rSize,
644 : sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine)
645 :
646 : /* [Description]
647 :
648 : Adds a DockingWindow, and causes the recalculation of the size of
649 : the SplitWindows.
650 : */
651 :
652 : {
653 0 : SfxDockingWindow* pDockWin = pDock->pWin;
654 :
655 0 : sal_uInt16 nItemBits = pDockWin->GetWinBits_Impl();
656 :
657 : long nWinSize, nSetSize;
658 0 : if ( IsHorizontal() )
659 : {
660 0 : nWinSize = rSize.Width();
661 0 : nSetSize = rSize.Height();
662 : }
663 : else
664 : {
665 0 : nSetSize = rSize.Width();
666 0 : nWinSize = rSize.Height();
667 : }
668 :
669 0 : pDock->nSize = nWinSize;
670 :
671 0 : sal_Bool bUpdateMode = IsUpdateMode();
672 0 : if ( bUpdateMode )
673 0 : SetUpdateMode( sal_False );
674 :
675 0 : if ( bNewLine || nLine == GetItemCount( 0 ) )
676 : {
677 : // An existing row should not be inserted, instead a new one
678 : // will be created
679 :
680 0 : sal_uInt16 nId = 1;
681 0 : for ( sal_uInt16 n=0; n<GetItemCount(0); n++ )
682 : {
683 0 : if ( GetItemId(n) >= nId )
684 0 : nId = GetItemId(n)+1;
685 : }
686 :
687 : // Create a new nLine:th line
688 0 : sal_uInt16 nBits = nItemBits;
689 0 : if ( GetAlign() == WINDOWALIGN_TOP || GetAlign() == WINDOWALIGN_BOTTOM )
690 0 : nBits |= SWIB_COLSET;
691 0 : InsertItem( nId, nSetSize, nLine, 0, nBits );
692 : }
693 :
694 : // Insert the window at line with the position nline. ItemWindowSize set to
695 : // "percentage" share since the SV then does the re-sizing as expected,
696 : // "pixel" actually only makes sense if also items with percentage or
697 : // relative sizes are present.
698 0 : nItemBits |= SWIB_PERCENTSIZE;
699 0 : bLocked = sal_True;
700 0 : sal_uInt16 nSet = GetItemId( nLine );
701 0 : InsertItem( pDockWin->GetType(), pDockWin, nWinSize, nPos, nSet, nItemBits );
702 :
703 : // SplitWindows are once created in SFX and when inserting the first
704 : // DockingWindows is made visable.
705 0 : if ( GetItemCount( 0 ) == 1 && GetItemCount( 1 ) == 1 )
706 : {
707 : // The Rearranging in WorkWindow and a Show() on the SplitWindow is
708 : // caues by SfxDockingwindow (->SfxWorkWindow::ConfigChild_Impl)
709 0 : if ( !bPinned && !IsFloatingMode() )
710 : {
711 0 : bPinned = sal_True;
712 0 : sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0;
713 0 : pEmptyWin->bFadeIn = sal_False;
714 0 : SetPinned_Impl( sal_False );
715 0 : pEmptyWin->Actualize();
716 : OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" );
717 0 : pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE;
718 0 : pWorkWin->ArrangeChildren_Impl();
719 0 : if ( bFadeIn )
720 0 : FadeIn();
721 : }
722 : else
723 : {
724 0 : sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0;
725 0 : pEmptyWin->bFadeIn = sal_False;
726 0 : pEmptyWin->Actualize();
727 : #ifdef DBG_UTIL
728 : if ( !bPinned || !pEmptyWin->bFadeIn )
729 : {
730 : OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" );
731 : }
732 : else
733 : {
734 : OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" );
735 : }
736 : #endif
737 0 : pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE;
738 0 : pWorkWin->ArrangeChildren_Impl();
739 0 : if ( bFadeIn )
740 0 : FadeIn();
741 : }
742 :
743 0 : pWorkWin->ShowChildren_Impl();
744 : }
745 :
746 0 : if ( bUpdateMode )
747 0 : SetUpdateMode( sal_True );
748 0 : bLocked = sal_False;
749 0 : }
750 :
751 : //-------------------------------------------------------------------------
752 :
753 0 : void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide )
754 :
755 : /* [Description]
756 :
757 : Removes a DockingWindow. If it was the last one, then the SplitWindow is
758 : beeing hidden.
759 : */
760 : {
761 0 : sal_uInt16 nSet = GetSet( pDockWin->GetType() );
762 :
763 : // SplitWindows are once created in SFX and is made invisible after
764 : // removing the last DockingWindows.
765 0 : if ( GetItemCount( nSet ) == 1 && GetItemCount( 0 ) == 1 )
766 : {
767 : // The Rearranging in WorkWindow is caues by SfxDockingwindow
768 0 : Hide();
769 0 : pEmptyWin->aTimer.Stop();
770 0 : sal_uInt16 nRealState = pEmptyWin->nState;
771 0 : FadeOut_Impl();
772 0 : pEmptyWin->Hide();
773 : #ifdef DBG_UTIL
774 : if ( !bPinned || !pEmptyWin->bFadeIn )
775 : {
776 : OSL_TRACE( "SfxSplitWindow::RemoveWindow - releasing empty Splitwindow" );
777 : }
778 : else
779 : {
780 : OSL_TRACE( "SfxSplitWindow::RemoveWindow - releasing real Splitwindow" );
781 : }
782 : #endif
783 0 : pWorkWin->ReleaseChild_Impl( *GetSplitWindow() );
784 0 : pEmptyWin->nState = nRealState;
785 0 : pWorkWin->ArrangeAutoHideWindows( this );
786 : }
787 :
788 0 : SfxDock_Impl *pDock=0;
789 0 : sal_uInt16 nCount = pDockArr->size();
790 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
791 : {
792 0 : pDock = (*pDockArr)[n];
793 0 : if ( pDock->nType == pDockWin->GetType() )
794 : {
795 0 : pDock->pWin = 0;
796 0 : pDock->bHide = bHide;
797 0 : break;
798 : }
799 : }
800 :
801 : // Remove Windows, and if it was the last of the line, then also remove
802 : // the line (line = itemset)
803 0 : sal_Bool bUpdateMode = IsUpdateMode();
804 0 : if ( bUpdateMode )
805 0 : SetUpdateMode( sal_False );
806 0 : bLocked = sal_True;
807 :
808 0 : RemoveItem( pDockWin->GetType() );
809 :
810 0 : if ( nSet && !GetItemCount( nSet ) )
811 0 : RemoveItem( nSet );
812 :
813 0 : if ( bUpdateMode )
814 0 : SetUpdateMode( sal_True );
815 0 : bLocked = sal_False;
816 0 : };
817 :
818 : //-------------------------------------------------------------------------
819 :
820 0 : sal_Bool SfxSplitWindow::GetWindowPos( const SfxDockingWindow* pWindow,
821 : sal_uInt16& rLine, sal_uInt16& rPos ) const
822 : /* [Description]
823 :
824 : Returns the ID of the item sets and items for the DockingWindow in
825 : the position passed on the old row / column-name.
826 : */
827 :
828 : {
829 0 : sal_uInt16 nSet = GetSet ( pWindow->GetType() );
830 0 : if ( nSet == SPLITWINDOW_ITEM_NOTFOUND )
831 0 : return sal_False;
832 :
833 0 : rPos = GetItemPos( pWindow->GetType(), nSet );
834 0 : rLine = GetItemPos( nSet );
835 0 : return sal_True;
836 : }
837 :
838 : //-------------------------------------------------------------------------
839 :
840 0 : sal_Bool SfxSplitWindow::GetWindowPos( const Point& rTestPos,
841 : sal_uInt16& rLine, sal_uInt16& rPos ) const
842 : /* [Description]
843 :
844 : Returns the ID of the item sets and items for the DockingWindow in
845 : the position passed on the old row / column-name.
846 : */
847 :
848 : {
849 0 : sal_uInt16 nId = GetItemId( rTestPos );
850 0 : if ( nId == 0 )
851 0 : return sal_False;
852 :
853 0 : sal_uInt16 nSet = GetSet ( nId );
854 0 : rPos = GetItemPos( nId, nSet );
855 0 : rLine = GetItemPos( nSet );
856 0 : return sal_True;
857 : }
858 :
859 : //-------------------------------------------------------------------------
860 :
861 0 : sal_uInt16 SfxSplitWindow::GetLineCount() const
862 :
863 : /* [Description]
864 :
865 : Returns the number of rows = number of sub-itemsets in the root set.
866 : */
867 : {
868 0 : return GetItemCount( 0 );
869 : }
870 :
871 : //-------------------------------------------------------------------------
872 :
873 0 : long SfxSplitWindow::GetLineSize( sal_uInt16 nLine ) const
874 :
875 : /* [Description]
876 :
877 : Returns the Row Height of nline itemset.
878 : */
879 : {
880 0 : sal_uInt16 nId = GetItemId( nLine );
881 0 : return GetItemSize( nId );
882 : }
883 :
884 : //-------------------------------------------------------------------------
885 :
886 0 : sal_uInt16 SfxSplitWindow::GetWindowCount( sal_uInt16 nLine ) const
887 :
888 : /* [Description]
889 :
890 : Returns the total number of windows
891 : */
892 : {
893 0 : sal_uInt16 nId = GetItemId( nLine );
894 0 : return GetItemCount( nId );
895 : }
896 :
897 : //-------------------------------------------------------------------------
898 :
899 5256 : sal_uInt16 SfxSplitWindow::GetWindowCount() const
900 :
901 : /* [Description]
902 :
903 : Returns the total number of windows
904 : */
905 : {
906 5256 : return GetItemCount( 0 );
907 : }
908 :
909 : //-------------------------------------------------------------------------
910 :
911 0 : void SfxSplitWindow::Command( const CommandEvent& rCEvt )
912 : {
913 0 : SplitWindow::Command( rCEvt );
914 0 : }
915 :
916 : //-------------------------------------------------------------------------
917 :
918 0 : IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer)
919 : {
920 0 : if ( pTimer )
921 0 : pTimer->Stop();
922 :
923 0 : if ( CursorIsOverRect( sal_False ) || !pTimer )
924 : {
925 : // If the cursor is within the window, display the SplitWindow and set
926 : // up the timer for close
927 0 : pEmptyWin->bAutoHide = sal_True;
928 0 : if ( !IsVisible() )
929 0 : pEmptyWin->FadeIn();
930 :
931 0 : pEmptyWin->aLastPos = GetPointerPosPixel();
932 0 : pEmptyWin->aTimer.Start();
933 : }
934 0 : else if ( pEmptyWin->bAutoHide )
935 : {
936 0 : if ( GetPointerPosPixel() != pEmptyWin->aLastPos )
937 : {
938 : // The mouse has moved within the running time of the timer, thus
939 : // do nothing
940 0 : pEmptyWin->aLastPos = GetPointerPosPixel();
941 0 : pEmptyWin->aTimer.Start();
942 0 : return 0L;
943 : }
944 :
945 : // Especially for TF_AUTOSHOW_ON_MOUSEMOVE :
946 : // If the window is not visible, there is nothing to do
947 : // (user has simply moved the mouse over pEmptyWin)
948 0 : if ( IsVisible() )
949 : {
950 0 : pEmptyWin->bEndAutoHide = sal_False;
951 0 : if ( !Application::IsInModalMode() &&
952 0 : !PopupMenu::IsInExecute() &&
953 0 : !pEmptyWin->bSplit && !HasChildPathFocus( sal_True ) )
954 : {
955 : // While a modal dialog or a popup menu is open or while the
956 : // Splitting is done, in any case, do not close. Even as long
957 : // as one of the Children has the focus, the window remains
958 : // open.
959 0 : pEmptyWin->bEndAutoHide = sal_True;
960 : }
961 :
962 0 : if ( pEmptyWin->bEndAutoHide )
963 : {
964 : // As far as I am concered this can be the end of AutoShow
965 : // But maybe some other SfxSplitWindow will remain open,
966 : // then all others remain open too.
967 0 : if ( !pWorkWin->IsAutoHideMode( this ) )
968 : {
969 0 : FadeOut_Impl();
970 0 : pWorkWin->ArrangeAutoHideWindows( this );
971 : }
972 : else
973 : {
974 0 : pEmptyWin->aLastPos = GetPointerPosPixel();
975 0 : pEmptyWin->aTimer.Start();
976 : }
977 : }
978 : else
979 : {
980 0 : pEmptyWin->aLastPos = GetPointerPosPixel();
981 0 : pEmptyWin->aTimer.Start();
982 : }
983 : }
984 : }
985 :
986 0 : return 0L;
987 : }
988 :
989 : //-------------------------------------------------------------------------
990 :
991 0 : sal_Bool SfxSplitWindow::CursorIsOverRect( sal_Bool bForceAdding ) const
992 : {
993 0 : sal_Bool bVisible = IsVisible();
994 :
995 : // Also, take the collapsed SplitWindow into account
996 0 : Point aPos = pEmptyWin->GetParent()->OutputToScreenPixel( pEmptyWin->GetPosPixel() );
997 0 : Size aSize = pEmptyWin->GetSizePixel();
998 :
999 0 : if ( bForceAdding )
1000 : {
1001 : // Extend with +/- a few pixels, otherwise it is too nervous
1002 0 : aPos.X() -= nPixel;
1003 0 : aPos.Y() -= nPixel;
1004 0 : aSize.Width() += 2 * nPixel;
1005 0 : aSize.Height() += 2 * nPixel;
1006 : }
1007 :
1008 0 : Rectangle aRect( aPos, aSize );
1009 :
1010 0 : if ( bVisible )
1011 : {
1012 0 : Point aVisPos = GetPosPixel();
1013 0 : Size aVisSize = GetSizePixel();
1014 :
1015 : // Extend with +/- a few pixels, otherwise it is too nervous
1016 0 : aVisPos.X() -= nPixel;
1017 0 : aVisPos.Y() -= nPixel;
1018 0 : aVisSize.Width() += 2 * nPixel;
1019 0 : aVisSize.Height() += 2 * nPixel;
1020 :
1021 0 : Rectangle aVisRect( aVisPos, aVisSize );
1022 0 : aRect = aRect.GetUnion( aVisRect );
1023 : }
1024 :
1025 0 : if ( aRect.IsInside( OutputToScreenPixel( ((Window*)this)->GetPointerPosPixel() ) ) )
1026 0 : return sal_True;
1027 0 : return sal_False;
1028 : }
1029 :
1030 : //-------------------------------------------------------------------------
1031 :
1032 3868 : SplitWindow* SfxSplitWindow::GetSplitWindow()
1033 : {
1034 3868 : if ( !bPinned || !pEmptyWin->bFadeIn )
1035 0 : return pEmptyWin;
1036 3868 : return this;
1037 : }
1038 :
1039 : //-------------------------------------------------------------------------
1040 3868 : sal_Bool SfxSplitWindow::IsFadeIn() const
1041 : {
1042 3868 : return pEmptyWin->bFadeIn;
1043 : }
1044 :
1045 0 : sal_Bool SfxSplitWindow::IsAutoHide( sal_Bool bSelf ) const
1046 : {
1047 0 : return bSelf ? pEmptyWin->bAutoHide && !pEmptyWin->bEndAutoHide : pEmptyWin->bAutoHide;
1048 : }
1049 :
1050 : //-------------------------------------------------------------------------
1051 :
1052 0 : void SfxSplitWindow::SetPinned_Impl( sal_Bool bOn )
1053 : {
1054 0 : if ( bPinned == bOn )
1055 0 : return;
1056 :
1057 0 : bPinned = bOn;
1058 0 : if ( GetItemCount( 0 ) == 0 )
1059 0 : return;
1060 :
1061 0 : if ( !bOn )
1062 : {
1063 0 : pEmptyWin->nState |= 1;
1064 0 : if ( pEmptyWin->bFadeIn )
1065 : {
1066 : // Unregister replacement windows
1067 : OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing real Splitwindow" );
1068 0 : pWorkWin->ReleaseChild_Impl( *this );
1069 0 : Hide();
1070 0 : pEmptyWin->Actualize();
1071 : OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" );
1072 0 : pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1073 : }
1074 :
1075 0 : Point aPos( GetPosPixel() );
1076 0 : aPos = GetParent()->OutputToScreenPixel( aPos );
1077 0 : SetFloatingPos( aPos );
1078 0 : SetFloatingMode( sal_True );
1079 0 : GetFloatingWindow()->SetOutputSizePixel( GetOutputSizePixel() );
1080 :
1081 0 : if ( pEmptyWin->bFadeIn )
1082 0 : Show();
1083 : }
1084 : else
1085 : {
1086 0 : pEmptyWin->nState &= ~1;
1087 0 : SetOutputSizePixel( GetFloatingWindow()->GetOutputSizePixel() );
1088 0 : SetFloatingMode( sal_False );
1089 :
1090 0 : if ( pEmptyWin->bFadeIn )
1091 : {
1092 : // Unregister replacement windows
1093 : OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing empty Splitwindow" );
1094 0 : pWorkWin->ReleaseChild_Impl( *pEmptyWin );
1095 0 : pEmptyWin->Hide();
1096 : OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" );
1097 0 : pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1098 : }
1099 : }
1100 :
1101 0 : SetAutoHideState( !bPinned );
1102 0 : pEmptyWin->SetAutoHideState( !bPinned );
1103 : }
1104 :
1105 : //-------------------------------------------------------------------------
1106 :
1107 0 : void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn )
1108 : {
1109 0 : if ( bOn == pEmptyWin->bFadeIn )
1110 0 : return;
1111 :
1112 0 : if ( GetItemCount( 0 ) == 0 )
1113 0 : return;
1114 :
1115 0 : pEmptyWin->bFadeIn = bOn;
1116 0 : if ( bOn )
1117 : {
1118 0 : pEmptyWin->nState |= 2;
1119 0 : if ( IsFloatingMode() )
1120 : {
1121 : // FloatingWindow is not visable, thus display it
1122 0 : pWorkWin->ArrangeAutoHideWindows( this );
1123 0 : Show();
1124 : }
1125 : else
1126 : {
1127 : OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing empty Splitwindow" );
1128 0 : pWorkWin->ReleaseChild_Impl( *pEmptyWin );
1129 0 : pEmptyWin->Hide();
1130 : OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" );
1131 0 : pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1132 0 : pWorkWin->ArrangeChildren_Impl();
1133 0 : pWorkWin->ShowChildren_Impl();
1134 : }
1135 : }
1136 : else
1137 : {
1138 0 : pEmptyWin->bAutoHide = sal_False;
1139 0 : pEmptyWin->nState &= ~2;
1140 0 : if ( !IsFloatingMode() )
1141 : {
1142 : // The window is not "floating", should be hidden
1143 : OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing real Splitwindow" );
1144 0 : pWorkWin->ReleaseChild_Impl( *this );
1145 0 : Hide();
1146 0 : pEmptyWin->Actualize();
1147 : OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" );
1148 0 : pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1149 0 : pWorkWin->ArrangeChildren_Impl();
1150 0 : pWorkWin->ShowChildren_Impl();
1151 0 : pWorkWin->ArrangeAutoHideWindows( this );
1152 : }
1153 : else
1154 : {
1155 0 : Hide();
1156 0 : pWorkWin->ArrangeAutoHideWindows( this );
1157 : }
1158 : }
1159 : }
1160 :
1161 0 : void SfxSplitWindow::AutoHide()
1162 : {
1163 : // If this handler is called in the "real" SplitWindow, it is
1164 : // either docked and should be displayed as floating, or vice versa
1165 0 : if ( !bPinned )
1166 : {
1167 : // It "floats", thus dock it again
1168 0 : SetPinned_Impl( sal_True );
1169 0 : pWorkWin->ArrangeChildren_Impl();
1170 : }
1171 : else
1172 : {
1173 : // In "limbo"
1174 0 : SetPinned_Impl( sal_False );
1175 0 : pWorkWin->ArrangeChildren_Impl();
1176 0 : pWorkWin->ArrangeAutoHideWindows( this );
1177 : }
1178 :
1179 0 : pWorkWin->ShowChildren_Impl();
1180 0 : SaveConfig_Impl();
1181 0 : }
1182 :
1183 0 : void SfxSplitWindow::FadeOut_Impl()
1184 : {
1185 0 : if ( pEmptyWin->aTimer.IsActive() )
1186 : {
1187 0 : pEmptyWin->bAutoHide = sal_False;
1188 0 : pEmptyWin->aTimer.Stop();
1189 : }
1190 :
1191 0 : SetFadeIn_Impl( sal_False );
1192 0 : Show_Impl();
1193 0 : }
1194 :
1195 0 : void SfxSplitWindow::FadeOut()
1196 : {
1197 0 : FadeOut_Impl();
1198 0 : SaveConfig_Impl();
1199 0 : }
1200 :
1201 0 : void SfxSplitWindow::FadeIn()
1202 : {
1203 0 : SetFadeIn_Impl( sal_True );
1204 0 : Show_Impl();
1205 0 : }
1206 :
1207 0 : void SfxSplitWindow::Show_Impl()
1208 : {
1209 0 : sal_uInt16 nCount = pDockArr->size();
1210 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
1211 : {
1212 0 : SfxDock_Impl *pDock = (*pDockArr)[n];
1213 0 : if ( pDock->pWin )
1214 0 : pDock->pWin->FadeIn( pEmptyWin->bFadeIn );
1215 : }
1216 0 : }
1217 :
1218 0 : sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward )
1219 : {
1220 : // If no pActive, go to first and last window (!bForward is first
1221 : // decremented in the loop)
1222 0 : sal_uInt16 nCount = pDockArr->size();
1223 0 : sal_uInt16 n = bForward ? 0 : nCount;
1224 :
1225 : // if Focus is within, then move to a window forward or backwards
1226 : // if possible
1227 0 : if ( pActive )
1228 : {
1229 : // Determine the active window
1230 0 : for ( n=0; n<nCount; n++ )
1231 : {
1232 0 : SfxDock_Impl *pD = (*pDockArr)[n];
1233 0 : if ( pD->pWin && pD->pWin->HasChildPathFocus() )
1234 0 : break;
1235 : }
1236 :
1237 0 : if ( bForward )
1238 : // up window counter (then when n>nCount, the loop below is
1239 : // not entered)
1240 0 : n++;
1241 : }
1242 :
1243 0 : if ( bForward )
1244 : {
1245 : // Search for next window
1246 0 : for ( sal_uInt16 nNext=n; nNext<nCount; nNext++ )
1247 : {
1248 0 : SfxDock_Impl *pD = (*pDockArr)[nNext];
1249 0 : if ( pD->pWin )
1250 : {
1251 0 : pD->pWin->GrabFocus();
1252 0 : return sal_True;
1253 : }
1254 : }
1255 : }
1256 : else
1257 : {
1258 : // Search for previous window
1259 0 : for ( sal_uInt16 nNext=n; nNext--; )
1260 : {
1261 0 : SfxDock_Impl *pD = (*pDockArr)[nNext];
1262 0 : if ( pD->pWin )
1263 : {
1264 0 : pD->pWin->GrabFocus();
1265 0 : return sal_True;
1266 : }
1267 : }
1268 : }
1269 :
1270 0 : return sal_False;
1271 : }
1272 :
1273 0 : void SfxSplitWindow::SetActiveWindow_Impl( SfxDockingWindow* pWin )
1274 : {
1275 0 : pActive = pWin;
1276 0 : pWorkWin->SetActiveChild_Impl( this );
1277 0 : }
1278 :
1279 :
1280 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|