LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - SdUnoSlideView.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 65 0.0 %
Date: 2012-08-25 Functions: 0 14 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 106 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <comphelper/serviceinfohelper.hxx>
      31                 :            : 
      32                 :            : #include "DrawController.hxx"
      33                 :            : #include "SdUnoSlideView.hxx"
      34                 :            : 
      35                 :            : #include "SlideSorter.hxx"
      36                 :            : #include "controller/SlideSorterController.hxx"
      37                 :            : #include "controller/SlsPageSelector.hxx"
      38                 :            : #include "controller/SlsCurrentSlideManager.hxx"
      39                 :            : #include "model/SlsPageEnumerationProvider.hxx"
      40                 :            : #include "model/SlideSorterModel.hxx"
      41                 :            : #include "model/SlsPageDescriptor.hxx"
      42                 :            : #include "sdpage.hxx"
      43                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      44                 :            : 
      45                 :            : using ::rtl::OUString;
      46                 :            : 
      47                 :            : using namespace ::com::sun::star;
      48                 :            : using namespace ::com::sun::star::uno;
      49                 :            : 
      50                 :            : namespace sd {
      51                 :            : 
      52                 :            : 
      53                 :          0 : SdUnoSlideView::SdUnoSlideView (
      54                 :            :     DrawController& rController,
      55                 :            :     slidesorter::SlideSorter& rSlideSorter,
      56                 :            :     View& rView) throw()
      57                 :            :     : DrawSubControllerInterfaceBase(m_aMutex),
      58                 :            :       mrController(rController),
      59                 :            :       mrSlideSorter(rSlideSorter),
      60         [ #  # ]:          0 :       mrView(rView)
      61                 :            : {
      62                 :          0 : }
      63                 :            : 
      64                 :            : 
      65                 :            : 
      66                 :            : 
      67         [ #  # ]:          0 : SdUnoSlideView::~SdUnoSlideView (void) throw()
      68                 :            : {
      69         [ #  # ]:          0 : }
      70                 :            : 
      71                 :            : 
      72                 :            : 
      73                 :            : 
      74                 :            : //----- XSelectionSupplier ----------------------------------------------------
      75                 :            : 
      76                 :          0 : sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection)
      77                 :            :       throw(lang::IllegalArgumentException, RuntimeException)
      78                 :            : {
      79                 :          0 :     bool bOk = true;
      80                 :            : 
      81                 :            :     slidesorter::controller::SlideSorterController& rSlideSorterController
      82         [ #  # ]:          0 :         = mrSlideSorter.GetController();
      83         [ #  # ]:          0 :     slidesorter::controller::PageSelector& rSelector (rSlideSorterController.GetPageSelector());
      84         [ #  # ]:          0 :     rSelector.DeselectAllPages();
      85         [ #  # ]:          0 :     Sequence<Reference<drawing::XDrawPage> > xPages;
      86         [ #  # ]:          0 :     aSelection >>= xPages;
      87                 :          0 :     const sal_uInt32 nCount = xPages.getLength();
      88         [ #  # ]:          0 :     for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
      89                 :            :     {
      90 [ #  # ][ #  # ]:          0 :         Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY);
      91         [ #  # ]:          0 :         if (xSet.is())
      92                 :            :         {
      93                 :            :             try
      94                 :            :             {
      95 [ #  # ][ #  # ]:          0 :                 Any aNumber = xSet->getPropertyValue("Number");
      96                 :          0 :                 sal_Int32 nPageNumber = 0;
      97                 :          0 :                 aNumber >>= nPageNumber;
      98                 :          0 :                 nPageNumber -=1; // Transform 1-based page numbers to 0-based ones.
      99 [ #  # ][ #  # ]:          0 :                 rSelector.SelectPage(nPageNumber);
     100                 :            :             }
     101         [ #  # ]:          0 :             catch (const RuntimeException&)
     102                 :            :             {
     103                 :            :             }
     104                 :            :         }
     105                 :          0 :     }
     106                 :            : 
     107         [ #  # ]:          0 :     return bOk;
     108                 :            : }
     109                 :            : 
     110                 :            : 
     111                 :            : 
     112                 :            : 
     113                 :          0 : Any SAL_CALL SdUnoSlideView::getSelection (void)
     114                 :            :       throw(RuntimeException)
     115                 :            : {
     116                 :          0 :     Any aResult;
     117                 :            : 
     118                 :            :     slidesorter::model::PageEnumeration aSelectedPages (
     119                 :            :         slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     120 [ #  # ][ #  # ]:          0 :             mrSlideSorter.GetModel()));
     121                 :            :     int nSelectedPageCount (
     122 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount());
                 [ #  # ]
     123                 :            : 
     124         [ #  # ]:          0 :     Sequence<Reference<XInterface> > aPages(nSelectedPageCount);
     125                 :          0 :     int nIndex = 0;
     126 [ #  # ][ #  # ]:          0 :     while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount)
         [ #  # ][ #  # ]
     127                 :            :     {
     128         [ #  # ]:          0 :         slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
     129 [ #  # ][ #  # ]:          0 :         aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage();
         [ #  # ][ #  # ]
     130         [ #  # ]:          0 :     }
     131         [ #  # ]:          0 :     aResult <<= aPages;
     132                 :            : 
     133 [ #  # ][ #  # ]:          0 :     return aResult;
     134                 :            : }
     135                 :            : 
     136                 :            : 
     137                 :            : 
     138                 :            : 
     139                 :          0 : void SAL_CALL SdUnoSlideView::addSelectionChangeListener (
     140                 :            :     const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
     141                 :            :     throw(css::uno::RuntimeException)
     142                 :            : {
     143                 :            :     (void)rxListener;
     144                 :          0 : }
     145                 :            : 
     146                 :            : 
     147                 :            : 
     148                 :            : 
     149                 :          0 : void SAL_CALL SdUnoSlideView::removeSelectionChangeListener (
     150                 :            :     const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
     151                 :            :     throw(css::uno::RuntimeException)
     152                 :            : {
     153                 :            :     (void)rxListener;
     154                 :          0 : }
     155                 :            : 
     156                 :            : 
     157                 :            : 
     158                 :            : 
     159                 :            : //----- XDrawView -------------------------------------------------------------
     160                 :            : 
     161                 :          0 : void SAL_CALL SdUnoSlideView::setCurrentPage (
     162                 :            :     const css::uno::Reference<css::drawing::XDrawPage>& rxDrawPage)
     163                 :            :     throw(css::uno::RuntimeException)
     164                 :            : {
     165         [ #  # ]:          0 :     Reference<beans::XPropertySet> xProperties (rxDrawPage, UNO_QUERY);
     166         [ #  # ]:          0 :     if (xProperties.is())
     167                 :            :     {
     168                 :          0 :         sal_uInt16 nPageNumber(0);
     169 [ #  # ][ #  # ]:          0 :         if (xProperties->getPropertyValue("Number") >>= nPageNumber)
                 [ #  # ]
     170                 :            :         {
     171         [ #  # ]:          0 :             mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(
     172                 :            :                 nPageNumber-1,
     173 [ #  # ][ #  # ]:          0 :                 true);
                 [ #  # ]
     174                 :            :         }
     175                 :          0 :     }
     176                 :          0 : }
     177                 :            : 
     178                 :            : 
     179                 :            : 
     180                 :            : 
     181                 :            : css::uno::Reference<css::drawing::XDrawPage > SAL_CALL
     182                 :          0 :     SdUnoSlideView::getCurrentPage (void)
     183                 :            :     throw(css::uno::RuntimeException)
     184                 :            : {
     185 [ #  # ][ #  # ]:          0 :     return mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide()->GetXDrawPage();
                 [ #  # ]
     186                 :            : }
     187                 :            : 
     188                 :            : 
     189                 :            : 
     190                 :            : 
     191                 :            : //----- XFastPropertySet ------------------------------------------------------
     192                 :            : 
     193                 :          0 : void SdUnoSlideView::setFastPropertyValue (
     194                 :            :     sal_Int32 nHandle,
     195                 :            :         const Any& rValue)
     196                 :            :     throw(css::beans::UnknownPropertyException,
     197                 :            :         css::beans::PropertyVetoException,
     198                 :            :         css::lang::IllegalArgumentException,
     199                 :            :         css::lang::WrappedTargetException,
     200                 :            :         css::uno::RuntimeException)
     201                 :            : {
     202                 :            :     (void)nHandle;
     203                 :            :     (void)rValue;
     204                 :            : 
     205         [ #  # ]:          0 :     throw beans::UnknownPropertyException();
     206                 :            : }
     207                 :            : 
     208                 :            : 
     209                 :            : 
     210                 :            : 
     211                 :          0 : Any SAL_CALL SdUnoSlideView::getFastPropertyValue (
     212                 :            :     sal_Int32 nHandle)
     213                 :            :     throw(css::beans::UnknownPropertyException,
     214                 :            :         css::lang::WrappedTargetException,
     215                 :            :         css::uno::RuntimeException)
     216                 :            : {
     217                 :            :     (void)nHandle;
     218                 :            : 
     219         [ #  # ]:          0 :     if( nHandle != DrawController::PROPERTY_VIEWOFFSET )
     220         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
     221                 :            : 
     222                 :          0 :     return Any();
     223                 :            : }
     224                 :            : 
     225                 :            : 
     226                 :            : // XServiceInfo
     227                 :          0 : OUString SAL_CALL SdUnoSlideView::getImplementationName(  ) throw (RuntimeException)
     228                 :            : {
     229                 :          0 :     return OUString( "com.sun.star.comp.sd.SdUnoSlideView" );
     230                 :            : }
     231                 :            : 
     232                 :          0 : sal_Bool SAL_CALL SdUnoSlideView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
     233                 :            : {
     234                 :          0 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
     235                 :            : }
     236                 :            : 
     237                 :          0 : Sequence< OUString > SAL_CALL SdUnoSlideView::getSupportedServiceNames(  ) throw (RuntimeException)
     238                 :            : {
     239                 :          0 :     OUString aSN( "com.sun.star.presentation.SlidesView" );
     240         [ #  # ]:          0 :     uno::Sequence< OUString > aSeq( &aSN, 1 );
     241                 :          0 :     return aSeq;
     242                 :            : }
     243                 :            : 
     244                 :            : } // end of namespace sd
     245                 :            : 
     246                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10