2002-01-30 04:40:42 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* $RCSfile: SdUnoSlideView.cxx,v $
|
|
|
|
* $Revision: 1.17 $
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:44:39 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2006-09-16 13:23:58 -05:00
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
#include "SdUnoSlideView.hxx"
|
|
|
|
|
2008-04-03 08:55:47 -05:00
|
|
|
#include "SlideSorter.hxx"
|
2006-03-21 10:35:10 -06:00
|
|
|
#include "controller/SlideSorterController.hxx"
|
|
|
|
#include "controller/SlsPageSelector.hxx"
|
2008-04-03 08:55:47 -05:00
|
|
|
#include "controller/SlsSelectionManager.hxx"
|
|
|
|
#include "model/SlsPageEnumerationProvider.hxx"
|
2006-03-21 10:35:10 -06:00
|
|
|
#include "model/SlideSorterModel.hxx"
|
|
|
|
#include "model/SlsPageDescriptor.hxx"
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2002-03-21 06:23:11 -06:00
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
2004-01-20 05:32:58 -06:00
|
|
|
namespace sd {
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
|
2004-01-20 05:32:58 -06:00
|
|
|
SdUnoSlideView::SdUnoSlideView (
|
2006-03-21 10:35:10 -06:00
|
|
|
DrawController& rController,
|
2008-04-03 08:55:47 -05:00
|
|
|
slidesorter::SlideSorter& rSlideSorter,
|
2004-06-03 05:57:02 -05:00
|
|
|
View& rView) throw()
|
2008-04-03 08:55:47 -05:00
|
|
|
: DrawSubControllerInterfaceBase(m_aMutex),
|
2006-03-21 10:35:10 -06:00
|
|
|
mrController(rController),
|
2008-04-03 08:55:47 -05:00
|
|
|
mrSlideSorter(rSlideSorter),
|
2006-03-21 10:35:10 -06:00
|
|
|
mrView(rView)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SdUnoSlideView::~SdUnoSlideView (void) throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-03 08:55:47 -05:00
|
|
|
//----- XSelectionSupplier ----------------------------------------------------
|
2006-03-21 10:35:10 -06:00
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection)
|
|
|
|
throw(lang::IllegalArgumentException, RuntimeException)
|
|
|
|
{
|
|
|
|
bool bOk = true;
|
|
|
|
|
|
|
|
slidesorter::controller::SlideSorterController& rSlideSorterController
|
2008-04-03 08:55:47 -05:00
|
|
|
= mrSlideSorter.GetController();
|
2006-03-21 10:35:10 -06:00
|
|
|
slidesorter::controller::PageSelector& rSelector (rSlideSorterController.GetPageSelector());
|
|
|
|
rSelector.DeselectAllPages();
|
|
|
|
Sequence<Reference<drawing::XDrawPage> > xPages;
|
|
|
|
aSelection >>= xPages;
|
|
|
|
const sal_uInt32 nCount = xPages.getLength();
|
|
|
|
for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
|
|
|
|
{
|
|
|
|
Reference<beans::XPropertySet> xSet (xPages[nIndex], UNO_QUERY);
|
|
|
|
if (xSet.is())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Any aNumber = xSet->getPropertyValue(
|
|
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Number")));
|
2007-01-09 04:33:03 -06:00
|
|
|
sal_Int32 nPageNumber = 0;
|
2006-03-21 10:35:10 -06:00
|
|
|
aNumber >>= nPageNumber;
|
|
|
|
nPageNumber -=1; // Transform 1-based page numbers to 0-based ones.
|
|
|
|
rSelector.SelectPage(nPageNumber);
|
|
|
|
}
|
|
|
|
catch(RuntimeException e)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-04-03 08:55:47 -05:00
|
|
|
rSlideSorterController.GetSelectionManager()->MakeSelectionVisible();
|
2006-03-21 10:35:10 -06:00
|
|
|
|
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Any SAL_CALL SdUnoSlideView::getSelection (void)
|
|
|
|
throw(RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2006-03-21 10:35:10 -06:00
|
|
|
Any aResult;
|
|
|
|
|
2008-04-03 08:55:47 -05:00
|
|
|
slidesorter::model::PageEnumeration aSelectedPages (
|
|
|
|
slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
|
|
|
|
mrSlideSorter.GetModel()));
|
|
|
|
int nSelectedPageCount (
|
|
|
|
mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount());
|
2006-03-21 10:35:10 -06:00
|
|
|
|
|
|
|
Sequence<Reference<XInterface> > aPages(nSelectedPageCount);
|
|
|
|
int nIndex = 0;
|
|
|
|
while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount)
|
|
|
|
{
|
2006-04-10 08:58:34 -05:00
|
|
|
slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
|
|
|
|
aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage();
|
2006-03-21 10:35:10 -06:00
|
|
|
}
|
|
|
|
aResult <<= aPages;
|
|
|
|
|
|
|
|
return aResult;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
2006-03-21 10:35:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-03 08:55:47 -05:00
|
|
|
void SAL_CALL SdUnoSlideView::addSelectionChangeListener (
|
|
|
|
const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
|
|
|
|
throw(css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
(void)rxListener;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL SdUnoSlideView::removeSelectionChangeListener (
|
|
|
|
const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
|
|
|
|
throw(css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
(void)rxListener;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----- XDrawView -------------------------------------------------------------
|
2006-03-21 10:35:10 -06:00
|
|
|
|
|
|
|
void SAL_CALL SdUnoSlideView::setCurrentPage (
|
2006-12-12 11:55:35 -06:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& )
|
2006-03-21 10:35:10 -06:00
|
|
|
throw(::com::sun::star::uno::RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-21 10:35:10 -06:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL
|
|
|
|
SdUnoSlideView::getCurrentPage (void)
|
|
|
|
throw(::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return Reference<drawing::XDrawPage>();
|
|
|
|
}
|
2003-03-27 03:58:12 -06:00
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
|
2008-04-03 08:55:47 -05:00
|
|
|
|
|
|
|
//----- XFastPropertySet ------------------------------------------------------
|
|
|
|
|
|
|
|
void SdUnoSlideView::setFastPropertyValue (
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const Any& rValue)
|
|
|
|
throw(css::beans::UnknownPropertyException,
|
|
|
|
css::beans::PropertyVetoException,
|
|
|
|
css::lang::IllegalArgumentException,
|
|
|
|
css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
(void)nHandle;
|
|
|
|
(void)rValue;
|
|
|
|
|
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Any SAL_CALL SdUnoSlideView::getFastPropertyValue (
|
|
|
|
sal_Int32 nHandle)
|
|
|
|
throw(css::beans::UnknownPropertyException,
|
|
|
|
css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
(void)nHandle;
|
|
|
|
|
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-03-21 10:35:10 -06:00
|
|
|
void SdUnoSlideView::FillPropertyTable (
|
2006-12-12 11:55:35 -06:00
|
|
|
::std::vector< ::com::sun::star::beans::Property>& )
|
2006-03-21 10:35:10 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdUnoSlideView::convertFastPropertyValue(
|
2006-12-12 11:55:35 -06:00
|
|
|
::com::sun::star::uno::Any & ,
|
|
|
|
::com::sun::star::uno::Any & ,
|
|
|
|
sal_Int32 ,
|
|
|
|
const ::com::sun::star::uno::Any& )
|
2006-03-21 10:35:10 -06:00
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException)
|
|
|
|
{
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL SdUnoSlideView::setFastPropertyValue_NoBroadcast(
|
2006-12-12 11:55:35 -06:00
|
|
|
sal_Int32 ,
|
|
|
|
const ::com::sun::star::uno::Any& )
|
2006-03-21 10:35:10 -06:00
|
|
|
throw (::com::sun::star::uno::Exception)
|
|
|
|
{
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-12 11:55:35 -06:00
|
|
|
void SAL_CALL SdUnoSlideView::getFastPropertyValue( ::com::sun::star::uno::Any&, sal_Int32 ) const
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-04-03 08:55:47 -05:00
|
|
|
*/
|
2002-03-21 06:23:11 -06:00
|
|
|
|
2004-01-20 05:32:58 -06:00
|
|
|
} // end of namespace sd
|