- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

IWORKText.h
Go to the documentation of this file.
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 #ifndef IWORKTEXT_H_INCLUDED
11 #define IWORKTEXT_H_INCLUDED
12
13 #include "IWORKText_fwd.h"
14
15 #include <deque>
16 #include <stack>
17
18 #include <glm/glm.hpp>
19
20 #include <librevenge/librevenge.h>
21
22 #include "IWORKStyle_fwd.h"
23 #include "IWORKStyleStack.h"
24 #include "IWORKOutputElements.h"
25
26 namespace libetonyek
27 {
28
29 class IWORKLanguageManager;
30 class IWORKTextRecorder;
31
32 class IWORKText
33 {
34 public:
35 IWORKText(const IWORKLanguageManager &langManager, bool discardEmptyContent);
36 ~IWORKText();
37
38 void setRecorder(const boost::shared_ptr<IWORKTextRecorder> &recorder);
39 const boost::shared_ptr<IWORKTextRecorder> &getRecorder() const;
40
42 void pushBaseLayoutStyle(const IWORKStylePtr_t &style);
44 void pushBaseParagraphStyle(const IWORKStylePtr_t &style);
45
47 void setLayoutStyle(const IWORKStylePtr_t &style);
49 void flushLayout();
50
52 void setListStyle(const IWORKStylePtr_t &style);
54 void setListLevel(const unsigned level);
56 void flushList();
57
59 void setParagraphStyle(const IWORKStylePtr_t &style);
61 void flushParagraph();
62
64 void setSpanStyle(const IWORKStylePtr_t &style);
66 void setLanguage(const IWORKStylePtr_t &style);
68 void flushSpan();
69
70 void openLink(const std::string &url);
71 void closeLink();
72
73 void insertText(const std::string &text);
74 void insertTab();
75 void insertSpace();
76 void insertLineBreak();
77
78 void insertInlineContent(const IWORKOutputElements &elements);
79 void insertBlockContent(const IWORKOutputElements &elements);
80
81 bool empty() const;
82
83 void draw(IWORKOutputElements &elements);
84
85 private:
86 void openSection();
87 void closeSection();
88 bool needsSection() const;
89
90 void handleListLevelChange(unsigned level);
91
92 void openPara();
93 void closePara();
94 void fillParaPropList(librevenge::RVNGPropertyList &propList);
95
96 void openSpan();
97 void closeSpan();
98
99 private:
100 const IWORKLanguageManager &m_langManager;
101
102 IWORKStyleStack m_layoutStyleStack;
103 IWORKStyleStack m_paraStyleStack;
104
105 IWORKOutputElements m_elements;
106
107 IWORKStylePtr_t m_layoutStyle;
108 bool m_inSection;
109 mutable librevenge::RVNGPropertyList m_sectionProps;
110 mutable bool m_checkedSection;
111
112 IWORKStylePtr_t m_listStyle;
113 unsigned m_listLevel;
114 unsigned m_inListLevel;
116 std::stack<bool> m_isOrderedStack;
117
118 IWORKStylePtr_t m_paraStyle;
119 bool m_inPara;
120 bool m_ignoreEmptyPara;
121
122 IWORKStylePtr_t m_spanStyle;
123 IWORKStylePtr_t m_langStyle;
124 bool m_spanStyleChanged;
125 bool m_inSpan;
126
127 IWORKStylePtr_t m_oldSpanStyle;
128
129 boost::shared_ptr<IWORKTextRecorder> m_recorder;
130 };
131
132 }
133
134 #endif // IWORKTEXT_H_INCLUDED
135
136 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
IWORKStyle_fwd.h
libetonyek::IWORKText::closeLink
void closeLink()
Definition: IWORKText.cpp:679
libetonyek
Definition: IWORKBezierElement.cpp:18
libetonyek::IWORKText::m_isOrderedStack
std::stack< bool > m_isOrderedStack
Saves info about the currently opened list levels being ordered or unordered.
Definition: IWORKText.h:116
libetonyek::IWORKText::setLanguage
void setLanguage(const IWORKStylePtr_t &style)
Set language used for the next span.
Definition: IWORKText.cpp:632
libetonyek::IWORKOutputElements
Definition: IWORKOutputElements.h:30
libetonyek::IWORKText::closeSection
void closeSection()
Definition: IWORKText.cpp:547
libetonyek::IWORKText::openSection
void openSection()
Definition: IWORKText.cpp:535
IWORKOutputElements.h
libetonyek::IWORKText::m_paraStyleStack
IWORKStyleStack m_paraStyleStack
Definition: IWORKText.h:103
libetonyek::IWORKText::closeSpan
void closeSpan()
Definition: IWORKText.cpp:875
libetonyek::IWORKStylePtr_t
boost::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
libetonyek::IWORKText
Definition: IWORKText.h:32
libetonyek::IWORKStyleStack
Representation of a dynamic inheritance of styles.
Definition: IWORKStyleStack.h:34
libetonyek::IWORKText::flushLayout
void flushLayout()
Flush the current layout.
Definition: IWORKText.cpp:523
libetonyek::IWORKText::handleListLevelChange
void handleListLevelChange(unsigned level)
Definition: IWORKText.cpp:777
libetonyek::IWORKText::m_langManager
const IWORKLanguageManager & m_langManager
Definition: IWORKText.h:100
libetonyek::IWORKText::fillParaPropList
void fillParaPropList(librevenge::RVNGPropertyList &propList)
Definition: IWORKText.cpp:848
libetonyek::IWORKText::openSpan
void openSpan()
Definition: IWORKText.cpp:855
libetonyek::IWORKToken::text
Definition: IWORKToken.h:270
libetonyek::IWORKText::m_layoutStyleStack
IWORKStyleStack m_layoutStyleStack
Definition: IWORKText.h:102
libetonyek::IWORKText::m_oldSpanStyle
IWORKStylePtr_t m_oldSpanStyle
Definition: IWORKText.h:127
libetonyek::IWORKText::m_ignoreEmptyPara
bool m_ignoreEmptyPara
Definition: IWORKText.h:120
libetonyek::IWORKText::setListLevel
void setListLevel(const unsigned level)
Set the list level of the next paragraph, 0 meaning no list.
Definition: IWORKText.cpp:570
libetonyek::IWORKText::empty
bool empty() const
Definition: IWORKText.cpp:772
libetonyek::IWORKToken::style
Definition: IWORKToken.h:254
libetonyek::IWORKText::m_inPara
bool m_inPara
Definition: IWORKText.h:119
libetonyek::IWORKText::insertText
void insertText(const std::string &text)
Definition: IWORKText.cpp:695
libetonyek::IWORKText::m_paraStyle
IWORKStylePtr_t m_paraStyle
Definition: IWORKText.h:118
libetonyek::IWORKText::insertTab
void insertTab()
Definition: IWORKText.cpp:710
libetonyek::IWORKText::IWORKText
IWORKText(const IWORKLanguageManager &langManager, bool discardEmptyContent)
Definition: IWORKText.cpp:446
libetonyek::IWORKText::needsSection
bool needsSection() const
Definition: IWORKText.cpp:883
libetonyek::IWORKText::flushSpan
void flushSpan()
Flush the current span.
Definition: IWORKText.cpp:644
libetonyek::KEY1Token::level
Definition: KEY1Token.h:133
libetonyek::IWORKText::m_sectionProps
librevenge::RVNGPropertyList m_sectionProps
Definition: IWORKText.h:109
libetonyek::IWORKText::getRecorder
const boost::shared_ptr< IWORKTextRecorder > & getRecorder() const
Definition: IWORKText.cpp:483
libetonyek::IWORKText::insertInlineContent
void insertInlineContent(const IWORKOutputElements &elements)
Definition: IWORKText.cpp:755
libetonyek::IWORKText::setSpanStyle
void setSpanStyle(const IWORKStylePtr_t &style)
Set style used for the next span.
Definition: IWORKText.cpp:620
libetonyek::IWORKText::openLink
void openLink(const std::string &url)
Definition: IWORKText.cpp:656
libetonyek::IWORKText::setRecorder
void setRecorder(const boost::shared_ptr< IWORKTextRecorder > &recorder)
Definition: IWORKText.cpp:478
libetonyek::IWORKText::pushBaseLayoutStyle
void pushBaseLayoutStyle(const IWORKStylePtr_t &style)
Set style used as base for all layout styles in this text.
Definition: IWORKText.cpp:488
libetonyek::IWORKText::m_inSection
bool m_inSection
Definition: IWORKText.h:108
libetonyek::IWORKText::insertBlockContent
void insertBlockContent(const IWORKOutputElements &elements)
Definition: IWORKText.cpp:762
libetonyek::IWORKText::setLayoutStyle
void setLayoutStyle(const IWORKStylePtr_t &style)
Set style used for the next layout.
Definition: IWORKText.cpp:510
libetonyek::IWORKText::closePara
void closePara()
Definition: IWORKText.cpp:833
libetonyek::IWORKText::m_langStyle
IWORKStylePtr_t m_langStyle
Definition: IWORKText.h:123
IWORKStyleStack.h
libetonyek::IWORKText::insertLineBreak
void insertLineBreak()
Definition: IWORKText.cpp:740
libetonyek::IWORKText::m_listLevel
unsigned m_listLevel
Definition: IWORKText.h:113
libetonyek::IWORKText::pushBaseParagraphStyle
void pushBaseParagraphStyle(const IWORKStylePtr_t &style)
Set style used as base for all paragraph styles in this text.
Definition: IWORKText.cpp:499
libetonyek::IWORKText::m_inSpan
bool m_inSpan
Definition: IWORKText.h:125
libetonyek::IWORKLanguageManager
Definition: IWORKLanguageManager.h:24
libetonyek::IWORKToken::string
Definition: IWORKToken.h:252
libetonyek::IWORKText::setParagraphStyle
void setParagraphStyle(const IWORKStylePtr_t &style)
Set style used for the next paragraph.
Definition: IWORKText.cpp:592
libetonyek::IWORKText::m_spanStyle
IWORKStylePtr_t m_spanStyle
Definition: IWORKText.h:122
libetonyek::IWORKText::m_elements
IWORKOutputElements m_elements
Definition: IWORKText.h:105
libetonyek::IWORKText::insertSpace
void insertSpace()
Definition: IWORKText.cpp:725
libetonyek::IWORKText::setListStyle
void setListStyle(const IWORKStylePtr_t &style)
Set list style used for the next paragraph, if it is in a list.
Definition: IWORKText.cpp:559
libetonyek::IWORKText::m_layoutStyle
IWORKStylePtr_t m_layoutStyle
Definition: IWORKText.h:107
libetonyek::IWORKText::m_listStyle
IWORKStylePtr_t m_listStyle
Definition: IWORKText.h:112
libetonyek::IWORKText::draw
void draw(IWORKOutputElements &elements)
Definition: IWORKText.cpp:439
libetonyek::IWORKText::m_spanStyleChanged
bool m_spanStyleChanged
Definition: IWORKText.h:124
libetonyek::IWORKText::~IWORKText
~IWORKText()
Definition: IWORKText.cpp:473
IWORKText_fwd.h
libetonyek::IWORKText::openPara
void openPara()
Definition: IWORKText.cpp:816
libetonyek::IWORKText::flushParagraph
void flushParagraph()
Flush the current paragraph.
Definition: IWORKText.cpp:603
libetonyek::IWORKText::m_checkedSection
bool m_checkedSection
Definition: IWORKText.h:110
libetonyek::IWORKText::m_inListLevel
unsigned m_inListLevel
Definition: IWORKText.h:114
libetonyek::IWORKText::m_recorder
boost::shared_ptr< IWORKTextRecorder > m_recorder
Definition: IWORKText.h:129
libetonyek::IWORKText::flushList
void flushList()
Flush the current list level(s).
Definition: IWORKText.cpp:581