/src/libstaroffice/src/lib/STOFFGraphicShape.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */ |
2 | | |
3 | | /* libstaroffice |
4 | | * Version: MPL 2.0 / LGPLv2+ |
5 | | * |
6 | | * The contents of this file are subject to the Mozilla Public License Version |
7 | | * 2.0 (the "License"); you may not use this file except in compliance with |
8 | | * the License or as specified alternatively below. You may obtain a copy of |
9 | | * the License at http://www.mozilla.org/MPL/ |
10 | | * |
11 | | * Software distributed under the License is distributed on an "AS IS" basis, |
12 | | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
13 | | * for the specific language governing rights and limitations under the |
14 | | * License. |
15 | | * |
16 | | * Major Contributor(s): |
17 | | * Copyright (C) 2002 William Lachance (wrlach@gmail.com) |
18 | | * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net) |
19 | | * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch) |
20 | | * Copyright (C) 2006, 2007 Andrew Ziem |
21 | | * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr) |
22 | | * |
23 | | * |
24 | | * All Rights Reserved. |
25 | | * |
26 | | * For minor contributions see the git repository. |
27 | | * |
28 | | * Alternatively, the contents of this file may be used under the terms of |
29 | | * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), |
30 | | * in which case the provisions of the LGPLv2+ are applicable |
31 | | * instead of those above. |
32 | | */ |
33 | | |
34 | | /* This header contains code specific to a pict mac file |
35 | | */ |
36 | | #include <string.h> |
37 | | |
38 | | #include <cmath> |
39 | | #include <cstring> |
40 | | #include <iomanip> |
41 | | #include <iostream> |
42 | | #include <sstream> |
43 | | #include <string> |
44 | | |
45 | | #include <librevenge/librevenge.h> |
46 | | |
47 | | #include "libstaroffice_internal.hxx" |
48 | | |
49 | | #include "STOFFGraphicStyle.hxx" |
50 | | |
51 | | #include "STOFFGraphicShape.hxx" |
52 | | |
53 | | //////////////////////////////////////////////////////////// |
54 | | // STOFFGraphicShape |
55 | | //////////////////////////////////////////////////////////// |
56 | | STOFFGraphicShape::~STOFFGraphicShape() |
57 | 71.2k | { |
58 | 71.2k | } |
59 | | |
60 | | void STOFFGraphicShape::addTo(librevenge::RVNGPropertyList &pList) const |
61 | 71.1k | { |
62 | 71.1k | if (m_bdbox.size()[0]>0) { |
63 | 34.2k | pList.insert("svg:x",double(m_bdbox[0][0]), librevenge::RVNG_POINT); |
64 | 34.2k | pList.insert("svg:width",double(m_bdbox.size()[0]), librevenge::RVNG_POINT); |
65 | 34.2k | } |
66 | 71.1k | if (m_bdbox.size()[1]>0) { |
67 | 34.2k | pList.insert("svg:y",double(m_bdbox[0][1]), librevenge::RVNG_POINT); |
68 | 34.2k | pList.insert("svg:height",double(m_bdbox.size()[1]), librevenge::RVNG_POINT); |
69 | 34.2k | } |
70 | | |
71 | 71.1k | librevenge::RVNGPropertyList::Iter i(m_propertyList); |
72 | 136k | for (i.rewind(); i.next();) { |
73 | 65.0k | if (i.child()) { |
74 | 34.5k | pList.insert(i.key(), *i.child()); |
75 | 34.5k | continue; |
76 | 34.5k | } |
77 | 30.5k | pList.insert(i.key(), i()->clone()); |
78 | 30.5k | } |
79 | 71.1k | } |
80 | | |
81 | | std::ostream &operator<<(std::ostream &o, STOFFGraphicShape const &sh) |
82 | 0 | { |
83 | 0 | o << "box=" << sh.m_bdbox << ","; |
84 | 0 | switch (sh.m_command) { |
85 | 0 | case STOFFGraphicShape::C_Connector: |
86 | 0 | o << "connector,"; |
87 | 0 | break; |
88 | 0 | case STOFFGraphicShape::C_Ellipse: |
89 | 0 | o << "ellipse,"; |
90 | 0 | break; |
91 | 0 | case STOFFGraphicShape::C_Path: |
92 | 0 | o << "path,"; |
93 | 0 | break; |
94 | 0 | case STOFFGraphicShape::C_Polygon: |
95 | 0 | o << "polygons,"; |
96 | 0 | break; |
97 | 0 | default: |
98 | 0 | case STOFFGraphicShape::C_Polyline: |
99 | 0 | o << "polyline,"; |
100 | 0 | break; |
101 | 0 | case STOFFGraphicShape::C_Rectangle: |
102 | 0 | o << "rect,"; |
103 | 0 | break; |
104 | 0 | case STOFFGraphicShape::C_Unknown: |
105 | 0 | o << "undef,"; |
106 | 0 | break; |
107 | 0 | } |
108 | 0 | o << "[" << sh.m_propertyList.getPropString().cstr() << "],"; |
109 | 0 | o << sh.m_extra; |
110 | 0 | return o; |
111 | 0 | } |
112 | | // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |
113 | | |