MacDrawProStyleManager.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
#ifndef MACDRAWPRO_STYLE_MANAGER
# define MACDRAWPRO_STYLE_MANAGER
#include <map>
#include <string>
#include <vector>
#include <librevenge/librevenge.h>
#include "MWAWDebug.hxx"
#include "MWAWGraphicStyle.hxx"
#include "MWAWInputStream.hxx"
class MWAWFont;
namespace MacDrawProStyleManagerInternal
{
struct State;
}
class MacDrawProParser;
class MacDrawProStyleManager
{
friend class MacDrawProParser;
public:
explicit MacDrawProStyleManager(MacDrawProParser &parser);
virtual ~MacDrawProStyleManager();
protected:
bool readRSRCZones();
// Intermediate level
bool readHeaderInfoStylePart(std::string &extra);
bool readStyles(long const(&sizeZones)[6]);
bool getColor(int cId, MWAWColor &color) const;
bool getDash(int dId, std::vector<float> &dash) const;
bool getFont(int fId, MWAWFont &font) const;
bool getParagraph(int pId, MWAWParagraph &para) const;
bool getPattern(int pId, MWAWGraphicStyle::Pattern &pattern) const;
bool getPenSize(int pId, float &penSize) const;
bool updateGradient(int gId, MWAWGraphicStyle &style) const;
//
// low level
//
bool readFontStyles(MWAWEntry const &entry);
bool readParagraphStyles(MWAWEntry const &entry);
// data fork or rsrc fork
bool readArrows(MWAWEntry const &entry, bool inRsrc=false);
bool readDashs(MWAWEntry const &entry, bool inRsrc=false);
bool readPens(MWAWEntry const &entry, bool inRsrc=false);
bool readRulers(MWAWEntry const &entry, bool inRsrc=false);
// rsrc
bool readDocumentInfo(MWAWEntry const &entry);
bool readPreferences(MWAWEntry const &entry);
bool readFontNames();
bool readColors(MWAWEntry const &entry);
bool readBWPatterns(MWAWEntry const &entry);
bool readColorPatterns(MWAWEntry const &entry);
bool readPatternsToolList(MWAWEntry const &entry);
bool readRulerSettings(MWAWEntry const &entry);
bool readViews(MWAWEntry const &entry);
bool readRSRCDstl(MWAWEntry const &entry);
// v1
bool readPaletteDef(MWAWEntry const &entry);
bool readPaletteMap(MWAWEntry const &entry, int N, int dataSz);
bool readPaletteData(MWAWEntry const &entry, int dataSz);
bool readColorMap(MWAWEntry const &entry, int N, int fSz);
bool readPatternMap(MWAWEntry const &entry, int N, int fSz);
bool readGradientMap(MWAWEntry const &entry, int N, int fSz);
bool readFAMap(MWAWEntry const &entry, int N, int fSz);
bool readColorPalette(MWAWEntry const &entry, int fSz);
bool readFAPalette(MWAWEntry const &entry, int fSz);
bool readGradientPalette(MWAWEntry const &entry, int fSz);
bool readPatternPalette(MWAWEntry const &entry, int fSz);
bool readListNames(MWAWEntry const &entry, int N=-1);
bool readListNames(char const *type);
bool readPreferencesListBool(MWAWEntry const &entry, int num);
bool readPreferences1(MWAWEntry const &entry);
bool readPreferences6(MWAWEntry const &entry);
bool readPreferences8(MWAWEntry const &entry);
bool readUPDL(MWAWEntry const &entry);
bool readGrid(MWAWEntry const &entry);
//
// data
//
protected:
MacDrawProParser &m_parser;
MWAWParserStatePtr m_parserState;
std::shared_ptr<MacDrawProStyleManagerInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWParagraph
class to store the paragraph properties
Definition MWAWParagraph.hxx:85
MacDrawProParser
the main class to read a MacDraw II file
Definition MacDrawProParser.hxx:64
MacDrawProStyleManager::readHeaderInfoStylePart
bool readHeaderInfoStylePart(std::string &extra)
tries to read the header info part which corresponds to style data
Definition MacDrawProStyleManager.cxx:460
MacDrawProStyleManager::readPreferences8
bool readPreferences8(MWAWEntry const &entry)
try to read the 8 pref resource Prf8:256
Definition MacDrawProStyleManager.cxx:2970
MacDrawProStyleManager::getDash
bool getDash(int dId, std::vector< float > &dash) const
tries to return the dash definition corresponding to an id
Definition MacDrawProStyleManager.cxx:377
MacDrawProStyleManager::readColorPatterns
bool readColorPatterns(MWAWEntry const &entry)
tries to read the color pattern colP:256
Definition MacDrawProStyleManager.cxx:1547
MacDrawProStyleManager::readGrid
bool readGrid(MWAWEntry const &entry)
try to read the Grid: resource, grid of palette position
Definition MacDrawProStyleManager.cxx:2781
MacDrawProStyleManager::readColorPalette
bool readColorPalette(MWAWEntry const &entry, int fSz)
try to read the color palette resource CoEL:128
Definition MacDrawProStyleManager.cxx:2148
MacDrawProStyleManager::readRSRCDstl
bool readRSRCDstl(MWAWEntry const &entry)
reads the Dstl:256 resource (unknown content)
Definition MacDrawProStyleManager.cxx:1800
MacDrawProStyleManager::readParagraphStyles
bool readParagraphStyles(MWAWEntry const &entry)
tries to read the paragraph style ( last style in v1 data fork )
Definition MacDrawProStyleManager.cxx:944
MacDrawProStyleManager::readPens
bool readPens(MWAWEntry const &entry, bool inRsrc=false)
tries to read the Pen styles or the resource PSet:256
Definition MacDrawProStyleManager.cxx:815
MacDrawProStyleManager::~MacDrawProStyleManager
virtual ~MacDrawProStyleManager()
destructor
Definition MacDrawProStyleManager.cxx:310
MacDrawProStyleManager::readRulers
bool readRulers(MWAWEntry const &entry, bool inRsrc=false)
tries to read the Ruler styles or the resource Drul:256
Definition MacDrawProStyleManager.cxx:885
MacDrawProStyleManager::readPatternMap
bool readPatternMap(MWAWEntry const &entry, int N, int fSz)
try to read the display pattern DPPa:1
Definition MacDrawProStyleManager.cxx:2215
MacDrawProStyleManager::readPreferences1
bool readPreferences1(MWAWEntry const &entry)
try to read the first pref resource Prf1:256
Definition MacDrawProStyleManager.cxx:2870
MacDrawProStyleManager::readColorMap
bool readColorMap(MWAWEntry const &entry, int N, int fSz)
try to read the display color map DPCo:0
Definition MacDrawProStyleManager.cxx:2077
MacDrawProStyleManager::readPreferences6
bool readPreferences6(MWAWEntry const &entry)
try to read the spelling pref resource Prf6:256
Definition MacDrawProStyleManager.cxx:2916
MacDrawProStyleManager::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition MacDrawProStyleManager.hxx:188
MacDrawProStyleManager::m_parser
MacDrawProParser & m_parser
the main parser
Definition MacDrawProStyleManager.hxx:186
MacDrawProStyleManager::getPenSize
bool getPenSize(int pId, float &penSize) const
tries to return the pen size corresponding to an id
Definition MacDrawProStyleManager.cxx:388
MacDrawProStyleManager::readFAMap
bool readFAMap(MWAWEntry const &entry, int N, int fSz)
try to read the FA map DPFa:3
Definition MacDrawProStyleManager.cxx:2320
MacDrawProStyleManager::readPreferencesListBool
bool readPreferencesListBool(MWAWEntry const &entry, int num)
try to read the first pref resource Prf[23459]:256
Definition MacDrawProStyleManager.cxx:2835
MacDrawProStyleManager::readArrows
bool readArrows(MWAWEntry const &entry, bool inRsrc=false)
tries to read the Arrow styles or the resource Aset:256
Definition MacDrawProStyleManager.cxx:677
MacDrawProStyleManager::m_state
std::shared_ptr< MacDrawProStyleManagerInternal::State > m_state
the state
Definition MacDrawProStyleManager.hxx:190
MacDrawProStyleManager::readPaletteData
bool readPaletteData(MWAWEntry const &entry, int dataSz)
try to read a palette data
Definition MacDrawProStyleManager.cxx:1973
MacDrawProStyleManager::updateGradient
bool updateGradient(int gId, MWAWGraphicStyle &style) const
tries to update the style gradient
Definition MacDrawProStyleManager.cxx:440
MacDrawProStyleManager::readGradientPalette
bool readGradientPalette(MWAWEntry const &entry, int fSz)
try to read the gradient palette resource RaEL:128
Definition MacDrawProStyleManager.cxx:2527
MacDrawProStyleManager::readColors
bool readColors(MWAWEntry const &entry)
tries to read colors map Ctbl:256
Definition MacDrawProStyleManager.cxx:1440
MacDrawProStyleManager::readListNames
bool readListNames(MWAWEntry const &entry, int N=-1)
try to read a list of names : CoNa:128 color name, FaNa:128 font color name, PaNa:128....
Definition MacDrawProStyleManager.cxx:2671
MacDrawProStyleManager::readPreferences
bool readPreferences(MWAWEntry const &entry)
tries to read the main Preferences resource Pref:256
Definition MacDrawProStyleManager.cxx:1225
MacDrawProStyleManager::readDashs
bool readDashs(MWAWEntry const &entry, bool inRsrc=false)
tries to read the dash settings or the resource Dset:256
Definition MacDrawProStyleManager.cxx:741
MacDrawProStyleManager::readFontNames
bool readFontNames()
tries to read the font name resources Fmtx:256 and Fnms:256
Definition MacDrawProStyleManager.cxx:1367
MacDrawProStyleManager::readStyles
bool readStyles(long const(&sizeZones)[6])
tries to read the style zone knowings the size and the number of data in each zones
Definition MacDrawProStyleManager.cxx:512
MacDrawProStyleManager::readBWPatterns
bool readBWPatterns(MWAWEntry const &entry)
tries to read the BW pattern bawP:256
Definition MacDrawProStyleManager.cxx:1493
MacDrawProStyleManager::readPatternsToolList
bool readPatternsToolList(MWAWEntry const &entry)
tries to read the list of pattern patR:256: list of BW/Color patterns list which appear in the patter...
Definition MacDrawProStyleManager.cxx:1643
MacDrawProStyleManager::readGradientMap
bool readGradientMap(MWAWEntry const &entry, int N, int fSz)
try to read the gradian map DPRa:2
Definition MacDrawProStyleManager.cxx:2408
MacDrawProStyleManager::getFont
bool getFont(int fId, MWAWFont &font) const
tries to return the font corresponding to an id
Definition MacDrawProStyleManager.cxx:356
MacDrawProStyleManager::readViews
bool readViews(MWAWEntry const &entry)
reads the view positions resource Dvws:256
Definition MacDrawProStyleManager.cxx:1745
MacDrawProStyleManager::readUPDL
bool readUPDL(MWAWEntry const &entry)
try to read the UPDL resource, maybe U? Palette Display Layer
Definition MacDrawProStyleManager.cxx:2731
MacDrawProStyleManager::MacDrawProStyleManager
MacDrawProStyleManager(MacDrawProParser &parser)
constructor
Definition MacDrawProStyleManager.cxx:303
MacDrawProStyleManager::getPattern
bool getPattern(int pId, MWAWGraphicStyle::Pattern &pattern) const
tries to return the pattern corresponding to an id
Definition MacDrawProStyleManager.cxx:399
MacDrawProStyleManager::readFontStyles
bool readFontStyles(MWAWEntry const &entry)
tries to read the font style ( last style in v0 data fork )
Definition MacDrawProStyleManager.cxx:564
MacDrawProStyleManager::readPatternPalette
bool readPatternPalette(MWAWEntry const &entry, int fSz)
try to read the pattern palette resource PaEL:128
Definition MacDrawProStyleManager.cxx:2270
MacDrawProStyleManager::readRulerSettings
bool readRulerSettings(MWAWEntry const &entry)
tries to read the Ruler settings resource Rset:256 or Rst2:256
Definition MacDrawProStyleManager.cxx:1691
MacDrawProStyleManager::getParagraph
bool getParagraph(int pId, MWAWParagraph &para) const
tries to return the paragraph corresponding to an id
Definition MacDrawProStyleManager.cxx:367
MacDrawProStyleManager::getColor
bool getColor(int cId, MWAWColor &color) const
tries to return the color corresponding to an id
Definition MacDrawProStyleManager.cxx:319
MacDrawProStyleManager::readFAPalette
bool readFAPalette(MWAWEntry const &entry, int fSz)
try to read the FA palette resource FaEL:128
Definition MacDrawProStyleManager.cxx:2363
MacDrawProStyleManager::readRSRCZones
bool readRSRCZones()
tries to read the RSRC zones
Definition MacDrawProStyleManager.cxx:1079
MacDrawProStyleManager::readPaletteDef
bool readPaletteDef(MWAWEntry const &entry)
try to read a palette definition PaDB:[0-3]
Definition MacDrawProStyleManager.cxx:1847
MacDrawProStyleManager::readDocumentInfo
bool readDocumentInfo(MWAWEntry const &entry)
tries to read the Document Information resource Dinf:256
Definition MacDrawProStyleManager.cxx:1276
MacDrawProStyleManager::readPaletteMap
bool readPaletteMap(MWAWEntry const &entry, int N, int dataSz)
try to read a palette map
Definition MacDrawProStyleManager.cxx:2023
MacDrawProStyleManager::MacDrawProParser
friend class MacDrawProParser
Definition MacDrawProStyleManager.hxx:61
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition libmwaw_internal.hxx:557
MacDrawProStyleManagerInternal
Internal: the structures of a MacDrawProStyleManager.
Definition MacDrawProStyleManager.cxx:62
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192
MWAWGraphicStyle::Pattern
a basic pattern used in a MWAWGraphicStyle:
Definition MWAWGraphicStyle.hxx:351
MacDrawProStyleManagerInternal::State
Internal: the state of a MacDrawProStyleManager.
Definition MacDrawProStyleManager.cxx:138