LCOV - code coverage report
Current view: top level - sd/source/ui/toolpanel - ToolPanelViewShell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 260 305 85.2 %
Date: 2012-08-25 Functions: 51 63 81.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 258 554 46.6 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       4                 :            :  *
       5                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       6                 :            :  *
       7                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       8                 :            :  *
       9                 :            :  * This file is part of OpenOffice.org.
      10                 :            :  *
      11                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      12                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      13                 :            :  * only, as published by the Free Software Foundation.
      14                 :            :  *
      15                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      16                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      17                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      18                 :            :  * GNU Lesser General Public License version 3 for more details
      19                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      20                 :            :  *
      21                 :            :  * You should have received a copy of the GNU Lesser General Public License
      22                 :            :  * version 3 along with OpenOffice.org.  If not, see
      23                 :            :  * <http://www.openoffice.org/license.html>
      24                 :            :  * for a copy of the LGPLv3 License.
      25                 :            :  *
      26                 :            : ************************************************************************/
      27                 :            : 
      28                 :            : 
      29                 :            : #include "taskpane/ToolPanelViewShell.hxx"
      30                 :            : 
      31                 :            : #include "TaskPaneShellManager.hxx"
      32                 :            : #include "TaskPaneFocusManager.hxx"
      33                 :            : #include "taskpane/TaskPaneControlFactory.hxx"
      34                 :            : #include "controls/MasterPagesPanel.hxx"
      35                 :            : #include "LayoutMenu.hxx"
      36                 :            : #include "DrawDocShell.hxx"
      37                 :            : #include "controls/TableDesignPanel.hxx"
      38                 :            : #include "controls/CustomAnimationPanel.hxx"
      39                 :            : #include "controls/SlideTransitionPanel.hxx"
      40                 :            : #include "controls/MasterPagesSelector.hxx"
      41                 :            : #include "ToolPanel.hxx"
      42                 :            : #include "ToolPanelUIElement.hxx"
      43                 :            : #include "PaneDockingWindow.hxx"
      44                 :            : #include "FrameView.hxx"
      45                 :            : #include "Window.hxx"
      46                 :            : #include "sdmod.hxx"
      47                 :            : #include "app.hrc"
      48                 :            : #include "glob.hrc"
      49                 :            : #include "res_bmp.hrc"
      50                 :            : #include "helpids.h"
      51                 :            : #include "strings.hrc"
      52                 :            : #include "sdresid.hxx"
      53                 :            : #include "framework/FrameworkHelper.hxx"
      54                 :            : 
      55                 :            : #include <com/sun/star/drawing/framework/XResourceId.hpp>
      56                 :            : #include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
      57                 :            : #include <com/sun/star/drawing/framework/AnchorBindingMode.hpp>
      58                 :            : #include <com/sun/star/drawing/XDrawSubController.hpp>
      59                 :            : 
      60                 :            : #include <svtools/toolpanel/toolpanel.hxx>
      61                 :            : #include <svtools/toolpanel/toolpaneldeck.hxx>
      62                 :            : #include <svx/dlgctrl.hxx>
      63                 :            : #include <sfx2/taskpane.hxx>
      64                 :            : #include <sfx2/imagemgr.hxx>
      65                 :            : #include <sfx2/bindings.hxx>
      66                 :            : #include <sfx2/dispatch.hxx>
      67                 :            : #include <sfx2/viewfrm.hxx>
      68                 :            : #include <sfx2/msg.hxx>
      69                 :            : #include <sfx2/objface.hxx>
      70                 :            : #include <svx/colrctrl.hxx>
      71                 :            : #include <svx/xtable.hxx>
      72                 :            : #include <vcl/dockwin.hxx>
      73                 :            : #include "sdtreelb.hxx"
      74                 :            : #include "DrawViewShell.hxx"
      75                 :            : #include "drawdoc.hxx"
      76                 :            : #include "ViewShellBase.hxx"
      77                 :            : #include <svx/ruler.hxx>
      78                 :            : #include <vcl/svapp.hxx>
      79                 :            : #include <vcl/toolbox.hxx>
      80                 :            : #include <tools/diagnose_ex.h>
      81                 :            : #include <unotools/confignode.hxx>
      82                 :            : #include <comphelper/processfactory.hxx>
      83                 :            : #include <comphelper/componentcontext.hxx>
      84                 :            : #include <cppuhelper/implbase1.hxx>
      85                 :            : #include <cppuhelper/basemutex.hxx>
      86                 :            : 
      87                 :            : #include <vector>
      88                 :            : 
      89                 :            : using namespace ::sd::toolpanel;
      90                 :            : 
      91                 :            : #define ToolPanelViewShell
      92                 :            : #include "sdslots.hxx"
      93                 :            : 
      94                 :            : /** === begin UNO using === **/
      95                 :            : using ::com::sun::star::uno::Reference;
      96                 :            : using ::com::sun::star::uno::XInterface;
      97                 :            : using ::com::sun::star::uno::UNO_QUERY;
      98                 :            : using ::com::sun::star::uno::UNO_QUERY_THROW;
      99                 :            : using ::com::sun::star::uno::UNO_SET_THROW;
     100                 :            : using ::com::sun::star::uno::Exception;
     101                 :            : using ::com::sun::star::uno::RuntimeException;
     102                 :            : using ::com::sun::star::uno::Any;
     103                 :            : using ::com::sun::star::uno::makeAny;
     104                 :            : using ::com::sun::star::uno::Sequence;
     105                 :            : using ::com::sun::star::uno::Type;
     106                 :            : using ::com::sun::star::accessibility::XAccessible;
     107                 :            : using ::com::sun::star::drawing::XDrawSubController;
     108                 :            : using ::com::sun::star::frame::XFrame;
     109                 :            : using ::com::sun::star::drawing::framework::XResourceId;
     110                 :            : using ::com::sun::star::drawing::framework::XConfigurationChangeListener;
     111                 :            : using ::com::sun::star::drawing::framework::ConfigurationChangeEvent;
     112                 :            : using ::com::sun::star::lang::EventObject;
     113                 :            : using ::com::sun::star::lang::DisposedException;
     114                 :            : using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster;
     115                 :            : using ::com::sun::star::drawing::framework::XConfigurationController;
     116                 :            : using ::com::sun::star::drawing::framework::XConfiguration;
     117                 :            : using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT;
     118                 :            : using ::com::sun::star::ui::XUIElement;
     119                 :            : using ::com::sun::star::ui::XToolPanel;
     120                 :            : using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
     121                 :            : /** === end UNO using === **/
     122                 :            : 
     123                 :            : using ::sd::framework::FrameworkHelper;
     124                 :            : 
     125                 :            : namespace sd { namespace toolpanel {
     126                 :            : 
     127                 :            : // =====================================================================================================================
     128                 :            : // = misc helper
     129                 :            : // =====================================================================================================================
     130                 :            : // ---------------------------------------------------------------------------------------------------------------------
     131                 :        500 : PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL, const bool i_bIgnoreUnknown )
     132                 :            : {
     133                 :        500 :     PanelId ePanelId( PID_UNKNOWN );
     134                 :            : 
     135         [ +  + ]:        500 :     if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) )
     136                 :            :     {
     137                 :         52 :         ePanelId = PID_MASTER_PAGES;
     138                 :            :     }
     139         [ +  + ]:        448 :     else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) )
     140                 :            :     {
     141                 :        137 :         ePanelId = PID_LAYOUT;
     142                 :            :     }
     143         [ +  + ]:        311 :     else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) )
     144                 :            :     {
     145                 :        155 :         ePanelId = PID_TABLE_DESIGN;
     146                 :            :     }
     147         [ +  + ]:        156 :     else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) )
     148                 :            :     {
     149                 :        104 :         ePanelId = PID_CUSTOM_ANIMATION;
     150                 :            :     }
     151         [ +  - ]:         52 :     else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) )
     152                 :            :     {
     153                 :         52 :         ePanelId = PID_SLIDE_TRANSITION;
     154                 :            :     }
     155                 :            :     else
     156                 :            :     {
     157                 :            :         OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" );
     158                 :            :         (void)i_bIgnoreUnknown;
     159                 :            :     }
     160                 :            : 
     161                 :        500 :     return ePanelId;
     162                 :            : }
     163                 :            : 
     164                 :            : // ---------------------------------------------------------------------------------------------------------------------
     165                 :         98 : PanelId GetStandardPanelId( const ::rtl::OUString& i_rTaskPanelResourceURL )
     166                 :            : {
     167                 :         98 :     return GetStandardPanelId( i_rTaskPanelResourceURL, false );
     168                 :            : }
     169                 :            : 
     170                 :            : // =====================================================================================================================
     171                 :            : // = ConfigurationListener - declaration
     172                 :            : // =====================================================================================================================
     173                 :            : typedef ::cppu::WeakImplHelper1 <   XConfigurationChangeListener
     174                 :            :                                 >   ConfigurationListener_Base;
     175                 :            : 
     176                 :            : class ConfigurationListener :public ::cppu::BaseMutex
     177                 :            :                             ,public ConfigurationListener_Base
     178                 :            : {
     179                 :            : public:
     180                 :            :     ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl );
     181                 :            : 
     182                 :            :     // XConfigurationChangeListener
     183                 :            :     virtual void SAL_CALL notifyConfigurationChange( const ConfigurationChangeEvent& aEvent ) throw (RuntimeException);
     184                 :            : 
     185                 :            :     // XEventListener
     186                 :            :     virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
     187                 :            : 
     188                 :            :     // XComponent equivalents (not available per UNO interface)
     189                 :            :     void    dispose();
     190                 :            : 
     191                 :            : protected:
     192                 :            :     ~ConfigurationListener();
     193                 :            : 
     194                 :        550 :     void impl_checkDisposed_throw()
     195                 :            :     {
     196         [ -  + ]:        550 :         if ( !m_pShellImpl )
     197 [ #  # ][ #  # ]:          0 :             throw DisposedException( ::rtl::OUString(), *this );
     198                 :        550 :     }
     199                 :            : 
     200                 :            : private:
     201                 :            :     ToolPanelViewShell_Impl* m_pShellImpl;
     202                 :            : };
     203                 :            : 
     204                 :            : // =====================================================================================================================
     205                 :            : // = ToolPanelViewShell_Impl - declaration
     206                 :            : // =====================================================================================================================
     207                 :            : /** Inner implementation class of ToolPanelViewShell.
     208                 :            : */
     209                 :            : class ToolPanelViewShell_Impl   :public ::boost::noncopyable
     210                 :            :                                 ,public ::svt::IToolPanelDeckListener
     211                 :            :                                 ,public ::sfx2::IToolPanelCompare
     212                 :            : {
     213                 :            : public:
     214                 :            :     static const size_t mnInvalidId = static_cast< size_t >( -1 );
     215                 :            : 
     216                 :            :     ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent );
     217                 :            :     virtual ~ToolPanelViewShell_Impl();
     218                 :            : 
     219                 :        208 :     ToolPanelViewShell& GetAntiImpl() { return m_rPanelViewShell; }
     220                 :            : 
     221                 :            :     /** Here the panels are created that are shown in the task pane.
     222                 :            :     */
     223                 :            :     void Setup();
     224                 :            : 
     225                 :            :     /** clean up the instance
     226                 :            :     */
     227                 :            :     void Cleanup();
     228                 :            : 
     229                 :            :     /** activates the panel which has the given resource URL
     230                 :            :     */
     231                 :            :     void    ActivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
     232                 :            : 
     233                 :            :     /** de-activates the panel given by its resource URL, bypassing the configuration controller
     234                 :            : 
     235                 :            :         If the panel is not active currently, nothing happens.
     236                 :            :     */
     237                 :            :     void    DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL );
     238                 :            : 
     239                 :            :     /** provides access to the the VCL window of the panel deck
     240                 :            :     */
     241                 :        500 :           ::sfx2::ModuleTaskPane& GetTaskPane()       { return *m_pTaskPane; }
     242                 :            :     const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; }
     243                 :            : 
     244                 :        274 :           ::svt::ToolPanelDeck& GetToolPanelDeck()       { return GetTaskPane().GetPanelDeck(); }
     245                 :            :     const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); }
     246                 :            : 
     247                 :            :     Reference< XAccessible >
     248                 :            :             CreateAccessible( ::sd::Window& i_rWindow );
     249                 :            : 
     250                 :            :     void    ConnectToDockingWindow();
     251                 :            : 
     252                 :            : private:
     253                 :            :     // IToolPanelDeckListener overridables
     254                 :            :     virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
     255                 :            :     virtual void PanelRemoved( const size_t i_nPosition );
     256                 :            :     virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
     257                 :            :     virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
     258                 :            :     virtual void Dying();
     259                 :            : 
     260                 :            :     // IToolPanelCompare overridables
     261                 :            :     virtual short compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const;
     262                 :            : 
     263                 :            : private:
     264                 :         26 :     struct InitialPanel
     265                 :            :     {
     266                 :            :         ::rtl::OUString sPanelResourceURL;
     267                 :            :         bool            bActivateDirectly;
     268                 :         26 :         InitialPanel()
     269                 :            :             :sPanelResourceURL()
     270                 :         26 :             ,bActivateDirectly( true )
     271                 :            :         {
     272                 :         26 :         }
     273                 :            :     };
     274                 :            :     InitialPanel        impl_determineInitialPanel();
     275                 :            :     ::rtl::OUString     impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel );
     276                 :            : 
     277                 :            : private:
     278                 :            :     ToolPanelViewShell&                             m_rPanelViewShell;
     279                 :            :     ::boost::scoped_ptr< ::sfx2::ModuleTaskPane >   m_pTaskPane;
     280                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     281                 :            :     ::std::auto_ptr< ::sfx2::TaskPaneController >   m_pTaskPaneController;
     282                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
     283                 :            :     ::rtl::Reference< ConfigurationListener >       m_pConfigListener;
     284                 :            :     bool                                            m_bInitialized;
     285                 :            : };
     286                 :            : 
     287                 :            : // =====================================================================================================================
     288                 :            : // = ConfigurationListener - implementation
     289                 :            : // =====================================================================================================================
     290                 :            : // ---------------------------------------------------------------------------------------------------------------------
     291                 :         26 : ConfigurationListener::ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl )
     292         [ +  - ]:         26 :     :m_pShellImpl( &i_rShellImpl )
     293                 :            : {
     294 [ +  - ][ +  - ]:         26 :     ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rShellImpl.GetAntiImpl().GetViewShellBase() ) );
     295                 :         26 :     Reference< XConfigurationControllerBroadcaster > xBroadcaster;
     296         [ +  - ]:         26 :     if ( pFrameworkHelper.get() )
     297 [ +  - ][ +  - ]:         26 :         xBroadcaster.set( pFrameworkHelper->GetConfigurationController().get() );
         [ +  - ][ +  - ]
     298 [ -  + ][ #  # ]:         26 :     ENSURE_OR_THROW( pFrameworkHelper.get(), "no access to the config controller" );
         [ #  # ][ #  # ]
     299                 :            : 
     300         [ +  - ]:         26 :     osl_incrementInterlockedCount( &m_refCount );
     301                 :            :     {
     302 [ +  - ][ +  - ]:         26 :         xBroadcaster->addConfigurationChangeListener( this, ::rtl::OUString(), Any() );
                 [ +  - ]
     303                 :            :     }
     304 [ +  - ][ +  - ]:         26 :     osl_decrementInterlockedCount( &m_refCount );
     305                 :         26 : }
     306                 :            : 
     307                 :            : // ---------------------------------------------------------------------------------------------------------------------
     308         [ +  - ]:         26 : ConfigurationListener::~ConfigurationListener()
     309                 :            : {
     310         [ -  + ]:         52 : }
     311                 :            : 
     312                 :            : // ---------------------------------------------------------------------------------------------------------------------
     313                 :        524 : void SAL_CALL ConfigurationListener::notifyConfigurationChange( const ConfigurationChangeEvent& i_rEvent ) throw (RuntimeException)
     314                 :            : {
     315         [ +  - ]:        524 :     ::osl::MutexGuard aGuard( m_aMutex );
     316         [ +  - ]:        524 :     impl_checkDisposed_throw();
     317                 :            : 
     318                 :            :     // is this an event we're interested in?
     319         [ +  + ]:        524 :     if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent )
     320                 :            :         return;
     321                 :            : 
     322                 :            :     // is this a resource we're interested in? Must be anchored in the task pane ...
     323                 :         16 :     Reference< XResourceId > xAnchorId;
     324         [ +  - ]:         16 :     if ( i_rEvent.ResourceId.is() )
     325 [ +  - ][ +  - ]:         16 :         xAnchorId = i_rEvent.ResourceId->getAnchor();
                 [ +  - ]
     326         [ -  + ]:         16 :     if ( !xAnchorId.is() )
     327                 :            :         return;
     328 [ +  - ][ +  - ]:         16 :     const ::rtl::OUString sAnchorURL( xAnchorId->getResourceURL() );
     329         [ -  + ]:         16 :     if ( sAnchorURL != FrameworkHelper::msTaskPaneURL )
     330                 :            :         return;
     331                 :            : 
     332 [ +  - ][ +  - ]:        524 :     m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() );
         [ +  - ][ -  + ]
         [ -  + ][ +  - ]
                 [ +  + ]
     333                 :            : }
     334                 :            : 
     335                 :            : // ---------------------------------------------------------------------------------------------------------------------
     336                 :         26 : void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
     337                 :            : {
     338                 :            :     (void)i_rEvent;
     339                 :            :     {
     340         [ +  - ]:         26 :         ::osl::MutexGuard aGuard( m_aMutex );
     341 [ +  - ][ +  - ]:         26 :         impl_checkDisposed_throw();
     342                 :            :     }
     343                 :            : 
     344                 :         26 :     dispose();
     345                 :         26 : }
     346                 :            : 
     347                 :            : // ---------------------------------------------------------------------------------------------------------------------
     348                 :         52 : void ConfigurationListener::dispose()
     349                 :            : {
     350         [ +  - ]:         52 :     ::osl::MutexGuard aGuard( m_aMutex );
     351         [ +  - ]:         52 :     m_pShellImpl = NULL;
     352                 :         52 : }
     353                 :            : 
     354                 :            : // =====================================================================================================================
     355                 :            : // = ToolPanelViewShell
     356                 :            : // =====================================================================================================================
     357                 :            : // ---------------------------------------------------------------------------------------------------------------------
     358 [ +  + ][ +  - ]:       1722 : SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL))
                 [ +  - ]
     359                 :            : {
     360                 :         25 : }
     361                 :            : 
     362                 :            : // ---------------------------------------------------------------------------------------------------------------------
     363 [ -  + ][ -  + ]:        360 : TYPEINIT1(ToolPanelViewShell, ViewShell);
     364                 :            : 
     365                 :            : // ---------------------------------------------------------------------------------------------------------------------
     366                 :         26 : ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel()
     367                 :            : {
     368                 :         26 :     InitialPanel aPanelToActivate;
     369 [ +  - ][ -  + ]:         26 :     if ( GetAntiImpl().GetViewShellBase().GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW )
                 [ +  - ]
     370                 :            :         // for Draw, rely on SFX's default handling, which is to activate the previously active panel
     371                 :          0 :         return aPanelToActivate;
     372                 :            : 
     373                 :            :     // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case,
     374                 :            :     // use that one.
     375                 :         26 :     aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL;
     376                 :         26 :     aPanelToActivate.bActivateDirectly = false;
     377                 :            :     try
     378                 :            :     {
     379 [ +  - ][ +  - ]:         26 :         ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) );
     380         [ +  - ]:         26 :         const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) );
     381 [ +  - ][ +  - ]:         26 :         Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
     382 [ +  - ][ +  - ]:         26 :         Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW );
                 [ +  - ]
     383         [ +  - ]:         26 :         Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources(
     384                 :            :             FrameworkHelper::CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ),
     385 [ +  - ][ +  - ]:         26 :             FrameworkHelper::msTaskPanelURLPrefix, AnchorBindingMode_DIRECT ) );
     386                 :            : 
     387         [ +  + ]:         26 :         if ( aViewIds.getLength() > 0 )
     388                 :            :         {
     389 [ +  - ][ +  - ]:          6 :             const ::rtl::OUString sResourceURL( aViewIds[0]->getResourceURL() );
                 [ +  - ]
     390                 :          6 :             PanelId nRequestedPanel = GetStandardPanelId( sResourceURL );
     391         [ +  - ]:          6 :             if ( nRequestedPanel != PID_UNKNOWN )
     392                 :            :             {
     393                 :          6 :                 aPanelToActivate.sPanelResourceURL = sResourceURL;
     394                 :          6 :                 aPanelToActivate.bActivateDirectly = true;
     395                 :          6 :             }
     396 [ +  - ][ +  - ]:         26 :         }
                 [ #  # ]
     397                 :            :     }
     398         [ #  # ]:          0 :     catch( const Exception& )
     399                 :            :     {
     400                 :            :         DBG_UNHANDLED_EXCEPTION();
     401                 :            :     }
     402                 :         26 :     return aPanelToActivate;
     403                 :            : }
     404                 :            : 
     405                 :            : // ---------------------------------------------------------------------------------------------------------------------
     406                 :         30 : void ToolPanelViewShell_Impl::Setup()
     407                 :            : {
     408         [ +  + ]:         30 :     if ( m_bInitialized )
     409                 :         30 :         return;
     410                 :         26 :     m_bInitialized = true;
     411                 :            : 
     412                 :            :     // initially activate a panel
     413         [ +  - ]:         26 :     const InitialPanel aInitialPanel = impl_determineInitialPanel();
     414         [ +  - ]:         26 :     if ( !aInitialPanel.sPanelResourceURL.isEmpty() )
     415                 :            :     {
     416         [ +  + ]:         26 :         if ( aInitialPanel.bActivateDirectly )
     417                 :            :         {
     418         [ +  - ]:          6 :             ActivatePanelByResource( aInitialPanel.sPanelResourceURL );
     419                 :            :         }
     420                 :            :         else
     421                 :            :         {
     422 [ +  - ][ +  - ]:         20 :             ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
     423 [ +  - ][ +  - ]:         20 :             pFrameworkHelper->RequestTaskPanel( aInitialPanel.sPanelResourceURL );
     424                 :            :         }
     425                 :            :     }
     426                 :            : 
     427                 :            :     // listen at the configuration
     428         [ +  - ]:         26 :     m_pConfigListener.set( new ConfigurationListener( *this ) );
     429                 :            : 
     430         [ +  - ]:         30 :     m_pTaskPane->Show();
     431                 :            : }
     432                 :            : 
     433                 :            : // ---------------------------------------------------------------------------------------------------------------------
     434                 :         26 : void ToolPanelViewShell_Impl::Cleanup()
     435                 :            : {
     436         [ +  - ]:         26 :     if ( m_bInitialized )
     437                 :            :     {
     438         [ +  - ]:         26 :         if ( m_pConfigListener.is() )
     439                 :         26 :             m_pConfigListener->dispose();
     440                 :            :     }
     441                 :         26 :     GetToolPanelDeck().RemoveListener( *this );
     442                 :         26 :     m_pTaskPaneController.reset();
     443                 :         26 :     m_pTaskPane.reset();
     444                 :         26 : }
     445                 :            : 
     446                 :            : // ---------------------------------------------------------------------------------------------------------------------
     447                 :         22 : void ToolPanelViewShell_Impl::ActivatePanelByResource( const ::rtl::OUString& i_rResourceURL )
     448                 :            : {
     449                 :            :     // determine position of the requested panel
     450 [ +  - ][ +  - ]:         22 :     ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL );
     451                 :            :     OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
     452 [ +  - ][ +  - ]:         22 :     if ( !!aPanelPos )
     453 [ +  - ][ +  - ]:         22 :         GetToolPanelDeck().ActivatePanel( *aPanelPos );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     454                 :         22 : }
     455                 :            : 
     456                 :            : // ---------------------------------------------------------------------------------------------------------------------
     457                 :          6 : void ToolPanelViewShell_Impl::DeactivatePanelByResource( const ::rtl::OUString& i_rPanelResourceURL )
     458                 :            : {
     459                 :            :     // determine position of the requested panel
     460 [ +  - ][ +  - ]:          6 :     ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL );
     461                 :            :     OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
     462 [ +  - ][ +  - ]:          6 :     if ( !!aPanelPos )
     463                 :            :     {
     464 [ +  - ][ +  - ]:          6 :         if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos )
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
     465 [ #  # ][ #  # ]:          0 :             GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() );
         [ #  # ][ #  # ]
     466         [ +  - ]:          6 :     }
     467                 :          6 : }
     468                 :            : 
     469                 :            : // ---------------------------------------------------------------------------------------------------------------------
     470                 :         30 : void ToolPanelViewShell::Initialize()
     471                 :            : {
     472                 :         30 :     mpImpl->Setup();
     473                 :         30 : }
     474                 :            : 
     475                 :            : // ---------------------------------------------------------------------------------------------------------------------
     476                 :         26 : ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow,
     477                 :            :         FrameView* pFrameViewArgument )
     478                 :            :     :ViewShell(pFrame, pParentWindow, rViewShellBase)
     479         [ +  - ]:         52 :     ,mpImpl( new ToolPanelViewShell_Impl( *this, *mpContentWindow.get() ) )
     480                 :            :     ,mpSubShellManager()
     481 [ +  - ][ +  - ]:         78 :     ,mnMenuId(0)
     482                 :            : {
     483         [ +  - ]:         26 :     doShow();
     484                 :            : 
     485                 :         26 :     meShellType = ST_TASK_PANE;
     486                 :            : 
     487         [ +  - ]:         26 :     mpContentWindow->SetCenterAllowed( false );
     488 [ +  - ][ +  - ]:         26 :     pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL );
     489                 :            : 
     490 [ +  - ][ +  - ]:         26 :     GetParentWindow()->SetBackground( Wallpaper() );
                 [ +  - ]
     491 [ +  - ][ +  - ]:         26 :     mpContentWindow->SetBackground( Wallpaper() );
                 [ +  - ]
     492                 :            : 
     493         [ +  - ]:         26 :     GetParentWindow()->SetHelpId(HID_SD_TASK_PANE);
     494                 :            : 
     495         [ +  - ]:         26 :     mpImpl->ConnectToDockingWindow();
     496                 :            : 
     497         [ +  - ]:         26 :     SetPool( &GetDoc()->GetPool() );
     498                 :            : 
     499         [ -  + ]:         26 :     if ( pFrameViewArgument )
     500                 :          0 :         mpFrameView = pFrameViewArgument;
     501                 :            :     else
     502 [ +  - ][ +  - ]:         26 :         mpFrameView = new FrameView( GetDoc() );
                 [ +  - ]
     503 [ +  - ][ +  - ]:         26 :     GetFrameView()->Connect();
     504                 :            : 
     505                 :            :     // Hide or delete unused controls that we have inherited from the
     506                 :            :     // ViewShell base class.
     507         [ +  - ]:         26 :     mpHorizontalScrollBar.reset();
     508         [ +  - ]:         26 :     mpVerticalScrollBar.reset();
     509         [ +  - ]:         26 :     mpScrollBarBox.reset();
     510                 :         26 :     mpHorizontalRuler.reset();
     511                 :         26 :     mpVerticalRuler.reset();
     512                 :            : 
     513 [ +  - ][ +  - ]:         26 :     SetName( rtl::OUString( "ToolPanelViewShell" ) );
                 [ +  - ]
     514                 :            : 
     515                 :            :     // enforce the creation of the Accessible object here.
     516                 :            :     // In some not-always-to-reproduce situations, creating the accessible on demand only leads to some
     517                 :            :     // cycliy parenthood references between the involved objects, which make some AT tools (accerciser, in particular)
     518                 :            :     // loop (which is /not/ a bug in the tool, of course).
     519                 :            :     // However, since those situations were not reproducible anymore, we deliberately leave the Accessible creation
     520                 :            :     // (which originally was intended as a workaround) herein. Better to be safe ...
     521                 :            :     // Note that this is not a performance problem: The implementation of the ToolPanelDeck's Accessible
     522                 :            :     // is separated from the implementation of its AccessibleContext (which even is in a separate library) - we only
     523                 :            :     // create the former here, the latter is still created on demand, when somebody requests it.
     524                 :            :     // #i113671# / 2010-09-17 / frank.schoenheit@oracle.com
     525         [ +  - ]:         26 :     if (mpContentWindow.get())
     526         [ +  - ]:         26 :         mpContentWindow->GetAccessible( sal_True );
     527                 :            : 
     528                 :            :     // For accessibility we have to shortly hide the content window.  This
     529                 :            :     // triggers the construction of a new accessibility object for the new
     530                 :            :     // view shell.  (One is created earlier while the construtor of the base
     531                 :            :     // class is executed.  At that time the correct accessibility object can
     532                 :            :     // not be constructed.)
     533         [ +  - ]:         26 :     if (mpContentWindow.get())
     534                 :            :     {
     535         [ +  - ]:         26 :         mpContentWindow->Hide();
     536         [ +  - ]:         26 :         mpContentWindow->Show();
     537                 :            :     }
     538                 :            : 
     539                 :            :     // Register the shell manager as factory at the ViewShellManager.
     540                 :            :     mpSubShellManager.reset( new TaskPaneShellManager(
     541         [ +  - ]:         26 :         GetViewShellBase().GetViewShellManager(),
     542                 :            :         *this
     543 [ +  - ][ +  - ]:         26 :     ) );
         [ +  - ][ +  - ]
                 [ +  - ]
     544 [ +  - ][ +  - ]:         26 :     GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     545                 :         26 : }
     546                 :            : 
     547                 :            : // ---------------------------------------------------------------------------------------------------------------------
     548 [ +  - ][ +  - ]:         26 : ToolPanelViewShell::~ToolPanelViewShell()
     549                 :            : {
     550         [ +  - ]:         26 :     mpImpl->Cleanup();
     551                 :            : 
     552                 :            :     // reset our impl before destroying the panel deck, to ensure the hidden panels are properly
     553                 :            :     // disposed/destroyed, too
     554         [ +  - ]:         26 :     mpImpl.reset();
     555 [ +  - ][ +  - ]:         26 :     GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager);
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     556 [ +  - ][ +  - ]:         26 :     GetFrameView()->Disconnect();
     557         [ -  + ]:         52 : }
     558                 :            : 
     559                 :            : // ---------------------------------------------------------------------------------------------------------------------
     560                 :            : // static
     561                 :         25 : void ToolPanelViewShell::RegisterControls()
     562                 :            : {
     563                 :         25 :     SfxModule* pModule = SD_MOD();
     564                 :         25 :     controls::MasterPagesSelector::RegisterInterface( pModule );
     565                 :         25 :     LayoutMenu::RegisterInterface( pModule );
     566                 :         25 : }
     567                 :            : 
     568                 :            : // ---------------------------------------------------------------------------------------------------------------------
     569                 :         30 : void ToolPanelViewShell::ArrangeGUIElements()
     570                 :            : {
     571                 :         30 :     ViewShell::ArrangeGUIElements();
     572                 :            : 
     573                 :         30 :     Initialize();
     574                 :            : 
     575         [ +  - ]:         30 :     mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize );
     576                 :         30 : }
     577                 :            : 
     578                 :            : // ---------------------------------------------------------------------------------------------------------------------
     579                 :          0 : void ToolPanelViewShell::GetFocus()
     580                 :            : {
     581                 :          0 :     Invalidate();
     582                 :          0 : }
     583                 :            : 
     584                 :            : // ---------------------------------------------------------------------------------------------------------------------
     585                 :          0 : void ToolPanelViewShell::LoseFocus()
     586                 :            : {
     587                 :          0 :     Invalidate();
     588                 :          0 : }
     589                 :            : 
     590                 :            : // ---------------------------------------------------------------------------------------------------------------------
     591                 :          0 : void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent )
     592                 :            : {
     593                 :          0 :     const KeyCode nCode = i_rKeyEvent.GetKeyCode();
     594 [ #  # ][ #  # ]:          0 :     if ( nCode == KEY_RETURN )
     595                 :            :     {
     596 [ #  # ][ #  # ]:          0 :         if ( !mpImpl->GetTaskPane().HasChildPathFocus() )
                 [ #  # ]
     597 [ #  # ][ #  # ]:          0 :             mpImpl->GetTaskPane().GrabFocus();
     598                 :            :     }
     599                 :            :     else
     600         [ #  # ]:          0 :         ViewShell::KeyInput( i_rKeyEvent, NULL );
     601                 :          0 : }
     602                 :            : 
     603                 :            : // ---------------------------------------------------------------------------------------------------------------------
     604                 :         26 : SdPage* ToolPanelViewShell::GetActualPage()
     605                 :            : {
     606                 :         26 :     return NULL;
     607                 :            : }
     608                 :            : 
     609                 :            : // ---------------------------------------------------------------------------------------------------------------------
     610                 :          0 : SdPage* ToolPanelViewShell::getCurrentPage() const
     611                 :            : {
     612                 :          0 :     return NULL;
     613                 :            : }
     614                 :            : 
     615                 :            : // ---------------------------------------------------------------------------------------------------------------------
     616                 :         15 : TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const
     617                 :            : {
     618                 :         15 :     return *mpSubShellManager.get();
     619                 :            : }
     620                 :            : 
     621                 :            : // ---------------------------------------------------------------------------------------------------------------------
     622                 :         78 : DockingWindow* ToolPanelViewShell::GetDockingWindow()
     623                 :            : {
     624                 :         78 :     ::Window* pParentWindow = GetParentWindow();
     625                 :         78 :     DockingWindow* pDockingWindow = NULL;
     626 [ +  + ][ +  + ]:        234 :     while (pParentWindow!=NULL && pDockingWindow==NULL)
                 [ +  + ]
     627                 :            :     {
     628         [ -  + ]:        156 :         pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow);
     629                 :        156 :         pParentWindow = pParentWindow->GetParent();
     630                 :            :     }
     631                 :         78 :     return pDockingWindow;
     632                 :            : }
     633                 :            : 
     634                 :            : // ---------------------------------------------------------------------------------------------------------------------
     635                 :         26 : Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow )
     636                 :            : {
     637         [ -  + ]:         26 :     ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL );
     638                 :         26 :     return mpImpl->CreateAccessible( *i_pWindow );
     639                 :            : }
     640                 :            : 
     641                 :            : // ---------------------------------------------------------------------------------------------------------------------
     642                 :          0 : Reference< XDrawSubController > ToolPanelViewShell::CreateSubController()
     643                 :            : {
     644                 :            :     // This view shell is not designed to be the main view shell and thus
     645                 :            :     // does not support a UNO sub controller.
     646                 :          0 :     return Reference< XDrawSubController >();
     647                 :            : }
     648                 :            : 
     649                 :            : // ---------------------------------------------------------------------------------------------------------------------
     650                 :         26 : bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow )
     651                 :            : {
     652                 :         26 :     ::Window* pOldParentWindow = GetParentWindow();
     653                 :         26 :     FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() );
     654                 :         26 :     FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow );
     655                 :            : 
     656         [ -  + ]:         26 :     PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() );
     657         [ +  - ]:         26 :     if ( pDockingWindow != NULL )
     658                 :            :     {
     659                 :         26 :         pDockingWindow->SetEndDockingHdl( Link() );
     660                 :            :     }
     661                 :            : 
     662                 :         26 :     ViewShell::RelocateToParentWindow(pParentWindow);
     663                 :            : 
     664                 :         26 :     mpImpl->ConnectToDockingWindow();
     665                 :            : 
     666                 :         26 :     Resize();
     667                 :            : 
     668                 :         26 :     return true;
     669                 :            : }
     670                 :            : 
     671                 :            : //---------------------------------------------------------------------------------------------------------------------
     672                 :         32 : bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const
     673                 :            : {
     674                 :         32 :     return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow;
     675                 :            : }
     676                 :            : 
     677                 :            : //---------------------------------------------------------------------------------------------------------------------
     678                 :            : namespace
     679                 :            : {
     680                 :            :     typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
     681                 :            : 
     682                 :         32 :     struct PanelFactory
     683                 :            :     {
     684                 :            :         ControlFactoryFactory   pFactory;
     685                 :            :         rtl::OString            sHelpID;
     686                 :         32 :         PanelFactory( const ControlFactoryFactory i_pFactory, const rtl::OString& i_nHelpID )
     687                 :            :             :pFactory( i_pFactory )
     688                 :         32 :             ,sHelpID( i_nHelpID )
     689                 :            :         {
     690                 :         32 :         }
     691                 :            :     };
     692                 :            : 
     693                 :         32 :     const PanelFactory lcl_describePanel( const PanelId i_ePanelId )
     694                 :            :     {
     695   [ -  +  +  -  :         32 :         switch ( i_ePanelId )
                   -  - ]
     696                 :            :         {
     697                 :            :         case PID_MASTER_PAGES:
     698                 :          0 :             return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS );
     699                 :            :         case PID_LAYOUT:
     700                 :         15 :             return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS );
     701                 :            :         case PID_TABLE_DESIGN:
     702                 :         17 :             return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN );
     703                 :            :         case PID_CUSTOM_ANIMATION:
     704                 :          0 :             return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS );
     705                 :            :         case PID_SLIDE_TRANSITION:
     706                 :          0 :             return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS );
     707                 :            :         default:
     708                 :          0 :             break;
     709                 :            :         }
     710 [ #  # ][ #  # ]:         32 :         throw RuntimeException( "illegal panel ID" , NULL );
     711                 :            :     }
     712                 :            : }
     713                 :            : 
     714                 :            : //---------------------------------------------------------------------------------------------------------------------
     715                 :         32 : Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const ::rtl::OUString& i_rPanelResourceURL )
     716                 :            : {
     717                 :         32 :     const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) );
     718 [ #  # ][ -  + ]:         32 :     ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL );
     719                 :            : 
     720                 :            :     // a TreeNode which will resemble the panel
     721         [ +  - ]:         32 :     const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) );
     722                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     723 [ +  - ][ +  - ]:         32 :     ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) );
     724 [ +  - ][ +  - ]:         32 :     ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) );
         [ +  - ][ +  - ]
     725                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
     726 [ +  - ][ +  - ]:         32 :     ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ),
         [ -  + ][ -  + ]
         [ #  # ][ #  # ]
                 [ #  # ]
     727                 :            :         "illegal node returned by the control factory" );
     728 [ +  - ][ +  - ]:         32 :     pNode->GetWindow()->SetHelpId( aPanelFactory.sHelpID );
     729                 :            : 
     730                 :            :     // create an XToolPanel
     731 [ +  - ][ +  - ]:         32 :     Reference< XToolPanel > xPanel( new ToolPanel( pNode ) );
                 [ +  - ]
     732                 :            : 
     733                 :            :     // create an XUIElement providing this panel
     734 [ +  - ][ +  - ]:         32 :     const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) );
                 [ +  - ]
     735                 :            : 
     736 [ +  - ][ +  - ]:         32 :     return xUIElement;
     737                 :            : }
     738                 :            : 
     739                 :            : // ---------------------------------------------------------------------------------------------------------------------
     740                 :          0 : void ToolPanelViewShell::ActivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
     741                 :            : {
     742                 :            :     OSL_ENSURE( i_rPanelResourceURL.indexOf( FrameworkHelper::msTaskPanelURLPrefix ) < 0,
     743                 :            :         "ToolPanelViewShell::ActivatePanel: for drawing-framework-controller panels, please use FrameworkHelper::RequestTaskPanel!" );
     744                 :          0 :     mpImpl->ActivatePanelByResource( i_rPanelResourceURL );
     745                 :          0 : }
     746                 :            : 
     747                 :            : // ---------------------------------------------------------------------------------------------------------------------
     748                 :          6 : void ToolPanelViewShell::DeactivatePanel( const ::rtl::OUString& i_rPanelResourceURL )
     749                 :            : {
     750                 :          6 :     mpImpl->DeactivatePanelByResource( i_rPanelResourceURL );
     751                 :          6 : }
     752                 :            : 
     753                 :            : // =====================================================================================================================
     754                 :            : // = ToolPanelViewShell_Impl - implementation
     755                 :            : // =====================================================================================================================
     756                 :            : // ---------------------------------------------------------------------------------------------------------------------
     757                 :         26 : ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
     758                 :            :     :m_rPanelViewShell( i_rPanelViewShell )
     759 [ +  - ][ +  - ]:         52 :     ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface(), *this ) )
                 [ +  - ]
     760 [ +  - ][ +  - ]:         78 :     ,m_bInitialized( false )
     761                 :            : {
     762 [ +  - ][ +  - ]:         26 :     const String sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
     763 [ +  - ][ +  - ]:         26 :     GetToolPanelDeck().SetAccessibleName( sPaneTitle );
     764 [ +  - ][ +  - ]:         26 :     GetToolPanelDeck().SetAccessibleDescription( sPaneTitle );
     765                 :            : 
     766 [ +  - ][ +  - ]:         26 :     GetToolPanelDeck().AddListener( *this );
                 [ +  - ]
     767                 :         26 : }
     768                 :            : 
     769                 :            : // ---------------------------------------------------------------------------------------------------------------------
     770 [ +  - ][ +  - ]:         26 : ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl()
     771                 :            : {
     772         [ -  + ]:         52 : }
     773                 :            : 
     774                 :            : // ---------------------------------------------------------------------------------------------------------------------
     775                 :          0 : void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
     776                 :            : {
     777                 :            :     // not interested in
     778                 :            :     (void)i_pPanel;
     779                 :            :     (void)i_nPosition;
     780                 :          0 : }
     781                 :            : 
     782                 :            : // ---------------------------------------------------------------------------------------------------------------------
     783                 :          0 : void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition )
     784                 :            : {
     785                 :            :     // not interested in
     786                 :            :     (void)i_nPosition;
     787                 :          0 : }
     788                 :            : 
     789                 :            : // ---------------------------------------------------------------------------------------------------------------------
     790                 :         64 : ::rtl::OUString ToolPanelViewShell_Impl::impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel )
     791                 :            : {
     792                 :         64 :     ::rtl::OUString sPanelURL;
     793 [ +  + ][ +  - ]:         64 :     if ( !!i_rPanel )
     794                 :            :     {
     795 [ +  - ][ +  - ]:         38 :         sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rPanel );
                 [ +  - ]
     796                 :         38 :         const PanelId ePanelId( GetStandardPanelId( sPanelURL, true ) );
     797         [ -  + ]:         38 :         if ( ePanelId == PID_UNKNOWN )
     798                 :          0 :             sPanelURL = ::rtl::OUString();
     799                 :            :     }
     800                 :         64 :     return sPanelURL;
     801                 :            : }
     802                 :            : 
     803                 :            : // ---------------------------------------------------------------------------------------------------------------------
     804                 :         32 : void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
     805                 :            : {
     806                 :            :     // update the configuration controller, since this change in the active panel might have been triggered by means other
     807                 :            :     // than the drawing framework, so it does not yet know about it.
     808                 :            : 
     809         [ +  - ]:         32 :     const ::rtl::OUString sOldPanelURL( impl_getPanelURL( i_rOldActive ) );
     810         [ +  - ]:         32 :     const ::rtl::OUString sNewPanelURL( impl_getPanelURL( i_rNewActive ) );
     811                 :            : 
     812 [ +  - ][ +  - ]:         32 :     const ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
     813         [ +  - ]:         32 :     if ( !sNewPanelURL.isEmpty() )
     814                 :            :     {
     815                 :            :         // activate the resource belonging to the new panel. This will automatically de-activate the previously active
     816                 :            :         // panel resource (since ResourceActivationMode_REPLACE is used)
     817         [ +  - ]:         32 :         pFrameworkHelper->RequestTaskPanel( sNewPanelURL );
     818                 :            :     }
     819         [ #  # ]:          0 :     else if ( !sOldPanelURL.isEmpty() )
     820                 :            :     {
     821                 :            :         // there is no new active panel, or it is not one of our standard panels, i.e. it is not covered by the
     822                 :            :         // resource framework. => Deactivate the old resource.
     823                 :            :         try
     824                 :            :         {
     825 [ #  # ][ #  # ]:          0 :             Reference< XConfigurationController > xConfigController( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
     826         [ #  # ]:          0 :             xConfigController->requestResourceDeactivation(
     827                 :          0 :                 pFrameworkHelper->CreateResourceId(
     828                 :            :                     sOldPanelURL,
     829                 :            :                     FrameworkHelper::msTaskPaneURL,
     830                 :            :                     FrameworkHelper::msRightPaneURL
     831                 :            :                 )
     832 [ #  # ][ #  # ]:          0 :             );
                 [ #  # ]
     833                 :            :         }
     834         [ #  # ]:          0 :         catch( const Exception& )
     835                 :            :         {
     836                 :            :             DBG_UNHANDLED_EXCEPTION();
     837                 :            :         }
     838         [ +  - ]:         32 :     }
     839                 :         32 : }
     840                 :            : 
     841                 :            : // ---------------------------------------------------------------------------------------------------------------------
     842                 :          0 : void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
     843                 :            : {
     844                 :            :     // not interested in
     845                 :            :     (void)i_rNewLayouter;
     846                 :          0 : }
     847                 :            : 
     848                 :            : // ---------------------------------------------------------------------------------------------------------------------
     849                 :          0 : void ToolPanelViewShell_Impl::Dying()
     850                 :            : {
     851                 :            :     // not interested in
     852                 :          0 : }
     853                 :            : 
     854                 :            : // ---------------------------------------------------------------------------------------------------------------------
     855                 :        182 : short ToolPanelViewShell_Impl::compareToolPanelsURLs( const ::rtl::OUString& i_rLHS, const ::rtl::OUString& i_rRHS ) const
     856                 :            : {
     857                 :        182 :     const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) );
     858                 :        182 :     const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) );
     859         [ +  + ]:        182 :     if ( eLHS < eRHS )
     860                 :        130 :         return -1;
     861         [ -  + ]:         52 :     if ( eLHS == eRHS )
     862                 :          0 :         return 0;
     863                 :        182 :     return 1;
     864                 :            : }
     865                 :            : 
     866                 :            : // ---------------------------------------------------------------------------------------------------------------------
     867                 :         52 : void ToolPanelViewShell_Impl::ConnectToDockingWindow()
     868                 :            : {
     869                 :         52 :     m_pTaskPaneController.reset();
     870                 :         52 :     DockingWindow* pDockingWindow( GetAntiImpl().GetDockingWindow() );
     871         [ +  + ]:         52 :     if ( pDockingWindow )
     872                 :            :     {
     873         [ -  + ]:         26 :         PaneDockingWindow* pPaneDockingWindow = dynamic_cast< PaneDockingWindow* >( pDockingWindow );
     874                 :            :         OSL_ENSURE( pPaneDockingWindow, "ToolPanelViewShell_Impl::ConnectToDockingWindow: unsupported docking window type!" );
     875         [ +  - ]:         26 :         if ( pPaneDockingWindow != NULL )
     876         [ +  - ]:         26 :             m_pTaskPaneController.reset( new ::sfx2::TaskPaneController( GetTaskPane(), *pPaneDockingWindow ) );
     877                 :            :     }
     878                 :            : 
     879                 :            :     // Tell the focus manager that we want to pass the focus to our
     880                 :            :     // child.
     881                 :         52 :     FocusManager::Instance().RegisterDownLink( GetAntiImpl().GetParentWindow(), &GetTaskPane() );
     882                 :         52 : }
     883                 :            : 
     884                 :            : // ---------------------------------------------------------------------------------------------------------------------
     885                 :         26 : Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow )
     886                 :            : {
     887 [ +  - ][ +  - ]:         26 :     Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( sal_False ) );
     888         [ +  - ]:         26 :     if ( !xAccessible.is() )
     889                 :            :     {
     890                 :            :         // determine the XAccessible which is the parent of the to-be-created object
     891         [ +  - ]:         26 :         ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow();
     892                 :            :         OSL_ENSURE( pAccessibleParent, "ToolPanelViewShell_Impl::CreateAccessible: illegal accessible parent provided by the sd::Window!" );
     893 [ +  - ][ +  - ]:         26 :         GetToolPanelDeck().SetAccessibleParentWindow( pAccessibleParent );
     894                 :            : 
     895 [ +  - ][ +  - ]:         26 :         xAccessible = GetToolPanelDeck().GetAccessible( sal_True );
                 [ +  - ]
     896 [ #  # ][ -  + ]:         26 :         ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL );
     897                 :            :         OSL_ENSURE( xAccessible->getAccessibleContext().is()
     898                 :            :                 &&  xAccessible->getAccessibleContext()->getAccessibleParent() == pAccessibleParent->GetAccessible(),
     899                 :            :                 "ToolPanelViewShell_Impl::CreateAccessible: illegal parenthood!" );
     900                 :            :     }
     901                 :         26 :     return xAccessible;
     902                 :            : }
     903                 :            : 
     904                 :            : } } // end of namespace ::sd::toolpanel
     905                 :            : 
     906                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10