// Driver.h : Declaration of the CDriver
//
// Author : David Shepherd
// Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "resource.h" // main symbols
#include "..\..\DDForms\DDForms.h"
// codemax type library
#import "CMax20.ocx" \
raw_interfaces_only \
rename("ReplaceText","_ReplaceText")
// IDriver
[
object,
uuid("B0DE2A22-2B9A-4A8E-A6AD-74877BE832D9"),
dual, helpstring("IDriver Interface"),
pointer_default(unique)
]
__interface IDriver : IDispatch
{
[propget, id(1), helpstring("Returns/sets the CodeMax editor object")] HRESULT Editor([out, retval] IUnknown** pVal);
[propput, id(1), helpstring("Returns/sets the CodeMax editor object")] HRESULT Editor([in] IUnknown* newVal);
};
// CDriver
#define CDriver Driver // for correct coclass naming
[
coclass,
threading("apartment"),
vi_progid("CodeMaxDriver.Driver"),
progid("CodeMaxDriver.Driver.1"),
version(1.0),
uuid("C40EC78F-4A4C-4258-8D64-827A59D6DA91"),
helpstring("Driver Class")
]
class ATL_NO_VTABLE CDriver :
public IDispatchImpl<IDriver>,
public IScriptBuffer,
public IScriptNavigation,
public IScriptState
{
private:
// the editor
CComPtr<IUnknown> m_spEditor;
// while this is greater than zero the editor will be read only
DWORD m_LockCount;
// returns the number of lines in the editor
DWORD GetLineCount();
// returns the length of the specified line in the editor
DWORD GetLineLength(DWORD Line);
// creates a position
CComPtr<CodeMax::IPosition> CreatePosition(DWORD Line,DWORD Col);
// creates a range
CComPtr<CodeMax::IRange> CreateRange(
DWORD StartLine,DWORD StartCol,DWORD EndLine,DWORD EndCol);
public:
CDriver();
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct();
void FinalRelease();
public:
// IDriver
STDMETHOD(get_Editor)(IUnknown** pVal);
STDMETHOD(put_Editor)(IUnknown* newVal);
// IScriptBuffer
STDMETHOD(LockExternal)(/*[in]*/ BOOL Lock);
STDMETHOD(GetLineCount)(/*[out]*/ DWORD *pCount);
STDMETHOD(FindText)(
/*[in]*/ DWORD Start,
/*[in]*/ LPCOLESTR pText,
/*[out]*/ BOOL *pFound,
/*[out]*/ DWORD *pLine);
STDMETHOD(InsertLines)(
/*[in]*/ DWORD Start,
/*[in]*/ DWORD Count,
/*[in, size_is(Count)]*/ LPCOLESTR *pLines);
STDMETHOD(GetLines)(
/*[in]*/ DWORD Start,
/*[in]*/ DWORD Count,
/*[out, size_is(,Count)]*/ LPOLESTR **ppLines);
STDMETHOD(DeleteLines)(
/*[in]*/ DWORD Start,
/*[in]*/ DWORD Count);
STDMETHOD(ModifyLines)(
/*[in]*/ DWORD Start,
/*[in]*/ DWORD End,
/*[in]*/ DWORD Count,
/*[in, size_is(Count)]*/ LPCOLESTR *pLines);
// IScriptNavigation
STDMETHOD(GoToLine)(/*[in]*/ DWORD Line);
// IScriptState
};