Coverage Report

Created: 2026-10-28 06:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libetonyek/src/lib/contexts/IWORKTextBodyElement.cpp
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/*
3
 * This file is part of the libetonyek project.
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
10
#include "IWORKTextBodyElement.h"
11
12
#include "IWORKCollector.h"
13
#include "IWORKDictionary.h"
14
#include "IWORKLayoutElement.h"
15
#include "IWORKPElement.h"
16
#include "IWORKText.h"
17
#include "IWORKToken.h"
18
#include "IWORKXMLParserState.h"
19
20
namespace libetonyek
21
{
22
23
IWORKTextBodyElement::IWORKTextBodyElement(IWORKXMLParserState &state)
24
0
  : IWORKXMLElementContextBase(state)
25
0
  , m_layout(false)
26
0
  , m_para(false)
27
0
{
28
0
}
29
30
IWORKXMLContextPtr_t IWORKTextBodyElement::element(const int name)
31
0
{
32
0
  switch (name)
33
0
  {
34
0
  case +IWORKToken::NS_URI_SF | IWORKToken::layout :
35
0
    if (m_layout || m_para)
36
0
    {
37
0
      ETONYEK_DEBUG_MSG(("IWORKTextBodyElement::element: layout following another element, not allowed, skipping\n"));
38
0
    }
39
0
    else
40
0
    {
41
0
      m_layout = true;
42
0
      return std::make_shared<IWORKLayoutElement>(getState());
43
0
    }
44
0
    break;
45
0
  case +IWORKToken::NS_URI_SF | IWORKToken::p :
46
0
    if (m_layout)
47
0
    {
48
0
      ETONYEK_DEBUG_MSG(("IWORKTextBodyElement::element: paragraph following layout, not allowed, skipping\n"));
49
0
    }
50
0
    else if (m_para)
51
0
    {
52
0
      return std::make_shared<IWORKPElement>(getState());
53
0
    }
54
0
    else
55
0
    {
56
0
      m_para = true;
57
0
      return std::make_shared<IWORKPElement>(getState());
58
0
    }
59
0
    break;
60
0
  case +IWORKToken::NS_URI_SF | IWORKToken::insertion_point :
61
0
  case +IWORKToken::NS_URI_SF | IWORKToken::page_start : // with attribute page-index
62
0
  case +IWORKToken::NS_URI_SF | IWORKToken::selection_end :
63
0
    break;
64
0
  default:
65
0
    ETONYEK_DEBUG_MSG(("IWORKTextBodyElement::element: find some unknown element\n"));
66
0
  }
67
68
0
  return IWORKXMLContextPtr_t();
69
0
}
70
71
void IWORKTextBodyElement::endOfElement()
72
0
{
73
0
  if (bool(getState().m_currentText))
74
0
    getState().m_currentText->flushList();
75
0
}
76
77
}
78
79
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */