sc/inc/cellsuno.hxx | 2 - sc/source/filter/xml/XMLExportIterator.cxx | 22 +++----------- sc/source/filter/xml/xmlexprt.cxx | 43 +++++++++------------------ sc/source/ui/unoobj/cellsuno.cxx | 45 ++++------------------------- 4 files changed, 28 insertions(+), 84 deletions(-)
New commits: commit 7963e79361278c14ddf98ac4d9ab3b6cab338129 Author: Kohei Yoshida <[email protected]> Date: Tue Apr 15 11:13:05 2014 -0400 Remove this duplicate, and use the one in ScCellFormat. Change-Id: I2410c8805ef5be950d5ce1e24f845ed910615442 diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx index 27eb295..c85bf55 100644 --- a/sc/inc/cellsuno.hxx +++ b/sc/inc/cellsuno.hxx @@ -1010,8 +1010,6 @@ public: virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Int16 SAL_CALL resetActionLocks() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - - static OUString GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aPos); }; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index fbde9f9..1e2a1dc 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6149,49 +6149,18 @@ OUString ScCellObj::GetInputString_Impl(bool bEnglish) const // fuer getFor return OUString(); } -OUString ScCellObj::GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aCellPos) -{ - if (!pDoc) - return EMPTY_OUSTRING; - - ScRefCellValue aCell; - aCell.assign(*pDoc, aCellPos); - - if (aCell.isEmpty()) - return EMPTY_OUSTRING; - - OUString aVal; - - if (aCell.meType == CELLTYPE_EDIT) - { - // GetString an der EditCell macht Leerzeichen aus Umbruechen, - // hier werden die Umbrueche aber gebraucht - const EditTextObject* pData = aCell.mpEditText; - 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 ); - aVal = ScCellFormat::GetString(*pDoc, aCellPos, nNumFmt, &pColor, *pDoc->GetFormatTable()); - } - return aVal; -} - OUString ScCellObj::GetOutputString_Impl() const { ScDocShell* pDocSh = GetDocShell(); OUString aVal; if ( pDocSh ) - aVal = GetOutputString_Impl(pDocSh->GetDocument(), aCellPos); + { + ScDocument* pDoc = pDocSh->GetDocument(); + ScRefCellValue aCell; + aCell.assign(*pDoc, aCellPos); + + aVal = ScCellFormat::GetOutputString(*pDoc, aCellPos, aCell); + } return aVal; } commit fec4ab14c0f5e0223559e9fd98d7c8d90e58cd18 Author: Kohei Yoshida <[email protected]> Date: Tue Apr 15 11:00:15 2014 -0400 Avoid unnecessarily converting UNO cell address to ScAddress. Change-Id: I69849b0a16cb353257f9fc1890a27595cd1b7b7b diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx index ff0b419..729ca41 100644 --- a/sc/source/filter/xml/XMLExportIterator.cxx +++ b/sc/source/filter/xml/XMLExportIterator.cxx @@ -94,12 +94,10 @@ bool ScMyShapesContainer::GetFirstAddress( table::CellAddress& rCellAddress ) void ScMyShapesContainer::SetCellData( ScMyCell& rMyCell ) { rMyCell.aShapeList.clear(); - ScAddress aAddress; - ScUnoConversion::FillScAddress( aAddress, rMyCell.aCellAddress ); ScMyShapeList::iterator aItr(aShapeList.begin()); ScMyShapeList::iterator aEndItr(aShapeList.end()); - while( (aItr != aEndItr) && (aItr->aAddress == aAddress) ) + while( (aItr != aEndItr) && (aItr->aAddress == rMyCell.maCellAddress) ) { rMyCell.aShapeList.push_back(*aItr); aItr = aShapeList.erase(aItr); @@ -156,11 +154,8 @@ bool ScMyNoteShapesContainer::GetFirstAddress( table::CellAddress& rCellAddress void ScMyNoteShapesContainer::SetCellData( ScMyCell& rMyCell ) { - ScAddress aAddress; - ScUnoConversion::FillScAddress( aAddress, rMyCell.aCellAddress ); - ScMyNoteShapeList::iterator aItr = aNoteShapeList.begin(); - while( (aItr != aNoteShapeList.end()) && (aItr->aPos == aAddress) ) + while( (aItr != aNoteShapeList.end()) && (aItr->aPos == rMyCell.maCellAddress) ) { aItr = aNoteShapeList.erase(aItr); } @@ -659,8 +654,6 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, const table::Cel bool bIsMatrixBase = false; - ScAddress aScAddress; - ScUnoConversion::FillScAddress( aScAddress, rMyCell.aCellAddress ); switch (rMyCell.maBaseCell.meType) { case CELLTYPE_VALUE: @@ -678,7 +671,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, const table::Cel } if (rMyCell.maBaseCell.meType == CELLTYPE_FORMULA) - if( rExport.IsMatrix( aScAddress, rMyCell.aMatrixRange, bIsMatrixBase ) ) + if (rExport.IsMatrix(rMyCell.maCellAddress, rMyCell.aMatrixRange, bIsMatrixBase)) { rMyCell.bIsMatrixBase = bIsMatrixBase; rMyCell.bIsMatrixCovered = !bIsMatrixBase; @@ -688,10 +681,7 @@ void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, const table::Cel void ScMyNotEmptyCellsIterator::HasAnnotation(ScMyCell& aCell) { aCell.bHasAnnotation = false; - ScAddress aAddress; - ScUnoConversion::FillScAddress( aAddress, aCell.aCellAddress ); - - ScPostIt* pNote = rExport.GetDocument()->GetNote(aAddress); + ScPostIt* pNote = rExport.GetDocument()->GetNote(aCell.maCellAddress); if(pNote) { @@ -787,8 +777,8 @@ bool ScMyNotEmptyCellsIterator::GetNext(ScMyCell& aCell, ScFormatRangeStyles* pC bool bIsAutoStyle; // Ranges before the previous cell are not needed by ExportFormatRanges anymore and can be removed sal_Int32 nRemoveBeforeRow = aLastAddress.Row; - aCell.nStyleIndex = pCellStyles->GetStyleNameIndex(aCell.aCellAddress.Sheet, - aCell.aCellAddress.Column, aCell.aCellAddress.Row, + aCell.nStyleIndex = pCellStyles->GetStyleNameIndex(aCell.maCellAddress.Tab(), + aCell.maCellAddress.Col(), aCell.maCellAddress.Row(), bIsAutoStyle, aCell.nValidationIndex, aCell.nNumberFormat, nRemoveBeforeRow); aLastAddress = aCell.aCellAddress; aCell.bIsAutoStyle = bIsAutoStyle; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 2603d05..ea2f883 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2950,14 +2950,14 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe { if (bIsFirst) { - ExportFormatRanges(0, 0, aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); + ExportFormatRanges(0, 0, aCell.maCellAddress.Col()-1, aCell.maCellAddress.Row(), nTable); aPrevCell = aCell; bIsFirst = false; } else { - if ((aPrevCell.aCellAddress.Row == aCell.aCellAddress.Row) && - (aPrevCell.aCellAddress.Column + nEqualCells + 1 == aCell.aCellAddress.Column)) + if ((aPrevCell.maCellAddress.Row() == aCell.maCellAddress.Row()) && + (aPrevCell.maCellAddress.Col() + nEqualCells + 1 == aCell.maCellAddress.Col())) { if(IsCellEqual(aPrevCell, aCell)) ++nEqualCells; @@ -2971,8 +2971,8 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe else { WriteCell(aPrevCell, nEqualCells); - ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, - aCell.aCellAddress.Column - 1, aCell.aCellAddress.Row, nTable); + ExportFormatRanges(aPrevCell.maCellAddress.Col() + nEqualCells + 1, aPrevCell.maCellAddress.Row(), + aCell.maCellAddress.Col()-1, aCell.maCellAddress.Row(), nTable); nEqualCells = 0; aPrevCell = aCell; } @@ -2981,7 +2981,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe if (!bIsFirst) { WriteCell(aPrevCell, nEqualCells); - ExportFormatRanges(aPrevCell.aCellAddress.Column + nEqualCells + 1, aPrevCell.aCellAddress.Row, + ExportFormatRanges(aPrevCell.maCellAddress.Col() + nEqualCells + 1, aPrevCell.maCellAddress.Row(), pSharedData->GetLastColumn(nTable), pSharedData->GetLastRow(nTable), nTable); } else @@ -3133,8 +3133,6 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) // nEqualCellCount is the number of additional cells SetRepeatAttribute(nEqualCellCount, (aCell.nType != table::CellContentType_EMPTY)); - ScAddress aCellPos; - ScUnoConversion::FillScAddress( aCellPos, aCell.aCellAddress ); if (aCell.nStyleIndex != -1) AddAttribute(sAttrStyleName, *pCellStyles->GetStyleNameByIndex(aCell.nStyleIndex, aCell.bIsAutoStyle)); if (aCell.nValidationIndex > -1) @@ -3171,7 +3169,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) break; case table::CellContentType_TEXT : { - OUString sFormattedString(lcl_GetFormattedString(pDoc, aCellPos)); + OUString sFormattedString(lcl_GetFormattedString(pDoc, aCell.maCellAddress)); OUString sCellString = aCell.maBaseCell.getString(pDoc); GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( sCellString, sFormattedString, true, true); @@ -3224,11 +3222,11 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) if (pDoc) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( - aCell.nNumberFormat, pDoc->GetValue( aCellPos )); + aCell.nNumberFormat, pDoc->GetValue(aCell.maCellAddress)); if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( - aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT, false ); + aCell.nNumberFormat, pDoc->GetValue(aCell.maCellAddress), false, XML_NAMESPACE_CALC_EXT, false ); } } } @@ -3507,9 +3505,9 @@ void ScXMLExport::WriteShapes(const ScMyCell& rMyCell) if( rMyCell.bHasShape && !rMyCell.aShapeList.empty() && pDoc ) { awt::Point aPoint; - Rectangle aRect = pDoc->GetMMRect(static_cast<SCCOL>(rMyCell.aCellAddress.Column), static_cast<SCROW>(rMyCell.aCellAddress.Row), - static_cast<SCCOL>(rMyCell.aCellAddress.Column), static_cast<SCROW>(rMyCell.aCellAddress.Row), static_cast<SCTAB>(rMyCell.aCellAddress.Sheet)); - bool bNegativePage(pDoc->IsNegativePage(rMyCell.aCellAddress.Sheet)); + Rectangle aRect = pDoc->GetMMRect(rMyCell.maCellAddress.Col(), rMyCell.maCellAddress.Row(), + rMyCell.maCellAddress.Col(), rMyCell.maCellAddress.Row(), rMyCell.maCellAddress.Tab()); + bool bNegativePage = pDoc->IsNegativePage(rMyCell.maCellAddress.Tab()); if (bNegativePage) aPoint.X = aRect.Right(); else @@ -3600,9 +3598,6 @@ void ScXMLExport::WriteAreaLink( const ScMyCell& rMyCell ) void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape >& xShape) { - ScAddress aCellPos; - ScUnoConversion::FillScAddress( aCellPos, pCurrentCell->aCellAddress ); - ScPostIt* pNote = pCurrentCell->pNote; if (pNote) @@ -3610,7 +3605,7 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape > // TODO : notes //is it still usefull, as this call back is only called from ScXMLExport::WriteAnnotation // and should be in sync with pCurrentCell - SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(aCellPos); + SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(pCurrentCell->maCellAddress); Reference<drawing::XShape> xCurrentShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY ); if (xCurrentShape.get()!=xShape.get()) return; @@ -3659,11 +3654,7 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape > void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell) { - - ScAddress aCellPos; - ScUnoConversion::FillScAddress( aCellPos, rMyCell.aCellAddress ); - - ScPostIt* pNote = pDoc->GetNote(aCellPos); + ScPostIt* pNote = pDoc->GetNote(rMyCell.maCellAddress); if (pNote) { if (pNote->IsCaptionShown()) @@ -3671,7 +3662,7 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell) pCurrentCell = &rMyCell; - SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(aCellPos); + SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress); Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY ); GetShapeExport()->exportShape(xShape, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL); @@ -3756,10 +3747,6 @@ bool ScXMLExport::IsEditCell(ScMyCell& rCell) const bool ScXMLExport::IsCellEqual (ScMyCell& aCell1, ScMyCell& aCell2) { - ScAddress aCellPos1; - ScUnoConversion::FillScAddress( aCellPos1, aCell1.aCellAddress ); - ScAddress aCellPos2; - ScUnoConversion::FillScAddress( aCellPos2, aCell2.aCellAddress ); bool bIsEqual = false; if( !aCell1.bIsMergedBase && !aCell2.bIsMergedBase && aCell1.bIsCovered == aCell2.bIsCovered && _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
