1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/svdpagv.hxx>
21 #include <com/sun/star/awt/XWindow.hpp>
22 #include <com/sun/star/awt/PosSize.hpp>
23 #include <svx/svdoutl.hxx>
24 #include <svx/xpoly.hxx>
25 #include <svx/svdouno.hxx>
26 #include <svx/svdpage.hxx>
27 #include <svx/svdview.hxx>
29 #include <svx/svdedxv.hxx>
30 #include <editeng/outliner.hxx>
31 #include <svx/svdetc.hxx>
32 #include <svx/svdobj.hxx>
33 #include <svx/svditer.hxx>
34 #include <svx/svdogrp.hxx>
35 #include <svx/svdtypes.hxx>
36 #include <svx/svdoole2.hxx>
38 #include <svx/sdr/contact/objectcontactofpageview.hxx>
39 #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
40 #include <svx/fmview.hxx>
44 #include <svx/sdrpagewindow.hxx>
45 #include <svx/sdrpaintwindow.hxx>
46 #include <comphelper/lok.hxx>
47 #include <basegfx/range/b2irectangle.hxx>
49 using namespace ::com::sun::star
;
51 // interface to SdrPageWindow
53 SdrPageWindow
* SdrPageView::FindPageWindow(SdrPaintWindow
& rPaintWindow
) const
55 for(auto & a
: maPageWindows
)
57 if(&(a
->GetPaintWindow()) == &rPaintWindow
)
66 const SdrPageWindow
* SdrPageView::FindPatchedPageWindow( const OutputDevice
& _rOutDev
) const
68 for ( auto const & pPageWindow
: maPageWindows
)
70 const SdrPaintWindow
& rPaintWindow( pPageWindow
->GetOriginalPaintWindow() ? *pPageWindow
->GetOriginalPaintWindow() : pPageWindow
->GetPaintWindow() );
71 if ( &rPaintWindow
.GetOutputDevice() == &_rOutDev
)
73 return pPageWindow
.get();
80 SdrPageWindow
* SdrPageView::FindPageWindow(const OutputDevice
& rOutDev
) const
82 for ( auto const & pPageWindow
: maPageWindows
)
84 if(&(pPageWindow
->GetPaintWindow().GetOutputDevice()) == &rOutDev
)
86 return pPageWindow
.get();
93 SdrPageWindow
* SdrPageView::GetPageWindow(sal_uInt32 nIndex
) const
95 return maPageWindows
[nIndex
].get();
98 void SdrPageView::ClearPageWindows()
100 maPageWindows
.clear();
103 SdrPageView::SdrPageView(SdrPage
* pPage1
, SdrView
& rNewView
)
105 // col_auto color lets the view takes the default SvxColorConfig entry
106 maDocumentColor( COL_AUTO
),
107 maBackgroundColor( COL_AUTO
), // #i48367# also react on autocolor
108 mpPreparedPageWindow(nullptr) // #i72752#
114 aPgOrg
.setX(mpPage
->GetLeftBorder() );
115 aPgOrg
.setY(mpPage
->GetUpperBorder() );
117 // For example, in the case of charts, there is a LayerAdmin, but it has no valid values. Therefore
118 // a solution like pLayerAdmin->getVisibleLayersODF(aLayerVisi) is not possible. So use the
119 // generic SetAll() for now.
125 pCurrentList
= nullptr;
126 pCurrentGroup
= nullptr;
127 SetCurrentGroupAndList(nullptr, mpPage
);
129 for(sal_uInt32
a(0); a
< rNewView
.PaintWindowCount(); a
++)
131 AddPaintWindowToPageView(*rNewView
.GetPaintWindow(a
));
135 SdrPageView::~SdrPageView()
139 void SdrPageView::AddPaintWindowToPageView(SdrPaintWindow
& rPaintWindow
)
141 if(!FindPageWindow(rPaintWindow
))
143 maPageWindows
.emplace_back(new SdrPageWindow(*this, rPaintWindow
));
147 void SdrPageView::RemovePaintWindowFromPageView(SdrPaintWindow
& rPaintWindow
)
149 auto it
= std::find_if(maPageWindows
.begin(), maPageWindows
.end(),
150 [&rPaintWindow
](const std::unique_ptr
<SdrPageWindow
>& rpWindow
) {
151 return &(rpWindow
->GetPaintWindow()) == &rPaintWindow
;
153 if (it
!= maPageWindows
.end())
154 maPageWindows
.erase(it
);
157 css::uno::Reference
< css::awt::XControlContainer
> SdrPageView::GetControlContainer( const OutputDevice
& _rDevice
) const
159 css::uno::Reference
< css::awt::XControlContainer
> xReturn
;
160 const SdrPageWindow
* pCandidate
= FindPatchedPageWindow( _rDevice
);
163 xReturn
= pCandidate
->GetControlContainer();
168 void SdrPageView::ModelHasChanged()
170 if (GetCurrentGroup()!=nullptr) CheckCurrentGroup();
173 bool SdrPageView::IsReadOnly() const
175 return (nullptr == GetPage() || GetView().GetModel()->IsReadOnly() || GetPage()->IsReadOnly() || GetObjList()->IsReadOnly());
178 void SdrPageView::Show()
184 for(sal_uInt32
a(0); a
< GetView().PaintWindowCount(); a
++)
186 AddPaintWindowToPageView(*GetView().GetPaintWindow(a
));
191 void SdrPageView::Hide()
195 if (!comphelper::LibreOfficeKit::isActive())
204 tools::Rectangle
SdrPageView::GetPageRect() const
206 if (GetPage()==nullptr) return tools::Rectangle();
207 return tools::Rectangle(Point(),Size(GetPage()->GetWidth()+1,GetPage()->GetHeight()+1));
210 void SdrPageView::InvalidateAllWin()
212 if(IsVisible() && GetPage())
214 tools::Rectangle
aRect(Point(0,0),Size(GetPage()->GetWidth()+1,GetPage()->GetHeight()+1));
215 aRect
.Union(GetPage()->GetAllObjBoundRect());
216 GetView().InvalidateAllWin(aRect
);
221 void SdrPageView::PrePaint()
223 const sal_uInt32
nCount(PageWindowCount());
225 for(sal_uInt32
a(0); a
< nCount
; a
++)
227 SdrPageWindow
* pCandidate
= GetPageWindow(a
);
231 pCandidate
->PrePaint();
236 void SdrPageView::CompleteRedraw(
237 SdrPaintWindow
& rPaintWindow
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
)
241 SdrPageWindow
* pPageWindow
= FindPageWindow(rPaintWindow
);
242 std::unique_ptr
<SdrPageWindow
> pTempPageWindow
;
246 // create temp PageWindow
247 pTempPageWindow
.reset(new SdrPageWindow(*this, rPaintWindow
));
248 pPageWindow
= pTempPageWindow
.get();
252 pPageWindow
->PrepareRedraw(rReg
);
253 pPageWindow
->RedrawAll(pRedirector
);
258 // #i74769# use SdrPaintWindow directly
260 void SdrPageView::setPreparedPageWindow(SdrPageWindow
* pKnownTarget
)
262 // #i72752# remember prepared SdrPageWindow
263 mpPreparedPageWindow
= pKnownTarget
;
266 void SdrPageView::DrawLayer(SdrLayerID nID
, OutputDevice
* pGivenTarget
,
267 sdr::contact::ViewObjectContactRedirector
* pRedirector
,
268 const tools::Rectangle
& rRect
, basegfx::B2IRectangle
const*const pPageFrame
)
274 SdrPageWindow
* pKnownTarget
= FindPageWindow(*pGivenTarget
);
278 // paint known target
279 pKnownTarget
->RedrawLayer(&nID
, pRedirector
, nullptr);
283 // #i72752# DrawLayer() uses an OutputDevice different from BeginDrawLayer. This happens
284 // e.g. when SW paints a single text line in text edit mode. Try to use it
285 SdrPageWindow
* pPreparedTarget
= mpPreparedPageWindow
;
289 // if we have a prepared target, do not use a new SdrPageWindow since this
290 // works but is expensive. Just use a temporary PaintWindow
291 SdrPaintWindow
aTemporaryPaintWindow(mrView
, *pGivenTarget
);
293 // Copy existing paint region to use the same as prepared in BeginDrawLayer
294 SdrPaintWindow
& rExistingPaintWindow
= pPreparedTarget
->GetPaintWindow();
295 const vcl::Region
& rExistingRegion
= rExistingPaintWindow
.GetRedrawRegion();
296 bool bUseRect(false);
297 if (!rRect
.IsEmpty())
299 vcl::Region
r(rExistingRegion
);
301 // fdo#74435: FIXME: visibility check broken if empty
306 aTemporaryPaintWindow
.SetRedrawRegion(rExistingRegion
);
308 aTemporaryPaintWindow
.SetRedrawRegion(vcl::Region(rRect
));
309 // patch the ExistingPageWindow
310 pPreparedTarget
->patchPaintWindow(aTemporaryPaintWindow
);
313 pPreparedTarget
->RedrawLayer(&nID
, pRedirector
, pPageFrame
);
315 // restore the ExistingPageWindow
316 pPreparedTarget
->unpatchPaintWindow();
320 OSL_FAIL("SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), this should never be needed (!)");
322 // None of the known OutputDevices is the target of this paint, use
323 // a temporary SdrPageWindow for this Redraw.
324 SdrPaintWindow
aTemporaryPaintWindow(mrView
, *pGivenTarget
);
325 SdrPageWindow
aTemporaryPageWindow(*this, aTemporaryPaintWindow
);
328 // Copy existing paint region if other PageWindows exist, this was created by
329 // PrepareRedraw() from BeginDrawLayer(). Needs to be used e.g. when suddenly SW
330 // paints into an unknown device other than the view was created for (e.g. VirtualDevice)
331 if(PageWindowCount())
333 SdrPageWindow
* pExistingPageWindow
= GetPageWindow(0);
334 SdrPaintWindow
& rExistingPaintWindow
= pExistingPageWindow
->GetPaintWindow();
335 const vcl::Region
& rExistingRegion
= rExistingPaintWindow
.GetRedrawRegion();
336 aTemporaryPaintWindow
.SetRedrawRegion(rExistingRegion
);
339 aTemporaryPageWindow
.RedrawLayer(&nID
, pRedirector
, nullptr);
345 // paint in all known windows
346 for(sal_uInt32
a(0); a
< PageWindowCount(); a
++)
348 SdrPageWindow
* pTarget
= GetPageWindow(a
);
349 pTarget
->RedrawLayer(&nID
, pRedirector
, nullptr);
355 void SdrPageView::SetDesignMode( bool _bDesignMode
) const
357 for ( sal_uInt32 i
= 0; i
< PageWindowCount(); ++i
)
359 const SdrPageWindow
& rPageViewWindow
= *GetPageWindow(i
);
360 rPageViewWindow
.SetDesignMode( _bDesignMode
);
365 void SdrPageView::DrawPageViewGrid(OutputDevice
& rOut
, const tools::Rectangle
& rRect
, Color aColor
)
367 if (GetPage()==nullptr)
370 long nx1
=GetView().maGridBig
.Width();
371 long nx2
=GetView().maGridFin
.Width();
372 long ny1
=GetView().maGridBig
.Height();
373 long ny2
=GetView().maGridFin
.Height();
379 if (nx1
==0) { nx1
=ny1
; nx2
=ny2
; }
380 if (ny1
==0) { ny1
=nx1
; ny2
=nx2
; }
389 // no more global output size, use window size instead to decide grid sizes
390 long nScreenWdt
= rOut
.GetOutputSizePixel().Width();
395 if (nScreenWdt
>=1600)
400 else if (nScreenWdt
>=1024)
410 Size
aMinDotDist(rOut
.PixelToLogic(Size(nMinDotPix
,nMinDotPix
)));
411 Size
aMinLinDist(rOut
.PixelToLogic(Size(nMinLinPix
,nMinLinPix
)));
412 bool bHoriSolid
=nx2
<aMinDotDist
.Width();
413 bool bVertSolid
=ny2
<aMinDotDist
.Height();
414 // enlarge line offset (minimum 4 pixels)
415 // enlarge by: *2 *5 *10 *20 *50 *100 ...
418 while (nx1
<aMinLinDist
.Width())
423 if (nTgl
==1) nx1
=nVal0
*5; // => nx1*=2.5
427 nTgl
++; if (nTgl
>=3) nTgl
=0;
431 while (ny1
<aMinLinDist
.Height())
436 if (nTgl
==1) ny1
=nVal0
*5; // => ny1*=2.5
445 bool bHoriFine
=nx2
<nx1
;
446 bool bVertFine
=ny2
<ny1
;
447 bool bHoriLines
=bHoriSolid
|| bHoriFine
|| !bVertFine
;
448 bool bVertLines
=bVertSolid
|| bVertFine
;
450 Color
aOriginalLineColor( rOut
.GetLineColor() );
451 rOut
.SetLineColor( aColor
);
453 bool bMap0
=rOut
.IsMapModeEnabled();
458 long x1
=GetPage()->GetLeftBorder()+1+nWrX
;
459 long x2
=GetPage()->GetWidth()-GetPage()->GetRightBorder()-1+nWrY
;
460 long y1
=GetPage()->GetUpperBorder()+1+nWrX
;
461 long y2
=GetPage()->GetHeight()-GetPage()->GetLowerBorder()-1+nWrY
;
462 const SdrPageGridFrameList
* pFrames
=GetPage()->GetGridFrameList(this,nullptr);
464 sal_uInt16 nGridPaintCnt
=1;
465 if (pFrames
!=nullptr) nGridPaintCnt
=pFrames
->GetCount();
466 for (sal_uInt16 nGridPaintNum
=0; nGridPaintNum
<nGridPaintCnt
; nGridPaintNum
++) {
467 if (pFrames
!=nullptr) {
468 const SdrPageGridFrame
& rGF
=(*pFrames
)[nGridPaintNum
];
469 nWrX
=rGF
.GetPaperRect().Left();
470 nWrY
=rGF
.GetPaperRect().Top();
471 x1
=rGF
.GetUserArea().Left();
472 x2
=rGF
.GetUserArea().Right();
473 y1
=rGF
.GetUserArea().Top();
474 y2
=rGF
.GetUserArea().Bottom();
475 aOrg
=rGF
.GetUserArea().TopLeft();
476 aOrg
-=rGF
.GetPaperRect().TopLeft();
478 if (!rRect
.IsEmpty()) {
479 Size
a1PixSiz(rOut
.PixelToLogic(Size(1,1)));
480 long nX1Pix
=a1PixSiz
.Width(); // add 1 pixel of tolerance
481 long nY1Pix
=a1PixSiz
.Height();
482 if (x1
<rRect
.Left() -nX1Pix
) x1
=rRect
.Left() -nX1Pix
;
483 if (x2
>rRect
.Right() +nX1Pix
) x2
=rRect
.Right() +nX1Pix
;
484 if (y1
<rRect
.Top() -nY1Pix
) y1
=rRect
.Top() -nY1Pix
;
485 if (y2
>rRect
.Bottom()+nY1Pix
) y2
=rRect
.Bottom()+nY1Pix
;
488 long xBigOrg
=aOrg
.X()+nWrX
;
489 while (xBigOrg
>=x1
) xBigOrg
-=nx1
;
490 while (xBigOrg
<x1
) xBigOrg
+=nx1
;
491 long xFinOrg
=xBigOrg
;
492 while (xFinOrg
>=x1
) xFinOrg
-=nx2
;
493 while (xFinOrg
<x1
) xFinOrg
+=nx2
;
495 long yBigOrg
=aOrg
.Y()+nWrY
;
496 while (yBigOrg
>=y1
) yBigOrg
-=ny1
;
497 while (yBigOrg
<y1
) yBigOrg
+=ny1
;
498 long yFinOrg
=yBigOrg
;
499 while (yFinOrg
>=y1
) yFinOrg
-=ny2
;
500 while (yFinOrg
<y1
) yFinOrg
+=ny2
;
502 if( x1
<= x2
&& y1
<= y2
)
506 DrawGridFlags nGridFlags
= ( bHoriSolid
? DrawGridFlags::HorzLines
: DrawGridFlags::Dots
);
507 sal_uInt16 nSteps
= sal_uInt16(nx1
/ nx2
);
508 sal_uInt32 nRestPerStepMul1000
= nSteps
? ( ((nx1
* 1000L)/ nSteps
) - (nx2
* 1000L) ) : 0;
509 sal_uInt32 nStepOffset
= 0;
510 sal_uInt16 nPointOffset
= 0;
512 for(sal_uInt16 a
=0;a
<nSteps
;a
++)
516 tools::Rectangle( xFinOrg
+ (a
* nx2
) + nPointOffset
, yBigOrg
, x2
, y2
),
517 Size( nx1
, ny1
), nGridFlags
);
520 nStepOffset
+= nRestPerStepMul1000
;
521 while(nStepOffset
>= 1000)
531 DrawGridFlags nGridFlags
= ( bVertSolid
? DrawGridFlags::VertLines
: DrawGridFlags::Dots
);
532 sal_uInt16 nSteps
= sal_uInt16(ny1
/ ny2
);
533 sal_uInt32 nRestPerStepMul1000
= nSteps
? ( ((ny1
* 1000L)/ nSteps
) - (ny2
* 1000L) ) : 0;
534 sal_uInt32 nStepOffset
= 0;
535 sal_uInt16 nPointOffset
= 0;
537 for(sal_uInt16 a
=0;a
<nSteps
;a
++)
541 tools::Rectangle( xBigOrg
, yFinOrg
+ (a
* ny2
) + nPointOffset
, x2
, y2
),
542 Size( nx1
, ny1
), nGridFlags
);
545 nStepOffset
+= nRestPerStepMul1000
;
546 while(nStepOffset
>= 1000)
556 rOut
.EnableMapMode(bMap0
);
557 rOut
.SetLineColor(aOriginalLineColor
);
560 void SdrPageView::AdjHdl()
562 GetView().AdjustMarkHdl();
565 void SdrPageView::SetLayer(const OUString
& rName
, SdrLayerIDSet
& rBS
, bool bJa
)
570 SdrLayerID nID
= GetPage()->GetLayerAdmin().GetLayerID(rName
);
572 if(SDRLAYER_NOTFOUND
!= nID
)
576 bool SdrPageView::IsLayer(const OUString
& rName
, const SdrLayerIDSet
& rBS
) const
583 if (!rName
.isEmpty())
585 SdrLayerID nId
= GetPage()->GetLayerAdmin().GetLayerID(rName
);
587 if(SDRLAYER_NOTFOUND
!= nId
)
589 bRet
= rBS
.IsSet(nId
);
596 bool SdrPageView::IsObjMarkable(SdrObject
const * pObj
) const
600 if (pObj
->IsMarkProtect())
601 return false; // excluded from selection?
602 if (!pObj
->IsVisible())
603 return false; // only visible are selectable
604 if (!pObj
->IsInserted())
605 return false; // Obj deleted?
606 if (auto pObjGroup
= dynamic_cast<const SdrObjGroup
*>(pObj
))
608 // If object is a Group object, visibility may depend on
609 // multiple layers. If one object is markable, Group is markable.
610 SdrObjList
* pObjList
= pObjGroup
->GetSubList();
612 if (pObjList
&& pObjList
->GetObjCount())
614 for (size_t a
= 0; a
< pObjList
->GetObjCount(); ++a
)
616 SdrObject
* pCandidate
= pObjList
->GetObj(a
);
618 if (IsObjMarkable(pCandidate
))
626 // Allow empty groups to be selected to be able to delete them
630 if (!pObj
->Is3DObj() && pObj
->getSdrPageFromSdrObject() != GetPage())
632 // Obj suddenly in different Page
636 // the layer has to be visible and must not be locked
637 SdrLayerID nL
= pObj
->GetLayer();
638 if (!aLayerVisi
.IsSet(nL
))
640 if (aLayerLock
.IsSet(nL
))
645 void SdrPageView::SetPageOrigin(const Point
& rOrg
)
649 if (GetView().IsGridVisible()) {
655 void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum
) const
657 if (GetView().IsHlplVisible() && nNum
<aHelpLines
.GetCount()) {
658 const SdrHelpLine
& rHL
=aHelpLines
[nNum
];
660 for(sal_uInt32
a(0); a
< GetView().PaintWindowCount(); a
++)
662 SdrPaintWindow
* pCandidate
= GetView().GetPaintWindow(a
);
664 if(pCandidate
->OutputToWindow())
666 OutputDevice
& rOutDev
= pCandidate
->GetOutputDevice();
667 tools::Rectangle
aR(rHL
.GetBoundRect(rOutDev
));
668 Size
aSiz(rOutDev
.PixelToLogic(Size(1,1)));
669 aR
.AdjustLeft( -(aSiz
.Width()) );
670 aR
.AdjustRight(aSiz
.Width() );
671 aR
.AdjustTop( -(aSiz
.Height()) );
672 aR
.AdjustBottom(aSiz
.Height() );
673 const_cast<SdrView
&>(GetView()).InvalidateOneWin(rOutDev
, aR
);
679 void SdrPageView::SetHelpLines(const SdrHelpLineList
& rHLL
)
685 void SdrPageView::SetHelpLine(sal_uInt16 nNum
, const SdrHelpLine
& rNewHelpLine
)
687 if (nNum
<aHelpLines
.GetCount() && aHelpLines
[nNum
]!=rNewHelpLine
) {
688 bool bNeedRedraw
= true;
689 if (aHelpLines
[nNum
].GetKind()==rNewHelpLine
.GetKind()) {
690 switch (rNewHelpLine
.GetKind()) {
691 case SdrHelpLineKind::Vertical
: if (aHelpLines
[nNum
].GetPos().X()==rNewHelpLine
.GetPos().X()) bNeedRedraw
= false; break;
692 case SdrHelpLineKind::Horizontal
: if (aHelpLines
[nNum
].GetPos().Y()==rNewHelpLine
.GetPos().Y()) bNeedRedraw
= false; break;
696 if (bNeedRedraw
) ImpInvalidateHelpLineArea(nNum
);
697 aHelpLines
[nNum
]=rNewHelpLine
;
698 if (bNeedRedraw
) ImpInvalidateHelpLineArea(nNum
);
702 void SdrPageView::DeleteHelpLine(sal_uInt16 nNum
)
704 if (nNum
<aHelpLines
.GetCount()) {
705 ImpInvalidateHelpLineArea(nNum
);
706 aHelpLines
.Delete(nNum
);
710 void SdrPageView::InsertHelpLine(const SdrHelpLine
& rHL
)
712 sal_uInt16 nNum
= aHelpLines
.GetCount();
713 aHelpLines
.Insert(rHL
,nNum
);
714 if (GetView().IsHlplVisible())
715 ImpInvalidateHelpLineArea(nNum
);
718 // set current group and list
719 void SdrPageView::SetCurrentGroupAndList(SdrObject
* pNewGroup
, SdrObjList
* pNewList
)
721 if(pCurrentGroup
!= pNewGroup
)
723 pCurrentGroup
= pNewGroup
;
725 if(pCurrentList
!= pNewList
)
727 pCurrentList
= pNewList
;
731 bool SdrPageView::EnterGroup(SdrObject
* pObj
)
735 if(pObj
&& pObj
->IsGroupObject())
737 bool bGlueInvalidate(GetView().ImpIsGlueVisible());
741 GetView().GlueInvalidate();
745 GetView().UnmarkAll();
747 // set current group and list
748 SdrObjList
* pNewObjList
= pObj
->GetSubList();
749 SetCurrentGroupAndList(pObj
, pNewObjList
);
751 // select contained object if only one object is contained,
752 // else select nothing and let the user decide what to do next
753 if(pNewObjList
&& pNewObjList
->GetObjCount() == 1)
755 SdrObject
* pFirstObject
= pNewObjList
->GetObj(0);
757 if(GetView().GetSdrPageView())
759 GetView().MarkObj(pFirstObject
, GetView().GetSdrPageView());
764 GetView().AdjustMarkHdl();
766 // invalidate only when view wants to visualize group entering
771 GetView().GlueInvalidate();
780 void SdrPageView::LeaveOneGroup()
782 SdrObject
* pLastGroup
= GetCurrentGroup();
786 bool bGlueInvalidate
= GetView().ImpIsGlueVisible();
789 GetView().GlueInvalidate();
791 SdrObject
* pParentGroup
= pLastGroup
->getParentSdrObjectFromSdrObject();
792 SdrObjList
* pParentList
= GetPage();
795 pParentList
= pParentGroup
->GetSubList();
797 // deselect everything
798 GetView().UnmarkAll();
800 // allocations, pCurrentGroup and pCurrentList need to be set
801 SetCurrentGroupAndList(pParentGroup
, pParentList
);
803 // select the group we just left
804 if (GetView().GetSdrPageView())
805 GetView().MarkObj(pLastGroup
, GetView().GetSdrPageView());
807 GetView().AdjustMarkHdl();
809 // invalidate only if view wants to visualize group entering
813 GetView().GlueInvalidate();
816 void SdrPageView::LeaveAllGroup()
818 if (SdrObject
* pLastGroup
= GetCurrentGroup())
820 bool bGlueInvalidate
= GetView().ImpIsGlueVisible();
823 GetView().GlueInvalidate();
825 // deselect everything
826 GetView().UnmarkAll();
828 // allocations, pCurrentGroup and pCurrentList always need to be set
829 SetCurrentGroupAndList(nullptr, GetPage());
831 // find and select uppermost group
832 while (pLastGroup
->getParentSdrObjectFromSdrObject())
833 pLastGroup
= pLastGroup
->getParentSdrObjectFromSdrObject();
835 if (GetView().GetSdrPageView())
836 GetView().MarkObj(pLastGroup
, GetView().GetSdrPageView());
838 GetView().AdjustMarkHdl();
840 // invalidate only when view wants to visualize group entering
844 GetView().GlueInvalidate();
848 sal_uInt16
SdrPageView::GetEnteredLevel() const
851 SdrObject
* pGrp
=GetCurrentGroup();
852 while (pGrp
!=nullptr) {
854 pGrp
=pGrp
->getParentSdrObjectFromSdrObject();
859 void SdrPageView::CheckCurrentGroup()
861 SdrObject
* pGrp(GetCurrentGroup());
863 while(nullptr != pGrp
&&
864 (!pGrp
->IsInserted() || nullptr == pGrp
->getParentSdrObjListFromSdrObject() || nullptr == pGrp
->getSdrPageFromSdrObject()))
866 // anything outside of the borders?
867 pGrp
= pGrp
->getParentSdrObjectFromSdrObject();
870 if(pGrp
!= GetCurrentGroup())
883 // Set background color for svx at SdrPageViews
884 void SdrPageView::SetApplicationBackgroundColor(Color aBackgroundColor
)
886 maBackgroundColor
= aBackgroundColor
;
890 // Set document color for svx at SdrPageViews
891 void SdrPageView::SetApplicationDocumentColor(Color aDocumentColor
)
893 maDocumentColor
= aDocumentColor
;
897 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */