36#ifndef WORKSHEETLAYOUT_H
37#define WORKSHEETLAYOUT_H
67 std::function<
GroupCell *()> getLastCell);
147 m_recalculateStart =
nullptr;
148 m_recalculateEnd =
nullptr;
158 bool atBottom =
false;
170 { m_getScrollAnchor = std::move(callback); }
218 static int AnchorY(
const ScrollAnchor &anchor);
229 int GetLastCellsRecalculated()
const {
return m_lastCellsRecalculated; }
236 void ApplyScrollCompensation();
245 std::function<
GroupCell *()> m_getLastCell;
260 int m_maxWidth_Cached = -1;
268 int m_scrollUnit = 10;
270 bool m_adjustWorksheetSizeNeeded =
false;
272 std::function<ScrollAnchor()> m_getScrollAnchor;
276 bool m_scrollAnchorAtBottom =
false;
279 bool m_scrollAnchorIsCursor =
false;
281 int m_scrollAnchorY = 0;
284 int m_lastCellsVisited = 0;
285 int m_lastCellsRecalculated = 0;
Implementation of an observing weak Cell pointer.
The pure arithmetic that turns a laid-out worksheet's extent into the scrollable (virtual) size and s...
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:539
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
The configuration storage for the current worksheet.
Definition: Configuration.h:101
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
The layout/recalculation engine of a worksheet.
Definition: WorksheetLayout.h:54
static GroupCell * FirstGroupReachingBelow(GroupCell *tree, int y)
The first group cell of tree that reaches below document y y.
Definition: WorksheetLayout.cpp:230
void RequestFullRecalculation()
Schedule a recalculation of the whole worksheet.
Definition: WorksheetLayout.cpp:330
void RequestAdjustSize()
Flag the virtual (scroll) size as needing re-adjustment.
Definition: WorksheetLayout.h:143
void RequestRecalculation(Cell *start)
Schedule a recalculation of the worksheet starting with the cell start.
Definition: WorksheetLayout.cpp:272
void GetMaxPoint(int *width, int *height)
Get the coordinates of the bottom right point of the worksheet.
Definition: WorksheetLayout.cpp:352
void UpdateConfigurationClientSize()
Inform the configuration about the view's current client size.
Definition: WorksheetLayout.cpp:339
int GetLastCellsVisited() const
GroupCells walked by the most recent RecalculateIfNeeded() pass (visited includes cheap reposition-on...
Definition: WorksheetLayout.h:228
static int AnchorY(const ScrollAnchor &anchor)
The document y of anchor's cursor position.
Definition: WorksheetLayout.cpp:191
void ArmScrollCompensation()
Keep the cursor still on screen across the next layout pass.
Definition: WorksheetLayout.cpp:208
void AdjustSize()
Adjust the virtual size and scrollbars to the document's extent.
Definition: WorksheetLayout.cpp:398
int GetScrollUnit() const
The scroll granularity (device px per scroll unit) AdjustSize() last applied.
Definition: WorksheetLayout.h:134
int GroupCellWidthWithMargins(int cellWidth) const
The horizontal space a group cell of the given width occupies.
Definition: WorksheetLayout.cpp:345
void SetScrollAnchorCallback(std::function< ScrollAnchor()> callback)
Tells the engine where the cursor currently is.
Definition: WorksheetLayout.h:169
bool RecalculateIfNeeded(bool timeout=false, long timeSliceMs=50)
Perform the scheduled recalculation, if one is pending.
Definition: WorksheetLayout.cpp:41
bool ScrollCompensationArmed() const
Is a scroll compensation waiting for the next layout pass to finish?
Definition: WorksheetLayout.h:221
void CancelPendingRecalculation()
Drop any pending recalculation (e.g. when the document is cleared).
Definition: WorksheetLayout.h:146
The narrow view surface the worksheet's layout pipeline needs.
Definition: WorksheetSizeMath.h:239
Remembers the last virtual size applied, so an unchanged size is a no-op.
Definition: WorksheetSizeMath.h:257