sc/inc/document.hxx              |    4 +++-
 sc/inc/table.hxx                 |    3 +++
 sc/source/core/data/document.cxx |   23 ++++++++++++++++-------
 sc/source/core/data/table5.cxx   |   13 +++++++++++++
 sc/source/ui/app/transobj.cxx    |    7 ++-----
 5 files changed, 37 insertions(+), 13 deletions(-)

New commits:
commit 03720cfb47870d5bf1619cae8c6ed66204b6415b
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Thu Jul 26 17:55:18 2012 -0400

    Try to encapsulate the row flag array.
    
    Eventually this flag array will go. The manual row height flag is
    the last one standing...
    
    Change-Id: I3f6be511eba50836d785ddf20ef08878797f6fe0

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6d4a02e..39fce78 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1341,7 +1341,6 @@ public:
     SC_DLLPUBLIC sal_uInt8          GetRowFlags( SCROW nRow, SCTAB nTab ) 
const;
 
     SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
GetRowFlagsArray( SCTAB nTab ) const;
-    SC_DLLPUBLIC       ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
GetRowFlagsArrayModifiable( SCTAB nTab );
 
     SC_DLLPUBLIC void           GetAllRowBreaks(::std::set<SCROW>& rBreaks, 
SCTAB nTab, bool bPage, bool bManual) const;
     SC_DLLPUBLIC void           GetAllColBreaks(::std::set<SCCOL>& rBreaks, 
SCTAB nTab, bool bPage, bool bManual) const;
@@ -1371,6 +1370,9 @@ public:
     SCROW                       LastNonFilteredRow(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab);
     SCROW                       CountNonFilteredRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab);
 
+    bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
+    void SetRowHeightManual(SCROW nRow, SCTAB nTab, bool bManual);
+
     /**
      * Write all column row flags to table's flag data, because not all column
      * row attributes are stored in the flag data members.  This is necessary
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 966c458..0f32c31 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -746,6 +746,9 @@ public:
     SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
     SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
 
+    bool IsManualRowHeight(SCROW nRow) const;
+    void SetRowHeightManual(SCROW nRow, bool bManual);
+
     void        SyncColRowFlags();
 
     void        StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f3724d5..df18748 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3754,13 +3754,6 @@ sal_uInt8 ScDocument::GetRowFlags( SCROW nRow, SCTAB 
nTab ) const
     return 0;
 }
 
-ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
ScDocument::GetRowFlagsArrayModifiable(
-        SCTAB nTab )
-{
-    return const_cast< ScBitMaskCompressedArray< SCROW, sal_uInt8> & >(
-            GetRowFlagsArray( nTab));
-}
-
 const ScBitMaskCompressedArray< SCROW, sal_uInt8> & 
ScDocument::GetRowFlagsArray(
         SCTAB nTab ) const
 {
@@ -3993,6 +3986,22 @@ SCROW ScDocument::CountNonFilteredRows(SCROW nStartRow, 
SCROW nEndRow, SCTAB nTa
     return maTabs[nTab]->CountNonFilteredRows(nStartRow, nEndRow);
 }
 
+bool ScDocument::IsManualRowHeight(SCROW nRow, SCTAB nTab) const
+{
+    if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || 
!maTabs[nTab])
+        return false;
+
+    return maTabs[nTab]->IsManualRowHeight(nRow);
+}
+
+void ScDocument::SetRowHeightManual(SCROW nRow, SCTAB nTab, bool bManual)
+{
+    if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || 
!maTabs[nTab])
+        return;
+
+    maTabs[nTab]->SetRowHeightManual(nRow, bManual);
+}
+
 void ScDocument::SyncColRowFlags()
 {
     TableContainer::iterator it = maTabs.begin();
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 77939a2..8356dc5 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -954,6 +954,19 @@ SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW 
nEndRow) const
     return nCount;
 }
 
+bool ScTable::IsManualRowHeight(SCROW nRow) const
+{
+    return (pRowFlags->GetValue(nRow) & CR_MANUALSIZE) != 0;
+}
+
+void ScTable::SetRowHeightManual(SCROW nRow, bool bManual)
+{
+    if (bManual)
+        pRowFlags->OrValue(nRow, CR_MANUALSIZE);
+    else
+        pRowFlags->AndValue(nRow, 
sal::static_int_cast<sal_uInt8>(~CR_MANUALSIZE));
+}
+
 namespace {
 
 void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, ScFlatBoolRowSegments& 
rRowSegments,
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 0d35c45..9d53c7d 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -632,9 +632,6 @@ void ScTransferObj::InitDocShell()
             else
                 pDestDoc->SetColWidth( nCol, 0, pDoc->GetColWidth( nCol, 
nSrcTab ) );
 
-        ScBitMaskCompressedArray< SCROW, sal_uInt8> & rDestRowFlags =
-            pDestDoc->GetRowFlagsArrayModifiable(0);
-
         for (SCROW nRow = nStartY; nRow <= nEndY; ++nRow)
         {
             sal_uInt8 nSourceFlags = pDoc->GetRowFlags(nRow, nSrcTab);
@@ -645,8 +642,8 @@ void ScTransferObj::InitDocShell()
                 pDestDoc->SetRowHeight( nRow, 0, pDoc->GetOriginalHeight( 
nRow, nSrcTab ) );
 
                 //  if height was set manually, that flag has to be copied, too
-                if ( nSourceFlags & CR_MANUALSIZE )
-                    rDestRowFlags.OrValue( nRow, CR_MANUALSIZE);
+                bool bManual = pDoc->IsManualRowHeight(nRow, nSrcTab);
+                pDestDoc->SetRowHeightManual(nRow, 0, bManual);
             }
         }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to