LCOV - code coverage report
Current view: top level - sd/source/ui/view - viewshel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 364 635 57.3 %
Date: 2012-08-25 Functions: 42 67 62.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 333 1043 31.9 %

           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                 :            : 
      30                 :            : #include "ViewShell.hxx"
      31                 :            : #include "ViewShellImplementation.hxx"
      32                 :            : 
      33                 :            : #include <com/sun/star/embed/EmbedStates.hpp>
      34                 :            : #include "ViewShellBase.hxx"
      35                 :            : #include "ShellFactory.hxx"
      36                 :            : #include "DrawController.hxx"
      37                 :            : #include "LayerTabBar.hxx"
      38                 :            : 
      39                 :            : #include <sfx2/viewfrm.hxx>
      40                 :            : #include <sfx2/bindings.hxx>
      41                 :            : #include <sfx2/dispatch.hxx>
      42                 :            : #include <vcl/scrbar.hxx>
      43                 :            : #include <svl/eitem.hxx>
      44                 :            : #include <svx/ruler.hxx>
      45                 :            : #include <svx/svxids.hrc>
      46                 :            : #include <svx/fmshell.hxx>
      47                 :            : #include "WindowUpdater.hxx"
      48                 :            : #include "GraphicViewShell.hxx"
      49                 :            : #include <sfx2/childwin.hxx>
      50                 :            : #include <sdxfer.hxx>
      51                 :            : 
      52                 :            : #include "app.hrc"
      53                 :            : #include "helpids.h"
      54                 :            : #include "strings.hrc"
      55                 :            : #include "res_bmp.hrc"
      56                 :            : #include "OutlineView.hxx"
      57                 :            : #include "Client.hxx"
      58                 :            : #include "sdresid.hxx"
      59                 :            : #include "DrawDocShell.hxx"
      60                 :            : #include "slideshow.hxx"
      61                 :            : #include "drawdoc.hxx"
      62                 :            : #include "sdpage.hxx"
      63                 :            : #include "zoomlist.hxx"
      64                 :            : #include "FrameView.hxx"
      65                 :            : #include "optsitem.hxx"
      66                 :            : #include "BezierObjectBar.hxx"
      67                 :            : #include "TextObjectBar.hxx"
      68                 :            : #include "GraphicObjectBar.hxx"
      69                 :            : #include "MediaObjectBar.hxx"
      70                 :            : #include "ViewShellManager.hxx"
      71                 :            : #include "FormShellManager.hxx"
      72                 :            : #include <svx/dialogs.hrc>
      73                 :            : #include <svx/extrusionbar.hxx>
      74                 :            : #include <svx/fontworkbar.hxx>
      75                 :            : #include <svx/svdoutl.hxx>
      76                 :            : #include <tools/diagnose_ex.h>
      77                 :            : 
      78                 :            : #include <svl/slstitm.hxx>
      79                 :            : #include <sfx2/request.hxx>
      80                 :            : #include "SpellDialogChildWindow.hxx"
      81                 :            : 
      82                 :            : #include <basegfx/tools/zoomtools.hxx>
      83                 :            : 
      84                 :            : #include "Window.hxx"
      85                 :            : #include "fupoor.hxx"
      86                 :            : 
      87                 :            : #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
      88                 :            : #define SO2_DECL_SVINPLACEOBJECT_DEFINED
      89                 :            : SO2_DECL_REF(SvInPlaceObject)
      90                 :            : #endif
      91                 :            : 
      92                 :            : namespace sd { namespace ui { namespace table {
      93                 :            :     extern SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView );
      94                 :            : } } }
      95                 :            : 
      96                 :            : using namespace ::com::sun::star;
      97                 :            : using namespace ::com::sun::star::uno;
      98                 :            : using namespace ::com::sun::star::presentation;
      99                 :            : 
     100                 :            : namespace {
     101                 :            : 
     102                 :            : class ViewShellObjectBarFactory
     103                 :            :     : public ::sd::ShellFactory<SfxShell>
     104                 :            : {
     105                 :            : public:
     106                 :            :     ViewShellObjectBarFactory (::sd::ViewShell& rViewShell);
     107                 :            :     virtual ~ViewShellObjectBarFactory (void);
     108                 :            :     virtual SfxShell* CreateShell (
     109                 :            :         ::sd::ShellId nId,
     110                 :            :         ::Window* pParentWindow,
     111                 :            :         ::sd::FrameView* pFrameView);
     112                 :            :     virtual void ReleaseShell (SfxShell* pShell);
     113                 :            : private:
     114                 :            :     ::sd::ViewShell& mrViewShell;
     115                 :            :     /** This cache holds the already created object bars.
     116                 :            :     */
     117                 :            :     typedef ::std::map< ::sd::ShellId,SfxShell*> ShellCache;
     118                 :            :     ShellCache maShellCache;
     119                 :            : };
     120                 :            : 
     121                 :            : 
     122                 :            : } // end of anonymous namespace
     123                 :            : 
     124                 :            : 
     125                 :            : namespace sd {
     126                 :            : 
     127                 :        930 : sal_Bool ViewShell::IsPageFlipMode(void) const
     128                 :            : {
     129                 :       1860 :     return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL &&
     130         [ -  + ]:       1860 :         mpContentWindow->GetVisibleHeight() >= 1.0;
           [ +  -  +  - ]
     131                 :            : }
     132                 :            : 
     133                 :      22327 : SfxViewFrame* ViewShell::GetViewFrame (void) const
     134                 :            : {
     135                 :      22327 :     const SfxViewShell* pViewShell = GetViewShell();
     136         [ +  - ]:      22327 :     if (pViewShell != NULL)
     137                 :            :     {
     138                 :      22327 :         return pViewShell->GetViewFrame();
     139                 :            :     }
     140                 :            :     else
     141                 :            :     {
     142                 :            :         OSL_ASSERT (GetViewShell()!=NULL);
     143                 :      22327 :         return NULL;
     144                 :            :     }
     145                 :            : }
     146                 :            : 
     147                 :            : 
     148                 :            : /*************************************************************************
     149                 :            : |*
     150                 :            : |* SFX-Slotmap und Standardinterface deklarieren
     151                 :            : |*
     152                 :            : \************************************************************************/
     153 [ -  + ][ -  + ]:       5790 : TYPEINIT1(ViewShell, SfxShell);
     154                 :            : 
     155                 :            : 
     156                 :        286 : ViewShell::ViewShell( SfxViewFrame*, ::Window* pParentWindow, ViewShellBase& rViewShellBase, bool bAllowCenter)
     157                 :            : :   SfxShell(&rViewShellBase)
     158                 :            : ,   mbCenterAllowed(bAllowCenter)
     159 [ +  - ][ +  - ]:        286 : ,   mpParentWindow(pParentWindow)
         [ +  - ][ +  - ]
                 [ +  - ]
     160                 :            : {
     161         [ +  - ]:        286 :     construct();
     162                 :        286 : }
     163                 :            : 
     164 [ +  - ][ +  - ]:        286 : ViewShell::~ViewShell()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     165                 :            : {
     166                 :            :     // Keep the content window from accessing in its destructor the
     167                 :            :     // WindowUpdater.
     168         [ +  - ]:        286 :     mpContentWindow->SetViewShell(NULL);
     169                 :            : 
     170         [ +  - ]:        286 :     delete mpZoomList;
     171                 :            : 
     172                 :        286 :     mpLayerTabBar.reset();
     173                 :            : 
     174         [ +  - ]:        286 :     if (mpImpl->mpSubShellFactory.get() != NULL)
     175         [ +  - ]:        286 :         GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
     176 [ +  - ][ +  - ]:        572 :             this,mpImpl->mpSubShellFactory);
                 [ +  - ]
     177         [ -  + ]:        286 : }
     178                 :            : 
     179                 :            : 
     180                 :            : /*************************************************************************
     181                 :            : |*
     182                 :            : |* gemeinsamer Initialiserungsanteil der beiden Konstruktoren
     183                 :            : |*
     184                 :            : \************************************************************************/
     185                 :            : 
     186                 :        286 : void ViewShell::construct(void)
     187                 :            : {
     188                 :        286 :     mbHasRulers = false;
     189                 :        286 :     mpActiveWindow = 0;
     190                 :        286 :     mpView = 0;
     191                 :        286 :     mpFrameView = 0;
     192                 :        286 :     mpZoomList = 0;
     193                 :        286 :     mbStartShowWithDialog = sal_False;
     194                 :        286 :     mnPrintedHandoutPageNum = 1;
     195                 :        286 :     mnPrintedHandoutPageCount = 0;
     196 [ +  - ][ +  - ]:        286 :     mpWindowUpdater.reset( new ::sd::WindowUpdater() );
     197 [ +  - ][ +  - ]:        286 :     mpImpl.reset(new Implementation(*this));
     198                 :        286 :     meShellType = ST_NONE;
     199                 :            : 
     200                 :            :     OSL_ASSERT (GetViewShell()!=NULL);
     201                 :            : 
     202         [ -  + ]:        286 :     if (IsMainViewShell())
     203 [ #  # ][ #  # ]:          0 :         GetDocSh()->Connect (this);
     204                 :            : 
     205 [ +  - ][ +  - ]:        286 :     mpZoomList = new ZoomList( this );
     206                 :            : 
     207 [ +  - ][ +  - ]:        286 :     mpContentWindow.reset(new ::sd::Window(GetParentWindow()));
                 [ +  - ]
     208         [ +  - ]:        286 :     SetActiveWindow (mpContentWindow.get());
     209                 :            : 
     210 [ +  - ][ +  - ]:        286 :     GetParentWindow()->SetBackground (Wallpaper());
                 [ +  - ]
     211 [ +  - ][ +  - ]:        286 :     mpContentWindow->SetBackground (Wallpaper());
                 [ +  - ]
     212         [ +  - ]:        286 :     mpContentWindow->SetCenterAllowed(mbCenterAllowed);
     213         [ +  - ]:        286 :     mpContentWindow->SetViewShell(this);
     214                 :        286 :     mpContentWindow->SetPosSizePixel(
     215 [ +  - ][ +  - ]:        286 :         GetParentWindow()->GetPosPixel(),GetParentWindow()->GetSizePixel());
                 [ +  - ]
     216                 :            : 
     217 [ +  - ][ +  - ]:        286 :     if ( ! GetDocSh()->IsPreview())
                 [ +  - ]
     218                 :            :     {
     219                 :            :         // Create scroll bars and the filler between the scroll bars.
     220 [ +  - ][ +  - ]:        286 :         mpHorizontalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG)));
                 [ +  - ]
     221         [ +  - ]:        286 :         mpHorizontalScrollBar->EnableRTL (sal_False);
     222         [ +  - ]:        286 :         mpHorizontalScrollBar->SetRange(Range(0, 32000));
     223         [ +  - ]:        286 :         mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl));
     224                 :            : 
     225 [ +  - ][ +  - ]:        286 :         mpVerticalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
                 [ +  - ]
     226         [ +  - ]:        286 :         mpVerticalScrollBar->SetRange(Range(0, 32000));
     227         [ +  - ]:        286 :         mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl));
     228                 :            : 
     229 [ +  - ][ +  - ]:        286 :         mpScrollBarBox.reset(new ScrollBarBox(GetParentWindow(), WB_SIZEABLE));
                 [ +  - ]
     230                 :            :     }
     231                 :            : 
     232                 :        286 :     rtl::OUString aName( "ViewShell" );
     233 [ +  - ][ +  - ]:        286 :     SetName (aName);
                 [ +  - ]
     234                 :            : 
     235 [ +  - ][ +  - ]:        286 :     GetDoc()->StartOnlineSpelling(sal_False);
     236                 :            : 
     237         [ +  - ]:        286 :     mpWindowUpdater->SetViewShell (*this);
     238 [ +  - ][ +  - ]:        286 :     mpWindowUpdater->SetDocument (GetDoc());
     239                 :            : 
     240                 :            :     // Re-initialize the spell dialog.
     241                 :            :     ::sd::SpellDialogChildWindow* pSpellDialog =
     242                 :            :           static_cast< ::sd::SpellDialogChildWindow*> (
     243                 :            :               GetViewFrame()->GetChildWindow (
     244 [ +  - ][ +  - ]:        286 :                   ::sd::SpellDialogChildWindow::GetChildWindowId()));
                 [ +  - ]
     245         [ -  + ]:        286 :     if (pSpellDialog != NULL)
     246         [ #  # ]:          0 :         pSpellDialog->InvalidateSpellDialog();
     247                 :            : 
     248                 :            :     // Register the sub shell factory.
     249 [ +  - ][ +  - ]:        286 :     mpImpl->mpSubShellFactory.reset(new ViewShellObjectBarFactory(*this));
                 [ +  - ]
     250 [ +  - ][ +  - ]:        286 :     GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this,mpImpl->mpSubShellFactory);
         [ +  - ][ +  - ]
     251                 :        286 : }
     252                 :            : 
     253                 :        286 : void ViewShell::doShow(void)
     254                 :            : {
     255                 :        286 :     mpContentWindow->Show();
     256                 :        286 :     static_cast< ::Window*>(mpContentWindow.get())->Resize();
     257                 :            :     OSL_TRACE("content window has size %d %d",
     258                 :            :         mpContentWindow->GetSizePixel().Width(),
     259                 :            :         mpContentWindow->GetSizePixel().Height());
     260                 :            : 
     261         [ +  - ]:        286 :     if ( ! GetDocSh()->IsPreview())
     262                 :            :     {
     263                 :            :         // Show scroll bars
     264                 :        286 :         mpHorizontalScrollBar->Show();
     265                 :            : 
     266                 :        286 :         mpVerticalScrollBar->Show();
     267                 :            :         maScrBarWH = Size(
     268         [ +  - ]:        286 :             mpVerticalScrollBar->GetSizePixel().Width(),
     269                 :        572 :             mpHorizontalScrollBar->GetSizePixel().Height());
     270                 :            : 
     271                 :        286 :         mpScrollBarBox->Show();
     272                 :            :     }
     273                 :            : 
     274                 :        286 :     GetParentWindow()->Show();
     275                 :        286 : }
     276                 :            : 
     277                 :        286 : void ViewShell::Init (bool bIsMainViewShell)
     278                 :            : {
     279                 :        286 :     mpImpl->mbIsInitialized = true;
     280                 :        286 :     SetIsMainViewShell(bIsMainViewShell);
     281         [ +  + ]:        286 :     if (bIsMainViewShell)
     282                 :        130 :         SetActiveWindow (mpContentWindow.get());
     283                 :        286 : }
     284                 :            : 
     285                 :            : 
     286                 :            : 
     287                 :            : 
     288                 :        286 : void ViewShell::Exit (void)
     289                 :            : {
     290                 :        286 :     sd::View* pView = GetView();
     291 [ -  + ][ -  + ]:        286 :     if (pView!=NULL && pView->IsTextEdit())
                 [ +  + ]
     292                 :            :     {
     293                 :          0 :         pView->SdrEndTextEdit();
     294                 :          0 :         pView->UnmarkAll();
     295                 :            :     }
     296                 :            : 
     297                 :        286 :     Deactivate (sal_True);
     298                 :            : 
     299         [ +  + ]:        286 :     if (IsMainViewShell())
     300                 :            :     {
     301                 :        130 :         GetDocSh()->Disconnect(this);
     302                 :            :     }
     303                 :            : 
     304                 :        286 :     SetIsMainViewShell(false);
     305                 :        286 : }
     306                 :            : 
     307                 :            : 
     308                 :            : 
     309                 :            : 
     310                 :            : /*************************************************************************
     311                 :            : |*
     312                 :            : |* Aktivierung: Arbeitsfenster den Fokus zuweisen
     313                 :            : |*
     314                 :            : \************************************************************************/
     315                 :            : 
     316                 :        446 : void ViewShell::Activate(sal_Bool bIsMDIActivate)
     317                 :            : {
     318                 :        446 :     SfxShell::Activate(bIsMDIActivate);
     319                 :            : 
     320                 :            :     // Laut MI darf keiner GrabFocus rufen, der nicht genau weiss von
     321                 :            :     // welchem Window der Focus gegrabt wird. Da Activate() vom SFX teilweise
     322                 :            :     // asynchron verschickt wird, kann es sein, dass ein falsches Window
     323                 :            :     // den Focus hat
     324                 :            : 
     325         [ +  + ]:        446 :     if (mpHorizontalRuler.get() != NULL)
     326                 :        208 :         mpHorizontalRuler->SetActive(sal_True);
     327         [ +  + ]:        446 :     if (mpVerticalRuler.get() != NULL)
     328                 :        208 :         mpVerticalRuler->SetActive(sal_True);
     329                 :            : 
     330         [ +  - ]:        446 :     if (bIsMDIActivate)
     331                 :            :     {
     332                 :            :         // Damit der Navigator auch einen aktuellen Status bekommt
     333         [ +  - ]:        446 :         SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
     334 [ +  - ][ +  - ]:        446 :         if (GetDispatcher() != NULL)
     335                 :            :             GetDispatcher()->Execute(
     336                 :            :                 SID_NAVIGATOR_INIT,
     337                 :            :                 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
     338                 :            :                 &aItem,
     339 [ +  - ][ +  - ]:        446 :                 0L);
     340                 :            : 
     341         [ +  - ]:        446 :         SfxViewShell* pViewShell = GetViewShell();
     342                 :            :         OSL_ASSERT (pViewShell!=NULL);
     343                 :        446 :         SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
     344         [ +  - ]:        446 :         rBindings.Invalidate( SID_3D_STATE, sal_True, sal_False );
     345                 :            : 
     346 [ +  - ][ +  - ]:        446 :         rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
     347 [ +  - ][ +  - ]:        446 :         if(xSlideShow.is() && xSlideShow->isRunning() )
         [ -  + ][ -  + ]
     348                 :            :         {
     349 [ #  # ][ #  # ]:          0 :             xSlideShow->activate(GetViewShellBase());
     350                 :            :         }
     351 [ +  - ][ +  + ]:        446 :         if(HasCurrentFunction())
     352                 :            :         {
     353 [ +  - ][ +  - ]:        420 :             GetCurrentFunction()->Activate();
                 [ +  - ]
     354                 :            :         }
     355                 :            : 
     356 [ +  - ][ +  - ]:        446 :         if(!GetDocSh()->IsUIActive())
                 [ +  - ]
     357 [ +  - ][ +  - ]:        446 :             UpdatePreview( GetActualPage(), sal_True );
                 [ +  - ]
     358                 :            : 
     359                 :            :     }
     360                 :            : 
     361                 :        446 :     ReadFrameViewData( mpFrameView );
     362                 :            : 
     363         [ +  + ]:        446 :     if (IsMainViewShell())
     364                 :        275 :         GetDocSh()->Connect(this);
     365                 :        446 : }
     366                 :            : 
     367                 :          0 : void ViewShell::UIActivating( SfxInPlaceClient*  )
     368                 :            : {
     369                 :            :     OSL_ASSERT (GetViewShell()!=NULL);
     370         [ #  # ]:          0 :     GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
     371                 :          0 : }
     372                 :            : 
     373                 :            : 
     374                 :            : 
     375                 :          0 : void ViewShell::UIDeactivated( SfxInPlaceClient*  )
     376                 :            : {
     377                 :            :     OSL_ASSERT (GetViewShell()!=NULL);
     378         [ #  # ]:          0 :     GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
     379         [ #  # ]:          0 :     if ( GetDrawView() )
     380         [ #  # ]:          0 :         GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this, *GetDrawView());
     381                 :          0 : }
     382                 :            : 
     383                 :            : /*************************************************************************
     384                 :            : |*
     385                 :            : |* Deaktivierung
     386                 :            : |*
     387                 :            : \************************************************************************/
     388                 :            : 
     389                 :       1148 : void ViewShell::Deactivate(sal_Bool bIsMDIActivate)
     390                 :            : {
     391                 :            :     // remove view from a still active drag'n'drop session
     392                 :       1148 :     SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
     393                 :            : 
     394         [ +  + ]:       1148 :     if (IsMainViewShell())
     395                 :        665 :         GetDocSh()->Disconnect(this);
     396                 :            : 
     397         [ -  + ]:       1148 :     if( pDragTransferable )
     398                 :          0 :         pDragTransferable->SetView( NULL );
     399                 :            : 
     400                 :            :     OSL_ASSERT (GetViewShell()!=NULL);
     401                 :            : 
     402                 :            :     // View-Attribute an der FrameView merken
     403                 :       1148 :     WriteFrameViewData();
     404                 :            : 
     405         [ +  - ]:       1148 :     if (bIsMDIActivate)
     406                 :            :     {
     407 [ +  - ][ +  - ]:       1148 :         rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
     408 [ +  - ][ +  - ]:       1148 :         if(xSlideShow.is() && xSlideShow->isRunning() )
         [ -  + ][ -  + ]
     409                 :            :         {
     410 [ #  # ][ #  # ]:          0 :             xSlideShow->deactivate(GetViewShellBase());
     411                 :            :         }
     412 [ +  - ][ +  + ]:       1148 :         if(HasCurrentFunction())
     413                 :            :         {
     414 [ +  - ][ +  - ]:        680 :             GetCurrentFunction()->Deactivate();
                 [ +  - ]
     415                 :       1148 :         }
     416                 :            :     }
     417                 :            : 
     418         [ +  + ]:       1148 :     if (mpHorizontalRuler.get() != NULL)
     419                 :        520 :         mpHorizontalRuler->SetActive(sal_False);
     420         [ +  + ]:       1148 :     if (mpVerticalRuler.get() != NULL)
     421                 :        520 :         mpVerticalRuler->SetActive(sal_False);
     422                 :            : 
     423                 :       1148 :     SfxShell::Deactivate(bIsMDIActivate);
     424                 :       1148 : }
     425                 :            : 
     426                 :            : 
     427                 :            : 
     428                 :            : 
     429                 :        286 : void ViewShell::Shutdown (void)
     430                 :            : {
     431                 :        286 :     Exit ();
     432                 :        286 : }
     433                 :            : 
     434                 :            : 
     435                 :            : 
     436                 :            : 
     437                 :            : /*************************************************************************
     438                 :            : |*
     439                 :            : |* Keyboard event
     440                 :            : |*
     441                 :            : \************************************************************************/
     442                 :            : 
     443                 :          0 : sal_Bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
     444                 :            : {
     445                 :          0 :     sal_Bool bReturn(sal_False);
     446                 :            : 
     447         [ #  # ]:          0 :     if(pWin)
     448                 :            :     {
     449                 :          0 :         SetActiveWindow(pWin);
     450                 :            :     }
     451                 :            : 
     452         [ #  # ]:          0 :     if(!bReturn)
     453                 :            :     {
     454                 :            :         // give key input first to SfxViewShell to give CTRL+Key
     455                 :            :         // (e.g. CTRL+SHIFT+'+', to front) priority.
     456                 :            :         OSL_ASSERT (GetViewShell()!=NULL);
     457                 :          0 :         bReturn = (sal_Bool)GetViewShell()->KeyInput(rKEvt);
     458                 :            :     }
     459                 :            : 
     460         [ #  # ]:          0 :     if(!bReturn)
     461                 :            :     {
     462 [ #  # ][ #  # ]:          0 :         rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
     463 [ #  # ][ #  # ]:          0 :         if(xSlideShow.is() && xSlideShow->isRunning())
         [ #  # ][ #  # ]
     464                 :            :         {
     465         [ #  # ]:          0 :             bReturn = xSlideShow->keyInput(rKEvt);
     466                 :            :         }
     467                 :            :         else
     468                 :            :         {
     469                 :          0 :             bool bConsumed = false;
     470         [ #  # ]:          0 :             if( GetView() )
     471         [ #  # ]:          0 :                 bConsumed = GetView()->getSmartTags().KeyInput(rKEvt);
     472                 :            : 
     473                 :            : 
     474         [ #  # ]:          0 :             if( !bConsumed )
     475                 :            :             {
     476         [ #  # ]:          0 :                 rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
     477 [ #  # ][ #  # ]:          0 :                 if( !xSelectionController.is() || !xSelectionController->onKeyInput( rKEvt, pWin ) )
         [ #  # ][ #  # ]
     478                 :            :                 {
     479 [ #  # ][ #  # ]:          0 :                     if(HasCurrentFunction())
     480 [ #  # ][ #  # ]:          0 :                         bReturn = GetCurrentFunction()->KeyInput(rKEvt);
                 [ #  # ]
     481                 :            :                 }
     482                 :            :                 else
     483                 :            :                 {
     484                 :          0 :                     bReturn = sal_True;
     485                 :          0 :                 }
     486                 :            :             }
     487                 :          0 :         }
     488                 :            :     }
     489                 :            : 
     490 [ #  # ][ #  # ]:          0 :     if(!bReturn && GetActiveWindow())
                 [ #  # ]
     491                 :            :     {
     492                 :          0 :         KeyCode aKeyCode = rKEvt.GetKeyCode();
     493                 :            : 
     494   [ #  #  #  # ]:          0 :         if (aKeyCode.IsMod1() && aKeyCode.IsShift()
         [ #  # ][ #  # ]
     495                 :          0 :             && aKeyCode.GetCode() == KEY_R)
     496                 :            :         {
     497         [ #  # ]:          0 :             InvalidateWindows();
     498                 :          0 :             bReturn = sal_True;
     499                 :            :         }
     500                 :            :     }
     501                 :            : 
     502                 :          0 :     return(bReturn);
     503                 :            : }
     504                 :            : 
     505                 :            : /*************************************************************************
     506                 :            : |*
     507                 :            : |* MouseButtonDown event
     508                 :            : |*
     509                 :            : \************************************************************************/
     510                 :            : 
     511                 :          0 : void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
     512                 :            : {
     513                 :            :     // We have to lock tool bar updates while the mouse button is pressed in
     514                 :            :     // order to prevent the shape under the mouse to be moved (this happens
     515                 :            :     // when the number of docked tool bars changes as result of a changed
     516                 :            :     // selection;  this changes the window size and thus the mouse position
     517                 :            :     // in model coordinates: with respect to model coordinates the mouse
     518                 :            :     // moves.)
     519                 :            :     OSL_ASSERT(mpImpl->mpUpdateLockForMouse.expired());
     520                 :          0 :     mpImpl->mpUpdateLockForMouse = ViewShell::Implementation::ToolBarManagerLock::Create(
     521   [ #  #  #  # ]:          0 :         GetViewShellBase().GetToolBarManager());
                 [ #  # ]
     522                 :            : 
     523 [ #  # ][ #  # ]:          0 :     if ( pWin && !pWin->HasFocus() )
                 [ #  # ]
     524                 :            :     {
     525                 :          0 :         pWin->GrabFocus();
     526                 :          0 :         SetActiveWindow(pWin);
     527                 :            :     }
     528                 :            : 
     529                 :            :     // MouseEvent in E3dView eintragen
     530         [ #  # ]:          0 :     if (GetView() != NULL)
     531                 :          0 :         GetView()->SetMouseEvent(rMEvt);
     532                 :            : 
     533                 :          0 :     bool bConsumed = false;
     534         [ #  # ]:          0 :     if( GetView() )
     535                 :          0 :         bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt );
     536                 :            : 
     537         [ #  # ]:          0 :     if( !bConsumed )
     538                 :            :     {
     539         [ #  # ]:          0 :         rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
     540 [ #  # ][ #  # ]:          0 :         if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) )
         [ #  # ][ #  # ]
     541                 :            :         {
     542 [ #  # ][ #  # ]:          0 :             if(HasCurrentFunction())
     543                 :            :             {
     544 [ #  # ][ #  # ]:          0 :                 GetCurrentFunction()->MouseButtonDown(rMEvt);
                 [ #  # ]
     545                 :            :             }
     546                 :          0 :         }
     547                 :            :     }
     548                 :          0 : }
     549                 :            : 
     550                 :            : /*************************************************************************
     551                 :            : |*
     552                 :            : |* MouseMove event
     553                 :            : |*
     554                 :            : \************************************************************************/
     555                 :            : 
     556                 :          0 : void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
     557                 :            : {
     558         [ #  # ]:          0 :     if (rMEvt.IsLeaveWindow())
     559                 :            :     {
     560         [ #  # ]:          0 :         if ( ! mpImpl->mpUpdateLockForMouse.expired())
     561                 :            :         {
     562                 :            :             ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
     563         [ #  # ]:          0 :                 mpImpl->mpUpdateLockForMouse);
     564         [ #  # ]:          0 :             if (pLock.get() != NULL)
     565 [ #  # ][ #  # ]:          0 :                 pLock->Release();
     566                 :            :         }
     567                 :            :     }
     568                 :            : 
     569         [ #  # ]:          0 :     if ( pWin )
     570                 :            :     {
     571                 :          0 :         SetActiveWindow(pWin);
     572                 :            :     }
     573                 :            : 
     574                 :            :     // MouseEvent in E3dView eintragen
     575         [ #  # ]:          0 :     if (GetView() != NULL)
     576                 :          0 :         GetView()->SetMouseEvent(rMEvt);
     577                 :            : 
     578         [ #  # ]:          0 :     if(HasCurrentFunction())
     579                 :            :     {
     580         [ #  # ]:          0 :         rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
     581 [ #  # ][ #  # ]:          0 :         if( !xSelectionController.is() || !xSelectionController->onMouseMove( rMEvt, pWin ) )
         [ #  # ][ #  # ]
     582                 :            :         {
     583 [ #  # ][ #  # ]:          0 :             if(HasCurrentFunction())
     584 [ #  # ][ #  # ]:          0 :                 GetCurrentFunction()->MouseMove(rMEvt);
                 [ #  # ]
     585                 :          0 :         }
     586                 :            :     }
     587                 :          0 : }
     588                 :            : 
     589                 :            : /*************************************************************************
     590                 :            : |*
     591                 :            : |* MouseButtonUp event
     592                 :            : |*
     593                 :            : \************************************************************************/
     594                 :            : 
     595                 :          0 : void ViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
     596                 :            : {
     597         [ #  # ]:          0 :     if ( pWin )
     598                 :            :     {
     599                 :          0 :         SetActiveWindow(pWin);
     600                 :            :     }
     601                 :            : 
     602                 :            :     // MouseEvent in E3dView eintragen
     603         [ #  # ]:          0 :     if (GetView() != NULL)
     604                 :          0 :         GetView()->SetMouseEvent(rMEvt);
     605                 :            : 
     606         [ #  # ]:          0 :     if( HasCurrentFunction())
     607                 :            :     {
     608         [ #  # ]:          0 :         rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
     609 [ #  # ][ #  # ]:          0 :         if( !xSelectionController.is() || !xSelectionController->onMouseButtonUp( rMEvt, pWin ) )
         [ #  # ][ #  # ]
     610                 :            :         {
     611 [ #  # ][ #  # ]:          0 :             if(HasCurrentFunction())
     612 [ #  # ][ #  # ]:          0 :                 GetCurrentFunction()->MouseButtonUp(rMEvt);
                 [ #  # ]
     613                 :          0 :         }
     614                 :            :     }
     615                 :            : 
     616         [ #  # ]:          0 :     if ( ! mpImpl->mpUpdateLockForMouse.expired())
     617                 :            :     {
     618                 :            :         ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
     619         [ #  # ]:          0 :             mpImpl->mpUpdateLockForMouse);
     620         [ #  # ]:          0 :         if (pLock.get() != NULL)
     621 [ #  # ][ #  # ]:          0 :             pLock->Release();
     622                 :            :     }
     623                 :          0 : }
     624                 :            : 
     625                 :            : 
     626                 :            : /*************************************************************************
     627                 :            : |*
     628                 :            : |* Command event
     629                 :            : |*
     630                 :            : \************************************************************************/
     631                 :            : 
     632                 :          0 : void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
     633                 :            : {
     634                 :          0 :     sal_Bool bDone = HandleScrollCommand (rCEvt, pWin);
     635                 :            : 
     636         [ #  # ]:          0 :     if( !bDone )
     637                 :            :     {
     638         [ #  # ]:          0 :         if( rCEvt.GetCommand() == COMMAND_INPUTLANGUAGECHANGE )
     639                 :            :         {
     640                 :            :             //#i42732# update state of fontname if input language changes
     641                 :          0 :             GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT );
     642                 :          0 :             GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
     643                 :            :         }
     644                 :            :         else
     645                 :            :         {
     646                 :          0 :             bool bConsumed = false;
     647         [ #  # ]:          0 :                if( GetView() )
     648                 :            :                {
     649                 :          0 :                 bConsumed = GetView()->getSmartTags().Command(rCEvt);
     650                 :            :             }
     651                 :            : 
     652 [ #  # ][ #  # ]:          0 :             if( !bConsumed && HasCurrentFunction())
                 [ #  # ]
     653                 :            :             {
     654         [ #  # ]:          0 :                 GetCurrentFunction()->Command(rCEvt);
     655                 :            :             }
     656                 :            :         }
     657                 :            :     }
     658                 :          0 : }
     659                 :            : 
     660                 :        797 : long ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin)
     661                 :            : {
     662                 :            :     // handle scroll commands when they arrived at child windows
     663                 :        797 :     long nRet = sal_False;
     664         [ -  + ]:        797 :     if( rNEvt.GetType() == EVENT_COMMAND )
     665                 :            :     {
     666                 :            :         // note: dynamic_cast is not possible as GetData() returns a void*
     667                 :          0 :         CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
     668                 :          0 :         nRet = HandleScrollCommand(*pCmdEvent, pWin);
     669                 :            :     }
     670                 :        797 :     return nRet;
     671                 :            : }
     672                 :            : 
     673                 :            : 
     674                 :          0 : bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin)
     675                 :            : {
     676                 :          0 :     bool bDone = false;
     677                 :            : 
     678      [ #  #  # ]:          0 :     switch( rCEvt.GetCommand() )
     679                 :            :     {
     680                 :            :         case COMMAND_WHEEL:
     681                 :            :             {
     682 [ #  # ][ #  # ]:          0 :                 Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) );
     683         [ #  # ]:          0 :                 if( xSlideShowController.is() )
     684                 :            :                 {
     685                 :            :                     // We ignore zooming with control+mouse wheel.
     686         [ #  # ]:          0 :                     const CommandWheelData* pData = rCEvt.GetWheelData();
     687 [ #  # ][ #  # ]:          0 :                     if( pData && !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) && !pData->IsHorz() )
         [ #  # ][ #  # ]
                 [ #  # ]
     688                 :            :                     {
     689                 :          0 :                         long nDelta = pData->GetDelta();
     690         [ #  # ]:          0 :                         if( nDelta > 0 )
     691                 :            :                         {
     692 [ #  # ][ #  # ]:          0 :                             xSlideShowController->gotoPreviousSlide();
     693                 :            :                         }
     694         [ #  # ]:          0 :                         else if( nDelta < 0 )
     695                 :            :                         {
     696 [ #  # ][ #  # ]:          0 :                             xSlideShowController->gotoNextEffect();
     697                 :            :                         }
     698                 :            :                     }
     699                 :            :                     break;
     700         [ #  # ]:          0 :                 }
     701                 :            :             }
     702                 :            :             // fall through when not running slideshow
     703                 :            :         case COMMAND_STARTAUTOSCROLL:
     704                 :            :         case COMMAND_AUTOSCROLL:
     705                 :            :         {
     706                 :          0 :             const CommandWheelData* pData = rCEvt.GetWheelData();
     707                 :            : 
     708         [ #  # ]:          0 :             if (pData != NULL)
     709                 :            :             {
     710         [ #  # ]:          0 :                 if (pData->IsMod1())
     711                 :            :                 {
     712         [ #  # ]:          0 :                     if( !GetDocSh()->IsUIActive() )
     713                 :            :                     {
     714                 :          0 :                         const long  nOldZoom = GetActiveWindow()->GetZoom();
     715                 :            :                         long        nNewZoom;
     716                 :            : 
     717         [ #  # ]:          0 :                         if( pData->GetDelta() < 0L )
     718                 :          0 :                             nNewZoom = Max( (long) pWin->GetMinZoom(), basegfx::zoomtools::zoomOut( nOldZoom ));
     719                 :            :                         else
     720                 :          0 :                             nNewZoom = Min( (long) pWin->GetMaxZoom(), basegfx::zoomtools::zoomIn( nOldZoom ));
     721                 :            : 
     722                 :          0 :                         SetZoom( nNewZoom );
     723                 :          0 :                         Invalidate( SID_ATTR_ZOOM );
     724                 :          0 :                         Invalidate( SID_ATTR_ZOOMSLIDER );
     725                 :            : 
     726                 :          0 :                         bDone = true;
     727                 :            :                     }
     728                 :            :                 }
     729                 :            :                 else
     730                 :            :                 {
     731         [ #  # ]:          0 :                     if( mpContentWindow.get() == pWin )
     732                 :            :                     {
     733                 :          0 :                         sal_uLong nScrollLines = pData->GetScrollLines();
     734 [ #  # ][ #  # ]:          0 :                         if(IsPageFlipMode())
     735                 :          0 :                             nScrollLines = COMMAND_WHEEL_PAGESCROLL;
     736                 :            :                         CommandWheelData aWheelData( pData->GetDelta(),pData->GetNotchDelta(),
     737         [ #  # ]:          0 :                             nScrollLines,pData->GetMode(),pData->GetModifier(),pData->IsHorz() );
     738                 :          0 :                         CommandEvent aReWrite( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),
     739         [ #  # ]:          0 :                             rCEvt.IsMouseEvent(),(const void *) &aWheelData );
     740                 :            :                         bDone = pWin->HandleScrollCommand( aReWrite,
     741                 :            :                             mpHorizontalScrollBar.get(),
     742         [ #  # ]:          0 :                             mpVerticalScrollBar.get()) == sal_True;
     743                 :            :                     }
     744                 :            :                 }
     745                 :            :             }
     746                 :            :         }
     747                 :          0 :         break;
     748                 :            : 
     749                 :            :         default:
     750                 :          0 :         break;
     751                 :            :     }
     752                 :            : 
     753                 :          0 :     return bDone;
     754                 :            : }
     755                 :            : 
     756                 :            : 
     757                 :            : 
     758                 :       1620 : void ViewShell::SetupRulers (void)
     759                 :            : {
     760 [ +  + ][ +  - ]:       1620 :     if(mbHasRulers && (mpContentWindow.get() != NULL) && !SlideShow::IsRunning(GetViewShellBase()))
         [ +  - ][ +  + ]
     761                 :            :     {
     762                 :        846 :         long nHRulerOfs = 0;
     763                 :            : 
     764         [ +  + ]:        846 :         if ( mpVerticalRuler.get() == NULL )
     765                 :            :         {
     766                 :        104 :             mpVerticalRuler.reset(CreateVRuler(GetActiveWindow()));
     767         [ +  - ]:        104 :             if ( mpVerticalRuler.get() != NULL )
     768                 :            :             {
     769                 :        104 :                 nHRulerOfs = mpVerticalRuler->GetSizePixel().Width();
     770                 :        104 :                 mpVerticalRuler->SetActive(sal_True);
     771                 :        104 :                 mpVerticalRuler->Show();
     772                 :            :             }
     773                 :            :         }
     774         [ +  + ]:        846 :         if ( mpHorizontalRuler.get() == NULL )
     775                 :            :         {
     776                 :        104 :             mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow(), sal_True));
     777         [ +  - ]:        104 :             if ( mpHorizontalRuler.get() != NULL )
     778                 :            :             {
     779                 :        104 :                 mpHorizontalRuler->SetWinPos(nHRulerOfs);
     780                 :        104 :                 mpHorizontalRuler->SetActive(sal_True);
     781                 :        104 :                 mpHorizontalRuler->Show();
     782                 :            :             }
     783                 :            :         }
     784                 :            :     }
     785                 :       1620 : }
     786                 :            : 
     787                 :            : 
     788                 :            : 
     789                 :            : 
     790                 :       1474 : sal_Bool ViewShell::HasRuler (void)
     791                 :            : {
     792                 :       1474 :     return mbHasRulers;
     793                 :            : }
     794                 :            : 
     795                 :            : 
     796                 :            : 
     797                 :            : 
     798                 :       1197 : void ViewShell::Resize (void)
     799                 :            : {
     800         [ +  - ]:       1197 :     SetupRulers ();
     801                 :            : 
     802         [ +  - ]:       1197 :     if (mpParentWindow == NULL)
     803                 :            :         return;
     804                 :            : 
     805                 :            :     // Make sure that the new size is not degenerate.
     806         [ +  - ]:       1197 :     const Size aSize (mpParentWindow->GetSizePixel());
     807 [ +  + ][ -  + ]:       1197 :     if (aSize.Width()==0 || aSize.Height()==0)
                 [ +  + ]
     808                 :            :         return;
     809                 :            : 
     810                 :            :     // Remember the new position and size.
     811                 :        610 :     maViewPos = Point(0,0);
     812                 :        610 :     maViewSize = aSize;
     813                 :            : 
     814                 :            :     // Rearrange the UI elements to take care of the new position and size.
     815         [ +  - ]:        610 :     ArrangeGUIElements ();
     816                 :            :     // end of included AdjustPosSizePixel.
     817                 :            : 
     818                 :        610 :     ::sd::View* pView = GetView();
     819                 :            : 
     820         [ +  + ]:        610 :     if (pView)
     821                 :            :     {
     822         [ +  - ]:       1197 :         pView->VisAreaChanged(GetActiveWindow());
     823                 :            :     }
     824                 :            : }
     825                 :            : 
     826                 :        558 : SvBorder ViewShell::GetBorder (bool )
     827                 :            : {
     828                 :        558 :     SvBorder aBorder;
     829                 :            : 
     830                 :            :     // Horizontal scrollbar.
     831         [ +  - ]:       1116 :     if (mpHorizontalScrollBar.get()!=NULL
           [ +  -  +  - ]
     832                 :        558 :         && mpHorizontalScrollBar->IsVisible())
     833                 :            :     {
     834                 :        558 :         aBorder.Bottom() = maScrBarWH.Height();
     835                 :            :     }
     836                 :            : 
     837                 :            :     // Vertical scrollbar.
     838   [ +  -  +  - ]:       1116 :     if (mpVerticalScrollBar.get()!=NULL
                 [ +  - ]
     839                 :        558 :         && mpVerticalScrollBar->IsVisible())
     840                 :            :     {
     841                 :        558 :         aBorder.Right() = maScrBarWH.Width();
     842                 :            :     }
     843                 :            : 
     844                 :            :     // Place horizontal ruler below tab bar.
     845 [ +  + ][ +  - ]:        558 :     if (mbHasRulers && mpContentWindow.get() != NULL)
                 [ +  + ]
     846                 :            :     {
     847                 :        423 :         SetupRulers();
     848         [ +  - ]:        423 :         if (mpHorizontalRuler.get() != NULL)
     849                 :        423 :             aBorder.Top() = mpHorizontalRuler->GetSizePixel().Height();
     850         [ +  - ]:        423 :         if (mpVerticalRuler.get() != NULL)
     851                 :        423 :             aBorder.Left() = mpVerticalRuler->GetSizePixel().Width();
     852                 :            :     }
     853                 :            : 
     854                 :        558 :     return aBorder;
     855                 :            : }
     856                 :            : 
     857                 :            : 
     858                 :            : 
     859                 :            : 
     860                 :        477 : void ViewShell::ArrangeGUIElements (void)
     861                 :            : {
     862         [ +  - ]:        477 :     if (mpImpl->mbArrangeActive)
     863                 :        477 :         return;
     864                 :        477 :     mpImpl->mbArrangeActive = true;
     865                 :            : 
     866                 :            :     // Calculate border for in-place editing.
     867                 :        477 :     long nLeft = maViewPos.X();
     868                 :        477 :     long nTop  = maViewPos.Y();
     869                 :        477 :     long nRight = maViewPos.X() + maViewSize.Width();
     870                 :        477 :     long nBottom = maViewPos.Y() + maViewSize.Height();
     871                 :            : 
     872                 :            :     // Horizontal scrollbar.
     873 [ +  - ][ +  + ]:        924 :     if (mpHorizontalScrollBar.get()!=NULL
                 [ +  + ]
     874         [ +  - ]:        447 :         && mpHorizontalScrollBar->IsVisible())
     875                 :            :     {
     876                 :        447 :         int nLocalLeft = nLeft;
     877 [ +  + ][ +  - ]:        447 :         if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
         [ +  - ][ +  + ]
     878         [ +  - ]:        319 :             nLocalLeft += mpLayerTabBar->GetSizePixel().Width();
     879                 :        447 :         nBottom -= maScrBarWH.Height();
     880                 :        447 :         mpHorizontalScrollBar->SetPosSizePixel (
     881                 :            :             Point(nLocalLeft,nBottom),
     882         [ +  - ]:        447 :             Size(nRight-nLocalLeft-maScrBarWH.Width(),maScrBarWH.Height()));
     883                 :            :     }
     884                 :            : 
     885                 :            :     // Vertical scrollbar.
     886 [ +  + ][ +  - ]:        924 :     if (mpVerticalScrollBar.get()!=NULL
                 [ +  + ]
     887         [ +  - ]:        447 :         && mpVerticalScrollBar->IsVisible())
     888                 :            :     {
     889                 :        447 :         nRight -= maScrBarWH.Width();
     890                 :        447 :         mpVerticalScrollBar->SetPosSizePixel (
     891                 :            :             Point(nRight,nTop),
     892         [ +  - ]:        447 :             Size (maScrBarWH.Width(),nBottom-nTop));
     893                 :            :     }
     894                 :            : 
     895                 :            :     // Filler in the lower right corner.
     896         [ +  + ]:        477 :     if (mpScrollBarBox.get() != NULL)
     897                 :            :     {
     898         [ +  - ]:       1788 :         if (mpHorizontalScrollBar.get()!=NULL
           [ +  -  +  - ]
         [ +  - ][ +  - ]
     899         [ +  - ]:        447 :             && mpHorizontalScrollBar->IsVisible()
     900                 :        447 :             && mpVerticalScrollBar.get()!=NULL
     901         [ +  - ]:        447 :             && mpVerticalScrollBar->IsVisible())
     902                 :            :         {
     903         [ +  - ]:        447 :             mpScrollBarBox->Show();
     904         [ +  - ]:        447 :             mpScrollBarBox->SetPosSizePixel(Point(nRight, nBottom), maScrBarWH);
     905                 :            :         }
     906                 :            :         else
     907         [ #  # ]:          0 :             mpScrollBarBox->Hide();
     908                 :            :     }
     909                 :            : 
     910                 :            :     // Place horizontal ruler below tab bar.
     911 [ +  + ][ +  - ]:        477 :     if (mbHasRulers && mpContentWindow.get() != NULL)
                 [ +  + ]
     912                 :            :     {
     913         [ +  - ]:        319 :         if (mpHorizontalRuler.get() != NULL)
     914                 :            :         {
     915         [ +  - ]:        319 :             Size aRulerSize = mpHorizontalRuler->GetSizePixel();
     916                 :        319 :             aRulerSize.Width() = nRight - nLeft;
     917                 :        319 :             mpHorizontalRuler->SetPosSizePixel (
     918         [ +  - ]:        319 :                 Point(nLeft,nTop), aRulerSize);
     919         [ +  - ]:        319 :             if (mpVerticalRuler.get() != NULL)
     920                 :        319 :                 mpHorizontalRuler->SetBorderPos(
     921 [ +  - ][ +  - ]:        638 :                     mpVerticalRuler->GetSizePixel().Width()-1);
     922                 :        319 :             nTop += aRulerSize.Height();
     923                 :            :         }
     924         [ +  - ]:        319 :         if (mpVerticalRuler.get() != NULL)
     925                 :            :         {
     926         [ +  - ]:        319 :             Size aRulerSize = mpVerticalRuler->GetSizePixel();
     927                 :        319 :             aRulerSize.Height() = nBottom  - nTop;
     928                 :        319 :             mpVerticalRuler->SetPosSizePixel (
     929         [ +  - ]:        319 :                 Point (nLeft,nTop), aRulerSize);
     930                 :        319 :             nLeft += aRulerSize.Width();
     931                 :            :         }
     932                 :            :     }
     933                 :            : 
     934 [ +  - ][ +  - ]:        477 :     rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
     935                 :            : 
     936                 :            :     // The size of the window of the center pane is set differently from
     937                 :            :     // that of the windows in the docking windows.
     938 [ +  - ][ +  - ]:        477 :     bool bSlideShowActive = (xSlideShow.is() && xSlideShow->isRunning()) && !xSlideShow->isFullScreen() && xSlideShow->getAnimationMode() == ANIMATIONMODE_SHOW;
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     939         [ +  - ]:        477 :     if ( !bSlideShowActive)
     940                 :            :     {
     941                 :            :         OSL_ASSERT (GetViewShell()!=NULL);
     942                 :            : 
     943                 :        477 :         mpContentWindow->SetPosSizePixel(
     944                 :            :             Point(nLeft,nTop),
     945         [ +  - ]:        477 :             Size(nRight-nLeft,nBottom-nTop));
     946                 :            :     }
     947                 :            : 
     948                 :            :     // Windows in the center and rulers at the left and top side.
     949                 :            :     maAllWindowRectangle = Rectangle(
     950                 :            :         maViewPos,
     951                 :        477 :         Size(maViewSize.Width()-maScrBarWH.Width(),
     952         [ +  - ]:        954 :             maViewSize.Height()-maScrBarWH.Height()));
     953                 :            : 
     954         [ +  - ]:        477 :     if (mpContentWindow.get() != NULL)
     955                 :            :     {
     956         [ +  - ]:        477 :         mpContentWindow->UpdateMapOrigin();
     957                 :            :     }
     958                 :            : 
     959         [ +  - ]:        477 :     UpdateScrollBars();
     960                 :            : 
     961                 :        477 :     mpImpl->mbArrangeActive = false;
     962                 :            : }
     963                 :            : 
     964                 :            : 
     965                 :            : 
     966                 :            : 
     967                 :          0 : void ViewShell::SetUIUnit(FieldUnit eUnit)
     968                 :            : {
     969                 :            :     // Set unit at horizontal and vertical rulers.
     970         [ #  # ]:          0 :     if (mpHorizontalRuler.get() != NULL)
     971                 :          0 :         mpHorizontalRuler->SetUnit(eUnit);
     972                 :            : 
     973                 :            : 
     974         [ #  # ]:          0 :     if (mpVerticalRuler.get() != NULL)
     975                 :          0 :         mpVerticalRuler->SetUnit(eUnit);
     976                 :          0 : }
     977                 :            : 
     978                 :            : /*************************************************************************
     979                 :            : |*
     980                 :            : |* DefTab an den horizontalen Linealen setzen
     981                 :            : |*
     982                 :            : \************************************************************************/
     983                 :          0 : void ViewShell::SetDefTabHRuler( sal_uInt16 nDefTab )
     984                 :            : {
     985         [ #  # ]:          0 :     if (mpHorizontalRuler.get() != NULL)
     986                 :          0 :         mpHorizontalRuler->SetDefTabDist( nDefTab );
     987                 :          0 : }
     988                 :            : 
     989                 :            : 
     990                 :            : 
     991                 :            : 
     992                 :            : /** Tell the FmFormShell that the view shell is closing.  Give it the
     993                 :            :     oportunity to prevent that.
     994                 :            : */
     995                 :        260 : sal_uInt16 ViewShell::PrepareClose (sal_Bool bUI, sal_Bool bForBrowsing)
     996                 :            : {
     997                 :        260 :     sal_uInt16 nResult = sal_True;
     998                 :            : 
     999         [ +  - ]:        260 :     FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
    1000         [ +  - ]:        260 :     if (pFormShell != NULL)
    1001                 :        260 :         nResult = pFormShell->PrepareClose (bUI, bForBrowsing);
    1002                 :            : 
    1003                 :        260 :     return nResult;
    1004                 :            : }
    1005                 :            : 
    1006                 :            : 
    1007                 :            : 
    1008                 :            : 
    1009                 :        995 : void ViewShell::UpdatePreview (SdPage*, sal_Bool )
    1010                 :            : {
    1011                 :            :     // Do nothing.  After the actual preview has been removed,
    1012                 :            :     // OutlineViewShell::UpdatePreview() is the place where something
    1013                 :            :     // usefull is still done.
    1014                 :        995 : }
    1015                 :            : 
    1016                 :        518 : ::svl::IUndoManager* ViewShell::ImpGetUndoManager (void) const
    1017                 :            : {
    1018                 :        518 :     const ViewShell* pMainViewShell = GetViewShellBase().GetMainViewShell().get();
    1019                 :            : 
    1020         [ -  + ]:        518 :     if( pMainViewShell == 0 )
    1021                 :          0 :         pMainViewShell = this;
    1022                 :            : 
    1023                 :        518 :     ::sd::View* pView = pMainViewShell->GetView();
    1024                 :            : 
    1025                 :            :     // check for text edit our outline view
    1026         [ +  - ]:        518 :     if( pView )
    1027                 :            :     {
    1028         [ -  + ]:        518 :         if( pMainViewShell->GetShellType() == ViewShell::ST_OUTLINE )
    1029                 :            :         {
    1030         [ #  # ]:          0 :             OutlineView* pOlView = dynamic_cast< OutlineView* >( pView );
    1031         [ #  # ]:          0 :             if( pOlView )
    1032                 :            :             {
    1033                 :          0 :                 ::Outliner* pOutl = pOlView->GetOutliner();
    1034         [ #  # ]:          0 :                 if( pOutl )
    1035                 :          0 :                     return &pOutl->GetUndoManager();
    1036                 :            :             }
    1037                 :            :         }
    1038         [ -  + ]:        518 :         else if( pView->IsTextEdit() )
    1039                 :            :         {
    1040                 :          0 :             SdrOutliner* pOL = pView->GetTextEditOutliner();
    1041         [ #  # ]:          0 :             if( pOL )
    1042                 :          0 :                 return &pOL->GetUndoManager();
    1043                 :            :         }
    1044                 :            :     }
    1045                 :            : 
    1046         [ +  - ]:        518 :     if( GetDocSh() )
    1047                 :        518 :         return GetDocSh()->GetUndoManager();
    1048                 :            : 
    1049                 :        518 :     return NULL;
    1050                 :            : }
    1051                 :            : 
    1052                 :            : 
    1053                 :            : 
    1054                 :            : 
    1055                 :          0 : void ViewShell::ImpGetUndoStrings(SfxItemSet &rSet) const
    1056                 :            : {
    1057                 :          0 :     ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
    1058         [ #  # ]:          0 :     if(pUndoManager)
    1059                 :            :     {
    1060                 :          0 :         sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
    1061         [ #  # ]:          0 :         if(nCount)
    1062                 :            :         {
    1063                 :            :             // prepare list
    1064         [ #  # ]:          0 :             ::std::vector< String > aStringList;
    1065                 :            : 
    1066         [ #  # ]:          0 :             for (sal_uInt16 a = 0; a < nCount; ++a)
    1067                 :            :             {
    1068                 :            :                 // generate one String in list per undo step
    1069 [ #  # ][ #  # ]:          0 :                 aStringList.push_back( String(pUndoManager->GetUndoActionComment(a)) );
         [ #  # ][ #  # ]
    1070                 :            :             }
    1071                 :            : 
    1072                 :            :             // set item
    1073 [ #  # ][ #  # ]:          0 :             rSet.Put(SfxStringListItem(SID_GETUNDOSTRINGS, &aStringList));
                 [ #  # ]
    1074                 :            :         }
    1075                 :            :         else
    1076                 :            :         {
    1077                 :          0 :             rSet.DisableItem(SID_GETUNDOSTRINGS);
    1078                 :            :         }
    1079                 :            :     }
    1080                 :          0 : }
    1081                 :            : 
    1082                 :            : // -----------------------------------------------------------------------------
    1083                 :            : 
    1084                 :          0 : void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const
    1085                 :            : {
    1086                 :          0 :     ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
    1087         [ #  # ]:          0 :     if(pUndoManager)
    1088                 :            :     {
    1089                 :          0 :         sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
    1090         [ #  # ]:          0 :         if(nCount)
    1091                 :            :         {
    1092                 :            :             // prepare list
    1093         [ #  # ]:          0 :             ::std::vector< String > aStringList;
    1094                 :            :             sal_uInt16 a;
    1095                 :            : 
    1096         [ #  # ]:          0 :             for( a = 0; a < nCount; a++)
    1097                 :            :             {
    1098                 :            :                 // generate one String in list per undo step
    1099 [ #  # ][ #  # ]:          0 :                 aStringList.push_back( String(pUndoManager->GetRedoActionComment(a)) );
         [ #  # ][ #  # ]
    1100                 :            :             }
    1101                 :            : 
    1102                 :            :             // set item
    1103 [ #  # ][ #  # ]:          0 :             rSet.Put(SfxStringListItem(SID_GETREDOSTRINGS, &aStringList));
                 [ #  # ]
    1104                 :            :         }
    1105                 :            :         else
    1106                 :            :         {
    1107                 :          0 :             rSet.DisableItem(SID_GETREDOSTRINGS);
    1108                 :            :         }
    1109                 :            :     }
    1110                 :          0 : }
    1111                 :            : 
    1112                 :            : // -----------------------------------------------------------------------------
    1113                 :            : 
    1114                 :         12 : void ViewShell::ImpSidUndo(sal_Bool, SfxRequest& rReq)
    1115                 :            : {
    1116                 :         12 :     ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
    1117                 :         12 :     sal_uInt16 nNumber(1);
    1118                 :         12 :     const SfxItemSet* pReqArgs = rReq.GetArgs();
    1119                 :            : 
    1120         [ -  + ]:         12 :     if(pReqArgs)
    1121                 :            :     {
    1122                 :          0 :         SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_UNDO);
    1123                 :          0 :         nNumber = pUIntItem->GetValue();
    1124                 :            :     }
    1125                 :            : 
    1126 [ +  - ][ +  - ]:         12 :     if(nNumber && pUndoManager)
    1127                 :            :     {
    1128                 :         12 :         sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
    1129         [ +  - ]:         12 :         if(nCount >= nNumber)
    1130                 :            :         {
    1131                 :            :             try
    1132                 :            :             {
    1133                 :            :                 // when UndoStack is cleared by ModifyPageUndoAction
    1134                 :            :                 // the nCount may have changed, so test GetUndoActionCount()
    1135 [ +  + ][ +  - ]:         20 :                 while(nNumber-- && pUndoManager->GetUndoActionCount())
         [ +  - ][ +  + ]
    1136                 :            :                 {
    1137         [ +  + ]:         12 :                     pUndoManager->Undo();
    1138                 :            :                 }
    1139                 :            :             }
    1140                 :          4 :             catch( const Exception& )
    1141                 :            :             {
    1142                 :            :                 // no need to handle. By definition, the UndoManager handled this by clearing the
    1143                 :            :                 // Undo/Redo stacks
    1144                 :            :             }
    1145                 :            :         }
    1146                 :            : 
    1147                 :            :         // refresh rulers, maybe UNDO was move of TAB marker in ruler
    1148         [ +  + ]:         12 :         if (mbHasRulers)
    1149                 :            :         {
    1150                 :          6 :             Invalidate(SID_ATTR_TABSTOP);
    1151                 :            :         }
    1152                 :            :     }
    1153                 :            : 
    1154                 :            :     // This one is corresponding to the default handling
    1155                 :            :     // of SID_UNDO in sfx2
    1156                 :         12 :     GetViewFrame()->GetBindings().InvalidateAll(sal_False);
    1157                 :            : 
    1158                 :         12 :     rReq.Done();
    1159         [ -  + ]:         16 : }
    1160                 :            : 
    1161                 :            : // -----------------------------------------------------------------------------
    1162                 :            : 
    1163                 :          4 : void ViewShell::ImpSidRedo(sal_Bool, SfxRequest& rReq)
    1164                 :            : {
    1165                 :          4 :     ::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
    1166                 :          4 :     sal_uInt16 nNumber(1);
    1167                 :          4 :     const SfxItemSet* pReqArgs = rReq.GetArgs();
    1168                 :            : 
    1169         [ -  + ]:          4 :     if(pReqArgs)
    1170                 :            :     {
    1171                 :          0 :         SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_REDO);
    1172                 :          0 :         nNumber = pUIntItem->GetValue();
    1173                 :            :     }
    1174                 :            : 
    1175 [ +  - ][ +  - ]:          4 :     if(nNumber && pUndoManager)
    1176                 :            :     {
    1177                 :          4 :         sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
    1178         [ +  - ]:          4 :         if(nCount >= nNumber)
    1179                 :            :         {
    1180                 :            :             try
    1181                 :            :             {
    1182                 :            :                 // when UndoStack is cleared by ModifyPageRedoAction
    1183                 :            :                 // the nCount may have changed, so test GetRedoActionCount()
    1184 [ +  - ][ +  - ]:          4 :                 while(nNumber-- && pUndoManager->GetRedoActionCount())
         [ +  - ][ +  - ]
    1185                 :            :                 {
    1186         [ -  + ]:          4 :                     pUndoManager->Redo();
    1187                 :            :                 }
    1188                 :            :             }
    1189                 :          4 :             catch( const Exception& )
    1190                 :            :             {
    1191                 :            :                 // no need to handle. By definition, the UndoManager handled this by clearing the
    1192                 :            :                 // Undo/Redo stacks
    1193                 :            :             }
    1194                 :            :         }
    1195                 :            : 
    1196                 :            :         // refresh rulers, maybe REDO was move of TAB marker in ruler
    1197         [ +  + ]:          4 :         if (mbHasRulers)
    1198                 :            :         {
    1199                 :          2 :             Invalidate(SID_ATTR_TABSTOP);
    1200                 :            :         }
    1201                 :            :     }
    1202                 :            : 
    1203                 :            :     // This one is corresponding to the default handling
    1204                 :            :     // of SID_UNDO in sfx2
    1205                 :          4 :     GetViewFrame()->GetBindings().InvalidateAll(sal_False);
    1206                 :            : 
    1207                 :          4 :     rReq.Done();
    1208         [ -  + ]:          8 : }
    1209                 :            : 
    1210                 :            : // -----------------------------------------------------------------------------
    1211                 :            : 
    1212                 :          0 : void ViewShell::ExecReq( SfxRequest& rReq )
    1213                 :            : {
    1214                 :          0 :     sal_uInt16 nSlot = rReq.GetSlot();
    1215      [ #  #  # ]:          0 :     switch( nSlot )
    1216                 :            :     {
    1217                 :            :         case SID_MAIL_SCROLLBODY_PAGEDOWN:
    1218                 :            :         {
    1219         [ #  # ]:          0 :             FunctionReference xFunc( GetCurrentFunction() );
    1220         [ #  # ]:          0 :             if( xFunc.is() )
    1221         [ #  # ]:          0 :                 ScrollLines( 0, -1 );
    1222                 :            : 
    1223 [ #  # ][ #  # ]:          0 :             rReq.Done();
    1224                 :            :         }
    1225                 :          0 :         break;
    1226                 :            : 
    1227                 :            :         case SID_OUTPUT_QUALITY_COLOR:
    1228                 :            :         case SID_OUTPUT_QUALITY_GRAYSCALE:
    1229                 :            :         case SID_OUTPUT_QUALITY_BLACKWHITE:
    1230                 :            :         case SID_OUTPUT_QUALITY_CONTRAST:
    1231                 :            :         {
    1232                 :          0 :             sal_uLong nMode = OUTPUT_DRAWMODE_COLOR;
    1233                 :            : 
    1234   [ #  #  #  #  :          0 :             switch( nSlot )
                      # ]
    1235                 :            :             {
    1236                 :          0 :                 case SID_OUTPUT_QUALITY_COLOR: nMode = OUTPUT_DRAWMODE_COLOR; break;
    1237                 :          0 :                 case SID_OUTPUT_QUALITY_GRAYSCALE: nMode = OUTPUT_DRAWMODE_GRAYSCALE; break;
    1238                 :          0 :                 case SID_OUTPUT_QUALITY_BLACKWHITE: nMode = OUTPUT_DRAWMODE_BLACKWHITE; break;
    1239                 :          0 :                 case SID_OUTPUT_QUALITY_CONTRAST: nMode = OUTPUT_DRAWMODE_CONTRAST; break;
    1240                 :            :             }
    1241                 :            : 
    1242                 :          0 :             GetActiveWindow()->SetDrawMode( nMode );
    1243                 :          0 :             mpFrameView->SetDrawMode( nMode );
    1244                 :            : 
    1245                 :          0 :             GetActiveWindow()->Invalidate();
    1246                 :            : 
    1247                 :          0 :             Invalidate();
    1248                 :          0 :             rReq.Done();
    1249                 :          0 :             break;
    1250                 :            :         }
    1251                 :            :     }
    1252                 :          0 : }
    1253                 :            : 
    1254                 :            : 
    1255                 :            : 
    1256                 :            : 
    1257                 :            : /** This default implemenation returns only an empty reference.  See derived
    1258                 :            :     classes for more interesting examples.
    1259                 :            : */
    1260                 :            : ::com::sun::star::uno::Reference<
    1261                 :            :     ::com::sun::star::accessibility::XAccessible>
    1262                 :          0 : ViewShell::CreateAccessibleDocumentView (::sd::Window* )
    1263                 :            : {
    1264                 :            :     OSL_FAIL("ViewShell::CreateAccessibleDocumentView should not be called!, perhaps Meyers, 3rd edition, Item 9:\n");
    1265                 :            : 
    1266                 :            :     return ::com::sun::star::uno::Reference<
    1267                 :          0 :         ::com::sun::star::accessibility::XAccessible> ();
    1268                 :            : }
    1269                 :            : 
    1270                 :            : 
    1271                 :            : 
    1272                 :        832 : ::sd::WindowUpdater* ViewShell::GetWindowUpdater (void) const
    1273                 :            : {
    1274                 :        832 :     return mpWindowUpdater.get();
    1275                 :            : }
    1276                 :            : 
    1277                 :            : 
    1278                 :            : 
    1279                 :            : 
    1280                 :      93153 : ViewShellBase& ViewShell::GetViewShellBase (void) const
    1281                 :            : {
    1282                 :      93153 :     return *static_cast<ViewShellBase*>(GetViewShell());
    1283                 :            : }
    1284                 :            : 
    1285                 :            : 
    1286                 :            : 
    1287                 :            : 
    1288                 :       2782 : ViewShell::ShellType ViewShell::GetShellType (void) const
    1289                 :            : {
    1290                 :       2782 :     return meShellType;
    1291                 :            : }
    1292                 :            : 
    1293                 :            : 
    1294                 :            : 
    1295                 :            : 
    1296                 :      32098 : DrawDocShell* ViewShell::GetDocSh (void) const
    1297                 :            : {
    1298                 :      32098 :     return GetViewShellBase().GetDocShell();
    1299                 :            : }
    1300                 :            : 
    1301                 :            : 
    1302                 :            : 
    1303                 :            : 
    1304                 :      29413 : SdDrawDocument* ViewShell::GetDoc (void) const
    1305                 :            : {
    1306                 :      29413 :     return GetViewShellBase().GetDocument();
    1307                 :            : }
    1308                 :            : 
    1309                 :          0 : ErrCode ViewShell::DoVerb (long )
    1310                 :            : {
    1311                 :          0 :     return ERRCODE_NONE;
    1312                 :            : }
    1313                 :            : 
    1314                 :        260 : void ViewShell::SetCurrentFunction( const FunctionReference& xFunction)
    1315                 :            : {
    1316 [ -  + ][ #  # ]:        260 :     if( mxCurrentFunction.is() && (mxOldFunction != mxCurrentFunction) )
                 [ -  + ]
    1317         [ #  # ]:          0 :         mxCurrentFunction->Dispose();
    1318         [ +  - ]:        260 :     FunctionReference xTemp( mxCurrentFunction );
    1319 [ +  - ][ +  - ]:        260 :     mxCurrentFunction = xFunction;
    1320                 :        260 : }
    1321                 :            : 
    1322                 :        260 : void ViewShell::SetOldFunction(const FunctionReference& xFunction)
    1323                 :            : {
    1324 [ -  + ][ #  # ]:        260 :     if( mxOldFunction.is() && (xFunction != mxOldFunction) && (mxCurrentFunction != mxOldFunction) )
         [ #  # ][ -  + ]
    1325         [ #  # ]:          0 :         mxOldFunction->Dispose();
    1326                 :            : 
    1327         [ +  - ]:        260 :     FunctionReference xTemp( mxOldFunction );
    1328 [ +  - ][ +  - ]:        260 :     mxOldFunction = xFunction;
    1329                 :        260 : }
    1330                 :            : 
    1331                 :            : /** this method deactivates the current function. If an old function is
    1332                 :            :     saved, this will become activated and current function.
    1333                 :            : */
    1334                 :          0 : void ViewShell::Cancel()
    1335                 :            : {
    1336 [ #  # ][ #  # ]:          0 :     if(mxCurrentFunction.is() && (mxCurrentFunction != mxOldFunction ))
                 [ #  # ]
    1337                 :            :     {
    1338         [ #  # ]:          0 :         FunctionReference xTemp( mxCurrentFunction );
    1339         [ #  # ]:          0 :         mxCurrentFunction.clear();
    1340         [ #  # ]:          0 :         xTemp->Deactivate();
    1341 [ #  # ][ #  # ]:          0 :         xTemp->Dispose();
    1342                 :            :     }
    1343                 :            : 
    1344         [ #  # ]:          0 :     if(mxOldFunction.is())
    1345                 :            :     {
    1346                 :          0 :         mxCurrentFunction = mxOldFunction;
    1347                 :          0 :         mxCurrentFunction->Activate();
    1348                 :            :     }
    1349                 :          0 : }
    1350                 :            : 
    1351                 :        130 : void ViewShell::DeactivateCurrentFunction( bool bPermanent /* == false */ )
    1352                 :            : {
    1353         [ +  - ]:        130 :     if( mxCurrentFunction.is() )
    1354                 :            :     {
    1355 [ -  + ][ #  # ]:        130 :         if(bPermanent && (mxOldFunction == mxCurrentFunction))
                 [ -  + ]
    1356         [ #  # ]:          0 :             mxOldFunction.clear();
    1357                 :            : 
    1358         [ +  - ]:        130 :         mxCurrentFunction->Deactivate();
    1359         [ -  + ]:        130 :         if( mxCurrentFunction != mxOldFunction )
    1360         [ #  # ]:          0 :             mxCurrentFunction->Dispose();
    1361                 :            : 
    1362         [ +  - ]:        130 :         FunctionReference xTemp( mxCurrentFunction );
    1363 [ +  - ][ +  - ]:        130 :         mxCurrentFunction.clear();
    1364                 :            :     }
    1365                 :        130 : }
    1366                 :            : 
    1367                 :        260 : void ViewShell::DisposeFunctions()
    1368                 :            : {
    1369         [ +  + ]:        260 :     if(mxCurrentFunction.is())
    1370                 :            :     {
    1371         [ +  - ]:        130 :         FunctionReference xTemp( mxCurrentFunction );
    1372         [ +  - ]:        130 :         mxCurrentFunction.clear();
    1373         [ +  - ]:        130 :         xTemp->Deactivate();
    1374 [ +  - ][ +  - ]:        130 :         xTemp->Dispose();
    1375                 :            :     }
    1376                 :            : 
    1377         [ +  - ]:        260 :     if(mxOldFunction.is())
    1378                 :            :     {
    1379         [ +  - ]:        260 :         FunctionReference xTemp( mxOldFunction );
    1380         [ +  - ]:        260 :         mxOldFunction->Dispose();
    1381 [ +  - ][ +  - ]:        260 :         mxOldFunction.clear();
    1382                 :            :     }
    1383                 :        260 : }
    1384                 :            : 
    1385                 :       5400 : bool ViewShell::IsMainViewShell (void) const
    1386                 :            : {
    1387                 :       5400 :     return mpImpl->mbIsMainViewShell;
    1388                 :            : }
    1389                 :            : 
    1390                 :        572 : void ViewShell::SetIsMainViewShell (bool bIsMainViewShell)
    1391                 :            : {
    1392         [ +  + ]:        572 :     if (bIsMainViewShell != mpImpl->mbIsMainViewShell)
    1393                 :            :     {
    1394                 :        260 :         mpImpl->mbIsMainViewShell = bIsMainViewShell;
    1395         [ +  + ]:        260 :         if (bIsMainViewShell)
    1396                 :            :         {
    1397                 :        130 :             GetDocSh()->Connect (this);
    1398                 :            :         }
    1399                 :            :         else
    1400                 :            :         {
    1401                 :        130 :             GetDocSh()->Disconnect (this);
    1402                 :            :         }
    1403                 :            :     }
    1404                 :        572 : }
    1405                 :            : 
    1406                 :            : 
    1407                 :            : 
    1408                 :            : 
    1409                 :      13784 : ::sd::Window* ViewShell::GetActiveWindow (void) const
    1410                 :            : {
    1411                 :      13784 :     return mpActiveWindow;
    1412                 :            : }
    1413                 :            : 
    1414                 :            : 
    1415                 :            : 
    1416                 :            : 
    1417                 :       1608 : void ViewShell::PrePaint()
    1418                 :            : {
    1419                 :       1608 : }
    1420                 :            : 
    1421                 :            : 
    1422                 :            : 
    1423                 :            : 
    1424                 :          0 : void ViewShell::Paint (const Rectangle&, ::sd::Window* )
    1425                 :            : {
    1426                 :          0 : }
    1427                 :            : 
    1428                 :            : 
    1429                 :            : 
    1430                 :            : 
    1431                 :          0 : void ViewShell::Draw(OutputDevice &, const Region &)
    1432                 :            : {
    1433                 :          0 : }
    1434                 :            : 
    1435                 :            : 
    1436                 :            : 
    1437                 :            : 
    1438                 :          0 : ZoomList* ViewShell::GetZoomList (void)
    1439                 :            : {
    1440                 :          0 :     return mpZoomList;
    1441                 :            : }
    1442                 :            : 
    1443                 :            : 
    1444                 :            : 
    1445                 :            : 
    1446                 :          0 : void ViewShell::ShowUIControls (bool bVisible)
    1447                 :            : {
    1448                 :          0 :     mpImpl->mbIsShowingUIControls = bVisible;
    1449                 :            : 
    1450         [ #  # ]:          0 :     if (mbHasRulers)
    1451                 :            :     {
    1452         [ #  # ]:          0 :         if (mpHorizontalRuler.get() != NULL)
    1453                 :          0 :             mpHorizontalRuler->Show( bVisible );
    1454                 :            : 
    1455         [ #  # ]:          0 :         if (mpVerticalRuler.get() != NULL)
    1456                 :          0 :             mpVerticalRuler->Show( bVisible );
    1457                 :            :     }
    1458                 :            : 
    1459         [ #  # ]:          0 :     if (mpVerticalScrollBar.get() != NULL)
    1460                 :          0 :         mpVerticalScrollBar->Show( bVisible );
    1461                 :            : 
    1462         [ #  # ]:          0 :     if (mpHorizontalScrollBar.get() != NULL)
    1463                 :          0 :         mpHorizontalScrollBar->Show( bVisible );
    1464                 :            : 
    1465         [ #  # ]:          0 :     if (mpScrollBarBox.get() != NULL)
    1466                 :          0 :         mpScrollBarBox->Show(bVisible);
    1467                 :            : 
    1468         [ #  # ]:          0 :     if (mpContentWindow.get() != NULL)
    1469                 :          0 :         mpContentWindow->Show( bVisible );
    1470                 :          0 : }
    1471                 :            : 
    1472                 :            : 
    1473                 :            : 
    1474                 :            : 
    1475                 :            : 
    1476                 :        156 : bool ViewShell::RelocateToParentWindow (::Window* pParentWindow)
    1477                 :            : {
    1478                 :        156 :     mpParentWindow = pParentWindow;
    1479                 :            : 
    1480         [ +  - ]:        156 :     mpParentWindow->SetBackground (Wallpaper());
    1481                 :            : 
    1482         [ +  - ]:        156 :     if (mpContentWindow.get() != NULL)
    1483                 :        156 :         mpContentWindow->SetParent(pParentWindow);
    1484                 :            : 
    1485         [ +  + ]:        156 :     if (mpHorizontalScrollBar.get() != NULL)
    1486                 :        130 :         mpHorizontalScrollBar->SetParent(mpParentWindow);
    1487         [ +  + ]:        156 :     if (mpVerticalScrollBar.get() != NULL)
    1488                 :        130 :         mpVerticalScrollBar->SetParent(mpParentWindow);
    1489         [ +  + ]:        156 :     if (mpScrollBarBox.get() != NULL)
    1490                 :        130 :         mpScrollBarBox->SetParent(mpParentWindow);
    1491                 :            : 
    1492                 :        156 :     return true;
    1493                 :            : }
    1494                 :            : 
    1495                 :            : 
    1496                 :            : 
    1497                 :            : } // end of namespace sd
    1498                 :            : 
    1499                 :            : 
    1500                 :            : 
    1501                 :            : 
    1502                 :            : 
    1503                 :            : //===== ViewShellObjectBarFactory =============================================
    1504                 :            : 
    1505                 :            : namespace {
    1506                 :            : 
    1507                 :        286 : ViewShellObjectBarFactory::ViewShellObjectBarFactory (
    1508                 :            :     ::sd::ViewShell& rViewShell)
    1509         [ +  - ]:        286 :     : mrViewShell (rViewShell)
    1510                 :            : {
    1511                 :        286 : }
    1512                 :            : 
    1513                 :            : 
    1514                 :            : 
    1515                 :            : 
    1516                 :        286 : ViewShellObjectBarFactory::~ViewShellObjectBarFactory (void)
    1517                 :            : {
    1518   [ #  #  +  - ]:        572 :     for (ShellCache::iterator aI(maShellCache.begin());
                 [ -  + ]
    1519                 :        286 :          aI!=maShellCache.end();
    1520                 :            :          ++aI)
    1521                 :            :     {
    1522 [ #  # ][ #  # ]:          0 :         delete aI->second;
                 [ #  # ]
    1523                 :            :     }
    1524         [ -  + ]:        572 : }
    1525                 :            : 
    1526                 :            : 
    1527                 :            : 
    1528                 :            : 
    1529                 :        145 : SfxShell* ViewShellObjectBarFactory::CreateShell (
    1530                 :            :     ::sd::ShellId nId,
    1531                 :            :     ::Window*,
    1532                 :            :     ::sd::FrameView* )
    1533                 :            : {
    1534                 :        145 :     SfxShell* pShell = NULL;
    1535                 :            : 
    1536         [ +  - ]:        145 :     ShellCache::iterator aI (maShellCache.find(nId));
    1537 [ +  - ][ -  + ]:        145 :     if (aI == maShellCache.end() || aI->second==NULL)
         [ #  # ][ #  # ]
                 [ +  - ]
           [ +  -  #  # ]
    1538                 :            :     {
    1539                 :        145 :         ::sd::View* pView = mrViewShell.GetView();
    1540   [ -  -  -  -  :        145 :         switch (nId)
             -  -  -  + ]
    1541                 :            :         {
    1542                 :            :             case RID_BEZIER_TOOLBOX:
    1543 [ #  # ][ #  # ]:          0 :                 pShell = new ::sd::BezierObjectBar(&mrViewShell, pView);
    1544                 :          0 :                 break;
    1545                 :            : 
    1546                 :            :             case RID_DRAW_TEXT_TOOLBOX:
    1547                 :            :                 pShell = new ::sd::TextObjectBar(
    1548 [ #  # ][ #  # ]:          0 :                     &mrViewShell, mrViewShell.GetDoc()->GetPool(), pView);
                 [ #  # ]
    1549                 :          0 :                 break;
    1550                 :            : 
    1551                 :            :             case RID_DRAW_GRAF_TOOLBOX:
    1552 [ #  # ][ #  # ]:          0 :                 pShell = new ::sd::GraphicObjectBar(&mrViewShell, pView);
    1553                 :          0 :                 break;
    1554                 :            : 
    1555                 :            :             case RID_DRAW_MEDIA_TOOLBOX:
    1556 [ #  # ][ #  # ]:          0 :                 pShell = new ::sd::MediaObjectBar(&mrViewShell, pView);
    1557                 :          0 :                 break;
    1558                 :            : 
    1559                 :            :             case RID_DRAW_TABLE_TOOLBOX:
    1560         [ #  # ]:          0 :                 pShell = ::sd::ui::table::CreateTableObjectBar( mrViewShell, pView );
    1561                 :          0 :                 break;
    1562                 :            : 
    1563                 :            :             case RID_SVX_EXTRUSION_BAR:
    1564                 :            :                 pShell = new ::svx::ExtrusionBar(
    1565 [ #  # ][ #  # ]:          0 :                     &mrViewShell.GetViewShellBase());
                 [ #  # ]
    1566                 :          0 :                 break;
    1567                 :            : 
    1568                 :            :             case RID_SVX_FONTWORK_BAR:
    1569                 :            :                 pShell = new ::svx::FontworkBar(
    1570 [ #  # ][ #  # ]:          0 :                     &mrViewShell.GetViewShellBase());
                 [ #  # ]
    1571                 :          0 :                 break;
    1572                 :            : 
    1573                 :            :             default:
    1574                 :        145 :                 pShell = NULL;
    1575                 :        145 :                 break;
    1576                 :            :         }
    1577                 :            :     }
    1578                 :            :     else
    1579         [ #  # ]:          0 :         pShell = aI->second;
    1580                 :            : 
    1581                 :        145 :     return pShell;
    1582                 :            : }
    1583                 :            : 
    1584                 :            : 
    1585                 :            : 
    1586                 :            : 
    1587                 :          0 : void ViewShellObjectBarFactory::ReleaseShell (SfxShell* pShell)
    1588                 :            : {
    1589         [ #  # ]:          0 :     if (pShell != NULL)
    1590         [ #  # ]:          0 :         delete pShell;
    1591                 :          0 : }
    1592                 :            : 
    1593                 :            : } // end of anonymous namespace
    1594                 :            : 
    1595                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10