[Libreoffice-commits] core.git: 3 commits - sc/source xmloff/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Jul 1 18:10:41 PDT 2013
sc/source/filter/excel/xetable.cxx | 46 +++++++++++++++++++++++++--
sc/source/filter/inc/xetable.hxx | 3 +
xmloff/source/chart/XMLChartStyleContext.cxx | 14 ++------
3 files changed, 50 insertions(+), 13 deletions(-)
New commits:
commit 93a5b7ee36818d60963e4fbe21f9e6c43c7c5a80
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Jul 2 02:37:58 2013 +0200
don't forget the formula cell style during xls/xlsx export, fdo#66242
This reverts parts of commit 64223bda068cc6d82d3c5e359d465014568398bb.
Change-Id: I6d5379aaedbf011b39a4cf076f0a43bc8a6cbc93
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 39f2e03..8694a49 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -760,13 +760,55 @@ IMPL_FIXEDMEMPOOL_NEWDEL( XclExpFormulaCell )
XclExpFormulaCell::XclExpFormulaCell(
const XclExpRoot& rRoot, const XclAddress& rXclPos,
- sal_uInt32 nForcedXFId, const ScFormulaCell& rScFmlaCell,
+ const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
+ const ScFormulaCell& rScFmlaCell,
XclExpArrayBuffer& rArrayBfr,
XclExpShrfmlaBuffer& rShrfmlaBfr,
XclExpTableopBuffer& rTableopBfr ) :
XclExpSingleCellBase( EXC_ID2_FORMULA, 0, rXclPos, nForcedXFId ),
mrScFmlaCell( const_cast< ScFormulaCell& >( rScFmlaCell ) )
{
+ // *** Find result number format overwriting cell number format *** -------
+
+ if( GetXFId() == EXC_XFID_NOTFOUND )
+ {
+ SvNumberFormatter& rFormatter = rRoot.GetFormatter();
+ XclExpNumFmtBuffer& rNumFmtBfr = rRoot.GetNumFmtBuffer();
+
+ // current cell number format
+ sal_uLong nScNumFmt = pPattern ?
+ GETITEMVALUE( pPattern->GetItemSet(), SfxUInt32Item, ATTR_VALUE_FORMAT, sal_uLong ) :
+ rNumFmtBfr.GetStandardFormat();
+
+ // alternative number format passed to XF buffer
+ sal_uLong nAltScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ /* Xcl doesn't know Boolean number formats, we write
+ "TRUE";"FALSE" (language dependent). Don't do it for automatic
+ formula formats, because Excel gets them right. */
+ /* #i8640# Don't set text format, if we have string results. */
+ short nFormatType = mrScFmlaCell.GetFormatType();
+ if( ((nScNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0) &&
+ (nFormatType != NUMBERFORMAT_LOGICAL) &&
+ (nFormatType != NUMBERFORMAT_TEXT) )
+ nAltScNumFmt = nScNumFmt;
+ /* If cell number format is Boolean and automatic formula
+ format is Boolean don't write that ugly special format. */
+ else if( (nFormatType == NUMBERFORMAT_LOGICAL) &&
+ (rFormatter.GetType( nScNumFmt ) == NUMBERFORMAT_LOGICAL) )
+ nAltScNumFmt = rNumFmtBfr.GetStandardFormat();
+
+ // #i41420# find script type according to result type (always latin for numeric results)
+ sal_Int16 nScript = ApiScriptType::LATIN;
+ bool bForceLineBreak = false;
+ if( nFormatType == NUMBERFORMAT_TEXT )
+ {
+ String aResult = mrScFmlaCell.GetString();
+ bForceLineBreak = mrScFmlaCell.IsMultilineResult();
+ nScript = XclExpStringHelper::GetLeadingScriptType( rRoot, aResult );
+ }
+ SetXFId( rRoot.GetXFBuffer().InsertWithNumFmt( pPattern, nScript, nAltScNumFmt, bForceLineBreak ) );
+ }
+
// *** Convert the formula token array *** --------------------------------
ScAddress aScPos( static_cast< SCCOL >( rXclPos.mnCol ), static_cast< SCROW >( rXclPos.mnRow ), rRoot.GetCurrScTab() );
@@ -2336,7 +2378,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
case CELLTYPE_FORMULA:
{
xCell.reset(new XclExpFormulaCell(
- GetRoot(), aXclPos, nMergeBaseXFId,
+ GetRoot(), aXclPos, pPattern, nMergeBaseXFId,
*rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr));
}
break;
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index b0253b3..655d6ea 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -451,7 +451,8 @@ class XclExpFormulaCell : public XclExpSingleCellBase
public:
explicit XclExpFormulaCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
- sal_uInt32 nForcedXFId, const ScFormulaCell& rScFmlaCell,
+ const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
+ const ScFormulaCell& rScFmlaCell,
XclExpArrayBuffer& rArrayBfr,
XclExpShrfmlaBuffer& rShrfmlaBfr,
XclExpTableopBuffer& rTableopBfr );
commit ae4e42c87f10eda7efd74cb250253a4f6815d427
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jun 30 05:56:31 2013 +0200
remove unnecessary comments
Change-Id: Iff6c1c59d0300f868972c2abf88fee5cf7e5372a
diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx
index 27ac66b..52dc38a 100644
--- a/xmloff/source/chart/XMLChartStyleContext.cxx
+++ b/xmloff/source/chart/XMLChartStyleContext.cxx
@@ -37,8 +37,6 @@ using ::xmloff::token::XML_CHART_PROPERTIES;
TYPEINIT1( XMLChartStyleContext, XMLPropStyleContext );
-// protected
-
void XMLChartStyleContext::SetAttribute(
sal_uInt16 nPrefixKey,
const OUString& rLocalName,
@@ -58,9 +56,6 @@ void XMLChartStyleContext::SetAttribute(
}
}
-//public
-
-// CTOR
XMLChartStyleContext::XMLChartStyleContext(
SvXMLImport& rImport, sal_uInt16 nPrfx,
const OUString& rLName,
@@ -71,7 +66,6 @@ XMLChartStyleContext::XMLChartStyleContext(
mrStyles( rStyles )
{}
-// DTOR
XMLChartStyleContext::~XMLChartStyleContext()
{}
@@ -96,7 +90,7 @@ void lcl_NumberFormatStyleToProperty( const OUString& rStyleName, const OUString
}
}
-}// anonymous namespace
+}
void XMLChartStyleContext::FillPropertySet(
const uno::Reference< beans::XPropertySet > & rPropSet )
commit 2c3b138a801437e801241039fa34f5f17646ecfe
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Jun 30 05:55:16 2013 +0200
fix indentation
Change-Id: I1bdd8980109b340765c0600f897ff14e75fb0bae
diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx
index b8246c7..27ac66b 100644
--- a/xmloff/source/chart/XMLChartStyleContext.cxx
+++ b/xmloff/source/chart/XMLChartStyleContext.cxx
@@ -78,9 +78,9 @@ XMLChartStyleContext::~XMLChartStyleContext()
namespace
{
- void lcl_NumberFormatStyleToProperty( const OUString& rStyleName, const OUString& rPropertyName,
- const SvXMLStylesContext& rStylesContext,
- const uno::Reference< beans::XPropertySet >& rPropSet )
+void lcl_NumberFormatStyleToProperty( const OUString& rStyleName, const OUString& rPropertyName,
+ const SvXMLStylesContext& rStylesContext,
+ const uno::Reference< beans::XPropertySet >& rPropSet )
{
if( !rStyleName.isEmpty())
{
More information about the Libreoffice-commits
mailing list