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

RichEdit

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #include <vclvcl.h>
  3. #pragma hdrstop
  4. #include "OptionsFrm.h"
  5. //---------------------------------------------------------------------------
  6. #pragma resource "*.dfm"
  7. TfrmOptions *frmOptions;
  8. //---------------------------------------------------------------------------
  9. __fastcall TfrmOptions::TfrmOptions(TComponent* Owner)
  10. : TForm(Owner)
  11. {
  12. }
  13. //---------------------------------------------------------------------------
  14. void SetRVFOption(bool Value, TRVFOption Option, TRVFOptions& RVFOptions)
  15. {
  16.   if (Value)
  17.     RVFOptions << Option;
  18.   else
  19.     RVFOptions >> Option;
  20. }
  21. //---------------------------------------------------------------------------
  22. void SetHTMLOption(bool Value, TRVSaveOption Option, TRVSaveOptions& HTMLOptions)
  23. {
  24.   if (Value)
  25.     HTMLOptions << Option;
  26.   else
  27.     HTMLOptions >> Option;
  28. }
  29. //---------------------------------------------------------------------------
  30. void TfrmOptions::GetOptions(TRVFOptions& RVFOptions, TRVSaveOptions& HTMLOptions,
  31.   AnsiString& HTMLTitle)
  32. {
  33.   RVFOptions  = TRVFOptions();
  34.   HTMLOptions = TRVSaveOptions();
  35.   SetRVFOption(cbRVFSaveBackground->Checked, rvfoSaveBack, RVFOptions);
  36.   SetRVFOption(cbRVFSaveLayout->Checked,     rvfoSaveLayout, RVFOptions);
  37.   SetRVFOption(cbRVFBinary->Checked,         rvfoSaveBinary, RVFOptions);
  38.   SetRVFOption(cbRVFSavePictures->Checked,   rvfoSavePicturesBody, RVFOptions);
  39.   SetRVFOption(cbRVFSaveControls->Checked,   rvfoSaveControlsBody, RVFOptions);
  40.   SetRVFOption(cbRVFLoadBackground->Checked, rvfoLoadBack, RVFOptions);
  41.   SetRVFOption(cbRVFLoadLayout->Checked,     rvfoLoadLayout, RVFOptions);
  42.   SetRVFOption(cbRVFIgnoreUnknownPictures->Checked , rvfoIgnoreUnknownPicFmt, RVFOptions);
  43.   SetRVFOption(cbRVFIgnoreUnknownControls->Checked , rvfoIgnoreUnknownCtrls, RVFOptions);
  44.   SetRVFOption(cbRVFInvStyles->Checked,              rvfoConvUnknownStylesToZero, RVFOptions);
  45.   SetRVFOption(cbRVFInvImageIndices->Checked,        rvfoConvLargeImageIdxToZero, RVFOptions);
  46.   SetRVFOption(cbRVFSaveTextStyles->Checked,  rvfoSaveTextStyles, RVFOptions);
  47.   SetRVFOption(cbRVFSaveParaStyles->Checked,  rvfoSaveParaStyles, RVFOptions);
  48.   SetHTMLOption(cbHTMLOverrideImages->Checked, rvsoOverrideImages, HTMLOptions);
  49.   SetHTMLOption(cbHTMLListAsTest->Checked, rvsoMarkersAsText, HTMLOptions);
  50.   SetHTMLOption(cbHTMLForceNonTextCSS->Checked, rvsoForceNonTextCSS, HTMLOptions);
  51.   SetHTMLOption(cbHTMLDefault0Style->Checked, rvsoDefault0Style, HTMLOptions);
  52.   SetHTMLOption(cbHTMLSaveImageSizes->Checked, rvsoImageSizes, HTMLOptions);
  53.   SetHTMLOption(cbHTMLNoHypertextImageBorders->Checked, rvsoNoHypertextImageBorders, HTMLOptions);
  54.   SetHTMLOption(cbHTMLUseCheckpointsNames->Checked, rvsoUseCheckpointsNames, HTMLOptions);
  55.   HTMLTitle = txtHTMLTitle->Text;
  56. }
  57. //---------------------------------------------------------------------------
  58. void TfrmOptions::SetOptions(TRVFOptions RVFOptions, TRVSaveOptions HTMLOptions,
  59.   const AnsiString HTMLTitle)
  60. {
  61.   cbRVFSaveBackground->Checked = RVFOptions.Contains(rvfoSaveBack);
  62.   cbRVFSaveLayout->Checked     = RVFOptions.Contains(rvfoSaveLayout);
  63.   cbRVFBinary->Checked         = RVFOptions.Contains(rvfoSaveBinary);
  64.   cbRVFSavePictures->Checked   = RVFOptions.Contains(rvfoSavePicturesBody);
  65.   cbRVFSaveControls->Checked   = RVFOptions.Contains(rvfoSaveControlsBody);
  66.   cbRVFLoadBackground->Checked = RVFOptions.Contains(rvfoLoadBack);
  67.   cbRVFLoadLayout->Checked     = RVFOptions.Contains(rvfoLoadLayout);
  68.   cbRVFIgnoreUnknownPictures->Checked = RVFOptions.Contains(rvfoIgnoreUnknownPicFmt);
  69.   cbRVFIgnoreUnknownControls->Checked = RVFOptions.Contains(rvfoIgnoreUnknownCtrls);
  70.   cbRVFInvStyles->Checked      = RVFOptions.Contains(rvfoConvUnknownStylesToZero);
  71.   cbRVFInvImageIndices->Checked = RVFOptions.Contains(rvfoConvLargeImageIdxToZero);
  72.   cbRVFSaveTextStyles->Checked = RVFOptions.Contains(rvfoSaveTextStyles);
  73.   cbRVFSaveParaStyles->Checked = RVFOptions.Contains(rvfoSaveParaStyles);
  74.   cbHTMLOverrideImages->Checked  = HTMLOptions.Contains(rvsoOverrideImages);
  75.   cbHTMLListAsTest->Checked      = HTMLOptions.Contains(rvsoMarkersAsText);
  76.   cbHTMLForceNonTextCSS->Checked = HTMLOptions.Contains(rvsoForceNonTextCSS);
  77.   cbHTMLDefault0Style->Checked   = HTMLOptions.Contains(rvsoDefault0Style);
  78.   cbHTMLSaveImageSizes->Checked  = HTMLOptions.Contains(rvsoImageSizes);
  79.   cbHTMLNoHypertextImageBorders->Checked = HTMLOptions.Contains(rvsoNoHypertextImageBorders);
  80.   cbHTMLUseCheckpointsNames->Checked = HTMLOptions.Contains(rvsoUseCheckpointsNames);
  81.   txtHTMLTitle->Text = HTMLTitle;
  82. }