Canvas5StyleManager.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/*
35 * Parser to Canvas5 text document ( style part )
36 *
37 */
38#ifndef CANVAS5_STYLE_MANAGER
39# define CANVAS5_STYLE_MANAGER
40
41#include <string>
42#include <utility>
43#include <vector>
44
45#include <librevenge/librevenge.h>
46
47#include "libmwaw_internal.hxx"
48
49#include "MWAWDebug.hxx"
50#include "MWAWGraphicStyle.hxx"
51#include "MWAWInputStream.hxx"
52#include "MWAWPosition.hxx"
53
54class MWAWFont;
55class MWAWParagraph;
56
57namespace Canvas5Structure
58{
59struct Stream;
60}
61
63{
64struct ColorStyle;
65struct State;
66}
67
68class Canvas5Graph;
69class Canvas5Parser;
70
77{
78 friend class Canvas5Graph;
79 friend class Canvas5Parser;
80
81public:
83 struct StyleList {
86 : m_fonts()
87 , m_paragraphs()
88 {
89 }
91 std::vector<std::pair<MWAWFont, int> > m_fonts;
93 std::vector<std::pair<MWAWParagraph, int> > m_paragraphs;
94 };
95
97 explicit Canvas5StyleManager(Canvas5Parser &parser);
99 virtual ~Canvas5StyleManager();
100
102 int version() const;
103
104protected:
105 // interface
106
112 bool updateLineStyle(int sId, MWAWGraphicStyle &style, int &numLines, int lineId=-1, float *offset=nullptr);
114 bool updateLineColor(int cId, MWAWGraphicStyle &style);
116 bool updateSurfaceColor(int cId, MWAWGraphicStyle &style);
117
118 //
119 // Intermediate level
120 //
121
125 bool readCharStyle(Canvas5Structure::Stream &stream, int id, std::pair<MWAWFont, int> &fontId);
133 bool readFonts(Canvas5Structure::Stream &stream, int numFonts);
143 bool readStyle(Canvas5Structure::Stream &stream, int id, StyleList *styles=nullptr);
146
147 //
148 // Windows RSRC
149 //
150
151 //
152 // Low level
153 //
154
156 bool readArrow(Canvas5Structure::Stream &stream, MWAWGraphicStyle::Arrow &arrow, long len);
158 bool readColor(Canvas5Structure::Stream &stream, MWAWColor &color, std::string &extra);
170 bool readVKFL(Canvas5Structure::Stream &stream, Canvas5StyleManagerInternal::ColorStyle &texture, long len, std::vector<int> *typeList=nullptr);
171
172private:
175
176protected:
177 //
178 // data
179 //
182
184 std::shared_ptr<Canvas5StyleManagerInternal::State> m_state;
185
188};
189#endif
190// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
the main class to read the graphic part of Canvas5 file
Definition: Canvas5Graph.hxx:83
the main class to read a Canvas 5 files
Definition: Canvas5Parser.hxx:71
the main class to read the style part of Canvas 5 file
Definition: Canvas5StyleManager.hxx:77
bool readStrokes(Canvas5Structure::Stream &stream)
try to read the stroke styles
Definition: Canvas5StyleManager.cxx:1520
bool readStyle(Canvas5Structure::Stream &stream, int id, StyleList *styles=nullptr)
try to read a style
Definition: Canvas5StyleManager.cxx:1745
Canvas5StyleManager(Canvas5StyleManager const &orig)=delete
bool readPenSize(Canvas5Structure::Stream &stream)
read the pen size (header file)
Definition: Canvas5StyleManager.cxx:1334
Canvas5StyleManager(Canvas5Parser &parser)
constructor
Definition: Canvas5StyleManager.cxx:223
bool readTexture(Canvas5Structure::Stream &stream, Canvas5StyleManagerInternal::ColorStyle &color, long len)
try to read a texture
Definition: Canvas5StyleManager.cxx:1119
bool readFonts(Canvas5Structure::Stream &stream, int numFonts)
try to read the fonts names
Definition: Canvas5StyleManager.cxx:1225
bool updateSurfaceColor(int cId, MWAWGraphicStyle &style)
try to update the surface color given the color id
Definition: Canvas5StyleManager.cxx:2037
virtual ~Canvas5StyleManager()
destructor
Definition: Canvas5StyleManager.cxx:230
bool readVKFL(Canvas5Structure::Stream &stream, Canvas5StyleManagerInternal::ColorStyle &texture, long len, std::vector< int > *typeList=nullptr)
try to read an unknown vectorized graphic format used to store symbol, texture and arrow
Definition: Canvas5StyleManager.cxx:734
bool readColorStyle(Canvas5Structure::Stream &stream, Canvas5StyleManagerInternal::ColorStyle &color, long len)
try to read a color style
Definition: Canvas5StyleManager.cxx:485
bool readArrow(Canvas5Structure::Stream &stream, MWAWGraphicStyle::Arrow &arrow, long len)
try to read an arrow
Definition: Canvas5StyleManager.cxx:276
bool readSymbol(Canvas5Structure::Stream &stream, Canvas5StyleManagerInternal::ColorStyle &color, long len)
try to read a symbol
Definition: Canvas5StyleManager.cxx:1046
bool readStyles(Canvas5Structure::Stream &stream)
try to read the styles
Definition: Canvas5StyleManager.cxx:1940
int version() const
returns the file version
Definition: Canvas5StyleManager.cxx:233
Canvas5Parser * m_mainParser
the main parser;
Definition: Canvas5StyleManager.hxx:187
Canvas5StyleManager & operator=(Canvas5StyleManager const &orig)=delete
bool readColor(Canvas5Structure::Stream &stream, MWAWColor &color, std::string &extra)
try to read a color: 12 unknown 4 components followed by a name
Definition: Canvas5StyleManager.cxx:341
bool readArrows(Canvas5Structure::Stream &stream)
try to read the arrows zones
Definition: Canvas5StyleManager.cxx:244
bool updateLineColor(int cId, MWAWGraphicStyle &style)
try to update the line color given the color id
Definition: Canvas5StyleManager.cxx:2001
bool readDashes(Canvas5Structure::Stream &stream)
try to read the dashes
Definition: Canvas5StyleManager.cxx:1177
bool readCharStyle(Canvas5Structure::Stream &stream, int id, std::pair< MWAWFont, int > &fontId)
try to read a character style
Definition: Canvas5StyleManager.cxx:1558
std::shared_ptr< Canvas5StyleManagerInternal::State > m_state
the state
Definition: Canvas5StyleManager.hxx:184
bool updateLineStyle(int sId, MWAWGraphicStyle &style, int &numLines, int lineId=-1, float *offset=nullptr)
try to update the line style given the stroke id and returns the number of lines(plin)
Definition: Canvas5StyleManager.cxx:2095
bool readCharStyles(Canvas5Structure::Stream &stream)
try to read the character styles
Definition: Canvas5StyleManager.cxx:1693
MWAWParserStatePtr m_parserState
the parser state
Definition: Canvas5StyleManager.hxx:181
bool readColors(Canvas5Structure::Stream &stream)
try to read the ink color zones
Definition: Canvas5StyleManager.cxx:382
bool readFormats(Canvas5Structure::Stream &stream)
read the list of formats, mainly an unit's conversion table
Definition: Canvas5StyleManager.cxx:1271
bool readPenStyles(Canvas5Structure::Stream &stream)
read the pen styles
Definition: Canvas5StyleManager.cxx:1354
Class to store font.
Definition: MWAWFont.hxx:44
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
a namespace used to define basic structure to read a Canvas 5 file
Definition: Canvas5Graph.hxx:60
Internal: the structures of a Canvas5StyleManager.
Definition: Canvas5StyleManager.cxx:63
a sub stream of Canvas5Structure
Definition: Canvas5Structure.hxx:46
Internal: the color style of a Canvas5StyleManager.
Definition: Canvas5StyleManager.cxx:67
a structure use to store a list of styles
Definition: Canvas5StyleManager.hxx:83
std::vector< std::pair< MWAWFont, int > > m_fonts
the fonts and the paragraph id
Definition: Canvas5StyleManager.hxx:91
StyleList()
constructor
Definition: Canvas5StyleManager.hxx:85
std::vector< std::pair< MWAWParagraph, int > > m_paragraphs
the paragraph list and the tab id
Definition: Canvas5StyleManager.hxx:93
the class to store a color
Definition: libmwaw_internal.hxx:192
a structure used to define an arrow
Definition: MWAWGraphicStyle.hxx:56

Generated on Fri Sep 2 2022 03:21:11 for libmwaw by doxygen 1.9.2