Attribute VB_Name = "ATX45API"

Type AtxPosInfo
   Par As Long
   Char As Long
   FontIndex As Long
   Color As Long
   BackColor As Long
   htag As Long
   ntag As Long
   ptag As Long
   Page As Long
   PageLine As Long
   Line As Long
   CharCod As Long
   CharInLine As Long
   Reserve1 As Long
   Reserve2 As Long
   Reserve3 As Long
   Reserve4 As Long
   Reserve5 As Long
   Reserve6 As Long
   Reserve7 As Long
End Type
''''''''''' Html support '''''''''''''begin''''''
'7.08.98 update
Declare Function FindNextOleObject Lib "atx45.ocx" (atx As Control, iPar As Long, iChr As Integer) As Integer
'/7.08.98 update
Declare Function GetHtmlStyle Lib "atx45.ocx" (hctl As Control, styleName As String) As Integer
Declare Function GetHtmlStyleName Lib "atx45.ocx" (ByVal style As Integer, styleBeg As String, styleEnd As String) As Integer
Declare Function MoveCursor Lib "atx45.ocx" (hctl As Control, ByVal where As Integer) As Integer
Declare Function GetOutHtml Lib "atx45.ocx" (hctl As Control, outStr As String, ByVal flag As Integer) As Integer
Declare Function MarkHtmlTag Lib "atx45.ocx" (hctl As Control, ByVal style As Integer, ByVal flag As Integer) As Integer
Declare Function HtmlStyleExist Lib "atx45.ocx" (hctl As Control, ByVal style As Integer) As Integer
Declare Function GetHtmlListInfo Lib "atx45.ocx" (hctl As Control, list As Integer, nest As Integer) As Integer
Declare Function GetNextHtmlPicture Lib "atx45.ocx" (hctl As Control, PicName As String, first As Integer) As Integer
Declare Function ParseHtmlTag Lib "atx45.ocx" (ByVal tag As String, AttrName As String, AttrValue As String, ByVal n As Integer) As Integer
Declare Function SetBodyAttribute Lib "atx45.ocx" (hctl As Control, ByVal bgImage As String, ByVal bgColor As Long, ByVal text As Long, ByVal link As Long, ByVal alink As Long, ByVal vlink As Long) As Integer
Declare Function GetBodyAttribute Lib "atx45.ocx" (hctl As Control, bgImage As String, bgColor As Long, text As Long, link As Long, alink As Long, vlink As Long) As Integer
Declare Function GetBodyTag Lib "atx45.ocx" (hctl As Control, BODY As String) As Integer
Declare Function GetAnchorByHTag Lib "atx45.ocx" (hctl As Control, ByVal htag As Long, anchor As String) As Integer
Declare Function GetHtmlTitle Lib "atx45.ocx" (hctl As Control, title As String) As Integer
Declare Function SetHtmlTitle Lib "atx45.ocx" (hctl As Control, ByVal title As String) As Integer
Declare Function AssignHtmlStyle Lib "atx45.ocx" (hctl As Control, ByVal style As Integer, ByVal flag As Integer) As Integer
Declare Function InsertHtmlTag Lib "atx45.ocx" (hctl As Control, ByVal htmlTag As String) As Integer
'1.02.98 update
Declare Function SetHtmlLeftIndent Lib "atx45.ocx" (atx As Control, ByVal indent As Integer, ByVal isShift As Integer) As Integer
'Declare Function SetHtmlLeftIndent Lib "atx45.ocx" (hctl As Control, ByVal indent As Integer) As Integer
'/1.02.98 update
Declare Function GetHtmlHead Lib "atx45.ocx" (hctl As Control, headTag As String, ByVal tagNum As Integer) As Integer
Declare Function SetHtmlHead Lib "atx45.ocx" (hctl As Control, ByVal headStr As String) As Integer
Declare Function SetHtmlFileName Lib "atx45.ocx" (hctl As Control, ByVal fName As String) As Integer
Declare Function GetDefaultProgram Lib "atx45.ocx" (fName As String, progName As String) As Integer
Declare Function SetFixWidthFont Lib "atx45.ocx" (hctl As Control, ByVal fontName As String, ByVal family As Integer, ByVal charset As Integer, ByVal size As Integer) As Integer
Declare Function SetVarWidthFont Lib "atx45.ocx" (hctl As Control, ByVal fontName As String, ByVal family As Integer, ByVal charset As Integer, ByVal size As Integer) As Integer
'16.06.97 update
Declare Function GetHtmlFontSizeIndex Lib "atx45.ocx" (atx As Control, ByVal size As Integer, ByVal fontType As Integer) As Integer
Declare Function GetHtmlFontSize Lib "atx45.ocx" (atx As Control, ByVal sizeIndex As Integer, ByVal fontType As Integer) As Integer
'/16.06.97 update




' function to read html file format
Declare Function GetHtmlFile Lib "atx45.ocx" (hctl As Control, ByVal file_name As String) As Integer ', rtfout As Long, Anchors As String, global_refs As String, local_refs As String, doc_title As String) As Integer
' function to parse string in html format
Declare Function GetHtmlStr Lib "atx45.ocx" (hctl As Control, ByVal html_str As String) As Integer ', rtfout As String, Anchors As String, global_refs As String, local_refs As String, doc_title As String) As Integer
' function to get next char from html input stream
Declare Function HtmlGetChar Lib "atx45.ocx" () As Integer
' function to get next parse unit from html input stream
Declare Function HtmlParse Lib "atx45.ocx" (text As String) As Integer

' function to set a logical style of HTML document
Declare Function SetStylePar Lib "atx45.ocx" (hctl As Control, ByVal style As Integer, ByVal fi%, ByVal li%, ByVal ri%, ByVal sb%, ByVal sa%, ByVal sl%, ByVal border%, ByVal align%) As Integer
Declare Function SetStyleFnt Lib "atx45.ocx" (hctl As Control, ByVal style%, ByVal font_name As String, ByVal font_family As Integer, ByVal font_charset As Integer, ByVal Color As Long, ByVal size As Integer, ByVal wid As Integer, ByVal Bold As Integer, ByVal Italic As Integer, ByVal underlined As Integer, ByVal strike As Integer, ByVal shadow%, ByVal SubSup As Integer) As Integer

' function to get a logical style of HTML document
Declare Function GetStylePar Lib "atx45.ocx" (hctl As Control, ByVal style As Integer, fi As Integer, li As Integer, ri As Integer, sb As Integer, sa As Integer, sl As Integer, border As Integer, align%) As Integer
Declare Function GetStyleFnt Lib "atx45.ocx" (hctl As Control, ByVal style As Integer, font_name As String, font_family%, font_charset%, COLOR_INDEX As Integer, size As Integer, wid As Integer, Bold As Integer, Italic As Integer, underlined As Integer, strike As Integer, shadow As Integer, SubSup As Integer) As Integer

'24.11.97 update
Declare Function Rtf2Html Lib "atx45.ocx" (hctl As Control, ByVal flag As Long) As Integer
Declare Function MakeRtf2HtmlFlag Lib "atx45.ocx" (ByVal StyleForBold%, ByVal StyleForItalic%, ByVal StyleForUnder%, ByVal StyleForTT%) As Long

'20.04.98 update
Declare Function SetAnchorParam Lib "atx45.ocx" (atx As Control, ByVal AttrName As String, ByVal AttrValue As String, ByVal cmd As Integer) As Integer
'The constants SET_ATTRIBUTE and CLEAR_ATTRIBUTE defined below
'can be used for cmd% parameter in SetAnchorParam function
Declare Function GetAnchorParam Lib "atx45.ocx" (atx As Control, AttrName As String, AttrValue As String, ByVal paramNum As Integer) As Integer
'/20.04.98 update
'---------------------HTML Table support-----------------
Declare Function SetHtmlTableParam Lib "atx45.ocx" (atx As Control, ByVal style As Integer, ByVal AttrName As String, ByVal AttrValue As String, ByVal cmd As Integer) As Integer
Declare Function GetHtmlTableParam Lib "atx45.ocx" (atx As Control, ByVal style As Integer, AttrName As String, AttrValue As String, ByVal paramNum As Integer) As Integer

Declare Function InsertHtmlTableCell Lib "atx45.ocx" (atx As Control, ByVal nCol As Integer, ByVal row As Integer, ByVal col As Integer, ByVal lastRow As Integer) As Integer

Global Const STYLE_TABLE = 52
Global Const STYLE_TD = 53
Global Const STYLE_TH = 54
Global Const STYLE_TR = 55
Global Const STYLE_CAPTION = 56
'Values for cmd% parameter in SetHtmlTableParam function
Global Const SET_ATTRIBUTE = -1 ' or 1
Global Const CLEAR_ATTRIBUTE = 0
Global Const REMOVE_CAPTION = 4
'--------------------End of HTML Table support-----------------

'---------------------------------------------------------
'Constants for Rtf2Html and MakeHtml2RtfFlag functions
'---------------------------------------------------------
Global Const USE_DEFAULT = 0   'Use for default RTF -> HTML conversion

'Use this constants in MakeHtml2RtfFlag function to disable
'conversion to appropriate style
Global Const DONTUSE_BOLD = &H1F
Global Const DONTUSE_ITALIC = &H3E0
Global Const DONTUSE_UNDER = &H7C00
Global Const DONTUSE_TT = &HF8000

'Use this constants for Flag% argument in function Rtf2Html
'to customize RTF -> HTML conversion
Global Const DONTUSE_FONTSIZE = &H100000
Global Const USE_BIG_SMALL_FOR_FONTSIZE = &H200000
Global Const DONTUSE_FONTCOLOR = &H400000
Global Const DONTUSE_FONTFACE = &H800000

Global Const DONTUSE_ADDRESS = &H1000000
Global Const DONTUSE_HEADER = &H2000000
Global Const DONTUSE_PRE = &H4000000
Global Const DONTUSE_ULIST = &H8000000
Global Const DONTUSE_OLIST = &H10000000
Global Const DONTUSE_INDENT = &H20000000
Global Const USE_ULIST_FOR_INDENT = &H30000000
Global Const USE_OLIST_FOR_INDENT = &H40000000
'/24.11.97 update

'----------------------------------------------------------------------------
' Constants to access different HTML styles (first argument of SetStyle func.)
'----------------------------------------------------------------------------
' the STYLE_DEFAULT is the style used outside any HTML
' logical style
Global Const STYLE_REFRESH = -2
Global Const STYLE_CLEARCHARTAG = -1

Global Const STYLE_DEFAULT = 0
'24.11.97 update
Global Const STYLE_EM = 1
Global Const STYLE_STRONG = 2
Global Const STYLE_CODE = 3
Global Const STYLE_SAMP = 4
Global Const STYLE_KBD = 5
Global Const STYLE_VAR = 6
Global Const STYLE_DFN = 7
Global Const STYLE_CITE = 8
Global Const STYLE_ANCHOR = 9
Global Const STYLE_HREF = 10
Global Const STYLE_TT = 11
Global Const STYLE_BIG = 12
Global Const STYLE_SMALL = 13
Global Const STYLE_SUB = 14
Global Const STYLE_SUP = 15

Global Const STYLE_IMAGE = 16
Global Const STYLE_FONTSIZE = 17
Global Const STYLE_FONTCOLOR = 18
Global Const STYLE_FONTFACE = 19
Global Const STYLE_BOLD = 20
Global Const STYLE_ITALIC = 21
Global Const STYLE_UNDERLINE = 22

Global Const STYLE_PARAGRAPH = 23
Global Const STYLE_PRE = 24
Global Const STYLE_LISTING = 25
Global Const STYLE_XMP = 26
Global Const STYLE_PLAINTEXT = 27
Global Const STYLE_HEADER1 = 28
Global Const STYLE_HEADER2 = 29
Global Const STYLE_HEADER3 = 30
Global Const STYLE_HEADER4 = 31
Global Const STYLE_HEADER5 = 32
Global Const STYLE_HEADER6 = 33
Global Const STYLE_ADDRESS = 34
Global Const STYLE_DL = 35
Global Const STYLE_ITEM = 36


Global Const STYLE_HR = 37
Global Const STYLE_BR = 38
Global Const STYLE_CENTER = 39
Global Const STYLE_DIV = 40

Global Const STYLE_FORM = 41
Global Const STYLE_INPUT = 42
Global Const STYLE_SELECT = 43
Global Const STYLE_TEXTAREA = 44

Global Const STYLE_BLOCKQUOTE = 45
Global Const STYLE_OLIST = 46
Global Const STYLE_ULIST = 47
Global Const STYLE_MENU = 48
Global Const STYLE_DIR = 49
Global Const STYLE_DTERM = 50
Global Const STYLE_DDEF = 51
'/24.11.97 update

Global Const HTML_FORM_BIT = &H2000000 'is setted if paragraph between form
                                       'open and close tags

' Constants to be used for ignoring properties.
' Can be used in SetStylePar SetStyleFnt as a value
' of property. This value means ignore this property
' when setting style. As for the font name the value should
' be a string not an integer two constants are supplied

Global Const HTML_PROP_DONTCARE = -30000
Global Const HTML_FONT_DONTCARE = "HTML_FNT_DONTCARE"

'----------------------------------------------------------------------------
'Constants for HtmlParse function (possible returned values)
'----------------------------------------------------------------------------

Global Const STATE_TEXT = 0   'plain text is returned.
Global Const STATE_TAG = 1    'html tag without < and > symbols is returned.
Global Const STATE_ENTITY = 2 'html entity is returned .
Global Const STATE_COMMENT = 4 'html comment is returned.
Global Const STATE_TITLE = 5  'html title is returned.
Global Const STATE_END = 6    'end of document is reached.

'----------------------------------------------------------------------------

'----------------------------------------------------------------------------
' Constants and functions to support Hypertext references
'----------------------------------------------------------------------------
Global Const HTML_ANCHOR_MIN = 1
Global Const HTML_ANCHOR_MAX = 999999
Global Const HTML_REF_LOCAL_BASE = 1000000
Global Const HTML_REF_LOCAL_MIN = 1000001
Global Const HTML_REF_LOCAL_MAX = 1999999
Global Const HTML_REF_GLOBAL_BASE = 2000000
Global Const HTML_REF_GLOBAL_MIN = 2000000
Global Const HTML_REF_GLOBAL_MAX = 1000000000

' Return values
Global Const ERR_NOERRORS = 1
Global Const ERR_ALLOC = -1
Global Const ERR_NOINPUT = -2
Global Const ERR_FILEOPEN = -3
Global Const ERR_INVALIDSTYLE = -4

'Consatnts for moveCursor function
Global Const HTML_CURSOR_SET = 0
Global Const HTML_CURSOR_RIGHT = 1
Global Const HTML_CURSOR_LEFT = 2

Global Const HTML_FORMAT_NONE = 0 'return HTML string as text flow wthout carrige return .
Global Const HTML_FORMAT_CR = 1  'adds carrige return before HTML block tags
Global Const HTML_FORMAT_BODY = 2 'encompasses Html string with <BODY ...  <BODY> tags.
Global Const HTML_FORMAT_HEAD = 4 'adds  <HEAD.> ... <\HEAD> block before <BODY> tag.
Global Const HTML_FORMAT_HTML = 8 'encompasses Html string with <HTML>  <HTML> tags
Global Const HTML_FORMAT_NOBLOCKTAG = &H10 'ignores all block tags for first selected paragraph.

Global Const HTML_MARK_INSERT = &H0 'mark selection with style nested inside existing styles.
Global Const HTML_MARK_OVERWRITE = &H400 'unmark selection before marking with new style.
Global Const HTML_MARK_ENCOMPASS = &H200 'mark selection with style encompassing existing styles.
Global Const HTML_MARK_CLEAR = -1 'remove style mark from selection.
''''''''''''''''''''''Html support'''''''''end''''''

