KEYText.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libetonyek project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef KEYTEXT_H_INCLUDED
00011 #define KEYTEXT_H_INCLUDED
00012 
00013 #include <deque>
00014 
00015 #include "KEYObject.h"
00016 #include "KEYStyles_fwd.h"
00017 #include "KEYText_fwd.h"
00018 
00019 namespace libetonyek
00020 {
00021 
00022 class KEYText
00023 {
00024   struct Paragraph;
00025   typedef boost::shared_ptr<Paragraph> ParagraphPtr_t;
00026 
00027 public:
00028   typedef std::deque<ParagraphPtr_t> ParagraphList_t;
00029 
00030 public:
00031   explicit KEYText(bool object = true);
00032 
00033   void setLayoutStyle(const KEYLayoutStylePtr_t &style);
00034 
00035   const KEYGeometryPtr_t &getBoundingBox() const;
00036   void setBoundingBox(const KEYGeometryPtr_t &boundingBox);
00037 
00038   void openParagraph(const KEYParagraphStylePtr_t &style);
00039   void closeParagraph();
00040 
00041   void insertText(const std::string &text, const KEYCharacterStylePtr_t &style);
00042   void insertTab();
00043   void insertLineBreak();
00044 
00045   const KEYLayoutStylePtr_t &getLayoutStyle() const;
00046   const ParagraphList_t &getParagraphs() const;
00047   bool isObject() const;
00048 
00049   bool empty() const;
00050 
00051 private:
00052   void insertDeferredLineBreaks();
00053 
00054 private:
00055   KEYLayoutStylePtr_t m_layoutStyle;
00056   ParagraphList_t m_paragraphs;
00057   ParagraphPtr_t m_currentParagraph;
00058   int m_lineBreaks;
00059   const bool m_object;
00060 
00061   KEYGeometryPtr_t m_boundingBox;
00062 };
00063 
00064 KEYObjectPtr_t makeObject(const KEYTextPtr_t &text);
00065 
00066 }
00067 
00068 #endif // KEYTEXT_H_INCLUDED
00069 
00070 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */