00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GR_GRAPHICS_H
00023 #define GR_GRAPHICS_H
00024
00025 #include <memory>
00026
00027 #include "xap_Features.h"
00028
00029 #include "ut_types.h"
00030 #include "ut_units.h"
00031 #include "ut_bytebuf.h"
00032 #include "ut_growbuf.h"
00033 #include "ut_misc.h"
00034 #include "gr_Image.h"
00035 #include "gr_Caret.h"
00036 #include "gr_Transform.h"
00037 #include "gr_CharWidthsCache.h"
00038 #include "ut_vector.h"
00039 #include "ut_stack.h"
00040 #include "ut_TextIterator.h"
00041
00042 #ifdef ABI_GRAPHICS_PLUGIN
00043 #define VIRTUAL_SFX = 0
00044 #else
00045 #define VIRTUAL_SFX
00046 #endif
00047
00048 class UT_RGBColor;
00049 class XAP_PrefsScheme;
00050 class XAP_Frame;
00051 class UT_String;
00052 class GR_RenderInfo;
00053 class GR_Itemization;
00054 class GR_ShapingInfo;
00055
00056
00071 class GR_Graphics;
00072 class GR_Painter;
00073 class GR_Caret;
00074
00075 enum GrFontType {
00076 GR_FONT_UNSET=0,
00077 GR_FONT_UNIX,
00078 GR_FONT_UNIX_PANGO,
00079 GR_FONT_WIN32,
00080 GR_FONT_WIN32_USP
00081 };
00082
00083 class ABI_EXPORT GR_Font
00084 {
00085 friend class GR_Graphics;
00086 friend class std::map<std::string, GR_Font*>;
00087
00088 public:
00089
00090
00091 virtual ~GR_Font();
00092
00093
00094 enum FontFamilyEnum { FF_Unknown = 0, FF_Roman, FF_Swiss, FF_Modern,
00095 FF_Script, FF_Decorative, FF_Technical, FF_BiDi, FF_Last };
00096 enum FontPitchEnum { FP_Unknown = 0, FP_Fixed, FP_Variable };
00097
00098
00099
00100 static void s_getGenericFontProperties(const char * szFontName,
00101 FontFamilyEnum * pff,
00102 FontPitchEnum * pfp,
00103 bool * pbTrueType);
00104
00105 virtual const char* getFamily() const { return NULL; }
00106 UT_uint32 getAllocNumber() const {return m_iAllocNo;}
00111 virtual UT_sint32 measureUnremappedCharForCache(UT_UCSChar cChar) const = 0;
00112 virtual const std::string & hashKey(void) const;
00113 UT_sint32 getCharWidthFromCache (UT_UCSChar c) const;
00114
00115
00116 virtual GR_CharWidths* newFontWidths(void) const;
00117
00118
00119
00120
00121
00122 virtual bool doesGlyphExist(UT_UCS4Char g) const;
00123
00124
00125
00126
00127
00128
00129
00130 virtual bool glyphBox(UT_UCS4Char g, UT_Rect & rec, GR_Graphics * pG) = 0;
00131 static bool s_doesGlyphExist(UT_UCS4Char g, void *instance)
00132 {
00133 UT_return_val_if_fail(instance, false);
00134 GR_Font * pThis = static_cast<GR_Font*>(instance);
00135 return pThis->doesGlyphExist(g);
00136 }
00137
00138 GrFontType getType()const {return m_eType;}
00139
00140 protected:
00141
00142 GR_Font();
00143
00144 GR_CharWidths * _getCharWidths() const {return m_pCharWidths;}
00149 mutable std::string m_hashKey;
00150
00151 GrFontType m_eType;
00152
00153 private:
00154
00155 static UT_uint32 s_iAllocCount;
00156 UT_uint32 m_iAllocNo;
00157 mutable GR_CharWidths* m_pCharWidths;
00158 };
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 enum GR_GraphicsId
00184 {
00185
00186
00187 GRID_DEFAULT = 0x0,
00188 GRID_DEFAULT_PRINT = 0x1,
00189
00190 GRID_LAST_DEFAULT = 0xff,
00191
00192
00193
00194 GRID_COCOA = 0x102,
00195 GRID_WIN32 = 0x104,
00196 GRID_UNIX = 0x105,
00197 GRID_UNIX_PS = 0x106,
00198 GRID_CAIRO_NULL = 0x107,
00199
00200
00201
00202 GRID_LAST_BUILT_IN = 0x200,
00203
00204
00205
00206
00207 GRID_UNIX_PANGO = 0x201,
00208 GRID_WIN32_UNISCRIBE = 0x202,
00209 GRID_UNIX_PANGO_PRINT = 0x203,
00210 GRID_UNIX_PANGO_PIXMAP = 0x204,
00211 GRID_COCOA_PANGO = 0x205,
00212 GRID_QT = 0x206,
00213
00214 GRID_LAST_EXTENSION = 0x0000ffff,
00215
00216
00217
00218 GRID_UNKNOWN = 0xffffffff
00219 };
00220
00221
00222 enum GR_Capability
00223 {
00224 GRCAP_UNKNOWN = 0,
00225 GRCAP_SCREEN_ONLY = 1,
00226 GRCAP_PRINTER_ONLY = 2,
00227 GRCAP_SCREEN_AND_PRINTER = 3
00228 };
00229
00273 class ABI_EXPORT GR_AllocInfo
00274 {
00275 public:
00276 virtual ~GR_AllocInfo() {}
00277
00278 virtual GR_GraphicsId getType() const {UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); return GRID_UNKNOWN;}
00279 virtual bool isPrinterGraphics()const {UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); return false;}
00280 };
00281
00282 typedef GR_Graphics * (*GR_Allocator)(GR_AllocInfo&);
00283 typedef const char * (*GR_Descriptor)(void);
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 class ABI_EXPORT GR_GraphicsFactory
00294 {
00295
00296 public:
00297 GR_GraphicsFactory(){};
00298 virtual ~GR_GraphicsFactory(){};
00299
00300 UT_uint32 getClassCount() const {return m_vClassIds.getItemCount();}
00301
00302 bool registerClass(GR_Allocator, GR_Descriptor, UT_uint32 iClassId);
00303 UT_uint32 registerPluginClass(GR_Allocator, GR_Descriptor);
00304
00305 void registerAsDefault(UT_uint32 iClassId, bool bScreen)
00306 {
00307 if(bScreen)
00308 m_iDefaultScreen = iClassId;
00309 else
00310 m_iDefaultPrinter = iClassId;
00311 }
00312
00313 UT_uint32 getDefaultClass(bool bScreen) const {if(bScreen) return m_iDefaultScreen; else return m_iDefaultPrinter;}
00314 bool unregisterClass(UT_uint32 iClassId);
00315 bool isRegistered(UT_uint32 iClassId) const;
00316
00317 GR_Graphics * newGraphics(UT_uint32 iClassId, GR_AllocInfo ¶m) const;
00318 const char * getClassDescription(UT_uint32 iClassId) const;
00319
00320
00321 private:
00322 UT_GenericVector<GR_Allocator> m_vAllocators;
00323 UT_GenericVector<GR_Descriptor> m_vDescriptors;
00324 UT_NumberVector m_vClassIds;
00325
00326 UT_uint32 m_iDefaultScreen;
00327 UT_uint32 m_iDefaultPrinter;
00328 };
00329
00330
00331 enum GRShapingResult
00332 {
00333 GRSR_BufferClean = 0x00,
00334 GRSR_None = 0x01,
00335 GRSR_ContextSensitive = 0x02,
00336 GRSR_Ligatures = 0x04,
00337 GRSR_ContextSensitiveAndLigatures = 0x06,
00338 GRSR_Unknown = 0xef,
00339 GRSR_Error = 0xff
00340 };
00341
00342
00343
00344
00345
00346
00347
00348 #define GR_OC_LEFT_FLUSHED 0x40000000 // flip bit 31
00349 #define GR_OC_MAX_WIDTH 0x3fffffff
00350
00351 class ABI_EXPORT AllCarets
00352 {
00353 friend class GR_Graphics;
00354 public:
00355 AllCarets(GR_Graphics * pG,
00356 GR_Caret ** pCaret,
00357 UT_GenericVector<GR_Caret *>* vecCarets );
00358 virtual ~AllCarets(){}
00359 GR_Caret * getBaseCaret(void);
00360 void enable(void);
00361 void disable(bool bNoMulti = false);
00362 void setBlink(bool bBlink);
00363 void JustErase(UT_sint32 xPoint,UT_sint32 yPoint);
00364 void setWindowSize(UT_uint32 width, UT_uint32 height);
00365 void setCoords(UT_sint32 x, UT_sint32 y, UT_uint32 h,
00366 UT_sint32 x2 = 0, UT_sint32 y2 = 0, UT_uint32 h2 = 0,
00367 bool bPointDirection = false,
00368 const UT_RGBColor * pClr = NULL);
00369 void setInsertMode (bool mode);
00370 void forceDraw(void);
00371 bool doBlinkIfNeeded(void);
00372 void setPendingBlink(void);
00373
00374 private:
00375 GR_Graphics * m_pG;
00376 GR_Caret ** m_pLocalCaret;
00377 UT_GenericVector<GR_Caret *>* m_vecCarets;
00378 };
00379
00380
00381 class ABI_EXPORT GR_Graphics
00382 {
00383 friend class GR_Painter;
00384 friend class GR_Caret;
00385 friend class AllCarets;
00386 public:
00387 virtual ~GR_Graphics();
00388
00389
00390
00391
00392
00393 virtual UT_uint32 getClassId() = 0;
00394
00395 virtual GR_Capability getCapability() {UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); return GRCAP_UNKNOWN;}
00396 #if 0
00397
00398
00399 static const char * graphicsDescriptor(void){UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); return "???";}
00400 static GR_Graphics * graphicsAllocator(GR_AllocInfo&){UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED); return NULL;}
00401 #endif
00402
00403 AllCarets * allCarets();
00404 void disableAllCarets();
00405 void enableAllCarets();
00406
00407 UT_sint32 tdu(UT_sint32 layoutUnits) const;
00408 UT_sint32 tlu(UT_sint32 deviceUnits) const;
00409 double tduD(double layoutUnits) const;
00410 double tluD(double deviceUnits) const;
00411 void antiAliasAlways(bool bAntiAlias)
00412 { m_bAntiAliasAlways = bAntiAlias;}
00413 bool getAntiAliasAlways(void)
00414 { return m_bAntiAliasAlways;}
00415
00420 UT_sint32 ftlu(UT_sint32 fontUnits) const;
00421 double ftluD(double fontUnits) const;
00422
00423 virtual void setFont(const GR_Font* pFont) = 0;
00424 virtual void clearFont(void) = 0;
00425 virtual UT_uint32 getFontAscent() = 0;
00426 virtual UT_uint32 getFontDescent() = 0;
00427 virtual UT_uint32 getFontHeight() = 0;
00428 void invalidateCache(void);
00429 virtual bool canQuickPrint(void) const { return false;}
00430 virtual UT_uint32 measureString(const UT_UCSChar*s,
00431 int iOffset,
00432 int num,
00433 UT_GrowBufElement* pWidths, UT_uint32 *height = 0);
00434
00435 virtual UT_sint32 measureUnRemappedChar(const UT_UCSChar c, UT_uint32 * height = 0) = 0;
00436 virtual void getCoverage(UT_NumberVector& coverage) = 0;
00437
00438
00439 virtual UT_uint32 getFontAscent(const GR_Font *) = 0;
00440 virtual UT_uint32 getFontDescent(const GR_Font *) = 0;
00441 virtual UT_uint32 getFontHeight(const GR_Font *) = 0;
00442 virtual double getResolutionRatio(void) const {return 1.0;}
00443
00444 void getMaxCharacterDimension (const UT_UCSChar*s, UT_uint32 Length, UT_uint32 &width, UT_uint32 &height);
00445
00446 virtual void setColor(const UT_RGBColor& clr) = 0;
00447 virtual void getColor(UT_RGBColor& clr) = 0;
00448 virtual GR_Font* getGUIFont() = 0;
00449
00450 GR_Font* findFont(const char* pszFontFamily,
00451 const char* pszFontStyle,
00452 const char* pszFontVariant,
00453 const char* pszFontWeight,
00454 const char* pszFontStretch,
00455 const char* pszFontSize,
00456 const char* pszLang);
00457
00458
00459
00460
00461
00462 #ifdef XAP_HAVE_GR_findNearestFont
00463 static const char* findNearestFont(const char* pszFontFamily,
00464 const char* pszFontStyle,
00465 const char* pszFontVariant,
00466 const char* pszFontWeight,
00467 const char* pszFontStretch,
00468 const char* pszFontSize,
00469 const char* pszLang);
00470 #else
00471 static const char* findNearestFont(const char* pszFontFamily,
00472 const char* ,
00473 const char* ,
00474 const char* ,
00475 const char* ,
00476 const char* ,
00477 const char* )
00478 {return pszFontFamily;}
00479 #endif
00480
00481 const char * invertDimension(UT_Dimension, double) const;
00482
00483 bool scaleDimensions(const char * szLeftIn,
00484 const char * szWidthIn,
00485 UT_uint32 iWidthAvail,
00486 UT_sint32 * piLeft,
00487 UT_uint32 * piWidth) const;
00488
00489 virtual GR_Image* createNewImage(const char* pszName,
00490 const UT_ConstByteBufPtr & pBB,
00491 const std::string& mimetype,
00492 UT_sint32 iWidth,
00493 UT_sint32 iHeight,
00494 GR_Image::GRType iType = GR_Image::GRT_Raster);
00495
00496 virtual void setLineWidth(UT_sint32) = 0;
00497
00498 virtual void setClipRect(const UT_Rect* pRect) = 0;
00499 const UT_Rect * getClipRect(void) const { return m_pRect.get();}
00500 virtual void scroll(UT_sint32, UT_sint32) = 0;
00501 virtual void scroll(UT_sint32 x_dest,
00502 UT_sint32 y_dest,
00503 UT_sint32 x_src,
00504 UT_sint32 y_src,
00505 UT_sint32 width,
00506 UT_sint32 height) = 0;
00507
00508 enum Properties { DGP_SCREEN, DGP_PAPER, DGP_OPAQUEOVERLAY };
00509
00510 enum JoinStyle
00511 {
00512 JOIN_MITER,
00513 JOIN_ROUND,
00514 JOIN_BEVEL
00515 };
00516
00517 enum CapStyle
00518 {
00519 CAP_BUTT,
00520 CAP_ROUND,
00521 CAP_PROJECTING
00522 };
00523
00524 enum LineStyle
00525 {
00526 LINE_SOLID,
00527 LINE_ON_OFF_DASH,
00528 LINE_DOUBLE_DASH,
00529 LINE_DOTTED
00530 };
00531
00532 virtual void setLineProperties ( double inWidthPixels,
00533 JoinStyle inJoinStyle = JOIN_MITER,
00534 CapStyle inCapStyle = CAP_BUTT,
00535 LineStyle inLineStyle = LINE_SOLID ) ;
00536
00537 virtual bool queryProperties(GR_Graphics::Properties gp) const = 0;
00538
00539
00540 virtual bool startPrint(void) = 0;
00541
00542 virtual bool startPage(const char * szPageLabel,
00543 UT_uint32 pageNumber,
00544 bool bPortrait,
00545 UT_uint32 iWidth,
00546 UT_uint32 iHeight) = 0;
00547
00548 virtual bool endPrint(void) = 0;
00549
00550 virtual void flush(void);
00551
00552
00553
00554 enum ColorSpace {
00555 GR_COLORSPACE_COLOR,
00556 GR_COLORSPACE_GRAYSCALE,
00557 GR_COLORSPACE_BW
00558 };
00559
00560 virtual void setColorSpace(GR_Graphics::ColorSpace c) = 0;
00561 virtual GR_Graphics::ColorSpace getColorSpace(void) const = 0;
00562
00563
00564
00565 enum Cursor {
00566 GR_CURSOR_INVALID = 0,
00567 GR_CURSOR_DEFAULT,
00568 GR_CURSOR_IBEAM,
00569 GR_CURSOR_RIGHTARROW,
00570 GR_CURSOR_IMAGE,
00571 GR_CURSOR_IMAGESIZE_NW,
00572 GR_CURSOR_IMAGESIZE_N,
00573 GR_CURSOR_IMAGESIZE_NE,
00574 GR_CURSOR_IMAGESIZE_E,
00575 GR_CURSOR_IMAGESIZE_SE,
00576 GR_CURSOR_IMAGESIZE_S,
00577 GR_CURSOR_IMAGESIZE_SW,
00578 GR_CURSOR_IMAGESIZE_W,
00579 GR_CURSOR_LEFTRIGHT,
00580 GR_CURSOR_UPDOWN,
00581 GR_CURSOR_EXCHANGE,
00582 GR_CURSOR_GRAB,
00583 GR_CURSOR_LINK,
00584 GR_CURSOR_WAIT,
00585 GR_CURSOR_LEFTARROW,
00586 GR_CURSOR_VLINE_DRAG,
00587 GR_CURSOR_HLINE_DRAG,
00588 GR_CURSOR_CROSSHAIR,
00589 GR_CURSOR_DOWNARROW,
00590 GR_CURSOR_DRAGTEXT,
00591 GR_CURSOR_COPYTEXT
00592 };
00593
00594 virtual void setCursor(GR_Graphics::Cursor c) = 0;
00595 virtual GR_Graphics::Cursor getCursor(void) const = 0;
00596
00597 virtual void setZoomPercentage(UT_uint32 iZoom);
00598 inline UT_uint32 getZoomPercentage(void) const {return m_iZoomPercentage; }
00599 static UT_uint32 getResolution(void) { return UT_LAYOUT_RESOLUTION; }
00600 inline void setPortrait (bool b) {m_bIsPortrait = b;}
00601 inline bool isPortrait (void) const {return m_bIsPortrait;}
00602
00603 enum GR_Color3D {
00604 CLR3D_Foreground = 0,
00605 CLR3D_Background = 1,
00606 CLR3D_BevelUp = 2,
00607 CLR3D_BevelDown = 3,
00608 CLR3D_Highlight = 4
00609 };
00610 #define COUNT_3D_COLORS 5
00611
00612 virtual void setColor3D(GR_Color3D c) = 0;
00613 virtual bool getColor3D(GR_Color3D , UT_RGBColor & ) = 0;
00614
00615 const GR_Transform & getTransform() const {return m_Transform;}
00616
00617
00618 bool setTransform(const GR_Transform & tr)
00619 {
00620 bool ret = _setTransform(tr);
00621 if(!ret)
00622 return false;
00623 m_Transform = tr;
00624 return true;
00625 }
00626
00627 void createCaret()
00628 {
00629 UT_ASSERT_HARMLESS(!m_pCaret);
00630 m_pCaret = new GR_Caret(this);
00631 }
00632
00633 GR_Caret * createCaret(const std::string& sID);
00634 GR_Caret * getCaret(const std::string& sID) const;
00635 GR_Caret * getNthCaret(UT_sint32 i) const;
00636 void removeCaret(const std::string& sID);
00637
00638 virtual void saveRectangle(UT_Rect & r, UT_uint32 iIndx) = 0;
00639 virtual void restoreRectangle(UT_uint32 iIndx) = 0;
00640 virtual UT_uint32 getDeviceResolution(void) const = 0;
00641
00642
00643
00644
00645
00646 UT_sint32 getPrevYOffset(void) const { return m_iPrevYOffset;}
00647 UT_sint32 getPrevXOffset(void) const { return m_iPrevXOffset;}
00648 void setPrevYOffset(UT_sint32 y) { m_iPrevYOffset = y;}
00649 void setPrevXOffset(UT_sint32 x) { m_iPrevXOffset = x;}
00650
00651 UT_sint32 _tduX(UT_sint32 layoutUnits) const;
00652
00653
00655
00656
00657
00658 virtual bool itemize(UT_TextIterator & text, GR_Itemization & I) VIRTUAL_SFX;
00659
00660
00661
00662 virtual bool shape(GR_ShapingInfo & si, GR_RenderInfo *& ri) VIRTUAL_SFX;
00663
00664
00665
00666
00667 virtual void prepareToRenderChars(GR_RenderInfo & ri) VIRTUAL_SFX;
00668 virtual void renderChars(GR_RenderInfo & ri) VIRTUAL_SFX;
00669
00670 virtual void appendRenderedCharsToBuff(GR_RenderInfo & ri, UT_GrowBuf & buf) const VIRTUAL_SFX;
00671 virtual void measureRenderedCharWidths(GR_RenderInfo & ri) VIRTUAL_SFX;
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686 virtual bool canBreak(GR_RenderInfo & ri, UT_sint32 &iNext, bool bAfter) VIRTUAL_SFX;
00687
00688
00689
00690 virtual bool needsSpecialCaretPositioning(GR_RenderInfo & ) VIRTUAL_SFX {return false;}
00691
00692
00693
00694
00695
00696
00697
00698 virtual UT_uint32 adjustCaretPosition(GR_RenderInfo & ri, bool bForward) VIRTUAL_SFX;
00699
00700
00701
00702
00703
00704
00705
00706
00707 virtual void adjustDeletePosition(GR_RenderInfo & ri) VIRTUAL_SFX;
00708
00709
00710
00711
00712
00713 virtual bool nativeBreakInfoForRightEdge() VIRTUAL_SFX {return true;}
00714
00715 virtual UT_sint32 resetJustification(GR_RenderInfo & ri, bool bPermanent) VIRTUAL_SFX;
00716 virtual UT_sint32 countJustificationPoints(const GR_RenderInfo & ri) const VIRTUAL_SFX;
00717 virtual void justify(GR_RenderInfo & ri) VIRTUAL_SFX;
00718
00719 virtual UT_uint32 XYToPosition(const GR_RenderInfo & ri, UT_sint32 x, UT_sint32 y) const VIRTUAL_SFX;
00720 virtual void positionToXY(const GR_RenderInfo & ri,
00721 UT_sint32& x, UT_sint32& y,
00722 UT_sint32& x2, UT_sint32& y2,
00723 UT_sint32& height, bool& bDirection) const VIRTUAL_SFX;
00724
00725
00726
00727 virtual UT_sint32 getTextWidth(GR_RenderInfo & ri) VIRTUAL_SFX;
00728
00729
00730
00731
00732
00733 virtual const UT_VersionInfo & getVersion() const {UT_ASSERT_HARMLESS( UT_NOT_IMPLEMENTED ); return s_Version;}
00734 UT_uint32 getPaintCount(void) const
00735 { return m_paintCount;}
00736
00737
00738
00739
00740 void beginPaint ();
00741 void endPaint ();
00742
00743 static GR_Graphics* newNullGraphics();
00744
00745 protected:
00746
00747 GR_Graphics();
00748 GR_Caret * getCaret() { return m_pCaret; }
00749
00750
00751 virtual void _beginPaint () {}
00752 virtual void _endPaint () {}
00753
00754 UT_sint32 _tduY(UT_sint32 layoutUnits) const;
00755 UT_sint32 _tduR(UT_sint32 layoutUnits) const;
00756
00757 void _destroyFonts ();
00758
00759 virtual GR_Font* _findFont(const char* pszFontFamily,
00760 const char* pszFontStyle,
00761 const char* pszFontVariant,
00762 const char* pszFontWeight,
00763 const char* pszFontStretch,
00764 const char* pszFontSize,
00765 const char* pszLang) = 0;
00766
00767
00768 virtual void drawLine(UT_sint32 x1, UT_sint32 y1, UT_sint32 x2, UT_sint32 y2) = 0;
00769 #if XAP_DONTUSE_XOR
00770 #else
00771 virtual void xorLine(UT_sint32 x1, UT_sint32 y1, UT_sint32 x2, UT_sint32 y2) = 0;
00772 #endif
00773 virtual void invertRect(const UT_Rect* pRect) = 0;
00774 #if XAP_DONTUSE_XOR
00775 #else
00776 void xorRect(UT_sint32 x, UT_sint32 y, UT_sint32 w, UT_sint32 h);
00777 void xorRect(const UT_Rect& r);
00778 #endif
00779
00780 virtual void fillRect(GR_Image *pImg, const UT_Rect &src, const UT_Rect & dest);
00781 virtual void fillRect(const UT_RGBColor& c, const UT_Rect &r);
00782 virtual void fillRect(const UT_RGBColor& c, UT_sint32 x, UT_sint32 y,
00783 UT_sint32 w, UT_sint32 h) = 0;
00784
00785 virtual void clearArea(UT_sint32 x, UT_sint32 y, UT_sint32 w, UT_sint32 h) = 0;
00786 virtual void drawImage(GR_Image* pImg, UT_sint32 xDest, UT_sint32 yDest);
00787 virtual void fillRect(GR_Color3D c, UT_Rect &r) = 0;
00788 virtual void fillRect(GR_Color3D c,
00789 UT_sint32 x, UT_sint32 y,
00790 UT_sint32 w, UT_sint32 h) = 0;
00791 virtual void polygon(const UT_RGBColor& c, const UT_Point *pts, UT_uint32 nPoints);
00792 virtual void polyLine(const UT_Point * pts, UT_uint32 nPoints) = 0;
00793 virtual void drawGlyph(UT_uint32 glyph_idx, UT_sint32 xoff, UT_sint32 yoff) = 0;
00794 virtual void drawChars(const UT_UCSChar* pChars,
00795 int iCharOffset,
00796 int iLength,
00797 UT_sint32 xoff,
00798 UT_sint32 yoff,
00799 int* pCharWidths = NULL) = 0;
00800
00801 virtual void drawCharsRelativeToBaseline(const UT_UCSChar* pChars,
00802 int iCharOffset,
00803 int iLength,
00804 UT_sint32 xoff,
00805 UT_sint32 yoff,
00806 int* pCharWidths = NULL);
00807
00808 virtual GR_Image * genImageFromRectangle(const UT_Rect & r) = 0;
00809
00810 private:
00811 virtual bool _setTransform(const GR_Transform & )
00812 {
00813 UT_ASSERT_HARMLESS( UT_NOT_IMPLEMENTED );
00814 return false;
00815 }
00816
00817 public:
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828 UT_uint32 m_iRasterPosition;
00829
00830 protected:
00831 UT_uint32 m_iZoomPercentage;
00832 UT_uint32 m_iFontAllocNo;
00833
00834 static XAP_PrefsScheme *m_pPrefsScheme;
00835 static UT_uint32 m_uTick;
00836
00837 std::unique_ptr<const UT_Rect> m_pRect;
00838
00839 bool m_bHave3DColors;
00840
00841 UT_uint32 m_paintCount;
00842
00843
00844
00845
00846
00847
00848 virtual void _DeviceContext_SwitchToBuffer() { };
00849 virtual void _DeviceContext_SwitchToScreen() { };
00850
00851
00852 bool beginDoubleBuffering();
00853
00854
00855
00856 void endDoubleBuffering(bool token);
00857
00858
00859
00860
00861
00862
00863 virtual void _DeviceContext_SuspendDrawing() { };
00864 virtual void _DeviceContext_ResumeDrawing() { };
00865
00866 bool suspendDrawing();
00867 void resumeDrawing(bool token);
00868
00869
00870 bool m_bDoubleBufferingActive;
00871 bool m_bDrawingSuspended;
00872
00873 enum DeviceContextSwitchType {
00874 SWITCHED_TO_BUFFER = 0,
00875 DRAWING_SUSPENDED
00876 };
00877
00878 UT_NumberStack m_DCSwitchManagementStack;
00879
00880 private:
00881 GR_Caret * m_pCaret;
00882 bool _PtInPolygon(const UT_Point * pts, UT_uint32 nPoints, UT_sint32 x,UT_sint32 y);
00883 bool m_bIsPortrait;
00884 bool m_bSpawnedRedraw;
00885 UT_Rect m_PendingExposeArea;
00886 UT_Rect m_RecentExposeArea;
00887 bool m_bExposePending;
00888 bool m_bIsExposedAreaAccessed;
00889 bool m_bDontRedraw;
00890 bool m_bDoMerge;
00891
00892
00893
00894
00895 UT_sint32 m_iPrevYOffset;
00896 UT_sint32 m_iPrevXOffset;
00897 GR_Transform m_Transform;
00898
00899 typedef std::map<std::string, GR_Font*> FontCache;
00900 FontCache m_hashFontCache;
00901
00902 static UT_VersionInfo s_Version;
00903 static UT_uint32 s_iInstanceCount;
00904 static UT_UCS4Char s_cDefaultGlyph;
00905 UT_GenericVector<GR_Caret *> m_vecCarets;
00906 AllCarets m_AllCarets;
00907 bool m_bAntiAliasAlways;
00908 };
00909
00910 #endif