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/viewcontactofpageobj.hxx>
21 : #include <svx/svdopage.hxx>
22 : #include <svx/sdr/contact/displayinfo.hxx>
23 : #include <vcl/outdev.hxx>
24 : #include <svx/svdmodel.hxx>
25 : #include <svx/svdpage.hxx>
26 : #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
27 : #include <svx/sdr/contact/viewobjectcontact.hxx>
28 : #include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
29 : #include <basegfx/polygon/b2dpolygontools.hxx>
30 : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
31 :
32 : //////////////////////////////////////////////////////////////////////////////
33 :
34 : namespace sdr
35 : {
36 : namespace contact
37 : {
38 0 : ViewObjectContact& ViewContactOfPageObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
39 : {
40 0 : ViewObjectContact* pRetval = new ViewObjectContactOfPageObj(rObjectContact, *this);
41 0 : return *pRetval;
42 : }
43 :
44 130 : ViewContactOfPageObj::ViewContactOfPageObj(SdrPageObj& rPageObj)
45 130 : : ViewContactOfSdrObj(rPageObj)
46 : {
47 130 : }
48 :
49 220 : ViewContactOfPageObj::~ViewContactOfPageObj()
50 : {
51 220 : }
52 :
53 : // #i35972# React on changes of the object of this ViewContact
54 306 : void ViewContactOfPageObj::ActionChanged()
55 : {
56 : static bool bIsInActionChange(false);
57 :
58 306 : if(!bIsInActionChange)
59 : {
60 : // set recursion flag, see description in *.hxx
61 306 : bIsInActionChange = true;
62 :
63 : // call parent
64 306 : ViewContactOfSdrObj::ActionChanged();
65 :
66 : // reset recursion flag, see description in *.hxx
67 306 : bIsInActionChange = false;
68 : }
69 306 : }
70 :
71 0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageObj::createViewIndependentPrimitive2DSequence() const
72 : {
73 : // ceate graphical visualisation data. Since this is the view-independent version which should not be used,
74 : // create a replacement graphic visualisation here. Use GetLastBoundRect to access the model data directly
75 : // which is aOutRect for SdrPageObj.
76 0 : const Rectangle aModelRectangle(GetPageObj().GetLastBoundRect());
77 0 : const basegfx::B2DRange aModelRange(aModelRectangle.Left(), aModelRectangle.Top(), aModelRectangle.Right(), aModelRectangle.Bottom());
78 0 : const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aModelRange));
79 0 : const basegfx::BColor aYellow(1.0, 1.0, 0.0);
80 0 : const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
81 :
82 0 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
83 : }
84 :
85 : } // end of namespace contact
86 : } // end of namespace sdr
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|