ClarisDrawStyleManager.hxx Source File documentation

ClarisDrawStyleManager.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 #ifndef CLARISDRAW_STYLE_MANAGER
35 # define CLARISDRAW_STYLE_MANAGER
36
37 #include <map>
38 #include <string>
39 #include <vector>
40
41 #include <librevenge/librevenge.h>
42
43 #include "MWAWDebug.hxx"
44 #include "MWAWGraphicStyle.hxx"
45 #include "MWAWInputStream.hxx"
46
47 class MWAWFont;
48
49 namespace ClarisDrawStyleManagerInternal
50 {
51 struct State;
52 }
53
54 class ClarisDrawParser;
55
59 class ClarisDrawStyleManager
60 {
61 friend class ClarisDrawParser;
62 public:
64 explicit ClarisDrawStyleManager(ClarisDrawParser &parser);
66 virtual ~ClarisDrawStyleManager();
68 void setDefaultNumbers(int nColors, int nGradients);
69 // Intermediate level
70
72 bool getColor(int cId, MWAWColor &color) const;
74 bool getDash(int dId, std::vector<float> &dash) const;
76 bool getFont(int fId, MWAWFont &font) const;
78 bool getParagraph(int pId, MWAWParagraph &para) const;
80 bool getPattern(int pId, MWAWGraphicStyle::Pattern &pattern) const;
82 bool updateGradient(int gId, MWAWGraphicStyle &style) const;
83
84 protected:
85 //
86 // low level
87 //
88
90 bool readFontStyles();
92 bool readParagraphStyles();
94 bool readFontNames();
95
96 // tries to read the color list
97 bool readColorList();
98 // tries to read the gradient list
99 bool readPatternList();
100 // tries to read the gradient list
101 bool readGradientList();
102
104 bool readArrows();
106 bool readDashs();
108 bool readRulers();
109
110 //
111 // data
112 //
113
114 protected:
116 ClarisDrawParser &m_parser;
118 MWAWParserStatePtr m_parserState;
120 std::shared_ptr<ClarisDrawStyleManagerInternal::State> m_state;
121 };
122 #endif
123 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
ClarisDrawStyleManager::readFontNames
bool readFontNames()
tries to read the font names zone
Definition: ClarisDrawStyleManager.cxx:1049
ClarisDrawStyleManagerInternal::Gradient::m_colors
MWAWColor m_colors[4]
the color
Definition: ClarisDrawStyleManager.cxx:119
ClarisDrawStyleManager::getPattern
bool getPattern(int pId, MWAWGraphicStyle::Pattern &pattern) const
tries to return the pattern corresponding to an id
Definition: ClarisDrawStyleManager.cxx:1008
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
ClarisDrawStyleManagerInternal::State::m_paragraphList
std::vector< MWAWParagraph > m_paragraphList
the list of paragraph
Definition: ClarisDrawStyleManager.cxx:214
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
ClarisDrawStyleManagerInternal::State::m_dashList
std::vector< std::vector< float > > m_dashList
the list of dash
Definition: ClarisDrawStyleManager.cxx:210
ClarisDrawStyleManagerInternal::State::m_fontList
std::vector< MWAWFont > m_fontList
the list of font
Definition: ClarisDrawStyleManager.cxx:212
MWAWGraphicStyle::setSurfaceColor
void setSurfaceColor(MWAWColor const &col, float opacity=1)
set the surface color
Definition: MWAWGraphicStyle.hxx:325
ClarisDrawStyleManagerInternal::Gradient::m_angle
int m_angle
the angle
Definition: ClarisDrawStyleManager.cxx:121
MWAWGraphicStyle::m_gradientType
GradientType m_gradientType
the gradient type
Definition: MWAWGraphicStyle.hxx:439
ClarisDrawParser.hxx
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
ClarisDrawStyleManagerInternal::State::m_numGradients
int m_numGradients
the number of gradient
Definition: ClarisDrawStyleManager.cxx:206
MWAWFontConverter.hxx
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
ClarisDrawStyleManagerInternal::State::State
State()
constructor
Definition: ClarisDrawStyleManager.cxx:175
ClarisDrawStyleManagerInternal::State::m_BWPatternList
std::vector< MWAWGraphicStyle::Pattern > m_BWPatternList
the patterns list
Definition: ClarisDrawStyleManager.cxx:217
MWAWGraphicStyle::G_Rectangular
@ G_Rectangular
Definition: MWAWGraphicStyle.hxx:55
MWAWPrinter.hxx
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
ClarisDrawStyleManagerInternal::State::initDashs
void initDashs()
init the dashs list
Definition: ClarisDrawStyleManager.cxx:301
ClarisDrawStyleManagerInternal::State::m_colorList
std::vector< MWAWColor > m_colorList
the color list
Definition: ClarisDrawStyleManager.cxx:208
ClarisDrawStyleManagerInternal::Gradient::m_numColors
int m_numColors
the number of color
Definition: ClarisDrawStyleManager.cxx:117
ClarisDrawStyleManager::~ClarisDrawStyleManager
virtual ~ClarisDrawStyleManager()
destructor
Definition: ClarisDrawStyleManager.cxx:937
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
MWAWGraphicStyle::Pattern::m_data
std::vector< unsigned char > m_data
the pattern data: a sequence of data: p[0..7,0],p[8..15,0]...p[0..7,1],p[8..15,1],...
Definition: MWAWGraphicStyle.hxx:266
ClarisDrawStyleManagerInternal::Gradient::m_decal
float m_decal
the decal
Definition: ClarisDrawStyleManager.cxx:123
MWAWGraphicStyle::m_gradientStopList
std::vector< GradientStop > m_gradientStopList
the list of gradient limits
Definition: MWAWGraphicStyle.hxx:445
ClarisDrawStyleManager::getColor
bool getColor(int cId, MWAWColor &color) const
tries to return the color corresponding to an id
Definition: ClarisDrawStyleManager.cxx:962
ClarisDrawStyleManagerInternal::State::m_numStyleZones
int m_numStyleZones[6]
the number of zones
Definition: ClarisDrawStyleManager.cxx:200
ClarisDrawStyleManager::readArrows
bool readArrows()
tries to read the Arrow styles
Definition: ClarisDrawStyleManager.cxx:1176
ClarisDrawStyleManager::ClarisDrawStyleManager
ClarisDrawStyleManager(ClarisDrawParser &parser)
constructor
Definition: ClarisDrawStyleManager.cxx:930
ClarisDrawStyleManagerInternal::State::m_documentSize
MWAWVec2f m_documentSize
the document size (in point)
Definition: ClarisDrawStyleManager.cxx:198
MWAWGraphicStyle::Pattern
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:180
MWAWSubDocument.hxx
ClarisDrawStyleManager::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: ClarisDrawStyleManager.hxx:118
MWAWColor::barycenter
static MWAWColor barycenter(float alpha, MWAWColor const &colA, float beta, MWAWColor const &colB)
return alpha*colA+beta*colB
Definition: libmwaw_internal.cxx:206
ClarisDrawStyleManagerInternal::Gradient
Definition: ClarisDrawStyleManager.cxx:64
ClarisDrawStyleManager.hxx
MWAWParagraph.hxx
MWAWRSRCParser.hxx
MWAWPosition.hxx
MWAWGraphicStyle::G_Radial
@ G_Radial
Definition: MWAWGraphicStyle.hxx:55
ClarisDrawStyleManager::setDefaultNumbers
void setDefaultNumbers(int nColors, int nGradients)
set the default number of color, ...
Definition: ClarisDrawStyleManager.cxx:941
ClarisDrawStyleManagerInternal::Gradient::Gradient
Gradient(int type=0, int nColor=0, int angle=0, float decal=0)
construtor
Definition: ClarisDrawStyleManager.cxx:66
ClarisDrawStyleManagerInternal::State::m_numColors
int m_numColors
the number of color
Definition: ClarisDrawStyleManager.cxx:202
ClarisDrawStyleManager
the main class to read a ClarisDraw style
Definition: ClarisDrawStyleManager.hxx:59
MWAWGraphicStyle::Pattern::m_dim
MWAWVec2i m_dim
the dimension width x height
Definition: MWAWGraphicStyle.hxx:261
ClarisDrawStyleManager::readDashs
bool readDashs()
tries to read the dash settings
Definition: ClarisDrawStyleManager.cxx:1229
ClarisDrawStyleManagerInternal::Gradient::ok
bool ok() const
check if the gradient is valid
Definition: ClarisDrawStyleManager.cxx:77
MWAWPictData.hxx
ClarisDrawStyleManagerInternal::Gradient::update
bool update(MWAWGraphicStyle &style) const
update the style
Definition: ClarisDrawStyleManager.cxx:127
ClarisWksStruct::Struct::readHeader
bool readHeader(MWAWInputStreamPtr input, bool strict=false)
try to read the header
Definition: ClarisWksStruct.cxx:72
MWAWVec2< float >
ClarisDrawStyleManager::readParagraphStyles
bool readParagraphStyles()
tries to read the paragraph style
MWAWGraphicListener.hxx
MWAWGraphicShape.hxx
ClarisDrawStyleManager::getFont
bool getFont(int fId, MWAWFont &font) const
tries to return the font corresponding to an id
Definition: ClarisDrawStyleManager.cxx:973
MWAWDebug.hxx
ClarisDrawStyleManagerInternal::State::m_numBWPatterns
int m_numBWPatterns
the number of BW pattern
Definition: ClarisDrawStyleManager.cxx:204
ClarisDrawStyleManager::getDash
bool getDash(int dId, std::vector< float > &dash) const
tries to return the dash definition corresponding to an id
Definition: ClarisDrawStyleManager.cxx:994
ClarisDrawStyleManagerInternal
Internal: the structures of a ClarisDrawStyleManager.
Definition: ClarisDrawStyleManager.cxx:61
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
ClarisDrawStyleManager::readPatternList
bool readPatternList()
Definition: ClarisDrawStyleManager.cxx:1385
MWAWGraphicStyle::G_Linear
@ G_Linear
Definition: MWAWGraphicStyle.hxx:55
MWAWGraphicStyle::GradientStop
a structure used to define the gradient limit in MWAWGraphicStyle
Definition: MWAWGraphicStyle.hxx:141
ClarisDrawStyleManager::readColorList
bool readColorList()
Definition: ClarisDrawStyleManager.cxx:1339
MWAWGraphicStyle::Pattern::m_colors
MWAWColor m_colors[2]
the two indexed colors
Definition: MWAWGraphicStyle.hxx:264
ClarisDrawStyleManager::m_parser
ClarisDrawParser & m_parser
the main parser
Definition: ClarisDrawStyleManager.hxx:116
MWAWHeader.hxx
ClarisDrawStyleManagerInternal::Gradient::m_type
int m_type
the type
Definition: ClarisDrawStyleManager.cxx:115
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1191
ClarisWksStruct::Struct::m_size
long m_size
the size of the DSET header
Definition: ClarisWksStruct.hxx:69
ClarisDrawStyleManagerInternal::State::m_gradientList
std::vector< Gradient > m_gradientList
the gradient list
Definition: ClarisDrawStyleManager.cxx:219
MWAWBox2::center
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1072
MWAWGraphicStyle.hxx
ClarisDrawStyleManagerInternal::State::initBWPatterns
void initBWPatterns()
init the black and white patterns list
Definition: ClarisDrawStyleManager.cxx:887
ClarisDrawStyleManager::readRulers
bool readRulers()
tries to read the Ruler styles
Definition: ClarisDrawStyleManager.cxx:1284
ClarisDrawStyleManagerInternal::State::initColors
void initColors()
init the colors list
Definition: ClarisDrawStyleManager.cxx:222
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
ClarisDrawStyleManager::updateGradient
bool updateGradient(int gId, MWAWGraphicStyle &style) const
tries to update the style gradient
Definition: ClarisDrawStyleManager.cxx:1023
ClarisWksStruct::Struct::m_dataSize
long m_dataSize
the data size
Definition: ClarisWksStruct.hxx:73
MWAWGraphicStyle::m_gradientPercentCenter
MWAWVec2f m_gradientPercentCenter
the gradient center
Definition: MWAWGraphicStyle.hxx:451
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
ClarisDrawStyleManagerInternal::Gradient::operator<<
friend std::ostream & operator<<(std::ostream &o, Gradient const &gr)
operator<<
Definition: ClarisDrawStyleManager.cxx:84
MWAWGraphicStyle::m_gradientAngle
float m_gradientAngle
the gradient angle
Definition: MWAWGraphicStyle.hxx:447
ClarisWksStruct::Struct
a basic structure
Definition: ClarisWksStruct.hxx:53
MWAWInputStream.hxx
ClarisDrawParser
the main class to read a ClarisDraw v1 file
Definition: ClarisDrawParser.hxx:63
MWAWFont.hxx
MWAWPictBitmap.hxx
MWAWBox2< int >
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:43
ClarisDrawStyleManagerInternal::State::initGradients
void initGradients()
init the gradient list
Definition: ClarisDrawStyleManager.cxx:328
ClarisDrawStyleManager::readGradientList
bool readGradientList()
Definition: ClarisDrawStyleManager.cxx:1430
ClarisDrawStyleManager::readFontStyles
bool readFontStyles()
tries to read the font style
Definition: ClarisDrawStyleManager.cxx:1113
ClarisDrawStyleManager::getParagraph
bool getParagraph(int pId, MWAWParagraph &para) const
tries to return the paragraph corresponding to an id
Definition: ClarisDrawStyleManager.cxx:984
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
ClarisDrawStyleManager::m_state
std::shared_ptr< ClarisDrawStyleManagerInternal::State > m_state
the state
Definition: ClarisDrawStyleManager.hxx:120
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
ClarisDrawStyleManagerInternal::Gradient::m_box
MWAWBox2i m_box
the center bdbox
Definition: ClarisDrawStyleManager.cxx:125
ClarisDrawStyleManagerInternal::State
Internal: the state of a ClarisDrawStyleManager.
Definition: ClarisDrawStyleManager.cxx:173
MWAWGraphicStyle::G_Axial
@ G_Axial
Definition: MWAWGraphicStyle.hxx:55