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() == SdrObjKind::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() == SdrObjKind::Graphic)
415  {
416  pGrafObj = static_cast<SdrGrafObj*>(pObj);
417  pViewSh->SetGraphicShell(true);
418  bSubShellSet = true;
419  }
420  else if (pObj->GetObjIdentifier() == SdrObjKind::Media)
421  {
422  pViewSh->SetMediaShell(true);
423  bSubShellSet = true;
424  }
425  else if (pObj->GetObjIdentifier() != SdrObjKind::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() != SdrObjKind::Graphic)
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() != SdrObjKind::Graphic)
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  rOutDev.GetOwnerWindow()->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::getFromUnoTunnel<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  {
568  aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
569  }
570  OString sRectangle = aRectangle.toString();
571  SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
572  }
573  }
574 
575  if ( pViewSh->GetViewFrame() )
576  {
577  SfxFrame& rFrame = pViewSh->GetViewFrame()->GetFrame();
578  uno::Reference< frame::XController > xController = rFrame.GetController();
579  if (xController.is())
580  {
581  ScTabViewObj* pImp = comphelper::getFromUnoTunnel<ScTabViewObj>( xController );
582  if (pImp)
583  pImp->SelectionChanged();
584  }
585  }
586 
587  return bRet;
588 }
589 
591 {
592  const SdrEndTextEditKind eRet = FmFormView::SdrEndTextEdit( bDontDeleteReally );
593 
594  ScTabViewShell* pViewSh = pViewData->GetViewShell();
595 
597  SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", "EMPTY");
598 
599  if ( pViewSh->GetViewFrame() )
600  {
601  SfxFrame& rFrame = pViewSh->GetViewFrame()->GetFrame();
602  uno::Reference< frame::XController > xController = rFrame.GetController();
603  if (xController.is())
604  {
605  ScTabViewObj* pImp = comphelper::getFromUnoTunnel<ScTabViewObj>( xController );
606  if (pImp)
607  pImp->SelectionChanged();
608  }
609  }
610 
611  return eRet;
612 }
613 
615 {
616  SdrObject* pEditObj = GetTextEditObject();
617  if ( pEditObj && !pEditObj->IsInserted() && pViewData )
618  {
619  // SdrObjEditView::ModelHasChanged will end text edit in this case,
620  // so make sure the EditEngine's undo manager is no longer used.
621  pViewData->GetViewShell()->SetDrawTextUndo(nullptr);
622  SetCreateMode(); // don't leave FuText in a funny state
623  }
624 
626 }
627 
629 {
630  if (!pViewData)
631  return;
632 
633  const ScViewOptions& rOpt = pViewData->GetOptions();
634  const ScGridOptions& rGrid = rOpt.GetGridOptions();
635 
636  SetDragStripes( rOpt.GetOption( VOPT_HELPLINES ) );
637  SetMarkHdlSizePixel( SC_HANDLESIZE_BIG );
638 
639  SetGridVisible( rGrid.GetGridVisible() );
640  SetSnapEnabled( rGrid.GetUseGridSnap() );
641  SetGridSnap( rGrid.GetUseGridSnap() );
642 
643  Fraction aFractX( rGrid.GetFieldDrawX(), rGrid.GetFieldDivisionX() + 1 );
644  Fraction aFractY( rGrid.GetFieldDrawY(), rGrid.GetFieldDivisionY() + 1 );
645  SetSnapGridWidth( aFractX, aFractY );
646 
647  SetGridCoarse( Size( rGrid.GetFieldDrawX(), rGrid.GetFieldDrawY() ) );
648  SetGridFine( Size( rGrid.GetFieldDrawX() / (rGrid.GetFieldDivisionX() + 1),
649  rGrid.GetFieldDrawY() / (rGrid.GetFieldDivisionY() + 1) ) );
650 }
651 
652 SdrObject* ScDrawView::GetObjectByName(std::u16string_view rName)
653 {
654  SfxObjectShell* pShell = rDoc.GetDocumentShell();
655  if (pShell)
656  {
657  SdrModel* pDrawLayer = GetModel();
658  sal_uInt16 nTabCount = rDoc.GetTableCount();
659  for (sal_uInt16 i=0; i<nTabCount; i++)
660  {
661  SdrPage* pPage = pDrawLayer->GetPage(i);
662  DBG_ASSERT(pPage,"Page ?");
663  if (pPage)
664  {
665  SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
666  SdrObject* pObject = aIter.Next();
667  while (pObject)
668  {
669  if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
670  {
671  return pObject;
672  }
673  pObject = aIter.Next();
674  }
675  }
676  }
677  }
678  return nullptr;
679 }
680 
681 //realize multi-selection of objects
682 
683 void ScDrawView::SelectCurrentViewObject( std::u16string_view rName )
684 {
685  sal_uInt16 nObjectTab = 0;
686  SdrObject* pFound = nullptr;
687  SfxObjectShell* pShell = rDoc.GetDocumentShell();
688  if (pShell)
689  {
690  SdrModel* pDrawLayer = GetModel();
691  sal_uInt16 nTabCount = rDoc.GetTableCount();
692  for (sal_uInt16 i=0; i<nTabCount && !pFound; i++)
693  {
694  SdrPage* pPage = pDrawLayer->GetPage(i);
695  DBG_ASSERT(pPage,"Page ?");
696  if (pPage)
697  {
698  SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
699  SdrObject* pObject = aIter.Next();
700  while (pObject && !pFound)
701  {
702  if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
703  {
704  pFound = pObject;
705  nObjectTab = i;
706  }
707  pObject = aIter.Next();
708  }
709  }
710  }
711  }
712  if ( !pFound )
713  return;
714 
715  ScTabView* pView = pViewData->GetView();
716  if ( nObjectTab != nTab ) // switch sheet
717  pView->SetTabNo( nObjectTab );
718  DBG_ASSERT( nTab == nObjectTab, "Switching sheets did not work" );
719  pView->ScrollToObject( pFound );
720  if ( pFound->GetLayer() == SC_LAYER_BACK &&
721  !pViewData->GetViewShell()->IsDrawSelMode() &&
722  !rDoc.IsTabProtected( nTab ) &&
723  !pViewData->GetSfxDocShell()->IsReadOnly() )
724  {
725  SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
726  if (pLayer)
727  SetLayerLocked( pLayer->GetName(), false );
728  }
729  SdrPageView* pPV = GetSdrPageView();
730  const bool bUnMark = IsObjMarked(pFound);
731  MarkObj( pFound, pPV, bUnMark);
732 }
733 
734 bool ScDrawView::SelectObject( std::u16string_view rName )
735 {
736  UnmarkAll();
737 
738  SCTAB nObjectTab = 0;
739  SdrObject* pFound = nullptr;
740 
741  SfxObjectShell* pShell = rDoc.GetDocumentShell();
742  if (pShell)
743  {
744  SdrModel* pDrawLayer = GetModel();
745  SCTAB nTabCount = rDoc.GetTableCount();
746  for (SCTAB i=0; i<nTabCount && !pFound; i++)
747  {
748  SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i));
749  OSL_ENSURE(pPage,"Page ?");
750  if (pPage)
751  {
752  SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
753  SdrObject* pObject = aIter.Next();
754  while (pObject && !pFound)
755  {
756  if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
757  {
758  pFound = pObject;
759  nObjectTab = i;
760  }
761  pObject = aIter.Next();
762  }
763  }
764  }
765  }
766 
767  if ( pFound )
768  {
769  ScTabView* pView = pViewData->GetView();
770  if ( nObjectTab != nTab ) // switch sheet
771  pView->SetTabNo( nObjectTab );
772 
773  OSL_ENSURE( nTab == nObjectTab, "Switching sheets did not work" );
774 
775  pView->ScrollToObject( pFound );
776 
777  /* To select an object on the background layer, the layer has to
778  be unlocked even if exclusive drawing selection mode is not active
779  (this is reversed in MarkListHasChanged when nothing is selected) */
780  if ( pFound->GetLayer() == SC_LAYER_BACK &&
781  !pViewData->GetViewShell()->IsDrawSelMode() &&
782  !rDoc.IsTabProtected( nTab ) &&
783  !pViewData->GetSfxDocShell()->IsReadOnly() )
784  {
785  LockBackgroundLayer(false);
786  }
787 
788  SdrPageView* pPV = GetSdrPageView();
789  MarkObj( pFound, pPV );
790  }
791 
792  return ( pFound != nullptr );
793 }
794 
795 //If object is marked , return true , else return false .
797 {
798  bool bisMarked = false;
799  if (pObject )
800  {
801  bisMarked = IsObjMarked(pObject);
802  }
803  return bisMarked;
804 }
805 
807 {
808  SdrInsertFlags nOptions=SdrInsertFlags::NONE;
809  // Do not change marks when the ole object is active
810  // (for Drop from ole object would otherwise be deactivated in the middle of ExecuteDrag!)
811 
812  if (pViewData)
813  {
814  SfxInPlaceClient* pClient = pViewData->GetViewShell()->GetIPClient();
815  if ( pClient && pClient->IsObjectInPlaceActive() )
816  nOptions |= SdrInsertFlags::DONTMARK;
817  }
818 
819  return InsertObjectAtView(pObj, rPV, nOptions);
820 }
821 
823 {
824  const SdrMarkList& rMarkList = GetMarkedObjectList();
825  if( pViewData && (rMarkList.GetMarkCount() == 1) )
826  {
827  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
828  if( ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, pViewData->GetTabNo() ) )
829  {
830  if( ppCaptData ) *ppCaptData = pCaptData;
831  return pObj;
832  }
833  }
834  return nullptr;
835 }
836 
837 void ScDrawView::LockCalcLayer( SdrLayerID nLayer, bool bLock )
838 {
839  SdrLayer* pLockLayer = GetModel()->GetLayerAdmin().GetLayerPerID( nLayer );
840  if( pLockLayer && (IsLayerLocked( pLockLayer->GetName() ) != bLock) )
841  SetLayerLocked( pLockLayer->GetName(), bLock );
842 }
843 
845 {
848 
849  if ( pViewData && pViewData->GetActiveWin() == &rWin )
850  pViewData->GetView()->MakeVisible( rRect );
851 }
852 
854 {
855  return pViewData->GetViewShell();
856 }
857 
859 {
860  // try to delete a note caption object with its cell note in the Calc document
861  ScDrawObjData* pCaptData = nullptr;
862  if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
863  {
864  ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
865  ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr;
866  SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : nullptr;
867  bool bUndo = pDrawLayer && pDocShell && pUndoMgr && rDoc.IsUndoEnabled();
868 
869  // remove the cell note from document, we are its owner now
870  std::unique_ptr<ScPostIt> pNote = rDoc.ReleaseNote( pCaptData->maStart );
871  OSL_ENSURE( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
872  if( pNote )
873  {
874  // rescue note data for undo (with pointer to caption object)
875  ScNoteData aNoteData = pNote->GetNoteData();
876  OSL_ENSURE( aNoteData.mxCaption.get() == pCaptObj, "ScDrawView::DeleteMarked - caption object does not match" );
877  // collect the drawing undo action created while deleting the note
878  if( bUndo )
879  pDrawLayer->BeginCalcUndo(false);
880  // delete the note (already removed from document above)
881  pNote.reset();
882  // add the undo action for the note
883  if( bUndo )
884  pUndoMgr->AddUndoAction( std::make_unique<ScUndoReplaceNote>( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
885  // repaint the cell to get rid of the note marker
886  if( pDocShell )
887  pDocShell->PostPaintCell( pCaptData->maStart );
888  // done, return now to skip call of FmFormView::DeleteMarked()
889  return;
890  }
891  }
892 
894 }
895 
897 {
898  bool bIsTextEdit = IsTextEdit();
899  SdrEndTextEditKind eKind = SdrEndTextEdit();
900 
901  if (bIsTextEdit)
902  pViewData->GetViewShell()->SetDrawTextUndo(nullptr); // the "normal" undo manager
903 
904  return eKind;
905 }
906 
908 {
909  if ( pDropMarkObj != pObj )
910  {
911  pDropMarkObj = pObj;
912  ImplClearCalcDropMarker();
913 
914  if(pDropMarkObj)
915  {
916  pDropMarker.reset( new SdrDropMarkerOverlay(*this, *pDropMarkObj) );
917  }
918  }
919 }
920 
921 // In order to counteract the effects of rounding due to the nature of how the
922 // grid positions are calculated and drawn we calculate the offset needed at the
923 // current zoom to be applied to an SrdObject when it is drawn in order to make
924 // sure that it's position relative to the nearest cell anchor doesn't change.
925 // Of course not all shape(s)/control(s) are cell anchored, if the
926 // object doesn't have a cell anchor we synthesise a temporary anchor.
928 {
929  // process members of a group shape separately
930  if ( auto pObjGroup = dynamic_cast<const SdrObjGroup*>( pObj) )
931  {
932  SdrObjList *pLst = pObjGroup->GetSubList();
933  for ( size_t i = 0, nCount = pLst->GetObjCount(); i < nCount; ++i )
934  SyncForGrid( pLst->GetObj( i ) );
935  }
936 
937  ScSplitPos eWhich = pViewData->GetActivePart();
938  ScGridWindow* pGridWin = pViewData->GetActiveWin();
940  if ( !pGridWin )
941  return;
942 
943  ScAddress aOldStt;
944  if( pData && pData->maStart.IsValid())
945  {
946  aOldStt = pData->maStart;
947  }
948  else
949  {
950  // Page anchored object so...
951  // synthesise an anchor ( but don't attach it to
952  // the object as we want to maintain page anchoring )
953  ScDrawObjData aAnchor;
954  const tools::Rectangle aObjRect(pObj->GetLogicRect());
956  aObjRect,
957  aAnchor,
958  rDoc,
959  GetTab());
960  aOldStt = aAnchor.maStart;
961  }
962  MapMode aDrawMode = pGridWin->GetDrawMapMode();
963  // find pos anchor position
964  Point aOldPos( rDoc.GetColOffset( aOldStt.Col(), aOldStt.Tab() ), rDoc.GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
965  aOldPos.setX(convertTwipToMm100(aOldPos.X()));
966  aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
967  // find position of same point on the screen ( e.g. grid )
968  Point aCurPos = pViewData->GetScrPos( aOldStt.Col(), aOldStt.Row(), eWhich, true );
969  Point aCurPosHmm = pGridWin->PixelToLogic(aCurPos, aDrawMode );
970  Point aGridOff = aCurPosHmm - aOldPos;
971  // fdo#63878 Fix the X position for RTL Sheet
972  if( rDoc.IsNegativePage( GetTab() ) && !comphelper::LibreOfficeKit::isActive() )
973  aGridOff.setX( aCurPosHmm.getX() + aOldPos.getX() );
974 }
975 
977 {
978  SdrPageView* pPageView(GetSdrPageView());
979 
980  if(nullptr == pPageView)
981  return;
982 
983  for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
984  {
985  SdrPageWindow* pPageWindow(pPageView->GetPageWindow(a));
986  assert(pPageWindow && "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
987 
988  if(nullptr != pPageWindow)
989  {
990  sdr::contact::ObjectContact& rObjectContact(pPageWindow->GetObjectContact());
991 
992  if(rObjectContact.supportsGridOffsets())
993  {
994  rObjectContact.resetAllGridOffsets();
995  }
996  }
997  }
998 }
999 
1001  SdrObject& rSdrObject,
1002  basegfx::B2DVector& rTarget) const
1003 {
1006  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1007  return false;
1008 
1009  ScGridWindow* pGridWin(pViewData->GetActiveWin());
1010 
1011  if(nullptr == pGridWin)
1012  {
1013  return false;
1014  }
1015 
1017  ScAddress aOldStt;
1018 
1019  if(nullptr != pData && pData->maStart.IsValid())
1020  {
1021  aOldStt = pData->maStart;
1022  }
1023  else
1024  {
1025  // Page anchored object so...
1026  // synthesise an anchor ( but don't attach it to
1027  // the object as we want to maintain page anchoring )
1028  ScDrawObjData aAnchor;
1029  const tools::Rectangle aObjRect(rSdrObject.GetLogicRect());
1031  aObjRect,
1032  aAnchor,
1033  rDoc,
1034  GetTab());
1035  aOldStt = aAnchor.maStart;
1036  }
1037 
1038  MapMode aDrawMode = pGridWin->GetDrawMapMode();
1039 
1040  // find pos anchor position
1041  Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
1042  aOldPos.setX(convertTwipToMm100(aOldPos.X()));
1043  aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
1044 
1045  // find position of same point on the screen ( e.g. grid )
1046  ScSplitPos eWhich(pViewData->GetActivePart());
1047  Point aCurPos(pViewData->GetScrPos(aOldStt.Col(), aOldStt.Row(), eWhich, true));
1048  Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
1049  Point aGridOff(aCurPosHmm - aOldPos);
1050 
1051  bool bLOKActive = comphelper::LibreOfficeKit::isActive();
1052  bool bNegativePage = rDoc.IsNegativePage(GetTab());
1053 
1054  // fdo#63878 Fix the X position for RTL Sheet
1055  if(bNegativePage && !bLOKActive)
1056  {
1057  aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
1058  }
1059 
1060  rTarget.setX(bNegativePage && bLOKActive ? -aGridOff.X() : aGridOff.X());
1061  rTarget.setY(aGridOff.Y());
1062  return true;
1063 }
1064 
1066  const basegfx::B2DRange& rB2DRange,
1067  basegfx::B2DVector& rTarget) const
1068 {
1069  ScGridWindow* pGridWin(pViewData->GetActiveWin());
1070 
1071  if(nullptr == pGridWin || rB2DRange.isEmpty())
1072  {
1073  return false;
1074  }
1075 
1076  // No SdrObject, so synthesise an anchor ( but don't attach it to
1077  // the object as we want to maintain page anchoring )
1078  ScDrawObjData aAnchor;
1079  const tools::Rectangle aRectangle(
1080  basegfx::fround(rB2DRange.getMinX()), basegfx::fround(rB2DRange.getMinY()),
1081  basegfx::fround(rB2DRange.getMaxX()), basegfx::fround(rB2DRange.getMaxY()));
1083  aRectangle,
1084  aAnchor,
1085  rDoc,
1086  GetTab());
1087  ScAddress aOldStt(aAnchor.maStart);
1088 
1089  MapMode aDrawMode = pGridWin->GetDrawMapMode();
1090 
1091  // find pos anchor position
1092  Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
1093  aOldPos.setX(convertTwipToMm100(aOldPos.X()));
1094  aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
1095 
1096  // find position of same point on the screen ( e.g. grid )
1097  ScSplitPos eWhich(pViewData->GetActivePart());
1098  Point aCurPos(pViewData->GetScrPos(aOldStt.Col(), aOldStt.Row(), eWhich, true));
1099  Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
1100  Point aGridOff(aCurPosHmm - aOldPos);
1101 
1102  bool bLOKActive = comphelper::LibreOfficeKit::isActive();
1103  bool bNegativePage = rDoc.IsNegativePage(GetTab());
1104 
1105  // fdo#63878 Fix the X position for RTL Sheet
1106  if(bNegativePage && !bLOKActive)
1107  {
1108  aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
1109  }
1110 
1111  rTarget.setX(bLOKActive && bNegativePage ? -aGridOff.X() : aGridOff.X());
1112  rTarget.setY(aGridOff.Y());
1113  return true;
1114 }
1115 
1116 // Create a new view-local UndoManager manager for Calc
1117 std::unique_ptr<SdrUndoManager> ScDrawView::createLocalTextUndoManager()
1118 {
1119  std::unique_ptr<SdrUndoManager> pUndoManager(new SdrUndoManager);
1120  ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr;
1121  pUndoManager->SetDocShell(pDocShell);
1122  return pUndoManager;
1123 }
1124 
1125 // #i123922# helper to apply a Graphic to an existing SdrObject
1127  SdrObject& rHitObject,
1128  const Graphic& rGraphic,
1129  const OUString& rBeginUndoText,
1130  const OUString& rFile)
1131 {
1132  if(dynamic_cast< SdrGrafObj* >(&rHitObject))
1133  {
1134  SdrGrafObj* pNewGrafObj(static_cast<SdrGrafObj*>(rHitObject.CloneSdrObject(rHitObject.getSdrModelFromSdrObject())));
1135 
1136  pNewGrafObj->SetGraphic(rGraphic);
1137  BegUndo(rBeginUndoText);
1138  ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj);
1139 
1140  // set in all cases - the Clone() will have copied an existing link (!)
1141  pNewGrafObj->SetGraphicLink( rFile );
1142 
1143  EndUndo();
1144  return pNewGrafObj;
1145  }
1146  else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
1147  {
1148  AddUndo(std::make_unique<SdrUndoAttrObj>(rHitObject));
1149 
1150  SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLBITMAP> aSet(GetModel()->GetItemPool());
1151 
1152  aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
1153  aSet.Put(XFillBitmapItem(OUString(), rGraphic));
1154  rHitObject.SetMergedItemSetAndBroadcast(aSet);
1155  return &rHitObject;
1156  }
1157 
1158  return nullptr;
1159 }
1160 
1161 // Own derivation of ObjectContact to allow on-demand calculation of
1162 // GridOffset for non-linear ViewToDevice transformation (calc)
1163 namespace sdr::contact
1164 {
1165  namespace {
1166 
1167  class ObjectContactOfScDrawView final : public ObjectContactOfPageView
1168  {
1169  private:
1170  // The ScDrawView to work on
1172 
1173  public:
1174  explicit ObjectContactOfScDrawView(
1175  const ScDrawView& rScDrawView,
1176  SdrPageWindow& rPageWindow,
1177  const char* pDebugName);
1178 
1179  virtual bool supportsGridOffsets() const override;
1180  virtual void calculateGridOffsetForViewOjectContact(
1181  basegfx::B2DVector& rTarget,
1182  const ViewObjectContact& rClient) const override;
1183  virtual void calculateGridOffsetForB2DRange(
1184  basegfx::B2DVector& rTarget,
1185  const basegfx::B2DRange& rB2DRange) const override;
1186  };
1187 
1188  }
1189 
1190  ObjectContactOfScDrawView::ObjectContactOfScDrawView(
1191  const ScDrawView& rScDrawView,
1192  SdrPageWindow& rPageWindow,
1193  const char* pDebugName)
1194  : ObjectContactOfPageView(rPageWindow, pDebugName),
1195  mrScDrawView(rScDrawView)
1196  {
1197  }
1198 
1199  bool ObjectContactOfScDrawView::supportsGridOffsets() const
1200  {
1201  // Except when scPrintTwipsMsgs flag is active,
1202  // Calc in LOK mode directly sets pixel-aligned logical coordinates for draw-objects.
1205  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1206  return false;
1207 
1208  // no GridOffset support for printer
1209  if(isOutputToPrinter())
1210  {
1211  return false;
1212  }
1213 
1214  // no GridOffset support for PDF export
1215  if(isOutputToPDFFile())
1216  {
1217  return false;
1218  }
1219 
1220  // yes - we support it
1221  return true;
1222  }
1223 
1224  void ObjectContactOfScDrawView::calculateGridOffsetForViewOjectContact(
1225  basegfx::B2DVector& rTarget,
1226  const ViewObjectContact& rClient) const
1227  {
1228  // Here the on-demand calculation happens. Try to access the SdrObject involved
1229  SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1230 
1231  if(nullptr != pTargetSdrObject)
1232  {
1234  *pTargetSdrObject,
1235  rTarget);
1236  }
1237  }
1238 
1239  void ObjectContactOfScDrawView::calculateGridOffsetForB2DRange(
1240  basegfx::B2DVector& rTarget,
1241  const basegfx::B2DRange& rB2DRange) const
1242  {
1243  // Here the on-demand calculation happens. Try to access the SdrObject involved
1244  if(!rB2DRange.isEmpty())
1245  {
1247  rB2DRange,
1248  rTarget);
1249  }
1250  }
1251 }
1252 
1253 // Create own derivation of ObjectContact for calc
1255  SdrPageWindow& rPageWindow,
1256  const char* pDebugName) const
1257 {
1258  return new sdr::contact::ObjectContactOfScDrawView(
1259  *this,
1260  rPageWindow,
1261  pDebugName);
1262 }
1263 
1264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
Definition: drwlayer.cxx:1426
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:2371
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
void UpdateUserViewOptions()
Definition: drawview.cxx:628
virtual ~ScDrawView() override
Definition: drawview.cxx:133
void ImplClearCalcDropMarker()
Definition: drawview.cxx:128
size_t GetMarkCount() const
bool IsClosedObj() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
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:274
bool IsObjectInPlaceActive() const
void SetMediaShell(bool bActive)
Definition: tabvwsh4.cxx:752
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: docsh3.cxx:188
std::unique_ptr< sal_Int32[]> pData
std::unique_ptr< SdrUndoManager > createLocalTextUndoManager() override
Definition: drawview.cxx:1117
sal_uInt32 GetFieldDrawX() const
SdrEndTextEditKind
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2602
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
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:652
bool HasMarkedInternal() const
Definition: drawview.cxx:253
constexpr SdrLayerID SC_LAYER_BACK(1)
void Unmark()
Definition: tabview3.cxx:1727
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
void PaintImmediately()
EmbeddedObjectRef * pObject
ScAddress maStart
Definition: userdat.hxx:36
void resetGridOffsetsForAllSdrPageViews()
Definition: drawview.cxx:976
void setX(double fX)
ScSplitPos
Definition: viewdata.hxx:44
constexpr auto convertTwipToMm100(N n)
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2945
virtual void DeleteMarked() override
Definition: drawview.cxx:858
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
Reference< XController > xController
OUTDEV_WINDOW
void LockCalcLayer(SdrLayerID nLayer, bool bLock)
Locks/unlocks the specified layer in the draw page.
Definition: drawview.cxx:837
SfxFrame & GetFrame() const
int nCount
void SetGraphic(const Graphic &rGrf)
bool isCompatFlagSet(Compat flag)
SCTAB Tab() const
Definition: address.hxx:283
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:1043
void GetScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawview.cxx:292
void MarkDropObj(SdrObject *pObj)
Definition: drawview.cxx:907
B2IRange fround(const B2DRange &rRange)
void ScrollToObject(const SdrObject *pDrawObj)
Definition: tabview5.cxx:549
void SetGraphicShell(bool bActive)
Definition: tabvwsh4.cxx:744
void UpdateWorkArea()
Definition: drawview.cxx:263
void SyncForGrid(SdrObject *pObj)
Definition: drawview.cxx:927
bool IsValid() const
Definition: address.hxx:305
constexpr double nPPTX
SdrObject * GetMarkedSdrObj() const
void SetChartShell(bool bActive)
Definition: tabvwsh4.cxx:736
virtual void MarkListHasChanged() override
Definition: drawview.cxx:358
void SelectCurrentViewObject(std::u16string_view rName)
Definition: drawview.cxx:683
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:1065
bool GetUseGridSnap() const
#define DBG_ASSERT(sCon, aError)
int i
uno_Any a
bool SelectObject(std::u16string_view rName)
Definition: drawview.cxx:734
sal_Int16 SCCOL
Definition: types.hxx:21
void SetMarkedToLayer(SdrLayerID nLayerNo)
Definition: drawview.cxx:212
const MapMode & GetMapMode() const
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
Definition: drwlayer.cxx:2635
#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:1802
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
Definition: drawview.cxx:853
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
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:612
const OUString & GetName() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
sal_uInt32 GetFieldDivisionX() const
SdrModel & getSdrModelFromSdrObject() const
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
SdrLayer * GetLayerPerID(SdrLayerID nID)
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:96
MapUnit GetMapUnit() const
Point PixelToLogic(const Point &rDevicePt) const
SfxViewShell * GetViewShell() const
SdrInsertFlags
SCCOL Col() const
Definition: address.hxx:279
virtual void DoConnect(SdrOle2Obj *pOleObj) override
Definition: drawview.cxx:352
void DeactivateObject()
virtual SdrLayerID GetLayer() const
void DoCut()
Definition: drawview.cxx:284
void setY(double fY)
bool InsertObjectSafe(SdrObject *pObj, SdrPageView &rPV)
Definition: drawview.cxx:806
void SetDrawFormShell(bool bActive)
Definition: tabvwsh4.cxx:729
SdrObject * Next()
void SetVerbs(const css::uno::Sequence< css::embed::VerbDescriptor > &aVerbs)
virtual void ModelHasChanged() override
Definition: drawview.cxx:614
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_Int32 SCROW
Definition: types.hxx:17
SfxViewShell * GetViewShell() const
void SelectionChanged()
Definition: viewuno.cxx:1639
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
Definition: drawview.cxx:590
SfxInPlaceClient * GetIPClient() const
ScCaptionPtr mxCaption
Initial data for invisible notes without SdrObject.
Definition: postit.hxx:151
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
Definition: drwlayer.cxx:1433
Internal data for a cell annotation.
Definition: postit.hxx:144
bool IsInPlace() const
const SdrCaptionObj * get() const
Definition: postit.hxx:54
virtual void MarkListHasChanged() override
SdrPage * GetPage() const
void CheckSelectionTransfer()
Definition: tabview3.cxx:474
static ScDrawObjData * GetObjDataTab(SdrObject *pObj, SCTAB nTab)
Definition: drwlayer.cxx:2616
SdrObject * GetMarkedNoteCaption(ScDrawObjData **ppCaptData)
Returns the selected object, if it is the caption object of a cell note.
Definition: drawview.cxx:822
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:760
sal_uInt32 GetFieldDrawY() const
static OUString GetVisibleName(const SdrObject *pObj)
Definition: drwlayer.cxx:2146
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:896
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:1126
void InvalidateAll(bool bWithMsg)
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const override
Definition: drawview.cxx:1254
virtual const tools::Rectangle & GetLogicRect() const
bool IsRefDialogOpen()
Definition: scmod.cxx:1662
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:29
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: drawview.cxx:844
virtual vcl::Window * GetOwnerWindow() const
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
OutputDevice & GetOutputDevice() const
bool calculateGridOffsetForSdrObject(SdrObject &rSdrObject, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:1000
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:796
#define SC_HANDLESIZE_BIG
Definition: drawview.cxx:69
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
bool m_bDetectedRangeSegmentation false
bool IsUndoEnabled() const
sal_uInt32 PageWindowCount() const
const ScDrawView & mrScDrawView
Definition: drawview.cxx:1171