''''''''''' Table support '''''''''''''begin''''''
' Table border constants
Global Const ATX_TABLEBORDER_NONE = 0
Global Const ATX_TABLEBORDER_TABLE = 1
Global Const ATX_TABLEBORDER_CELL = 2

Declare Function ATX_TABLESTATUS Lib "atx45.ocx" (hctl As Control, ByVal newstatus%) As Integer
Declare Function ATX_TABLEPARAGRAPHS Lib "atx45.ocx" (hctl As Control, TableRow%, TableCol%, TableCellRow%) As Integer
Declare Function ATX_INSERTTABLE Lib "atx45.ocx" (hctl As Control, ByVal Rows%, ByVal Columns%) As Integer
Declare Function ATX_CONVERTTOTABLE Lib "atx45.ocx" (hctl As Control) As Integer
Declare Function ATX_TABLEBORDER Lib "atx45.ocx" (hctl As Control, ByVal border%) As Integer
Declare Function ATX_DELETETABLEROW Lib "atx45.ocx" (hctl As Control) As Integer

Declare Function ATX_DELETETABLECELL Lib "atx45.ocx" (hctl As Control) As Integer
Declare Function ATX_DELETETABLECOL Lib "atx45.ocx" (hctl As Control, ByVal RowsToDelete%) As Integer
Declare Function ATX_TABLEROWS Lib "atx45.ocx" (hctl As Control) As Integer
Declare Function ATX_MERGETABLECELL Lib "atx45.ocx" (hctl As Control, ByVal RowsToMerge%) As Integer

Declare Function ATX_SPLITTABLECELL Lib "atx45.ocx" (hctl As Control, ByVal n%) As Integer
Declare Function ATX_INSERTTABLEROW Lib "atx45.ocx" (hctl As Control) As Integer
Declare Function ATX_CHANGETABLEBOUND Lib "atx45.ocx" (hctl As Control, ByVal BoundNom%, ByVal NumRows%, ByVal Delta&) As Integer
Declare Function ATX_GETSELCELLSBOUNDS Lib "atx45.ocx" (hctl As Control, Col1Nom%, Col2Nom%, LBoundPoz&, RBoundPoz&) As Integer

Declare Function ATX_GETCURCELLINFO Lib "atx45.ocx" (hctl As Control, rnom%, cnom%, pnum&, cleft&, cwidth&) As Integer
Declare Function ATX_GETCURROWINFO Lib "atx45.ocx" (hctl As Control, rnom%, cnum%, rleft&, rwidth&) As Integer
Declare Function ATX_GETCURTABLEINFO Lib "atx45.ocx" (hctl As Control, tnom%, rnum%, tleft&, twidth&) As Integer

Declare Function ATX_SETCURTABLE Lib "atx45.ocx" (hctl As Control, ByVal tnom%, ByVal endFlag%, ByVal selectFlag%) As Integer
Declare Function ATX_SETCURTABLEROW Lib "atx45.ocx" (hctl As Control, ByVal rnom%, ByVal endFlag%, ByVal selectFlag%) As Integer
Declare Function ATX_SETCURTABLEROWCELL Lib "atx45.ocx" (hctl As Control, ByVal cnom%, ByVal endFlag%, ByVal selectFlag%) As Integer
Declare Function ATX_SETCURROWH Lib "atx45.ocx" (hctl As Control, ByVal NumRows%, ByVal RH&) As Integer
Declare Function ATX_GETCURROWH Lib "atx45.ocx" (hctl As Control, RH&) As Integer
''''''''''' Table support '''''''''''''end''''''

Declare Function ATX_GetCurrentLineText Lib "atx45.ocx" (hctl As Control) As String
Declare Function ATX_GetHiddenText Lib "atx45.ocx" (hctl As Control) As String

Declare Function ENABLEDRAGDROP Lib "atx45.ocx" (hctl As Control, ByVal dragflag%) As Integer

Declare Function ParCharToOffset Lib "atx45.ocx" (hctl As Control, ByVal lparag&, ByVal ichar%) As Long

Declare Function ATX_COLOR_CONTROL Lib "atx45.ocx" (hctl As Control, ByVal flag%) As Integer

Declare Function ATX_GETLoadedRTFFT Lib "atx45.ocx" (hctl As Control) As String

Declare Function ATX_SETFontAdjustMethod Lib "atx45.ocx" (hctl As Control, ByVal am%) As Integer

Declare Sub SET_FontColor Lib "atx45.ocx" (hctl As Control, ByVal ColorIndex%, ByVal Color&)
Declare Function GET_FontColor Lib "atx45.ocx" (hctl As Control, ByVal ColorIndex%) As Long

Declare Function ATX_SETWRITEPROTECT Lib "atx45.ocx" (hctl As Control, ByVal wp%) As Integer

Declare Function IS_FILELOADABLE Lib "atx45ole.dll" (ByVal FileName$) As Integer
Declare Function GET_EXTASS Lib "atx45ole.dll" (ByVal Extension$) As String
Declare Function GET_ASSEXTENSIONS Lib "atx45ole.dll" (ByVal nom%, Extensions$) As String
Declare Function GET_KEYFIRSTLEVELVALUE Lib "atx45ole.dll" (ByVal regKey$) As String
Declare Function GET_LASTFIRSTLEVELVALUE Lib "atx45ole.dll" () As String
Declare Function IS_OLESERVER Lib "atx45ole.dll" (ByVal ServName$, servFile$) As Integer
Declare Function GET_OLESERVERNAME Lib "atx45ole.dll" (ByVal ServNom%, ServName$) As String
Declare Function GET_REGISTRYRECORD Lib "atx45ole.dll" (ByVal RegRecNom&, RegRecValue$) As String
Declare Sub SET_OBJECTHOSTNAME Lib "atx45ole.dll" (ByVal NewName$)

Declare Sub ATX_USERCHANGE Lib "atx45.ocx" (Alltext As Control, ByVal Param1&, ByVal Param2&)

Declare Function ATX_ATXOLELOADED Lib "atx45.ocx" () As Integer

Declare Function GET_FONTSIZE Lib "atx45.ocx" (ByVal fontNom%, ByVal fntname$) As Integer
Declare Function GET_FONTNAME Lib "atx45.ocx" (ByVal fontNom%) As String

''' ATX4 UPPER/LOWER Support '''
Declare Sub ATX_TOUPPER Lib "atx45.ocx" (Alltext As Control)
Declare Sub ATX_TOLOWER Lib "atx45.ocx" (Alltext As Control)

'''' ATX4 Print Support '''
Declare Function ATX_GETPAGE_EXTPARAM Lib "atx45.ocx" (ByVal hdc As Long, pagew&, pageh&, printw&, printh&, offx&, offy&) As Integer
Declare Function ATX_PRINT_START Lib "atx45.ocx" (ByVal FormWnd&, ByVal hdc&, ByVal log_n%, ByVal rel_n%) As Integer
Declare Sub ATX_PRINT_FINISH Lib "atx45.ocx" ()
Declare Sub ATX_PRINT_TITLE Lib "atx45.ocx" (ByVal TitleString$)
Declare Function ATX_PRINT Lib "atx45.ocx" (Alltext As Control, StartTop&, ByVal Top_Indent&, ByVal TextOnPageY&, ByVal LeftIndent&, ByVal DocWidth&, ByVal ParFrom&, ByVal ParTo&, ByVal Flags%) As Integer
Declare Function ATX_PRINT_REGION Lib "atx45.ocx" (Alltext As Control, StartTop&, ByVal TextOnPageY&, ByVal LeftIndent&, ByVal DocWidth&, ByVal ParFrom&, ByVal ParTo&, ByVal Flags%) As Integer
''''' ATX4 Print Support '''
'Declare Function ATX_GETPAGE_EXTPARAM Lib "atx45.ocx" (ByVal hdc As Long, pagew&, pageh&, printw&, printh&, offx&, offy&) As Integer
'Declare Function ATX_PRINT_START Lib "atx45.ocx" (ByVal FormWnd&, ByVal hdc&, ByVal log_n%, ByVal rel_n%) As Integer
'Declare Sub ATX_PRINT_FINISH Lib "atx45.ocx" ()
'Declare Sub ATX_PRINT_TITLE Lib "atx45.ocx" (ByVal TitleString$)
'Declare Function ATX_PRINT Lib "atx45.ocx" (alltext As Control, StartTop&, ByVal Top_Indent&, ByVal TextOnPageY&, ByVal LeftIndent&, ByVal DocWidth&, ByVal ParFrom&, ByVal ParTo&, ByVal Flags%) As Integer
'Declare Function ATX_PRINT_REGION Lib "atx45.ocx" (alltext As Control, StartTop&, ByVal TextOnPageY&, ByVal LeftIndent&, ByVal DocWidth&, ByVal ParFrom&, ByVal ParTo&, ByVal Flags%) As Integer

''' Old Functions '''
Declare Function PRINT_ATEXTPAGES Lib "atx45.ocx" (Alltext As Control, ByVal ptop&, ByVal pbottom&, ByVal pleft&, ByVal pwidth&, ByVal pages$, ByVal Flags%) As Integer
Declare Function PRINT_ATEXT Lib "atx45.ocx" (Alltext As Control, ByVal ptop&, ByVal pbottom&, ByVal pleft&, ByVal pwidth&, ByVal start_par%, ByVal end_par%, ByVal Flags%) As Integer
'''' Old Functions '''
'Declare Function PRINT_ATEXTPAGES Lib "atx45.ocx" (alltext As Control, ByVal ptop&, ByVal pbottom&, ByVal pleft&, ByVal pwidth&, ByVal pages$, ByVal Flags%) As Integer
'Declare Function PRINT_ATEXT Lib "atx45.ocx" (alltext As Control, ByVal ptop&, ByVal pbottom&, ByVal pleft&, ByVal pwidth&, ByVal start_par%, ByVal end_par%, ByVal Flags%) As Integer
'

''' Print Support '''
Global Const ATX_PRINT_OK = 0
Global Const ATX_PRINT_ERR_NODEFPRINTER = 101
Global Const ATX_PRINT_ERR_NOSUPPORTPRINTER = 102
Global Const ATX_PRINT_ERR_INVALIDARGS = 103
Global Const ATX_PRINT_ERR_NOROOM = 104
Global Const ATX_PRINT_ERR_PRINTERROR = 105
Global Const ATX_PRINT_ERR_NOPRINTSTART = 106
Global Const ATX_PRINT_ERR_INVALIDSCALE = 107
Global Const ATX_PRINT_ERR_INVALPARAGRAPHRANGE = 108
Global Const ATX_PRINT_ERR_REGIONTOOSMALL = 109
Global Const ATX_PRINT_ERR_CANCEL = 110
Global Const ATX_PRINT_ERR_FATAL = 113

' constant for Flags% parameters in prit new and old functions
Global Const ATX_PRINT_BACKPICTURE = 1 ' for new and old functions
Global Const ATX_PRINTOLD_NODIALOG = 2 ' only for old functions

''' EXT Objects Support '''
Global Const ATXOBJ_PARAMTYPE_STRING = 1
Global Const ATXOBJ_PARAMTYPE_LONG = 2
Global Const ATXOBJ_PARAMTYPE_DOUBLE = 3
Global Const ATXOBJ_PARAMTYPE_BOOL = 4
Global Const ATXOBJ_PARAMTYPE_ENUM = 5
Global Const ATXOBJ_PARAMTYPE_COLOR = 6
Global Const ATXOBJ_PARAMTYPE_DISK = 7
Global Const ATXOBJ_PARAMTYPE_DIRECTORY = 8
Global Const ATXOBJ_PARAMTYPE_FILE = 9
Global Const ATXOBJ_PARAMTYPE_FIELD = 10
Global Const ATXOBJ_PARAMTYPE_FONT = 11
Global Const ATXOBJ_PARAMTYPE_LIST = 12
Global Const ATXOBJ_PARAMTYPE_PICTURE = 13

Type ATXOBJ_PARAMTYPE
   type As Long
   ndx As Long
   param_option As String
End Type

Declare Function ATX_REGNEWEXTERN Lib "atx32.ocx" (ByVal noMsg%, ByVal lpstrModule$) As Integer
'Declare Function ATX_REGNEWEXTERN Lib "atx45.ocx" (ByVal noMsg%, ByVal lpstrModule$) As Integer
Declare Function ATX_GETEXTOBJPTR Lib "atx45.ocx" (Alltext As Control) As Long
Declare Function ATX_GETOBJ_NAMES Lib "atx45.ocx" (Alltext As Control, ByVal module$, names$) As Integer
Declare Function ATX_GETOBJ_PARAMTYPE Lib "atx45.ocx" (Alltext As Control, ByVal module$, ByVal parName$, paramtype As ATXOBJ_PARAMTYPE) As Integer
Declare Sub COPY_ATX_PARAMTYPE Lib "atx45.ocx" (aopt As ATXOBJ_PARAMTYPE, ByVal l&)
'Declare Function ATX_GETOBJ_PARAM Lib "atx45.ocx" (alltext As Control, ByVal module$, ByVal parName$, parValue$) As Integer
'Declare Function ATX_SETOBJ_PARAM Lib "atx45.ocx" (alltext As Control, ByVal module$, ByVal parName$, ByVal parValue$) As Integer
'''

''' ATX Change Event Support '''
Global Const ATXTAG_CHANGED = 1
Global Const ATXMOUSE_CHANGED = 2
Global Const ATXFONT_CHANGED = 3
Global Const ATXCOLOR_CHANGED = 4
Global Const ATXCURSORLOCATION_CHANGED = 5
Global Const ATXSELECTION_CHANGED = 6
Global Const ATXLOCATIONX_CHANGED = 7
Global Const ATXLOCATIONY_CHANGED = 8
Global Const ATXSELPARAGS_CHANGED = 9
Global Const ATXPARALIGNMENT_CHANGED = 10
Global Const ATXMARGINX_CHANGED = 11
Global Const ATXSCROLLH_CHANGED = 12
Global Const ATXSCROLLV_CHANGED = 13
Global Const ATXPAGE_CHANGED = 14
Global Const ATXPAGELINE_CHANGED = 15
Global Const ATXLINE_CHANGED = 16
Global Const ATXFORMATED_CHANGED = 17
Global Const ATXCHANGED_CHANGED = 18
Global Const ATXCHANGED_USER = &H80000000

Global Const ATXTAG_CHANGED_MASK = &H1&
Global Const ATXMOUSE_CHANGED_MASK = &H2&
Global Const ATXFONT_CHANGED_MASK = &H4&
Global Const ATXCOLOR_CHANGED_MASK = &H8&
Global Const ATXCURSORLOCATION_CHANGED_MASK = &H10&
Global Const ATXSELECTION_CHANGED_MASK = &H20&
Global Const ATXLOCATIONX_CHANGED_MASK = &H40&
Global Const ATXLOCATIONY_CHANGED_MASK = &H80&
Global Const ATXSELPARAGS_CHANGED_MASK = &H100&
Global Const ATXPARALIGNMENT_CHANGED_MASK = &H200&
Global Const ATXMARGINX_CHANGED_MASK = &H400&
Global Const ATXSCROLLH_CHANGED_MASK = &H800&
Global Const ATXSCROLLV_CHANGED_MASK = &H1000&
Global Const ATXPAGE_CHANGED_MASK = &H2000&
Global Const ATXPAGELINE_CHANGED_MASK = &H4000&
Global Const ATXLINE_CHANGED_MASK = &H8000&
Global Const ATXFORMATED_CHANGED_MASK = &H10000
Global Const ATXCHANGED_CHANGED_MASK = &H20000

Global Const ATXCHANGED_USER_MASK = &H80000000

''' Left shift text from alltext windows in pixels
Global Const ATXLEFTSHIFT = 3

''' Save / Restore Alltext Cursor Support '''
Type AtxTextCursor
   iPrg As Long
   iChr As Long
   wordptr As Long
End Type
Type SaveCursorBuf
   BlkBegin As AtxTextCursor
   BlkEnd As AtxTextCursor
   BlkFix As AtxTextCursor
   BlkCursor As AtxTextCursor
End Type
Declare Function ATX_SAVECURSOR Lib "atx45.ocx" (Alltext As Control, SaveBuf As SaveCursorBuf) As Integer
Declare Function ATX_RESTORECURSOR Lib "atx45.ocx" (Alltext As Control, SaveBuf As SaveCursorBuf) As Integer

'''''''''''''' UnDo support ''''''''''''''''''''
Global Const ATX_UNDO_RESET = 0
Global Const ATX_UNDO_STEP = 1
'''''''''

'''''''''''''' Header Footer support '''''''''''
Global Const ATX_HEADER_SIMPLE = 0
Global Const ATX_HEADER_LEFT = 1
Global Const ATX_HEADER_RIGHT = 2
Global Const ATX_HEADER_FIRST = 3

Global Const ATX_FOOTER_SIMPLE = 0
Global Const ATX_FOOTER_LEFT = 1
Global Const ATX_FOOTER_RIGHT = 2
Global Const ATX_FOOTER_FIRST = 3
''''''''''''''''

'''''''''''''' ATX3 + ATX4 Functions and constants '''''''

Declare Function ATX_GETRTFLSTR Lib "atx45.ocx" (Alltext As Control, ByVal PropFlag%, ByVal RtfFlag%, hls&) As Integer
Declare Function ATX_SETRTFLSTR Lib "atx45.ocx" (Alltext As Control, ByVal PropFlag%, ByVal RtfFlag%, ByVal hls&) As Integer
Declare Function ATX_GETOLERTFLSTR Lib "atx45.ocx" (Alltext As Control, OleServer$, hls&) As Integer

' HYPERTEXT EXTENSION
Declare Function FIND_HTAG Lib "atx45.ocx" (Alltext As Control, ByVal htag&, ByVal skipcount&) As Long
Declare Function FIND_NTAG Lib "atx45.ocx" (Alltext As Control, ByVal ntag&, ByVal skipcount&) As Long
Declare Function FIND_PTAG Lib "atx45.ocx" (Alltext As Control, ByVal ptag&, ByVal skipcount&) As Long

Declare Function GET_OLESERV Lib "atx45.ocx" (ByVal ne As Integer) As String

Global Const ATX_MAXNEWHTAG = 64000                 ' Max Htag Number can be returned by NewHtag property
Global Const ATX_MAXMOUSEHPOINTER = 14
Global Const ATX_TAG_UNDEFINED = -2147483648#

Global Const ATX_VERB_UNDEFINED = -32000

' STANDARD/HYPERTEXT
Declare Function ATX_CURTOXY Lib "atx45.ocx" (Alltext As Control, ByVal p&, ByVal c%, x1&, y1&) As Integer
Declare Function ATX_XYTOCUR Lib "atx45.ocx" (Alltext As Control, ByVal x&, ByVal y&, p&, c%) As Integer

Declare Function FontTablePut Lib "atx45.ocx" (Alltext As Control, ByVal num%, ByVal fam%, ByVal charset%, ByVal fntname$, ByVal h%, ByVal FntWidth%, ByVal Bold%, ByVal Italic%, ByVal Underline%, ByVal StrikeOut%, ByVal shadow%, ByVal SubSup%) As Integer
Declare Function FontTableGet Lib "atx45.ocx" (Alltext As Control, ByVal num%, fam%, charset%, fntname$, h%, FntWidth%, Bold%, Italic%, Underline%, StrikeOut%, shadow%, SubSup%) As Integer

Declare Function MAKE_SHADOW Lib "atx45.ocx" (ByVal delt1%, ByVal delt2%, ByVal color1%, ByVal color2%) As Integer
Declare Sub GET_SHADOW Lib "atx45.ocx" (ByVal shadow%, delt1%, delt2%, color1%, color2%)

Declare Function COLOR_INDEX Lib "atx45.ocx" (ByVal rgb_color&) As Integer

Declare Function MAKE_UNDERLINE Lib "atx45.ocx" (ByVal shape%, ByVal dblflag%, ByVal ncolor%) As Integer
Declare Sub GET_UNDERLINE Lib "atx45.ocx" (ByVal underval%, shape%, dblflag%, ncolor%)

Declare Function MAKE_BORDER Lib "atx45.ocx" (ByVal side%, ByVal shape%, ByVal shadow%) As Long
Declare Sub GET_BORDER Lib "atx45.ocx" (ByVal border&, side%, shape%, shadow%)

Declare Sub GET_PARDET Lib "atx45.ocx" (Alltext As Control, ByVal paragraph&, top&, height&, FirstLineIndent&, LineSpace&, SpaceAfter&, SpaceBefore&)
Declare Sub GET_LINETOPHEIGHT Lib "atx45.ocx" (Alltext As Control, ByVal paragraph&, ByVal linenum&, top&, height&)

Declare Function find_phrase Lib "atx45.ocx" (Alltext As Control, ByVal What As String, _
                                               ByVal Direction&, ByVal CaseSensitive&) As Long
Declare Function find_phraseEX Lib "atx45.ocx" _
                      (Alltext As Control, ByVal What As String, _
                       ByVal Direction&, ByVal CaseSensitive&, _
                       ByVal SearchFontName As String, _
                       ByVal SearchFontHt&, ByVal SearchFontWd&, ByVal SearchFontBl&, _
                       ByVal SearchFontIt&, ByVal SearchFontUl&, ByVal SearchFontSt&, _
                       ByVal SearchFontSh&, ByVal SearchFontSu&, ByVal SearchFontCol&, _
                       ByVal SearchFontHi&, ByVal SearchFontTag&, _
                       FoundPos&, FoundLen&) _
                 As Long
'Declare Function find_phraseEX Lib "atx45.ocx" (alltext As Control, ByVal What As String, ByVal Direction%, ByVal CaseSensitive%, ByVal SearchFontName As String, ByVal SearchFontHt%, ByVal SearchFontWd%, ByVal SearchFontBl%, ByVal SearchFontIt%, ByVal SearchFontUl%, ByVal SearchFontSt%, ByVal SearchFontSh%, ByVal SearchFontSu%, ByVal SearchFontCol&, ByVal SearchFontHi%, ByVal SearchFontTag&, FoundPos&, FoundLen&) As Long

Declare Sub set_font Lib "atx45.ocx" Alias "SET_FONT" (Alltext As Control, fontName$, FontSharSet%, FontFamily%)

'----------------------------------

' AllText limitations
Global Const ATX_MAXPARAG = 1000000          ' Max Number of paragraphs
Global Const ATX_MAXCHARS = 30000            ' Max Number of characters per paragraph
Global Const ATX_MINTEXTWIDTH = 40           ' Min Text Width  in pixels
Global Const ATX_MAXTEXTWIDTH = 32000        ' Max Text Width  in pixels
Global Const ATX_MAXTEXTHEIGTH = 2000000000  ' Max Text Height in pixels
Global Const ATX_MINTABSET = 16              ' Min Tabulation setting in pixels
Global Const ATX_MAXTABSET = 10000           ' Max Tabulation setting in twips
Global Const ATX_MAXFONTSIZE = 32000         ' Max Font Size in points
Global Const ATX_MAXSPACING = 32000          ' Max Font Size in points

' Error constants
Global Const ATX_NOMEM = 15001         ' NOT ENOUGH MEMORY
Global Const ATX_NOGDIMEM = 15002      ' NOT ENOUGH GDI MEMORY
Global Const ATX_BADGDIHANDLE = 15003  ' CAN'T CREATE DEVICE CONTEXT
Global Const ATX_TOOMANY_PARS = 15101  ' TOO MANY PARAGRAPHS PER TEXT
Global Const ATX_TOOMANY_CHARS = 15102 ' TOO MANY CHARACTERS PER PARAGRAPH
Global Const ATX_TOOMANY_LINES = 15103 ' TOO MANY LINES PER PARAGRAPH
Global Const ATX_TOOMANY_WORDS = 15104 ' TOO MANY WORDS PER PARAGRAPH
Global Const ATX_TOOMANY_FONTS = 15105 ' TOO MANY FONTS PER PARAGRAPH

' Common constants
Global Const ATX_UNDEFINED = -4096
Global Const ATX_PAR_UNDEFINED = -32000
Global Const ATX_DEFAULT = 0

' Protection constants
Global Const ATX_PROTECT_NONE = 0
Global Const ATX_PROTECT_CHANGES = -1
Global Const ATX_PROTECT_KEYBOARD = 1
Global Const ATX_PROTECT_SCREEN = 2

' Font family constants
Global Const ATX_DONTCARE = 0
Global Const ATX_ROMAN = 1
Global Const ATX_SWISS = 2
Global Const ATX_MODERN = 3
Global Const ATX_SCRIPT = 4
Global Const ATX_DECORATIVE = 5

' Font CharSet values
Global Const ATX_ANSI_CHARSET = 0
Global Const ATX_DEFAULT_CHARSET = 1
Global Const ATX_SYMBOL_CHARSET = 2
Global Const ATX_SHIFTJIS_CHARSET = 128
Global Const ATX_HANGEUL_CHARSET = 129
Global Const ATX_CHINESEBIG5_CHARSET = 136
Global Const ATX_OEM_CHARSET = 255

' Paragraph alignment constants
Global Const ATX_LEFT = 0
Global Const ATX_RIGHT = 1
Global Const ATX_CENTERED = 2
Global Const ATX_JUSTIFIED = 3

'color constants
Global Const ATX_Black = 0
Global Const ATX_Blue = 1
Global Const ATX_Green = 2
Global Const ATX_Cyan = 3
Global Const ATX_Red = 4
Global Const ATX_Magenta = 5
Global Const ATX_Yellow = 6
Global Const ATX_White = 7
Global Const ATX_Gray = 8
Global Const ATX_LT_Blue = 9
Global Const ATX_LT_Green = 10
Global Const ATX_LT_Cyan = 11
Global Const ATX_LT_Red = 12
Global Const ATX_LT_Magenta = 13
Global Const ATX_LT_Yellow = 14
Global Const ATX_LT_White = 15
Global Const ATX_Color_Undefined = 16

' Underline constants:
Global Const ATX_NONE = 0
Global Const ATX_SOLID = 1
Global Const ATX_DASH = 2
Global Const ATX_DOT = 3
Global Const ATX_DASHDOT = 4
Global Const ATX_DASHDOTDOT = 5
Global Const ATX_DOUBLE = 1
Global Const ATX_SINGLE = 0

' Background Style constants
Global Const ATX_Transparent = 0
Global Const ATX_Opaque = 1

' I/O format constants
Global Const ATX_FORMAT_TEXT = 0
Global Const ATX_FORMAT_S = 1
Global Const ATX_FORMAT_F = 2
Global Const ATX_FORMAT_RTF = 3     ' for HT edition only.
Global Const ATX_FORMAT_FLX = 4     ' for HT edition only.
Global Const ATX_FORMAT_USER = 4
Global Const ATX_FORMAT_HTML = 5     ' for HT edition only.

' I/O mode constants
Global Const ATX_IO_COMPLETED = 0
Global Const ATX_IO_FAST = 1
Global Const ATX_IO_STANDARD = 2
Global Const ATX_IO_LOWLEVEL = 3

' SelFType and ExtDataType masks (for HT edition only).
Global Const ATX_FNTTBL_MASK = 1        'font table
Global Const ATX_CLRTBL_MASK = 2        'color table
Global Const ATX_PRGSET_MASK = 4        'paragraph settings
Global Const ATX_OLEOBJ_MASK = 8        'ole objects
Global Const ATX_RTFSTD_MASK = 16       '"rtf1...", "}", spec. sym. conversion,
Global Const ATX_HDRFTR_MASK = 32       ' headers and footers
Global Const ATX_NOCR_MASK = 64       ' No CR generate mask
Global Const ATXS_MASK = ATX_PRGSET_MASK
Global Const ATXF_MASK = ATXS_MASK Or ATX_FNTTBL_MASK Or ATX_OLEOBJ_MASK
Global Const FULLRTF_MASK = &H3F


' Tabulation constants
Global Const ATX_TAB_UNDEFINED = -32000
Global Const ATX_TAB_MIN_PIX = 16
Global Const ATX_TAB_LEFT = 0
Global Const ATX_TAB_CENTERED = 1
Global Const ATX_TAB_CENTRED = 1
Global Const ATX_TAB_RIGHT = 2

' Border constants
Global Const ATX_BORDER_NONE = 0
Global Const ATX_BORDER_LEFT = 1
Global Const ATX_BORDER_RIGHT = 2
Global Const ATX_BORDER_TOP = 4
Global Const ATX_BORDER_BOTTOM = 8
Global Const ATX_BORDER_BOX = 15
Global Const ATX_BORDER_LINE_STANDARD = 0
Global Const ATX_BORDER_LINE_THICK = 1
Global Const ATX_BORDER_LINE_DOUBLE = 2
Global Const ATX_BORDER_NOTSHADOWED = 0
Global Const ATX_BORDER_SHADOWED = 1

'cut copy paste Clipboard action
Global Const ATX_CUT = 1
Global Const ATX_COPY = 2
Global Const ATX_PASTE = 3

'Constants of location type of frame
Global Const ATX_FRAME_CENTER = 0
Global Const ATX_FRAME_RIGHT = 1
Global Const ATX_FRAME_LEFT = 2

'-----------------------------------------------------------------------
'
'
'Declare Function TESTBSTR Lib "atx45.ocx" (ByVal fontNom%) As String
'Declare Sub OLETEST Lib "atx45.ocx" (ByVal alltexthwnd As Long, ByVal ctlhdc As Long, ByVal s$)
'Declare Function TEST001 Lib "atx45.ocx" (tstr$) As String
'
'
'Declare Function ATX_GETEXTOBJPTR Lib "atx45.ocx" (alltext As Control) As Long
'Declare Function ATX_GETOBJ_NAMES Lib "atx45.ocx" (alltext As Control, ByVal module$, names$) As Integer
'Declare Function ATX_GETOBJ_PARAMTYPE Lib "atx45.ocx" (alltext As Control, ByVal module$, ByVal parName$, paramtype As ATXOBJ_PARAMTYPE) As Integer
'Declare Sub COPY_ATX_PARAMTYPE Lib "atx45.ocx" (aopt As ATXOBJ_PARAMTYPE, ByVal l&)
''Declare Function ATX_GETOBJ_PARAM Lib "atx45.ocx" (alltext As Control, ByVal module$, ByVal parName$, parValue$) As Integer
''Declare Function ATX_SETOBJ_PARAM Lib "atx45.ocx" (alltext As Control, ByVal module$, ByVal parName$, ByVal parValue$) As Integer
'
'
Function ATX_PRINT_START1(ByVal i_hWnd As Long, ByVal i_hDC As Long)
Dim mfrom%
Dim mto%
Dim i%
'!!! sorry only 1,1 support now
   mfrom% = 1
   mto% = 1
   i% = ATX_PRINT_START(i_hWnd, i_hDC, mfrom%, mto%)
   ATX_PRINT_START1 = i%
End Function
Function atx_getobj_param(hctl As Control, modName$, parName$, parval$) As Integer
   hctl.ExtObjParam = modName$ + ":" + parName$
   parval$ = hctl.ExtObjValue
   atx_getobj_param = 0
End Function
Function atx_setobj_param(hctl As Control, modName$, parName$, parval$) As Integer
   hctl.ExtObjParam = modName$ + ":" + parName$
   hctl.ExtObjValue = parval$
   atx_setobj_param = 0
End Function

