LibreOffice Module svx (master)  1
viewobjectcontactofmasterpagedescriptor.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 
25 #include <svx/svdpagv.hxx>
26 #include <svx/svdview.hxx>
27 #include <svx/svdpage.hxx>
31 
32 
33 namespace sdr::contact
34 {
36  : ViewObjectContact(rObjectContact, rViewContact)
37  {
38  }
39 
41  {
42  }
43 
45  {
46  if(rDisplayInfo.GetControlLayerProcessingActive())
47  {
48  return false;
49  }
50 
51  if(!rDisplayInfo.GetPageProcessingActive())
52  {
53  return false;
54  }
55 
56  return true;
57  }
58 
60  {
63  const sdr::MasterPageDescriptor& rDescriptor = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).GetMasterPageDescriptor();
64 
65  // used range (retval) is fixed here, it's the MasterPage fill range
66  const SdrPage& rOwnerPage = rDescriptor.GetOwnerPage();
67  const basegfx::B2DRange aPageFillRange(
68  rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(),
69  rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(), rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder());
70 
71  // Modify DisplayInfo for MasterPageContent collection; remember original layers and
72  // set combined SdrLayerIDSet; set MasterPagePaint flag
73  const SdrLayerIDSet aRememberedLayers(rDisplayInfo.GetProcessLayers());
74  SdrLayerIDSet aPreprocessedLayers(aRememberedLayers);
75  aPreprocessedLayers &= rDescriptor.GetVisibleLayers();
76  rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
77  rDisplayInfo.SetSubContentActive(true);
78 
79  // check layer visibility (traditionally was member of layer 1)
80  if(aPreprocessedLayers.IsSet(SdrLayerID(1)))
81  {
82  // hide PageBackground for special DrawModes; historical reasons
84  {
85  // if visible, create the default background primitive sequence
86  xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DContainer();
87  }
88  }
89 
90  // hide MasterPage content? Test self here for hierarchy
91  if(isPrimitiveVisible(rDisplayInfo))
92  {
93  // get the VOC of the Master-SdrPage and get its object hierarchy
94  ViewContact& rViewContactOfMasterPage(rDescriptor.GetUsedPage().GetViewContact());
95  ViewObjectContact& rVOCOfMasterPage(rViewContactOfMasterPage.GetViewObjectContact(GetObjectContact()));
96 
97  xMasterPageSequence = rVOCOfMasterPage.getPrimitive2DSequenceHierarchy(rDisplayInfo);
98  }
99 
100  // reset DisplayInfo changes for MasterPage paint
101  rDisplayInfo.SetProcessLayers(aRememberedLayers);
102  rDisplayInfo.SetSubContentActive(false);
103 
104  if(!xMasterPageSequence.empty())
105  {
106  // get range of MasterPage sub hierarchy
107  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
108  const basegfx::B2DRange aSubHierarchyRange(xMasterPageSequence.getB2DRange(rViewInformation2D));
109 
110  if(aPageFillRange.isInside(aSubHierarchyRange))
111  {
112  // completely inside, just render MasterPage content. Add to target
113  xRetval.append(xMasterPageSequence);
114  }
115  else if(aPageFillRange.overlaps(aSubHierarchyRange))
116  {
117  // overlapping, compute common area
118  basegfx::B2DRange aCommonArea(aPageFillRange);
119  aCommonArea.intersect(aSubHierarchyRange);
120 
121  // need to create a clip primitive, add clipped list to target
123  basegfx::B2DPolyPolygon(basegfx::utils::createPolygonFromRect(aCommonArea)), xMasterPageSequence));
124  xRetval.push_back(xReference);
125  }
126  }
127 
128  // return grouped primitive
129  return xRetval;
130  }
131 } // end of namespace
132 
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool isDrawModeHighContrast() const
virtual drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo) const override
sal_Int32 GetHeight() const
Definition: svdpage.cxx:1418
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1503
bool GetPageProcessingActive() const
Definition: displayinfo.hxx:90
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1508
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1493
void SetProcessLayers(const SdrLayerIDSet &rSet)
Definition: displayinfo.cxx:36
void SetSubContentActive(bool bNew)
Definition: displayinfo.cxx:78
const SdrLayerIDSet & GetProcessLayers() const
Definition: displayinfo.hxx:75
ViewObjectContactOfMasterPageDescriptor(ObjectContact &rObjectContact, ViewContact &rViewContact)
ObjectContact & GetObjectContact() const
bool GetControlLayerProcessingActive() const
Definition: displayinfo.hxx:86
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1498
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
virtual void append(const Primitive2DReference &) override
void intersect(const B2DRange &rRange)
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
const sdr::contact::ViewContact & GetViewContact() const
Definition: svdpage.cxx:1125
ViewContact & GetViewContact() const
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
sal_Int32 GetWidth() const
Definition: svdpage.cxx:1392
virtual bool isDrawModeGray() const
const SdrLayerIDSet & GetVisibleLayers() const