<commit_before>/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libfreehand project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <librevenge/librevenge.h>
#include "FHCollector.h"

libfreehand::FHCollector::FHCollector(librevenge::RVNGDrawingInterface *painter, const FHPageInfo &pageInfo) :
  m_painter(painter), m_pageInfo(pageInfo), m_transforms()
{
  librevenge::RVNGPropertyList propList;
  propList.insert("svg:height", m_pageInfo.m_maxY - m_pageInfo.m_minY);
  propList.insert("svg:width", m_pageInfo.m_maxX - m_pageInfo.m_minX);
  m_painter->startPage(propList);
}

libfreehand::FHCollector::~FHCollector()
{
  m_painter->endPage();
}

void libfreehand::FHCollector::collectUString(unsigned /* recordId */, const std::vector<unsigned short> & /* ustr */)
{
}

void libfreehand::FHCollector::collectMName(unsigned /* recordId */, const librevenge::RVNGString & /* name */)
{
}

void libfreehand::FHCollector::collectPath(unsigned /* recordId */, unsigned short /* graphicStyle */,
    unsigned short /* layer */, unsigned short xform, const libfreehand::FHPath &path, bool /* evenOdd */)
{
  if (path.empty())
    return;
  FHPath fhPath(path);
  if (xform)
  {<commit_msg>Add startDocument and endDocument calls<commit_after>/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libfreehand project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <librevenge/librevenge.h>
#include "FHCollector.h"

libfreehand::FHCollector::FHCollector(librevenge::RVNGDrawingInterface *painter, const FHPageInfo &pageInfo) :
  m_painter(painter), m_pageInfo(pageInfo), m_transforms()
{
  librevenge::RVNGPropertyList propList;
  propList.insert("svg:height", m_pageInfo.m_maxY - m_pageInfo.m_minY);
  propList.insert("svg:width", m_pageInfo.m_maxX - m_pageInfo.m_minX);
  m_painter->startDocument(librevenge::RVNGPropertyList());
  m_painter->startPage(propList);
}

libfreehand::FHCollector::~FHCollector()
{
  m_painter->endPage();
  m_painter->endDocument();
}

void libfreehand::FHCollector::collectUString(unsigned /* recordId */, const std::vector<unsigned short> & /* ustr */)
{
}

void libfreehand::FHCollector::collectMName(unsigned /* recordId */, const librevenge::RVNGString & /* name */)
{
}

void libfreehand::FHCollector::collectPath(unsigned /* recordId */, unsigned short /* graphicStyle */,
    unsigned short /* layer */, unsigned short xform, const libfreehand::FHPath &path, bool /* evenOdd */)
{
  if (path.empty())
    return;
  FHPath fhPath(path);
  if (xform)
  {
{'fraction_non_alphanumeric': 0.14789687924016282, 'fraction_numerical': 0.004070556309362279, 'mean_word_length': 4.8396039603960395, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '777596', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1008, 'n_words': 228}