Line data Source code
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/sdr/contact/displayinfo.hxx>
24 : #include <svx/svdobj.hxx>
25 : #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
26 : #include <vcl/timer.hxx>
27 : #include <svx/svdpagv.hxx>
28 : #include <svx/svdview.hxx>
29 : #include <sdr/contact/viewcontactofsdrpage.hxx>
30 : #include <sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx>
31 : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
32 : #include <basegfx/polygon/b2dpolygontools.hxx>
33 : #include <basegfx/matrix/b2dhommatrix.hxx>
34 : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
35 : #include <drawinglayer/attribute/sdrfillattribute.hxx>
36 : #include <basegfx/polygon/b2dpolygon.hxx>
37 : #include <drawinglayer/attribute/fillgradientattribute.hxx>
38 :
39 :
40 :
41 : namespace sdr
42 : {
43 : namespace contact
44 : {
45 273 : ViewObjectContact& ViewContactOfMasterPageDescriptor::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
46 : {
47 273 : return *(new ViewObjectContactOfMasterPageDescriptor(rObjectContact, *this));
48 : }
49 :
50 1183 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const
51 : {
52 1183 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
53 2366 : drawinglayer::attribute::SdrFillAttribute aFill;
54 1183 : const SdrPageProperties* pCorrectProperties = GetMasterPageDescriptor().getCorrectSdrPageProperties();
55 :
56 1183 : if(pCorrectProperties)
57 : {
58 : // create page fill attributes when correct properties were identified
59 1174 : aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet());
60 : }
61 :
62 1183 : if(!aFill.isDefault())
63 : {
64 : // direct model data is the page size, get and use it
65 0 : const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage();
66 : const basegfx::B2DRange aInnerRange(
67 0 : rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(),
68 0 : rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(),
69 0 : rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder());
70 0 : const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
71 : const drawinglayer::primitive2d::Primitive2DReference xReference(
72 : drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
73 : basegfx::B2DPolyPolygon(aInnerPolgon),
74 : aFill,
75 0 : drawinglayer::attribute::FillGradientAttribute()));
76 :
77 0 : xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
78 : }
79 :
80 2366 : return xRetval;
81 : }
82 :
83 : // basic constructor
84 2008 : ViewContactOfMasterPageDescriptor::ViewContactOfMasterPageDescriptor(sdr::MasterPageDescriptor& rDescriptor)
85 : : ViewContact(),
86 2008 : mrMasterPageDescriptor(rDescriptor)
87 : {
88 2008 : }
89 :
90 : // The destructor.
91 3986 : ViewContactOfMasterPageDescriptor::~ViewContactOfMasterPageDescriptor()
92 : {
93 3986 : }
94 :
95 0 : sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const
96 : {
97 0 : return GetMasterPageDescriptor().GetUsedPage().GetObjCount();
98 : }
99 :
100 0 : ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const
101 : {
102 0 : return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact();
103 : }
104 :
105 0 : ViewContact* ViewContactOfMasterPageDescriptor::GetParentContact() const
106 : {
107 0 : return &(GetMasterPageDescriptor().GetOwnerPage().GetViewContact());
108 : }
109 : } // end of namespace contact
110 435 : } // end of namespace sdr
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|