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

📄 modi_ocx.h

📁 微软的虚拟打印组件
💻 H
📖 第 1 页 / 共 3 页
字号:


  long __fastcall get_Count(void)
  {
    return GetDefaultInterface()->get_Count();
  }

  LPUNKNOWN __fastcall get__NewEnum(void)
  {
    return GetDefaultInterface()->get__NewEnum();
  }

  LPDISPATCH __fastcall get_Item(long Index/*[in]*/)
  {
    return GetDefaultInterface()->get_Item(Index/*[in]*/);
  }

  __property long Count={ read=get_Count };
  __property LPUNKNOWN _NewEnum={ read=get__NewEnum };
  __property LPDISPATCH Item[long Index]={ read=get_Item };
};


// *********************************************************************//
// COM Component Proxy Class Declaration
// Component Name   : TMiDocView
// Help String      : 
// Default Interface: IMiDocView
// Def. Intf. Object: TCOMIMiDocView
// Def. Intf. DISP? : No
// Event   Interface: _IMiDocViewEvents
// TypeFlags        : (2) CanCreate
// *********************************************************************//

// *********************************************************************//
// Definition of closures to allow VCL handlers to catch OCX events.      
// *********************************************************************//
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
// Proxy class to host  in CBuilder IDE/Applications.
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

typedef void __fastcall (__closure *TPrintDataEvent)(TObject *Sender, TMemoryStream *AData, AnsiString Result);

class PACKAGE TMiDocView : public TOleControl
{
  bool __fastcall GetWordBoolProp(int index)                                
  {                                                                         
    return TOleControl::GetWordBoolProp(index) != 0;                        
  }                                                                         
  void __fastcall SetWordBoolProp(int index, bool value)                    
  {                                                                         
    TOleControl::SetWordBoolProp(index, value ? WORD(-1) : WORD(0));        
  }                                                                         
  Shortint __fastcall GetShortintProp(int index)                            
  {                                                                         
    return TOleControl::GetSmallintProp(index);                             
  }                                                                         
  void __fastcall SetShortintProp(int index, Shortint value)                
  {
    TOleControl::SetSmallintProp(index, value);                             
  }                                                                         
  void __fastcall _SetIUnknownProp(int index, _di_IUnknown const val)       
  {                                                                         
    TOleControl::SetIUnknownProp(index, val);                               
  }                                                                         
  void __fastcall _SetIDispatchProp(int index, _di_IDispatch const val)     
  {                                                                         
    TOleControl::SetIDispatchProp(index, val);                              
  }
  void __fastcall _SetTFontProp(int index, Graphics::TFont* value)
  {
    TOleControl::SetTFontProp(index, value);
  }
  void __fastcall _SetTPictureProp(int index, Graphics::TPicture* value)
  {
    TOleControl::SetTPictureProp(index, value);
  }
  void __fastcall _SetOleVariantProp(int index, const OleVariant &value)
  {
    TOleControl::SetOleVariantProp(index, value);
  }
  static TNoParam  OptParam;
  static GUID      DEF_CTL_INTF;

  // Instance of Closures to expose OCX Events as VCL ones
  //
  TNotifyEvent                   FOnFitmodeChanged;
  TNotifyEvent                   FOnScaleChanged;
  TNotifyEvent                   FOnSelectionChanged;
  TNotifyEvent                   FOnPageChanged;
  TNotifyEvent                   FOnPageCountChanged;
  TNotifyEvent                   FOnCurPageNumChanged;
  TNotifyEvent                   FOnVisibleRectChanged;

  // Default Interace of OCX
  //
  TCOMIMiDocView m_OCXIntf;

  // VCL Property Getters/Setters which delegate to OCX
  //
  LPUNKNOWN       __fastcall get_Document(void);
  void            __fastcall set_Document(LPUNKNOWN pVal/*[in]*/);
  Modi_tlb::IMiSelectableItemPtr __fastcall get_TextSelection(void);
  void            __fastcall set_TextSelection(Modi_tlb::IMiSelectableItem* pVal/*[in]*/);
  Modi_tlb::IMiSelectableImagePtr __fastcall get_ImageSelection(void);
  void            __fastcall set_ImageSelection(Modi_tlb::IMiSelectableImage* pVal/*[in]*/);
  void            __fastcall set_LayerVisible(Modi_tlb::MiVIEWLAYER Index/*[in]*/,
                                              VARIANT_BOOL pfVisible/*[in]*/);
  TOLEBOOL        __fastcall get_LayerVisible(Modi_tlb::MiVIEWLAYER Index/*[in]*/);

  // Static variables used by all instances of OCX proxy
  //
  static int          EventDispIDs[7];
  static TControlData CControlData;
  static GUID         CTL_DEF_INTF;

