Kaydet (Commit) 232f2513 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

correctly export background colors of cond formats to xlsx

Change-Id: I6d4b596ba3d611c8b795d48ca59378c4f4136611
üst c319e625
...@@ -1885,6 +1885,33 @@ void XclExpCellArea::SaveXml( XclExpXmlStream& rStrm ) const ...@@ -1885,6 +1885,33 @@ void XclExpCellArea::SaveXml( XclExpXmlStream& rStrm ) const
rStyleSheet->endElement( XML_fill ); 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() : XclExpXFId::XclExpXFId() :
...@@ -2898,11 +2925,11 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) ...@@ -2898,11 +2925,11 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
pCellProt = NULL; pCellProt = NULL;
} }
XclExpCellArea* pCellArea = new XclExpCellArea; XclExpColor* pColor = new XclExpColor();
if(!pCellArea->FillFromItemSet( rSet, GetPalette(), GetBiff() )) if(!pColor->FillFromItemSet( rSet ))
{ {
delete pCellArea; delete pColor;
pCellArea = NULL; pColor = NULL;
} }
XclExpFont* pFont = NULL; XclExpFont* pFont = NULL;
...@@ -2923,7 +2950,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) ...@@ -2923,7 +2950,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
++nNumFmtIndex; ++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; ++nIndex;
} }
...@@ -2962,16 +2989,15 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm ) ...@@ -2962,16 +2989,15 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm )
// ============================================================================ // ============================================================================
XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCellBorder* pBorder, 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 ), : XclExpRoot( rRoot ),
mpAlign(pAlign), mpAlign(pAlign),
mpBorder(pBorder), mpBorder(pBorder),
mpFont(pFont), mpFont(pFont),
mpNumberFmt(pNumberFmt), mpNumberFmt(pNumberFmt),
mpProt(pProt), mpProt(pProt),
mpCellArea(pCellArea) mpColor(pColor)
{ {
} }
XclExpDxf::~XclExpDxf() XclExpDxf::~XclExpDxf()
...@@ -2981,7 +3007,7 @@ XclExpDxf::~XclExpDxf() ...@@ -2981,7 +3007,7 @@ XclExpDxf::~XclExpDxf()
delete mpFont; delete mpFont;
delete mpNumberFmt; delete mpNumberFmt;
delete mpProt; delete mpProt;
delete mpCellArea; delete mpColor;
} }
void XclExpDxf::SaveXml( XclExpXmlStream& rStrm ) void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
...@@ -2999,8 +3025,8 @@ void XclExpDxf::SaveXml( XclExpXmlStream& rStrm ) ...@@ -2999,8 +3025,8 @@ void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
mpNumberFmt->SaveXml(rStrm); mpNumberFmt->SaveXml(rStrm);
if (mpProt) if (mpProt)
mpProt->SaveXml(rStrm); mpProt->SaveXml(rStrm);
if (mpCellArea) if (mpColor)
mpCellArea->SaveXml(rStrm); mpColor->SaveXml(rStrm);
rStyleSheet->endElement( XML_dxf ); rStyleSheet->endElement( XML_dxf );
} }
......
...@@ -427,6 +427,15 @@ struct XclExpCellArea : public XclCellArea ...@@ -427,6 +427,15 @@ struct XclExpCellArea : public XclCellArea
void SaveXml( XclExpXmlStream& rStrm ) const; 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. */ /** A combination of unique XF identifier with real Excel XF index. */
...@@ -733,7 +742,7 @@ class XclExpDxf : public XclExpRecordBase, protected XclExpRoot ...@@ -733,7 +742,7 @@ class XclExpDxf : public XclExpRecordBase, protected XclExpRoot
{ {
public: public:
XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCellBorder* pBorder, 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 ~XclExpDxf();
virtual void SaveXml( XclExpXmlStream& rStrm ); virtual void SaveXml( XclExpXmlStream& rStrm );
...@@ -744,7 +753,7 @@ private: ...@@ -744,7 +753,7 @@ private:
XclExpFont* mpFont; XclExpFont* mpFont;
XclExpNumFmt* mpNumberFmt; XclExpNumFmt* mpNumberFmt;
XclExpCellProt* mpProt; XclExpCellProt* mpProt;
XclExpCellArea* mpCellArea; XclExpColor* mpColor;
}; };
class XclExpDxfs : public XclExpRecordBase, protected XclExpRoot class XclExpDxfs : public XclExpRecordBase, protected XclExpRoot
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment