2002-01-30 04:40:42 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* $RCSfile: SdUnoDrawView.cxx,v $
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-12-14 10:23:21 -06:00
|
|
|
* $Revision: 1.27 $
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-12-14 10:23:21 -06:00
|
|
|
* last change: $Author: rt $ $Date: 2005-12-14 17:23:21 $
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* This library 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 for more details.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2005-09-09 00:46:06 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
#include "SdUnoDrawView.hxx"
|
|
|
|
|
2004-07-13 08:48:44 -05:00
|
|
|
#include <vector>
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#endif
|
2003-03-27 03:58:12 -06:00
|
|
|
#ifndef _COM_SUN_STAR_VIEW_DOCUMENTZOOMTYPE_HPP_
|
|
|
|
#include <com/sun/star/view/DocumentZoomType.hpp>
|
|
|
|
#endif
|
2002-01-24 08:06:27 -06:00
|
|
|
#ifndef _SVX_UNOSHAPE_HXX
|
|
|
|
#include <svx/unoshape.hxx>
|
|
|
|
#endif
|
|
|
|
#include <svx/svdobj.hxx>
|
|
|
|
#include <svx/svdpagv.hxx>
|
|
|
|
#include <svx/unoshcol.hxx>
|
2003-03-27 03:58:12 -06:00
|
|
|
#ifndef _SVX_ZOOMITEM_HXX
|
|
|
|
#include <svx/zoomitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFX_BINDINGS_HXX
|
|
|
|
#include <sfx2/bindings.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SFXDISPATCH_HXX
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#endif
|
2002-03-21 06:23:11 -06:00
|
|
|
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#endif
|
2004-10-04 12:39:17 -05:00
|
|
|
|
2005-07-14 04:45:27 -05:00
|
|
|
#include "comphelper/anytostring.hxx"
|
|
|
|
#include "cppuhelper/exc_hlp.hxx"
|
|
|
|
|
2004-10-04 12:39:17 -05:00
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
#ifndef SD_WINDOW_HXX
|
|
|
|
#include "Window.hxx"
|
|
|
|
#endif
|
2002-01-24 08:06:27 -06:00
|
|
|
#include "unohelp.hxx"
|
|
|
|
#include "unopage.hxx"
|
|
|
|
#include "unomodel.hxx"
|
2004-01-20 05:32:04 -06:00
|
|
|
#ifndef SD_VIEW_HXX
|
|
|
|
#include "View.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_DRAW_VIEW_SHELL_HXX
|
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#endif
|
2002-01-24 08:06:27 -06:00
|
|
|
#include "drawdoc.hxx"
|
2004-01-20 05:32:04 -06:00
|
|
|
#ifndef SD_DRAW_DOC_SHELL_HXX
|
|
|
|
#include "DrawDocShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_GRAPHIC_VIEW_SHELL_HXX
|
|
|
|
#include "GraphicViewShell.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_PRESENTATION_VIEW_SHELL_HXX
|
|
|
|
#include "PresentationViewShell.hxx"
|
|
|
|
#endif
|
2002-01-30 04:40:42 -06:00
|
|
|
#include "sdpage.hxx"
|
2002-08-02 06:16:09 -05:00
|
|
|
#include "unolayer.hxx"
|
2004-01-20 05:32:04 -06:00
|
|
|
#ifndef SD_DRAW_CONTROLLER_HXX
|
|
|
|
#include "DrawController.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef SD_VIEW_SHELL_BASE_HXX
|
|
|
|
#include "ViewShellBase.hxx"
|
|
|
|
#endif
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2002-05-24 03:56:35 -05:00
|
|
|
using namespace ::std;
|
2005-12-14 10:23:21 -06:00
|
|
|
using ::rtl::OUString;
|
2002-01-24 08:06:27 -06:00
|
|
|
using namespace ::vos;
|
|
|
|
using namespace ::cppu;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
namespace sd {
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
SdUnoDrawView::SdUnoDrawView(
|
2004-06-03 05:56:16 -05:00
|
|
|
ViewShellBase& rBase,
|
|
|
|
ViewShell& rViewShell,
|
|
|
|
View& rView) throw()
|
|
|
|
: DrawController (rBase, rViewShell, rView),
|
2004-01-20 05:32:04 -06:00
|
|
|
mbOldMasterPageMode(sal_False),
|
|
|
|
mbOldLayerMode(sal_False),
|
|
|
|
mpCurrentPage(NULL)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
SdUnoDrawView::~SdUnoDrawView() throw()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
DrawViewShell* SdUnoDrawView::GetDrawViewShell (void) const
|
2004-01-20 05:32:04 -06:00
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-12-09 09:12:43 -06:00
|
|
|
|
|
|
|
return static_cast<DrawViewShell*>(mpViewShell);
|
2004-01-20 05:32:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
sal_Bool SdUnoDrawView::getMasterPageMode(void) const throw()
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpViewShell != NULL)
|
|
|
|
return GetDrawViewShell()->GetEditMode() == EM_MASTERPAGE;
|
|
|
|
else
|
|
|
|
return sal_False;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
void SdUnoDrawView::setMasterPageMode (sal_Bool bMasterPageMode) throw()
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-12-09 09:12:43 -06:00
|
|
|
|
|
|
|
if (mpViewShell!=NULL
|
|
|
|
&&(GetDrawViewShell()->GetEditMode() == EM_MASTERPAGE) != bMasterPageMode)
|
|
|
|
{
|
|
|
|
GetDrawViewShell()->ChangeEditMode (
|
2004-01-20 05:32:04 -06:00
|
|
|
bMasterPageMode ? EM_MASTERPAGE : EM_PAGE,
|
2004-12-09 09:12:43 -06:00
|
|
|
GetDrawViewShell()->IsLayerModeActive());
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
sal_Bool SdUnoDrawView::getLayerMode(void) const throw()
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpViewShell != NULL)
|
|
|
|
return GetDrawViewShell()->IsLayerModeActive();
|
|
|
|
else
|
|
|
|
return sal_False;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
void SdUnoDrawView::setLayerMode (sal_Bool bLayerMode) throw()
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpViewShell!=NULL
|
|
|
|
&& GetDrawViewShell()->IsLayerModeActive() != (bLayerMode==sal_True))
|
|
|
|
{
|
|
|
|
GetDrawViewShell()->ChangeEditMode (
|
|
|
|
GetDrawViewShell()->GetEditMode(),
|
2004-01-20 05:32:04 -06:00
|
|
|
bLayerMode);
|
2004-12-09 09:12:43 -06:00
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
Reference<drawing::XLayer> SdUnoDrawView::getActiveLayer (void) throw ()
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2002-08-02 06:16:09 -05:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
Reference<drawing::XLayer> xCurrentLayer;
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
do
|
2002-08-02 06:16:09 -05:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
// Retrieve the layer manager from the model.
|
|
|
|
SdXImpressDocument* pModel = GetModel();
|
|
|
|
if (pModel == NULL)
|
|
|
|
break;
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
SdDrawDocument* pSdModel = pModel->GetDoc();
|
2004-12-09 09:12:43 -06:00
|
|
|
if (pSdModel == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (mpView == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
// From the model get the current SdrLayer object via the layer admin.
|
|
|
|
SdrLayerAdmin& rLayerAdmin = pSdModel->GetLayerAdmin ();
|
|
|
|
SdrLayer* pLayer = rLayerAdmin.GetLayer (mpView->GetActiveLayer(), TRUE);
|
|
|
|
if (pLayer == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Get the corresponding XLayer object from the implementation
|
|
|
|
// object of the layer manager.
|
|
|
|
Reference<drawing::XLayerManager> xManager (pModel->getLayerManager(), uno::UNO_QUERY);
|
|
|
|
SdLayerManager* pManager = SdLayerManager::getImplementation (xManager);
|
|
|
|
if (pManager != NULL)
|
|
|
|
xCurrentLayer = pManager->GetLayer (pLayer);
|
2002-08-02 06:16:09 -05:00
|
|
|
}
|
2004-12-09 09:12:43 -06:00
|
|
|
while (false);
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
return xCurrentLayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SdUnoDrawView::setActiveLayer (const Reference<drawing::XLayer>& rxLayer) throw ()
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2002-08-02 06:16:09 -05:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
do
|
2002-08-02 06:16:09 -05:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
// Get the SdrLayer object corresponding to the given reference.
|
|
|
|
if ( ! rxLayer.is())
|
|
|
|
break;
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
SdLayer* pLayer = SdLayer::getImplementation (rxLayer);
|
2004-12-09 09:12:43 -06:00
|
|
|
if (pLayer == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
SdrLayer* pSdrLayer = pLayer->GetSdrLayer();
|
|
|
|
if (pSdrLayer == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (mpView == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Set the new active layer and make the change visible.
|
|
|
|
mpView->SetActiveLayer (pSdrLayer->GetName());
|
|
|
|
GetDrawViewShell()->ResetActualLayer ();
|
2002-08-02 06:16:09 -05:00
|
|
|
}
|
2004-12-09 09:12:43 -06:00
|
|
|
while (false);
|
2002-08-02 06:16:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
void SdUnoDrawView::FireChangeEditMode (bool bMasterPageMode) throw()
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
if( bMasterPageMode != mbOldMasterPageMode )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
Any aNewValue;
|
|
|
|
aNewValue <<= (sal_Bool)bMasterPageMode;
|
|
|
|
Any aOldValue;
|
|
|
|
aOldValue <<= (sal_Bool)mbOldMasterPageMode;
|
|
|
|
|
|
|
|
FirePropertyChange(PROPERTY_MASTERPAGEMODE, aNewValue, aOldValue);
|
|
|
|
|
|
|
|
mbOldMasterPageMode = bMasterPageMode;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
void SdUnoDrawView::FireChangeLayerMode (bool bLayerMode) throw()
|
|
|
|
{
|
|
|
|
if( bLayerMode != mbOldLayerMode )
|
|
|
|
{
|
|
|
|
Any aNewValue;
|
|
|
|
aNewValue <<= (sal_Bool)bLayerMode;
|
|
|
|
Any aOldValue;
|
|
|
|
aOldValue <<= (sal_Bool)mbOldLayerMode;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
FirePropertyChange (PROPERTY_LAYERMODE, aNewValue, aOldValue);
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
mbOldLayerMode = bLayerMode;
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
void SdUnoDrawView::FireSwitchCurrentPage (SdPage* pCurrentPage) throw()
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2005-07-14 04:45:27 -05:00
|
|
|
if( pCurrentPage != mpCurrentPage ) try
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
Reference< drawing::XDrawPage > xNewPage( pCurrentPage->getUnoPage(), UNO_QUERY );
|
|
|
|
Any aNewValue( makeAny( xNewPage ) );
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
Any aOldValue;
|
|
|
|
if( mpCurrentPage )
|
|
|
|
{
|
|
|
|
Reference< drawing::XDrawPage > xOldPage( mpCurrentPage->getUnoPage(), UNO_QUERY );
|
|
|
|
aOldValue <<= xOldPage;
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
FirePropertyChange (PROPERTY_CURRENTPAGE, aNewValue, aOldValue);
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
mpCurrentPage = pCurrentPage;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2005-07-14 04:45:27 -05:00
|
|
|
catch( uno::Exception& e )
|
|
|
|
{
|
|
|
|
(void)e;
|
|
|
|
DBG_ERROR(
|
2005-12-14 10:23:21 -06:00
|
|
|
(rtl::OString("sd::SdUnoDrawView::FireSwitchCurrentPage(), "
|
2005-07-14 04:45:27 -05:00
|
|
|
"exception caught: ") +
|
|
|
|
rtl::OUStringToOString(
|
|
|
|
comphelper::anyToString( cppu::getCaughtException() ),
|
|
|
|
RTL_TEXTENCODING_UTF8 )).getStr() );
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
// XTypeProvider
|
|
|
|
|
|
|
|
IMPLEMENT_GET_IMPLEMENTATION_ID(SdUnoDrawView);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
|
|
|
|
|
|
|
|
OUString SAL_CALL SdUnoDrawView::getImplementationName (void)
|
|
|
|
throw(RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-01-20 05:32:04 -06:00
|
|
|
return OUString(RTL_CONSTASCII_USTRINGPARAM("SdUnoDrawView"));
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2002-01-30 04:40:42 -06:00
|
|
|
static sal_Char pImplSdUnoDrawViewService[sizeof("com.sun.star.drawing.DrawingDocumentDrawView")] = "com.sun.star.drawing.DrawingDocumentDrawView";
|
2002-03-21 07:19:59 -06:00
|
|
|
static sal_Char pImplSdUnoSlideViewService[sizeof("com.sun.star.presentation.SlidesView")] = "com.sun.star.presentation.SlidesView";
|
2002-01-30 04:40:42 -06:00
|
|
|
static sal_Char pImplSdUnoNotesViewService[sizeof("com.sun.star.presentation.NotesView")] = "com.sun.star.presentation.NotesView";
|
|
|
|
static sal_Char pImplSdUnoHandoutViewService[sizeof("com.sun.star.presentation.HandoutView")] = "com.sun.star.presentation.HandoutView";
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2002-03-21 07:19:59 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
sal_Bool SAL_CALL SdUnoDrawView::supportsService( const OUString& ServiceName )
|
|
|
|
throw(RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
sal_Bool bServiceIsSupported = sal_False;
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
switch (meViewShellType)
|
2002-01-30 04:40:42 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
case ViewShell::ST_NOTES:
|
2004-12-09 09:12:43 -06:00
|
|
|
bServiceIsSupported = ServiceName.equalsAscii(pImplSdUnoNotesViewService)
|
2004-01-20 05:32:04 -06:00
|
|
|
|| ServiceName.equalsAscii( pImplSdUnoDrawViewService );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ViewShell::ST_HANDOUT:
|
2004-12-09 09:12:43 -06:00
|
|
|
bServiceIsSupported = ServiceName.equalsAscii(pImplSdUnoHandoutViewService )
|
2004-01-20 05:32:04 -06:00
|
|
|
|| ServiceName.equalsAscii( pImplSdUnoDrawViewService );
|
|
|
|
break;
|
2002-01-30 04:40:42 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
case ViewShell::ST_IMPRESS:
|
2005-03-01 10:34:25 -06:00
|
|
|
case ViewShell::ST_DRAW:
|
2004-12-09 09:12:43 -06:00
|
|
|
bServiceIsSupported = ServiceName.equalsAscii(pImplSdUnoDrawViewService );
|
2004-11-26 08:10:37 -06:00
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
default:
|
|
|
|
// Shell type is not handled by this object.
|
2004-12-09 09:12:43 -06:00
|
|
|
bServiceIsSupported = sal_False;
|
2002-01-30 04:40:42 -06:00
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
return bServiceIsSupported;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-30 04:40:42 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
Sequence<OUString> SAL_CALL SdUnoDrawView::getSupportedServiceNames (void)
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2004-01-20 05:32:04 -06:00
|
|
|
Sequence<OUString> aServices (
|
2004-12-09 09:12:43 -06:00
|
|
|
(meViewShellType == ViewShell::ST_NOTES)
|
|
|
|
|| (meViewShellType == ViewShell::ST_HANDOUT)
|
|
|
|
|| (meViewShellType == ViewShell::ST_PRESENTATION)
|
2004-01-20 05:32:04 -06:00
|
|
|
? 2 : 1);
|
|
|
|
|
|
|
|
int nIndex = 0;
|
2004-12-09 09:12:43 -06:00
|
|
|
switch (meViewShellType)
|
2002-01-30 04:40:42 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
case ViewShell::ST_NOTES:
|
2005-03-01 10:34:25 -06:00
|
|
|
aServices[nIndex++] = OUString(
|
2004-01-20 05:32:04 -06:00
|
|
|
RTL_CONSTASCII_USTRINGPARAM(pImplSdUnoNotesViewService));
|
|
|
|
break;
|
2002-01-30 04:40:42 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
case ViewShell::ST_HANDOUT:
|
2005-03-01 10:34:25 -06:00
|
|
|
aServices[nIndex++] = OUString(
|
2004-01-20 05:32:04 -06:00
|
|
|
RTL_CONSTASCII_USTRINGPARAM(pImplSdUnoHandoutViewService));
|
2002-01-30 04:40:42 -06:00
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
}
|
2002-01-30 04:40:42 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
switch (meViewShellType)
|
2004-01-20 05:32:04 -06:00
|
|
|
{
|
|
|
|
case ViewShell::ST_NOTES:
|
|
|
|
case ViewShell::ST_HANDOUT:
|
|
|
|
case ViewShell::ST_IMPRESS:
|
2005-03-01 10:34:25 -06:00
|
|
|
case ViewShell::ST_DRAW:
|
|
|
|
aServices[nIndex] = OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(pImplSdUnoDrawViewService));
|
|
|
|
break;
|
2002-01-30 04:40:42 -06:00
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
return aServices;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// XSelectionSupplier
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
|
|
|
|
throw(lang::IllegalArgumentException, RuntimeException)
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2002-01-24 08:06:27 -06:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
bool bOk = true;
|
|
|
|
|
|
|
|
if (mpViewShell != NULL)
|
|
|
|
{
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
vector<SdrObject*> aObjects;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
SdrPage* pSdrPage = NULL;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
Reference< drawing::XShape > xShape;
|
|
|
|
aSelection >>= xShape;
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if(xShape.is())
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xShape );
|
|
|
|
if( pShape && (pShape->GetSdrObject() != NULL) )
|
|
|
|
{
|
|
|
|
SdrObject* pObj = pShape->GetSdrObject();
|
|
|
|
pSdrPage = pObj->GetPage();
|
|
|
|
aObjects.push_back( pObj );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bOk = false;
|
|
|
|
}
|
2002-05-24 03:56:35 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
Reference< drawing::XShapes > xShapes;
|
|
|
|
aSelection >>= xShapes;
|
|
|
|
if( xShapes.is() )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
const sal_uInt32 nCount = xShapes->getCount();
|
|
|
|
for( sal_uInt32 i = 0; i < nCount; i++ )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
xShapes->getByIndex(i) >>= xShape;
|
|
|
|
if( xShape.is() )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SvxShape* pShape = SvxShape::getImplementation(xShape);
|
|
|
|
if( (pShape == NULL) || (pShape->GetSdrObject() == NULL) )
|
|
|
|
{
|
|
|
|
bOk = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SdrObject* pObj = pShape->GetSdrObject();
|
|
|
|
|
|
|
|
if( pSdrPage == NULL )
|
|
|
|
{
|
|
|
|
pSdrPage = pObj->GetPage();
|
|
|
|
}
|
|
|
|
else if( pSdrPage != pObj->GetPage() )
|
|
|
|
{
|
|
|
|
bOk = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aObjects.push_back( pObj );
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-05-24 03:56:35 -05:00
|
|
|
}
|
2002-05-08 03:52:47 -05:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if( bOk )
|
2002-05-24 03:56:35 -05:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
if( pSdrPage )
|
|
|
|
{
|
|
|
|
setMasterPageMode( pSdrPage->IsMasterPage() );
|
|
|
|
GetDrawViewShell()->SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
|
|
|
|
GetDrawViewShell()->WriteFrameViewData();
|
|
|
|
}
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
SdrPageView *pPV = mpView->GetPageViewPvNum(0);
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if(pPV)
|
|
|
|
{
|
|
|
|
// first deselect all
|
|
|
|
mpView->UnmarkAllObj( pPV );
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
vector<SdrObject*>::iterator aIter( aObjects.begin() );
|
|
|
|
const vector<SdrObject*>::iterator aEnd( aObjects.end() );
|
|
|
|
while( aIter != aEnd )
|
|
|
|
{
|
|
|
|
SdrObject* pObj = (*aIter++);
|
|
|
|
mpView->MarkObj( pObj, pPV );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2002-05-24 03:56:35 -05:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
bOk = false;
|
2002-05-24 03:56:35 -05:00
|
|
|
}
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2004-12-09 09:12:43 -06:00
|
|
|
else
|
|
|
|
bOk = false;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2002-05-24 03:56:35 -05:00
|
|
|
return bOk;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Any SAL_CALL SdUnoDrawView::getSelection()
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2002-01-24 08:06:27 -06:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2004-11-26 13:27:36 -06:00
|
|
|
|
|
|
|
Any aAny;
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpView != NULL)
|
|
|
|
{
|
|
|
|
if( mpView->IsTextEdit() )
|
|
|
|
mpView->getTextSelection( aAny );
|
2004-11-26 13:27:36 -06:00
|
|
|
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if( !aAny.hasValue() )
|
2004-11-26 13:27:36 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
|
|
|
|
sal_uInt32 nCount = rMarkList.GetMarkCount();
|
|
|
|
if( nCount )
|
2004-11-26 13:27:36 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY );
|
|
|
|
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
|
|
|
|
{
|
|
|
|
SdrMark *pMark = rMarkList.GetMark(nNum);
|
|
|
|
if(pMark==NULL)
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
SdrObject *pObj = pMark->GetObj();
|
|
|
|
if(pObj==NULL || pObj->GetPage() == NULL)
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if(!xPage.is())
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if(pDrawPage==NULL)
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
Reference< drawing::XShape > xShape( pObj->getUnoShape(), UNO_QUERY );
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if(xShape.is())
|
|
|
|
xShapes->add(xShape);
|
|
|
|
}
|
|
|
|
aAny <<= xShapes;
|
2004-11-26 13:27:36 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aAny;
|
|
|
|
/*
|
2004-06-03 05:56:16 -05:00
|
|
|
SdXImpressDocument* pModel = GetModel();
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY );
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
DBG_ASSERT (&mrView != NULL,
|
|
|
|
"view is NULL in SdUnoDrawView::getSelection()");
|
|
|
|
|
2004-07-12 09:12:39 -05:00
|
|
|
const SdrMarkList& rMarkList = mrView.GetMarkedObjectList();
|
2004-01-20 05:32:04 -06:00
|
|
|
sal_uInt32 nCount = rMarkList.GetMarkCount();
|
|
|
|
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
SdrMark *pMark = rMarkList.GetMark(nNum);
|
|
|
|
if(pMark==NULL)
|
|
|
|
continue;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
SdrObject *pObj = pMark->GetObj();
|
|
|
|
if(pObj==NULL || pObj->GetPage() == NULL)
|
|
|
|
continue;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
if(!xPage.is())
|
|
|
|
continue;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
if(pDrawPage==NULL)
|
|
|
|
continue;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
Reference< drawing::XShape > xShape( pObj->getUnoShape(), UNO_QUERY );
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
if(xShape.is())
|
|
|
|
xShapes->add(xShape);
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
2002-11-19 06:06:01 -06:00
|
|
|
Any aAny;
|
|
|
|
if( 0 != xShapes->getCount() )
|
|
|
|
aAny <<= xShapes;
|
|
|
|
|
|
|
|
return aAny;
|
2004-11-26 13:27:36 -06:00
|
|
|
*/
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
//------ The Properties of this implementation -------------------------
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* All Properties of this implementation. Must be sorted by name.
|
|
|
|
*/
|
2004-06-03 05:56:16 -05:00
|
|
|
void SdUnoDrawView::FillPropertyTable (
|
|
|
|
::std::vector<beans::Property>& rProperties)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
DrawController::FillPropertyTable (rProperties);
|
|
|
|
|
|
|
|
static const beans::Property aBasicProps[
|
2004-07-13 08:48:44 -05:00
|
|
|
PROPERTY__END - PROPERTY__BEGIN] = {
|
2004-06-03 05:56:16 -05:00
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrentPage") ), PROPERTY_CURRENTPAGE, ::getCppuType((const Reference< drawing::XDrawPage > *)0), beans::PropertyAttribute::BOUND ),
|
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsLayerMode") ), PROPERTY_LAYERMODE, ::getCppuBooleanType(), beans::PropertyAttribute::BOUND ),
|
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode") ), PROPERTY_MASTERPAGEMODE,::getCppuBooleanType(), beans::PropertyAttribute::BOUND ),
|
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ActiveLayer") ), PROPERTY_ACTIVE_LAYER, ::getCppuBooleanType(), beans::PropertyAttribute::BOUND ),
|
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomValue") ), PROPERTY_ZOOMVALUE, ::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::BOUND ),
|
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomType") ), PROPERTY_ZOOMTYPE, ::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::BOUND ),
|
|
|
|
beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("ViewOffset") ), PROPERTY_VIEWOFFSET, ::getCppuType((const ::com::sun::star::awt::Point*)0), beans::PropertyAttribute::BOUND ),
|
|
|
|
};
|
2004-07-13 08:48:44 -05:00
|
|
|
int n = PROPERTY__END - PROPERTY__BEGIN;
|
2004-06-03 05:56:16 -05:00
|
|
|
for (int i=0; i<n; i++)
|
|
|
|
rProperties.push_back (aBasicProps[i]);
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
//------ XPropertySet & OPropertySetHelper -----------------------------
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2002-01-30 03:12:31 -06:00
|
|
|
// Return sal_True, value change
|
2002-01-24 08:06:27 -06:00
|
|
|
sal_Bool SdUnoDrawView::convertFastPropertyValue
|
|
|
|
(
|
|
|
|
Any & rConvertedValue,
|
|
|
|
Any & rOldValue,
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const Any& rValue
|
2002-01-30 03:12:31 -06:00
|
|
|
) throw ( com::sun::star::lang::IllegalArgumentException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
sal_Bool bResult = sal_False;
|
|
|
|
|
2002-07-12 04:44:08 -05:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
switch( nHandle )
|
|
|
|
{
|
2002-01-30 04:40:42 -06:00
|
|
|
case PROPERTY_CURRENTPAGE:
|
|
|
|
{
|
|
|
|
Reference< drawing::XDrawPage > xOldPage( getCurrentPage() );
|
|
|
|
Reference< drawing::XDrawPage > xNewPage;
|
|
|
|
convertPropertyValue( xNewPage, rValue );
|
|
|
|
if( xOldPage != xNewPage )
|
|
|
|
{
|
|
|
|
rConvertedValue <<= xNewPage;
|
|
|
|
rOldValue <<= xOldPage;
|
2004-01-20 05:32:04 -06:00
|
|
|
bResult = sal_True;
|
2002-01-30 04:40:42 -06:00
|
|
|
}
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
case PROPERTY_MASTERPAGEMODE:
|
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
sal_Bool bOldValue = getMasterPageMode();
|
|
|
|
sal_Bool b;
|
|
|
|
convertPropertyValue( b , rValue );
|
|
|
|
if( b != bOldValue )
|
|
|
|
{
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
rConvertedValue.setValue( &b , ::getCppuBooleanType() );
|
|
|
|
rOldValue.setValue( & bOldValue , ::getCppuBooleanType() );
|
|
|
|
bResult = sal_True;
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
case PROPERTY_LAYERMODE:
|
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
sal_Bool bOldValue = getLayerMode();
|
|
|
|
sal_Bool b;
|
|
|
|
convertPropertyValue( b , rValue );
|
|
|
|
if( b != bOldValue )
|
|
|
|
{
|
|
|
|
rConvertedValue.setValue( &b , ::getCppuBooleanType() );
|
|
|
|
rOldValue.setValue( & bOldValue , ::getCppuBooleanType() );
|
|
|
|
bResult = sal_True;
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
case PROPERTY_ACTIVE_LAYER:
|
|
|
|
{
|
|
|
|
Reference<drawing::XLayer> xOldLayer (getActiveLayer());
|
|
|
|
Reference<drawing::XLayer> xNewLayer;
|
|
|
|
convertPropertyValue (xNewLayer, rValue);
|
|
|
|
if (xOldLayer != xNewLayer)
|
|
|
|
{
|
|
|
|
rConvertedValue <<= xNewLayer;
|
|
|
|
rOldValue <<= xOldLayer;
|
2004-01-20 05:32:04 -06:00
|
|
|
bResult = sal_True;
|
2002-08-02 06:16:09 -05:00
|
|
|
}
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
|
|
|
|
2003-03-27 03:58:12 -06:00
|
|
|
case PROPERTY_ZOOMVALUE:
|
|
|
|
{
|
|
|
|
sal_Int16 nOldZoom = GetZoom();
|
|
|
|
sal_Int16 nNewZoom;
|
|
|
|
convertPropertyValue( nNewZoom, rValue );
|
|
|
|
if( nNewZoom != nOldZoom )
|
|
|
|
{
|
|
|
|
rConvertedValue <<= nNewZoom;
|
|
|
|
rOldValue <<= nOldZoom;
|
2004-01-20 05:32:04 -06:00
|
|
|
bResult = sal_True;
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
|
|
|
|
2003-03-27 03:58:12 -06:00
|
|
|
case PROPERTY_ZOOMTYPE:
|
|
|
|
{
|
|
|
|
sal_Int16 nOldType = com::sun::star::view::DocumentZoomType::BY_VALUE;
|
|
|
|
sal_Int16 nNewType;
|
|
|
|
convertPropertyValue( nNewType, rValue );
|
|
|
|
if( nNewType != nOldType )
|
|
|
|
{
|
|
|
|
rConvertedValue <<= nNewType;
|
|
|
|
rOldValue <<= nOldType;
|
2004-01-20 05:32:04 -06:00
|
|
|
bResult = sal_True;
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
|
|
|
|
2003-03-27 03:58:12 -06:00
|
|
|
case PROPERTY_VIEWOFFSET:
|
|
|
|
{
|
|
|
|
awt::Point aOld( GetViewOffset() );
|
|
|
|
awt::Point aNew;
|
|
|
|
convertPropertyValue( aNew, rValue );
|
|
|
|
if( (aOld.X != aNew.X) && (aOld.Y != aNew.Y) )
|
|
|
|
{
|
|
|
|
rConvertedValue <<= aNew;
|
|
|
|
rOldValue <<= aOld;
|
2004-01-20 05:32:04 -06:00
|
|
|
bResult = sal_True;
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
2003-03-27 03:58:12 -06:00
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
default:
|
2004-06-03 05:56:16 -05:00
|
|
|
bResult = DrawController::convertFastPropertyValue
|
|
|
|
(rConvertedValue, rOldValue, nHandle, rValue);
|
2004-01-20 05:32:04 -06:00
|
|
|
break;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
return bResult;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* only set the value.
|
|
|
|
*/
|
|
|
|
void SdUnoDrawView::setFastPropertyValue_NoBroadcast
|
|
|
|
(
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const Any& rValue
|
2002-01-30 03:12:31 -06:00
|
|
|
) throw ( com::sun::star::uno::Exception)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2002-07-12 04:44:08 -05:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
switch( nHandle )
|
|
|
|
{
|
2002-01-30 04:40:42 -06:00
|
|
|
case PROPERTY_CURRENTPAGE:
|
|
|
|
{
|
|
|
|
Reference< drawing::XDrawPage > xPage;
|
|
|
|
rValue >>= xPage;
|
|
|
|
setCurrentPage( xPage );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
case PROPERTY_MASTERPAGEMODE:
|
|
|
|
{
|
|
|
|
sal_Bool bValue;
|
|
|
|
rValue >>= bValue;
|
|
|
|
setMasterPageMode( bValue );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROPERTY_LAYERMODE:
|
|
|
|
{
|
|
|
|
sal_Bool bValue;
|
|
|
|
rValue >>= bValue;
|
|
|
|
setLayerMode( bValue );
|
|
|
|
}
|
2002-08-02 06:16:09 -05:00
|
|
|
|
|
|
|
case PROPERTY_ACTIVE_LAYER:
|
|
|
|
{
|
|
|
|
Reference<drawing::XLayer> xLayer;
|
|
|
|
rValue >>= xLayer;
|
|
|
|
setActiveLayer (xLayer);
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
break;
|
2003-03-27 03:58:12 -06:00
|
|
|
case PROPERTY_ZOOMVALUE:
|
|
|
|
{
|
|
|
|
sal_Int16 nZoom;
|
|
|
|
rValue >>= nZoom;
|
|
|
|
SetZoom( nZoom );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PROPERTY_ZOOMTYPE:
|
|
|
|
{
|
|
|
|
sal_Int16 nType;
|
|
|
|
rValue >>= nType;
|
|
|
|
SetZoomType( nType );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PROPERTY_VIEWOFFSET:
|
|
|
|
{
|
|
|
|
awt::Point aOffset;
|
|
|
|
rValue >>= aOffset;
|
|
|
|
SetViewOffset( aOffset );
|
|
|
|
}
|
|
|
|
break;
|
2004-06-03 05:56:16 -05:00
|
|
|
|
|
|
|
default:
|
|
|
|
DrawController::setFastPropertyValue_NoBroadcast (nHandle, rValue);
|
|
|
|
break;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SdUnoDrawView::getFastPropertyValue( Any & rRet, sal_Int32 nHandle ) const
|
|
|
|
{
|
2002-07-12 04:44:08 -05:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
switch( nHandle )
|
|
|
|
{
|
2002-01-30 04:40:42 -06:00
|
|
|
case PROPERTY_CURRENTPAGE:
|
|
|
|
rRet <<= (const_cast<SdUnoDrawView*>(this))->getCurrentPage();
|
|
|
|
break;
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
case PROPERTY_MASTERPAGEMODE:
|
|
|
|
rRet <<= getMasterPageMode();
|
2002-01-30 04:40:42 -06:00
|
|
|
break;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
case PROPERTY_LAYERMODE:
|
|
|
|
rRet <<= getLayerMode();
|
2002-01-30 04:40:42 -06:00
|
|
|
break;
|
|
|
|
|
2002-08-02 06:16:09 -05:00
|
|
|
case PROPERTY_ACTIVE_LAYER:
|
|
|
|
rRet <<= (const_cast<SdUnoDrawView*>(this))->getActiveLayer();
|
|
|
|
break;
|
|
|
|
|
2003-03-27 03:58:12 -06:00
|
|
|
case PROPERTY_ZOOMVALUE:
|
|
|
|
rRet <<= GetZoom();
|
|
|
|
break;
|
|
|
|
case PROPERTY_ZOOMTYPE:
|
|
|
|
rRet <<= (sal_Int16)com::sun::star::view::DocumentZoomType::BY_VALUE;
|
|
|
|
break;
|
|
|
|
case PROPERTY_VIEWOFFSET:
|
|
|
|
rRet <<= GetViewOffset();
|
|
|
|
break;
|
|
|
|
|
2004-07-13 08:48:44 -05:00
|
|
|
/* case PROPERTY_WORKAREA:
|
2004-01-20 05:32:04 -06:00
|
|
|
rRet <<= awt::Rectangle(
|
|
|
|
maLastVisArea.Left(),
|
|
|
|
maLastVisArea.Top(),
|
|
|
|
maLastVisArea.GetWidth(),
|
|
|
|
maLastVisArea.GetHeight());
|
|
|
|
break;
|
2004-07-13 08:48:44 -05:00
|
|
|
*/
|
2004-06-03 05:56:16 -05:00
|
|
|
default:
|
|
|
|
DrawController::getFastPropertyValue (rRet, nHandle);
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-30 04:40:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
// XDrawView
|
2002-01-30 04:40:42 -06:00
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
void SAL_CALL SdUnoDrawView::setCurrentPage (
|
|
|
|
const Reference< drawing::XDrawPage >& xPage )
|
2002-01-24 08:06:27 -06:00
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
DBG_ASSERT (mpView!=NULL, "View is NULL in SdUnoDrawView::setCurrentPage");
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpViewShell != NULL)
|
2004-01-20 05:32:04 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
|
|
|
|
SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
|
|
|
|
|
|
|
|
if(pSdrPage)
|
|
|
|
{
|
|
|
|
// End editing of text. Otherwise the edited text object would
|
|
|
|
// still be visible on the new page.
|
|
|
|
GetDrawViewShell()->GetView()->EndTextEdit();
|
2004-09-20 07:37:05 -05:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
setMasterPageMode( pSdrPage->IsMasterPage() );
|
|
|
|
GetDrawViewShell()->SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
|
|
|
|
GetDrawViewShell()->WriteFrameViewData();
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Reference< drawing::XDrawPage > SAL_CALL SdUnoDrawView::getCurrentPage()
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2004-06-03 05:56:16 -05:00
|
|
|
ThrowIfDisposed();
|
2002-01-24 08:06:27 -06:00
|
|
|
OGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
Reference< drawing::XDrawPage > xPage;
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
DBG_ASSERT (mpView!=NULL, "View is NULL in SdUnoDrawView::getCurrentPage");
|
|
|
|
if (mpView != NULL)
|
|
|
|
{
|
|
|
|
SdXImpressDocument* pModel = GetModel();
|
|
|
|
SdrPageView *pPV = mpView->GetPageViewPvNum(0);
|
|
|
|
SdrPage* pPage = pPV ? pPV->GetPage() : NULL;
|
2002-03-21 06:23:11 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if(pPage)
|
|
|
|
xPage = Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
|
|
|
|
}
|
2002-03-21 06:23:11 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
return xPage;
|
2002-03-21 06:23:11 -06:00
|
|
|
}
|
|
|
|
|
2002-08-27 08:01:08 -05:00
|
|
|
|
2003-03-27 03:58:12 -06:00
|
|
|
sal_Int16 SdUnoDrawView::GetZoom(void) const
|
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpViewShell!=NULL && GetDrawViewShell()->GetActiveWindow() )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
return (sal_Int16)GetDrawViewShell()->GetActiveWindow()->GetZoom();
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdUnoDrawView::SetZoom( sal_Int16 nZoom )
|
|
|
|
{
|
|
|
|
SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, nZoom );
|
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
if (mpViewShell != NULL)
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame();
|
2003-03-27 03:58:12 -06:00
|
|
|
if( pViewFrame )
|
|
|
|
{
|
|
|
|
SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
|
|
|
|
if( pDispatcher )
|
|
|
|
{
|
|
|
|
pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SdUnoDrawView::SetViewOffset(const awt::Point& rWinPos )
|
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
DBG_ASSERT (mpViewShell != NULL, "ViewShell is NULL in SdUnoDrawView::SetViewOffset");
|
|
|
|
if (mpViewShell != NULL)
|
|
|
|
{
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
Point aWinPos( rWinPos.X, rWinPos.Y );
|
|
|
|
aWinPos += mpViewShell->GetViewOrigin();
|
|
|
|
mpViewShell->SetWinViewPos( aWinPos, true );
|
|
|
|
}
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
awt::Point SdUnoDrawView::GetViewOffset() const
|
|
|
|
{
|
|
|
|
Point aRet;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
DBG_ASSERT (mpViewShell!=NULL, "ViewShell is NULL in SdUnoDrawView::GetViewOffset");
|
|
|
|
if (mpViewShell != NULL)
|
|
|
|
{
|
|
|
|
aRet = mpViewShell->GetWinViewPos();
|
|
|
|
aRet -= mpViewShell->GetViewOrigin();
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2003-03-27 03:58:12 -06:00
|
|
|
return awt::Point( aRet.X(), aRet.Y() );
|
|
|
|
}
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
void SdUnoDrawView::SetZoomType ( sal_Int16 nType )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
DBG_ASSERT (mpViewShell!= NULL, "ViewShell is NULL in SdUnoDrawView::SetZoomType");
|
|
|
|
if (mpViewShell != NULL)
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame();
|
|
|
|
if( pViewFrame )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
|
|
|
|
if( pDispatcher )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
SvxZoomType eZoomType;
|
|
|
|
switch( nType )
|
|
|
|
{
|
|
|
|
case com::sun::star::view::DocumentZoomType::OPTIMAL:
|
|
|
|
eZoomType = SVX_ZOOM_OPTIMAL;
|
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
case com::sun::star::view::DocumentZoomType::PAGE_WIDTH:
|
|
|
|
case com::sun::star::view::DocumentZoomType::PAGE_WIDTH_EXACT:
|
|
|
|
eZoomType = SVX_ZOOM_PAGEWIDTH;
|
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
case com::sun::star::view::DocumentZoomType::ENTIRE_PAGE:
|
|
|
|
eZoomType = SVX_ZOOM_WHOLEPAGE;
|
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2004-12-09 09:12:43 -06:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SvxZoomItem aZoomItem( eZoomType );
|
|
|
|
pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
} // end of namespace sd
|