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_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <svx/svdograf.hxx> 36*cdf0e10cSrcweir #include <svx/svdoole2.hxx> 37*cdf0e10cSrcweir #include <sfx2/app.hxx> 38*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "drawview.hxx" 41*cdf0e10cSrcweir #include "drwlayer.hxx" 42*cdf0e10cSrcweir #include "viewdata.hxx" 43*cdf0e10cSrcweir #include "dbfunc.hxx" 44*cdf0e10cSrcweir #include "document.hxx" 45*cdf0e10cSrcweir #include "userdat.hxx" 46*cdf0e10cSrcweir #include "tabvwsh.hxx" 47*cdf0e10cSrcweir #include "docsh.hxx" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir void ScIMapDlgSet( const Graphic& rGraphic, const ImageMap* pImageMap, 50*cdf0e10cSrcweir const TargetList* pTargetList, void* pEditingObj ); // imapwrap 51*cdf0e10cSrcweir sal_uInt16 ScIMapChildWindowId(); 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir // STATIC DATA ----------------------------------------------------------- 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir ScDrawView::ScDrawView( OutputDevice* pOut, ScViewData* pData ) : 56*cdf0e10cSrcweir FmFormView( pData->GetDocument()->GetDrawLayer(), pOut ), 57*cdf0e10cSrcweir pViewData( pData ), 58*cdf0e10cSrcweir pDev( pOut ), 59*cdf0e10cSrcweir pDoc( pData->GetDocument() ), 60*cdf0e10cSrcweir nTab( pData->GetTabNo() ), 61*cdf0e10cSrcweir pDropMarker( NULL ), 62*cdf0e10cSrcweir pDropMarkObj( NULL ), 63*cdf0e10cSrcweir bInConstruct( sal_True ) 64*cdf0e10cSrcweir //HMHbDisableHdl( sal_False ) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir // #i73602# Use default from the configuration 67*cdf0e10cSrcweir SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_Calc()); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir // #i74769#, #i75172# Use default from the configuration 70*cdf0e10cSrcweir SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_Calc()); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir Construct(); 73*cdf0e10cSrcweir } 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir // Verankerung setzen 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir void ScDrawView::SetAnchor( ScAnchorType eType ) 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir SdrObject* pObj = NULL; 80*cdf0e10cSrcweir if( AreObjectsMarked() ) 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir const SdrMarkList* pMark = &GetMarkedObjectList(); 83*cdf0e10cSrcweir sal_uLong nCount = pMark->GetMarkCount(); 84*cdf0e10cSrcweir for( sal_uLong i=0; i<nCount; i++ ) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir pObj = pMark->GetMark(i)->GetMarkedSdrObj(); 87*cdf0e10cSrcweir ScDrawLayer::SetAnchor( pObj, eType ); 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir if ( pViewData ) 91*cdf0e10cSrcweir pViewData->GetDocShell()->SetDrawModified(); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir ScAnchorType ScDrawView::GetAnchor() const 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir sal_Bool bPage = sal_False; 98*cdf0e10cSrcweir sal_Bool bCell = sal_False; 99*cdf0e10cSrcweir const SdrObject* pObj = NULL; 100*cdf0e10cSrcweir if( AreObjectsMarked() ) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir const SdrMarkList* pMark = &GetMarkedObjectList(); 103*cdf0e10cSrcweir sal_uLong nCount = pMark->GetMarkCount(); 104*cdf0e10cSrcweir Point p0; 105*cdf0e10cSrcweir for( sal_uLong i=0; i<nCount; i++ ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir pObj = pMark->GetMark(i)->GetMarkedSdrObj(); 108*cdf0e10cSrcweir if( ScDrawLayer::GetAnchor( pObj ) == SCA_CELL ) 109*cdf0e10cSrcweir bCell =sal_True; 110*cdf0e10cSrcweir else 111*cdf0e10cSrcweir bPage = sal_True; 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir if( bPage && !bCell ) 115*cdf0e10cSrcweir return SCA_PAGE; 116*cdf0e10cSrcweir if( !bPage && bCell ) 117*cdf0e10cSrcweir return SCA_CELL; 118*cdf0e10cSrcweir return SCA_DONTKNOW; 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir void __EXPORT ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir if (rHint.ISA(ScTabDeletedHint)) // Tabelle geloescht 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir SCTAB nDelTab = ((ScTabDeletedHint&)rHint).GetTab(); 126*cdf0e10cSrcweir if (ValidTab(nDelTab)) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir // used to be: HidePagePgNum(nDelTab) - hide only if the deleted sheet is shown here 129*cdf0e10cSrcweir if ( nDelTab == nTab ) 130*cdf0e10cSrcweir HideSdrPage(); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir else if (rHint.ISA(ScTabSizeChangedHint)) // Groesse geaendert 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir if ( nTab == ((ScTabSizeChangedHint&)rHint).GetTab() ) 136*cdf0e10cSrcweir UpdateWorkArea(); 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir else 139*cdf0e10cSrcweir FmFormView::Notify( rBC,rHint ); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir void ScDrawView::UpdateIMap( SdrObject* pObj ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir if ( pViewData && 145*cdf0e10cSrcweir pViewData->GetViewShell()->GetViewFrame()->HasChildWindow( ScIMapChildWindowId() ) && 146*cdf0e10cSrcweir pObj && ( pObj->ISA(SdrGrafObj) || pObj->ISA(SdrOle2Obj) ) ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir Graphic aGraphic; 149*cdf0e10cSrcweir TargetList aTargetList; 150*cdf0e10cSrcweir ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pObj ); 151*cdf0e10cSrcweir const ImageMap* pImageMap = NULL; 152*cdf0e10cSrcweir if ( pIMapInfo ) 153*cdf0e10cSrcweir pImageMap = &pIMapInfo->GetImageMap(); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir // Target-Liste besorgen 156*cdf0e10cSrcweir pViewData->GetViewShell()->GetViewFrame()->GetTargetList( aTargetList ); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // Grafik vom Objekt besorgen 159*cdf0e10cSrcweir if ( pObj->ISA( SdrGrafObj ) ) 160*cdf0e10cSrcweir aGraphic = ( (SdrGrafObj*) pObj )->GetGraphic(); 161*cdf0e10cSrcweir else 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir Graphic* pGraphic = ((const SdrOle2Obj*) pObj )->GetGraphic(); 164*cdf0e10cSrcweir if ( pGraphic ) 165*cdf0e10cSrcweir aGraphic = *pGraphic; 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir ScIMapDlgSet( aGraphic, pImageMap, &aTargetList, pObj ); // aus imapwrap 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir // TargetListe kann von uns wieder geloescht werden 171*cdf0e10cSrcweir String* pEntry = aTargetList.First(); 172*cdf0e10cSrcweir while( pEntry ) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir delete pEntry; 175*cdf0e10cSrcweir pEntry = aTargetList.Next(); 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir 183