NVDA Helper
In-process and lite high-speed utilities for NVDA
displayModel_t Class Reference

Holds rectanglular chunks of text, and allows inserting chunks, clearing rectangles, and rendering text in a given rectangle. More...

#include <displayModel.h>

Inheritance diagram for displayModel_t:
LockableAutoFreeObject LockableObject

Public Member Functions

 displayModel_t (HWND hwnd=NULL)
 constructor
 
size_t getChunkCount ()
 Finds out how many chunks this model contains.
 
void insertChunk (const RECT &rect, int baseline, const std::wstring &text, POINT *characterExtents, const displayModelFormatInfo_t &formatInfo, int direction, const RECT *clippingRect)
 Inserts a text chunk in to the model.
 
void setFocusRect (const RECT *rect)
 Sets the coordinates of the current focus rectangle.
 
bool getFocusRect (RECT *rect)
 Gets the coordinates of the current focus rectangle.
 
void clearRectangle (const RECT &rect, BOOL clearForText=FALSE)
 Removes all chunks intersecting the given rectangle.
 
void clearAll ()
 Removes all content from this display model.
 
void transposAndScaleCoordinate (long srcOffset, long destOffset, float scale, long &val)
 
void copyRectangle (const RECT &srcRect, BOOL removeFromSource, BOOL opaqueCopy, BOOL srcInvert, const RECT &destRect, const RECT *destClippingRect, displayModel_t *destModel)
 Copies the chunks intersecting the given rectangle, in to the given display model, starting from the given coordinates.
 
void generateWhitespaceXML (HWND hwnd, long baseline, std::wstring &text)
 Generates xml representing whitespace between chunks.
 
void renderText (const RECT &rect, const int minHorizontalWhitespace, const int minVerticalWhitespace, const bool stripOuterWhitespace, std::wstring &text, std::deque< RECT > &characterLocations)
 Fetches the text contained in all chunks intersecting the given rectangle if provided, otherwize the text from all chunks in the model.
 
- Public Member Functions inherited from LockableAutoFreeObject
 LockableAutoFreeObject ()
 
void acquire ()
 Increases the reference count and acquires exclusive access.
 
void release ()
 
void requestDelete ()
 Deletes this object if no one has acquired it, or indicates that it should be deleted once it has been released.
 

Public Attributes

HWND hwnd
 

Protected Member Functions

void insertChunk (displayModelChunk_t *chunk)
 Overloaded insertChunk to take an already made chunk.
 
virtual ~displayModel_t ()
 destructor
 
- Protected Member Functions inherited from LockableAutoFreeObject
long incRef ()
 
long decRef ()
 

Detailed Description

Holds rectanglular chunks of text, and allows inserting chunks, clearing rectangles, and rendering text in a given rectangle.

Constructor & Destructor Documentation

◆ ~displayModel_t()

displayModel_t::~displayModel_t ( )
protectedvirtual

destructor

References LOG_DEBUG, and setFocusRect().

◆ displayModel_t()

displayModel_t::displayModel_t ( HWND hwnd = NULL)

constructor

References LOG_DEBUG.

Member Function Documentation

◆ insertChunk() [1/2]

void displayModel_t::insertChunk ( displayModelChunk_t * chunk)
protected

Overloaded insertChunk to take an already made chunk.

Parameters
chunkan already made chunk

References displayModelChunk_t::baseline, hwnd, displayModelChunk_t::hwnd, and displayModelChunk_t::rect.

Referenced by clearRectangle(), copyRectangle(), ExtTextOutHelper(), and insertChunk().

◆ getChunkCount()

size_t displayModel_t::getChunkCount ( )

Finds out how many chunks this model contains.

◆ insertChunk() [2/2]

void displayModel_t::insertChunk ( const RECT & rect,
int baseline,
const std::wstring & text,
POINT * characterExtents,
const displayModelFormatInfo_t & formatInfo,
int direction,
const RECT * clippingRect )

Inserts a text chunk in to the model.

Parameters
rectthe rectangle bounding the text.
textthe string of unicode text in the chunk.
characterExtentsan array of screen points denoting the end of each character relative to the start of the string
clippingRecta optional pointer to a rectangle which if specified will be used to clip the text so that none falls outside this rectangle.

References displayModelChunk_t::baseline, displayModelChunk_t::characterXArray, displayModelChunk_t::direction, displayModelChunk_t::formatInfo, insertChunk(), LOG_DEBUG, displayModelChunk_t::rect, displayModelChunk_t::text, and displayModelChunk_t::truncate().

