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