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/svdpage.hxx>
29 
30 
31 namespace sdr::contact
32 {
34  : ViewObjectContact(rObjectContact, rViewContact)
35  {
36  }
37 
39  {
40  }
41 
43  {
44  if(rDisplayInfo.GetControlLayerProcessingActive())
45  {
46  return false;
47  }
48 
49  if(!rDisplayInfo.GetPageProcessingActive())
50  {
51  return false;
52  }
53 
54  return true;
55  }
56 
58  {
61  const sdr::MasterPageDescriptor& rDescriptor = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).GetMasterPageDescriptor();
62 
63  // used range (retval) is fixed here, it's the MasterPage fill range
64  const SdrPage& rOwnerPage = rDescriptor.GetOwnerPage();
65  const basegfx::B2DRange aPageFillRange(
66  rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(),
67  rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(), rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder());
68 
69  // Modify DisplayInfo for MasterPageContent collection; remember original layers and
70  // set combined SdrLayerIDSet; set MasterPagePaint flag
71  const SdrLayerIDSet aRememberedLayers(rDisplayInfo.GetProcessLayers());
72  SdrLayerIDSet aPreprocessedLayers(aRememberedLayers);
73  aPreprocessedLayers &= rDescriptor.GetVisibleLayers();
74  rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
75  rDisplayInfo.SetSubContentActive(true);
76 
77  // check layer visibility (traditionally was member of layer 1)
78  if(aPreprocessedLayers.IsSet(SdrLayerID(1)))
79  {
80  // hide PageBackground for special DrawModes; historical reasons
82  {
83  // if visible, create the default background primitive sequence
84  xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DContainer();
85  }
86  }
87 
88  // hide MasterPage content? Test self here for hierarchy
89  if(isPrimitiveVisible(rDisplayInfo))
90  {
91  // get the VOC of the Master-SdrPage and get its object hierarchy
92  ViewContact& rViewContactOfMasterPage(rDescriptor.GetUsedPage().GetViewContact());
93  ViewObjectContact& rVOCOfMasterPage(rViewContactOfMasterPage.GetViewObjectContact(GetObjectContact()));
94 
95  xMasterPageSequence = rVOCOfMasterPage.getPrimitive2DSequenceHierarchy(rDisplayInfo);
96  }
97 
98  // reset DisplayInfo changes for MasterPage paint
99  rDisplayInfo.SetProcessLayers(aRememberedLayers);
100  rDisplayInfo.SetSubContentActive(false);
101 
102  if(!xMasterPageSequence.empty())
103  {
104  // get range of MasterPage sub hierarchy
105  const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
106  const basegfx::B2DRange aSubHierarchyRange(xMasterPageSequence.getB2DRange(rViewInformation2D));
107 
108  if(aPageFillRange.isInside(aSubHierarchyRange))
109  {
110  // completely inside, just render MasterPage content. Add to target
111  xRetval.append(xMasterPageSequence);
112  }
113  else if(aPageFillRange.overlaps(aSubHierarchyRange))
114  {
115  // overlapping, compute common area
116  basegfx::B2DRange aCommonArea(aPageFillRange);
117  aCommonArea.intersect(aSubHierarchyRange);
118 
119  // need to create a clip primitive, add clipped list to target
121  basegfx::B2DPolyPolygon(basegfx::utils::createPolygonFromRect(aCommonArea)), xMasterPageSequence));
122  xRetval.push_back(xReference);
123  }
124  }
125 
126  // return grouped primitive
127  return xRetval;
128  }
129 } // end of namespace
130 
131 /* 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:1393
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1478
bool GetPageProcessingActive() const
Definition: displayinfo.hxx:88
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1483
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1468
void SetProcessLayers(const SdrLayerIDSet &rSet)
Definition: displayinfo.cxx:36
void SetSubContentActive(bool bNew)
Definition: displayinfo.cxx:78
const SdrLayerIDSet & GetProcessLayers() const
Definition: displayinfo.hxx:73
ViewObjectContactOfMasterPageDescriptor(ObjectContact &rObjectContact, ViewContact &rViewContact)
ObjectContact & GetObjectContact() const
bool GetControlLayerProcessingActive() const
Definition: displayinfo.hxx:84
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1473
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:1100
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:365
sal_Int32 GetWidth() const
Definition: svdpage.cxx:1367
virtual bool isDrawModeGray() const
const SdrLayerIDSet & GetVisibleLayers() const