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>
32#include <sfx2/bindings.hxx>
33#include <sfx2/viewfrm.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>
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
67using namespace com::sun::star;
68
69#define SC_HANDLESIZE_BIG 9
70
72{
75
77
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 ) ||
89
90 SdrLayer* pLayer;
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
115 }
116 else
117 {
118 ShowSdrPage(GetModel().GetPage(nTab));
119 }
120
122 RecalcScale();
124
125 bInConstruct = false;
126}
127
129{
130 pDropMarker.reset();
131}
132
134{
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
238
239 // check mark list now instead of later in a timer
240 CheckMarked();
242}
243
245{
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...
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
292void 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 {
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,
332
333 // clear all evtl existing GridOffset vectors
335
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
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
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& rViewFrame = 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
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 SfxFrame& rFrame = rViewFrame.GetFrame();
526 uno::Reference<frame::XController> xController = rFrame.GetController();
527 if (xController.is())
528 {
529 ScTabViewObj* pImp = dynamic_cast<ScTabViewObj*>( xController.get() );
530 if (pImp)
531 pImp->SelectionChanged();
532 }
533
534 // update selection transfer object
535
536 pViewSh->CheckSelectionTransfer();
537
538}
539
541 SdrObject* pObj,
542 SdrPageView* pPV,
543 vcl::Window* pWinL,
544 bool bIsNewObj,
545 SdrOutliner* pGivenOutliner,
546 OutlinerView* pGivenOutlinerView,
547 bool bDontDeleteOutliner,
548 bool bOnlyOneView,
549 bool bGrabFocus )
550{
551 const bool bRet = FmFormView::SdrBeginTextEdit(
552 pObj, pPV, pWinL, bIsNewObj,
553 pGivenOutliner, pGivenOutlinerView, bDontDeleteOutliner,
554 bOnlyOneView, bGrabFocus );
555
557
559 {
561 {
562 tools::Rectangle aRectangle = pView->GetOutputArea();
563 if (pWinL && pWinL->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
564 {
565 aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
566 }
567 OString sRectangle = aRectangle.toString();
568 SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
569 }
570 }
571
572 SfxFrame& rFrame = pViewSh->GetViewFrame().GetFrame();
573 uno::Reference< frame::XController > xController = rFrame.GetController();
574 if (xController.is())
575 {
576 ScTabViewObj* pImp = dynamic_cast<ScTabViewObj*>( xController.get() );
577 if (pImp)
578 pImp->SelectionChanged();
579 }
580
581 return bRet;
582}
583
585{
586 const SdrEndTextEditKind eRet = FmFormView::SdrEndTextEdit( bDontDeleteReally );
587
589
591 SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", "EMPTY");
592
593 SfxFrame& rFrame = pViewSh->GetViewFrame().GetFrame();
594 uno::Reference< frame::XController > xController = rFrame.GetController();
595 if (xController.is())
596 {
597 ScTabViewObj* pImp = dynamic_cast<ScTabViewObj*>( xController.get() );
598 if (pImp)
599 pImp->SelectionChanged();
600 }
601
602 return eRet;
603}
604
606{
607 SdrObject* pEditObj = GetTextEditObject();
608 if ( pEditObj && !pEditObj->IsInserted() && pViewData )
609 {
610 // SdrObjEditView::ModelHasChanged will end text edit in this case,
611 // so make sure the EditEngine's undo manager is no longer used.
613 SetCreateMode(); // don't leave FuText in a funny state
614 }
615
617}
618
620{
621 if (!pViewData)
622 return;
623
624 const ScViewOptions& rOpt = pViewData->GetOptions();
625 const ScGridOptions& rGrid = rOpt.GetGridOptions();
626
629
632 SetGridSnap( rGrid.GetUseGridSnap() );
633
634 Fraction aFractX( rGrid.GetFieldDrawX(), rGrid.GetFieldDivisionX() + 1 );
635 Fraction aFractY( rGrid.GetFieldDrawY(), rGrid.GetFieldDivisionY() + 1 );
636 SetSnapGridWidth( aFractX, aFractY );
637
638 SetGridCoarse( Size( rGrid.GetFieldDrawX(), rGrid.GetFieldDrawY() ) );
639 SetGridFine( Size( rGrid.GetFieldDrawX() / (rGrid.GetFieldDivisionX() + 1),
640 rGrid.GetFieldDrawY() / (rGrid.GetFieldDivisionY() + 1) ) );
641}
642
643SdrObject* ScDrawView::GetObjectByName(std::u16string_view rName)
644{
646 if (pShell)
647 {
648 SdrModel& rDrawLayer = GetModel();
649 sal_uInt16 nTabCount = rDoc.GetTableCount();
650 for (sal_uInt16 i=0; i<nTabCount; i++)
651 {
652 SdrPage* pPage = rDrawLayer.GetPage(i);
653 DBG_ASSERT(pPage,"Page ?");
654 if (pPage)
655 {
656 SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
657 SdrObject* pObject = aIter.Next();
658 while (pObject)
659 {
660 if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
661 {
662 return pObject;
663 }
664 pObject = aIter.Next();
665 }
666 }
667 }
668 }
669 return nullptr;
670}
671
672//realize multi-selection of objects
673
674void ScDrawView::SelectCurrentViewObject( std::u16string_view rName )
675{
676 sal_uInt16 nObjectTab = 0;
677 SdrObject* pFound = nullptr;
679 if (pShell)
680 {
681 SdrModel& rDrawLayer = GetModel();
682 sal_uInt16 nTabCount = rDoc.GetTableCount();
683 for (sal_uInt16 i=0; i<nTabCount && !pFound; i++)
684 {
685 SdrPage* pPage = rDrawLayer.GetPage(i);
686 DBG_ASSERT(pPage,"Page ?");
687 if (pPage)
688 {
689 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
690 SdrObject* pObject = aIter.Next();
691 while (pObject && !pFound)
692 {
693 if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
694 {
695 pFound = pObject;
696 nObjectTab = i;
697 }
698 pObject = aIter.Next();
699 }
700 }
701 }
702 }
703 if ( !pFound )
704 return;
705
706 ScTabView* pView = pViewData->GetView();
707 if ( nObjectTab != nTab ) // switch sheet
708 pView->SetTabNo( nObjectTab );
709 DBG_ASSERT( nTab == nObjectTab, "Switching sheets did not work" );
710 pView->ScrollToObject( pFound );
711 if ( pFound->GetLayer() == SC_LAYER_BACK &&
715 {
717 if (pLayer)
718 SetLayerLocked( pLayer->GetName(), false );
719 }
721 const bool bUnMark = IsObjMarked(pFound);
722 MarkObj( pFound, pPV, bUnMark);
723}
724
725bool ScDrawView::SelectObject( std::u16string_view rName )
726{
727 UnmarkAll();
728
729 SCTAB nObjectTab = 0;
730 SdrObject* pFound = nullptr;
731
733 if (pShell)
734 {
735 SdrModel& rDrawLayer = GetModel();
736 SCTAB nTabCount = rDoc.GetTableCount();
737 for (SCTAB i=0; i<nTabCount && !pFound; i++)
738 {
739 SdrPage* pPage = rDrawLayer.GetPage(static_cast<sal_uInt16>(i));
740 OSL_ENSURE(pPage,"Page ?");
741 if (pPage)
742 {
743 SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
744 SdrObject* pObject = aIter.Next();
745 while (pObject && !pFound)
746 {
747 if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
748 {
749 pFound = pObject;
750 nObjectTab = i;
751 }
752 pObject = aIter.Next();
753 }
754 }
755 }
756 }
757
758 if ( pFound )
759 {
760 ScTabView* pView = pViewData->GetView();
761 if ( nObjectTab != nTab ) // switch sheet
762 pView->SetTabNo( nObjectTab );
763
764 OSL_ENSURE( nTab == nObjectTab, "Switching sheets did not work" );
765
766 pView->ScrollToObject( pFound );
767
768 /* To select an object on the background layer, the layer has to
769 be unlocked even if exclusive drawing selection mode is not active
770 (this is reversed in MarkListHasChanged when nothing is selected) */
771 if ( pFound->GetLayer() == SC_LAYER_BACK &&
775 {
776 LockBackgroundLayer(false);
777 }
778
780 MarkObj( pFound, pPV );
781 }
782
783 return ( pFound != nullptr );
784}
785
786//If object is marked , return true , else return false .
788{
789 bool bisMarked = false;
790 if (pObject )
791 {
792 bisMarked = IsObjMarked(pObject);
793 }
794 return bisMarked;
795}
796
798{
799 SdrInsertFlags nOptions=SdrInsertFlags::NONE;
800 // Do not change marks when the ole object is active
801 // (for Drop from ole object would otherwise be deactivated in the middle of ExecuteDrag!)
802
803 if (pViewData)
804 {
806 if ( pClient && pClient->IsObjectInPlaceActive() )
807 nOptions |= SdrInsertFlags::DONTMARK;
808 }
809
810 return InsertObjectAtView(pObj, rPV, nOptions);
811}
812
814{
815 const SdrMarkList& rMarkList = GetMarkedObjectList();
816 if( pViewData && (rMarkList.GetMarkCount() == 1) )
817 {
818 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
820 {
821 if( ppCaptData ) *ppCaptData = pCaptData;
822 return pObj;
823 }
824 }
825 return nullptr;
826}
827
828void ScDrawView::LockCalcLayer( SdrLayerID nLayer, bool bLock )
829{
830 SdrLayer* pLockLayer = GetModel().GetLayerAdmin().GetLayerPerID( nLayer );
831 if( pLockLayer && (IsLayerLocked( pLockLayer->GetName() ) != bLock) )
832 SetLayerLocked( pLockLayer->GetName(), bLock );
833}
834
836{
839
840 if ( pViewData && pViewData->GetActiveWin() == &rWin )
841 pViewData->GetView()->MakeVisible( rRect );
842}
843
845{
846 return pViewData->GetViewShell();
847}
848
850{
851 // try to delete a note caption object with its cell note in the Calc document
852 ScDrawObjData* pCaptData = nullptr;
853 if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
854 {
855 ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
856 ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr;
857 SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : nullptr;
858 bool bUndo = pDrawLayer && pDocShell && pUndoMgr && rDoc.IsUndoEnabled();
859
860 // remove the cell note from document, we are its owner now
861 std::unique_ptr<ScPostIt> pNote = rDoc.ReleaseNote( pCaptData->maStart );
862 OSL_ENSURE( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
863 if( pNote )
864 {
865 // rescue note data for undo (with pointer to caption object)
866 ScNoteData aNoteData = pNote->GetNoteData();
867 OSL_ENSURE( aNoteData.mxCaption.get() == pCaptObj, "ScDrawView::DeleteMarked - caption object does not match" );
868 // collect the drawing undo action created while deleting the note
869 if( bUndo )
870 pDrawLayer->BeginCalcUndo(false);
871 // delete the note (already removed from document above)
872 pNote.reset();
873 // add the undo action for the note
874 if( bUndo )
875 pUndoMgr->AddUndoAction( std::make_unique<ScUndoReplaceNote>( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
876 // repaint the cell to get rid of the note marker
877 if( pDocShell )
878 pDocShell->PostPaintCell( pCaptData->maStart );
879 // done, return now to skip call of FmFormView::DeleteMarked()
880 return;
881 }
882 }
883
885}
886
888{
889 bool bIsTextEdit = IsTextEdit();
891
892 if (bIsTextEdit)
893 pViewData->GetViewShell()->SetDrawTextUndo(nullptr); // the "normal" undo manager
894
895 return eKind;
896}
897
899{
900 if ( pDropMarkObj != pObj )
901 {
902 pDropMarkObj = pObj;
904
905 if(pDropMarkObj)
906 {
907 pDropMarker.reset( new SdrDropMarkerOverlay(*this, *pDropMarkObj) );
908 }
909 }
910}
911
912// In order to counteract the effects of rounding due to the nature of how the
913// grid positions are calculated and drawn we calculate the offset needed at the
914// current zoom to be applied to an SrdObject when it is drawn in order to make
915// sure that it's position relative to the nearest cell anchor doesn't change.
916// Of course not all shape(s)/control(s) are cell anchored, if the
917// object doesn't have a cell anchor we synthesise a temporary anchor.
919{
920 // process members of a group shape separately
921 if ( auto pObjGroup = dynamic_cast<const SdrObjGroup*>( pObj) )
922 {
923 SdrObjList *pLst = pObjGroup->GetSubList();
924 for ( size_t i = 0, nCount = pLst->GetObjCount(); i < nCount; ++i )
925 SyncForGrid( pLst->GetObj( i ) );
926 }
927
929 ScGridWindow* pGridWin = pViewData->GetActiveWin();
931 if ( !pGridWin )
932 return;
933
934 ScAddress aOldStt;
935 if( pData && pData->maStart.IsValid())
936 {
937 aOldStt = pData->maStart;
938 }
939 else
940 {
941 // Page anchored object so...
942 // synthesise an anchor ( but don't attach it to
943 // the object as we want to maintain page anchoring )
944 ScDrawObjData aAnchor;
945 const tools::Rectangle aObjRect(pObj->GetLogicRect());
947 aObjRect,
948 aAnchor,
949 rDoc,
950 GetTab());
951 aOldStt = aAnchor.maStart;
952 }
953 MapMode aDrawMode = pGridWin->GetDrawMapMode();
954 // find pos anchor position
955 Point aOldPos( rDoc.GetColOffset( aOldStt.Col(), aOldStt.Tab() ), rDoc.GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
956 aOldPos.setX(convertTwipToMm100(aOldPos.X()));
957 aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
958 // find position of same point on the screen ( e.g. grid )
959 Point aCurPos = pViewData->GetScrPos( aOldStt.Col(), aOldStt.Row(), eWhich, true );
960 Point aCurPosHmm = pGridWin->PixelToLogic(aCurPos, aDrawMode );
961 Point aGridOff = aCurPosHmm - aOldPos;
962 // fdo#63878 Fix the X position for RTL Sheet
964 aGridOff.setX( aCurPosHmm.getX() + aOldPos.getX() );
965}
966
968{
969 SdrPageView* pPageView(GetSdrPageView());
970
971 if(nullptr == pPageView)
972 return;
973
974 for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
975 {
976 SdrPageWindow* pPageWindow(pPageView->GetPageWindow(a));
977 assert(pPageWindow && "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
978
979 if(nullptr != pPageWindow)
980 {
981 sdr::contact::ObjectContact& rObjectContact(pPageWindow->GetObjectContact());
982
983 if(rObjectContact.supportsGridOffsets())
984 {
985 rObjectContact.resetAllGridOffsets();
986 }
987 }
988 }
989}
990
992 SdrObject& rSdrObject,
993 basegfx::B2DVector& rTarget) const
994{
997 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
998 return false;
999
1000 ScGridWindow* pGridWin(pViewData->GetActiveWin());
1001
1002 if(nullptr == pGridWin)
1003 {
1004 return false;
1005 }
1006
1008 ScAddress aOldStt;
1009
1010 if(nullptr != pData && pData->maStart.IsValid())
1011 {
1012 aOldStt = pData->maStart;
1013 }
1014 else
1015 {
1016 // Page anchored object so...
1017 // synthesise an anchor ( but don't attach it to
1018 // the object as we want to maintain page anchoring )
1019 ScDrawObjData aAnchor;
1020 const tools::Rectangle aObjRect(rSdrObject.GetLogicRect());
1022 aObjRect,
1023 aAnchor,
1024 rDoc,
1025 GetTab());
1026 aOldStt = aAnchor.maStart;
1027 }
1028
1029 MapMode aDrawMode = pGridWin->GetDrawMapMode();
1030
1031 // find pos anchor position
1032 Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
1033 aOldPos.setX(convertTwipToMm100(aOldPos.X()));
1034 aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
1035
1036 // find position of same point on the screen ( e.g. grid )
1038 Point aCurPos(pViewData->GetScrPos(aOldStt.Col(), aOldStt.Row(), eWhich, true));
1039 Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
1040 Point aGridOff(aCurPosHmm - aOldPos);
1041
1042 bool bLOKActive = comphelper::LibreOfficeKit::isActive();
1043 bool bNegativePage = rDoc.IsNegativePage(GetTab());
1044
1045 // fdo#63878 Fix the X position for RTL Sheet
1046 if(bNegativePage && !bLOKActive)
1047 {
1048 aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
1049 }
1050
1051 rTarget.setX(bNegativePage && bLOKActive ? -aGridOff.X() : aGridOff.X());
1052 rTarget.setY(aGridOff.Y());
1053 return true;
1054}
1055
1057 const basegfx::B2DRange& rB2DRange,
1058 basegfx::B2DVector& rTarget) const
1059{
1060 ScGridWindow* pGridWin(pViewData->GetActiveWin());
1061
1062 if(nullptr == pGridWin || rB2DRange.isEmpty())
1063 {
1064 return false;
1065 }
1066
1067 // No SdrObject, so synthesise an anchor ( but don't attach it to
1068 // the object as we want to maintain page anchoring )
1069 ScDrawObjData aAnchor;
1070 const tools::Rectangle aRectangle(
1071 basegfx::fround(rB2DRange.getMinX()), basegfx::fround(rB2DRange.getMinY()),
1072 basegfx::fround(rB2DRange.getMaxX()), basegfx::fround(rB2DRange.getMaxY()));
1074 aRectangle,
1075 aAnchor,
1076 rDoc,
1077 GetTab());
1078 ScAddress aOldStt(aAnchor.maStart);
1079
1080 MapMode aDrawMode = pGridWin->GetDrawMapMode();
1081
1082 // find pos anchor position
1083 Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
1084 aOldPos.setX(convertTwipToMm100(aOldPos.X()));
1085 aOldPos.setY(convertTwipToMm100(aOldPos.Y()));
1086
1087 // find position of same point on the screen ( e.g. grid )
1089 Point aCurPos(pViewData->GetScrPos(aOldStt.Col(), aOldStt.Row(), eWhich, true));
1090 Point aCurPosHmm(pGridWin->PixelToLogic(aCurPos, aDrawMode));
1091 Point aGridOff(aCurPosHmm - aOldPos);
1092
1093 bool bLOKActive = comphelper::LibreOfficeKit::isActive();
1094 bool bNegativePage = rDoc.IsNegativePage(GetTab());
1095
1096 // fdo#63878 Fix the X position for RTL Sheet
1097 if(bNegativePage && !bLOKActive)
1098 {
1099 aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
1100 }
1101
1102 rTarget.setX(bLOKActive && bNegativePage ? -aGridOff.X() : aGridOff.X());
1103 rTarget.setY(aGridOff.Y());
1104 return true;
1105}
1106
1107// Create a new view-local UndoManager manager for Calc
1108std::unique_ptr<SdrUndoManager> ScDrawView::createLocalTextUndoManager()
1109{
1110 std::unique_ptr<SdrUndoManager> pUndoManager(new SdrUndoManager);
1111 ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr;
1112 pUndoManager->SetDocShell(pDocShell);
1113 return pUndoManager;
1114}
1115
1116// #i123922# helper to apply a Graphic to an existing SdrObject
1118 SdrObject& rHitObject,
1119 const Graphic& rGraphic,
1120 const OUString& rBeginUndoText,
1121 const OUString& rFile)
1122{
1123 if(auto pGrafHitObj = dynamic_cast< SdrGrafObj* >(&rHitObject))
1124 {
1125 rtl::Reference<SdrGrafObj> pNewGrafObj = SdrObject::Clone(*pGrafHitObj, rHitObject.getSdrModelFromSdrObject());
1126
1127 pNewGrafObj->SetGraphic(rGraphic);
1128 BegUndo(rBeginUndoText);
1129 ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj.get());
1130
1131 // set in all cases - the Clone() will have copied an existing link (!)
1132 pNewGrafObj->SetGraphicLink( rFile );
1133
1134 EndUndo();
1135 return pNewGrafObj.get();
1136 }
1137 else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
1138 {
1139 AddUndo(std::make_unique<SdrUndoAttrObj>(rHitObject));
1140
1142
1143 aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
1144 aSet.Put(XFillBitmapItem(OUString(), rGraphic));
1145 rHitObject.SetMergedItemSetAndBroadcast(aSet);
1146 return &rHitObject;
1147 }
1148
1149 return nullptr;
1150}
1151
1152// Own derivation of ObjectContact to allow on-demand calculation of
1153// GridOffset for non-linear ViewToDevice transformation (calc)
1154namespace sdr::contact
1155{
1156 namespace {
1157
1158 class ObjectContactOfScDrawView final : public ObjectContactOfPageView
1159 {
1160 private:
1161 // The ScDrawView to work on
1163
1164 public:
1165 explicit ObjectContactOfScDrawView(
1166 const ScDrawView& rScDrawView,
1167 SdrPageWindow& rPageWindow,
1168 const char* pDebugName);
1169
1170 virtual bool supportsGridOffsets() const override;
1171 virtual void calculateGridOffsetForViewOjectContact(
1172 basegfx::B2DVector& rTarget,
1173 const ViewObjectContact& rClient) const override;
1174 virtual void calculateGridOffsetForB2DRange(
1175 basegfx::B2DVector& rTarget,
1176 const basegfx::B2DRange& rB2DRange) const override;
1177 };
1178
1179 }
1180
1181 ObjectContactOfScDrawView::ObjectContactOfScDrawView(
1182 const ScDrawView& rScDrawView,
1183 SdrPageWindow& rPageWindow,
1184 const char* pDebugName)
1185 : ObjectContactOfPageView(rPageWindow, pDebugName),
1186 mrScDrawView(rScDrawView)
1187 {
1188 }
1189
1190 bool ObjectContactOfScDrawView::supportsGridOffsets() const
1191 {
1192 // Except when scPrintTwipsMsgs flag is active,
1193 // Calc in LOK mode directly sets pixel-aligned logical coordinates for draw-objects.
1196 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1197 return false;
1198
1199 // no GridOffset support for printer
1200 if(isOutputToPrinter())
1201 {
1202 return false;
1203 }
1204
1205 // no GridOffset support for PDF export
1206 if(isOutputToPDFFile())
1207 {
1208 return false;
1209 }
1210
1211 // yes - we support it
1212 return true;
1213 }
1214
1215 void ObjectContactOfScDrawView::calculateGridOffsetForViewOjectContact(
1216 basegfx::B2DVector& rTarget,
1217 const ViewObjectContact& rClient) const
1218 {
1219 // Here the on-demand calculation happens. Try to access the SdrObject involved
1220 SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1221
1222 if(nullptr != pTargetSdrObject)
1223 {
1225 *pTargetSdrObject,
1226 rTarget);
1227 }
1228 }
1229
1230 void ObjectContactOfScDrawView::calculateGridOffsetForB2DRange(
1231 basegfx::B2DVector& rTarget,
1232 const basegfx::B2DRange& rB2DRange) const
1233 {
1234 // Here the on-demand calculation happens. Try to access the SdrObject involved
1235 if(!rB2DRange.isEmpty())
1236 {
1238 rB2DRange,
1239 rTarget);
1240 }
1241 }
1242}
1243
1244// Create own derivation of ObjectContact for calc
1246 SdrPageWindow& rPageWindow,
1247 const char* pDebugName) const
1248{
1249 return new sdr::contact::ObjectContactOfScDrawView(
1250 *this,
1251 rPageWindow,
1252 pDebugName);
1253}
1254
1255/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr auto convertTwipToMm100(N n)
virtual SdrPageView * ShowSdrPage(SdrPage *pPage) override
virtual void MarkListHasChanged() override
MapUnit GetMapUnit() const
OutDevType GetOutDevType() const
virtual vcl::Window * GetOwnerWindow() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long getX() const
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: docsh3.cxx:188
void SetDrawModified()
SetDrawModified - without Formula update.
Definition: docsh.cxx:3046
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
SC_DLLPUBLIC tools::Long GetColOffset(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4224
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1905
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
Definition: document.cxx:982
SC_DLLPUBLIC std::unique_ptr< ScPostIt > ReleaseNote(const ScAddress &rPos)
Definition: document.cxx:6689
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
SC_DLLPUBLIC bool GetTableArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bCalcHiddens=false) const
Definition: document.cxx:1008
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1083
static bool IsChart(const SdrObject *pObject)
Definition: documen9.cxx:209
bool IsUndoEnabled() const
Definition: document.hxx:1595
SC_DLLPUBLIC tools::Long GetRowOffset(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4232
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
static ScDrawObjData * GetObjDataTab(SdrObject *pObj, SCTAB nTab)
Definition: drwlayer.cxx:2888
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2874
static OUString GetVisibleName(const SdrObject *pObj)
Definition: drwlayer.cxx:2424
static void GetCellAnchorFromPosition(const tools::Rectangle &rRectangle, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bHiddenAsZero=true)
Definition: drwlayer.cxx:2649
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
Definition: drwlayer.cxx:1514
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
Definition: drwlayer.cxx:1521
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
Definition: drwlayer.cxx:2907
ScAddress maStart
Definition: userdat.hxx:36
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
SdrObject * ApplyGraphicToObject(SdrObject &rHitObject, const Graphic &rGraphic, const OUString &rBeginUndoText, const OUString &rFile)
Definition: drawview.cxx:1117
void SyncForGrid(SdrObject *pObj)
Definition: drawview.cxx:918
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:540
ScViewData * pViewData
Definition: drawview.hxx:35
std::unique_ptr< SdrDropMarkerOverlay > pDropMarker
Definition: drawview.hxx:41
bool calculateGridOffsetForB2DRange(const basegfx::B2DRange &rB2DRange, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:1056
void RecalcScale()
Definition: drawview.cxx:298
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:887
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
Definition: drawview.cxx:844
void LockInternalLayer(bool bLock=true)
Locks/unlocks the internal layer that contains caption objects of cell notes.
Definition: drawview.hxx:135
void ImplClearCalcDropMarker()
Definition: drawview.cxx:128
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
Definition: drawview.cxx:584
virtual void DeleteMarked() override
Definition: drawview.cxx:849
virtual void ModelHasChanged() override
Definition: drawview.cxx:605
bool calculateGridOffsetForSdrObject(SdrObject &rSdrObject, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:991
void UpdateIMap(SdrObject *pObj)
Definition: drawvie3.cxx:229
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: drawview.cxx:835
void InvalidateDrawTextAttrs()
Definition: drawview.cxx:162
Fraction aScaleX
Definition: drawview.hxx:39
bool SelectObject(std::u16string_view rName)
Definition: drawview.cxx:725
std::unique_ptr< SdrUndoManager > createLocalTextUndoManager() override
Definition: drawview.cxx:1108
void LockCalcLayer(SdrLayerID nLayer, bool bLock)
Locks/unlocks the specified layer in the draw page.
Definition: drawview.cxx:828
void Construct()
Definition: drawview.cxx:71
bool InsertObjectSafe(SdrObject *pObj, SdrPageView &rPV)
Definition: drawview.cxx:797
void SetMarkedToLayer(SdrLayerID nLayerNo)
Definition: drawview.cxx:212
void SelectCurrentViewObject(std::u16string_view rName)
Definition: drawview.cxx:674
void DoCopy()
Definition: drawvie4.cxx:333
void MarkDropObj(SdrObject *pObj)
Definition: drawview.cxx:898
SCTAB nTab
Definition: drawview.hxx:38
ScDocument & rDoc
needed ?
Definition: drawview.hxx:37
void GetScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawview.cxx:292
VclPtr< OutputDevice > pDev
Definition: drawview.hxx:36
bool HasMarkedInternal() const
Definition: drawview.cxx:253
bool bInConstruct
Definition: drawview.hxx:43
void resetGridOffsetsForAllSdrPageViews()
Definition: drawview.cxx:967
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const override
Definition: drawview.cxx:1245
bool HasMarkedControl() const
Definition: drawview.cxx:244
void LockBackgroundLayer(bool bLock)
Locks/unlocks the background layer that contains background objects.
Definition: drawview.hxx:131
void UpdateWorkArea()
Definition: drawview.cxx:263
void UpdateUserViewOptions()
Definition: drawview.cxx:619
void InvalidateAttribs()
Definition: drawview.cxx:153
virtual void DoConnect(SdrOle2Obj *pOleObj) override
Definition: drawview.cxx:352
virtual void MarkListHasChanged() override
Definition: drawview.cxx:358
SdrObject * pDropMarkObj
Definition: drawview.hxx:42
virtual void AddCustomHdl() override
Definition: drawview.cxx:138
SCTAB GetTab() const
Definition: drawview.hxx:100
SdrObject * GetObjectByName(std::u16string_view rName)
Definition: drawview.cxx:643
virtual ~ScDrawView() override
Definition: drawview.cxx:133
Fraction aScaleY
Definition: drawview.hxx:40
void DoCut()
Definition: drawview.cxx:284
SdrObject * GetMarkedNoteCaption(ScDrawObjData **ppCaptData)
Returns the selected object, if it is the caption object of a cell note.
Definition: drawview.cxx:813
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:787
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
Definition: gridwin3.cxx:252
sal_uInt16 GetCurRefDlgId() const
Definition: scmod.hxx:226
bool IsRefDialogOpen()
Definition: scmod.cxx:1665
void SelectionChanged()
Definition: viewuno.cxx:1652
void SetGraphicShell(bool bActive)
Definition: tabvwsh4.cxx:745
void SetChartShell(bool bActive)
Definition: tabvwsh4.cxx:737
void SetDrawTextUndo(SfxUndoManager *pUndoMgr)
Definition: tabvwsh4.cxx:1054
void ConnectObject(const SdrOle2Obj *pObj)
Definition: tabvwshb.cxx:72
void SetDrawFormShell(bool bActive)
Definition: tabvwsh4.cxx:730
void SetOleObjectShell(bool bActive)
Definition: tabvwsh4.cxx:761
void SetMediaShell(bool bActive)
Definition: tabvwsh4.cxx:753
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:1044
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:613
void MakeVisible(const tools::Rectangle &rHMMRect)
Definition: tabview5.cxx:555
void ScrollToObject(const SdrObject *pDrawObj)
Definition: tabview5.cxx:546
void CheckSelectionTransfer()
Definition: tabview3.cxx:474
void Unmark()
Definition: tabview3.cxx:1744
bool IsDrawSelMode() const
Definition: tabview.hxx:327
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1819
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:554
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
double GetPPTY() const
Definition: viewdata.hxx:469
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3162
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
ScDBFunc * GetView() const
Definition: viewdata.cxx:864
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
Definition: viewdata.cxx:2380
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
SfxObjectShell * GetSfxDocShell() const
Definition: viewdata.hxx:358
double GetPPTX() const
Definition: viewdata.hxx:468
SfxBindings & GetBindings()
Definition: viewdata.cxx:3134
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:94
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:86
void SetCreateMode(bool bOn=true)
void SetWorkArea(const tools::Rectangle &rRect)
void SetDragStripes(bool bOn)
void ReplaceObjectAtView(SdrObject *pOldObj, SdrPageView &rPV, SdrObject *pNewObj, bool bMark=true)
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
void BegUndo()
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
void EndUndo()
SdrLayer * GetLayerPerID(SdrLayerID nID)
const OUString & GetName() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
void SetFrameDragSingles(bool bOn=true)
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrHdlList maHdlList
void CheckMarked()
void SetMarkHdlSizePixel(sal_uInt16 nSiz)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrLayerAdmin & GetLayerAdmin() const
SdrTextObj * GetTextEditObject() const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
const OutlinerView * GetTextEditOutlinerView() const
virtual void ModelHasChanged() override
virtual bool IsTextEdit() const final override
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)
SdrObject * Next()
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
bool IsClosedObj() const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
SdrModel & getSdrModelFromSdrObject() const
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
virtual SdrObjKind GetObjIdentifier() const
bool IsInserted() const
virtual SdrLayerID GetLayer() const
virtual void SetLayer(SdrLayerID nLayer)
virtual const tools::Rectangle & GetLogicRect() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
sal_uInt32 PageWindowCount() const
SdrPage * GetPage() const
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
const sdr::contact::ObjectContact & GetObjectContact() const
Size GetSize() const
void SetLayerLocked(const OUString &rName, bool bLock=true)
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
void SetActiveLayer(const OUString &rName)
void SetGridFine(const Size &rSiz)
void SetHitTolerancePixel(sal_uInt16 nVal)
void SetSwapAsynchron(bool bJa=true)
sal_uInt32 PaintWindowCount() const
bool IsLayerLocked(const OUString &rName) const
void SetGridCoarse(const Size &rSiz)
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
void SetMinMoveDistancePixel(sal_uInt16 nVal)
void SetLayerVisible(const OUString &rName, bool bShow)
void SetGridVisible(bool bOn)
OutputDevice & GetOutputDevice() const
void SetSnapGridWidth(const Fraction &rX, const Fraction &rY)
void SetGridSnap(bool bOn)
void SetSnapEnabled(bool bOn)
void EnableExtendedMouseEventDispatcher(bool bOn)
virtual void DeleteMarked()
void UnmarkAll()
void EnableExtendedKeyInputDispatcher(bool bOn)
void Invalidate(sal_uInt16 nId)
void InvalidateAll(bool bWithMsg)
bool IsInPlace() const
css::uno::Reference< css::frame::XController > GetController() const
bool IsObjectInPlaceActive() const
void DeactivateObject()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
bool IsReadOnly() const
void SetVerbs(const css::uno::Sequence< css::embed::VerbDescriptor > &aVerbs)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
SfxFrame & GetFrame() const
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * GetIPClient() const
constexpr tools::Long Width() const
bool GetGridVisible() const
bool GetUseGridSnap() const
sal_uInt32 GetFieldDivisionY() const
sal_uInt32 GetFieldDrawY() const
sal_uInt32 GetFieldDrawX() const
sal_uInt32 GetFieldDivisionX() const
TYPE getMaxX() const
TYPE getMinX() const
TYPE getMinY() const
TYPE getMaxY() const
bool isEmpty() const
virtual bool supportsGridOffsets() const
constexpr void SetLeft(tools::Long v)
constexpr void SetRight(tools::Long v)
rtl::OString toString() const
void PaintImmediately()
const MapMode & GetMapMode() const
Point PixelToLogic(const Point &rDevicePt) const
int nCount
constexpr double nPPTX
constexpr double nPPTY
#define DBG_ASSERT(sCon, aError)
#define SC_HANDLESIZE_BIG
Definition: drawview.cxx:69
const ScDrawView & mrScDrawView
Definition: drawview.cxx:1162
EmbeddedObjectRef * pObject
FilterGroup & rTarget
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
uno_Any a
sal_uInt16 nPos
std::unique_ptr< sal_Int32[]> pData
B2IRange fround(const B2DRange &rRange)
bool isCompatFlagSet(Compat flag)
int i
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OUTDEV_WINDOW
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SC_MOD()
Definition: scmod.hxx:247
Internal data for a cell annotation.
Definition: postit.hxx:42
rtl::Reference< SdrCaptionObj > mxCaption
Initial data for invisible notes without SdrObject.
Definition: postit.hxx:48
Reference< XController > xController
SdrInsertFlags
SdrEndTextEditKind
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
ScSplitPos
Definition: viewdata.hxx:44
@ VOPT_HELPLINES
Definition: viewopti.hxx:44