[Libreoffice-commits] .: 3 commits - sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Tue Aug 14 13:56:03 PDT 2012
sc/source/filter/excel/xestyle.cxx | 59 ++++++++++++++++++++++++++-----------
sc/source/filter/inc/xestyle.hxx | 23 ++++++++++----
2 files changed, 58 insertions(+), 24 deletions(-)
New commits:
commit 631b6e87ca95c0e2bcb2bdc34095c5f601af3469
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 14 22:50:05 2012 +0200
check for non existing style entries, fdo#53339
Change-Id: I95bbb3ad89eedebbcd45b4eefd26b46d5d8cd05f
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 01f0b0f..9bfb1ca 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2902,7 +2902,12 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
{
maStyleNameToDxfId.insert(std::pair<rtl::OUString, sal_Int32>(aStyleName, nIndex));
- SfxItemSet& rSet = rRoot.GetDoc().GetStyleSheetPool()->Find(aStyleName)->GetItemSet();
+ std::cout << "Style" << aStyleName << std::endl;
+ SfxStyleSheetBase* pStyle = rRoot.GetDoc().GetStyleSheetPool()->Find(aStyleName);
+ if(!pStyle)
+ continue;
+
+ SfxItemSet& rSet = pStyle->GetItemSet();
XclExpCellBorder* pBorder = new XclExpCellBorder;
if (!pBorder->FillFromItemSet( rSet, GetPalette(), GetBiff()) )
commit 97c8aaee3afa65bf7106cf175af87841147ca6e5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 14 22:19:15 2012 +0200
use boost::scoped_ptr instead of raw pointers
Change-Id: Ie09c66a414ec5a949bf8b0e5a32a3bd0d603bd06
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index dacbbbc..01f0b0f 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3002,12 +3002,6 @@ XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCe
XclExpDxf::~XclExpDxf()
{
- delete mpAlign;
- delete mpBorder;
- delete mpFont;
- delete mpNumberFmt;
- delete mpProt;
- delete mpColor;
}
void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index a255b98..2d064f2 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -748,12 +748,12 @@ public:
virtual void SaveXml( XclExpXmlStream& rStrm );
private:
- XclExpCellAlign* mpAlign;
- XclExpCellBorder* mpBorder;
- XclExpFont* mpFont;
- XclExpNumFmt* mpNumberFmt;
- XclExpCellProt* mpProt;
- XclExpColor* mpColor;
+ boost::scoped_ptr<XclExpCellAlign> mpAlign;
+ boost::scoped_ptr<XclExpCellBorder> mpBorder;
+ boost::scoped_ptr<XclExpFont> mpFont;
+ boost::scoped_ptr<XclExpNumFmt> mpNumberFmt;
+ boost::scoped_ptr<XclExpCellProt> mpProt;
+ boost::scoped_ptr<XclExpColor> mpColor;
};
class XclExpDxfs : public XclExpRecordBase, protected XclExpRoot
commit 232f2513fc79120ab2625db867f49c35838830ef
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 14 22:13:50 2012 +0200
correctly export background colors of cond formats to xlsx
Change-Id: I6d4b596ba3d611c8b795d48ca59378c4f4136611
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 5e2e011..dacbbbc 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1885,6 +1885,33 @@ void XclExpCellArea::SaveXml( XclExpXmlStream& rStrm ) const
rStyleSheet->endElement( XML_fill );
}
+
+bool XclExpColor::FillFromItemSet( const SfxItemSet& rItemSet )
+{
+ if( !ScfTools::CheckItem( rItemSet, ATTR_BACKGROUND, true ) )
+ return false;
+
+ const SvxBrushItem& rBrushItem = GETITEM( rItemSet, SvxBrushItem, ATTR_BACKGROUND );
+ maColor = rBrushItem.GetColor();
+
+ return true;
+}
+
+void XclExpColor::SaveXml( XclExpXmlStream& rStrm ) const
+{
+ sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
+ rStyleSheet->startElement( XML_fill,
+ FSEND );
+ rStyleSheet->startElement( XML_patternFill,
+ FSEND );
+ rStyleSheet->singleElement( XML_bgColor,
+ XML_rgb, XclXmlUtils::ToOString(maColor).getStr(),
+ FSEND );
+
+ rStyleSheet->endElement( XML_patternFill );
+ rStyleSheet->endElement( XML_fill );
+}
+
// ----------------------------------------------------------------------------
XclExpXFId::XclExpXFId() :
@@ -2898,11 +2925,11 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
pCellProt = NULL;
}
- XclExpCellArea* pCellArea = new XclExpCellArea;
- if(!pCellArea->FillFromItemSet( rSet, GetPalette(), GetBiff() ))
+ XclExpColor* pColor = new XclExpColor();
+ if(!pColor->FillFromItemSet( rSet ))
{
- delete pCellArea;
- pCellArea = NULL;
+ delete pColor;
+ pColor = NULL;
}
XclExpFont* pFont = NULL;
@@ -2923,7 +2950,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
++nNumFmtIndex;
}
- maDxf.push_back(new XclExpDxf( rRoot, pAlign, pBorder, pFont, pNumFormat, pCellProt, pCellArea ));
+ maDxf.push_back(new XclExpDxf( rRoot, pAlign, pBorder, pFont, pNumFormat, pCellProt, pColor ));
++nIndex;
}
@@ -2962,16 +2989,15 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm )
// ============================================================================
XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCellBorder* pBorder,
- XclExpFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpCellArea* pCellArea)
+ XclExpFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpColor* pColor)
: XclExpRoot( rRoot ),
mpAlign(pAlign),
mpBorder(pBorder),
mpFont(pFont),
mpNumberFmt(pNumberFmt),
mpProt(pProt),
- mpCellArea(pCellArea)
+ mpColor(pColor)
{
-
}
XclExpDxf::~XclExpDxf()
@@ -2981,7 +3007,7 @@ XclExpDxf::~XclExpDxf()
delete mpFont;
delete mpNumberFmt;
delete mpProt;
- delete mpCellArea;
+ delete mpColor;
}
void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
@@ -2999,8 +3025,8 @@ void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
mpNumberFmt->SaveXml(rStrm);
if (mpProt)
mpProt->SaveXml(rStrm);
- if (mpCellArea)
- mpCellArea->SaveXml(rStrm);
+ if (mpColor)
+ mpColor->SaveXml(rStrm);
rStyleSheet->endElement( XML_dxf );
}
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index ba7dc67..a255b98 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -427,6 +427,15 @@ struct XclExpCellArea : public XclCellArea
void SaveXml( XclExpXmlStream& rStrm ) const;
};
+struct XclExpColor
+{
+ Color maColor;
+
+ bool FillFromItemSet( const SfxItemSet& rItemSet );
+
+ void SaveXml( XclExpXmlStream& rStrm ) const;
+};
+
// ----------------------------------------------------------------------------
/** A combination of unique XF identifier with real Excel XF index. */
@@ -733,7 +742,7 @@ class XclExpDxf : public XclExpRecordBase, protected XclExpRoot
{
public:
XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCellBorder* pBorder,
- XclExpFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpCellArea* pCellArea);
+ XclExpFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpColor* pColor);
virtual ~XclExpDxf();
virtual void SaveXml( XclExpXmlStream& rStrm );
@@ -744,7 +753,7 @@ private:
XclExpFont* mpFont;
XclExpNumFmt* mpNumberFmt;
XclExpCellProt* mpProt;
- XclExpCellArea* mpCellArea;
+ XclExpColor* mpColor;
};
class XclExpDxfs : public XclExpRecordBase, protected XclExpRoot
More information about the Libreoffice-commits
mailing list