Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <stdio.h>
22 : #include <boost/unordered_map.hpp>
23 :
24 : #include <sfx2/docfile.hxx>
25 : #include <sfx2/objsh.hxx>
26 : #include <sfx2/app.hxx>
27 : #include "workwin.hxx"
28 : #include <sfx2/viewfrm.hxx>
29 : #include "arrdecl.hxx"
30 : #include <sfx2/module.hxx>
31 : #include <sfx2/dispatch.hxx>
32 : #include <sfx2/dockwin.hxx>
33 : #include <sfx2/viewsh.hxx>
34 : #include "splitwin.hxx"
35 : #include <sfx2/msgpool.hxx>
36 : #include "sfx2/sfxresid.hxx"
37 : #include <sfx2/request.hxx> // SFX_ITEMSET_SET
38 : #include <vcl/taskpanelist.hxx>
39 : #include <vcl/toolbox.hxx>
40 : #include <tools/rcid.h>
41 : #include <tools/diagnose_ex.h>
42 : #include <toolkit/helper/vclunohelper.hxx>
43 : #include <svl/itempool.hxx>
44 : #include <svl/itemiter.hxx>
45 : #include <svl/whiter.hxx>
46 : #include <svl/intitem.hxx>
47 : #include <svl/eitem.hxx>
48 : #include <com/sun/star/ui/XUIElement.hpp>
49 : #include <com/sun/star/frame/XLayoutManager.hpp>
50 : #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
51 : #include <com/sun/star/frame/LayoutManagerEvents.hpp>
52 : #include <com/sun/star/beans/XPropertySet.hpp>
53 : #include <com/sun/star/awt/XWindow.hpp>
54 : #include <com/sun/star/lang/DisposedException.hpp>
55 :
56 : using namespace ::com::sun::star;
57 : using namespace ::com::sun::star::uno;
58 :
59 : struct ResIdToResName
60 : {
61 : sal_uInt16 nId;
62 : const char* pName;
63 : };
64 :
65 : static const ResIdToResName pToolBarResToName[] =
66 : {
67 : { 558, "fullscreenbar" },
68 : { 560, "standardbar", },
69 : { 18001, "formsnavigationbar" },
70 : { 18002, "formsfilterbar" },
71 : { 18003, "formtextobjectbar" },
72 : { 18004, "formcontrols" },
73 : { 18005, "moreformcontrols" },
74 : { 18006, "formdesign" },
75 : { 20050, "toolbar" }, //math
76 : { 30001, "objectbar" }, //chart
77 : { 30513, "toolbar" }, //chart
78 : { 25005, "textobjectbar" }, //calc
79 : { 25053, "drawobjectbar" },
80 : { 25054, "graphicobjectbar" },
81 : { 25001, "formatobjectbar" },
82 : { 25006, "previewbar" },
83 : { 25035, "toolbar" }, //calc
84 : { 23015, "bezierobjectbar" }, //draw/impress
85 : { 23019, "gluepointsobjectbar" },
86 : { 23030, "graphicobjectbar" },
87 : { 23013, "drawingobjectbar" }, //impress
88 : { 23016, "textobjectbar" }, //impress
89 : { 23028, "textobjectbar" }, //draw
90 : { 23011, "toolbar" }, //impress
91 : { 23020, "optionsbar" },
92 : { 23021, "commontaskbar" },
93 : { 23025, "toolbar" }, //draw
94 : { 23026, "optionsbar" },
95 : { 23027, "drawingobjectbar" }, //draw
96 : { 23017, "outlinetoolbar" }, //impress
97 : { 23012, "slideviewtoolbar" },
98 : { 23014, "slideviewobjectbar" },
99 : { 23283, "bezierobjectbar" }, //writer
100 : { 23269, "drawingobjectbar" },
101 : { 23270, "drawtextobjectbar" },
102 : { 23267, "frameobjectbar" },
103 : { 23268, "graphicobjectbar" },
104 : { 23271, "numobjectbar" },
105 : { 23272, "oleobjectbar" },
106 : { 23266, "tableobjectbar" },
107 : { 23265, "textobjectbar" },
108 : { 20631, "previewobjectbar" }, //writer
109 : { 20402, "toolbar" }, //web
110 : { 20403, "textobjectbar" },
111 : { 23273, "toolbar" }, //writer
112 : { 20408, "frameobjectbar" }, //web
113 : { 20410, "graphicobjectbar" },
114 : { 20411, "oleobjectbar" },
115 : { 14850, "macrobar" },
116 : { 10987, "fontworkobjectbar" }, //global
117 : { 10986, "extrusionobjectbar" },
118 : { 23022, "formsobjectbar" },
119 : { 23310, "viewerbar" }, //writer (plugin)
120 : { 25000, "viewerbar" }, //calc (plugin)
121 : { 23023, "viewerbar" }, //impress(plugin)
122 : { 23024, "viewerbar" }, //draw (plugin)
123 : { 23031, "mediaobjectbar" }, //draw/impress
124 : { 25060, "mediaobjectbar" }, //calc
125 : { 23311, "mediaobjectbar" }, //writer
126 : { 23313, "navigationobjectbar" }, //writer
127 : { 0, "" }
128 : };
129 :
130 : DBG_NAME(SfxWorkWindow)
131 :
132 : //SV_IMPL_OBJARR( SfxObjectBarArr_Impl, SfxObjectBar_Impl );
133 :
134 : //====================================================================
135 : // Sort the Children according their alignment
136 : // The order corresponds to the enum SfxChildAlignment (->CHILDWIN.HXX).
137 : //
138 :
139 : // Help to make changes to the alignment compatible!
140 :
141 :
142 15413 : SFX_IMPL_XINTERFACE_3( LayoutManagerListener, OWeakObject, ::com::sun::star::frame::XLayoutManagerListener, ::com::sun::star::lang::XEventListener, ::com::sun::star::lang::XComponent )
143 0 : SFX_IMPL_XTYPEPROVIDER_3( LayoutManagerListener, ::com::sun::star::frame::XLayoutManagerListener, ::com::sun::star::lang::XEventListener, ::com::sun::star::lang::XComponent )
144 :
145 240 : LayoutManagerListener::LayoutManagerListener(
146 : SfxWorkWindow* pWrkWin ) :
147 : m_bHasFrame( sal_False ),
148 : m_pWrkWin( pWrkWin ),
149 240 : m_aLayoutManagerPropName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))
150 : {
151 240 : }
152 :
153 126 : LayoutManagerListener::~LayoutManagerListener()
154 : {
155 126 : }
156 :
157 240 : void LayoutManagerListener::setFrame( const css::uno::Reference< css::frame::XFrame >& xFrame )
158 : {
159 240 : SolarMutexGuard aGuard;
160 240 : if ( m_pWrkWin && !m_bHasFrame )
161 : {
162 240 : m_xFrame = xFrame;
163 240 : m_bHasFrame = sal_True;
164 :
165 240 : if ( xFrame.is() )
166 : {
167 240 : css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
168 240 : css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager;
169 240 : if ( xPropSet.is() )
170 : {
171 : try
172 : {
173 240 : Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
174 240 : aValue >>= xLayoutManager;
175 :
176 240 : if ( xLayoutManager.is() )
177 240 : xLayoutManager->addLayoutManagerEventListener(
178 : css::uno::Reference< css::frame::XLayoutManagerListener >(
179 240 : static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY ));
180 :
181 240 : xPropSet = css::uno::Reference< css::beans::XPropertySet >( xLayoutManager, UNO_QUERY );
182 240 : if ( xPropSet.is() )
183 : {
184 240 : aValue = xPropSet->getPropertyValue(
185 240 : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LockCount" )) );
186 240 : aValue >>= m_pWrkWin->m_nLock;
187 240 : }
188 : }
189 0 : catch ( css::lang::DisposedException& )
190 : {
191 : }
192 0 : catch ( const css::uno::RuntimeException& )
193 : {
194 0 : throw;
195 : }
196 0 : catch ( css::uno::Exception& )
197 : {
198 : }
199 240 : }
200 : }
201 240 : }
202 240 : }
203 :
204 : //---------------------------------------------------------------------------------------------------------
205 : // XComponent
206 : //---------------------------------------------------------------------------------------------------------
207 0 : void SAL_CALL LayoutManagerListener::addEventListener(
208 : const css::uno::Reference< css::lang::XEventListener >& )
209 : throw (::com::sun::star::uno::RuntimeException)
210 : {
211 : // do nothing, only internal class
212 0 : }
213 :
214 0 : void SAL_CALL LayoutManagerListener::removeEventListener(
215 : const css::uno::Reference< css::lang::XEventListener >& )
216 : throw (::com::sun::star::uno::RuntimeException)
217 : {
218 : // do nothing, only internal class
219 0 : }
220 :
221 63 : void SAL_CALL LayoutManagerListener::dispose()
222 : throw( css::uno::RuntimeException )
223 : {
224 63 : SolarMutexGuard aGuard;
225 :
226 : // reset member
227 63 : m_pWrkWin = 0;
228 :
229 63 : css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame.get(), css::uno::UNO_QUERY );
230 63 : if ( xFrame.is() )
231 : {
232 63 : m_xFrame = css::uno::Reference< css::frame::XFrame >();
233 63 : m_bHasFrame = sal_False;
234 :
235 63 : css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, css::uno::UNO_QUERY );
236 63 : css::uno::Reference< css::frame::XLayoutManagerEventBroadcaster > xLayoutManager;
237 63 : if ( xPropSet.is() )
238 : {
239 : try
240 : {
241 63 : css::uno::Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
242 63 : aValue >>= xLayoutManager;
243 :
244 : // remove as listener from layout manager
245 63 : if ( xLayoutManager.is() )
246 63 : xLayoutManager->removeLayoutManagerEventListener(
247 : css::uno::Reference< css::frame::XLayoutManagerListener >(
248 63 : static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY ));
249 : }
250 0 : catch ( css::lang::DisposedException& )
251 : {
252 : }
253 0 : catch ( const css::uno::RuntimeException& )
254 : {
255 0 : throw;
256 : }
257 0 : catch ( css::uno::Exception& )
258 : {
259 : }
260 63 : }
261 63 : }
262 63 : }
263 :
264 : //---------------------------------------------------------------------------------------------------------
265 : // XEventListener
266 : //---------------------------------------------------------------------------------------------------------
267 0 : void SAL_CALL LayoutManagerListener::disposing(
268 : const css::lang::EventObject& )
269 : throw( css::uno::RuntimeException )
270 : {
271 0 : SolarMutexGuard aGuard;
272 0 : m_pWrkWin = 0;
273 0 : m_bHasFrame = sal_False;
274 0 : m_xFrame = css::uno::Reference< css::frame::XFrame >();
275 0 : }
276 :
277 : //---------------------------------------------------------------------------------------------------------
278 : // XLayoutManagerEventListener
279 : //---------------------------------------------------------------------------------------------------------
280 5983 : void SAL_CALL LayoutManagerListener::layoutEvent(
281 : const css::lang::EventObject&,
282 : ::sal_Int16 eLayoutEvent,
283 : const css::uno::Any& )
284 : throw (css::uno::RuntimeException)
285 : {
286 5983 : SolarMutexGuard aGuard;
287 5983 : if ( m_pWrkWin )
288 : {
289 5983 : if ( eLayoutEvent == css::frame::LayoutManagerEvents::VISIBLE )
290 : {
291 94 : m_pWrkWin->MakeVisible_Impl( sal_True );
292 94 : m_pWrkWin->ShowChildren_Impl();
293 94 : m_pWrkWin->ArrangeChildren_Impl( sal_True );
294 : }
295 5889 : else if ( eLayoutEvent == css::frame::LayoutManagerEvents::INVISIBLE )
296 : {
297 0 : m_pWrkWin->MakeVisible_Impl( sal_False );
298 0 : m_pWrkWin->HideChildren_Impl();
299 0 : m_pWrkWin->ArrangeChildren_Impl( sal_True );
300 : }
301 5889 : else if ( eLayoutEvent == css::frame::LayoutManagerEvents::LOCK )
302 : {
303 1188 : m_pWrkWin->Lock_Impl( sal_True );
304 : }
305 4701 : else if ( eLayoutEvent == css::frame::LayoutManagerEvents::UNLOCK )
306 : {
307 1188 : m_pWrkWin->Lock_Impl( sal_False );
308 : }
309 5983 : }
310 5983 : }
311 :
312 : namespace
313 : {
314 8 : class FilledToolBarResIdToResourceURLMap
315 : {
316 : private:
317 : typedef boost::unordered_map< sal_Int32, rtl::OUString > ToolBarResIdToResourceURLMap;
318 : ToolBarResIdToResourceURLMap m_aResIdToResourceURLMap;
319 : public:
320 8 : FilledToolBarResIdToResourceURLMap()
321 8 : {
322 8 : sal_Int32 nIndex( 0 );
323 496 : while ( pToolBarResToName[nIndex].nId != 0 )
324 : {
325 480 : rtl::OUString aResourceURL( rtl::OUString::createFromAscii( pToolBarResToName[nIndex].pName ));
326 : m_aResIdToResourceURLMap.insert( ToolBarResIdToResourceURLMap::value_type(
327 480 : sal_Int32( pToolBarResToName[nIndex].nId ), aResourceURL ));
328 480 : ++nIndex;
329 480 : }
330 8 : }
331 :
332 3253 : rtl::OUString findURL(sal_uInt16 nResId) const
333 : {
334 3253 : ToolBarResIdToResourceURLMap::const_iterator aIter = m_aResIdToResourceURLMap.find( nResId );
335 3253 : if ( aIter != m_aResIdToResourceURLMap.end() )
336 3253 : return aIter->second;
337 0 : return rtl::OUString();
338 : }
339 : };
340 :
341 : class theFilledToolBarResIdToResourceURLMap
342 : : public rtl::Static<FilledToolBarResIdToResourceURLMap,
343 : theFilledToolBarResIdToResourceURLMap>
344 : {
345 : };
346 : }
347 :
348 3253 : static rtl::OUString GetResourceURLFromResId( sal_uInt16 nResId )
349 : {
350 3253 : return theFilledToolBarResIdToResourceURLMap::get().findURL(nResId);
351 : }
352 :
353 0 : sal_Bool IsAppWorkWinToolbox_Impl( sal_uInt16 nPos )
354 : {
355 0 : switch ( nPos )
356 : {
357 : case SFX_OBJECTBAR_APPLICATION :
358 : case SFX_OBJECTBAR_MACRO:
359 : case SFX_OBJECTBAR_FULLSCREEN:
360 0 : return sal_True;
361 : default:
362 0 : return sal_False;
363 : }
364 : }
365 :
366 236 : sal_uInt16 TbxMatch( sal_uInt16 nPos )
367 : {
368 236 : switch ( nPos )
369 : {
370 : case SFX_OBJECTBAR_APPLICATION :
371 0 : return 0;
372 : case SFX_OBJECTBAR_OPTIONS:
373 0 : return 1;
374 : case SFX_OBJECTBAR_MACRO:
375 0 : return 2;
376 : case SFX_OBJECTBAR_OBJECT:
377 236 : return 3;
378 : case SFX_OBJECTBAR_TOOLS:
379 0 : return 4;
380 : case SFX_OBJECTBAR_FULLSCREEN:
381 : case SFX_OBJECTBAR_COMMONTASK:
382 : case SFX_OBJECTBAR_RECORDING:
383 0 : return nPos+1;
384 : default:
385 0 : return nPos;
386 : }
387 : }
388 :
389 0 : sal_uInt16 ChildAlignValue(SfxChildAlignment eAlign)
390 : {
391 0 : sal_uInt16 ret = 17;
392 :
393 0 : switch (eAlign)
394 : {
395 : case SFX_ALIGN_HIGHESTTOP:
396 0 : ret = 1;
397 0 : break;
398 : case SFX_ALIGN_LOWESTBOTTOM:
399 0 : ret = 2;
400 0 : break;
401 : case SFX_ALIGN_FIRSTLEFT:
402 0 : ret = 3;
403 0 : break;
404 : case SFX_ALIGN_LASTRIGHT:
405 0 : ret = 4;
406 0 : break;
407 : case SFX_ALIGN_LEFT:
408 0 : ret = 5;
409 0 : break;
410 : case SFX_ALIGN_RIGHT:
411 0 : ret = 6;
412 0 : break;
413 : case SFX_ALIGN_FIRSTRIGHT:
414 0 : ret = 7;
415 0 : break;
416 : case SFX_ALIGN_LASTLEFT:
417 0 : ret = 8;
418 0 : break;
419 : case SFX_ALIGN_TOP:
420 0 : ret = 9;
421 0 : break;
422 : case SFX_ALIGN_BOTTOM:
423 0 : ret = 10;
424 0 : break;
425 : case SFX_ALIGN_TOOLBOXTOP:
426 0 : ret = 11;
427 0 : break;
428 : case SFX_ALIGN_TOOLBOXBOTTOM:
429 0 : ret = 12;
430 0 : break;
431 : case SFX_ALIGN_LOWESTTOP:
432 0 : ret = 13;
433 0 : break;
434 : case SFX_ALIGN_HIGHESTBOTTOM:
435 0 : ret = 14;
436 0 : break;
437 : case SFX_ALIGN_TOOLBOXLEFT:
438 0 : ret = 15;
439 0 : break;
440 : case SFX_ALIGN_TOOLBOXRIGHT:
441 0 : ret = 16;
442 0 : break;
443 : case SFX_ALIGN_NOALIGNMENT:
444 0 : break; // -Wall not handled...
445 : }
446 :
447 0 : return ret;
448 : }
449 :
450 0 : sal_uInt16 ChildTravelValue( SfxChildAlignment eAlign )
451 : {
452 0 : sal_uInt16 ret = 17;
453 :
454 0 : switch (eAlign)
455 : {
456 : case SFX_ALIGN_FIRSTLEFT:
457 0 : ret = 1;
458 0 : break;
459 : case SFX_ALIGN_LEFT:
460 0 : ret = 2;
461 0 : break;
462 : case SFX_ALIGN_LASTLEFT:
463 0 : ret = 3;
464 0 : break;
465 : case SFX_ALIGN_TOOLBOXLEFT:
466 0 : ret = 4;
467 0 : break;
468 : case SFX_ALIGN_HIGHESTTOP:
469 0 : ret = 5;
470 0 : break;
471 : case SFX_ALIGN_TOP:
472 0 : ret = 6;
473 0 : break;
474 : case SFX_ALIGN_TOOLBOXTOP:
475 0 : ret = 7;
476 0 : break;
477 : case SFX_ALIGN_LOWESTTOP:
478 0 : ret = 8;
479 0 : break;
480 : case SFX_ALIGN_HIGHESTBOTTOM:
481 0 : ret = 9;
482 0 : break;
483 : case SFX_ALIGN_TOOLBOXBOTTOM:
484 0 : ret = 10;
485 0 : break;
486 : case SFX_ALIGN_BOTTOM:
487 0 : ret = 11;
488 0 : break;
489 : case SFX_ALIGN_LOWESTBOTTOM:
490 0 : ret = 12;
491 0 : break;
492 : case SFX_ALIGN_TOOLBOXRIGHT:
493 0 : ret = 13;
494 0 : break;
495 : case SFX_ALIGN_FIRSTRIGHT:
496 0 : ret = 14;
497 0 : break;
498 : case SFX_ALIGN_RIGHT:
499 0 : ret = 15;
500 0 : break;
501 : case SFX_ALIGN_LASTRIGHT:
502 0 : ret = 16;
503 0 : break;
504 : case SFX_ALIGN_NOALIGNMENT:
505 0 : break; // -Wall not handled.
506 : }
507 :
508 0 : return ret;
509 : }
510 :
511 186 : void SfxWorkWindow::Sort_Impl()
512 : {
513 186 : aSortedList.clear();
514 2790 : for (sal_uInt16 i=0; i<pChildren->Count(); i++)
515 : {
516 2604 : SfxChild_Impl *pCli = (*pChildren)[i];
517 2604 : if (pCli)
518 : {
519 : sal_uInt16 k;
520 186 : for (k=0; k<aSortedList.size(); k++)
521 0 : if (ChildAlignValue((*pChildren)[aSortedList[k]]->eAlign) >
522 0 : ChildAlignValue(pCli->eAlign))
523 0 : break;
524 186 : aSortedList.insert( aSortedList.begin() + k, i );
525 : }
526 : }
527 :
528 186 : bSorted = sal_True;
529 186 : }
530 :
531 :
532 : //====================================================================
533 : // constructor for workwin of a Frame
534 :
535 240 : SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( Window *pWin, SfxFrame *pFrm, SfxFrame* pMaster )
536 : : SfxWorkWindow(
537 : pWin,
538 240 : pFrm->GetCurrentViewFrame()->GetBindings(),
539 240 : pFrm->GetParentFrame() ? pFrm->GetParentFrame()->GetWorkWindow_Impl() : NULL )
540 : , pMasterFrame( pMaster )
541 480 : , pFrame( pFrm )
542 : {
543 240 : pConfigShell = pFrm->GetCurrentViewFrame();
544 240 : if ( pConfigShell && pConfigShell->GetObjectShell() )
545 : {
546 240 : bShowStatusBar = ( !pConfigShell->GetObjectShell()->IsInPlaceActive() );
547 240 : bDockingAllowed = sal_True;
548 240 : bInternalDockingAllowed = sal_True;
549 : }
550 :
551 : // The required split windows (one for each side) can be created
552 1200 : for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
553 : {
554 : // The SplitWindows excludes direct ChildWindows of the WorkWindows
555 : // and receives the docked window.
556 :
557 : SfxChildAlignment eAlign =
558 : ( n == SFX_SPLITWINDOWS_LEFT ? SFX_ALIGN_LEFT :
559 : n == SFX_SPLITWINDOWS_RIGHT ? SFX_ALIGN_RIGHT :
560 : n == SFX_SPLITWINDOWS_TOP ? SFX_ALIGN_TOP :
561 960 : SFX_ALIGN_BOTTOM );
562 960 : SfxSplitWindow *pSplitWin = new SfxSplitWindow(pWorkWin, eAlign, this, pParent==0 );
563 960 : pSplit[n] = pSplitWin;
564 : }
565 :
566 240 : nOrigMode = SFX_VISIBILITY_STANDARD;
567 240 : nUpdateMode = SFX_VISIBILITY_STANDARD;
568 240 : }
569 :
570 : //====================================================================
571 : // Constructor of the base class
572 :
573 240 : SfxWorkWindow::SfxWorkWindow( Window *pWin, SfxBindings& rB, SfxWorkWindow* pParentWorkwin ) :
574 : pParent( pParentWorkwin ),
575 : pBindings(&rB),
576 : pWorkWin (pWin),
577 : pConfigShell( 0 ),
578 : pActiveChild( 0 ),
579 : nChildren( 0 ),
580 : nOrigMode( 0 ),
581 : bSorted( sal_True ),
582 : bDockingAllowed(sal_True),
583 : bInternalDockingAllowed(sal_True),
584 : bAllChildrenVisible(sal_True),
585 : bIsFullScreen( sal_False ),
586 : bShowStatusBar( sal_True ),
587 : m_nLock( 0 ),
588 : m_aStatusBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )),
589 : m_aLayoutManagerPropName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )),
590 : m_aTbxTypeName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" )),
591 240 : m_aProgressBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/progressbar/progressbar" ))
592 : {
593 : DBG_CTOR(SfxWorkWindow, 0);
594 : DBG_ASSERT (pBindings, "No Bindings!");
595 :
596 240 : pBindings->SetWorkWindow_Impl( this );
597 :
598 240 : pChildWins = new SfxChildWindows_Impl;
599 240 : pChildren = new SfxChildList_Impl;
600 :
601 : // For the ObjectBars a integral place in the Childlist is reserved,
602 : // so that they always come in a defined order.
603 240 : SfxChild_Impl* pChild=0;
604 3360 : for (sal_uInt16 n=0; n < SFX_OBJECTBAR_MAX; ++n)
605 3120 : pChildren->Insert(0,pChild);
606 :
607 : // create and initialize layout manager listener
608 240 : Reference< com::sun::star::frame::XFrame > xFrame = GetFrameInterface();
609 240 : LayoutManagerListener* pLayoutManagerListener = new LayoutManagerListener( this );
610 : m_xLayoutManagerListener = css::uno::Reference< css::lang::XComponent >(
611 240 : static_cast< cppu::OWeakObject* >( pLayoutManagerListener ),
612 240 : css::uno::UNO_QUERY );
613 240 : pLayoutManagerListener->setFrame( xFrame );
614 240 : }
615 :
616 : //====================================================================
617 : // Destructor
618 :
619 126 : SfxWorkWindow::~SfxWorkWindow()
620 : {
621 : DBG_DTOR(SfxWorkWindow, 0);
622 :
623 : // Delete SplitWindows
624 315 : for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
625 : {
626 252 : SfxSplitWindow *p = pSplit[n];
627 252 : if (p->GetWindowCount())
628 0 : ReleaseChild_Impl(*p);
629 252 : delete p;
630 : }
631 :
632 : // Delete help structure for Child-Windows
633 : DBG_ASSERT( pChildren->Count() == 0, "dangling children" );
634 63 : delete pChildren;
635 63 : delete pChildWins;
636 :
637 63 : if ( m_xLayoutManagerListener.is() )
638 63 : m_xLayoutManagerListener->dispose();
639 63 : }
640 :
641 2376 : void SfxWorkWindow::Lock_Impl( sal_Bool bLock )
642 : {
643 2376 : if ( bLock )
644 1188 : m_nLock++;
645 : else
646 1188 : --m_nLock;
647 2376 : if ( m_nLock<0 )
648 : {
649 : OSL_FAIL("Lock count underflow!");
650 0 : m_nLock = 0;
651 : }
652 :
653 2376 : if ( !m_nLock )
654 594 : ArrangeChildren_Impl();
655 2376 : }
656 :
657 : //--------------------------------------------------------------------
658 : // Helper method to release the child lists. Should the destructor not be
659 : // called after this, instead work continues, then space for the object bars
660 : // and split windows has to be reserved in the same way as in the constructor
661 : // of SfxWorkWindow.
662 :
663 63 : void SfxWorkWindow::DeleteControllers_Impl()
664 : {
665 : DBG_CHKTHIS(SfxWorkWindow, 0);
666 :
667 : // Lock SplitWindows (which means supressing the Resize-Reaction of the
668 : // DockingWindows)
669 : sal_uInt16 n;
670 315 : for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
671 : {
672 252 : SfxSplitWindow *p = pSplit[n];
673 252 : if (p->GetWindowCount())
674 0 : p->Lock();
675 : }
676 :
677 : // Delete Child-Windows
678 2203 : for ( n=0; n<pChildWins->Count(); )
679 : {
680 2077 : SfxChildWin_Impl* pCW = (*pChildWins)[n];
681 2077 : pChildWins->Remove(n);
682 2077 : SfxChildWindow *pChild = pCW->pWin;
683 2077 : if (pChild)
684 : {
685 63 : pChild->Hide();
686 :
687 : // If the child window is a direct child window and not in a
688 : // SplitWindow, cancel it at the workwindow.
689 : // After TH a cancellation on the SplitWindow is not necessary
690 : // since this window is also destroyed (see below).
691 63 : if (pCW->pCli)
692 63 : ReleaseChild_Impl(*pChild->GetWindow());
693 63 : pCW->pWin = 0;
694 63 : pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChild->GetWindow() );
695 63 : pChild->Destroy();
696 : }
697 :
698 2077 : delete pCW;
699 :
700 : // ATTENTION: The array itself is cleared after this loop!!
701 : // Therefore we have to set every array entry to zero as it could be
702 : // accessed by calling pChild->Destroy().
703 : // Window::NotifyAllChildren() calls SfxWorkWindow::DataChanged_Impl for
704 : // 8-bit displays (WM_QUERYPALETTECHANGED message due to focus change)!!
705 : }
706 :
707 63 : Reference< com::sun::star::frame::XFrame > xFrame = GetFrameInterface();
708 63 : Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
709 63 : Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
710 63 : if ( xPropSet.is() )
711 : {
712 : try
713 : {
714 0 : Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
715 0 : aValue >>= xLayoutManager;
716 : }
717 0 : catch ( Exception& )
718 : {
719 : }
720 : }
721 :
722 63 : if ( xLayoutManager.is() )
723 : {
724 0 : xLayoutManager->reset();
725 :
726 : // Delete StatusBar
727 0 : ResetStatusBar_Impl();
728 :
729 : // Delete ObjectBars (this is done last, so that pChildren does not
730 : // receive dead Pointers)
731 0 : for ( sal_uInt16 i = 0; i < aObjBarList.size(); i++ )
732 : {
733 : // Not every position must be occupied
734 0 : sal_uInt16 nId = aObjBarList[i].nId;
735 0 : if ( nId )
736 0 : aObjBarList[i].nId = 0;
737 : }
738 : }
739 :
740 : // ObjectBars are all released at once, since they occupy a
741 : // fixed contiguous area in the array pChild
742 63 : pChildren->Remove(0, SFX_OBJECTBAR_MAX);
743 63 : bSorted = sal_False;
744 :
745 63 : nChildren = 0;
746 63 : }
747 :
748 : //====================================================================
749 : // Virtual method for placing the child window.
750 :
751 0 : void SfxWorkWindow::ArrangeChildren_Impl( sal_Bool /*bForce*/)
752 : {
753 0 : Arrange_Impl();
754 0 : }
755 :
756 1937 : void SfxFrameWorkWin_Impl::ArrangeChildren_Impl( sal_Bool bForce )
757 : {
758 1937 : if ( pFrame->IsClosing_Impl() || ( m_nLock && !bForce ))
759 : return;
760 :
761 1343 : SfxInPlaceClient *pClient = 0;
762 1343 : SfxViewFrame *pF = pFrame->GetCurrentViewFrame();
763 1343 : if ( pF && pF->GetViewShell() )
764 1343 : pClient = pF->GetViewShell()->GetIPClient();
765 :
766 1343 : if ( pClient )
767 : return;
768 :
769 1343 : aClientArea = GetTopRect_Impl();
770 1343 : if ( aClientArea.IsEmpty() )
771 : return;
772 :
773 967 : SvBorder aBorder;
774 967 : if ( nChildren )
775 : {
776 825 : if ( IsVisible_Impl() )
777 825 : aBorder = Arrange_Impl();
778 : }
779 : // If the current application document contains a IPClient, then the
780 : // object through SetTopToolFramePixel has to be assigned the available
781 : // space. The object will then point to its UITools and sets the app border
782 : // (-> SfxInPlaceEnv_Impl:: ArrangeChildren_Impl ()). Otherwise the
783 : // app border is set here directly to possibly overwrite the Border that
784 : // was set by an object from another document. The object does not set
785 : // the SetAppBorder when it removes its UI tools so that no-dithering
786 : // ObjectBar arises.
787 : // (->SfxInPlaceEnv_Impl::ArrangeChildren_Impl())
788 :
789 967 : pMasterFrame->SetToolSpaceBorderPixel_Impl( aBorder );
790 :
791 967 : ArrangeAutoHideWindows( NULL );
792 : }
793 :
794 : //--------------------------------------------------------------------
795 :
796 825 : SvBorder SfxWorkWindow::Arrange_Impl()
797 :
798 : /* [Description]
799 :
800 : This method organizes all visible child windows so that the docked window
801 : sorted in order from the outside to the inside are placed after one
802 : another. If a visible window does not fit anymore into the free
803 : ClientArea, it is set to "not visible".
804 : */
805 : {
806 : DBG_CHKTHIS(SfxWorkWindow, 0);
807 :
808 825 : aClientArea = GetTopRect_Impl();
809 825 : aUpperClientArea = aClientArea;
810 :
811 825 : SvBorder aBorder;
812 825 : if ( !nChildren )
813 0 : return aBorder;
814 :
815 825 : if (!bSorted)
816 186 : Sort_Impl();
817 :
818 825 : Point aPos;
819 825 : Size aSize;
820 825 : Rectangle aTmp( aClientArea );
821 :
822 1650 : for ( sal_uInt16 n=0; n<aSortedList.size(); ++n )
823 : {
824 825 : SfxChild_Impl* pCli = (*pChildren)[aSortedList[n]];
825 825 : if ( !pCli->pWin )
826 0 : continue;
827 :
828 : // First, we assume that there is room for the window.
829 825 : pCli->nVisible |= CHILD_FITS_IN;
830 :
831 : // Skip invisiable windows
832 825 : if (pCli->nVisible != CHILD_VISIBLE)
833 0 : continue;
834 :
835 825 : if ( pCli->bResize )
836 0 : aSize = pCli->aSize;
837 : else
838 825 : aSize = pCli->pWin->GetSizePixel();
839 :
840 825 : SvBorder aTemp = aBorder;
841 825 : sal_Bool bAllowHiding = sal_True;
842 825 : switch ( pCli->eAlign )
843 : {
844 : case SFX_ALIGN_HIGHESTTOP:
845 : case SFX_ALIGN_TOP:
846 : case SFX_ALIGN_TOOLBOXTOP:
847 : case SFX_ALIGN_LOWESTTOP:
848 825 : aSize.Width() = aTmp.GetWidth();
849 825 : if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
850 0 : aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
851 825 : bAllowHiding = sal_False;
852 825 : aBorder.Top() += aSize.Height();
853 825 : aPos = aTmp.TopLeft();
854 825 : aTmp.Top() += aSize.Height();
855 825 : if ( pCli->eAlign == SFX_ALIGN_HIGHESTTOP )
856 0 : aUpperClientArea.Top() += aSize.Height();
857 825 : break;
858 :
859 : case SFX_ALIGN_LOWESTBOTTOM:
860 : case SFX_ALIGN_BOTTOM:
861 : case SFX_ALIGN_TOOLBOXBOTTOM:
862 : case SFX_ALIGN_HIGHESTBOTTOM:
863 0 : aSize.Width() = aTmp.GetWidth();
864 0 : if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
865 0 : aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
866 0 : aBorder.Bottom() += aSize.Height();
867 0 : aPos = aTmp.BottomLeft();
868 0 : aPos.Y() -= (aSize.Height()-1);
869 0 : aTmp.Bottom() -= aSize.Height();
870 0 : if ( pCli->eAlign == SFX_ALIGN_LOWESTBOTTOM )
871 0 : aUpperClientArea.Bottom() -= aSize.Height();
872 0 : break;
873 :
874 : case SFX_ALIGN_FIRSTLEFT:
875 : case SFX_ALIGN_LEFT:
876 : case SFX_ALIGN_LASTLEFT:
877 : case SFX_ALIGN_TOOLBOXLEFT:
878 0 : aSize.Height() = aTmp.GetHeight();
879 0 : if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
880 0 : aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
881 0 : bAllowHiding = sal_False;
882 0 : aBorder.Left() += aSize.Width();
883 0 : aPos = aTmp.TopLeft();
884 0 : aTmp.Left() += aSize.Width();
885 0 : if ( pCli->eAlign != SFX_ALIGN_TOOLBOXLEFT )
886 0 : aUpperClientArea.Left() += aSize.Width();
887 0 : break;
888 :
889 : case SFX_ALIGN_FIRSTRIGHT:
890 : case SFX_ALIGN_RIGHT:
891 : case SFX_ALIGN_LASTRIGHT:
892 : case SFX_ALIGN_TOOLBOXRIGHT:
893 0 : aSize.Height() = aTmp.GetHeight();
894 0 : if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
895 0 : aSize = ((SplitWindow *)(pCli->pWin))->CalcLayoutSizePixel( aSize );
896 0 : aBorder.Right() += aSize.Width();
897 0 : aPos = aTmp.TopRight();
898 0 : aPos.X() -= (aSize.Width()-1);
899 0 : aTmp.Right() -= aSize.Width();
900 0 : if ( pCli->eAlign != SFX_ALIGN_TOOLBOXRIGHT )
901 0 : aUpperClientArea.Right() -= aSize.Width();
902 0 : break;
903 :
904 : default:
905 0 : pCli->aSize = pCli->pWin->GetSizePixel();
906 0 : pCli->bResize = sal_False;
907 0 : continue;
908 : }
909 :
910 825 : pCli->pWin->SetPosSizePixel( aPos, aSize );
911 825 : pCli->bResize = sal_False;
912 825 : pCli->aSize = aSize;
913 825 : if( bAllowHiding && !RequestTopToolSpacePixel_Impl( aBorder ) )
914 : {
915 0 : pCli->nVisible ^= CHILD_FITS_IN;
916 0 : aBorder = aTemp;
917 : }
918 : }
919 :
920 825 : if ( aClientArea.GetWidth() >= aBorder.Left() + aBorder.Right() )
921 : {
922 825 : aClientArea.Left() += aBorder.Left();
923 825 : aClientArea.Right() -= aBorder.Right();
924 : }
925 : else
926 : {
927 0 : aBorder.Left() = aClientArea.Left();
928 0 : aBorder.Right() = aClientArea.Right();
929 0 : aClientArea.Right() = aClientArea.Left() = aTmp.Left();
930 : }
931 :
932 825 : if ( aClientArea.GetHeight() >= aBorder.Top() + aBorder.Bottom() )
933 : {
934 825 : aClientArea.Top() += aBorder.Top();
935 825 : aClientArea.Bottom() -= aBorder.Bottom();
936 : }
937 : else
938 : {
939 0 : aBorder.Top() = aClientArea.Top();
940 0 : aBorder.Bottom() = aClientArea.Bottom();
941 0 : aClientArea.Top() = aClientArea.Bottom() = aTmp.Top();
942 : }
943 :
944 825 : return IsDockingAllowed() ? aBorder : SvBorder();
945 : }
946 :
947 0 : sal_Bool SfxWorkWindow::PrepareClose_Impl()
948 : {
949 0 : for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
950 : {
951 0 : SfxChildWin_Impl *pCW = (*pChildWins)[n];
952 0 : SfxChildWindow *pChild = pCW->pWin;
953 0 : if ( pChild && !pChild->QueryClose() )
954 0 : return sal_False;
955 : }
956 :
957 0 : return sal_True;
958 : }
959 :
960 : //--------------------------------------------------------------------
961 :
962 236 : SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( Window& rWindow,
963 : SfxChildAlignment eAlign, sal_Bool bCanGetFocus )
964 : {
965 : DBG_CHKTHIS(SfxWorkWindow, 0);
966 : DBG_ASSERT( pChildren->Count() < 255, "too many children" );
967 : DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
968 : DBG_ASSERT( !FindChild_Impl(rWindow), "child registered more than once" );
969 :
970 :
971 236 : if ( rWindow.GetParent() != pWorkWin )
972 0 : rWindow.SetParent( pWorkWin );
973 :
974 236 : SfxChild_Impl *pChild = new SfxChild_Impl(rWindow, rWindow.GetSizePixel(),
975 236 : eAlign, rWindow.IsVisible());
976 236 : pChild->bCanGetFocus = bCanGetFocus;
977 :
978 236 : pChildren->Insert(pChildren->Count(), pChild);
979 236 : bSorted = sal_False;
980 236 : nChildren++;
981 236 : return (*pChildren)[pChildren->Count()-1];
982 : }
983 :
984 : //--------------------------------------------------------------------
985 :
986 63 : void SfxWorkWindow::ReleaseChild_Impl( Window& rWindow )
987 : {
988 : DBG_CHKTHIS(SfxWorkWindow, 0);
989 :
990 63 : SfxChild_Impl *pChild = 0;
991 : sal_uInt16 nPos;
992 882 : for ( nPos = 0; nPos < pChildren->Count(); ++nPos )
993 : {
994 882 : pChild = (*pChildren)[nPos];
995 882 : if ( pChild )
996 63 : if ( pChild->pWin == &rWindow )
997 63 : break;
998 : }
999 :
1000 63 : if ( nPos < pChildren->Count() )
1001 : {
1002 63 : bSorted = sal_False;
1003 63 : nChildren--;
1004 63 : pChildren->Remove(nPos);
1005 63 : delete pChild;
1006 : }
1007 : else {
1008 : OSL_FAIL( "releasing unregistered child" );
1009 : }
1010 63 : }
1011 :
1012 : //--------------------------------------------------------------------
1013 :
1014 0 : SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const Window& rWindow ) const
1015 : {
1016 : DBG_CHKTHIS(SfxWorkWindow, 0);
1017 :
1018 0 : SfxChild_Impl *pChild = 0;
1019 0 : sal_uInt16 nCount = pChildren->Count();
1020 0 : for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
1021 : {
1022 0 : pChild = (*pChildren)[nPos];
1023 0 : if ( pChild )
1024 0 : if ( pChild->pWin == &rWindow )
1025 0 : return pChild;
1026 : }
1027 :
1028 0 : return 0;
1029 : }
1030 :
1031 : //--------------------------------------------------------------------
1032 :
1033 1939 : void SfxWorkWindow::ShowChildren_Impl()
1034 : {
1035 : DBG_CHKTHIS(SfxWorkWindow, 0);
1036 :
1037 1939 : bool bInvisible = ( !IsVisible_Impl() || ( !pWorkWin->IsReallyVisible() && !pWorkWin->IsReallyShown() ));
1038 :
1039 1939 : SfxChild_Impl *pCli = 0;
1040 28943 : for ( sal_uInt16 nPos = 0; nPos < pChildren->Count(); ++nPos )
1041 : {
1042 27004 : SfxChildWin_Impl* pCW = 0;
1043 27004 : pCli = (*pChildren)[nPos];
1044 :
1045 27004 : if ( pCli && pCli->pWin )
1046 : {
1047 : // We have to find the SfxChildWin_Impl to retrieve the
1048 : // SFX_CHILDWIN flags that can influence visibility.
1049 30549 : for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
1050 : {
1051 30549 : SfxChildWin_Impl* pCWin = (*pChildWins)[n];
1052 30549 : SfxChild_Impl* pChild = pCWin->pCli;
1053 30549 : if ( pChild == pCli )
1054 : {
1055 1797 : pCW = pCWin;
1056 1797 : break;
1057 : }
1058 : }
1059 :
1060 1797 : bool bVisible( !bInvisible );
1061 1797 : if ( pCW )
1062 : {
1063 : // Check flag SFX_CHILDWIN_NEVERHIDE that forces us to show
1064 : // the child window even in situations where no child window is
1065 : // visible.
1066 1797 : sal_uInt16 nFlags = pCW->aInfo.nFlags;
1067 1797 : bVisible = !bInvisible || (( nFlags & SFX_CHILDWIN_NEVERHIDE ) != 0 );
1068 : }
1069 :
1070 1797 : if ( CHILD_VISIBLE == (pCli->nVisible & CHILD_VISIBLE) && bVisible )
1071 : {
1072 1797 : sal_uInt16 nFlags = pCli->bSetFocus ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE;
1073 1797 : switch ( pCli->pWin->GetType() )
1074 : {
1075 : case RSC_DOCKINGWINDOW :
1076 0 : ((DockingWindow*)pCli->pWin)->Show( sal_True, nFlags );
1077 0 : break;
1078 : case RSC_SPLITWINDOW :
1079 0 : ((SplitWindow*)pCli->pWin)->Show( sal_True, nFlags );
1080 0 : break;
1081 : default:
1082 1797 : pCli->pWin->Show( sal_True, nFlags );
1083 1797 : break;
1084 : }
1085 :
1086 1797 : pCli->bSetFocus = sal_False;
1087 : }
1088 : else
1089 : {
1090 0 : switch ( pCli->pWin->GetType() )
1091 : {
1092 : case RSC_DOCKINGWINDOW :
1093 0 : ((DockingWindow*)pCli->pWin)->Hide();
1094 0 : break;
1095 : default:
1096 0 : pCli->pWin->Hide();
1097 0 : break;
1098 : }
1099 : }
1100 : }
1101 : }
1102 1939 : }
1103 :
1104 : //--------------------------------------------------------------------
1105 :
1106 0 : void SfxWorkWindow::HideChildren_Impl()
1107 : {
1108 0 : SfxChild_Impl *pChild = 0;
1109 0 : for ( sal_uInt16 nPos = pChildren->Count(); nPos > 0; --nPos )
1110 : {
1111 0 : pChild = (*pChildren)[nPos-1];
1112 0 : if (pChild && pChild->pWin)
1113 : {
1114 0 : switch ( pChild->pWin->GetType() )
1115 : {
1116 : case RSC_DOCKINGWINDOW :
1117 0 : ((DockingWindow*)pChild->pWin)->Hide();
1118 0 : break;
1119 : default:
1120 0 : pChild->pWin->Hide();
1121 0 : break;
1122 : }
1123 : }
1124 : }
1125 0 : }
1126 :
1127 : //------------------------------------------------------------------------
1128 :
1129 594 : void SfxWorkWindow::ResetObjectBars_Impl()
1130 : {
1131 : sal_uInt16 n;
1132 2174 : for ( n = 0; n < aObjBarList.size(); n++ )
1133 1580 : aObjBarList[n].bDestroy = sal_True;
1134 :
1135 10529 : for ( n = 0; n < pChildWins->Count(); ++n )
1136 9935 : (*pChildWins)[n]->nId = 0;
1137 594 : }
1138 :
1139 : //------------------------------------------------------------------------
1140 :
1141 3253 : void SfxWorkWindow::SetObjectBar_Impl( sal_uInt16 nPos, sal_uInt32 nResId,
1142 : SfxInterface* pIFace, const String *pName)
1143 : {
1144 : DBG_ASSERT( (nPos & SFX_POSITION_MASK) < SFX_OBJECTBAR_MAX,
1145 : "object bar position overflow" );
1146 :
1147 3253 : sal_uInt16 nRealPos = nPos & SFX_POSITION_MASK;
1148 3253 : if ( pParent && IsAppWorkWinToolbox_Impl( nRealPos ) )
1149 : {
1150 0 : pParent->SetObjectBar_Impl( nPos, nResId, pIFace, pName );
1151 : return;
1152 : }
1153 :
1154 3253 : SfxObjectBar_Impl aObjBar;
1155 3253 : aObjBar.pIFace = pIFace;
1156 3253 : aObjBar.nId = sal::static_int_cast<sal_uInt16>(nResId);
1157 3253 : aObjBar.nPos = nRealPos;
1158 3253 : aObjBar.nMode = (nPos & SFX_VISIBILITY_MASK);
1159 3253 : if (pName)
1160 3253 : aObjBar.aName = *pName;
1161 : else
1162 0 : aObjBar.aName.Erase();
1163 :
1164 11732 : for ( sal_uInt16 n=0; n<aObjBarList.size(); n++ )
1165 : {
1166 10059 : if ( aObjBarList[n].nId == aObjBar.nId )
1167 : {
1168 1580 : aObjBarList[n] = aObjBar;
1169 : return;
1170 : }
1171 : }
1172 :
1173 1673 : aObjBarList.push_back( aObjBar );
1174 : }
1175 :
1176 : //------------------------------------------------------------------------
1177 :
1178 0 : bool SfxWorkWindow::KnowsObjectBar_Impl( sal_uInt16 nPos ) const
1179 :
1180 : /* [Description]
1181 :
1182 : Determines if a object list is available at the position in question.
1183 : This is independent for the fact whether it is actually turned on or off.
1184 : */
1185 :
1186 : {
1187 0 : sal_uInt16 nRealPos = nPos & SFX_POSITION_MASK;
1188 0 : if ( pParent && IsAppWorkWinToolbox_Impl( nRealPos ) )
1189 0 : return pParent->KnowsObjectBar_Impl( nPos );
1190 :
1191 0 : for ( sal_uInt16 n=0; n<aObjBarList.size(); n++ )
1192 : {
1193 0 : if ( aObjBarList[n].nPos == nRealPos )
1194 0 : return true;
1195 : }
1196 :
1197 0 : return false;
1198 : }
1199 :
1200 : //------------------------------------------------------------------------
1201 :
1202 35976 : sal_Bool SfxWorkWindow::IsVisible_Impl( sal_uInt16 nMode ) const
1203 : {
1204 35976 : switch( nUpdateMode )
1205 : {
1206 : case SFX_VISIBILITY_STANDARD:
1207 35976 : return sal_True;
1208 : case SFX_VISIBILITY_UNVISIBLE:
1209 0 : return sal_False;
1210 : case SFX_VISIBILITY_PLUGSERVER:
1211 : case SFX_VISIBILITY_PLUGCLIENT:
1212 : case SFX_VISIBILITY_CLIENT:
1213 : case SFX_VISIBILITY_SERVER:
1214 0 : return !!(nMode & nUpdateMode);
1215 : default:
1216 0 : return !!(nMode & nOrigMode ) ||
1217 0 : nOrigMode == SFX_VISIBILITY_STANDARD;
1218 : }
1219 : }
1220 :
1221 594 : void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl()
1222 : {
1223 594 : if ( pFrame->IsClosing_Impl() )
1224 594 : return;
1225 :
1226 594 : SfxWorkWindow *pWork = pParent;
1227 1188 : while ( pWork )
1228 : {
1229 0 : pWork->SfxWorkWindow::UpdateObjectBars_Impl();
1230 0 : pWork = pWork->GetParent_Impl();
1231 : }
1232 :
1233 594 : SfxWorkWindow::UpdateObjectBars_Impl();
1234 :
1235 : {
1236 594 : pWork = pParent;
1237 1188 : while ( pWork )
1238 : {
1239 0 : pWork->ArrangeChildren_Impl();
1240 0 : pWork = pWork->GetParent_Impl();
1241 : }
1242 :
1243 594 : ArrangeChildren_Impl( sal_False );
1244 :
1245 594 : pWork = pParent;
1246 1188 : while ( pWork )
1247 : {
1248 0 : pWork->ShowChildren_Impl();
1249 0 : pWork = pWork->GetParent_Impl();
1250 : }
1251 :
1252 594 : ShowChildren_Impl();
1253 : }
1254 :
1255 594 : ShowChildren_Impl();
1256 : }
1257 :
1258 2 : Reference< ::com::sun::star::task::XStatusIndicator > SfxWorkWindow::GetStatusIndicator()
1259 : {
1260 2 : Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
1261 2 : Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1262 2 : Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
1263 :
1264 2 : if ( xPropSet.is() )
1265 : {
1266 2 : Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
1267 2 : aValue >>= xLayoutManager;
1268 2 : if ( xLayoutManager.is() )
1269 : {
1270 2 : xLayoutManager->createElement( m_aProgressBarResName );
1271 2 : xLayoutManager->showElement( m_aProgressBarResName );
1272 :
1273 : Reference< ::com::sun::star::ui::XUIElement > xProgressBar =
1274 2 : xLayoutManager->getElement( m_aProgressBarResName );
1275 2 : if ( xProgressBar.is() )
1276 : {
1277 : xStatusIndicator = Reference< ::com::sun::star::task::XStatusIndicator >(
1278 2 : xProgressBar->getRealInterface(), UNO_QUERY );
1279 2 : }
1280 2 : }
1281 : }
1282 :
1283 2 : return xStatusIndicator;
1284 : }
1285 :
1286 : //------------------------------------------------------------------------
1287 :
1288 594 : sal_Bool SfxWorkWindow::IsPluginMode( SfxObjectShell* pObjShell )
1289 : {
1290 594 : if ( pObjShell && pObjShell->GetMedium() )
1291 : {
1292 594 : SFX_ITEMSET_ARG( pObjShell->GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, sal_False );
1293 594 : if ( pViewOnlyItem && pViewOnlyItem->GetValue() )
1294 0 : return sal_True;
1295 : }
1296 :
1297 594 : return sal_False;
1298 : }
1299 :
1300 : //------------------------------------------------------------------------
1301 :
1302 1493 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxWorkWindow::GetFrameInterface()
1303 : {
1304 1493 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
1305 :
1306 1493 : SfxDispatcher* pDispatcher( GetBindings().GetDispatcher() );
1307 1493 : if ( pDispatcher )
1308 : {
1309 1493 : SfxViewFrame* pFrame = pDispatcher->GetFrame();
1310 1493 : if ( pFrame )
1311 1493 : xFrame = pFrame->GetFrame().GetFrameInterface();
1312 : }
1313 :
1314 1493 : return xFrame;
1315 : }
1316 :
1317 : //------------------------------------------------------------------------
1318 :
1319 594 : void SfxWorkWindow::UpdateObjectBars_Impl()
1320 : {
1321 : // Lock SplitWindows (which means supressing the Resize-Reaction of the
1322 : // DockingWindows)
1323 : sal_uInt16 n;
1324 2970 : for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
1325 : {
1326 2376 : SfxSplitWindow *p = pSplit[n];
1327 2376 : if (p->GetWindowCount())
1328 0 : p->Lock();
1329 : }
1330 :
1331 : // you realize what is needed often (saves Code and execution time)
1332 594 : SFX_APP();
1333 :
1334 594 : Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
1335 594 : Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1336 :
1337 594 : if ( xPropSet.is() )
1338 : {
1339 594 : Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
1340 594 : aValue >>= xLayoutManager;
1341 : }
1342 :
1343 594 : if ( !xLayoutManager.is() )
1344 594 : return;
1345 :
1346 594 : sal_Bool bPluginMode( sal_False );
1347 594 : SfxDispatcher* pDispatcher( GetBindings().GetDispatcher() );
1348 :
1349 594 : if ( pDispatcher )
1350 : {
1351 594 : SfxViewFrame* pFrame = pDispatcher->GetFrame();
1352 594 : if ( pFrame )
1353 594 : bPluginMode = IsPluginMode( pFrame->GetObjectShell() );
1354 : }
1355 :
1356 : // Iterate over all Toolboxes
1357 594 : xLayoutManager->lock();
1358 3847 : for ( n = 0; n < aObjBarList.size(); ++n )
1359 : {
1360 3253 : sal_uInt16 nId = aObjBarList[n].nId;
1361 3253 : sal_Bool bDestroy = aObjBarList[n].bDestroy;
1362 :
1363 : // Determine the vaild mode for the ToolBox
1364 3253 : sal_uInt16 nTbxMode = aObjBarList[n].nMode;
1365 : bool bFullScreenTbx = SFX_VISIBILITY_FULLSCREEN ==
1366 3253 : ( nTbxMode & SFX_VISIBILITY_FULLSCREEN );
1367 3253 : nTbxMode &= ~SFX_VISIBILITY_FULLSCREEN;
1368 3253 : nTbxMode &= ~SFX_VISIBILITY_VIEWER;
1369 :
1370 : // Is a ToolBox required in this context ?
1371 3253 : bool bModesMatching = ( nUpdateMode && ( nTbxMode & nUpdateMode) == nUpdateMode );
1372 3253 : if ( bDestroy )
1373 : {
1374 0 : rtl::OUString aTbxId( m_aTbxTypeName );
1375 0 : aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
1376 0 : xLayoutManager->destroyElement( aTbxId );
1377 : }
1378 3253 : else if ( nId != 0 && ( ( bModesMatching && !bIsFullScreen ) ||
1379 : ( bIsFullScreen && bFullScreenTbx ) ) )
1380 : {
1381 2659 : rtl::OUString aTbxId( m_aTbxTypeName );
1382 2659 : aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
1383 2659 : if ( !IsDockingAllowed() && !xLayoutManager->isElementFloating( aTbxId ))
1384 0 : xLayoutManager->destroyElement( aTbxId );
1385 : else
1386 : {
1387 2659 : xLayoutManager->requestElement( aTbxId );
1388 2659 : if ( bPluginMode )
1389 0 : xLayoutManager->lockWindow( aTbxId );
1390 2659 : }
1391 : }
1392 594 : else if ( nId != 0 )
1393 : {
1394 : // Delete the Toolbox at this Position if possible
1395 594 : rtl::OUString aTbxId( m_aTbxTypeName );
1396 594 : aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
1397 594 : xLayoutManager->destroyElement( aTbxId );
1398 : }
1399 : }
1400 :
1401 594 : UpdateStatusBar_Impl();
1402 :
1403 : // unlocking automatically forces Layout
1404 594 : xLayoutManager->unlock();
1405 :
1406 594 : UpdateChildWindows_Impl();
1407 :
1408 : // Unlock the SplitWindows again
1409 2970 : for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
1410 : {
1411 2376 : SfxSplitWindow *p = pSplit[n];
1412 2376 : if (p->GetWindowCount())
1413 0 : p->Lock(sal_False);
1414 594 : }
1415 : }
1416 :
1417 594 : bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const
1418 : {
1419 : // or checking the availability of child windows, we need access to the module
1420 594 : const SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame();
1421 594 : const SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
1422 594 : const SfxModule* pModule = pShell ? pShell->GetModule() : NULL;
1423 594 : ENSURE_OR_RETURN( pModule, "SfxWorkWindow::UpdateChildWindows_Impl: did not find an SfxModule to ask for the child win availability!", true );
1424 594 : return pModule->IsChildWindowAvailable( i_rCW.nId, pViewFrame );
1425 : }
1426 :
1427 594 : void SfxWorkWindow::UpdateChildWindows_Impl()
1428 : {
1429 : // any current or in the context available Childwindows
1430 18308 : for ( sal_uInt16 n=0; n<pChildWins->Count(); n++ )
1431 : {
1432 17714 : SfxChildWin_Impl *pCW = (*pChildWins)[n];
1433 17714 : SfxChildWindow *pChildWin = pCW->pWin;
1434 17714 : sal_Bool bCreate = sal_False;
1435 17714 : if ( pCW->nId && !pCW->bDisabled && (pCW->aInfo.nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE || IsVisible_Impl( pCW->nVisibility ) ) )
1436 : {
1437 : // In the context is an appropriate ChildWindow allowed;
1438 : // it is also turned on?
1439 17714 : if ( pChildWin == NULL && pCW->bCreate )
1440 : {
1441 : // Internal docking is only used for embedding into another
1442 : // container. We force the floating state of all floatable
1443 : // child windows.
1444 236 : if ( !bInternalDockingAllowed )
1445 : {
1446 : // Special case for all non-floatable child windows. We have
1447 : // to prevent the creation here!
1448 0 : bCreate = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK );
1449 : }
1450 236 : else if ( !IsDockingAllowed() || bIsFullScreen ) // || !bInternalDocking )
1451 : {
1452 : // In Presentation mode or FullScreen only FloatingWindows
1453 : SfxChildAlignment eAlign;
1454 0 : if ( pCW->aInfo.GetExtraData_Impl( &eAlign ) )
1455 0 : bCreate = ( eAlign == SFX_ALIGN_NOALIGNMENT );
1456 : }
1457 : else
1458 236 : bCreate = sal_True;
1459 :
1460 236 : if ( bCreate )
1461 236 : bCreate = AllowChildWindowCreation_Impl( *pCW );
1462 :
1463 : // Currently, no window here, but it is enabled; windows
1464 : // Create window and if possible theContext
1465 236 : if ( bCreate )
1466 236 : CreateChildWin_Impl( pCW, sal_False );
1467 :
1468 236 : if ( !bAllChildrenVisible )
1469 : {
1470 0 : if ( pCW->pCli )
1471 0 : pCW->pCli->nVisible &= ~CHILD_ACTIVE;
1472 236 : }
1473 : }
1474 17478 : else if ( pChildWin )
1475 : {
1476 : // Window already exists, it should also be visible?
1477 358 : if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT ) && bAllChildrenVisible )
1478 : {
1479 : // Update Mode is compatible; definitely enable it
1480 358 : bCreate = AllowChildWindowCreation_Impl( *pCW );
1481 358 : if ( bCreate )
1482 : {
1483 358 : if ( pCW->pCli )
1484 : {
1485 : // The window is a direct Child
1486 358 : if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) )
1487 358 : pCW->pCli->nVisible |= CHILD_NOT_HIDDEN;
1488 : }
1489 : else
1490 : {
1491 0 : if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed )
1492 : // The window ia within a SplitWindow
1493 0 : ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl();
1494 : }
1495 :
1496 358 : if ( pCW->nInterfaceId != pChildWin->GetContextId() )
1497 0 : pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
1498 : }
1499 : }
1500 : }
1501 : }
1502 :
1503 17714 : if ( pChildWin && !bCreate )
1504 : {
1505 0 : if ( !pChildWin->QueryClose() || pChildWin->IsHideNotDelete() || Application::IsUICaptured() )
1506 : {
1507 0 : if ( pCW->pCli )
1508 : {
1509 0 : if ( pCW->pCli->nVisible & CHILD_NOT_HIDDEN )
1510 0 : pCW->pCli->nVisible ^= CHILD_NOT_HIDDEN;
1511 : }
1512 : else
1513 0 : ((SfxDockingWindow*)pChildWin->GetWindow())->Disappear_Impl();
1514 : }
1515 : else
1516 0 : RemoveChildWin_Impl( pCW );
1517 : }
1518 : }
1519 594 : }
1520 :
1521 236 : void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, sal_Bool bSetFocus )
1522 : {
1523 236 : if ( pCW->aInfo.bVisible != 42 )
1524 236 : pCW->aInfo.bVisible = sal_True;
1525 :
1526 236 : SfxChildWindow *pChildWin = SfxChildWindow::CreateChildWindow( pCW->nId, pWorkWin, &GetBindings(), pCW->aInfo);
1527 236 : if (pChildWin)
1528 : {
1529 236 : if ( bSetFocus )
1530 0 : bSetFocus = pChildWin->WantsFocus();
1531 236 : pChildWin->SetWorkWindow_Impl( this );
1532 :
1533 : // At least the extra string is changed during the evaluation,
1534 : // also get it anewed
1535 236 : SfxChildWinInfo aInfo = pChildWin->GetInfo();
1536 236 : pCW->aInfo.aExtraString = aInfo.aExtraString;
1537 236 : pCW->aInfo.bVisible = aInfo.bVisible;
1538 236 : pCW->aInfo.nFlags |= aInfo.nFlags;
1539 :
1540 : // The creation was successful
1541 236 : GetBindings().Invalidate(pCW->nId);
1542 :
1543 236 : sal_uInt16 nPos = pChildWin->GetPosition();
1544 236 : if (nPos != CHILDWIN_NOPOS)
1545 : {
1546 : DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!");
1547 236 : if ((*pChildren)[TbxMatch(nPos)])// &&
1548 : {
1549 : // ChildWindow replaces ObjectBar
1550 0 : (*pChildren)[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN;
1551 : }
1552 : }
1553 :
1554 : // make childwin keyboard accessible
1555 236 : pWorkWin->GetSystemWindow()->GetTaskPaneList()->AddWindow( pChildWin->GetWindow() );
1556 :
1557 236 : pCW->pWin = pChildWin;
1558 :
1559 236 : if ( pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT || pChildWin->GetWindow()->GetParent() == pWorkWin)
1560 : {
1561 : // The window is not docked or docked outside of one split windows
1562 : // and must therefore be registered explicitly as a Child
1563 236 : pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment(), pChildWin->CanGetFocus());
1564 236 : pCW->pCli->nVisible = CHILD_VISIBLE;
1565 236 : if ( pChildWin->GetAlignment() != SFX_ALIGN_NOALIGNMENT && bIsFullScreen )
1566 0 : pCW->pCli->nVisible ^= CHILD_ACTIVE;
1567 236 : pCW->pCli->bSetFocus = bSetFocus;
1568 : }
1569 : else
1570 : {
1571 : // A docked window which parent is not a WorkingWindow, must lie
1572 : // in a SplitWindow and thus not be explicitly registered.
1573 : // This happens already in the initialization of SfxDockingWindows!
1574 : }
1575 :
1576 236 : if ( pCW->nInterfaceId != pChildWin->GetContextId() )
1577 0 : pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() );
1578 :
1579 : // Save the information in the INI file
1580 236 : SaveStatus_Impl(pChildWin, pCW->aInfo);
1581 : }
1582 236 : }
1583 :
1584 0 : void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW )
1585 : {
1586 0 : sal_uInt16 nId = pCW->nSaveId;
1587 0 : SfxChildWindow *pChildWin = pCW->pWin;
1588 :
1589 : // Save the information in the INI file
1590 0 : sal_uInt16 nFlags = pCW->aInfo.nFlags;
1591 0 : pCW->aInfo = pChildWin->GetInfo();
1592 0 : pCW->aInfo.nFlags |= nFlags;
1593 0 : SaveStatus_Impl(pChildWin, pCW->aInfo);
1594 :
1595 0 : pChildWin->Hide();
1596 :
1597 0 : if ( pCW->pCli )
1598 : {
1599 : // Child window is a direct child window and must therefore unregister
1600 : // itself from the WorkWindow
1601 0 : pCW->pCli = 0;
1602 0 : ReleaseChild_Impl(*pChildWin->GetWindow());
1603 : }
1604 : else
1605 : {
1606 : // ChildWindow is within a SplitWindow and unregister itself in
1607 : // the destructor.
1608 : }
1609 :
1610 0 : pWorkWin->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChildWin->GetWindow() );
1611 0 : pCW->pWin = 0;
1612 0 : pChildWin->Destroy();
1613 :
1614 0 : GetBindings().Invalidate( nId );
1615 0 : }
1616 :
1617 594 : void SfxWorkWindow::ResetStatusBar_Impl()
1618 : {
1619 594 : aStatBar.nId = 0;
1620 594 : }
1621 :
1622 : //--------------------------------------------------------------------
1623 594 : void SfxWorkWindow::SetStatusBar_Impl( sal_uInt32 nResId, SfxShell*, SfxBindings& )
1624 : {
1625 594 : if ( nResId && bShowStatusBar && IsVisible_Impl() )
1626 594 : aStatBar.nId = sal::static_int_cast<sal_uInt16>(nResId);
1627 594 : }
1628 :
1629 594 : void SfxWorkWindow::UpdateStatusBar_Impl()
1630 : {
1631 594 : Reference< ::com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY );
1632 594 : Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
1633 :
1634 594 : Any aValue = xPropSet->getPropertyValue( m_aLayoutManagerPropName );
1635 594 : aValue >>= xLayoutManager;
1636 :
1637 : // No status bar, if no ID is required or when in FullScreenView or
1638 : // if disabled
1639 1188 : if ( aStatBar.nId && IsDockingAllowed() && bInternalDockingAllowed && bShowStatusBar &&
1640 594 : ( (aStatBar.bOn && !bIsFullScreen) || aStatBar.bTemp ) )
1641 : {
1642 : // Id has changed, thus create a suitable Statusbarmanager, this takes
1643 : // over the current status bar;
1644 594 : if ( xLayoutManager.is() )
1645 594 : xLayoutManager->requestElement( m_aStatusBarResName );
1646 : }
1647 : else
1648 : {
1649 : // Destroy the current StatusBar
1650 : // The Manager only creates the Status bar, does not destroy it.
1651 0 : if ( xLayoutManager.is() )
1652 0 : xLayoutManager->destroyElement( m_aStatusBarResName );
1653 594 : }
1654 594 : }
1655 :
1656 94 : void SfxWorkWindow::MakeVisible_Impl( sal_Bool bVis )
1657 : {
1658 94 : if ( bVis )
1659 94 : nOrigMode = SFX_VISIBILITY_STANDARD;
1660 : else
1661 0 : nOrigMode = SFX_VISIBILITY_UNVISIBLE;
1662 :
1663 94 : if ( nOrigMode != nUpdateMode)
1664 0 : nUpdateMode = nOrigMode;
1665 94 : }
1666 :
1667 3358 : sal_Bool SfxWorkWindow::IsVisible_Impl()
1668 : {
1669 3358 : return nOrigMode != SFX_VISIBILITY_UNVISIBLE;
1670 : }
1671 :
1672 : //------------------------------------------------------------------------
1673 472 : void SfxWorkWindow::HidePopups_Impl(sal_Bool bHide, sal_Bool bParent, sal_uInt16 nId )
1674 : {
1675 12090 : for ( sal_uInt16 n = 0; n < pChildWins->Count(); ++n )
1676 : {
1677 11618 : SfxChildWindow *pCW = (*pChildWins)[n]->pWin;
1678 11618 : if (pCW && pCW->GetAlignment() == SFX_ALIGN_NOALIGNMENT && pCW->GetType() != nId)
1679 : {
1680 0 : Window *pWin = pCW->GetWindow();
1681 0 : SfxChild_Impl *pChild = FindChild_Impl(*pWin);
1682 0 : if (bHide)
1683 : {
1684 0 : pChild->nVisible &= ~CHILD_ACTIVE;
1685 0 : pCW->Hide();
1686 : }
1687 : else
1688 : {
1689 0 : pChild->nVisible |= CHILD_ACTIVE;
1690 0 : if ( CHILD_VISIBLE == (pChild->nVisible & CHILD_VISIBLE) )
1691 0 : pCW->Show( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
1692 : }
1693 : }
1694 : }
1695 :
1696 472 : if ( bParent && pParent )
1697 0 : pParent->HidePopups_Impl( bHide, bParent, nId );
1698 472 : }
1699 :
1700 : //------------------------------------------------------------------------
1701 :
1702 0 : void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
1703 : SfxDockingConfig eConfig, sal_uInt16 nId)
1704 : {
1705 0 : SfxDockingWindow* pDockWin=0;
1706 0 : sal_uInt16 nPos = USHRT_MAX;
1707 0 : Window *pWin=0;
1708 0 : SfxChildWin_Impl *pCW = 0;
1709 :
1710 0 : if ( eChild == SFX_CHILDWIN_OBJECTBAR )
1711 : {
1712 0 : return;
1713 : }
1714 : else
1715 : {
1716 : // configure direct childwindow
1717 0 : for (sal_uInt16 n=0; n<pChildWins->Count(); n++)
1718 : {
1719 0 : pCW = (*pChildWins)[n];
1720 0 : SfxChildWindow *pChild = pCW->pWin;
1721 0 : if ( pChild )
1722 : {
1723 0 : if ( pChild->GetType() == nId )
1724 : {
1725 0 : if ( pChild->GetWindow()->GetType() == RSC_DOCKINGWINDOW )
1726 : // it's a DockingWindow
1727 0 : pDockWin = (SfxDockingWindow*) pChild->GetWindow();
1728 : else
1729 : // FloatingWindow or ModelessDialog
1730 0 : pWin = pChild->GetWindow();
1731 0 : break;
1732 : }
1733 : }
1734 : }
1735 :
1736 0 : if ( pDockWin )
1737 : {
1738 0 : if ( eChild == SFX_CHILDWIN_DOCKINGWINDOW || pDockWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT )
1739 : {
1740 0 : if ( eChild == SFX_CHILDWIN_SPLITWINDOW && eConfig == SFX_TOGGLEFLOATMODE)
1741 : {
1742 : // DockingWindow was dragged out of a SplitWindow
1743 0 : pCW->pCli = RegisterChild_Impl(*pDockWin, pDockWin->GetAlignment(), pCW->pWin->CanGetFocus());
1744 0 : pCW->pCli->nVisible = CHILD_VISIBLE;
1745 : }
1746 :
1747 0 : pWin = pDockWin;
1748 : }
1749 : else
1750 : {
1751 0 : SfxSplitWindow *pSplitWin = GetSplitWindow_Impl(pDockWin->GetAlignment());
1752 :
1753 : // configure DockingWindow inside a SplitWindow
1754 0 : if ( eConfig == SFX_TOGGLEFLOATMODE)
1755 : {
1756 : // DockingWindow was dragged into a SplitWindow
1757 0 : pCW->pCli = 0;
1758 0 : ReleaseChild_Impl(*pDockWin);
1759 : }
1760 :
1761 0 : pWin = pSplitWin->GetSplitWindow();
1762 0 : if ( pSplitWin->GetWindowCount() == 1 )
1763 0 : ((SplitWindow*)pWin)->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
1764 : }
1765 : }
1766 :
1767 : DBG_ASSERT( pCW, "Unknown window!" );
1768 0 : if ( !pCW && pParent )
1769 : {
1770 0 : pParent->ConfigChild_Impl( eChild, eConfig, nId );
1771 0 : return;
1772 : }
1773 : }
1774 :
1775 0 : if ( !bSorted )
1776 : // windows may have been registered and released without an update until now
1777 0 : Sort_Impl();
1778 :
1779 0 : SfxChild_Impl *pChild = 0;
1780 : sal_uInt16 n;
1781 0 : for ( n=0; n<aSortedList.size(); ++n )
1782 : {
1783 0 : pChild = (*pChildren)[aSortedList[n]];
1784 0 : if ( pChild )
1785 0 : if ( pChild->pWin == pWin )
1786 0 : break;
1787 : }
1788 :
1789 0 : if ( n < aSortedList.size() )
1790 : // sometimes called while toggeling float mode
1791 0 : nPos = aSortedList[n];
1792 :
1793 0 : switch ( eConfig )
1794 : {
1795 : case SFX_SETDOCKINGRECTS :
1796 : {
1797 0 : if ( nPos == USHRT_MAX )
1798 : return;
1799 :
1800 0 : Rectangle aOuterRect( GetTopRect_Impl() );
1801 0 : aOuterRect.SetPos( pWorkWin->OutputToScreenPixel( aOuterRect.TopLeft() ));
1802 0 : Rectangle aInnerRect( aOuterRect );
1803 0 : sal_Bool bTbx = (eChild == SFX_CHILDWIN_OBJECTBAR);
1804 :
1805 : // The current affected window is included in the calculation of
1806 : // the inner rectangle!
1807 0 : for ( sal_uInt16 m=0; m<aSortedList.size(); ++m )
1808 : {
1809 0 : sal_uInt16 i=aSortedList[m];
1810 0 : SfxChild_Impl* pCli = (*pChildren)[i];
1811 :
1812 0 : if ( pCli && pCli->nVisible == CHILD_VISIBLE && pCli->pWin )
1813 : {
1814 0 : switch ( pCli->eAlign )
1815 : {
1816 : case SFX_ALIGN_TOP:
1817 : // Objekt-Toolboxes come always last
1818 0 : aInnerRect.Top() += pCli->aSize.Height();
1819 0 : break;
1820 :
1821 : case SFX_ALIGN_TOOLBOXTOP:
1822 : // Toolbox has priority, if no higher Position
1823 0 : if ( bTbx && i <= nPos)
1824 0 : aInnerRect.Top() += pCli->aSize.Height();
1825 0 : break;
1826 :
1827 : case SFX_ALIGN_HIGHESTTOP:
1828 : // Always performed first
1829 0 : aInnerRect.Top() += pCli->aSize.Height();
1830 0 : break;
1831 :
1832 : case SFX_ALIGN_LOWESTTOP:
1833 : // Is only counted if it is the current window
1834 0 : if ( i == nPos )
1835 0 : aInnerRect.Top() += pCli->aSize.Height();
1836 0 : break;
1837 :
1838 : case SFX_ALIGN_BOTTOM:
1839 : // Objekt-Toolboxes come always last
1840 0 : aInnerRect.Bottom() -= pCli->aSize.Height();
1841 0 : break;
1842 :
1843 : case SFX_ALIGN_TOOLBOXBOTTOM:
1844 : // Toolbox has priority, if no higher Position
1845 0 : if ( bTbx && i <= nPos)
1846 0 : aInnerRect.Bottom() -= pCli->aSize.Height();
1847 0 : break;
1848 :
1849 : case SFX_ALIGN_LOWESTBOTTOM:
1850 : // Always performed first
1851 0 : aInnerRect.Bottom() -= pCli->aSize.Height();
1852 0 : break;
1853 :
1854 : case SFX_ALIGN_HIGHESTBOTTOM:
1855 : // Is only counted if it is the current window
1856 0 : if ( i == nPos )
1857 0 : aInnerRect.Bottom() -= pCli->aSize.Height();
1858 0 : break;
1859 :
1860 : case SFX_ALIGN_LEFT:
1861 : // Toolboxes come always last
1862 0 : aInnerRect.Left() += pCli->aSize.Width();
1863 0 : break;
1864 :
1865 : case SFX_ALIGN_TOOLBOXLEFT:
1866 : // Toolboxes come always last
1867 0 : if (bTbx && i <= nPos)
1868 0 : aInnerRect.Left() += pCli->aSize.Width();
1869 0 : break;
1870 :
1871 : case SFX_ALIGN_FIRSTLEFT:
1872 : // Always performed first
1873 0 : aInnerRect.Left() += pCli->aSize.Width();
1874 0 : break;
1875 :
1876 : case SFX_ALIGN_LASTLEFT:
1877 : // Is only counted if it is the current window
1878 0 : if (i == nPos)
1879 0 : aInnerRect.Left() += pCli->aSize.Width();
1880 :
1881 : case SFX_ALIGN_RIGHT:
1882 : // Toolboxes come always last
1883 0 : aInnerRect.Right() -= pCli->aSize.Width();
1884 0 : break;
1885 :
1886 : case SFX_ALIGN_TOOLBOXRIGHT:
1887 : // Toolboxes come always last
1888 0 : if (bTbx && i <= nPos)
1889 0 : aInnerRect.Right() -= pCli->aSize.Width();
1890 0 : break;
1891 :
1892 : case SFX_ALIGN_FIRSTRIGHT:
1893 : // Is only counted if it is the current window
1894 0 : if (i == nPos)
1895 0 : aInnerRect.Right() -= pCli->aSize.Width();
1896 0 : break;
1897 :
1898 : case SFX_ALIGN_LASTRIGHT:
1899 : // Always performed first
1900 0 : aInnerRect.Right() -= pCli->aSize.Width();
1901 0 : break;
1902 :
1903 : default:
1904 0 : break;
1905 : }
1906 : }
1907 : }
1908 :
1909 0 : pDockWin->SetDockingRects(aOuterRect, aInnerRect);
1910 : break;
1911 : }
1912 :
1913 : case SFX_MOVEDOCKINGWINDOW :
1914 : case SFX_ALIGNDOCKINGWINDOW :
1915 : case SFX_TOGGLEFLOATMODE:
1916 : {
1917 0 : if ( nPos == USHRT_MAX && !pCW )
1918 0 : return;
1919 :
1920 0 : SfxChildAlignment eAlign = SFX_ALIGN_NOALIGNMENT;
1921 0 : SfxChild_Impl *pCli = ( nPos != USHRT_MAX ) ? (*pChildren)[nPos] : 0;
1922 0 : if ( pCli && pDockWin )
1923 : {
1924 0 : eAlign = pDockWin->GetAlignment();
1925 0 : if ( eChild == SFX_CHILDWIN_DOCKINGWINDOW || eAlign == SFX_ALIGN_NOALIGNMENT)
1926 : {
1927 : // configuration inside the SplitWindow, no change for the SplitWindows' configuration
1928 0 : pCli->bResize = sal_True;
1929 0 : pCli->aSize = pDockWin->GetSizePixel();
1930 : }
1931 : }
1932 :
1933 0 : if ( pCli )
1934 : {
1935 0 : if( pCli->eAlign != eAlign )
1936 : {
1937 0 : bSorted = sal_False;
1938 0 : pCli->eAlign = eAlign;
1939 : }
1940 :
1941 0 : ArrangeChildren_Impl();
1942 0 : ShowChildren_Impl();
1943 : }
1944 :
1945 0 : if ( pCW && pCW->pWin )
1946 : {
1947 : // store changed configuration
1948 0 : sal_uInt16 nFlags = pCW->aInfo.nFlags;
1949 0 : pCW->aInfo = pCW->pWin->GetInfo();
1950 0 : pCW->aInfo.nFlags |= nFlags;
1951 0 : if ( eConfig != SFX_MOVEDOCKINGWINDOW )
1952 0 : SaveStatus_Impl( pCW->pWin, pCW->aInfo);
1953 : }
1954 :
1955 0 : break;
1956 : }
1957 : }
1958 : }
1959 :
1960 : //--------------------------------------------------------------------
1961 :
1962 18856 : void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId, sal_Bool bEnabled, sal_uInt16 nMode )
1963 : {
1964 18856 : sal_uInt16 nInter = (sal_uInt16) ( lId >> 16 );
1965 18856 : sal_uInt16 nId = (sal_uInt16) ( lId & 0xFFFF );
1966 :
1967 18856 : SfxChildWin_Impl *pCW=NULL;
1968 18856 : SfxWorkWindow *pWork = pParent;
1969 :
1970 : // Get the top parent, child windows are alwas registered at the
1971 : // task of the WorkWindow for example the frame or on AppWorkWindow
1972 37712 : while ( pWork && pWork->pParent )
1973 0 : pWork = pWork->pParent;
1974 :
1975 18856 : if ( pWork )
1976 : {
1977 : // The Parent already known?
1978 0 : sal_uInt16 nCount = pWork->pChildWins->Count();
1979 0 : for (sal_uInt16 n=0; n<nCount; n++)
1980 0 : if ((*pWork->pChildWins)[n]->nSaveId == nId)
1981 : {
1982 0 : pCW = (*pWork->pChildWins)[n];
1983 0 : break;
1984 : }
1985 : }
1986 :
1987 18856 : if ( !pCW )
1988 : {
1989 : // If no Parent or the Parent us still unknown, then search here
1990 18856 : sal_uInt16 nCount = pChildWins->Count();
1991 306871 : for (sal_uInt16 n=0; n<nCount; n++)
1992 299092 : if ((*pChildWins)[n]->nSaveId == nId)
1993 : {
1994 11077 : pCW = (*pChildWins)[n];
1995 11077 : break;
1996 : }
1997 : }
1998 :
1999 18856 : if ( !pCW )
2000 : {
2001 : // If new, then initialize, add this here depending on the flag or
2002 : // the Parent
2003 7779 : pCW = new SfxChildWin_Impl( lId );
2004 7779 : pCW->nId = nId;
2005 7779 : InitializeChild_Impl( pCW );
2006 7779 : if ( pWork && !( pCW->aInfo.nFlags & SFX_CHILDWIN_TASK ) )
2007 0 : pWork->pChildWins->Insert( pWork->pChildWins->Count(), pCW );
2008 : else
2009 7779 : pChildWins->Insert( pChildWins->Count(), pCW );
2010 : }
2011 :
2012 18856 : pCW->nId = nId;
2013 18856 : if ( nInter )
2014 594 : pCW->nInterfaceId = nInter;
2015 18856 : pCW->nVisibility = nMode;
2016 18856 : pCW->bEnable = bEnabled;
2017 18856 : pCW->nVisibility = nMode;
2018 18856 : }
2019 :
2020 : //--------------------------------------------------------------------
2021 : // The on/of-Status of a ChildWindows is switched
2022 :
2023 0 : void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, sal_Bool bSetFocus)
2024 : {
2025 0 : sal_uInt16 nCount = pChildWins->Count();
2026 : sal_uInt16 n;
2027 0 : for (n=0; n<nCount; n++)
2028 0 : if ((*pChildWins)[n]->nId == nId)
2029 0 : break;
2030 :
2031 0 : if ( n<nCount )
2032 : {
2033 : // The Window is aleady known
2034 0 : SfxChildWin_Impl *pCW = (*pChildWins)[n];
2035 0 : SfxChildWindow *pChild = pCW->pWin;
2036 :
2037 0 : bool bCreationAllowed( true );
2038 0 : if ( !bInternalDockingAllowed )
2039 : {
2040 : // Special case for all non-floatable child windows. We have
2041 : // to prevent the creation here!
2042 0 : bCreationAllowed = !( pCW->aInfo.nFlags & SFX_CHILDWIN_FORCEDOCK );
2043 : }
2044 :
2045 0 : if ( bCreationAllowed )
2046 : {
2047 0 : if ( pCW->bCreate )
2048 : {
2049 0 : if ( pChild )
2050 : {
2051 0 : if ( pChild->QueryClose() )
2052 : {
2053 0 : pCW->bCreate = sal_False;
2054 0 : if ( pChild->IsHideAtToggle() )
2055 : {
2056 0 : ShowChildWindow_Impl( nId, sal_False, bSetFocus );
2057 : }
2058 : else
2059 : {
2060 : // The Window should be switched off
2061 0 : pChild->SetVisible_Impl( sal_False );
2062 0 : RemoveChildWin_Impl( pCW );
2063 : }
2064 : }
2065 : }
2066 : else
2067 : {
2068 : // no actual Window exists, yet => just remember the "switched off" state
2069 0 : pCW->bCreate = sal_False;
2070 : }
2071 : }
2072 : else
2073 : {
2074 0 : pCW->bCreate = AllowChildWindowCreation_Impl( *pCW );
2075 0 : if ( pCW->bCreate )
2076 : {
2077 0 : if ( pChild )
2078 : {
2079 0 : ShowChildWindow_Impl( nId, sal_True, bSetFocus );
2080 : }
2081 : else
2082 : {
2083 : // create actual Window
2084 0 : CreateChildWin_Impl( pCW, bSetFocus );
2085 0 : if ( !pCW->pWin )
2086 : // no success
2087 0 : pCW->bCreate = sal_False;
2088 : }
2089 : }
2090 : }
2091 : }
2092 :
2093 0 : ArrangeChildren_Impl();
2094 0 : ShowChildren_Impl();
2095 :
2096 0 : if ( pCW->bCreate && bCreationAllowed )
2097 : {
2098 0 : if ( !pCW->pCli )
2099 : {
2100 : SfxDockingWindow *pDock =
2101 0 : (SfxDockingWindow*) pCW->pWin->GetWindow();
2102 0 : if ( pDock->IsAutoHide_Impl() )
2103 0 : pDock->AutoShow_Impl();
2104 : }
2105 : }
2106 :
2107 0 : return;
2108 : }
2109 0 : else if ( pParent )
2110 : {
2111 0 : pParent->ToggleChildWindow_Impl( nId, bSetFocus );
2112 0 : return;
2113 : }
2114 :
2115 : #ifdef DBG_UTIL
2116 : nCount = pChildWins->Count();
2117 : for (n=0; n<nCount; n++)
2118 : if ((*pChildWins)[n]->nSaveId == nId)
2119 : break;
2120 :
2121 : if ( n < nCount )
2122 : {
2123 : OSL_FAIL("The ChildWindow is not in context!");
2124 : }
2125 : else
2126 : {
2127 : OSL_FAIL("The ChildWindow is not registered!");
2128 : }
2129 : #endif
2130 : }
2131 :
2132 : //--------------------------------------------------------------------
2133 :
2134 9 : sal_Bool SfxWorkWindow::HasChildWindow_Impl(sal_uInt16 nId)
2135 : {
2136 9 : sal_uInt16 nCount = pChildWins->Count();
2137 : sal_uInt16 n;
2138 234 : for (n=0; n<nCount; n++)
2139 225 : if ((*pChildWins)[n]->nSaveId == nId)
2140 0 : break;
2141 :
2142 9 : if (n<nCount)
2143 : {
2144 0 : SfxChildWin_Impl *pCW = (*pChildWins)[n];
2145 0 : SfxChildWindow *pChild = pCW->pWin;
2146 0 : return ( pChild && pCW->bCreate );
2147 : }
2148 :
2149 9 : if ( pParent )
2150 0 : return pParent->HasChildWindow_Impl( nId );
2151 :
2152 9 : return sal_False;
2153 : }
2154 :
2155 0 : sal_Bool SfxWorkWindow::IsFloating( sal_uInt16 nId )
2156 : {
2157 0 : SfxChildWin_Impl *pCW=NULL;
2158 0 : SfxWorkWindow *pWork = pParent;
2159 :
2160 : // Get the top parent, child windows are alwas registered at the
2161 : // task of the WorkWindow for example the frame or on AppWorkWindow
2162 0 : while ( pWork && pWork->pParent )
2163 0 : pWork = pWork->pParent;
2164 :
2165 0 : if ( pWork )
2166 : {
2167 : // The Parent already known?
2168 0 : sal_uInt16 nCount = pWork->pChildWins->Count();
2169 0 : for (sal_uInt16 n=0; n<nCount; n++)
2170 0 : if ((*pWork->pChildWins)[n]->nSaveId == nId)
2171 : {
2172 0 : pCW = (*pWork->pChildWins)[n];
2173 0 : break;
2174 : }
2175 : }
2176 :
2177 0 : if ( !pCW )
2178 : {
2179 : // If no Parent or the Parent us still unknown, then search here
2180 0 : sal_uInt16 nCount = pChildWins->Count();
2181 0 : for (sal_uInt16 n=0; n<nCount; n++)
2182 0 : if ((*pChildWins)[n]->nSaveId == nId)
2183 : {
2184 0 : pCW = (*pChildWins)[n];
2185 0 : break;
2186 : }
2187 : }
2188 :
2189 0 : if ( !pCW )
2190 : {
2191 : // If new, then initialize, add this here depending on the flag or
2192 : // the Parent
2193 0 : pCW = new SfxChildWin_Impl( nId );
2194 0 : pCW->bEnable = sal_False;
2195 0 : pCW->nId = 0;
2196 0 : pCW->nVisibility = 0;
2197 0 : InitializeChild_Impl( pCW );
2198 0 : if ( pWork && !( pCW->aInfo.nFlags & SFX_CHILDWIN_TASK ) )
2199 0 : pWork->pChildWins->Insert( pWork->pChildWins->Count(), pCW );
2200 : else
2201 0 : pChildWins->Insert( pChildWins->Count(), pCW );
2202 : }
2203 :
2204 : SfxChildAlignment eAlign;
2205 0 : if ( pCW->aInfo.GetExtraData_Impl( &eAlign ) )
2206 0 : return( eAlign == SFX_ALIGN_NOALIGNMENT );
2207 : else
2208 0 : return sal_True;
2209 : }
2210 :
2211 : //--------------------------------------------------------------------
2212 :
2213 0 : sal_Bool SfxWorkWindow::KnowsChildWindow_Impl(sal_uInt16 nId)
2214 : {
2215 0 : SfxChildWin_Impl *pCW=0;
2216 0 : sal_uInt16 nCount = pChildWins->Count();
2217 : sal_uInt16 n;
2218 0 : for (n=0; n<nCount; n++)
2219 : {
2220 0 : pCW = (*pChildWins)[n];
2221 0 : if ( pCW->nSaveId == nId)
2222 0 : break;
2223 : }
2224 :
2225 0 : if (n<nCount)
2226 : {
2227 0 : if ( !(pCW->aInfo.nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE) && !IsVisible_Impl( pCW->nVisibility ) )
2228 0 : return sal_False;
2229 0 : return pCW->bEnable;
2230 : }
2231 0 : else if ( pParent )
2232 0 : return pParent->KnowsChildWindow_Impl( nId );
2233 : else
2234 0 : return sal_False;
2235 : }
2236 :
2237 : //--------------------------------------------------------------------
2238 :
2239 126 : void SfxWorkWindow::SetChildWindow_Impl(sal_uInt16 nId, sal_Bool bOn, sal_Bool bSetFocus)
2240 : {
2241 126 : SfxChildWin_Impl *pCW=NULL;
2242 126 : SfxWorkWindow *pWork = pParent;
2243 :
2244 : // Get the top parent, child windows are alwas registered at the
2245 : // task of the WorkWindow for example the frame or on AppWorkWindow
2246 252 : while ( pWork && pWork->pParent )
2247 0 : pWork = pWork->pParent;
2248 :
2249 126 : if ( pWork )
2250 : {
2251 : // The Parent already known?
2252 0 : sal_uInt16 nCount = pWork->pChildWins->Count();
2253 0 : for (sal_uInt16 n=0; n<nCount; n++)
2254 0 : if ((*pWork->pChildWins)[n]->nSaveId == nId)
2255 : {
2256 0 : pCW = (*pWork->pChildWins)[n];
2257 0 : break;
2258 : }
2259 : }
2260 :
2261 126 : if ( !pCW )
2262 : {
2263 : // If no Parent or the Parent us still unknown, then search here
2264 126 : sal_uInt16 nCount = pChildWins->Count();
2265 3650 : for (sal_uInt16 n=0; n<nCount; n++)
2266 3650 : if ((*pChildWins)[n]->nSaveId == nId)
2267 : {
2268 126 : pCW = (*pChildWins)[n];
2269 126 : pWork = this;
2270 126 : break;
2271 : }
2272 : }
2273 :
2274 126 : if ( !pCW )
2275 : {
2276 : // If new, then initialize, add this here depending on the flag or
2277 : // the Parent
2278 0 : pCW = new SfxChildWin_Impl( nId );
2279 0 : InitializeChild_Impl( pCW );
2280 0 : if ( !pWork || pCW->aInfo.nFlags & SFX_CHILDWIN_TASK )
2281 0 : pWork = this;
2282 0 : pWork->pChildWins->Insert( pWork->pChildWins->Count(), pCW );
2283 : }
2284 :
2285 126 : if ( pCW->bCreate != bOn )
2286 0 : pWork->ToggleChildWindow_Impl(nId,bSetFocus);
2287 126 : }
2288 :
2289 : //--------------------------------------------------------------------
2290 :
2291 0 : void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus)
2292 : {
2293 0 : sal_uInt16 nCount = pChildWins->Count();
2294 0 : SfxChildWin_Impl* pCW=0;
2295 : sal_uInt16 n;
2296 0 : for (n=0; n<nCount; n++)
2297 : {
2298 0 : pCW = (*pChildWins)[n];
2299 0 : if (pCW->nId == nId)
2300 0 : break;
2301 : }
2302 :
2303 0 : if ( n<nCount )
2304 : {
2305 0 : SfxChildWindow *pChildWin = pCW->pWin;
2306 0 : if ( pChildWin )
2307 : {
2308 0 : if ( bVisible )
2309 : {
2310 0 : if ( pCW->pCli )
2311 : {
2312 0 : pCW->pCli->bSetFocus = bSetFocus;
2313 0 : pCW->pCli->nVisible = CHILD_VISIBLE;
2314 0 : pChildWin->Show( bSetFocus && pChildWin->WantsFocus() ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
2315 : }
2316 : else
2317 0 : ((SfxDockingWindow*)pChildWin->GetWindow())->Reappear_Impl();
2318 :
2319 : }
2320 : else
2321 : {
2322 0 : if ( pCW->pCli )
2323 : {
2324 0 : pCW->pCli->nVisible = CHILD_VISIBLE ^ CHILD_NOT_HIDDEN;
2325 0 : pCW->pWin->Hide();
2326 : }
2327 : else
2328 0 : ((SfxDockingWindow*)pChildWin->GetWindow())->Disappear_Impl();
2329 :
2330 : }
2331 :
2332 0 : ArrangeChildren_Impl();
2333 0 : ShowChildren_Impl();
2334 : }
2335 0 : else if ( bVisible )
2336 : {
2337 0 : SetChildWindow_Impl( nId, sal_True, bSetFocus );
2338 0 : pChildWin = pCW->pWin;
2339 : }
2340 :
2341 0 : if ( pChildWin )
2342 : {
2343 0 : pChildWin->SetVisible_Impl( bVisible );
2344 0 : sal_uInt16 nFlags = pCW->aInfo.nFlags;
2345 0 : pCW->aInfo = pChildWin->GetInfo();
2346 0 : pCW->aInfo.nFlags |= nFlags;
2347 0 : if ( !pCW->bCreate )
2348 0 : SaveStatus_Impl( pChildWin, pCW->aInfo );
2349 : }
2350 :
2351 0 : return;
2352 : }
2353 :
2354 0 : if ( pParent )
2355 : {
2356 0 : pParent->ShowChildWindow_Impl( nId, bVisible, bSetFocus );
2357 0 : return;
2358 : }
2359 :
2360 : #ifdef DBG_UTIL
2361 : nCount = pChildWins->Count();
2362 : for (n=0; n<nCount; n++)
2363 : if ((*pChildWins)[n]->nSaveId == nId)
2364 : break;
2365 :
2366 : if ( n<nCount )
2367 : {
2368 : OSL_FAIL("The ChildWindow is not in context!");
2369 : }
2370 : else
2371 : {
2372 : OSL_FAIL("The ChildWindow is not registered");
2373 : }
2374 : #endif
2375 : }
2376 :
2377 : //--------------------------------------------------------------------
2378 :
2379 10489 : SfxChildWindow* SfxWorkWindow::GetChildWindow_Impl(sal_uInt16 nId)
2380 : {
2381 10489 : sal_uInt16 nCount = pChildWins->Count();
2382 : sal_uInt16 n;
2383 152160 : for (n=0; n<nCount; n++)
2384 149018 : if ((*pChildWins)[n]->nSaveId == nId)
2385 7347 : break;
2386 :
2387 10489 : if (n<nCount)
2388 7347 : return (*pChildWins)[n]->pWin;
2389 3142 : else if ( pParent )
2390 0 : return pParent->GetChildWindow_Impl( nId );
2391 3142 : return 0;
2392 : }
2393 :
2394 : //------------------------------------------------------------------------
2395 :
2396 594 : void SfxWorkWindow::ResetChildWindows_Impl()
2397 : {
2398 10529 : for ( sal_uInt16 n = 0; n < pChildWins->Count(); ++n )
2399 : {
2400 9935 : (*pChildWins)[n]->nId = 0;
2401 9935 : (*pChildWins)[n]->bEnable = sal_False;
2402 : }
2403 594 : }
2404 :
2405 : //------------------------------------------------------------------------
2406 : // Virtual method that returns the size of the area (client area) of the
2407 : // parent windows, in which the ChildWindow can be fitted.
2408 :
2409 0 : Rectangle SfxWorkWindow::GetTopRect_Impl()
2410 : {
2411 0 : return Rectangle (Point(), pWorkWin->GetOutputSizePixel() );
2412 : }
2413 :
2414 : //------------------------------------------------------------------------
2415 : // Virtual method that returns the size of the area (client area) of the
2416 : // parent windows, in which the ChildWindow can be fitted.
2417 :
2418 2168 : Rectangle SfxFrameWorkWin_Impl::GetTopRect_Impl()
2419 : {
2420 2168 : return pMasterFrame->GetTopOuterRectPixel_Impl();
2421 : }
2422 :
2423 : //------------------------------------------------------------------------
2424 : // Virtual method to find out if there is room for a ChildWindow in the
2425 : // client area of the parent.
2426 :
2427 0 : sal_Bool SfxWorkWindow::RequestTopToolSpacePixel_Impl( SvBorder aBorder )
2428 : {
2429 0 : if ( !IsDockingAllowed() ||
2430 0 : aClientArea.GetWidth() < aBorder.Left() + aBorder.Right() ||
2431 0 : aClientArea.GetHeight() < aBorder.Top() + aBorder.Bottom() )
2432 0 : return sal_False;
2433 : else
2434 0 : return sal_True;;
2435 : }
2436 :
2437 236 : void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow *pChild, const SfxChildWinInfo &rInfo)
2438 : {
2439 : // The Status of the Presentation mode is not saved
2440 236 : if ( IsDockingAllowed() && bInternalDockingAllowed )
2441 236 : pChild->SaveStatus(rInfo);
2442 236 : }
2443 :
2444 7779 : void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW)
2445 : {
2446 7779 : SfxChildWinFactory* pFact=0;
2447 7779 : SfxApplication *pApp = SFX_APP();
2448 : {
2449 7779 : SfxChildWinFactArr_Impl &rFactories = pApp->GetChildWinFactories_Impl();
2450 119582 : for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory )
2451 : {
2452 115570 : pFact = rFactories[nFactory];
2453 115570 : if ( pFact->nId == pCW->nSaveId )
2454 : {
2455 3767 : pCW->aInfo = pFact->aInfo;
2456 : SfxChildWindow::InitializeChildWinFactory_Impl(
2457 3767 : pCW->nSaveId, pCW->aInfo);
2458 3767 : pCW->bCreate = pCW->aInfo.bVisible;
2459 3767 : sal_uInt16 nFlags = pFact->aInfo.nFlags;
2460 3767 : if ( nFlags & SFX_CHILDWIN_TASK )
2461 0 : pCW->aInfo.nFlags |= SFX_CHILDWIN_TASK;
2462 3767 : if ( nFlags & SFX_CHILDWIN_CANTGETFOCUS )
2463 0 : pCW->aInfo.nFlags |= SFX_CHILDWIN_CANTGETFOCUS;
2464 3767 : if ( nFlags & SFX_CHILDWIN_FORCEDOCK )
2465 0 : pCW->aInfo.nFlags |= SFX_CHILDWIN_FORCEDOCK;
2466 3767 : pFact->aInfo = pCW->aInfo;
2467 3767 : return;
2468 : }
2469 : }
2470 : }
2471 :
2472 4012 : SfxDispatcher *pDisp = pBindings->GetDispatcher_Impl();
2473 4012 : SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :0;
2474 4012 : if ( pMod )
2475 : {
2476 4012 : SfxChildWinFactArr_Impl *pFactories = pMod->GetChildWinFactories_Impl();
2477 4012 : if ( pFactories )
2478 : {
2479 4012 : SfxChildWinFactArr_Impl &rFactories = *pFactories;
2480 46256 : for ( sal_uInt16 nFactory = 0; nFactory < rFactories.size(); ++nFactory )
2481 : {
2482 46020 : pFact = rFactories[nFactory];
2483 46020 : if ( pFact->nId == pCW->nSaveId )
2484 : {
2485 3776 : pCW->aInfo = pFact->aInfo;
2486 : SfxChildWindow::InitializeChildWinFactory_Impl(
2487 3776 : pCW->nSaveId, pCW->aInfo);
2488 3776 : pCW->bCreate = pCW->aInfo.bVisible;
2489 3776 : sal_uInt16 nFlags = pFact->aInfo.nFlags;
2490 3776 : if ( nFlags & SFX_CHILDWIN_TASK )
2491 0 : pCW->aInfo.nFlags |= SFX_CHILDWIN_TASK;
2492 3776 : if ( nFlags & SFX_CHILDWIN_CANTGETFOCUS )
2493 0 : pCW->aInfo.nFlags |= SFX_CHILDWIN_CANTGETFOCUS;
2494 3776 : if ( nFlags & SFX_CHILDWIN_FORCEDOCK )
2495 236 : pCW->aInfo.nFlags |= SFX_CHILDWIN_FORCEDOCK;
2496 3776 : if ( nFlags & SFX_CHILDWIN_ALWAYSAVAILABLE )
2497 0 : pCW->aInfo.nFlags |= SFX_CHILDWIN_ALWAYSAVAILABLE;
2498 3776 : pFact->aInfo = pCW->aInfo;
2499 3776 : return;
2500 : }
2501 : }
2502 : }
2503 : }
2504 : }
2505 :
2506 0 : SfxSplitWindow* SfxWorkWindow::GetSplitWindow_Impl( SfxChildAlignment eAlign )
2507 : {
2508 0 : switch ( eAlign )
2509 : {
2510 : case SFX_ALIGN_TOP:
2511 0 : return pSplit[2];
2512 :
2513 : case SFX_ALIGN_BOTTOM:
2514 0 : return pSplit[3];
2515 :
2516 : case SFX_ALIGN_LEFT:
2517 0 : return pSplit[0];
2518 :
2519 : case SFX_ALIGN_RIGHT:
2520 0 : return pSplit[1];
2521 :
2522 : default:
2523 0 : return 0;
2524 : }
2525 : }
2526 :
2527 0 : void SfxWorkWindow::MakeChildrenVisible_Impl( sal_Bool bVis )
2528 : {
2529 0 : if ( pParent )
2530 0 : pParent->MakeChildrenVisible_Impl( bVis );
2531 :
2532 0 : bAllChildrenVisible = bVis;
2533 0 : if ( bVis )
2534 : {
2535 0 : if ( !bSorted )
2536 0 : Sort_Impl();
2537 0 : for ( sal_uInt16 n=0; n<aSortedList.size(); ++n )
2538 : {
2539 0 : SfxChild_Impl* pCli = (*pChildren)[aSortedList[n]];
2540 0 : if ( (pCli->eAlign == SFX_ALIGN_NOALIGNMENT) || (IsDockingAllowed() && bInternalDockingAllowed) )
2541 0 : pCli->nVisible |= CHILD_ACTIVE;
2542 : }
2543 : }
2544 : else
2545 : {
2546 0 : if ( !bSorted )
2547 0 : Sort_Impl();
2548 0 : for ( sal_uInt16 n=0; n<aSortedList.size(); ++n )
2549 : {
2550 0 : SfxChild_Impl* pCli = (*pChildren)[aSortedList[n]];
2551 0 : pCli->nVisible &= ~CHILD_ACTIVE;
2552 : }
2553 : }
2554 0 : }
2555 :
2556 0 : sal_Bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin )
2557 : {
2558 0 : for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2559 : {
2560 0 : if ( pSplit[n] != pSplitWin && pSplit[n]->IsAutoHide( sal_True ) )
2561 0 : return sal_True;
2562 : }
2563 0 : return sal_False;
2564 : }
2565 :
2566 :
2567 0 : void SfxWorkWindow::EndAutoShow_Impl( Point aPos )
2568 : {
2569 0 : if ( pParent )
2570 0 : pParent->EndAutoShow_Impl( aPos );
2571 :
2572 0 : for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2573 : {
2574 0 : SfxSplitWindow *p = pSplit[n];
2575 0 : if ( p && p->IsAutoHide() )
2576 : {
2577 0 : Point aLocalPos = p->ScreenToOutputPixel( aPos );
2578 0 : Point aEmptyPoint = Point();
2579 0 : Rectangle aRect( aEmptyPoint, p->GetSizePixel() );
2580 0 : if ( !aRect.IsInside( aLocalPos ) )
2581 0 : p->FadeOut();
2582 : }
2583 : }
2584 0 : }
2585 :
2586 967 : void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin )
2587 : {
2588 967 : if ( m_nLock )
2589 967 : return;
2590 :
2591 967 : if ( pParent )
2592 0 : pParent->ArrangeAutoHideWindows( pActSplitWin );
2593 :
2594 967 : Rectangle aArea( aUpperClientArea );
2595 4835 : for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2596 : {
2597 : // Either dummy window or window in the auto-show-mode are processed
2598 : // (not pinned, FadeIn).
2599 : // Only the abandoned window may be invisible, because perhaps its
2600 : // size is just beeing calculated before it is displayed.
2601 3868 : SfxSplitWindow* pSplitWin = pSplit[n];
2602 3868 : sal_Bool bDummyWindow = !pSplitWin->IsFadeIn();
2603 3868 : Window *pDummy = pSplitWin->GetSplitWindow();
2604 3868 : Window *pWin = bDummyWindow ? pDummy : pSplitWin;
2605 3868 : if ( (pSplitWin->IsPinned() && !bDummyWindow) || (!pWin->IsVisible() && pActSplitWin != pSplitWin) )
2606 3868 : continue;
2607 :
2608 : // Width and position of the dummy window as a starting point
2609 0 : Size aSize = pDummy->GetSizePixel();
2610 0 : Point aPos = pDummy->GetPosPixel();
2611 :
2612 0 : switch ( n )
2613 : {
2614 : case ( 0 ) :
2615 : {
2616 : // Left SplitWindow
2617 : // Get the width of the Window yourself, if no DummyWindow
2618 0 : if ( !bDummyWindow )
2619 0 : aSize.Width() = pSplitWin->GetSizePixel().Width();
2620 :
2621 : // If a Window is visable to the left, then the free region
2622 : // starts to the right from it, for example at the Client area
2623 0 : long nLeft = aPos.X() + aSize.Width();
2624 0 : if ( nLeft > aArea.Left() )
2625 0 : aArea.Left() = nLeft;
2626 0 : break;
2627 : }
2628 : case ( 1 ) :
2629 : {
2630 : // Right SplitWindow
2631 : // Position to correct the difference of the widths
2632 0 : aPos.X() += aSize.Width();
2633 :
2634 : // Get the width of the Window yourself, if no DummyWindow
2635 0 : if ( !bDummyWindow )
2636 0 : aSize.Width() = pSplitWin->GetSizePixel().Width();
2637 :
2638 0 : aPos.X() -= aSize.Width();
2639 :
2640 : // If already a window is opened at the left side, then the
2641 : // right is not allowed to overlap this one.
2642 0 : if ( aPos.X() < aArea.Left() )
2643 : {
2644 0 : aPos.X() = aArea.Left();
2645 0 : aSize.Width() = aArea.GetWidth();
2646 : }
2647 :
2648 : // If a Window is visable to the right, then the free region
2649 : // starts to the left from it, for example at the Client area
2650 0 : long nRight = aPos.X();
2651 0 : if ( nRight < aArea.Right() )
2652 0 : aArea.Right() = nRight;
2653 0 : break;
2654 : }
2655 : case ( 2 ) :
2656 : {
2657 : // Top SplitWindow
2658 : // Get the height of the Window yourself, if no DummyWindow
2659 0 : if ( !bDummyWindow )
2660 0 : aSize.Height() = pSplitWin->GetSizePixel().Height();
2661 :
2662 :
2663 : // Adjust width with regard to if a Window is already open
2664 : // to the left or right
2665 0 : aPos.X() = aArea.Left();
2666 0 : aSize.Width() = aArea.GetWidth();
2667 :
2668 : // If a Window is visable at the top, then the free region
2669 : // starts beneath it, for example at the Client area
2670 0 : long nTop = aPos.Y() + aSize.Height();
2671 0 : if ( nTop > aArea.Top() )
2672 0 : aArea.Top() = nTop;
2673 0 : break;
2674 : }
2675 : case ( 3 ) :
2676 : {
2677 : // The bottom SplitWindow
2678 : // Position to correct the difference of the heights
2679 0 : aPos.Y() += aSize.Height();
2680 :
2681 : // Get the height of the Window yourself, if no DummyWindow
2682 0 : if ( !bDummyWindow )
2683 0 : aSize.Height() = pSplitWin->GetSizePixel().Height();
2684 :
2685 0 : aPos.Y() -= aSize.Height();
2686 :
2687 : // Adjust width with regard to if a Window is already open
2688 : // to the left or right.
2689 0 : aPos.X() = aArea.Left();
2690 0 : aSize.Width() = aArea.GetWidth();
2691 :
2692 : // If already a window is opened at the top, then the
2693 : // bottom one is not allowed to overlap this one.
2694 0 : if ( aPos.Y() < aArea.Top() )
2695 : {
2696 0 : aPos.Y() = aArea.Top();
2697 0 : aSize.Height() = aArea.GetHeight();
2698 : }
2699 :
2700 0 : break;
2701 : }
2702 : }
2703 :
2704 0 : if ( !bDummyWindow )
2705 : // the FadeIn-Window is a Floating window, which coordinates are
2706 : // set in Screen coordinates.
2707 0 : pSplitWin->SetPosSizePixel( pWorkWin->OutputToScreenPixel(aPos), aSize );
2708 : else
2709 : // the docked DummyWindow
2710 0 : pDummy->SetPosSizePixel( aPos, aSize );
2711 : }
2712 : }
2713 :
2714 0 : Rectangle SfxWorkWindow::GetFreeArea( sal_Bool bAutoHide ) const
2715 : {
2716 0 : if ( bAutoHide )
2717 : {
2718 0 : Rectangle aArea( aClientArea );
2719 0 : for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2720 : {
2721 0 : if ( pSplit[n]->IsPinned() || !pSplit[n]->IsVisible() )
2722 0 : continue;
2723 :
2724 0 : Size aSize = pSplit[n]->GetSizePixel();
2725 0 : switch ( n )
2726 : {
2727 : case ( 0 ) :
2728 0 : aArea.Left() += aSize.Width();
2729 0 : break;
2730 : case ( 1 ) :
2731 0 : aArea.Right() -= aSize.Width();
2732 0 : break;
2733 : case ( 2 ) :
2734 0 : aArea.Top() += aSize.Height();
2735 0 : break;
2736 : case ( 3 ) :
2737 0 : aArea.Bottom() -= aSize.Height();
2738 0 : break;
2739 : }
2740 : }
2741 :
2742 0 : return aArea;
2743 : }
2744 : else
2745 0 : return aClientArea;
2746 : }
2747 :
2748 0 : void SfxWorkWindow::SetActiveChild_Impl( Window *pChild )
2749 : {
2750 0 : pActiveChild = pChild;
2751 0 : }
2752 :
2753 0 : sal_Bool SfxWorkWindow::ActivateNextChild_Impl( sal_Bool bForward )
2754 : {
2755 : // Sort all children under list
2756 0 : std::vector<sal_uInt16> aList;
2757 0 : for ( sal_uInt16 i=SFX_OBJECTBAR_MAX; i<pChildren->Count(); i++)
2758 : {
2759 0 : SfxChild_Impl *pCli = (*pChildren)[i];
2760 0 : if ( pCli && pCli->bCanGetFocus && pCli->pWin )
2761 : {
2762 : sal_uInt16 k;
2763 0 : for (k=0; k<aList.size(); k++)
2764 0 : if ( ChildTravelValue((*pChildren)[aList[k]]->eAlign) > ChildTravelValue(pCli->eAlign) )
2765 0 : break;
2766 0 : aList.insert( aList.begin() + k, i );
2767 : }
2768 : }
2769 :
2770 0 : if ( aList.empty() )
2771 0 : return sal_False;
2772 :
2773 0 : sal_uInt16 nTopValue = ChildTravelValue( SFX_ALIGN_LOWESTTOP );
2774 0 : for ( sal_uInt16 i=0; i<aList.size(); i++ )
2775 : {
2776 0 : SfxChild_Impl* pCli = (*pChildren)[aList[i]];
2777 0 : if ( pCli->pWin && ChildTravelValue( pCli->eAlign ) > nTopValue )
2778 0 : break;
2779 : }
2780 :
2781 0 : sal_uInt16 n = bForward ? 0 : aList.size()-1;
2782 0 : SfxChild_Impl *pAct=NULL;
2783 0 : if ( pActiveChild )
2784 : {
2785 : // Look for the active window
2786 0 : for ( n=0; n<aList.size(); n++ )
2787 : {
2788 0 : SfxChild_Impl* pCli = (*pChildren)[aList[n]];
2789 0 : if ( pCli && pCli->pWin && ( pCli->pWin == pActiveChild || !pActiveChild ) )
2790 : {
2791 0 : pAct = pCli;
2792 0 : break;
2793 : }
2794 : }
2795 : }
2796 :
2797 : // dummy entries for the container window
2798 0 : aList.insert( aList.begin(), 0xFFFF );
2799 0 : aList.push_back( 0xFFFF );
2800 0 : n = n + 1;
2801 0 : if ( pAct )
2802 : {
2803 0 : for ( sal_uInt16 i=0; i<SFX_SPLITWINDOWS_MAX; i++ )
2804 : {
2805 : // Maybe the pNext is a Splitwindow
2806 0 : SfxSplitWindow *p = pSplit[i];
2807 0 : if ( pAct->pWin == p )
2808 : {
2809 0 : if( p->ActivateNextChild_Impl( bForward ) )
2810 0 : return sal_True;
2811 0 : break;
2812 : }
2813 : }
2814 :
2815 : // pAct is a direct ChildWindow
2816 : // continue with the successor or predecessor of the active window
2817 0 : if ( bForward )
2818 0 : n = n+1;
2819 : else
2820 0 : n = n-1;
2821 :
2822 0 : if ( n == 0 || n == aList.size()-1 )
2823 0 : return sal_False;
2824 : }
2825 :
2826 0 : for( ;; )
2827 : {
2828 0 : SfxChild_Impl* pCli = (*pChildren)[aList[n]];
2829 0 : if ( pCli->pWin )
2830 : {
2831 0 : SfxChild_Impl* pNext = pCli;
2832 0 : for ( sal_uInt16 i=0; n<SFX_SPLITWINDOWS_MAX; n++ )
2833 : {
2834 : // Maybe the pNext is a Splitwindow
2835 0 : SfxSplitWindow *p = pSplit[i];
2836 0 : if ( pNext->pWin == p )
2837 : {
2838 : // Activate the first/last window
2839 0 : p->SetActiveWindow_Impl( NULL );
2840 0 : pNext = NULL;
2841 0 : if( p->ActivateNextChild_Impl( bForward ) )
2842 0 : return sal_True;
2843 0 : break;
2844 : }
2845 : }
2846 :
2847 0 : if ( pNext )
2848 : {
2849 0 : pNext->pWin->GrabFocus();
2850 0 : pActiveChild = pNext->pWin;
2851 0 : return sal_True;
2852 : }
2853 : }
2854 :
2855 0 : if ( bForward )
2856 0 : n = n+1;
2857 : else
2858 0 : n = n-1;
2859 :
2860 0 : if ( n == 0 || n == aList.size()-1 )
2861 0 : break;
2862 : }
2863 :
2864 0 : return sal_False;
2865 : }
2866 :
2867 92 : void SfxWorkWindow::DataChanged_Impl( const DataChangedEvent& )
2868 : {
2869 : sal_uInt16 n;
2870 92 : sal_uInt16 nCount = pChildWins->Count();
2871 3128 : for (n=0; n<nCount; n++)
2872 : {
2873 3036 : SfxChildWin_Impl*pCW = (*pChildWins)[n];
2874 3036 : if ( pCW && pCW->pWin )
2875 92 : pCW->pWin->GetWindow()->UpdateSettings( Application::GetSettings() );
2876 : }
2877 :
2878 92 : ArrangeChildren_Impl();
2879 92 : }
2880 :
2881 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|