LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterSlideSorter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 702 0.1 %
Date: 2012-08-25 Functions: 2 77 2.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 1334 0.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "PresenterSlideSorter.hxx"
      30                 :            : #include "PresenterButton.hxx"
      31                 :            : #include "PresenterCanvasHelper.hxx"
      32                 :            : #include "PresenterComponent.hxx"
      33                 :            : #include "PresenterGeometryHelper.hxx"
      34                 :            : #include "PresenterHelper.hxx"
      35                 :            : #include "PresenterPaintManager.hxx"
      36                 :            : #include "PresenterPaneBase.hxx"
      37                 :            : #include "PresenterScrollBar.hxx"
      38                 :            : #include "PresenterUIPainter.hxx"
      39                 :            : #include "PresenterWindowManager.hxx"
      40                 :            : #include <com/sun/star/awt/PosSize.hpp>
      41                 :            : #include <com/sun/star/awt/XWindowPeer.hpp>
      42                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      43                 :            : #include <com/sun/star/container/XNamed.hpp>
      44                 :            : #include <com/sun/star/drawing/XSlideSorterBase.hpp>
      45                 :            : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
      46                 :            : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
      47                 :            : #include <com/sun/star/rendering/CompositeOperation.hpp>
      48                 :            : #include <com/sun/star/rendering/TextDirection.hpp>
      49                 :            : #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
      50                 :            : #include <com/sun/star/util/Color.hpp>
      51                 :            : #include <algorithm>
      52                 :            : #include <math.h>
      53                 :            : #include <boost/bind.hpp>
      54                 :            : 
      55                 :            : using namespace ::com::sun::star;
      56                 :            : using namespace ::com::sun::star::uno;
      57                 :            : using namespace ::com::sun::star::drawing::framework;
      58                 :            : using ::rtl::OUString;
      59                 :            : 
      60                 :            : #define A2S(pString) (::rtl::OUString(pString))
      61                 :            : 
      62                 :            : namespace {
      63                 :            :     const static sal_Int32 gnVerticalGap (10);
      64                 :            :     const static sal_Int32 gnVerticalBorder (10);
      65                 :            :     const static sal_Int32 gnHorizontalGap (10);
      66                 :            :     const static sal_Int32 gnHorizontalBorder (10);
      67                 :            : 
      68                 :            :     const static double gnMinimalPreviewWidth (200);
      69                 :            :     const static double gnPreferredPreviewWidth (300);
      70                 :            :     const static double gnMaximalPreviewWidth (400);
      71                 :            :     const static sal_Int32 gnPreferredColumnCount (6);
      72                 :            :     const static double gnMinimalHorizontalPreviewGap(15);
      73                 :            :     const static double gnPreferredHorizontalPreviewGap(25);
      74                 :            :     const static double gnMaximalHorizontalPreviewGap(50);
      75                 :            :     const static double gnMinimalVerticalPreviewGap(15);
      76                 :            :     const static double gnPreferredVerticalPreviewGap(25);
      77                 :            :     const static double gnMaximalVerticalPreviewGap(50);
      78                 :            : 
      79                 :            :     const static sal_Int32 gnHorizontalLabelBorder (3);
      80                 :            :     const static sal_Int32 gnHorizontalLabelPadding (5);
      81                 :            : 
      82                 :            :     const static sal_Int32 gnVerticalButtonPadding (gnVerticalGap);
      83                 :            : }
      84                 :            : 
      85                 :            : namespace sdext { namespace presenter {
      86                 :            : 
      87                 :            : namespace {
      88                 :          0 :     sal_Int32 round (const double nValue) { return sal::static_int_cast<sal_Int32>(0.5 + nValue); }
      89                 :          0 :     sal_Int32 floor (const double nValue) { return sal::static_int_cast<sal_Int32>(nValue); }
      90                 :            : }
      91                 :            : 
      92                 :            : //===== PresenterSlideSorter::Layout ==========================================
      93                 :            : 
      94                 :          0 : class PresenterSlideSorter::Layout
      95                 :            : {
      96                 :            : public:
      97                 :            :     Layout (const ::rtl::Reference<PresenterScrollBar>& rpVerticalScrollBar);
      98                 :            : 
      99                 :            :     void Update (const geometry::RealRectangle2D& rBoundingBox, const double nSlideAspectRatio);
     100                 :            :     void SetupVisibleArea (void);
     101                 :            :     void UpdateScrollBars (void);
     102                 :            :     bool IsScrollBarNeeded (const sal_Int32 nSlideCount);
     103                 :            :     geometry::RealPoint2D GetLocalPosition (const geometry::RealPoint2D& rWindowPoint) const;
     104                 :            :     geometry::RealPoint2D GetWindowPosition(const geometry::RealPoint2D& rLocalPoint) const;
     105                 :            :     sal_Int32 GetColumn (const geometry::RealPoint2D& rLocalPoint,
     106                 :            :         const bool bReturnInvalidValue = false) const;
     107                 :            :     sal_Int32 GetRow (const geometry::RealPoint2D& rLocalPoint,
     108                 :            :         const bool bReturnInvalidValue = false) const;
     109                 :            :     sal_Int32 GetSlideIndexForPosition (const css::geometry::RealPoint2D& rPoint) const;
     110                 :            :     css::geometry::RealPoint2D GetPoint (
     111                 :            :         const sal_Int32 nSlideIndex,
     112                 :            :         const sal_Int32 nRelativeHorizontalPosition,
     113                 :            :         const sal_Int32 nRelativeVerticalPosition) const;
     114                 :            :     css::awt::Rectangle GetBoundingBox (const sal_Int32 nSlideIndex) const;
     115                 :            :     void ForAllVisibleSlides (const ::boost::function<void(sal_Int32)>& rAction);
     116                 :            :     sal_Int32 GetFirstVisibleSlideIndex (void) const;
     117                 :            :     sal_Int32 GetLastVisibleSlideIndex (void) const;
     118                 :            :     bool SetHorizontalOffset (const double nOffset);
     119                 :            :     bool SetVerticalOffset (const double nOffset);
     120                 :            : 
     121                 :            :     css::geometry::RealRectangle2D maBoundingBox;
     122                 :            :     css::geometry::IntegerSize2D maPreviewSize;
     123                 :            :     sal_Int32 mnHorizontalOffset;
     124                 :            :     sal_Int32 mnVerticalOffset;
     125                 :            :     sal_Int32 mnHorizontalGap;
     126                 :            :     sal_Int32 mnVerticalGap;
     127                 :            :     sal_Int32 mnHorizontalBorder;
     128                 :            :     sal_Int32 mnVerticalBorder;
     129                 :            :     sal_Int32 mnRowCount;
     130                 :            :     sal_Int32 mnColumnCount;
     131                 :            :     sal_Int32 mnSlideCount;
     132                 :            :     sal_Int32 mnSlideIndexAtMouse;
     133                 :            :     sal_Int32 mnFirstVisibleColumn;
     134                 :            :     sal_Int32 mnLastVisibleColumn;
     135                 :            :     sal_Int32 mnFirstVisibleRow;
     136                 :            :     sal_Int32 mnLastVisibleRow;
     137                 :            : 
     138                 :            : private:
     139                 :            :     ::rtl::Reference<PresenterScrollBar> mpVerticalScrollBar;
     140                 :            : 
     141                 :            :     sal_Int32 GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const;
     142                 :            :     sal_Int32 GetRow (const sal_Int32 nSlideIndex) const;
     143                 :            :     sal_Int32 GetColumn (const sal_Int32 nSlideIndex) const;
     144                 :            : };
     145                 :            : 
     146                 :            : //==== PresenterSlideSorter::MouseOverManager =================================
     147                 :            : 
     148                 :            : class PresenterSlideSorter::MouseOverManager
     149                 :            :     : ::boost::noncopyable
     150                 :            : {
     151                 :            : public:
     152                 :            :     MouseOverManager (
     153                 :            :         const Reference<container::XIndexAccess>& rxSlides,
     154                 :            :         const ::boost::shared_ptr<PresenterTheme>& rpTheme,
     155                 :            :         const Reference<awt::XWindow>& rxInvalidateTarget,
     156                 :            :         const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager);
     157                 :            :     ~MouseOverManager (void);
     158                 :            : 
     159                 :            :     void Paint (
     160                 :            :         const sal_Int32 nSlideIndex,
     161                 :            :         const Reference<rendering::XCanvas>& rxCanvas,
     162                 :            :         const Reference<rendering::XPolyPolygon2D>& rxClip);
     163                 :            : 
     164                 :            :     void SetSlide (
     165                 :            :         const sal_Int32 nSlideIndex,
     166                 :            :         const awt::Rectangle& rBox);
     167                 :            : 
     168                 :            : private:
     169                 :            :     Reference<rendering::XCanvas> mxCanvas;
     170                 :            :     const Reference<container::XIndexAccess> mxSlides;
     171                 :            :     SharedBitmapDescriptor mpLeftLabelBitmap;
     172                 :            :     SharedBitmapDescriptor mpCenterLabelBitmap;
     173                 :            :     SharedBitmapDescriptor mpRightLabelBitmap;
     174                 :            :     PresenterTheme::SharedFontDescriptor mpFont;
     175                 :            :     sal_Int32 mnSlideIndex;
     176                 :            :     awt::Rectangle maSlideBoundingBox;
     177                 :            :     OUString msText;
     178                 :            :     Reference<rendering::XBitmap> mxBitmap;
     179                 :            :     Reference<awt::XWindow> mxInvalidateTarget;
     180                 :            :     ::boost::shared_ptr<PresenterPaintManager> mpPaintManager;
     181                 :            : 
     182                 :            :     void SetCanvas (
     183                 :            :         const Reference<rendering::XCanvas>& rxCanvas);
     184                 :            :     /** Create a bitmap that shows the given text and is not wider than the
     185                 :            :         given maximal width.
     186                 :            :     */
     187                 :            :     Reference<rendering::XBitmap> CreateBitmap (
     188                 :            :         const OUString& rsText,
     189                 :            :         const sal_Int32 nMaximalWidth) const;
     190                 :            :     void Invalidate (void);
     191                 :            :     geometry::IntegerSize2D CalculateLabelSize (
     192                 :            :         const OUString& rsText) const;
     193                 :            :     OUString GetFittingText (const OUString& rsText, const double nMaximalWidth) const;
     194                 :            :     void PaintButtonBackground (
     195                 :            :         const Reference<rendering::XBitmapCanvas>& rxCanvas,
     196                 :            :         const geometry::IntegerSize2D& rSize) const;
     197                 :            : };
     198                 :            : 
     199                 :            : //==== PresenterSlideSorter::CurrentSlideFrameRenderer ========================
     200                 :            : 
     201                 :            : class PresenterSlideSorter::CurrentSlideFrameRenderer
     202                 :            : {
     203                 :            : public:
     204                 :            :     CurrentSlideFrameRenderer (
     205                 :            :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     206                 :            :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
     207                 :            :     ~CurrentSlideFrameRenderer (void);
     208                 :            : 
     209                 :            :     void PaintCurrentSlideFrame (
     210                 :            :         const awt::Rectangle& rSlideBoundingBox,
     211                 :            :         const Reference<rendering::XCanvas>& rxCanvas,
     212                 :            :         const geometry::RealRectangle2D& rClipBox);
     213                 :            : 
     214                 :            :     /** Enlarge the given rectangle to include the current slide indicator.
     215                 :            :     */
     216                 :            :     awt::Rectangle GetBoundingBox (
     217                 :            :         const awt::Rectangle& rSlideBoundingBox);
     218                 :            : 
     219                 :            : private:
     220                 :            :     SharedBitmapDescriptor mpTopLeft;
     221                 :            :     SharedBitmapDescriptor mpTop;
     222                 :            :     SharedBitmapDescriptor mpTopRight;
     223                 :            :     SharedBitmapDescriptor mpLeft;
     224                 :            :     SharedBitmapDescriptor mpRight;
     225                 :            :     SharedBitmapDescriptor mpBottomLeft;
     226                 :            :     SharedBitmapDescriptor mpBottom;
     227                 :            :     SharedBitmapDescriptor mpBottomRight;
     228                 :            :     sal_Int32 mnTopFrameSize;
     229                 :            :     sal_Int32 mnLeftFrameSize;
     230                 :            :     sal_Int32 mnRightFrameSize;
     231                 :            :     sal_Int32 mnBottomFrameSize;
     232                 :            : 
     233                 :            :     void PaintBitmapOnce(
     234                 :            :         const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
     235                 :            :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
     236                 :            :         const Reference<rendering::XPolyPolygon2D>& rxClip,
     237                 :            :         const double nX,
     238                 :            :         const double nY);
     239                 :            :     void PaintBitmapTiled(
     240                 :            :         const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
     241                 :            :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
     242                 :            :         const geometry::RealRectangle2D& rClipBox,
     243                 :            :         const double nX,
     244                 :            :         const double nY,
     245                 :            :         const double nWidth,
     246                 :            :         const double nHeight);
     247                 :            : };
     248                 :            : 
     249                 :            : //===== PresenterSlideSorter ==================================================
     250                 :            : 
     251                 :          0 : PresenterSlideSorter::PresenterSlideSorter (
     252                 :            :     const Reference<uno::XComponentContext>& rxContext,
     253                 :            :     const Reference<XResourceId>& rxViewId,
     254                 :            :     const Reference<frame::XController>& rxController,
     255                 :            :     const ::rtl::Reference<PresenterController>& rpPresenterController)
     256                 :            :     : PresenterSlideSorterInterfaceBase(m_aMutex),
     257                 :            :       mxComponentContext(rxContext),
     258                 :            :       mxViewId(rxViewId),
     259                 :            :       mxPane(),
     260                 :            :       mxCanvas(),
     261                 :            :       mxWindow(),
     262                 :            :       mpPresenterController(rpPresenterController),
     263                 :            :       mxSlideShowController(mpPresenterController->GetSlideShowController()),
     264                 :            :       mxPreviewCache(),
     265                 :            :       mbIsPaintPending(true),
     266                 :            :       mbIsLayoutPending(true),
     267                 :            :       mpLayout(),
     268                 :            :       mpVerticalScrollBar(),
     269                 :            :       mpCloseButton(),
     270                 :            :       mpMouseOverManager(),
     271                 :            :       mnSlideIndexMousePressed(-1),
     272                 :            :       mnCurrentSlideIndex(-1),
     273                 :            :       mnSeparatorY(0),
     274                 :            :       maSeparatorColor(0x00ffffff),
     275                 :            :       maCloseButtonCenter(),
     276                 :            :       maCurrentSlideFrameBoundingBox(),
     277                 :            :       mpCurrentSlideFrameRenderer(),
     278 [ #  # ][ #  # ]:          0 :       mxPreviewFrame()
         [ #  # ][ #  # ]
     279                 :            : {
     280 [ #  # ][ #  #  :          0 :     if ( ! rxContext.is()
          #  #  #  #  #  
                      # ]
     281                 :          0 :         || ! rxViewId.is()
     282                 :          0 :         || ! rxController.is()
     283                 :          0 :         || rpPresenterController.get()==NULL)
     284                 :            :     {
     285         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
     286                 :            :     }
     287                 :            : 
     288         [ #  # ]:          0 :     if ( ! mxSlideShowController.is())
     289         [ #  # ]:          0 :         throw RuntimeException();
     290                 :            : 
     291                 :            :     try
     292                 :            :     {
     293                 :            :         // Get pane and window.
     294         [ #  # ]:          0 :         Reference<XControllerManager> xCM (rxController, UNO_QUERY_THROW);
     295                 :            :         Reference<XConfigurationController> xCC (
     296 [ #  # ][ #  # ]:          0 :             xCM->getConfigurationController(), UNO_QUERY_THROW);
                 [ #  # ]
     297                 :            :         Reference<lang::XMultiComponentFactory> xFactory (
     298 [ #  # ][ #  # ]:          0 :             mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
                 [ #  # ]
     299                 :            : 
     300 [ #  # ][ #  # ]:          0 :         mxPane = Reference<XPane>(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     301 [ #  # ][ #  # ]:          0 :         mxWindow = mxPane->getWindow();
                 [ #  # ]
     302                 :            : 
     303                 :            :         // Add window listener.
     304 [ #  # ][ #  # ]:          0 :         mxWindow->addWindowListener(this);
                 [ #  # ]
     305 [ #  # ][ #  # ]:          0 :         mxWindow->addPaintListener(this);
                 [ #  # ]
     306 [ #  # ][ #  # ]:          0 :         mxWindow->addMouseListener(this);
                 [ #  # ]
     307 [ #  # ][ #  # ]:          0 :         mxWindow->addMouseMotionListener(this);
                 [ #  # ]
     308 [ #  # ][ #  # ]:          0 :         mxWindow->setVisible(sal_True);
     309                 :            : 
     310                 :            :         // Remember the current slide.
     311 [ #  # ][ #  # ]:          0 :         mnCurrentSlideIndex = mxSlideShowController->getCurrentSlideIndex();
     312                 :            : 
     313                 :            :         // Create the scroll bar.
     314                 :            :         mpVerticalScrollBar = ::rtl::Reference<PresenterScrollBar>(
     315                 :            :             new PresenterVerticalScrollBar(
     316                 :            :                 rxContext,
     317                 :            :                 mxWindow,
     318                 :            :                 mpPresenterController->GetPaintManager(),
     319 [ #  # ][ #  # ]:          0 :                 ::boost::bind(&PresenterSlideSorter::SetVerticalOffset,this,_1)));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     320                 :            : 
     321                 :            :         mpCloseButton = PresenterButton::Create(
     322                 :            :             rxContext,
     323                 :            :             mpPresenterController,
     324                 :            :             mpPresenterController->GetTheme(),
     325                 :            :             mxWindow,
     326                 :            :             mxCanvas,
     327 [ #  # ][ #  # ]:          0 :             A2S("SlideSorterCloser"));
         [ #  # ][ #  # ]
     328                 :            : 
     329 [ #  # ][ #  # ]:          0 :         if (mpPresenterController->GetTheme().get() != NULL)
                 [ #  # ]
     330                 :            :         {
     331                 :            :             PresenterTheme::SharedFontDescriptor pFont (
     332 [ #  # ][ #  # ]:          0 :                 mpPresenterController->GetTheme()->GetFont(A2S("ButtonFont")));
                 [ #  # ]
     333         [ #  # ]:          0 :             if (pFont.get() != NULL)
     334         [ #  # ]:          0 :                 maSeparatorColor = pFont->mnColor;
     335                 :            :         }
     336                 :            : 
     337                 :            :         // Create the layout.
     338 [ #  # ][ #  # ]:          0 :         mpLayout.reset(new Layout(mpVerticalScrollBar));
                 [ #  # ]
     339                 :            : 
     340                 :            :         // Create the preview cache.
     341                 :            :         mxPreviewCache = Reference<drawing::XSlidePreviewCache>(
     342         [ #  # ]:          0 :             xFactory->createInstanceWithContext(
     343                 :            :                 OUString("com.sun.star.drawing.PresenterPreviewCache"),
     344                 :          0 :                 mxComponentContext),
     345 [ #  # ][ #  # ]:          0 :             UNO_QUERY_THROW);
                 [ #  # ]
     346         [ #  # ]:          0 :         Reference<container::XIndexAccess> xSlides (mxSlideShowController, UNO_QUERY);
     347 [ #  # ][ #  # ]:          0 :         mxPreviewCache->setDocumentSlides(xSlides, rxController->getModel());
         [ #  # ][ #  # ]
     348 [ #  # ][ #  # ]:          0 :         mxPreviewCache->addPreviewCreationNotifyListener(this);
                 [ #  # ]
     349         [ #  # ]:          0 :         if (xSlides.is())
     350                 :            :         {
     351 [ #  # ][ #  # ]:          0 :             mpLayout->mnSlideCount = xSlides->getCount();
     352                 :            :         }
     353                 :            : 
     354                 :            :         // Create the mouse over manager.
     355                 :            :         mpMouseOverManager.reset(new MouseOverManager(
     356                 :            :             Reference<container::XIndexAccess>(mxSlideShowController, UNO_QUERY),
     357                 :            :             mpPresenterController->GetTheme(),
     358                 :            :             mxWindow,
     359 [ #  # ][ #  # ]:          0 :             mpPresenterController->GetPaintManager()));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     360                 :            : 
     361                 :            :         // Listen for changes of the current slide.
     362         [ #  # ]:          0 :         Reference<beans::XPropertySet> xControllerProperties (rxController, UNO_QUERY_THROW);
     363         [ #  # ]:          0 :         xControllerProperties->addPropertyChangeListener(
     364                 :            :             OUString("CurrentPage"),
     365 [ #  # ][ #  # ]:          0 :             this);
     366                 :            : 
     367                 :            :         // Move the current slide in the center of the window.
     368         [ #  # ]:          0 :         const awt::Rectangle aCurrentSlideBBox (mpLayout->GetBoundingBox(mnCurrentSlideIndex));
     369 [ #  # ][ #  # ]:          0 :         const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     370         [ #  # ]:          0 :         SetHorizontalOffset(aCurrentSlideBBox.X - aWindowBox.Width/2.0);
     371                 :            :     }
     372         [ #  # ]:          0 :     catch (RuntimeException&)
     373                 :            :     {
     374         [ #  # ]:          0 :         disposing();
     375                 :          0 :         throw;
     376                 :            :     }
     377                 :          0 : }
     378                 :            : 
     379 [ #  # ][ #  # ]:          0 : PresenterSlideSorter::~PresenterSlideSorter (void)
         [ #  # ][ #  # ]
     380                 :            : {
     381         [ #  # ]:          0 : }
     382                 :            : 
     383                 :          0 : void SAL_CALL PresenterSlideSorter::disposing (void)
     384                 :            : {
     385                 :          0 :     mxComponentContext = NULL;
     386                 :          0 :     mxViewId = NULL;
     387                 :          0 :     mxPane = NULL;
     388                 :            : 
     389         [ #  # ]:          0 :     if (mpVerticalScrollBar.is())
     390                 :            :     {
     391                 :            :         Reference<lang::XComponent> xComponent (
     392         [ #  # ]:          0 :             static_cast<XWeak*>(mpVerticalScrollBar.get()), UNO_QUERY);
     393         [ #  # ]:          0 :         mpVerticalScrollBar = NULL;
     394         [ #  # ]:          0 :         if (xComponent.is())
     395 [ #  # ][ #  # ]:          0 :             xComponent->dispose();
     396                 :            :     }
     397         [ #  # ]:          0 :     if (mpCloseButton.is())
     398                 :            :     {
     399                 :            :         Reference<lang::XComponent> xComponent (
     400         [ #  # ]:          0 :             static_cast<XWeak*>(mpCloseButton.get()), UNO_QUERY);
     401         [ #  # ]:          0 :         mpCloseButton = NULL;
     402         [ #  # ]:          0 :         if (xComponent.is())
     403 [ #  # ][ #  # ]:          0 :             xComponent->dispose();
     404                 :            :     }
     405                 :            : 
     406         [ #  # ]:          0 :     if (mxCanvas.is())
     407                 :            :     {
     408         [ #  # ]:          0 :         Reference<lang::XComponent> xComponent (mxCanvas, UNO_QUERY);
     409         [ #  # ]:          0 :         if (xComponent.is())
     410 [ #  # ][ #  # ]:          0 :             xComponent->removeEventListener(static_cast<awt::XWindowListener*>(this));
                 [ #  # ]
     411         [ #  # ]:          0 :         mxCanvas = NULL;
     412                 :            :     }
     413                 :          0 :     mpPresenterController = NULL;
     414                 :          0 :     mxSlideShowController = NULL;
     415                 :          0 :     mpLayout.reset();
     416                 :          0 :     mpMouseOverManager.reset();
     417                 :            : 
     418         [ #  # ]:          0 :     if (mxPreviewCache.is())
     419                 :            :     {
     420 [ #  # ][ #  # ]:          0 :         mxPreviewCache->removePreviewCreationNotifyListener(this);
                 [ #  # ]
     421                 :            : 
     422         [ #  # ]:          0 :         Reference<XComponent> xComponent (mxPreviewCache, UNO_QUERY);
     423         [ #  # ]:          0 :         mxPreviewCache = NULL;
     424         [ #  # ]:          0 :         if (xComponent.is())
     425 [ #  # ][ #  # ]:          0 :             xComponent->dispose();
     426                 :            :     }
     427                 :            : 
     428         [ #  # ]:          0 :     if (mxWindow.is())
     429                 :            :     {
     430         [ #  # ]:          0 :         mxWindow->removeWindowListener(this);
     431         [ #  # ]:          0 :         mxWindow->removePaintListener(this);
     432         [ #  # ]:          0 :         mxWindow->removeMouseListener(this);
     433         [ #  # ]:          0 :         mxWindow->removeMouseMotionListener(this);
     434                 :            :     }
     435                 :          0 : }
     436                 :            : 
     437                 :          0 : void PresenterSlideSorter::SetActiveState (const bool bIsActive)
     438                 :            : {
     439                 :            :     (void)bIsActive;
     440                 :          0 : }
     441                 :            : 
     442                 :            : //----- lang::XEventListener --------------------------------------------------
     443                 :            : 
     444                 :          0 : void SAL_CALL PresenterSlideSorter::disposing (const lang::EventObject& rEventObject)
     445                 :            :     throw (RuntimeException)
     446                 :            : {
     447         [ #  # ]:          0 :     if (rEventObject.Source == mxWindow)
     448                 :            :     {
     449                 :          0 :         mxWindow = NULL;
     450                 :          0 :         dispose();
     451                 :            :     }
     452         [ #  # ]:          0 :     else if (rEventObject.Source == mxPreviewCache)
     453                 :            :     {
     454                 :          0 :         mxPreviewCache = NULL;
     455                 :          0 :         dispose();
     456                 :            :     }
     457         [ #  # ]:          0 :     else if (rEventObject.Source == mxCanvas)
     458                 :            :     {
     459                 :          0 :         mxCanvas = NULL;
     460                 :          0 :         mbIsLayoutPending = true;
     461                 :          0 :         mbIsPaintPending = true;
     462                 :            : 
     463         [ #  # ]:          0 :         mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
     464                 :            :     }
     465                 :          0 : }
     466                 :            : 
     467                 :            : //----- XWindowListener -------------------------------------------------------
     468                 :            : 
     469                 :          0 : void SAL_CALL PresenterSlideSorter::windowResized (const awt::WindowEvent& rEvent)
     470                 :            :     throw (uno::RuntimeException)
     471                 :            : {
     472                 :            :     (void)rEvent;
     473                 :          0 :     ThrowIfDisposed();
     474                 :          0 :     mbIsLayoutPending = true;
     475         [ #  # ]:          0 :     mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
     476                 :          0 : }
     477                 :            : 
     478                 :          0 : void SAL_CALL PresenterSlideSorter::windowMoved (const awt::WindowEvent& rEvent)
     479                 :            :     throw (uno::RuntimeException)
     480                 :            : {
     481                 :            :     (void)rEvent;
     482                 :          0 :     ThrowIfDisposed();
     483                 :          0 : }
     484                 :            : 
     485                 :          0 : void SAL_CALL PresenterSlideSorter::windowShown (const lang::EventObject& rEvent)
     486                 :            :     throw (uno::RuntimeException)
     487                 :            : {
     488                 :            :     (void)rEvent;
     489                 :          0 :     ThrowIfDisposed();
     490                 :          0 :     mbIsLayoutPending = true;
     491         [ #  # ]:          0 :     mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
     492                 :          0 : }
     493                 :            : 
     494                 :          0 : void SAL_CALL PresenterSlideSorter::windowHidden (const lang::EventObject& rEvent)
     495                 :            :     throw (uno::RuntimeException)
     496                 :            : {
     497                 :            :     (void)rEvent;
     498                 :          0 :     ThrowIfDisposed();
     499                 :          0 : }
     500                 :            : 
     501                 :            : //----- XPaintListener --------------------------------------------------------
     502                 :            : 
     503                 :          0 : void SAL_CALL PresenterSlideSorter::windowPaint (const css::awt::PaintEvent& rEvent)
     504                 :            :     throw (RuntimeException)
     505                 :            : {
     506                 :            :     (void)rEvent;
     507                 :            : 
     508                 :            :     // Deactivated views must not be painted.
     509         [ #  # ]:          0 :     if ( ! mbIsPresenterViewActive)
     510                 :          0 :         return;
     511                 :            : 
     512         [ #  # ]:          0 :     Paint(rEvent.UpdateRect);
     513                 :            : 
     514         [ #  # ]:          0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY);
     515         [ #  # ]:          0 :     if (xSpriteCanvas.is())
     516 [ #  # ][ #  # ]:          0 :         xSpriteCanvas->updateScreen(sal_False);
     517                 :            : }
     518                 :            : 
     519                 :            : //----- XMouseListener --------------------------------------------------------
     520                 :            : 
     521                 :          0 : void SAL_CALL PresenterSlideSorter::mousePressed (const css::awt::MouseEvent& rEvent)
     522                 :            :     throw(css::uno::RuntimeException)
     523                 :            : {
     524                 :          0 :     const geometry::RealPoint2D aPosition (rEvent.X, rEvent.Y);
     525         [ #  # ]:          0 :     mnSlideIndexMousePressed = mpLayout->GetSlideIndexForPosition(aPosition);
     526                 :          0 : }
     527                 :            : 
     528                 :          0 : void SAL_CALL PresenterSlideSorter::mouseReleased (const css::awt::MouseEvent& rEvent)
     529                 :            :     throw(css::uno::RuntimeException)
     530                 :            : {
     531                 :          0 :     const geometry::RealPoint2D aPosition (rEvent.X, rEvent.Y);
     532         [ #  # ]:          0 :     const sal_Int32 nSlideIndex (mpLayout->GetSlideIndexForPosition(aPosition));
     533                 :            : 
     534 [ #  # ][ #  # ]:          0 :     if (nSlideIndex == mnSlideIndexMousePressed && mnSlideIndexMousePressed >= 0)
     535                 :            :     {
     536         [ #  # ]:          0 :         switch (rEvent.ClickCount)
     537                 :            :         {
     538                 :            :             case 1:
     539                 :            :             default:
     540         [ #  # ]:          0 :                 GotoSlide(nSlideIndex);
     541                 :          0 :                 break;
     542                 :            : 
     543                 :            :             case 2:
     544                 :            :                 OSL_ASSERT(mpPresenterController.get()!=NULL);
     545                 :            :                 OSL_ASSERT(mpPresenterController->GetWindowManager().get()!=NULL);
     546 [ #  # ][ #  # ]:          0 :                 mpPresenterController->GetWindowManager()->SetSlideSorterState(false);
     547         [ #  # ]:          0 :                 GotoSlide(nSlideIndex);
     548                 :          0 :                 break;
     549                 :            :         }
     550                 :            :     }
     551                 :          0 : }
     552                 :            : 
     553                 :          0 : void SAL_CALL PresenterSlideSorter::mouseEntered (const css::awt::MouseEvent& rEvent)
     554                 :            :     throw(css::uno::RuntimeException)
     555                 :            : {
     556                 :            :     (void)rEvent;
     557                 :          0 : }
     558                 :            : 
     559                 :          0 : void SAL_CALL PresenterSlideSorter::mouseExited (const css::awt::MouseEvent& rEvent)
     560                 :            :     throw(css::uno::RuntimeException)
     561                 :            : {
     562                 :            :     (void)rEvent;
     563                 :          0 :     mnSlideIndexMousePressed = -1;
     564         [ #  # ]:          0 :     if (mpMouseOverManager.get() != NULL)
     565         [ #  # ]:          0 :         mpMouseOverManager->SetSlide(mnSlideIndexMousePressed, awt::Rectangle(0,0,0,0));
     566                 :          0 : }
     567                 :            : 
     568                 :            : //----- XMouseMotionListener --------------------------------------------------
     569                 :            : 
     570                 :          0 : void SAL_CALL PresenterSlideSorter::mouseMoved (const css::awt::MouseEvent& rEvent)
     571                 :            :     throw (css::uno::RuntimeException)
     572                 :            : {
     573         [ #  # ]:          0 :     if (mpMouseOverManager.get() != NULL)
     574                 :            :     {
     575                 :          0 :         const geometry::RealPoint2D aPosition (rEvent.X, rEvent.Y);
     576         [ #  # ]:          0 :         sal_Int32 nSlideIndex (mpLayout->GetSlideIndexForPosition(aPosition));
     577                 :            : 
     578         [ #  # ]:          0 :         if (nSlideIndex < 0)
     579                 :          0 :             mnSlideIndexMousePressed = -1;
     580                 :            : 
     581         [ #  # ]:          0 :         if (nSlideIndex < 0)
     582                 :            :         {
     583         [ #  # ]:          0 :             mpMouseOverManager->SetSlide(nSlideIndex, awt::Rectangle(0,0,0,0));
     584                 :            :         }
     585                 :            :         else
     586                 :            :         {
     587                 :            :             mpMouseOverManager->SetSlide(
     588                 :            :                 nSlideIndex,
     589 [ #  # ][ #  # ]:          0 :                 mpLayout->GetBoundingBox(nSlideIndex));
     590                 :            :         }
     591                 :            :     }
     592                 :          0 : }
     593                 :            : 
     594                 :          0 : void SAL_CALL PresenterSlideSorter::mouseDragged (const css::awt::MouseEvent& rEvent)
     595                 :            :     throw (css::uno::RuntimeException)
     596                 :            : {
     597                 :            :     (void)rEvent;
     598                 :          0 : }
     599                 :            : 
     600                 :            : //----- XResourceId -----------------------------------------------------------
     601                 :            : 
     602                 :          0 : Reference<XResourceId> SAL_CALL PresenterSlideSorter::getResourceId (void)
     603                 :            :     throw (RuntimeException)
     604                 :            : {
     605                 :          0 :     ThrowIfDisposed();
     606                 :          0 :     return mxViewId;
     607                 :            : }
     608                 :            : 
     609                 :          0 : sal_Bool SAL_CALL PresenterSlideSorter::isAnchorOnly (void)
     610                 :            :     throw (RuntimeException)
     611                 :            : {
     612                 :          0 :     return false;
     613                 :            : }
     614                 :            : 
     615                 :            : //----- XPropertyChangeListener -----------------------------------------------
     616                 :            : 
     617                 :          0 : void SAL_CALL PresenterSlideSorter::propertyChange (
     618                 :            :     const css::beans::PropertyChangeEvent& rEvent)
     619                 :            :     throw(css::uno::RuntimeException)
     620                 :            : {
     621                 :            :     (void)rEvent;
     622                 :          0 : }
     623                 :            : 
     624                 :            : //----- XSlidePreviewCacheListener --------------------------------------------
     625                 :            : 
     626                 :          0 : void SAL_CALL PresenterSlideSorter::notifyPreviewCreation (
     627                 :            :     sal_Int32 nSlideIndex)
     628                 :            :     throw(css::uno::RuntimeException)
     629                 :            : {
     630                 :            :     OSL_ASSERT(mpLayout.get()!=NULL);
     631                 :            : 
     632         [ #  # ]:          0 :     awt::Rectangle aBBox (mpLayout->GetBoundingBox(nSlideIndex));
     633 [ #  # ][ #  # ]:          0 :     mpPresenterController->GetPaintManager()->Invalidate(mxWindow, aBBox, true);
                 [ #  # ]
     634                 :          0 : }
     635                 :            : 
     636                 :            : //----- XDrawView -------------------------------------------------------------
     637                 :            : 
     638                 :          0 : void SAL_CALL PresenterSlideSorter::setCurrentPage (const Reference<drawing::XDrawPage>& rxSlide)
     639                 :            :     throw (RuntimeException)
     640                 :            : {
     641                 :            :     (void)rxSlide;
     642                 :            : 
     643         [ #  # ]:          0 :     ThrowIfDisposed();
     644 [ #  # ][ #  # ]:          0 :     ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
     645                 :            : 
     646         [ #  # ]:          0 :     if (mxSlideShowController.is())
     647                 :            :     {
     648 [ #  # ][ #  # ]:          0 :         const sal_Int32 nNewCurrentSlideIndex (mxSlideShowController->getCurrentSlideIndex());
     649         [ #  # ]:          0 :         if (nNewCurrentSlideIndex != mnCurrentSlideIndex)
     650                 :            :         {
     651                 :          0 :             mnCurrentSlideIndex = nNewCurrentSlideIndex;
     652                 :            : 
     653                 :            :             // Request a repaint of the previous current slide to hide its
     654                 :            :             // current slide indicator.
     655                 :            :             mpPresenterController->GetPaintManager()->Invalidate(
     656                 :            :                 mxWindow,
     657 [ #  # ][ #  # ]:          0 :                 maCurrentSlideFrameBoundingBox);
                 [ #  # ]
     658                 :            : 
     659                 :            :             // Request a repaint of the new current slide to show its
     660                 :            :             // current slide indicator.
     661                 :            :             maCurrentSlideFrameBoundingBox = mpCurrentSlideFrameRenderer->GetBoundingBox(
     662         [ #  # ]:          0 :                 mpLayout->GetBoundingBox(mnCurrentSlideIndex));
     663                 :            :             mpPresenterController->GetPaintManager()->Invalidate(
     664                 :            :                 mxWindow,
     665 [ #  # ][ #  # ]:          0 :                 maCurrentSlideFrameBoundingBox);
                 [ #  # ]
     666                 :            :         }
     667         [ #  # ]:          0 :     }
     668                 :          0 : }
     669                 :            : 
     670                 :          0 : Reference<drawing::XDrawPage> SAL_CALL PresenterSlideSorter::getCurrentPage (void)
     671                 :            :     throw (RuntimeException)
     672                 :            : {
     673                 :          0 :     ThrowIfDisposed();
     674                 :          0 :     return NULL;
     675                 :            : }
     676                 :            : 
     677                 :            : //-----------------------------------------------------------------------------
     678                 :            : 
     679                 :          0 : void PresenterSlideSorter::UpdateLayout (void)
     680                 :            : {
     681         [ #  # ]:          0 :     if ( ! mxWindow.is())
     682                 :          0 :         return;
     683                 :            : 
     684                 :          0 :     mbIsLayoutPending = false;
     685                 :          0 :     mbIsPaintPending = true;
     686                 :            : 
     687 [ #  # ][ #  # ]:          0 :     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     688                 :          0 :     awt::Rectangle aCenterBox (aWindowBox);
     689                 :          0 :     sal_Int32 nLeftBorderWidth (aWindowBox.X);
     690                 :            : 
     691                 :            :     // Get border width.
     692                 :            :     PresenterPaneContainer::SharedPaneDescriptor pPane (
     693                 :            :         mpPresenterController->GetPaneContainer()->FindViewURL(
     694 [ #  # ][ #  # ]:          0 :             mxViewId->getResourceURL()));
         [ #  # ][ #  # ]
     695                 :            :     do
     696                 :            :     {
     697         [ #  # ]:          0 :         if (pPane.get() == NULL)
     698                 :            :             break;
     699         [ #  # ]:          0 :         if ( ! pPane->mxPane.is())
     700                 :            :             break;
     701                 :            : 
     702                 :            :         Reference<drawing::framework::XPaneBorderPainter> xBorderPainter (
     703         [ #  # ]:          0 :             pPane->mxPane->GetPaneBorderPainter());
     704         [ #  # ]:          0 :         if ( ! xBorderPainter.is())
     705                 :            :             break;
     706         [ #  # ]:          0 :         aCenterBox = xBorderPainter->addBorder (
     707 [ #  # ][ #  # ]:          0 :             mxViewId->getAnchor()->getResourceURL(),
                 [ #  # ]
     708                 :            :             awt::Rectangle(0, 0, aWindowBox.Width, aWindowBox.Height),
     709 [ #  # ][ #  # ]:          0 :             drawing::framework::BorderType_INNER_BORDER);
                 [ #  # ]
     710                 :            :     }
     711                 :            :     while(false);
     712                 :            : 
     713                 :            :     // Place vertical separator.
     714         [ #  # ]:          0 :     mnSeparatorY = aWindowBox.Height - mpCloseButton->GetSize().Height - gnVerticalButtonPadding;
     715                 :            : 
     716         [ #  # ]:          0 :     PlaceCloseButton(pPane, aWindowBox, nLeftBorderWidth);
     717                 :            : 
     718                 :            :     geometry::RealRectangle2D aUpperBox(
     719                 :            :         gnHorizontalBorder,
     720                 :            :         gnVerticalBorder,
     721                 :            :         aWindowBox.Width - 2*gnHorizontalBorder,
     722                 :          0 :         mnSeparatorY - gnVerticalGap);
     723                 :            : 
     724                 :            :     // Determine whether the scroll bar has to be displayed.
     725         [ #  # ]:          0 :     aUpperBox = PlaceScrollBars(aUpperBox);
     726                 :            : 
     727 [ #  # ][ #  # ]:          0 :     mpLayout->Update(aUpperBox, GetSlideAspectRatio());
     728         [ #  # ]:          0 :     mpLayout->SetupVisibleArea();
     729         [ #  # ]:          0 :     mpLayout->UpdateScrollBars();
     730                 :            : 
     731                 :            :     // Tell the preview cache about some of the values.
     732 [ #  # ][ #  # ]:          0 :     mxPreviewCache->setPreviewSize(mpLayout->maPreviewSize);
     733         [ #  # ]:          0 :     mxPreviewCache->setVisibleRange(
     734                 :            :         mpLayout->GetFirstVisibleSlideIndex(),
     735 [ #  # ][ #  # ]:          0 :         mpLayout->GetLastVisibleSlideIndex());
                 [ #  # ]
     736                 :            : 
     737                 :            :     // Clear the frame polygon so that it is re-created on the next paint.
     738 [ #  # ][ #  # ]:          0 :     mxPreviewFrame = NULL;
     739                 :            : }
     740                 :            : 
     741                 :          0 : geometry::RealRectangle2D PresenterSlideSorter::PlaceScrollBars (
     742                 :            :     const geometry::RealRectangle2D& rUpperBox)
     743                 :            : {
     744 [ #  # ][ #  # ]:          0 :     mpLayout->Update(rUpperBox, GetSlideAspectRatio());
     745                 :          0 :     bool bIsScrollBarNeeded (false);
     746         [ #  # ]:          0 :     Reference<container::XIndexAccess> xSlides (mxSlideShowController, UNO_QUERY_THROW);
     747         [ #  # ]:          0 :     if (xSlides.is())
     748 [ #  # ][ #  # ]:          0 :         bIsScrollBarNeeded = mpLayout->IsScrollBarNeeded(xSlides->getCount());
                 [ #  # ]
     749                 :            : 
     750         [ #  # ]:          0 :     if (mpVerticalScrollBar.get() != NULL)
     751                 :            :     {
     752         [ #  # ]:          0 :         if (bIsScrollBarNeeded)
     753                 :            :         {
     754                 :            :             // Place vertical scroll bar at right border.
     755                 :            :             mpVerticalScrollBar->SetPosSize(geometry::RealRectangle2D(
     756         [ #  # ]:          0 :                 rUpperBox.X2 - mpVerticalScrollBar->GetSize(),
     757                 :            :                 rUpperBox.Y1,
     758                 :            :                 rUpperBox.X2,
     759         [ #  # ]:          0 :                 rUpperBox.Y2));
     760         [ #  # ]:          0 :             mpVerticalScrollBar->SetVisible(true);
     761                 :            : 
     762                 :            :             // Reduce area covered by the scroll bar from the available
     763                 :            :             // space.
     764                 :            :             return geometry::RealRectangle2D(
     765                 :            :                 rUpperBox.X1,
     766                 :            :                 rUpperBox.Y1,
     767         [ #  # ]:          0 :                 rUpperBox.X2 - mpVerticalScrollBar->GetSize() - gnHorizontalGap,
     768                 :          0 :                 rUpperBox.Y2);
     769                 :            :         }
     770                 :            :         else
     771         [ #  # ]:          0 :             mpVerticalScrollBar->SetVisible(false);
     772                 :            :     }
     773                 :            : 
     774                 :          0 :     return rUpperBox;
     775                 :            : }
     776                 :            : 
     777                 :          0 : void PresenterSlideSorter::PlaceCloseButton (
     778                 :            :     const PresenterPaneContainer::SharedPaneDescriptor& rpPane,
     779                 :            :     const awt::Rectangle& rCenterBox,
     780                 :            :     const sal_Int32 nLeftBorderWidth)
     781                 :            : {
     782                 :            :     // Place button.  When the callout is near the center then the button is
     783                 :            :     // centered over the callout.  Otherwise it is centered with respect to
     784                 :            :     // the whole window.
     785                 :          0 :     sal_Int32 nCloseButtonCenter (rCenterBox.Width/2);
     786 [ #  # ][ #  # ]:          0 :     if (rpPane.get() != NULL && rpPane->mxPane.is())
                 [ #  # ]
     787                 :            :     {
     788                 :          0 :         const sal_Int32 nCalloutCenter (rpPane->mxPane->GetCalloutAnchor().X - nLeftBorderWidth);
     789                 :          0 :         const sal_Int32 nDistanceFromWindowCenter (abs(nCalloutCenter - rCenterBox.Width/2));
     790                 :          0 :         const sal_Int32 nButtonWidth (mpCloseButton->GetSize().Width);
     791 [ #  # ][ #  # ]:          0 :         const static sal_Int32 nMaxDistanceForCalloutCentering (nButtonWidth * 2);
     792         [ #  # ]:          0 :         if (nDistanceFromWindowCenter < nMaxDistanceForCalloutCentering)
     793                 :            :         {
     794         [ #  # ]:          0 :             if (nCalloutCenter < nButtonWidth/2)
     795                 :          0 :                 nCloseButtonCenter = nButtonWidth/2;
     796         [ #  # ]:          0 :             else if (nCalloutCenter > rCenterBox.Width-nButtonWidth/2)
     797                 :          0 :                 nCloseButtonCenter = rCenterBox.Width-nButtonWidth/2;
     798                 :            :             else
     799                 :          0 :                 nCloseButtonCenter = nCalloutCenter;
     800                 :            :         }
     801                 :            :     }
     802                 :            :     mpCloseButton->SetCenter(geometry::RealPoint2D(
     803                 :            :         nCloseButtonCenter,
     804         [ #  # ]:          0 :         rCenterBox.Height - mpCloseButton->GetSize().Height/ 2));
     805                 :          0 : }
     806                 :            : 
     807                 :          0 : void PresenterSlideSorter::ClearBackground (
     808                 :            :     const Reference<rendering::XCanvas>& rxCanvas,
     809                 :            :     const awt::Rectangle& rUpdateBox)
     810                 :            : {
     811                 :            :     OSL_ASSERT(rxCanvas.is());
     812                 :            : 
     813 [ #  # ][ #  # ]:          0 :     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     814                 :            :     mpPresenterController->GetCanvasHelper()->Paint(
     815         [ #  # ]:          0 :         mpPresenterController->GetViewBackground(mxViewId->getResourceURL()),
     816                 :            :         rxCanvas,
     817                 :            :         rUpdateBox,
     818                 :            :         awt::Rectangle(0,0,aWindowBox.Width,aWindowBox.Height),
     819 [ #  # ][ #  # ]:          0 :         awt::Rectangle());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     820                 :          0 : }
     821                 :            : 
     822                 :          0 : double PresenterSlideSorter::GetSlideAspectRatio (void) const
     823                 :            : {
     824                 :          0 :     double nSlideAspectRatio (28.0/21.0);
     825                 :            : 
     826                 :            :     try
     827                 :            :     {
     828         [ #  # ]:          0 :         Reference<container::XIndexAccess> xSlides(mxSlideShowController, UNO_QUERY_THROW);
     829 [ #  # ][ #  # ]:          0 :         if (mxSlideShowController.is() && xSlides->getCount()>0)
         [ #  # ][ #  # ]
                 [ #  # ]
     830                 :            :         {
     831 [ #  # ][ #  # ]:          0 :             Reference<beans::XPropertySet> xProperties(xSlides->getByIndex(0),UNO_QUERY_THROW);
                 [ #  # ]
     832                 :          0 :             sal_Int32 nWidth (28000);
     833                 :          0 :             sal_Int32 nHeight (21000);
     834         [ #  # ]:          0 :             if ((xProperties->getPropertyValue(OUString("Width")) >>= nWidth)
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
             #  #  #  # ]
                 [ #  # ]
     835 [ #  # ][ #  # ]:          0 :                 && (xProperties->getPropertyValue(OUString("Height")) >>= nHeight)
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
     836                 :            :                 && nHeight > 0)
     837                 :            :             {
     838                 :          0 :                 nSlideAspectRatio = double(nWidth) / double(nHeight);
     839                 :          0 :             }
     840         [ #  # ]:          0 :         }
     841                 :            :     }
     842                 :          0 :     catch (RuntimeException&)
     843                 :            :     {
     844                 :            :         OSL_ASSERT(false);
     845                 :            :     }
     846                 :            : 
     847                 :          0 :     return nSlideAspectRatio;
     848                 :            : }
     849                 :            : 
     850                 :          0 : Reference<rendering::XBitmap> PresenterSlideSorter::GetPreview (const sal_Int32 nSlideIndex)
     851                 :            : {
     852 [ #  # ][ #  # ]:          0 :     if (nSlideIndex < 0 || nSlideIndex>=mpLayout->mnSlideCount)
                 [ #  # ]
     853                 :          0 :         return NULL;
     854         [ #  # ]:          0 :     else if (mxPane.is())
     855         [ #  # ]:          0 :         return mxPreviewCache->getSlidePreview(nSlideIndex, mxPane->getCanvas());
     856                 :            :     else
     857                 :          0 :         return NULL;
     858                 :            : }
     859                 :            : 
     860                 :          0 : void PresenterSlideSorter::PaintPreview (
     861                 :            :     const Reference<rendering::XCanvas>& rxCanvas,
     862                 :            :     const css::awt::Rectangle& rUpdateBox,
     863                 :            :     const sal_Int32 nSlideIndex)
     864                 :            : {
     865                 :            :     OSL_ASSERT(rxCanvas.is());
     866                 :            : 
     867                 :          0 :     geometry::IntegerSize2D aSize (mpLayout->maPreviewSize);
     868                 :            : 
     869 [ #  # ][ #  # ]:          0 :     if (PresenterGeometryHelper::AreRectanglesDisjoint(
     870                 :            :         rUpdateBox,
     871         [ #  # ]:          0 :         mpLayout->GetBoundingBox(nSlideIndex)))
     872                 :            :     {
     873                 :          0 :         return;
     874                 :            :     }
     875                 :            : 
     876         [ #  # ]:          0 :     Reference<rendering::XBitmap> xPreview (GetPreview(nSlideIndex));
     877                 :            : 
     878                 :            :     const geometry::RealPoint2D aTopLeft (
     879                 :            :         mpLayout->GetWindowPosition(
     880         [ #  # ]:          0 :             mpLayout->GetPoint(nSlideIndex, -1, -1)));
     881                 :            : 
     882                 :            :     // Create clip rectangle as intersection of the current update area and
     883                 :            :     // the bounding box of all previews.
     884                 :          0 :     geometry::RealRectangle2D aBoundingBox (mpLayout->maBoundingBox);
     885                 :          0 :     aBoundingBox.Y2 += 1;
     886                 :            :     const geometry::RealRectangle2D aClipBox (
     887                 :            :         PresenterGeometryHelper::Intersection(
     888                 :            :             PresenterGeometryHelper::ConvertRectangle(rUpdateBox),
     889 [ #  # ][ #  # ]:          0 :             aBoundingBox));
     890                 :            :     Reference<rendering::XPolyPolygon2D> xClip (
     891 [ #  # ][ #  # ]:          0 :         PresenterGeometryHelper::CreatePolygon(aClipBox, rxCanvas->getDevice()));
                 [ #  # ]
     892                 :            : 
     893         [ #  # ]:          0 :     const rendering::ViewState aViewState (geometry::AffineMatrix2D(1,0,0, 0,1,0), xClip);
     894                 :            : 
     895                 :            :     rendering::RenderState aRenderState (
     896                 :            :         geometry::AffineMatrix2D(
     897                 :            :             1, 0, aTopLeft.X,
     898                 :            :             0, 1, aTopLeft.Y),
     899                 :            :         NULL,
     900                 :            :         Sequence<double>(4),
     901 [ #  # ][ #  # ]:          0 :         rendering::CompositeOperation::SOURCE);
         [ #  # ][ #  # ]
     902                 :            : 
     903                 :            :     // Emphasize the current slide.
     904         [ #  # ]:          0 :     if (nSlideIndex == mnCurrentSlideIndex)
     905                 :            :     {
     906         [ #  # ]:          0 :         if (mpCurrentSlideFrameRenderer.get() != NULL)
     907                 :            :         {
     908                 :            :             const awt::Rectangle aSlideBoundingBox(
     909                 :          0 :                 sal::static_int_cast<sal_Int32>(0.5 + aTopLeft.X),
     910                 :          0 :                 sal::static_int_cast<sal_Int32>(0.5 + aTopLeft.Y),
     911                 :            :                 aSize.Width,
     912                 :          0 :                 aSize.Height);
     913                 :            :             maCurrentSlideFrameBoundingBox
     914                 :          0 :                 = mpCurrentSlideFrameRenderer->GetBoundingBox(aSlideBoundingBox);
     915                 :            :             mpCurrentSlideFrameRenderer->PaintCurrentSlideFrame (
     916                 :            :                 aSlideBoundingBox,
     917                 :            :                 mxCanvas,
     918         [ #  # ]:          0 :                 aClipBox);
     919                 :            :         }
     920                 :            :     }
     921                 :            : 
     922                 :            :     // Paint the preview.
     923         [ #  # ]:          0 :     if (xPreview.is())
     924                 :            :     {
     925 [ #  # ][ #  # ]:          0 :         aSize = xPreview->getSize();
     926 [ #  # ][ #  # ]:          0 :         if (aSize.Width > 0 && aSize.Height > 0)
     927                 :            :         {
     928 [ #  # ][ #  # ]:          0 :             rxCanvas->drawBitmap(xPreview, aViewState, aRenderState);
     929                 :            :         }
     930                 :            :     }
     931                 :            : 
     932                 :            :     // Create a polygon that is used to paint a frame around previews.  Its
     933                 :            :     // coordinates are chosen in the local coordinate system of a preview.
     934         [ #  # ]:          0 :     if ( ! mxPreviewFrame.is())
     935                 :            :         mxPreviewFrame = PresenterGeometryHelper::CreatePolygon(
     936                 :            :             awt::Rectangle(-1, -1, aSize.Width+2, aSize.Height+2),
     937 [ #  # ][ #  # ]:          0 :             rxCanvas->getDevice());
         [ #  # ][ #  # ]
     938                 :            : 
     939                 :            :     // Paint a border around the preview.
     940         [ #  # ]:          0 :     if (mxPreviewFrame.is())
     941                 :            :     {
     942                 :          0 :         const geometry::RealRectangle2D aBox (0, 0, aSize.Width, aSize.Height);
     943                 :          0 :         const util::Color aFrameColor (0x00000000);
     944         [ #  # ]:          0 :         PresenterCanvasHelper::SetDeviceColor(aRenderState, aFrameColor);
     945 [ #  # ][ #  # ]:          0 :         rxCanvas->drawPolyPolygon(mxPreviewFrame, aViewState, aRenderState);
     946                 :            :     }
     947                 :            : 
     948                 :            :     // Paint mouse over effect.
     949 [ #  # ][ #  # ]:          0 :     mpMouseOverManager->Paint(nSlideIndex, mxCanvas, xClip);
                 [ #  # ]
     950                 :            : }
     951                 :            : 
     952                 :          0 : void PresenterSlideSorter::Paint (const awt::Rectangle& rUpdateBox)
     953                 :            : {
     954                 :          0 :     const bool bCanvasChanged ( ! mxCanvas.is());
     955 [ #  # ][ #  # ]:          0 :     if ( ! ProvideCanvas())
     956                 :            :         return;
     957                 :            : 
     958 [ #  # ][ #  # ]:          0 :     if (mpLayout->mnRowCount<=0 || mpLayout->mnColumnCount<=0)
                 [ #  # ]
     959                 :            :     {
     960                 :            :         OSL_ASSERT(mpLayout->mnRowCount>0 || mpLayout->mnColumnCount>0);
     961                 :            :         return;
     962                 :            :     }
     963                 :            : 
     964                 :          0 :     mbIsPaintPending = false;
     965                 :            : 
     966         [ #  # ]:          0 :     ClearBackground(mxCanvas, rUpdateBox);
     967                 :            : 
     968                 :            :     // Give the canvas to the controls.
     969         [ #  # ]:          0 :     if (bCanvasChanged)
     970                 :            :     {
     971         [ #  # ]:          0 :         if (mpVerticalScrollBar.is())
     972         [ #  # ]:          0 :             mpVerticalScrollBar->SetCanvas(mxCanvas);
     973         [ #  # ]:          0 :         if (mpCloseButton.is())
     974         [ #  # ]:          0 :             mpCloseButton->SetCanvas(mxCanvas, mxWindow);
     975                 :            :     }
     976                 :            : 
     977                 :            :     // Now that the controls have a canvas we can do the layouting.
     978         [ #  # ]:          0 :     if (mbIsLayoutPending)
     979         [ #  # ]:          0 :         UpdateLayout();
     980                 :            : 
     981                 :            :     // Paint the horizontal separator.
     982                 :            :     rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0),
     983 [ #  # ][ #  # ]:          0 :             NULL, Sequence<double>(4), rendering::CompositeOperation::SOURCE);
         [ #  # ][ #  # ]
     984         [ #  # ]:          0 :     PresenterCanvasHelper::SetDeviceColor(aRenderState, maSeparatorColor);
     985         [ #  # ]:          0 :     mxCanvas->drawLine(
     986                 :            :         geometry::RealPoint2D(0, mnSeparatorY),
     987         [ #  # ]:          0 :         geometry::RealPoint2D(mxWindow->getPosSize().Width, mnSeparatorY),
     988                 :            :         rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL),
     989 [ #  # ][ #  # ]:          0 :         aRenderState);
         [ #  # ][ #  # ]
                 [ #  # ]
     990                 :            : 
     991                 :            :     // Paint the slides.
     992         [ #  # ]:          0 :     if ( ! PresenterGeometryHelper::AreRectanglesDisjoint(
     993                 :            :         rUpdateBox,
     994 [ #  # ][ #  # ]:          0 :         PresenterGeometryHelper::ConvertRectangle(mpLayout->maBoundingBox)))
     995                 :            :     {
     996                 :            :         mpLayout->ForAllVisibleSlides(
     997 [ #  # ][ #  # ]:          0 :             ::boost::bind(&PresenterSlideSorter::PaintPreview, this, mxCanvas, rUpdateBox, _1));
         [ #  # ][ #  # ]
                 [ #  # ]
     998                 :            :     }
     999                 :            : 
    1000         [ #  # ]:          0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxCanvas, UNO_QUERY);
    1001         [ #  # ]:          0 :     if (xSpriteCanvas.is())
    1002 [ #  # ][ #  # ]:          0 :         xSpriteCanvas->updateScreen(sal_False);
                 [ #  # ]
    1003                 :            : }
    1004                 :            : 
    1005                 :          0 : void PresenterSlideSorter::SetHorizontalOffset (const double nXOffset)
    1006                 :            : {
    1007         [ #  # ]:          0 :     if (mpLayout->SetHorizontalOffset(nXOffset))
    1008                 :            :     {
    1009                 :          0 :         mxPreviewCache->setVisibleRange(
    1010                 :            :             mpLayout->GetFirstVisibleSlideIndex(),
    1011                 :          0 :             mpLayout->GetLastVisibleSlideIndex());
    1012                 :            : 
    1013         [ #  # ]:          0 :         mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
    1014                 :            :     }
    1015                 :          0 : }
    1016                 :            : 
    1017                 :          0 : void PresenterSlideSorter::SetVerticalOffset (const double nYOffset)
    1018                 :            : {
    1019         [ #  # ]:          0 :     if (mpLayout->SetVerticalOffset(nYOffset))
    1020                 :            :     {
    1021                 :          0 :         mxPreviewCache->setVisibleRange(
    1022                 :            :             mpLayout->GetFirstVisibleSlideIndex(),
    1023                 :          0 :             mpLayout->GetLastVisibleSlideIndex());
    1024                 :            : 
    1025         [ #  # ]:          0 :         mpPresenterController->GetPaintManager()->Invalidate(mxWindow);
    1026                 :            :     }
    1027                 :          0 : }
    1028                 :            : 
    1029                 :          0 : void PresenterSlideSorter::GotoSlide (const sal_Int32 nSlideIndex)
    1030                 :            : {
    1031                 :          0 :     mxSlideShowController->gotoSlideIndex(nSlideIndex);
    1032                 :          0 : }
    1033                 :            : 
    1034                 :          0 : bool PresenterSlideSorter::ProvideCanvas (void)
    1035                 :            : {
    1036         [ #  # ]:          0 :     if ( ! mxCanvas.is())
    1037                 :            :     {
    1038         [ #  # ]:          0 :         if (mxPane.is())
    1039 [ #  # ][ #  # ]:          0 :             mxCanvas = mxPane->getCanvas();
                 [ #  # ]
    1040                 :            : 
    1041                 :            :         // Register as event listener so that we are informed when the
    1042                 :            :         // canvas is disposed (and we have to fetch another one).
    1043         [ #  # ]:          0 :         Reference<lang::XComponent> xComponent (mxCanvas, UNO_QUERY);
    1044         [ #  # ]:          0 :         if (xComponent.is())
    1045 [ #  # ][ #  # ]:          0 :             xComponent->addEventListener(static_cast<awt::XWindowListener*>(this));
                 [ #  # ]
    1046                 :            : 
    1047                 :            :         mpCurrentSlideFrameRenderer.reset(
    1048 [ #  # ][ #  # ]:          0 :             new CurrentSlideFrameRenderer(mxComponentContext, mxCanvas));
                 [ #  # ]
    1049                 :            :     }
    1050                 :          0 :     return mxCanvas.is();
    1051                 :            : }
    1052                 :            : 
    1053                 :          0 : void PresenterSlideSorter::ThrowIfDisposed (void)
    1054                 :            :     throw (lang::DisposedException)
    1055                 :            : {
    1056 [ #  # ][ #  # ]:          0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
    1057                 :            :     {
    1058                 :            :         throw lang::DisposedException (
    1059                 :            :             OUString(
    1060                 :            :                 "PresenterSlideSorter has been already disposed"),
    1061 [ #  # ][ #  # ]:          0 :             const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
    1062                 :            :     }
    1063                 :          0 : }
    1064                 :            : 
    1065                 :            : //===== PresenterSlideSorter::Layout ==========================================
    1066                 :            : 
    1067                 :          0 : PresenterSlideSorter::Layout::Layout (
    1068                 :            :     const ::rtl::Reference<PresenterScrollBar>& rpVerticalScrollBar)
    1069                 :            :     : maBoundingBox(),
    1070                 :            :       maPreviewSize(),
    1071                 :            :       mnHorizontalOffset(0),
    1072                 :            :       mnVerticalOffset(0),
    1073                 :            :       mnHorizontalGap(0),
    1074                 :            :       mnVerticalGap(0),
    1075                 :            :       mnHorizontalBorder(0),
    1076                 :            :       mnVerticalBorder(0),
    1077                 :            :       mnRowCount(1),
    1078                 :            :       mnColumnCount(1),
    1079                 :            :       mnSlideCount(0),
    1080                 :            :       mnSlideIndexAtMouse(-1),
    1081                 :            :       mnFirstVisibleColumn(-1),
    1082                 :            :       mnLastVisibleColumn(-1),
    1083                 :            :       mnFirstVisibleRow(-1),
    1084                 :            :       mnLastVisibleRow(-1),
    1085                 :          0 :       mpVerticalScrollBar(rpVerticalScrollBar)
    1086                 :            : {
    1087                 :          0 : }
    1088                 :            : 
    1089                 :          0 : void PresenterSlideSorter::Layout::Update (
    1090                 :            :     const geometry::RealRectangle2D& rBoundingBox,
    1091                 :            :     const double nSlideAspectRatio)
    1092                 :            : {
    1093                 :          0 :     maBoundingBox = rBoundingBox;
    1094                 :            : 
    1095                 :          0 :     mnHorizontalBorder = gnHorizontalBorder;
    1096                 :          0 :     mnVerticalBorder = gnVerticalBorder;
    1097                 :            : 
    1098                 :          0 :     const double nWidth (rBoundingBox.X2 - rBoundingBox.X1 - 2*mnHorizontalBorder);
    1099                 :          0 :     const double nHeight (rBoundingBox.Y2 - rBoundingBox.Y1 - 2*mnVerticalBorder);
    1100 [ #  # ][ #  # ]:          0 :     if (nWidth<=0 || nHeight<=0)
    1101                 :          0 :         return;
    1102                 :            : 
    1103                 :            :     double nPreviewWidth;
    1104                 :            : 
    1105                 :            :     // Determine column count, preview width, and horizontal gap (borders
    1106                 :            :     // are half the gap).  Try to use the preferred values.  Try more to
    1107                 :            :     // stay in the valid intervalls.  This last constraint may be not
    1108                 :            :     // fullfilled in some cases.
    1109                 :          0 :     const double nElementWidth = nWidth / gnPreferredColumnCount;
    1110         [ #  # ]:          0 :     if (nElementWidth < gnMinimalPreviewWidth + gnMinimalHorizontalPreviewGap)
    1111                 :            :     {
    1112                 :            :         // The preferred column count is too large.
    1113                 :            :         // Can we use the preferred preview width?
    1114         [ #  # ]:          0 :         if (nWidth - gnMinimalHorizontalPreviewGap >= gnPreferredPreviewWidth)
    1115                 :            :         {
    1116                 :            :             // Yes.
    1117                 :          0 :             nPreviewWidth = gnPreferredPreviewWidth;
    1118                 :            :             mnColumnCount = floor((nWidth+gnPreferredHorizontalPreviewGap)
    1119                 :          0 :                 / (nPreviewWidth+gnPreferredHorizontalPreviewGap));
    1120                 :          0 :             mnHorizontalGap = round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
    1121                 :            :         }
    1122                 :            :         else
    1123                 :            :         {
    1124                 :            :             // No.  Set the column count to 1 and adapt preview width and
    1125                 :            :             // gap.
    1126                 :          0 :             mnColumnCount = 1;
    1127                 :          0 :             mnHorizontalGap = floor(gnMinimalHorizontalPreviewGap);
    1128         [ #  # ]:          0 :             if (nWidth - gnMinimalHorizontalPreviewGap >= gnPreferredPreviewWidth)
    1129                 :          0 :                 nPreviewWidth = nWidth - gnMinimalHorizontalPreviewGap;
    1130                 :            :             else
    1131         [ #  # ]:          0 :                 nPreviewWidth = ::std::max(gnMinimalPreviewWidth, nWidth-mnHorizontalGap);
    1132                 :            :         }
    1133                 :            :     }
    1134         [ #  # ]:          0 :     else if (nElementWidth > gnMaximalPreviewWidth + gnMaximalHorizontalPreviewGap)
    1135                 :            :     {
    1136                 :            :         // The preferred column count is too small.
    1137                 :          0 :         nPreviewWidth = gnPreferredPreviewWidth;
    1138                 :            :         mnColumnCount = floor((nWidth+gnPreferredHorizontalPreviewGap)
    1139                 :          0 :             / (nPreviewWidth+gnPreferredHorizontalPreviewGap));
    1140                 :          0 :         mnHorizontalGap = round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
    1141                 :            :     }
    1142                 :            :     else
    1143                 :            :     {
    1144                 :            :         // The preferred column count is possible.  Determine gap and
    1145                 :            :         // preview width.
    1146                 :          0 :         mnColumnCount = gnPreferredColumnCount;
    1147         [ #  # ]:          0 :         if (nElementWidth - gnPreferredPreviewWidth < gnMinimalHorizontalPreviewGap)
    1148                 :            :         {
    1149                 :            :             // Use the minimal gap and adapt the preview width.
    1150                 :          0 :             mnHorizontalGap = floor(gnMinimalHorizontalPreviewGap);
    1151                 :          0 :             nPreviewWidth = (nWidth - mnColumnCount*mnHorizontalGap) / mnColumnCount;
    1152                 :            :         }
    1153         [ #  # ]:          0 :         else if (nElementWidth - gnPreferredPreviewWidth <= gnMaximalHorizontalPreviewGap)
    1154                 :            :         {
    1155                 :            :             // Use the maximal gap and adapt the preview width.
    1156                 :          0 :             mnHorizontalGap = round(gnMaximalHorizontalPreviewGap);
    1157                 :          0 :             nPreviewWidth = (nWidth - mnColumnCount*mnHorizontalGap) / mnColumnCount;
    1158                 :            :         }
    1159                 :            :         else
    1160                 :            :         {
    1161                 :            :             // Use the preferred preview width and adapt the gap.
    1162                 :          0 :             nPreviewWidth = gnPreferredPreviewWidth;
    1163                 :          0 :             mnHorizontalGap = round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
    1164                 :            :         }
    1165                 :            :     }
    1166                 :            : 
    1167                 :            :     // Now determine the row count, preview height, and vertical gap.
    1168                 :          0 :     const double nPreviewHeight = nPreviewWidth / nSlideAspectRatio;
    1169                 :            :     mnRowCount = ::std::max(
    1170                 :            :         sal_Int32(1),
    1171                 :            :         sal_Int32(ceil((nHeight+gnPreferredVerticalPreviewGap)
    1172         [ #  # ]:          0 :                 / (nPreviewHeight + gnPreferredVerticalPreviewGap))));
    1173                 :          0 :     mnVerticalGap = round(gnPreferredVerticalPreviewGap);
    1174                 :            : 
    1175         [ #  # ]:          0 :     maPreviewSize = geometry::IntegerSize2D(floor(nPreviewWidth), floor(nPreviewHeight));
    1176                 :            : 
    1177                 :            :     // Reset the offset.
    1178                 :          0 :     mnVerticalOffset = 0;
    1179                 :            :     mnHorizontalOffset = round(-(nWidth
    1180                 :            :         - mnColumnCount*maPreviewSize.Width
    1181                 :            :         - (mnColumnCount-1)*mnHorizontalGap)
    1182                 :          0 :         / 2);
    1183                 :            : }
    1184                 :            : 
    1185                 :          0 : void PresenterSlideSorter::Layout::SetupVisibleArea (void)
    1186                 :            : {
    1187                 :            :     geometry::RealPoint2D aPoint (GetLocalPosition(
    1188                 :          0 :         geometry::RealPoint2D(maBoundingBox.X1, maBoundingBox.Y1)));
    1189                 :          0 :     mnFirstVisibleColumn = 0;
    1190 [ #  # ][ #  # ]:          0 :     mnFirstVisibleRow = ::std::max(sal_Int32(0), GetRow(aPoint));
    1191                 :            : 
    1192                 :          0 :     aPoint = GetLocalPosition(geometry::RealPoint2D( maBoundingBox.X2, maBoundingBox.Y2));
    1193                 :          0 :     mnLastVisibleColumn = mnColumnCount - 1;
    1194         [ #  # ]:          0 :     mnLastVisibleRow = GetRow(aPoint, true);
    1195                 :          0 : }
    1196                 :            : 
    1197                 :          0 : bool PresenterSlideSorter::Layout::IsScrollBarNeeded (const sal_Int32 nSlideCount)
    1198                 :            : {
    1199                 :          0 :     geometry::RealPoint2D aBottomRight;
    1200                 :            :     aBottomRight = GetPoint(
    1201         [ #  # ]:          0 :         mnColumnCount * (GetRow(nSlideCount)+1) - 1, +1, +1);
    1202                 :            :     return aBottomRight.X > maBoundingBox.X2-maBoundingBox.X1
    1203 [ #  # ][ #  # ]:          0 :         || aBottomRight.Y > maBoundingBox.Y2-maBoundingBox.Y1;
    1204                 :            : }
    1205                 :            : 
    1206                 :          0 : geometry::RealPoint2D PresenterSlideSorter::Layout::GetLocalPosition(
    1207                 :            :     const geometry::RealPoint2D& rWindowPoint) const
    1208                 :            : {
    1209                 :            :     return css::geometry::RealPoint2D(
    1210                 :            :         rWindowPoint.X - maBoundingBox.X1 + mnHorizontalOffset,
    1211                 :          0 :         rWindowPoint.Y - maBoundingBox.Y1 + mnVerticalOffset);
    1212                 :            : }
    1213                 :            : 
    1214                 :          0 : geometry::RealPoint2D PresenterSlideSorter::Layout::GetWindowPosition(
    1215                 :            :     const geometry::RealPoint2D& rLocalPoint) const
    1216                 :            : {
    1217                 :            :     return css::geometry::RealPoint2D(
    1218                 :            :         rLocalPoint.X - mnHorizontalOffset + maBoundingBox.X1,
    1219                 :          0 :         rLocalPoint.Y - mnVerticalOffset + maBoundingBox.Y1);
    1220                 :            : }
    1221                 :            : 
    1222                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetColumn (
    1223                 :            :     const css::geometry::RealPoint2D& rLocalPoint,
    1224                 :            :     const bool bReturnInvalidValue) const
    1225                 :            : {
    1226                 :            :     const sal_Int32 nColumn(floor(
    1227                 :          0 :         (rLocalPoint.X + mnHorizontalGap/2.0) / (maPreviewSize.Width+mnHorizontalGap)));
    1228 [ #  # ][ #  # ]:          0 :     if (bReturnInvalidValue
                 [ #  # ]
    1229                 :            :         || (nColumn>=mnFirstVisibleColumn && nColumn<=mnLastVisibleColumn))
    1230                 :            :     {
    1231                 :          0 :         return nColumn;
    1232                 :            :     }
    1233                 :            :     else
    1234                 :          0 :         return -1;
    1235                 :            : }
    1236                 :            : 
    1237                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetRow (
    1238                 :            :     const css::geometry::RealPoint2D& rLocalPoint,
    1239                 :            :     const bool bReturnInvalidValue) const
    1240                 :            : {
    1241                 :            :     const sal_Int32 nRow (floor(
    1242                 :          0 :         (rLocalPoint.Y + mnVerticalGap/2.0) / (maPreviewSize.Height+mnVerticalGap)));
    1243 [ #  # ][ #  # ]:          0 :     if (bReturnInvalidValue
                 [ #  # ]
    1244                 :            :         || (nRow>=mnFirstVisibleRow && nRow<=mnLastVisibleRow))
    1245                 :            :     {
    1246                 :          0 :         return nRow;
    1247                 :            :     }
    1248                 :            :     else
    1249                 :          0 :         return -1;
    1250                 :            : }
    1251                 :            : 
    1252                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetSlideIndexForPosition (
    1253                 :            :     const css::geometry::RealPoint2D& rWindowPoint) const
    1254                 :            : {
    1255 [ #  # ][ #  # ]:          0 :     if ( ! PresenterGeometryHelper::IsInside(maBoundingBox, rWindowPoint))
    1256                 :          0 :         return -1;
    1257                 :            : 
    1258                 :          0 :     const css::geometry::RealPoint2D aLocalPosition (GetLocalPosition(rWindowPoint));
    1259         [ #  # ]:          0 :     const sal_Int32 nColumn (GetColumn(aLocalPosition));
    1260         [ #  # ]:          0 :     const sal_Int32 nRow (GetRow(aLocalPosition));
    1261                 :            : 
    1262 [ #  # ][ #  # ]:          0 :     if (nColumn < 0 || nRow < 0)
    1263                 :          0 :         return -1;
    1264                 :            :     else
    1265                 :            :     {
    1266                 :          0 :         sal_Int32 nIndex (GetIndex(nRow, nColumn));
    1267         [ #  # ]:          0 :         if (nIndex >= mnSlideCount)
    1268                 :          0 :             return -1;
    1269                 :            :         else
    1270                 :          0 :             return nIndex;
    1271                 :            :     }
    1272                 :            : }
    1273                 :            : 
    1274                 :          0 : geometry::RealPoint2D PresenterSlideSorter::Layout::GetPoint (
    1275                 :            :     const sal_Int32 nSlideIndex,
    1276                 :            :     const sal_Int32 nRelativeHorizontalPosition,
    1277                 :            :     const sal_Int32 nRelativeVerticalPosition) const
    1278                 :            : {
    1279                 :          0 :     sal_Int32 nColumn (GetColumn(nSlideIndex));
    1280                 :          0 :     sal_Int32 nRow (GetRow(nSlideIndex));
    1281                 :            : 
    1282                 :            :     geometry::RealPoint2D aPosition (
    1283                 :            :         mnHorizontalBorder + nColumn*(maPreviewSize.Width+mnHorizontalGap),
    1284                 :          0 :         mnVerticalBorder + nRow*(maPreviewSize.Height+mnVerticalGap));
    1285                 :            : 
    1286         [ #  # ]:          0 :     if (nRelativeHorizontalPosition >= 0)
    1287                 :            :     {
    1288         [ #  # ]:          0 :         if (nRelativeHorizontalPosition > 0)
    1289                 :          0 :             aPosition.X += maPreviewSize.Width;
    1290                 :            :         else
    1291                 :          0 :             aPosition.X += maPreviewSize.Width / 2.0;
    1292                 :            :     }
    1293         [ #  # ]:          0 :     if (nRelativeVerticalPosition >= 0)
    1294                 :            :     {
    1295         [ #  # ]:          0 :         if (nRelativeVerticalPosition > 0)
    1296                 :          0 :             aPosition.Y += maPreviewSize.Height;
    1297                 :            :         else
    1298                 :          0 :             aPosition.Y += maPreviewSize.Height / 2.0;
    1299                 :            :     }
    1300                 :            : 
    1301                 :          0 :     return aPosition;
    1302                 :            : }
    1303                 :            : 
    1304                 :          0 : awt::Rectangle PresenterSlideSorter::Layout::GetBoundingBox (const sal_Int32 nSlideIndex) const
    1305                 :            : {
    1306         [ #  # ]:          0 :     const geometry::RealPoint2D aWindowPosition(GetWindowPosition(GetPoint(nSlideIndex, -1, -1)));
    1307                 :            :     return PresenterGeometryHelper::ConvertRectangle(
    1308                 :            :         geometry::RealRectangle2D(
    1309                 :            :             aWindowPosition.X,
    1310                 :            :             aWindowPosition.Y,
    1311                 :            :             aWindowPosition.X + maPreviewSize.Width,
    1312         [ #  # ]:          0 :             aWindowPosition.Y + maPreviewSize.Height));
    1313                 :            : }
    1314                 :            : 
    1315                 :          0 : void PresenterSlideSorter::Layout::ForAllVisibleSlides (const ::boost::function<void(sal_Int32)>& rAction)
    1316                 :            : {
    1317         [ #  # ]:          0 :     for (sal_Int32 nRow=mnFirstVisibleRow; nRow<=mnLastVisibleRow; ++nRow)
    1318                 :            :     {
    1319         [ #  # ]:          0 :         for (sal_Int32 nColumn=mnFirstVisibleColumn; nColumn<=mnLastVisibleColumn; ++nColumn)
    1320                 :            :         {
    1321                 :          0 :             const sal_Int32 nSlideIndex (GetIndex(nRow, nColumn));
    1322         [ #  # ]:          0 :             if (nSlideIndex >= mnSlideCount)
    1323                 :          0 :                 return;
    1324                 :          0 :             rAction(nSlideIndex);
    1325                 :            :         }
    1326                 :            :     }
    1327                 :            : }
    1328                 :            : 
    1329                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetFirstVisibleSlideIndex (void) const
    1330                 :            : {
    1331                 :          0 :     return GetIndex(mnFirstVisibleRow, mnFirstVisibleColumn);
    1332                 :            : }
    1333                 :            : 
    1334                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetLastVisibleSlideIndex (void) const
    1335                 :            : {
    1336                 :            :     return ::std::min(
    1337                 :          0 :         GetIndex(mnLastVisibleRow, mnLastVisibleColumn),
    1338         [ #  # ]:          0 :         mnSlideCount);
    1339                 :            : }
    1340                 :            : 
    1341                 :          0 : bool PresenterSlideSorter::Layout::SetHorizontalOffset (const double nOffset)
    1342                 :            : {
    1343         [ #  # ]:          0 :     if (mnHorizontalOffset != nOffset)
    1344                 :            :     {
    1345                 :          0 :         mnHorizontalOffset = round(nOffset);
    1346                 :          0 :         SetupVisibleArea();
    1347                 :          0 :         UpdateScrollBars();
    1348                 :          0 :         return true;
    1349                 :            :     }
    1350                 :            :     else
    1351                 :          0 :         return false;
    1352                 :            : }
    1353                 :            : 
    1354                 :          0 : bool PresenterSlideSorter::Layout::SetVerticalOffset (const double nOffset)
    1355                 :            : {
    1356         [ #  # ]:          0 :     if (mnVerticalOffset != nOffset)
    1357                 :            :     {
    1358                 :          0 :         mnVerticalOffset = round(nOffset);
    1359                 :          0 :         SetupVisibleArea();
    1360                 :          0 :         UpdateScrollBars();
    1361                 :          0 :         return true;
    1362                 :            :     }
    1363                 :            :     else
    1364                 :          0 :         return false;
    1365                 :            : }
    1366                 :            : 
    1367                 :          0 : void PresenterSlideSorter::Layout::UpdateScrollBars (void)
    1368                 :            : {
    1369                 :          0 :     sal_Int32 nTotalRowCount (0);
    1370                 :          0 :     nTotalRowCount = sal_Int32(ceil(double(mnSlideCount) / double(mnColumnCount)));
    1371                 :            : 
    1372         [ #  # ]:          0 :     if (mpVerticalScrollBar.get() != NULL)
    1373                 :            :     {
    1374                 :            :         mpVerticalScrollBar->SetTotalSize(
    1375                 :            :             nTotalRowCount * maPreviewSize.Height
    1376                 :            :                 + (nTotalRowCount-1) * mnVerticalGap
    1377                 :          0 :             + 2*mnVerticalGap);
    1378                 :          0 :         mpVerticalScrollBar->SetThumbPosition(mnVerticalOffset, false);
    1379                 :          0 :         mpVerticalScrollBar->SetThumbSize(maBoundingBox.Y2 - maBoundingBox.Y1 + 1);
    1380                 :          0 :         mpVerticalScrollBar->SetLineHeight(maPreviewSize.Height);
    1381                 :            :     }
    1382                 :            : 
    1383                 :            :     // No place yet for the vertical scroll bar.
    1384                 :          0 : }
    1385                 :            : 
    1386                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetIndex (
    1387                 :            :     const sal_Int32 nRow,
    1388                 :            :     const sal_Int32 nColumn) const
    1389                 :            : {
    1390                 :          0 :     return nRow * mnColumnCount + nColumn;
    1391                 :            : }
    1392                 :            : 
    1393                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetRow (const sal_Int32 nSlideIndex) const
    1394                 :            : {
    1395                 :          0 :     return nSlideIndex / mnColumnCount;
    1396                 :            : }
    1397                 :            : 
    1398                 :          0 : sal_Int32 PresenterSlideSorter::Layout::GetColumn (const sal_Int32 nSlideIndex) const
    1399                 :            : {
    1400                 :          0 :     return nSlideIndex % mnColumnCount;
    1401                 :            : }
    1402                 :            : 
    1403                 :            : //===== PresenterSlideSorter::MouseOverManager ================================
    1404                 :            : 
    1405                 :          0 : PresenterSlideSorter::MouseOverManager::MouseOverManager (
    1406                 :            :     const Reference<container::XIndexAccess>& rxSlides,
    1407                 :            :     const ::boost::shared_ptr<PresenterTheme>& rpTheme,
    1408                 :            :     const Reference<awt::XWindow>& rxInvalidateTarget,
    1409                 :            :     const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager)
    1410                 :            :     : mxCanvas(),
    1411                 :            :       mxSlides(rxSlides),
    1412                 :            :       mpLeftLabelBitmap(),
    1413                 :            :       mpCenterLabelBitmap(),
    1414                 :            :       mpRightLabelBitmap(),
    1415                 :            :       mpFont(),
    1416                 :            :       mnSlideIndex(-1),
    1417                 :            :       maSlideBoundingBox(),
    1418                 :            :       mxInvalidateTarget(rxInvalidateTarget),
    1419 [ #  # ][ #  # ]:          0 :       mpPaintManager(rpPaintManager)
         [ #  # ][ #  # ]
                 [ #  # ]
    1420                 :            : {
    1421         [ #  # ]:          0 :     if (rpTheme.get()!=NULL)
    1422                 :            :     {
    1423         [ #  # ]:          0 :         ::boost::shared_ptr<PresenterBitmapContainer> pBitmaps (rpTheme->GetBitmapContainer());
    1424         [ #  # ]:          0 :         if (pBitmaps.get() != NULL)
    1425                 :            :         {
    1426 [ #  # ][ #  # ]:          0 :             mpLeftLabelBitmap = pBitmaps->GetBitmap(A2S("LabelLeft"));
                 [ #  # ]
    1427 [ #  # ][ #  # ]:          0 :             mpCenterLabelBitmap = pBitmaps->GetBitmap(A2S("LabelCenter"));
                 [ #  # ]
    1428 [ #  # ][ #  # ]:          0 :             mpRightLabelBitmap = pBitmaps->GetBitmap(A2S("LabelRight"));
                 [ #  # ]
    1429                 :            :         }
    1430                 :            : 
    1431 [ #  # ][ #  # ]:          0 :         mpFont = rpTheme->GetFont(A2S("SlideSorterLabelFont"));
         [ #  # ][ #  # ]
    1432                 :            :     }
    1433                 :          0 : }
    1434                 :            : 
    1435 [ #  # ][ #  # ]:          0 : PresenterSlideSorter::MouseOverManager::~MouseOverManager (void)
         [ #  # ][ #  # ]
                 [ #  # ]
    1436                 :            : {
    1437                 :          0 : }
    1438                 :            : 
    1439                 :          0 : void PresenterSlideSorter::MouseOverManager::Paint (
    1440                 :            :     const sal_Int32 nSlideIndex,
    1441                 :            :     const Reference<rendering::XCanvas>& rxCanvas,
    1442                 :            :     const Reference<rendering::XPolyPolygon2D>& rxClip)
    1443                 :            : {
    1444         [ #  # ]:          0 :     if (nSlideIndex != mnSlideIndex)
    1445                 :          0 :         return;
    1446                 :            : 
    1447         [ #  # ]:          0 :     if (mxCanvas != rxCanvas)
    1448                 :          0 :         SetCanvas(rxCanvas);
    1449         [ #  # ]:          0 :     if (rxCanvas != NULL)
    1450                 :            :     {
    1451         [ #  # ]:          0 :         if ( ! mxBitmap.is())
    1452         [ #  # ]:          0 :             mxBitmap = CreateBitmap(msText, maSlideBoundingBox.Width);
    1453         [ #  # ]:          0 :         if (mxBitmap.is())
    1454                 :            :         {
    1455 [ #  # ][ #  # ]:          0 :             geometry::IntegerSize2D aSize (mxBitmap->getSize());
    1456                 :            :             const double nXOffset (maSlideBoundingBox.X
    1457                 :          0 :                 + (maSlideBoundingBox.Width - aSize.Width) / 2.0);
    1458                 :            :             const double nYOffset (maSlideBoundingBox.Y
    1459                 :          0 :                 + (maSlideBoundingBox.Height - aSize.Height) / 2.0);
    1460         [ #  # ]:          0 :             rxCanvas->drawBitmap(
    1461                 :            :                 mxBitmap,
    1462                 :            :                 rendering::ViewState(
    1463                 :            :                     geometry::AffineMatrix2D(1,0,0, 0,1,0),
    1464                 :            :                     rxClip),
    1465                 :            :                 rendering::RenderState(
    1466                 :            :                     geometry::AffineMatrix2D(1,0,nXOffset, 0,1,nYOffset),
    1467                 :            :                     NULL,
    1468                 :            :                     Sequence<double>(4),
    1469 [ #  # ][ #  # ]:          0 :                     rendering::CompositeOperation::SOURCE));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1470                 :            :         }
    1471                 :            :     }
    1472                 :            : }
    1473                 :            : 
    1474                 :          0 : void PresenterSlideSorter::MouseOverManager::SetCanvas (
    1475                 :            :     const Reference<rendering::XCanvas>& rxCanvas)
    1476                 :            : {
    1477                 :          0 :     mxCanvas = rxCanvas;
    1478         [ #  # ]:          0 :     if (mpFont.get() != NULL)
    1479         [ #  # ]:          0 :         mpFont->PrepareFont(Reference<rendering::XCanvas>(mxCanvas, UNO_QUERY));
    1480                 :          0 : }
    1481                 :            : 
    1482                 :          0 : void PresenterSlideSorter::MouseOverManager::SetSlide (
    1483                 :            :     const sal_Int32 nSlideIndex,
    1484                 :            :     const awt::Rectangle& rBox)
    1485                 :            : {
    1486         [ #  # ]:          0 :     if (mnSlideIndex == nSlideIndex)
    1487                 :          0 :         return;
    1488                 :            : 
    1489                 :          0 :     mnSlideIndex = -1;
    1490                 :          0 :     Invalidate();
    1491                 :            : 
    1492                 :          0 :     maSlideBoundingBox = rBox;
    1493                 :          0 :     mnSlideIndex = nSlideIndex;
    1494                 :            : 
    1495         [ #  # ]:          0 :     if (nSlideIndex >= 0)
    1496                 :            :     {
    1497         [ #  # ]:          0 :         if (mxSlides.get() != NULL)
    1498                 :            :         {
    1499                 :          0 :             msText = OUString();
    1500                 :            : 
    1501 [ #  # ][ #  # ]:          0 :             Reference<beans::XPropertySet> xSlideProperties(mxSlides->getByIndex(nSlideIndex), UNO_QUERY);
                 [ #  # ]
    1502         [ #  # ]:          0 :             if (xSlideProperties.is())
    1503 [ #  # ][ #  # ]:          0 :                 xSlideProperties->getPropertyValue(A2S("LinkDisplayName")) >>= msText;
    1504                 :            : 
    1505         [ #  # ]:          0 :             if (msText.isEmpty())
    1506                 :          0 :                 msText = A2S("Slide ") + OUString::valueOf(nSlideIndex + 1);
    1507                 :            :         }
    1508                 :            :     }
    1509                 :            :     else
    1510                 :            :     {
    1511                 :          0 :         msText = OUString();
    1512                 :            :     }
    1513                 :          0 :     mxBitmap = NULL;
    1514                 :            : 
    1515                 :          0 :     Invalidate();
    1516                 :            : }
    1517                 :            : 
    1518                 :          0 : Reference<rendering::XBitmap> PresenterSlideSorter::MouseOverManager::CreateBitmap (
    1519                 :            :     const OUString& rsText,
    1520                 :            :     const sal_Int32 nMaximalWidth) const
    1521                 :            : {
    1522         [ #  # ]:          0 :     if ( ! mxCanvas.is())
    1523         [ #  # ]:          0 :         return NULL;
    1524                 :            : 
    1525 [ #  # ][ #  # ]:          0 :     if (mpFont.get()==NULL || !mpFont->mxFont.is())
                 [ #  # ]
    1526         [ #  # ]:          0 :         return NULL;
    1527                 :            : 
    1528                 :            :     // Long text has to be shortened.
    1529                 :            :     const OUString sText (GetFittingText(rsText, nMaximalWidth
    1530                 :            :             - 2*gnHorizontalLabelBorder
    1531         [ #  # ]:          0 :             - 2*gnHorizontalLabelPadding));
    1532                 :            : 
    1533                 :            :     // Determine the size of the label.  Its height is defined by the
    1534                 :            :     // bitmaps that are used to paints its background.  The width is defined
    1535                 :            :     // by the text.
    1536         [ #  # ]:          0 :     geometry::IntegerSize2D aLabelSize (CalculateLabelSize(sText));
    1537                 :            : 
    1538                 :            :     // Create a new bitmap that will contain the complete label.
    1539                 :            :     Reference<rendering::XBitmap> xBitmap (
    1540 [ #  # ][ #  # ]:          0 :         mxCanvas->getDevice()->createCompatibleAlphaBitmap(aLabelSize));
         [ #  # ][ #  # ]
    1541                 :            : 
    1542         [ #  # ]:          0 :     if ( ! xBitmap.is())
    1543         [ #  # ]:          0 :         return NULL;
    1544                 :            : 
    1545         [ #  # ]:          0 :     Reference<rendering::XBitmapCanvas> xBitmapCanvas (xBitmap, UNO_QUERY);
    1546         [ #  # ]:          0 :     if ( ! xBitmapCanvas.is())
    1547         [ #  # ]:          0 :         return NULL;
    1548                 :            : 
    1549                 :            :     // Paint the background.
    1550         [ #  # ]:          0 :     PaintButtonBackground(xBitmapCanvas, aLabelSize);
    1551                 :            : 
    1552                 :            :     // Paint the text.
    1553         [ #  # ]:          0 :     if (!sText.isEmpty())
    1554                 :            :     {
    1555                 :            : 
    1556                 :          0 :         const rendering::StringContext aContext (sText, 0, sText.getLength());
    1557         [ #  # ]:          0 :         const Reference<rendering::XTextLayout> xLayout (mpFont->mxFont->createTextLayout(
    1558         [ #  # ]:          0 :             aContext, rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
    1559 [ #  # ][ #  # ]:          0 :         const geometry::RealRectangle2D aTextBBox (xLayout->queryTextBounds());
    1560                 :            : 
    1561                 :          0 :         const double nXOffset = (aLabelSize.Width - aTextBBox.X2 + aTextBBox.X1) / 2;
    1562                 :            :         const double nYOffset = aLabelSize.Height
    1563                 :          0 :             - (aLabelSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y2;
    1564                 :            : 
    1565                 :            :         const rendering::ViewState aViewState(
    1566                 :            :             geometry::AffineMatrix2D(1,0,0, 0,1,0),
    1567 [ #  # ][ #  # ]:          0 :             NULL);
    1568                 :            : 
    1569                 :            :         rendering::RenderState aRenderState (
    1570                 :            :             geometry::AffineMatrix2D(1,0,nXOffset, 0,1,nYOffset),
    1571                 :            :             NULL,
    1572                 :            :             Sequence<double>(4),
    1573 [ #  # ][ #  # ]:          0 :             rendering::CompositeOperation::SOURCE);
         [ #  # ][ #  # ]
    1574         [ #  # ]:          0 :         PresenterCanvasHelper::SetDeviceColor(aRenderState, mpFont->mnColor);
    1575                 :            : 
    1576         [ #  # ]:          0 :         xBitmapCanvas->drawText(
    1577                 :            :             aContext,
    1578                 :          0 :             mpFont->mxFont,
    1579                 :            :             aViewState,
    1580                 :            :             aRenderState,
    1581 [ #  # ][ #  # ]:          0 :             rendering::TextDirection::WEAK_LEFT_TO_RIGHT);
                 [ #  # ]
    1582                 :            :     }
    1583                 :            : 
    1584                 :          0 :     return xBitmap;
    1585                 :            : }
    1586                 :            : 
    1587                 :          0 : OUString PresenterSlideSorter::MouseOverManager::GetFittingText (
    1588                 :            :     const OUString& rsText,
    1589                 :            :     const double nMaximalWidth) const
    1590                 :            : {
    1591                 :            :     const double nTextWidth (
    1592                 :          0 :         PresenterCanvasHelper::GetTextSize(mpFont->mxFont, rsText).Width);
    1593         [ #  # ]:          0 :     if (nTextWidth > nMaximalWidth)
    1594                 :            :     {
    1595                 :            :         // Text is too wide.  Shorten it by removing characters from the end
    1596                 :            :         // and replacing them by ellipses.
    1597                 :            : 
    1598                 :            :         // Guess a start value of the final string length.
    1599                 :          0 :         double nBestWidth (0);
    1600                 :          0 :         OUString sBestCandidate;
    1601         [ #  # ]:          0 :         sal_Int32 nLength (round(rsText.getLength() * nMaximalWidth / nTextWidth));
    1602                 :          0 :         const OUString sEllipses (A2S("..."));
    1603                 :          0 :         while (true)
    1604                 :            :         {
    1605                 :          0 :             const OUString sCandidate (rsText.copy(0,nLength) + sEllipses);
    1606                 :            :             const double nWidth (
    1607         [ #  # ]:          0 :                 PresenterCanvasHelper::GetTextSize(mpFont->mxFont, sCandidate).Width);
    1608         [ #  # ]:          0 :             if (nWidth > nMaximalWidth)
    1609                 :            :             {
    1610                 :            :                 // Candidate still too wide, shorten it.
    1611                 :          0 :                 nLength -= 1;
    1612         [ #  # ]:          0 :                 if (nLength <= 0)
    1613                 :            :                     break;
    1614                 :            :             }
    1615         [ #  # ]:          0 :             else if (nWidth < nMaximalWidth)
    1616                 :            :             {
    1617                 :            :                 // Candidate short enough.
    1618         [ #  # ]:          0 :                 if (nWidth > nBestWidth)
    1619                 :            :                 {
    1620                 :            :                     // Best length so far.
    1621                 :          0 :                     sBestCandidate = sCandidate;
    1622                 :          0 :                     nBestWidth = nWidth;
    1623                 :          0 :                     nLength += 1;
    1624         [ #  # ]:          0 :                     if (nLength >= rsText.getLength())
    1625                 :            :                         break;
    1626                 :            :                 }
    1627                 :            :                 else
    1628                 :            :                     break;
    1629                 :            :             }
    1630                 :            :             else
    1631                 :            :             {
    1632                 :            :                 // Candidate is exactly as long as it may be.  Use it
    1633                 :            :                 // without looking any further.
    1634                 :          0 :                 sBestCandidate = sCandidate;
    1635                 :            :                 break;
    1636                 :            :             }
    1637         [ #  # ]:          0 :         }
    1638                 :          0 :         return sBestCandidate;
    1639                 :            :     }
    1640                 :            :     else
    1641                 :          0 :         return rsText;
    1642                 :            : }
    1643                 :            : 
    1644                 :          0 : geometry::IntegerSize2D PresenterSlideSorter::MouseOverManager::CalculateLabelSize (
    1645                 :            :     const OUString& rsText) const
    1646                 :            : {
    1647                 :            :     // Height is specified by the label bitmaps.
    1648                 :          0 :     sal_Int32 nHeight (32);
    1649         [ #  # ]:          0 :     if (mpCenterLabelBitmap.get() != NULL)
    1650                 :            :     {
    1651         [ #  # ]:          0 :         Reference<rendering::XBitmap> xBitmap (mpCenterLabelBitmap->GetNormalBitmap());
    1652         [ #  # ]:          0 :         if (xBitmap.is())
    1653 [ #  # ][ #  # ]:          0 :             nHeight = xBitmap->getSize().Height;
    1654                 :            :     }
    1655                 :            : 
    1656                 :            :     // Width is specified by text width and maximal width.
    1657                 :            :     const geometry::RealSize2D aTextSize (
    1658         [ #  # ]:          0 :         PresenterCanvasHelper::GetTextSize(mpFont->mxFont, rsText));
    1659                 :            : 
    1660         [ #  # ]:          0 :     const sal_Int32 nWidth (round(aTextSize.Width + 2*gnHorizontalLabelPadding));
    1661                 :            : 
    1662                 :          0 :     return geometry::IntegerSize2D(nWidth, nHeight);
    1663                 :            : }
    1664                 :            : 
    1665                 :          0 : void PresenterSlideSorter::MouseOverManager::PaintButtonBackground (
    1666                 :            :     const Reference<rendering::XBitmapCanvas>& rxCanvas,
    1667                 :            :     const geometry::IntegerSize2D& rSize) const
    1668                 :            : {
    1669                 :            :     // Get the bitmaps for painting the label background.
    1670                 :          0 :     Reference<rendering::XBitmap> xLeftLabelBitmap;
    1671         [ #  # ]:          0 :     if (mpLeftLabelBitmap.get() != NULL)
    1672 [ #  # ][ #  # ]:          0 :         xLeftLabelBitmap = mpLeftLabelBitmap->GetNormalBitmap();
    1673                 :            : 
    1674                 :          0 :     Reference<rendering::XBitmap> xCenterLabelBitmap;
    1675         [ #  # ]:          0 :     if (mpCenterLabelBitmap.get() != NULL)
    1676 [ #  # ][ #  # ]:          0 :         xCenterLabelBitmap = mpCenterLabelBitmap->GetNormalBitmap();
    1677                 :            : 
    1678                 :          0 :     Reference<rendering::XBitmap> xRightLabelBitmap;
    1679         [ #  # ]:          0 :     if (mpRightLabelBitmap.get() != NULL)
    1680 [ #  # ][ #  # ]:          0 :         xRightLabelBitmap = mpRightLabelBitmap->GetNormalBitmap();
    1681                 :            : 
    1682                 :            :     PresenterUIPainter::PaintHorizontalBitmapComposite (
    1683                 :            :         Reference<rendering::XCanvas>(rxCanvas, UNO_QUERY),
    1684                 :            :         awt::Rectangle(0,0, rSize.Width,rSize.Height),
    1685                 :            :         awt::Rectangle(0,0, rSize.Width,rSize.Height),
    1686                 :            :         xLeftLabelBitmap,
    1687                 :            :         xCenterLabelBitmap,
    1688 [ #  # ][ #  # ]:          0 :         xRightLabelBitmap);
    1689                 :          0 : }
    1690                 :            : 
    1691                 :          0 : void PresenterSlideSorter::MouseOverManager::Invalidate (void)
    1692                 :            : {
    1693         [ #  # ]:          0 :     if (mpPaintManager.get() != NULL)
    1694                 :          0 :         mpPaintManager->Invalidate(mxInvalidateTarget, maSlideBoundingBox, true);
    1695                 :          0 : }
    1696                 :            : 
    1697                 :            : //===== PresenterSlideSorter::CurrentSlideFrameRenderer =======================
    1698                 :            : 
    1699                 :          0 : PresenterSlideSorter::CurrentSlideFrameRenderer::CurrentSlideFrameRenderer (
    1700                 :            :     const css::uno::Reference<css::uno::XComponentContext>& rxContext,
    1701                 :            :     const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
    1702                 :            :     : mpTopLeft(),
    1703                 :            :       mpTop(),
    1704                 :            :       mpTopRight(),
    1705                 :            :       mpLeft(),
    1706                 :            :       mpRight(),
    1707                 :            :       mpBottomLeft(),
    1708                 :            :       mpBottom(),
    1709                 :            :       mpBottomRight(),
    1710                 :            :       mnTopFrameSize(0),
    1711                 :            :       mnLeftFrameSize(0),
    1712                 :            :       mnRightFrameSize(0),
    1713 [ #  # ][ #  # ]:          0 :       mnBottomFrameSize(0)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1714                 :            : {
    1715                 :            :     PresenterConfigurationAccess aConfiguration (
    1716                 :            :         rxContext,
    1717                 :            :         OUString("/org.openoffice.Office.extension.PresenterScreen/"),
    1718         [ #  # ]:          0 :         PresenterConfigurationAccess::READ_ONLY);
    1719                 :            :     Reference<container::XHierarchicalNameAccess> xBitmaps (
    1720                 :            :         aConfiguration.GetConfigurationNode(
    1721                 :            :             A2S("PresenterScreenSettings/SlideSorter/CurrentSlideBorderBitmaps")),
    1722 [ #  # ][ #  # ]:          0 :         UNO_QUERY);
    1723         [ #  # ]:          0 :     if ( ! xBitmaps.is())
    1724                 :          0 :         return;
    1725                 :            : 
    1726                 :            :     PresenterBitmapContainer aContainer (
    1727                 :            :         A2S("PresenterScreenSettings/SlideSorter/CurrentSlideBorderBitmaps"),
    1728                 :            :         ::boost::shared_ptr<PresenterBitmapContainer>(),
    1729                 :            :         rxContext,
    1730                 :            :         rxCanvas,
    1731 [ #  # ][ #  # ]:          0 :         PresenterComponent::GetBasePath(rxContext));
         [ #  # ][ #  # ]
                 [ #  # ]
    1732                 :            : 
    1733 [ #  # ][ #  # ]:          0 :     mpTopLeft = aContainer.GetBitmap(A2S("TopLeft"));
                 [ #  # ]
    1734 [ #  # ][ #  # ]:          0 :     mpTop = aContainer.GetBitmap(A2S("Top"));
                 [ #  # ]
    1735 [ #  # ][ #  # ]:          0 :     mpTopRight = aContainer.GetBitmap(A2S("TopRight"));
                 [ #  # ]
    1736 [ #  # ][ #  # ]:          0 :     mpLeft = aContainer.GetBitmap(A2S("Left"));
                 [ #  # ]
    1737 [ #  # ][ #  # ]:          0 :     mpRight = aContainer.GetBitmap(A2S("Right"));
                 [ #  # ]
    1738 [ #  # ][ #  # ]:          0 :     mpBottomLeft = aContainer.GetBitmap(A2S("BottomLeft"));
                 [ #  # ]
    1739 [ #  # ][ #  # ]:          0 :     mpBottom = aContainer.GetBitmap(A2S("Bottom"));
                 [ #  # ]
    1740 [ #  # ][ #  # ]:          0 :     mpBottomRight = aContainer.GetBitmap(A2S("BottomRight"));
                 [ #  # ]
    1741                 :            : 
    1742                 :            :     // Determine size of frame.
    1743         [ #  # ]:          0 :     if (mpTop.get() != NULL)
    1744                 :          0 :         mnTopFrameSize = mpTop->mnHeight;
    1745         [ #  # ]:          0 :     if (mpLeft.get() != NULL)
    1746                 :          0 :         mnLeftFrameSize = mpLeft->mnWidth;
    1747         [ #  # ]:          0 :     if (mpRight.get() != NULL)
    1748                 :          0 :         mnRightFrameSize = mpRight->mnWidth;
    1749         [ #  # ]:          0 :     if (mpBottom.get() != NULL)
    1750                 :          0 :         mnBottomFrameSize = mpBottom->mnHeight;
    1751                 :            : 
    1752         [ #  # ]:          0 :     if (mpTopLeft.get() != NULL)
    1753                 :            :     {
    1754         [ #  # ]:          0 :         mnTopFrameSize = ::std::max(mnTopFrameSize, mpTopLeft->mnHeight);
    1755         [ #  # ]:          0 :         mnLeftFrameSize = ::std::max(mnLeftFrameSize, mpTopLeft->mnWidth);
    1756                 :            :     }
    1757         [ #  # ]:          0 :     if (mpTopRight.get() != NULL)
    1758                 :            :     {
    1759         [ #  # ]:          0 :         mnTopFrameSize = ::std::max(mnTopFrameSize, mpTopRight->mnHeight);
    1760         [ #  # ]:          0 :         mnRightFrameSize = ::std::max(mnRightFrameSize, mpTopRight->mnWidth);
    1761                 :            :     }
    1762         [ #  # ]:          0 :     if (mpBottomLeft.get() != NULL)
    1763                 :            :     {
    1764         [ #  # ]:          0 :         mnLeftFrameSize = ::std::max(mnLeftFrameSize, mpBottomLeft->mnWidth);
    1765         [ #  # ]:          0 :         mnBottomFrameSize = ::std::max(mnBottomFrameSize, mpBottomLeft->mnHeight);
    1766                 :            :     }
    1767         [ #  # ]:          0 :     if (mpBottomRight.get() != NULL)
    1768                 :            :     {
    1769         [ #  # ]:          0 :         mnRightFrameSize = ::std::max(mnRightFrameSize, mpBottomRight->mnWidth);
    1770         [ #  # ]:          0 :         mnBottomFrameSize = ::std::max(mnBottomFrameSize, mpBottomRight->mnHeight);
    1771 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
    1772                 :            : }
    1773                 :            : 
    1774 [ #  # ][ #  # ]:          0 : PresenterSlideSorter::CurrentSlideFrameRenderer::~CurrentSlideFrameRenderer (void)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1775                 :            : {
    1776                 :          0 : }
    1777                 :            : 
    1778                 :          0 : void PresenterSlideSorter::CurrentSlideFrameRenderer::PaintCurrentSlideFrame (
    1779                 :            :     const awt::Rectangle& rSlideBoundingBox,
    1780                 :            :     const Reference<rendering::XCanvas>& rxCanvas,
    1781                 :            :     const geometry::RealRectangle2D& rClipBox)
    1782                 :            : {
    1783         [ #  # ]:          0 :     if ( ! rxCanvas.is())
    1784                 :          0 :         return;
    1785                 :            : 
    1786                 :            :     const Reference<rendering::XPolyPolygon2D> xClip (
    1787 [ #  # ][ #  # ]:          0 :         PresenterGeometryHelper::CreatePolygon(rClipBox, rxCanvas->getDevice()));
                 [ #  # ]
    1788                 :            : 
    1789         [ #  # ]:          0 :     if (mpTop.get() != NULL)
    1790                 :            :     {
    1791                 :            :         PaintBitmapTiled(
    1792                 :            :             mpTop->GetNormalBitmap(),
    1793                 :            :             rxCanvas,
    1794                 :            :             rClipBox,
    1795                 :            :             rSlideBoundingBox.X,
    1796                 :          0 :             rSlideBoundingBox.Y - mpTop->mnHeight,
    1797                 :            :             rSlideBoundingBox.Width,
    1798 [ #  # ][ #  # ]:          0 :             mpTop->mnHeight);
    1799                 :            :     }
    1800         [ #  # ]:          0 :     if (mpLeft.get() != NULL)
    1801                 :            :     {
    1802                 :            :         PaintBitmapTiled(
    1803                 :            :             mpLeft->GetNormalBitmap(),
    1804                 :            :             rxCanvas,
    1805                 :            :             rClipBox,
    1806                 :          0 :             rSlideBoundingBox.X - mpLeft->mnWidth,
    1807                 :            :             rSlideBoundingBox.Y,
    1808                 :          0 :             mpLeft->mnWidth,
    1809 [ #  # ][ #  # ]:          0 :             rSlideBoundingBox.Height);
    1810                 :            :     }
    1811         [ #  # ]:          0 :     if (mpRight.get() != NULL)
    1812                 :            :     {
    1813                 :            :         PaintBitmapTiled(
    1814                 :            :             mpRight->GetNormalBitmap(),
    1815                 :            :             rxCanvas,
    1816                 :            :             rClipBox,
    1817                 :            :             rSlideBoundingBox.X + rSlideBoundingBox.Width,
    1818                 :            :             rSlideBoundingBox.Y,
    1819                 :          0 :             mpRight->mnWidth,
    1820 [ #  # ][ #  # ]:          0 :             rSlideBoundingBox.Height);
    1821                 :            :     }
    1822         [ #  # ]:          0 :     if (mpBottom.get() != NULL)
    1823                 :            :     {
    1824                 :            :         PaintBitmapTiled(
    1825                 :            :             mpBottom->GetNormalBitmap(),
    1826                 :            :             rxCanvas,
    1827                 :            :             rClipBox,
    1828                 :            :             rSlideBoundingBox.X,
    1829                 :            :             rSlideBoundingBox.Y + rSlideBoundingBox.Height,
    1830                 :            :             rSlideBoundingBox.Width,
    1831 [ #  # ][ #  # ]:          0 :             mpBottom->mnHeight);
    1832                 :            :     }
    1833         [ #  # ]:          0 :     if (mpTopLeft.get() != NULL)
    1834                 :            :     {
    1835                 :            :         PaintBitmapOnce(
    1836                 :            :             mpTopLeft->GetNormalBitmap(),
    1837                 :            :             rxCanvas,
    1838                 :            :             xClip,
    1839                 :          0 :             rSlideBoundingBox.X - mpTopLeft->mnWidth,
    1840 [ #  # ][ #  # ]:          0 :             rSlideBoundingBox.Y - mpTopLeft->mnHeight);
    1841                 :            :     }
    1842         [ #  # ]:          0 :     if (mpTopRight.get() != NULL)
    1843                 :            :     {
    1844                 :            :         PaintBitmapOnce(
    1845                 :            :             mpTopRight->GetNormalBitmap(),
    1846                 :            :             rxCanvas,
    1847                 :            :             xClip,
    1848                 :            :             rSlideBoundingBox.X + rSlideBoundingBox.Width,
    1849 [ #  # ][ #  # ]:          0 :             rSlideBoundingBox.Y - mpTopLeft->mnHeight);
    1850                 :            :     }
    1851         [ #  # ]:          0 :     if (mpBottomLeft.get() != NULL)
    1852                 :            :     {
    1853                 :            :         PaintBitmapOnce(
    1854                 :            :             mpBottomLeft->GetNormalBitmap(),
    1855                 :            :             rxCanvas,
    1856                 :            :             xClip,
    1857                 :          0 :             rSlideBoundingBox.X - mpBottomLeft->mnWidth,
    1858 [ #  # ][ #  # ]:          0 :             rSlideBoundingBox.Y + rSlideBoundingBox.Height);
    1859                 :            :     }
    1860         [ #  # ]:          0 :     if (mpBottomRight.get() != NULL)
    1861                 :            :     {
    1862                 :            :         PaintBitmapOnce(
    1863                 :            :             mpBottomRight->GetNormalBitmap(),
    1864                 :            :             rxCanvas,
    1865                 :            :             xClip,
    1866                 :            :             rSlideBoundingBox.X + rSlideBoundingBox.Width,
    1867 [ #  # ][ #  # ]:          0 :             rSlideBoundingBox.Y + rSlideBoundingBox.Height);
    1868                 :          0 :     }
    1869                 :            : }
    1870                 :            : 
    1871                 :          0 : awt::Rectangle PresenterSlideSorter::CurrentSlideFrameRenderer::GetBoundingBox (
    1872                 :            :     const awt::Rectangle& rSlideBoundingBox)
    1873                 :            : {
    1874                 :            :     return awt::Rectangle(
    1875                 :            :         rSlideBoundingBox.X - mnLeftFrameSize,
    1876                 :            :         rSlideBoundingBox.Y - mnTopFrameSize,
    1877                 :            :         rSlideBoundingBox.Width + mnLeftFrameSize + mnRightFrameSize,
    1878                 :          0 :         rSlideBoundingBox.Height + mnTopFrameSize + mnBottomFrameSize);
    1879                 :            : }
    1880                 :            : 
    1881                 :          0 : void PresenterSlideSorter::CurrentSlideFrameRenderer::PaintBitmapOnce(
    1882                 :            :     const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
    1883                 :            :     const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
    1884                 :            :     const Reference<rendering::XPolyPolygon2D>& rxClip,
    1885                 :            :     const double nX,
    1886                 :            :     const double nY)
    1887                 :            : {
    1888                 :            :     OSL_ASSERT(rxCanvas.is());
    1889         [ #  # ]:          0 :     if ( ! rxBitmap.is())
    1890                 :          0 :         return;
    1891                 :            : 
    1892                 :            :     const rendering::ViewState aViewState(
    1893                 :            :         geometry::AffineMatrix2D(1,0,0, 0,1,0),
    1894         [ #  # ]:          0 :         rxClip);
    1895                 :            : 
    1896                 :            :     const rendering::RenderState aRenderState (
    1897                 :            :         geometry::AffineMatrix2D(
    1898                 :            :             1, 0, nX,
    1899                 :            :             0, 1, nY),
    1900                 :            :         NULL,
    1901                 :            :         Sequence<double>(4),
    1902 [ #  # ][ #  # ]:          0 :         rendering::CompositeOperation::SOURCE);
         [ #  # ][ #  # ]
    1903                 :            : 
    1904         [ #  # ]:          0 :     rxCanvas->drawBitmap(
    1905                 :            :         rxBitmap,
    1906                 :            :         aViewState,
    1907 [ #  # ][ #  # ]:          0 :         aRenderState);
                 [ #  # ]
    1908                 :            : }
    1909                 :            : 
    1910                 :          0 : void PresenterSlideSorter::CurrentSlideFrameRenderer::PaintBitmapTiled(
    1911                 :            :     const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
    1912                 :            :     const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
    1913                 :            :     const geometry::RealRectangle2D& rClipBox,
    1914                 :            :     const double nX0,
    1915                 :            :     const double nY0,
    1916                 :            :     const double nWidth,
    1917                 :            :     const double nHeight)
    1918                 :            : {
    1919                 :            :     OSL_ASSERT(rxCanvas.is());
    1920         [ #  # ]:          0 :     if ( ! rxBitmap.is())
    1921                 :          0 :         return;
    1922                 :            : 
    1923 [ #  # ][ #  # ]:          0 :     geometry::IntegerSize2D aSize (rxBitmap->getSize());
    1924                 :            : 
    1925                 :            :     const rendering::ViewState aViewState(
    1926                 :            :         geometry::AffineMatrix2D(1,0,0, 0,1,0),
    1927                 :            :         PresenterGeometryHelper::CreatePolygon(
    1928                 :            :             PresenterGeometryHelper::Intersection(
    1929                 :            :                 rClipBox,
    1930                 :          0 :                 geometry::RealRectangle2D(nX0,nY0,nX0+nWidth,nY0+nHeight)),
    1931         [ #  # ]:          0 :             rxCanvas->getDevice()));
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1932                 :            : 
    1933                 :            :     rendering::RenderState aRenderState (
    1934                 :            :         geometry::AffineMatrix2D(
    1935                 :            :             1, 0, nX0,
    1936                 :            :             0, 1, nY0),
    1937                 :            :         NULL,
    1938                 :            :         Sequence<double>(4),
    1939 [ #  # ][ #  # ]:          0 :         rendering::CompositeOperation::SOURCE);
         [ #  # ][ #  # ]
    1940                 :            : 
    1941                 :          0 :     const double nX1 = nX0 + nWidth;
    1942                 :          0 :     const double nY1 = nY0 + nHeight;
    1943         [ #  # ]:          0 :     for (double nY=nY0; nY<nY1; nY+=aSize.Height)
    1944         [ #  # ]:          0 :         for (double nX=nX0; nX<nX1; nX+=aSize.Width)
    1945                 :            :         {
    1946                 :          0 :             aRenderState.AffineTransform.m02 = nX;
    1947                 :          0 :             aRenderState.AffineTransform.m12 = nY;
    1948         [ #  # ]:          0 :             rxCanvas->drawBitmap(
    1949                 :            :                 rxBitmap,
    1950                 :            :                 aViewState,
    1951         [ #  # ]:          0 :                 aRenderState);
    1952 [ #  # ][ #  # ]:          0 :         }
    1953                 :            : }
    1954                 :            : 
    1955 [ +  - ][ +  - ]:         24 : } } // end of namespace ::sdext::presenter
    1956                 :            : 
    1957                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10