Kaydet (Commit) 5a025886 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Hide the implementation of svx::frame::Array.

Change-Id: Iad2d494bf7dd9f1f69e4e863aeaa514bf76c7c76
üst ebba1f50
...@@ -31,91 +31,7 @@ ...@@ -31,91 +31,7 @@
namespace svx { namespace svx {
namespace frame { namespace frame {
// ============================================================================ class ArrayImpl;
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;
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;
};
/** Stores frame styles of an array of cells, supports merged ranges. /** Stores frame styles of an array of cells, supports merged ranges.
......
...@@ -27,8 +27,32 @@ ...@@ -27,8 +27,32 @@
namespace svx { namespace svx {
namespace frame { 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() : Cell::Cell() :
mnAddLeft( 0 ), mnAddLeft( 0 ),
...@@ -95,7 +119,61 @@ static const Cell OBJ_CELL_NONE; ...@@ -95,7 +119,61 @@ static const Cell OBJ_CELL_NONE;
const bool DIAG_DBL_CLIP_DEFAULT = false; 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 ) : ArrayImpl::ArrayImpl( size_t nWidth, size_t nHeight, bool bDiagDblClip ) :
mnWidth( nWidth ), mnWidth( nWidth ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment