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 namespace sdr
{ namespace contact
{
34 ViewObjectContact
& ViewContactOfPageObj::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
36 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageObj(rObjectContact
, *this);
40 ViewContactOfPageObj::ViewContactOfPageObj(SdrPageObj
& rPageObj
)
41 : ViewContactOfSdrObj(rPageObj
)
45 ViewContactOfPageObj::~ViewContactOfPageObj()
49 // #i35972# React on changes of the object of this ViewContact
50 void ViewContactOfPageObj::ActionChanged()
52 static bool bIsInActionChange(false);
54 if(!bIsInActionChange
)
56 // set recursion flag, see description in *.hxx
57 bIsInActionChange
= true;
60 ViewContactOfSdrObj::ActionChanged();
62 // reset recursion flag, see description in *.hxx
63 bIsInActionChange
= false;
67 drawinglayer::primitive2d::Primitive2DContainer
ViewContactOfPageObj::createViewIndependentPrimitive2DSequence() const
69 // create 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 const tools::Rectangle
aModelRectangle(GetPageObj().GetLastBoundRect());
73 const basegfx::B2DRange
aModelRange(aModelRectangle
.Left(), aModelRectangle
.Top(), aModelRectangle
.Right(), aModelRectangle
.Bottom());
74 const basegfx::B2DPolygon
aOutline(basegfx::tools::createPolygonFromRect(aModelRange
));
75 const basegfx::BColor
aYellow(1.0, 1.0, 0.0);
76 const drawinglayer::primitive2d::Primitive2DReference
xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline
, aYellow
));
78 return drawinglayer::primitive2d::Primitive2DContainer
{ xReference
};
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */