/*
 * Copyright 2006 Juan Lang
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

import "oaidl.idl";

cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
cpp_quote("#undef FindText")
cpp_quote("#endif")

typedef enum tagTomConstants
{
    tomFalse       = 0,
    tomTrue        = -1,
    tomUndefined   = -9999999,
    tomToggle      = -9999998,
    tomAutoColor   = -9999997,
    tomDefault     = -9999996,
    tomSuspend     = -9999995,
    tomResume      = -9999994,
    tomApplyNow    = 0,
    tomApplyLater  = 1,
    tomTrackParms  = 2,
    tomCacheParms  = 3,
    tomBackward    = 0xc0000001,
    tomForward     = 0x3fffffff,
    tomMove        = 0,
    tomExtend      = 1,
    tomNoSelection          = 0,
    tomSelectionIP          = 1,
    tomSelectionNormal      = 2,
    tomSelectionFrame       = 3,
    tomSelectionColumn      = 4,
    tomSelectionRow         = 5,
    tomSelectionBlock       = 6,
    tomSelectionInlineShape = 7,
    tomSelectionShape       = 8,
    tomSelStartActive = 1,
    tomSelAtEOL       = 2,
    tomSelOvertype    = 4,
    tomSelActive      = 8,
    tomSelReplace     = 16,
    tomEnd   = 0,
    tomStart = 32,
    tomCollapseEnd   = 0,
    tomCollapseStart = 1,
    tomClientCoord = 256,
    tomNone       = 0,
    tomSingle     = 1,
    tomWords      = 2,
    tomDouble     = 3,
    tomDotted     = 4,
    tomDash       = 5,
    tomDashDot    = 6,
    tomDashDotDot = 7,
    tomWave       = 8,
    tomThick      = 9,
    tomHair       = 10,
    tomLineSpaceSingle   = 0,
    tomLineSpace1pt5     = 1,
    tomLineSpaceDouble   = 2,
    tomLineSpaceAtLeast  = 3,
    tomLineSpaceExactly  = 4,
    tomLineSpaceMultiple = 5,
    tomAlignLeft        = 0,
    tomAlignCenter      = 1,
    tomAlignRight       = 2,
    tomAlignJustify     = 3,
    tomAlignDecimal     = 3,
    tomAlignBar         = 4,
    tomAlignInterWord   = 3,
    tomAlignInterLetter = 4,
    tomAlignScaled      = 5,
    tomAlignGlyphs      = 6,
    tomAlignSnapGrid    = 7,
    tomSpaces     = 0,
    tomDots       = 1,
    tomDashes     = 2,
    tomLines      = 3,
    tomThickLines = 4,
    tomEquals     = 5,
    tomTabBack = -3,
    tomTabNext = -2,
    tomTabHere = -1,
    tomListBullet           = 1,
    tomListNumberAsArabic   = 2,
    tomListNumberAsLCLetter = 3,
    tomListNumberAsUCLetter = 4,
    tomListNumberAsLCRoman  = 5,
    tomListNumberAsUCRoman  = 6,
    tomListNumberAsSequence = 7,
    tomListParentheses      = 0x10000,
    tomListPeriod           = 0x20000,
    tomListPlain            = 0x30000,
    tomCharacter  = 1,
    tomWord       = 2,
    tomSentence   = 3,
    tomParagraph  = 4,
    tomLine       = 5,
    tomStory      = 6,
    tomScreen     = 7,
    tomSection    = 8,
    tomColumn     = 9,
    tomRow        = 10,
    tomWindow     = 11,
    tomCell       = 12,
    tomCharFormat = 13,
    tomParaFormat = 14,
    tomTable      = 15,
    tomObject     = 16,
    tomMatchWord    = 2,
    tomMatchCase    = 4,
    tomMatchPattern = 8,
    tomUnknownStory         = 0,
    tomMainTextStory        = 1,
    tomFootnotesStory       = 2,
    tomEndnotesStory        = 3,
    tomCommentsStory        = 4,
    tomTextFrameStory       = 5,
    tomEvenPagesHeaderStory = 6,
    tomPrimaryHeaderStory   = 7,
    tomEvenPagesFooterStory = 8,
    tomPrimaryFooterStory   = 9,
    tomFirstPageHeaderStory = 10,
    tomFirstPageFooterStory = 11,
    tomNoAnimation        = 0,
    tomLasVegasLights     = 1,
    tomBlinkingBackground = 2,
    tomSparkleText        = 3,
    tomMarchingBlackAnts  = 4,
    tomMarchingRedAnts    = 5,
    tomShimmer            = 6,
    tomWipeDown           = 7,
    tomWipeRight          = 8,
    tomAnimationMax       = 8,
    tomLowerCase     = 0,
    tomUpperCase     = 1,
    tomTitleCase     = 2,
    tomSentenceCase  = 4,
    tomToggleCase    = 5,
    tomReadOnly         = 0x100,
    tomShareDenyRead    = 0x200,
    tomShareDenyWrite   = 0x400,
    tomPasteFile        = 0x1000,
    tomCreateNew        = 0x10,
    tomCreateAlways     = 0x20,
    tomOpenExisting     = 0x30,
    tomOpenAlways       = 0x40,
    tomTruncateExisting = 0x50,
    tomRTF              = 0x1,
    tomText             = 0x2,
    tomHTML             = 0x3,
    tomWordDocument     = 0x4,
    tomBold      = 0x80000001,
    tomItalic    = 0x80000002,
    tomUnderline = 0x80000004,
    tomStrikeout = 0x80000008,
    tomProtected = 0x80000010,
    tomLink      = 0x80000020,
    tomSmallCaps = 0x80000040,
    tomAllCaps   = 0x80000080,
    tomHidden    = 0x80000100,
    tomOutline   = 0x80000200,
    tomShadow    = 0x80000400,
    tomEmboss    = 0x80000800,
    tomImprint   = 0x80001000,
    tomDisabled  = 0x80002000,
    tomRevised   = 0x80004000,
    tomNormalCaret      = 0,
    tomKoreanBlockCaret = 0x1,
    tomIncludeInset = 0x1,
    tomIgnoreCurrentFont  = 0,
    tomMatchFontCharset   = 0x1,
    tomMatchFontSignature = 0x2,
    tomCharset = 0x80000000,
    tomRE10Mode = 0x1,
    tomNoIME   = 0x80000,
    tomSelfIME = 0x40000
} tomConstants;

interface ITextRange;
interface ITextSelection;
interface ITextStoryRanges;

[
  object,
  uuid(8cc497c0-a1df-11ce-8098-00aa0047be5d)
]
interface ITextDocument : IDispatch
{
    HRESULT GetName([retval, out]BSTR *pName);
    HRESULT GetSelection([retval, out]ITextSelection **ppSel);
    HRESULT GetStoryCount([retval, out]LONG *pCount);
    HRESULT GetStoryRanges([retval, out]ITextStoryRanges **ppStories);
    HRESULT GetSaved([retval, out]LONG *pValue);
    HRESULT SetSaved([in]LONG Value);
    HRESULT GetDefaultTabStop([retval, out]float *pValue);
    HRESULT SetDefaultTabStop([in]float Value);
    HRESULT New();
    HRESULT Open([in]VARIANT *pVar, [in]LONG Flags, [in]LONG CodePage);
    HRESULT Save([in]VARIANT *pVar, [in]LONG Flags, [in]LONG CodePage);
    HRESULT Freeze([retval, out]LONG *pCount);
    HRESULT Unfreeze([retval, out]LONG *pCount);
    HRESULT BeginEditCollection();
    HRESULT EndEditCollection();
    HRESULT Undo([in]LONG Count, [retval, out]LONG *prop);
    HRESULT Redo([in]LONG Count, [retval, out]LONG *prop);
    HRESULT Range([in]LONG cp1, [in]LONG cp2, [retval, out]ITextRange **ppRange);
    HRESULT RangeFromPoint([in]LONG x, [in]LONG y, [retval, out]ITextRange **ppRange);
}

interface ITextFont;
interface ITextPara;

[
  object,
  uuid(8cc497c2-a1df-11ce-8098-00aa0047be5d)
]
interface ITextRange : IDispatch
{
    HRESULT GetText([retval, out]BSTR *pbstr);
    HRESULT SetText([in]BSTR bstr);
    HRESULT GetChar([retval, out]LONG *pch);
    HRESULT SetChar([in]LONG ch);
    HRESULT GetDuplicate([retval, out]ITextRange **ppRange);
    HRESULT GetFormattedText([retval, out]ITextRange **ppRange);
    HRESULT SetFormattedText([in]ITextRange *pRange);
    HRESULT GetStart([retval, out]LONG *pcpFirst);
    HRESULT SetStart([in]LONG cpFirst);
    HRESULT GetEnd([retval, out]LONG *pcpLim);
    HRESULT SetEnd([in]LONG cpLim);
    HRESULT GetFont([retval, out]ITextFont **pFont);
    HRESULT SetFont([in]ITextFont *pFont);
    HRESULT GetPara([retval, out]ITextPara **ppPara);
    HRESULT SetPara([in]ITextPara *pPara);
    HRESULT GetStoryLength([retval, out]LONG *pcch);
    HRESULT GetStoryType([retval, out]LONG *pValue);
    HRESULT Collapse([in]LONG bStart);
    HRESULT Expand([in]LONG Unit, [retval, out]LONG *pDelta);
    HRESULT GetIndex([in]LONG Unit, [retval, out]LONG *pIndex);
    HRESULT SetIndex([in]LONG Unit, [in]LONG Index, [in]LONG Extend);
    HRESULT SetRange([in]LONG cpActive, [in]LONG cpOther);
    HRESULT InRange([in]ITextRange *pRange, [retval, out]LONG *pb);
    HRESULT InStory([in]ITextRange *pRange, [retval, out]LONG *pb);
    HRESULT IsEqual([in]ITextRange *pRange, [retval, out]LONG *pb);
    HRESULT Select();
    HRESULT StartOf([in]LONG Unit, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT EndOf([in]LONG Unit, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT Move([in]LONG Unit, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveStart([in]LONG Unit, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveEnd([in]LONG Unit, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveWhile([in]VARIANT *Cset, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveStartWhile([in]VARIANT *Cset, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveEndWhile([in]VARIANT *Cset, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveUntil([in]VARIANT *Cset, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveStartUntil([in]VARIANT *Cset, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT MoveEndUntil([in]VARIANT *Cset, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT FindText([in]BSTR bstr, [in]LONG cch, [in]LONG Flags, [retval, out]LONG *pLength);
    HRESULT FindTextStart([in]BSTR bstr, [in]LONG cch, [in]LONG Flags, [retval, out]LONG *pLength);
    HRESULT FindTextEnd([in]BSTR bstr, [in]LONG cch, [in]LONG Flags, [retval, out]LONG *pLength);
    HRESULT Delete([in]LONG Unit, [in]LONG Count, [retval, out]LONG *pDelta);
    HRESULT Cut([out]VARIANT *pVar);
    HRESULT Copy([out]VARIANT *pVar);
    HRESULT Paste([in]VARIANT *pVar, [in]LONG Format);
    HRESULT CanPaste([in]VARIANT *pVar, [in]LONG Format, [retval, out]LONG *pb);
    HRESULT CanEdit([retval, out]LONG *pb);
    HRESULT ChangeCase([in]LONG Type);
    HRESULT GetPoint([in]LONG Type, [out]LONG *cx, [out]LONG *cy);
    HRESULT SetPoint([in]LONG x, [in]LONG y, [in]LONG Type, [in]LONG Extend);
    HRESULT ScrollIntoView([in]LONG Value);
    HRESULT GetEmbeddedObject([retval, out]IUnknown **ppv);
}

[
  object,
  uuid(8cc497c1-a1df-11ce-8098-00aa0047be5d)
]
interface ITextSelection : ITextRange
{
    HRESULT GetFlags([retval, out]LONG *pFlags);
    HRESULT SetFlags([in]LONG Flags);
    HRESULT GetType([retval, out]LONG *pType);
    HRESULT MoveLeft([in]LONG Unit, [in]LONG Count, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT MoveRight([in]LONG Unit, [in]LONG Count, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT MoveUp([in]LONG Unit, [in]LONG Count, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT MoveDown([in]LONG Unit, [in]LONG Count, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT HomeKey([in]LONG Unit, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT EndKey([in]LONG Unit, [in]LONG Extend, [retval, out]LONG *pDelta);
    HRESULT TypeText([in]BSTR bstr);
}

[
  object,
  uuid(8cc497c3-a1df-11ce-8098-00aa0047be5d)
]
interface ITextFont : IDispatch
{
    HRESULT GetDuplicate([retval, out]ITextFont **ppFont);
    HRESULT SetDuplicate([in]ITextFont *pFont);
    HRESULT CanChange([out]LONG *pB);
    HRESULT IsEqual([in]ITextFont *pFont, [retval, out]LONG *pB);
    HRESULT Reset([in]LONG Value);
    HRESULT GetStyle([retval, out]LONG *pValue);
    HRESULT SetStyle([in]LONG Value);
    HRESULT GetAllCaps([retval, out]LONG *pValue);
    HRESULT SetAllCaps([in]LONG Value);
    HRESULT GetAnimation([retval, out]LONG *pValue);
    HRESULT SetAnimation([in]LONG Value);
    HRESULT GetBackColor([retval, out]LONG *pValue);
    HRESULT SetBackColor([in]LONG Value);
    HRESULT GetBold([retval, out]LONG *pValue);
    HRESULT SetBold([in]LONG Value);
    HRESULT GetEmboss([retval, out]LONG *pValue);
    HRESULT SetEmboss([in]LONG Value);
    HRESULT GetForeColor([retval, out]LONG *pValue);
    HRESULT SetForeColor([in]LONG Value);
    HRESULT GetHidden([retval, out]LONG *pValue);
    HRESULT SetHidden([in]LONG Value);
    HRESULT GetEngrave([retval, out]LONG *pValue);
    HRESULT SetEngrave([in]LONG Value);
    HRESULT GetItalic([retval, out]LONG *pValue);
    HRESULT SetItalic([in]LONG Value);
    HRESULT GetKerning([retval, out]LONG *pValue);
    HRESULT SetKerning([in]LONG Value);
    HRESULT GetLanguageID([retval, out]LONG *pValue);
    HRESULT SetLanguageID([in]LONG Value);
    HRESULT GetName([retval, out]BSTR *pValue);
    HRESULT SetName([in]BSTR Value);
    HRESULT GetOutline([retval, out]LONG *pValue);
    HRESULT SetOutline([in]LONG Value);
    HRESULT GetPosition([retval, out]LONG *pValue);
    HRESULT SetPosition([in]LONG Value);
    HRESULT GetProtected([retval, out]LONG *pValue);
    HRESULT SetProtected([in]LONG Value);
    HRESULT GetShadow([retval, out]LONG *pValue);
    HRESULT SetShadow([in]LONG Value);
    HRESULT GetSize([retval, out]LONG *pValue);
    HRESULT SetSize([in]LONG Value);
    HRESULT GetSmallCaps([retval, out]LONG *pValue);
    HRESULT SetSmallCaps([in]LONG Value);
    HRESULT GetSpacing([retval, out]float *pValue);
    HRESULT SetSpacing([in]float Value);
    HRESULT GetStrikeThrough([retval, out]LONG *pValue);
    HRESULT SetStrikeThrough([in]LONG Value);
    HRESULT GetSubscript([retval, out]LONG *pValue);
    HRESULT SetSubscript([in]LONG Value);
    HRESULT GetSuperscript([retval, out]LONG *pValue);
    HRESULT SetSuperscript([in]LONG Value);
    HRESULT GetUnderline([retval, out]LONG *pValue);
    HRESULT SetUnderline([in]LONG Value);
    HRESULT GetWeight([retval, out]LONG *pValue);
    HRESULT SetWeight([in]LONG Value);
}

[
  object,
  uuid(8cc497c4-a1df-11ce-8098-00aa0047be5d)
]
interface ITextPara : IDispatch
{
    HRESULT GetDuplicate([retval, out]ITextPara **ppPara);
    HRESULT SetDuplicate([in]ITextPara *pPara);
    HRESULT CanChange([out]LONG *pB);
    HRESULT IsEqual([in]ITextPara *pPara, [retval, out]LONG *pB);
    HRESULT Reset([in]LONG Value);
    HRESULT GetStyle([retval, out]LONG *pValue);
    HRESULT SetStyle([in]LONG Value);
    HRESULT GetAlignment([retval, out]LONG *pValue);
    HRESULT SetAlignment([in]LONG Value);
    HRESULT GetHyphenation([retval, out]LONG *pValue);
    HRESULT SetHyphenation([in]LONG Value);
    HRESULT GetFirstLineIndent([retval, out]float *pValue);
    HRESULT GetKeepTogether([retval, out]LONG *pValue);
    HRESULT SetKeepTogether([in]LONG Value);
    HRESULT GetKeepWithNext([retval, out]LONG *pValue);
    HRESULT SetKeepWithNext([in]LONG Value);
    HRESULT GetLeftIndent([retval, out]float *pValue);
    HRESULT GetLineSpacing([retval, out]float *pValue);
    HRESULT GetLineSpacingRule([retval, out]LONG *pValue);
    HRESULT GetListAlignment([retval, out]LONG *pValue);
    HRESULT SetListAlignment([in]LONG Value);
    HRESULT GetListLevelIndex([retval, out]LONG *pValue);
    HRESULT SetListLevelIndex([in]LONG Value);
    HRESULT GetListStart([retval, out]LONG *pValue);
    HRESULT SetListStart([in]LONG Value);
    HRESULT GetListTab([retval, out]LONG *pValue);
    HRESULT SetListTab([in]LONG Value);
    HRESULT GetListType([retval, out]LONG *pValue);
    HRESULT SetListType([in]LONG Value);
    HRESULT GetNoLineNumber([retval, out]LONG *pValue);
    HRESULT SetNoLineNumber([in]LONG Value);
    HRESULT GetPageBreakBefore([retval, out]LONG *pValue);
    HRESULT SetPageBreakBefore([in]LONG Value);
    HRESULT GetRightIndent([retval, out]float *pValue);
    HRESULT SetRightIndent([in]float Value);
    HRESULT SetIndents([in]float StartIndent, [in]float LeftIndent, [in]float RightIndent);
    HRESULT SetLineSpacing([in]LONG LineSpacingRule, [in]float LineSpacing);
    HRESULT GetSpaceAfter([retval, out]float *pValue);
    HRESULT SetSpaceAfter([in]float Value);
    HRESULT GetSpaceBefore([retval, out]float *pValue);
    HRESULT SetSpaceBefore([in]float Value);
    HRESULT GetWindowControl([retval, out]float *pValue);
    HRESULT SetWindowControl([in]float Value);
    HRESULT GetTabCount([retval, out]LONG *pCount);
    HRESULT AddTab([in]float tbPos, [in]LONG tbAlign, [in]LONG tbLeader);
    HRESULT ClearAllTabs();
    HRESULT DeleteTab([in]float tbPos);
    HRESULT GetTab([in]LONG iTab, [out]float *ptbPos, [out]LONG *ptbAlign, [out]LONG *ptbLeader);
}

[
  object,
  uuid(8cc497c5-a1df-11ce-8098-00aa0047be5d)
]
interface ITextStoryRanges : IDispatch
{
    HRESULT _NewEnum([retval, out]IUnknown **ppUnkEnum);
    HRESULT Item([in]LONG Index, [retval, out]ITextRange **ppRange);
    HRESULT GetCount([retval, out]LONG *pCount);
}
