⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rvrtf.pas

📁 richview1.7 full.source
💻 PAS
📖 第 1 页 / 共 5 页
字号:
       property SpacingTw  [Index:TRVRTFSide]: Integer read GetSpacingTw;
       property UsePadding [Index:TRVRTFSide]: Boolean read GetUsePadding;
       property UseSpacing [Index:TRVRTFSide]: Boolean read GetUseSpacing;
       property Border         : TRVRTFParaBorder read FBorder;
       property Heading        : Boolean         read FHeading; 
   end;
   {-------------------- section properties -----------------------}
   TRVRTFSectionBreakType = (rtf_sbk_None, rtf_sbk_Column, rtf_sbk_Even, rtf_sbk_Odd, rtf_sbk_Page);
   TRVRTFPageNumberFormat = (rtf_pg_Decimal,
                             rtf_pg_UpperRoman, rtf_pg_LowerRoman,
                             rtf_pg_UpperLetter, rtf_pg_LowerLetter);

   TRVRTFSectionProperties = class
     private
       FColumnCount: Integer;
       FSectionBreakType: TRVRTFSectionBreakType;
       FPageNumberXTw, FPageNumberYTw: Integer;
       FPageNumberFormat: TRVRTFPageNumberFormat;
       FHeaderYTw, FFooterYTw: Integer;
       FDefMarkerPropsList: TRVList;
       procedure InitListDefaults;
     public
       constructor Create;
       procedure Reset;
       destructor Destroy; override;
       procedure Assign(Source: TRVRTFSectionProperties);
       property ColumnCount     : Integer                read FColumnCount;
       property SectionBreakType: TRVRTFSectionBreakType read FSectionBreakType;
       property PageNumberXTw   : Integer                read FPageNumberXTw;
       property PageNumberYTw   : Integer                read FPageNumberYTw;
       property PageNumberFormat: TRVRTFPageNumberFormat read FPageNumberFormat;
       property HeaderYTw       : Integer                read FHeaderYTw;
       property FooterYTw       : Integer                read FFooterYTw;
   end;
   {-------------------- document properties -----------------------}
    TRVRTFDocProperties = class
      private
        FPaperWidthTw, FPaperHeightTw: Integer;
        FLeftMarginTw, FTopMarginTw, FRightMarginTw, FBottomMarginTw: Integer;
        FPageNumberStart: Integer;
        FFacingPages: Boolean;
        FLandscape: Boolean;
      public
        constructor Create;
        procedure Reset;
        procedure Assign(Source: TRVRTFDocProperties);
        property PaperWidthTw   : Integer read FPaperWidthTw;
        property PaperHeightTw  : Integer read FPaperHeightTw;
        property LeftMarginTw   : Integer read FLeftMarginTw;
        property TopMarginTw    : Integer read FTopMarginTw;
        property RightMarginTw  : Integer read FRightMarginTw;
        property BottomMarginTw : Integer read FBottomMarginTw;
        property PageNumberStart: Integer read FPageNumberStart;
        property FacingPages    : Boolean read FFacingPages;
        property Landscape      : Boolean read FLandscape;
    end;
//----------------------------------------------------------------------
    TRTFrds = ( rdsNorm, rdsSkip,  rdsFontTable, rdsStyleSheet, rdsColorTable,
                rdsStyleSheetEntry, rdsPict,
                rdsField, rdsFldInst, rdsPN, rdsPNTextAfter, rdsPNTextBefore,
                rdsPNSecLvl, rdsListTable, rdsList, rdsListLevel,
                rdsListName, rdsListLevelText, rdsListLevelNumbers,
                rdsLOTable, rdsLO, rdsLOLevel);       // Rtf Destination State
//----------------------------------------------------------------------
    TRTFris = ( risNorm, risBin, risHex );// Rtf Internal State
