00001
00002
00003
00004
00005
00006 #ifndef H_CPPPDFElement
00007 #define H_CPPPDFElement
00008
00009 #include <SDF/Obj.h>
00010 #include <PDF/GState.h>
00011 #include <PDF/Rect.h>
00012 #include <PDF/CharData.h>
00013 #include <PDF/Struct/SElement.h>
00014 #include <C/PDF/TRN_Element.h>
00015
00016 namespace pdftron {
00017 namespace PDF {
00018
00019
00032 class Element
00033 {
00034 public:
00035
00036
00037 enum Type
00038 {
00039 e_null,
00040 e_path,
00041 e_text_begin,
00042 e_text,
00043 e_text_new_line,
00044 e_text_end,
00045 e_image,
00046 e_inline_image,
00047 e_shading,
00048 e_form,
00049 e_group_begin,
00050 e_group_end,
00051 e_marked_content_begin,
00052 e_marked_content_end,
00053 e_marked_content_point
00054 };
00055
00056 Element();
00057 Element(const Element& c);
00058 Element& operator=(const Element&c);
00059 operator bool () { return mp_elem!=0;}
00060
00064 Type GetType();
00065
00069 GState GetGState();
00070
00075 Common::Matrix2D GetCTM();
00076
00097 bool GetBBox(Rect& out_bbox);
00098
00104 Struct::SElement GetParentStructElement();
00105
00113 int GetStructMCID();
00114
00125 bool IsOCVisible();
00126
00127
00128
00133 bool IsClippingPath();
00134
00138 bool IsStroked();
00139
00143 bool IsFilled();
00144
00162 bool IsWindingFill();
00163
00168 bool IsClipWindingFill();
00169
00170 enum PathSegmentType
00171 {
00172
00173
00174 e_moveto = 1,
00175
00176
00177
00178
00179 e_lineto,
00180
00181
00182
00183
00184
00185 e_cubicto,
00186
00187
00188
00189
00190
00191
00192 e_conicto,
00193
00194
00195
00196 e_rect,
00197
00198
00199
00200
00201 e_closepath
00202 };
00203
00211 const char* GetPathTypes();
00212
00216 int GetPathTypesCount();
00217
00226 const double* GetPathPoints();
00227
00231 int GetPointCount();
00232
00233
00234
00235
00239 void SetPathClip(bool clip);
00240
00244 void SetPathStroke(bool stroke);
00245
00249 void SetPathFill(bool fill);
00250
00256 void SetWindingFill(bool winding_rule);
00257
00264 void SetClipWindingFill(bool winding_rule);
00265
00266
00275 void SetPathPoints(const double* in_points, int count);
00276
00284 void SetPathTypes(const char* in_seg_types, int count);
00285
00286
00287
00288
00292 SDF::Obj GetXObject();
00293
00294
00295
00296
00300 Filters::Filter GetImageData() const;
00301
00305 int GetImageDataSize() const;
00306
00318 #if defined(_WIN32) && !defined(WINCE)
00319 Gdiplus::Bitmap* GetBitmap() const;
00320 #endif
00321
00328 ColorSpace GetImageColorSpace() const;
00329
00333 int GetImageWidth() const;
00334
00338 int GetImageHeight() const;
00339
00348 SDF::Obj GetDecodeArray() const;
00349
00355 int GetBitsPerComponent() const;
00356
00360 int GetComponentNum() const;
00361
00362
00366 bool IsImageMask() const;
00367
00371 bool IsImageInterpolate() const;
00372
00380 SDF::Obj GetMask() const;
00381
00385 GState::RenderingIntent GetImageRenderingIntent() const;
00386
00387
00388
00406 const UString* GetTextString();
00407
00422 const UChar* GetTextData();
00423
00427 UInt32 GetTextDataSize();
00428
00432 Common::Matrix2D GetTextMatrix();
00433
00464 CharIterator GetCharIterator();
00465
00480 double GetTextLength();
00481
00491 double GetPosAdjustment();
00492
00493
00494
00502 void GetNewTextLineOffset(double& out_x, double& out_y);
00503
00504
00505
00511 bool HasTextMatrix();
00512
00513
00514
00515
00521 void SetTextData(const UChar* text_data, int text_data_size);
00522
00528 void SetTextMatrix(Common::Matrix2D& mtx);
00529
00549 void SetTextMatrix(double a, double b, double c, double d, double h, double v);
00550
00557 void SetPosAdjustment(double adjust);
00558
00568 void UpdateTextMetrics();
00569
00570
00571
00572
00577 void SetNewTextLineOffset(double dx, double dy);
00578
00579
00580
00581
00585 Shading GetShading();
00586
00587
00588
00589
00598 SDF::Obj GetMCPropertyDict();
00599
00604 SDF::Obj GetMCTag();
00605
00606 ~Element() {}
00607
00608
00610 Element(TRN_Element impl);
00611 TRN_Element mp_elem;
00613 };
00614
00615
00616 #include <Impl/Element.inl>
00617
00618 };
00619 };
00620
00621 #endif