3
* Copyright (C) 2006 Murray Cumming
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
21
#include "layoutitem_line.h"
22
#include <glom/libglom/utils.h>
23
#include <glibmm/i18n.h>
28
LayoutItem_Line::LayoutItem_Line()
34
m_translatable_item_type = TRANSLATABLE_TYPE_INVALID; //There is no text in this to translate.
37
LayoutItem_Line::LayoutItem_Line(const LayoutItem_Line& src)
39
m_start_x(src.m_start_x),
40
m_start_y(src.m_start_y),
46
LayoutItem_Line::~LayoutItem_Line()
50
LayoutItem* LayoutItem_Line::clone() const
52
return new LayoutItem_Line(*this);
55
bool LayoutItem_Line::operator==(const LayoutItem_Line& src) const
57
bool result = LayoutItem::operator==(src) &&
58
(m_start_x == src.m_start_x) &&
59
(m_start_y == src.m_start_y) &&
60
(m_end_x == src.m_end_x) &&
61
(m_end_y == src.m_end_y);
66
//Avoid using this, for performance:
67
LayoutItem_Line& LayoutItem_Line::operator=(const LayoutItem_Line& src)
69
LayoutItem::operator=(src);
71
m_start_x = src.m_start_x;
72
m_start_y = src.m_start_y;
73
m_end_x = src.m_end_x;
74
m_end_y = src.m_end_y;
79
Glib::ustring LayoutItem_Line::get_part_type_name() const
81
//Note to translators: This is a straight line, not a database row.
85
Glib::ustring LayoutItem_Line::get_report_part_id() const
87
return "line"; //We reuse this for this node.
90
void LayoutItem_Line::get_coordinates(double& start_x, double& start_y, double& end_x, double& end_y) const
98
void LayoutItem_Line::set_coordinates(double start_x, double start_y, double end_x, double end_y)
105
//Set the x,y,height,width too,
106
//for generic code that deals with that API:
107
set_print_layout_position(m_start_x, m_start_y, (m_end_x - m_start_x), (m_end_y - m_start_y));