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