◆ setFocusRect()

void displayModel_t::setFocusRect ( const RECT * rect)

Sets the coordinates of the current focus rectangle.

Referenced by clearAll(), clearRectangle(), copyRectangle(), fake_DrawFocusRect(), and ~displayModel_t().

◆ getFocusRect()

bool displayModel_t::getFocusRect ( RECT * rect)

Gets the coordinates of the current focus rectangle.

Referenced by fake_DrawFocusRect().

◆ clearRectangle()

void displayModel_t::clearRectangle ( const RECT & rect,
BOOL clearForText = FALSE )

Removes all chunks intersecting the given rectangle.

Currently this must be called before inserting chunks as chunks should never overlap.

Parameters
rectthe rectangle to clear.
clearForTextif true then the part of any chunk covered by the rectangle will definitly be removed to make way for text. If False chunks will only be removed/mutated if the rectangle starts at or outside of, the chunk and overlaps it, or covers the chunk's baseline.

References insertChunk(), LOG_DEBUG, displayModelChunk_t::rect, setFocusRect(), displayModelChunk_t::text, and displayModelChunk_t::truncate().

Referenced by copyRectangle(), ExtTextOutHelper(), fake_BeginPaint(), fake_FillRect(), fake_PatBlt(), and StretchBlt_helper().

◆ clearAll()

void displayModel_t::clearAll ( )

Removes all content from this display model.

References setFocusRect().

Referenced by fake_SelectObject().

◆ transposAndScaleCoordinate()

void displayModel_t::transposAndScaleCoordinate ( long srcOffset,
long destOffset,
float scale,
long & val )
inline

References long.

Referenced by copyRectangle().

◆ copyRectangle()

void displayModel_t::copyRectangle ( const RECT & srcRect,
BOOL removeFromSource,
BOOL opaqueCopy,
BOOL srcInvert,
const RECT & destRect,
const RECT * destClippingRect,
displayModel_t * destModel )

Copies the chunks intersecting the given rectangle, in to the given display model, starting from the given coordinates.

Parameters
srcRectthe rectangle intersecting all the chunks in this model that will be copied.
removeFromSourceif true then the content will be moved, rather than copied
opaqueCopyif true then the entire destination rectangle will be cleared before inserting any chunks, but if false then only space for each chunk will be cleared.
destRectthe destination rectangle where the chunks should be placed
destClippingRectan optional rectangle which will be used to clip all content being copied in to the destination model
destModela pointer to the displayModel the chunks should be copied to (if NULL then this model is used)

References displayModelFormatInfo_t::backgroundColor, displayModelChunk_t::baseline, displayModelChunk_t::characterXArray, clearRectangle(), displayModelFormatInfo_t::color, displayModelChunk_t::formatInfo, insertChunk(), displayModelFormatColor_t::inverted(), displayModelChunk_t::rect, setFocusRect(), displayModelChunk_t::text, transposAndScaleCoordinate(), and displayModelChunk_t::truncate().

Referenced by fake_ScrollWindow(), fake_ScrollWindowEx(), and StretchBlt_helper().

◆ generateWhitespaceXML()

void displayModel_t::generateWhitespaceXML ( HWND hwnd,
long baseline,
std::wstring & text )

Generates xml representing whitespace between chunks.

References hwnd.

Referenced by renderText().

◆ renderText()

void displayModel_t::renderText ( const RECT & rect,
const int minHorizontalWhitespace,
const int minVerticalWhitespace,
const bool stripOuterWhitespace,
std::wstring & text,
std::deque< RECT > & characterLocations )

Fetches the text contained in all chunks intersecting the given rectangle if provided, otherwize the text from all chunks in the model.

The chunks are ordered by Y and then by x.

Parameters
rectthe retangle which intersects the wanted chunks.
texta string in which all the rendered text will be placed.
characterPointsa deque in which the points for each character in text will be placed.

References BOOL(), displayModelChunk_t::characterXArray, generateWhitespaceXML(), displayModelChunk_t::generateXML(), hwnd, displayModelChunk_t::hwnd, displayModelChunk_t::rect, displayModelChunk_t::text, and displayModelChunk_t::truncate().

Referenced by displayModelRemote_getWindowTextInRect().

Member Data Documentation

◆ hwnd


The documentation for this class was generated from the following files: