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
31namespace 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 // display mster page content?
50 if (!GetObjectContact().isMasterPageActive())
51 {
52 return false;
53 }
54
55 return true;
56 }
57
59 {
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 aInnerRange(
66 rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(),
67 rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(), rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder());
68 const basegfx::B2DRange aOuterRange(
69 0, 0, rOwnerPage.GetWidth(), rOwnerPage.GetHeight());
70 // ??? somehow only the master page's bit is used
71 bool const isFullSize(rDescriptor.GetUsedPage().IsBackgroundFullSize());
72 basegfx::B2DRange const& rPageFillRange(isFullSize ? aOuterRange : aInnerRange);
73
74 // Modify DisplayInfo for MasterPageContent collection; remember original layers and
75 // set combined SdrLayerIDSet; set MasterPagePaint flag
76 const SdrLayerIDSet aRememberedLayers(rDisplayInfo.GetProcessLayers());
77 SdrLayerIDSet aPreprocessedLayers(aRememberedLayers);
78 aPreprocessedLayers &= rDescriptor.GetVisibleLayers();
79 rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
80 rDisplayInfo.SetSubContentActive(true);
81
82 // check layer visibility (traditionally was member of layer 1)
83 if(aPreprocessedLayers.IsSet(SdrLayerID(1)))
84 {
85 // hide PageBackground for special DrawModes; historical reasons
86 if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast())
87 {
88 // if visible, create the default background primitive sequence
89 static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DContainer(rVisitor);
90 }
91 }
92
93 // hide MasterPage content? Test self here for hierarchy
94 if(isPrimitiveVisible(rDisplayInfo))
95 {
96 // get the VOC of the Master-SdrPage and get its object hierarchy
97 ViewContact& rViewContactOfMasterPage(rDescriptor.GetUsedPage().GetViewContact());
98 ViewObjectContact& rVOCOfMasterPage(rViewContactOfMasterPage.GetViewObjectContact(GetObjectContact()));
99
100 rVOCOfMasterPage.getPrimitive2DSequenceHierarchy(rDisplayInfo, xMasterPageSequence);
101 }
102
103 // reset DisplayInfo changes for MasterPage paint
104 rDisplayInfo.SetProcessLayers(aRememberedLayers);
105 rDisplayInfo.SetSubContentActive(false);
106
107 if(!xMasterPageSequence.empty())
108 {
109 // get range of MasterPage sub hierarchy
110 const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
111 basegfx::B2DRange aSubHierarchyRange(xMasterPageSequence.getB2DRange(rViewInformation2D));
112
113 if (rPageFillRange.isInside(aSubHierarchyRange))
114 {
115 // completely inside, just render MasterPage content. Add to target
116 rVisitor.visit(xMasterPageSequence);
117 }
118 else if (rPageFillRange.overlaps(aSubHierarchyRange))
119 {
120 // overlapping, compute common area
121 basegfx::B2DRange aCommonArea(rPageFillRange);
122 aCommonArea.intersect(aSubHierarchyRange);
123
124 // need to create a clip primitive, add clipped list to target
126 basegfx::B2DPolyPolygon(basegfx::utils::createPolygonFromRect(aCommonArea)), std::move(xMasterPageSequence)));
127 rVisitor.visit(xReference);
128 }
129 }
130 }
131} // end of namespace
132
133/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsSet(SdrLayerID a) const
Definition: svdsob.hxx:69
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
const sdr::contact::ViewContact & GetViewContact() const
Definition: svdpage.cxx:1139
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1561
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1566
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1556
bool IsBackgroundFullSize() const
Definition: svdpage.cxx:1585
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1571
tools::Long GetHeight() const
Definition: svdpage.cxx:1481
tools::Long GetWidth() const
Definition: svdpage.cxx:1455
void intersect(const Range2D &rRange)
bool isInside(const Tuple2D< TYPE > &rTuple) const
bool overlaps(const Range2D &rRange) const
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
virtual void visit(const Primitive2DReference &)=0
const SdrLayerIDSet & GetVisibleLayers() const
void SetProcessLayers(const SdrLayerIDSet &rSet)
Definition: displayinfo.cxx:34
void SetSubContentActive(bool bNew)
Definition: displayinfo.cxx:68
bool GetControlLayerProcessingActive() const
Definition: displayinfo.hxx:77
const SdrLayerIDSet & GetProcessLayers() const
Definition: displayinfo.hxx:66
ViewObjectContact & GetViewObjectContact(ObjectContact &rObjectContact)
Definition: viewcontact.cxx:65
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
ViewObjectContactOfMasterPageDescriptor(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual void getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
ViewContact & GetViewContact() const
ObjectContact & GetObjectContact() const
virtual void getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)