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 <markus.mohrhard@googlemail.com>
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
Context
- [Libreoffice] [PATCH] some refactoring in xmlcelli.cxx · Markus Mohrhard
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.