NVDA Helper
In-process and lite high-speed utilities for NVDA
|
Holds rectanglular chunks of text, and allows inserting chunks, clearing rectangles, and rendering text in a given rectangle. More...
#include <displayModel.h>
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. | |
![]() | |
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 | |
![]() | |
long | incRef () |
long | decRef () |
Holds rectanglular chunks of text, and allows inserting chunks, clearing rectangles, and rendering text in a given rectangle.
|
protectedvirtual |
destructor
References LOG_DEBUG, and setFocusRect().
displayModel_t::displayModel_t | ( | HWND | hwnd = NULL | ) |
constructor
References LOG_DEBUG.
|
protected |
Overloaded insertChunk to take an already made chunk.
chunk | an already made chunk |
References displayModelChunk_t::baseline, hwnd, displayModelChunk_t::hwnd, and displayModelChunk_t::rect.
Referenced by clearRectangle(), copyRectangle(), ExtTextOutHelper(), and insertChunk().
size_t displayModel_t::getChunkCount | ( | ) |
Finds out how many chunks this model contains.
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.
rect | the rectangle bounding the text. |
text | the string of unicode text in the chunk. |
characterExtents | an array of screen points denoting the end of each character relative to the start of the string |
clippingRect | a 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().
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().
bool displayModel_t::getFocusRect | ( | RECT * | rect | ) |
Gets the coordinates of the current focus rectangle.
Referenced by fake_DrawFocusRect().
Removes all chunks intersecting the given rectangle.
Currently this must be called before inserting chunks as chunks should never overlap.
rect | the rectangle to clear. |
clearForText | if 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().
void displayModel_t::clearAll | ( | ) |
Removes all content from this display model.
References setFocusRect().
Referenced by fake_SelectObject().
|
inline |
References long.
Referenced by 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.
srcRect | the rectangle intersecting all the chunks in this model that will be copied. |
removeFromSource | if true then the content will be moved, rather than copied |
opaqueCopy | if 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. |
destRect | the destination rectangle where the chunks should be placed |
destClippingRect | an optional rectangle which will be used to clip all content being copied in to the destination model |
destModel | a 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().
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.
rect | the retangle which intersects the wanted chunks. |
text | a string in which all the rendered text will be placed. |
characterPoints | a 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().
HWND displayModel_t::hwnd |
Referenced by displayModelRemote_getWindowTextInRect(), fake_DrawFocusRect(), generateWhitespaceXML(), insertChunk(), and renderText().