• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

fg_Graphic.h

Go to the documentation of this file.
00001 /* AbiWord -- Embedded graphics for layout
00002  * Copyright (C) 1999 Matt Kimball
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00017  * 02111-1307, USA.
00018  */
00019 
00020 
00021 #ifndef FG_GRAPHIC_H
00022 #define FG_GRAPHIC_H
00023 
00024 #include <string>
00025 
00026 #include "ut_types.h"
00027 #include "pt_Types.h"
00028 
00029 class UT_ByteBuf;
00030 class fl_ContainerLayout;
00031 class PX_ChangeRecord_Object;
00032 class PP_AttrProp;
00033 class PD_Document;
00034 class GR_Graphics;
00035 class GR_Image;
00036 
00037 
00038 
00039 enum FGType {
00040     FGT_Unknown,
00041     FGT_Raster,
00042     FGT_Vector
00043 };
00044 
00045 //  FG_Graphic is used throughout the fmt code where we want the same code
00046 //  to handle various types of graphics interchangably.  FG_Graphic objects
00047 //  aren't persistent in the formatting, but are constructed when needed
00048 //  and removed after the operating is finished, and they act as a proxy
00049 //  for the underlying representation.
00050 class ABI_EXPORT FG_Graphic
00051 {
00052 public:
00053     static FG_Graphic*  createFromChangeRecord(const fl_ContainerLayout *pFL,
00054                                                const PX_ChangeRecord_Object* pcro);
00055     static FG_Graphic*  createFromStrux(const fl_ContainerLayout *pFL);
00056 
00057     virtual ~FG_Graphic();
00058 
00059     virtual FGType      getType(void) const = 0;
00060     // return the mime type.
00061     virtual const std::string & getMimeType() const = 0;
00062 
00063     //  width and height are returned in inches not pixels.
00064     virtual double      getWidth(void) const = 0;
00065     virtual double      getHeight(void) const = 0;
00066     virtual const char * getDataId(void) const = 0;
00067 //
00068 // Return the width and height properties of the span that contains this
00069 // Image
00070 //
00071     virtual const char * getWidthProp(void) = 0;
00072     virtual const char * getHeightProp(void) = 0;
00073     virtual GR_Image *     regenerateImage(GR_Graphics * pG) = 0;
00074     virtual FG_Graphic *   clone(void) const = 0;
00075     // return the buffer behind the image
00076     virtual const UT_ByteBuf * getBuffer() const = 0;
00077     virtual const char * createDataItem(PD_Document *pDoc, const char * szName) = 0;
00078     //  generate an image for display in the specified graphics object
00079     virtual GR_Image* generateImage(GR_Graphics* pG,
00080                                    const PP_AttrProp * pSpanAP,
00081                                    UT_sint32 maxW, UT_sint32 maxH) = 0;
00082 
00083     //  Insert the object at the specified point in a document
00084     virtual UT_Error    insertIntoDocument(PD_Document* pDoc, UT_uint32 res,
00085 
00086                                            UT_uint32 iPos, const char* szName) = 0;
00087     //  Attach the object to a strux for a background image for the strux
00088     virtual UT_Error    insertAtStrux(PD_Document* pDoc,
00089                                       UT_uint32 res,
00090                                       UT_uint32 iPos,
00091                                       PTStruxType iStruxType,
00092                                       const char* szName) = 0;
00093 };
00094 
00095 #endif /* FG_GRAPHIC_H */

Generated on Sun May 27 2012 for AbiWord by  doxygen 1.7.1