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