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