|
OpenXLSX 1.9.1
|
Manages merged cell ranges in a worksheet. More...
#include <XLMergeCells.hpp>
Data Structures | |
| struct | XLMergeEntry |
| struct | XLRect |
| Internal numerical bounds representation for constant-time coordinate tests. More... | |
Public Member Functions | |
| XLMergeCells () | |
| XLMergeCells (const XMLNode &rootNode, std::vector< std::string_view > const &nodeOrder) | |
| ~XLMergeCells ()=default | |
| XLMergeCells (const XLMergeCells &other)=default | |
| XLMergeCells (XLMergeCells &&other) noexcept=default | |
| XLMergeCells & | operator= (const XLMergeCells &other)=default |
| XLMergeCells & | operator= (XLMergeCells &&other) noexcept=default |
| bool | valid () const |
| XLMergeIndex | findMerge (std::string_view reference) const |
| bool | mergeExists (std::string_view reference) const |
| XLMergeIndex | findMergeByCell (std::string_view cellRef) const |
| XLMergeIndex | findMergeByCell (XLCellReference cellRef) const |
| size_t | count () const |
| const char * | merge (XLMergeIndex index) const |
| const char * | operator[] (XLMergeIndex index) const |
| XLMergeIndex | appendMerge (const std::string &reference) |
| void | deleteMerge (XLMergeIndex index) |
| void | deleteAll () |
| Removes all merged ranges and the <mergeCells> XML container. | |
| void | shiftRows (int32_t delta, uint32_t fromRow) |
| Shift all merge regions by rowDelta for rows >= fromRow. | |
| void | shiftCols (int32_t delta, uint16_t fromCol) |
| Shift all merge regions by colDelta for columns >= fromCol. | |
| void | print (std::basic_ostream< char > &ostr) const |
Manages merged cell ranges in a worksheet.
This class handles the <mergeCells> element. Rationale: Excel's string-based range lookups (e.g., "A1:C3") are O(N) and expensive for frequent checks. This class maintains a numerical coordinate cache to enable O(1) cell-in-merge tests and O(M) overlap detection, significantly improving performance for spreadsheets with many merged areas.
|
default |
|
explicit |
| rootNode | The worksheet root node. |
| nodeOrder | Required child sequence for proper OOXML schema compliance. |
|
default |
|
default |
|
defaultnoexcept |
| XLMergeIndex XLMergeCells::appendMerge | ( | const std::string & | reference | ) |
| XLInputError | If the range overlaps with an existing merge. |
| size_t XLMergeCells::count | ( | ) | const |
| void XLMergeCells::deleteAll | ( | ) |
Removes all merged ranges and the <mergeCells> XML container.
| void XLMergeCells::deleteMerge | ( | XLMergeIndex | index | ) |
Invalidation: previous indices are invalidated after deletion.
| XLMergeIndex XLMergeCells::findMerge | ( | std::string_view | reference | ) | const |
| XLMergeIndex XLMergeCells::findMergeByCell | ( | std::string_view | cellRef | ) | const |
| XLMergeIndex XLMergeCells::findMergeByCell | ( | XLCellReference | cellRef | ) | const |
| const char * XLMergeCells::merge | ( | XLMergeIndex | index | ) | const |
| bool XLMergeCells::mergeExists | ( | std::string_view | reference | ) | const |
|
default |
|
defaultnoexcept |
|
inline |
| void XLMergeCells::print | ( | std::basic_ostream< char > & | ostr | ) | const |
| void XLMergeCells::shiftCols | ( | int32_t | delta, |
| uint16_t | fromCol | ||
| ) |
Shift all merge regions by colDelta for columns >= fromCol.
| delta | Positive = insert, negative = delete. |
| fromCol | 1-based first affected column. |
Mirror of shiftRows but operating on column (left/right) coordinates.
| void XLMergeCells::shiftRows | ( | int32_t | delta, |
| uint32_t | fromRow | ||
| ) |
Shift all merge regions by rowDelta for rows >= fromRow.
Regions that shrink to zero height or are fully inside the deleted band are removed. Regions straddling the boundary are clipped/expanded as appropriate.
| delta | Positive = insert (push down), negative = delete (pull up). |
| fromRow | 1-based first affected row. |
Shift merge regions vertically.
| bool XLMergeCells::valid | ( | ) | const |