1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 32 33 // INCLUDE --------------------------------------------------------------- 34 35 #include <svx/svdograf.hxx> 36 #include <svx/svdoole2.hxx> 37 #include <sfx2/app.hxx> 38 #include <sfx2/viewfrm.hxx> 39 40 #include "drawview.hxx" 41 #include "drwlayer.hxx" 42 #include "viewdata.hxx" 43 #include "dbfunc.hxx" 44 #include "document.hxx" 45 #include "userdat.hxx" 46 #include "tabvwsh.hxx" 47 #include "docsh.hxx" 48 49 void ScIMapDlgSet( const Graphic& rGraphic, const ImageMap* pImageMap, 50 const TargetList* pTargetList, void* pEditingObj ); // imapwrap 51 sal_uInt16 ScIMapChildWindowId(); 52 53 // STATIC DATA ----------------------------------------------------------- 54 55 ScDrawView::ScDrawView( OutputDevice* pOut, ScViewData* pData ) : 56 FmFormView( pData->GetDocument()->GetDrawLayer(), pOut ), 57 pViewData( pData ), 58 pDev( pOut ), 59 pDoc( pData->GetDocument() ), 60 nTab( pData->GetTabNo() ), 61 pDropMarker( NULL ), 62 pDropMarkObj( NULL ), 63 bInConstruct( sal_True ) 64 //HMHbDisableHdl( sal_False ) 65 { 66 // #i73602# Use default from the configuration 67 SetBufferedOverlayAllowed(getOptionsDrawinglayer().IsOverlayBuffer_Calc()); 68 69 // #i74769#, #i75172# Use default from the configuration 70 SetBufferedOutputAllowed(getOptionsDrawinglayer().IsPaintBuffer_Calc()); 71 72 Construct(); 73 } 74 75 // Verankerung setzen 76 77 void ScDrawView::SetAnchor( ScAnchorType eType ) 78 { 79 SdrObject* pObj = NULL; 80 if( AreObjectsMarked() ) 81 { 82 const SdrMarkList* pMark = &GetMarkedObjectList(); 83 sal_uLong nCount = pMark->GetMarkCount(); 84 for( sal_uLong i=0; i<nCount; i++ ) 85 { 86 pObj = pMark->GetMark(i)->GetMarkedSdrObj(); 87 ScDrawLayer::SetAnchor( pObj, eType ); 88 } 89 90 if ( pViewData ) 91 pViewData->GetDocShell()->SetDrawModified(); 92 } 93 } 94 95 ScAnchorType ScDrawView::GetAnchor() const 96 { 97 sal_Bool bPage = sal_False; 98 sal_Bool bCell = sal_False; 99 const SdrObject* pObj = NULL; 100 if( AreObjectsMarked() ) 101 { 102 const SdrMarkList* pMark = &GetMarkedObjectList(); 103 sal_uLong nCount = pMark->GetMarkCount(); 104 Point p0; 105 for( sal_uLong i=0; i<nCount; i++ ) 106 { 107 pObj = pMark->GetMark(i)->GetMarkedSdrObj(); 108 if( ScDrawLayer::GetAnchor( pObj ) == SCA_CELL ) 109 bCell =sal_True; 110 else 111 bPage = sal_True; 112 } 113 } 114 if( bPage && !bCell ) 115 return SCA_PAGE; 116 if( !bPage && bCell ) 117 return SCA_CELL; 118 return SCA_DONTKNOW; 119 } 120 121 void __EXPORT ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 122 { 123 if (rHint.ISA(ScTabDeletedHint)) // Tabelle geloescht 124 { 125 SCTAB nDelTab = ((ScTabDeletedHint&)rHint).GetTab(); 126 if (ValidTab(nDelTab)) 127 { 128 // used to be: HidePagePgNum(nDelTab) - hide only if the deleted sheet is shown here 129 if ( nDelTab == nTab ) 130 HideSdrPage(); 131 } 132 } 133 else if (rHint.ISA(ScTabSizeChangedHint)) // Groesse geaendert 134 { 135 if ( nTab == ((ScTabSizeChangedHint&)rHint).GetTab() ) 136 UpdateWorkArea(); 137 } 138 else 139 FmFormView::Notify( rBC,rHint ); 140 } 141 142 void ScDrawView::UpdateIMap( SdrObject* pObj ) 143 { 144 if ( pViewData && 145 pViewData->GetViewShell()->GetViewFrame()->HasChildWindow( ScIMapChildWindowId() ) && 146 pObj && ( pObj->ISA(SdrGrafObj) || pObj->ISA(SdrOle2Obj) ) ) 147 { 148 Graphic aGraphic; 149 TargetList aTargetList; 150 ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pObj ); 151 const ImageMap* pImageMap = NULL; 152 if ( pIMapInfo ) 153 pImageMap = &pIMapInfo->GetImageMap(); 154 155 // Target-Liste besorgen 156 pViewData->GetViewShell()->GetViewFrame()->GetTargetList( aTargetList ); 157 158 // Grafik vom Objekt besorgen 159 if ( pObj->ISA( SdrGrafObj ) ) 160 aGraphic = ( (SdrGrafObj*) pObj )->GetGraphic(); 161 else 162 { 163 Graphic* pGraphic = ((const SdrOle2Obj*) pObj )->GetGraphic(); 164 if ( pGraphic ) 165 aGraphic = *pGraphic; 166 } 167 168 ScIMapDlgSet( aGraphic, pImageMap, &aTargetList, pObj ); // aus imapwrap 169 170 // TargetListe kann von uns wieder geloescht werden 171 String* pEntry = aTargetList.First(); 172 while( pEntry ) 173 { 174 delete pEntry; 175 pEntry = aTargetList.Next(); 176 } 177 } 178 } 179 180 181 182 183