//----------------------------------------------------------------------
// What types of properties are there?
    TRTFIPROP = (ipropBold, ipropItalic, ipropUnderline, ipropStrike,
              ipropCharScaleX, ipropCharSpacing, ipropSScript, ipropAllCaps,
              ipropFontSize, ipropTextColor, ipropTextBackColor, ipropHighlight,
              ipropSL, ipropSLMult,
              ipropLeftInd,
              ipropRightInd, ipropFirstInd, ipropCols, ipropPgnX,
              ipropPgnY, ipropHeaderY, ipropFooterY, ipropXaPage, ipropYaPage, ipropXaLeft,
              ipropXaRight, ipropYaTop, ipropYaBottom, ipropPgnStart,
              ipropSbk, ipropPgnFormat, ipropFacingp, ipropLandscape,
              ipropJust, ipropPard, ipropPlain, ipropSectd,
              ipropF, ipropDefF, ipropSpaceBefore, ipropSpaceAfter,
              ipropParaBorderType, ipropParaBorderSide, ipropParaBorderWidth,
              ipropParaBorderColor, ipropParaBorderSpace, ipropParaColor,
              ipropAnsiCodePage, ipropU, ipropUC,
              ipropPage, ipropField, ipropFldInst, ipropFldRslt, ipropHidden,
              // color table:
              ipropRed, ipropGreen, ipropBlue,
              // font table:
              ipropFontFamily,
              ipropFCharset,
              // style sheet
              ipropS, ipropCS, ipropDS, ipropSBasedOn, irpropSNext, ipropAdditive, ipropSHidden,
              // picture
              ipropPicW, ipropPicH, ipropPicScaleX, ipropPicScaleY,
              ipropWBMWidthBytes, ipropPictureType,
              ipropMetafile, ipropPicBmp,
              // lists
              ipropPNLevel, ipropPNHanging, ipropPNType,
              ipropPNBold, ipropPNItalic, ipropPNUnderline, ipropPNStrike,
              ipropPNColor, ipropPNF, ipropPNFontSize, ipropPNIndent, ipropPNSp,
              ipropPNAlign, ipropPNStart, ipropPNSecLvl,
              // new lists
              ipropListId, ipropListTemplateId, ipropListSimple, ipropListName,
              ipropLevelStartAt, ipropLevelNumberType, ipropLevelJustify, ipropLevelOld,
              ipropLevelIndent, ipropLevelSpace, ipropLevelFollow,
              ipropLevelLegal, ipropLevelNoRestart, ipropLOCount, ipropLONumber,
              ipropLOStart, ipropLevel, ipropTX,
              // tables
              ipropRowEnd, ipropCellEnd, ipropInTbl, ipropItap,
              ipropTRowD, ipropRowAlign, ipropTRGapH, ipropTRLeft, ipropTRRowHeight,
              ipropTRHeader, ipropTRPaddL, ipropTRPaddR, ipropTRPaddT, ipropTRPaddB,
              ipropTRPaddFL, ipropTRPaddFR, ipropTRPaddFT, ipropTRPaddFB,
              ipropTRSpdL, ipropTRSpdR, ipropTRSpdT, ipropTRSpdB,
              ipropTRSpdFL, ipropTRSpdFR, ipropTRSpdFT, ipropTRSpdFB,
              ipropTRwWidth, ipropTRftsWidth,
              ipropCLVMerge, ipropCLHMerge,
              ipropCLwWidth, ipropCLftsWidth, ipropCLColor, ipropCLFColor, ipropCLShading,ipropCLVertAl,
              ipropCellX, ipropTRBorderSide, ipropCLBorderSide, ipropNoTableEv,
              ipropNoResetLev,
              {$IFDEF RICHVIEW}
              ipropRVCellBestWidth,ipropRVCellBestHeight,ipropRVTableBestWidth,
              {$ENDIF}
              ipropMax);
//----------------------------------------------------------------------
    TRTFACTN = (actnSpec, actnByte, actnWord);
//----------------------------------------------------------------------
    TRTFPROPTYPE = (propChp, propPap, propSep, propDop);
