1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_chart2.hxx" 30*cdf0e10cSrcweir #include "DrawViewWrapper.hxx" 31*cdf0e10cSrcweir #include "chartview/DrawModelWrapper.hxx" 32*cdf0e10cSrcweir #include "ConfigurationAccess.hxx" 33*cdf0e10cSrcweir #include "macros.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <unotools/lingucfg.hxx> 36*cdf0e10cSrcweir #include <editeng/langitem.hxx> 37*cdf0e10cSrcweir // header for class SdrPage 38*cdf0e10cSrcweir #include <svx/svdpage.hxx> 39*cdf0e10cSrcweir //header for class SdrPageView 40*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 41*cdf0e10cSrcweir // header for class SdrModel 42*cdf0e10cSrcweir #include <svx/svdmodel.hxx> 43*cdf0e10cSrcweir // header for class E3dScene 44*cdf0e10cSrcweir #include <svx/scene3d.hxx> 45*cdf0e10cSrcweir #include <svx/svdetc.hxx> 46*cdf0e10cSrcweir #include <svx/svdoutl.hxx> 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir // header for class SvxForbiddenCharactersTable 49*cdf0e10cSrcweir #include <editeng/forbiddencharacterstable.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 52*cdf0e10cSrcweir #include <svx/svxids.hrc> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir // header for class SvxShape 56*cdf0e10cSrcweir #include <svx/unoshape.hxx> 57*cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 60*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 63*cdf0e10cSrcweir #include <svx/helperhittest3d.hxx> 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir using namespace ::com::sun::star; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir //............................................................................. 68*cdf0e10cSrcweir namespace chart 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir //............................................................................. 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir namespace 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir short lcl_getHitTolerance( OutputDevice* pOutDev ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir const short HITPIX=2; //hit-tolerance in pixel 77*cdf0e10cSrcweir short nHitTolerance = 50; 78*cdf0e10cSrcweir if(pOutDev) 79*cdf0e10cSrcweir nHitTolerance = static_cast<short>(pOutDev->PixelToLogic(Size(HITPIX,0)).Width()); 80*cdf0e10cSrcweir return nHitTolerance; 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // this code is copied from sfx2/source/doc/objembed.cxx 84*cdf0e10cSrcweir SfxObjectShell * lcl_GetParentObjectShell( const uno::Reference< frame::XModel > & xModel ) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir SfxObjectShell* pResult = NULL; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir try 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir uno::Reference< container::XChild > xChildModel( xModel, uno::UNO_QUERY ); 91*cdf0e10cSrcweir if ( xChildModel.is() ) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xParentTunnel( xChildModel->getParent(), uno::UNO_QUERY ); 94*cdf0e10cSrcweir if ( xParentTunnel.is() ) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID ); 97*cdf0e10cSrcweir pResult = reinterpret_cast< SfxObjectShell * >( 98*cdf0e10cSrcweir xParentTunnel->getSomething( uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) ); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir catch( uno::Exception& ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir // TODO: error handling 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir return pResult; 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // this code is copied from sfx2/source/doc/objembed.cxx. It is a workaround to 111*cdf0e10cSrcweir // get the reference device (e.g. printer) fromthe parent document 112*cdf0e10cSrcweir OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & xModel ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir SfxObjectShell * pParent = lcl_GetParentObjectShell( xModel ); 115*cdf0e10cSrcweir if ( pParent ) 116*cdf0e10cSrcweir return pParent->GetDocumentRefDev(); 117*cdf0e10cSrcweir return NULL; 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir /* 123*cdf0e10cSrcweir void lcl_initOutliner( SdrOutliner* pTargetOutliner, SdrOutliner* pSourceOutliner ) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir //just an unsuccessful try to initialize the text edit outliner correctly 126*cdf0e10cSrcweir //if( bInit ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir pTargetOutliner->EraseVirtualDevice(); 129*cdf0e10cSrcweir pTargetOutliner->SetUpdateMode(sal_False); 130*cdf0e10cSrcweir pTargetOutliner->SetEditTextObjectPool( pSourceOutliner->GetEditTextObjectPool() ); 131*cdf0e10cSrcweir pTargetOutliner->SetDefTab( pSourceOutliner->GetDefTab() ); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir pTargetOutliner->SetRefDevice( pSourceOutliner->GetRefDevice() ); 135*cdf0e10cSrcweir pTargetOutliner->SetForbiddenCharsTable( pSourceOutliner->GetForbiddenCharsTable() ); 136*cdf0e10cSrcweir pTargetOutliner->SetAsianCompressionMode( pSourceOutliner->GetAsianCompressionMode() ); 137*cdf0e10cSrcweir pTargetOutliner->SetKernAsianPunctuation( pSourceOutliner->IsKernAsianPunctuation() ); 138*cdf0e10cSrcweir pTargetOutliner->SetStyleSheetPool( pSourceOutliner->GetStyleSheetPool() ); 139*cdf0e10cSrcweir pTargetOutliner->SetRefMapMode( pSourceOutliner->GetRefMapMode() ); 140*cdf0e10cSrcweir pTargetOutliner->SetDefaultLanguage( pSourceOutliner->GetDefaultLanguage() ); 141*cdf0e10cSrcweir pTargetOutliner->SetHyphenator( pSourceOutliner->GetHyphenator() ); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir sal_uInt16 nX, nY; 144*cdf0e10cSrcweir pSourceOutliner->GetGlobalCharStretching( nX, nY ); 145*cdf0e10cSrcweir pTargetOutliner->SetGlobalCharStretching( nX, nY ); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir *//* 148*cdf0e10cSrcweir if ( !GetRefDevice() ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir MapMode aMapMode(eObjUnit, Point(0,0), aObjUnit, aObjUnit); 151*cdf0e10cSrcweir pTargetOutliner->SetRefMapMode(aMapMode); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir *//* 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir */ 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut, bool bPaintPageForEditMode) 158*cdf0e10cSrcweir : E3dView(pSdrModel, pOut) 159*cdf0e10cSrcweir , m_pMarkHandleProvider(NULL) 160*cdf0e10cSrcweir , m_apOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pSdrModel ) ) 161*cdf0e10cSrcweir , m_bRestoreMapMode( false ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir // #114898# 164*cdf0e10cSrcweir SetBufferedOutputAllowed(true); 165*cdf0e10cSrcweir SetBufferedOverlayAllowed(true); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir SetPagePaintingAllowed(bPaintPageForEditMode); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir // #i12587# support for shapes in chart 170*cdf0e10cSrcweir SdrOutliner* pOutliner = getOutliner(); 171*cdf0e10cSrcweir SfxItemPool* pOutlinerPool = ( pOutliner ? pOutliner->GetEditTextObjectPool() : NULL ); 172*cdf0e10cSrcweir if ( pOutlinerPool ) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir SvtLinguConfig aLinguConfig; 175*cdf0e10cSrcweir SvtLinguOptions aLinguOptions; 176*cdf0e10cSrcweir if ( aLinguConfig.GetOptions( aLinguOptions ) ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ) ); 179*cdf0e10cSrcweir pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ) ); 180*cdf0e10cSrcweir pOutlinerPool->SetPoolDefaultItem( SvxLanguageItem( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ) ); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir // set font height without changing SdrEngineDefaults 184*cdf0e10cSrcweir pOutlinerPool->SetPoolDefaultItem( SvxFontHeightItem( 423, 100, EE_CHAR_FONTHEIGHT ) ); // 12pt 185*cdf0e10cSrcweir } 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir ReInit(); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir void DrawViewWrapper::ReInit() 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir OutputDevice* pOutDev = this->GetFirstOutputDevice(); 193*cdf0e10cSrcweir Size aOutputSize(100,100); 194*cdf0e10cSrcweir if(pOutDev) 195*cdf0e10cSrcweir aOutputSize = pOutDev->GetOutputSize(); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir bPageVisible = false; 198*cdf0e10cSrcweir bPageBorderVisible = false; 199*cdf0e10cSrcweir bBordVisible = false; 200*cdf0e10cSrcweir bGridVisible = false; 201*cdf0e10cSrcweir bHlplVisible = false; 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir this->SetNoDragXorPolys(true);//for interactive 3D resize-dragging: paint only a single rectangle (not a simulated 3D object) 204*cdf0e10cSrcweir //this->SetResizeAtCenter(true);//for interactive resize-dragging: keep the object center fix 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir //a correct work area is at least necessary for correct values in the position and size dialog 207*cdf0e10cSrcweir Rectangle aRect(Point(0,0), aOutputSize); 208*cdf0e10cSrcweir this->SetWorkArea(aRect); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir this->ShowSdrPage(this->GetModel()->GetPage(0)); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir DrawViewWrapper::~DrawViewWrapper() 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir aComeBackTimer.Stop();//@todo this should be done in destructor of base class 216*cdf0e10cSrcweir UnmarkAllObj();//necessary to aavoid a paint call during the destructor hierarchy 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir SdrPageView* DrawViewWrapper::GetPageView() const 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir SdrPageView* pSdrPageView = this->GetSdrPageView(); 222*cdf0e10cSrcweir return pSdrPageView; 223*cdf0e10cSrcweir }; 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir //virtual 226*cdf0e10cSrcweir void DrawViewWrapper::SetMarkHandles() 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir if( m_pMarkHandleProvider && m_pMarkHandleProvider->getMarkHandles( aHdl ) ) 229*cdf0e10cSrcweir return; 230*cdf0e10cSrcweir else 231*cdf0e10cSrcweir SdrView::SetMarkHandles(); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir SdrObject* pRet = NULL; 237*cdf0e10cSrcweir //sal_uLong nOptions =SDRSEARCH_DEEP|SDRSEARCH_PASS2BOUND|SDRSEARCH_PASS3NEAREST; 238*cdf0e10cSrcweir sal_uLong nOptions = SDRSEARCH_DEEP | SDRSEARCH_TESTMARKABLE; 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir SdrPageView* pSdrPageView = this->GetPageView(); 241*cdf0e10cSrcweir this->SdrView::PickObj(rPnt, lcl_getHitTolerance( this->GetFirstOutputDevice() ), pRet, pSdrPageView, nOptions); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir if( pRet ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir //ignore some special shapes 246*cdf0e10cSrcweir rtl::OUString aShapeName = pRet->GetName(); 247*cdf0e10cSrcweir if( aShapeName.match(C2U("PlotAreaIncludingAxes")) || aShapeName.match(C2U("PlotAreaExcludingAxes")) ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir pRet->SetMarkProtect( true ); 250*cdf0e10cSrcweir return getHitObject( rPnt ); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir //3d objects need a special treatment 254*cdf0e10cSrcweir //because the simple PickObj method is not accurate in this case for performance reasons 255*cdf0e10cSrcweir E3dObject* pE3d = dynamic_cast< E3dObject* >(pRet); 256*cdf0e10cSrcweir if( pE3d ) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir E3dScene* pScene = pE3d->GetScene(); 259*cdf0e10cSrcweir if( pScene ) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir // prepare result vector and call helper 262*cdf0e10cSrcweir ::std::vector< const E3dCompoundObject* > aHitList; 263*cdf0e10cSrcweir const basegfx::B2DPoint aHitPoint(rPnt.X(), rPnt.Y()); 264*cdf0e10cSrcweir getAllHit3DObjectsSortedFrontToBack(aHitPoint, *pScene, aHitList); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir if(aHitList.size()) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir // choose the frontmost hit 3D object of the scene 269*cdf0e10cSrcweir pRet = const_cast< E3dCompoundObject* >(aHitList[0]); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir return pRet; 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir void DrawViewWrapper::MarkObject( SdrObject* pObj ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir bool bFrameDragSingles = true;//true == green == surrounding handles 280*cdf0e10cSrcweir if(pObj) 281*cdf0e10cSrcweir pObj->SetMarkProtect(false); 282*cdf0e10cSrcweir if( m_pMarkHandleProvider ) 283*cdf0e10cSrcweir bFrameDragSingles = m_pMarkHandleProvider->getFrameDragSingles(); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir this->SetFrameDragSingles(bFrameDragSingles);//decide wether each single object should get handles 286*cdf0e10cSrcweir this->SdrView::MarkObj( pObj, this->GetPageView() ); 287*cdf0e10cSrcweir this->showMarkHandles(); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir void DrawViewWrapper::setMarkHandleProvider( MarkHandleProvider* pMarkHandleProvider ) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir m_pMarkHandleProvider = pMarkHandleProvider; 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir void DrawViewWrapper::CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* /* pRedirector */) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir svtools::ColorConfig aColorConfig; 299*cdf0e10cSrcweir Color aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); 300*cdf0e10cSrcweir this->SetApplicationBackgroundColor(aFillColor); 301*cdf0e10cSrcweir this->E3dView::CompleteRedraw( pOut, rReg ); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir SdrObject* DrawViewWrapper::getSelectedObject() const 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir SdrObject* pObj(NULL); 307*cdf0e10cSrcweir const SdrMarkList& rMarkList = this->GetMarkedObjectList(); 308*cdf0e10cSrcweir if(rMarkList.GetMarkCount() == 1) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 311*cdf0e10cSrcweir pObj = pMark->GetMarkedSdrObj(); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir return pObj; 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir SdrObject* DrawViewWrapper::getTextEditObject() const 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir SdrObject* pObj = this->getSelectedObject(); 319*cdf0e10cSrcweir SdrObject* pTextObj = NULL; 320*cdf0e10cSrcweir if( pObj && pObj->HasTextEdit()) 321*cdf0e10cSrcweir pTextObj = (SdrTextObj*)pObj; 322*cdf0e10cSrcweir return pTextObj; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir void DrawViewWrapper::attachParentReferenceDevice( const uno::Reference< frame::XModel > & xChartModel ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir OutputDevice * pParentRefDev( lcl_GetParentRefDevice( xChartModel )); 328*cdf0e10cSrcweir SdrOutliner * pOutliner( getOutliner()); 329*cdf0e10cSrcweir if( pParentRefDev && pOutliner ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir pOutliner->SetRefDevice( pParentRefDev ); 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir SdrOutliner* DrawViewWrapper::getOutliner() const 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir // lcl_initOutliner( m_apOutliner.get(), &GetModel()->GetDrawOutliner() ); 338*cdf0e10cSrcweir return m_apOutliner.get(); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir SfxItemSet DrawViewWrapper::getPositionAndSizeItemSetFromMarkedObject() const 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir SfxItemSet aFullSet( GetModel()->GetItemPool(), 344*cdf0e10cSrcweir SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE, 345*cdf0e10cSrcweir SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT, 346*cdf0e10cSrcweir SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS, 347*cdf0e10cSrcweir SID_ATTR_METRIC,SID_ATTR_METRIC, 348*cdf0e10cSrcweir 0); 349*cdf0e10cSrcweir SfxItemSet aGeoSet( E3dView::GetGeoAttrFromMarked() ); 350*cdf0e10cSrcweir aFullSet.Put( aGeoSet ); 351*cdf0e10cSrcweir aFullSet.Put( SfxUInt16Item(SID_ATTR_METRIC,static_cast< sal_uInt16 >( ConfigurationAccess::getFieldUnit()))); 352*cdf0e10cSrcweir return aFullSet; 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir SdrObject* DrawViewWrapper::getNamedSdrObject( const rtl::OUString& rName ) const 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir if(rName.getLength()==0) 358*cdf0e10cSrcweir return 0; 359*cdf0e10cSrcweir SdrPageView* pSdrPageView = this->GetPageView(); 360*cdf0e10cSrcweir if( pSdrPageView ) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir return DrawModelWrapper::getNamedSdrObject( rName, pSdrPageView->GetObjList() ); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir return 0; 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir bool DrawViewWrapper::IsObjectHit( SdrObject* pObj, const Point& rPnt ) const 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir if(pObj) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir Rectangle aRect(pObj->GetCurrentBoundRect()); 372*cdf0e10cSrcweir return aRect.IsInside(rPnt); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir return false; 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir void DrawViewWrapper::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir //prevent wrong reselection of objects 380*cdf0e10cSrcweir SdrModel* pSdrModel( this->GetModel() ); 381*cdf0e10cSrcweir if( pSdrModel && pSdrModel->isLocked() ) 382*cdf0e10cSrcweir return; 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint ); 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir //#i76053# do nothing when only changes on the hidden draw page were made ( e.g. when the symbols for the dialogs are created ) 387*cdf0e10cSrcweir SdrPageView* pSdrPageView = this->GetPageView(); 388*cdf0e10cSrcweir if( pSdrHint && pSdrPageView ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir if( pSdrPageView->GetPage() != pSdrHint->GetPage() ) 391*cdf0e10cSrcweir return; 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir E3dView::Notify(rBC, rHint); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir if( pSdrHint != 0 ) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir SdrHintKind eKind = pSdrHint->GetKind(); 399*cdf0e10cSrcweir if( eKind == HINT_BEGEDIT ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir // #i79965# remember map mode 402*cdf0e10cSrcweir OSL_ASSERT( ! m_bRestoreMapMode ); 403*cdf0e10cSrcweir OutputDevice* pOutDev = this->GetFirstOutputDevice(); 404*cdf0e10cSrcweir if( pOutDev ) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir m_aMapModeToRestore = pOutDev->GetMapMode(); 407*cdf0e10cSrcweir m_bRestoreMapMode = true; 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir else if( eKind == HINT_ENDEDIT ) 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir // #i79965# scroll back view when ending text edit 413*cdf0e10cSrcweir OSL_ASSERT( m_bRestoreMapMode ); 414*cdf0e10cSrcweir if( m_bRestoreMapMode ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir OutputDevice* pOutDev = this->GetFirstOutputDevice(); 417*cdf0e10cSrcweir if( pOutDev ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir pOutDev->SetMapMode( m_aMapModeToRestore ); 420*cdf0e10cSrcweir m_bRestoreMapMode = false; 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference< 428*cdf0e10cSrcweir drawing::XShape >& xShape ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir SdrObject* pRet = 0; 431*cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY ); 432*cdf0e10cSrcweir uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY ); 433*cdf0e10cSrcweir if(xUnoTunnel.is()&&xTypeProvider.is()) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() )); 436*cdf0e10cSrcweir if(pSvxShape) 437*cdf0e10cSrcweir pRet = pSvxShape->GetSdrObject(); 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir return pRet; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir //............................................................................. 443*cdf0e10cSrcweir } //namespace chart 444*cdf0e10cSrcweir //............................................................................. 445