/src/libreoffice/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
Line | Count | Source |
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 <sdr/contact/viewcontactofmasterpagedescriptor.hxx> |
21 | | #include <svx/sdr/contact/viewobjectcontact.hxx> |
22 | | #include <svx/svdpage.hxx> |
23 | | #include <svx/svdobj.hxx> |
24 | | #include <sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx> |
25 | | #include <sdr/primitive2d/sdrattributecreator.hxx> |
26 | | #include <basegfx/polygon/b2dpolygontools.hxx> |
27 | | #include <sdr/primitive2d/sdrdecompositiontools.hxx> |
28 | | #include <drawinglayer/attribute/sdrfillattribute.hxx> |
29 | | #include <basegfx/polygon/b2dpolygon.hxx> |
30 | | #include <drawinglayer/attribute/fillgradientattribute.hxx> |
31 | | |
32 | | |
33 | | namespace sdr::contact |
34 | | { |
35 | | ViewObjectContact& ViewContactOfMasterPageDescriptor::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact) |
36 | 0 | { |
37 | 0 | return *(new ViewObjectContactOfMasterPageDescriptor(rObjectContact, *this)); |
38 | 0 | } |
39 | | |
40 | | void ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const |
41 | 0 | { |
42 | 0 | drawinglayer::attribute::SdrFillAttribute aFill; |
43 | 0 | const SdrPageProperties* pCorrectProperties = GetMasterPageDescriptor().getCorrectSdrPageProperties(); |
44 | |
|
45 | 0 | if(pCorrectProperties) |
46 | 0 | { |
47 | | // create page fill attributes when correct properties were identified |
48 | 0 | aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet()); |
49 | 0 | } |
50 | |
|
51 | 0 | if(!aFill.isDefault()) |
52 | 0 | { |
53 | | // direct model data is the page size, get and use it |
54 | 0 | const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); |
55 | 0 | const basegfx::B2DRange aInnerRange( |
56 | 0 | rOwnerPage.GetLeftBorder(), rOwnerPage.GetUpperBorder(), |
57 | 0 | rOwnerPage.GetWidth() - rOwnerPage.GetRightBorder(), |
58 | 0 | rOwnerPage.GetHeight() - rOwnerPage.GetLowerBorder()); |
59 | 0 | const basegfx::B2DRange aOuterRange( |
60 | 0 | 0, 0, rOwnerPage.GetWidth(), rOwnerPage.GetHeight()); |
61 | | // ??? somehow only the master page's bit is used |
62 | 0 | bool const isFullSize(GetMasterPageDescriptor().GetUsedPage().IsBackgroundFullSize()); |
63 | 0 | const basegfx::B2DPolygon aFillPolygon( |
64 | 0 | basegfx::utils::createPolygonFromRect(isFullSize ? aOuterRange : aInnerRange)); |
65 | 0 | const drawinglayer::primitive2d::Primitive2DReference xReference( |
66 | 0 | drawinglayer::primitive2d::createPolyPolygonFillPrimitive( |
67 | 0 | basegfx::B2DPolyPolygon(aFillPolygon), |
68 | 0 | aFill, |
69 | 0 | drawinglayer::attribute::FillGradientAttribute())); |
70 | |
|
71 | 0 | rVisitor.visit(xReference); |
72 | 0 | } |
73 | 0 | } |
74 | | |
75 | | // basic constructor |
76 | | ViewContactOfMasterPageDescriptor::ViewContactOfMasterPageDescriptor(sdr::MasterPageDescriptor& rDescriptor) |
77 | 608k | : mrMasterPageDescriptor(rDescriptor) |
78 | 608k | { |
79 | 608k | } |
80 | | |
81 | | // The destructor. |
82 | | ViewContactOfMasterPageDescriptor::~ViewContactOfMasterPageDescriptor() |
83 | 608k | { |
84 | 608k | } |
85 | | |
86 | | sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const |
87 | 0 | { |
88 | 0 | return GetMasterPageDescriptor().GetUsedPage().GetObjCount(); |
89 | 0 | } |
90 | | |
91 | | ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const |
92 | 0 | { |
93 | 0 | return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); |
94 | 0 | } |
95 | | |
96 | | ViewContact* ViewContactOfMasterPageDescriptor::GetParentContact() const |
97 | 0 | { |
98 | 0 | return &(GetMasterPageDescriptor().GetOwnerPage().GetViewContact()); |
99 | 0 | } |
100 | | |
101 | | } // end of namespace |
102 | | |
103 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |