Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / svx / source / sdr / contact / viewcontactofpageobj.cxx
blob3736faefa2bc9e7986a74408282004a9124c353f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sdr/contact/viewcontactofpageobj.hxx>
21 #include <svx/svdopage.hxx>
22 #include <vcl/canvastools.hxx>
23 #include <svx/sdr/contact/viewobjectcontact.hxx>
24 #include <sdr/contact/viewobjectcontactofpageobj.hxx>
25 #include <basegfx/polygon/b2dpolygontools.hxx>
26 #include <drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx>
28 namespace sdr::contact
30 ViewObjectContact&
31 ViewContactOfPageObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
33 ViewObjectContact* pRetval = new ViewObjectContactOfPageObj(rObjectContact, *this);
34 return *pRetval;
37 ViewContactOfPageObj::ViewContactOfPageObj(SdrPageObj& rPageObj)
38 : ViewContactOfSdrObj(rPageObj)
42 ViewContactOfPageObj::~ViewContactOfPageObj() {}
44 // #i35972# React on changes of the object of this ViewContact
45 void ViewContactOfPageObj::ActionChanged()
47 static bool bIsInActionChange(false);
49 if (!bIsInActionChange)
51 // set recursion flag, see description in *.hxx
52 bIsInActionChange = true;
54 // call parent
55 ViewContactOfSdrObj::ActionChanged();
57 // reset recursion flag, see description in *.hxx
58 bIsInActionChange = false;
62 void ViewContactOfPageObj::createViewIndependentPrimitive2DSequence(
63 drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
65 // create graphical visualisation data. Since this is the view-independent version which should not be used,
66 // create a replacement graphic visualisation here. Use GetLastBoundRect to access the model data directly
67 // which is aOutRect for SdrPageObj.
68 const tools::Rectangle aModelRectangle(GetPageObj().GetLastBoundRect());
69 const basegfx::B2DRange aModelRange = vcl::unotools::b2DRectangleFromRectangle(aModelRectangle);
70 basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aModelRange));
71 const basegfx::BColor aYellow(1.0, 1.0, 0.0);
72 const drawinglayer::primitive2d::Primitive2DReference xReference(
73 new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(std::move(aOutline), aYellow));
75 rVisitor.visit(xReference);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */