CDRStylesCollector.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* libcdr
00003  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License or as specified alternatively below. You may obtain a copy of
00008  * the License at http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * Major Contributor(s):
00016  * Copyright (C) 2012 Fridrich Strba <fridrich.strba@bluewin.ch>
00017  *
00018  *
00019  * All Rights Reserved.
00020  *
00021  * For minor contributions see the git repository.
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
00025  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
00026  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
00027  * instead of those above.
00028  */
00029 
00030 #ifndef __CDRSTYLESCOLLECTOR_H__
00031 #define __CDRSTYLESCOLLECTOR_H__
00032 
00033 #include <map>
00034 #include <vector>
00035 #include <stack>
00036 #include <libwpg/libwpg.h>
00037 #include <lcms2.h>
00038 #include "CDRTypes.h"
00039 #include "CDRPath.h"
00040 #include "CDROutputElementList.h"
00041 #include "CDRCollector.h"
00042 #include "libcdr_utils.h"
00043 
00044 namespace libcdr
00045 {
00046 
00047 class CDRStylesCollector : public CDRCollector
00048 {
00049 public:
00050   CDRStylesCollector(CDRParserState &ps);
00051   virtual ~CDRStylesCollector();
00052 
00053   // collector functions
00054   void collectPage(unsigned level);
00055   void collectObject(unsigned) {}
00056   void collectGroup(unsigned) {}
00057   void collectVect(unsigned) {}
00058   void collectOtherList() {}
00059   void collectCubicBezier(double, double, double, double, double, double) {}
00060   void collectQuadraticBezier(double, double, double, double) {}
00061   void collectMoveTo(double, double) {}
00062   void collectLineTo(double, double) {}
00063   void collectArcTo(double, double, bool, bool, double, double) {}
00064   void collectClosePath() {}
00065   void collectLevel(unsigned) {}
00066   void collectTransform(const CDRTransforms &, bool) {}
00067   void collectFillStyle(unsigned short, const CDRColor &, const CDRColor &, const CDRGradient &, const CDRImageFill &) {}
00068   void collectLineStyle(unsigned short, unsigned short, unsigned short, double, double, double, const CDRColor &,
00069                         const std::vector<unsigned> &, unsigned, unsigned) {}
00070   void collectRotate(double,double,double) {}
00071   void collectFlags(unsigned, bool) {}
00072   void collectPageSize(double width, double height, double offsetX, double offsetY);
00073   void collectPolygonTransform(unsigned, unsigned, double, double, double, double) {}
00074   void collectBitmap(unsigned, double, double, double, double) {}
00075   void collectBmp(unsigned imageId, unsigned colorModel, unsigned width, unsigned height, unsigned bpp, const std::vector<unsigned> &palette, const std::vector<unsigned char> &bitmap);
00076   void collectBmp(unsigned imageId, const std::vector<unsigned char> &bitmap);
00077   void collectBmpf(unsigned patternId, unsigned width, unsigned height, const std::vector<unsigned char> &pattern);
00078   void collectPpdt(const std::vector<std::pair<double, double> > &, const std::vector<unsigned> &) {}
00079   void collectFillTransform(const CDRTransforms &) {}
00080   void collectFillOpacity(double) {}
00081   void collectPolygon() {}
00082   void collectSpline() {}
00083   void collectColorProfile(const std::vector<unsigned char> &profile);
00084   void collectBBox(double, double, double, double) {}
00085   void collectSpnd(unsigned) {}
00086   void collectVectorPattern(unsigned, const WPXBinaryData &) {}
00087   void collectPaletteEntry(unsigned colorId, unsigned userId, const CDRColor &color);
00088   void collectText(unsigned textId, unsigned styleId, const std::vector<unsigned char> &data,
00089                    const std::vector<unsigned char> &charDescriptions, const std::map<unsigned, CDRCharacterStyle> &styleOverrides);
00090   void collectArtisticText(double, double) {}
00091   void collectParagraphText(double, double, double, double) {}
00092   void collectStld(unsigned id, const CDRCharacterStyle &charStyle);
00093 
00094 private:
00095   CDRStylesCollector(const CDRStylesCollector &);
00096   CDRStylesCollector &operator=(const CDRStylesCollector &);
00097 
00098   void getRecursedStyle(CDRCharacterStyle &charStyle, unsigned styleId);
00099 
00100   CDRParserState &m_ps;
00101   CDRPage m_page;
00102   std::map<unsigned, CDRCharacterStyle> m_charStyles;
00103 };
00104 
00105 } // namespace libcdr
00106 
00107 #endif /* __CDRCOLLECTOR_H__ */
00108 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */