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 <svx/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 <svx/sdr/contact/viewcontactofsdrpage.hxx>
30 : #include <svx/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 0 : ViewObjectContact& ViewContactOfMasterPageDescriptor::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
46 : {
47 0 : return *(new ViewObjectContactOfMasterPageDescriptor(rObjectContact, *this));
48 : }
49 :
50 0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const
51 : {
52 0 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
53 0 : drawinglayer::attribute::SdrFillAttribute aFill;
54 0 : const SdrPageProperties* pCorrectProperties = GetMasterPageDescriptor().getCorrectSdrPageProperties();
55 :
56 0 : if(pCorrectProperties)
57 : {
58 : // create page fill attributes when correct properties were identified
59 0 : aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet());
60 : }
61 :
62 0 : 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 0 : const basegfx::B2DHomMatrix aEmptyTransform;
72 : const drawinglayer::primitive2d::Primitive2DReference xReference(
73 : drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
74 : basegfx::B2DPolyPolygon(aInnerPolgon),
75 : aEmptyTransform,
76 : aFill,
77 0 : drawinglayer::attribute::FillGradientAttribute()));
78 :
79 0 : xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
80 : }
81 :
82 0 : return xRetval;
83 : }
84 :
85 : // basic constructor
86 127 : ViewContactOfMasterPageDescriptor::ViewContactOfMasterPageDescriptor(sdr::MasterPageDescriptor& rDescriptor)
87 : : ViewContact(),
88 127 : mrMasterPageDescriptor(rDescriptor)
89 : {
90 127 : }
91 :
92 : // The destructor.
93 242 : ViewContactOfMasterPageDescriptor::~ViewContactOfMasterPageDescriptor()
94 : {
95 242 : }
96 :
97 0 : sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const
98 : {
99 0 : return GetMasterPageDescriptor().GetUsedPage().GetObjCount();
100 : }
101 :
102 0 : ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const
103 : {
104 0 : return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact();
105 : }
106 :
107 0 : ViewContact* ViewContactOfMasterPageDescriptor::GetParentContact() const
108 : {
109 0 : return &(GetMasterPageDescriptor().GetOwnerPage().GetViewContact());
110 : }
111 : } // end of namespace contact
112 : } // end of namespace sdr
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|