2002-01-30 04:40:42 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 16:43:49 -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:43:49 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:43:49 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:43:49 -05:00
|
|
|
* $RCSfile: SdUnoDrawView.cxx,v $
|
|
|
|
* $Revision: 1.35 $
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:43:49 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-01-30 04:40:42 -06:00
|
|
|
*
|
2008-04-10 16:43:49 -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:43:49 -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:43:49 -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:17 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
#include "SdUnoDrawView.hxx"
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
#include "DrawController.hxx"
|
|
|
|
#include "DrawDocShell.hxx"
|
|
|
|
#include "DrawViewShell.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
#include "unolayer.hxx"
|
|
|
|
#include "unomodel.hxx"
|
|
|
|
#include "unopage.hxx"
|
|
|
|
#include "Window.hxx"
|
|
|
|
|
|
|
|
#include <cppuhelper/proptypehlp.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
#include <svx/svdpagv.hxx>
|
2002-01-24 08:06:27 -06:00
|
|
|
#include <svx/unoshape.hxx>
|
|
|
|
#include <svx/unoshcol.hxx>
|
2003-03-27 03:58:12 -06:00
|
|
|
#include <svx/zoomitem.hxx>
|
2006-03-21 10:34:06 -06:00
|
|
|
#include <com/sun/star/drawing/XLayerManager.hpp>
|
|
|
|
#include <com/sun/star/view/DocumentZoomType.hpp>
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
#include <vector>
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
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(
|
2006-03-21 10:34:06 -06:00
|
|
|
DrawController& rController,
|
|
|
|
DrawViewShell& rViewShell,
|
2004-06-03 05:56:16 -05:00
|
|
|
View& rView) throw()
|
2008-04-03 08:55:09 -05:00
|
|
|
: DrawSubControllerInterfaceBase(m_aMutex),
|
2006-03-21 10:34:06 -06:00
|
|
|
mrController(rController),
|
|
|
|
mrDrawViewShell(rViewShell),
|
|
|
|
mrView(rView)
|
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
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
sal_Bool SdUnoDrawView::getMasterPageMode(void) const throw()
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
return (mrDrawViewShell.GetEditMode() == EM_MASTERPAGE);
|
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
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
if ((mrDrawViewShell.GetEditMode() == EM_MASTERPAGE) != bMasterPageMode)
|
2004-12-09 09:12:43 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
mrDrawViewShell.ChangeEditMode (
|
2004-01-20 05:32:04 -06:00
|
|
|
bMasterPageMode ? EM_MASTERPAGE : EM_PAGE,
|
2006-03-21 10:34:06 -06:00
|
|
|
mrDrawViewShell.IsLayerModeActive());
|
2004-12-09 09:12:43 -06:00
|
|
|
}
|
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()
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
return mrDrawViewShell.IsLayerModeActive();
|
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
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
if (mrDrawViewShell.IsLayerModeActive() != (bLayerMode==sal_True))
|
2004-12-09 09:12:43 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
mrDrawViewShell.ChangeEditMode (
|
|
|
|
mrDrawViewShell.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 ()
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
// From the model get the current SdrLayer object via the layer admin.
|
|
|
|
SdrLayerAdmin& rLayerAdmin = pSdModel->GetLayerAdmin ();
|
2006-03-21 10:34:06 -06:00
|
|
|
SdrLayer* pLayer = rLayerAdmin.GetLayer (mrView.GetActiveLayer(), TRUE);
|
2004-12-09 09:12:43 -06:00
|
|
|
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-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;
|
|
|
|
|
|
|
|
// Set the new active layer and make the change visible.
|
2006-03-21 10:34:06 -06:00
|
|
|
mrView.SetActiveLayer (pSdrLayer->GetName());
|
|
|
|
mrDrawViewShell.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
|
|
|
// XSelectionSupplier
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
|
|
|
|
throw(lang::IllegalArgumentException, RuntimeException)
|
|
|
|
{
|
2004-12-09 09:12:43 -06:00
|
|
|
bool bOk = true;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
::std::vector<SdrObject*> aObjects;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
SdrPage* pSdrPage = NULL;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
Reference< drawing::XShape > xShape;
|
|
|
|
aSelection >>= xShape;
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if(xShape.is())
|
|
|
|
{
|
|
|
|
SvxShape* pShape = SvxShape::getImplementation( xShape );
|
|
|
|
if( pShape && (pShape->GetSdrObject() != NULL) )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SdrObject* pObj = pShape->GetSdrObject();
|
|
|
|
pSdrPage = pObj->GetPage();
|
|
|
|
aObjects.push_back( pObj );
|
2002-05-24 03:56:35 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
bOk = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Reference< drawing::XShapes > xShapes;
|
|
|
|
aSelection >>= xShapes;
|
|
|
|
if( xShapes.is() )
|
|
|
|
{
|
|
|
|
const sal_uInt32 nCount = xShapes->getCount();
|
|
|
|
for( sal_uInt32 i = 0; i < nCount; i++ )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
xShapes->getByIndex(i) >>= xShape;
|
|
|
|
if( xShape.is() )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -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() )
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
bOk = false;
|
|
|
|
break;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2006-03-21 10:34:06 -06:00
|
|
|
|
|
|
|
aObjects.push_back( pObj );
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
2002-05-24 03:56:35 -05:00
|
|
|
}
|
2006-03-21 10:34:06 -06:00
|
|
|
}
|
2002-05-08 03:52:47 -05:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
if( pSdrPage )
|
2002-05-24 03:56:35 -05:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
setMasterPageMode( pSdrPage->IsMasterPage() );
|
|
|
|
mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
|
|
|
|
mrDrawViewShell.WriteFrameViewData();
|
|
|
|
}
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2006-11-14 07:38:07 -06:00
|
|
|
SdrPageView *pPV = mrView.GetSdrPageView();
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if(pPV)
|
|
|
|
{
|
|
|
|
// first deselect all
|
|
|
|
mrView.UnmarkAllObj( pPV );
|
2002-05-24 03:56:35 -05:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
::std::vector<SdrObject*>::iterator aIter( aObjects.begin() );
|
|
|
|
const ::std::vector<SdrObject*>::iterator aEnd( aObjects.end() );
|
|
|
|
while( aIter != aEnd )
|
2002-05-24 03:56:35 -05:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SdrObject* pObj = (*aIter++);
|
|
|
|
mrView.MarkObj( pObj, pPV );
|
2002-05-24 03:56:35 -05:00
|
|
|
}
|
|
|
|
}
|
2006-03-21 10:34:06 -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-11-26 13:27:36 -06:00
|
|
|
Any aAny;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if( mrView.IsTextEdit() )
|
|
|
|
mrView.getTextSelection( aAny );
|
2004-11-26 13:27:36 -06:00
|
|
|
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if( !aAny.hasValue() )
|
|
|
|
{
|
|
|
|
const SdrMarkList& rMarkList = mrView.GetMarkedObjectList();
|
|
|
|
sal_uInt32 nCount = rMarkList.GetMarkCount();
|
|
|
|
if( nCount )
|
2004-11-26 13:27:36 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY );
|
|
|
|
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
|
2004-11-26 13:27:36 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SdrMark *pMark = rMarkList.GetMark(nNum);
|
|
|
|
if(pMark==NULL)
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-07-25 05:44:02 -05:00
|
|
|
SdrObject *pObj = pMark->GetMarkedSdrObj();
|
2006-03-21 10:34:06 -06:00
|
|
|
if(pObj==NULL || pObj->GetPage() == NULL)
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if(!xPage.is())
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if(pDrawPage==NULL)
|
|
|
|
continue;
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
Reference< drawing::XShape > xShape( pObj->getUnoShape(), UNO_QUERY );
|
2004-11-26 13:27:36 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if(xShape.is())
|
|
|
|
xShapes->add(xShape);
|
2004-11-26 13:27:36 -06:00
|
|
|
}
|
2006-03-21 10:34:06 -06:00
|
|
|
aAny <<= xShapes;
|
2004-11-26 13:27:36 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aAny;
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-03 08:55:09 -05:00
|
|
|
void SAL_CALL SdUnoDrawView::addSelectionChangeListener (
|
|
|
|
const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
|
|
|
|
throw(css::uno::RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2008-04-03 08:55:09 -05:00
|
|
|
(void)rxListener;
|
|
|
|
}
|
2004-01-20 05:32:04 -06:00
|
|
|
|
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2008-04-03 08:55:09 -05:00
|
|
|
void SAL_CALL SdUnoDrawView::removeSelectionChangeListener (
|
|
|
|
const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
|
|
|
|
throw(css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
(void)rxListener;
|
|
|
|
}
|
2003-03-27 03:58:12 -06:00
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2002-01-24 08:06:27 -06:00
|
|
|
|
|
|
|
|
2008-04-03 08:55:09 -05:00
|
|
|
void SdUnoDrawView::setFastPropertyValue (
|
2002-01-24 08:06:27 -06:00
|
|
|
sal_Int32 nHandle,
|
2008-04-03 08:55:09 -05:00
|
|
|
const Any& rValue)
|
|
|
|
throw(css::beans::UnknownPropertyException,
|
|
|
|
css::beans::PropertyVetoException,
|
|
|
|
css::lang::IllegalArgumentException,
|
|
|
|
css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
|
|
|
switch( nHandle )
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_CURRENTPAGE:
|
2002-01-30 04:40:42 -06:00
|
|
|
{
|
|
|
|
Reference< drawing::XDrawPage > xPage;
|
|
|
|
rValue >>= xPage;
|
|
|
|
setCurrentPage( xPage );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_MASTERPAGEMODE:
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2007-01-09 04:34:17 -06:00
|
|
|
sal_Bool bValue = sal_False;
|
2002-01-24 08:06:27 -06:00
|
|
|
rValue >>= bValue;
|
|
|
|
setMasterPageMode( bValue );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_LAYERMODE:
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2007-01-09 04:34:17 -06:00
|
|
|
sal_Bool bValue = sal_False;
|
2002-01-24 08:06:27 -06:00
|
|
|
rValue >>= bValue;
|
|
|
|
setLayerMode( bValue );
|
|
|
|
}
|
2002-08-02 06:16:09 -05:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_ACTIVE_LAYER:
|
2002-08-02 06:16:09 -05:00
|
|
|
{
|
|
|
|
Reference<drawing::XLayer> xLayer;
|
|
|
|
rValue >>= xLayer;
|
|
|
|
setActiveLayer (xLayer);
|
|
|
|
}
|
2002-01-24 08:06:27 -06:00
|
|
|
break;
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_ZOOMVALUE:
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2007-01-09 04:34:17 -06:00
|
|
|
sal_Int16 nZoom = 0;
|
2003-03-27 03:58:12 -06:00
|
|
|
rValue >>= nZoom;
|
|
|
|
SetZoom( nZoom );
|
|
|
|
}
|
|
|
|
break;
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_ZOOMTYPE:
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2007-01-09 04:34:17 -06:00
|
|
|
sal_Int16 nType = 0;
|
2003-03-27 03:58:12 -06:00
|
|
|
rValue >>= nType;
|
|
|
|
SetZoomType( nType );
|
|
|
|
}
|
|
|
|
break;
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_VIEWOFFSET:
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
|
|
|
awt::Point aOffset;
|
|
|
|
rValue >>= aOffset;
|
|
|
|
SetViewOffset( aOffset );
|
|
|
|
}
|
|
|
|
break;
|
2004-06-03 05:56:16 -05:00
|
|
|
|
|
|
|
default:
|
2008-04-03 08:55:09 -05:00
|
|
|
throw beans::UnknownPropertyException();
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-03 08:55:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
Any SAL_CALL SdUnoDrawView::getFastPropertyValue (
|
|
|
|
sal_Int32 nHandle)
|
|
|
|
throw(css::beans::UnknownPropertyException,
|
|
|
|
css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
2002-01-24 08:06:27 -06:00
|
|
|
{
|
2008-04-03 08:55:09 -05:00
|
|
|
Any aValue;
|
2002-01-24 08:06:27 -06:00
|
|
|
switch( nHandle )
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_CURRENTPAGE:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= (const_cast<SdUnoDrawView*>(this))->getCurrentPage();
|
2002-01-30 04:40:42 -06:00
|
|
|
break;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_MASTERPAGEMODE:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= getMasterPageMode();
|
2002-01-30 04:40:42 -06:00
|
|
|
break;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_LAYERMODE:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= getLayerMode();
|
2002-01-30 04:40:42 -06:00
|
|
|
break;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_ACTIVE_LAYER:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= (const_cast<SdUnoDrawView*>(this))->getActiveLayer();
|
2002-08-02 06:16:09 -05:00
|
|
|
break;
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_ZOOMVALUE:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= GetZoom();
|
2003-03-27 03:58:12 -06:00
|
|
|
break;
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_ZOOMTYPE:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= (sal_Int16)com::sun::star::view::DocumentZoomType::BY_VALUE;
|
2003-03-27 03:58:12 -06:00
|
|
|
break;
|
2006-03-21 10:34:06 -06:00
|
|
|
case DrawController::PROPERTY_VIEWOFFSET:
|
2008-04-03 08:55:09 -05:00
|
|
|
aValue <<= GetViewOffset();
|
2003-03-27 03:58:12 -06:00
|
|
|
break;
|
|
|
|
|
2004-06-03 05:56:16 -05:00
|
|
|
default:
|
2008-04-03 08:55:09 -05:00
|
|
|
throw beans::UnknownPropertyException();
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
2008-04-03 08:55:09 -05:00
|
|
|
|
|
|
|
return aValue;
|
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)
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
|
|
|
|
SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
|
2002-01-24 08:06:27 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
if(pSdrPage)
|
2004-01-20 05:32:04 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
// End editing of text. Otherwise the edited text object would
|
|
|
|
// still be visible on the new page.
|
2006-11-14 07:38:07 -06:00
|
|
|
mrDrawViewShell.GetView()->SdrEndTextEdit();
|
2004-09-20 07:37:05 -05:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
setMasterPageMode( pSdrPage->IsMasterPage() );
|
|
|
|
mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
|
|
|
|
mrDrawViewShell.WriteFrameViewData();
|
2002-01-24 08:06:27 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Reference< drawing::XDrawPage > SAL_CALL SdUnoDrawView::getCurrentPage()
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
|
|
|
Reference< drawing::XDrawPage > xPage;
|
|
|
|
|
2006-11-14 07:38:07 -06:00
|
|
|
SdrPageView *pPV = mrView.GetSdrPageView();
|
2006-03-21 10:34:06 -06:00
|
|
|
SdrPage* pPage = pPV ? pPV->GetPage() : NULL;
|
2002-03-21 06:23:11 -06:00
|
|
|
|
2006-03-21 10:34:06 -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
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
if (mrDrawViewShell.GetActiveWindow() )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
return (sal_Int16)mrDrawViewShell.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 );
|
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
|
|
|
|
if( pViewFrame )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
|
|
|
|
if( pDispatcher )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SdUnoDrawView::SetViewOffset(const awt::Point& rWinPos )
|
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
Point aWinPos( rWinPos.X, rWinPos.Y );
|
|
|
|
aWinPos += mrDrawViewShell.GetViewOrigin();
|
|
|
|
mrDrawViewShell.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
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
aRet = mrDrawViewShell.GetWinViewPos();
|
|
|
|
aRet -= mrDrawViewShell.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
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
|
|
|
|
if( pViewFrame )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
|
|
|
|
if( pDispatcher )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
SvxZoomType eZoomType;
|
|
|
|
switch( nType )
|
2003-03-27 03:58:12 -06:00
|
|
|
{
|
2006-03-21 10:34:06 -06:00
|
|
|
case com::sun::star::view::DocumentZoomType::OPTIMAL:
|
|
|
|
eZoomType = SVX_ZOOM_OPTIMAL;
|
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2006-03-21 10:34:06 -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
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
case com::sun::star::view::DocumentZoomType::ENTIRE_PAGE:
|
|
|
|
eZoomType = SVX_ZOOM_WHOLEPAGE;
|
|
|
|
break;
|
2004-01-20 05:32:04 -06:00
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
default:
|
|
|
|
return;
|
2003-03-27 03:58:12 -06:00
|
|
|
}
|
2006-03-21 10:34:06 -06:00
|
|
|
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
|
|
|
|
2006-03-21 10:34:06 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SdXImpressDocument* SdUnoDrawView::GetModel (void) const throw()
|
|
|
|
{
|
|
|
|
if (mrView.GetDocSh()!=NULL)
|
|
|
|
{
|
|
|
|
Reference<frame::XModel> xModel (mrView.GetDocSh()->GetModel());
|
|
|
|
return SdXImpressDocument::getImplementation(xModel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-20 05:32:04 -06:00
|
|
|
} // end of namespace sd
|