LCOV - code coverage report
Current view: top level - sd/source/ui/view - ViewShellBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 232 565 41.1 %
Date: 2012-08-25 Functions: 39 76 51.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 245 1029 23.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <comphelper/processfactory.hxx>
      30                 :            : 
      31                 :            : #include <com/sun/star/frame/UnknownModuleException.hpp>
      32                 :            : #include <com/sun/star/frame/XModuleManager.hpp>
      33                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      34                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      35                 :            : 
      36                 :            : #include "ViewShellBase.hxx"
      37                 :            : #include <algorithm>
      38                 :            : #include "EventMultiplexer.hxx"
      39                 :            : #include "cache/SlsPageCacheManager.hxx"
      40                 :            : #include "sdresid.hxx"
      41                 :            : #include "app.hrc"
      42                 :            : #include "strings.hrc"
      43                 :            : #include "glob.hrc"
      44                 :            : #include "unokywds.hxx"
      45                 :            : #include <svx/svxids.hrc>
      46                 :            : #include "DrawDocShell.hxx"
      47                 :            : #include <sfx2/app.hxx>
      48                 :            : #include "PaneChildWindows.hxx"
      49                 :            : #include "ViewShellManager.hxx"
      50                 :            : #include "DrawController.hxx"
      51                 :            : #include "FrameView.hxx"
      52                 :            : #include "ViewTabBar.hxx"
      53                 :            : #include <sfx2/event.hxx>
      54                 :            : #include "drawdoc.hxx"
      55                 :            : #include <sfx2/dispatch.hxx>
      56                 :            : #include <sfx2/request.hxx>
      57                 :            : #include <sfx2/printer.hxx>
      58                 :            : #include "DrawViewShell.hxx"
      59                 :            : #include "GraphicViewShell.hxx"
      60                 :            : #include "OutlineViewShell.hxx"
      61                 :            : #include "SlideSorterViewShell.hxx"
      62                 :            : #include "PresentationViewShell.hxx"
      63                 :            : #include "FormShellManager.hxx"
      64                 :            : #include "ToolBarManager.hxx"
      65                 :            : #include "taskpane/PanelId.hxx"
      66                 :            : #include "Window.hxx"
      67                 :            : #include "framework/ConfigurationController.hxx"
      68                 :            : #include "DocumentRenderer.hxx"
      69                 :            : 
      70                 :            : #include <com/sun/star/frame/XFrame.hpp>
      71                 :            : #include <com/sun/star/awt/XWindow.hpp>
      72                 :            : #include <com/sun/star/frame/XController.hpp>
      73                 :            : #include <com/sun/star/frame/XModel.hpp>
      74                 :            : #include <com/sun/star/document/XViewDataSupplier.hpp>
      75                 :            : #include <com/sun/star/container/XIndexAccess.hpp>
      76                 :            : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
      77                 :            : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
      78                 :            : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
      79                 :            : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
      80                 :            : #include <com/sun/star/drawing/framework/ResourceId.hpp>
      81                 :            : #include "framework/FrameworkHelper.hxx"
      82                 :            : 
      83                 :            : #include <rtl/ref.hxx>
      84                 :            : #include <sfx2/msg.hxx>
      85                 :            : #include <sfx2/objface.hxx>
      86                 :            : #include <sfx2/viewfrm.hxx>
      87                 :            : #include <svl/whiter.hxx>
      88                 :            : #include <vcl/msgbox.hxx>
      89                 :            : #include <tools/diagnose_ex.h>
      90                 :            : 
      91                 :            : #include "fubullet.hxx"
      92                 :            : 
      93                 :            : using namespace sd;
      94                 :            : #define ViewShellBase
      95                 :            : #include "sdslots.hxx"
      96                 :            : 
      97                 :            : using ::sd::framework::FrameworkHelper;
      98                 :            : using ::rtl::OUString;
      99                 :            : using namespace com::sun::star::uno;
     100                 :            : using namespace com::sun::star::frame;
     101                 :            : using namespace com::sun::star::container;
     102                 :            : using namespace com::sun::star::lang;
     103                 :            : using namespace com::sun::star::beans;
     104                 :            : 
     105                 :            : namespace {
     106                 :            : 
     107                 :            : class CurrentPageSetter
     108                 :            : {
     109                 :            : public:
     110                 :            :     CurrentPageSetter (ViewShellBase& rBase);
     111                 :            :     void operator () (bool);
     112                 :            : private:
     113                 :            :     ViewShellBase& mrBase;
     114                 :            : };
     115                 :            : 
     116                 :            : } // end of anonymous namespace
     117                 :            : 
     118                 :            : 
     119                 :            : using namespace ::com::sun::star;
     120                 :            : using namespace ::com::sun::star::uno;
     121                 :            : using namespace ::com::sun::star::drawing::framework;
     122                 :            : using ::sd::framework::FrameworkHelper;
     123                 :            : 
     124                 :            : namespace sd {
     125                 :            : 
     126                 :            : class ViewShellBase::Implementation
     127                 :            : {
     128                 :            : public:
     129                 :            :     /** Main controller of the view shell.  During the switching from one
     130                 :            :         stacked shell to another this pointer may be NULL.
     131                 :            :     */
     132                 :            :     ::rtl::Reference<DrawController> mpController;
     133                 :            : 
     134                 :            :     /** The view tab bar is the control for switching between different
     135                 :            :         views in one pane.
     136                 :            :     */
     137                 :            :     ::rtl::Reference<ViewTabBar> mpViewTabBar;
     138                 :            : 
     139                 :            :     // contains the complete area of the current view relative to the frame window
     140                 :            :     Rectangle maClientArea;
     141                 :            : 
     142                 :            :     // This is set to true when PrepareClose() is called.
     143                 :            :     bool mbIsClosing;
     144                 :            : 
     145                 :            :     /** The view window is the parent of all UI elements that belong to the
     146                 :            :         view or ViewShell.  This comprises the rulers, the scroll bars, and
     147                 :            :         the content window.
     148                 :            :         It does not include the ViewTabBar.
     149                 :            :     */
     150                 :            :     ::boost::scoped_ptr< ::Window> mpViewWindow;
     151                 :            :     ::boost::shared_ptr<ToolBarManager> mpToolBarManager;
     152                 :            :     ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
     153                 :            :     ::boost::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer;
     154                 :            :     ::boost::shared_ptr<FormShellManager> mpFormShellManager;
     155                 :            : 
     156                 :            :     Implementation (ViewShellBase& rBase);
     157                 :            :     ~Implementation (void);
     158                 :            : 
     159                 :            :     void LateInit (void);
     160                 :            : 
     161                 :            :     /** Show or hide the ViewTabBar.
     162                 :            :         @param bShow
     163                 :            :             When <TRUE/> then the ViewTabBar is shown, otherwise it is hidden.
     164                 :            :     */
     165                 :            :     void ShowViewTabBar (bool bShow);
     166                 :            : 
     167                 :            :     /** Common code of ViewShellBase::OuterResizePixel() and
     168                 :            :         ViewShellBase::InnerResizePixel().
     169                 :            :     */
     170                 :            :     void ResizePixel (
     171                 :            :         const Point& rOrigin,
     172                 :            :         const Size& rSize,
     173                 :            :         bool bOuterResize);
     174                 :            : 
     175                 :            :     /** Show or hide the specified pane.  The visibility state is taken
     176                 :            :         fromthe given request.
     177                 :            :         @param rRequest
     178                 :            :             The request determines the new visibility state.  The state can
     179                 :            :             either be toggled or be set to a given value.
     180                 :            :         @param rsPaneURL
     181                 :            :             This URL specifies the pane whose visibility state to set.
     182                 :            :         @param rsViewURL
     183                 :            :             When the pane becomes visible then this view URL specifies which
     184                 :            :             type of view to show in it.
     185                 :            :     */
     186                 :            :     void SetPaneVisibility (
     187                 :            :         const SfxRequest& rRequest,
     188                 :            :         const ::rtl::OUString& rsPaneURL,
     189                 :            :         const ::rtl::OUString& rsViewURL);
     190                 :            : 
     191                 :            :     void GetSlotState (SfxItemSet& rSet);
     192                 :            : 
     193                 :            :     void ProcessRestoreEditingViewSlot (void);
     194                 :            :     void ProcessTaskPaneSlot (SfxRequest& rRequest);
     195                 :            : 
     196                 :            : private:
     197                 :            :     ViewShellBase& mrBase;
     198                 :            : 
     199                 :            :     /** Hold a reference to the page cache manager of the slide sorter in
     200                 :            :         order to ensure that it stays alive while the ViewShellBase is
     201                 :            :         alive.
     202                 :            :     */
     203                 :            :     ::boost::shared_ptr<slidesorter::cache::PageCacheManager> mpPageCacheManager;
     204                 :            : };
     205                 :            : 
     206                 :            : 
     207                 :            : namespace {
     208                 :            : /** The only task of this window is to forward key presses to the content
     209                 :            :     window of the main view shell.  With the key press it forwards the focus
     210                 :            :     so that it is not called very often.
     211                 :            : */
     212                 :            : class FocusForwardingWindow : public ::Window
     213                 :            : {
     214                 :            : public:
     215                 :            :     FocusForwardingWindow (::Window& rParentWindow, ViewShellBase& rBase);
     216                 :            :     virtual ~FocusForwardingWindow (void);
     217                 :            :     virtual void KeyInput (const KeyEvent& rEvent);
     218                 :            :     virtual void Command (const CommandEvent& rEvent);
     219                 :            : 
     220                 :            : private:
     221                 :            :     ViewShellBase& mrBase;
     222                 :            : };
     223                 :            : } // end of anonymous namespace
     224                 :            : 
     225                 :            : 
     226                 :            : //===== ViewShellBase =========================================================
     227                 :            : 
     228 [ +  + ][ +  + ]:       5811 : TYPEINIT1(ViewShellBase, SfxViewShell);
     229                 :            : 
     230                 :            : // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
     231                 :            : // new ViewShellBase object has been constructed.
     232                 :            : 
     233                 :            : SfxViewFactory* ViewShellBase::pFactory;
     234                 :          0 : SfxViewShell* ViewShellBase::CreateInstance (
     235                 :            :     SfxViewFrame *pFrame, SfxViewShell *pOldView)
     236                 :            : {
     237         [ #  # ]:          0 :     ViewShellBase* pBase = new ViewShellBase(pFrame, pOldView);
     238         [ #  # ]:          0 :     pBase->LateInit("");
     239                 :          0 :     return pBase;
     240                 :            : }
     241                 :          0 : void ViewShellBase::RegisterFactory( sal_uInt16 nPrio )
     242                 :            : {
     243         [ #  # ]:          0 :     pFactory = new SfxViewFactory( &CreateInstance,nPrio,"Default" );
     244                 :          0 :     InitFactory();
     245                 :          0 : }
     246                 :          0 : void ViewShellBase::InitFactory()
     247                 :            : {
     248                 :          0 :     SFX_VIEW_REGISTRATION(DrawDocShell);
     249                 :          0 : }
     250                 :            : 
     251                 :            : 
     252                 :            : 
     253 [ +  + ][ +  - ]:      10258 : SFX_IMPL_INTERFACE(ViewShellBase, SfxViewShell, SdResId(0))
         [ +  - ][ +  - ]
     254                 :            : {
     255                 :         25 : }
     256                 :            : 
     257                 :            : 
     258                 :            : 
     259                 :            : 
     260                 :        130 : ViewShellBase::ViewShellBase (
     261                 :            :     SfxViewFrame* _pFrame,
     262                 :            :     SfxViewShell*)
     263                 :            :     : SfxViewShell (_pFrame,
     264                 :            :           SFX_VIEW_CAN_PRINT
     265                 :            :         | SFX_VIEW_HAS_PRINTOPTIONS),
     266                 :            :       maMutex(),
     267                 :            :       mpImpl(),
     268                 :            :       mpDocShell (NULL),
     269         [ +  - ]:        130 :       mpDocument (NULL)
     270                 :            : {
     271 [ +  - ][ +  - ]:        130 :     mpImpl.reset(new Implementation(*this));
                 [ +  - ]
     272 [ +  - ][ +  - ]:        130 :     mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this));
         [ +  - ][ +  - ]
     273 [ +  - ][ +  - ]:        130 :     mpImpl->mpViewWindow->SetBackground(Wallpaper());
                 [ +  - ]
     274                 :            : 
     275 [ +  - ][ +  - ]:        130 :     _pFrame->GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
         [ +  - ][ +  - ]
                 [ +  - ]
     276                 :            : 
     277                 :            :     // Set up the members in the correct order.
     278 [ +  - ][ +  - ]:        130 :     if (GetViewFrame()->GetObjectShell()->ISA(DrawDocShell))
         [ +  - ][ +  - ]
     279                 :            :         mpDocShell = static_cast<DrawDocShell*>(
     280         [ +  - ]:        130 :             GetViewFrame()->GetObjectShell());
     281         [ +  - ]:        130 :     if (mpDocShell != NULL)
     282         [ +  - ]:        130 :         mpDocument = mpDocShell->GetDoc();
     283 [ +  - ][ +  - ]:        130 :     mpImpl->mpViewShellManager.reset(new ViewShellManager(*this));
                 [ +  - ]
     284                 :            : 
     285         [ +  - ]:        130 :     SetWindow(mpImpl->mpViewWindow.get());
     286                 :            : 
     287                 :            :     // Hide the window to avoid complaints from Sfx...SwitchViewShell...
     288 [ +  - ][ +  - ]:        130 :     _pFrame->GetWindow().Hide();
     289                 :        130 : }
     290                 :            : 
     291                 :            : 
     292                 :            : 
     293                 :            : 
     294                 :            : /** In this destructor the order in which some of the members are destroyed
     295                 :            :     (and/or being prepared to being destroyed) is important.  Change it only
     296                 :            :     when you know what you are doing.
     297                 :            : */
     298 [ +  - ][ +  - ]:        130 : ViewShellBase::~ViewShellBase (void)
     299                 :            : {
     300                 :            :     // Tell the controller that the ViewShellBase is not available anymore.
     301         [ +  - ]:        130 :     if (mpImpl->mpController.get() != NULL)
     302         [ +  - ]:        130 :         mpImpl->mpController->ReleaseViewShellBase();
     303                 :            : 
     304                 :            :     // We have to hide the main window to prevent SFX complaining after a
     305                 :            :     // reload about it being already visible.
     306 [ +  - ][ +  - ]:        130 :     ViewShell* pShell = GetMainViewShell().get();
     307 [ -  + ][ #  # ]:        130 :     if (pShell!=NULL
         [ #  # ][ -  + ]
     308         [ #  # ]:          0 :         && pShell->GetActiveWindow()!=NULL
     309 [ #  # ][ #  # ]:          0 :         && pShell->GetActiveWindow()->GetParent()!=NULL)
     310                 :            :     {
     311 [ #  # ][ #  # ]:          0 :         pShell->GetActiveWindow()->GetParent()->Hide();
                 [ #  # ]
     312                 :            :     }
     313                 :            : 
     314         [ +  - ]:        130 :     mpImpl->mpToolBarManager->Shutdown();
     315         [ +  - ]:        130 :     mpImpl->mpViewShellManager->Shutdown();
     316                 :            : 
     317         [ +  - ]:        130 :     EndListening(*GetViewFrame());
     318         [ +  - ]:        130 :     EndListening(*GetDocShell());
     319                 :            : 
     320         [ +  - ]:        130 :     SetWindow(NULL);
     321         [ -  + ]:        130 : }
     322                 :            : 
     323                 :            : 
     324                 :            : 
     325                 :            : 
     326                 :        130 : void ViewShellBase::LateInit (const ::rtl::OUString& rsDefaultView)
     327                 :            : {
     328                 :        130 :     StartListening(*GetViewFrame(),sal_True);
     329                 :        130 :     StartListening(*GetDocShell(),sal_True);
     330                 :        130 :     mpImpl->LateInit();
     331                 :        130 :     InitializeFramework();
     332                 :            : 
     333         [ +  - ]:        130 :     mpImpl->mpEventMultiplexer.reset(new tools::EventMultiplexer (*this));
     334                 :            : 
     335         [ +  - ]:        130 :     mpImpl->mpFormShellManager.reset(new FormShellManager(*this));
     336                 :            : 
     337                 :        130 :     mpImpl->mpToolBarManager = ToolBarManager::Create(
     338                 :            :         *this,
     339                 :        130 :         mpImpl->mpEventMultiplexer,
     340         [ +  - ]:        390 :         mpImpl->mpViewShellManager);
     341                 :            : 
     342                 :            :     try
     343                 :            :     {
     344 [ +  - ][ +  - ]:        130 :         Reference<XControllerManager> xControllerManager (GetDrawController(), UNO_QUERY_THROW);
                 [ +  - ]
     345                 :            :         Reference<XConfigurationController> xConfigurationController (
     346 [ +  - ][ +  - ]:        130 :             xControllerManager->getConfigurationController());
     347         [ +  - ]:        130 :         if (xConfigurationController.is())
     348                 :            :         {
     349                 :        130 :             OUString sView (rsDefaultView);
     350         [ +  + ]:        130 :             if (sView.isEmpty())
     351         [ +  - ]:         26 :                 sView = GetInitialViewShellType();
     352                 :            : 
     353         [ +  - ]:        130 :             ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(*this));
     354                 :            : 
     355                 :            :             // Create the resource ids for the center pane and view.
     356                 :            :             const Reference<drawing::framework::XResourceId> xCenterPaneId (
     357         [ +  - ]:        130 :                 pHelper->CreateResourceId(FrameworkHelper::msCenterPaneURL));
     358                 :            :             const Reference<drawing::framework::XResourceId> xCenterViewId (
     359         [ +  - ]:        130 :                 pHelper->CreateResourceId(sView, xCenterPaneId));
     360                 :            : 
     361                 :            :             // Request center pane and view.
     362 [ +  - ][ +  - ]:        130 :             xConfigurationController->requestResourceActivation(xCenterPaneId, ResourceActivationMode_ADD);
     363 [ +  - ][ +  - ]:        130 :             xConfigurationController->requestResourceActivation(xCenterViewId, ResourceActivationMode_REPLACE);
     364                 :            : 
     365                 :            :             // Process configuration events synchronously until the center view
     366                 :            :             // has been created.
     367                 :            :             sd::framework::ConfigurationController* pConfigurationController
     368 [ +  - ][ -  + ]:        130 :                 = dynamic_cast<sd::framework::ConfigurationController*>(xConfigurationController.get());
     369         [ +  - ]:        130 :             if (pConfigurationController != NULL)
     370                 :            :             {
     371 [ +  + ][ +  - ]:       2184 :                 while (
                 [ +  + ]
     372 [ +  - ][ +  - ]:       1456 :                     ! pConfigurationController->getResource(xCenterViewId).is()
                 [ #  # ]
     373         [ +  - ]:        598 :                         && pConfigurationController->hasPendingRequests())
     374                 :            :                 {
     375         [ +  - ]:        598 :                     pConfigurationController->ProcessEvent();
     376                 :            :                 }
     377         [ +  - ]:        130 :             }
     378         [ #  # ]:        130 :         }
     379                 :            :     }
     380                 :          0 :     catch (const RuntimeException&)
     381                 :            :     {
     382                 :            :     }
     383                 :            : 
     384                 :            :     // AutoLayouts have to be ready.
     385                 :        130 :     GetDocument()->StopWorkStartupDelay();
     386                 :            : 
     387                 :        130 :     UpdateBorder();
     388                 :            : 
     389                 :            :     // Remember the type of the current main view shell in the frame view.
     390                 :        130 :     ViewShell* pViewShell = GetMainViewShell().get();
     391         [ +  - ]:        130 :     if (pViewShell != NULL)
     392                 :            :     {
     393                 :        130 :         FrameView* pFrameView = pViewShell->GetFrameView();
     394         [ +  - ]:        130 :         if (pFrameView != NULL)
     395                 :        130 :             pFrameView->SetViewShellTypeOnLoad(pViewShell->GetShellType());
     396                 :            :     }
     397                 :        130 : }
     398                 :            : 
     399                 :            : 
     400                 :            : 
     401                 :            : 
     402                 :      10469 : ::boost::shared_ptr<ViewShellManager> ViewShellBase::GetViewShellManager (void) const
     403                 :            : {
     404                 :      10469 :     return mpImpl->mpViewShellManager;
     405                 :            : }
     406                 :            : 
     407                 :            : 
     408                 :            : 
     409                 :            : 
     410                 :       7669 : ::boost::shared_ptr<ViewShell> ViewShellBase::GetMainViewShell (void) const
     411                 :            : {
     412                 :            :     ::boost::shared_ptr<ViewShell> pMainViewShell (
     413                 :            :         framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))
     414 [ +  - ][ +  - ]:       7669 :             ->GetViewShell(framework::FrameworkHelper::msCenterPaneURL));
     415         [ +  + ]:       7669 :     if (pMainViewShell.get() == NULL)
     416                 :            :         pMainViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))
     417 [ +  - ][ +  - ]:       1296 :             ->GetViewShell(framework::FrameworkHelper::msFullScreenPaneURL);
         [ +  - ][ +  - ]
                 [ +  - ]
     418                 :       7669 :     return pMainViewShell;
     419                 :            : }
     420                 :            : 
     421                 :            : 
     422                 :            : 
     423                 :            : 
     424                 :        817 : ViewShellBase* ViewShellBase::GetViewShellBase (SfxViewFrame* pViewFrame)
     425                 :            : {
     426                 :        817 :     ViewShellBase* pBase = NULL;
     427                 :            : 
     428         [ +  - ]:        817 :     if (pViewFrame != NULL)
     429                 :            :     {
     430                 :            :         // Get the view shell for the frame and cast it to
     431                 :            :         // sd::ViewShellBase.
     432                 :        817 :         SfxViewShell* pSfxViewShell = pViewFrame->GetViewShell();
     433 [ +  + ][ +  + ]:        817 :         if (pSfxViewShell!=NULL && pSfxViewShell->ISA(::sd::ViewShellBase))
                 [ +  - ]
     434                 :        815 :             pBase = static_cast<ViewShellBase*>(pSfxViewShell);
     435                 :            :     }
     436                 :            : 
     437                 :        817 :     return pBase;
     438                 :            : }
     439                 :            : 
     440                 :            : 
     441                 :            : 
     442                 :            : 
     443                 :      34817 : DrawDocShell* ViewShellBase::GetDocShell (void) const
     444                 :            : {
     445                 :      34817 :     return mpDocShell;
     446                 :            : }
     447                 :            : 
     448                 :            : 
     449                 :            : 
     450                 :      52169 : SdDrawDocument* ViewShellBase::GetDocument (void) const
     451                 :            : {
     452                 :      52169 :     return mpDocument;
     453                 :            : }
     454                 :            : 
     455                 :            : 
     456                 :            : 
     457                 :            : 
     458                 :      11012 : void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     459                 :            : {
     460                 :      11012 :     SfxViewShell::Notify(rBC, rHint);
     461                 :            : 
     462         [ +  + ]:      11012 :     if (rHint.IsA(TYPE(SfxEventHint)))
     463                 :            :     {
     464         [ +  + ]:       1568 :         switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
     465                 :            :         {
     466                 :            :             case SFX_EVENT_OPENDOC:
     467 [ +  - ][ -  + ]:          8 :                 if( GetDocument() && GetDocument()->IsStartWithPresentation() )
                 [ -  + ]
     468                 :            :                 {
     469         [ #  # ]:          0 :                     if( GetViewFrame() )
     470                 :            :                     {
     471                 :            :                         GetViewFrame()->GetDispatcher()->Execute(
     472                 :          0 :                             SID_PRESENTATION, SFX_CALLMODE_ASYNCHRON );
     473                 :            :                     }
     474                 :            :                 }
     475                 :          8 :                 break;
     476                 :            : 
     477                 :            :             default:
     478                 :       1568 :                 break;
     479                 :            :         }
     480                 :            :     }
     481                 :      11012 : }
     482                 :            : 
     483                 :            : 
     484                 :            : 
     485                 :            : 
     486                 :          0 : void ViewShellBase::InitializeFramework (void)
     487                 :            : {
     488                 :          0 : }
     489                 :            : 
     490                 :            : 
     491                 :            : 
     492                 :            : 
     493                 :          0 : void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize)
     494                 :            : {
     495 [ #  # ][ #  # ]:          0 :     Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
                 [ #  # ]
     496 [ #  # ][ #  # ]:          0 :     if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
                 [ #  # ]
     497                 :            :     {
     498         [ #  # ]:          0 :         SvBorder aBorder( GetBorderPixel() );
     499                 :          0 :         Size aSize( rSize );
     500                 :          0 :         aSize.Width() -= (aBorder.Left() + aBorder.Right());
     501                 :          0 :         aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
     502 [ #  # ][ #  # ]:          0 :         Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel( aObjSize, MAP_100TH_MM );
                 [ #  # ]
     503                 :            :         SfxViewShell::SetZoomFactor(
     504         [ #  # ]:          0 :             Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ),
     505         [ #  # ]:          0 :             Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) );
           [ #  #  #  # ]
                 [ #  # ]
     506                 :            :     }
     507                 :            : 
     508         [ #  # ]:          0 :     mpImpl->ResizePixel(rOrigin, rSize, false);
     509                 :          0 : }
     510                 :            : 
     511                 :            : 
     512                 :            : 
     513                 :            : 
     514                 :        428 : void ViewShellBase::OuterResizePixel (const Point& rOrigin, const Size &rSize)
     515                 :            : {
     516                 :        428 :     mpImpl->ResizePixel (rOrigin, rSize, true);
     517                 :        428 : }
     518                 :            : 
     519                 :            : 
     520                 :            : 
     521                 :            : 
     522                 :          0 : void ViewShellBase::Rearrange (void)
     523                 :            : {
     524                 :            :     OSL_ASSERT(GetViewFrame()!=NULL);
     525                 :            : 
     526                 :            :     // There is a bug in the communication between embedded objects and the
     527                 :            :     // framework::LayoutManager that leads to missing resize updates.  The
     528                 :            :     // following workaround enforces such an update by cycling the border to
     529                 :            :     // zero and back to the current value.
     530         [ #  # ]:          0 :     if (GetWindow() != NULL)
     531                 :            :     {
     532         [ #  # ]:          0 :         SetBorderPixel(SvBorder());
     533                 :          0 :         UpdateBorder(true);
     534                 :            :     }
     535                 :            :     else
     536                 :            :     {
     537                 :            :         OSL_TRACE("Rearrange: window missing");
     538                 :            :     }
     539                 :            : 
     540                 :          0 :     GetViewFrame()->Resize(sal_True);
     541                 :          0 : }
     542                 :            : 
     543                 :            : 
     544                 :            : 
     545                 :            : 
     546                 :          0 : ErrCode ViewShellBase::DoVerb (long nVerb)
     547                 :            : {
     548                 :          0 :     ErrCode aResult = ERRCODE_NONE;
     549                 :            : 
     550                 :          0 :     ::sd::ViewShell* pShell = GetMainViewShell().get();
     551         [ #  # ]:          0 :     if (pShell != NULL)
     552                 :          0 :         aResult = pShell->DoVerb (nVerb);
     553                 :            : 
     554                 :          0 :     return aResult;
     555                 :            : }
     556                 :            : 
     557                 :            : 
     558                 :            : 
     559                 :            : 
     560                 :          0 : Reference<view::XRenderable> ViewShellBase::GetRenderable (void)
     561                 :            : {
     562                 :            :     // Create a new DocumentRenderer on every call.  It observes the life
     563                 :            :     // time of this ViewShellBase object.
     564 [ #  # ][ #  # ]:          0 :     return Reference<view::XRenderable>(new DocumentRenderer(*this));
     565                 :            : }
     566                 :            : 
     567                 :            : 
     568                 :            : 
     569                 :            : 
     570                 :        587 : SfxPrinter* ViewShellBase::GetPrinter (sal_Bool bCreate)
     571                 :            : {
     572                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
     573                 :            : 
     574                 :        587 :     return GetDocShell()->GetPrinter (bCreate);
     575                 :            : }
     576                 :            : 
     577                 :            : 
     578                 :            : 
     579                 :            : 
     580                 :          0 : sal_uInt16 ViewShellBase::SetPrinter (
     581                 :            :     SfxPrinter* pNewPrinter,
     582                 :            :     sal_uInt16 nDiffFlags,
     583                 :            :     bool bIsAPI)
     584                 :            : {
     585                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
     586                 :            : 
     587                 :          0 :     GetDocShell()->SetPrinter(pNewPrinter);
     588                 :            : 
     589 [ #  # ][ #  # ]:          0 :     if ( (nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ||
                 [ #  # ]
     590                 :            :           nDiffFlags & SFX_PRINTER_CHG_SIZE) && pNewPrinter  )
     591                 :            :     {
     592         [ #  # ]:          0 :         MapMode aMap = pNewPrinter->GetMapMode();
     593         [ #  # ]:          0 :         aMap.SetMapUnit(MAP_100TH_MM);
     594         [ #  # ]:          0 :         MapMode aOldMap = pNewPrinter->GetMapMode();
     595         [ #  # ]:          0 :         pNewPrinter->SetMapMode(aMap);
     596         [ #  # ]:          0 :         Size aNewSize = pNewPrinter->GetOutputSize();
     597                 :            : 
     598                 :          0 :         sal_Bool bScaleAll = sal_False;
     599         [ #  # ]:          0 :         if ( bIsAPI )
     600                 :            :         {
     601                 :            :             WarningBox aWarnBox (
     602                 :            :                 GetWindow(),
     603                 :            :                 (WinBits)(WB_YES_NO | WB_DEF_YES),
     604 [ #  # ][ #  # ]:          0 :                 String(SdResId(STR_SCALE_OBJS_TO_PAGE)));
         [ #  # ][ #  # ]
     605 [ #  # ][ #  # ]:          0 :             bScaleAll = (aWarnBox.Execute() == RET_YES);
     606                 :            :         }
     607                 :            : 
     608                 :            :         ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
     609 [ #  # ][ #  # ]:          0 :             ::boost::dynamic_pointer_cast<DrawViewShell>(GetMainViewShell()));
                 [ #  # ]
     610         [ #  # ]:          0 :         if (pDrawViewShell)
     611                 :            :         {
     612                 :            :             SdPage* pPage = GetDocument()->GetSdPage(
     613         [ #  # ]:          0 :                 0, PK_STANDARD );
     614                 :          0 :             pDrawViewShell->SetPageSizeAndBorder (
     615                 :            :                 pDrawViewShell->GetPageKind(),
     616                 :            :                 aNewSize,
     617                 :            :                 -1,-1,-1,-1,
     618                 :            :                 bScaleAll,
     619                 :            :                 pNewPrinter->GetOrientation(),
     620                 :          0 :                 pPage->GetPaperBin(),
     621 [ #  # ][ #  # ]:          0 :                 pPage->IsBackgroundFullSize());
     622                 :            :         }
     623                 :            : 
     624 [ #  # ][ #  # ]:          0 :         pNewPrinter->SetMapMode(aOldMap);
         [ #  # ][ #  # ]
     625                 :            :     }
     626                 :            : 
     627                 :          0 :     return 0;
     628                 :            : }
     629                 :            : 
     630                 :            : 
     631                 :            : 
     632                 :            : 
     633                 :          0 : SfxTabPage*  ViewShellBase::CreatePrintOptionsPage(
     634                 :            :     ::Window *pParent,
     635                 :            :     const SfxItemSet &rOptions)
     636                 :            : {
     637                 :            :     (void)pParent;
     638                 :            :     (void)rOptions;
     639                 :          0 :     return NULL;
     640                 :            : }
     641                 :            : 
     642                 :            : 
     643                 :            : 
     644                 :            : 
     645                 :          0 : void ViewShellBase::UIActivating( SfxInPlaceClient* pClient )
     646                 :            : {
     647                 :          0 :     mpImpl->ShowViewTabBar(false);
     648                 :            : 
     649                 :          0 :     ViewShell* pViewShell = GetMainViewShell().get();
     650         [ #  # ]:          0 :     if ( pViewShell )
     651                 :          0 :         pViewShell->UIActivating( pClient );
     652                 :            : 
     653                 :          0 :     SfxViewShell::UIActivating( pClient );
     654                 :          0 : }
     655                 :            : 
     656                 :            : 
     657                 :            : 
     658                 :            : 
     659                 :          0 : void ViewShellBase::UIDeactivated( SfxInPlaceClient* pClient )
     660                 :            : {
     661                 :          0 :     SfxViewShell::UIDeactivated( pClient );
     662                 :            : 
     663                 :          0 :     mpImpl->ShowViewTabBar(true);
     664                 :            : 
     665                 :          0 :     ViewShell* pViewShell = GetMainViewShell().get();
     666         [ #  # ]:          0 :     if ( pViewShell )
     667                 :          0 :         pViewShell->UIDeactivated( pClient );
     668                 :          0 : }
     669                 :            : 
     670                 :            : 
     671                 :            : 
     672                 :            : 
     673                 :        558 : SvBorder ViewShellBase::GetBorder (bool )
     674                 :            : {
     675                 :        558 :     int nTop = 0;
     676 [ +  + ][ +  - ]:        558 :     if (mpImpl->mpViewTabBar.is() && mpImpl->mpViewTabBar->GetTabControl()->IsVisible())
         [ +  - ][ +  - ]
                 [ +  + ]
           [ +  +  #  # ]
     677                 :        135 :         nTop = mpImpl->mpViewTabBar->GetHeight();
     678                 :        558 :     return SvBorder(0,nTop,0,0);
     679                 :            : }
     680                 :            : 
     681                 :            : 
     682                 :            : 
     683                 :            : 
     684                 :          0 : void ViewShellBase::Execute (SfxRequest& rRequest)
     685                 :            : {
     686                 :          0 :     sal_uInt16 nSlotId = rRequest.GetSlot();
     687                 :            : 
     688   [ #  #  #  #  :          0 :     switch (nSlotId)
             #  #  #  #  
                      # ]
     689                 :            :     {
     690                 :            :         case SID_SWITCH_SHELL:
     691                 :            :         {
     692 [ #  # ][ #  # ]:          0 :             Reference<XControllerManager> xControllerManager (GetController(), UNO_QUERY);
     693         [ #  # ]:          0 :             if (xControllerManager.is())
     694                 :            :             {
     695                 :            :                 Reference<XConfigurationController> xConfigurationController (
     696 [ #  # ][ #  # ]:          0 :                     xControllerManager->getConfigurationController());
     697         [ #  # ]:          0 :                 if (xConfigurationController.is())
     698 [ #  # ][ #  # ]:          0 :                     xConfigurationController->update();
     699                 :          0 :             }
     700                 :            :         }
     701                 :          0 :         break;
     702                 :            : 
     703                 :            :         case SID_LEFT_PANE_DRAW:
     704                 :            :             mpImpl->SetPaneVisibility(
     705                 :            :                 rRequest,
     706                 :            :                 framework::FrameworkHelper::msLeftDrawPaneURL,
     707                 :          0 :                 framework::FrameworkHelper::msSlideSorterURL);
     708                 :          0 :             break;
     709                 :            : 
     710                 :            :         case SID_LEFT_PANE_IMPRESS:
     711                 :            :             mpImpl->SetPaneVisibility(
     712                 :            :                 rRequest,
     713                 :            :                 framework::FrameworkHelper::msLeftImpressPaneURL,
     714                 :          0 :                 framework::FrameworkHelper::msSlideSorterURL);
     715                 :          0 :             break;
     716                 :            : 
     717                 :            :         case SID_TASKPANE:
     718                 :            :             mpImpl->SetPaneVisibility(
     719                 :            :                 rRequest,
     720                 :            :                 framework::FrameworkHelper::msRightPaneURL,
     721                 :          0 :                 framework::FrameworkHelper::msTaskPaneURL);
     722                 :          0 :             break;
     723                 :            : 
     724                 :            :         case SID_NORMAL_MULTI_PANE_GUI:
     725                 :            :         case SID_SLIDE_SORTER_MULTI_PANE_GUI:
     726                 :            :         case SID_DRAWINGMODE:
     727                 :            :         case SID_DIAMODE:
     728                 :            :         case SID_OUTLINEMODE:
     729                 :            :         case SID_NOTESMODE:
     730                 :            :         case SID_HANDOUTMODE:
     731         [ #  # ]:          0 :             framework::FrameworkHelper::Instance(*this)->HandleModeChangeSlot(nSlotId, rRequest);
     732                 :          0 :             break;
     733                 :            : 
     734                 :            :         case SID_WIN_FULLSCREEN:
     735                 :            :             // The full screen mode is not supported.  Ignore the request.
     736                 :          0 :             break;
     737                 :            : 
     738                 :            :         case SID_SHOW_TOOL_PANEL:
     739                 :          0 :             mpImpl->ProcessTaskPaneSlot(rRequest);
     740                 :          0 :             break;
     741                 :            : 
     742                 :            :         case SID_RESTORE_EDITING_VIEW:
     743                 :          0 :             mpImpl->ProcessRestoreEditingViewSlot();
     744                 :          0 :             break;
     745                 :            : 
     746                 :            :         default:
     747                 :            :             // Ignore any other slot.
     748                 :          0 :             rRequest.Ignore ();
     749                 :          0 :             break;
     750                 :            :     }
     751                 :          0 : }
     752                 :            : 
     753                 :            : 
     754                 :            : 
     755                 :            : 
     756                 :          0 : void ViewShellBase::GetState (SfxItemSet& rSet)
     757                 :            : {
     758                 :          0 :     mpImpl->GetSlotState(rSet);
     759                 :            : 
     760                 :          0 :     FuBullet::GetSlotState( rSet, 0, GetViewFrame() );
     761                 :          0 : }
     762                 :            : 
     763                 :            : 
     764                 :            : 
     765                 :            : 
     766                 :        134 : void ViewShellBase::WriteUserDataSequence (
     767                 :            :     ::com::sun::star::uno::Sequence <
     768                 :            :     ::com::sun::star::beans::PropertyValue >& rSequence,
     769                 :            :     sal_Bool bBrowse)
     770                 :            : {
     771                 :            :     // Forward call to main sub shell.
     772                 :        134 :     ViewShell* pShell = GetMainViewShell().get();
     773         [ +  - ]:        134 :     if (pShell != NULL)
     774                 :        134 :         pShell->WriteUserDataSequence (rSequence, bBrowse);
     775                 :        134 : }
     776                 :            : 
     777                 :            : 
     778                 :            : 
     779                 :            : 
     780                 :        130 : void ViewShellBase::ReadUserDataSequence (
     781                 :            :     const ::com::sun::star::uno::Sequence <
     782                 :            :     ::com::sun::star::beans::PropertyValue >& rSequence,
     783                 :            :     sal_Bool bBrowse)
     784                 :            : {
     785                 :            :     // Forward call to main sub shell.
     786                 :        130 :     ViewShell* pShell = GetMainViewShell().get();
     787         [ +  - ]:        130 :     if (pShell != NULL)
     788                 :            :     {
     789                 :        130 :         pShell->ReadUserDataSequence (rSequence, bBrowse);
     790                 :            : 
     791                 :            :         // For certain shell types ReadUserDataSequence may have changed the
     792                 :            :         // type to another one.  Make sure that the center pane shows the
     793                 :            :         // right view shell.
     794         [ +  + ]:        130 :         switch (pShell->GetShellType())
     795                 :            :         {
     796                 :            :             case ViewShell::ST_IMPRESS:
     797                 :            :             case ViewShell::ST_NOTES:
     798                 :            :             case ViewShell::ST_HANDOUT:
     799                 :            :             {
     800                 :         26 :                 ::rtl::OUString sViewURL;
     801 [ +  - ][ +  - ]:         26 :                 switch (PTR_CAST(DrawViewShell, pShell)->GetPageKind())
                 [ +  - ]
              [ +  -  - ]
                 [ +  - ]
     802                 :            :                 {
     803                 :            :                     default:
     804                 :            :                     case PK_STANDARD:
     805                 :         26 :                         sViewURL = framework::FrameworkHelper::msImpressViewURL;
     806                 :         26 :                         break;
     807                 :            :                     case PK_NOTES:
     808                 :          0 :                         sViewURL = framework::FrameworkHelper::msNotesViewURL;
     809                 :          0 :                         break;
     810                 :            :                     case PK_HANDOUT:
     811                 :          0 :                         sViewURL = framework::FrameworkHelper::msHandoutViewURL;
     812                 :          0 :                         break;
     813                 :            :                 }
     814         [ +  - ]:         26 :                 if (!sViewURL.isEmpty())
     815                 :            :                     framework::FrameworkHelper::Instance(*this)->RequestView(
     816                 :            :                         sViewURL,
     817 [ +  - ][ +  - ]:         26 :                         framework::FrameworkHelper::msCenterPaneURL);
                 [ +  - ]
     818                 :            :             }
     819                 :         26 :             break;
     820                 :            : 
     821                 :            :             default:
     822                 :        130 :                 break;
     823                 :            :         }
     824                 :            :     }
     825                 :        130 : }
     826                 :            : 
     827                 :            : 
     828                 :            : 
     829                 :            : 
     830                 :        130 : void ViewShellBase::Activate (sal_Bool bIsMDIActivate)
     831                 :            : {
     832         [ +  - ]:        130 :     SfxViewShell::Activate(bIsMDIActivate);
     833                 :            : 
     834 [ +  - ][ +  - ]:        130 :     Reference<XControllerManager> xControllerManager (GetController(), UNO_QUERY);
     835         [ +  - ]:        130 :     if (xControllerManager.is())
     836                 :            :     {
     837                 :            :         Reference<XConfigurationController> xConfigurationController (
     838 [ +  - ][ +  - ]:        130 :             xControllerManager->getConfigurationController());
     839         [ +  - ]:        130 :         if (xConfigurationController.is())
     840 [ +  - ][ +  - ]:        130 :             xConfigurationController->update();
     841                 :            :     }
     842 [ +  - ][ +  - ]:        130 :     GetToolBarManager()->RequestUpdate();
                 [ +  - ]
     843                 :        130 : }
     844                 :            : 
     845                 :            : 
     846                 :            : 
     847                 :            : 
     848                 :        130 : void ViewShellBase::Deactivate (sal_Bool bIsMDIActivate)
     849                 :            : {
     850                 :        130 :     SfxViewShell::Deactivate(bIsMDIActivate);
     851                 :        130 : }
     852                 :            : 
     853                 :            : 
     854                 :            : 
     855                 :            : 
     856                 :          0 : void ViewShellBase::SetZoomFactor (
     857                 :            :     const Fraction &rZoomX,
     858                 :            :     const Fraction &rZoomY)
     859                 :            : {
     860                 :          0 :     SfxViewShell::SetZoomFactor (rZoomX, rZoomY);
     861                 :            :     // Forward call to main sub shell.
     862                 :          0 :     ViewShell* pShell = GetMainViewShell().get();
     863         [ #  # ]:          0 :     if (pShell != NULL)
     864                 :          0 :         pShell->SetZoomFactor (rZoomX, rZoomY);
     865                 :          0 : }
     866                 :            : 
     867                 :            : 
     868                 :            : 
     869                 :            : 
     870                 :        260 : sal_uInt16 ViewShellBase::PrepareClose (sal_Bool bUI, sal_Bool bForBrowsing)
     871                 :            : {
     872                 :        260 :     sal_uInt16 nResult = SfxViewShell::PrepareClose (bUI, bForBrowsing);
     873                 :            : 
     874         [ +  - ]:        260 :     if (nResult == sal_True)
     875                 :            :     {
     876                 :        260 :         mpImpl->mbIsClosing = true;
     877                 :            : 
     878                 :            :         // Forward call to main sub shell.
     879                 :        260 :         ViewShell* pShell = GetMainViewShell().get();
     880         [ +  - ]:        260 :         if (pShell != NULL)
     881                 :        260 :             nResult = pShell->PrepareClose (bUI, bForBrowsing);
     882                 :            :     }
     883                 :            : 
     884                 :        260 :     return nResult;
     885                 :            : }
     886                 :            : 
     887                 :            : 
     888                 :            : 
     889                 :            : 
     890                 :          0 : void ViewShellBase::WriteUserData (String& rString, sal_Bool bBrowse)
     891                 :            : {
     892                 :          0 :     SfxViewShell::WriteUserData (rString, bBrowse);
     893                 :            : 
     894                 :            :     // Forward call to main sub shell.
     895                 :          0 :     ViewShell* pShell = GetMainViewShell().get();
     896         [ #  # ]:          0 :     if (pShell != NULL)
     897                 :          0 :         pShell->WriteUserData (rString);
     898                 :          0 : }
     899                 :            : 
     900                 :            : 
     901                 :            : 
     902                 :            : 
     903                 :          0 : void ViewShellBase::ReadUserData (const String& rString, sal_Bool bBrowse)
     904                 :            : {
     905                 :          0 :     SfxViewShell::ReadUserData (rString, bBrowse);
     906                 :            : 
     907                 :            :     // Forward call to main sub shell.
     908                 :          0 :     ViewShell* pShell = GetMainViewShell().get();
     909         [ #  # ]:          0 :     if (pShell != NULL)
     910                 :          0 :         pShell->ReadUserData (rString);
     911                 :          0 : }
     912                 :            : 
     913                 :            : 
     914                 :            : 
     915                 :            : 
     916                 :        546 : SdrView* ViewShellBase::GetDrawView (void) const
     917                 :            : {
     918                 :            :     // Forward call to main sub shell.
     919                 :        546 :     ViewShell* pShell = GetMainViewShell().get();
     920         [ +  + ]:        546 :     if (pShell != NULL)
     921                 :        416 :         return pShell->GetDrawView ();
     922                 :            :     else
     923                 :        546 :         return SfxViewShell::GetDrawView();
     924                 :            : }
     925                 :            : 
     926                 :            : 
     927                 :            : 
     928                 :            : 
     929                 :          0 : void ViewShellBase::AdjustPosSizePixel (const Point &rOfs, const Size &rSize)
     930                 :            : {
     931                 :          0 :     SfxViewShell::AdjustPosSizePixel (rOfs, rSize);
     932                 :          0 : }
     933                 :            : 
     934                 :            : 
     935                 :            : 
     936                 :            : 
     937                 :          0 : void ViewShellBase::SetBusyState (bool bBusy)
     938                 :            : {
     939         [ #  # ]:          0 :     if (GetDocShell() != NULL)
     940                 :          0 :         GetDocShell()->SetWaitCursor (bBusy);
     941                 :          0 : }
     942                 :            : 
     943                 :            : 
     944                 :            : 
     945                 :            : 
     946                 :        130 : void ViewShellBase::UpdateBorder ( bool bForce /* = false */ )
     947                 :            : {
     948                 :            :     // The following calls to SetBorderPixel() and InvalidateBorder() are
     949                 :            :     // made only for the main view shell.  This not only avoids unnecessary
     950                 :            :     // calls for the views in side panes but prevents calling an already
     951                 :            :     // dying SfxViewShell base class.
     952                 :            :     // We have to check the existence of the window, too.
     953                 :            :     // The SfxViewFrame accesses the window without checking it.
     954                 :        130 :     ViewShell* pMainViewShell = GetMainViewShell().get();
     955 [ +  - ][ +  - ]:        130 :     if (pMainViewShell != NULL && GetWindow()!=NULL)
                 [ +  - ]
     956                 :            :     {
     957         [ +  - ]:        130 :         SvBorder aCurrentBorder (GetBorderPixel());
     958         [ +  - ]:        130 :         bool bOuterResize ( ! GetDocShell()->IsInPlaceActive());
     959         [ +  - ]:        130 :         SvBorder aBorder (GetBorder(bOuterResize));
     960 [ +  - ][ +  - ]:        130 :         aBorder += pMainViewShell->GetBorder(bOuterResize);
     961                 :            : 
     962 [ +  - ][ +  - ]:        130 :         if (bForce || (aBorder != aCurrentBorder))
                 [ +  - ]
     963                 :            :         {
     964         [ +  - ]:        130 :             SetBorderPixel (aBorder);
     965         [ +  - ]:        130 :             InvalidateBorder();
     966                 :            :         }
     967                 :            :     }
     968                 :        130 : }
     969                 :            : 
     970                 :            : 
     971                 :            : 
     972                 :            : 
     973                 :          0 : void ViewShellBase::ShowUIControls (bool bVisible)
     974                 :            : {
     975         [ #  # ]:          0 :     if (mpImpl->mpViewTabBar.is())
     976         [ #  # ]:          0 :         mpImpl->mpViewTabBar->GetTabControl()->Show(bVisible);
     977                 :            : 
     978                 :          0 :     ViewShell* pMainViewShell = GetMainViewShell().get();
     979         [ #  # ]:          0 :     if (pMainViewShell != NULL)
     980                 :          0 :         pMainViewShell->ShowUIControls (bVisible);
     981                 :            : 
     982                 :          0 :     UpdateBorder();
     983         [ #  # ]:          0 :     if (bVisible)
     984                 :          0 :         Rearrange();
     985                 :          0 : }
     986                 :            : 
     987                 :            : 
     988                 :            : 
     989                 :            : 
     990                 :         26 : OUString ViewShellBase::GetInitialViewShellType (void)
     991                 :            : {
     992                 :         26 :     OUString sRequestedView (FrameworkHelper::msImpressViewURL);
     993                 :            : 
     994                 :            :     do
     995                 :            :     {
     996                 :            :         Reference<document::XViewDataSupplier> xViewDataSupplier (
     997 [ +  - ][ +  - ]:         26 :             GetDocShell()->GetModel(), UNO_QUERY);
     998         [ -  + ]:         26 :         if ( ! xViewDataSupplier.is())
     999                 :            :             break;
    1000                 :            : 
    1001 [ +  - ][ +  - ]:         26 :         Reference<container::XIndexAccess> xViewData (xViewDataSupplier->getViewData());
    1002         [ +  + ]:         26 :         if ( ! xViewData.is())
    1003                 :            :             break;
    1004 [ +  - ][ +  - ]:          4 :         if (xViewData->getCount() == 0)
                 [ -  + ]
    1005                 :            :             break;
    1006                 :            : 
    1007                 :          4 :         sal_Int32 nView = 0;
    1008 [ +  - ][ +  - ]:          4 :         ::com::sun::star::uno::Any aAny = xViewData->getByIndex(nView);
    1009         [ +  - ]:          4 :         Sequence<beans::PropertyValue> aProperties;
    1010 [ +  - ][ -  + ]:          4 :         if ( ! (aAny >>= aProperties))
    1011                 :            :             break;
    1012                 :            : 
    1013                 :            :         // Search the properties for the one that tells us what page kind to
    1014                 :            :         // use.
    1015         [ +  - ]:         80 :         for (sal_Int32 n=0; n<aProperties.getLength(); n++)
    1016                 :            :         {
    1017         [ +  - ]:         76 :             const beans::PropertyValue& rProperty (aProperties[n]);
    1018         [ +  + ]:         76 :             if (rProperty.Name.compareToAscii(sUNO_View_PageKind) == COMPARE_EQUAL)
    1019                 :            :             {
    1020                 :          4 :                 sal_Int16 nPageKind = 0;
    1021                 :          4 :                 rProperty.Value >>= nPageKind;
    1022   [ +  -  -  - ]:          4 :                 switch ((PageKind)nPageKind)
    1023                 :            :                 {
    1024                 :            :                     case PK_STANDARD:
    1025                 :          4 :                         sRequestedView = FrameworkHelper::msImpressViewURL;
    1026                 :          4 :                         break;
    1027                 :            : 
    1028                 :            :                     case PK_HANDOUT:
    1029                 :          0 :                         sRequestedView = FrameworkHelper::msHandoutViewURL;
    1030                 :          0 :                         break;
    1031                 :            : 
    1032                 :            :                     case PK_NOTES:
    1033                 :          0 :                         sRequestedView = FrameworkHelper::msNotesViewURL;
    1034                 :          0 :                         break;
    1035                 :            : 
    1036                 :            :                     default:
    1037                 :            :                         // The page kind is invalid.  This is propably an
    1038                 :            :                         // error by the caller.  We use the standard type to
    1039                 :            :                         // keep things going.
    1040                 :            :                         DBG_ASSERT(sal_False, "ViewShellBase::GetInitialViewShellType: invalid page kind");
    1041                 :          0 :                         sRequestedView = FrameworkHelper::msImpressViewURL;
    1042                 :          4 :                         break;
    1043                 :            :                 }
    1044                 :            :                 break;
    1045                 :            :             }
    1046 [ +  - ][ -  + ]:         26 :         }
         [ -  + ][ +  + ]
                 [ +  + ]
    1047                 :            :     }
    1048                 :            :     while (false);
    1049                 :            : 
    1050                 :         26 :     return sRequestedView;
    1051                 :            : }
    1052                 :            : 
    1053                 :            : 
    1054                 :            : 
    1055                 :            : 
    1056                 :            : /** this method starts the presentation by
    1057                 :            :     executing the slot SID_PRESENTATION asynchronous */
    1058                 :          0 : void ViewShellBase::StartPresentation()
    1059                 :            : {
    1060 [ #  # ][ #  # ]:          0 :     if( GetViewFrame() && GetViewFrame()->GetDispatcher() )
                 [ #  # ]
    1061                 :          0 :         GetViewFrame()->GetDispatcher()->Execute(SID_PRESENTATION, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
    1062                 :          0 : }
    1063                 :            : 
    1064                 :            : 
    1065                 :            : 
    1066                 :            : 
    1067                 :            : 
    1068                 :       1255 : ::boost::shared_ptr<tools::EventMultiplexer> ViewShellBase::GetEventMultiplexer (void)
    1069                 :            : {
    1070                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
    1071                 :            :     OSL_ASSERT(mpImpl->mpEventMultiplexer.get()!=NULL);
    1072                 :            : 
    1073                 :       1255 :     return mpImpl->mpEventMultiplexer;
    1074                 :            : }
    1075                 :            : 
    1076                 :            : 
    1077                 :            : 
    1078                 :            : 
    1079                 :          0 : const Rectangle& ViewShellBase::getClientRectangle (void) const
    1080                 :            : {
    1081                 :          0 :     return mpImpl->maClientArea;
    1082                 :            : }
    1083                 :            : 
    1084                 :            : 
    1085                 :       1220 : ::boost::shared_ptr<ToolBarManager> ViewShellBase::GetToolBarManager (void) const
    1086                 :            : {
    1087                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
    1088                 :            :     OSL_ASSERT(mpImpl->mpToolBarManager.get()!=NULL);
    1089                 :            : 
    1090                 :       1220 :     return mpImpl->mpToolBarManager;
    1091                 :            : }
    1092                 :            : 
    1093                 :            : 
    1094                 :            : 
    1095                 :            : 
    1096                 :       1376 : ::boost::shared_ptr<FormShellManager> ViewShellBase::GetFormShellManager (void) const
    1097                 :            : {
    1098                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
    1099                 :            :     OSL_ASSERT(mpImpl->mpFormShellManager.get()!=NULL);
    1100                 :            : 
    1101                 :       1376 :     return mpImpl->mpFormShellManager;
    1102                 :            : }
    1103                 :            : 
    1104                 :            : 
    1105                 :            : 
    1106                 :            : 
    1107                 :       2433 : DrawController& ViewShellBase::GetDrawController (void) const
    1108                 :            : {
    1109                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
    1110                 :            : 
    1111                 :       2433 :     return *mpImpl->mpController;
    1112                 :            : }
    1113                 :            : 
    1114                 :            : 
    1115                 :            : 
    1116                 :            : 
    1117                 :         52 : void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar)
    1118                 :            : {
    1119                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
    1120                 :            : 
    1121                 :         52 :     mpImpl->mpViewTabBar = rViewTabBar;
    1122                 :         52 : }
    1123                 :            : 
    1124                 :            : 
    1125                 :            : 
    1126                 :            : 
    1127                 :        130 : ::Window* ViewShellBase::GetViewWindow (void)
    1128                 :            : {
    1129                 :            :     OSL_ASSERT(mpImpl.get()!=NULL);
    1130                 :            : 
    1131                 :        130 :     return mpImpl->mpViewWindow.get();
    1132                 :            : }
    1133                 :            : 
    1134                 :            : 
    1135                 :          0 : ::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const ::rtl::OUString& aCmdURL )
    1136                 :            : {
    1137                 :          0 :     ::rtl::OUString aLabel;
    1138                 :            : 
    1139         [ #  # ]:          0 :     if ( !aCmdURL.isEmpty() ) try
    1140                 :            :     {
    1141 [ #  # ][ #  # ]:          0 :         Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
    1142                 :            : 
    1143 [ #  # ][ #  # ]:          0 :         Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
                 [ #  # ]
    1144         [ #  # ]:          0 :         Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW );
    1145                 :            : 
    1146 [ #  # ][ #  # ]:          0 :         ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) );
    1147                 :            : 
    1148         [ #  # ]:          0 :         if( !aModuleIdentifier.isEmpty() )
    1149                 :            :         {
    1150 [ #  # ][ #  # ]:          0 :             Reference< XNameAccess > xNameAccess( xServiceManager->createInstance( "com.sun.star.frame.UICommandDescription" ), UNO_QUERY );
                 [ #  # ]
    1151         [ #  # ]:          0 :             if( xNameAccess.is() )
    1152                 :            :             {
    1153 [ #  # ][ #  # ]:          0 :                 Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW );
                 [ #  # ]
    1154         [ #  # ]:          0 :                 Sequence< PropertyValue > aPropSeq;
    1155 [ #  # ][ #  # ]:          0 :                 if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
         [ #  # ][ #  # ]
    1156                 :            :                 {
    1157         [ #  # ]:          0 :                     for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
    1158                 :            :                     {
    1159 [ #  # ][ #  # ]:          0 :                         if ( aPropSeq[i].Name == "Name" )
    1160                 :            :                         {
    1161         [ #  # ]:          0 :                             aPropSeq[i].Value >>= aLabel;
    1162                 :          0 :                             break;
    1163                 :            :                         }
    1164                 :            :                     }
    1165         [ #  # ]:          0 :                 }
    1166                 :          0 :             }
    1167         [ #  # ]:          0 :         }
    1168                 :            :     }
    1169         [ #  # ]:          0 :     catch (const Exception&)
    1170                 :            :     {
    1171                 :            :     }
    1172                 :            : 
    1173                 :          0 :     return aLabel;
    1174                 :            : }
    1175                 :            : 
    1176                 :          0 : ::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const
    1177                 :            : {
    1178 [ #  # ][ #  # ]:          0 :     Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1179         [ #  # ]:          0 :     return ImplRetrieveLabelFromCommand( xFrame, aCmdURL );
    1180                 :            : }
    1181                 :            : 
    1182                 :            : 
    1183                 :            : 
    1184                 :            : //===== ViewShellBase::Implementation =========================================
    1185                 :            : 
    1186                 :        130 : ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
    1187                 :            :     : mpController(),
    1188                 :            :       mpViewTabBar(),
    1189                 :            :       maClientArea(),
    1190                 :            :       mbIsClosing(false),
    1191                 :            :       mpViewWindow(),
    1192                 :            :       mpToolBarManager(),
    1193                 :            :       mpViewShellManager(),
    1194                 :            :       mpEventMultiplexer(),
    1195                 :            :       mpFormShellManager(),
    1196                 :            :       mrBase(rBase),
    1197 [ +  - ][ +  - ]:        130 :       mpPageCacheManager(slidesorter::cache::PageCacheManager::Instance())
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1198                 :            : {
    1199                 :        130 : }
    1200                 :            : 
    1201                 :            : 
    1202                 :            : 
    1203                 :            : 
    1204 [ +  - ][ +  - ]:        130 : ViewShellBase::Implementation::~Implementation (void)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1205                 :            : {
    1206         [ +  - ]:        130 :     mpController = NULL;
    1207         [ +  - ]:        130 :     mpViewTabBar = NULL;
    1208         [ +  - ]:        130 :     mpViewWindow.reset();
    1209         [ +  - ]:        130 :     mpToolBarManager.reset();
    1210                 :        130 : }
    1211                 :            : 
    1212                 :            : 
    1213                 :            : 
    1214                 :            : 
    1215                 :        130 : void ViewShellBase::Implementation::LateInit (void)
    1216                 :            : {
    1217                 :        130 :     mpController = new DrawController(mrBase);
    1218                 :        130 : }
    1219                 :            : 
    1220                 :            : 
    1221                 :            : 
    1222                 :            : 
    1223                 :          0 : void ViewShellBase::Implementation::ProcessRestoreEditingViewSlot (void)
    1224                 :            : {
    1225                 :          0 :     ViewShell* pViewShell = mrBase.GetMainViewShell().get();
    1226         [ #  # ]:          0 :     if (pViewShell != NULL)
    1227                 :            :     {
    1228                 :          0 :         FrameView* pFrameView = pViewShell->GetFrameView();
    1229         [ #  # ]:          0 :         if (pFrameView != NULL)
    1230                 :            :         {
    1231                 :            :             // Set view shell, edit mode, and page kind.
    1232                 :            :             pFrameView->SetViewShEditMode(
    1233                 :            :                 pFrameView->GetViewShEditModeOnLoad(),
    1234 [ #  # ][ #  # ]:          0 :                 pFrameView->GetPageKindOnLoad());
    1235                 :            :             pFrameView->SetPageKind(
    1236                 :          0 :                 pFrameView->GetPageKindOnLoad());
    1237         [ #  # ]:          0 :             ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(mrBase));
    1238                 :            :             pHelper->RequestView(
    1239                 :          0 :                 pHelper->GetViewURL(pFrameView->GetViewShellTypeOnLoad()),
    1240 [ #  # ][ #  # ]:          0 :                 FrameworkHelper::msCenterPaneURL);
                 [ #  # ]
    1241 [ #  # ][ #  # ]:          0 :             pHelper->RunOnConfigurationEvent("ConfigurationUpdateEnd", CurrentPageSetter(mrBase));
         [ #  # ][ #  # ]
    1242                 :            :         }
    1243                 :            :     }
    1244                 :          0 : }
    1245                 :            : 
    1246                 :            : 
    1247                 :            : 
    1248                 :            : 
    1249                 :          0 : void ViewShellBase::Implementation::ShowViewTabBar (bool bShow)
    1250                 :            : {
    1251 [ #  # ][ #  # ]:          0 :     if (mpViewTabBar.is()
                 [ #  # ]
    1252 [ #  # ][ #  # ]:          0 :         && (mpViewTabBar->GetTabControl()->IsVisible()==sal_True) != bShow)
         [ #  # ][ #  # ]
    1253                 :            :     {
    1254 [ #  # ][ #  # ]:          0 :         mpViewTabBar->GetTabControl()->Show(bShow ? sal_True : sal_False);
    1255                 :          0 :         mrBase.Rearrange();
    1256                 :            :     }
    1257                 :          0 : }
    1258                 :            : 
    1259                 :            : 
    1260                 :            : 
    1261                 :            : 
    1262                 :        428 : void ViewShellBase::Implementation::ResizePixel (
    1263                 :            :     const Point& rOrigin,
    1264                 :            :     const Size &rSize,
    1265                 :            :     bool bOuterResize)
    1266                 :            : {
    1267         [ +  - ]:        428 :     if (mbIsClosing)
    1268                 :        428 :         return;
    1269                 :            : 
    1270                 :            :     // Forward the call to both the base class and the main stacked sub
    1271                 :            :     // shell only when main sub shell exists.
    1272 [ +  - ][ +  - ]:        428 :     ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
    1273                 :            : 
    1274                 :            :     // Set the ViewTabBar temporarily to full size so that, when asked
    1275                 :            :     // later, it can return its true height.
    1276         [ +  - ]:        428 :     mrBase.SetWindow (mpViewWindow.get());
    1277 [ +  + ][ +  - ]:        428 :     if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
           [ +  +  #  # ]
    1278 [ +  - ][ +  - ]:        109 :         mpViewTabBar->GetTabControl()->SetPosSizePixel (rOrigin, rSize);
                 [ +  - ]
    1279                 :            : 
    1280                 :            :     // Calculate and set the border before the controls are placed.
    1281                 :        428 :     SvBorder aBorder;
    1282         [ +  - ]:        428 :     if (pMainViewShell != NULL)
    1283 [ +  - ][ +  - ]:        428 :         aBorder = pMainViewShell->GetBorder(bOuterResize);
    1284 [ +  - ][ +  - ]:        428 :     aBorder += mrBase.GetBorder(bOuterResize);
    1285 [ +  - ][ +  + ]:        428 :     if (mrBase.GetBorderPixel() != aBorder)
    1286         [ +  - ]:         19 :         mrBase.SetBorderPixel(aBorder);
    1287                 :            : 
    1288                 :            :     // Place the ViewTabBar at the top.  It is part of the border.
    1289                 :        428 :     SvBorder aBaseBorder;
    1290 [ +  - ][ +  - ]:        428 :     if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
         [ +  - ][ +  + ]
                 [ +  - ]
           [ +  +  #  # ]
                 [ +  + ]
    1291                 :            :     {
    1292         [ +  - ]:        109 :         aBaseBorder.Top() = mpViewTabBar->GetHeight();
    1293 [ +  - ][ +  - ]:        218 :         mpViewTabBar->GetTabControl()->SetPosSizePixel(
    1294         [ +  - ]:        109 :             rOrigin, Size(rSize.Width(),aBaseBorder.Top()));
    1295                 :            :     }
    1296                 :            : 
    1297                 :            :     // The view window gets the remaining space.
    1298                 :            :     Point aViewWindowPosition (
    1299                 :        428 :         rOrigin.X()+aBaseBorder.Left(),
    1300                 :        856 :         rOrigin.Y()+aBaseBorder.Top());
    1301                 :            : 
    1302                 :            :     // -1 (below) is there to let one line of _pFrame->GetWindow() visible,
    1303                 :            :     // so that it plays better with the overall look
    1304                 :            :     Size aViewWindowSize (
    1305                 :        428 :         rSize.Width() - aBaseBorder.Left() - aBaseBorder.Right(),
    1306                 :        856 :         rSize.Height() - aBaseBorder.Top() - aBaseBorder.Bottom() - 1);
    1307         [ +  - ]:        428 :     mpViewWindow->SetPosSizePixel(aViewWindowPosition, aViewWindowSize);
    1308                 :            : 
    1309         [ +  - ]:        428 :     maClientArea = Rectangle(Point(0,0), aViewWindowSize);
    1310                 :            : }
    1311                 :            : 
    1312                 :            : 
    1313                 :            : 
    1314                 :            : 
    1315                 :          0 : void ViewShellBase::Implementation::SetPaneVisibility (
    1316                 :            :     const SfxRequest& rRequest,
    1317                 :            :     const ::rtl::OUString& rsPaneURL,
    1318                 :            :     const ::rtl::OUString& rsViewURL)
    1319                 :            : {
    1320                 :            :     try
    1321                 :            :     {
    1322 [ #  # ][ #  # ]:          0 :         Reference<XControllerManager> xControllerManager (mrBase.GetController(), UNO_QUERY_THROW);
    1323                 :            : 
    1324                 :            :         const Reference< XComponentContext > xContext(
    1325         [ #  # ]:          0 :             ::comphelper::getProcessComponentContext() );
    1326                 :            :         Reference<XResourceId> xPaneId (ResourceId::create(
    1327         [ #  # ]:          0 :             xContext, rsPaneURL));
    1328                 :            :         Reference<XResourceId> xViewId (ResourceId::createWithAnchorURL(
    1329         [ #  # ]:          0 :             xContext, rsViewURL, rsPaneURL));
    1330                 :            : 
    1331                 :            :         // Determine the new visibility state.
    1332                 :          0 :         const SfxItemSet* pArguments = rRequest.GetArgs();
    1333                 :            :         sal_Bool bShowChildWindow;
    1334                 :          0 :         sal_uInt16 nSlotId = rRequest.GetSlot();
    1335         [ #  # ]:          0 :         if (pArguments != NULL)
    1336                 :            :             bShowChildWindow = static_cast<const SfxBoolItem&>(
    1337         [ #  # ]:          0 :                 pArguments->Get(nSlotId)).GetValue();
    1338                 :            :         else
    1339                 :            :         {
    1340                 :            :             Reference<XConfigurationController> xConfigurationController (
    1341 [ #  # ][ #  # ]:          0 :                 xControllerManager->getConfigurationController());
    1342         [ #  # ]:          0 :             if ( ! xConfigurationController.is())
    1343         [ #  # ]:          0 :                 throw RuntimeException();
    1344                 :            :             Reference<XConfiguration> xConfiguration (
    1345 [ #  # ][ #  # ]:          0 :                 xConfigurationController->getRequestedConfiguration());
    1346         [ #  # ]:          0 :             if ( ! xConfiguration.is())
    1347         [ #  # ]:          0 :                 throw RuntimeException();
    1348                 :            : 
    1349 [ #  # ][ #  # ]:          0 :             bShowChildWindow = ! xConfiguration->hasResource(xPaneId);
    1350                 :            :         }
    1351                 :            : 
    1352                 :            :         // Set the desired visibility state at the current configuration
    1353                 :            :         // and update it accordingly.
    1354                 :            :         Reference<XConfigurationController> xConfigurationController (
    1355 [ #  # ][ #  # ]:          0 :             xControllerManager->getConfigurationController());
    1356         [ #  # ]:          0 :         if ( ! xConfigurationController.is())
    1357         [ #  # ]:          0 :             throw RuntimeException();
    1358         [ #  # ]:          0 :         if (bShowChildWindow)
    1359                 :            :         {
    1360         [ #  # ]:          0 :             xConfigurationController->requestResourceActivation(
    1361                 :            :                 xPaneId,
    1362         [ #  # ]:          0 :                 ResourceActivationMode_ADD);
    1363         [ #  # ]:          0 :             xConfigurationController->requestResourceActivation(
    1364                 :            :                 xViewId,
    1365         [ #  # ]:          0 :                 ResourceActivationMode_REPLACE);
    1366                 :            :         }
    1367                 :            :         else
    1368         [ #  # ]:          0 :             xConfigurationController->requestResourceDeactivation(
    1369 [ #  # ][ #  # ]:          0 :                 xPaneId);
    1370                 :            :     }
    1371                 :          0 :     catch (const Exception&)
    1372                 :            :     {
    1373                 :            :         DBG_UNHANDLED_EXCEPTION();
    1374                 :            :     }
    1375                 :          0 : }
    1376                 :            : 
    1377                 :            : 
    1378                 :            : 
    1379                 :            : 
    1380                 :            : 
    1381                 :          0 : void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
    1382                 :            : {
    1383                 :            :     try
    1384                 :            :     {
    1385                 :            :         // Get some frequently used values.
    1386 [ #  # ][ #  # ]:          0 :         Reference<XControllerManager> xControllerManager (mrBase.GetController(), UNO_QUERY_THROW);
    1387                 :            :         Reference<XConfigurationController> xConfigurationController (
    1388 [ #  # ][ #  # ]:          0 :             xControllerManager->getConfigurationController());
    1389         [ #  # ]:          0 :         if ( ! xConfigurationController.is())
    1390         [ #  # ]:          0 :             throw RuntimeException();
    1391                 :            :         Reference<XConfiguration> xConfiguration (
    1392 [ #  # ][ #  # ]:          0 :             xConfigurationController->getRequestedConfiguration());
    1393         [ #  # ]:          0 :         if ( ! xConfiguration.is())
    1394         [ #  # ]:          0 :             throw RuntimeException();
    1395                 :            : 
    1396                 :            :         const Reference< XComponentContext > xContext(
    1397         [ #  # ]:          0 :             ::comphelper::getProcessComponentContext() );
    1398         [ #  # ]:          0 :         SfxWhichIter aSetIterator (rSet);
    1399         [ #  # ]:          0 :         sal_uInt16 nItemId (aSetIterator.FirstWhich());
    1400         [ #  # ]:          0 :         while (nItemId > 0)
    1401                 :            :         {
    1402                 :          0 :             bool bState (false);
    1403                 :          0 :             Reference<XResourceId> xResourceId;
    1404                 :            :             try
    1405                 :            :             {
    1406   [ #  #  #  #  :          0 :                 switch (nItemId)
             #  #  #  #  
                      # ]
    1407                 :            :                 {
    1408                 :            :                     case SID_LEFT_PANE_IMPRESS:
    1409                 :            :                         xResourceId = ResourceId::create(
    1410 [ #  # ][ #  # ]:          0 :                             xContext, FrameworkHelper::msLeftImpressPaneURL);
    1411                 :          0 :                         break;
    1412                 :            : 
    1413                 :            :                     case SID_LEFT_PANE_DRAW:
    1414                 :            :                         xResourceId = ResourceId::create(
    1415 [ #  # ][ #  # ]:          0 :                             xContext, FrameworkHelper::msLeftDrawPaneURL);
    1416                 :          0 :                         break;
    1417                 :            : 
    1418                 :            :                     case SID_TASKPANE:
    1419                 :            :                         xResourceId = ResourceId::create(
    1420 [ #  # ][ #  # ]:          0 :                             xContext, FrameworkHelper::msRightPaneURL);
    1421                 :          0 :                         break;
    1422                 :            : 
    1423                 :            :                     case SID_NORMAL_MULTI_PANE_GUI:
    1424                 :            :                         xResourceId = ResourceId::createWithAnchorURL(
    1425                 :            :                             xContext,
    1426                 :            :                             FrameworkHelper::msImpressViewURL,
    1427 [ #  # ][ #  # ]:          0 :                             FrameworkHelper::msCenterPaneURL);
    1428                 :          0 :                         break;
    1429                 :            : 
    1430                 :            :                     case SID_SLIDE_SORTER_MULTI_PANE_GUI:
    1431                 :            :                     case SID_DIAMODE:
    1432                 :            :                         xResourceId = ResourceId::createWithAnchorURL(
    1433                 :            :                             xContext,
    1434                 :            :                             FrameworkHelper::msSlideSorterURL,
    1435 [ #  # ][ #  # ]:          0 :                             FrameworkHelper::msCenterPaneURL);
    1436                 :          0 :                         break;
    1437                 :            : 
    1438                 :            :                     case SID_OUTLINEMODE:
    1439                 :            :                         xResourceId = ResourceId::createWithAnchorURL(
    1440                 :            :                             xContext,
    1441                 :            :                             FrameworkHelper::msOutlineViewURL,
    1442 [ #  # ][ #  # ]:          0 :                             FrameworkHelper::msCenterPaneURL);
    1443                 :          0 :                         break;
    1444                 :            : 
    1445                 :            :                     case SID_HANDOUTMODE:
    1446                 :            :                         // There is only the master page mode for the handout
    1447                 :            :                         // view so ignore the master page flag.
    1448                 :            :                         xResourceId = ResourceId::createWithAnchorURL(
    1449                 :            :                             xContext,
    1450                 :            :                             FrameworkHelper::msHandoutViewURL,
    1451 [ #  # ][ #  # ]:          0 :                             FrameworkHelper::msCenterPaneURL);
    1452                 :          0 :                         break;
    1453                 :            : 
    1454                 :            :                     case SID_NOTESMODE:
    1455                 :            :                         xResourceId = ResourceId::createWithAnchorURL(
    1456                 :            :                             xContext,
    1457                 :            :                             FrameworkHelper::msNotesViewURL,
    1458 [ #  # ][ #  # ]:          0 :                             FrameworkHelper::msCenterPaneURL);
                 [ #  # ]
    1459                 :          0 :                         break;
    1460                 :            : 
    1461                 :            :                     default:
    1462                 :            :                         // Ignore all other items.  They are not meant to be
    1463                 :            :                         // handled by us.
    1464                 :          0 :                         break;
    1465                 :            :                 }
    1466                 :            :             }
    1467         [ #  # ]:          0 :             catch (const DeploymentException&)
    1468                 :            :             {
    1469                 :            :             }
    1470                 :            : 
    1471                 :            :             // Determine the state for the resource.
    1472 [ #  # ][ #  # ]:          0 :             bState = xConfiguration->hasResource(xResourceId);
    1473                 :            : 
    1474                 :            :             // Take the master page mode into account.
    1475      [ #  #  # ]:          0 :             switch (nItemId)
    1476                 :            :             {
    1477                 :            :                 case SID_NORMAL_MULTI_PANE_GUI:
    1478                 :            :                 case SID_NOTESMODE:
    1479                 :            :                 {
    1480                 :            :                     // Determine the master page mode.
    1481                 :            :                     ViewShell* pCenterViewShell = FrameworkHelper::Instance(mrBase)->GetViewShell(
    1482 [ #  # ][ #  # ]:          0 :                         FrameworkHelper::msCenterPaneURL).get();
         [ #  # ][ #  # ]
    1483                 :          0 :                     bool bMasterPageMode (false);
    1484 [ #  # ][ #  # ]:          0 :                     if (pCenterViewShell!=NULL && pCenterViewShell->ISA(DrawViewShell))
         [ #  # ][ #  # ]
                 [ #  # ]
    1485 [ #  # ][ #  # ]:          0 :                         if (PTR_CAST(DrawViewShell,pCenterViewShell)->GetEditMode()
         [ #  # ][ #  # ]
                 [ #  # ]
    1486                 :            :                             == EM_MASTERPAGE)
    1487                 :            :                         {
    1488                 :          0 :                             bMasterPageMode = true;
    1489                 :            :                         }
    1490                 :            : 
    1491                 :          0 :                     bState &= !bMasterPageMode;
    1492                 :          0 :                     break;
    1493                 :            :                 }
    1494                 :            : 
    1495                 :            :                 case SID_HANDOUTMODE:
    1496                 :            :                     // There is only the master page mode for the handout
    1497                 :            :                     // view so ignore the master page flag.
    1498                 :          0 :                     break;
    1499                 :            :             }
    1500                 :            : 
    1501                 :            :             // And finally set the state.
    1502 [ #  # ][ #  # ]:          0 :             rSet.Put(SfxBoolItem(nItemId, bState));
                 [ #  # ]
    1503                 :            : 
    1504         [ #  # ]:          0 :             nItemId = aSetIterator.NextWhich();
    1505 [ #  # ][ #  # ]:          0 :         }
    1506                 :            :     }
    1507                 :          0 :     catch (const RuntimeException&)
    1508                 :            :     {
    1509                 :            :         DBG_UNHANDLED_EXCEPTION();
    1510                 :            :     }
    1511                 :            : 
    1512                 :          0 : }
    1513                 :            : 
    1514                 :            : 
    1515                 :            : 
    1516                 :            : 
    1517                 :          0 : void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest)
    1518                 :            : {
    1519                 :            :     // Set the visibility state of the toolpanel and one of its top
    1520                 :            :     // level panels.
    1521                 :            :     toolpanel::PanelId nPanelId (
    1522                 :          0 :         toolpanel::PID_UNKNOWN);
    1523                 :          0 :     bool bPanelIdGiven = false;
    1524                 :            : 
    1525                 :            :     // Extract the given arguments.
    1526                 :          0 :     const SfxItemSet* pArgs = rRequest.GetArgs();
    1527         [ #  # ]:          0 :     if (pArgs)
    1528                 :            :     {
    1529         [ #  # ]:          0 :         if (pArgs->Count() == 2)
    1530                 :            :         {
    1531                 :          0 :             SFX_REQUEST_ARG (rRequest, pPanelId, SfxUInt32Item,
    1532                 :            :                 ID_VAL_PANEL_INDEX, sal_False);
    1533         [ #  # ]:          0 :             if (pPanelId != NULL)
    1534                 :            :             {
    1535                 :            :                 nPanelId = static_cast<
    1536                 :            :                     toolpanel::PanelId>(
    1537                 :          0 :                         pPanelId->GetValue());
    1538                 :          0 :                 bPanelIdGiven = true;
    1539                 :            :             }
    1540                 :            :         }
    1541                 :            :     }
    1542                 :            : 
    1543                 :            :     // Ignore the request for some combinations of panels and view
    1544                 :            :     // shell types.
    1545 [ #  # ][ #  # ]:          0 :     if (bPanelIdGiven
                 [ #  # ]
    1546                 :            :         && ! (nPanelId==toolpanel::PID_LAYOUT
    1547 [ #  # ][ #  # ]:          0 :             && mrBase.GetMainViewShell()!=NULL
                 [ #  # ]
    1548 [ #  # ][ #  # ]:          0 :             && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1549                 :            :     {
    1550                 :            :         framework::FrameworkHelper::Instance(mrBase)->RequestTaskPanel(
    1551         [ #  # ]:          0 :             framework::FrameworkHelper::msLayoutTaskPanelURL);
    1552                 :            :     }
    1553                 :          0 : }
    1554                 :            : 
    1555                 :            : 
    1556                 :            : } // end of namespace sd
    1557                 :            : 
    1558                 :            : 
    1559                 :            : 
    1560                 :            : 
    1561                 :            : //===== CurrentPageSetter ===========================================
    1562                 :            : 
    1563                 :            : namespace {
    1564                 :            : 
    1565                 :          0 : CurrentPageSetter::CurrentPageSetter (ViewShellBase& rBase)
    1566                 :          0 :     : mrBase(rBase)
    1567                 :            : {
    1568                 :          0 : }
    1569                 :            : 
    1570                 :            : 
    1571                 :            : 
    1572                 :            : 
    1573                 :            : 
    1574                 :          0 : void CurrentPageSetter::operator() (bool)
    1575                 :            : {
    1576                 :          0 :     FrameView* pFrameView = NULL;
    1577                 :            : 
    1578         [ #  # ]:          0 :     if (mrBase.GetMainViewShell() != NULL)
    1579                 :            :     {
    1580         [ #  # ]:          0 :         pFrameView = mrBase.GetMainViewShell()->GetFrameView();
    1581                 :            :     }
    1582                 :            : 
    1583         [ #  # ]:          0 :     if (pFrameView!=NULL)
    1584                 :            :     {
    1585                 :            :         try
    1586                 :            :         {
    1587                 :            :             // Get the current page either from the DrawPagesSupplier or the
    1588                 :            :             // MasterPagesSupplier.
    1589                 :          0 :             Any aPage;
    1590 [ #  # ][ #  # ]:          0 :             if (pFrameView->GetViewShEditModeOnLoad() == EM_PAGE)
    1591                 :            :             {
    1592                 :            :                 Reference<drawing::XDrawPagesSupplier> xPagesSupplier (
    1593 [ #  # ][ #  # ]:          0 :                     mrBase.GetController()->getModel(), UNO_QUERY_THROW);
         [ #  # ][ #  # ]
    1594                 :            :                 Reference<container::XIndexAccess> xPages (
    1595 [ #  # ][ #  # ]:          0 :                     xPagesSupplier->getDrawPages(), UNO_QUERY_THROW);
                 [ #  # ]
    1596 [ #  # ][ #  # ]:          0 :                 aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
    1597                 :            :             }
    1598                 :            :             else
    1599                 :            :             {
    1600                 :            :                 Reference<drawing::XMasterPagesSupplier> xPagesSupplier (
    1601 [ #  # ][ #  # ]:          0 :                     mrBase.GetController()->getModel(), UNO_QUERY_THROW);
         [ #  # ][ #  # ]
    1602                 :            :                 Reference<container::XIndexAccess> xPages (
    1603 [ #  # ][ #  # ]:          0 :                     xPagesSupplier->getMasterPages(), UNO_QUERY_THROW);
                 [ #  # ]
    1604 [ #  # ][ #  # ]:          0 :                 aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
    1605                 :            :             }
    1606                 :            :             // Switch to the page last edited by setting the CurrentPage
    1607                 :            :             // property.
    1608 [ #  # ][ #  # ]:          0 :             Reference<beans::XPropertySet> xSet (mrBase.GetController(), UNO_QUERY_THROW);
    1609         [ #  # ]:          0 :             xSet->setPropertyValue (rtl::OUString("CurrentPage"), aPage);
              [ #  #  # ]
                 [ #  # ]
    1610                 :            :         }
    1611                 :          0 :         catch (const RuntimeException&)
    1612                 :            :         {
    1613                 :            :             // We have not been able to set the current page at the main view.
    1614                 :            :             // This is sad but still leaves us in a valid state.  Therefore,
    1615                 :            :             // this exception is silently ignored.
    1616                 :            :         }
    1617                 :          0 :         catch (const beans::UnknownPropertyException&)
    1618                 :            :         {
    1619                 :            :             DBG_ASSERT(false,"CurrentPage property unknown");
    1620                 :            :         }
    1621                 :            :     }
    1622                 :          0 : }
    1623                 :            : 
    1624                 :            : } // end of anonymouse namespace
    1625                 :            : 
    1626                 :            : 
    1627                 :            : 
    1628                 :            : 
    1629                 :            : //===== FocusForwardingWindow =================================================
    1630                 :            : 
    1631                 :            : namespace sd { namespace {
    1632                 :            : 
    1633                 :        130 : FocusForwardingWindow::FocusForwardingWindow (
    1634                 :            :     ::Window& rParentWindow,
    1635                 :            :     ViewShellBase& rBase)
    1636                 :            :     : ::Window(&rParentWindow, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
    1637                 :        130 :         mrBase(rBase)
    1638                 :            : {
    1639                 :            :     OSL_TRACE("created FocusForwardingWindow at %x", this);
    1640                 :        130 : }
    1641                 :            : 
    1642                 :            : 
    1643                 :            : 
    1644                 :            : 
    1645                 :        130 : FocusForwardingWindow::~FocusForwardingWindow (void)
    1646                 :            : {
    1647                 :            :     OSL_TRACE("destroyed FocusForwardingWindow at %x", this);
    1648         [ -  + ]:        260 : }
    1649                 :            : 
    1650                 :            : 
    1651                 :            : 
    1652                 :            : 
    1653                 :          0 : void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt)
    1654                 :            : {
    1655         [ #  # ]:          0 :     ::boost::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell();
    1656         [ #  # ]:          0 :     if (pViewShell.get() != NULL)
    1657                 :            :     {
    1658         [ #  # ]:          0 :         ::Window* pWindow = pViewShell->GetActiveWindow();
    1659         [ #  # ]:          0 :         if (pWindow != NULL)
    1660                 :            :         {
    1661                 :            :             // Forward the focus so that the window is called directly the
    1662                 :            :             // next time.
    1663         [ #  # ]:          0 :             pWindow->GrabFocus();
    1664                 :            :             // Forward the key press as well.
    1665         [ #  # ]:          0 :             pWindow->KeyInput(rKEvt);
    1666                 :            :         }
    1667         [ #  # ]:          0 :     }
    1668                 :          0 : }
    1669                 :            : 
    1670                 :            : 
    1671                 :            : 
    1672                 :            : 
    1673                 :          0 : void FocusForwardingWindow::Command (const CommandEvent& rEvent)
    1674                 :            : {
    1675         [ #  # ]:          0 :     ::boost::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell();
    1676         [ #  # ]:          0 :     if (pViewShell.get() != NULL)
    1677                 :            :     {
    1678         [ #  # ]:          0 :         ::Window* pWindow = pViewShell->GetActiveWindow();
    1679         [ #  # ]:          0 :         if (pWindow != NULL)
    1680                 :            :         {
    1681         [ #  # ]:          0 :             pWindow->Command(rEvent);
    1682                 :            :         }
    1683         [ #  # ]:          0 :     }
    1684                 :          0 : }
    1685                 :            : 
    1686                 :            : 
    1687                 :            : } // end of anonymouse namespace
    1688                 :            : 
    1689                 :            : } // end of namespace sd
    1690                 :            : 
    1691                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10