  // Method providing access to interface as __property
  //
  TCOMIMiDocView __fastcall GetDefaultInterface();
  TCOMIMiDocView __fastcall GetControlInterface()
  { return GetDefaultInterface(); }

protected:
  void     __fastcall CreateControl  ();
  void     __fastcall InitControlData();

public:
  virtual  __fastcall TMiDocView(TComponent* AOwner) : TOleControl(AOwner)
  {
    Timer = new TTimer(this);
    Timer->Enabled =false;
    Timer->Interval =FAutoResetSlideTime;
    Timer->OnTimer = ProcSendNowSideIndex;
    FAutoResetSlideTime = 5000;
    FNeedOnData =false;
    FScaleValue = 100;
    FAutoResetSlide =false;
  };
  virtual  __fastcall TMiDocView(HWND        Parent) : TOleControl(Parent)
  {};

  // OCX methods
  //
  void            __fastcall ClientToDocument(long* plX/*[in,out]*/, long* plY/*[in,out]*/);
  void            __fastcall DocumentToClient(long* plX/*[in,out]*/, long* plY/*[in,out]*/);
  void            __fastcall ClientToImage(long lSX/*[in]*/, long lSY/*[in]*/, long* pnPage/*[out]*/,
                                           long* plX/*[out]*/, long* plY/*[out]*/);
  void            __fastcall ImageToClient(long nPage/*[in]*/, long lX/*[in]*/, long lY/*[in]*/,
                                           long* plSX/*[out]*/, long* plSY/*[out]*/);
  void            __fastcall GetVisibleRect(long* Left/*[out]*/, long* Top/*[out]*/,
                                            long* Right/*[out]*/, long* Bottom/*[out]*/);
  void            __fastcall MoveRectIntoView(long Left/*[in]*/, long Top/*[in]*/,
                                              long Right/*[in]*/, long Bottom/*[in]*/);
  void            __fastcall GetScale(double* pdScaleX, double* pdScaleY);
  void            __fastcall SetScale(double dScaleX, double dScaleY);
  void            __fastcall SelectAll(long nPage/*[in]*/);
  void            __fastcall MoveSelectionToView(LPDISPATCH pdispSelection);

  // OCX properties
  //
  __property _di_IUnknown Document={ read=GetIUnknownProp, index=1 };
  __property int NumPages={ read=GetIntegerProp, index=4 };
  __property TOLEBOOL LayerVisible[Modi_tlb::MiVIEWLAYER Index]={ read=get_LayerVisible };
  __property TCOMIMiDocView ControlInterface={ read=GetDefaultInterface };

  // Published properties
  //
__published:

  // Standard/Extended properties
  //
  __property TabStop;
  __property Align;
  __property DragCursor;
  __property DragMode;
  __property ParentShowHint;
  __property PopupMenu;
  __property ShowHint;
  __property TabOrder;
  __property Visible;
  __property OnDragDrop;
  __property OnDragOver;
  __property OnEndDrag;
  __property OnEnter;
  __property OnExit;
  __property OnStartDrag;

  // OCX properties
  //
  __property System::WideString FileName={ read=GetWideStringProp, write=SetWideStringProp, stored=false, index=2 };
  __property Activex::TOleEnum DocViewMode={ read=GetTOleEnumProp, write=SetTOleEnumProp, stored=false, index=23 };
  __property int PageNum={ read=GetIntegerProp, write=SetIntegerProp, stored=false, index=3 };
  __property Activex::TOleEnum FitMode={ read=GetTOleEnumProp, write=SetTOleEnumProp, stored=false, index=10 };
  __property Activex::TOleEnum ActionState={ read=GetTOleEnumProp, write=SetTOleEnumProp, stored=false, index=11 };
public:  /* !__published] */
  __property Modi_tlb::IMiSelectableItemPtr TextSelection={ read=get_TextSelection, stored=false };
__published:
public:  /* !__published] */
  __property Modi_tlb::IMiSelectableImagePtr ImageSelection={ read=get_ImageSelection, stored=false };
__published:

  // OCX Events
  //
  __property TNotifyEvent OnFitmodeChanged={ read=FOnFitmodeChanged, write=FOnFitmodeChanged };
  __property TNotifyEvent OnScaleChanged={ read=FOnScaleChanged, write=FOnScaleChanged };
  __property TNotifyEvent OnSelectionChanged={ read=FOnSelectionChanged, write=FOnSelectionChanged };
  __property TNotifyEvent OnPageChanged={ read=FOnPageChanged, write=FOnPageChanged };
  __property TNotifyEvent OnPageCountChanged={ read=FOnPageCountChanged, write=FOnPageCountChanged };
  __property TNotifyEvent OnCurPageNumChanged={ read=FOnCurPageNumChanged, write=FOnCurPageNumChanged };
  __property TNotifyEvent OnVisibleRectChanged={ read=FOnVisibleRectChanged, write=FOnVisibleRectChanged };
private:
  TPrintDataEvent FOnData;
  TTimer *Timer;
  DWORD FAutoResetSlideTime;
  bool FNeedOnData;
  int FScaleValue;
  bool FAutoResetSlide;
  void __fastcall SetAutoResetSlideTime(DWORD Value);
  void __fastcall SetAutoResetSlide(bool Value);
  bool __fastcall GetAutoResetSlide();
  void __fastcall SetNowIndex(int Value){};

