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