LibreOffice Module svx (master) 1
svdpagv.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 <svx/svdpagv.hxx>
21#include <svx/svdpage.hxx>
22#include <svx/svdview.hxx>
23
24#include <svx/svdobj.hxx>
25#include <svx/svdogrp.hxx>
26#include <svx/svdtypes.hxx>
27
29
30#include <algorithm>
31
32#include <svx/sdrpagewindow.hxx>
34#include <comphelper/lok.hxx>
37#include <osl/diagnose.h>
38
39using namespace ::com::sun::star;
40
41// interface to SdrPageWindow
42
44{
45 for(auto & a : maPageWindows)
46 {
47 if(&(a->GetPaintWindow()) == &rPaintWindow)
48 {
49 return a.get();
50 }
51 }
52
53 return nullptr;
54}
55
57{
58 for ( auto const & pPageWindow : maPageWindows )
59 {
60 const SdrPaintWindow& rPaintWindow( pPageWindow->GetOriginalPaintWindow() ? *pPageWindow->GetOriginalPaintWindow() : pPageWindow->GetPaintWindow() );
61 if ( &rPaintWindow.GetOutputDevice() == &_rOutDev )
62 {
63 return pPageWindow.get();
64 }
65 }
66
67 return nullptr;
68}
69
71{
72 for ( auto const & pPageWindow : maPageWindows )
73 {
74 if(&(pPageWindow->GetPaintWindow().GetOutputDevice()) == &rOutDev)
75 {
76 return pPageWindow.get();
77 }
78 }
79
80 return nullptr;
81}
82
84{
85 return maPageWindows[nIndex].get();
86}
87
89: mrView(rNewView),
90 // col_auto color lets the view takes the default SvxColorConfig entry
91 maDocumentColor( COL_AUTO ),
92 maBackgroundColor( COL_AUTO ), // #i48367# also react on autocolor
93 mpPreparedPageWindow(nullptr) // #i72752#
94{
95 mpPage = pPage1;
96
97 if(mpPage)
98 {
99 aPgOrg.setX(mpPage->GetLeftBorder() );
100 aPgOrg.setY(mpPage->GetUpperBorder() );
101 }
102 // For example, in the case of charts, there is a LayerAdmin, but it has no valid values. Therefore
103 // a solution like pLayerAdmin->getVisibleLayersODF(aLayerVisi) is not possible. So use the
104 // generic SetAll() for now.
107
108 mbHasMarked = false;
109 mbVisible = false;
110 pCurrentList = nullptr;
111 pCurrentGroup = nullptr;
113
114 for(sal_uInt32 a(0); a < rNewView.PaintWindowCount(); a++)
115 {
117 }
118}
119
121{
122}
123
125{
126 if(!FindPageWindow(rPaintWindow))
127 {
128 maPageWindows.emplace_back(new SdrPageWindow(*this, rPaintWindow));
129 }
130}
131
133{
134 auto it = std::find_if(maPageWindows.begin(), maPageWindows.end(),
135 [&rPaintWindow](const std::unique_ptr<SdrPageWindow>& rpWindow) {
136 return &(rpWindow->GetPaintWindow()) == &rPaintWindow;
137 });
138 if (it != maPageWindows.end())
139 maPageWindows.erase(it);
140}
141
142css::uno::Reference< css::awt::XControlContainer > SdrPageView::GetControlContainer( const OutputDevice& _rDevice ) const
143{
144 css::uno::Reference< css::awt::XControlContainer > xReturn;
145 const SdrPageWindow* pCandidate = FindPatchedPageWindow( _rDevice );
146
147 if ( pCandidate )
148 xReturn = pCandidate->GetControlContainer();
149
150 return xReturn;
151}
152
154{
155 if (GetCurrentGroup()!=nullptr) CheckCurrentGroup();
156}
157
159{
160 return (nullptr == GetPage() || GetView().GetModel()->IsReadOnly() || GetPage()->IsReadOnly() || GetObjList()->IsReadOnly());
161}
162
164{
165 if(!IsVisible())
166 {
167 mbVisible = true;
168
169 for(sal_uInt32 a(0); a < GetView().PaintWindowCount(); a++)
170 {
171 AddPaintWindowToPageView(*GetView().GetPaintWindow(a));
172 }
173 }
174}
175
177{
178 if(IsVisible())
179 {
181 {
183 }
184 mbVisible = false;
185 maPageWindows.clear();
186 }
187}
188
190{
191 if (GetPage()==nullptr) return tools::Rectangle();
192 return tools::Rectangle(Point(),Size(GetPage()->GetWidth()+1,GetPage()->GetHeight()+1));
193}
194
196{
197 if(IsVisible() && GetPage())
198 {
199 tools::Rectangle aRect(Point(0,0),Size(GetPage()->GetWidth()+1,GetPage()->GetHeight()+1));
200 aRect.Union(GetPage()->GetAllObjBoundRect());
201 GetView().InvalidateAllWin(aRect);
202 }
203}
204
205
207{
208 const sal_uInt32 nCount(PageWindowCount());
209
210 for(sal_uInt32 a(0); a < nCount; a++)
211 {
212 SdrPageWindow* pCandidate = GetPageWindow(a);
213
214 if(pCandidate)
215 {
216 pCandidate->PrePaint();
217 }
218 }
219}
220
222 SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector )
223{
224 if(!GetPage())
225 return;
226
227 SdrPageWindow* pPageWindow = FindPageWindow(rPaintWindow);
228 std::unique_ptr<SdrPageWindow> pTempPageWindow;
229
230 if(!pPageWindow)
231 {
232 // create temp PageWindow
233 pTempPageWindow.reset(new SdrPageWindow(*this, rPaintWindow));
234 pPageWindow = pTempPageWindow.get();
235 }
236
237 // do the redraw
238 pPageWindow->PrepareRedraw(rReg);
239 pPageWindow->RedrawAll(pRedirector);
240}
241
242
243// #i74769# use SdrPaintWindow directly
244
246{
247 // #i72752# remember prepared SdrPageWindow
248 mpPreparedPageWindow = pKnownTarget;
249}
250
253 const tools::Rectangle& rRect, basegfx::B2IRectangle const*const pPageFrame)
254{
255 if(!GetPage())
256 return;
257
258 if(pGivenTarget)
259 {
260 SdrPageWindow* pKnownTarget = FindPageWindow(*pGivenTarget);
261
262 if(pKnownTarget)
263 {
264 // paint known target
265 pKnownTarget->RedrawLayer(&nID, pRedirector, nullptr);
266 }
267 else
268 {
269 // #i72752# DrawLayer() uses an OutputDevice different from BeginDrawLayer. This happens
270 // e.g. when SW paints a single text line in text edit mode. Try to use it
271 SdrPageWindow* pPreparedTarget = mpPreparedPageWindow;
272
273 if(pPreparedTarget)
274 {
275 // if we have a prepared target, do not use a new SdrPageWindow since this
276 // works but is expensive. Just use a temporary PaintWindow
277 SdrPaintWindow aTemporaryPaintWindow(mrView, *pGivenTarget);
278
279 // Copy existing paint region to use the same as prepared in BeginDrawLayer
280 SdrPaintWindow& rExistingPaintWindow = pPreparedTarget->GetPaintWindow();
281 const vcl::Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion();
282 bool bUseRect(false);
283 if (!rRect.IsEmpty())
284 {
285 vcl::Region r(rExistingRegion);
286 r.Intersect(rRect);
287 // fdo#74435: FIXME: visibility check broken if empty
288 if (!r.IsEmpty())
289 bUseRect = true;
290 }
291 if (!bUseRect)
292 aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion);
293 else
294 aTemporaryPaintWindow.SetRedrawRegion(vcl::Region(rRect));
295
296 // patch the ExistingPageWindow
297 auto pPreviousWindow = pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
298 // unpatch window when leaving the scope
299 const ::comphelper::ScopeGuard aGuard(
300 [&pPreviousWindow, &pPreparedTarget]() { pPreparedTarget->unpatchPaintWindow(pPreviousWindow); } );
301 // redraw the layer
302 pPreparedTarget->RedrawLayer(&nID, pRedirector, pPageFrame);
303 }
304 else
305 {
306 OSL_FAIL("SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), this should never be needed (!)");
307
308 // None of the known OutputDevices is the target of this paint, use
309 // a temporary SdrPageWindow for this Redraw.
310 SdrPaintWindow aTemporaryPaintWindow(mrView, *pGivenTarget);
311 SdrPageWindow aTemporaryPageWindow(*this, aTemporaryPaintWindow);
312
313 // #i72752#
314 // Copy existing paint region if other PageWindows exist, this was created by
315 // PrepareRedraw() from BeginDrawLayer(). Needs to be used e.g. when suddenly SW
316 // paints into an unknown device other than the view was created for (e.g. VirtualDevice)
317 if(PageWindowCount())
318 {
319 SdrPageWindow* pExistingPageWindow = GetPageWindow(0);
320 SdrPaintWindow& rExistingPaintWindow = pExistingPageWindow->GetPaintWindow();
321 const vcl::Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion();
322 aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion);
323 }
324
325 aTemporaryPageWindow.RedrawLayer(&nID, pRedirector, nullptr);
326 }
327 }
328 }
329 else
330 {
331 // paint in all known windows
332 for(sal_uInt32 a(0); a < PageWindowCount(); a++)
333 {
334 SdrPageWindow* pTarget = GetPageWindow(a);
335 pTarget->RedrawLayer(&nID, pRedirector, nullptr);
336 }
337 }
338}
339
340void SdrPageView::SetDesignMode( bool _bDesignMode ) const
341{
342 for ( sal_uInt32 i = 0; i < PageWindowCount(); ++i )
343 {
344 const SdrPageWindow& rPageViewWindow = *GetPageWindow(i);
345 rPageViewWindow.SetDesignMode( _bDesignMode );
346 }
347}
348
349
351{
352 if (GetPage()==nullptr)
353 return;
354
359
360 if (nx1==0) nx1=nx2;
361 if (nx2==0) nx2=nx1;
362 if (ny1==0) ny1=ny2;
363 if (ny2==0) ny2=ny1;
364 if (nx1==0) { nx1=ny1; nx2=ny2; }
365 if (ny1==0) { ny1=nx1; ny2=nx2; }
366 if (nx1<0) nx1=-nx1;
367 if (nx2<0) nx2=-nx2;
368 if (ny1<0) ny1=-ny1;
369 if (ny2<0) ny2=-ny2;
370
371 if (nx1==0)
372 return;
373
374 // no more global output size, use window size instead to decide grid sizes
375 tools::Long nScreenWdt = rOut.GetOutputSizePixel().Width();
376
377 tools::Long nMinDotPix=2;
378 tools::Long nMinLinPix=4;
379
380 if (nScreenWdt>=1600)
381 {
382 nMinDotPix=4;
383 nMinLinPix=8;
384 }
385 else if (nScreenWdt>=1024)
386 {
387 nMinDotPix=3;
388 nMinLinPix=6;
389 }
390 else
391 { // e. g. 640x480
392 nMinDotPix=2;
393 nMinLinPix=4;
394 }
395 Size aMinDotDist(rOut.PixelToLogic(Size(nMinDotPix,nMinDotPix)));
396 Size aMinLinDist(rOut.PixelToLogic(Size(nMinLinPix,nMinLinPix)));
397 bool bHoriSolid=nx2<aMinDotDist.Width();
398 bool bVertSolid=ny2<aMinDotDist.Height();
399 // enlarge line offset (minimum 4 pixels)
400 // enlarge by: *2 *5 *10 *20 *50 *100 ...
401 int nTgl=0;
402 tools::Long nVal0=nx1;
403 while (nx1<aMinLinDist.Width())
404 {
405 tools::Long a=nx1;
406
407 if (nTgl==0) nx1*=2;
408 if (nTgl==1) nx1=nVal0*5; // => nx1*=2.5
409 if (nTgl==2) nx1*=2;
410
411 nVal0=a;
412 nTgl++; if (nTgl>=3) nTgl=0;
413 }
414 nTgl=0;
415 nVal0=ny1;
416 while (ny1<aMinLinDist.Height())
417 {
418 tools::Long a=ny1;
419
420 if (nTgl==0) ny1*=2;
421 if (nTgl==1) ny1=nVal0*5; // => ny1*=2.5
422 if (nTgl==2) ny1*=2;
423
424 nVal0=a;
425 nTgl++;
426
427 if (nTgl>=3) nTgl=0;
428 }
429
430 bool bHoriFine=nx2<nx1;
431 bool bVertFine=ny2<ny1;
432 bool bHoriLines=bHoriSolid || bHoriFine || !bVertFine;
433 bool bVertLines=bVertSolid || bVertFine;
434
435 Color aOriginalLineColor( rOut.GetLineColor() );
436 rOut.SetLineColor( aColor );
437
438 bool bMap0=rOut.IsMapModeEnabled();
439
440 tools::Long nWrX=0;
441 tools::Long nWrY=0;
442 Point aOrg(aPgOrg);
443 tools::Long x1 = 0;
444 tools::Long x2 = 0;
445 if (GetPage()->GetWidth() < 0) // ScDrawPage of RTL sheet
446 {
447 x1 = GetPage()->GetWidth() + GetPage()->GetLeftBorder() + 1;
448 x2 = - GetPage()->GetRightBorder() - 1;
449 }
450 else
451 {
452 x1 = GetPage()->GetLeftBorder() + 1;
453 x2 = GetPage()->GetWidth() - GetPage()->GetRightBorder() - 1;
454 }
455 tools::Long y1 = GetPage()->GetUpperBorder() + 1;
457 const SdrPageGridFrameList* pFrames=GetPage()->GetGridFrameList(this,nullptr);
458
459 sal_uInt16 nGridPaintCnt=1;
460 if (pFrames!=nullptr) nGridPaintCnt=pFrames->GetCount();
461 for (sal_uInt16 nGridPaintNum=0; nGridPaintNum<nGridPaintCnt; nGridPaintNum++) {
462 if (pFrames!=nullptr) {
463 const SdrPageGridFrame& rGF=(*pFrames)[nGridPaintNum];
464 nWrX=rGF.GetPaperRect().Left();
465 nWrY=rGF.GetPaperRect().Top();
466 x1=rGF.GetUserArea().Left();
467 x2=rGF.GetUserArea().Right();
468 y1=rGF.GetUserArea().Top();
469 y2=rGF.GetUserArea().Bottom();
470 aOrg=rGF.GetUserArea().TopLeft();
471 aOrg-=rGF.GetPaperRect().TopLeft();
472 }
473 if (!rRect.IsEmpty()) {
474 Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
475 tools::Long nX1Pix=a1PixSiz.Width(); // add 1 pixel of tolerance
476 tools::Long nY1Pix=a1PixSiz.Height();
477 if (x1<rRect.Left() -nX1Pix) x1=rRect.Left() -nX1Pix;
478 if (x2>rRect.Right() +nX1Pix) x2=rRect.Right() +nX1Pix;
479 if (y1<rRect.Top() -nY1Pix) y1=rRect.Top() -nY1Pix;
480 if (y2>rRect.Bottom()+nY1Pix) y2=rRect.Bottom()+nY1Pix;
481 }
482
483 tools::Long xBigOrg=aOrg.X()+nWrX;
484 while (xBigOrg>=x1) xBigOrg-=nx1;
485 while (xBigOrg<x1) xBigOrg+=nx1;
486 tools::Long xFinOrg=xBigOrg;
487 while (xFinOrg>=x1) xFinOrg-=nx2;
488 while (xFinOrg<x1) xFinOrg+=nx2;
489
490 tools::Long yBigOrg=aOrg.Y()+nWrY;
491 while (yBigOrg>=y1) yBigOrg-=ny1;
492 while (yBigOrg<y1) yBigOrg+=ny1;
493 tools::Long yFinOrg=yBigOrg;
494 while (yFinOrg>=y1) yFinOrg-=ny2;
495 while (yFinOrg<y1) yFinOrg+=ny2;
496
497 if( x1 <= x2 && y1 <= y2 )
498 {
499 if( bHoriLines )
500 {
501 DrawGridFlags nGridFlags = ( bHoriSolid ? DrawGridFlags::HorzLines : DrawGridFlags::Dots );
502 sal_uInt16 nSteps = sal_uInt16(nx1 / nx2);
503 sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((nx1 * 1000)/ nSteps) - (nx2 * 1000) ) : 0;
504 sal_uInt32 nStepOffset = 0;
505 sal_uInt16 nPointOffset = 0;
506
507 for(sal_uInt16 a=0;a<nSteps;a++)
508 {
509 // draw
510 rOut.DrawGrid(
511 tools::Rectangle( xFinOrg + (a * nx2) + nPointOffset, yBigOrg, x2, y2 ),
512 Size( nx1, ny1 ), nGridFlags );
513
514 // do a step
515 nStepOffset += nRestPerStepMul1000;
516 while(nStepOffset >= 1000)
517 {
518 nStepOffset -= 1000;
519 nPointOffset++;
520 }
521 }
522 }
523
524 if( bVertLines )
525 {
526 DrawGridFlags nGridFlags = ( bVertSolid ? DrawGridFlags::VertLines : DrawGridFlags::Dots );
527 sal_uInt16 nSteps = sal_uInt16(ny1 / ny2);
528 sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((ny1 * 1000L)/ nSteps) - (ny2 * 1000L) ) : 0;
529 sal_uInt32 nStepOffset = 0;
530 sal_uInt16 nPointOffset = 0;
531
532 for(sal_uInt16 a=0;a<nSteps;a++)
533 {
534 // draw
535 rOut.DrawGrid(
536 tools::Rectangle( xBigOrg, yFinOrg + (a * ny2) + nPointOffset, x2, y2 ),
537 Size( nx1, ny1 ), nGridFlags );
538
539 // do a step
540 nStepOffset += nRestPerStepMul1000;
541 while(nStepOffset >= 1000)
542 {
543 nStepOffset -= 1000;
544 nPointOffset++;
545 }
546 }
547 }
548 }
549 }
550
551 rOut.EnableMapMode(bMap0);
552 rOut.SetLineColor(aOriginalLineColor);
553}
554
556{
558}
559
560void SdrPageView::SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa)
561{
562 if(!GetPage())
563 return;
564
565 SdrLayerID nID = GetPage()->GetLayerAdmin().GetLayerID(rName);
566
567 if(SDRLAYER_NOTFOUND != nID)
568 rBS.Set(nID, bJa);
569}
570
571bool SdrPageView::IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const
572{
573 if(!GetPage())
574 return false;
575
576 bool bRet(false);
577
578 if (!rName.isEmpty())
579 {
581
583 {
584 bRet = rBS.IsSet(nId);
585 }
586 }
587
588 return bRet;
589}
590
591bool SdrPageView::IsObjMarkable(SdrObject const * pObj) const
592{
593 if (!pObj)
594 return false;
595 if (pObj->IsMarkProtect())
596 return false; // excluded from selection?
597 if (!pObj->IsVisible())
598 return false; // only visible are selectable
599 if (!pObj->IsInserted())
600 return false; // Obj deleted?
601 if (auto pObjGroup = dynamic_cast<const SdrObjGroup*>(pObj))
602 {
603 // If object is a Group object, visibility may depend on
604 // multiple layers. If one object is markable, Group is markable.
605 SdrObjList* pObjList = pObjGroup->GetSubList();
606
607 if (pObjList && pObjList->GetObjCount())
608 {
609 for (size_t a = 0; a < pObjList->GetObjCount(); ++a)
610 {
611 SdrObject* pCandidate = pObjList->GetObj(a);
612 // call recursively
613 if (IsObjMarkable(pCandidate))
614 return true;
615 }
616 return false;
617 }
618 else
619 {
620 // #i43302#
621 // Allow empty groups to be selected to be able to delete them
622 return true;
623 }
624 }
625 if (!pObj->Is3DObj() && pObj->getSdrPageFromSdrObject() != GetPage())
626 {
627 // Obj suddenly in different Page
628 return false;
629 }
630
631 // the layer has to be visible and must not be locked
632 SdrLayerID nL = pObj->GetLayer();
633 if (!aLayerVisi.IsSet(nL))
634 return false;
635 if (aLayerLock.IsSet(nL))
636 return false;
637 return true;
638}
639
640void SdrPageView::SetPageOrigin(const Point& rOrg)
641{
642 if (rOrg!=aPgOrg) {
643 aPgOrg=rOrg;
644 if (GetView().IsGridVisible()) {
646 }
647 }
648}
649
650void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum) const
651{
652 if (!(GetView().IsHlplVisible() && nNum<aHelpLines.GetCount())) return;
653
654 const SdrHelpLine& rHL=aHelpLines[nNum];
655
656 for(sal_uInt32 a(0); a < GetView().PaintWindowCount(); a++)
657 {
658 SdrPaintWindow* pCandidate = GetView().GetPaintWindow(a);
659
660 if(pCandidate->OutputToWindow())
661 {
662 OutputDevice& rOutDev = pCandidate->GetOutputDevice();
663 tools::Rectangle aR(rHL.GetBoundRect(rOutDev));
664 Size aSiz(rOutDev.PixelToLogic(Size(1,1)));
665 aR.AdjustLeft( -(aSiz.Width()) );
666 aR.AdjustRight(aSiz.Width() );
667 aR.AdjustTop( -(aSiz.Height()) );
668 aR.AdjustBottom(aSiz.Height() );
669 const_cast<SdrView&>(GetView()).InvalidateOneWin(rOutDev, aR);
670 }
671 }
672}
673
675{
676 aHelpLines=rHLL;
678}
679
680void SdrPageView::SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine)
681{
682 if (nNum >= aHelpLines.GetCount() || aHelpLines[nNum] == rNewHelpLine)
683 return;
684
685 bool bNeedRedraw = true;
686 if (aHelpLines[nNum].GetKind()==rNewHelpLine.GetKind()) {
687 switch (rNewHelpLine.GetKind()) {
688 case SdrHelpLineKind::Vertical : if (aHelpLines[nNum].GetPos().X()==rNewHelpLine.GetPos().X()) bNeedRedraw = false; break;
689 case SdrHelpLineKind::Horizontal: if (aHelpLines[nNum].GetPos().Y()==rNewHelpLine.GetPos().Y()) bNeedRedraw = false; break;
690 default: break;
691 } // switch
692 }
693 if (bNeedRedraw) ImpInvalidateHelpLineArea(nNum);
694 aHelpLines[nNum]=rNewHelpLine;
695 if (bNeedRedraw) ImpInvalidateHelpLineArea(nNum);
696}
697
698void SdrPageView::DeleteHelpLine(sal_uInt16 nNum)
699{
700 if (nNum<aHelpLines.GetCount()) {
702 aHelpLines.Delete(nNum);
703 }
704}
705
707{
708 sal_uInt16 nNum = aHelpLines.GetCount();
709 aHelpLines.Insert(rHL,nNum);
710 if (GetView().IsHlplVisible())
712}
713
714// set current group and list
716{
717 if(pCurrentGroup != pNewGroup)
718 {
719 pCurrentGroup = pNewGroup;
720 }
721 if(pCurrentList != pNewList)
722 {
723 pCurrentList = pNewList;
724 }
725}
726
728{
729 if(!pObj || !pObj->IsGroupObject())
730 return false;
731
732 // Don't allow enter Diagrams
733 if(nullptr != pObj && pObj->isDiagram())
734 return false;
735
736 const bool bGlueInvalidate(GetView().ImpIsGlueVisible());
737
738 if (bGlueInvalidate)
739 {
741 }
742
743 // deselect all
744 GetView().UnmarkAll();
745
746 // set current group and list
747 SdrObjList* pNewObjList = pObj->GetSubList();
748 SetCurrentGroupAndList(pObj, pNewObjList);
749
750 // select contained object if only one object is contained,
751 // else select nothing and let the user decide what to do next
752 if(pNewObjList && pNewObjList->GetObjCount() == 1)
753 {
754 SdrObject* pFirstObject = pNewObjList->GetObj(0);
755
756 if(GetView().GetSdrPageView())
757 {
758 GetView().MarkObj(pFirstObject, GetView().GetSdrPageView());
759 }
760 }
761
762 // build new handles
764
765 // invalidate only when view wants to visualize group entering
767
768 if (bGlueInvalidate)
769 {
771 }
772
773 return true;
774}
775
777{
778 SdrObject* pLastGroup = GetCurrentGroup();
779 if (!pLastGroup)
780 return;
781
782 bool bGlueInvalidate = GetView().ImpIsGlueVisible();
783
784 if(bGlueInvalidate)
786
787 SdrObject* pParentGroup = pLastGroup->getParentSdrObjectFromSdrObject();
788 SdrObjList* pParentList = GetPage();
789
790 if(pParentGroup)
791 pParentList = pParentGroup->GetSubList();
792
793 // deselect everything
794 GetView().UnmarkAll();
795
796 // allocations, pCurrentGroup and pCurrentList need to be set
797 SetCurrentGroupAndList(pParentGroup, pParentList);
798
799 // select the group we just left
800 if (GetView().GetSdrPageView())
801 GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
802
804
805 // invalidate only if view wants to visualize group entering
807
808 if(bGlueInvalidate)
810}
811
813{
814 SdrObject* pLastGroup = GetCurrentGroup();
815 if (!pLastGroup)
816 return;
817
818 bool bGlueInvalidate = GetView().ImpIsGlueVisible();
819
820 if(bGlueInvalidate)
822
823 // deselect everything
824 GetView().UnmarkAll();
825
826 // allocations, pCurrentGroup and pCurrentList always need to be set
828
829 // find and select uppermost group
830 while (pLastGroup->getParentSdrObjectFromSdrObject())
831 pLastGroup = pLastGroup->getParentSdrObjectFromSdrObject();
832
833 if (GetView().GetSdrPageView())
834 GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
835
837
838 // invalidate only when view wants to visualize group entering
840
841 if(bGlueInvalidate)
843}
844
846{
847 sal_uInt16 nCount=0;
849 while (pGrp!=nullptr) {
850 nCount++;
852 }
853 return nCount;
854}
855
857{
858 SdrObject* pGrp(GetCurrentGroup());
859
860 while(nullptr != pGrp &&
861 (!pGrp->IsInserted() || nullptr == pGrp->getParentSdrObjListFromSdrObject() || nullptr == pGrp->getSdrPageFromSdrObject()))
862 {
863 // anything outside of the borders?
864 pGrp = pGrp->getParentSdrObjectFromSdrObject();
865 }
866
867 if(pGrp != GetCurrentGroup())
868 {
869 if(nullptr != pGrp)
870 {
871 EnterGroup(pGrp);
872 }
873 else
874 {
876 }
877 }
878}
879
880// Set background color for svx at SdrPageViews
882{
883 maBackgroundColor = aBackgroundColor;
884}
885
886
887// Set document color for svx at SdrPageViews
889{
890 maDocumentColor = aDocumentColor;
891}
892
893
894/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawGridFlags
Color maBackgroundColor
SlideSorterView & mrView
void EnableMapMode(bool bEnable=true)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Size GetOutputSizePixel() const
void SetLineColor()
void DrawGrid(const tools::Rectangle &rRect, const Size &rDist, DrawGridFlags nFlags)
const Color & GetLineColor() const
bool IsMapModeEnabled() const
void Insert(const SdrHelpLine &rHL)
Definition: svdhlpln.hxx:71
sal_uInt16 GetCount() const
Definition: svdhlpln.hxx:70
void Delete(sal_uInt16 nPos)
Definition: svdhlpln.hxx:79
const Point & GetPos() const
Definition: svdhlpln.hxx:51
SdrHelpLineKind GetKind() const
Definition: svdhlpln.hxx:49
tools::Rectangle GetBoundRect(const OutputDevice &rOut) const
Definition: svdhlpln.cxx:55
SdrLayerID GetLayerID(const OUString &rName) const
Definition: svdlayer.cxx:231
void Set(SdrLayerID a)
Definition: svdsob.hxx:47
bool IsSet(SdrLayerID a) const
Definition: svdsob.hxx:69
void SetAll()
Definition: svdsob.hxx:75
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
Definition: svdmrkv.cxx:2605
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
Definition: svdmrkv.cxx:1928
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:822
size_t GetObjCount() const
Definition: svdpage.cxx:816
Abstract DrawObject.
Definition: svdobj.hxx:257
bool isDiagram() const
Definition: svdobj.hxx:261
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:710
bool Is3DObj() const
Definition: svdobj.hxx:749
SdrObjList * getParentSdrObjListFromSdrObject() const
Definition: svdobj.cxx:313
bool IsGroupObject() const
Definition: svdobj.cxx:705
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:274
bool IsVisible() const
Definition: svdobj.hxx:758
SdrObject * getParentSdrObjectFromSdrObject() const
Definition: svdobj.cxx:715
bool IsInserted() const
Definition: svdobj.hxx:746
bool IsMarkProtect() const
Definition: svdobj.hxx:760
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:640
sal_uInt16 GetCount() const
Definition: svdpage.hxx:307
for the snap-to-grid in Writer
Definition: svdpage.hxx:286
const tools::Rectangle & GetUserArea() const
Definition: svdpage.hxx:292
const tools::Rectangle & GetPaperRect() const
Definition: svdpage.hxx:291
void SetDesignMode(bool _bDesignMode) const
Sets all elements in the view which support a design and an alive mode into the given mode.
Definition: svdpagv.cxx:340
void Hide()
Definition: svdpagv.cxx:176
void SetLayer(const OUString &rName, SdrLayerIDSet &rBS, bool bJa)
Definition: svdpagv.cxx:560
sal_uInt16 GetEnteredLevel() const
Determine, how deep we descended (0 = Root(Page))
Definition: svdpagv.cxx:845
const SdrPageWindow * FindPatchedPageWindow(const OutputDevice &rOutDev) const
Finds the page window whose PaintWindow belongs to the given output device In opposite to FindPageWin...
Definition: svdpagv.cxx:56
bool IsObjMarkable(SdrObject const *pObj) const
At least one member must be visible for the Group object and it must not be locked.
Definition: svdpagv.cxx:591
bool IsVisible() const
Definition: svdpagv.hxx:146
SdrHelpLineList aHelpLines
Definition: svdpagv.hxx:74
SdrView & mrView
Definition: svdpagv.hxx:58
SdrPageWindow * mpPreparedPageWindow
Definition: svdpagv.hxx:86
tools::Rectangle GetPageRect() const
Definition: svdpagv.cxx:189
void AdjHdl()
Definition: svdpagv.cxx:555
void DrawLayer(SdrLayerID nID, OutputDevice *pGivenTarget, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr, const tools::Rectangle &rRect=tools::Rectangle(), basegfx::B2IRectangle const *pPageFrame=nullptr)
Definition: svdpagv.cxx:251
bool IsReadOnly() const
PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly.
Definition: svdpagv.cxx:158
SdrPage * mpPage
Definition: svdpagv.hxx:59
void ModelHasChanged()
Is called by PaintView, when modal changes have finished.
Definition: svdpagv.cxx:153
SdrObjList * GetObjList() const
Return current List.
Definition: svdpagv.hxx:169
void SetPageOrigin(const Point &rOrg)
Definition: svdpagv.cxx:640
void setPreparedPageWindow(SdrPageWindow *pKnownTarget)
Write access to mpPreparedPageWindow.
Definition: svdpagv.cxx:245
SdrLayerIDSet aLayerPrn
Definition: svdpagv.hxx:69
Point aPgOrg
Definition: svdpagv.hxx:60
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:89
void DrawPageViewGrid(OutputDevice &rOut, const tools::Rectangle &rRect, Color aColor=COL_BLACK)
Definition: svdpagv.cxx:350
SdrLayerIDSet aLayerVisi
Definition: svdpagv.hxx:67
bool mbHasMarked
Definition: svdpagv.hxx:64
void InvalidateAllWin()
Invalidates the Page's whole area.
Definition: svdpagv.cxx:195
SdrView & GetView()
Definition: svdpagv.hxx:130
void LeaveAllGroup()
Leave all object groups we entered previously.
Definition: svdpagv.cxx:812
void RemovePaintWindowFromPageView(SdrPaintWindow &rPaintWindow)
Definition: svdpagv.cxx:132
SdrObject * GetCurrentGroup() const
Return current Group.
Definition: svdpagv.hxx:172
void DeleteHelpLine(sal_uInt16 nNum)
Definition: svdpagv.cxx:698
bool mbVisible
Definition: svdpagv.hxx:65
void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const
Definition: svdpagv.cxx:650
void SetCurrentGroupAndList(SdrObject *pNewGroup, SdrObjList *pNewList)
Set current Group and List.
Definition: svdpagv.cxx:715
Color maDocumentColor
Definition: svdpagv.hxx:77
void AddPaintWindowToPageView(SdrPaintWindow &rPaintWindow)
Definition: svdpagv.cxx:124
std::vector< std::unique_ptr< SdrPageWindow > > maPageWindows
Definition: svdpagv.hxx:82
void SetApplicationDocumentColor(Color aDocumentColor)
Definition: svdpagv.cxx:888
void CheckCurrentGroup()
Let's see if the current Group (pCurrentGroup) is still inserted.
Definition: svdpagv.cxx:856
SdrPage * GetPage() const
Definition: svdpagv.hxx:166
void Show()
Definition: svdpagv.cxx:163
void PrePaint()
PrePaint call forwarded from app windows.
Definition: svdpagv.cxx:206
css::uno::Reference< css::awt::XControlContainer > GetControlContainer(const OutputDevice &_rDevice) const
Looks up the control container belonging to given output device.
Definition: svdpagv.cxx:142
SdrObjList * pCurrentList
Definition: svdpagv.hxx:71
SdrPageWindow * GetPageWindow(sal_uInt32 nIndex) const
Definition: svdpagv.cxx:83
bool IsLayer(const OUString &rName, const SdrLayerIDSet &rBS) const
Definition: svdpagv.cxx:571
SdrLayerIDSet aLayerLock
Definition: svdpagv.hxx:68
SdrPageView(SdrPage *pPage1, SdrView &rNewView)
Definition: svdpagv.cxx:88
void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine &rNewHelpLine)
Definition: svdpagv.cxx:680
SdrPageWindow * FindPageWindow(const SdrPaintWindow &rPaintWindow) const
Definition: svdpagv.cxx:43
Color maBackgroundColor
Definition: svdpagv.hxx:80
SdrObject * pCurrentGroup
Definition: svdpagv.hxx:72
void LeaveOneGroup()
Leave an object group we entered previously.
Definition: svdpagv.cxx:776
void SetHelpLines(const SdrHelpLineList &rHLL)
Definition: svdpagv.cxx:674
void CompleteRedraw(SdrPaintWindow &rPaintWindow, const vcl::Region &rReg, sdr::contact::ViewObjectContactRedirector *pRedirector)
Definition: svdpagv.cxx:221
bool EnterGroup(SdrObject *pObj)
Entering (editing) an object group After that, we have direct access to all member objects of the gro...
Definition: svdpagv.cxx:727
void SetApplicationBackgroundColor(Color aBackgroundColor)
Definition: svdpagv.cxx:881
void InsertHelpLine(const SdrHelpLine &rHL)
Definition: svdpagv.cxx:706
void unpatchPaintWindow(SdrPaintWindow *pPreviousPaintWindow)
SdrPaintWindow * patchPaintWindow(SdrPaintWindow &rPaintWindow)
css::uno::Reference< css::awt::XControlContainer > const & GetControlContainer(bool _bCreateIfNecessary=true) const
void PrepareRedraw(const vcl::Region &rReg)
void SetDesignMode(bool _bDesignMode) const
sets all elements in the view which support a design and an alive mode into the given mode
SdrPaintWindow & GetPaintWindow() const
void RedrawLayer(const SdrLayerID *pId, sdr::contact::ViewObjectContactRedirector *pRedirector, basegfx::B2IRectangle const *)
void RedrawAll(sdr::contact::ViewObjectContactRedirector *pRedirector)
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:377
const SdrLayerAdmin & GetLayerAdmin() const
changing the layers does not set the modified-flag!
Definition: svdpage.cxx:1734
virtual const SdrPageGridFrameList * GetGridFrameList(const SdrPageView *pPV, const tools::Rectangle *pRect) const
for snap-to-grid in Writer, also for AlignObjects if 1 object is marked if pRect !...
Definition: svdpage.cxx:1729
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1569
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1574
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1564
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1579
tools::Long GetHeight() const
Definition: svdpage.cxx:1489
tools::Long GetWidth() const
Definition: svdpage.cxx:1463
Size maGridFin
Definition: svdpntv.hxx:139
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
Definition: svdpntv.cxx:75
void InvalidateAllWin()
Definition: svdpntv.cxx:822
Size maGridBig
Definition: svdpntv.hxx:138
sal_uInt32 PaintWindowCount() const
Definition: svdpntv.hxx:219
bool ImpIsGlueVisible() const
Definition: svdpntv.hxx:240
void GlueInvalidate() const
Definition: svdpntv.cxx:789
const vcl::Region & GetRedrawRegion() const
OutputDevice & GetOutputDevice() const
bool OutputToWindow() const
void SetRedrawRegion(const vcl::Region &rNew)
void UnmarkAll()
Definition: svdview.cxx:1386
constexpr tools::Long Height() const
constexpr tools::Long Width() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
tools::Rectangle & Union(const tools::Rectangle &rRect)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
void Intersect(const tools::Rectangle &rRegion)
bool IsEmpty() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
sal_Int32 nIndex
uno_Any a
int i
long Long
sal_Int16 nId
#define Y
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)