LibreOffice Module sc (master)  1
drawview.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <com/sun/star/embed/XEmbeddedObject.hpp>
21 
22 #include <svx/svditer.hxx>
23 #include <svx/svdograf.hxx>
24 #include <svx/svdogrp.hxx>
25 #include <svx/svdoole2.hxx>
26 #include <svx/svdouno.hxx>
27 #include <svx/svdpage.hxx>
28 #include <svx/svdpagv.hxx>
29 #include <svx/svdundo.hxx>
30 #include <svx/svdocapt.hxx>
31 #include <svx/sdrpaintwindow.hxx>
32 #include <sfx2/bindings.hxx>
33 #include <sfx2/viewfrm.hxx>
34 #include <svx/sdrundomanager.hxx>
35 #include <svx/xfillit0.hxx>
36 #include <svx/xbtmpit.hxx>
37 #include <comphelper/lok.hxx>
38 #include <sfx2/lokhelper.hxx>
39 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
43 #include <svx/sdrpagewindow.hxx>
44 #include <tools/UnitConversion.hxx>
45 #include <osl/diagnose.h>
46 
47 #include <drawview.hxx>
48 #include <global.hxx>
49 #include <viewdata.hxx>
50 #include <document.hxx>
51 #include <drawutil.hxx>
52 #include <globstr.hrc>
53 #include <scresid.hxx>
54 #include <tabvwsh.hxx>
55 #include <client.hxx>
56 #include <scmod.hxx>
57 #include <drwlayer.hxx>
58 #include <docsh.hxx>
59 #include <viewuno.hxx>
60 #include <userdat.hxx>
61 #include <postit.hxx>
62 #include <undocell.hxx>
63 #include <gridwin.hxx>
64 
65 #include <sc.hrc>
66 
67 using namespace com::sun::star;
68 
69 #define SC_HANDLESIZE_BIG 9
70 
72 {
73  EnableExtendedKeyInputDispatcher(false);
74  EnableExtendedMouseEventDispatcher(false);
75 
76  SetFrameDragSingles();
77 
78  SetMinMoveDistancePixel( 2 );
79  SetHitTolerancePixel( 2 );
80 
81  if (pViewData)
82  {
83  SCTAB nViewTab = pViewData->GetTabNo();
84  ShowSdrPage(GetModel()->GetPage(nViewTab));
85 
86  bool bEx = pViewData->GetViewShell()->IsDrawSelMode();
87  bool bProt = rDoc.IsTabProtected( nViewTab ) ||
88  pViewData->GetSfxDocShell()->IsReadOnly();
89 
90  SdrLayer* pLayer;
91  SdrLayerAdmin& rAdmin = GetModel()->GetLayerAdmin();
92  pLayer = rAdmin.GetLayerPerID(SC_LAYER_BACK);
93  if (pLayer)
94  SetLayerLocked( pLayer->GetName(), bProt || !bEx );
95  pLayer = rAdmin.GetLayerPerID(SC_LAYER_INTERN);
96  if (pLayer)
97  SetLayerLocked( pLayer->GetName() );
98  pLayer = rAdmin.GetLayerPerID(SC_LAYER_FRONT);
99  if (pLayer)
100  {
101  SetLayerLocked( pLayer->GetName(), bProt );
102  SetActiveLayer( pLayer->GetName() ); // set active layer to FRONT
103  }
104  pLayer = rAdmin.GetLayerPerID(SC_LAYER_CONTROLS);
105  if (pLayer)
106  SetLayerLocked( pLayer->GetName(), bProt );
107  pLayer = rAdmin.GetLayerPerID(SC_LAYER_HIDDEN);
108  if (pLayer)
109  {
110  SetLayerLocked( pLayer->GetName(), bProt );
111  SetLayerVisible( pLayer->GetName(), false);
112  }
113 
114  SetSwapAsynchron();
115  }
116  else
117  {
118  ShowSdrPage(GetModel()->GetPage(nTab));
119  }
120 
121  UpdateUserViewOptions();
122  RecalcScale();
123  UpdateWorkArea();
124 
125  bInConstruct = false;
126 }
127 
129 {
130  pDropMarker.reset();
131 }
132 
134 {
135  ImplClearCalcDropMarker();
136 }
137 
139 {
140  const SdrMarkList &rMrkList = GetMarkedObjectList();
141  const size_t nCount = rMrkList.GetMarkCount();
142  for(size_t nPos=0; nPos<nCount; ++nPos )
143  {
144  SdrObject* pObj = rMrkList.GetMark(nPos)->GetMarkedSdrObj();
145  if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjDataTab(pObj, nTab))
146  {
147  if (ScTabView* pView = pViewData->GetView())
148  pView->CreateAnchorHandles(maHdlList, pAnchor->maStart);
149  }
150  }
151 }
152 
154 {
155  if (!pViewData) return;
156  SfxBindings& rBindings = pViewData->GetBindings();
157 
158  // true status values:
159  rBindings.InvalidateAll( true );
160 }
161 
163 {
164  if (!pViewData) return;
165  SfxBindings& rBindings = pViewData->GetBindings();
166 
167  // cjk/ctl font items have no configured slots,
168  // need no invalidate
169 
170  rBindings.Invalidate( SID_ATTR_CHAR_FONT );
171  rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
172  rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
173  rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
174  rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
175  rBindings.Invalidate( SID_ULINE_VAL_NONE );
176  rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
177  rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
178  rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
179  rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
180  rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
181  rBindings.Invalidate( SID_ATTR_CHAR_BACK_COLOR );
182  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
183  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
184  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
185  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
186  rBindings.Invalidate( SID_ALIGNLEFT );
187  rBindings.Invalidate( SID_ALIGNCENTERHOR );
188  rBindings.Invalidate( SID_ALIGNRIGHT );
189  rBindings.Invalidate( SID_ALIGNBLOCK );
190  rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 );
191  rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 );
192  rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
193  rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
194  rBindings.Invalidate( SID_SET_SUB_SCRIPT );
195  rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
196  rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
197  rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
198  rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
199  rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
200  rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
201  rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
202  rBindings.Invalidate( SID_TABLE_VERT_NONE );
203  rBindings.Invalidate( SID_TABLE_VERT_CENTER );
204  rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
205  // pseudo slots for Format menu
206  rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
207  rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
208  rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
209  rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
210 }
211 
213 {
214  if (!AreObjectsMarked())
215  return;
216 
217  // #i11702# use SdrUndoObjectLayerChange for undo
218  // STR_UNDO_SELATTR is "Attributes" - should use a different text later
219  BegUndo( ScResId( STR_UNDO_SELATTR ) );
220 
221  const SdrMarkList& rMark = GetMarkedObjectList();
222  const size_t nCount = rMark.GetMarkCount();
223  for (size_t i=0; i<nCount; ++i)
224  {
225  SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
226  if ( dynamic_cast<const SdrUnoObj*>( pObj) == nullptr && (pObj->GetLayer() != SC_LAYER_INTERN) )
227  {
228  AddUndo( std::make_unique<SdrUndoObjectLayerChange>( *pObj, pObj->GetLayer(), nLayerNo) );
229  pObj->SetLayer( nLayerNo );
230  }
231  }
232 
233  EndUndo();
234 
235  // repaint is done in SetLayer
236 
237  pViewData->GetDocShell()->SetDrawModified();
238 
239  // check mark list now instead of later in a timer
240  CheckMarked();
241  MarkListHasChanged();
242 }
243 
245 {
246  SdrObjListIter aIter( GetMarkedObjectList() );
247  for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
248  if( dynamic_cast<const SdrUnoObj*>( pObj) != nullptr )
249  return true;
250  return false;
251 }
252 
254 {
255  // internal objects should not be inside a group, but who knows...
256  SdrObjListIter aIter( GetMarkedObjectList() );
257  for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
258  if( pObj->GetLayer() == SC_LAYER_INTERN )
259  return true;
260  return false;
261 }
262 
264 {
265  SdrPage* pPage = GetModel()->GetPage(static_cast<sal_uInt16>(nTab));
266  if (pPage)
267  {
268  Size aPageSize( pPage->GetSize() );
269  tools::Rectangle aNewArea( Point(), aPageSize );
270  if ( aPageSize.Width() < 0 )
271  {
272  // RTL: from max.negative (left) to zero (right)
273  aNewArea.SetRight( 0 );
274  aNewArea.SetLeft( aPageSize.Width() + 1 );
275  }
276  SetWorkArea( aNewArea );
277  }
278  else
279  {
280  OSL_FAIL("Page not found");
281  }
282 }
283 
285 {
286  DoCopy();
287  BegUndo( ScResId( STR_UNDO_CUT ) );
288  DeleteMarked(); // In this View - not affected by 505f change
289  EndUndo();
290 }
291 
292 void ScDrawView::GetScale( Fraction& rFractX, Fraction& rFractY ) const
293 {
294  rFractX = aScaleX;
295  rFractY = aScaleY;
296 }
297 
299 {
300  double nPPTX;
301  double nPPTY;
302  Fraction aZoomX(1,1);
303  Fraction aZoomY(1,1);
304 
305  if (pViewData)
306  {
307  nTab = pViewData->GetTabNo();
308  nPPTX = pViewData->GetPPTX();
309  nPPTY = pViewData->GetPPTY();
310  aZoomX = pViewData->GetZoomX();
311  aZoomY = pViewData->GetZoomY();
312  }
313  else
314  {
315  Point aLogic = pDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
316  nPPTX = aLogic.X() / 1000.0;
317  nPPTY = aLogic.Y() / 1000.0;
319  }
320 
321  SCCOL nEndCol = 0;
322  SCROW nEndRow = 0;
323  rDoc.GetTableArea( nTab, nEndCol, nEndRow );
324  if (nEndCol<20)
325  nEndCol = 20;
326  if (nEndRow<20)
327  nEndRow = 20;
328 
330  rDoc, nTab, 0, 0, nEndCol, nEndRow, pDev, aZoomX, aZoomY, nPPTX, nPPTY,
331  aScaleX, aScaleY);
332 
333  // clear all evtl existing GridOffset vectors
334  resetGridOffsetsForAllSdrPageViews();
335 
336  SdrPageView* pPV = GetSdrPageView();
337  if ( !(pViewData && pPV) )
338  return;
339 
340  if ( SdrPage* pPage = pPV->GetPage() )
341  {
342  const size_t nCount = pPage->GetObjCount();
343  for ( size_t i = 0; i < nCount; ++i )
344  {
345  SdrObject* pObj = pPage->GetObj( i );
346  // Align objects to nearest grid position
347  SyncForGrid( pObj );
348  }
349  }
350 }
351 
353 {
354  if ( pViewData )
355  pViewData->GetViewShell()->ConnectObject( pOleObj );
356 }
357 
359 {
361 
362  ScTabViewShell* pViewSh = pViewData->GetViewShell();
363 
364  // #i110829# remove the cell selection only if drawing objects are selected
365  if ( !bInConstruct && GetMarkedObjectList().GetMarkCount() )
366  {
367  pViewSh->Unmark(); // remove cell selection
368 
369  // end cell edit mode if drawing objects are selected
370  SC_MOD()->InputEnterHandler();
371  }
372 
373  // deactivate IP
374 
375  ScModule* pScMod = SC_MOD();
376  bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
377 
378  ScClient* pClient = static_cast<ScClient*>( pViewSh->GetIPClient() );
379  if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog )
380  {
381  // do not display the handles for ViewShell::Activate from the Reset2Open
382  pClient->DeactivateObject();
383  // replacing image ole graphics is now done in ScClient::UIActivate
384  }
385 
386  // Select Ole object?
387 
388  SdrOle2Obj* pOle2Obj = nullptr;
389  SdrGrafObj* pGrafObj = nullptr;
390 
391  const SdrMarkList& rMarkList = GetMarkedObjectList();
392  const size_t nMarkCount = rMarkList.GetMarkCount();
393 
394  if ( nMarkCount == 0 && !pViewData->GetViewShell()->IsDrawSelMode() && !bInConstruct )
395  {
396  // relock layers that may have been unlocked before
397  LockBackgroundLayer(true);
398  LockInternalLayer();
399  }
400 
401  bool bSubShellSet = false;
402  if (nMarkCount == 1)
403  {
404  SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
405  if (pObj->GetObjIdentifier() == OBJ_OLE2)
406  {
407  pOle2Obj = static_cast<SdrOle2Obj*>(pObj);
408  if (!ScDocument::IsChart(pObj) )
409  pViewSh->SetOleObjectShell(true);
410  else
411  pViewSh->SetChartShell(true);
412  bSubShellSet = true;
413  }
414  else if (pObj->GetObjIdentifier() == OBJ_GRAF)
415  {
416  pGrafObj = static_cast<SdrGrafObj*>(pObj);
417  pViewSh->SetGraphicShell(true);
418  bSubShellSet = true;
419  }
420  else if (pObj->GetObjIdentifier() == OBJ_MEDIA)
421  {
422  pViewSh->SetMediaShell(true);
423  bSubShellSet = true;
424  }
425  else if (pObj->GetObjIdentifier() != OBJ_TEXT // prevent switching to the drawing shell
426  || !pViewSh->IsDrawTextShell()) // when creating a text object @#70206#
427  {
428  pViewSh->SetDrawShell(true);
429  }
430  }
431 
432  if ( nMarkCount && !bSubShellSet )
433  {
434  bool bOnlyControls = true;
435  bool bOnlyGraf = true;
436  for (size_t i=0; i<nMarkCount; ++i)
437  {
438  SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
439  if ( auto pObjGroup = dynamic_cast<const SdrObjGroup*>( pObj) )
440  {
441  const SdrObjList *pLst = pObjGroup->GetSubList();
442  const size_t nListCount = pLst->GetObjCount();
443  if ( nListCount == 0 )
444  {
445  // An empty group (may occur during Undo) is no control or graphics object.
446  // Creating the form shell during undo would lead to problems with the undo manager.
447  bOnlyControls = false;
448  bOnlyGraf = false;
449  }
450  for ( size_t j = 0; j < nListCount; ++j )
451  {
452  SdrObject *pSubObj = pLst->GetObj( j );
453 
454  if (dynamic_cast<const SdrUnoObj*>( pSubObj) == nullptr)
455  bOnlyControls = false;
456  if (pSubObj->GetObjIdentifier() != OBJ_GRAF)
457  bOnlyGraf = false;
458 
459  if ( !bOnlyControls && !bOnlyGraf ) break;
460  }
461  }
462  else
463  {
464  if (dynamic_cast<const SdrUnoObj*>( pObj) == nullptr)
465  bOnlyControls = false;
466  if (pObj->GetObjIdentifier() != OBJ_GRAF)
467  bOnlyGraf = false;
468  }
469 
470  if ( !bOnlyControls && !bOnlyGraf ) break;
471  }
472 
473  if(bOnlyControls)
474  {
475  pViewSh->SetDrawFormShell(true); // now UNO controls
476  }
477  else if(bOnlyGraf)
478  {
479  pViewSh->SetGraphicShell(true);
480  }
481  else if(nMarkCount>1)
482  {
483  pViewSh->SetDrawShell(true);
484  }
485  }
486 
487  // adjust verbs
488 
489  SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
490  bool bOle = pViewSh->GetViewFrame()->GetFrame().IsInPlace();
491  uno::Sequence< embed::VerbDescriptor > aVerbs;
492  if ( pOle2Obj && !bOle )
493  {
494  const uno::Reference < embed::XEmbeddedObject >& xObj = pOle2Obj->GetObjRef();
495  OSL_ENSURE( xObj.is(), "SdrOle2Obj without ObjRef" );
496  if (xObj.is())
497  aVerbs = xObj->getSupportedVerbs();
498  }
499  pViewSh->SetVerbs( aVerbs );
500 
501  // image map editor
502 
503  if ( pOle2Obj )
504  UpdateIMap( pOle2Obj );
505  else if ( pGrafObj )
506  UpdateIMap( pGrafObj );
507 
508  InvalidateAttribs(); // after the image map editor update
509  InvalidateDrawTextAttrs();
510 
511  for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
512  {
513  SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
514  OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
515 
516  if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
517  {
518  static_cast<vcl::Window&>(rOutDev).PaintImmediately();
519  }
520  }
521 
522  // uno object for view returns drawing objects as selection,
523  // so it must notify its SelectionChangeListeners
524 
525  if (pViewFrame)
526  {
527  SfxFrame& rFrame = pViewFrame->GetFrame();
528  uno::Reference<frame::XController> xController = rFrame.GetController();
529  if (xController.is())
530  {
531  ScTabViewObj* pImp = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
532  if (pImp)
533  pImp->SelectionChanged();
534  }
535  }
536 
537  // update selection transfer object
538 
539  pViewSh->CheckSelectionTransfer();
540 
541 }
542 
544  SdrObject* pObj,
545  SdrPageView* pPV,
546  vcl::Window* pWinL,
547  bool bIsNewObj,
548  SdrOutliner* pGivenOutliner,
549  OutlinerView* pGivenOutlinerView,
550  bool bDontDeleteOutliner,
551  bool bOnlyOneView,
552  bool bGrabFocus )
553 {
554  const bool bRet = FmFormView::SdrBeginTextEdit(
555  pObj, pPV, pWinL, bIsNewObj,
556  pGivenOutliner, pGivenOutlinerView, bDontDeleteOutliner,
557  bOnlyOneView, bGrabFocus );
558 
559  ScTabViewShell* pViewSh = pViewData->GetViewShell();
560 
562  {
563  if (OutlinerView* pView = GetTextEditOutlinerView())
564  {
565  tools::Rectangle aRectangle = pView->GetOutputArea();
566  if (pWinL && pWinL->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
567  aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
568  OString sRectangle = aRectangle.toString();
569  SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
570  }
571  }
572 
573  if ( pViewSh->GetViewFrame() )
574  {
575  SfxFrame& rFrame = pViewSh->GetViewFrame()->GetFrame();
576  uno::Reference< frame::XController > xController = rFrame.GetController();
577  if (xController.is())
578  {
579  ScTabViewObj* pImp = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
580  if (pImp)
581  pImp->SelectionChanged();
582  }
583  }
584 
585  return bRet;
586 }
587 
589 {
590  const SdrEndTextEditKind eRet = FmFormView::SdrEndTextEdit( bDontDeleteReally );
591 
592  ScTabViewShell* pViewSh = pViewData->GetViewShell();
593 
595  SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", "EMPTY");
596 
597  if ( pViewSh->GetViewFrame() )
598  {
599  SfxFrame& rFrame = pViewSh->GetViewFrame()->GetFrame();
600  uno::Reference< frame::XController > xController = rFrame.GetController();
601  if (xController.is())
602  {
603  ScTabViewObj* pImp = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
604  if (pImp)
605  pImp->SelectionChanged();
606  }
607  }
608 
609  return eRet;
610 }
611 
613 {
614  SdrObject* pEditObj = GetTextEditObject();
615  if ( pEditObj && !pEditObj->IsInserted() && pViewData )
616  {
617  // SdrObjEditView::ModelHasChanged will end text edit in this case,
618  // so make sure the EditEngine's undo manager is no longer used.
619  pViewData->GetViewShell()->SetDrawTextUndo(nullptr);
620  SetCreateMode(); // don't leave FuText in a funny state
621  }
622 
624 }
625 
627 {
628  if (!pViewData)
629  return;
630 
631  const ScViewOptions& rOpt = pViewData->GetOptions();
632  const ScGridOptions& rGrid = rOpt.GetGridOptions();
633 
634  SetDragStripes( rOpt.GetOption( VOPT_HELPLINES ) );
635  SetMarkHdlSizePixel( SC_HANDLESIZE_BIG );
636 
637  SetGridVisible( rGrid.GetGridVisible() );
638  SetSnapEnabled( rGrid.GetUseGridSnap() );
639  SetGridSnap( rGrid.GetUseGridSnap() );
640 
641  Fraction aFractX( rGrid.GetFieldDrawX(), rGrid.GetFieldDivisionX() + 1 );
642  Fraction aFractY( rGrid.GetFieldDrawY(), rGrid.GetFieldDivisionY() + 1 );
643  SetSnapGridWidth( aFractX, aFractY );
644 
645  SetGridCoarse( Size( rGrid.GetFieldDrawX(), rGrid.GetFieldDrawY() ) );
646  SetGridFine( Size( rGrid.GetFieldDrawX() / (rGrid.GetFieldDivisionX() + 1),
647  rGrid.GetFieldDrawY() / (rGrid.GetFieldDivisionY() + 1) ) );
648 }
649 
650 SdrObject* ScDrawView::GetObjectByName(std::u16string_view rName)
651 {
652  SfxObjectShell* pShell = rDoc.GetDocumentShell();
653  if (pShell)
654  {
655  SdrModel* pDrawLayer = GetModel();
656  sal_uInt16 nTabCount = rDoc.GetTableCount();
657  for (sal_uInt16 i=0; i<nTabCount; i++)
658  {
659  SdrPage* pPage = pDrawLayer->GetPage(i);
660  DBG_ASSERT(pPage,"Page ?");
661  if (pPage)
662  {
663  SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
664  SdrObject* pObject = aIter.Next();
665  while (pObject)
666  {
667  if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
668  {
669  return pObject;
670  }
671  pObject = aIter.Next();
672  }
673  }
674  }
675  }
676  return nullptr;
677 }
678 
679 //realize multi-selection of objects
680 
681 void ScDrawView::SelectCurrentViewObject( std::u16string_view rName )
682 {
683  sal_uInt16 nObjectTab = 0;
684  SdrObject* pFound = nullptr;
685  SfxObjectShell* pShell = rDoc.GetDocumentShell();
686  if (pShell)
687  {
688  SdrModel* pDrawLayer = GetModel();
689  sal_uInt16 nTabCount = rDoc.GetTableCount();
690  for (sal_uInt16 i=0; i<nTabCount && !pFound; i++)
691  {
692  SdrPage* pPage = pDrawLayer->GetPage(i);
693  DBG_ASSERT(pPage,"Page ?");
694  if (pPage)
695  {
696  SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
697  SdrObject* pObject = aIter.Next();
698  while (pObject && !pFound)
699  {
700  if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
701  {
702  pFound = pObject;
703  nObjectTab = i;
704  }
705  pObject = aIter.Next();
706  }
707  }
708  }
709  }
710  if ( !pFound )
711  return;
712 
713  ScTabView* pView = pViewData->GetView();
714  if ( nObjectTab != nTab ) // switch sheet
715  pView->SetTabNo( nObjectTab );
716  DBG_ASSERT( nTab == nObjectTab, "Switching sheets did not work" );
717  pView->ScrollToObject( pFound );
718  if ( pFound->GetLayer() == SC_LAYER_BACK &&
719  !pViewData->GetViewShell()->IsDrawSelMode() &&
720  !rDoc.IsTabProtected( nTab ) &&
721  !pViewData->GetSfxDocShell()->IsReadOnly() )
722  {
723  SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
724  if (pLayer)
725  SetLayerLocked( pLayer->GetName(), false );
726  }
727  SdrPageView* pPV = GetSdrPageView();
728  const bool bUnMark = IsObjMarked(pFound);
729  MarkObj( pFound, pPV, bUnMark);
730 }
731 
732 bool ScDrawView::SelectObject( std::u16string_view rName )
733 {
734  UnmarkAll();
735 
736  SCTAB nObjectTab = 0;
737  SdrObject* pFound = nullptr;
738 
739  SfxObjectShell* pShell = rDoc.GetDocumentShell();
740  if (pShell)
741  {
742  SdrModel* pDrawLayer = GetModel();
743  SCTAB nTabCount = rDoc.GetTableCount();
744  for (SCTAB i=0; i<nTabCount && !pFound; i++)
745  {
746  SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i));
747  OSL_ENSURE(pPage,"Page ?");
748  if (pPage)
749  {
750  SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
751  SdrObject* pObject = aIter.Next();
752  while (pObject && !pFound)
753  {
754  if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
755  {
756  pFound = pObject;
757  nObjectTab = i;
758  }
759  pObject = aIter.Next();
760  }
761  }
762  }
763  }
764 
765  if ( pFound )
766  {
767  ScTabView* pView = pViewData->GetView();
768  if ( nObjectTab != nTab ) // switch sheet
769  pView->SetTabNo( nObjectTab );
770 
771  OSL_ENSURE( nTab == nObjectTab, "Switching sheets did not work" );
772 
773  pView->ScrollToObject( pFound );
774 
775  /* To select an object on the background layer, the layer has to
776  be unlocked even if exclusive drawing selection mode is not active
777  (this is reversed in MarkListHasChanged when nothing is selected) */
778  if ( pFound->GetLayer() == SC_LAYER_BACK &&
779  !pViewData->GetViewShell()->IsDrawSelMode() &&
780  !rDoc.IsTabProtected( nTab ) &&
781  !pViewData->GetSfxDocShell()->IsReadOnly() )
782  {
783  LockBackgroundLayer(false);
784  }
785 
786  SdrPageView* pPV = GetSdrPageView();
787  MarkObj( pFound, pPV );
788  }
789 
790  return ( pFound != nullptr );
791 }
792 
793 //If object is marked , return true , else return false .
795 {
796  bool bisMarked = false;
797  if (pObject )
798  {
799  bisMarked = IsObjMarked(pObject);
800  }
801  return bisMarked;
802 }
803 
805 {
806  SdrInsertFlags nOptions=SdrInsertFlags::NONE;
807  // Do not change marks when the ole object is active
808  // (for Drop from ole object would otherwise be deactivated in the middle of ExecuteDrag!)
809 
810  if (pViewData)
811  {
812  SfxInPlaceClient* pClient = pViewData->GetViewShell()->GetIPClient();
813  if ( pClient && pClient->IsObjectInPlaceActive() )
814  nOptions |= SdrInsertFlags::DONTMARK;
815  }
816 
817  return InsertObjectAtView(pObj, rPV, nOptions);
818 }
819 
821 {
822  const SdrMarkList& rMarkList = GetMarkedObjectList();
823  if( pViewData && (rMarkList.GetMarkCount() == 1) )
824  {
825  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
826  if( ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, pViewData->GetTabNo() ) )
827  {
828  if( ppCaptData ) *ppCaptData = pCaptData;
829  return pObj;
830  }
831  }
832  return nullptr;
833 }
834 
835 void ScDrawView::LockCalcLayer( SdrLayerID nLayer, bool bLock )
836 {
837  SdrLayer* pLockLayer = GetModel()->GetLayerAdmin().GetLayerPerID( nLayer );
838  if( pLockLayer && (IsLayerLocked( pLockLayer->GetName() ) != bLock) )
839  SetLayerLocked( pLockLayer->GetName(), bLock );
840 }
841 
843 {
846 
847  if ( pViewData && pViewData->GetActiveWin() == &rWin )
848  pViewData->GetView()->MakeVisible( rRect );
849 }
850 
852 {
853  return pViewData->GetViewShell();
854 }
855 
857 {
858  // try to delete a note caption object with its cell note in the Calc document
859  ScDrawObjData* pCaptData = nullptr;
860  if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
861  {
862  ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
863  ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr;
864  SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : nullptr;
865  bool bUndo = pDrawLayer && pDocShell && pUndoMgr && rDoc.IsUndoEnabled();
866 
867  // remove the cell note from document, we are its owner now
868  std::unique_ptr<ScPostIt> pNote = rDoc.ReleaseNote( pCaptData->maStart );
869  OSL_ENSURE( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
870  if( pNote )
871  {
872  // rescue note data for undo (with pointer to caption object)
873  ScNoteData aNoteData = pNote->GetNoteData();
874  OSL_ENSURE( aNoteData.mxCaption.get() == pCaptObj, "ScDrawView::DeleteMarked - caption object does not match" );
875  // collect the drawing undo action created while deleting the note
876  if( bUndo )
877  pDrawLayer->BeginCalcUndo(false);
878  // delete the note (already removed from document above)
879  pNote.reset();
880  // add the undo action for the note
881  if( bUndo )
882  pUndoMgr->AddUndoAction( std::make_unique<ScUndoReplaceNote>( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
883  // repaint the cell to get rid of the note marker
884  if( pDocShell )
885  pDocShell->PostPaintCell( pCaptData->maStart );
886  // done, return now to skip call of FmFormView::DeleteMarked()
887  return;
888  }
889  }
890 
892 }
893 
895 {
896  bool bIsTextEdit = IsTextEdit();
897  SdrEndTextEditKind eKind = SdrEndTextEdit();
898 
899  if (bIsTextEdit)
900  pViewData->GetViewShell()->SetDrawTextUndo(nullptr); // the "normal" undo manager
901 
902  return eKind;
903 }
904 
906 {
907  if ( pDropMarkObj != pObj )
908  {
909  pDropMarkObj = pObj;
910  ImplClearCalcDropMarker();
911 
912  if(pDropMarkObj)
913  {
914  pDropMarker.reset( new SdrDropMarkerOverlay(*this, *pDropMarkObj) );
915  }
916  }
917 }
918 
919 // In order to counteract the effects of rounding due to the nature of how the
920 // grid positions are calculated and drawn we calculate the offset needed at the
921 // current zoom to be applied to an SrdObject when it is drawn in order to make
922 // sure that it's position relative to the nearest cell anchor doesn't change.
923 // Of course not all shape(s)/control(s) are cell anchored, if the
924 // object doesn't have a cell anchor we synthesise a temporary anchor.
926 {
927  // process members of a group shape separately
928  if ( auto pObjGroup = dynamic_cast<const SdrObjGroup*>( pObj) )
929  {
930  SdrObjList *pLst = pObjGroup->GetSubList();
931  for ( size_t i = 0, nCount = pLst->GetObjCount(); i < nCount; ++i )
932  SyncForGrid( pLst->GetObj( i ) );
933  }
934 
935  ScSplitPos eWhich = pViewData->GetActivePart();
936  ScGridWindow* pGridWin = pViewData->GetActiveWin();
938  if ( !pGridWin )
939  return;
940 
941  ScAddress aOldStt;
942  if( pData && pData->maStart.IsValid())
943  {
944  aOldStt = pData->maStart;
945  }
946  else
947  {
948  // Page anchored object so...
949  // synthesise an anchor ( but don't attach it to
950  // the object as we want to maintain page anchoring )
951  ScDrawObjData aAnchor;
952  const tools::Rectangle aObjRect(pObj->GetLogicRect());
954  aObjRect,
955  aAnchor,
956  rDoc,
957  GetTab());
958  aOldStt = aAnchor.maStart;
959  }
960  MapMode aDrawMode = pGridWin->GetDrawMapMode();
961  // find pos anchor position
962  Point aOldPos( rDoc.GetColOffset( aOldStt.Col(), aOldStt.Tab() ), rDoc.GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
963  aOldPos.setX(convertTwipToMm100(aOldPos.X()));
964  aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
965  // find position of same point on the screen ( e.g. grid )
966  Point aCurPos = pViewData->GetScrPos( aOldStt.Col(), aOldStt.Row(), eWhich, true );
967  Point aCurPosHmm = pGridWin->PixelToLogic(aCurPos, aDrawMode );
968  Point aGridOff = aCurPosHmm - aOldPos;
969  // fdo#63878 Fix the X position for RTL Sheet
970  if( rDoc.IsNegativePage( GetTab() ) )
971  aGridOff.setX( aCurPosHmm.getX() + aOldPos.getX() );
972 }
973 
975 {
976  SdrPageView* pPageView(GetSdrPageView());
977 
978  if(nullptr == pPageView)
979  return;
980 
981  for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
982  {
983  SdrPageWindow* pPageWindow(pPageView->GetPageWindow(a));
984  assert(pPageWindow && "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
985 
986  if(nullptr != pPageWindow)
987  {
988  sdr::contact::ObjectContact& rObjectContact(pPageWindow->GetObjectContact());
989 
990  if(rObjectContact.supportsGridOffsets())
991  {
992  rObjectContact.resetAllGridOffsets();
993  }
994  }
995  }
996 }
997 
999  SdrObject& rSdrObject,
1000  basegfx::B2DVector& rTarget) const
1001 {
1004  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1005  return false;
1006 
1007  ScGridWindow* pGridWin(pViewData->GetActiveWin());
1008 
1009  if(nullptr == pGridWin)
1010  {
1011  return false;
1012  }
1013 
1015  ScAddress aOldStt;
1016 
1017  if(nullptr != pData && pData->maStart.IsValid())
1018  {
1019  aOldStt = pData->maStart;
1020  }
1021  else
1022  {
1023  // Page anchored object so...
1024  // synthesise an anchor ( but don't attach it to
1025  // the object as we want to maintain page anchoring )
1026  ScDrawObjData aAnchor;
1027  const tools::Rectangle aObjRect(rSdrObject.GetLogicRect());
1029  aObjRect,
1030  aAnchor,
1031  rDoc,
1032  GetTab());
1033  aOldStt = aAnchor.maStart;
1034  }
1035 
1036  MapMode aDrawMode = pGridWin->GetDrawMapMode();
1037 
1038  // find pos anchor position
1039  Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
1040  aOldPos.setX(convertTwipToMm100(aOldPos.X()));
1041  aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
1042 
1043  // find position of same point on the screen ( e.g. grid )
1044  ScSplitPos eWhich(pViewData->GetActivePart());
1045  Point aCurPos(pViewData->GetScrPos(aOldStt.Col(), aOldStt.Row(), eWhich, true));
1046  Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
1047  Point aGridOff(aCurPosHmm - aOldPos);
1048 
1049  // fdo#63878 Fix the X position for RTL Sheet
1050  if(rDoc.IsNegativePage(GetTab()))
1051  {
1052  aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
1053  }
1054 
1055  rTarget.setX(aGridOff.X());
1056  rTarget.setY(aGridOff.Y());
1057  return true;
1058 }
1059 
1061  const basegfx::B2DRange& rB2DRange,
1062  basegfx::B2DVector& rTarget) const
1063 {
1064  ScGridWindow* pGridWin(pViewData->GetActiveWin());
1065 
1066  if(nullptr == pGridWin || rB2DRange.isEmpty())
1067  {
1068  return false;
1069  }
1070 
1071  // No SdrObject, so synthesise an anchor ( but don't attach it to
1072  // the object as we want to maintain page anchoring )
1073  ScDrawObjData aAnchor;
1074  const tools::Rectangle aRectangle(
1075  basegfx::fround(rB2DRange.getMinX()), basegfx::fround(rB2DRange.getMinY()),
1076  basegfx::fround(rB2DRange.getMaxX()), basegfx::fround(rB2DRange.getMaxY()));
1078  aRectangle,
1079  aAnchor,
1080  rDoc,
1081  GetTab());
1082  ScAddress aOldStt(aAnchor.maStart);
1083 
1084  MapMode aDrawMode = pGridWin->GetDrawMapMode();
1085 
1086  // find pos anchor position
1087  Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
1088  aOldPos.setX(convertTwipToMm100(aOldPos.X()));
1089  aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
1090 
1091  // find position of same point on the screen ( e.g. grid )
1092  ScSplitPos eWhich(pViewData->GetActivePart());
1093  Point aCurPos(pViewData->GetScrPos(aOldStt.Col(), aOldStt.Row(), eWhich, true));
1094  Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
1095  Point aGridOff(aCurPosHmm - aOldPos);
1096 
1097  // fdo#63878 Fix the X position for RTL Sheet
1098  if(rDoc.IsNegativePage(GetTab()))
1099  {
1100  aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
1101  }
1102 
1103  rTarget.setX(aGridOff.X());
1104  rTarget.setY(aGridOff.Y());
1105  return true;
1106 }
1107 
1108 // support enhanced text edit for draw objects
1110 {
1111  return dynamic_cast<SdrUndoManager*>(rDoc.GetUndoManager());
1112 }
1113 
1114 // #i123922# helper to apply a Graphic to an existing SdrObject
1116  SdrObject& rHitObject,
1117  const Graphic& rGraphic,
1118  const OUString& rBeginUndoText,
1119  const OUString& rFile)
1120 {
1121  if(dynamic_cast< SdrGrafObj* >(&rHitObject))
1122  {
1123  SdrGrafObj* pNewGrafObj(static_cast<SdrGrafObj*>(rHitObject.CloneSdrObject(rHitObject.getSdrModelFromSdrObject())));
1124 
1125  pNewGrafObj->SetGraphic(rGraphic);
1126  BegUndo(rBeginUndoText);
1127  ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj);
1128 
1129  // set in all cases - the Clone() will have copied an existing link (!)
1130  pNewGrafObj->SetGraphicLink( rFile );
1131 
1132  EndUndo();
1133  return pNewGrafObj;
1134  }
1135  else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
1136  {
1137  AddUndo(std::make_unique<SdrUndoAttrObj>(rHitObject));
1138 
1139  SfxItemSet aSet(GetModel()->GetItemPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLBITMAP>{});
1140 
1141  aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
1142  aSet.Put(XFillBitmapItem(OUString(), rGraphic));
1143  rHitObject.SetMergedItemSetAndBroadcast(aSet);
1144  return &rHitObject;
1145  }
1146 
1147  return nullptr;
1148 }
1149 
1150 // Own derivation of ObjectContact to allow on-demand calculation of
1151 // GridOffset for non-linear ViewToDevice transformation (calc)
1152 namespace sdr::contact
1153 {
1154  namespace {
1155 
1156  class ObjectContactOfScDrawView final : public ObjectContactOfPageView
1157  {
1158  private:
1159  // The ScDrawView to work on
1161 
1162  public:
1163  explicit ObjectContactOfScDrawView(
1164  const ScDrawView& rScDrawView,
1165  SdrPageWindow& rPageWindow,
1166  const char* pDebugName);
1167 
1168  virtual bool supportsGridOffsets() const override;
1169  virtual void calculateGridOffsetForViewOjectContact(
1170  basegfx::B2DVector& rTarget,
1171  const ViewObjectContact& rClient) const override;
1172  virtual void calculateGridOffsetForB2DRange(
1173  basegfx::B2DVector& rTarget,
1174  const basegfx::B2DRange& rB2DRange) const override;
1175  };
1176 
1177  }
1178 
1179  ObjectContactOfScDrawView::ObjectContactOfScDrawView(
1180  const ScDrawView& rScDrawView,
1181  SdrPageWindow& rPageWindow,
1182  const char* pDebugName)
1183  : ObjectContactOfPageView(rPageWindow, pDebugName),
1184  mrScDrawView(rScDrawView)
1185  {
1186  }
1187 
1188  bool ObjectContactOfScDrawView::supportsGridOffsets() const
1189  {
1190  // Except when scPrintTwipsMsgs flag is active,
1191  // Calc in LOK mode directly sets pixel-aligned logical coordinates for draw-objects.
1194  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1195  return false;
1196 
1197  // no GridOffset support for printer
1198  if(isOutputToPrinter())
1199  {
1200  return false;
1201  }
1202 
1203  // no GridOffset support for PDF export
1204  if(isOutputToPDFFile())
1205  {
1206  return false;
1207  }
1208 
1209  // yes - we support it
1210  return true;
1211  }
1212 
1213  void ObjectContactOfScDrawView::calculateGridOffsetForViewOjectContact(
1214  basegfx::B2DVector& rTarget,
1215  const ViewObjectContact& rClient) const
1216  {
1217  // Here the on-demand calculation happens. Try to access the SdrObject involved
1218  SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1219 
1220  if(nullptr != pTargetSdrObject)
1221  {
1223  *pTargetSdrObject,
1224  rTarget);
1225  }
1226  }
1227 
1228  void ObjectContactOfScDrawView::calculateGridOffsetForB2DRange(
1229  basegfx::B2DVector& rTarget,
1230  const basegfx::B2DRange& rB2DRange) const
1231  {
1232  // Here the on-demand calculation happens. Try to access the SdrObject involved
1233  if(!rB2DRange.isEmpty())
1234  {
1236  rB2DRange,
1237  rTarget);
1238  }
1239  }
1240 }
1241 
1242 // Create own derivation of ObjectContact for calc
1244  SdrPageWindow& rPageWindow,
1245  const char* pDebugName) const
1246 {
1247  return new sdr::contact::ObjectContactOfScDrawView(
1248  *this,
1249  rPageWindow,
1250  pDebugName);
1251 }
1252 
1253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
Definition: drwlayer.cxx:1413
SfxViewFrame * GetViewFrame() const
virtual void ModelHasChanged() override
OutDevType GetOutDevType() const
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true) override
Definition: drawview.cxx:543
sal_uInt32 GetFieldDivisionY() const
constexpr double nPPTY
static void GetCellAnchorFromPosition(const tools::Rectangle &rRectangle, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bHiddenAsZero=true)
Definition: drwlayer.cxx:2360
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
void UpdateUserViewOptions()
Definition: drawview.cxx:626
virtual ~ScDrawView() override
Definition: drawview.cxx:133
void setX(double fX)
void ImplClearCalcDropMarker()
Definition: drawview.cxx:128
size_t GetMarkCount() const
bool IsClosedObj() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
Definition: gridwin3.cxx:252
SCROW Row() const
Definition: address.hxx:261
std::unique_ptr< ContentProperties > pData
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
bool IsObjectInPlaceActive() const
void SetMediaShell(bool bActive)
Definition: tabvwsh4.cxx:732
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: docsh3.cxx:187
sal_uInt32 GetFieldDrawX() const
SdrEndTextEditKind
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2591
SdrObject * GetObj(size_t nNum) const
bool IsInserted() const
size_t GetObjCount() const
void InvalidateAttribs()
Definition: drawview.cxx:153
SdrObject * GetObjectByName(std::u16string_view rName)
Definition: drawview.cxx:650
const MapMode & GetMapMode() const
bool HasMarkedInternal() const
Definition: drawview.cxx:253
constexpr SdrLayerID SC_LAYER_BACK(1)
void Unmark()
Definition: tabview3.cxx:1721
SdrMark * GetMark(size_t nNum) const
virtual void AddCustomHdl() override
Definition: drawview.cxx:138
void Invalidate(sal_uInt16 nId)
virtual SdrObjKind GetObjIdentifier() const
bool HasMarkedControl() const
Definition: drawview.cxx:244
EmbeddedObjectRef * pObject
ScAddress maStart
Definition: userdat.hxx:36
double getMaxX() const
void resetGridOffsetsForAllSdrPageViews()
Definition: drawview.cxx:974
ScSplitPos
Definition: viewdata.hxx:44
constexpr auto convertTwipToMm100(N n)
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2806
virtual void DeleteMarked() override
Definition: drawview.cxx:856
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
Reference< XController > xController
OUTDEV_WINDOW
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void LockCalcLayer(SdrLayerID nLayer, bool bLock)
Locks/unlocks the specified layer in the draw page.
Definition: drawview.cxx:835
SfxFrame & GetFrame() const
int nCount
void SetGraphic(const Graphic &rGrf)
bool isCompatFlagSet(Compat flag)
SCTAB Tab() const
Definition: address.hxx:270
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:1006
void GetScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawview.cxx:292
void MarkDropObj(SdrObject *pObj)
Definition: drawview.cxx:905
double getMaxY() const
B2IRange fround(const B2DRange &rRange)
void ScrollToObject(const SdrObject *pDrawObj)
Definition: tabview5.cxx:541
void SetGraphicShell(bool bActive)
Definition: tabvwsh4.cxx:724
void UpdateWorkArea()
Definition: drawview.cxx:263
void SyncForGrid(SdrObject *pObj)
Definition: drawview.cxx:925
bool IsValid() const
Definition: address.hxx:292
constexpr double nPPTX
SdrObject * GetMarkedSdrObj() const
bool isEmpty() const
void SetChartShell(bool bActive)
Definition: tabvwsh4.cxx:716
virtual void MarkListHasChanged() override
Definition: drawview.cxx:358
void SelectCurrentViewObject(std::u16string_view rName)
Definition: drawview.cxx:681
virtual void SetLayer(SdrLayerID nLayer)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
void Construct()
Definition: drawview.cxx:71
sal_uInt16 GetCurRefDlgId() const
Definition: scmod.hxx:228
bool calculateGridOffsetForB2DRange(const basegfx::B2DRange &rB2DRange, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:1060
bool GetUseGridSnap() const
#define DBG_ASSERT(sCon, aError)
virtual SdrUndoManager * getSdrUndoManagerForEnhancedTextEdit() const override
Definition: drawview.cxx:1109
int i
uno_Any a
bool SelectObject(std::u16string_view rName)
Definition: drawview.cxx:732
sal_Int16 SCCOL
Definition: types.hxx:21
void SetMarkedToLayer(SdrLayerID nLayerNo)
Definition: drawview.cxx:212
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
Definition: drwlayer.cxx:2624
#define SC_MOD()
Definition: scmod.hxx:249
Size GetSize() const
void InvalidateDrawTextAttrs()
Definition: drawview.cxx:162
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1796
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
Definition: drawview.cxx:851
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true)
void RecalcScale()
Definition: drawview.cxx:298
OBJ_GRAF
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:611
const OUString & GetName() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
sal_uInt32 GetFieldDivisionX() const
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
SdrModel & getSdrModelFromSdrObject() const
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:87
SdrLayer * GetLayerPerID(SdrLayerID nID)
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:95
MapUnit GetMapUnit() const
SfxViewShell * GetViewShell() const
SdrInsertFlags
SCCOL Col() const
Definition: address.hxx:266
virtual void DoConnect(SdrOle2Obj *pOleObj) override
Definition: drawview.cxx:352
void DeactivateObject()
virtual SdrLayerID GetLayer() const
void DoCut()
Definition: drawview.cxx:284
Point PixelToLogic(const Point &rDevicePt) const
bool InsertObjectSafe(SdrObject *pObj, SdrPageView &rPV)
Definition: drawview.cxx:804
void SetDrawFormShell(bool bActive)
Definition: tabvwsh4.cxx:709
SdrObject * Next()
void SetVerbs(const css::uno::Sequence< css::embed::VerbDescriptor > &aVerbs)
virtual void ModelHasChanged() override
Definition: drawview.cxx:612
sal_Int32 SCROW
Definition: types.hxx:17
SfxViewShell * GetViewShell() const
void SelectionChanged()
Definition: viewuno.cxx:1641
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
Definition: drawview.cxx:588
double getMinY() const
SfxInPlaceClient * GetIPClient() const
ScCaptionPtr mxCaption
Initial data for invisible notes without SdrObject.
Definition: postit.hxx:150
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
Definition: drwlayer.cxx:1420
void setY(double fY)
Internal data for a cell annotation.
Definition: postit.hxx:143
bool IsInPlace() const
const SdrCaptionObj * get() const
Definition: postit.hxx:53
virtual void MarkListHasChanged() override
SdrPage * GetPage() const
void CheckSelectionTransfer()
Definition: tabview3.cxx:472
static ScDrawObjData * GetObjDataTab(SdrObject *pObj, SCTAB nTab)
Definition: drwlayer.cxx:2605
SdrObject * GetMarkedNoteCaption(ScDrawObjData **ppCaptData)
Returns the selected object, if it is the caption object of a cell note.
Definition: drawview.cxx:820
constexpr SdrLayerID SC_LAYER_FRONT(0)
css::uno::Reference< css::frame::XController > GetController() const
constexpr SdrLayerID SC_LAYER_INTERN(2)
virtual void DeleteMarked()
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
void SetOleObjectShell(bool bActive)
Definition: tabvwsh4.cxx:740
sal_uInt32 GetFieldDrawY() const
static OUString GetVisibleName(const SdrObject *pObj)
Definition: drwlayer.cxx:2135
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:894
static bool IsChart(const SdrObject *pObject)
Definition: documen9.cxx:203
SdrObject * ApplyGraphicToObject(SdrObject &rHitObject, const Graphic &rGraphic, const OUString &rBeginUndoText, const OUString &rFile)
Definition: drawview.cxx:1115
void InvalidateAll(bool bWithMsg)
double getMinX() const
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const override
Definition: drawview.cxx:1243
virtual const tools::Rectangle & GetLogicRect() const
bool IsRefDialogOpen()
Definition: scmod.cxx:1606
bool GetGridVisible() const
rtl::OString toString() const
static void CalcScale(const ScDocument &rDoc, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const OutputDevice *pDev, const Fraction &rZoomX, const Fraction &rZoomY, double nPPTX, double nPPTY, Fraction &rScaleX, Fraction &rScaleY)
Definition: drawutil.cxx:30
OBJ_TEXT
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: drawview.cxx:842
OBJ_OLE2
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
OutputDevice & GetOutputDevice() const
bool calculateGridOffsetForSdrObject(SdrObject &rSdrObject, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:998
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:794
OBJ_MEDIA
#define SC_HANDLESIZE_BIG
Definition: drawview.cxx:69
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
bool IsUndoEnabled() const
sal_uInt32 PageWindowCount() const
const ScDrawView & mrScDrawView
Definition: drawview.cxx:1160