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 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 35*cdf0e10cSrcweir #include <svx/svditer.hxx> 36*cdf0e10cSrcweir #include <svx/svdograf.hxx> 37*cdf0e10cSrcweir #include <svx/svdogrp.hxx> 38*cdf0e10cSrcweir #include <svx/svdoole2.hxx> 39*cdf0e10cSrcweir #include <svx/svdpage.hxx> 40*cdf0e10cSrcweir #include <svx/svdundo.hxx> 41*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 42*cdf0e10cSrcweir #include <tools/urlobj.hxx> 43*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include "drawview.hxx" 46*cdf0e10cSrcweir #include "global.hxx" 47*cdf0e10cSrcweir #include "drwlayer.hxx" 48*cdf0e10cSrcweir #include "viewdata.hxx" 49*cdf0e10cSrcweir #include "document.hxx" 50*cdf0e10cSrcweir #include "docsh.hxx" 51*cdf0e10cSrcweir #include "drwtrans.hxx" 52*cdf0e10cSrcweir #include "transobj.hxx" // SetDrawClipDoc 53*cdf0e10cSrcweir #include "drawutil.hxx" 54*cdf0e10cSrcweir #include "scmod.hxx" 55*cdf0e10cSrcweir #include "globstr.hrc" 56*cdf0e10cSrcweir #include "chartarr.hxx" 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir using namespace com::sun::star; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir // STATIC DATA ----------------------------------------------------------- 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir Point aDragStartDiff; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir // ----------------------------------------------------------------------- 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir //! welche Funktionen aus drawview/drawvie4 muessen wirklich ohne Optimierung sein? 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir #ifdef _MSC_VER 69*cdf0e10cSrcweir #pragma optimize ( "", off ) 70*cdf0e10cSrcweir #endif 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir // ----------------------------------------------------------------------- 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir void lcl_CheckOle( const SdrMarkList& rMarkList, sal_Bool& rAnyOle, sal_Bool& rOneOle ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir rAnyOle = rOneOle = sal_False; 77*cdf0e10cSrcweir sal_uLong nCount = rMarkList.GetMarkCount(); 78*cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(i); 81*cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 82*cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 83*cdf0e10cSrcweir if (nSdrObjKind == OBJ_OLE2) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir rAnyOle = sal_True; 86*cdf0e10cSrcweir rOneOle = (nCount == 1); 87*cdf0e10cSrcweir break; 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir else if ( pObj->ISA(SdrObjGroup) ) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir SdrObjListIter aIter( *pObj, IM_DEEPNOGROUPS ); 92*cdf0e10cSrcweir SdrObject* pSubObj = aIter.Next(); 93*cdf0e10cSrcweir while (pSubObj) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir if ( pSubObj->GetObjIdentifier() == OBJ_OLE2 ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir rAnyOle = sal_True; 98*cdf0e10cSrcweir // rOneOle remains sal_False - a group isn't treated like a single OLE object 99*cdf0e10cSrcweir return; 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir pSubObj = aIter.Next(); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir #if 0 108*cdf0e10cSrcweir void lcl_RefreshChartData( SdrModel* pModel, ScDocument* pSourceDoc ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir sal_uInt16 nPages = pModel->GetPageCount(); 111*cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nPages; nTab++) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir SdrPage* pPage = pModel->GetPage(nTab); 114*cdf0e10cSrcweir SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); 115*cdf0e10cSrcweir SdrObject* pObject = aIter.Next(); 116*cdf0e10cSrcweir while (pObject) 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir SvInPlaceObjectRef aIPObj = ((SdrOle2Obj*)pObject)->GetObjRef(); 121*cdf0e10cSrcweir if ( aIPObj.Is() && SotExchange::IsChart( aIPObj->GetStorage()->GetClassName() ) ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir SchMemChart* pOldData = SchDLL::GetChartData(aIPObj); 124*cdf0e10cSrcweir if ( pOldData ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir // create data from source document 127*cdf0e10cSrcweir ScChartArray aArray( pSourceDoc, *pOldData ); 128*cdf0e10cSrcweir if ( aArray.IsValid() ) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir SchMemChart* pNewData = aArray.CreateMemChart(); 131*cdf0e10cSrcweir SchDLL::Update( aIPObj, pNewData ); 132*cdf0e10cSrcweir delete pNewData; 133*cdf0e10cSrcweir ((SdrOle2Obj*)pObject)->GetNewReplacement(); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir pObject = aIter.Next(); 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir #endif 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir sal_Bool ScDrawView::BeginDrag( Window* pWindow, const Point& rStartPos ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir if ( AreObjectsMarked() ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir BrkAction(); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir Rectangle aMarkedRect = GetAllMarkedRect(); 154*cdf0e10cSrcweir Region aRegion( aMarkedRect ); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir aDragStartDiff = rStartPos - aMarkedRect.TopLeft(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir sal_Bool bAnyOle, bOneOle; 159*cdf0e10cSrcweir const SdrMarkList& rMarkList = GetMarkedObjectList(); 160*cdf0e10cSrcweir lcl_CheckOle( rMarkList, bAnyOle, bOneOle ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir ScDocShellRef aDragShellRef; 163*cdf0e10cSrcweir if (bAnyOle) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately 166*cdf0e10cSrcweir aDragShellRef->DoInitNew(NULL); 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); 169*cdf0e10cSrcweir SdrModel* pModel = GetAllMarkedModel(); 170*cdf0e10cSrcweir ScDrawLayer::SetGlobalDrawPersist(NULL); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // Charts now always copy their data in addition to the source reference, so 173*cdf0e10cSrcweir // there's no need to call SchDLL::Update for the charts in the clipboard doc. 174*cdf0e10cSrcweir // Update with the data (including NumberFormatter) from the live document would 175*cdf0e10cSrcweir // also store the NumberFormatter in the clipboard chart (#88749#) 176*cdf0e10cSrcweir // lcl_RefreshChartData( pModel, pViewData->GetDocument() ); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir ScDocShell* pDocSh = pViewData->GetDocShell(); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 181*cdf0e10cSrcweir pDocSh->FillTransferableObjectDescriptor( aObjDesc ); 182*cdf0e10cSrcweir aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); 183*cdf0e10cSrcweir // maSize is set in ScDrawTransferObj ctor 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc ); 186*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir pTransferObj->SetDrawPersist( &aDragShellRef ); // keep persist for ole objects alive 189*cdf0e10cSrcweir pTransferObj->SetDragSource( this ); // copies selection 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir SC_MOD()->SetDragObject( NULL, pTransferObj ); // for internal D&D 192*cdf0e10cSrcweir pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir return bReturn; 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir void ScDrawView::DoCopy() 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir sal_Bool bAnyOle, bOneOle; 201*cdf0e10cSrcweir const SdrMarkList& rMarkList = GetMarkedObjectList(); 202*cdf0e10cSrcweir lcl_CheckOle( rMarkList, bAnyOle, bOneOle ); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // update ScGlobal::pDrawClipDocShellRef 205*cdf0e10cSrcweir ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) ); 206*cdf0e10cSrcweir SdrModel* pModel = GetAllMarkedModel(); 207*cdf0e10cSrcweir ScDrawLayer::SetGlobalDrawPersist(NULL); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir // Charts now always copy their data in addition to the source reference, so 210*cdf0e10cSrcweir // there's no need to call SchDLL::Update for the charts in the clipboard doc. 211*cdf0e10cSrcweir // Update with the data (including NumberFormatter) from the live document would 212*cdf0e10cSrcweir // also store the NumberFormatter in the clipboard chart (#88749#) 213*cdf0e10cSrcweir // lcl_RefreshChartData( pModel, pViewData->GetDocument() ); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir ScDocShell* pDocSh = pViewData->GetDocShell(); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 218*cdf0e10cSrcweir pDocSh->FillTransferableObjectDescriptor( aObjDesc ); 219*cdf0e10cSrcweir aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); 220*cdf0e10cSrcweir // maSize is set in ScDrawTransferObj ctor 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc ); 223*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir if ( ScGlobal::pDrawClipDocShellRef ) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir pTransferObj->SetDrawPersist( &(*ScGlobal::pDrawClipDocShellRef) ); // keep persist for ole objects alive 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir pTransferObj->CopyToClipboard( pViewData->GetActiveWin() ); // system clipboard 231*cdf0e10cSrcweir SC_MOD()->SetClipObject( NULL, pTransferObj ); // internal clipboard 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable() 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir sal_Bool bAnyOle, bOneOle; 237*cdf0e10cSrcweir const SdrMarkList& rMarkList = GetMarkedObjectList(); 238*cdf0e10cSrcweir lcl_CheckOle( rMarkList, bAnyOle, bOneOle ); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir // update ScGlobal::pDrawClipDocShellRef 241*cdf0e10cSrcweir ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) ); 242*cdf0e10cSrcweir SdrModel* pModel = GetAllMarkedModel(); 243*cdf0e10cSrcweir ScDrawLayer::SetGlobalDrawPersist(NULL); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir // Charts now always copy their data in addition to the source reference, so 246*cdf0e10cSrcweir // there's no need to call SchDLL::Update for the charts in the clipboard doc. 247*cdf0e10cSrcweir // Update with the data (including NumberFormatter) from the live document would 248*cdf0e10cSrcweir // also store the NumberFormatter in the clipboard chart (#88749#) 249*cdf0e10cSrcweir // lcl_RefreshChartData( pModel, pViewData->GetDocument() ); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir ScDocShell* pDocSh = pViewData->GetDocShell(); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir TransferableObjectDescriptor aObjDesc; 254*cdf0e10cSrcweir pDocSh->FillTransferableObjectDescriptor( aObjDesc ); 255*cdf0e10cSrcweir aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); 256*cdf0e10cSrcweir // maSize is set in ScDrawTransferObj ctor 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc ); 259*cdf0e10cSrcweir uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir if ( ScGlobal::pDrawClipDocShellRef ) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir pTransferObj->SetDrawPersist( &(*ScGlobal::pDrawClipDocShellRef) ); // keep persist for ole objects alive 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir return xTransferable; 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir // Korrektur fuer 100% berechnen, unabhaengig von momentanen Einstellungen 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir Point aLogic = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP ); 274*cdf0e10cSrcweir double nPPTX = ScGlobal::nScreenPPTX; 275*cdf0e10cSrcweir double nPPTY = ScGlobal::nScreenPPTY; 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir if (pViewData) 278*cdf0e10cSrcweir nPPTX /= pViewData->GetDocShell()->GetOutputFactor(); 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir SCCOL nEndCol = 0; 281*cdf0e10cSrcweir SCROW nEndRow = 0; 282*cdf0e10cSrcweir pDoc->GetTableArea( nTab, nEndCol, nEndRow ); 283*cdf0e10cSrcweir if (nEndCol<20) 284*cdf0e10cSrcweir nEndCol = 20; 285*cdf0e10cSrcweir if (nEndRow<20) 286*cdf0e10cSrcweir nEndRow = 20; 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir Fraction aZoom(1,1); 289*cdf0e10cSrcweir ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom, 290*cdf0e10cSrcweir nPPTX, nPPTY, rFractX,rFractY ); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir void ScDrawView::SetMarkedOriginalSize() 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*GetModel()); 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir const SdrMarkList& rMarkList = GetMarkedObjectList(); 298*cdf0e10cSrcweir long nDone = 0; 299*cdf0e10cSrcweir sal_uLong nCount = rMarkList.GetMarkCount(); 300*cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 303*cdf0e10cSrcweir sal_uInt16 nIdent = pObj->GetObjIdentifier(); 304*cdf0e10cSrcweir sal_Bool bDo = sal_False; 305*cdf0e10cSrcweir Size aOriginalSize; 306*cdf0e10cSrcweir if (nIdent == OBJ_OLE2) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir // TODO/LEAN: working with visual area can switch object to running state 309*cdf0e10cSrcweir uno::Reference < embed::XEmbeddedObject > xObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY ); 310*cdf0e10cSrcweir if ( xObj.is() ) // #121612# NULL for an invalid object that couldn't be loaded 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect(); 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir if ( nAspect == embed::Aspects::MSOLE_ICON ) 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir MapMode aMapMode( MAP_100TH_MM ); 317*cdf0e10cSrcweir aOriginalSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMapMode ); 318*cdf0e10cSrcweir bDo = sal_True; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir else 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( ((SdrOle2Obj*)pObj)->GetAspect() ) ); 323*cdf0e10cSrcweir awt::Size aSz; 324*cdf0e10cSrcweir try 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir aSz = xObj->getVisualAreaSize( ((SdrOle2Obj*)pObj)->GetAspect() ); 327*cdf0e10cSrcweir aOriginalSize = OutputDevice::LogicToLogic( 328*cdf0e10cSrcweir Size( aSz.Width, aSz.Height ), 329*cdf0e10cSrcweir aUnit, MAP_100TH_MM ); 330*cdf0e10cSrcweir bDo = sal_True; 331*cdf0e10cSrcweir } catch( embed::NoVisualAreaSizeException& ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir OSL_ENSURE( sal_False, "Can't get the original size of the object!" ); 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir else if (nIdent == OBJ_GRAF) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir const Graphic& rGraphic = ((SdrGrafObj*)pObj)->GetGraphic(); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir MapMode aSourceMap = rGraphic.GetPrefMapMode(); 343*cdf0e10cSrcweir MapMode aDestMap( MAP_100TH_MM ); 344*cdf0e10cSrcweir if (aSourceMap.GetMapUnit() == MAP_PIXEL) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir // Pixel-Korrektur beruecksichtigen, damit Bitmap auf dem Bildschirm stimmt 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir Fraction aNormScaleX, aNormScaleY; 349*cdf0e10cSrcweir CalcNormScale( aNormScaleX, aNormScaleY ); 350*cdf0e10cSrcweir aDestMap.SetScaleX(aNormScaleX); 351*cdf0e10cSrcweir aDestMap.SetScaleY(aNormScaleY); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir if (pViewData) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir Window* pActWin = pViewData->GetActiveWin(); 356*cdf0e10cSrcweir if (pActWin) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir aOriginalSize = pActWin->LogicToLogic( 359*cdf0e10cSrcweir rGraphic.GetPrefSize(), &aSourceMap, &aDestMap ); 360*cdf0e10cSrcweir bDo = sal_True; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir if ( bDo ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir Rectangle aDrawRect = pObj->GetLogicRect(); 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir pUndoGroup->AddAction( new SdrUndoGeoObj( *pObj ) ); 370*cdf0e10cSrcweir pObj->Resize( aDrawRect.TopLeft(), Fraction( aOriginalSize.Width(), aDrawRect.GetWidth() ), 371*cdf0e10cSrcweir Fraction( aOriginalSize.Height(), aDrawRect.GetHeight() ) ); 372*cdf0e10cSrcweir ++nDone; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir if (nDone) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir pUndoGroup->SetComment(ScGlobal::GetRscString( STR_UNDO_ORIGINALSIZE )); 379*cdf0e10cSrcweir ScDocShell* pDocSh = pViewData->GetDocShell(); 380*cdf0e10cSrcweir pDocSh->GetUndoManager()->AddUndoAction(pUndoGroup); 381*cdf0e10cSrcweir pDocSh->SetDrawModified(); 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir else 384*cdf0e10cSrcweir delete pUndoGroup; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir #ifdef _MSC_VER 389*cdf0e10cSrcweir #pragma optimize ( "", on ) 390*cdf0e10cSrcweir #endif 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir 395