[PATCH libreoffice-4-0] r is an optional attribute in c and r, fdo#65059

Markus Mohrhard (via Code Review) gerrit at gerrit.libreoffice.org
Wed May 29 13:52:38 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4088

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/88/4088/1

r is an optional attribute in c and r, fdo#65059

Change-Id: Ic954cc5692ddc899f8a6fa99466bc0c8a83da352
---
M sc/source/filter/inc/sheetdatacontext.hxx
M sc/source/filter/oox/sheetdatacontext.cxx
2 files changed, 29 insertions(+), 5 deletions(-)



diff --git a/sc/source/filter/inc/sheetdatacontext.hxx b/sc/source/filter/inc/sheetdatacontext.hxx
index 52d20da..72da911 100644
--- a/sc/source/filter/inc/sheetdatacontext.hxx
+++ b/sc/source/filter/inc/sheetdatacontext.hxx
@@ -117,6 +117,9 @@
     BinAddress          maCurrPos;          /// Current cell position (BIFF12 only).
     bool                mbHasFormula;       /// True = current cell has formula data (OOXML only).
     bool                mbValidRange;       /// True = maFmlaData.maFormulaRef is valid (OOXML only).
+
+    sal_Int32 mnRow;
+    sal_Int32 mnCol;
 };
 
 // ============================================================================
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index bd5b146..11047f0 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -111,7 +111,9 @@
     WorksheetContextBase( rFragment ),
     SheetDataContextBase( rFragment ),
     mbHasFormula( false ),
-    mbValidRange( false )
+    mbValidRange( false ),
+    mnRow( -1 ),
+    mnCol( -1 )
 {
 }
 
@@ -294,7 +296,13 @@
 void SheetDataContext::importRow( const AttributeList& rAttribs )
 {
     RowModel aModel;
-    aModel.mnRow          = rAttribs.getInteger( XML_r, -1 );
+    sal_Int32 nRow = rAttribs.getInteger( XML_r, -1 );
+    if(nRow != -1)
+        aModel.mnRow          = nRow;
+    else
+        aModel.mnRow = ++mnRow;
+    mnCol = -1;
+
     aModel.mfHeight       = rAttribs.getDouble( XML_ht, -1.0 );
     aModel.mnXfId         = rAttribs.getInteger( XML_s, -1 );
     aModel.mnLevel        = rAttribs.getInteger( XML_outlineLevel, 0 );
@@ -328,8 +336,21 @@
 
 bool SheetDataContext::importCell( const AttributeList& rAttribs )
 {
-    bool bValidAddr = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, rAttribs.getString( XML_r, OUString() ), mnSheet, true );
-    if( bValidAddr )
+    OUString aCellAddrStr =  rAttribs.getString( XML_r, OUString() );
+    bool bValid = true;
+    if(aCellAddrStr.isEmpty())
+    {
+        ++mnCol;
+        maCellData.maCellAddr = CellAddress( mnSheet, mnCol, mnRow );
+    }
+    else
+    {
+        bValid = mrAddressConv.convertToCellAddress( maCellData.maCellAddr, aCellAddrStr, mnSheet, true );
+
+        mnCol = maCellData.maCellAddr.Column;
+    }
+
+    if( bValid )
     {
         maCellData.mnCellType     = rAttribs.getToken( XML_t, XML_n );
         maCellData.mnXfId         = rAttribs.getInteger( XML_s, -1 );
@@ -343,7 +364,7 @@
         // update used area of the sheet
         extendUsedArea( maCellData.maCellAddr );
     }
-    return bValidAddr;
+    return bValid;
 }
 
 void SheetDataContext::importFormula( const AttributeList& rAttribs )

-- 
To view, visit https://gerrit.libreoffice.org/4088
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic954cc5692ddc899f8a6fa99466bc0c8a83da352
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Markus Mohrhard <markus.mohrhard at googlemail.com>



More information about the LibreOffice mailing list