| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
| 2 | /* librevenge |
| 3 | * Version: MPL 2.0 / LGPLv2.1+ |
| 4 | * |
| 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/. |
| 8 | * |
| 9 | * Major Contributor(s): |
| 10 | * Copyright (C) 2006 Ariya Hidayat ([email protected]) |
| 11 | * Copyright (C) 2005 Fridrich Strba ([email protected]) |
| 12 | * Copyright (C) 2004 Marc Oude Kotte ([email protected]) |
| 13 | * |
| 14 | * For minor contributions see the git repository. |
| 15 | * |
| 16 | * Alternatively, the contents of this file may be used under the terms |
| 17 | * of the GNU Lesser General Public License Version 2.1 or later |
| 18 | * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are |
| 19 | * applicable instead of those above. |
| 20 | */ |
| 21 | |
| 22 | #include <librevenge-generators/librevenge-generators.h> |
| 23 | |
| 24 | #include <stdio.h> |
| 25 | |
| 26 | #include "RVNGRawGeneratorBase.h" |
| 27 | |
| 28 | namespace librevenge |
| 29 | { |
| 30 | |
| 31 | struct RVNGRawDrawingGeneratorImpl : RVNGRawGeneratorBase |
| 32 | { |
| 33 | explicit RVNGRawDrawingGeneratorImpl(bool printCallgraphScore); |
| 34 | }; |
| 35 | |
| 36 | RVNGRawDrawingGeneratorImpl::RVNGRawDrawingGeneratorImpl(const bool printCallgraphScore) |
| 37 | : RVNGRawGeneratorBase(printCallgraphScore) |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | RVNGRawDrawingGenerator::RVNGRawDrawingGenerator(bool printCallgraphScore): |
| 42 | RVNGDrawingInterface(), |
| 43 | m_impl(new RVNGRawDrawingGeneratorImpl(printCallgraphScore)) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | RVNGRawDrawingGenerator::~RVNGRawDrawingGenerator() |
| 48 | { |
| 49 | if (m_impl->m_printCallgraphScore) |
| 50 | printf("%d\n", (int)m_impl->m_callStack.size() + m_impl->m_callbackMisses); |
| 51 | |
| 52 | delete m_impl; |
| 53 | } |
| 54 | |
| 55 | void RVNGRawDrawingGenerator::startDocument(const librevenge::RVNGPropertyList &propList) |
| 56 | { |
| 57 | RVNG_CALLGRAPH_ENTER(("startDocument(%s)\n", propList.getPropString().cstr()), CALLBACK_START_DOCUMENT); |
| 58 | } |
| 59 | |
| 60 | void RVNGRawDrawingGenerator::endDocument() |
| 61 | { |
| 62 | RVNG_CALLGRAPH_LEAVE(("endDocument\n"), CALLBACK_START_DOCUMENT); |
| 63 | } |
| 64 | |
| 65 | void RVNGRawDrawingGenerator::setDocumentMetaData(const librevenge::RVNGPropertyList &propList) |
| 66 | { |
| 67 | if (m_impl->m_printCallgraphScore) |
| 68 | return; |
| 69 | |
| 70 | m_impl->iprintf("setDocumentMetaData(%s)\n", propList.getPropString().cstr()); |
| 71 | } |
| 72 | |
| 73 | void RVNGRawDrawingGenerator::defineEmbeddedFont(const librevenge::RVNGPropertyList &propList) |
| 74 | { |
| 75 | if (m_impl->m_printCallgraphScore) |
| 76 | return; |
| 77 | |
| 78 | m_impl->iprintf("defineEmbeddedFont(%s)\n", propList.getPropString().cstr()); |
| 79 | } |
| 80 | |
| 81 | void RVNGRawDrawingGenerator::startPage(const RVNGPropertyList &propList) |
| 82 | { |
| 83 | RVNG_CALLGRAPH_ENTER(("startPage(%s)\n", propList.getPropString().cstr()), CALLBACK_START_PAGE); |
| 84 | } |
| 85 | |
| 86 | void RVNGRawDrawingGenerator::endPage() |
| 87 | { |
| 88 | RVNG_CALLGRAPH_LEAVE(("endPage\n"), CALLBACK_START_PAGE); |
| 89 | } |
| 90 | |
| 91 | void RVNGRawDrawingGenerator::startMasterPage(const RVNGPropertyList &propList) |
| 92 | { |
| 93 | RVNG_CALLGRAPH_ENTER(("startMasterPage(%s)\n", propList.getPropString().cstr()), CALLBACK_START_MASTER_PAGE); |
| 94 | } |
| 95 | |
| 96 | void RVNGRawDrawingGenerator::endMasterPage() |
| 97 | { |
| 98 | RVNG_CALLGRAPH_LEAVE(("endMasterPage\n"), CALLBACK_START_MASTER_PAGE); |
| 99 | } |
| 100 | |
| 101 | void RVNGRawDrawingGenerator::startLayer(const RVNGPropertyList &propList) |
| 102 | { |
| 103 | RVNG_CALLGRAPH_ENTER(("startLayer (%s)\n", propList.getPropString().cstr()), CALLBACK_START_LAYER); |
| 104 | } |
| 105 | |
| 106 | void RVNGRawDrawingGenerator::endLayer() |
| 107 | { |
| 108 | RVNG_CALLGRAPH_LEAVE(("endLayer\n"), CALLBACK_START_LAYER); |
| 109 | } |
| 110 | |
| 111 | void RVNGRawDrawingGenerator::startEmbeddedGraphics(const RVNGPropertyList &propList) |
| 112 | { |
| 113 | RVNG_CALLGRAPH_ENTER(("startEmbeddedGraphics (%s)\n", propList.getPropString().cstr()), CALLBACK_START_EMBEDDED_GRAPHICS); |
| 114 | } |
| 115 | |
| 116 | void RVNGRawDrawingGenerator::endEmbeddedGraphics() |
| 117 | { |
| 118 | RVNG_CALLGRAPH_LEAVE(("endEmbeddedGraphics \n"), CALLBACK_START_EMBEDDED_GRAPHICS); |
| 119 | } |
| 120 | |
| 121 | void RVNGRawDrawingGenerator::openGroup(const RVNGPropertyList &propList) |
| 122 | { |
| 123 | RVNG_CALLGRAPH_ENTER(("openGroup(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_GROUP); |
| 124 | } |
| 125 | |
| 126 | void RVNGRawDrawingGenerator::closeGroup() |
| 127 | { |
| 128 | RVNG_CALLGRAPH_LEAVE(("closeGroup\n"), CALLBACK_OPEN_GROUP); |
| 129 | } |
| 130 | |
| 131 | void RVNGRawDrawingGenerator::setStyle(const RVNGPropertyList &propList) |
| 132 | { |
| 133 | if (m_impl->m_printCallgraphScore) |
| 134 | return; |
| 135 | |
| 136 | m_impl->iprintf("setStyle(%s)\n", propList.getPropString().cstr()); |
| 137 | } |
| 138 | |
| 139 | void RVNGRawDrawingGenerator::drawRectangle(const RVNGPropertyList &propList) |
| 140 | { |
| 141 | if (m_impl->m_printCallgraphScore) |
| 142 | return; |
| 143 | |
| 144 | m_impl->iprintf("drawRectangle (%s)\n", propList.getPropString().cstr()); |
| 145 | } |
| 146 | |
| 147 | void RVNGRawDrawingGenerator::drawEllipse(const RVNGPropertyList &propList) |
| 148 | { |
| 149 | if (m_impl->m_printCallgraphScore) |
| 150 | return; |
| 151 | |
| 152 | m_impl->iprintf("drawEllipse (%s)\n", propList.getPropString().cstr()); |
| 153 | } |
| 154 | |
| 155 | void RVNGRawDrawingGenerator::drawPolyline(const RVNGPropertyList &propList) |
| 156 | { |
| 157 | if (m_impl->m_printCallgraphScore) |
| 158 | return; |
| 159 | |
| 160 | m_impl->iprintf("drawPolyline (%s)\n", propList.getPropString().cstr()); |
| 161 | } |
| 162 | |
| 163 | void RVNGRawDrawingGenerator::drawPolygon(const RVNGPropertyList &propList) |
| 164 | { |
| 165 | if (m_impl->m_printCallgraphScore) |
| 166 | return; |
| 167 | |
| 168 | m_impl->iprintf("drawPolygon (%s)\n", propList.getPropString().cstr()); |
| 169 | } |
| 170 | |
| 171 | void RVNGRawDrawingGenerator::drawPath(const RVNGPropertyList &propList) |
| 172 | { |
| 173 | if (m_impl->m_printCallgraphScore) |
| 174 | return; |
| 175 | |
| 176 | m_impl->iprintf("drawPath (%s)\n", propList.getPropString().cstr()); |
| 177 | } |
| 178 | |
| 179 | void RVNGRawDrawingGenerator::drawGraphicObject(const RVNGPropertyList &propList) |
| 180 | { |
| 181 | if (m_impl->m_printCallgraphScore) |
| 182 | return; |
| 183 | |
| 184 | m_impl->iprintf("drawGraphicObject (%s)\n", propList.getPropString().cstr()); |
| 185 | } |
| 186 | |
| 187 | void RVNGRawDrawingGenerator::drawConnector(const RVNGPropertyList &propList) |
| 188 | { |
| 189 | if (m_impl->m_printCallgraphScore) |
| 190 | return; |
| 191 | |
| 192 | m_impl->iprintf("drawConnector(%s)\n", propList.getPropString().cstr()); |
| 193 | } |
| 194 | |
| 195 | void RVNGRawDrawingGenerator::startTextObject(const RVNGPropertyList &propList) |
| 196 | { |
| 197 | RVNG_CALLGRAPH_ENTER(("startTextObject (%s)\n", propList.getPropString().cstr()), CALLBACK_START_TEXT_OBJECT); |
| 198 | } |
| 199 | |
| 200 | void RVNGRawDrawingGenerator::endTextObject() |
| 201 | { |
| 202 | RVNG_CALLGRAPH_LEAVE(("endTextObject\n"), CALLBACK_START_TEXT_OBJECT); |
| 203 | } |
| 204 | |
| 205 | void RVNGRawDrawingGenerator::openOrderedListLevel(const librevenge::RVNGPropertyList &propList) |
| 206 | { |
| 207 | RVNG_CALLGRAPH_ENTER(("openOrderedListLevel(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_ORDERED_LIST_LEVEL); |
| 208 | } |
| 209 | |
| 210 | void RVNGRawDrawingGenerator::closeOrderedListLevel() |
| 211 | { |
| 212 | RVNG_CALLGRAPH_LEAVE(("closeOrderedListLevel\n"), CALLBACK_OPEN_ORDERED_LIST_LEVEL); |
| 213 | } |
| 214 | |
| 215 | void RVNGRawDrawingGenerator::openUnorderedListLevel(const librevenge::RVNGPropertyList &propList) |
| 216 | { |
| 217 | RVNG_CALLGRAPH_ENTER(("openUnorderedListLevel(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_UNORDERED_LIST_LEVEL); |
| 218 | } |
| 219 | |
| 220 | void RVNGRawDrawingGenerator::closeUnorderedListLevel() |
| 221 | { |
| 222 | RVNG_CALLGRAPH_LEAVE(("closeUnorderedListLevel\n"), CALLBACK_OPEN_UNORDERED_LIST_LEVEL); |
| 223 | } |
| 224 | |
| 225 | void RVNGRawDrawingGenerator::openListElement(const librevenge::RVNGPropertyList &propList) |
| 226 | { |
| 227 | RVNG_CALLGRAPH_ENTER(("openListElement(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_LIST_ELEMENT); |
| 228 | } |
| 229 | |
| 230 | void RVNGRawDrawingGenerator::closeListElement() |
| 231 | { |
| 232 | RVNG_CALLGRAPH_LEAVE(("closeListElement\n"), CALLBACK_OPEN_LIST_ELEMENT); |
| 233 | } |
| 234 | |
| 235 | void RVNGRawDrawingGenerator::defineParagraphStyle(const RVNGPropertyList &propList) |
| 236 | { |
| 237 | m_impl->iprintf("defineParagraphStyle(%s)\n", propList.getPropString().cstr()); |
| 238 | } |
| 239 | |
| 240 | void RVNGRawDrawingGenerator::openParagraph(const RVNGPropertyList &propList) |
| 241 | { |
| 242 | RVNG_CALLGRAPH_ENTER(("openParagraph (%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_PARAGRAPH); |
| 243 | } |
| 244 | |
| 245 | void RVNGRawDrawingGenerator::closeParagraph() |
| 246 | { |
| 247 | RVNG_CALLGRAPH_LEAVE(("closeParagraph\n"), CALLBACK_OPEN_PARAGRAPH); |
| 248 | } |
| 249 | |
| 250 | void RVNGRawDrawingGenerator::defineCharacterStyle(const RVNGPropertyList &propList) |
| 251 | { |
| 252 | m_impl->iprintf("defineCharacterStyle(%s)\n", propList.getPropString().cstr()); |
| 253 | } |
| 254 | |
| 255 | void RVNGRawDrawingGenerator::openSpan(const RVNGPropertyList &propList) |
| 256 | { |
| 257 | RVNG_CALLGRAPH_ENTER(("openSpan(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_SPAN); |
| 258 | } |
| 259 | |
| 260 | void RVNGRawDrawingGenerator::closeSpan() |
| 261 | { |
| 262 | RVNG_CALLGRAPH_LEAVE(("closeSpan\n"), CALLBACK_OPEN_SPAN); |
| 263 | } |
| 264 | |
| 265 | void RVNGRawDrawingGenerator::openLink(const RVNGPropertyList &propList) |
| 266 | { |
| 267 | RVNG_CALLGRAPH_ENTER(("openLink(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_LINK); |
| 268 | } |
| 269 | |
| 270 | void RVNGRawDrawingGenerator::closeLink() |
| 271 | { |
| 272 | RVNG_CALLGRAPH_LEAVE(("closeLink\n"), CALLBACK_OPEN_LINK); |
| 273 | } |
| 274 | |
| 275 | void RVNGRawDrawingGenerator::insertTab() |
| 276 | { |
| 277 | if (m_impl->m_printCallgraphScore) |
| 278 | return; |
| 279 | |
| 280 | m_impl->iprintf("insertTab\n"); |
| 281 | } |
| 282 | |
| 283 | void RVNGRawDrawingGenerator::insertSpace() |
| 284 | { |
| 285 | if (m_impl->m_printCallgraphScore) |
| 286 | return; |
| 287 | |
| 288 | m_impl->iprintf("insertSpace\n"); |
| 289 | } |
| 290 | |
| 291 | void RVNGRawDrawingGenerator::insertText(const RVNGString &str) |
| 292 | { |
| 293 | if (m_impl->m_printCallgraphScore) |
| 294 | return; |
| 295 | |
| 296 | m_impl->iprintf("insertText (%s)\n", str.cstr()); |
| 297 | } |
| 298 | |
| 299 | void RVNGRawDrawingGenerator::insertLineBreak() |
| 300 | { |
| 301 | if (m_impl->m_printCallgraphScore) |
| 302 | return; |
| 303 | |
| 304 | m_impl->iprintf("insertLineBreak\n"); |
| 305 | } |
| 306 | |
| 307 | void RVNGRawDrawingGenerator::insertField(const librevenge::RVNGPropertyList &propList) |
| 308 | { |
| 309 | if (m_impl->m_printCallgraphScore) |
| 310 | return; |
| 311 | |
| 312 | m_impl->iprintf("insertField(%s)\n", propList.getPropString().cstr()); |
| 313 | } |
| 314 | |
| 315 | void RVNGRawDrawingGenerator::startTableObject(const RVNGPropertyList &propList) |
| 316 | { |
| 317 | RVNG_CALLGRAPH_ENTER(("startTableObject(%s)\n", propList.getPropString().cstr()), CALLBACK_OPEN_TABLE); |
| 318 | } |
| 319 | |
| 320 | void RVNGRawDrawingGenerator::openTableRow(const RVNGPropertyList &propList) |
| 321 | { |
| 322 | RVNG_CALLGRAPH_ENTER(("openTableRow(%s)\n", propList.getPropString().cstr()), |
| 323 | CALLBACK_OPEN_TABLE_ROW); |
| 324 | } |
| 325 | |
| 326 | void RVNGRawDrawingGenerator::closeTableRow() |
| 327 | { |
| 328 | RVNG_CALLGRAPH_LEAVE(("closeTableRow()\n"), CALLBACK_OPEN_TABLE_ROW); |
| 329 | } |
| 330 | |
| 331 | void RVNGRawDrawingGenerator::openTableCell(const RVNGPropertyList &propList) |
| 332 | { |
| 333 | RVNG_CALLGRAPH_ENTER(("openTableCell(%s)\n", propList.getPropString().cstr()), |
| 334 | CALLBACK_OPEN_TABLE_CELL); |
| 335 | } |
| 336 | |
| 337 | void RVNGRawDrawingGenerator::closeTableCell() |
| 338 | { |
| 339 | RVNG_CALLGRAPH_LEAVE(("closeTableCell()\n"), CALLBACK_OPEN_TABLE_CELL); |
| 340 | } |
| 341 | |
| 342 | void RVNGRawDrawingGenerator::insertCoveredTableCell(const RVNGPropertyList &propList) |
| 343 | { |
| 344 | if (m_impl->m_printCallgraphScore) |
| 345 | return; |
| 346 | |
| 347 | m_impl->iprintf("insertCoveredTableCell(%s)\n", propList.getPropString().cstr()); |
| 348 | } |
| 349 | |
| 350 | void RVNGRawDrawingGenerator::endTableObject() |
| 351 | { |
| 352 | RVNG_CALLGRAPH_LEAVE(("endTableObject()\n"), CALLBACK_OPEN_TABLE); |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |