diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-13 13:18:25 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-01-17 11:33:10 -0500 |
commit | 5a0258868c05d6f5cb5de64af5df8c01153e99ec (patch) | |
tree | 077e30b1a8625700f91511ccefeabc78c16f58da /svx/source | |
parent | ebba1f506c0694e4a469feac1e019ee127a3dc9d (diff) |
Hide the implementation of svx::frame::Array.
Change-Id: Iad2d494bf7dd9f1f69e4e863aeaa514bf76c7c76
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/framelinkarray.cxx | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx index d82b959d686a..6b83afb9cb26 100644 --- a/svx/source/dialog/framelinkarray.cxx +++ b/svx/source/dialog/framelinkarray.cxx @@ -27,8 +27,32 @@ namespace svx { namespace frame { -// ============================================================================ +struct Cell +{ + Style maLeft; + Style maRight; + Style maTop; + Style maBottom; + Style maTLBR; + Style maBLTR; + long mnAddLeft; + long mnAddRight; + long mnAddTop; + long mnAddBottom; + bool mbMergeOrig; + bool mbOverlapX; + bool mbOverlapY; + + explicit Cell(); + + inline bool IsMerged() const { return mbMergeOrig || mbOverlapX || mbOverlapY; } + inline bool IsOverlapped() const { return mbOverlapX || mbOverlapY; } + + void MirrorSelfX( bool bMirrorStyles, bool bSwapDiag ); +}; +typedef std::vector< long > LongVec; +typedef std::vector< Cell > CellVec; Cell::Cell() : mnAddLeft( 0 ), @@ -95,7 +119,61 @@ static const Cell OBJ_CELL_NONE; const bool DIAG_DBL_CLIP_DEFAULT = false; -// ============================================================================ +struct ArrayImpl +{ + CellVec maCells; + LongVec maWidths; + LongVec maHeights; + mutable LongVec maXCoords; + mutable LongVec maYCoords; + size_t mnWidth; + size_t mnHeight; + size_t mnFirstClipCol; + size_t mnFirstClipRow; + size_t mnLastClipCol; + size_t mnLastClipRow; + mutable bool mbXCoordsDirty; + mutable bool mbYCoordsDirty; + bool mbDiagDblClip; + + explicit ArrayImpl( size_t nWidth, size_t nHeight, bool bDiagDblClip ); + + inline bool IsValidPos( size_t nCol, size_t nRow ) const + { return (nCol < mnWidth) && (nRow < mnHeight); } + inline size_t GetIndex( size_t nCol, size_t nRow ) const + { return nRow * mnWidth + nCol; } + + const Cell& GetCell( size_t nCol, size_t nRow ) const; + Cell& GetCellAcc( size_t nCol, size_t nRow ); + + size_t GetMergedFirstCol( size_t nCol, size_t nRow ) const; + size_t GetMergedFirstRow( size_t nCol, size_t nRow ) const; + size_t GetMergedLastCol( size_t nCol, size_t nRow ) const; + size_t GetMergedLastRow( size_t nCol, size_t nRow ) const; + + const Cell& GetMergedOriginCell( size_t nCol, size_t nRow ) const; + + bool IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const; + bool IsMergedOverlappedRight( size_t nCol, size_t nRow ) const; + bool IsMergedOverlappedTop( size_t nCol, size_t nRow ) const; + bool IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const; + + bool IsInClipRange( size_t nCol, size_t nRow ) const; + bool IsColInClipRange( size_t nCol ) const; + bool IsRowInClipRange( size_t nRow ) const; + + inline size_t GetMirrorCol( size_t nCol ) const { return mnWidth - nCol - 1; } + inline size_t GetMirrorRow( size_t nRow ) const { return mnHeight - nRow - 1; } + + long GetColPosition( size_t nCol ) const; + long GetRowPosition( size_t nRow ) const; + + long GetColWidth( size_t nFirstCol, size_t nLastCol ) const; + long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const; + + double GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple = false ) const; + double GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple = false ) const; +}; ArrayImpl::ArrayImpl( size_t nWidth, size_t nHeight, bool bDiagDblClip ) : mnWidth( nWidth ), |