LCOV - code coverage report
Current view: top level - sfx2/source/appl - workwin.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 815 1200 67.9 %
Date: 2015-06-13 12:38:46 Functions: 61 76 80.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11