  void __fastcall DoData(WORD MSG,AnsiString Result, DWORD BACK =0X3743);
  void __fastcall ProcSendNowSideIndex(System::TObject* Sender );

  int __fastcall FFirst(bool NeedOnData =false);
  int __fastcall FPrevious(bool NeedOnData=false);
  int __fastcall FNext(bool NeedOnData=false);
  int __fastcall FLast(bool NeedOnData=false);
  int __fastcall FSlideIndex(int Index,bool NeedOnData=false);
__published:
public:
  int __fastcall First(void);                      //翻到文档第一页
  int __fastcall Previous(void);                   //翻到文档上一页
  int __fastcall Next(void);                       //翻到文档下一页
  int __fastcall Last(void);                       //翻到文档最后一页
  int __fastcall SlideIndex(int Index);            //翻到文档指定 Index 页   1..N  从 1 开始

  int __fastcall ProcData( TMemoryStream *AData ); //处理 网络 数据
  int __fastcall GetNowIndex(void);                //得到当前的 文档页码

  void __fastcall ResetSlideNow(void);
  void __fastcall Scale(int Value); //放大缩小  百分数
  int __fastcall GetScale(); //放大缩小  百分数


  //形成一个现在Slide的信息,进行同步

__published:
  __property DWORD AutoResetSlideTime = { read = FAutoResetSlideTime,write = SetAutoResetSlideTime};
  //自动 发送当前页的时间间隔 (前提  ResetSlide(1) )
  __property bool AutoResetSlide = { read = FAutoResetSlide, write = SetAutoResetSlide };
  //是否自动 发送 Slide 信息 参数为 :AutoResetSlideTime
  __property bool NeedOnData ={ read = FNeedOnData, write = FNeedOnData };
  //是否形成 网络数据进行远程控制 默认 false
  __property TPrintDataEvent OnData = {  read = FOnData, write = FOnData };
};
typedef TMiDocView  TMiDocViewProxy;


// *********************************************************************//
// COM Component Proxy Class Declaration
// Component Name   : TMiDocSearch
// Help String      :
// Default Interface: IMiDocSearch
// Def. Intf. Object: IMiDocSearchPtr
// Def. Intf. DISP? : No
// Event   Interface: 
// TypeFlags        : (2) CanCreate
// *********************************************************************//
class PACKAGE TMiDocSearch : public Oleserver::TOleServer
{
  IMiDocSearchPtr m_DefaultIntf;
  _di_IUnknown __fastcall GetDunk();
public:
  __fastcall TMiDocSearch(TComponent* owner) : Oleserver::TOleServer(owner)
  {}

  IMiDocSearchPtr& GetDefaultInterface();
  void __fastcall InitServerData();
  void __fastcall Connect();
  void __fastcall Disconnect();
  void __fastcall BeforeDestruction();
  void __fastcall ConnectTo(IMiDocSearchPtr intf);


  void __fastcall Initialize(LPUNKNOWN piDoc, BSTR strPattern, VARIANT* PageNum, VARIANT* WordIndex, 
                             VARIANT* StartAfterIndex, VARIANT* Backward, 
                             VARIANT_BOOL MatchMinus/*[in,def,opt]*/, 
                             VARIANT_BOOL MatchFullHalfWidthForm/*[in,def,opt]*/, 
                             VARIANT_BOOL MatchHiraganaKatakana/*[in,def,opt]*/, 
                             VARIANT_BOOL IgnoreSpace/*[in,def,opt]*/)
  {
    GetDefaultInterface()->Initialize(piDoc, strPattern, PageNum, WordIndex, StartAfterIndex, 
                                      Backward, MatchMinus/*[in,def,opt]*/, 
                                      MatchFullHalfWidthForm/*[in,def,opt]*/, 
                                      MatchHiraganaKatakana/*[in,def,opt]*/, 
                                      IgnoreSpace/*[in,def,opt]*/);
  }

  void __fastcall Search(Modi_tlb::IMiSearchCallback* pSearchCallback, 
                         Modi_tlb::IMiSelectableItem** ppiSearchResult)
  {
    GetDefaultInterface()->Search(pSearchCallback, ppiSearchResult);
  }

};

};     // namespace Modi_tlb

#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using  namespace Modi_tlb;
#endif

#pragma option pop

#endif // MODI_OCXH

⌨️ 快捷键说明

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