sc/source/filter/xml/XMLStylesImportHelper.cxx |    5 
 sc/source/filter/xml/XMLStylesImportHelper.hxx |    4 
 sc/source/filter/xml/xmlcelli.cxx              |  301 ++++++++++---------------
 sc/source/filter/xml/xmlcelli.hxx              |    8 
 4 files changed, 131 insertions(+), 187 deletions(-)

New commits:
commit b91e54a89586717fef49531d9626fbd2c75cf24e
Author: Daniel Bankston <daniel.e.banks...@gmail.com>
Date:   Tue Jun 5 02:17:07 2012 -0500

    Replace CellAddress with ScAddress in ScXMLTableRowCellContext::EndElement()
    
    Replaced CellAddress with ScAddress in EndElement() and adjusted related
    methods.
    
    Also removed commented-out code.
    
    Also did intermediate conversion for XText::getString() as related code was 
unnecessary since there is now direct access to ScAddress cell position.
    
    Change-Id: Ia237d0deb2d03a9d0470208d289947d474bc6d38

diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx 
b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index 471e531..9947db7 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -500,10 +500,9 @@ void ScMyStylesImportHelper::AddRange(const ScRange& 
rRange)
     }
 }
 
-void ScMyStylesImportHelper::AddCell(const com::sun::star::table::CellAddress& 
rAddress)
+void ScMyStylesImportHelper::AddCell(const ScAddress& rAddress)
 {
-    ScAddress aScAddress( static_cast<SCCOL>(rAddress.Column), 
static_cast<SCROW>(rAddress.Row), rAddress.Sheet );
-    ScRange aScRange( aScAddress, aScAddress );
+    ScRange aScRange( rAddress, rAddress );
     AddRange(aScRange);
 }
 
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx 
b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 3f8b90b..c5bf5d3 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -32,8 +32,6 @@
 #include "rangelst.hxx"
 #include "simplerangelist.hxx"
 #include <rtl/ustring.hxx>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
 
 #include <set>
 #include <vector>
@@ -179,7 +177,7 @@ public:
     void SetAttributes(rtl::OUString* pStyleName,
         rtl::OUString* pCurrency, const sal_Int16 nCellType);
     void AddRange(const ScRange& rRange);
-    void AddCell(const com::sun::star::table::CellAddress& rAddress);
+    void AddCell(const ScAddress& rAddress);
     void InsertRow(const sal_Int32 nRow, const sal_Int32 nTab, ScDocument* 
pDoc); // a row is inserted before nRow
     void InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDocument* 
pDoc); // a col is inserted before nCol
     void EndTable();
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 9e36e95..e6cf759 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -42,6 +42,7 @@
 #include "postit.hxx"
 #include "sheetdata.hxx"
 #include "docsh.hxx"
+#include "cellform.hxx"
 
 #include "XMLTableShapeImportHelper.hxx"
 #include "XMLTextPContext.hxx"
@@ -282,6 +283,15 @@ void ScXMLTableRowCellContext::UnlockSolarMutex()
     }
 }
 
