xref: /trunk/main/sfx2/source/appl/workwin.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sfx2.hxx"
30 
31 #ifndef GCC
32 #endif
33 
34 #include <stdio.h>
35 #include <hash_map>
36 
37 #include <sfx2/docfile.hxx>
38 #include <sfx2/objsh.hxx>
39 #include <sfx2/app.hxx>
40 #include "workwin.hxx"
41 #include <sfx2/viewfrm.hxx>
42 #include "arrdecl.hxx"
43 #include <sfx2/viewfrm.hxx>
44 #include <sfx2/module.hxx>
45 #include <sfx2/dispatch.hxx>
46 #include <sfx2/dockwin.hxx>
47 #include <sfx2/viewsh.hxx>
48 #include "splitwin.hxx"
49 #include <sfx2/msgpool.hxx>
50 #include "sfx2/sfxresid.hxx"
51 #include <sfx2/objsh.hxx>
52 #include <sfx2/request.hxx>      // SFX_ITEMSET_SET
53 #include <vcl/taskpanelist.hxx>
54 #include <vcl/toolbox.hxx>
55 #include <tools/rcid.h>
56 #include <tools/diagnose_ex.h>
57 #include <toolkit/helper/vclunohelper.hxx>
58 #include <svl/itempool.hxx>
59 #include <svl/itemiter.hxx>
60 #include <svl/whiter.hxx>
61 #include <svl/intitem.hxx>
62 #ifndef _SFXEITEM_HXX //autogen
63 #include <svl/eitem.hxx>
64 #endif
65 #include <com/sun/star/ui/XUIElement.hpp>
66 #include <com/sun/star/frame/XLayoutManager.hpp>
67 #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
68 #include <com/sun/star/frame/LayoutManagerEvents.hpp>
69 #include <com/sun/star/beans/XPropertySet.hpp>
70 #include <com/sun/star/awt/XWindow.hpp>
71 #include <com/sun/star/lang/DisposedException.hpp>
72 
73 using namespace ::com::sun::star;
74 using namespace ::com::sun::star::uno;
75 namespace css = ::com::sun::star;
76 
77 struct ResIdToResName
78 {
79     sal_uInt16      nId;
80     const char* pName;
81 };
82 
83 static const ResIdToResName pToolBarResToName[] =
84 {
85     { 558,      "fullscreenbar"        },
86     { 560,      "standardbar",         },
87     { 18001,    "formsnavigationbar"   },
88     { 18002,    "formsfilterbar"       },
89     { 18003,    "formtextobjectbar"    },
90     { 18004,    "formcontrols"         },
91     { 18005,    "moreformcontrols"     },
92     { 18006,    "formdesign"           },
93     { 20050,    "toolbar"              },      //math
94     { 30001,    "objectbar"            },      //chart
95     { 30513,    "toolbar"              },      //chart
96     { 25005,    "textobjectbar"        },      //calc
97     { 25053,    "drawobjectbar"        },
98     { 25054,    "graphicobjectbar"     },
99     { 25001,    "formatobjectbar"      },
100     { 25006,    "previewbar"           },
101     { 25035,    "toolbar"              },      //calc
102     { 23015,    "bezierobjectbar"      },      //draw/impress
103     { 23019,    "gluepointsobjectbar"  },
104     { 23030,    "graphicobjectbar"     },
105     { 23013,    "drawingobjectbar"     },      //impress
106     { 23016,    "textobjectbar"        },      //impress
107     { 23028,    "textobjectbar"        },      //draw
108     { 23011,    "toolbar"              },      //impress
109     { 23020,    "optionsbar"           },
110     { 23021,    "commontaskbar"        },
111     { 23025,    "toolbar"              },      //draw
112     { 23026,    "optionsbar"           },
113     { 23027,    "drawingobjectbar"     },      //draw
114     { 23017,    "outlinetoolbar"       },      //impress
115     { 23012,    "slideviewtoolbar"     },
116     { 23014,    "slideviewobjectbar"   },
117     { 23283,    "bezierobjectbar"      },      //writer
118     { 23269,    "drawingobjectbar"     },
119     { 23270,    "drawtextobjectbar"    },
120     { 23267,    "frameobjectbar"       },
121     { 23268,    "graphicobjectbar"     },
122     { 23271,    "numobjectbar"         },
123     { 23272,    "oleobjectbar"         },
124     { 23266,    "tableobjectbar"       },
125     { 23265,    "textobjectbar"        },
126     { 20631,    "previewobjectbar"     },      //writer
127     { 20402,    "toolbar"              },      //web
128     { 20403,    "textobjectbar"        },
129     { 23273,    "toolbar"              },      //writer
130     { 20408,    "frameobjectbar"       },      //web
131     { 20410,    "graphicobjectbar"     },
132     { 20411,    "oleobjectbar"         },
133     { 14850,    "macrobar"             },
134     { 10987,    "fontworkobjectbar"    },      //global
135     { 10986,    "extrusionobjectbar"   },
136     { 23022,    "formsobjectbar"       },
137     { 23310,    "viewerbar"            },      //writer (plugin)
138     { 25000,    "viewerbar"            },      //calc   (plugin)
139     { 23023,    "viewerbar"            },      //impress(plugin)
140     { 23024,    "viewerbar"            },      //draw   (plugin)
141     { 23031,    "mediaobjectbar"       },      //draw/impress
142     { 25060,    "mediaobjectbar"       },      //calc
143     { 23311,    "mediaobjectbar"       },      //writer
144     { 0,        ""                     }
145 };
146 
147 DBG_NAME(SfxWorkWindow)
148 
149 //SV_IMPL_OBJARR( SfxObjectBarArr_Impl, SfxObjectBar_Impl );
150 
151 //====================================================================
152 // Sortiert die Children nach ihrem Alignment
153 // Reihenfolge entspricht der im enum SfxChildAlignment (->CHILDWIN.HXX).
154 //
155 
156 // Hilfe, um die "Anderungen am Alignment kompatibal zu machen!
157 
158 
159 SFX_IMPL_XINTERFACE_3( LayoutManagerListener, OWeakObject, ::com::sun::star::frame::XLayoutManagerListener, ::com::sun::star::lang::XEventListener, ::com::sun::star::lang::XComponent )
160 SFX_IMPL_XTYPEPROVIDER_3( LayoutManagerListener, ::com::sun::star::frame::XLayoutManagerListener, ::com::sun::star::lang::XEventListener, ::com::sun::star::lang::XComponent )
161 
162 LayoutManagerListener::LayoutManagerListener(
163     SfxWorkWindow* pWrkWin ) :
164     m_bHasFrame( sal_False ),
165     m_pWrkWin( pWrkWin ),
166     m_aLayoutManagerPropName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))
167 {
168 }
169 
170 LayoutManagerListener::~LayoutManagerListener()
171 {
172 }
173 
174 void LayoutManagerListener::setFrame( const css::uno::Reference< css::frame::XFrame >& xFrame )
175 {
176     ::vos::OGuard aGuard( Application::GetSolarMutex() );
177     if ( m_pWrkWin && !m_bHasFrame )
178     {
179         m_xFrame    = xFrame;
180         m_bHasFrame = sal_True;
181 
182         if ( xFrame.is() )
183         {
184             css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
185             css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager;
186             if ( xPropSet.is() )
187             {
188                 try
189                 {
190                     Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
191                     aValue >>= xLayoutManager;
192 
193                     if ( xLayoutManager.is() )
194                         xLayoutManager->addLayoutManagerEventListener(
195                             css::uno::Reference< css::frame::XLayoutManagerListener >(
196                                 static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY ));
197 
198                     xPropSet = css::uno::Reference< css::beans::XPropertySet >( xLayoutManager, UNO_QUERY );
199                     if ( xPropSet.is() )
200                     {
201                         aValue = xPropSet->getPropertyValue(
202                             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LockCount" )) );
203                         aValue >>= m_pWrkWin->m_nLock;
204                     }
205                 }
206                 catch ( css::lang::DisposedException& )
207                 {
208                 }
209                 catch ( css::uno::RuntimeException& e )
210                 {
211                     throw e;
212                 }
213                 catch ( css::uno::Exception& )
214                 {
215                 }
216             }
217         }
218     }
219 }
220 
221 //---------------------------------------------------------------------------------------------------------
222 //  XComponent
223 //---------------------------------------------------------------------------------------------------------
224 void SAL_CALL LayoutManagerListener::addEventListener(
225     const css::uno::Reference< css::lang::XEventListener >& )
226 throw (::com::sun::star::uno::RuntimeException)
227 {
228     // do nothing, only internal class
229 }
230 
231 void SAL_CALL LayoutManagerListener::removeEventListener(
232     const css::uno::Reference< css::lang::XEventListener >& )
233 throw (::com::sun::star::uno::RuntimeException)
234 {
235     // do nothing, only internal class
236 }
237 
238 void SAL_CALL LayoutManagerListener::dispose()
239 throw( css::uno::RuntimeException )
240 {
241     ::vos::OGuard aGuard( Application::GetSolarMutex() );
242 
243     // reset member
244     m_pWrkWin = 0;
245 
246     css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame.get(), css::uno::UNO_QUERY );
247     if ( xFrame.is() )
248     {
249         m_xFrame = css::uno::Reference< css::frame::XFrame >();
250         m_bHasFrame = sal_False;
251 
252         css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, css::uno::UNO_QUERY );
253         css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager;
254         if ( xPropSet.is() )
255         {
256             try
257             {
258                 css::uno::Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
259                 aValue >>= xLayoutManager;
260 
261                 // remove as listener from layout manager
262                 if ( xLayoutManager.is() )
263                     xLayoutManager->removeLayoutManagerEventListener(
264                         css::uno::Reference< css::frame::XLayoutManagerListener >(
265                             static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY ));
266             }
267             catch ( css::lang::DisposedException& )
268             {
269             }
270             catch ( css::uno::RuntimeException& e )
271             {
272                 throw e;
273             }
274             catch ( css::uno::Exception& )
275             {
276             }
277         }
278     }
279 }
280 
281 //---------------------------------------------------------------------------------------------------------
282 //  XEventListener
283 //---------------------------------------------------------------------------------------------------------
284 void SAL_CALL LayoutManagerListener::disposing(
285     const css::lang::EventObject& )
286 throw( css::uno::RuntimeException )
287 {
288     ::vos::OGuard aGuard( Application::GetSolarMutex() );
289     m_pWrkWin = 0;
290     m_bHasFrame = sal_False;
291     m_xFrame = css::uno::Reference< css::frame::XFrame >();
292 }
293 
294 //---------------------------------------------------------------------------------------------------------
295 // XLayoutManagerEventListener
296 //---------------------------------------------------------------------------------------------------------
297 void SAL_CALL LayoutManagerListener::layoutEvent(
298     const css::lang::EventObject&,
299     ::sal_Int16                   eLayoutEvent,
300     const css::uno::Any&                        )
301 throw (css::uno::RuntimeException)
302 {
303     ::vos::OGuard aGuard( Application::GetSolarMutex() );
304     if ( m_pWrkWin )
305     {
306         if ( eLayoutEvent == css::frame::LayoutManagerEvents::VISIBLE )
307         {
308             m_pWrkWin->MakeVisible_Impl( sal_True );
309             m_pWrkWin->ShowChilds_Impl();
310             m_pWrkWin->ArrangeChilds_Impl( sal_True );
311         }
312         else if ( eLayoutEvent == css::frame::LayoutManagerEvents::INVISIBLE )
313         {
314             m_pWrkWin->MakeVisible_Impl( sal_False );
315             m_pWrkWin->HideChilds_Impl();
316             m_pWrkWin->ArrangeChilds_Impl( sal_True );
317         }
318         else if ( eLayoutEvent == css::frame::LayoutManagerEvents::LOCK )
319         {
320             m_pWrkWin->Lock_Impl( sal_True );
321         }
322         else if ( eLayoutEvent == css::frame::LayoutManagerEvents::UNLOCK )
323         {
324             m_pWrkWin->Lock_Impl( sal_False );
325         }
326     }
327 }
328 
329 //====================================================================
330 
331 typedef std::hash_map< sal_Int32, rtl::OUString > ToolBarResIdToResourceURLMap;
332 
333 static sal_Bool bMapInitialized = sal_False;
334 static ToolBarResIdToResourceURLMap aResIdToResourceURLMap;
335 
336 static rtl::OUString GetResourceURLFromResId( sal_uInt16 nResId )
337 {
338     if ( !bMapInitialized )
339     {
340         osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
341         if ( !bMapInitialized )
342         {
343             sal_Int32 nIndex( 0 );
344             while ( pToolBarResToName[nIndex].nId != 0 )
345             {
346                 rtl::OUString aResourceURL( rtl::OUString::createFromAscii( pToolBarResToName[nIndex].pName ));
347                 aResIdToResourceURLMap.insert( ToolBarResIdToResourceURLMap::value_type(
348                                                     sal_Int32( pToolBarResToName[nIndex].nId ), aResourceURL ));
349                 ++nIndex;
350             }
351             bMapInitialized = sal_True;
352         }
353     }
354 
355     ToolBarResIdToResourceURLMap::const_iterator pIter = aResIdToResourceURLMap.find( nResId );
356     if ( pIter != aResIdToResourceURLMap.end() )
357         return pIter->second;
358     else
359         return rtl::OUString();
360 }
361 
362 sal_Bool IsAppWorkWinToolbox_Impl( sal_uInt16 nPos )
363 {
364     switch ( nPos )
365     {
366         case SFX_OBJECTBAR_APPLICATION :
367         case SFX_OBJECTBAR_MACRO:
368         case SFX_OBJECTBAR_FULLSCREEN:
369             return sal_True;
370         default:
371             return sal_False;
372     }
373 }
374 
375 sal_uInt16 TbxMatch( sal_uInt16 nPos )
376 {
377     switch ( nPos )
378     {
379         case SFX_OBJECTBAR_APPLICATION :
380             return 0;
381         case SFX_OBJECTBAR_OPTIONS:
382             return 1;
383         case SFX_OBJECTBAR_MACRO:
384             return 2;
385         case SFX_OBJECTBAR_OBJECT:
386             return 3;
387         case SFX_OBJECTBAR_TOOLS:
388             return 4;
389         case SFX_OBJECTBAR_FULLSCREEN:
390         case SFX_OBJECTBAR_COMMONTASK:
391         case SFX_OBJECTBAR_RECORDING:
392             return nPos+1;
393         default:
394             return nPos;
395     }
396 }
397 
398 sal_uInt16 ChildAlignValue(SfxChildAlignment eAlign)
399 {
400     sal_uInt16 ret = 17;
401 
402     switch (eAlign)
403     {
404         case SFX_ALIGN_HIGHESTTOP:
405             ret = 1;
406             break;
407         case SFX_ALIGN_LOWESTBOTTOM:
408             ret = 2;
409             break;
410         case SFX_ALIGN_FIRSTLEFT:
411             ret = 3;
412             break;
413         case SFX_ALIGN_LASTRIGHT:
414             ret = 4;
415             break;
416         case SFX_ALIGN_LEFT:
417             ret = 5;
418             break;
419         case SFX_ALIGN_RIGHT:
420             ret = 6;
421             break;
422         case SFX_ALIGN_FIRSTRIGHT:
423             ret = 7;
424             break;
425         case SFX_ALIGN_LASTLEFT:
426             ret = 8;
427             break;
428         case SFX_ALIGN_TOP:
429             ret = 9;
430             break;
431         case SFX_ALIGN_BOTTOM:
432             ret = 10;
433             break;
434         case SFX_ALIGN_TOOLBOXTOP:
435             ret = 11;
436             break;
437         case SFX_ALIGN_TOOLBOXBOTTOM:
438             ret = 12;
439             break;
440         case SFX_ALIGN_LOWESTTOP:
441             ret = 13;
442             break;
443         case SFX_ALIGN_HIGHESTBOTTOM:
444             ret = 14;
445             break;
446         case SFX_ALIGN_TOOLBOXLEFT:
447             ret = 15;
448             break;
449         case SFX_ALIGN_TOOLBOXRIGHT:
450             ret = 16;
451             break;
452         case SFX_ALIGN_NOALIGNMENT:
453             break;  // -Wall not handled...
454     }
455 
456     return ret;
457 }
458 
459 sal_uInt16 ChildTravelValue( SfxChildAlignment eAlign )
460 {
461     sal_uInt16 ret = 17;
462 
463     switch (eAlign)
464     {
465         case SFX_ALIGN_FIRSTLEFT:
466             ret = 1;
467             break;
468         case SFX_ALIGN_LEFT:
469             ret = 2;
470             break;
471         case SFX_ALIGN_LASTLEFT:
472             ret = 3;
473             break;
474         case SFX_ALIGN_TOOLBOXLEFT:
475             ret = 4;
476             break;
477         case SFX_ALIGN_HIGHESTTOP:
478             ret = 5;
479             break;
480         case SFX_ALIGN_TOP:
481             ret = 6;
482             break;
483         case SFX_ALIGN_TOOLBOXTOP:
484             ret = 7;
485             break;
486         case SFX_ALIGN_LOWESTTOP:
487             ret = 8;
488             break;
489         case SFX_ALIGN_HIGHESTBOTTOM:
490             ret = 9;
491             break;
492         case SFX_ALIGN_TOOLBOXBOTTOM:
493             ret = 10;
494             break;
495         case SFX_ALIGN_BOTTOM:
496             ret = 11;
497             break;
498         case SFX_ALIGN_LOWESTBOTTOM:
499             ret = 12;
500             break;
501         case SFX_ALIGN_TOOLBOXRIGHT:
502             ret = 13;
503             break;
504         case SFX_ALIGN_FIRSTRIGHT:
505             ret = 14;
506             break;
507         case SFX_ALIGN_RIGHT:
508             ret = 15;
509             break;
510         case SFX_ALIGN_LASTRIGHT:
511             ret = 16;
512             break;
513         case SFX_ALIGN_NOALIGNMENT:
514             break;  // -Wall not handled.
515     }
516 
517     return ret;
518 }
519 
520 void SfxWorkWindow::Sort_Impl()
521 {
522     aSortedList.Remove(0, aSortedList.Count());
523     for (sal_uInt16 i=0; i<pChilds->Count(); i++)
524     {
525         SfxChild_Impl *pCli = (*pChilds)[i];
526         if (pCli)
527         {
528             sal_uInt16 k;
529             for (k=0; k<aSortedList.Count(); k++)
530 //              if ( (*pChilds)[aSortedList[k]]->eAlign > pCli->eAlign )
531                 if (ChildAlignValue((*pChilds)[aSortedList[k]]->eAlign) >
532                     ChildAlignValue(pCli->eAlign))
533                     break;
534             aSortedList.Insert (i,k);
535         }
536     }
537 
538     bSorted = sal_True;
539 }
540 
541 
542 //====================================================================
543 // ctor f"ur workwin eines Frames
544 
545 SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster )
546     : SfxWorkWindow(
547         pWin,
548         pFrm->GetCurrentViewFrame()->GetBindings(),
549         pFrm->GetParentFrame() ? pFrm->GetParentFrame()->GetWorkWindow_Impl() : NULL )
550     , pMasterFrame( pMaster )
551     , pFrame( pFrm )
552 {
553     pConfigShell = pFrm->GetCurrentViewFrame();
554     if ( pConfigShell && pConfigShell->GetObjectShell() )
555     {
556         bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() );
557         bDockingAllowed = sal_True;
558         bInternalDockingAllowed = sal_True;
559     }
560 
561     // Die ben"otigten SplitWindows (je eins f"ur jede Seite) werden erzeugt
562     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
563     {
564         // Die SplitWindows sind direkte ChildWindows des WorkWindows und enthalten
565         // die angedockten Fenster.
566 
567         SfxChildAlignment eAlign =
568                         ( n == SFX_SPLITWINDOWS_LEFT ? SFX_ALIGN_LEFT :
569                             n == SFX_SPLITWINDOWS_RIGHT ? SFX_ALIGN_RIGHT :
570                             n == SFX_SPLITWINDOWS_TOP ? SFX_ALIGN_TOP :
571                                 SFX_ALIGN_BOTTOM );
572         SfxSplitWindow *pSplitWin = new SfxSplitWindow(pWorkWin, eAlign, this, pParent==0 );
573         pSplit[n] = pSplitWin;
574     }
575 
576     //nOrigMode = SFX_VISIBILITY_CLIENT;
577     nOrigMode = SFX_VISIBILITY_STANDARD;
578     nUpdateMode = SFX_VISIBILITY_STANDARD;
579 }
580 
581 //====================================================================
582 // ctor der Basisklasse
583 
584 SfxWorkWindow::SfxWorkWindow( Window *pWin, SfxBindings& rB, SfxWorkWindow* pParentWorkwin ) :
585     pParent( pParentWorkwin ),
586     pBindings(&rB),
587     pWorkWin (pWin),
588     pConfigShell( 0 ),
589     pActiveChild( 0 ),
590     nChilds( 0 ),
591     nOrigMode( 0 ),
592     bSorted( sal_True ),
593     bDockingAllowed(sal_True),
594     bInternalDockingAllowed(sal_True),
595     bAllChildsVisible(sal_True),
596     bIsFullScreen( sal_False ),
597     bShowStatusBar( sal_True ),
598     m_nLock( 0 ),
599     m_aStatusBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )),
600     m_aLayoutManagerPropName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )),
601     m_aTbxTypeName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" )),
602     m_aProgressBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/progressbar/progressbar" ))
603 {
604     DBG_CTOR(SfxWorkWindow, 0);
605     DBG_ASSERT (pBindings, "Keine Bindings!");
606 
607     pBindings->SetWorkWindow_Impl( this );
608 
609     pChildWins = new SfxChildWindows_Impl;
610     pChilds = new SfxChildList_Impl;
611 
612     // F"ur die ObjectBars wird ein fester Platz in der ChildList reserviert,
613     // damit sie immer in einer definierten Reihenfolge kommen.
614     SfxChild_Impl* pChild=0;
615     for (sal_uInt16 n=0; n < SFX_OBJECTBAR_MAX; ++n)
616         pChilds->Insert(0,pChild);
617 
618     // create and initialize layout manager listener
619     Reference< com::sun::star::frame::XFrame > xFrame = GetFrameInterface();
620     LayoutManagerListener* pLayoutManagerListener = new LayoutManagerListener( this );
621     m_xLayoutManagerListener = css::uno::Reference< css::lang::XComponent >(
622                                     static_cast< cppu::OWeakObject* >( pLayoutManagerListener ),
623                                         css::uno::UNO_QUERY );
624     pLayoutManagerListener->setFrame( xFrame );
625 }
626 
627 //====================================================================
628 // dtor
629 
630 SfxWorkWindow::~SfxWorkWindow()
631 {
632     DBG_DTOR(SfxWorkWindow, 0);
633 
634     // SplitWindows l"oschen
635     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
636     {
637         SfxSplitWindow *p = pSplit[n];
638         if (p->GetWindowCount())
639             ReleaseChild_Impl(*p);
640         delete p;
641     }
642 
643     // Hilfsstruktur f"ur Child-Windows l"oschen
644     DBG_ASSERT( pChilds->Count() == 0, "dangling childs" );
645     delete pChilds;
646     delete pChildWins;
647 
648     if ( m_xLayoutManagerListener.is() )
649         m_xLayoutManagerListener->dispose();
650 }
651 
652 SystemWindow* SfxWorkWindow::GetTopWindow() const
653 {
654     Window* pRet = pWorkWin;
655     while ( pRet && !pRet->IsSystemWindow() )
656         pRet = pRet->GetParent();
657     return (SystemWindow*) pRet;
658 }
659 
660 void SfxWorkWindow::Lock_Impl( sal_Bool bLock )
661 {
662     if ( bLock )
663         m_nLock++;
664     else
665         --m_nLock;
666     if ( m_nLock<0 )
667     {
668         DBG_ERROR("Lock count underflow!");
669         m_nLock = 0;
670     }
671 
672     if ( !m_nLock )
673         ArrangeChilds_Impl();
674 }
675 
676 void SfxWorkWindow::ChangeWindow_Impl( Window *pNew )
677 {
678     Window *pOld = pWorkWin;
679     pWorkWin = pNew;
680     for ( sal_uInt16 nPos = 0; nPos < pChilds->Count(); ++nPos )
681     {
682         SfxChild_Impl *pCli = (*pChilds)[nPos];
683         if ( pCli && pCli->pWin && pCli->pWin->GetParent() == pOld )
684         {
685             pCli->pWin->SetParent( pNew );
686         }
687     }
688 }
689 
690 void SfxWorkWindow::SaveStatus_Impl()
691 {
692     sal_uInt16 nCount = pChildWins->Count();
693     for ( sal_uInt16 n=0; n<nCount; n++ )
694     {
695         SfxChildWin_Impl* pCW = (*pChildWins)[n];
696         SfxChildWindow *pChild = pCW->pWin;
697         if (pChild)
698         {
699             sal_uInt16 nFlags = pCW->aInfo.nFlags;
700             pCW->aInfo = pChild->GetInfo();
701             pCW->aInfo.nFlags |= nFlags;
702             SaveStatus_Impl(pChild, pCW->aInfo);
703         }
704     }
705 }
706 
707 //--------------------------------------------------------------------
708 // Hilfsmethode zum Freigeben der Childlisten. Wenn danach nicht der dtor
709 // aufgerufen wird, sondern weiter gearbeitet wird, mu\s wie im ctor von
710 // SfxWorkWindow noch Platz f"ur die Objectbars und SplitWindows reserviert
711 // werden.
712 
713 void SfxWorkWindow::DeleteControllers_Impl()
714 {
715     DBG_CHKTHIS(SfxWorkWindow, 0);
716 
717     // SplitWindows locken (d.h. Resize-Reaktion an den
718     // DockingWindows unterdr"ucken)
719     sal_uInt16 n;
720     for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
721     {
722         SfxSplitWindow *p = pSplit[n];
723         if (p->GetWindowCount())
724         p->Lock();
725     }
726 
727     // Child-Windows l"oschen
728     for ( n=0; n<pChildWins->Count(); )
729     {
730         SfxChildWin_Impl* pCW = (*pChildWins)[n];
731         pChildWins->Remove(n);
732         SfxChildWindow *pChild = pCW->pWin;
733         if (pChild)
734         {
735 /*
736             sal_uInt16 nFlags = pCW->aInfo.nFlags;
737             pCW->aInfo = pChild->GetInfo();
738             pCW->aInfo.nFlags |= nFlags;
739             SaveStatus_Impl(pChild, pCW->aInfo);
740 */
741             pChild->Hide();
742 
743             // Wenn das ChildWindow ein direktes Childfenster ist und nicht
744             // in einem SplitWindow liegt, am WorkWindow abmelden.
745             // Nach TH ist eine Abmeldung am Splitwindow nicht erforderlich,
746             // wenn dieses auch gleich mit zerst"ort wird (s.u.).
747             if (pCW->pCli)
748                 ReleaseChild_Impl(*pChild->GetWindow());
749             pCW->pWin = 0;
750             pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChild->GetWindow() );
751             pChild->Destroy();
752         }
753 
754         delete pCW;
755 
756         // ATTENTION: The array itself is cleared after this loop!!
757         // Therefore we have to set every array entry to zero as it could be
758         // accessed by calling pChild->Destroy().
759         // See task 128307 (Windows)
760         // Window::NotifyAllChilds() calls SfxWorkWindow::DataChanged_Impl for
761         // 8-bit displays (WM_QUERYPALETTECHANGED message due to focus change)!!
762         //(*pChildWins)[n] = 0;
763     }
764 
765     //pChildWins->Remove((sal_uInt16)0, nCount);
766 
767     Reference< com::sun::star::frame::XFrame > xFrame = GetFrameInterface();
768     Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
769     Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
770     if ( xPropSet.is() )
771     {
772         try
773         {
774             Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
775             aValue >>= xLayoutManager;
776         }
777         catch ( Exception& )
778         {
779         }
780     }
781 
782     if ( xLayoutManager.is() )
783     {
784         xLayoutManager->reset();
785 
786         // StatusBar l"oschen
787         ResetStatusBar_Impl();
788 
789         // ObjectBars l"oschen( zuletzt, damit pChilds nicht tote Pointer enh"alt )
790         for ( sal_uInt16 i = 0; i < aObjBarList.size(); i++ )
791         {
792             // Nicht jede Position mu\s belegt sein
793             sal_uInt16 nId = aObjBarList[i].nId;
794             if ( nId )
795                 aObjBarList[i].nId = 0;
796         }
797     }
798 
799     // ObjectBars werden alle auf einmal released, da sie einen
800     // festen zusammenh"angenden  Bereich im Array pChilds belegen
801     pChilds->Remove(0, SFX_OBJECTBAR_MAX);
802     bSorted = sal_False;
803 
804     nChilds = 0;
805 }
806 
807 //====================================================================
808 // Virtuelle Methode zum Anordnen der Childfenster.
809 
810 void SfxWorkWindow::ArrangeChilds_Impl( sal_Bool /*bForce*/)
811 {
812     Arrange_Impl();
813 }
814 
815 void SfxFrameWorkWin_Impl::ArrangeChilds_Impl( sal_Bool bForce )
816 {
817     if ( pFrame->IsClosing_Impl() || ( m_nLock && !bForce ))
818         return;
819 
820     SfxInPlaceClient *pClient = 0;
821     SfxViewFrame *pF = pFrame->GetCurrentViewFrame();
822     if ( pF && pF->GetViewShell() )
823         pClient = pF->GetViewShell()->GetIPClient();
824 
825     if ( pClient )
826         return;
827 
828     aClientArea = GetTopRect_Impl();
829     if ( aClientArea.IsEmpty() )
830         return;
831 
832     SvBorder aBorder;
833     if ( nChilds )
834     {
835         if ( IsVisible_Impl() )
836             aBorder = Arrange_Impl();
837     }
838 
839     // Wenn das aktuelle Dokument der Applikation einen IPClient enth"alt, mu\s
840     // dem dazugeh"origen Objekt durch SetTopToolFramePixel der zur Verf"ugung
841     // stehende Platz zugeteilt werden. Das Objekt zeigt dann seine UITools an
842     // und setzt den App-Border(->SfxInPlaceEnv_Impl::ArrangeChilds_Impl()).
843     // Anderenfalls wird hier direkt der AppBorder gesetzt, um evtl. den Border
844     // zu "uberschreiben, den bisher ein Objekt aus einem anderen Dokument
845     // gesetzt hatte.
846     // Das Objekt setzt, wenn es seine UI-Tools wegnimmt, den SetAppBorder nicht,
847     // damit kein ObjectBar-Zappeln entsteht.
848     // (->SfxInPlaceEnv_Impl::ArrangeChilds_Impl())
849 
850     pMasterFrame->SetToolSpaceBorderPixel_Impl( aBorder );
851 
852     ArrangeAutoHideWindows( NULL );
853 }
854 
855 //--------------------------------------------------------------------
856 
857 SvBorder SfxWorkWindow::Arrange_Impl()
858 
859 /*  [Beschreibung]
860 
861     Diese Methode ordnet alle sichtbaren ChildFenster so an, da\s die angedockten
862     Fenster nach der Sorierreihenfolge von au\sen nach innen aneinander
863     gesetzt werden. Wenn ein an sich sichtbares Fenster nicht mehr in die
864     noch freie ClientArea pa\st, wird es auf "nicht sichtbar" gesetzt.
865 
866 */
867 {
868     DBG_CHKTHIS(SfxWorkWindow, 0);
869 
870     aClientArea = GetTopRect_Impl();
871     aUpperClientArea = aClientArea;
872 
873     SvBorder aBorder;
874     if ( !nChilds )
875         return aBorder;
876 
877     if (!bSorted)
878         Sort_Impl();
879 
880     Point aPos;
881     Size aSize;
882     Rectangle aTmp( aClientArea );
883 
884     for ( sal_uInt16 n=0; n<aSortedList.Count(); ++n )
885     {
886         SfxChild_Impl* pCli = (*pChilds)[aSortedList[n]];
887         if ( !pCli->pWin )
888             continue;
889 
890         // Zun"achst nehmen wir an, da\s das Fenster Platz hat
891         pCli->nVisible |= CHILD_FITS_IN;
892 
893         // Nicht sichtbare Fenster "uberspringen
894         if (pCli->nVisible != CHILD_VISIBLE)
895             continue;
896 
897         if ( pCli->bResize )
898             aSize = pCli->aSize;
899         else
900             aSize = pCli->pWin->GetSizePixel();
901 
902         SvBorder aTemp = aBorder;
903         sal_Bool bAllowHiding = sal_True;
904         switch ( pCli->eAlign )
905         {
906             case SFX_ALIGN_HIGHESTTOP:
907             case SFX_ALIGN_TOP:
908             case SFX_ALIGN_TOOLBOXTOP:
909             case SFX_ALIGN_LOWESTTOP:
910                 aSize.Width() = aTmp.GetWidth();
911                 if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
912                     aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
913                 bAllowHiding = sal_False;
914                 aBorder.Top() += aSize.Height();
915                 aPos = aTmp.TopLeft();
916                 aTmp.Top() += aSize.Height();
917                 if ( pCli->eAlign == SFX_ALIGN_HIGHESTTOP )
918                     aUpperClientArea.Top() += aSize.Height();
919                 break;
920 
921             case SFX_ALIGN_LOWESTBOTTOM:
922             case SFX_ALIGN_BOTTOM:
923             case SFX_ALIGN_TOOLBOXBOTTOM:
924             case SFX_ALIGN_HIGHESTBOTTOM:
925                 aSize.Width() = aTmp.GetWidth();
926                 if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
927                     aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
928                 aBorder.Bottom() += aSize.Height();
929                 aPos = aTmp.BottomLeft();
930                 aPos.Y() -= (aSize.Height()-1);
931                 aTmp.Bottom() -= aSize.Height();
932                 if ( pCli->eAlign == SFX_ALIGN_LOWESTBOTTOM )
933                     aUpperClientArea.Bottom() -= aSize.Height();
934                 break;
935 
936             case SFX_ALIGN_FIRSTLEFT:
937             case SFX_ALIGN_LEFT:
938             case SFX_ALIGN_LASTLEFT:
939             case SFX_ALIGN_TOOLBOXLEFT:
940                 aSize.Height() = aTmp.GetHeight();
941                 if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
942                     aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
943                 bAllowHiding = sal_False;
944                 aBorder.Left() += aSize.Width();
945                 aPos = aTmp.TopLeft();
946                 aTmp.Left() += aSize.Width();
947                 if ( pCli->eAlign != SFX_ALIGN_TOOLBOXLEFT )
948                     aUpperClientArea.Left() += aSize.Width();
949                 break;
950 
951             case SFX_ALIGN_FIRSTRIGHT:
952             case SFX_ALIGN_RIGHT:
953             case SFX_ALIGN_LASTRIGHT:
954             case SFX_ALIGN_TOOLBOXRIGHT:
955                 aSize.Height() = aTmp.GetHeight();
956                 if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
957                     aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
958                 aBorder.Right() += aSize.Width();
959                 aPos = aTmp.TopRight();
960                 aPos.X() -= (aSize.Width()-1);
961                 aTmp.Right() -= aSize.Width();
962                 if ( pCli->eAlign != SFX_ALIGN_TOOLBOXRIGHT )
963                     aUpperClientArea.Right() -= aSize.Width();
964                 break;
965 
966             default:
967                 pCli->aSize = pCli->pWin->GetSizePixel();
968                 pCli->bResize = sal_False;
969                 continue;
970         }
971 
972         pCli->pWin->SetPosSizePixel( aPos, aSize );
973         pCli->bResize = sal_False;
974         pCli->aSize = aSize;
975         if( bAllowHiding && !RequestTopToolSpacePixel_Impl( aBorder ) )
976         {
977             pCli->nVisible ^= CHILD_FITS_IN;
978             aBorder = aTemp;
979         }
980     }
981 
982     if ( aClientArea.GetWidth() >= aBorder.Left() + aBorder.Right() )
983     {
984         aClientArea.Left() += aBorder.Left();
985         aClientArea.Right() -= aBorder.Right();
986     }
987     else
988     {
989         aBorder.Left() = aClientArea.Left();
990         aBorder.Right() = aClientArea.Right();
991         aClientArea.Right() = aClientArea.Left() = aTmp.Left();
992     }
993 
994     if ( aClientArea.GetHeight() >= aBorder.Top() + aBorder.Bottom() )
995     {
996         aClientArea.Top() += aBorder.Top();
997         aClientArea.Bottom() -= aBorder.Bottom();
998     }
999     else
1000     {
1001         aBorder.Top() = aClientArea.Top();
1002         aBorder.Bottom() = aClientArea.Bottom();
1003         aClientArea.Top() = aClientArea.Bottom() = aTmp.Top();
1004     }
1005 
1006     return IsDockingAllowed() ? aBorder : SvBorder();
1007 }
1008 
1009 //--------------------------------------------------------------------
1010 // Close-Handler: die Konfiguration der ChildWindows wird gespeichert.
1011 //
1012 
1013 void SfxWorkWindow::Close_Impl()
1014 {
1015     for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
1016     {
1017         SfxChildWin_Impl *pCW  = (*pChildWins)[n];
1018         SfxChildWindow *pChild = pCW->pWin;
1019         if (pChild)
1020         {
1021             sal_uInt16 nFlags = pCW->aInfo.nFlags;
1022             pCW->aInfo = pChild->GetInfo();
1023             pCW->aInfo.nFlags |= nFlags;
1024             SaveStatus_Impl(pChild, pCW->aInfo);
1025         }
1026     }
1027 }
1028 
1029 sal_Bool SfxWorkWindow::PrepareClose_Impl()
1030 {
1031     for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
1032     {
1033         SfxChildWin_Impl *pCW  = (*pChildWins)[n];
1034         SfxChildWindow *pChild = pCW->pWin;
1035         if ( pChild && !pChild->QueryClose() )
1036             return sal_False;
1037     }
1038 
1039     return sal_True;
1040 }
1041 
1042 //--------------------------------------------------------------------
1043 
1044 SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( Window& rWindow,
1045                     SfxChildAlignment eAlign, sal_Bool bCanGetFocus )
1046 {
1047     DBG_CHKTHIS(SfxWorkWindow, 0);
1048     DBG_ASSERT( pChilds->Count() < 255, "too many childs" );
1049     DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
1050     DBG_ASSERT( !FindChild_Impl(rWindow), "child registered more than once" );
1051 
1052 
1053     if ( rWindow.GetParent() != pWorkWin )
1054         rWindow.SetParent( pWorkWin );
1055 
1056     SfxChild_Impl *pChild = new SfxChild_Impl(rWindow, rWindow.GetSizePixel(),
1057                                     eAlign, rWindow.IsVisible());
1058     pChild->bCanGetFocus = bCanGetFocus;
1059 
1060     pChilds->Insert(pChilds->Count(), pChild);
1061     bSorted = sal_False;
1062     nChilds++;
1063     return (*pChilds)[pChilds->Count()-1];
1064 }
1065 
1066 //--------------------------------------------------------------------
1067 
1068 void SfxWorkWindow::AlignChild_Impl( Window& rWindow,
1069                                             const Size& rNewSize,
1070                                             SfxChildAlignment eAlign )
1071 {
1072     DBG_CHKTHIS(SfxWorkWindow, 0);
1073 //  DBG_ASSERT( pChilds, "aligning unregistered child" );
1074     DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
1075 
1076     SfxChild_Impl *pChild = FindChild_Impl(rWindow);
1077     if ( pChild )
1078     {
1079         if (pChild->eAlign != eAlign)
1080             bSorted = sal_False;
1081 
1082         pChild->eAlign = eAlign;
1083         pChild->aSize = rNewSize;
1084         pChild->bResize = sal_True;
1085     }
1086     else {
1087         DBG_ERROR( "aligning unregistered child" );
1088     }
1089 }
1090 
1091 //--------------------------------------------------------------------
1092 
1093 void SfxWorkWindow::ReleaseChild_Impl( Window& rWindow )
1094 {
1095     DBG_CHKTHIS(SfxWorkWindow, 0);
1096 //  DBG_ASSERT( pChilds, "releasing unregistered child" );
1097 
1098     SfxChild_Impl *pChild = 0;
1099     sal_uInt16 nPos;
1100     for ( nPos = 0; nPos < pChilds->Count(); ++nPos )
1101     {
1102         pChild = (*pChilds)[nPos];
1103         if ( pChild )
1104           if ( pChild->pWin == &rWindow )
1105             break;
1106     }
1107 
1108     if ( nPos < pChilds->Count() )
1109     {
1110         bSorted = sal_False;
1111         nChilds--;
1112         pChilds->Remove(nPos);
1113         delete pChild;
1114     }
1115     else {
1116         DBG_ERROR( "releasing unregistered child" );
1117     }
1118 }
1119 
1120 //--------------------------------------------------------------------
1121 
1122 SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const Window& rWindow ) const
1123 {
1124     DBG_CHKTHIS(SfxWorkWindow, 0);
1125 
1126     SfxChild_Impl *pChild = 0;
1127     sal_uInt16 nCount = pChilds->Count();
1128     for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
1129     {
1130         pChild = (*pChilds)[nPos];
1131         if ( pChild )
1132           if ( pChild->pWin == &rWindow )
1133             return pChild;
1134     }
1135 
1136     return 0;
1137 }
1138 
1139 //--------------------------------------------------------------------
1140 
1141 void SfxWorkWindow::ShowChilds_Impl()
1142 {
1143     DBG_CHKTHIS(SfxWorkWindow, 0);
1144 
1145     bool bInvisible = ( !IsVisible_Impl() || ( !pWorkWin->IsReallyVisible() && !pWorkWin->IsReallyShown() ));
1146 
1147     SfxChild_Impl *pCli = 0;
1148     for ( sal_uInt16 nPos = 0; nPos < pChilds->Count(); ++nPos )
1149     {
1150         SfxChildWin_Impl* pCW = 0;
1151         pCli = (*pChilds)[nPos];
1152 
1153         if ( pCli && pCli->pWin )
1154         {
1155             // We have to find the SfxChildWin_Impl to retrieve the
1156             // SFX_CHILDWIN flags that can influence visibility.
1157             for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
1158             {
1159                 SfxChildWin_Impl* pCWin = (*pChildWins)[n];
1160                 SfxChild_Impl*    pChild  = pCWin->pCli;
1161                 if ( pChild == pCli )
1162                 {
1163                     pCW = pCWin;
1164                     break;
1165                 }
1166             }
1167 
1168             bool bVisible( !bInvisible );
1169             if ( pCW )
1170             {
1171                 // Check flag SFX_CHILDWIN_NEVERHIDE that forces us to show
1172                 // the child window even in situations where no child window is
1173                 // visible.
1174                 sal_uInt16 nFlags = pCW->aInfo.nFlags;
1175                 bVisible = !bInvisible || ( bInvisible & (( nFlags & SFX_CHILDWIN_NEVERHIDE ) != 0 ));
1176             }
1177 
1178             if ( CHILD_VISIBLE == (pCli->nVisible & CHILD_VISIBLE) && bVisible )
1179             {
1180                 sal_uInt16 nFlags = pCli->bSetFocus ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE;
1181                 switch ( pCli->pWin->GetType() )
1182                 {
1183                     case RSC_DOCKINGWINDOW :
1184                         ((DockingWindow*)pCli->pWin)->Show( sal_True, nFlags );
1185                         break;
1186                     case RSC_SPLITWINDOW :
1187                         ((SplitWindow*)pCli->pWin)->Show( sal_True, nFlags );
1188                         break;
1189                     default:
1190                         pCli->pWin->Show( sal_True, nFlags );
1191                         break;
1192                 }
1193 
1194                 pCli->bSetFocus = sal_False;
1195             }
1196             else
1197             {
1198                 switch ( pCli->pWin->GetType() )
1199                 {
1200                     case RSC_DOCKINGWINDOW :
1201                         ((DockingWindow*)pCli->pWin)->Hide();
1202                         break;
1203                     default:
1204                         pCli->pWin->Hide();
1205                         break;
1206                 }
1207             }
1208         }
1209     }
1210 }
1211 
1212 //--------------------------------------------------------------------
1213 
1214 void SfxWorkWindow::HideChilds_Impl()
1215 {
1216     SfxChild_Impl *pChild = 0;
1217     for ( sal_uInt16 nPos = pChilds->Count(); nPos > 0; --nPos )
1218     {
1219         pChild = (*pChilds)[nPos-1];
1220         if (pChild && pChild->pWin)
1221         {
1222             switch ( pChild->pWin->GetType() )
1223             {
1224                 case RSC_DOCKINGWINDOW :
1225                     ((DockingWindow*)pChild->pWin)->Hide();
1226                     break;
1227                 default:
1228                     pChild->pWin->Hide();
1229                     break;
1230             }
1231         }
1232     }
1233 }
1234 
1235 //------------------------------------------------------------------------
1236 
1237 void SfxWorkWindow::ResetObjectBars_Impl()
1238 {
1239     sal_uInt16 n;
1240     for ( n = 0; n < aObjBarList.size(); n++ )
1241         aObjBarList[n].bDestroy = sal_True;
1242 
1243     for ( n = 0; n < pChildWins->Count(); ++n )
1244         (*pChildWins)[n]->nId = 0;
1245 }
1246 
1247 void SfxWorkWindow::NextObjectBar_Impl( sal_uInt16 )
1248 {
1249 }
1250 
1251 sal_uInt16 SfxWorkWindow::HasNextObjectBar_Impl( sal_uInt16, String* )
1252 {
1253     return 0;
1254 }
1255 
1256 //------------------------------------------------------------------------
1257 
1258 void SfxWorkWindow::SetObjectBar_Impl( sal_uInt16 nPos, sal_uInt32 nResId,
1259             SfxInterface* pIFace, const String *pName)
1260 {
1261     DBG_ASSERT( (nPos & SFX_POSITION_MASK) < SFX_OBJECTBAR_MAX,
1262                 "object bar position overflow" );
1263 
1264     sal_uInt16 nRealPos = nPos & SFX_POSITION_MASK;
1265     if ( pParent && IsAppWorkWinToolbox_Impl( nRealPos ) )
1266     {
1267         pParent->SetObjectBar_Impl( nPos, nResId, pIFace, pName );
1268         return;
1269     }
1270 
1271     SfxObjectBar_Impl aObjBar;
1272     aObjBar.pIFace = pIFace;
1273     aObjBar.nId = sal::static_int_cast<sal_uInt16>(nResId);
1274     aObjBar.nPos = nRealPos;
1275     aObjBar.nMode = (nPos & SFX_VISIBILITY_MASK);
1276     if (pName)
1277         aObjBar.aName = *pName;
1278     else
1279         aObjBar.aName.Erase();
1280 
1281     for ( sal_uInt16 n=0; n<aObjBarList.size(); n++ )
1282     {
1283         if ( aObjBarList[n].nId == aObjBar.nId )
1284         {
1285             aObjBarList[n] = aObjBar;
1286             return;
1287         }
1288     }
1289 
1290     aObjBarList.push_back( aObjBar );
1291 }
1292 
1293 //------------------------------------------------------------------------
1294 
1295 bool SfxWorkWindow::KnowsObjectBar_Impl( sal_uInt16 nPos ) const
1296 
1297 /*  [Beschreibung]
1298 
1299     Stellt fest, ob an der betreffenden Position "uberhaupt eine
1300     Objektleiste zur Verf"ugung stehen w"urde. Ist unabh"agig davon,
1301     ob diese tats"achlich ein- oder ausgeschaltet ist.
1302 */
1303 
1304 {
1305     sal_uInt16 nRealPos = nPos & SFX_POSITION_MASK;
1306     if ( pParent && IsAppWorkWinToolbox_Impl( nRealPos ) )
1307         return pParent->KnowsObjectBar_Impl( nPos );
1308 
1309     for ( sal_uInt16 n=0; n<aObjBarList.size(); n++ )
1310     {
1311         if ( aObjBarList[n].nPos == nRealPos )
1312             return true;
1313     }
1314 
1315     return false;
1316 }
1317 
1318 //------------------------------------------------------------------------
1319 
1320 sal_Bool SfxWorkWindow::IsVisible_Impl( sal_uInt16 nMode ) const
1321 {
1322     switch( nUpdateMode )
1323     {
1324         case SFX_VISIBILITY_STANDARD:
1325             return sal_True;
1326         case SFX_VISIBILITY_UNVISIBLE:
1327             return sal_False;
1328         case SFX_VISIBILITY_PLUGSERVER:
1329         case SFX_VISIBILITY_PLUGCLIENT:
1330         case SFX_VISIBILITY_CLIENT:
1331         case SFX_VISIBILITY_SERVER:
1332             return !!(nMode & nUpdateMode);
1333         default:
1334             return !!(nMode & nOrigMode ) ||
1335                 nOrigMode == SFX_VISIBILITY_STANDARD;
1336     }
1337 }
1338 
1339 Window* SfxWorkWindow::GetObjectBar_Impl( sal_uInt16, sal_uInt32 )
1340 {
1341     return NULL;
1342 }
1343 
1344 //------------------------------------------------------------------------
1345 void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl()
1346 {
1347     if ( pFrame->IsClosing_Impl() )
1348         return;
1349 
1350     SfxWorkWindow *pWork = pParent;
1351     while ( pWork )
1352     {
1353         pWork->SfxWorkWindow::UpdateObjectBars_Impl();
1354         pWork = pWork->GetParent_Impl();
1355     }
1356 
1357     SfxWorkWindow::UpdateObjectBars_Impl();
1358 
1359 //  if ( pTask->IsActive() )
1360     {
1361         pWork = pParent;
1362         while ( pWork )
1363         {
1364             pWork->ArrangeChilds_Impl();
1365             pWork = pWork->GetParent_Impl();
1366         }
1367 
1368         ArrangeChilds_Impl( sal_False );
1369 
1370         pWork = pParent;
1371         while ( pWork )
1372         {
1373             pWork->ShowChilds_Impl();
1374             pWork = pWork->GetParent_Impl();
1375         }
1376 
1377         ShowChilds_Impl();
1378     }
1379 
1380     ShowChilds_Impl();
1381 }
1382 
1383 Reference< ::com::sun::star::task::XStatusIndicator > SfxWorkWindow::GetStatusIndicator()
1384 {
1385     Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
1386     Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1387     Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
1388 
1389     if ( xPropSet.is() )
1390     {
1391         Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
1392         aValue >>= xLayoutManager;
1393         if ( xLayoutManager.is() )
1394         {
1395             xLayoutManager->createElement( m_aProgressBarResName );
1396             xLayoutManager->showElement( m_aProgressBarResName );
1397 
1398             Reference< ::com::sun::star::ui::XUIElement > xProgressBar =
1399                 xLayoutManager->getElement( m_aProgressBarResName );
1400             if ( xProgressBar.is() )
1401             {
1402                 xStatusIndicator = Reference< ::com::sun::star::task::XStatusIndicator >(
1403                     xProgressBar->getRealInterface(), UNO_QUERY );
1404             }
1405         }
1406     }
1407 
1408     return xStatusIndicator;
1409 }
1410 
1411 //------------------------------------------------------------------------
1412 
1413 sal_Bool SfxWorkWindow::IsPluginMode( SfxObjectShell* pObjShell )
1414 {
1415     if ( pObjShell && pObjShell->GetMedium() )
1416     {
1417         SFX_ITEMSET_ARG( pObjShell->GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, sal_False );
1418         if ( pViewOnlyItem && pViewOnlyItem->GetValue() )
1419             return sal_True;
1420     }
1421 
1422     return sal_False;
1423 }
1424 
1425 //------------------------------------------------------------------------
1426 
1427 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxWorkWindow::GetFrameInterface()
1428 {
1429     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
1430 
1431     SfxDispatcher* pDispatcher( GetBindings().GetDispatcher() );
1432     if ( pDispatcher )
1433     {
1434         SfxViewFrame* pFrame = pDispatcher->GetFrame();
1435         if ( pFrame )
1436            xFrame = pFrame->GetFrame().GetFrameInterface();
1437     }
1438 
1439     return xFrame;
1440 }
1441 
1442 //------------------------------------------------------------------------
1443 
1444 void SfxWorkWindow::UpdateObjectBars_Impl()
1445 {
1446     // SplitWindows locken (d.h. Resize-Reaktion an den
1447     // DockingWindows unterdr"ucken)
1448     sal_uInt16 n;
1449     for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
1450     {
1451         SfxSplitWindow *p = pSplit[n];
1452         if (p->GetWindowCount())
1453             p->Lock();
1454     }
1455 
1456     // was man so "ofters braucht, merkt man sich (spart Code und Laufzeit)
1457     SFX_APP();
1458 
1459     Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
1460     Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1461 
1462     if ( xPropSet.is() )
1463     {
1464         Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
1465         aValue >>= xLayoutManager;
1466     }
1467 
1468     if ( !xLayoutManager.is() )
1469         return;
1470 
1471     sal_Bool       bPluginMode( sal_False );
1472     SfxDispatcher* pDispatcher( GetBindings().GetDispatcher() );
1473 
1474     if ( pDispatcher )
1475     {
1476         SfxViewFrame* pFrame = pDispatcher->GetFrame();
1477         if ( pFrame )
1478            bPluginMode = IsPluginMode( pFrame->GetObjectShell() );
1479     }
1480 
1481     // "uber alle Toolboxen iterieren
1482     xLayoutManager->lock();
1483     for ( n = 0; n < aObjBarList.size(); ++n )
1484     {
1485         sal_uInt16      nId      = aObjBarList[n].nId;
1486         sal_Bool    bDestroy = aObjBarList[n].bDestroy;
1487 
1488         // die Modi bestimmen, f"ur die die ToolBox gilt
1489         sal_uInt16 nTbxMode = aObjBarList[n].nMode;
1490         bool bFullScreenTbx = SFX_VISIBILITY_FULLSCREEN ==
1491                                   ( nTbxMode & SFX_VISIBILITY_FULLSCREEN );
1492         nTbxMode &= ~SFX_VISIBILITY_FULLSCREEN;
1493         nTbxMode &= ~SFX_VISIBILITY_VIEWER;
1494 
1495         // wird in diesem Kontext eine ToolBox gefordert?
1496         bool bModesMatching = ( nUpdateMode && ( nTbxMode & nUpdateMode) == nUpdateMode );
1497         if ( bDestroy )
1498         {
1499             rtl::OUString aTbxId( m_aTbxTypeName );
1500             aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
1501             xLayoutManager->destroyElement( aTbxId );
1502         }
1503         else if ( nId != 0 && ( ( bModesMatching && !bIsFullScreen ) ||
1504                                 ( bIsFullScreen && bFullScreenTbx ) ) )
1505         {
1506             rtl::OUString aTbxId( m_aTbxTypeName );
1507             aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
1508             if ( !IsDockingAllowed() && !xLayoutManager->isElementFloating( aTbxId ))
1509                 xLayoutManager->destroyElement( aTbxId );
1510             else
1511             {
1512                 xLayoutManager->requestElement( aTbxId );
1513                 if ( bPluginMode )
1514                     xLayoutManager->lockWindow( aTbxId );
1515             }
1516         }
1517         else if ( nId != 0 )
1518         {
1519             // ggf. Toolbox an dieser Position l"oschen
1520             rtl::OUString aTbxId( m_aTbxTypeName );
1521             aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
1522             xLayoutManager->destroyElement( aTbxId );
1523         }
1524     }
1525 
1526     UpdateStatusBar_Impl();
1527 
1528     // unlocking automatically forces Layout
1529     xLayoutManager->unlock();
1530 
1531     UpdateChildWindows_Impl();
1532 
1533     // SplitWindows wieder ent-locken
1534     for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
1535     {
1536         SfxSplitWindow *p = pSplit[n];
1537         if (p->GetWindowCount())
1538             p->Lock(sal_False);
1539     }
1540 }
1541 
1542 bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const
1543 {
1544     // or checking the availability of child windows, we need access to the module
1545     const SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
1546     const SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
1547     const SfxModule* pModule = pShell ? pShell->GetModule() : NULL;
1548     ENSURE_OR_RETURN( pModule, "SfxWorkWindow::UpdateChildWindows_Impl: did not find an SfxModule to ask for the child win availability!", true );
1549     return pModule->IsChildWindowAvailable( i_rCW.nId, pViewFrame );
1550 }
1551 
1552 void SfxWorkWindow::UpdateChildWindows_Impl()
1553 {
1554     // alle vorhandenen oder in den Kontext gekommenen ChildWindows
1555     for ( sal_uInt16 n=0; n<pChildWins->Count(); n++ )
1556     {
1557         SfxChildWin_Impl *pCW = (*pChildWins)[n];
1558         SfxChildWindow *pChildWin = pCW->pWin;
1559         sal_Bool bCreate = sal_False;
1560         if ( pCW->nId && !pCW->bDisabled  && (pCW->aInfo.nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE || IsVisible_Impl( pCW->nVisibility ) ) )
1561         {
1562             // Im Kontext ist ein geeignetes ChildWindow erlaubt;
1563             // ist es auch eingeschaltet ?
1564             if ( pChildWin == NULL && pCW->bCreate )
1565             {
1566                 // Internal docking is only used for embedding into another
1567                 // container. We force the floating state of all floatable
1568                 // child windows.
1569                 if ( !bInternalDockingAllowed )
1570                 {
1571                     // Special case for all non-floatable child windows. We have
1572                     // to prevent the creation here!
1573                     bCreate = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK );
1574                 }
1575                 else if ( !IsDockingAllowed() || bIsFullScreen ) // || !bInternalDocking )
1576                 {
1577                     // im PresentationMode oder FullScreen nur FloatingWindows
1578                     SfxChildAlignment eAlign;
1579                     if ( pCW->aInfo.GetExtraData_Impl( &eAlign ) )
1580                         bCreate = ( eAlign == SFX_ALIGN_NOALIGNMENT );
1581                 }
1582                 else
1583                     bCreate = sal_True;
1584 
1585                 if ( bCreate )
1586                     bCreate = AllowChildWindowCreation_Impl( *pCW );
1587 
1588                 // Momentan kein Fenster da, aber es ist eingeschaltet; Fenster
1589                 // und ggf. Context erzeugen
1590                 if ( bCreate )
1591                     CreateChildWin_Impl( pCW, sal_False );
1592 
1593                 if ( !bAllChildsVisible )
1594                 {
1595                     if ( pCW->pCli )
1596                         pCW->pCli->nVisible &= ~CHILD_ACTIVE;
1597                 }
1598             }
1599             else if ( pChildWin )
1600             {
1601                 // Fenster existiert schon; soll es auch sichtbar sein ?
1602                 if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT ) && bAllChildsVisible )
1603                 {
1604                     // Updatemode ist kompatibel; auf jeden Fall wieder einschalten
1605                     bCreate = AllowChildWindowCreation_Impl( *pCW );
1606                     if ( bCreate )
1607                     {
1608                         if ( pCW->pCli )
1609                         {
1610                             // Fenster ist direktes Child
1611                             if ( bAllChildsVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) )
1612                                 pCW->pCli->nVisible |= CHILD_NOT_HIDDEN;
1613                         }
1614                         else
1615                         {
1616                             if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed )
1617                                 // Fenster liegt in einem SplitWindow
1618                                 ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl();
1619                         }
1620 
1621                         if ( pCW->nInterfaceId != pChildWin->GetContextId() )
1622                             pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
1623                     }
1624                 }
1625             }
1626         }
1627 
1628         if ( pChildWin && !bCreate )
1629         {
1630             if ( !pChildWin->QueryClose() || pChildWin->IsHideNotDelete() || Application::IsUICaptured() )
1631             {
1632                 if ( pCW->pCli )
1633                 {
1634                     if ( pCW->pCli->nVisible & CHILD_NOT_HIDDEN )
1635                         pCW->pCli->nVisible ^= CHILD_NOT_HIDDEN;
1636                 }
1637                 else
1638                     ((SfxDockingWindow*)pChildWin->GetWindow())->Disappear_Impl();
1639             }
1640             else
1641                 RemoveChildWin_Impl( pCW );
1642         }
1643     }
1644 }
1645 
1646 void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, sal_Bool bSetFocus )
1647 {
1648     if ( pCW->aInfo.bVisible != 42 )
1649         pCW->aInfo.bVisible = sal_True;
1650 
1651     SfxChildWindow *pChildWin = SfxChildWindow::CreateChildWindow( pCW->nId, pWorkWin, &GetBindings(), pCW->aInfo);
1652     if (pChildWin)
1653     {
1654         if ( bSetFocus )
1655             bSetFocus = pChildWin->WantsFocus();
1656         pChildWin->SetWorkWindow_Impl( this );
1657 #if 0
1658         // Enable-Status richtig setzen
1659         pChildWin->GetWindow()->EnableInput( pCW->bEnable &&
1660             ( pWorkWin->IsInputEnabled() /* || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT */ ) );
1661 #endif
1662         // Zumindest der ExtraString wird beim Auswerten ver"andert, also neu holen
1663         SfxChildWinInfo aInfo = pChildWin->GetInfo();
1664         pCW->aInfo.aExtraString = aInfo.aExtraString;
1665         pCW->aInfo.bVisible = aInfo.bVisible;
1666         pCW->aInfo.nFlags |= aInfo.nFlags;
1667 
1668         // Nein !! Sonst kann man keine Fenster defaultmaessig ausschalten ( Partwindow! )
1669 //      pCW->aInfo.bVisible = sal_True;
1670 
1671         // Erzeugung war erfolgreich
1672         GetBindings().Invalidate(pCW->nId);
1673 
1674         sal_uInt16 nPos = pChildWin->GetPosition();
1675         if (nPos != CHILDWIN_NOPOS)
1676         {
1677             DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!");
1678             if ((*pChilds)[TbxMatch(nPos)])// &&
1679 //                            pChildWin->GetAlignment() == (*pChilds)[nPos]->eAlign )
1680             {
1681                 // ChildWindow ersetzt ObjectBar
1682                 (*pChilds)[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN;
1683             }
1684         }
1685 
1686         // make childwin keyboard accessible
1687         pWorkWin->GetSystemWindow()->GetTaskPaneList()->AddWindow( pChildWin->GetWindow() );
1688 
1689         pCW->pWin = pChildWin;
1690 
1691         if ( pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT || pChildWin->GetWindow()->GetParent() == pWorkWin)
1692         {
1693             // Das Fenster ist entweder nicht angedockt oder au\serhalb
1694             // eines SplitWindows angedockt und mu\s daher explizit als
1695             // Child registriert werden
1696             pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment(), pChildWin->CanGetFocus());
1697             pCW->pCli->nVisible = CHILD_VISIBLE;
1698             if ( pChildWin->GetAlignment() != SFX_ALIGN_NOALIGNMENT && bIsFullScreen )
1699                 pCW->pCli->nVisible ^= CHILD_ACTIVE;
1700             pCW->pCli->bSetFocus = bSetFocus;
1701         }
1702         else
1703         {
1704             // Ein angedocktes Fenster, dessen Parent nicht das WorkWindow ist,
1705             // mu\s in einem SplitWindow liegen und daher nicht explizit
1706             // registriert werden.
1707             // Das passiert aber schon bei der Initialisierung des
1708             // SfxDockingWindows!
1709         }
1710 
1711         if ( pCW->nInterfaceId != pChildWin->GetContextId() )
1712             pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
1713 
1714         // Information in der INI-Datei sichern
1715         SaveStatus_Impl(pChildWin, pCW->aInfo);
1716     }
1717 }
1718 
1719 void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW )
1720 {
1721     sal_uInt16 nId = pCW->nSaveId;
1722     SfxChildWindow *pChildWin = pCW->pWin;
1723 
1724     // vorhandenes Fenster geht aus dem Kontext und wird daher entfernt
1725     sal_uInt16 nPos = pChildWin->GetPosition();
1726     if (nPos != CHILDWIN_NOPOS)
1727     {
1728 /*
1729         // ChildWindow "uberlagert einen ObjectBar
1730         DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!");
1731         if ((*pChilds)[TbxMatch(nPos)] &&
1732             (aObjBars[nPos].nMode & nUpdateMode) ) //&&
1733 //                         pChildWin->GetAlignment() == (*pChilds)[nPos]->eAlign )
1734         {
1735             // ObjectBar war "uberlagert; jetzt wieder anzeigen
1736             (*pChilds)[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN;
1737         }
1738 */
1739     }
1740 
1741     // Information in der INI-Datei sichern
1742     sal_uInt16 nFlags = pCW->aInfo.nFlags;
1743     pCW->aInfo = pChildWin->GetInfo();
1744     pCW->aInfo.nFlags |= nFlags;
1745     SaveStatus_Impl(pChildWin, pCW->aInfo);
1746 
1747     pChildWin->Hide();
1748 
1749     if ( pCW->pCli )
1750     {
1751         // ChildWindow ist ein direktes ChildWindow und mu\s sich daher
1752         // beim WorkWindow abmelden
1753         pCW->pCli = 0;
1754         ReleaseChild_Impl(*pChildWin->GetWindow());
1755     }
1756     else
1757     {
1758         // ChildWindow liegt in einem SplitWindow und meldet sich
1759         // selbst im dtor dort ab
1760     }
1761 
1762     pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChildWin->GetWindow() );
1763     pCW->pWin = 0;
1764     pChildWin->Destroy();
1765 
1766     GetBindings().Invalidate( nId );
1767 }
1768 
1769 void SfxWorkWindow::ResetStatusBar_Impl()
1770 {
1771     aStatBar.nId = 0;
1772 }
1773 
1774 //--------------------------------------------------------------------
1775 void SfxWorkWindow::SetStatusBar_Impl( sal_uInt32 nResId, SfxShell*, SfxBindings& )
1776 {
1777     if ( nResId && bShowStatusBar && IsVisible_Impl() )
1778         aStatBar.nId = sal::static_int_cast<sal_uInt16>(nResId);
1779 }
1780 
1781 #define SFX_ITEMTYPE_STATBAR 4
1782 
1783 void SfxWorkWindow::SetTempStatusBar_Impl( sal_Bool bSet )
1784 {
1785     if ( aStatBar.bTemp != bSet && bShowStatusBar && IsVisible_Impl() )
1786     {
1787         sal_Bool bOn = sal_False;
1788         sal_Bool bReset = sal_False;
1789         if ( bSet && !aStatBar.nId )
1790         {
1791             bReset = sal_True;
1792             SetStatusBar_Impl( SFX_ITEMTYPE_STATBAR, SFX_APP(), GetBindings() );
1793         }
1794 
1795         if ( aStatBar.nId && aStatBar.bOn && !bIsFullScreen )
1796             bOn = sal_True;
1797 
1798         aStatBar.bTemp = bSet;
1799         if ( !bOn || bReset || (!bSet && aStatBar.nId ) )
1800         {
1801             // Nur was tun, wenn die Temp-Einstellung wirklich was bewirkt
1802             UpdateStatusBar_Impl();
1803             ArrangeChilds_Impl();
1804             ShowChilds_Impl();
1805         }
1806 
1807         if ( bReset )
1808             ResetStatusBar_Impl();
1809     }
1810 }
1811 
1812 void SfxWorkWindow::UpdateStatusBar_Impl()
1813 {
1814     Reference< ::com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
1815     Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1816 
1817     Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
1818     aValue >>= xLayoutManager;
1819 
1820     // keine Statusleiste, wenn keine Id gew"unscht oder bei FullScreenView
1821     // oder wenn ausgeschaltet
1822     if ( aStatBar.nId && IsDockingAllowed() && bInternalDockingAllowed && bShowStatusBar &&
1823          ( (aStatBar.bOn && !bIsFullScreen) || aStatBar.bTemp ) )
1824     {
1825         // Id hat sich ge"andert, also passenden Statusbarmanager erzeugen,
1826         // dieser "ubernimmt die aktuelle Statusleiste;
1827         if ( xLayoutManager.is() )
1828             xLayoutManager->requestElement( m_aStatusBarResName );
1829     }
1830     else
1831     {
1832         // Aktuelle StatusBar vernichten
1833         // Der Manager erzeugt die Statusleiste nur, er zerst"ort sie
1834         // nicht !
1835         if ( xLayoutManager.is() )
1836             xLayoutManager->destroyElement( m_aStatusBarResName );
1837     }
1838 }
1839 
1840 //------------------------------------------------------------------------
1841 /*
1842 void SfxWorkWindow::SetObjectBarVisibility_Impl( sal_uInt16 nMask )
1843 {
1844     switch( nMask )
1845     {
1846         case SFX_VISIBILITY_UNVISIBLE:
1847         case SFX_VISIBILITY_STANDARD:
1848         case SFX_VISIBILITY_CLIENT:
1849         case SFX_VISIBILITY_SERVER:
1850             nOrigMode = nMask;
1851     }
1852     if (nMask != nUpdateMode)
1853         nUpdateMode = nMask;
1854 }*/
1855 
1856 void SfxWorkWindow::MakeVisible_Impl( sal_Bool bVis )
1857 {
1858     if ( bVis )
1859         nOrigMode = SFX_VISIBILITY_STANDARD;
1860     else
1861         nOrigMode = SFX_VISIBILITY_UNVISIBLE;
1862 
1863     if ( nOrigMode != nUpdateMode)
1864         nUpdateMode = nOrigMode;
1865 }
1866 
1867 sal_Bool SfxWorkWindow::IsVisible_Impl()
1868 {
1869     return nOrigMode != SFX_VISIBILITY_UNVISIBLE;
1870 }
1871 
1872 //------------------------------------------------------------------------
1873 void SfxWorkWindow::HidePopups_Impl(sal_Bool bHide, sal_Bool bParent, sal_uInt16 nId )
1874 {
1875     for ( sal_uInt16 n = 0; n < pChildWins->Count(); ++n )
1876     {
1877         SfxChildWindow *pCW = (*pChildWins)[n]->pWin;
1878         if (pCW && pCW->GetAlignment() == SFX_ALIGN_NOALIGNMENT && pCW->GetType() != nId)
1879         {
1880             Window *pWin = pCW->GetWindow();
1881             SfxChild_Impl *pChild = FindChild_Impl(*pWin);
1882             if (bHide)
1883             {
1884                 pChild->nVisible &= ~CHILD_ACTIVE;
1885                 pCW->Hide();
1886             }
1887             else
1888             {
1889                 pChild->nVisible |= CHILD_ACTIVE;
1890                 if ( CHILD_VISIBLE == (pChild->nVisible & CHILD_VISIBLE) )
1891                     pCW->Show( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
1892             }
1893         }
1894     }
1895 
1896     if ( bParent && pParent )
1897         pParent->HidePopups_Impl( bHide, bParent, nId );
1898 }
1899 
1900 //------------------------------------------------------------------------
1901 
1902 void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
1903             SfxDockingConfig eConfig, sal_uInt16 nId)
1904 {
1905     SfxDockingWindow* pDockWin=0;
1906     sal_uInt16 nPos = USHRT_MAX;
1907     Window *pWin=0;
1908     SfxChildWin_Impl *pCW = 0;
1909 
1910     if ( eChild == SFX_CHILDWIN_OBJECTBAR )
1911     {
1912         return;
1913     }
1914     else
1915     {
1916         // configure direct childwindow
1917         for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
1918         {
1919             pCW = (*pChildWins)[n];
1920             SfxChildWindow *pChild = pCW->pWin;
1921             if ( pChild )
1922             {
1923                 if ( pChild->GetType() == nId )
1924                 {
1925                     if ( pChild->GetWindow()->GetType() == RSC_DOCKINGWINDOW )
1926                         // it's a DockingWindow
1927                         pDockWin = (SfxDockingWindow*) pChild->GetWindow();
1928                     else
1929                         // FloatingWindow or ModelessDialog
1930                         pWin = pChild->GetWindow();
1931                     break;
1932                 }
1933             }
1934         }
1935 
1936         if ( pDockWin )
1937         {
1938             if ( eChild == SFX_CHILDWIN_DOCKINGWINDOW || pDockWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT )
1939             {
1940                 if ( eChild == SFX_CHILDWIN_SPLITWINDOW && eConfig == SFX_TOGGLEFLOATMODE)
1941                 {
1942                     // DockingWindow was dragged out of a SplitWindow
1943                     pCW->pCli = RegisterChild_Impl(*pDockWin, pDockWin->GetAlignment(), pCW->pWin->CanGetFocus());
1944                     pCW->pCli->nVisible = CHILD_VISIBLE;
1945                 }
1946 
1947                 pWin = pDockWin;
1948             }
1949             else
1950             {
1951                 SfxSplitWindow *pSplitWin = GetSplitWindow_Impl(pDockWin->GetAlignment());
1952 
1953                 // configure DockingWindow inside a SplitWindow
1954                 if ( eConfig == SFX_TOGGLEFLOATMODE)
1955                 {
1956                     // DockingWindow was dragged into a SplitWindow
1957                     pCW->pCli = 0;
1958                     ReleaseChild_Impl(*pDockWin);
1959                 }
1960 
1961                 pWin = pSplitWin->GetSplitWindow();
1962                 if ( pSplitWin->GetWindowCount() == 1 )
1963                     ((SplitWindow*)pWin)->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
1964             }
1965         }
1966 
1967         DBG_ASSERT( pCW, "Unknown window!" );
1968         if ( !pCW && pParent )
1969         {
1970             pParent->ConfigChild_Impl( eChild, eConfig, nId );
1971             return;
1972         }
1973     }
1974 
1975     if ( !bSorted )
1976         // windows may have been registered and released without an update until now
1977         Sort_Impl();
1978 
1979     SfxChild_Impl *pChild = 0;
1980     sal_uInt16 n;
1981     for ( n=0; n<aSortedList.Count(); ++n )
1982     {
1983         pChild = (*pChilds)[aSortedList[n]];
1984         if ( pChild )
1985             if ( pChild->pWin == pWin )
1986             break;
1987     }
1988 
1989     if ( n < aSortedList.Count() )
1990         // sometimes called while toggeling float mode
1991         nPos = aSortedList[n];
1992 
1993     switch ( eConfig )
1994     {
1995         case SFX_SETDOCKINGRECTS :
1996         {
1997             if ( nPos == USHRT_MAX )
1998                 return;
1999 
2000 //          SfxChild_Impl *pChild = (*pChilds)[nPos];
2001             Rectangle aOuterRect( GetTopRect_Impl() );
2002             aOuterRect.SetPos( pWorkWin->OutputToScreenPixel( aOuterRect.TopLeft() ));
2003             Rectangle aInnerRect( aOuterRect );
2004             sal_Bool bTbx = (eChild == SFX_CHILDWIN_OBJECTBAR);
2005 
2006             // Das gerade betroffene Fenster wird bei der Berechnung des
2007             // inneren Rechtecks mit eingeschlossen!
2008             for ( sal_uInt16 m=0; m<aSortedList.Count(); ++m )
2009             {
2010                 sal_uInt16 i=aSortedList[m];
2011                 SfxChild_Impl* pCli = (*pChilds)[i];
2012 
2013                 if ( pCli && pCli->nVisible == CHILD_VISIBLE && pCli->pWin )
2014                 {
2015                     switch ( pCli->eAlign )
2016                     {
2017                         case SFX_ALIGN_TOP:
2018                             // Objekt-Toolboxen kommen immer zuletzt
2019                             //if ( bTbx || i <= nPos)
2020                                 aInnerRect.Top() += pCli->aSize.Height();
2021                             break;
2022 
2023                         case SFX_ALIGN_TOOLBOXTOP:
2024                             // Toolbox geht nur vor, wenn nicht h"ohere Position
2025                             if ( bTbx && i <= nPos)
2026                                 aInnerRect.Top() += pCli->aSize.Height();
2027                             break;
2028 
2029                         case SFX_ALIGN_HIGHESTTOP:
2030                             // Geht immer vor
2031                             aInnerRect.Top() += pCli->aSize.Height();
2032                             break;
2033 
2034                         case SFX_ALIGN_LOWESTTOP:
2035                             // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2036                             if ( i == nPos )
2037                                 aInnerRect.Top() += pCli->aSize.Height();
2038                             break;
2039 
2040                         case SFX_ALIGN_BOTTOM:
2041                             // Objekt-Toolboxen kommen immer zuletzt
2042                             //if ( bTbx || i <= nPos)
2043                                 aInnerRect.Bottom() -= pCli->aSize.Height();
2044                             break;
2045 
2046                         case SFX_ALIGN_TOOLBOXBOTTOM:
2047                             // Toolbox geht nur vor, wenn nicht h"ohere Position
2048                             if ( bTbx && i <= nPos)
2049                                 aInnerRect.Bottom() -= pCli->aSize.Height();
2050                             break;
2051 
2052                         case SFX_ALIGN_LOWESTBOTTOM:
2053                             // Geht immer vor
2054                             aInnerRect.Bottom() -= pCli->aSize.Height();
2055                             break;
2056 
2057                         case SFX_ALIGN_HIGHESTBOTTOM:
2058                             // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2059                             if ( i == nPos )
2060                                 aInnerRect.Bottom() -= pCli->aSize.Height();
2061                             break;
2062 
2063                         case SFX_ALIGN_LEFT:
2064                             // Toolboxen kommen immer zuletzt
2065                             //if (bTbx || i <= nPos)
2066                                 aInnerRect.Left() += pCli->aSize.Width();
2067                             break;
2068 
2069                         case SFX_ALIGN_TOOLBOXLEFT:
2070                             // Toolboxen kommen immer zuletzt
2071                             if (bTbx && i <= nPos)
2072                                 aInnerRect.Left() += pCli->aSize.Width();
2073                             break;
2074 
2075                         case SFX_ALIGN_FIRSTLEFT:
2076                             // Geht immer vor
2077                             aInnerRect.Left() += pCli->aSize.Width();
2078                             break;
2079 
2080                         case SFX_ALIGN_LASTLEFT:
2081                             // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2082                             if (i == nPos)
2083                                 aInnerRect.Left() += pCli->aSize.Width();
2084 
2085                         case SFX_ALIGN_RIGHT:
2086                             // Toolboxen kommen immer zuletzt
2087                             //if (bTbx || i <= nPos)
2088                                 aInnerRect.Right() -= pCli->aSize.Width();
2089                             break;
2090 
2091                         case SFX_ALIGN_TOOLBOXRIGHT:
2092                             // Toolboxen kommen immer zuletzt
2093                             if (bTbx && i <= nPos)
2094                                 aInnerRect.Right() -= pCli->aSize.Width();
2095                             break;
2096 
2097                         case SFX_ALIGN_FIRSTRIGHT:
2098                             // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2099                             if (i == nPos)
2100                                 aInnerRect.Right() -= pCli->aSize.Width();
2101                             break;
2102 
2103                         case SFX_ALIGN_LASTRIGHT:
2104                             // Geht immer vor
2105                             aInnerRect.Right() -= pCli->aSize.Width();
2106                             break;
2107 
2108                         default:
2109                             break;
2110                     }
2111                 }
2112             }
2113 
2114             pDockWin->SetDockingRects(aOuterRect, aInnerRect);
2115             break;
2116         }
2117 
2118         case SFX_MOVEDOCKINGWINDOW :
2119         case SFX_ALIGNDOCKINGWINDOW :
2120         case SFX_TOGGLEFLOATMODE:
2121         {
2122             if ( nPos == USHRT_MAX && !pCW )
2123                 return;
2124 
2125             SfxChildAlignment eAlign = SFX_ALIGN_NOALIGNMENT;
2126             SfxChild_Impl *pCli = ( nPos != USHRT_MAX ) ? (*pChilds)[nPos] : 0;
2127             if ( pCli && pDockWin )
2128             {
2129                 eAlign = pDockWin->GetAlignment();
2130                 if ( eChild == SFX_CHILDWIN_DOCKINGWINDOW || eAlign == SFX_ALIGN_NOALIGNMENT)
2131                 {
2132                     // configuration inside the SplitWindow, no change for the SplitWindows' configuration
2133                     pCli->bResize = sal_True;
2134                     pCli->aSize = pDockWin->GetSizePixel();
2135                 }
2136             }
2137 
2138             if ( pCli )
2139             {
2140                 if( pCli->eAlign != eAlign )
2141                 {
2142                     bSorted = sal_False;
2143                     pCli->eAlign = eAlign;
2144                 }
2145 
2146                 ArrangeChilds_Impl();
2147                 ShowChilds_Impl();
2148             }
2149 
2150             if ( pCW && pCW->pWin )
2151             {
2152                 // store changed configuration
2153                 sal_uInt16 nFlags = pCW->aInfo.nFlags;
2154                 pCW->aInfo = pCW->pWin->GetInfo();
2155                 pCW->aInfo.nFlags |= nFlags;
2156                 if ( eConfig != SFX_MOVEDOCKINGWINDOW )
2157                     SaveStatus_Impl( pCW->pWin, pCW->aInfo);
2158             }
2159 
2160             break;
2161         }
2162     }
2163 }
2164 
2165 
2166 //--------------------------------------------------------------------
2167 
2168 void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnabled, sal_uInt16 nMode )
2169 {
2170     sal_uInt16 nInter = (sal_uInt16) ( lId >> 16 );
2171     sal_uInt16 nId = (sal_uInt16) ( lId & 0xFFFF );
2172 
2173     SfxChildWin_Impl *pCW=NULL;
2174     SfxWorkWindow *pWork = pParent;
2175 
2176     // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow
2177     // der Task bzw. des Frames oder am AppWorkWindow angemeldet
2178     while ( pWork && pWork->pParent )
2179         pWork = pWork->pParent;
2180 
2181     if ( pWork )
2182     {
2183         // Dem Parent schon bekannt ?
2184         sal_uInt16 nCount = pWork->pChildWins->Count();
2185         for (sal_uInt16 n=0; n<nCount; n++)
2186             if ((*pWork->pChildWins)[n]->nSaveId == nId)
2187             {
2188                 pCW = (*pWork->pChildWins)[n];
2189                 break;
2190             }
2191     }
2192 
2193     if ( !pCW )
2194     {
2195         // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen
2196         sal_uInt16 nCount = pChildWins->Count();
2197         for (sal_uInt16 n=0; n<nCount; n++)
2198             if ((*pChildWins)[n]->nSaveId == nId)
2199             {
2200                 pCW = (*pChildWins)[n];
2201                 break;
2202             }
2203     }
2204 
2205     if ( !pCW )
2206     {
2207         // Ist neu, also initialisieren; je nach Flag beim Parent oder bei
2208         // mir eintragen
2209         pCW = new SfxChildWin_Impl( lId );
2210         pCW->nId = nId;
2211         InitializeChild_Impl( pCW );
2212         if ( pWork && !( pCW->aInfo.nFlags & SFX_CHILDWIN_TASK ) )
2213             pWork->pChildWins->Insert( pWork->pChildWins->Count(), pCW );
2214         else
2215             pChildWins->Insert( pChildWins->Count(), pCW );
2216     }
2217 
2218     pCW->nId = nId;
2219     if ( nInter )
2220         pCW->nInterfaceId = nInter;
2221     pCW->nVisibility = nMode;
2222     pCW->bEnable = bEnabled;
2223 #if 0
2224     if ( pCW->pWin )
2225         pCW->pWin->GetWindow()->EnableInput( bEnabled &&
2226             ( pWorkWin->IsInputEnabled() /* || pCW->pWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT */ ) );
2227 #endif
2228     pCW->nVisibility = nMode;
2229 }
2230 
2231 //--------------------------------------------------------------------
2232 // Der An/Aus-Status eines ChildWindows wird umgeschaltet.
2233 
2234 void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, sal_Bool bSetFocus)
2235 {
2236     sal_uInt16 nCount = pChildWins->Count();
2237     sal_uInt16 n;
2238     for (n=0; n<nCount; n++)
2239         if ((*pChildWins)[n]->nId == nId)
2240             break;
2241 
2242     if ( n<nCount )
2243     {
2244         // Das Fenster ist schon bekannt
2245         SfxChildWin_Impl *pCW = (*pChildWins)[n];
2246         SfxChildWindow *pChild = pCW->pWin;
2247 
2248         bool bCreationAllowed( true );
2249         if ( !bInternalDockingAllowed )
2250         {
2251             // Special case for all non-floatable child windows. We have
2252             // to prevent the creation here!
2253             bCreationAllowed = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK );
2254         }
2255 
2256         if ( bCreationAllowed )
2257         {
2258             if ( pCW->bCreate )
2259             {
2260                 if ( pChild )
2261                 {
2262                     if ( pChild->QueryClose() )
2263                     {
2264                         pCW->bCreate = sal_False;
2265                         if ( pChild->IsHideAtToggle() )
2266                         {
2267                             ShowChildWindow_Impl( nId, sal_False, bSetFocus );
2268                         }
2269                         else
2270                         {
2271                             // Fenster soll ausgeschaltet werdem
2272                             pChild->SetVisible_Impl( sal_False );
2273                             RemoveChildWin_Impl( pCW );
2274                         }
2275                     }
2276                 }
2277                 else
2278                 {
2279                     // no actual Window exists, yet => just remember the "switched off" state
2280                     pCW->bCreate = sal_False;
2281                 }
2282             }
2283             else
2284             {
2285                 pCW->bCreate = AllowChildWindowCreation_Impl( *pCW );
2286                 if ( pCW->bCreate )
2287                 {
2288                     if ( pChild )
2289                     {
2290                         ShowChildWindow_Impl( nId, sal_True, bSetFocus );
2291                     }
2292                     else
2293                     {
2294                         // create actual Window
2295                         CreateChildWin_Impl( pCW, bSetFocus );
2296                         if ( !pCW->pWin )
2297                             // no success
2298                             pCW->bCreate = sal_False;
2299                     }
2300                 }
2301             }
2302         }
2303 
2304         ArrangeChilds_Impl();
2305         ShowChilds_Impl();
2306 
2307         if ( pCW->bCreate && bCreationAllowed )
2308         {
2309             if ( !pCW->pCli )
2310             {
2311                 SfxDockingWindow *pDock =
2312                     (SfxDockingWindow*) pCW->pWin->GetWindow();
2313                 if ( pDock->IsAutoHide_Impl() )
2314                     pDock->AutoShow_Impl();
2315             }
2316         }
2317 
2318         return;
2319     }
2320     else if ( pParent )
2321     {
2322         pParent->ToggleChildWindow_Impl( nId, bSetFocus );
2323         return;
2324     }
2325 
2326 #ifdef DBG_UTIL
2327     nCount = pChildWins->Count();
2328     for (n=0; n<nCount; n++)
2329         if ((*pChildWins)[n]->nSaveId == nId)
2330             break;
2331 
2332     if ( n < nCount )
2333     {
2334         DBG_ERROR("ChildWindow ist nicht im Kontext!");
2335     }
2336     else
2337     {
2338         DBG_ERROR("ChildWindow ist nicht registriert!");
2339     }
2340 #endif
2341 }
2342 
2343 //--------------------------------------------------------------------
2344 
2345 sal_Bool SfxWorkWindow::HasChildWindow_Impl(sal_uInt16 nId)
2346 {
2347     sal_uInt16 nCount = pChildWins->Count();
2348     sal_uInt16 n;
2349     for (n=0; n<nCount; n++)
2350         if ((*pChildWins)[n]->nSaveId == nId)
2351             break;
2352 
2353     if (n<nCount)
2354     {
2355         SfxChildWin_Impl *pCW = (*pChildWins)[n];
2356         SfxChildWindow *pChild = pCW->pWin;
2357         return ( pChild && pCW->bCreate );
2358     }
2359 
2360     if ( pParent )
2361         return pParent->HasChildWindow_Impl( nId );
2362 
2363     return sal_False;
2364 }
2365 
2366 sal_Bool SfxWorkWindow::IsFloating( sal_uInt16 nId )
2367 {
2368     SfxChildWin_Impl *pCW=NULL;
2369     SfxWorkWindow *pWork = pParent;
2370 
2371     // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow
2372     // der Task bzw. des Frames oder am AppWorkWindow angemeldet
2373     while ( pWork && pWork->pParent )
2374         pWork = pWork->pParent;
2375 
2376     if ( pWork )
2377     {
2378         // Dem Parent schon bekannt ?
2379         sal_uInt16 nCount = pWork->pChildWins->Count();
2380         for (sal_uInt16 n=0; n<nCount; n++)
2381             if ((*pWork->pChildWins)[n]->nSaveId == nId)
2382             {
2383                 pCW = (*pWork->pChildWins)[n];
2384                 break;
2385             }
2386     }
2387 
2388     if ( !pCW )
2389     {
2390         // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen
2391         sal_uInt16 nCount = pChildWins->Count();
2392         for (sal_uInt16 n=0; n<nCount; n++)
2393             if ((*pChildWins)[n]->nSaveId == nId)
2394             {
2395                 pCW = (*pChildWins)[n];
2396                 break;
2397             }
2398     }
2399 
2400     if ( !pCW )
2401     {
2402         // Ist neu, also initialisieren; je nach Flag beim Parent oder bei
2403         // mir eintragen
2404         pCW = new SfxChildWin_Impl( nId );
2405         pCW->bEnable = sal_False;
2406         pCW->nId = 0;
2407         pCW->nVisibility = 0;
2408         InitializeChild_Impl( pCW );
2409         if ( pWork && !( pCW->aInfo.nFlags & SFX_CHILDWIN_TASK ) )
2410             pWork->pChildWins->Insert( pWork->pChildWins->Count(), pCW );
2411         else
2412             pChildWins->Insert( pChildWins->Count(), pCW );
2413     }
2414 
2415     SfxChildAlignment eAlign;
2416     if ( pCW->aInfo.GetExtraData_Impl( &eAlign ) )
2417         return( eAlign == SFX_ALIGN_NOALIGNMENT );
2418     else
2419         return sal_True;
2420 }
2421 
2422 //--------------------------------------------------------------------
2423 
2424 sal_Bool SfxWorkWindow::KnowsChildWindow_Impl(sal_uInt16 nId)
2425 {
2426     SfxChildWin_Impl *pCW=0;
2427     sal_uInt16 nCount = pChildWins->Count();
2428     sal_uInt16 n;
2429     for (n=0; n<nCount; n++)
2430     {
2431         pCW = (*pChildWins)[n];
2432         if ( pCW->nSaveId == nId)
2433              break;
2434     }
2435 
2436     if (n<nCount)
2437     {
2438         if ( !(pCW->aInfo.nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE) && !IsVisible_Impl(  pCW->nVisibility ) )
2439             return sal_False;
2440         return pCW->bEnable;
2441     }
2442     else if ( pParent )
2443         return pParent->KnowsChildWindow_Impl( nId );
2444     else
2445         return sal_False;
2446 }
2447 
2448 //--------------------------------------------------------------------
2449 
2450 void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, sal_Bool bOn, sal_Bool bSetFocus)
2451 {
2452     SfxChildWin_Impl *pCW=NULL;
2453     SfxWorkWindow *pWork = pParent;
2454 
2455     // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow
2456     // der Task bzw. des Frames oder am AppWorkWindow angemeldet
2457     while ( pWork && pWork->pParent )
2458         pWork = pWork->pParent;
2459 
2460     if ( pWork )
2461     {
2462         // Dem Parent schon bekannt ?
2463         sal_uInt16 nCount = pWork->pChildWins->Count();
2464         for (sal_uInt16 n=0; n<nCount; n++)
2465             if ((*pWork->pChildWins)[n]->nSaveId == nId)
2466             {
2467                 pCW = (*pWork->pChildWins)[n];
2468                 break;
2469             }
2470     }
2471 
2472     if ( !pCW )
2473     {
2474         // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen
2475         sal_uInt16 nCount = pChildWins->Count();
2476         for (sal_uInt16 n=0; n<nCount; n++)
2477             if ((*pChildWins)[n]->nSaveId == nId)
2478             {
2479                 pCW = (*pChildWins)[n];
2480                 pWork = this;
2481                 break;
2482             }
2483     }
2484 
2485     if ( !pCW )
2486     {
2487         // Ist neu, also initialisieren; je nach Flag beim Parent oder bei
2488         // mir eintragen
2489         pCW = new SfxChildWin_Impl( nId );
2490         InitializeChild_Impl( pCW );
2491         if ( !pWork || pCW->aInfo.nFlags & SFX_CHILDWIN_TASK )
2492             pWork = this;
2493         pWork->pChildWins->Insert( pWork->pChildWins->Count(), pCW );
2494     }
2495 
2496     if ( pCW->bCreate != bOn )
2497         pWork->ToggleChildWindow_Impl(nId,bSetFocus);
2498 }
2499 
2500 //--------------------------------------------------------------------
2501 
2502 void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus)
2503 {
2504     sal_uInt16 nCount = pChildWins->Count();
2505     SfxChildWin_Impl* pCW=0;
2506     sal_uInt16 n;
2507     for (n=0; n<nCount; n++)
2508     {
2509         pCW = (*pChildWins)[n];
2510         if (pCW->nId == nId)
2511             break;
2512     }
2513 
2514     if ( n<nCount )
2515     {
2516         SfxChildWindow *pChildWin = pCW->pWin;
2517         if ( pChildWin )
2518         {
2519             if ( bVisible )
2520             {
2521                 if ( pCW->pCli )
2522                 {
2523                     pCW->pCli->bSetFocus = bSetFocus;
2524                     pCW->pCli->nVisible = CHILD_VISIBLE;
2525                     pChildWin->Show( bSetFocus && pChildWin->WantsFocus() ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
2526                 }
2527                 else
2528                     ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl();
2529 
2530             }
2531             else
2532             {
2533                 if ( pCW->pCli )
2534                 {
2535                     pCW->pCli->nVisible = CHILD_VISIBLE ^ CHILD_NOT_HIDDEN;
2536                     pCW->pWin->Hide();
2537                 }
2538                 else
2539                     ((SfxDockingWindow*)pChildWin->GetWindow())->Disappear_Impl();
2540 
2541             }
2542 
2543             ArrangeChilds_Impl();
2544             ShowChilds_Impl();
2545         }
2546         else if ( bVisible )
2547         {
2548             SetChildWindow_Impl( nId, sal_True, bSetFocus );
2549             pChildWin = pCW->pWin;
2550         }
2551 
2552         if ( pChildWin )
2553         {
2554             pChildWin->SetVisible_Impl( bVisible );
2555             sal_uInt16 nFlags = pCW->aInfo.nFlags;
2556             pCW->aInfo = pChildWin->GetInfo();
2557             pCW->aInfo.nFlags |= nFlags;
2558             if ( !pCW->bCreate )
2559                 SaveStatus_Impl( pChildWin, pCW->aInfo );
2560         }
2561 
2562         return;
2563     }
2564 
2565     if ( pParent )
2566     {
2567         pParent->ShowChildWindow_Impl( nId, bVisible, bSetFocus );
2568         return;
2569     }
2570 
2571 #ifdef DBG_UTIL
2572     nCount = pChildWins->Count();
2573     for (n=0; n<nCount; n++)
2574         if ((*pChildWins)[n]->nSaveId == nId)
2575             break;
2576 
2577     if ( n<nCount )
2578     {
2579         DBG_ERROR("ChildWindow ist nicht im Kontext!");
2580     }
2581     else
2582     {
2583         DBG_ERROR("ChildWindow ist nicht registriert!");
2584     }
2585 #endif
2586 }
2587 
2588 //--------------------------------------------------------------------
2589 
2590 SfxChildWindow* SfxWorkWindow::GetChildWindow_Impl(sal_uInt16 nId)
2591 {
2592     sal_uInt16 nCount = pChildWins->Count();
2593     sal_uInt16 n;
2594     for (n=0; n<nCount; n++)
2595         if ((*pChildWins)[n]->nSaveId == nId)
2596              break;
2597 
2598     if (n<nCount)
2599         return (*pChildWins)[n]->pWin;
2600     else if ( pParent )
2601         return pParent->GetChildWindow_Impl( nId );
2602     return 0;
2603 }
2604 
2605 //------------------------------------------------------------------------
2606 
2607 void SfxWorkWindow::ResetChildWindows_Impl()
2608 {
2609 //  if ( pParent )
2610 //      pParent->ResetChildWindows_Impl();
2611 
2612     for ( sal_uInt16 n = 0; n < pChildWins->Count(); ++n )
2613     {
2614         (*pChildWins)[n]->nId = 0;
2615         (*pChildWins)[n]->bEnable = sal_False;
2616     }
2617 }
2618 
2619 //------------------------------------------------------------------------
2620 // Virtuelle Methode, die die Gr"o\se der Fl"ache (client area) des parent
2621 // windows liefert, in der Child-Fenster angeordnet werden k"onnen.
2622 // in der ClientArea des parent findet.
2623 
2624 Rectangle SfxWorkWindow::GetTopRect_Impl()
2625 {
2626     return Rectangle (Point(), pWorkWin->GetOutputSizePixel() );
2627 }
2628 
2629 //------------------------------------------------------------------------
2630 // Virtuelle Methode, die die Gr"o\se der Fl"ache (client area) des parent
2631 // windows liefert, in der Child-Fenster angeordnet werden k"onnen.
2632 // in der ClientArea des parent findet.
2633 
2634 Rectangle SfxFrameWorkWin_Impl::GetTopRect_Impl()
2635 {
2636     return pMasterFrame->GetTopOuterRectPixel_Impl();
2637 }
2638 
2639 //------------------------------------------------------------------------
2640 // Virtuelle Methode, um herauszufinden, ob ein Child-Fenster noch Platz
2641 // in der ClientArea des parent findet.
2642 
2643 sal_Bool SfxWorkWindow::RequestTopToolSpacePixel_Impl( SvBorder aBorder )
2644 {
2645     if ( !IsDockingAllowed() ||
2646             aClientArea.GetWidth() < aBorder.Left() + aBorder.Right() ||
2647             aClientArea.GetHeight() < aBorder.Top() + aBorder.Bottom() )
2648         return sal_False;
2649     else
2650         return sal_True;;
2651 }
2652 
2653 void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow *pChild, const SfxChildWinInfo &rInfo)
2654 {
2655     // Den Status vom Presentation mode wollen wir nicht sichern
2656     if ( IsDockingAllowed() && bInternalDockingAllowed )
2657         pChild->SaveStatus(rInfo);
2658 }
2659 
2660 void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW)
2661 {
2662     SfxChildWinFactory* pFact=0;
2663     SfxApplication *pApp = SFX_APP();
2664     {
2665         SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl();
2666         for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory )
2667         {
2668             pFact = rFactories[nFactory];
2669             if ( pFact->nId == pCW->nSaveId )
2670             {
2671                 pCW->aInfo   = pFact->aInfo;
2672                 SfxChildWindow::InitializeChildWinFactory_Impl(
2673                                             pCW->nSaveId, pCW->aInfo);
2674                 pCW->bCreate = pCW->aInfo.bVisible;
2675                 sal_uInt16 nFlags = pFact->aInfo.nFlags;
2676                 if ( nFlags & SFX_CHILDWIN_TASK )
2677                     pCW->aInfo.nFlags |= SFX_CHILDWIN_TASK;
2678                 if ( nFlags & SFX_CHILDWIN_CANTGETFOCUS )
2679                     pCW->aInfo.nFlags |= SFX_CHILDWIN_CANTGETFOCUS;
2680                 if ( nFlags & SFX_CHILDWIN_FORCEDOCK )
2681                     pCW->aInfo.nFlags |= SFX_CHILDWIN_FORCEDOCK;
2682                 pFact->aInfo = pCW->aInfo;
2683                 return;
2684             }
2685         }
2686     }
2687 
2688     SfxDispatcher *pDisp = pBindings->GetDispatcher_Impl();
2689     SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :0;
2690     if ( pMod )
2691     {
2692         SfxChildWinFactArr_Impl *pFactories = pMod->GetChildWinFactories_Impl();
2693         if ( pFactories )
2694         {
2695             SfxChildWinFactArr_Impl &rFactories = *pFactories;
2696             for ( sal_uInt16 nFactory = 0; nFactory < rFactories.Count(); ++nFactory )
2697             {
2698                 pFact = rFactories[nFactory];
2699                 if ( pFact->nId == pCW->nSaveId )
2700                 {
2701                     pCW->aInfo   = pFact->aInfo;
2702                     SfxChildWindow::InitializeChildWinFactory_Impl(
2703                                                 pCW->nSaveId, pCW->aInfo);
2704                     pCW->bCreate = pCW->aInfo.bVisible;
2705                     sal_uInt16 nFlags = pFact->aInfo.nFlags;
2706                     if ( nFlags & SFX_CHILDWIN_TASK )
2707                         pCW->aInfo.nFlags |= SFX_CHILDWIN_TASK;
2708                     if ( nFlags & SFX_CHILDWIN_CANTGETFOCUS )
2709                         pCW->aInfo.nFlags |= SFX_CHILDWIN_CANTGETFOCUS;
2710                     if ( nFlags & SFX_CHILDWIN_FORCEDOCK )
2711                         pCW->aInfo.nFlags |= SFX_CHILDWIN_FORCEDOCK;
2712                     if ( nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE )
2713                         pCW->aInfo.nFlags |= SFX_CHILDWIN_ALWAYSAVAILABLE;
2714                     pFact->aInfo = pCW->aInfo;
2715                     return;
2716                 }
2717             }
2718         }
2719     }
2720 }
2721 /*
2722 SfxStatBar_Impl* SfxWorkWindow::GetStatusBar_Impl()
2723 {
2724     return &aStatBar;
2725 } */
2726 
2727 SfxSplitWindow* SfxWorkWindow::GetSplitWindow_Impl( SfxChildAlignment eAlign )
2728 {
2729     switch ( eAlign )
2730     {
2731         case SFX_ALIGN_TOP:
2732             return pSplit[2];
2733 
2734         case SFX_ALIGN_BOTTOM:
2735             return pSplit[3];
2736 
2737         case SFX_ALIGN_LEFT:
2738             return pSplit[0];
2739 
2740         case SFX_ALIGN_RIGHT:
2741             return pSplit[1];
2742 
2743         default:
2744             return 0;
2745     }
2746 }
2747 
2748 void SfxWorkWindow::MakeChildsVisible_Impl( sal_Bool bVis )
2749 {
2750     if ( pParent )
2751         pParent->MakeChildsVisible_Impl( bVis );
2752 
2753     bAllChildsVisible = bVis;
2754     if ( bVis )
2755     {
2756         if ( !bSorted )
2757             Sort_Impl();
2758         for ( sal_uInt16 n=0; n<aSortedList.Count(); ++n )
2759         {
2760             SfxChild_Impl* pCli = (*pChilds)[aSortedList[n]];
2761             if ( (pCli->eAlign == SFX_ALIGN_NOALIGNMENT) || (IsDockingAllowed() && bInternalDockingAllowed) )
2762                 pCli->nVisible |= CHILD_ACTIVE;
2763         }
2764     }
2765     else
2766     {
2767         if ( !bSorted )
2768             Sort_Impl();
2769         for ( sal_uInt16 n=0; n<aSortedList.Count(); ++n )
2770         {
2771             SfxChild_Impl* pCli = (*pChilds)[aSortedList[n]];
2772             pCli->nVisible &= ~CHILD_ACTIVE;
2773         }
2774     }
2775 }
2776 
2777 sal_Bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin )
2778 {
2779     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2780     {
2781         if ( pSplit[n] != pSplitWin && pSplit[n]->IsAutoHide( sal_True ) )
2782             return sal_True;
2783     }
2784     return sal_False;
2785 }
2786 
2787 
2788 void SfxWorkWindow::EndAutoShow_Impl( Point aPos )
2789 {
2790     if ( pParent )
2791         pParent->EndAutoShow_Impl( aPos );
2792 
2793     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2794     {
2795         SfxSplitWindow *p = pSplit[n];
2796         if ( p && p->IsAutoHide() )
2797         {
2798             Point aLocalPos = p->ScreenToOutputPixel( aPos );
2799         Point aEmptyPoint = Point();
2800             Rectangle aRect( aEmptyPoint, p->GetSizePixel() );
2801             if ( !aRect.IsInside( aLocalPos ) )
2802                 p->FadeOut();
2803         }
2804     }
2805 }
2806 
2807 void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin )
2808 {
2809     if ( m_nLock )
2810         return;
2811 
2812     if ( pParent )
2813         pParent->ArrangeAutoHideWindows( pActSplitWin );
2814 
2815     Rectangle aArea( aUpperClientArea );
2816     for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2817     {
2818         // Es werden entweder Dummyfenster oder Fenster im AutoShow-Modus
2819         // ( nicht gepinned, FadeIn ) behandelt.
2820         // Nur das "ubergebene Fenster darf unsichtbar sein, denn vielleicht
2821         // soll daf"ur gerade die Gr"o\se berechnet werden, bevor es angezeigt
2822         // wird.
2823         SfxSplitWindow* pSplitWin = pSplit[n];
2824         sal_Bool bDummyWindow = !pSplitWin->IsFadeIn();
2825         Window *pDummy = pSplitWin->GetSplitWindow();
2826         Window *pWin = bDummyWindow ? pDummy : pSplitWin;
2827         if ( (pSplitWin->IsPinned() && !bDummyWindow) || (!pWin->IsVisible() && pActSplitWin != pSplitWin) )
2828             continue;
2829 
2830         // Breite und Position des Dummy-Fensters als Ausgangspunkt
2831         Size aSize = pDummy->GetSizePixel();
2832         Point aPos = pDummy->GetPosPixel();
2833 
2834         switch ( n )
2835         {
2836             case ( 0 ) :
2837             {
2838                 // Linkes SplitWindow
2839                 // Breite vom Fenster selbst holen, wenn nicht das DummyWindow
2840                 if ( !bDummyWindow )
2841                     aSize.Width() = pSplitWin->GetSizePixel().Width();
2842 
2843                 // Wenn links ein Window sichtbar ist, beginnt der freie
2844                 // Bereich rechts davon bzw. bei der Client area
2845                 long nLeft = aPos.X() + aSize.Width();
2846                 if ( nLeft > aArea.Left() )
2847                     aArea.Left() = nLeft;
2848                 break;
2849             }
2850             case ( 1 ) :
2851             {
2852                 // Rechtes SplitWindow
2853                 // Position um Differenz der Breiten korrigieren
2854                 aPos.X() += aSize.Width();
2855 
2856                 // Breite vom Fenster selbst holen, wenn nicht das DummyWindow
2857                 if ( !bDummyWindow )
2858                     aSize.Width() = pSplitWin->GetSizePixel().Width();
2859 
2860                 aPos.X() -= aSize.Width();
2861 
2862                 // Wenn links schon ein Fenster aufgeklappt ist, darf
2863                 // das rechte nicht dar"uber gehen
2864                 if ( aPos.X() < aArea.Left() )
2865                 {
2866                     aPos.X() = aArea.Left();
2867                     aSize.Width() = aArea.GetWidth();
2868                 }
2869 
2870                 // Wenn rechts ein Window sichtbar ist, endet der freie
2871                 // Bereich links davon bzw. bei der Client area
2872                 long nRight = aPos.X();
2873                 if ( nRight < aArea.Right() )
2874                     aArea.Right() = nRight;
2875                 break;
2876             }
2877             case ( 2 ) :
2878             {
2879                 // Oberes SplitWindow
2880                 // H"ohe vom Fenster selbst holen, wenn nicht das DummyWindow
2881                 if ( !bDummyWindow )
2882                     aSize.Height() = pSplitWin->GetSizePixel().Height();
2883 
2884                 // Breite anpassen, je nachdem ob links oder rechts
2885                 // schon ein Fenster aufgeklappt ist
2886                 aPos.X() = aArea.Left();
2887                 aSize.Width() = aArea.GetWidth();
2888 
2889                 // Wenn oben ein Window sichtbar ist, beginnt der freie
2890                 // Bereich darunter bzw. bei der Client Area
2891                 long nTop = aPos.Y() + aSize.Height();
2892                 if ( nTop > aArea.Top() )
2893                     aArea.Top() = nTop;
2894                 break;
2895             }
2896             case ( 3 ) :
2897             {
2898                 // Das untere SplitWindow
2899                 // Position um Differenz der H"ohen korrigieren
2900                 aPos.Y() += aSize.Height();
2901 
2902                 // H"ohe vom Fenster selbst holen, wenn nicht das DummmyWindow
2903                 if ( !bDummyWindow )
2904                     aSize.Height() = pSplitWin->GetSizePixel().Height();
2905 
2906                 aPos.Y() -= aSize.Height();
2907 
2908                 // Breite anpassen, je nachdem ob links oder rechts
2909                 // schon ein Fenster aufgeklappt ist
2910                 aPos.X() = aArea.Left();
2911                 aSize.Width() = aArea.GetWidth();
2912 
2913                 // Wenn oben schon ein Fenster aufgeklappt ist, darf
2914                 // das untere nicht dar"uber gehen
2915                 if ( aPos.Y() < aArea.Top() )
2916                 {
2917                     aPos.Y() = aArea.Top();
2918                     aSize.Height() = aArea.GetHeight();
2919                 }
2920 
2921                 break;
2922             }
2923         }
2924 
2925         if ( !bDummyWindow )
2926             // Das FadeIn-Window ist ein Float, dessen Koordinaten in
2927             // Screenkoordinaten gesetzt werden
2928             pSplitWin->SetPosSizePixel( pWorkWin->OutputToScreenPixel(aPos), aSize );
2929         else
2930             // Das angedockte DummyWindow
2931             pDummy->SetPosSizePixel( aPos, aSize );
2932     }
2933 }
2934 
2935 Rectangle SfxWorkWindow::GetFreeArea( sal_Bool bAutoHide ) const
2936 {
2937     if ( bAutoHide )
2938     {
2939         Rectangle aArea( aClientArea );
2940         for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2941         {
2942             if ( pSplit[n]->IsPinned() || !pSplit[n]->IsVisible() )
2943                 continue;
2944 
2945             Size aSize = pSplit[n]->GetSizePixel();
2946             switch ( n )
2947             {
2948                 case ( 0 ) :
2949                     aArea.Left() += aSize.Width();
2950                     break;
2951                 case ( 1 ) :
2952                     aArea.Right() -= aSize.Width();
2953                     break;
2954                 case ( 2 ) :
2955                     aArea.Top() += aSize.Height();
2956                     break;
2957                 case ( 3 ) :
2958                     aArea.Bottom() -= aSize.Height();
2959                     break;
2960             }
2961         }
2962 
2963         return aArea;
2964     }
2965     else
2966         return aClientArea;
2967 }
2968 
2969 SfxChildWinController_Impl::SfxChildWinController_Impl( sal_uInt16 nID, SfxWorkWindow *pWork )
2970     : SfxControllerItem( nID, pWork->GetBindings() )
2971     , pWorkwin( pWork )
2972 {}
2973 
2974 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SfxWorkWindow::CreateDispatch( const String& )
2975 {
2976     return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >();
2977 }
2978 
2979 void SfxChildWinController_Impl::StateChanged(
2980     sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* )
2981 {
2982     pWorkwin->DisableChildWindow_Impl( nSID, eState == SFX_ITEM_DISABLED );
2983 }
2984 
2985 void SfxWorkWindow::DisableChildWindow_Impl( sal_uInt16 nId, sal_Bool bDisable )
2986 {
2987     sal_uInt16 nCount = pChildWins->Count();
2988     sal_uInt16 n;
2989     for (n=0; n<nCount; n++)
2990         if ((*pChildWins)[n]->nSaveId == nId)
2991              break;
2992     if ( n<nCount && (*pChildWins)[n]->bDisabled != bDisable )
2993     {
2994         (*pChildWins)[n]->bDisabled = bDisable;
2995         UpdateChildWindows_Impl();
2996         ArrangeChilds_Impl();
2997         ShowChilds_Impl();
2998     }
2999 }
3000 
3001 void SfxWorkWindow::SetActiveChild_Impl( Window *pChild )
3002 {
3003     pActiveChild = pChild;
3004 }
3005 
3006 Window* SfxWorkWindow::GetActiveChild_Impl()
3007 {
3008     return pActiveChild;
3009 }
3010 
3011 sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward )
3012 {
3013     // Alle Kinder gem"a\s Liste sortieren
3014     SvUShorts aList;
3015     for ( sal_uInt16 i=SFX_OBJECTBAR_MAX; i<pChilds->Count(); i++)
3016     {
3017         SfxChild_Impl *pCli = (*pChilds)[i];
3018         if ( pCli && pCli->bCanGetFocus && pCli->pWin )
3019         {
3020             sal_uInt16 k;
3021             for (k=0; k<aList.Count(); k++)
3022                 if ( ChildTravelValue((*pChilds)[aList[k]]->eAlign) > ChildTravelValue(pCli->eAlign) )
3023                     break;
3024             aList.Insert(i,k);
3025         }
3026     }
3027 
3028     if ( aList.Count() == 0 )
3029         return sal_False;
3030 
3031     sal_uInt16 nTopValue  = ChildTravelValue( SFX_ALIGN_LOWESTTOP );
3032     for ( sal_uInt16 i=0; i<aList.Count(); i++ )
3033     {
3034         SfxChild_Impl* pCli = (*pChilds)[aList[i]];
3035         if ( pCli->pWin && ChildTravelValue( pCli->eAlign ) > nTopValue )
3036             break;
3037     }
3038 
3039     sal_uInt16 n = bForward ? 0 : aList.Count()-1;
3040     SfxChild_Impl *pAct=NULL;
3041     if ( pActiveChild )
3042     {
3043         // Das aktive Fenster suchen
3044         for ( n=0; n<aList.Count(); n++ )
3045         {
3046             SfxChild_Impl* pCli = (*pChilds)[aList[n]];
3047             if ( pCli && pCli->pWin && ( pCli->pWin == pActiveChild || !pActiveChild ) )
3048             {
3049                 pAct = pCli;
3050                 break;
3051             }
3052         }
3053     }
3054 
3055     // dummy entries for the container window
3056     aList.Insert( 0xFFFF, 0 );
3057     aList.Insert( 0xFFFF, aList.Count() );
3058     n = n + 1;
3059     if ( pAct )
3060     {
3061         for ( sal_uInt16 i=0; i<SFX_SPLITWINDOWS_MAX; i++ )
3062         {
3063             // Eventuell ist pAct ein Splitwindow
3064             SfxSplitWindow *p = pSplit[i];
3065             if ( pAct->pWin == p )
3066             {
3067                 if( p->ActivateNextChild_Impl( bForward ) )
3068                     return sal_True;
3069                 break;
3070             }
3071         }
3072 
3073         // pAct ist ein direktes ChildWindow
3074         // mit dem Nachfolger bzw. Vorg"anger des aktiven Fensters weitermachen
3075         if ( bForward )
3076             n = n+1;
3077         else
3078             n = n-1;
3079 
3080         if ( n == 0 || n == aList.Count()-1 )
3081             return sal_False;
3082     }
3083 
3084     for( ;; )
3085     {
3086         SfxChild_Impl* pCli = (*pChilds)[aList[n]];
3087         if ( pCli->pWin )
3088         {
3089             SfxChild_Impl* pNext = pCli;
3090             for ( sal_uInt16 i=0; n<SFX_SPLITWINDOWS_MAX; n++ )
3091             {
3092                 // Eventuell ist pNext ein Splitwindow
3093                 SfxSplitWindow *p = pSplit[i];
3094                 if ( pNext->pWin == p )
3095                 {
3096                     // Das erste/letzte Fenster dort aktivieren
3097                     p->SetActiveWindow_Impl( NULL );
3098                     pNext = NULL;
3099                     if( p->ActivateNextChild_Impl( bForward ) )
3100                         return sal_True;
3101                     break;
3102                 }
3103             }
3104 
3105             if ( pNext )
3106             {
3107                 pNext->pWin->GrabFocus();
3108                 pActiveChild = pNext->pWin;
3109                 return sal_True;
3110             }
3111         }
3112 
3113         if ( bForward )
3114             n = n+1;
3115         else
3116             n = n-1;
3117 
3118         if ( n == 0 || n == aList.Count()-1 )
3119             break;
3120     }
3121 
3122     return sal_False;
3123 }
3124 
3125 void SfxWorkWindow::SetObjectBarCustomizeMode_Impl( sal_Bool )
3126 {
3127 }
3128 
3129 void SfxWorkWindow::DataChanged_Impl( const DataChangedEvent& )
3130 {
3131     sal_uInt16 n;
3132     sal_uInt16 nCount = pChildWins->Count();
3133     for (n=0; n<nCount; n++)
3134     {
3135         SfxChildWin_Impl*pCW = (*pChildWins)[n];
3136         if ( pCW && pCW->pWin )
3137             pCW->pWin->GetWindow()->UpdateSettings( Application::GetSettings() );
3138     }
3139 
3140     ArrangeChilds_Impl();
3141 }
3142 
3143