Commit 717b6280 authored by ElenaSubbotina's avatar ElenaSubbotina

...

parent e4f94646
...@@ -35,9 +35,6 @@ ...@@ -35,9 +35,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of DataFormat record in BIFF8
class DataFormat: public BiffRecord class DataFormat: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(DataFormat) BIFF_RECORD_DEFINE_TYPE_INFO(DataFormat)
...@@ -48,7 +45,6 @@ public: ...@@ -48,7 +45,6 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeDataFormat; static const ElementType type = typeDataFormat;
......
...@@ -184,9 +184,9 @@ int TxO::serialize_vml (std::wostream & _stream) ...@@ -184,9 +184,9 @@ int TxO::serialize_vml (std::wostream & _stream)
{ {
iFmt = run->formatRun.ifnt; iFmt = run->formatRun.ifnt;
Font *font = NULL; Font *font = NULL;
if ((global_info->m_arFonts) && (iFmt >=0 && iFmt < global_info->m_arFonts->size())) if (iFmt >= 0 && iFmt < global_info->m_arFonts.size())
{ {
font = dynamic_cast<Font *>(global_info->m_arFonts->at(iFmt).get()); font = dynamic_cast<Font *>(global_info->m_arFonts[iFmt].get());
} }
if (font) if (font)
{ {
...@@ -281,12 +281,11 @@ int TxO::serialize (std::wostream & _stream) ...@@ -281,12 +281,11 @@ int TxO::serialize (std::wostream & _stream)
int TxO::serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_) int TxO::serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_)
{ {
if (!global_info) return 0; if (!global_info) return 0;
if (!global_info->m_arFonts) return 0;
int sz = global_info->m_arFonts->size(); int sz = global_info->m_arFonts.size();
if (iFmt - 1 >= sz || iFmt < 1) return 0; if (iFmt - 1 >= sz || iFmt < 1) return 0;
Font * font = dynamic_cast<Font*>(global_info->m_arFonts->at(iFmt-1).get()); Font * font = dynamic_cast<Font*>(global_info->m_arFonts[iFmt-1].get());
if (!font) return 0; if (!font) return 0;
......
...@@ -240,9 +240,9 @@ void StyleXF::Update(XFProp* xfProp) ...@@ -240,9 +240,9 @@ void StyleXF::Update(XFProp* xfProp)
case 0x0025: case 0x0025:
{ {
font_id = *byte_->value(); font_id = *byte_->value();
if ((global_info->m_arFonts) && (font_id >=0 && font_id < global_info->m_arFonts->size())) if (font_id >=0 && font_id < global_info->m_arFonts.size())
{ {
font = dynamic_cast<Font*>(global_info->m_arFonts->at(font_id).get()); font = dynamic_cast<Font*>(global_info->m_arFonts[font_id].get());
} }
}break; }break;
......
...@@ -150,16 +150,15 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream) ...@@ -150,16 +150,15 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream)
int XLUnicodeRichExtendedString::serialize_rPr (std::wostream & _stream, int iFmt) int XLUnicodeRichExtendedString::serialize_rPr (std::wostream & _stream, int iFmt)
{ {
if (!pGlobalWorkbookInfoPtr) return 0; if (!pGlobalWorkbookInfoPtr) return 0;
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size(); int sz = pGlobalWorkbookInfoPtr->m_arFonts.size();
if (iFmt -1 > sz || iFmt < 1) return 0; if (iFmt -1 > sz || iFmt < 1) return 0;
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
CP_XML_NODE(L"rPr") CP_XML_NODE(L"rPr")
{ {
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get()); Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts[iFmt-1].get());
if (font) font->serialize_properties(CP_XML_STREAM(), true); if (font) font->serialize_properties(CP_XML_STREAM(), true);
} }
......
...@@ -347,12 +347,11 @@ int ATTACHEDLABEL::serialize(std::wostream & _stream, bool isPosition) ...@@ -347,12 +347,11 @@ int ATTACHEDLABEL::serialize(std::wostream & _stream, bool isPosition)
int ATTACHEDLABEL::serialize_rPr (std::wostream & _stream, int iFmt, bool rtl, bool defRPr) int ATTACHEDLABEL::serialize_rPr (std::wostream & _stream, int iFmt, bool rtl, bool defRPr)
{ {
if (!pGlobalWorkbookInfoPtr) return 0; if (!pGlobalWorkbookInfoPtr) return 0;
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size(); int sz = pGlobalWorkbookInfoPtr->m_arFonts.size();
if (iFmt -1 > sz || iFmt < 1) return 0; if (iFmt -1 > sz || iFmt < 1) return 0;
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get()); Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts[iFmt-1].get());
Text * text_props = dynamic_cast<Text*>(m_TextProperties.get()); Text * text_props = dynamic_cast<Text*>(m_TextProperties.get());
......
...@@ -260,13 +260,12 @@ int AXS::serialize(std::wostream & _stream) ...@@ -260,13 +260,12 @@ int AXS::serialize(std::wostream & _stream)
int AXS::serialize_rPr (std::wostream & _stream, int iFmt, _CP_OPT(unsigned int) color, bool rtl, bool defRPr) int AXS::serialize_rPr (std::wostream & _stream, int iFmt, _CP_OPT(unsigned int) color, bool rtl, bool defRPr)
{ {
if (!pGlobalWorkbookInfoPtr) return 0; if (!pGlobalWorkbookInfoPtr) return 0;
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
Font * font = NULL; Font * font = NULL;
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size(); int sz = pGlobalWorkbookInfoPtr->m_arFonts.size();
if (iFmt > 0 && iFmt <= sz) if (iFmt > 0 && iFmt <= sz)
font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get()); font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts.at(iFmt-1).get());
if (font) if (font)
{ {
......
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
*/ */
#include "CRT.h" #include "CRT.h"
#include "LD.h"
#include "DROPBAR.h"
#include "SS.h"
#include "SHAPEPROPS.h"
#include "DFTTEXT.h"
#include "../Biff_records/ChartFormat.h" #include "../Biff_records/ChartFormat.h"
#include "../Biff_records/Begin.h" #include "../Biff_records/Begin.h"
#include "../Biff_records/Bar.h" #include "../Biff_records/Bar.h"
...@@ -46,14 +52,9 @@ ...@@ -46,14 +52,9 @@
#include "../Biff_records/CrtLink.h" #include "../Biff_records/CrtLink.h"
#include "../Biff_records/SeriesList.h" #include "../Biff_records/SeriesList.h"
#include "../Biff_records/Chart3d.h" #include "../Biff_records/Chart3d.h"
#include "../Biff_unions/LD.h"
#include "../Biff_unions/DROPBAR.h"
#include "../Biff_records/CrtLine.h" #include "../Biff_records/CrtLine.h"
#include "../Biff_records/LineFormat.h" #include "../Biff_records/LineFormat.h"
#include "../Biff_unions/DFTTEXT.h"
#include "../Biff_records/DataLabExtContents.h" #include "../Biff_records/DataLabExtContents.h"
#include "../Biff_unions/SS.h"
#include "../Biff_unions/SHAPEPROPS.h"
#include "../Biff_records/End.h" #include "../Biff_records/End.h"
#include "../Biff_records/ValueRange.h" #include "../Biff_records/ValueRange.h"
#include "../Biff_records/Tick.h" #include "../Biff_records/Tick.h"
...@@ -65,6 +66,7 @@ ...@@ -65,6 +66,7 @@
#include "../Biff_records/PlotArea.h" #include "../Biff_records/PlotArea.h"
#include "../Biff_records/DropBar.h" #include "../Biff_records/DropBar.h"
#include "../Biff_records/CrtMlFrt.h" #include "../Biff_records/CrtMlFrt.h"
#include "../Biff_records/DataFormat.h"
#include "../Biff_records/StartObject.h" #include "../Biff_records/StartObject.h"
#include "../Biff_records/EndObject.h" #include "../Biff_records/EndObject.h"
......
...@@ -76,11 +76,16 @@ const bool DFTTEXT::loadContent(BinProcessor& proc) ...@@ -76,11 +76,16 @@ const bool DFTTEXT::loadContent(BinProcessor& proc)
m_DefaultText = elements_.back(); m_DefaultText = elements_.back();
elements_.pop_back(); elements_.pop_back();
} }
if (proc.optional<DataLabExtContents>()) if (proc.optional<DataLabExtContents>())
{ {
m_DataLabExtContents = elements_.back(); m_DataLabExtContents = elements_.back();
elements_.pop_back(); elements_.pop_back();
} }
if (!m_DefaultText && !m_DataLabExtContents)
return false;
if (proc.mandatory<ATTACHEDLABEL>()) if (proc.mandatory<ATTACHEDLABEL>())
{ {
m_ATTACHEDLABEL = elements_.back(); m_ATTACHEDLABEL = elements_.back();
...@@ -89,10 +94,7 @@ const bool DFTTEXT::loadContent(BinProcessor& proc) ...@@ -89,10 +94,7 @@ const bool DFTTEXT::loadContent(BinProcessor& proc)
if (proc.optional<EndObject>()) elements_.pop_back(); if (proc.optional<EndObject>()) elements_.pop_back();
if (m_DefaultText || m_DataLabExtContents)
return true; return true;
else
return false;
} }
} // namespace XLS } // namespace XLS
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of DROPBAR union of records
class DROPBAR: public CompositeObject class DROPBAR: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(DROPBAR) BASE_OBJECT_DEFINE_CLASS_NAME(DROPBAR)
......
...@@ -31,15 +31,17 @@ ...@@ -31,15 +31,17 @@
*/ */
#include "DROPBAR.h" #include "DROPBAR.h"
#include <Logic/Biff_records/DropBar.h> #include "GELFRAME.h"
#include <Logic/Biff_records/Begin.h> #include "SHAPEPROPS.h"
#include <Logic/Biff_records/LineFormat.h>
#include <Logic/Biff_records/AreaFormat.h> #include "../Biff_records/DropBar.h"
#include <Logic/Biff_unions/GELFRAME.h> #include "../Biff_records/LineFormat.h"
#include <Logic/Biff_unions/SHAPEPROPS.h> #include "../Biff_records/AreaFormat.h"
#include <Logic/Biff_records/End.h>
#include <Logic/Biff_records/StartObject.h> #include "../Biff_records/Begin.h"
#include <Logic/Biff_records/EndObject.h> #include "../Biff_records/End.h"
#include "../Biff_records/StartObject.h"
#include "../Biff_records/EndObject.h"
namespace XLS namespace XLS
{ {
...@@ -72,7 +74,7 @@ const bool DROPBAR::loadContent(BinProcessor& proc) ...@@ -72,7 +74,7 @@ const bool DROPBAR::loadContent(BinProcessor& proc)
if (proc.mandatory<Begin>()) elements_.pop_back(); if (proc.mandatory<Begin>()) elements_.pop_back();
if (proc.mandatory<LineFormat>()) if (proc.optional<LineFormat>())
{ {
m_LineFormat = elements_.back(); elements_.pop_back(); m_LineFormat = elements_.back(); elements_.pop_back();
} }
...@@ -81,11 +83,10 @@ const bool DROPBAR::loadContent(BinProcessor& proc) ...@@ -81,11 +83,10 @@ const bool DROPBAR::loadContent(BinProcessor& proc)
elements_.pop_back(); elements_.pop_back();
if (proc.mandatory<EndObject>()) elements_.pop_back(); if (proc.mandatory<EndObject>()) elements_.pop_back();
} }
if (proc.mandatory<AreaFormat>()) if (proc.optional<AreaFormat>())
{ {
m_AreaFormat = elements_.back(); elements_.pop_back(); m_AreaFormat = elements_.back(); elements_.pop_back();
} }
if (proc.optional<GELFRAME>()) if (proc.optional<GELFRAME>())
{ {
m_GELFRAME = elements_.back(); elements_.pop_back(); m_GELFRAME = elements_.back(); elements_.pop_back();
......
...@@ -71,7 +71,6 @@ BaseObjectPtr FORMATTING::clone() ...@@ -71,7 +71,6 @@ BaseObjectPtr FORMATTING::clone()
const bool FORMATTING::loadContent(BinProcessor& proc) const bool FORMATTING::loadContent(BinProcessor& proc)
{ {
global_info = proc.getGlobalWorkbookInfo(); global_info = proc.getGlobalWorkbookInfo();
global_info->m_arFonts = &m_arFonts;
int count = 0; int count = 0;
count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally at least one Font is mandatory) count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally at least one Font is mandatory)
...@@ -80,7 +79,7 @@ const bool FORMATTING::loadContent(BinProcessor& proc) ...@@ -80,7 +79,7 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
Font *font = dynamic_cast<Font *>(elements_.front().get()); Font *font = dynamic_cast<Font *>(elements_.front().get());
if ((font) && (font->correct)) if ((font) && (font->correct))
{ {
m_arFonts.push_back(elements_.front()); global_info->m_arFonts.push_back(elements_.front());
} }
elements_.pop_front(); elements_.pop_front();
count--; count--;
...@@ -95,10 +94,10 @@ const bool FORMATTING::loadContent(BinProcessor& proc) ...@@ -95,10 +94,10 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally Font follows by Format) count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally Font follows by Format)
int countFonts = m_arFonts.size(); int countFonts = global_info->m_arFonts.size();
while(count > 0) while(count > 0)
{ {
m_arFonts.insert(m_arFonts.begin()+countFonts, elements_.back()); global_info->m_arFonts.insert(global_info->m_arFonts.begin() + countFonts, elements_.back());
elements_.pop_back(); elements_.pop_back();
count--; count--;
} }
...@@ -235,20 +234,23 @@ int FORMATTING::serialize1(std::wostream & stream) ...@@ -235,20 +234,23 @@ int FORMATTING::serialize1(std::wostream & stream)
} }
} }
} }
if (m_arFonts.size() > 0) if (!global_info->m_arFonts.empty())
{ {
CP_XML_NODE(L"fonts") CP_XML_NODE(L"fonts")
{ {
CP_XML_ATTR(L"count", m_arFonts.size()); CP_XML_ATTR(L"count", global_info->m_arFonts.size());
for (size_t i = 0 ; i < m_arFonts.size(); i++)
for (size_t i = 0; i < global_info->m_arFonts.size(); i++)
{ {
Font * font = dynamic_cast<Font*>(m_arFonts[i].get()); Font * font = dynamic_cast<Font*>(global_info->m_arFonts[i].get());
std::map<int, FillInfoExt>::iterator it = global_info->fonts_color_ext.find(i); std::map<int, FillInfoExt>::iterator it = global_info->fonts_color_ext.find(i);
if (font && (it!=global_info->fonts_color_ext.end()))
if (font && (it != global_info->fonts_color_ext.end()))
{ {
font->set_color_ext(it->second); font->set_color_ext(it->second);
} }
m_arFonts[i]->serialize(CP_XML_STREAM()); global_info->m_arFonts[i]->serialize(CP_XML_STREAM());
} }
} }
} }
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
BaseObjectPtr m_Styles; BaseObjectPtr m_Styles;
BaseObjectPtr m_XFS; BaseObjectPtr m_XFS;
std::vector<BaseObjectPtr> m_arFormats; std::vector<BaseObjectPtr> m_arFormats;
std::vector<BaseObjectPtr> m_arFonts; //std::vector<BaseObjectPtr> m_arFonts; in global
BaseObjectPtr m_Palette; BaseObjectPtr m_Palette;
BaseObjectPtr m_ClrtClient; BaseObjectPtr m_ClrtClient;
std::vector<BaseObjectPtr> m_arDXF; std::vector<BaseObjectPtr> m_arDXF;
......
...@@ -186,9 +186,9 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels() ...@@ -186,9 +186,9 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels()
} }
defaultDigitFontSize = std::pair<float, float>(7,8); defaultDigitFontSize = std::pair<float, float>(7,8);
if (m_arFonts->size() < 1) return; if (m_arFonts.empty()) return;
Font * font = dynamic_cast<Font*>(m_arFonts->at(0).get()); Font * font = dynamic_cast<Font*>(m_arFonts[0].get());
if (!font) return; if (!font) return;
std::wstring fontName = font->fontName.value(); std::wstring fontName = font->fontName.value();
......
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
std::map<int, int> fonts_charsets; std::map<int, int> fonts_charsets;
std::map<int, std::wstring> colors_palette; std::map<int, std::wstring> colors_palette;
std::vector<BaseObjectPtr> *m_arFonts; std::vector<BaseObjectPtr> m_arFonts;
unsigned int current_sheet; unsigned int current_sheet;
......
...@@ -333,7 +333,6 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc) ...@@ -333,7 +333,6 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
if (fmts) if (fmts)
{ {
global_info_->cellStyleDxfs_count = fmts->m_arDXF.size(); global_info_->cellStyleDxfs_count = fmts->m_arDXF.size();
global_info_->m_arFonts = &fmts->m_arFonts;
} }
} }
//else //else
......
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