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