Main Page
Namespaces
Classes
Files
File List
File Members
ShapeGroup.h
Go to the documentation of this file.
1
#ifndef __SHAPEGROUP_H__
2
#define __SHAPEGROUP_H__
3
#include "
VectorTransformation2D.h
"
4
#include "
ShapeGroupPainter.h
"
5
#include "
MSPUBConstants.h
"
6
#include "
Coordinate.h
"
7
#include <boost/ptr_container/ptr_vector.hpp>
8
namespace
libmspub
9
{
10
class
ShapeGroup;
11
class
ShapeGroupElement
12
{
13
public
:
14
ShapeGroup
*
m_parent
;
15
VectorTransformation2D
m_transform
;
16
Coordinate
m_coordinates
;
17
ShapeGroupElement
(
ShapeGroup
*parent) :
m_parent
(parent),
m_transform
(
IDENTITY_TRANSFORMATION
),
m_coordinates
()
18
{
19
}
20
virtual
unsigned
getPageSeqNum
()
const
= 0;
21
virtual
unsigned
getFirstShapeSeqNum
()
const
= 0;
22
virtual
void
setPage
(
unsigned
pageSeqNum) = 0;
23
virtual
void
visit
(
ShapeGroupVisitor
*v) = 0;
24
virtual
~ShapeGroupElement
()
25
{
26
}
27
private
:
28
ShapeGroupElement
(
const
ShapeGroupElement
&);
29
ShapeGroupElement
&
operator=
(
const
ShapeGroupElement
&);
30
};
31
class
ShapeGroup
:
public
ShapeGroupElement
32
{
33
ShapeGroup
(
const
ShapeGroup
&);
34
ShapeGroup
&
operator=
(
const
ShapeGroup
&);
35
public
:
36
boost::ptr_vector<ShapeGroupElement>
m_elements
;
37
ShapeGroup
(
ShapeGroup
*parent) :
ShapeGroupElement
(parent),
m_elements
(),
m_seqNum
(0)
38
{
39
}
40
unsigned
getFirstShapeSeqNum
()
const
41
{
42
return
(!
m_elements
.empty()) ?
m_elements
[0].
getFirstShapeSeqNum
() : 0;
43
}
44
unsigned
getPageSeqNum
()
const
45
{
46
if
(!
m_elements
.empty())
47
{
48
return
m_elements
[0].getPageSeqNum();
49
}
50
return
0;
51
}
52
void
setPage
(
unsigned
pageSeqNum)
53
{
54
for
(
unsigned
i = 0; i <
m_elements
.size(); ++i)
55
{
56
m_elements
[i].setPage(pageSeqNum);
57
}
58
}
59
VectorTransformation2D
getFoldedTransform
();
60
void
visit
(
ShapeGroupVisitor
*v);
61
unsigned
m_seqNum
;
62
};
63
class
ShapeGroupElementLeaf
:
public
ShapeGroupElement
64
{
65
ShapeGroupElementLeaf
(
const
ShapeGroupElementLeaf
&);
66
ShapeGroupElementLeaf
&
operator=
(
const
ShapeGroupElementLeaf
&);
67
unsigned
m_pageSeqNum
;
68
unsigned
m_seqNum
;
69
public
:
70
ShapeGroupElementLeaf
(
ShapeGroup
*parent,
unsigned
seqNum = 0) :
ShapeGroupElement
(parent),
m_pageSeqNum
(0),
m_seqNum
(seqNum)
71
{
72
}
73
unsigned
getPageSeqNum
()
const
74
{
75
return
m_pageSeqNum
;
76
}
77
unsigned
getFirstShapeSeqNum
()
const
78
{
79
return
m_seqNum
;
80
}
81
void
setPage
(
unsigned
pageSeqNum)
82
{
83
m_pageSeqNum
= pageSeqNum;
84
}
85
void
visit
(
ShapeGroupVisitor
*v);
86
VectorTransformation2D
getFoldedTransform
(
VectorTransformation2D
init);
87
};
88
}
89
#endif
90
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Generated for libmspub by
doxygen
1.8.1.2