10 #ifndef QXPCONTENTCOLLECTOR_H_INCLUDED 11 #define QXPCONTENTCOLLECTOR_H_INCLUDED 15 #include <unordered_map> 18 #include <type_traits> 43 void collectLine(
const std::shared_ptr<Line> &line)
override;
44 void collectBox(
const std::shared_ptr<Box> &box)
override;
46 void collectTextPath(
const std::shared_ptr<TextPath> &textPath)
override;
47 void collectGroup(
const std::shared_ptr<Group> &group)
override;
49 void collectText(
const std::shared_ptr<Text> &text,
const unsigned linkId)
override;
57 template<
typename T,
typename TThis>
67 virtual unsigned zIndex()
const = 0;
68 virtual void setZIndex(
unsigned value) = 0;
74 static_assert(std::is_base_of<Object, T>::value,
"T is not Object");
76 const std::shared_ptr<T>
object;
79 : object(obj), m_handler(handler), m_isProcessed(false)
86 m_handler(
object, page);
93 return object->zIndex;
98 object->zIndex = value;
109 std::vector<std::shared_ptr<CollectedObject<Group>>>
groups;
111 std::vector<std::shared_ptr<CollectedObjectInterface>>
objects;
114 : settings(pageSettings), groups(), linkedTextObjects(), objects()
117 double getX(
const double x)
const;
118 double getX(
const std::shared_ptr<Object> &obj)
const;
119 double getY(
const double y)
const;
120 double getY(
const std::shared_ptr<Object> &obj)
const;
141 auto collectedObj = std::make_shared<CollectedObject<T>>(obj, std::bind(handler,
this, std::placeholders::_1, std::placeholders::_2));
146 void draw(
bool force =
false);
163 void writeFill(librevenge::RVNGPropertyList &propList,
const boost::optional<Fill> &fill);
164 void writeFrame(librevenge::RVNGPropertyList &propList,
const Frame &frame,
const bool runaround,
const bool allowHairline =
false);
169 #endif // QXPCONTENTCOLLECTOR_H_INCLUDED std::unordered_map< unsigned, std::shared_ptr< Text > > m_linkTextMap
Definition: QXPContentCollector.h:131
Definition: QXPContentCollector.h:60
void startPage(const Page &page) override
Definition: QXPContentCollector.cpp:335
Definition: QXPContentCollector.h:106
void drawOval(const std::shared_ptr< Box > &oval, const CollectedPage &page)
Definition: QXPContentCollector.cpp:626
void drawPolygon(const std::shared_ptr< Box > &polygon, const CollectedPage &page)
Definition: QXPContentCollector.cpp:650
void drawTextPath(const std::shared_ptr< TextPath > &textPath, const CollectedPage &page)
Definition: QXPContentCollector.cpp:756
std::vector< CollectedPage > m_unprocessedPages
Definition: QXPContentCollector.h:129
QXPContentCollector & operator=(const QXPContentCollector &other)=delete
std::unordered_map< unsigned, std::unordered_map< unsigned, std::shared_ptr< TextObject > > > m_linkIndexedTextObjectsMap
Definition: QXPContentCollector.h:132
Definition: libqxp_utils.cpp:24
void collectTextPath(const std::shared_ptr< TextPath > &textPath) override
Definition: QXPContentCollector.cpp:378
void collectTextBox(const std::shared_ptr< TextBox > &box) override
Definition: QXPContentCollector.cpp:366
~QXPContentCollector()
Definition: QXPContentCollector.cpp:301
void collectGroup(const std::shared_ptr< Group > &group) override
Definition: QXPContentCollector.cpp:390
void drawRectangle(const std::shared_ptr< Box > &box, const CollectedPage &page)
Definition: QXPContentCollector.cpp:591
virtual unsigned zIndex() const =0
std::function< void(const std::shared_ptr< T > &obj, const CollectedPage &)> ObjectHandler
Definition: QXPContentCollector.h:55
Definition: QXPTypes.h:361
Definition: QXPTypes.h:560
QXPDocumentProperties m_docProps
Definition: QXPContentCollector.h:134
virtual void setZIndex(unsigned value)=0
Definition: QXPTypes.h:536
Definition: QXPTypes.h:24
librevenge::RVNGDrawingInterface * m_painter
Definition: QXPContentCollector.h:124
void collectText(const std::shared_ptr< Text > &text, const unsigned linkId) override
Definition: QXPContentCollector.cpp:397
unsigned zIndex() const override
Definition: QXPContentCollector.h:91
virtual void draw(const CollectedPage &page)=0
void endDocument() override
Definition: QXPContentCollector.cpp:319
std::function< void(TThis *, const std::shared_ptr< T > &obj, const CollectedPage &)> ObjectHandlerMember
Definition: QXPContentCollector.h:58
void drawText(const std::shared_ptr< Text > &text, const LinkedTextSettings &linkSettings)
Definition: QXPContentCollector.cpp:825
const std::shared_ptr< T > object
Definition: QXPContentCollector.h:74
bool m_isDocumentStarted
Definition: QXPContentCollector.h:126
void collectBox(const std::shared_ptr< Box > &box) override
Definition: QXPContentCollector.cpp:361
std::vector< std::shared_ptr< CollectedObjectInterface > > objects
Definition: QXPContentCollector.h:111
CollectedPage(const PageSettings &pageSettings)
Definition: QXPContentCollector.h:113
std::shared_ptr< CollectedObject< T > > addObject(const std::shared_ptr< T > &obj, const ObjectHandlerMember< T, QXPContentCollector > &handler)
Definition: QXPContentCollector.h:139
void drawTextBox(const std::shared_ptr< TextBox > &textbox, const CollectedPage &page)
Definition: QXPContentCollector.cpp:706
const PageSettings settings
Definition: QXPContentCollector.h:108
void writeFill(librevenge::RVNGPropertyList &propList, const boost::optional< Fill > &fill)
Definition: QXPContentCollector.cpp:1072
std::vector< std::shared_ptr< CollectedObject< Group > > > groups
Definition: QXPContentCollector.h:109
void startDocument() override
Definition: QXPContentCollector.cpp:309
bool m_isCollectingFacingPage
Definition: QXPContentCollector.h:127
bool m_isProcessed
Definition: QXPContentCollector.h:103
CollectedPage & getInsertionPage(const std::shared_ptr< Object > &obj)
Definition: QXPContentCollector.cpp:414
std::vector< std::shared_ptr< TextObject > > linkedTextObjects
Definition: QXPContentCollector.h:110
void drawBox(const std::shared_ptr< Box > &box, const CollectedPage &page)
Definition: QXPContentCollector.cpp:571
void drawLine(const std::shared_ptr< Line > &line, const CollectedPage &page)
Definition: QXPContentCollector.cpp:529
Definition: QXPContentCollector.h:25
void collectDocumentProperties(const QXPDocumentProperties &props) override
Definition: QXPContentCollector.cpp:351
void writeFrame(librevenge::RVNGPropertyList &propList, const Frame &frame, const bool runaround, const bool allowHairline=false)
Definition: QXPContentCollector.cpp:1083
CollectedObject(const std::shared_ptr< T > &obj, const ObjectHandler< T > &handler)
Definition: QXPContentCollector.h:78
virtual ~CollectedObjectInterface()=default
void collectTextObject(const std::shared_ptr< TextObject > &textObj, CollectedPage &page)
Definition: QXPContentCollector.cpp:472
void drawBezierBox(const std::shared_ptr< Box > &box, const CollectedPage &page)
Definition: QXPContentCollector.cpp:676
const ObjectHandler< T > m_handler
Definition: QXPContentCollector.h:102
void drawGroup(const std::shared_ptr< Group > &group, const CollectedPage &page)
Definition: QXPContentCollector.cpp:1041
void setZIndex(unsigned value) override
Definition: QXPContentCollector.h:96
Definition: QXPTypes.h:545
Definition: QXPContentCollector.h:72
void endPage() override
Definition: QXPContentCollector.cpp:345
void collectLine(const std::shared_ptr< Line > &line) override
Definition: QXPContentCollector.cpp:356
void updateLinkedTexts()
Definition: QXPContentCollector.cpp:494
QXPContentCollector(const QXPContentCollector &other)=delete
void draw(const CollectedPage &page) override
Definition: QXPContentCollector.h:82
Definition: QXPTypes.h:344
bool hasUnfinishedLinkedTexts()
Definition: QXPContentCollector.cpp:513
Definition: QXPCollector.h:27