40 Option<Id>
GetId()
const;
112 Block(
const Element &el);
114 Block(
const Element &el,
const Id &id_,
int x,
int y,
int w,
int h);
129 const std::vector<std::weak_ptr<TextBlock>>&
GetTextBlocks()
const {
return textBlocks; }
153 Option<StringUTF8>
GetType()
const;
161 Illustration(
const Element &el,
const Id &id_,
int x,
int y,
int w,
int h);
222 Option<StringUTF8>
GetType()
const;
226 std::vector<BlockPtr>
GetBlocks()
const {
return std::vector<BlockPtr>(blocks.begin(), blocks.end()); }
228 const std::vector<std::weak_ptr<TextBlock> >&
GetTextBlocks()
const {
return textBlocks; }
230 const std::vector<std::weak_ptr<Illustration> >&
GetIllustrations()
const {
return illustrations; }
232 const std::vector<std::weak_ptr<GraphicalElement> >&
GetGraphicalElements()
const {
return graphicalElements; }
234 const std::vector<std::weak_ptr<ComposedBlock> >&
GetComposedBlocks()
const {
return composedBlocks; }
240 std::vector<std::shared_ptr<Block> > blocks;
241 std::vector<TextBlockPtr> textBlocks;
242 std::vector<IllustrationPtr> illustrations;
243 std::vector<GraphicalElementPtr> graphicalElements;
244 std::vector<std::weak_ptr<ComposedBlock> > composedBlocks;
258 Space(
const Element &el);
260 Space(
const Element &el,
const Id &id_,
double x,
double y,
double w,
double h);
262 void update_subelements();
264 std::vector<std::shared_ptr<Block> > blocks;
265 std::map<Id, std::weak_ptr<Block> > id_blocks;
266 std::vector<TextBlockPtr> textBlocks;
267 std::map<Id, TextBlockPtr> id_textBlocks;
268 std::vector<IllustrationPtr> illustrations;
269 std::vector<GraphicalElementPtr> graphicalElements;
270 std::vector<ComposedBlockPtr> composedBlocks;
275 #error you cannot include this file directly
void RemoveBlock(const Id &bid)
Removes a block.
Illustration & AddIllustration(const Id &id_, int x, int y, int w, int h)
Adds an illustration in the print space.
TextBlock & AddTextBlockAfter(const Id &pred, const Id &id_, int x, int y, int w, int h)
Adds a text block in the print space.
Option< StringUTF8 > GetType() const
Returns the type of block (table, advertisement…)
const std::vector< ComposedBlockPtr > & GetComposedBlocks() const
Returns the list of composed blocks in the print space.
std::weak_ptr< GraphicalElement > GraphicalElementPtr
Option< Id > GetId() const
Returns the id of the element.
void SetVPos(double d)
Sets the ordinate of the element.
std::weak_ptr< TextBlock > TextBlockPtr
void RemoveStyle(const Id &styleid)
Removes a reference to a style.
std::vector< BlockPtr > GetBlocks() const
Returns the list of subblocks in the block.
int GetHPos() const
Returns the abscissa of the element.
Illustration & AddIllustrationBefore(const Id &next, const Id &id_, int x, int y, int w, int h)
Adds an illustration in the print space.
void SetWidth(int i)
Sets the width of the element.
Illustration(const Illustration &)=default
Option< StringUTF8 > GetFileId() const
Returns a link to an image containing only this illustration.
void RemoveStyle(const Id &styleid)
Adds a reference to a style.
const std::vector< std::weak_ptr< TextBlock > > & GetTextBlocks() const
Returns the list of text blocks in the block.
Block(const Block &)=delete
const std::vector< std::weak_ptr< TextBlock > > & GetTextBlocks() const
Returns the list of text blocks in the print space.
const Id & GetId() const
Returns the id of the element.
std::vector< Id > GetStyles() const
Returns the list of style references.
std::vector< BlockPtr > GetBlocks() const
Returns the list of blocks in the print space.
int GetWidth() const
Returns the width of the element.
void SetHeight(double d)
Sets the height of the element.
const std::vector< std::weak_ptr< GraphicalElement > > & GetGraphicalElements() const
Returns the list of graphical elements in the block.
Option< StringUTF8 > GetType() const
Returns the type of illustration (photo, map, drawing, chart…)
TextBlock & AddTextBlock(const Id &id_, int x, int y, int w, int h)
Adds a text block in the print space.
const std::vector< IllustrationPtr > & GetIllustrations() const
Returns the list of illustrations in the print space.
virtual ~Block() override
A composed block in a space.
GraphicalElement & AddGraphicalElement(const Id &id_, int x, int y, int w, int h)
Adds an graphical element in the print space.
Option< Id > GetNextId() const
Returns the id of the next block.
Base class for blocks in spaces.
int GetVPos() const
Returns the ordinate of the element.
Space(const Space &)=delete
double GetWidth() const
Returns the width of the element.
GraphicalElement & AddGraphicalElementBefore(const Id &next, const Id &id_, int x, int y, int w, int h)
Adds an graphical element in the print space.
virtual ~Illustration() override
void SetHPos(double d)
Sets the abscissa of the element.
ComposedBlock(const ComposedBlock &)=default
GraphicalElement(const GraphicalElement &)=default
TextBlock & GetTextBlock(const Id &id)
Returns a text block contained in the print space.
void SetVPos(int i)
Sets the ordinate of the element.
double GetVPos() const
Returns the ordinate of the element.
const std::vector< std::weak_ptr< Illustration > > & GetIllustrations() const
Returns the list of illustrations in the block.
ComposedBlock & operator=(const ComposedBlock &)=default
void SetWidth(double d)
Sets the width of the element.
Option< StringUTF8 > GetFileId() const
Returns a link to an image containing only this block.
int GetHeight() const
Returns the height of the element.
GraphicalElement & AddGraphicalElementAfter(const Id &pred, const Id &id_, int x, int y, int w, int h)
Adds an graphical element in the print space.
Space & operator=(const Space &)=delete
std::weak_ptr< Block > BlockPtr
Illustration & operator=(const Illustration &)=default
void SetHPos(int i)
Sets the abscissa of the element.
void SetHeight(int i)
Sets the height of the element.
Block & operator=(const Block &)=delete
Block & GetBlock(const Id &bid)
Returns a text block contained in the print space.
const std::vector< std::weak_ptr< ComposedBlock > > & GetComposedBlocks() const
Returns the list of composed blocks in the block.
Option< double > GetRotation() const
Returns the rotation of the object, in degree, counterclockwise.
double GetHeight() const
Returns the height of the element.
virtual ~Space() override
const std::vector< GraphicalElementPtr > & GetGraphicalElements() const
Returns the list of graphical elements in the print space.
GraphicalElement & operator=(const GraphicalElement &)=default
std::weak_ptr< Illustration > IllustrationPtr
Graphical element in a space.
void AddStyle(const Id &styleid)
Adds a reference to a style.
std::vector< Id > GetStyles() const
Returns the list of style references.
virtual ~ComposedBlock() override
virtual ~GraphicalElement() override
Illustration & AddIllustrationAfter(const Id &pred, const Id &id_, int x, int y, int w, int h)
Adds an illustration in the print space.
double GetHPos() const
Returns the abscissa of the element.
std::weak_ptr< ComposedBlock > ComposedBlockPtr
void AddStyle(const Id &styleid)
Adds a reference to a style.
TextBlock & AddTextBlockBefore(const Id &next, const Id &id_, int x, int y, int w, int h)
Adds a text block in the print space.