LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/unoidl - SdUnoSlideView.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 65 0.0 %
Date: 2012-12-27 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <comphelper/serviceinfohelper.hxx>
      22             : 
      23             : #include "DrawController.hxx"
      24             : #include "SdUnoSlideView.hxx"
      25             : 
      26             : #include "SlideSorter.hxx"
      27             : #include "controller/SlideSorterController.hxx"
      28             : #include "controller/SlsPageSelector.hxx"
      29             : #include "controller/SlsCurrentSlideManager.hxx"
      30             : #include "model/SlsPageEnumerationProvider.hxx"
      31             : #include "model/SlideSorterModel.hxx"
      32             : #include "model/SlsPageDescriptor.hxx"
      33             : #include "sdpage.hxx"
      34             : #include <com/sun/star/beans/XPropertySet.hpp>
      35             : 
      36             : using ::rtl::OUString;
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : 
      41             : namespace sd {
      42             : 
      43             : 
      44           0 : SdUnoSlideView::SdUnoSlideView (
      45             :     slidesorter::SlideSorter& rSlideSorter) throw()
      46             :     : DrawSubControllerInterfaceBase(m_aMutex),
      47           0 :       mrSlideSorter(rSlideSorter)
      48             : {
      49           0 : }
      50             : 
      51             : 
      52             : 
      53             : 
      54           0 : SdUnoSlideView::~SdUnoSlideView (void) throw()
      55             : {
      56           0 : }
      57             : 
      58             : 
      59             : 
      60             : 
      61             : //----- XSelectionSupplier ----------------------------------------------------
      62             : 
      63           0 : sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection)
      64             :       throw(lang::IllegalArgumentException, RuntimeException)
      65             : {
      66           0 :     bool bOk = true;
      67             : 
      68             :     slidesorter::controller::SlideSorterController& rSlideSorterController
      69           0 :         = mrSlideSorter.GetController();
      70           0 :     slidesorter::controller::PageSelector& rSelector (rSlideSorterController.GetPageSelector());
      71           0 :     rSelector.DeselectAllPages();
      72           0 :     Sequence<Reference<drawing::XDrawPage> > xPages;
      73           0 :     aSelection >>= xPages;
      74           0 :     const sal_uInt32 nCount = xPages.getLength();
      75           0 :     for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
      76             :     {
      77           0 :         Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY);
      78           0 :         if (xSet.is())
      79             :         {
      80             :             try
      81             :             {
      82           0 :                 Any aNumber = xSet->getPropertyValue("Number");
      83           0 :                 sal_Int32 nPageNumber = 0;
      84           0 :                 aNumber >>= nPageNumber;
      85           0 :                 nPageNumber -=1; // Transform 1-based page numbers to 0-based ones.
      86           0 :                 rSelector.SelectPage(nPageNumber);
      87             :             }
      88           0 :             catch (const RuntimeException&)
      89             :             {
      90             :             }
      91             :         }
      92           0 :     }
      93             : 
      94           0 :     return bOk;
      95             : }
      96             : 
      97             : 
      98             : 
      99             : 
     100           0 : Any SAL_CALL SdUnoSlideView::getSelection (void)
     101             :       throw(RuntimeException)
     102             : {
     103           0 :     Any aResult;
     104             : 
     105             :     slidesorter::model::PageEnumeration aSelectedPages (
     106             :         slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
     107           0 :             mrSlideSorter.GetModel()));
     108             :     int nSelectedPageCount (
     109           0 :         mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount());
     110             : 
     111           0 :     Sequence<Reference<XInterface> > aPages(nSelectedPageCount);
     112           0 :     int nIndex = 0;
     113           0 :     while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount)
     114             :     {
     115           0 :         slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
     116           0 :         aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage();
     117           0 :     }
     118           0 :     aResult <<= aPages;
     119             : 
     120           0 :     return aResult;
     121             : }
     122             : 
     123             : 
     124             : 
     125             : 
     126           0 : void SAL_CALL SdUnoSlideView::addSelectionChangeListener (
     127             :     const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
     128             :     throw(css::uno::RuntimeException)
     129             : {
     130             :     (void)rxListener;
     131           0 : }
     132             : 
     133             : 
     134             : 
     135             : 
     136           0 : void SAL_CALL SdUnoSlideView::removeSelectionChangeListener (
     137             :     const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
     138             :     throw(css::uno::RuntimeException)
     139             : {
     140             :     (void)rxListener;
     141           0 : }
     142             : 
     143             : 
     144             : 
     145             : 
     146             : //----- XDrawView -------------------------------------------------------------
     147             : 
     148           0 : void SAL_CALL SdUnoSlideView::setCurrentPage (
     149             :     const css::uno::Reference<css::drawing::XDrawPage>& rxDrawPage)
     150             :     throw(css::uno::RuntimeException)
     151             : {
     152           0 :     Reference<beans::XPropertySet> xProperties (rxDrawPage, UNO_QUERY);
     153           0 :     if (xProperties.is())
     154             :     {
     155           0 :         sal_uInt16 nPageNumber(0);
     156           0 :         if (xProperties->getPropertyValue("Number") >>= nPageNumber)
     157             :         {
     158           0 :             mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(
     159             :                 nPageNumber-1,
     160           0 :                 true);
     161             :         }
     162           0 :     }
     163           0 : }
     164             : 
     165             : 
     166             : 
     167             : 
     168             : css::uno::Reference<css::drawing::XDrawPage > SAL_CALL
     169           0 :     SdUnoSlideView::getCurrentPage (void)
     170             :     throw(css::uno::RuntimeException)
     171             : {
     172           0 :     return mrSlideSorter.GetController().GetCurrentSlideManager()->GetCurrentSlide()->GetXDrawPage();
     173             : }
     174             : 
     175             : 
     176             : 
     177             : 
     178             : //----- XFastPropertySet ------------------------------------------------------
     179             : 
     180           0 : void SdUnoSlideView::setFastPropertyValue (
     181             :     sal_Int32 nHandle,
     182             :         const Any& rValue)
     183             :     throw(css::beans::UnknownPropertyException,
     184             :         css::beans::PropertyVetoException,
     185             :         css::lang::IllegalArgumentException,
     186             :         css::lang::WrappedTargetException,
     187             :         css::uno::RuntimeException)
     188             : {
     189             :     (void)nHandle;
     190             :     (void)rValue;
     191             : 
     192           0 :     throw beans::UnknownPropertyException();
     193             : }
     194             : 
     195             : 
     196             : 
     197             : 
     198           0 : Any SAL_CALL SdUnoSlideView::getFastPropertyValue (
     199             :     sal_Int32 nHandle)
     200             :     throw(css::beans::UnknownPropertyException,
     201             :         css::lang::WrappedTargetException,
     202             :         css::uno::RuntimeException)
     203             : {
     204             :     (void)nHandle;
     205             : 
     206           0 :     if( nHandle != DrawController::PROPERTY_VIEWOFFSET )
     207           0 :         throw beans::UnknownPropertyException();
     208             : 
     209           0 :     return Any();
     210             : }
     211             : 
     212             : 
     213             : // XServiceInfo
     214           0 : OUString SAL_CALL SdUnoSlideView::getImplementationName(  ) throw (RuntimeException)
     215             : {
     216           0 :     return OUString( "com.sun.star.comp.sd.SdUnoSlideView" );
     217             : }
     218             : 
     219           0 : sal_Bool SAL_CALL SdUnoSlideView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
     220             : {
     221           0 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
     222             : }
     223             : 
     224           0 : Sequence< OUString > SAL_CALL SdUnoSlideView::getSupportedServiceNames(  ) throw (RuntimeException)
     225             : {
     226           0 :     OUString aSN( "com.sun.star.presentation.SlidesView" );
     227           0 :     uno::Sequence< OUString > aSeq( &aSN, 1 );
     228           0 :     return aSeq;
     229             : }
     230             : 
     231             : } // end of namespace sd
     232             : 
     233             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10