Hello, In my attempt to understand the xml import a bit better I found some places I think we could easily refactor a bit.
It would be nice if someone could give it a quick review before I push it. Especially the long if statement is a bit tricky but I think that only the first line was needed. Regards, Markus
From b3a0436ea06f827409b13c4d61be6da0d5f4f9e7 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard <[email protected]> Date: Sat, 27 Aug 2011 14:33:44 +0200 Subject: [PATCH] some initial refactoring in xmlcelli.cxx --- sc/source/filter/xml/xmlcelli.cxx | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 74cc5b8..c7ab439 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -769,16 +769,17 @@ void ScXMLTableRowCellContext::EndElement() { if (bHasTextImport && rXMLImport.GetRemoveLastChar()) { - if (rXMLImport.GetTextImport()->GetCursor().is()) + UniReference< XMLTextImportHelper > aTextImport = rXMLImport.GetTextImport(); + if (aTextImport->GetCursor().is()) { - //GetImport().GetTextImport()->GetCursor()->gotoEnd(sal_False); - if( GetImport().GetTextImport()->GetCursor()->goLeft( 1, sal_True ) ) + //aTextImport->GetCursor()->gotoEnd(sal_False); + if( aTextImport->GetCursor()->goLeft( 1, sal_True ) ) { - GetImport().GetTextImport()->GetText()->insertString( - GetImport().GetTextImport()->GetCursorAsRange(), rtl::OUString(), + aTextImport->GetText()->insertString( + aTextImport->GetCursorAsRange(), rtl::OUString(), sal_True ); } - rXMLImport.GetTextImport()->ResetCursor(); + aTextImport->ResetCursor(); } } ScMyTables& rTables = rXMLImport.GetTables(); @@ -821,13 +822,10 @@ void ScXMLTableRowCellContext::EndElement() pOUText.reset(xTempText->getString()); } } - if ( (!pOUTextContent && !pOUText && !pOUTextValue) - && ( (pOUTextContent && !pOUTextContent->getLength()) || !pOUTextContent ) - && ( (pOUText && !pOUText->getLength()) || !pOUText ) - && ( (pOUTextValue && !pOUTextValue->getLength()) || !pOUTextValue )) + if (!pOUTextContent && !pOUText && !pOUTextValue) bIsEmpty = sal_True; } - sal_Bool bWasEmpty = bIsEmpty; + bool bWasEmpty = bIsEmpty; // uno::Reference <table::XCell> xCell; table::CellAddress aCurrentPos( aCellPos ); if ((pContentValidationName && pContentValidationName->getLength()) || -- 1.7.3.4
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
