1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
32 //////////////////////////////////////////////////////////////////////////////
38 ViewObjectContact
& ViewContactOfPageObj::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
40 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageObj(rObjectContact
, *this);
44 ViewContactOfPageObj::ViewContactOfPageObj(SdrPageObj
& rPageObj
)
45 : ViewContactOfSdrObj(rPageObj
)
49 ViewContactOfPageObj::~ViewContactOfPageObj()
53 // #i35972# React on changes of the object of this ViewContact
54 void ViewContactOfPageObj::ActionChanged()
56 static bool bIsInActionChange(false);
58 if(!bIsInActionChange
)
60 // set recursion flag, see description in *.hxx
61 bIsInActionChange
= true;
64 ViewContactOfSdrObj::ActionChanged();
66 // reset recursion flag, see description in *.hxx
67 bIsInActionChange
= false;
71 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfPageObj::createViewIndependentPrimitive2DSequence() const
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 const Rectangle
aModelRectangle(GetPageObj().GetLastBoundRect());
77 const basegfx::B2DRange
aModelRange(aModelRectangle
.Left(), aModelRectangle
.Top(), aModelRectangle
.Right(), aModelRectangle
.Bottom());
78 const basegfx::B2DPolygon
aOutline(basegfx::tools::createPolygonFromRect(aModelRange
));
79 const basegfx::BColor
aYellow(1.0, 1.0, 0.0);
80 const drawinglayer::primitive2d::Primitive2DReference
xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline
, aYellow
));
82 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
85 } // end of namespace contact
86 } // end of namespace sdr
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */