[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Mon Feb 17 16:15:02 CET 2014
sc/inc/tokenstringcontext.hxx | 1 +
sc/source/core/tool/compiler.cxx | 1 +
sc/source/core/tool/tokenstringcontext.cxx | 6 ++++++
sc/source/filter/xml/xmlexprt.cxx | 20 +++++++++++++-------
sc/source/filter/xml/xmlexprt.hxx | 7 +++++++
5 files changed, 28 insertions(+), 7 deletions(-)
New commits:
commit fc7d5cfe5611a90beb16c15cc0a2304ef2c15acc
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Feb 15 10:12:52 2014 -0500
fdo#74512: Fix the ODS export as well.
Change-Id: I54a2b2f405f9172d2ec5646346ef4e8a7ae27cb2
(cherry picked from commit 9a5ce676ede4828db0acde5db79d91320575ec08)
Reviewed-on: https://gerrit.libreoffice.org/8074
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/tokenstringcontext.hxx b/sc/inc/tokenstringcontext.hxx
index 3740f60..aa61ada 100644
--- a/sc/inc/tokenstringcontext.hxx
+++ b/sc/inc/tokenstringcontext.hxx
@@ -56,6 +56,7 @@ class CompileFormulaContext
public:
CompileFormulaContext( ScDocument* pDoc );
+ CompileFormulaContext( ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram );
formula::FormulaGrammar::Grammar getGrammar() const;
void setGrammar( formula::FormulaGrammar::Grammar eGram );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 13b3a85..22a5035 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1628,6 +1628,7 @@ void ScCompiler::CheckTabQuotes( OUString& rString,
case FormulaGrammar::CONV_XL_A1 :
case FormulaGrammar::CONV_XL_R1C1 :
case FormulaGrammar::CONV_XL_OOX :
+ case FormulaGrammar::CONV_ODF :
if( bNeedsQuote )
{
const OUString one_quote('\'');
diff --git a/sc/source/core/tool/tokenstringcontext.cxx b/sc/source/core/tool/tokenstringcontext.cxx
index 203d36a..7586a31 100644
--- a/sc/source/core/tool/tokenstringcontext.cxx
+++ b/sc/source/core/tool/tokenstringcontext.cxx
@@ -114,6 +114,12 @@ CompileFormulaContext::CompileFormulaContext( ScDocument* pDoc ) :
updateTabNames();
}
+CompileFormulaContext::CompileFormulaContext( ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram ) :
+ mpDoc(pDoc), meGram(eGram)
+{
+ updateTabNames();
+}
+
void CompileFormulaContext::updateTabNames()
{
// Fetch all sheet names.
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 62c0da4..d5c025d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -63,6 +63,7 @@
#include <arealink.hxx>
#include <datastream.hxx>
#include <documentlinkmgr.hxx>
+#include <tokenstringcontext.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -3175,21 +3176,26 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
if (aCell.maBaseCell.meType == CELLTYPE_FORMULA)
{
- OUStringBuffer sFormula;
ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula;
if (!bIsMatrix || (bIsMatrix && bIsFirstMatrixCell))
{
- const formula::FormulaGrammar::Grammar eGrammar = pDoc->GetStorageGrammar();
- sal_uInt16 nNamespacePrefix = (eGrammar == formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
- pFormulaCell->GetFormula(sFormula, eGrammar);
- OUString sOUFormula(sFormula.makeStringAndClear());
+ if (!mpCompileFormulaCxt)
+ {
+ const formula::FormulaGrammar::Grammar eGrammar = pDoc->GetStorageGrammar();
+ mpCompileFormulaCxt.reset(new sc::CompileFormulaContext(pDoc, eGrammar));
+ }
+
+ OUString aFormula = pFormulaCell->GetFormula(*mpCompileFormulaCxt);
+ sal_uInt16 nNamespacePrefix =
+ (mpCompileFormulaCxt->getGrammar() == formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
+
if (!bIsMatrix)
{
- AddAttribute(sAttrFormula, GetNamespaceMap().GetQNameByKey( nNamespacePrefix, sOUFormula, false ));
+ AddAttribute(sAttrFormula, GetNamespaceMap().GetQNameByKey(nNamespacePrefix, aFormula, false));
}
else
{
- AddAttribute(sAttrFormula, GetNamespaceMap().GetQNameByKey( nNamespacePrefix, sOUFormula.copy(1, sOUFormula.getLength() - 2), false ));
+ AddAttribute(sAttrFormula, GetNamespaceMap().GetQNameByKey(nNamespacePrefix, aFormula.copy(1, aFormula.getLength()-2), false));
}
}
if (pFormulaCell->GetErrCode())
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 564009d..4308328 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -63,6 +63,12 @@ class ScXMLEditAttributeMap;
class EditTextObject;
class ScFormulaCell;
+namespace sc {
+
+class CompileFormulaContext;
+
+}
+
typedef std::vector< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > > ScMyXShapesVec;
class ScXMLExport : public SvXMLExport
@@ -76,6 +82,7 @@ class ScXMLExport : public SvXMLExport
mutable boost::scoped_ptr<ScXMLEditAttributeMap> mpEditAttrMap;
boost::scoped_ptr<ScMyNotEmptyCellsIterator> mpCellsItr;
+ boost::scoped_ptr<sc::CompileFormulaContext> mpCompileFormulaCxt;
UniReference < XMLPropertyHandlerFactory > xScPropHdlFactory;
UniReference < XMLPropertySetMapper > xCellStylesPropertySetMapper;
UniReference < XMLPropertySetMapper > xColumnStylesPropertySetMapper;
More information about the Libreoffice-commits
mailing list