//----------------------------------------------------------------------
    TRTFpropmod = record
      actn: TRTFACTN;       // size of value
      prop: TRTFPROPTYPE;   // structure containing value
      offset: Integer;      // offset of value from base of structure
    end; //PROP;
//----------------------------------------------------------------------
    TRTFIPFN = ( ipfnBin, ipfnHex, ipfnSkipDest );
//----------------------------------------------------------------------
    TRTFIDEST = ( idestPict, idestSkip,  idestFontTable,  idestStyleSheet, idestColorTable,
                  idestStyleSheetParaStyle, idestStyleSheetCharStyle, idestStyleSheetSectStyle,
                  idestField, idestFldInst, idestFldRslt,
                  idestNestedTableProps, idestHeader, idestFooter,
                  idestPNTextAfter, idestPNTextBefore,
                  idestPN, idestPNSecLvl,
                  idestListTable, idestList, idestListName, idestListLevel,
                  idestLevelText, idestLevelNumbers, idestLOTable, idestLO, idestLOLevel);
//----------------------------------------------------------------------
    TRVRTFKeywordType = ( rtf_kwd_Char, rtf_kwd_WideChar, rtf_kwd_Dest, rtf_kwd_Prop, rtf_kwd_Spec );
//----------------------------------------------------------------------
    TRVRTFKeywordAffect = (rtf_af_None, rtf_af_CharProp, rtf_af_ParaProp,
                           rtf_af_BothProp);
    TRVRTFsymbol = record
      Keyword: String;    // RTF keyword
      DefValue: Integer;  // default value to use
      UseDef: Boolean;    // true to use default value from this table
      Kwd: TRVRTFKeywordType; // base action to take
      Idx: Integer;       // index into property table    if Kwd == trf_kwd_Prop
                          // index into destination table if Kwd == trf_kwd_Dest
                          // character to print           if Kwd == trf_kwd_Char
      AffectTo: TRVRTFKeywordAffect;
    end;
    PRVRTFsymbol = ^TRVRTFsymbol;
    {----------------------------------------------------------------------}
    // RTF Style Sheet
    TRVRTFStyleSheetType = (rtf_sst_Char, rtf_sst_Par, rtf_sst_Sect);

    TRVRTFReaderState = class;

    TRVRTFStyleSheetEntry = class
      private
        FParaProps: TRVRTFParaProperties;
        FCharProps: TRVRTFCharProperties;
        FAdditive, FHidden: Boolean;
        FNumber:  Integer;
        FStyleType: TRVRTFStyleSheetType;
        FBasedOn, FNext:  TRVRTFStyleSheetEntry;
        FName: String;
      public
        constructor Create;
        destructor Destroy; override;
        procedure Assign(Source:TRVRTFReaderState);
        property ParaProps: TRVRTFParaProperties  read FParaProps;
        property CharProps: TRVRTFCharProperties  read FCharProps;
        property Additive : Boolean               read FAdditive;
        property Hidden   : Boolean               read FHidden;
        property Number   : Integer               read FNumber;
        property StyleType: TRVRTFStyleSheetType  read FStyleType;
        property BasedOn  : TRVRTFStyleSheetEntry read FBasedOn;
        property Next     : TRVRTFStyleSheetEntry read FNext;
        property Name     : String                read FName;
    end;

    TRVRTFStyleSheet = class (TRVList)
      private
        function Get(Index: Integer): TRVRTFStyleSheetEntry;
        procedure Put(Index: Integer; const Value: TRVRTFStyleSheetEntry);
        procedure AddPara(Number: Integer);
      public
        function GetEntry(Number: Integer): TRVRTFStyleSheetEntry;
        property Items[Index: Integer]: TRVRTFStyleSheetEntry read Get write Put; default;
    end;
    {----------------------------------------------------------------------}
    // RTF font table

    TRVRTFFontFamily = (rtf_ff_Default, rtf_ff_Roman, rtf_ff_Swiss,
                        rtf_ff_Modern, rtf_ff_Script, rtf_ff_Decorative,
                        rtf_ff_Symbol, rtf_ff_BiDi);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -