1b3f79822SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file 5b3f79822SAndrew Rist * distributed with this work for additional information 6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the 8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance 9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at 10b3f79822SAndrew Rist * 11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12b3f79822SAndrew Rist * 13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing, 14b3f79822SAndrew Rist * software distributed under the License is distributed on an 15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the 17b3f79822SAndrew Rist * specific language governing permissions and limitations 18b3f79822SAndrew Rist * under the License. 19b3f79822SAndrew Rist * 20b3f79822SAndrew Rist *************************************************************/ 21b3f79822SAndrew Rist 22b3f79822SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sc.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "scitems.hxx" 28cdf0e10cSrcweir #include <editeng/eeitem.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <svx/svdoutl.hxx> 31cdf0e10cSrcweir #include <svx/svdotext.hxx> 32cdf0e10cSrcweir #include <svx/svdpagv.hxx> 33cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 34cdf0e10cSrcweir #include <sfx2/bindings.hxx> 35cdf0e10cSrcweir #include <svl/ptitem.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include "tabvwsh.hxx" 38cdf0e10cSrcweir #include "gridwin.hxx" 39cdf0e10cSrcweir #include "dbfunc.hxx" 40cdf0e10cSrcweir #include "viewdata.hxx" 41cdf0e10cSrcweir #include "output.hxx" 42cdf0e10cSrcweir #include "drawview.hxx" 43cdf0e10cSrcweir #include "fupoor.hxx" 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include "drawutil.hxx" 46cdf0e10cSrcweir #include "document.hxx" 47cdf0e10cSrcweir #include "drwlayer.hxx" 48cdf0e10cSrcweir #include <vcl/svapp.hxx> 49cdf0e10cSrcweir 50cdf0e10cSrcweir // ----------------------------------------------------------------------- 51cdf0e10cSrcweir 52cdf0e10cSrcweir sal_Bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) 53cdf0e10cSrcweir { 54cdf0e10cSrcweir sal_Bool bRet = sal_False; 55cdf0e10cSrcweir FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); 56cdf0e10cSrcweir if (pDraw && !pViewData->IsRefMode()) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir pDraw->SetWindow( this ); 59cdf0e10cSrcweir Point aLogicPos = PixelToLogic(rMEvt.GetPosPixel()); 60cdf0e10cSrcweir if ( pDraw->IsDetectiveHit( aLogicPos ) ) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir // auf Detektiv-Pfeilen gar nichts (Doppelklick wird bei ButtonUp ausgewertet) 63cdf0e10cSrcweir bRet = sal_True; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir else 66cdf0e10cSrcweir { 67cdf0e10cSrcweir bRet = pDraw->MouseButtonDown( rMEvt ); 68cdf0e10cSrcweir if ( bRet ) 69cdf0e10cSrcweir UpdateStatusPosSize(); 70cdf0e10cSrcweir } 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir // bei rechter Taste Draw-Aktion abbrechen 74cdf0e10cSrcweir 75cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 76cdf0e10cSrcweir if ( pDrView && !rMEvt.IsLeft() && !bRet ) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir pDrView->BrkAction(); 79cdf0e10cSrcweir bRet = sal_True; 80cdf0e10cSrcweir } 81cdf0e10cSrcweir return bRet; 82cdf0e10cSrcweir } 83cdf0e10cSrcweir 84cdf0e10cSrcweir sal_Bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir ScViewFunc* pView = pViewData->GetView(); 87cdf0e10cSrcweir sal_Bool bRet = sal_False; 88cdf0e10cSrcweir FuPoor* pDraw = pView->GetDrawFuncPtr(); 89cdf0e10cSrcweir if (pDraw && !pViewData->IsRefMode()) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir pDraw->SetWindow( this ); 92cdf0e10cSrcweir bRet = pDraw->MouseButtonUp( rMEvt ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // execute "format paint brush" for drawing objects 95cdf0e10cSrcweir SfxItemSet* pDrawBrush = pView->GetDrawBrushSet(); 96cdf0e10cSrcweir if ( pDrawBrush ) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 99cdf0e10cSrcweir if ( pDrView ) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir sal_Bool bReplaceAll = sal_True; 102cdf0e10cSrcweir pDrView->SetAttrToMarked(*pDrawBrush, bReplaceAll); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir if ( !pView->IsPaintBrushLocked() ) 106cdf0e10cSrcweir pView->ResetBrushDocument(); // end paint brush mode if not locked 107cdf0e10cSrcweir } 108cdf0e10cSrcweir } 109cdf0e10cSrcweir 110cdf0e10cSrcweir return bRet; 111cdf0e10cSrcweir } 112cdf0e10cSrcweir 113cdf0e10cSrcweir sal_Bool ScGridWindow::DrawMouseMove(const MouseEvent& rMEvt) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); 116cdf0e10cSrcweir if (pDraw && !pViewData->IsRefMode()) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir pDraw->SetWindow( this ); 119cdf0e10cSrcweir sal_Bool bRet = pDraw->MouseMove( rMEvt ); 120cdf0e10cSrcweir if ( bRet ) 121cdf0e10cSrcweir UpdateStatusPosSize(); 122cdf0e10cSrcweir return bRet; 123cdf0e10cSrcweir } 124cdf0e10cSrcweir else 125cdf0e10cSrcweir { 126cdf0e10cSrcweir SetPointer( Pointer( POINTER_ARROW ) ); 127cdf0e10cSrcweir return sal_False; 128cdf0e10cSrcweir } 129cdf0e10cSrcweir } 130cdf0e10cSrcweir 131cdf0e10cSrcweir void ScGridWindow::DrawEndAction() 132cdf0e10cSrcweir { 133cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 134cdf0e10cSrcweir if ( pDrView && pDrView->IsAction() ) 135cdf0e10cSrcweir pDrView->BrkAction(); 136cdf0e10cSrcweir 137cdf0e10cSrcweir FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); 138cdf0e10cSrcweir if (pDraw) 139cdf0e10cSrcweir pDraw->StopDragTimer(); 140cdf0e10cSrcweir 141cdf0e10cSrcweir // ReleaseMouse beim Aufruf 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir sal_Bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 147cdf0e10cSrcweir FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); 148cdf0e10cSrcweir if (pDrView && pDraw && !pViewData->IsRefMode()) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir pDraw->SetWindow( this ); 151cdf0e10cSrcweir sal_uInt8 nUsed = pDraw->Command( rCEvt ); 152cdf0e10cSrcweir if( nUsed == SC_CMD_USED ) 153cdf0e10cSrcweir nButtonDown = 0; // MouseButtonUp wird verschluckt... 154cdf0e10cSrcweir if( nUsed || pDrView->IsAction() ) 155cdf0e10cSrcweir return sal_True; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir 158cdf0e10cSrcweir return sal_False; 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir sal_Bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 164cdf0e10cSrcweir FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); 165cdf0e10cSrcweir if (pDrView && pDraw && !pViewData->IsRefMode()) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir pDraw->SetWindow( this ); 168cdf0e10cSrcweir sal_Bool bOldMarked = pDrView->AreObjectsMarked(); 169cdf0e10cSrcweir if (pDraw->KeyInput( rKEvt )) 170cdf0e10cSrcweir { 171cdf0e10cSrcweir sal_Bool bLeaveDraw = sal_False; 172cdf0e10cSrcweir sal_Bool bUsed = sal_True; 173cdf0e10cSrcweir sal_Bool bNewMarked = pDrView->AreObjectsMarked(); 174cdf0e10cSrcweir if ( !pViewData->GetView()->IsDrawSelMode() ) 175cdf0e10cSrcweir if ( !bNewMarked ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir pViewData->GetViewShell()->SetDrawShell( sal_False ); 178cdf0e10cSrcweir bLeaveDraw = sal_True; 179cdf0e10cSrcweir if ( !bOldMarked && 180cdf0e10cSrcweir rKEvt.GetKeyCode().GetCode() == KEY_DELETE ) 181cdf0e10cSrcweir bUsed = sal_False; // nichts geloescht 182*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 183*0deba7fbSSteve Yin if(bOldMarked) 184*0deba7fbSSteve Yin GetFocus(); 185*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 186cdf0e10cSrcweir } 187cdf0e10cSrcweir if (!bLeaveDraw) 188cdf0e10cSrcweir UpdateStatusPosSize(); // #108137# for moving/resizing etc. by keyboard 189cdf0e10cSrcweir return bUsed; 190cdf0e10cSrcweir } 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir return sal_False; 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sal_uLong nLayer ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir // #109985# 199cdf0e10cSrcweir const ScViewOptions& rOpts = pViewData->GetOptions(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir // use new flags at SdrPaintView for hiding objects 202cdf0e10cSrcweir const bool bDrawOle(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_OLE)); 203cdf0e10cSrcweir const bool bDrawChart(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_CHART)); 204cdf0e10cSrcweir const bool bDrawDraw(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_DRAW)); 205cdf0e10cSrcweir 206cdf0e10cSrcweir if(bDrawOle || bDrawChart || bDrawDraw) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 209cdf0e10cSrcweir 210cdf0e10cSrcweir if(pDrView) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir pDrView->setHideOle(!bDrawOle); 213cdf0e10cSrcweir pDrView->setHideChart(!bDrawChart); 214cdf0e10cSrcweir pDrView->setHideDraw(!bDrawDraw); 215cdf0e10cSrcweir pDrView->setHideFormControl(!bDrawDraw); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir if(SC_UPDATE_CHANGED == eMode) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir rOutputData.DrawingSingle((sal_uInt16)nLayer); 221cdf0e10cSrcweir } 222cdf0e10cSrcweir else 223cdf0e10cSrcweir { 224cdf0e10cSrcweir rOutputData.DrawSelectiveObjects((sal_uInt16)nLayer); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir } 227cdf0e10cSrcweir } 228cdf0e10cSrcweir 229cdf0e10cSrcweir void ScGridWindow::DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev ) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir // Draw-Gitterlinien 232cdf0e10cSrcweir 233cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 234cdf0e10cSrcweir if ( pDrView && pDrView->IsGridVisible() ) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir SdrPageView* pPV = pDrView->GetSdrPageView(); 237cdf0e10cSrcweir DBG_ASSERT(pPV, "keine PageView"); 238cdf0e10cSrcweir if (pPV) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir pContentDev->SetLineColor(COL_GRAY); 241cdf0e10cSrcweir 242cdf0e10cSrcweir pPV->DrawPageViewGrid( *pContentDev, rDrawingRect ); 243cdf0e10cSrcweir } 244cdf0e10cSrcweir } 245cdf0e10cSrcweir } 246cdf0e10cSrcweir 247cdf0e10cSrcweir MapMode ScGridWindow::GetDrawMapMode( sal_Bool bForce ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 250cdf0e10cSrcweir SCTAB nTab = pViewData->GetTabNo(); 251cdf0e10cSrcweir sal_Bool bNegativePage = pDoc->IsNegativePage( nTab ); 252cdf0e10cSrcweir 253cdf0e10cSrcweir MapMode aDrawMode = pViewData->GetLogicMode(); 254cdf0e10cSrcweir 255cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 256cdf0e10cSrcweir if ( pDrView || bForce ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir Fraction aScaleX; 259cdf0e10cSrcweir Fraction aScaleY; 260cdf0e10cSrcweir if (pDrView) 261cdf0e10cSrcweir pDrView->GetScale( aScaleX, aScaleY ); 262cdf0e10cSrcweir else 263cdf0e10cSrcweir { 264cdf0e10cSrcweir SCCOL nEndCol = 0; 265cdf0e10cSrcweir SCROW nEndRow = 0; 266cdf0e10cSrcweir pDoc->GetTableArea( nTab, nEndCol, nEndRow ); 267cdf0e10cSrcweir if (nEndCol<20) nEndCol = 20; 268cdf0e10cSrcweir if (nEndRow<20) nEndRow = 20; 269cdf0e10cSrcweir ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this, 270cdf0e10cSrcweir pViewData->GetZoomX(),pViewData->GetZoomY(), 271cdf0e10cSrcweir pViewData->GetPPTX(),pViewData->GetPPTY(), 272cdf0e10cSrcweir aScaleX,aScaleY ); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir aDrawMode.SetScaleX(aScaleX); 275cdf0e10cSrcweir aDrawMode.SetScaleY(aScaleY); 276cdf0e10cSrcweir } 277cdf0e10cSrcweir aDrawMode.SetOrigin(Point()); 278cdf0e10cSrcweir Point aStartPos = pViewData->GetPixPos(eWhich); 279cdf0e10cSrcweir if ( bNegativePage ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir // RTL uses negative positions for drawing objects 282cdf0e10cSrcweir aStartPos.X() = -aStartPos.X() + GetOutputSizePixel().Width() - 1; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir aDrawMode.SetOrigin( PixelToLogic( aStartPos, aDrawMode ) ); 285cdf0e10cSrcweir 286cdf0e10cSrcweir return aDrawMode; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir //sal_Bool ScGridWindow::DrawBeforeScroll() 290cdf0e10cSrcweir //{ 291cdf0e10cSrcweir // ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 292cdf0e10cSrcweir // 293cdf0e10cSrcweir // sal_Bool bXor = sal_False; 294cdf0e10cSrcweir // if (pDrView) 295cdf0e10cSrcweir // { 296cdf0e10cSrcweir // bXor=pDrView->IsShownXorVisible(this); 297cdf0e10cSrcweir // if (bXor) pDrView->HideShownXor(this); 298cdf0e10cSrcweir // } 299cdf0e10cSrcweir // return bXor; 300cdf0e10cSrcweir //} 301cdf0e10cSrcweir 302cdf0e10cSrcweir void ScGridWindow::DrawAfterScroll(/*sal_Bool bVal*/) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir Update(); // immer, damit das Verhalten mit/ohne DrawingLayer gleich ist 305cdf0e10cSrcweir 306cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 307cdf0e10cSrcweir if (pDrView) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir //if (bVal) 310cdf0e10cSrcweir // pDrView->ShowShownXor(this); 311cdf0e10cSrcweir 312cdf0e10cSrcweir OutlinerView* pOlView = pDrView->GetTextEditOutlinerView(); 313cdf0e10cSrcweir if (pOlView && pOlView->GetWindow() == this) 314cdf0e10cSrcweir pOlView->ShowCursor(sal_False); // ist beim Scrollen weggekommen 315cdf0e10cSrcweir } 316cdf0e10cSrcweir } 317cdf0e10cSrcweir 318cdf0e10cSrcweir //void ScGridWindow::DrawMarks() 319cdf0e10cSrcweir //{ 320cdf0e10cSrcweir // ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 321cdf0e10cSrcweir // if (pDrView) 322cdf0e10cSrcweir // pDrView->DrawMarks(this); 323cdf0e10cSrcweir //} 324cdf0e10cSrcweir 325cdf0e10cSrcweir //sal_Bool ScGridWindow::NeedDrawMarks() 326cdf0e10cSrcweir //{ 327cdf0e10cSrcweir // ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 328cdf0e10cSrcweir // return pDrView && pDrView->IsMarkHdlShown() && pDrView->AreObjectsMarked(); 329cdf0e10cSrcweir //} 330cdf0e10cSrcweir 331cdf0e10cSrcweir void ScGridWindow::CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 334cdf0e10cSrcweir if (pDrView) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir const ScViewOptions& rOpts = pViewData->GetOptions(); 337cdf0e10cSrcweir if(rOpts.GetOption( VOPT_ANCHOR )) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir sal_Bool bNegativePage = pViewData->GetDocument()->IsNegativePage( pViewData->GetTabNo() ); 340cdf0e10cSrcweir Point aPos = pViewData->GetScrPos( rAddress.Col(), rAddress.Row(), eWhich, sal_True ); 341cdf0e10cSrcweir aPos = PixelToLogic(aPos); 342cdf0e10cSrcweir rHdl.AddHdl(new SdrHdl(aPos, bNegativePage ? HDL_ANCHOR_TR : HDL_ANCHOR)); 343cdf0e10cSrcweir } 344cdf0e10cSrcweir } 345cdf0e10cSrcweir } 346cdf0e10cSrcweir 347cdf0e10cSrcweir SdrObject* ScGridWindow::GetEditObject() 348cdf0e10cSrcweir { 349cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 350cdf0e10cSrcweir if (pDrView) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir OutlinerView* pOlView = pDrView->GetTextEditOutlinerView(); 353cdf0e10cSrcweir if (pOlView && pOlView->GetWindow() == this) 354cdf0e10cSrcweir return pDrView->GetTextEditObject(); 355cdf0e10cSrcweir } 356cdf0e10cSrcweir 357cdf0e10cSrcweir return NULL; 358cdf0e10cSrcweir } 359cdf0e10cSrcweir 360cdf0e10cSrcweir void ScGridWindow::UpdateStatusPosSize() 361cdf0e10cSrcweir { 362cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 363cdf0e10cSrcweir if (!pDrView) 364cdf0e10cSrcweir return; // shouldn't be called in that case 365cdf0e10cSrcweir 366cdf0e10cSrcweir SdrPageView* pPV = pDrView->GetSdrPageView(); 367cdf0e10cSrcweir if (!pPV) 368cdf0e10cSrcweir return; // shouldn't be called in that case either 369cdf0e10cSrcweir 370cdf0e10cSrcweir SfxItemSet aSet(pViewData->GetViewShell()->GetPool(), SID_ATTR_POSITION, SID_ATTR_SIZE); 371cdf0e10cSrcweir 372cdf0e10cSrcweir // Fill items for position and size: 373cdf0e10cSrcweir // #108137# show action rectangle during action, 374cdf0e10cSrcweir // position and size of selected object(s) if something is selected, 375cdf0e10cSrcweir // mouse position otherwise 376cdf0e10cSrcweir 377cdf0e10cSrcweir sal_Bool bActionItem = sal_False; 378cdf0e10cSrcweir if ( pDrView->IsAction() ) // action rectangle 379cdf0e10cSrcweir { 380cdf0e10cSrcweir Rectangle aRect; 381cdf0e10cSrcweir pDrView->TakeActionRect( aRect ); 382cdf0e10cSrcweir if ( !aRect.IsEmpty() ) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir pPV->LogicToPagePos(aRect); 385cdf0e10cSrcweir aSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) ); 386cdf0e10cSrcweir aSet.Put( SvxSizeItem( SID_ATTR_SIZE, 387cdf0e10cSrcweir Size( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ) ) ); 388cdf0e10cSrcweir bActionItem = sal_True; 389cdf0e10cSrcweir } 390cdf0e10cSrcweir } 391cdf0e10cSrcweir if ( !bActionItem ) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir if ( pDrView->AreObjectsMarked() ) // selected objects 394cdf0e10cSrcweir { 395cdf0e10cSrcweir Rectangle aRect = pDrView->GetAllMarkedRect(); 396cdf0e10cSrcweir pPV->LogicToPagePos(aRect); 397cdf0e10cSrcweir aSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) ); 398cdf0e10cSrcweir aSet.Put( SvxSizeItem( SID_ATTR_SIZE, 399cdf0e10cSrcweir Size( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ) ) ); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir else // mouse position 402cdf0e10cSrcweir { 403cdf0e10cSrcweir Point aPos = PixelToLogic(aCurMousePos); 404cdf0e10cSrcweir pPV->LogicToPagePos(aPos); 405cdf0e10cSrcweir aSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos ) ); 406cdf0e10cSrcweir aSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) ); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir pViewData->GetBindings().SetState(aSet); 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir sal_Bool ScGridWindow::DrawHasMarkedObj() 414cdf0e10cSrcweir { 415cdf0e10cSrcweir ScDrawView* p = pViewData->GetScDrawView(); 416cdf0e10cSrcweir return p ? p->AreObjectsMarked() : sal_False; 417cdf0e10cSrcweir } 418cdf0e10cSrcweir 419cdf0e10cSrcweir //void ScGridWindow::DrawStartTimer() 420cdf0e10cSrcweir //{ 421cdf0e10cSrcweir //ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 422cdf0e10cSrcweir //if (pDrView) 423cdf0e10cSrcweir //{ 424cdf0e10cSrcweir /* jetzt in DrawMarks 425cdf0e10cSrcweir sal_uInt16 nWinNum = pDrView->FindWin(this); 426cdf0e10cSrcweir if (nWinNum!=SDRVIEWWIN_NOTFOUND) 427cdf0e10cSrcweir pDrView->AfterInitRedraw(nWinNum); 428cdf0e10cSrcweir */ 429cdf0e10cSrcweir 430cdf0e10cSrcweir // pDrView->PostPaint(); 431cdf0e10cSrcweir // pDrView->RestartAfterPaintTimer(); 432cdf0e10cSrcweir //} 433cdf0e10cSrcweir //} 434cdf0e10cSrcweir 435cdf0e10cSrcweir void ScGridWindow::DrawMarkDropObj( SdrObject* pObj ) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); 438cdf0e10cSrcweir if (pDrView) 439cdf0e10cSrcweir pDrView->MarkDropObj(pObj); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir 442cdf0e10cSrcweir 443cdf0e10cSrcweir 444