// Borland C++ Builder
// Copyright (c) 1995, 1998 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'CRVFData.pas' rev: 3.00

#ifndef CRVFDataHPP
#define CRVFDataHPP
#include <RVClasses.hpp>
#include <RVUni.hpp>
#include <RVBack.hpp>
#include <RVScroll.hpp>
#include <DLines.hpp>
#include <CRVData.hpp>
#include <RVItem.hpp>
#include <RVStyle.hpp>
#include <RVFuncs.hpp>
#include <Forms.hpp>
#include <Clipbrd.hpp>
#include <Controls.hpp>
#include <Graphics.hpp>
#include <Classes.hpp>
#include <Messages.hpp>
#include <Windows.hpp>
#include <SysUtils.hpp>
#include <SysInit.hpp>
#include <System.hpp>

//-- user supplied -----------------------------------------------------------

namespace Crvfdata
{
//-- type declarations -------------------------------------------------------
enum TRVFlag { rvflUseJumps, rvflTrim, rvflShareContents, rvflUseExternalLeading, rvflMouseXYAlwaysCorrect, 
	rvflAllowCustomDrawItems, rvflPrinting, rvflRootEditor };

typedef Set<TRVFlag, rvflUseJumps, rvflRootEditor>  TRVFlags;

enum TRVState { rvstMakingSelection, rvstDrawHover, rvstSkipFormatting, rvstFormatParas, rvstIgnoreNextMouseDown, 
	rvstChangingBkPalette, rvstCompletelySelected, rvstClearing, rvstResizing, rvstDoNotMoveChildren, rvstForceStyleChangeEvent, 
	rvstIgnoreNextChar, rvstDoNotTab, rvstDeselecting, rvstUnAssigningChosen };

typedef Set<TRVState, rvstMakingSelection, rvstUnAssigningChosen>  TRVStates;

class DELPHICLASS TRVJumpInfo;
class DELPHICLASS TCustomRVFormattedData;
class PASCALIMPLEMENTATION TCustomRVFormattedData : public Crvdata::TCustomRVData 
{
	typedef Crvdata::TCustomRVData inherited;
	
private:
	Rvitem::TRVCPInfo* LastRaisedCP;
	bool XorImageDrawn;
	Controls::TMouseMoveEvent FXORDrawing;
	Rvitem::TCustomRVItemInfo* FCaptureMouseItem;
	int FZoomPercent;
	int __fastcall FindDrawItemAtPos(int X, int Y);
	bool __fastcall FindWordAt(System::AnsiString &Word, int X, int Y, int &StyleNo, int &ItemNo, int &
		Offs, TCustomRVFormattedData* &RVData);
	void __fastcall CopyText_(void);
	void __fastcall CopyTextW_(void);
	void __fastcall CopyImage_(void);
	void __fastcall CopyRVF_(Graphics::TColor Color, Rvback::TRVBackground* Background);
	void __fastcall CopyRTF_(Graphics::TColor Color, Rvback::TRVBackground* Background);
	void __fastcall StartFormatting(void);
	void __fastcall EndFormatting(void);
	void __fastcall SearchHotItem(int X, int Y, int HOffs, int VOffs);
	
protected:
	int MouseX;
	int MouseY;
	Classes::TList* Jumps;
	int nJmps;
	int LastItemFormatted;
	int LastJumpMovedAbove;
	int LastDIMovedAbove;
	TCustomRVFormattedData* LastRVDataMovedAbove;
	int LastJumpDowned;
	Rvitem::TCustomRVItemInfo* FPartialSelectedItem;
	bool AlreadyFormatted;
	virtual void __fastcall InternalFreeItem(Rvitem::TCustomRVItemInfo* item);
	void __fastcall FindDrawItemForSel(int X, int Y, int &No, int &Offs, bool isstart);
	void __fastcall GetScreenLineBounds(int DrawItemNo, int &First, int &Last);
	void __fastcall ApplyZoom(Graphics::TCanvas* Canvas);
	void __fastcall ZoomRectDown(Windows::TRect &r);
	void __fastcall ZoomInt(int &v);
	void __fastcall RestoreZoom(Graphics::TCanvas* Canvas);
	void __fastcall FinishScreenLine(const Rvfuncs::TRVScreenAndDevice &sad, int LineWidth, int LastDrawItem
		, bool parafinished, int &ExtraSpace, bool &dontdoit);
	void __fastcall FormatLine(const System::AnsiString Text, int StartOffs, int Len, int ItemNo, int &
		x, int &baseline, int &prevdesc, int &prevabove, Graphics::TCanvas* Canvas, Rvfuncs::TRVScreenAndDevice 
		&sad, bool &IsParaStart, int &LineWidth, int &FirstIndent, int &LastDrawItem, int &VerticalOffs, bool 
		&DontFSL, int &LastTextStyle, tagTEXTMETRICA &TextMetric);
	void __fastcall FormatWords(int ItemNo, int &x, int &baseline, int &prevdesc, int &prevabove, Graphics::TCanvas* 
		Canvas, Rvfuncs::TRVScreenAndDevice &sad, bool &IsParaStart, int &LineWidth, int &FirstIndent, int 
		&LastDrawItem, int &VerticalOffs, bool &DontFSL, int &LastTextStyle, tagTEXTMETRICA &TextMetric);
	DYNAMIC void __fastcall RVFGetLimits(Crvdata::TRVFSaveScope SaveScope, int &StartItem, int &EndItem
		, int &StartOffs, int &EndOffs, Rvitem::TRVMultiDrawItemPart* &StartPart, Rvitem::TRVMultiDrawItemPart* 
		&EndPart);
	Windows::TRect __fastcall GetClientSelectionRect(void);
	virtual void __fastcall GetSADForFormatting(Graphics::TCanvas* Canvas, Rvfuncs::TRVScreenAndDevice 
		&sad);
	DYNAMIC void __fastcall DeselectPartiallySelectedItem(Rvitem::TCustomRVItemInfo* NewPartiallySelected
		);
	virtual void __fastcall SetPartialSelectedItem(Rvitem::TCustomRVItemInfo* Item);
	DYNAMIC void __fastcall Formatted(int FirstItemNo, int LastItemNo, bool Partial);
	DYNAMIC Controls::TControl* __fastcall GetInplaceEditor(void);
	DYNAMIC void __fastcall DestroyInplaceEditor(void);
	void __fastcall ClearLastJump(void);
	void __fastcall ExpandToParaSection(int ItemNo1, int ItemNo2, int &FirstItemNo, int &LastItemNo);
	void __fastcall ExpandToPara(int ItemNo1, int ItemNo2, int &FirstItemNo, int &LastItemNo);
	bool __fastcall InsideSelection(int DItemNo, int DItemOffs);
	DYNAMIC void __fastcall AfterDeleteStyles(Rvclasses::TRVIntegerList* TextStylesShift, Rvclasses::TRVIntegerList* 
		ParaStylesShift);
	Rvstyle::TRVBiDiMode __fastcall GetItemBiDiMode(int ItemNo);
	Rvstyle::TRVBiDiMode __fastcall GetParaBiDiMode(int ParaNo);
	DYNAMIC void __fastcall ResetSubCoords(void);
	void __fastcall ConcateItems(int FirstItemNo);
	
public:
	Rvitem::TCustomRVItemInfo* FActiveItem;
	int DocumentWidth;
	int DocumentHeight;
	int TextWidth;
	int FocusedItemNo;
	TRVStates State;
	Dlines::TRVDrawLines* DrawItems;
	int FSelStartNo;
	int FSelEndNo;
	int FSelStartOffs;
	int FSelEndOffs;
	void __fastcall Normalize(void);
	int __fastcall GetOffsBeforeDrawItem(int DrawItemNo);
	int __fastcall GetOffsAfterDrawItem(int DrawItemNo);
	DYNAMIC TCustomRVFormattedData* __fastcall GetChosenRVData(void);
	DYNAMIC Rvitem::TCustomRVItemInfo* __fastcall GetChosenItem(void);
	DYNAMIC Controls::TWinControl* __fastcall GetEditor(void);
	void __fastcall GetItemAt(int X, int Y, int &ItemNo, int &OffsetInItem);
	void __fastcall GetItemAtEx(int X, int Y, TCustomRVFormattedData* &RVData, int &ItemNo, int &OffsetInItem
		);
	int __fastcall GetNextFocusedItem(int ItemNo, bool GoForward, TCustomRVFormattedData* &TopLevelRVData
		, int &TopLevelItemNo);
	void __fastcall ClearFocus(void);
	DYNAMIC void __fastcall AdjustFocus(int NewFocusedItemNo, Classes::TPersistent* TopLevelRVData, int 
		TopLevelItemNo);
	virtual void __fastcall GetOrigin(int &ALeft, int &ATop);
	DYNAMIC void __fastcall GetOriginEx(int &ALeft, int &ATop);
	void __fastcall BuildJumpsCoords(int &StartJumpNo, Classes::TList* jumps);
	DYNAMIC void __fastcall ShowRectangle(int Left, int Top, int Width, int Height);
	virtual TRVFlags __fastcall GetFlags(void) = 0;
	virtual void __fastcall SetFlags(const TRVFlags Value) = 0;
	virtual int __fastcall GetAreaWidth(void) = 0;
	virtual int __fastcall GetLeftMargin(void) = 0;
	virtual int __fastcall GetRightMargin(void) = 0;
	virtual int __fastcall GetTopMargin(void) = 0;
	virtual int __fastcall GetBottomMargin(void) = 0;
	virtual int __fastcall GetMinTextWidth(void) = 0;
	virtual int __fastcall GetMaxTextWidth(void) = 0;
	virtual Rvback::TRVBackground* __fastcall GetBackground(void) = 0;
	virtual Rvstyle::TRVBiDiMode __fastcall GetBiDiMode(void);
	__property TRVFlags Flags = {read=GetFlags, write=SetFlags, nodefault};
	void __fastcall GetSelBounds(int &StartNo, int &EndNo, int &StartOffs, int &EndOffs, bool Normalize
		);
	void __fastcall StoreSelBounds(int &StartNo, int &EndNo, int &StartOffs, int &EndOffs, bool Normalize
		);
	void __fastcall RestoreSelBounds(int StartNo, int EndNo, int StartOffs, int EndOffs);
	void __fastcall DrawItem2Item(int DrawItemNo, int DrawItemOffs, int &ItemNo, int &ItemOffs);
	void __fastcall Item2FirstDrawItem(int ItemNo, int &DrawItemNo);
	void __fastcall AdjustJumpsCoords(void);
	virtual void __fastcall AdjustVScrollUnits(void) = 0;
	virtual void __fastcall SetDocumentAreaSize(int Width, int Height, bool UpdateH) = 0;
	int __fastcall FindDrawItemByItem(int ItemNo);
	int __fastcall GetFirstVisible(int TopLine);
	DYNAMIC void __fastcall DoCopy(void);
	DYNAMIC bool __fastcall IsAssignedCopy(void);
	DYNAMIC bool __fastcall IsAssignedRVMouseUp(void) = 0;
	DYNAMIC bool __fastcall IsAssignedRVMouseDown(void) = 0;
	DYNAMIC bool __fastcall IsAssignedRVRightClick(void);
	DYNAMIC bool __fastcall IsAssignedJump(void) = 0;
	DYNAMIC bool __fastcall IsAssignedRVDblClick(void);
	DYNAMIC bool __fastcall IsAssignedCheckpointVisible(void) = 0;
	DYNAMIC void __fastcall DoRVMouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int 
		ItemNo, int X, int Y) = 0;
	DYNAMIC void __fastcall DoRVMouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int 
		ItemNo, int X, int Y) = 0;
	DYNAMIC void __fastcall DoRVRightClick(const System::AnsiString ClickedWord, int StyleNo, int X, int 
		Y);
	DYNAMIC void __fastcall DoJump(int id) = 0;
	DYNAMIC void __fastcall DoRVMouseMove(int id) = 0;
	DYNAMIC void __fastcall DoRVDblClick(const System::AnsiString ClickedWord, int StyleNo);
	DYNAMIC void __fastcall DoSelect(void);
	DYNAMIC void __fastcall DoCheckpointVisible(Rvstyle::TCheckpointData CheckpointData) = 0;
	DYNAMIC Controls::TCursor __fastcall GetNormalCursor(void) = 0;
	DYNAMIC Rvscroll::TCPEventKind __fastcall GetCPEventKind(void);
	DYNAMIC void __fastcall DoOnSelection(void);
	void __fastcall InvalidateJumpRect(int id);
	void __fastcall Refresh(void);
	void __fastcall UpdateView(void);
	void __fastcall Invalidate(void);
	void __fastcall InvalidateRect(const Windows::TRect &r);
	DYNAMIC tagPOINT __fastcall ClientToScreen(const tagPOINT &p);
	DYNAMIC tagPOINT __fastcall ScreenToClient(const tagPOINT &p);
	DYNAMIC void __fastcall GetSelStart(int &DINo, int &DIOffs);
	DYNAMIC void __fastcall SrchSelectIt(int strt, int offs, int len);
	DYNAMIC void __fastcall SrchStart(bool Down, int &strt, int &offs);
	__property Rvitem::TCustomRVItemInfo* PartialSelectedItem = {read=FPartialSelectedItem, write=SetPartialSelectedItem
		};
	virtual int __fastcall GetHOffs(void);
	virtual int __fastcall GetVOffs(void);
	int __fastcall GetZHOffs(void);
	int __fastcall GetZVOffs(void);
	void __fastcall SetMouseCapture(Rvitem::TCustomRVItemInfo* Item, int &Left, int &Top);
	void __fastcall ReleaseMouseCapture(Rvitem::TCustomRVItemInfo* Item);
	virtual int __fastcall GetWidth(void) = 0;
	virtual int __fastcall GetHeight(void) = 0;
	virtual Graphics::TCanvas* __fastcall GetCanvas(void);
	virtual void __fastcall ScrollTo(int Y, bool Redraw) = 0;
	virtual void __fastcall HScrollTo(int X) = 0;
	virtual int __fastcall GetVSmallStep(void) = 0;
	void __fastcall XorDrawing(void);
	void __fastcall XorDrawingEx(int X, int Y);
	bool __fastcall ClearXorDrawing(void);
	void __fastcall AssignXorDrawing(Controls::TMouseMoveEvent P);
	bool __fastcall UsingThisXorDrawing(Controls::TMouseMoveEvent P);
	void __fastcall UnAssignXorDrawing(Controls::TMouseMoveEvent P);
	DYNAMIC void __fastcall SetCursor(Controls::TCursor Cursor);
	int __fastcall CalculateParaSectionMinWidth(int StartItemNo);
	int __fastcall CalculateParaSectionsMinWidth(int StartItemNo, int EndItemNo);
	int __fastcall CalculateMinItemWidthPlus(Rvitem::TCustomRVItemInfo* li);
	int __fastcall CalculateMinItemsWidthPlus(int StartItemNo, int EndItemNo);
	int __fastcall CalculateMinItemWidthPlusEx(int ItemNo);
	int __fastcall CalculateMinItemsWidthPlusEx(int StartItemNo, int EndItemNo);
	int __fastcall CalculateMinDocWidthPlus(void);
	int __fastcall CalculateMinWidthAfterInsert(Rvitem::TCustomRVItemInfo* item, int InsertItemNo);
	void __fastcall Item2DrawItem(int ItemNo, int ItemOffs, int &DrawItemNo, int &DrawItemOffs);
	virtual void __fastcall ClearTemporal(void);
	DYNAMIC void __fastcall Clear(void);
	void __fastcall ClearJumps(void);
	void __fastcall AdjustChildrenCoords(void);
	virtual void __fastcall Format_(bool OnlyResized, bool ForceFormat, bool NoScroll, int depth, Graphics::TCanvas* 
		Canvas, bool OnlyTail);
	void __fastcall Format(void);
	int __fastcall GetDrawItemNo(int BoundLine, int Option);
	void __fastcall MouseLeave(void);
	void __fastcall MouseMove(Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall MouseUp(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int 
		Y);
	DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
		int Y);
	void __fastcall DblClick(void);
	void __fastcall AfterVScroll(void);
	void __fastcall UpdateBackgroundPaletteInfo(Rvback::TRVBackground* Background);
	bool __fastcall UpdatingBackgroundPalette(void);
	void __fastcall OnTimerScroll(void);
	virtual Graphics::TColor __fastcall GetColor(void) = 0;
	DYNAMIC void __fastcall AssignChosenRVData(TCustomRVFormattedData* RVData, Rvitem::TCustomRVItemInfo* 
		Item);
	DYNAMIC void __fastcall SilentReplaceChosenRVData(TCustomRVFormattedData* RVData);
	DYNAMIC void __fastcall UnassignChosenRVData(TCustomRVFormattedData* RVData);
	void __fastcall GetParaBounds(int DINo1, int DINo2, int &ParaStart, int &ParaEnd);
	void __fastcall FormatParas(int StartDrawItemNo, int EndDrawItemNo, int ItemsInserted);
	void __fastcall FormatParasExact(int StartDrawItemNo, int EndDrawItemNo, int ItemsInserted);
	__fastcall TCustomRVFormattedData(void);
	__fastcall virtual ~TCustomRVFormattedData(void);
	void __fastcall PaintTo(Graphics::TCanvas* Canvas, const Windows::TRect &AClipRect);
	DYNAMIC int __fastcall GetFirstItemVisible(void);
	DYNAMIC int __fastcall GetLastItemVisible(void);
	bool __fastcall SearchText(bool Down, bool MatchCase, bool WholeWord, System::AnsiString s);
	void __fastcall GetWordAt(int X, int Y, int &ItemNo, System::AnsiString &Word);
	void __fastcall SelectWordAt(int X, int Y);
	DYNAMIC void __fastcall Deselect(Rvitem::TCustomRVItemInfo* NewPartiallySelected, bool MakeEvent);
	void __fastcall SelectAll(void);
	bool __fastcall SelectionExists(bool AllowReset, bool UsePartialSelected);
	System::AnsiString __fastcall GetSelText(bool Unicode);
	Graphics::TGraphic* __fastcall GetSelectedImage(void);
	void __fastcall GetSelectionBounds(int &StartItemNo, int &StartItemOffs, int &EndItemNo, int &EndItemOffs
		, bool Normalize);
	DYNAMIC void __fastcall GetSelectionBoundsEx(int &StartItemNo, int &StartItemOffs, int &EndItemNo, 
		int &EndItemOffs, bool Normalize);
	void __fastcall SetSelectionBounds(int StartItemNo, int StartItemOffs, int EndItemNo, int EndItemOffs
		);
	Windows::TRect __fastcall GetSelectionRect(void);
	void __fastcall GetCheckpointXY(Rvstyle::TCheckpointData CheckpointData, int &X, int &Y);
	int __fastcall GetCheckpointYEx(Rvstyle::TCheckpointData CheckpointData);
	int __fastcall GetJumpPointY(int id);
	int __fastcall GetJumpPointItemNo(int id);
	void __fastcall GetJumpPointLocation(int id, TCustomRVFormattedData* &RVData, int &ItemNo);
	DYNAMIC void __fastcall DeleteItems(int FirstItemNo, int Count);
	void __fastcall CopyRVF(Graphics::TColor Color, Rvback::TRVBackground* Background);
	void __fastcall CopyRTF(Graphics::TColor Color, Rvback::TRVBackground* Background);
	void __fastcall CopyText(void);
	void __fastcall CopyTextW(void);
	void __fastcall CopyImage(void);
	void __fastcall Copy(Graphics::TColor Color, Rvback::TRVBackground* Background);
	bool __fastcall CopyDef(Graphics::TColor Color, Rvback::TRVBackground* Background);
	void __fastcall SelectLine(int ItemNo, int Offs);
	bool __fastcall GetItemCoords(int ItemNo, int &Left, int &Top);
	bool __fastcall GetItemClientCoords(int ItemNo, int &Left, int &Top);
	__property Rvitem::TCustomRVItemInfo* CaptureMouseItem = {read=FCaptureMouseItem};
};

class PASCALIMPLEMENTATION TRVJumpInfo : public System::TObject 
{
	typedef System::TObject inherited;
	
public:
	TCustomRVFormattedData* RVData;
	int l;
	int t;
	int w;
	int h;
	int id;
	int DrawItemNo;
	Controls::TCursor Cursor;
public:
	/* TObject.Create */ __fastcall TRVJumpInfo(void) : System::TObject() { }
	/* TObject.Destroy */ __fastcall virtual ~TRVJumpInfo(void) { }
	
};

//-- var, const, procedure ---------------------------------------------------
extern PACKAGE bool RichViewSafeFormatting;

}	/* namespace Crvfdata */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Crvfdata;
#endif
//-- end unit ----------------------------------------------------------------
#endif	// CRVFData
