| 1 |
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */ |
| 2 |
|
| 3 |
/* libmwaw |
| 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 ([email protected]) |
| 18 |
* Copyright (C) 2002,2004 Marc Maurer ([email protected]) |
| 19 |
* Copyright (C) 2004-2006 Fridrich Strba ([email protected]) |
| 20 |
* Copyright (C) 2006, 2007 Andrew Ziem |
| 21 |
* Copyright (C) 2011, 2012 Alonso Laurent ([email protected]) |
| 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 |
#include <algorithm> |
| 35 |
#include <cmath> |
| 36 |
#include <iomanip> |
| 37 |
#include <iostream> |
| 38 |
#include <limits> |
| 39 |
#include <map> |
| 40 |
#include <sstream> |
| 41 |
#include <stack> |
| 42 |
|
| 43 |
#include <librevenge/librevenge.h> |
| 44 |
|
| 45 |
#include "MWAWFont.hxx" |
| 46 |
#include "MWAWFontConverter.hxx" |
| 47 |
#include "MWAWGraphicShape.hxx" |
| 48 |
#include "MWAWListener.hxx" |
| 49 |
#include "MWAWParagraph.hxx" |
| 50 |
#include "MWAWPosition.hxx" |
| 51 |
#include "MWAWSubDocument.hxx" |
| 52 |
|
| 53 |
#include "WingzParser.hxx" |
| 54 |
|
| 55 |
#include "WingzGraph.hxx" |
| 56 |
|
| 57 |
/** Internal: the structures of a WingzGraph */ |
| 58 |
namespace WingzGraphInternal |
| 59 |
{ |
| 60 |
//! Internal a Graphic of a WingzGraph |
| 61 |
struct Graphic { |
| 62 |
//! the constructor |
| 63 |
Graphic() |
| 64 |
: m_type(-1) |
| 65 |
, m_order(-1) |
| 66 |
, m_position() |
| 67 |
, m_relativePosition() |
| 68 |
, m_style(MWAWGraphicStyle::emptyStyle()) |
| 69 |
, m_vertices() |
| 70 |
, m_children() |
| 71 |
|
| 72 |
, m_textType(-1) |
| 73 |
, m_textEntry() |
| 74 |
, m_fontList() |
| 75 |
, m_posToFontId() |
| 76 |
, m_paragraph() |
| 77 |
|
| 78 |
, m_flag(0) |
| 79 |
{ |
| 80 |
for (auto &angle : m_angles) angle=0; |
| 81 |
} |
| 82 |
//! the file type |
| 83 |
int m_type; |
| 84 |
//! the order |
| 85 |
int m_order; |
| 86 |
//! the cell |
| 87 |
MWAWBox2i m_position; |
| 88 |
//! the relative position (% of cell) |
| 89 |
MWAWBox2f m_relativePosition; |
| 90 |
//! the graphic style |
| 91 |
MWAWGraphicStyle m_style; |
| 92 |
//! the angles: for arc |
| 93 |
float m_angles[2]; |
| 94 |
//! the vertices list: poly (% of box) |
| 95 |
std::vector<MWAWVec2f> m_vertices; |
| 96 |
//! the children: group |
| 97 |
std::vector<std::shared_ptr<Graphic> > m_children; |
| 98 |
//! the data : if picture 0: data, if textbox/button 0:button, 1:title |
| 99 |
MWAWEntry m_entry[2]; |
| 100 |
//! the name/title basic font |
| 101 |
MWAWFont m_font[2]; |
| 102 |
|
| 103 |
// textbox |
| 104 |
//! the textbox type |
| 105 |
int m_textType; |
| 106 |
//! the textbox entry |
| 107 |
MWAWEntry m_textEntry; |
| 108 |
//! list of fonts: textbox |
| 109 |
std::vector<MWAWFont> m_fontList; |
| 110 |
//! map pos to fontId |
| 111 |
std::map<int, size_t> m_posToFontId; |
| 112 |
//! the paragraph: textbox |
| 113 |
MWAWParagraph m_paragraph; |
| 114 |
|
| 115 |
//! some flag (depending of type) |
| 116 |
int m_flag; |
| 117 |
}; |
| 118 |
|
| 119 |
//////////////////////////////////////// |
| 120 |
//! Internal: the state of a WingzGraph |
| 121 |
struct State { |
| 122 |
//! constructor |
| 123 |
State() |
| 124 |
: m_patternList() |
| 125 |
, m_pictureList() |
| 126 |
, m_groupStack() |
| 127 |
, m_inGroupDepth(0) |
| 128 |
{ |
| 129 |
} |
| 130 |
//! init the pattern list |
| 131 |
void initPatterns(int vers); |
| 132 |
//! add a new graphic |
| 133 |
void addGraphic(std::shared_ptr<WingzGraphInternal::Graphic> graphic) |
| 134 |
{ |
| 135 |
if (!m_groupStack.empty() && m_groupStack.top()) |
| 136 |
m_groupStack.top()->m_children.push_back(graphic); |
| 137 |
else |
| 138 |
m_pictureList.push_back(graphic); |
| 139 |
} |
| 140 |
//! the patterns list |
| 141 |
std::vector<MWAWGraphicStyle::Pattern> m_patternList; |
| 142 |
//! the list of picture |
| 143 |
std::vector<std::shared_ptr<Graphic> > m_pictureList; |
| 144 |
//! the group stack |
| 145 |
std::stack<std::shared_ptr<Graphic> > m_groupStack; |
| 146 |
//! the group actual depth |
| 147 |
int m_inGroupDepth; |
| 148 |
}; |
| 149 |
|
| 150 |
void State::initPatterns(int vers) |
| 151 |
{ |
| 152 |
if (!m_patternList.empty()) |
| 153 |
return; |
| 154 |
static uint16_t const patternsWingz[] = { |
| 155 |
0x0,0x0,0x0,0x0/*none*/, 0xffff,0xffff,0xffff,0xffff, 0xfffb,0xffbf,0xfffb,0xffbf, 0xff77,0xffdd,0xff77,0xffdd, |
| 156 |
0x4411,0x4411,0x4411,0x4411, 0xfffb,0xfffb,0xfffb,0xfffb, 0x3333,0x3333,0x3333,0x3333, 0xfcf9,0xf3e7,0xcf9f,0x3f8e, |
| 157 |
0x1111,0x1111,0x1111,0x1111, 0x1881,0xb136,0x0660,0x631b, 0x2004,0x8010,0x0108,0x4002, 0x1010,0x1010,0x1010,0x01ff, |
| 158 |
0x0101,0x01ff,0x1010,0x10ff, |
| 159 |
0x0001,0x0010,0x0001,0x0010, 0x8040,0x2000,0x0001,0x0204, 0x7088,0x0505,0x0588,0x7002, 0xc7ab,0x11ba,0x7cba,0x91eb, |
| 160 |
0x1010,0x3844,0x8283,0x4428, 0x8142,0x2424,0x2424,0x1800, 0x007e,0x7e62,0x6262,0x7e00, 0x0000,0x0000,0x0000,0x0000, |
| 161 |
0x0000,0x0010,0x0000,0x0001, 0x0001,0x0010,0x0001,0x0010, 0x0044,0x0011,0x0044,0x0011, 0x0011,0x0011,0x0011,0x0011, |
| 162 |
0x00ff,0x00ff,0x00ff,0x00ff, |
| 163 |
0x1122,0x4488,0x1122,0x4488, 0x000f,0x000f,0x000f,0x000f, 0x1020,0x4080,0x1020,0x4080, 0x4000,0x40aa,0x4000,0x4000, |
| 164 |
0x4040,0x40ff,0x4040,0x4040, 0x1028,0x4482,0x0102,0x0408, 0x0814,0x2241,0x8800,0xaa00, 0x40a0,0x0000,0x040a,0x0000, |
| 165 |
0x8004,0x040a,0x1221,0xa030, 0xa141,0x221a,0x0808,0x1422, 0x0102,0x0408,0x102a,0x66ff, 0x62e3,0xe3dd,0x263e,0x3edd, |
| 166 |
0x0502,0x0002,0x058a,0x558a |
| 167 |
}; |
| 168 |
static uint16_t const patternsResolve[] = { |
| 169 |
0x0, 0x0, 0x0, 0x0, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0xffff, 0xf7ff, 0xffff, 0x7fff, 0xf7ff, 0x7fff, 0xf7ff, |
| 170 |
0xffee, 0xffbb, 0xffee, 0xffbb, 0x77dd, 0x77dd, 0x77dd, 0x77dd, 0xaa55, 0xaa55, 0xaa55, 0xaa55, 0x8822, 0x8822, 0x8822, 0x8822, |
| 171 |
0xaa00, 0xaa00, 0xaa00, 0xaa00, 0xaa00, 0x4400, 0xaa00, 0x1100, 0x8800, 0xaa00, 0x8800, 0xaa00, 0x8800, 0x2200, 0x8800, 0x2200, |
| 172 |
0x8000, 0x800, 0x8000, 0x800, 0x0, 0x11, 0x0, 0x11, 0x8000, 0x0, 0x800, 0x0, 0x0, 0x0, 0x0, 0x0, |
| 173 |
0xeedd, 0xbb77, 0xeedd, 0xbb77, 0x3366, 0xcc99, 0x3366, 0xcc99, 0x1122, 0x4488, 0x1122, 0x4488, 0x8307, 0xe1c, 0x3870, 0xe0c1, |
| 174 |
0x306, 0xc18, 0x3060, 0xc081, 0x102, 0x408, 0x1020, 0x4080, 0xffff, 0x0, 0x0, 0x0, 0xff00, 0x0, 0x0, 0x0, |
| 175 |
0x77bb, 0xddee, 0x77bb, 0xddee, 0x99cc, 0x6633, 0x99cc, 0x6633, 0x8844, 0x2211, 0x8844, 0x2211, 0xe070, 0x381c, 0xe07, 0x83c1, |
| 176 |
0xc060, 0x3018, 0xc06, 0x381, 0x8040, 0x2010, 0x804, 0x201, 0xc0c0, 0xc0c0, 0xc0c0, 0xc0c0, 0x8080, 0x8080, 0x8080, 0x8080, |
| 177 |
0xffaa, 0xffaa, 0xffaa, 0xffaa, 0xe4e4, 0xe4e4, 0xe4e4, 0xe4e4, 0xffff, 0xff00, 0xff, 0x0, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, |
| 178 |
0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0x0, 0xff00, 0x0, 0x8888, 0x8888, 0x8888, 0x8888, 0xff80, 0x8080, 0x8080, 0x8080, |
| 179 |
0x4ecf, 0xfce4, 0x473f, 0xf372, 0x6006, 0x36b1, 0x8118, 0x1b63, 0x2004, 0x4002, 0x1080, 0x801, 0x9060, 0x609, 0x9060, 0x609, |
| 180 |
0x8814, 0x2241, 0x8800, 0xaa00, 0x2050, 0x8888, 0x8888, 0x502, 0xaa00, 0x8000, 0x8800, 0x8000, 0x2040, 0x8000, 0x804, 0x200, |
| 181 |
0xf0f0, 0xf0f0, 0xf0f, 0xf0f, 0x77, 0x7777, 0x77, 0x7777, 0xff88, 0x8888, 0xff88, 0x8888, 0xaa44, 0xaa11, 0xaa44, 0xaa11, |
| 182 |
0x8244, 0x2810, 0x2844, 0x8201, 0x8080, 0x413e, 0x808, 0x14e3, 0x8142, 0x2418, 0x1020, 0x4080, 0x40a0, 0x0, 0x40a, 0x0, |
| 183 |
0x7789, 0x8f8f, 0x7798, 0xf8f8, 0xf1f8, 0x6cc6, 0x8f1f, 0x3663, 0xbf00, 0xbfbf, 0xb0b0, 0xb0b0, 0xff80, 0x8080, 0xff08, 0x808, |
| 184 |
0x1020, 0x54aa, 0xff02, 0x408, 0x8, 0x142a, 0x552a, 0x1408, 0x55a0, 0x4040, 0x550a, 0x404, 0x8244, 0x3944, 0x8201, 0x101 |
| 185 |
}; |
| 186 |
MWAWGraphicStyle::Pattern pat; |
| 187 |
pat.m_dim=MWAWVec2i(8,8); |
| 188 |
pat.m_data.resize(8); |
| 189 |
pat.m_colors[0]=MWAWColor::white(); |
| 190 |
pat.m_colors[1]=MWAWColor::black(); |
| 191 |
uint16_t const *patPtr=vers==2 ? patternsWingz : patternsResolve; |
| 192 |
for (int i=0; i<(vers==2 ? 39 : 64); ++i) { |
| 193 |
for (size_t j=0; j<8; j+=2, ++patPtr) { |
| 194 |
pat.m_data[j]=uint8_t((*patPtr)>>8); |
| 195 |
pat.m_data[j+1]=uint8_t((*patPtr)&0xFF); |
| 196 |
} |
| 197 |
m_patternList.push_back(pat); |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
//////////////////////////////////////// |
| 202 |
//! Internal: the subdocument of a WingzGraph |
| 203 |
class SubDocument final : public MWAWSubDocument |
| 204 |
{ |
| 205 |
public: |
| 206 |
SubDocument(WingzGraph &pars, MWAWInputStreamPtr const &input, Graphic const &graph) |
| 207 |
: MWAWSubDocument(pars.m_mainParser, input, MWAWEntry()) |
| 208 |
, m_graphParser(pars) |
| 209 |
, m_graphic(graph) |
| 210 |
{ |
| 211 |
} |
| 212 |
|
| 213 |
//! destructor |
| 214 |
~SubDocument() final {} |
| 215 |
|
| 216 |
//! operator!= |
| 217 |
bool operator!=(MWAWSubDocument const &doc) const final; |
| 218 |
|
| 219 |
//! the parser function |
| 220 |
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type) final; |
| 221 |
|
| 222 |
protected: |
| 223 |
/** the graph parser */ |
| 224 |
WingzGraph &m_graphParser; |
| 225 |
/** the graphic */ |
| 226 |
Graphic const &m_graphic; |
| 227 |
private: |
| 228 |
SubDocument(SubDocument const &orig) = delete; |
| 229 |
SubDocument &operator=(SubDocument const &orig) = delete; |
| 230 |
}; |
| 231 |
|
| 232 |
void SubDocument::parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType /*type*/) |
| 233 |
{ |
| 234 |
if (!listener.get()) { |
| 235 |
MWAW_DEBUG_MSG(("WingzGraphInternal::SubDocument::parse: no listener\n")); |
| 236 |
return; |
| 237 |
} |
| 238 |
long pos = m_input->tell(); |
| 239 |
m_graphParser.sendText(m_graphic); |
| 240 |
m_input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 241 |
} |
| 242 |
|
| 243 |
bool SubDocument::operator!=(MWAWSubDocument const &doc) const |
| 244 |
{ |
| 245 |
if (MWAWSubDocument::operator!=(doc)) return true; |
| 246 |
auto const *sDoc = dynamic_cast<SubDocument const *>(&doc); |
| 247 |
if (!sDoc) return true; |
| 248 |
if (&m_graphParser != &sDoc->m_graphParser) return true; |
| 249 |
if (&m_graphic != &sDoc->m_graphic) return true; |
| 250 |
return false; |
| 251 |
} |
| 252 |
} |
| 253 |
|
| 254 |
//////////////////////////////////////////////////////////// |
| 255 |
// constructor/destructor, ... |
| 256 |
//////////////////////////////////////////////////////////// |
| 257 |
WingzGraph::WingzGraph(WingzParser &parser) |
| 258 |
: m_parserState(parser.getParserState()) |
| 259 |
, m_state(new WingzGraphInternal::State) |
| 260 |
, m_mainParser(&parser) |
| 261 |
{ |
| 262 |
} |
| 263 |
|
| 264 |
WingzGraph::~WingzGraph() |
| 265 |
{ } |
| 266 |
|
| 267 |
int WingzGraph::version() const |
| 268 |
{ |
| 269 |
return m_parserState->m_version; |
| 270 |
} |
| 271 |
|
| 272 |
//////////////////////////////////////////////////////////// |
| 273 |
// |
| 274 |
// Intermediate level |
| 275 |
// |
| 276 |
//////////////////////////////////////////////////////////// |
| 277 |
|
| 278 |
//////////////////////////////////////////////////////////// |
| 279 |
// read a graphic zone |
| 280 |
//////////////////////////////////////////////////////////// |
| 281 |
bool WingzGraph::readGraphic() |
| 282 |
{ |
| 283 |
auto input = m_parserState->m_input; |
| 284 |
auto &ascFile = m_parserState->m_asciiFile; |
| 285 |
long pos = input->tell(); |
| 286 |
if (!input->checkPosition(pos+60)) { |
| 287 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: the header seems bad\n")); |
| 288 |
return false; |
| 289 |
} |
| 290 |
auto graphic=std::make_shared<WingzGraphInternal::Graphic>(); |
| 291 |
auto type=static_cast<int>(input->readULong(1)); |
| 292 |
if (type!=0xe) return false; |
| 293 |
auto fl=static_cast<int>(input->readULong(1)); |
| 294 |
auto dSz=static_cast<int>(input->readULong(2)); |
| 295 |
int id= (fl==0) ? 0 : static_cast<int>(input->readULong(2)); |
| 296 |
libmwaw::DebugStream f; |
| 297 |
f << "Entries(Graphic):"; |
| 298 |
if (fl!=0x80) f << "fl=" << std::hex << fl << std::dec << ","; |
| 299 |
if (id) f << "id=" << id << ","; |
| 300 |
long actPos=input->tell(); |
| 301 |
auto nSz=static_cast<int>(input->readULong(1)); |
| 302 |
if (nSz>15) { |
| 303 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: the graphic title seems bad\n")); |
| 304 |
f << "#nSz=" << nSz << ","; |
| 305 |
} |
| 306 |
else if (nSz) { |
| 307 |
std::string name(""); |
| 308 |
for (int i=0; i<nSz; ++i) name+=char(input->readULong(1)); |
| 309 |
f << name << ","; |
| 310 |
} |
| 311 |
input->seek(actPos+16, librevenge::RVNG_SEEK_SET); |
| 312 |
graphic->m_order=static_cast<int>(input->readULong(2)); |
| 313 |
f << "order=" << graphic->m_order << ","; |
| 314 |
auto val=static_cast<int>(input->readULong(2)); // always 0 |
| 315 |
if (val) f << "f1=" << val << ","; |
| 316 |
// the position seem to be stored as cell + % of the cell width... |
| 317 |
float decal[4]; |
| 318 |
for (auto &d : decal) d=static_cast<float>(input->readULong(1))/255.f; |
| 319 |
graphic->m_relativePosition=MWAWBox2f(MWAWVec2f(decal[2],decal[0]),MWAWVec2f(decal[3],decal[1])); |
| 320 |
int dim[4]; // the cells which included the picture |
| 321 |
for (auto &d : dim) d=static_cast<int>(input->readULong(2)); |
| 322 |
graphic->m_position=MWAWBox2i(MWAWVec2i(dim[0],dim[1]),MWAWVec2i(dim[2],dim[3])); |
| 323 |
f << "dim=" << dim[0] << ":" << decal[2] << "x" |
| 324 |
<< dim[1] << ":" << decal[0] << "<->" |
| 325 |
<< dim[2] << ":" << decal[3] << "x" |
| 326 |
<< dim[3] << ":" << decal[1] << ","; |
| 327 |
type=graphic->m_type=static_cast<int>(input->readULong(2)); |
| 328 |
val=static_cast<int>(input->readULong(2)); // always 0 |
| 329 |
if (val) f << "f2=" << val << ","; |
| 330 |
|
| 331 |
long endPos=pos+(version()==1 ? 4 : 8)+dSz; |
| 332 |
long dataPos=input->tell(); |
| 333 |
if (type==0 || type==2) { |
| 334 |
for (int i=0; i<2; ++i) { // name, title |
| 335 |
auto sSz=static_cast<int>(input->readULong(1)); |
| 336 |
if (!input->checkPosition(input->tell()+sSz+1)) { |
| 337 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: can not find the textbox name%d\n", i)); |
| 338 |
return false; |
| 339 |
} |
| 340 |
if (!sSz) |
| 341 |
continue; |
| 342 |
graphic->m_entry[i].setBegin(input->tell()); |
| 343 |
graphic->m_entry[i].setLength(sSz); |
| 344 |
std::string name(""); |
| 345 |
for (int c=0; c<sSz; ++c) name+=char(input->readULong(1)); |
| 346 |
f << name << ","; |
| 347 |
} |
| 348 |
auto hasMacro=static_cast<int>(input->readLong(1)); |
| 349 |
if (hasMacro==1) { |
| 350 |
f << "macro,"; |
| 351 |
if (!m_mainParser->readMacro()) return false; |
| 352 |
} |
| 353 |
else if (hasMacro) { |
| 354 |
f << "###macro=" << hasMacro << ","; |
| 355 |
ascFile.addPos(pos); |
| 356 |
ascFile.addNote(f.str().c_str()); |
| 357 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: can not find the textbox type\n")); |
| 358 |
return false; |
| 359 |
} |
| 360 |
} |
| 361 |
if (type==0 || type==2 || (type>=5 && type<=9)) { |
| 362 |
bool canHaveShadow=true; |
| 363 |
if (type>=5 && type<=9) { |
| 364 |
static int const expectedSize[]= {0x38, 0x3c, 0x34, 0x40, 0x40 }; |
| 365 |
if (!input->checkPosition(endPos) || dSz < expectedSize[type-5]) { |
| 366 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: find bad size for shape\n")); |
| 367 |
return false; |
| 368 |
} |
| 369 |
canHaveShadow=type==8; |
| 370 |
} |
| 371 |
else if (!input->checkPosition(input->tell()+30)) { |
| 372 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: find bad size for text/button\n")); |
| 373 |
return false; |
| 374 |
} |
| 375 |
int patId; |
| 376 |
MWAWColor color; |
| 377 |
MWAWGraphicStyle::Pattern pattern; |
| 378 |
readPattern(pattern, patId); |
| 379 |
if (patId) { |
| 380 |
if (pattern.getUniqueColor(color)) { |
| 381 |
graphic->m_style.setSurfaceColor(color); |
| 382 |
if (!color.isWhite()) |
| 383 |
f << "surf[col]=" << color << ","; |
| 384 |
} |
| 385 |
else { |
| 386 |
f << "surf=" << pattern << ","; |
| 387 |
graphic->m_style.setPattern(pattern); |
| 388 |
} |
| 389 |
} |
| 390 |
else |
| 391 |
f << "surf[col]=none,"; |
| 392 |
val=int(input->readLong(1)); |
| 393 |
if (val!=1) f << "f0=" << val << ","; |
| 394 |
if (canHaveShadow) { |
| 395 |
graphic->m_flag=val; |
| 396 |
readColor(color, patId); |
| 397 |
if (patId) { |
| 398 |
if (graphic->m_flag&2) |
| 399 |
graphic->m_style.setShadowColor(color); |
| 400 |
f << "shadow[col]=" << color << ","; |
| 401 |
} |
| 402 |
val=int(input->readLong(1)); |
| 403 |
if (val) f << "f1=" << val << ","; |
| 404 |
} |
| 405 |
readColor(color, patId); |
| 406 |
bool hasLine=true; |
| 407 |
if (patId && !color.isBlack()) { |
| 408 |
f << "line[col]=" << color << ","; |
| 409 |
graphic->m_style.m_lineColor=color; |
| 410 |
} |
| 411 |
else if (!patId) { |
| 412 |
hasLine=false; |
| 413 |
f << "line[col]=none,"; |
| 414 |
} |
| 415 |
val=int(input->readLong(1)); |
| 416 |
if (val!=1) f << "f2=" << val << ","; |
| 417 |
|
| 418 |
val=static_cast<int>(input->readLong(2)); |
| 419 |
if (hasLine) graphic->m_style.m_lineWidth=float(val)/20.f; |
| 420 |
if (val!=5) f << "line[w]=" << float(val)/20.f << ","; |
| 421 |
if (canHaveShadow) { |
| 422 |
for (int i=0; i<2; ++i) dim[i]=int(input->readLong(2)); |
| 423 |
if (dim[0]!=20 || dim[1]!=20) { |
| 424 |
graphic->m_style.m_shadowOffset=MWAWVec2f(float(dim[0])/20.f,float(dim[1])/20.f); |
| 425 |
f << "shadow[pos]=" << graphic->m_style.m_shadowOffset << ","; |
| 426 |
} |
| 427 |
} |
| 428 |
} |
| 429 |
switch (type) { |
| 430 |
case 0: // button |
| 431 |
case 2: { // textbox |
| 432 |
f << "TextZone,g0=" << std::hex << dSz << std::dec << ","; |
| 433 |
ascFile.addPos(pos); |
| 434 |
ascFile.addNote(f.str().c_str()); |
| 435 |
return readTextZone(graphic); |
| 436 |
} |
| 437 |
case 4: |
| 438 |
f << "Chart,"; |
| 439 |
ascFile.addPos(pos); |
| 440 |
ascFile.addNote(f.str().c_str()); |
| 441 |
return readChartData(graphic); |
| 442 |
case 5: |
| 443 |
case 6: |
| 444 |
case 7: |
| 445 |
case 8: |
| 446 |
case 9: { |
| 447 |
static int const expectedSize[]= {0x38, 0x3c, 0x34, 0x40, 0x40 }; |
| 448 |
if (!input->checkPosition(endPos) || dSz < expectedSize[type-5]) { |
| 449 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: find bad size for shape\n")); |
| 450 |
return false; |
| 451 |
} |
| 452 |
static char const *what[]= {"line", "arc", "circle", "rectangle", "poly" }; |
| 453 |
f << what[type-5] << ","; |
| 454 |
switch (type) { |
| 455 |
case 5: { |
| 456 |
int arrowWidth=static_cast<int>(input->readLong(2)); |
| 457 |
if (arrowWidth!=0x21c) f << "arrow[size]=" << double(arrowWidth)/20. << ","; // default 27 point |
| 458 |
val=static_cast<int>(input->readULong(2)); |
| 459 |
if (val&0x40) { |
| 460 |
f << "start[arrow],"; |
| 461 |
graphic->m_style.m_arrows[0]= |
| 462 |
MWAWGraphicStyle::Arrow(float(arrowWidth)/20.f, MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(3000,3000)), |
| 463 |
"M1500 0l1500 3000h-3000zM1500 447l-1176 2353h2353z", false); |
| 464 |
} |
| 465 |
if (val&0x80) { |
| 466 |
f << "start[end],"; |
| 467 |
graphic->m_style.m_arrows[1]= |
| 468 |
MWAWGraphicStyle::Arrow(float(arrowWidth)/20.f, MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(3000,3000)), |
| 469 |
"M1500 0l1500 3000h-3000zM1500 447l-1176 2353h2353z", false); |
| 470 |
} |
| 471 |
graphic->m_flag=(val&3); |
| 472 |
if (graphic->m_flag&3) f << "rot=" << (graphic->m_flag&3) << ","; |
| 473 |
val &= 0xff3c; |
| 474 |
if (val) f << "fl=" << std::hex << val << std::dec << ","; |
| 475 |
break; |
| 476 |
} |
| 477 |
case 6: { |
| 478 |
for (int i=0; i<2; ++i) { // 0|3fff |
| 479 |
val=int(input->readULong(2)); |
| 480 |
if (!val) continue; |
| 481 |
if (val==0x3fff) |
| 482 |
f << "h" << i << "*,"; |
| 483 |
else |
| 484 |
f << "h" << i << "=" << val << ","; |
| 485 |
} |
| 486 |
for (auto &angle : graphic->m_angles) angle=float(input->readLong(2))/10.f; |
| 487 |
f << "angles=" << MWAWVec2f(graphic->m_angles[0],graphic->m_angles[1]) << ","; |
| 488 |
break; |
| 489 |
} |
| 490 |
case 7: |
| 491 |
break; |
| 492 |
case 8: { |
| 493 |
break; |
| 494 |
} |
| 495 |
case 9: { |
| 496 |
val=static_cast<int>(input->readULong(2)); |
| 497 |
if (val&1) f << "closed,"; |
| 498 |
if (val&2) f << "smooth,"; |
| 499 |
graphic->m_flag=val; |
| 500 |
int arrowWidth=static_cast<int>(input->readLong(2)); |
| 501 |
if (arrowWidth!=0x21c) f << "arrow[size]=" << double(arrowWidth)/20. << ","; // default 27 point |
| 502 |
if (val&0x40) { |
| 503 |
f << "start[arrow],"; |
| 504 |
graphic->m_style.m_arrows[0]= |
| 505 |
MWAWGraphicStyle::Arrow(float(arrowWidth)/20.f, MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(3000,3000)), |
| 506 |
"M1500 0l1500 3000h-3000zM1500 447l-1176 2353h2353z", false); |
| 507 |
} |
| 508 |
if (val&0x80) { |
| 509 |
f << "start[end],"; |
| 510 |
graphic->m_style.m_arrows[0]= |
| 511 |
MWAWGraphicStyle::Arrow(float(arrowWidth)/20.f, MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(3000,3000)), |
| 512 |
"M1500 0l1500 3000h-3000zM1500 447l-1176 2353h2353z", false); |
| 513 |
} |
| 514 |
val &= 0xff3c; |
| 515 |
if (val) f << "h0=" << val << ","; |
| 516 |
int nbPt=int(input->readULong(2)); |
| 517 |
f << "nbPt=" << nbPt << ","; |
| 518 |
if (input->tell()+nbPt*4>endPos) { |
| 519 |
f << "###"; |
| 520 |
break; |
| 521 |
} |
| 522 |
f << "pts=["; |
| 523 |
for (int i=0; i<nbPt; ++i) { |
| 524 |
float pts[2]; |
| 525 |
for (auto &pt : pts) pt=float(input->readULong(2))/float(0x3fff); |
| 526 |
graphic->m_vertices.push_back(MWAWVec2f(pts[0],pts[1])); |
| 527 |
f << graphic->m_vertices.back() << ","; |
| 528 |
} |
| 529 |
f << "],"; |
| 530 |
break; |
| 531 |
} |
| 532 |
default: |
| 533 |
break; |
| 534 |
} |
| 535 |
break; |
| 536 |
} |
| 537 |
case 0xa: { |
| 538 |
if (!input->checkPosition(endPos)) { |
| 539 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: find bad size for picture\n")); |
| 540 |
return false; |
| 541 |
} |
| 542 |
f << "picture,"; |
| 543 |
auto pSz=long(input->readULong(2)); |
| 544 |
for (int i=0; i<2; ++i) { // g0=0, g1=2 |
| 545 |
val=static_cast<int>(input->readULong(2)); |
| 546 |
if (val) f << "g" << i << "=" << val << ","; |
| 547 |
} |
| 548 |
ascFile.addPos(pos); |
| 549 |
ascFile.addNote(f.str().c_str()); |
| 550 |
if (!pSz || !input->checkPosition(dataPos+6+pSz)) { |
| 551 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: can not find the picture data\n")); |
| 552 |
return false; |
| 553 |
} |
| 554 |
graphic->m_entry[0].setBegin(dataPos+6); |
| 555 |
graphic->m_entry[0].setLength(pSz); |
| 556 |
#ifdef DEBUG_WITH_FILES |
| 557 |
ascFile.skipZone(dataPos+6, dataPos+6+pSz-1); |
| 558 |
librevenge::RVNGBinaryData file; |
| 559 |
input->seek(dataPos+6, librevenge::RVNG_SEEK_SET); |
| 560 |
input->readDataBlock(pSz, file); |
| 561 |
static int volatile pictName = 0; |
| 562 |
libmwaw::DebugStream f2; |
| 563 |
f2.str(""); |
| 564 |
f2 << "PICT-" << ++pictName; |
| 565 |
libmwaw::Debug::dumpFile(file, f2.str().c_str()); |
| 566 |
#endif |
| 567 |
input->seek(dataPos+6+pSz, librevenge::RVNG_SEEK_SET); |
| 568 |
break; |
| 569 |
} |
| 570 |
case 0xb: { |
| 571 |
if (!input->checkPosition(endPos)) { |
| 572 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: find bad size for group\n")); |
| 573 |
return false; |
| 574 |
} |
| 575 |
f << "group,"; |
| 576 |
break; |
| 577 |
} |
| 578 |
default: |
| 579 |
MWAW_DEBUG_MSG(("WingzGraph::readGraphic: find some unknown type %d\n", type)); |
| 580 |
f << "#typ=" << type << ","; |
| 581 |
ascFile.addPos(pos); |
| 582 |
ascFile.addNote(f.str().c_str()); |
| 583 |
return false; |
| 584 |
} |
| 585 |
m_state->addGraphic(graphic); |
| 586 |
if (graphic->m_type==0xb) |
| 587 |
m_state->m_groupStack.push(graphic); |
| 588 |
if (input->tell()!=pos && input->tell()!=endPos) |
| 589 |
ascFile.addDelimiter(input->tell(),'|'); |
| 590 |
ascFile.addPos(pos); |
| 591 |
ascFile.addNote(f.str().c_str()); |
| 592 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 593 |
return true; |
| 594 |
} |
| 595 |
|
| 596 |
bool WingzGraph::readEndGroup() |
| 597 |
{ |
| 598 |
auto input = m_parserState->m_input; |
| 599 |
auto &ascFile = m_parserState->m_asciiFile; |
| 600 |
long pos = input->tell(); |
| 601 |
if (!input->checkPosition(pos+4)) { |
| 602 |
MWAW_DEBUG_MSG(("WingzGraph::readEndGroup: the header seems bad\n")); |
| 603 |
return false; |
| 604 |
} |
| 605 |
auto type=static_cast<int>(input->readULong(1)); |
| 606 |
if (type!=0xf) return false; |
| 607 |
auto fl=static_cast<int>(input->readULong(1)); |
| 608 |
auto dSz=static_cast<int>(input->readULong(2)); |
| 609 |
int id= (fl==0) ? 0 : static_cast<int>(input->readULong(2)); |
| 610 |
libmwaw::DebugStream f; |
| 611 |
f << "Entries(Group)[end]:"; |
| 612 |
if (fl!=0x80) f << "fl=" << std::hex << fl << std::dec << ","; |
| 613 |
if (id) f << "id=" << id << ","; |
| 614 |
if (!input->checkPosition(input->tell()+dSz)) { |
| 615 |
MWAW_DEBUG_MSG(("WingzGraph::readEndGroup: the header seems bad\n")); |
| 616 |
return false; |
| 617 |
} |
| 618 |
if (dSz) { |
| 619 |
ascFile.addDelimiter(input->tell(),'|'); |
| 620 |
input->seek(dSz, librevenge::RVNG_SEEK_CUR); |
| 621 |
} |
| 622 |
ascFile.addPos(pos); |
| 623 |
ascFile.addNote(f.str().c_str()); |
| 624 |
if (m_state->m_groupStack.empty()) { |
| 625 |
MWAW_DEBUG_MSG(("WingzGraph::readEndGroup: can not found the group beginning\n")); |
| 626 |
} |
| 627 |
else |
| 628 |
m_state->m_groupStack.pop(); |
| 629 |
return true; |
| 630 |
} |
| 631 |
|
| 632 |
//////////////////////////////////////////////////////////// |
| 633 |
// text box |
| 634 |
//////////////////////////////////////////////////////////// |
| 635 |
bool WingzGraph::readTextZone(std::shared_ptr<WingzGraphInternal::Graphic> graphic) |
| 636 |
{ |
| 637 |
auto input = m_parserState->m_input; |
| 638 |
auto &ascFile = m_parserState->m_asciiFile; |
| 639 |
long pos = input->tell(); |
| 640 |
if (!input->checkPosition(pos+18)) { |
| 641 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: the zone seems too short\n")); |
| 642 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 643 |
return false; |
| 644 |
} |
| 645 |
|
| 646 |
libmwaw::DebugStream f; |
| 647 |
f << "Entries(TextZone):"; |
| 648 |
int patId; |
| 649 |
MWAWColor color; |
| 650 |
readColor(color, patId); |
| 651 |
if (patId) |
| 652 |
f << "col[unkn]=" << color << ","; |
| 653 |
int val=int(input->readULong(1)); |
| 654 |
if (val!=1) f << "f0=" << val << ","; |
| 655 |
auto fontConverter=m_parserState->m_fontConverter; |
| 656 |
for (int i=0; i<2; ++i) { // actual font and generic font ? |
| 657 |
MWAWFont font; |
| 658 |
f << "font" << i << "=["; |
| 659 |
unsigned char colors[3]; |
| 660 |
for (auto &c : colors) c=static_cast<unsigned char>(input->readULong(1)); |
| 661 |
font.setColor(MWAWColor(colors[0],colors[1],colors[2])); |
| 662 |
val=int(input->readLong(1)); // 0 |
| 663 |
if (val) f << "f0=" << val << ","; |
| 664 |
font.setSize(float(input->readULong(1))); |
| 665 |
auto flag=static_cast<int>(input->readULong(1)); |
| 666 |
uint32_t flags=0; |
| 667 |
if (flag&0x1) flags |= MWAWFont::boldBit; |
| 668 |
if (flag&0x2) flags |= MWAWFont::italicBit; |
| 669 |
if (flag&0x4) font.setUnderlineStyle(MWAWFont::Line::Simple); |
| 670 |
if (flag&0x8) flags |= MWAWFont::embossBit; |
| 671 |
if (flag&0x10) flags |= MWAWFont::shadowBit; |
| 672 |
if (flag&0x60) |
| 673 |
f << "#font[flag]=" << std::hex << (flag&0x60) << std::dec << ","; |
| 674 |
font.setFlags(flags); |
| 675 |
auto sSz=static_cast<int>(input->readULong(1)); |
| 676 |
if (!sSz || !input->checkPosition(input->tell()+4+sSz)) { |
| 677 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: can not determine the string zone %d\n", i)); |
| 678 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 679 |
return false; |
| 680 |
} |
| 681 |
std::string name(""); |
| 682 |
for (int j=0; j<sSz; ++j) |
| 683 |
name+=char(input->readLong(1)); |
| 684 |
font.setId(fontConverter->getId(name)); |
| 685 |
f << font.getDebugString(fontConverter); |
| 686 |
f << "],"; |
| 687 |
graphic->m_font[i]=font; |
| 688 |
} |
| 689 |
for (int i=0; i<3; ++i) { |
| 690 |
val=static_cast<int>(input->readLong(2)); |
| 691 |
if (val) f << "g" << i << "=" << val; |
| 692 |
} |
| 693 |
ascFile.addPos(pos); |
| 694 |
ascFile.addNote(f.str().c_str()); |
| 695 |
|
| 696 |
pos=input->tell(); |
| 697 |
f.str(""); |
| 698 |
f << "TextZone-A:"; |
| 699 |
graphic->m_textType=static_cast<int>(input->readLong(1)); |
| 700 |
m_state->addGraphic(graphic); |
| 701 |
bool ok=true; |
| 702 |
switch (graphic->m_textType) { |
| 703 |
case 0: |
| 704 |
f << "button,"; |
| 705 |
val=static_cast<int>(input->readLong(1)); |
| 706 |
if (val!=3) f << "f0=" << val << ","; |
| 707 |
val=static_cast<int>(input->readLong(1)); |
| 708 |
if (val==0) f << "noContent,"; |
| 709 |
else if (val!=1) f << "#content=" << val << ","; |
| 710 |
val=static_cast<int>(input->readLong(1)); |
| 711 |
if (val==1) f << "title,"; |
| 712 |
else if (val) f << "#title=" << val << ","; |
| 713 |
val=static_cast<int>(input->readULong(1)); |
| 714 |
if (val) f << "h[content]=" << val << ","; |
| 715 |
val=static_cast<int>(input->readULong(1)); |
| 716 |
if (val) f << "h[title]=" << val << ","; |
| 717 |
ascFile.addPos(pos); |
| 718 |
ascFile.addNote(f.str().c_str()); |
| 719 |
return true; |
| 720 |
case 1: |
| 721 |
ok=input->checkPosition(pos+60); |
| 722 |
if (!ok) break; |
| 723 |
f << "text,"; |
| 724 |
break; |
| 725 |
case 5: { |
| 726 |
ok=input->checkPosition(pos+53); |
| 727 |
if (!ok) break; |
| 728 |
f << "wheel,"; |
| 729 |
for (int i=0; i<5; ++i) { |
| 730 |
val=int(input->readLong(1)); |
| 731 |
int const expected[]= {3,0,0,0,0}; |
| 732 |
if (val!=expected[i]) f << "f" << i << "=" << val << ","; |
| 733 |
} |
| 734 |
bool isNan; |
| 735 |
double value; |
| 736 |
f << "val=["; |
| 737 |
for (int i=0; i<5; ++i) { // val, minVal, maxVal, incr?, maxVal-minVal? |
| 738 |
if (!input->readDoubleReverted8(value,isNan)) { |
| 739 |
f << "###,"; |
| 740 |
input->seek(pos+6+8*(i+1), librevenge::RVNG_SEEK_SET); |
| 741 |
} |
| 742 |
else |
| 743 |
f << value << ","; |
| 744 |
} |
| 745 |
f << "],"; |
| 746 |
for (int i=0; i<3; ++i) { // small number |
| 747 |
val=int(input->readLong(2)); |
| 748 |
if (val) f << "g" << i << "=" << val << ","; |
| 749 |
} |
| 750 |
ascFile.addDelimiter(input->tell(),'|'); |
| 751 |
input->seek(pos+53, librevenge::RVNG_SEEK_SET); |
| 752 |
break; |
| 753 |
} |
| 754 |
case 6: { |
| 755 |
ok=input->checkPosition(pos+40); |
| 756 |
if (!ok) break; |
| 757 |
f << "button[wheel],"; |
| 758 |
for (int i=0; i<5; ++i) { |
| 759 |
val=int(input->readLong(1)); |
| 760 |
int const expected[]= {3,0,0,0,0}; |
| 761 |
if (val!=expected[i]) f << "f" << i << "=" << val << ","; |
| 762 |
} |
| 763 |
bool isNan; |
| 764 |
double value; |
| 765 |
f << "val=["; |
| 766 |
for (int i=0; i<4; ++i) { // val?, min, max, increment? |
| 767 |
if (!input->readDoubleReverted8(value,isNan)) { |
| 768 |
f << "###,"; |
| 769 |
input->seek(pos+6+8*(i+1), librevenge::RVNG_SEEK_SET); |
| 770 |
} |
| 771 |
else |
| 772 |
f << value << ","; |
| 773 |
} |
| 774 |
f << "],"; |
| 775 |
val=int(input->readLong(2)); // 0 |
| 776 |
if (val) f << "f5=" << val << ","; |
| 777 |
input->seek(pos+40, librevenge::RVNG_SEEK_SET); |
| 778 |
break; |
| 779 |
} |
| 780 |
default: |
| 781 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: find unknown type %d\n", graphic->m_textType)); |
| 782 |
f << "###type=" << graphic->m_textType; |
| 783 |
ok=false; |
| 784 |
break; |
| 785 |
} |
| 786 |
|
| 787 |
if (!ok || graphic->m_textType!=1) { |
| 788 |
ascFile.addPos(pos); |
| 789 |
ascFile.addNote(f.str().c_str()); |
| 790 |
if (ok) return true; |
| 791 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 792 |
return m_mainParser->findNextZone(0xe) && input->tell()>pos; |
| 793 |
} |
| 794 |
val=static_cast<int>(input->readLong(1)); |
| 795 |
if (val!=3) f<<"f0=" << val << ","; |
| 796 |
auto ¶=graphic->m_paragraph; |
| 797 |
for (int i=0; i<5; ++i) { |
| 798 |
val=static_cast<int>(input->readULong(2)); |
| 799 |
if (i==2 && (val>>12)) { // 1 left, 2 center, 3 right |
| 800 |
switch ((val>>12)&3) { |
| 801 |
case 0: |
| 802 |
default: |
| 803 |
f << "#align=0,"; |
| 804 |
break; |
| 805 |
case 1: // left |
| 806 |
break; |
| 807 |
case 2: |
| 808 |
para.m_justify = MWAWParagraph::JustificationCenter; |
| 809 |
f << "center,"; |
| 810 |
break; |
| 811 |
case 3: |
| 812 |
para.m_justify = MWAWParagraph::JustificationRight; |
| 813 |
f << "right,"; |
| 814 |
break; |
| 815 |
} |
| 816 |
val &= 0xCFFF; |
| 817 |
} |
| 818 |
if (val) f<<"f" << i+1 << "=" << std::hex << val << std::dec << ","; |
| 819 |
} |
| 820 |
val=static_cast<int>(input->readULong(4)); |
| 821 |
auto textSize=static_cast<int>(input->readLong(4)); |
| 822 |
if (val!=textSize) |
| 823 |
f << "selection="<<val << ","; |
| 824 |
val=static_cast<int>(input->readLong(2)); // 1|7 |
| 825 |
if (val!=1) f << "g0=" << val << ","; |
| 826 |
val=static_cast<int>(input->readLong(2)); |
| 827 |
if (val) f << "g1=" << val << ","; |
| 828 |
for (int i=0; i< 2; ++i) { // g2=0|1, g3=4|6, g3=64 -> scroll bar, g3&1 -> cell note? |
| 829 |
val=static_cast<int>(input->readULong(1)); |
| 830 |
static int const expected[]= {0,0x40}; |
| 831 |
if (val!=expected[i]) |
| 832 |
f << "g" << i+2 << "=" << std::hex << val << std::dec << ","; |
| 833 |
} |
| 834 |
auto numFonts=static_cast<int>(input->readLong(2)); |
| 835 |
if (numFonts!=1) f << "numFonts=" << numFonts << ","; |
| 836 |
val=static_cast<int>(input->readLong(2)); |
| 837 |
if (val) f << "h0=" << val << ","; |
| 838 |
auto numPos=static_cast<int>(input->readULong(2)); |
| 839 |
if (numPos!=1) f << "numPos=" << numPos << ","; |
| 840 |
for (int i=0; i<14; ++i) { |
| 841 |
val=static_cast<int>(input->readLong(2)); |
| 842 |
if (!val) continue; |
| 843 |
if (i==3) f << "marg[top]=" << double(val)/20. << ","; |
| 844 |
else if (i==4) f << "marg[bottom]=" << double(val)/20. << ","; |
| 845 |
else if (i==7) f << "tabs[repeat]=" << double(val)/20. << ","; |
| 846 |
else |
| 847 |
f << "h" << i+1 << "=" << val << ","; |
| 848 |
} |
| 849 |
ascFile.addPos(pos); |
| 850 |
ascFile.addNote(f.str().c_str()); |
| 851 |
|
| 852 |
pos=input->tell(); |
| 853 |
if (textSize<0 || (long)((unsigned long)pos+(unsigned long)textSize)<pos || !input->checkPosition(pos+textSize)) { |
| 854 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: the text zone seems bad\n")); |
| 855 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 856 |
return false; |
| 857 |
} |
| 858 |
f.str(""); |
| 859 |
f << "TextZone[text]:"; |
| 860 |
graphic->m_textEntry.setBegin(input->tell()); |
| 861 |
graphic->m_textEntry.setLength(textSize); |
| 862 |
std::string text(""); |
| 863 |
for (int i=0; i< textSize; ++i) text+=char(input->readULong(1)); |
| 864 |
f << text; |
| 865 |
ascFile.addPos(pos); |
| 866 |
ascFile.addNote(f.str().c_str()); |
| 867 |
|
| 868 |
pos=input->tell(); |
| 869 |
if (!input->checkPosition(pos+numFonts*7)) { |
| 870 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: the fonts zone seems bad\n")); |
| 871 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 872 |
return false; |
| 873 |
} |
| 874 |
f.str(""); |
| 875 |
f << "TextZone[fonts]:"; |
| 876 |
for (int i=0; i<numFonts; ++i) { |
| 877 |
f << "font" << i << "=["; |
| 878 |
MWAWFont font; |
| 879 |
unsigned char colors[3]; |
| 880 |
for (auto &c : colors) c=static_cast<unsigned char>(input->readULong(1)); |
| 881 |
font.setColor(MWAWColor(colors[0],colors[1],colors[2])); |
| 882 |
val=int(input->readLong(1)); // 0 |
| 883 |
if (val) f << "f0=" << val << ","; |
| 884 |
font.setSize(float(input->readULong(1))); |
| 885 |
auto flag=static_cast<int>(input->readULong(1)); |
| 886 |
uint32_t flags=0; |
| 887 |
if (flag&0x1) flags |= MWAWFont::boldBit; |
| 888 |
if (flag&0x2) flags |= MWAWFont::italicBit; |
| 889 |
if (flag&0x4) font.setUnderlineStyle(MWAWFont::Line::Simple); |
| 890 |
if (flag&0x8) flags |= MWAWFont::embossBit; |
| 891 |
if (flag&0x10) flags |= MWAWFont::shadowBit; |
| 892 |
if (flag&0x60) |
| 893 |
f << "#font[flag]=" << std::hex << (flag&0x60) << std::dec << ","; |
| 894 |
font.setFlags(flags); |
| 895 |
auto sSz=static_cast<int>(input->readULong(1)); |
| 896 |
if (!sSz || !input->checkPosition(input->tell()+sSz)) { |
| 897 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: can not determine the string zone %d\n", i)); |
| 898 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 899 |
return false; |
| 900 |
} |
| 901 |
std::string name(""); |
| 902 |
for (int j=0; j<sSz; ++j) |
| 903 |
name+=char(input->readLong(1)); |
| 904 |
font.setId(fontConverter->getId(name)); |
| 905 |
f << font.getDebugString(fontConverter); |
| 906 |
f << "],"; |
| 907 |
graphic->m_fontList.push_back(font); |
| 908 |
} |
| 909 |
ascFile.addPos(pos); |
| 910 |
ascFile.addNote(f.str().c_str()); |
| 911 |
|
| 912 |
pos=input->tell(); |
| 913 |
if (!input->checkPosition(pos+16+numPos*6)) { |
| 914 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: the last zone seems bad\n")); |
| 915 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 916 |
return false; |
| 917 |
} |
| 918 |
f.str(""); |
| 919 |
f << "TextZone-B:"; |
| 920 |
double extraLeading=0; |
| 921 |
para.m_marginsUnit=librevenge::RVNG_POINT; |
| 922 |
for (int i=0; i<7; ++i) { |
| 923 |
val=static_cast<int>(input->readLong(2)); |
| 924 |
if (val==0) continue; |
| 925 |
switch (i) { |
| 926 |
case 2: |
| 927 |
para.m_margins[1]=double(val)/20.; |
| 928 |
f << "marg[left]=" << double(val)/20. << ","; |
| 929 |
break; |
| 930 |
case 3: |
| 931 |
para.m_margins[2]=double(val)/20.; |
| 932 |
f << "marg[right]=" << double(val)/20. << ","; |
| 933 |
break; |
| 934 |
case 4: |
| 935 |
para.m_margins[0]=double(val)/20.; |
| 936 |
f << "para[indent]=" << double(val)/20. << ","; |
| 937 |
break; |
| 938 |
case 5: |
| 939 |
extraLeading=double(val)/20; |
| 940 |
f << "height[leading]=" << extraLeading << ","; |
| 941 |
break; |
| 942 |
default: |
| 943 |
f << "f" << i << "=" << val << ","; |
| 944 |
break; |
| 945 |
} |
| 946 |
} |
| 947 |
val=static_cast<int>(input->readLong(1)); |
| 948 |
switch (val) { |
| 949 |
case 1: // normal |
| 950 |
break; |
| 951 |
case 2: |
| 952 |
para.setInterline(2, librevenge::RVNG_PERCENT); |
| 953 |
f << "interline=200%,"; |
| 954 |
break; |
| 955 |
case 3: |
| 956 |
para.setInterline(1.5, librevenge::RVNG_PERCENT); |
| 957 |
f << "interline=150%,"; |
| 958 |
break; |
| 959 |
case 4: |
| 960 |
f << "interline=fixed,"; |
| 961 |
break; |
| 962 |
case 5: |
| 963 |
para.m_spacings[1]=extraLeading/72.; |
| 964 |
f << "interline=extra[leading],"; |
| 965 |
break; |
| 966 |
default: |
| 967 |
f << "#interline=" << val << ","; |
| 968 |
break; |
| 969 |
} |
| 970 |
val=static_cast<int>(input->readLong(1)); // 1|2 |
| 971 |
if (val!=1) f << "f8=" << val << ","; |
| 972 |
int lastPos=0; |
| 973 |
f << "pos=["; |
| 974 |
for (int i=0; i<numPos; ++i) { |
| 975 |
auto newPos=static_cast<int>(input->readULong(4)); |
| 976 |
auto ft=static_cast<int>(input->readULong(2)); |
| 977 |
if ((i==0 && newPos!=0) || (i && (newPos<lastPos || newPos>textSize)) || (ft>numFonts)) { |
| 978 |
MWAW_DEBUG_MSG(("WingzGraph::readTextZone: the position zone seems bad\n")); |
| 979 |
f << "##"; |
| 980 |
ascFile.addPos(pos); |
| 981 |
ascFile.addNote(f.str().c_str()); |
| 982 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 983 |
return false; |
| 984 |
} |
| 985 |
if (ft<numFonts) |
| 986 |
graphic->m_posToFontId[newPos]=size_t(ft); |
| 987 |
f << std::hex << newPos << std::dec << ":" << ft << ","; |
| 988 |
} |
| 989 |
f << "],"; |
| 990 |
|
| 991 |
ascFile.addPos(pos); |
| 992 |
ascFile.addNote(f.str().c_str()); |
| 993 |
return true; |
| 994 |
} |
| 995 |
|
| 996 |
//////////////////////////////////////////////////////////// |
| 997 |
// color/pattern |
| 998 |
//////////////////////////////////////////////////////////// |
| 999 |
bool WingzGraph::readPattern(MWAWGraphicStyle::Pattern &pattern, int &patId) |
| 1000 |
{ |
| 1001 |
auto input = m_parserState->m_input; |
| 1002 |
long pos = input->tell(); |
| 1003 |
if (!input->checkPosition(pos+7)) { |
| 1004 |
MWAW_DEBUG_MSG(("WingzGraph::readPattern: the zone seems to short\n")); |
| 1005 |
return false; |
| 1006 |
} |
| 1007 |
MWAWColor colors[2]; |
| 1008 |
unsigned char col[3]; |
| 1009 |
for (auto &c : col) c=static_cast<unsigned char>(input->readULong(1)); |
| 1010 |
colors[0]=MWAWColor(col[0],col[1],col[2]); |
| 1011 |
patId=int(input->readULong(1)); |
| 1012 |
for (auto &c : col) c=static_cast<unsigned char>(input->readULong(1)); |
| 1013 |
colors[1]=MWAWColor(col[0],col[1],col[2]); |
| 1014 |
if (m_state->m_patternList.empty()) |
| 1015 |
m_state->initPatterns(version()); |
| 1016 |
if (patId>=0 && patId<int(m_state->m_patternList.size())) |
| 1017 |
pattern=m_state->m_patternList[size_t(patId)]; |
| 1018 |
else |
| 1019 |
pattern=m_state->m_patternList[0]; |
| 1020 |
for (int i=0; i<2; ++i) |
| 1021 |
pattern.m_colors[i]=colors[1-i]; |
| 1022 |
return true; |
| 1023 |
} |
| 1024 |
|
| 1025 |
bool WingzGraph::readColor(MWAWColor &color, int &patId) |
| 1026 |
{ |
| 1027 |
MWAWGraphicStyle::Pattern pat; |
| 1028 |
if (!readPattern(pat, patId)) |
| 1029 |
return false; |
| 1030 |
pat.getAverageColor(color); |
| 1031 |
return true; |
| 1032 |
} |
| 1033 |
|
| 1034 |
//////////////////////////////////////////////////////////// |
| 1035 |
// chart |
| 1036 |
//////////////////////////////////////////////////////////// |
| 1037 |
bool WingzGraph::readChartData(std::shared_ptr<WingzGraphInternal::Graphic>) |
| 1038 |
{ |
| 1039 |
auto input = m_parserState->m_input; |
| 1040 |
auto &ascFile = m_parserState->m_asciiFile; |
| 1041 |
long pos = input->tell(), debPos=pos; |
| 1042 |
libmwaw::DebugStream f; |
| 1043 |
f << "Entries(Chart):"; |
| 1044 |
auto val=static_cast<int>(input->readLong(2)); |
| 1045 |
f << "f0=" << val << ","; |
| 1046 |
val=static_cast<int>(input->readLong(2)); |
| 1047 |
f << "f1=" << val << ","; |
| 1048 |
ascFile.addPos(pos); |
| 1049 |
ascFile.addNote(f.str().c_str()); |
| 1050 |
if (val>0) |
| 1051 |
return true; |
| 1052 |
if (!input->checkPosition(pos+866)) { |
| 1053 |
MWAW_DEBUG_MSG(("WingzGraph::readChartData: the zone seems to short\n")); |
| 1054 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1055 |
return false; |
| 1056 |
} |
| 1057 |
MWAWColor color; |
| 1058 |
int patId; |
| 1059 |
bool ok=true; |
| 1060 |
for (int i=0; i<6; ++i) { |
| 1061 |
pos=input->tell(); |
| 1062 |
f.str(""); |
| 1063 |
char const *wh[]= {"title", "footnote", "background", "plotArea", "serie,label", "interior"}; |
| 1064 |
f << "Chart[" << wh[i] << "]:"; |
| 1065 |
if (!readColor(color, patId)) { |
| 1066 |
ok=false; |
| 1067 |
break; |
| 1068 |
} |
| 1069 |
if (patId && !color.isWhite()) |
| 1070 |
f << "surf[col]=" << color << ","; |
| 1071 |
else if (!patId) |
| 1072 |
f << "surf[col]=none,"; |
| 1073 |
if (i==5) { |
| 1074 |
val=int(input->readLong(1)); |
| 1075 |
if (val!=1) f << "f0=" << val << ","; |
| 1076 |
} |
| 1077 |
else { |
| 1078 |
val=int(input->readLong(1)); // shadow type 4: none, 5: 2d, 6: 3d |
| 1079 |
if (val!=4) f << "shadow[type]=" << val << ","; |
| 1080 |
if (!readColor(color, patId)) { |
| 1081 |
ok=false; |
| 1082 |
break; |
| 1083 |
} |
| 1084 |
if (patId && !color.isBlack()) |
| 1085 |
f << "shadow[col]=" << color << ","; |
| 1086 |
else if (!patId) |
| 1087 |
f << "shadow[col]=none,"; |
| 1088 |
val=int(input->readULong(1)); // related to shadow |
| 1089 |
if (val!=0xff) f << "f1=" << std::hex << val << std::dec << ","; |
| 1090 |
} |
| 1091 |
if (!readColor(color, patId)) { |
| 1092 |
ok=false; |
| 1093 |
break; |
| 1094 |
} |
| 1095 |
if (patId && !color.isBlack()) |
| 1096 |
f << "line[col]=" << color << ","; |
| 1097 |
else if (!patId) |
| 1098 |
f << "line[col]=none,"; |
| 1099 |
val=int(input->readLong(1)); |
| 1100 |
if (val!=1) f << "h0=" << val << ","; |
| 1101 |
val=int(input->readULong(1)); |
| 1102 |
if (val!=5) f << "line[w]=" << float(val)/20.f << ","; |
| 1103 |
val=int(input->readLong(1)); |
| 1104 |
if (val) f << "h1=" << val << ","; |
| 1105 |
if (i!=5) { |
| 1106 |
int dim[2]; |
| 1107 |
for (auto &d : dim) d=int(input->readULong(2)); |
| 1108 |
if (dim[0]!=20 || dim[1]!=20) f << "shadow[pos]=" << 0.05f * MWAWVec2f(float(dim[0]), float(dim[1])) << ","; |
| 1109 |
} |
| 1110 |
if (i<2) { |
| 1111 |
int cell[4]; |
| 1112 |
for (auto &d : cell) d=int(input->readLong(2)); |
| 1113 |
if (cell[1]>=0) |
| 1114 |
f << MWAWBox2i(MWAWVec2i(cell[0],cell[1]),MWAWVec2i(cell[2],cell[3])) << ","; |
| 1115 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1116 |
input->seek(pos+42, librevenge::RVNG_SEEK_SET); |
| 1117 |
} |
| 1118 |
ascFile.addPos(pos); |
| 1119 |
ascFile.addNote(f.str().c_str()); |
| 1120 |
} |
| 1121 |
if (!ok) { |
| 1122 |
input->seek(debPos, librevenge::RVNG_SEEK_SET); |
| 1123 |
return false; |
| 1124 |
} |
| 1125 |
pos=input->tell(); |
| 1126 |
f.str(""); |
| 1127 |
f << "Chart-A5:"; |
| 1128 |
for (int j=0; j<7; ++j) { // 0 and 1 : the table's data |
| 1129 |
int cell[4]; |
| 1130 |
for (auto &d : cell) d=int(input->readLong(2)); |
| 1131 |
if (cell[1]>=0) |
| 1132 |
f << "ce" << j << "=" << MWAWBox2i(MWAWVec2i(cell[0],cell[1]),MWAWVec2i(cell[2],cell[3])) << ","; |
| 1133 |
} |
| 1134 |
for (int j=0; j<6; ++j) { // f0=0|1,f3=1|2|b|e|13:type?,f5=1-4,b-c|10|1b|23|40|47 |
| 1135 |
val=int(input->readLong(2)); |
| 1136 |
int const expected[]= {0,0xf0,0,0,0,0}; |
| 1137 |
if (j==3) |
| 1138 |
/* 0: bar, 1: line, 2:layer, 3:step, 4: bar/line |
| 1139 |
5: bar 3d, 6: line 3d, 7: layer 3d, 8: step 3d, 9: bar/line 3d |
| 1140 |
10:pie, 11: pie 3d, 12:High-Low, 14: XY, 16: scatter, |
| 1141 |
17: polar, 18: wireframe, 19: contour, 20: surface |
| 1142 |
*/ |
| 1143 |
f << "type=" << val << ","; |
| 1144 |
else if (val!=expected[j]) |
| 1145 |
f << "f" << j << "=" << val << ","; |
| 1146 |
} |
| 1147 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1148 |
ascFile.addPos(pos); |
| 1149 |
ascFile.addNote(f.str().c_str()); |
| 1150 |
pos+=70; |
| 1151 |
|
| 1152 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1153 |
f.str(""); |
| 1154 |
f << "Chart-header:"; |
| 1155 |
auto numSeries=static_cast<int>(input->readULong(2)); |
| 1156 |
f << "numSerie=" << numSeries << ","; |
| 1157 |
long endPos=debPos+866+73*numSeries; |
| 1158 |
if (!input->checkPosition(endPos)) { |
| 1159 |
MWAW_DEBUG_MSG(("WingzGraph::readChartData: the zone seems to short\n")); |
| 1160 |
ok=input->checkPosition(debPos+866); |
| 1161 |
if (ok) { |
| 1162 |
input->seek(debPos+866, librevenge::RVNG_SEEK_SET); |
| 1163 |
ok=m_mainParser->findNextZone(0xe); |
| 1164 |
} |
| 1165 |
if (!ok) { |
| 1166 |
MWAW_DEBUG_MSG(("WingzGraph::readChartData: can not find the next zone\n")); |
| 1167 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1168 |
return false; |
| 1169 |
} |
| 1170 |
numSeries=0; |
| 1171 |
endPos=input->tell(); |
| 1172 |
input->seek(pos+2, librevenge::RVNG_SEEK_SET); |
| 1173 |
} |
| 1174 |
for (int i=0; i<3; ++i) { // f1: some id, f2&0xff: subtype |
| 1175 |
val=int(input->readULong(2)); |
| 1176 |
if (val) |
| 1177 |
f << "f" << i << "=" << std::hex << val << std::dec << ","; |
| 1178 |
} |
| 1179 |
readColor(color, patId); |
| 1180 |
if (patId && !color.isWhite()) |
| 1181 |
f << "surf[col]=" << color << ","; |
| 1182 |
else if (!patId) |
| 1183 |
f << "surf[col]=none,"; |
| 1184 |
val=int(input->readLong(1)); // shadow type 4: none, 5: 2d, 6: 3d |
| 1185 |
if (val!=4) f << "shadow[type]=" << val << ","; |
| 1186 |
readColor(color, patId); |
| 1187 |
if (patId && !color.isBlack()) |
| 1188 |
f << "shadow[col]=" << color << ","; |
| 1189 |
else if (!patId) |
| 1190 |
f << "shadow[col]=none,"; |
| 1191 |
val=int(input->readULong(1)); // related to shadow |
| 1192 |
if (val!=0xff) |
| 1193 |
f << "f4=" << std::hex << val << std::dec << ","; |
| 1194 |
readColor(color, patId); |
| 1195 |
if (patId && !color.isBlack()) |
| 1196 |
f << "line[col]=" << color << ","; |
| 1197 |
else if (!patId) |
| 1198 |
f << "line[col]=none,"; |
| 1199 |
val=int(input->readLong(1)); |
| 1200 |
if (val!=1) f << "g0=" << val << ","; |
| 1201 |
val=int(input->readULong(1)); |
| 1202 |
if (val!=5) f << "line[w]=" << float(val)/20.f << ","; |
| 1203 |
val=int(input->readLong(1)); |
| 1204 |
if (val) f << "g1=" << val << ","; |
| 1205 |
int dim[2]; |
| 1206 |
for (auto &d : dim) d=int(input->readULong(2)); |
| 1207 |
if (dim[0]!=20 || dim[1]!=20) f << "shadow[pos]=" << 0.05f * MWAWVec2f(float(dim[0]), float(dim[1])) << ","; |
| 1208 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1209 |
input->seek(18, librevenge::RVNG_SEEK_CUR); |
| 1210 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1211 |
val=int(input->readLong(1)); |
| 1212 |
if (val!=1) |
| 1213 |
f << "g2=" << val << ","; |
| 1214 |
val=int(input->readLong(1)); |
| 1215 |
if (val!=1) |
| 1216 |
f << "g3=" << val << ","; |
| 1217 |
for (int i=0; i<11; ++i) { |
| 1218 |
val=int(input->readLong(1)); |
| 1219 |
if (val) |
| 1220 |
f << "h" << i << "=" << val << ","; |
| 1221 |
} |
| 1222 |
ascFile.addPos(pos); |
| 1223 |
ascFile.addNote(f.str().c_str()); |
| 1224 |
|
| 1225 |
pos+=80; |
| 1226 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1227 |
for (int i=0; i<4; ++i) { |
| 1228 |
pos=input->tell(); |
| 1229 |
f.str(""); |
| 1230 |
char const *wh[]= {"axisX", "axisZ", "axisY", "B3"}; |
| 1231 |
f << "Chart[" << wh[i] << "]:"; |
| 1232 |
val=int(input->readULong(2)); |
| 1233 |
if (val!=0x4024) f << "fl=" << std::hex << val << std::dec << ","; |
| 1234 |
if (!readColor(color, patId)) { |
| 1235 |
ok=false; |
| 1236 |
break; |
| 1237 |
} |
| 1238 |
if (patId && !color.isWhite()) |
| 1239 |
f << "surf[col]=" << color << ","; |
| 1240 |
else if (!patId) |
| 1241 |
f << "surf[col]=none,"; |
| 1242 |
val=int(input->readLong(1)); // shadow type 4: none, 5: 2d, 6: 3d |
| 1243 |
if (val!=4) f << "shadow[type]=" << val << ","; |
| 1244 |
if (!readColor(color, patId)) { |
| 1245 |
ok=false; |
| 1246 |
break; |
| 1247 |
} |
| 1248 |
if (patId && !color.isBlack()) |
| 1249 |
f << "shadow[col]=" << color << ","; |
| 1250 |
else if (!patId) |
| 1251 |
f << "shadow[col]=none,"; |
| 1252 |
val=int(input->readULong(1)); // related to shadow |
| 1253 |
if (val!=0xff) f << "f1=" << std::hex << val << std::dec << ","; |
| 1254 |
if (!readColor(color, patId)) { |
| 1255 |
ok=false; |
| 1256 |
break; |
| 1257 |
} |
| 1258 |
if (patId && !color.isBlack()) |
| 1259 |
f << "line[col]=" << color << ","; |
| 1260 |
else if (!patId) |
| 1261 |
f << "line[col]=none,"; |
| 1262 |
val=int(input->readLong(1)); |
| 1263 |
if (val!=1) f << "h0=" << val << ","; |
| 1264 |
val=int(input->readULong(1)); |
| 1265 |
if (val!=5) f << "line[w]=" << float(val)/20.f << ","; |
| 1266 |
val=int(input->readLong(1)); |
| 1267 |
if (val) f << "h1=" << val << ","; |
| 1268 |
for (auto &d : dim) d=int(input->readULong(2)); |
| 1269 |
if (dim[0]!=20 || dim[1]!=20) f << "shadow[pos]=" << 0.05f * MWAWVec2f(float(dim[0]), float(dim[1])) << ","; |
| 1270 |
int cell[4]; |
| 1271 |
for (auto &d : cell) d=int(input->readLong(2)); |
| 1272 |
if (cell[1]>=0) |
| 1273 |
f << MWAWBox2i(MWAWVec2i(cell[0],cell[1]),MWAWVec2i(cell[2],cell[3])) << ","; |
| 1274 |
for (int j=0; j<2; ++j) { // h2=1 for axisY |
| 1275 |
int const expected[]= {0,2}; |
| 1276 |
val=int(input->readLong(2)); |
| 1277 |
if (val!=expected[j]) f << "h" << j+2 << "=" << val << ","; |
| 1278 |
} |
| 1279 |
for (int k=0; k<2; ++k) { // k=0, real axis line color |
| 1280 |
std::string what(k==0 ? "line2" : "unkn"); |
| 1281 |
if (!readColor(color, patId)) { |
| 1282 |
ok=false; |
| 1283 |
break; |
| 1284 |
} |
| 1285 |
if (patId && !color.isBlack()) |
| 1286 |
f << what << "[col]=" << color << ","; |
| 1287 |
else if (!patId) |
| 1288 |
f << what << "[col]=none,"; |
| 1289 |
val=int(input->readLong(1)); |
| 1290 |
if (val!=1) f << what << "[f0]=" << val << ","; |
| 1291 |
val=int(input->readULong(1)); |
| 1292 |
if (val!=5) f << what << "[w]=" << float(val)/20.f << ","; |
| 1293 |
val=int(input->readLong(1)); |
| 1294 |
if (val) f << what << "[f1]=" << val << ","; |
| 1295 |
} |
| 1296 |
if (!readColor(color, patId)) { |
| 1297 |
ok=false; |
| 1298 |
break; |
| 1299 |
} |
| 1300 |
if (patId) |
| 1301 |
f << "unkn2[col]=" << color << ","; |
| 1302 |
val=int(input->readLong(1)); |
| 1303 |
if (val!=1) f << "l0=" << val << ","; |
| 1304 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1305 |
ascFile.addPos(pos); |
| 1306 |
ascFile.addNote(f.str().c_str()); |
| 1307 |
|
| 1308 |
input->seek(pos+113, librevenge::RVNG_SEEK_SET); |
| 1309 |
} |
| 1310 |
if (!ok) { |
| 1311 |
input->seek(debPos, librevenge::RVNG_SEEK_SET); |
| 1312 |
return false; |
| 1313 |
} |
| 1314 |
pos=input->tell(); |
| 1315 |
f.str(""); |
| 1316 |
f << "Chart-B5:"; |
| 1317 |
for (int i=0; i<5; ++i) { |
| 1318 |
int const expected[]= {0x1e, 0x1e, 0x32, 0x32, 0x109}; |
| 1319 |
val=int(input->readLong(2)); |
| 1320 |
if (val==expected[i]) continue; |
| 1321 |
char const *wh[] = {"f0", "f1", "x[vanish,3d]", "y[vanish,3d]", "distance[3d]"}; |
| 1322 |
f << wh[i] << "=" << val << ","; |
| 1323 |
} |
| 1324 |
for (int i=0; i<4; ++i) { |
| 1325 |
if (!readColor(color, patId)) { |
| 1326 |
ok=false; |
| 1327 |
break; |
| 1328 |
} |
| 1329 |
char const *wh[] = {"top", "side", "shadow", "line"}; |
| 1330 |
if (patId && ((i<2 && !color.isWhite()) || (i>=2 && !color.isBlack()))) |
| 1331 |
f << wh[i] << "[3d,col]=" << color << ","; |
| 1332 |
else if (!patId) |
| 1333 |
f << wh[i] << "[3d,col]=none,"; |
| 1334 |
val=int(input->readULong(1)); |
| 1335 |
if (i<2) { |
| 1336 |
if (val!=4) |
| 1337 |
f << "f" << i+2 << "=" << val << ","; |
| 1338 |
} |
| 1339 |
else if (i==2) { |
| 1340 |
if (val!=0x4b) // val something like ~2*tint in percent |
| 1341 |
f << "shadow[tint]=" << val << ","; |
| 1342 |
} |
| 1343 |
else if (val!=1) |
| 1344 |
f << "f" << i+2 << "=" << val << ","; |
| 1345 |
} |
| 1346 |
val=int(input->readULong(1)); |
| 1347 |
if (val!=5) f << "line[w,3d]=" << float(val)/20.f << ","; |
| 1348 |
if (!ok) { |
| 1349 |
input->seek(debPos, librevenge::RVNG_SEEK_SET); |
| 1350 |
return false; |
| 1351 |
} |
| 1352 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1353 |
ascFile.addPos(pos); |
| 1354 |
ascFile.addNote(f.str().c_str()); |
| 1355 |
pos+=68; |
| 1356 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1357 |
|
| 1358 |
for (int i=0; i<numSeries; ++i) { |
| 1359 |
pos=input->tell(); |
| 1360 |
f.str(""); |
| 1361 |
f << "Chart-Serie" << i << ":"; |
| 1362 |
|
| 1363 |
input->seek(pos+70, librevenge::RVNG_SEEK_SET); |
| 1364 |
val=int(input->readLong(1)); |
| 1365 |
if (val!=2) { |
| 1366 |
if (val) { |
| 1367 |
f << "###type=" << val << ","; |
| 1368 |
MWAW_DEBUG_MSG(("WingzGraph::readChartData: find unexpected serie type\n")); |
| 1369 |
} |
| 1370 |
f << "_,"; |
| 1371 |
ascFile.addPos(pos); |
| 1372 |
ascFile.addNote(f.str().c_str()); |
| 1373 |
input->seek(pos+73, librevenge::RVNG_SEEK_SET); |
| 1374 |
continue; |
| 1375 |
} |
| 1376 |
|
| 1377 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1378 |
if (!readColor(color, patId)) |
| 1379 |
break; |
| 1380 |
if (patId && !color.isWhite()) |
| 1381 |
f << "surf[col]=" << color << ","; |
| 1382 |
else if (!patId) |
| 1383 |
f << "surf[col]=none,"; |
| 1384 |
val=int(input->readLong(1)); |
| 1385 |
if (val!=1) f << "f0=" << val << ","; |
| 1386 |
|
| 1387 |
if (!readColor(color, patId)) |
| 1388 |
break; |
| 1389 |
if (patId) |
| 1390 |
f << "shadow[col]=" << color << ","; |
| 1391 |
|
| 1392 |
val=int(input->readLong(1)); |
| 1393 |
if (val) f << "f1=" << val << ","; |
| 1394 |
if (!readColor(color, patId)) |
| 1395 |
break; |
| 1396 |
if (patId && !color.isBlack()) |
| 1397 |
f << "line[col]=" << color << ","; |
| 1398 |
else if (!patId) |
| 1399 |
f << "line[col]=none,"; |
| 1400 |
val=int(input->readLong(1)); |
| 1401 |
if (val!=1) f << "f2=" << val << ","; |
| 1402 |
val=int(input->readLong(2)); |
| 1403 |
if (val!=40) f << "f3=" << val << ","; |
| 1404 |
if (!readColor(color, patId)) |
| 1405 |
break; |
| 1406 |
if (patId && !color.isBlack()) |
| 1407 |
f << "unkn[col]=" << color << ","; |
| 1408 |
else if (!patId) |
| 1409 |
f << "unkn[col]=none,"; |
| 1410 |
val=int(input->readLong(1)); |
| 1411 |
if (val!=1) f << "g0=" << val << ","; |
| 1412 |
val=int(input->readULong(1)); |
| 1413 |
if (val!=5) f << "line[w]=" << float(val)/20.f << ","; |
| 1414 |
val=int(input->readLong(1)); |
| 1415 |
if (val) f << "g1=" << val << ","; |
| 1416 |
for (int j=0; j<3; ++j) { // 0: data, 1: label? |
| 1417 |
int cell[4]; |
| 1418 |
for (auto &c : cell) c=int(input->readLong(2)); |
| 1419 |
if (cell[1]>=0) |
| 1420 |
f << "cells" << j << "=" << MWAWBox2i(MWAWVec2i(cell[0],cell[1]),MWAWVec2i(cell[2],cell[3])) << ","; |
| 1421 |
} |
| 1422 |
for (int j=0; j<5; ++j) { // h1=serie[id] ? |
| 1423 |
val=int(input->readLong(2)); |
| 1424 |
if (val) |
| 1425 |
f << "h" << j << "=" << val << ","; |
| 1426 |
} |
| 1427 |
ascFile.addDelimiter(input->tell(),'|'); |
| 1428 |
ascFile.addPos(pos); |
| 1429 |
ascFile.addNote(f.str().c_str()); |
| 1430 |
input->seek(pos+73, librevenge::RVNG_SEEK_SET); |
| 1431 |
} |
| 1432 |
if (input->tell()!=endPos) { |
| 1433 |
MWAW_DEBUG_MSG(("WingzGraph::readChartData: find some extra data\n")); |
| 1434 |
ascFile.addPos(input->tell()); |
| 1435 |
ascFile.addNote("Chart-end:###"); |
| 1436 |
} |
| 1437 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1438 |
return true; |
| 1439 |
} |
| 1440 |
|
| 1441 |
//////////////////////////////////////////////////////////// |
| 1442 |
// send data |
| 1443 |
//////////////////////////////////////////////////////////// |
| 1444 |
bool WingzGraph::sendGraphic(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos) |
| 1445 |
{ |
| 1446 |
MWAWListenerPtr listener=m_parserState->getMainListener(); |
| 1447 |
if (!listener) { |
| 1448 |
MWAW_DEBUG_MSG(("WingzGraph::sendGraphic: listener is not set\n")); |
| 1449 |
return false; |
| 1450 |
} |
| 1451 |
MWAWPosition fPos; |
| 1452 |
if (!m_state->m_inGroupDepth) { |
| 1453 |
MWAWVec2f begPos=m_mainParser->getPosition(graphic.m_position[0], graphic.m_relativePosition[0]); |
| 1454 |
MWAWVec2f endPos=m_mainParser->getPosition(graphic.m_position[1], graphic.m_relativePosition[1]); |
| 1455 |
fPos=MWAWPosition(begPos, endPos-begPos, librevenge::RVNG_POINT); |
| 1456 |
} |
| 1457 |
else { // special case relative to the group box |
| 1458 |
auto const &orig=pos.origin(); |
| 1459 |
auto const &size=pos.size(); |
| 1460 |
MWAWVec2f begPos(orig[0]+size[0]*float(graphic.m_position[0][0])/float(0x3fff), |
| 1461 |
orig[1]+size[1]*float(graphic.m_position[0][1])/float(0x3fff)); |
| 1462 |
MWAWVec2f endPos(orig[0]+size[0]*float(graphic.m_position[1][0])/float(0x3fff), |
| 1463 |
orig[1]+size[1]*float(graphic.m_position[1][1])/float(0x3fff)); |
| 1464 |
fPos=MWAWPosition(begPos, endPos-begPos, librevenge::RVNG_POINT); |
| 1465 |
} |
| 1466 |
fPos.m_anchorTo=MWAWPosition::Page; |
| 1467 |
fPos.setOrder(graphic.m_order); |
| 1468 |
switch (graphic.m_type) { |
| 1469 |
case 0: |
| 1470 |
case 2: { |
| 1471 |
std::shared_ptr<MWAWSubDocument> doc(new WingzGraphInternal::SubDocument(*this, m_parserState->m_input, graphic)); |
| 1472 |
listener->insertTextBox(fPos, doc, graphic.m_style); |
| 1473 |
return true; |
| 1474 |
} |
| 1475 |
case 5: |
| 1476 |
case 6: |
| 1477 |
case 7: |
| 1478 |
case 8: |
| 1479 |
case 9: |
| 1480 |
return sendShape(graphic, fPos); |
| 1481 |
case 0xa: |
| 1482 |
return sendPicture(graphic, fPos); |
| 1483 |
case 0xb: // group |
| 1484 |
listener->openGroup(pos); |
| 1485 |
++m_state->m_inGroupDepth; |
| 1486 |
for (auto const &c : graphic.m_children) { |
| 1487 |
if (c) sendGraphic(*c, fPos); |
| 1488 |
} |
| 1489 |
--m_state->m_inGroupDepth; |
| 1490 |
listener->closeGroup(); |
| 1491 |
return true; |
| 1492 |
default: |
| 1493 |
break; |
| 1494 |
} |
| 1495 |
static bool first=true; |
| 1496 |
if (first) { |
| 1497 |
MWAW_DEBUG_MSG(("WingzGraph::sendGraphic: oops, unsure how to send some graphic[%d]\n", graphic.m_type)); |
| 1498 |
first=false; |
| 1499 |
} |
| 1500 |
return false; |
| 1501 |
} |
| 1502 |
|
| 1503 |
bool WingzGraph::sendPicture(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos) |
| 1504 |
{ |
| 1505 |
MWAWListenerPtr listener=m_parserState->getMainListener(); |
| 1506 |
if (!listener) { |
| 1507 |
MWAW_DEBUG_MSG(("WingzGraph::sendPicture: listener is not set\n")); |
| 1508 |
return false; |
| 1509 |
} |
| 1510 |
if (!graphic.m_entry[0].valid()) { |
| 1511 |
MWAW_DEBUG_MSG(("WingzGraph::sendPicture: can not find the picture\n")); |
| 1512 |
return false; |
| 1513 |
} |
| 1514 |
auto input = m_parserState->m_input; |
| 1515 |
long actPos=input->tell(); |
| 1516 |
librevenge::RVNGBinaryData file; |
| 1517 |
input->seek(graphic.m_entry[0].begin(), librevenge::RVNG_SEEK_SET); |
| 1518 |
input->readDataBlock(graphic.m_entry[0].length(), file); |
| 1519 |
MWAWEmbeddedObject object(file); |
| 1520 |
listener->insertPicture(pos, object); |
| 1521 |
input->seek(actPos, librevenge::RVNG_SEEK_SET); |
| 1522 |
return true; |
| 1523 |
} |
| 1524 |
|
| 1525 |
bool WingzGraph::sendShape(WingzGraphInternal::Graphic const &graphic, MWAWPosition const &pos) |
| 1526 |
{ |
| 1527 |
MWAWListenerPtr listener=m_parserState->getMainListener(); |
| 1528 |
if (!listener) { |
| 1529 |
MWAW_DEBUG_MSG(("WingzGraph::sendShape: listener is not set\n")); |
| 1530 |
return false; |
| 1531 |
} |
| 1532 |
auto const &orig=pos.origin(); |
| 1533 |
auto end=orig+pos.size(); |
| 1534 |
MWAWGraphicShape shape; |
| 1535 |
switch (graphic.m_type) { |
| 1536 |
case 5: |
| 1537 |
switch (graphic.m_flag&3) { |
| 1538 |
case 1: |
| 1539 |
shape=MWAWGraphicShape::line(MWAWVec2f(end[0],orig[1]),MWAWVec2f(orig[0],end[1])); |
| 1540 |
break; |
| 1541 |
case 2: |
| 1542 |
shape=MWAWGraphicShape::line(MWAWVec2f(orig[0],end[1]),MWAWVec2f(end[0],orig[1])); |
| 1543 |
break; |
| 1544 |
case 3: |
| 1545 |
shape=MWAWGraphicShape::line(end,orig); |
| 1546 |
break; |
| 1547 |
case 0: |
| 1548 |
default: |
| 1549 |
shape=MWAWGraphicShape::line(orig,end); |
| 1550 |
break; |
| 1551 |
} |
| 1552 |
break; |
| 1553 |
case 6: { |
| 1554 |
float angle[2] = { graphic.m_angles[0], graphic.m_angles[1] }; |
| 1555 |
if (angle[0] > angle[1]) std::swap(angle[0],angle[1]); |
| 1556 |
while (angle[1] > 360) { |
| 1557 |
angle[0]-=360; |
| 1558 |
angle[1]-=360; |
| 1559 |
} |
| 1560 |
while (angle[0] < -360) { |
| 1561 |
angle[0]+=360; |
| 1562 |
angle[1]+=360; |
| 1563 |
} |
| 1564 |
|
| 1565 |
MWAWBox2f box(orig,end); |
| 1566 |
// we must compute the real bd box |
| 1567 |
float minVal[2] = { 0, 0 }, maxVal[2] = { 0, 0 }; |
| 1568 |
int limitAngle[2]; |
| 1569 |
for (int i = 0; i < 2; i++) |
| 1570 |
limitAngle[i] = (angle[i] < 0) ? int(angle[i]/90)-1 : int(angle[i]/90); |
| 1571 |
for (int bord = limitAngle[0]; bord <= limitAngle[1]+1; bord++) { |
| 1572 |
float ang = (bord == limitAngle[0]) ? float(angle[0]) : |
| 1573 |
(bord == limitAngle[1]+1) ? float(angle[1]) : float(90 * bord); |
| 1574 |
ang *= float(M_PI/180.); |
| 1575 |
float const actVal[2] = { std::cos(ang), -std::sin(ang)}; |
| 1576 |
if (actVal[0] < minVal[0]) minVal[0] = actVal[0]; |
| 1577 |
else if (actVal[0] > maxVal[0]) maxVal[0] = actVal[0]; |
| 1578 |
if (actVal[1] < minVal[1]) minVal[1] = actVal[1]; |
| 1579 |
else if (actVal[1] > maxVal[1]) maxVal[1] = actVal[1]; |
| 1580 |
} |
| 1581 |
MWAWBox2f circleBox(orig,end); |
| 1582 |
// we have the shape box, we need to reconstruct the circle box |
| 1583 |
if (maxVal[0]>minVal[0] && maxVal[1]>minVal[1]) { |
| 1584 |
float const scaling[2]= { (box[1][0]-box[0][0])/(maxVal[0]-minVal[0]), |
| 1585 |
(box[1][1]-box[0][1])/(maxVal[1]-minVal[1]) |
| 1586 |
}; |
| 1587 |
float const constant[2]= { box[0][0]-minVal[0] *scaling[0], box[0][1]-minVal[1] *scaling[1]}; |
| 1588 |
circleBox=MWAWBox2f(MWAWVec2f(constant[0]-scaling[0], constant[1]-scaling[1]), |
| 1589 |
MWAWVec2f(constant[0]+scaling[0], constant[1]+scaling[1])); |
| 1590 |
} |
| 1591 |
if (graphic.m_style.hasSurface()) |
| 1592 |
shape = MWAWGraphicShape::pie(box, circleBox, MWAWVec2f(float(angle[0]),float(angle[1]))); |
| 1593 |
else |
| 1594 |
shape = MWAWGraphicShape::arc(box, circleBox, MWAWVec2f(float(angle[0]),float(angle[1]))); |
| 1595 |
break; |
| 1596 |
} |
| 1597 |
case 7: |
| 1598 |
shape=MWAWGraphicShape::circle(MWAWBox2f(orig,end)); |
| 1599 |
break; |
| 1600 |
case 8: |
| 1601 |
if (graphic.m_flag&0x20) |
| 1602 |
shape=MWAWGraphicShape::rectangle(MWAWBox2f(orig,end), 0.2f*pos.size()); |
| 1603 |
else |
| 1604 |
shape=MWAWGraphicShape::rectangle(MWAWBox2f(orig,end)); |
| 1605 |
break; |
| 1606 |
case 9: { |
| 1607 |
if (graphic.m_vertices.empty()) { |
| 1608 |
MWAW_DEBUG_MSG(("WingzGraph::sendPageGraphics: oops, can not find any vertices\n")); |
| 1609 |
return false; |
| 1610 |
} |
| 1611 |
auto size=pos.size(); |
| 1612 |
if (graphic.m_flag&2) { // smooth |
| 1613 |
shape.m_bdBox=MWAWBox2f(orig,end); |
| 1614 |
shape.m_type=MWAWGraphicShape::Path; |
| 1615 |
shape.m_path.push_back(MWAWGraphicShape::PathData('M', MWAWVec2f(orig[0]+graphic.m_vertices[0][0]*size[0],orig[1]+graphic.m_vertices[0][1]*size[1]))); |
| 1616 |
for (size_t i=1; i+1<graphic.m_vertices.size(); ++i) { |
| 1617 |
MWAWVec2f pt=MWAWVec2f(orig[0]+graphic.m_vertices[i][0]*size[0], |
| 1618 |
orig[1]+graphic.m_vertices[i][1]*size[1]); |
| 1619 |
MWAWVec2f dir=graphic.m_vertices[i+1]-graphic.m_vertices[i-1]; |
| 1620 |
shape.m_path.push_back(MWAWGraphicShape::PathData('S', pt, pt-0.1f*MWAWVec2f(dir[0]*size[0],dir[1]*size[1]))); |
| 1621 |
} |
| 1622 |
if (graphic.m_vertices.size()>1) |
| 1623 |
shape.m_path.push_back(MWAWGraphicShape::PathData('L', MWAWVec2f(orig[0]+graphic.m_vertices.back()[0]*size[0],orig[1]+graphic.m_vertices.back()[1]*size[1]))); |
| 1624 |
if (graphic.m_flag&1) |
| 1625 |
shape.m_path.push_back(MWAWGraphicShape::PathData('Z')); |
| 1626 |
break; |
| 1627 |
} |
| 1628 |
if (graphic.m_flag&1) |
| 1629 |
shape=MWAWGraphicShape::polygon(MWAWBox2f(orig,end)); |
| 1630 |
else |
| 1631 |
shape=MWAWGraphicShape::polyline(MWAWBox2f(orig,end)); |
| 1632 |
for (auto const &pt : graphic.m_vertices) |
| 1633 |
shape.m_vertices.push_back(MWAWVec2f(orig[0]+pt[0]*size[0],orig[1]+pt[1]*size[1])); |
| 1634 |
break; |
| 1635 |
} |
| 1636 |
default: |
| 1637 |
shape=MWAWGraphicShape::rectangle(MWAWBox2f(orig,end)); |
| 1638 |
break; |
| 1639 |
} |
| 1640 |
listener->insertShape(pos, shape, graphic.m_style); |
| 1641 |
return true; |
| 1642 |
} |
| 1643 |
|
| 1644 |
bool WingzGraph::sendText(WingzGraphInternal::Graphic const &graphic) |
| 1645 |
{ |
| 1646 |
MWAWListenerPtr listener=m_parserState->getMainListener(); |
| 1647 |
if (!listener) { |
| 1648 |
MWAW_DEBUG_MSG(("WingzGraph::sendText: listener is not set\n")); |
| 1649 |
return false; |
| 1650 |
} |
| 1651 |
auto input=m_parserState->m_input; |
| 1652 |
|
| 1653 |
bool first=true; |
| 1654 |
for (int i=0; i<2; ++i) { |
| 1655 |
if (!graphic.m_entry[i].valid()) continue; |
| 1656 |
if (!first) listener->insertEOL(); |
| 1657 |
listener->setFont(graphic.m_font[graphic.m_textType==1 ? 0 : 1]); |
| 1658 |
input->seek(graphic.m_entry[i].begin(), librevenge::RVNG_SEEK_SET); |
| 1659 |
for (long l=graphic.m_entry[i].length(); l>0; --l) { |
| 1660 |
auto c=static_cast<unsigned char>(input->readULong(1)); |
| 1661 |
if (c==0x9) |
| 1662 |
listener->insertTab(); |
| 1663 |
else if (c==0xd) |
| 1664 |
listener->insertEOL(); |
| 1665 |
else |
| 1666 |
listener->insertCharacter(c); |
| 1667 |
} |
| 1668 |
first=false; |
| 1669 |
} |
| 1670 |
|
| 1671 |
if (!graphic.m_textEntry.valid()) |
| 1672 |
return true; |
| 1673 |
if (!first) listener->insertEOL(); |
| 1674 |
listener->setParagraph(graphic.m_paragraph); |
| 1675 |
input->seek(graphic.m_textEntry.begin(), librevenge::RVNG_SEEK_SET); |
| 1676 |
for (long l=0; l<graphic.m_textEntry.length(); ++l) { |
| 1677 |
if (graphic.m_posToFontId.find(int(l))!=graphic.m_posToFontId.end()) { |
| 1678 |
auto fId=graphic.m_posToFontId.find(int(l))->second; |
| 1679 |
if (fId<graphic.m_fontList.size()) |
| 1680 |
listener->setFont(graphic.m_fontList[fId]); |
| 1681 |
} |
| 1682 |
auto c=static_cast<unsigned char>(input->readULong(1)); |
| 1683 |
if (c==0x9) |
| 1684 |
listener->insertTab(); |
| 1685 |
else if (c==0xd) |
| 1686 |
listener->insertEOL(); |
| 1687 |
else |
| 1688 |
listener->insertCharacter(c); |
| 1689 |
} |
| 1690 |
return true; |
| 1691 |
} |
| 1692 |
|
| 1693 |
bool WingzGraph::sendPageGraphics() |
| 1694 |
{ |
| 1695 |
if (!m_state->m_groupStack.empty()) { |
| 1696 |
MWAW_DEBUG_MSG(("WingzGraph::sendPageGraphics: oops, some groups are not closed\n")); |
| 1697 |
} |
| 1698 |
MWAWListenerPtr listener=m_parserState->getMainListener(); |
| 1699 |
if (!listener) { |
| 1700 |
MWAW_DEBUG_MSG(("WingzGraph::sendPageGraphics: listener is not set\n")); |
| 1701 |
return false; |
| 1702 |
} |
| 1703 |
MWAWPosition pos(MWAWVec2f(0,0), MWAWVec2f(0,0), librevenge::RVNG_POINT); |
| 1704 |
pos.m_anchorTo=MWAWPosition::Page; |
| 1705 |
|
| 1706 |
for (auto const &graph : m_state->m_pictureList) { |
| 1707 |
if (graph) sendGraphic(*graph, pos); |
| 1708 |
} |
| 1709 |
return true; |
| 1710 |
} |
| 1711 |
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |