Unit1.h
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:9k
源码类别:

RichEdit

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #ifndef Unit1H
  3. #define Unit1H
  4. //---------------------------------------------------------------------------
  5. #include <vclClasses.hpp>
  6. #include <vclControls.hpp>
  7. #include <vclStdCtrls.hpp>
  8. #include <vclForms.hpp>
  9. #include <vclOleCtnrs.hpp>
  10. #include <vclComCtrls.hpp>
  11. #include <vclExtCtrls.hpp>
  12. #include <vclButtons.hpp>
  13. #include <vclMenus.hpp>
  14. #include <vclDialogs.hpp>
  15. #include "RVEdit.hpp"
  16. #include "RichView.hpp"
  17. #include "RVScroll.hpp"
  18. #include "PtblRV.hpp"
  19. #include "RVStyle.hpp"
  20. #include <Graphics.hpp>
  21. #include <ImgList.hpp>
  22. //---------------------------------------------------------------------------
  23. class TForm1 : public TForm
  24. {
  25. __published: // IDE-managed Components
  26.     TRichViewEdit *RichViewEdit1;
  27.     TStatusBar *StatusBar1;
  28.     TPanel *Panel1;
  29.     TComboBox *cmbText;
  30.     TComboBox *cmbPara;
  31.     TMainMenu *MainMenu1;
  32.     TMenuItem *mpdFile;
  33.     TMenuItem *mitLoad;
  34.     TMenuItem *mitSave;
  35.     TMenuItem *N2;
  36.     TMenuItem *mitPreview;
  37.     TMenuItem *mitPrint;
  38.     TMenuItem *N4;
  39.     TMenuItem *mitClear;
  40.     TMenuItem *N1;
  41.     TMenuItem *mitExit;
  42.     TMenuItem *mpdEdit;
  43.     TMenuItem *mitUndo;
  44.     TMenuItem *mitRedo;
  45.     TMenuItem *N10;
  46.     TMenuItem *mitCut;
  47.     TMenuItem *mitCopy;
  48.     TMenuItem *mitPaste;
  49.     TMenuItem *PasteAs1;
  50.     TMenuItem *mitPasteAsRTF;
  51.     TMenuItem *mitPasteAsText;
  52.     TMenuItem *mitPasteAsUnicodeText;
  53.     TMenuItem *mitPasteAsMetafile;
  54.     TMenuItem *mitPasteAsBitmap;
  55.     TMenuItem *mitPasteAsRVF;
  56.     TMenuItem *N8;
  57.     TMenuItem *mitPasteAsOLE;
  58.     TMenuItem *mitDelete;
  59.     TMenuItem *mitSelectAll;
  60.     TMenuItem *N6;
  61.     TMenuItem *mitSearch;
  62.     TMenuItem *mitSelectCurrentWord;
  63.     TMenuItem *N9;
  64.     TMenuItem *mitInsertPageBreak;
  65.     TMenuItem *mitRemovePageBreak;
  66.     TMenuItem *N3;
  67.     TMenuItem *mitEditCheckpoint;
  68.     TMenuItem *mitEditProps;
  69.     TMenuItem *mpdInsert;
  70.     TMenuItem *mitInsertFile;
  71.     TMenuItem *mitPicture;
  72.     TMenuItem *mpdComponent;
  73.     TMenuItem *mitButtonComp;
  74.     TMenuItem *mitEditBoxComp;
  75.     TMenuItem *mpdBullet;
  76.     TMenuItem *mitHelpIcon;
  77.     TMenuItem *mitHelpSearchIcon;
  78.     TMenuItem *mitPropertiesIcon;
  79.     TMenuItem *mpdHotspot;
  80.     TMenuItem *mitAddImageHS;
  81.     TMenuItem *mitAddTextHS;
  82.     TMenuItem *mitBreak;
  83.     TMenuItem *mpdTable;
  84.     TMenuItem *mitInserttable1;
  85.     TMenuItem *mitInsertTable2;
  86.     TMenuItem *mitInsertTable3;
  87.     TMenuItem *mitInsertTable4;
  88.     TMenuItem *N7;
  89.     TMenuItem *Insert1;
  90.     TMenuItem *mitRowsAbove;
  91.     TMenuItem *mitRowsBelow;
  92.     TMenuItem *N14;
  93.     TMenuItem *mitColsLeft;
  94.     TMenuItem *mitColsRight;
  95.     TMenuItem *Delete1;
  96.     TMenuItem *mitDelRows;
  97.     TMenuItem *mitDelColumns;
  98.     TMenuItem *N13;
  99.     TMenuItem *mitMergeCells;
  100.     TMenuItem *Split1;
  101.     TMenuItem *mitSplitVertically;
  102.     TMenuItem *mitSplitHorizontally;
  103.     TMenuItem *Unmerge1;
  104.     TMenuItem *mitUmRows;
  105.     TMenuItem *mitUmCols;
  106.     TMenuItem *mitUmRowsandCols;
  107.     TMenuItem *mpdMisc;
  108.     TMenuItem *mpdBackground;
  109.     TMenuItem *mitBackNoBitmap;
  110.     TMenuItem *mitBackStretched;
  111.     TMenuItem *mitBackTiled;
  112.     TMenuItem *mitBackTiledandScrolled;
  113.     TMenuItem *mitBackCentered;
  114.     TMenuItem *N5;
  115.     TMenuItem *mitCheckpointList;
  116.     TOpenDialog *OpenDialog1;
  117.     TSaveDialog *SaveDialog1;
  118.     TPopupMenu *PopupMenu1;
  119.     TMenuItem *mitEditCheckpoint1;
  120.     TMenuItem *mitEditProp1;
  121.     TFindDialog *FindDialog1;
  122.     TRVPrint *RVPrint1;
  123.     TPrinterSetupDialog *psd;
  124.     TImageList *il;
  125.     TMenuItem *N11;
  126.     TMenuItem *mitReadOnly;
  127. TMenuItem *N12;
  128. TMenuItem *OptionsforSavingLoading1;
  129. TMenuItem *mpdLists;
  130. TMenuItem *mitApplyLists;
  131. TMenuItem *mitRemoveLists;
  132. TRVStyle *RVStyle1;
  133.         TMenuItem *mitBackTopLeft;
  134.         TMenuItem *mitBackTopRight;
  135.         TMenuItem *mitBackBottomLeft;
  136.         TMenuItem *mitBackBottomRight;
  137.     void __fastcall FormCreate(TObject *Sender);
  138.     void __fastcall RichViewEdit1CurParaStyleChanged(TObject *Sender);
  139.     void __fastcall RichViewEdit1CurTextStyleChanged(TObject *Sender);
  140.     void __fastcall cmbParaClick(TObject *Sender);
  141.     void __fastcall cmbTextClick(TObject *Sender);
  142.     void __fastcall mitLoadClick(TObject *Sender);
  143.     void __fastcall RichViewEdit1RVFPictureNeeded(TCustomRichView *Sender,
  144.     AnsiString Name, int Tag, TGraphic *&gr);
  145.     void __fastcall RichViewEdit1RVFControlNeeded(TCustomRichView *Sender,
  146.     AnsiString Name, int Tag, TControl *&ctrl);
  147.     void __fastcall RichViewEdit1RVFImageListNeeded(TCustomRichView *Sender,
  148.     int ImageListTag, TCustomImageList *&il);
  149.     void __fastcall mitSaveClick(TObject *Sender);
  150.     void __fastcall mitClearClick(TObject *Sender);
  151.     void __fastcall mitPreviewClick(TObject *Sender);
  152.     void __fastcall RichViewEdit1SaveComponentToFile(TCustomRichView *Sender,
  153.     AnsiString Path, TPersistent *SaveMe, TRVSaveFormat SaveFormat,
  154.     AnsiString &OutStr);
  155.     void __fastcall mitPrintClick(TObject *Sender);
  156.     void __fastcall mitExitClick(TObject *Sender);
  157.     void __fastcall mitInsertFileClick(TObject *Sender);
  158.     void __fastcall mitPictureClick(TObject *Sender);
  159.     void __fastcall mitButtonCompClick(TObject *Sender);
  160.     void __fastcall mitEditBoxCompClick(TObject *Sender);
  161.     void __fastcall mitInsertBulletClick(TObject *Sender);
  162.     void __fastcall mitInsertHotspotClick(TObject *Sender);
  163.     void __fastcall mitBreakClick(TObject *Sender);
  164.     void __fastcall mpdEditClick(TObject *Sender);
  165.     void __fastcall mitUndoClick(TObject *Sender);
  166.     void __fastcall mitRedoClick(TObject *Sender);
  167.     
  168.     void __fastcall mitCutClick(TObject *Sender);
  169.     void __fastcall mitCopyClick(TObject *Sender);
  170.     void __fastcall mitPasteClick(TObject *Sender);
  171.     
  172.     void __fastcall mitPasteAsRTFClick(TObject *Sender);
  173.     void __fastcall mitPasteAsTextClick(TObject *Sender);
  174.     void __fastcall mitPasteAsUnicodeTextClick(TObject *Sender);
  175.     void __fastcall mitPasteAsMetafileClick(TObject *Sender);
  176.     void __fastcall mitPasteAsBitmapClick(TObject *Sender);
  177.     
  178.     void __fastcall mitPasteAsRVFClick(TObject *Sender);
  179.     void __fastcall mitPasteAsOLEClick(TObject *Sender);
  180.     void __fastcall mitDeleteClick(TObject *Sender);
  181.     void __fastcall mitSelectAllClick(TObject *Sender);
  182.     void __fastcall RichViewEdit1Select(TObject *Sender);
  183.     void __fastcall mitInsertPageBreakClick(TObject *Sender);
  184.     void __fastcall mitRemovePageBreakClick(TObject *Sender);
  185.     void __fastcall mitEditCheckpointClick(TObject *Sender);
  186.     void __fastcall mitSearchClick(TObject *Sender);
  187.     void __fastcall mitSelectCurrentWordClick(TObject *Sender);
  188.     void __fastcall mitEditPropsClick(TObject *Sender);
  189.     void __fastcall mitCheckpointListClick(TObject *Sender);
  190.     void __fastcall mpdBackgroundClick(TObject *Sender);
  191.     void __fastcall mitBackClick(TObject *Sender);
  192.     void __fastcall PopupMenu1Popup(TObject *Sender);
  193.     void __fastcall RichViewEdit1Change(TObject *Sender);
  194.     void __fastcall FindDialog1Find(TObject *Sender);
  195.     void __fastcall RichViewEdit1Jump(TObject *Sender, int id);
  196.     void __fastcall RichViewEdit1RVMouseMove(TObject *Sender, int id);
  197.     void __fastcall mitInserttable1Click(TObject *Sender);
  198.     void __fastcall mitInsertTable2Click(TObject *Sender);
  199.     void __fastcall mitInsertTable3Click(TObject *Sender);
  200.     void __fastcall mitInsertTable4Click(TObject *Sender);
  201.     void __fastcall mpdTableClick(TObject *Sender);
  202.     void __fastcall mitCellOperation(TObject *Sender);
  203.     void __fastcall mitReadOnlyClick(TObject *Sender);
  204. void __fastcall OptionsforSavingLoading1Click(TObject *Sender);
  205. void __fastcall mitApplyListsClick(TObject *Sender);
  206. void __fastcall mitRemoveListsClick(TObject *Sender);
  207. void __fastcall RichViewEdit1Click(TObject *Sender);
  208. void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  209. void __fastcall RichViewEdit1ControlAction(TCustomRichView *Sender,
  210. TRVControlAction ControlAction, int ItemNo, TControl *&ctrl);
  211. void __fastcall RichViewEdit1WriteHyperlink(TCustomRichView *Sender, int id,
  212. TCustomRVData *RVData, int ItemNo, TRVSaveFormat SaveFormat,
  213. AnsiString &Target, AnsiString &Extras);
  214. protected:
  215.     void __fastcall WMDisplayChange(TMessage &Message);
  216.       BEGIN_MESSAGE_MAP
  217.         MESSAGE_HANDLER(WM_DISPLAYCHANGE, TMessage, WMDisplayChange)
  218.       END_MESSAGE_MAP(TForm)
  219. private: // User declarations
  220.     TOleContainer* ActiveOleContainer;
  221.     TRVSaveOptions HTMLSaveOptions;
  222.     AnsiString HTMLTitle;
  223.     void UpdateUndoMenu();
  224.     AnsiString GetUnicodeFontName();
  225.     void FillStyleCombo(TCustomRVInfos* Styles, TComboBox* cmb);
  226.     void DisplayUnicodeWarning();
  227.     AnsiString GetRVFErrors();
  228.     void __fastcall OnOleResize(TObject *Sender);
  229.     void __fastcall OnOleActivate(TObject *Sender);
  230.     void __fastcall OnOleDeactivate(TObject *Sender);
  231.     void __fastcall OnControlClick(TObject *Sender);
  232.     void CloseOleContainer();
  233. public: // User declarations
  234.     __fastcall TForm1(TComponent* Owner);
  235. };
  236. //---------------------------------------------------------------------------
  237. extern TForm1 *Form1;
  238. //---------------------------------------------------------------------------
  239. #endif
  240.