+namespace {
+
+bool scCellExists( const ScAddress& rCellPos )
+{
+    return( rCellPos.Col() <= MAXCOL && rCellPos.Row() <= MAXROW );
+}
+
+}
+
 void ScXMLTableRowCellContext::SetCursorOnTextImport(const rtl::OUString& 
rOUTempText)
 {
     //extra step here until this area is fully converted
@@ -530,8 +540,10 @@ void 
ScXMLTableRowCellContext::SetContentValidation(com::sun::star::uno::Referen
 }
 
 void ScXMLTableRowCellContext::SetCellProperties(const 
uno::Reference<table::XCellRange>& xCellRange,
-                                                const table::CellAddress& 
aCellAddress)
+                                                const ScAddress& 
aScCellAddress)
 {
+    com::sun::star::table::CellAddress aCellAddress;
+    ScUnoConversion::FillApiAddress( aCellAddress, aScCellAddress );
     if (CellExists(aCellAddress) && pContentValidationName && 
!pContentValidationName->isEmpty())
     {
         sal_Int32 nBottom = aCellAddress.Row + nRepeatedRows - 1;
@@ -557,7 +569,7 @@ void ScXMLTableRowCellContext::SetCellProperties(const 
uno::Reference<table::XCe
     }
 }
 
-void ScXMLTableRowCellContext::SetAnnotation(const table::CellAddress& 
aCellAddress)
+void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos)
 {
     ScDocument* pDoc = rXMLImport.GetDocument();
     if( !pDoc || !mxAnnotationData.get() )
@@ -565,8 +577,6 @@ void ScXMLTableRowCellContext::SetAnnotation(const 
table::CellAddress& aCellAddr
 
     LockSolarMutex();
 
-    ScAddress aPos;
-    ScUnoConversion::FillScAddress( aPos, aCellAddress );
     ScPostIt* pNote = 0;
 
     uno::Reference< drawing::XShapes > xShapes = 
rXMLImport.GetTables().GetCurrentXShapes();
@@ -589,7 +599,7 @@ void ScXMLTableRowCellContext::SetAnnotation(const 
table::CellAddress& aCellAddr
             {
                 OSL_ENSURE( !pCaption->GetLogicRect().IsEmpty(), 
"ScXMLTableRowCellContext::SetAnnotation - invalid caption rectangle" );
                 // create the cell note with the caption object
-                pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, aPos, 
*pCaption, true );
+                pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, rPos, 
*pCaption, true );
                 // forget pointer to object (do not create note again below)
                 pObject = 0;
             }
@@ -617,7 +627,7 @@ void ScXMLTableRowCellContext::SetAnnotation(const 
table::CellAddress& aCellAddr
             if( xOutlinerObj.get() )
             {
                 // create cell note with all data from drawing object
-                pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, aPos,
+                pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, rPos,
                     xItemSet.release(), xOutlinerObj.release(),
                     aCaptionRect, mxAnnotationData->mbShown, false );
             }
@@ -626,7 +636,7 @@ void ScXMLTableRowCellContext::SetAnnotation(const 
table::CellAddress& aCellAddr
     else if( !mxAnnotationData->maSimpleText.isEmpty() )
     {
         // create note from simple text
-        pNote = ScNoteUtil::CreateNoteFromString( *pDoc, aPos,
+        pNote = ScNoteUtil::CreateNoteFromString( *pDoc, rPos,
             mxAnnotationData->maSimpleText, mxAnnotationData->mbShown, false );
     }
 
@@ -654,32 +664,30 @@ void ScXMLTableRowCellContext::SetAnnotation(const 
table::CellAddress& aCellAddr
 
     // store the style names for stream copying
     ScSheetSaveData* pSheetData = 
ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData();
-    pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, 
mxAnnotationData->maTextStyle, aPos );
+    pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, 
mxAnnotationData->maTextStyle, rPos );
 
     std::vector<ScXMLAnnotationStyleEntry>::const_iterator aIter = 
mxAnnotationData->maContentStyles.begin();
     std::vector<ScXMLAnnotationStyleEntry>::const_iterator aEnd = 
mxAnnotationData->maContentStyles.end();
     while (aIter != aEnd)
     {
-        pSheetData->AddNoteContentStyle( aIter->mnFamily, aIter->maName, aPos, 
aIter->maSelection );
+        pSheetData->AddNoteContentStyle( aIter->mnFamily, aIter->maName, rPos, 
aIter->maSelection );
         ++aIter;
     }
 }
 
 // core implementation
-void ScXMLTableRowCellContext::SetDetectiveObj( const table::CellAddress& 
rPosition )
+void ScXMLTableRowCellContext::SetDetectiveObj( const ScAddress& rPosition )
 {
-    if( CellExists(rPosition) && pDetectiveObjVec && pDetectiveObjVec->size() )
+    if( scCellExists(rPosition) && pDetectiveObjVec && 
pDetectiveObjVec->size() )
     {
         LockSolarMutex();
-        ScDetectiveFunc aDetFunc( rXMLImport.GetDocument(), rPosition.Sheet );
+        ScDetectiveFunc aDetFunc( rXMLImport.GetDocument(), rPosition.Tab() );
         uno::Reference<container::XIndexAccess> xShapesIndex 
(rXMLImport.GetTables().GetCurrentXShapes(), uno::UNO_QUERY); // make draw page
         ScMyImpDetectiveObjVec::iterator aItr(pDetectiveObjVec->begin());
         ScMyImpDetectiveObjVec::iterator aEndItr(pDetectiveObjVec->end());
         while(aItr != aEndItr)
         {
-            ScAddress aScAddress;
-            ScUnoConversion::FillScAddress( aScAddress, rPosition );
-            aDetFunc.InsertObject( aItr->eObjType, aScAddress, 
aItr->aSourceRange, aItr->bHasError );
+            aDetFunc.InsertObject( aItr->eObjType, rPosition, 
aItr->aSourceRange, aItr->bHasError );
             if (xShapesIndex.is())
             {
                 sal_Int32 nShapes = xShapesIndex->getCount();
@@ -692,18 +700,18 @@ void ScXMLTableRowCellContext::SetDetectiveObj( const 
table::CellAddress& rPosit
 }
 
 // core implementation
-void ScXMLTableRowCellContext::SetCellRangeSource( const table::CellAddress& 
rPosition )
+void ScXMLTableRowCellContext::SetCellRangeSource( const ScAddress& rPosition )
 {
-    if( CellExists(rPosition) && pCellRangeSource  && 
!pCellRangeSource->sSourceStr.isEmpty() &&
+    if( scCellExists(rPosition) && pCellRangeSource  && 
!pCellRangeSource->sSourceStr.isEmpty() &&
         !pCellRangeSource->sFilterName.isEmpty() && 
!pCellRangeSource->sURL.isEmpty() )
     {
         ScDocument* pDoc = rXMLImport.GetDocument();
         if (pDoc)
         {
             LockSolarMutex();
-            ScRange aDestRange( static_cast<SCCOL>(rPosition.Column), 
static_cast<SCROW>(rPosition.Row), rPosition.Sheet,
-                static_cast<SCCOL>(rPosition.Column + 
pCellRangeSource->nColumns - 1),
-                static_cast<SCROW>(rPosition.Row + pCellRangeSource->nRows - 
1), rPosition.Sheet );
+            ScRange aDestRange( rPosition.Col(), rPosition.Row(), 
rPosition.Tab(),
+                rPosition.Col() + 
static_cast<SCCOL>(pCellRangeSource->nColumns - 1),
+                rPosition.Row() + static_cast<SCROW>(pCellRangeSource->nRows - 
1), rPosition.Tab() );
             String sFilterName( pCellRangeSource->sFilterName );
             String sSourceStr( pCellRangeSource->sSourceStr );
             ScAreaLink* pLink = new ScAreaLink( pDoc->GetDocumentShell(), 
pCellRangeSource->sURL,
@@ -714,14 +722,51 @@ void ScXMLTableRowCellContext::SetCellRangeSource( const 
table::CellAddress& rPo
     }
 }
 
-bool lcl_IsEmptyOrNote( ScDocument* pDoc, const table::CellAddress& 
rCurrentPos )
+bool lcl_IsEmptyOrNote( ScDocument* pDoc, const ScAddress& rScCurrentPos )
 {
-    ScAddress aScAddress;
-    ScUnoConversion::FillScAddress( aScAddress, rCurrentPos );
-    ScBaseCell* pCell = pDoc->GetCell( aScAddress );
+    ScBaseCell* pCell = pDoc->GetCell( rScCurrentPos );
     return ( !pCell || pCell->GetCellType() == CELLTYPE_NOTE );
 }
 
+namespace {
+
+// from ScCellObj::GetOutputString_Imp().  all of it may not be necessary.
+rtl::OUString getOutputString(ScDocument* pDoc, const ScAddress& aCellPos)
+{
+    rtl::OUString aVal;
+    if ( pDoc )
+    {
+        ScBaseCell* pCell = pDoc->GetCell( aCellPos );
+        if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
+        {
+            if ( pCell->GetCellType() == CELLTYPE_EDIT )
+            {
+                //  GetString an der EditCell macht Leerzeichen aus Umbruechen,
+                //  hier werden die Umbrueche aber gebraucht
+                const EditTextObject* pData = ((ScEditCell*)pCell)->GetData();
+                if (pData)
+                {
+                    EditEngine& rEngine = pDoc->GetEditEngine();
+                    rEngine.SetText( *pData );
+                    aVal = rEngine.GetText( LINEEND_LF );
+                }
+                //  Edit-Zellen auch nicht per NumberFormatter formatieren
+                //  (passend zur Ausgabe)
+            }
+            else
+            {
+                //  wie in GetString am Dokument (column)
+                Color* pColor;
+                sal_uLong nNumFmt = pDoc->GetNumberFormat( aCellPos );
+                ScCellFormat::GetString( pCell, nNumFmt, aVal, &pColor, 
*pDoc->GetFormatTable() );
+            }
+        }
+    }
+    return aVal;
+}
+
+}
+
 void ScXMLTableRowCellContext::EndElement()
 {
     if (!bHasSubTable)
@@ -743,15 +788,7 @@ void ScXMLTableRowCellContext::EndElement()
         }
         ScMyTables& rTables = rXMLImport.GetTables();
 
-        //extra step here until this area is fully converted
-        com::sun::star::table::CellAddress aCellPos;
-        ScAddress aScCellPos = rXMLImport.GetTables().GetRealScCellPos();
-        ScUnoConversion::FillApiAddress( aCellPos, aScCellPos );
-
-        if (aCellPos.Column > 0 && nRepeatedRows > 1)
-            aCellPos.Row -= (nRepeatedRows - 1);
-
-        //duplicated for now
+        ScAddress aScCellPos = rTables.GetRealScCellPos();
         if (aScCellPos.Col() > 0 && nRepeatedRows > 1)
             aScCellPos.SetRow( aScCellPos.Row() - (nRepeatedRows - 1) );
 
@@ -772,99 +809,47 @@ void ScXMLTableRowCellContext::EndElement()
                     // #i61702# The formatted text content of xBaseCell / 
xLockable is invalidated,
                     // so it can't be used after calling removeActionLock 
(getString always uses the document).
 
-                    if (CellExists(aCellPos) && ((nCellsRepeated > 1) || 
(nRepeatedRows > 1)))
-                    {
-                        if (!xBaseCell.is())
-                        {
-                            try
-                            {
-                                
xBaseCell.set(xCellRange->getCellByPosition(aCellPos.Column, aCellPos.Row));
-                            }
-                            catch (lang::IndexOutOfBoundsException&)
-                            {
-                                OSL_FAIL("It seems here are to many columns or 
rows");
-                            }
-                        }
-                        uno::Reference <text::XText> xTempText (xBaseCell, 
uno::UNO_QUERY);
-                        if (xTempText.is())
-                        {
-                            pOUText.reset(xTempText->getString());
-                        }
-                    }
+                    if (scCellExists(aScCellPos) && ((nCellsRepeated > 1) || 
(nRepeatedRows > 1)))
+                        pOUText.reset( 
getOutputString(rXMLImport.GetDocument(), aScCellPos) );
+
                     if (!pOUTextContent && !pOUText && !pOUTextValue)
                             bIsEmpty = true;
                 }
                 bool bWasEmpty = bIsEmpty;
-//              uno::Reference <table::XCell> xCell;
-                table::CellAddress aCurrentPos( aCellPos );
+
+                ScAddress aScCurrentPos( aScCellPos );
                 if ((pContentValidationName && 
!pContentValidationName->isEmpty()) ||
                     mxAnnotationData.get() || pDetectiveObjVec || 
pCellRangeSource)
                     bIsEmpty = false;
 
                 for (sal_Int32 i = 0; i < nCellsRepeated; ++i)
                 {
-                    aCurrentPos.Column = aCellPos.Column + i;
+                    aScCurrentPos.SetCol( aScCurrentPos.Col() + i );
                     if (i > 0)
                         rTables.AddColumn(false);
                     if (!bIsEmpty)
                     {
                         for (sal_Int32 j = 0; j < nRepeatedRows; ++j)
                         {
-                            aCurrentPos.Row = aCellPos.Row + j;
-                            if ((aCurrentPos.Column == 0) && (j > 0))
+                            aScCurrentPos.SetRow( aScCurrentPos.Row() + j );
+                            if( (aScCurrentPos.Col() == 0) && (j > 0) )
                             {
                                 rTables.AddRow();
                                 rTables.AddColumn(false);
                             }
-                            if (CellExists(aCurrentPos))
+                            if( scCellExists(aScCurrentPos) )
                             {
-                                // test - bypass the API
-                                // if (xBaseCell.is() && (aCurrentPos == 
aCellPos))
-                                //     xCell.set(xBaseCell);
-                                // else
-                                // {
-                                //     try
-                                //     {
-                                //      
xCell.set(xCellRange->getCellByPosition(aCurrentPos.Column, aCurrentPos.Row));
-                                //     }
-                                //     catch (lang::IndexOutOfBoundsException&)
-                                //     {
-                                //         OSL_FAIL("It seems here are to many 
columns or rows");
-                                //     }
-                                // }
-
-                                // test - bypass the API
-                                // if ((!(bIsCovered) || (xCell->getType() == 
table::CellContentType_EMPTY)))
-                                if ((!(bIsCovered) || lcl_IsEmptyOrNote( 
rXMLImport.GetDocument(), aCurrentPos )))
+                                if(  ( !(bIsCovered) || 
lcl_IsEmptyOrNote(rXMLImport.GetDocument(), aScCurrentPos) )  )
                                 {
                                     switch (nCellType)
                                     {
-                                    case util::NumberFormat::TEXT:
+                                        case util::NumberFormat::TEXT:
                                         {
                                             bool bDoIncrement = true;
-                                            if 
(rTables.IsPartOfMatrix(static_cast<SCCOL>(aCurrentPos.Column), 
static_cast<SCROW>(aCurrentPos.Row)))
+                                            if( 
rTables.IsPartOfMatrix(aScCurrentPos.Col(), aScCurrentPos.Row()) )
                                             {
                                                 LockSolarMutex();
-                                                // test - bypass the API
-                                                // ScCellObj* pCellObj = 
(ScCellObj*)ScCellRangesBase::getImplementation(xCell);
-                                                // if (pCellObj)
-                                                // {
-                                                //     if(pOUTextValue && 
pOUTextValue->getLength())
-                                                //         
pCellObj->SetFormulaResultString(*pOUTextValue);
-                                                //     else if (pOUTextContent 
&& pOUTextContent->getLength())
-                                                //         
pCellObj->SetFormulaResultString(*pOUTextContent);
-                                                //     else if ( i > 0 && 
pOUText && pOUText->getLength() )
-                                                //     {
-                                                //         
pCellObj->SetFormulaResultString(*pOUText);
-                                                //     }
-                                                //     else
-                                                //         bDoIncrement = 
false;
-                                                // }
-                                                // else
-                                                //     bDoIncrement = false;
-                                                ScAddress aScAddress;
-                                                
ScUnoConversion::FillScAddress( aScAddress, aCurrentPos );
-                                                ScBaseCell* pCell = 
rXMLImport.GetDocument()->GetCell( aScAddress );
+                                                ScBaseCell* pCell = 
rXMLImport.GetDocument()->GetCell( aScCurrentPos );
                                                 bDoIncrement = ( pCell && 
pCell->GetCellType() == CELLTYPE_FORMULA );
                                                 if ( bDoIncrement )
                                                 {
@@ -881,21 +866,6 @@ void ScXMLTableRowCellContext::EndElement()
                                             }
                                             else
                                             {
-                                                // test - bypass the API
-                                                // uno::Reference 
<text::XText> xText (xCell, uno::UNO_QUERY);
-                                                // if (xText.is())
-                                                // {
-                                                //     if(pOUTextValue && 
pOUTextValue->getLength())
-                                                //         
xText->setString(*pOUTextValue);
-                                                //     else if (pOUTextContent 
&& pOUTextContent->getLength())
-                                                //         
xText->setString(*pOUTextContent);
-                                                //     else if ( i > 0 && 
pOUText && pOUText->getLength() )
-                                                //     {
-                                                //         
xText->setString(*pOUText);
-                                                //     }
-                                                //     else
-                                                //         bDoIncrement = 
false;
-                                                // }
                                                 LockSolarMutex();
                                                 ScBaseCell* pNewCell = NULL;
                                                 ScDocument* pDoc = 
rXMLImport.GetDocument();
@@ -908,11 +878,7 @@ void ScXMLTableRowCellContext::EndElement()
 
                                                 bDoIncrement = pNewCell != 
NULL;
                                                 if ( bDoIncrement )
-                                                {
-                                                    ScAddress aScAddress;
-                                                    
ScUnoConversion::FillScAddress( aScAddress, aCurrentPos );
-                                                    pDoc->PutCell( aScAddress, 
pNewCell );
-                                                }
+                                                    pDoc->PutCell( 
aScCurrentPos, pNewCell );
                                             }
                                             // #i56027# This is about setting 
simple text, not edit cells,
                                             // so ProgressBarIncrement must be 
called with bEditCell = FALSE.
@@ -922,30 +888,22 @@ void ScXMLTableRowCellContext::EndElement()
                                                 
rXMLImport.ProgressBarIncrement(false);
                                         }
                                         break;
-                                    case util::NumberFormat::NUMBER:
-                                    case util::NumberFormat::PERCENT:
-                                    case util::NumberFormat::CURRENCY:
-                                    case util::NumberFormat::TIME:
-                                    case util::NumberFormat::DATETIME:
-                                    case util::NumberFormat::LOGICAL:
+                                        case util::NumberFormat::NUMBER:
+                                        case util::NumberFormat::PERCENT:
+                                        case util::NumberFormat::CURRENCY:
+                                        case util::NumberFormat::TIME:
+                                        case util::NumberFormat::DATETIME:
+                                        case util::NumberFormat::LOGICAL:
                                         {
-                                            if( 
rTables.IsPartOfMatrix(static_cast<SCCOL>(aCurrentPos.Column), 
static_cast<SCROW>(aCurrentPos.Row)) )
+                                            if( 
rTables.IsPartOfMatrix(aScCurrentPos.Col(), aScCurrentPos.Row()) )
                                             {
                                                 LockSolarMutex();
-                                                // test - bypass the API
-                                                // ScCellObj* pCellObj = 
(ScCellObj*)ScCellRangesBase::getImplementation(xCell);
-                                                // if (pCellObj)
-                                                //     
pCellObj->SetFormulaResultDouble(fValue);
-                                                ScAddress aScAddress;
-                                                
ScUnoConversion::FillScAddress( aScAddress, aCurrentPos );
-                                                ScBaseCell* pCell = 
rXMLImport.GetDocument()->GetCell( aScAddress );
+                                                ScBaseCell* pCell = 
rXMLImport.GetDocument()->GetCell( aScCurrentPos );
                                                 if ( pCell && 
pCell->GetCellType() == CELLTYPE_FORMULA )
                                                     
static_cast<ScFormulaCell*>(pCell)->SetHybridDouble( fValue );
                                             }
                                             else
                                             {
-                                                // test - bypass the API
-                                                // xCell->setValue(fValue);
                                                 LockSolarMutex();
 
                                                 // #i62435# Initialize the 
value cell's script type
@@ -957,15 +915,13 @@ void ScXMLTableRowCellContext::EndElement()
                                                 if ( 
rXMLImport.IsLatinDefaultStyle() )
                                                     pNewCell->SetScriptType( 
SCRIPTTYPE_LATIN );
                                                 
rXMLImport.GetDocument()->PutCell(
-                                                    
sal::static_int_cast<SCCOL>( aCurrentPos.Column ),
-                                                    
sal::static_int_cast<SCROW>( aCurrentPos.Row ),
-                                                    
sal::static_int_cast<SCTAB>( aCurrentPos.Sheet ),
-                                                    pNewCell );
+                                                    aScCurrentPos.Col(), 
aScCurrentPos.Row(),
+                                                    aScCurrentPos.Tab(), 
pNewCell );
                                             }
                                             
rXMLImport.ProgressBarIncrement(false);
                                         }
                                         break;
-                                    default:
+                                        default:
                                         {
                                             OSL_FAIL("no cell type given");
                                         }
@@ -973,15 +929,15 @@ void ScXMLTableRowCellContext::EndElement()
                                     }
                                 }
 
-                                SetAnnotation(aCurrentPos);
-                                SetDetectiveObj( aCurrentPos );
-                                SetCellRangeSource( aCurrentPos );
+                                SetAnnotation( aScCurrentPos );
+                                SetDetectiveObj( aScCurrentPos );
+                                SetCellRangeSource( aScCurrentPos );
                             }
                             else
                             {
                                 if (!bWasEmpty || mxAnnotationData.get())
                                 {
-                                    if (aCurrentPos.Row > MAXROW)
+                                    if (aScCurrentPos.Row() > MAXROW)
                                         
rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW);
                                     else
                                         
rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_COLUMN_OVERFLOW);
@@ -996,7 +952,7 @@ void ScXMLTableRowCellContext::EndElement()
                         // with bEditCell = TRUE.
                         if (bHasTextImport)
                             rXMLImport.ProgressBarIncrement(true);
-                        if ((i == 0) && (aCellPos.Column == 0))
+                        if ((i == 0) && (aScCellPos.Col() == 0))
                             for (sal_Int32 j = 1; j < nRepeatedRows; ++j)
                             {
                                 rTables.AddRow();
@@ -1006,35 +962,29 @@ void ScXMLTableRowCellContext::EndElement()
                 }
                 if (nCellsRepeated > 1 || nRepeatedRows > 1)
                 {
-                    SetCellProperties(xCellRange, aCellPos); // set now only 
the validation for the complete range with the given cell as start cell
-                    //SetType(xCellRange, aCellPos);
-                    SCCOL nStartCol(aCellPos.Column < MAXCOL ? 
static_cast<SCCOL>(aCellPos.Column) : MAXCOL);
-                    SCROW nStartRow(aCellPos.Row < MAXROW ? 
static_cast<SCROW>(aCellPos.Row) : MAXROW);
-                    SCCOL nEndCol(aCellPos.Column + nCellsRepeated - 1 < 
MAXCOL ? static_cast<SCCOL>(aCellPos.Column + nCellsRepeated - 1) : MAXCOL);
-                    SCROW nEndRow(aCellPos.Row + nRepeatedRows - 1 < MAXROW ? 
static_cast<SCROW>(aCellPos.Row + nRepeatedRows - 1) : MAXROW);
-                    ScRange aScRange( nStartCol, nStartRow, aCellPos.Sheet,
-                        nEndCol, nEndRow, aCellPos.Sheet );
+                    SetCellProperties(xCellRange, aScCellPos); // set now only 
the validation for the complete range with the given cell as start cell
+                    SCCOL nStartCol( aScCellPos.Col() < MAXCOL ? 
aScCellPos.Col() : MAXCOL );
+                    SCROW nStartRow( aScCellPos.Row() < MAXROW ? 
aScCellPos.Row() : MAXROW );
+                    SCCOL nEndCol( aScCellPos.Col() + nCellsRepeated - 1 < 
MAXCOL ? aScCellPos.Col() + nCellsRepeated - 1 : MAXCOL );
+                    SCROW nEndRow( aScCellPos.Row() + nRepeatedRows - 1 < 
MAXROW ? aScCellPos.Row() + nRepeatedRows - 1 : MAXROW );
+                    ScRange aScRange( nStartCol, nStartRow, aScCellPos.Tab(),
+                        nEndCol, nEndRow, aScCellPos.Tab() );
                     rXMLImport.GetStylesImportHelper()->AddRange(aScRange);
                 }
-                else if (CellExists(aCellPos))
+                else if( scCellExists(aScCellPos) )
                 {
-                    rXMLImport.GetStylesImportHelper()->AddCell(aCellPos);
-
-                    // test - bypass the API
-                    // SetCellProperties(xCell); // set now only the validation
-                    SetCellProperties(xCellRange, aCellPos);
-
-                    //SetType(xTempCell);
+                    rXMLImport.GetStylesImportHelper()->AddCell(aScCellPos);
+                    SetCellProperties(xCellRange, aScCellPos);
                 }
             }
             else // if ( !pOUFormula )
             {
-                if (CellExists(aCellPos))
+                if (scCellExists(aScCellPos))
                 {
                     uno::Reference <table::XCell> xCell;
                     try
                     {
-                        
xCell.set(xCellRange->getCellByPosition(aCellPos.Column , aCellPos.Row));
+                        
xCell.set(xCellRange->getCellByPosition(aScCellPos.Col() , aScCellPos.Row()));
                     }
                     catch (lang::IndexOutOfBoundsException&)
                     {
@@ -1044,14 +994,11 @@ void ScXMLTableRowCellContext::EndElement()
                     {
                         SetCellProperties(xCell); // set now only the 
validation
                         OSL_ENSURE(((nCellsRepeated == 1) && (nRepeatedRows == 
1)), "repeated cells with formula not possible now");
-                        rXMLImport.GetStylesImportHelper()->AddCell(aCellPos);
+                        
rXMLImport.GetStylesImportHelper()->AddCell(aScCellPos);
                         if (!bIsMatrix)
                         {
                             LockSolarMutex();
 
-                            ScAddress aScAddress;
-                            ScUnoConversion::FillScAddress( aScAddress, 
aCellPos );
-
                             ScDocument* pDoc = rXMLImport.GetDocument();
 
                             rtl::OUString aText = pOUFormula->first;
@@ -1073,7 +1020,7 @@ void ScXMLTableRowCellContext::EndElement()
                                         pCode->AddStringXML( aFormulaNmsp );
 
                                     pDoc->IncXMLImportedFormulaCount( 
aText.getLength() );
-                                    pNewCell = new ScFormulaCell( pDoc, 
aScAddress, pCode, eGrammar, MM_NONE );
+                                    pNewCell = new ScFormulaCell( pDoc, 
aScCellPos, pCode, eGrammar, MM_NONE );
                                     delete pCode;
                                 }
                                 else if ( aText[0] == '\'' && 
aText.getLength() > 1 )
@@ -1098,9 +1045,9 @@ void ScXMLTableRowCellContext::EndElement()
                                 }
 
                                 if (pNewCell)
-                                    pDoc->PutCell( aScAddress, pNewCell );
+                                    pDoc->PutCell( aScCellPos, pNewCell );
 
-                                ScBaseCell* pCell = 
rXMLImport.GetDocument()->GetCell( aScAddress );
+                                ScBaseCell* pCell = 
rXMLImport.GetDocument()->GetCell( aScCellPos );
                                 if ( pCell && pCell->GetCellType() == 
CELLTYPE_FORMULA )
                                 {
                                     if (bFormulaTextResult && pOUTextValue && 
!pOUTextValue->isEmpty())
@@ -1115,22 +1062,22 @@ void ScXMLTableRowCellContext::EndElement()
                             if (nMatrixCols > 0 && nMatrixRows > 0)
                             {
                                 rTables.AddMatrixRange(
-                                        static_cast<SCCOL>(aCellPos.Column),
-                                        static_cast<SCROW>(aCellPos.Row),
-                                        static_cast<SCCOL>(aCellPos.Column + 
nMatrixCols - 1),
-                                        static_cast<SCROW>(aCellPos.Row + 
nMatrixRows - 1),
+                                        aScCellPos.Col(),
+                                        aScCellPos.Row(),
+                                        aScCellPos.Col() + nMatrixCols - 1,
+                                        aScCellPos.Row() + nMatrixRows - 1,
                                         pOUFormula->first, pOUFormula->second, 
eGrammar);
                             }
                         }
-                        SetAnnotation( aCellPos );
-                        SetDetectiveObj( aCellPos );
-                        SetCellRangeSource( aCellPos );
+                        SetAnnotation( aScCellPos );
+                        SetDetectiveObj( aScCellPos );
+                        SetCellRangeSource( aScCellPos );
                         rXMLImport.ProgressBarIncrement(false);
                     }
                 }
                 else
                 {
-                    if (aCellPos.Row > MAXROW)
+                    if (aScCellPos.Row() > MAXROW)
                         
rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW);
                     else
                         
rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_COLUMN_OVERFLOW);
diff --git a/sc/source/filter/xml/xmlcelli.hxx 
b/sc/source/filter/xml/xmlcelli.hxx
index 70137f0..858270a 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -86,7 +86,7 @@ class ScXMLTableRowCellContext : public SvXMLImportContext
 
     void 
SetContentValidation(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>&
 xPropSet);
     void SetCellProperties(const 
com::sun::star::uno::Reference<com::sun::star::table::XCellRange>& xCellRange,
-                                                const 
com::sun::star::table::CellAddress& aCellAddress);
+                                                const ScAddress& aCellAddress);
     void SetCellProperties(const 
com::sun::star::uno::Reference<com::sun::star::table::XCell>& xCell);
 
     void LockSolarMutex();
@@ -115,9 +115,9 @@ public:
     inline void SetString(const rtl::OUString& rOUTempText) { 
pOUTextContent.reset(rOUTempText); }
     void SetCursorOnTextImport(const rtl::OUString& rOUTempText);
 
-    void SetAnnotation(const ::com::sun::star::table::CellAddress& rPosition );
-    void SetDetectiveObj( const ::com::sun::star::table::CellAddress& 
rPosition );
-    void SetCellRangeSource( const ::com::sun::star::table::CellAddress& 
rPosition );
+    void SetAnnotation( const ScAddress& rPosition );
+    void SetDetectiveObj( const ScAddress& rPosition );
+    void SetCellRangeSource( const ScAddress& rPosition );
 
     virtual void EndElement();
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to