TableArea.h (1755B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 #ifndef mozilla_TableArea_h_ 7 #define mozilla_TableArea_h_ 8 9 #include "nsRect.h" 10 11 namespace mozilla { 12 13 struct TableArea { 14 TableArea() : mStartCol(0), mStartRow(0), mColCount(0), mRowCount(0) {} 15 TableArea(int32_t aStartCol, int32_t aStartRow, int32_t aColCount, 16 int32_t aRowCount) 17 : mStartCol(aStartCol), 18 mStartRow(aStartRow), 19 mColCount(aColCount), 20 mRowCount(aRowCount) {} 21 22 int32_t& StartCol() { return mStartCol; } 23 int32_t& StartRow() { return mStartRow; } 24 int32_t& ColCount() { return mColCount; } 25 int32_t& RowCount() { return mRowCount; } 26 27 int32_t StartCol() const { return mStartCol; } 28 int32_t StartRow() const { return mStartRow; } 29 int32_t ColCount() const { return mColCount; } 30 int32_t RowCount() const { return mRowCount; } 31 int32_t EndCol() const { return mStartCol + mColCount; } 32 int32_t EndRow() const { return mStartRow + mRowCount; } 33 34 void UnionArea(const TableArea& aArea1, const TableArea& aArea2) { 35 nsIntRect rect(aArea1.mStartCol, aArea1.mStartRow, aArea1.mColCount, 36 aArea1.mRowCount); 37 rect.UnionRect(rect, nsIntRect(aArea2.mStartCol, aArea2.mStartRow, 38 aArea2.mColCount, aArea2.mRowCount)); 39 rect.GetRect(&mStartCol, &mStartRow, &mColCount, &mRowCount); 40 } 41 42 private: 43 int32_t mStartCol, mStartRow, mColCount, mRowCount; 44 }; 45 46 } // namespace mozilla 47 48 #endif // mozilla_TableArea_h_