Commit 2ce57085 authored by ElenaSubbotina's avatar ElenaSubbotina

Odf, xls, doc - fix users files

parent 48d94d24
...@@ -75,6 +75,8 @@ namespace DocFileFormat ...@@ -75,6 +75,8 @@ namespace DocFileFormat
while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] ) while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] )
{ {
int cpStart = cp;
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break; if (fc < 0) break;
...@@ -93,6 +95,8 @@ namespace DocFileFormat ...@@ -93,6 +95,8 @@ namespace DocFileFormat
//this PAPX is for a normal paragraph //this PAPX is for a normal paragraph
cp = writeParagraph( cp ); cp = writeParagraph( cp );
} }
while (cp <= cpStart) //conv_fQioC665ib4ngHkDGY4__docx.doc
cp++;
} }
m_pXmlWriter->WriteNodeEnd( L"w:footnote"); m_pXmlWriter->WriteNodeEnd( L"w:footnote");
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
......
...@@ -74,6 +74,8 @@ xlsx_document::xlsx_document() ...@@ -74,6 +74,8 @@ xlsx_document::xlsx_document()
void xlsx_document::write(const std::wstring & RootPath) void xlsx_document::write(const std::wstring & RootPath)
{ {
_CP_LOG << L"[info][xlsx] process writing" << std::endl;
xl_files_.write (RootPath); xl_files_.write (RootPath);
docProps_files_.write (RootPath); docProps_files_.write (RootPath);
rels_files_.write (RootPath); rels_files_.write (RootPath);
......
...@@ -160,7 +160,10 @@ void xlsx_table_state::set_table_row_group(int count, bool collapsed, int level) ...@@ -160,7 +160,10 @@ void xlsx_table_state::set_table_row_group(int count, bool collapsed, int level)
group_row_.collapsed = collapsed; group_row_.collapsed = collapsed;
group_row_.level = level; group_row_.level = level;
} }
void xlsx_table_state::add_empty_row(int count)
{
current_table_row_ += count;
}
void xlsx_table_state::start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName) void xlsx_table_state::start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName)
{ {
empty_row_ = true; empty_row_ = true;
......
...@@ -89,6 +89,8 @@ public: ...@@ -89,6 +89,8 @@ public:
void non_empty_row (); void non_empty_row ();
bool is_empty_row () const; bool is_empty_row () const;
void end_row (); void end_row ();
void add_empty_row(int count);
std::wstring current_row_style () const; std::wstring current_row_style () const;
std::wstring default_row_cell_style () const; std::wstring default_row_cell_style () const;
......
...@@ -356,7 +356,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std:: ...@@ -356,7 +356,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
*/ */
} }
// table-table-cell-content
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
std::wostream & table_table_cell_content::text_to_stream(std::wostream & _Wostream) const std::wostream & table_table_cell_content::text_to_stream(std::wostream & _Wostream) const
...@@ -393,9 +392,14 @@ void table_table_cell::add_child_element( xml::sax * Reader, const std::wstring ...@@ -393,9 +392,14 @@ void table_table_cell::add_child_element( xml::sax * Reader, const std::wstring
void table_table_cell::add_text(const std::wstring & Text) void table_table_cell::add_text(const std::wstring & Text)
{ {
} }
bool table_table_cell::empty()
{
if (!content_.elements_.empty()) return false;
if (attlist_.table_formula_) return false;
return true;
}
// table:covered-table-cell // table:covered-table-cell
// table-covered-table-cell
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_covered_table_cell::ns = L"table"; const wchar_t * table_covered_table_cell::ns = L"table";
const wchar_t * table_covered_table_cell::name = L"covered-table-cell"; const wchar_t * table_covered_table_cell::name = L"covered-table-cell";
...@@ -412,13 +416,19 @@ void table_covered_table_cell::add_attributes( const xml::attributes_wc_ptr & At ...@@ -412,13 +416,19 @@ void table_covered_table_cell::add_attributes( const xml::attributes_wc_ptr & At
void table_covered_table_cell::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void table_covered_table_cell::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{ {
empty_ = false;
content_.add_child_element(Reader, Ns, Name, getContext()); content_.add_child_element(Reader, Ns, Name, getContext());
} }
void table_covered_table_cell::add_text(const std::wstring & Text) void table_covered_table_cell::add_text(const std::wstring & Text)
{ {
} }
bool table_covered_table_cell::empty()
{
if (!content_.elements_.empty()) return false;
if (attlist_.table_formula_) return false;
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-row // table:table-row
...@@ -445,7 +455,38 @@ void table_table_row::add_child_element( xml::sax * Reader, const std::wstring & ...@@ -445,7 +455,38 @@ void table_table_row::add_child_element( xml::sax * Reader, const std::wstring &
else else
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
bool table_table_row::empty()
{
if (content_.empty() && !attlist_.table_style_name_ && !attlist_.table_default_cell_style_name_) return true;
return false;
}
bool table_table_row::empty_content_cells()
{
bool res = true;
for (size_t i = 0 ; i < content_.size(); i++)
{
table_table_cell *cell = dynamic_cast<table_table_cell*>(content_[i].get());
table_covered_table_cell *cover_cell = dynamic_cast<table_covered_table_cell*>(content_[i].get());
if (!cell && !cover_cell)
{
res = false;
break;
}
if (cell && cell->empty() == false)
{
res = false;
break;
}
if (cover_cell && cover_cell->empty() == false)
{
res = false;
break;
}
}
return res;
}
// table:table-rows // table:table-rows
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_table_rows::ns = L"table"; const wchar_t * table_table_rows::ns = L"table";
......
...@@ -361,6 +361,9 @@ private: ...@@ -361,6 +361,9 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public: public:
bool empty();
bool empty_content_cells();
table_table_row_attlist attlist_; table_table_row_attlist attlist_;
office_element_ptr_array content_; // table-table-cell or table-covered-table-cell office_element_ptr_array content_; // table-table-cell or table-covered-table-cell
...@@ -408,6 +411,7 @@ private: ...@@ -408,6 +411,7 @@ private:
public: public:
bool last_cell_; bool last_cell_;
bool empty();
table_table_cell_attlist attlist_; table_table_cell_attlist attlist_;
table_table_cell_attlist_extra attlist_extra_; table_table_cell_attlist_extra attlist_extra_;
...@@ -427,7 +431,7 @@ public: ...@@ -427,7 +431,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
table_covered_table_cell() : last_cell_(false), empty_(true) {} table_covered_table_cell() : last_cell_(false){}
virtual void docx_convert(oox::docx_conversion_context & Context) ; virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ; virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
...@@ -443,7 +447,7 @@ private: ...@@ -443,7 +447,7 @@ private:
public: public:
bool last_cell_; bool last_cell_;
bool empty_; bool empty();
table_table_cell_attlist attlist_; table_table_cell_attlist attlist_;
table_table_cell_content content_; table_table_cell_content content_;
......
...@@ -54,6 +54,7 @@ void table_data_pilot_tables::add_child_element( xml::sax * Reader, const std::w ...@@ -54,6 +54,7 @@ void table_data_pilot_tables::add_child_element( xml::sax * Reader, const std::w
} }
void table_data_pilot_tables::xlsx_convert(oox::xlsx_conversion_context & Context) void table_data_pilot_tables::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
return;
for (size_t i = 0; i < content_.size(); i++) for (size_t i = 0; i < content_.size(); i++)
{ {
content_[i]->xlsx_convert(Context); content_[i]->xlsx_convert(Context);
......
...@@ -78,6 +78,17 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex ...@@ -78,6 +78,17 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
if (attlist_.table_number_rows_repeated_ > 1 && empty())
{
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
return;
}
if (attlist_.table_number_rows_repeated_ > 0xf000 && empty_content_cells())
{
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
return; //conv_hSX8n3lVbhALjt0aafg__xlsx.ods, conv_MA2CauoNfX_7ejKS5eg__xlsx.ods
}
std::wostream & strm = Context.current_sheet().sheetData(); std::wostream & strm = Context.current_sheet().sheetData();
///обработка чтилей для роу - ///обработка чтилей для роу -
size_t Default_Cell_style_in_row_ = 0; size_t Default_Cell_style_in_row_ = 0;
...@@ -259,20 +270,22 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -259,20 +270,22 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_row* row_last = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 1].get()); table_table_row* row_last = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 1].get());
table_table_row* row_last_1 = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 2].get()); table_table_row* row_last_1 = dynamic_cast<table_table_row*>(table_table_row_[table_table_row_.size() - 2].get());
if (row_last->attlist_.table_number_rows_repeated_ > 1000 && if (row_last->empty_content_cells() && row_last_1->empty_content_cells())
row_last_1->attlist_.table_number_rows_repeated_ > 1000 ||
row_last_1->attlist_.table_number_rows_repeated_ > 0xf000)
{ {
std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L""); if (row_last->attlist_.table_number_rows_repeated_ > 1000 &&
std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L""); row_last_1->attlist_.table_number_rows_repeated_ > 1000 ||
row_last_1->attlist_.table_number_rows_repeated_ > 0xf000)
if (style == style_1)//check for empty also ????
{ {
row_last_1->attlist_.table_number_rows_repeated_ = 1024; std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L"");
table_table_row_.pop_back(); std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L"");
if (style == style_1)//check for empty also ????
{
row_last_1->attlist_.table_number_rows_repeated_ = 1024;
table_table_row_.pop_back();
}
} }
} }
} }
for (size_t i = 0; i < table_table_row_.size(); i++) for (size_t i = 0; i < table_table_row_.size(); i++)
{ {
......
...@@ -249,17 +249,16 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -249,17 +249,16 @@ int FDB::serialize(std::wostream & strm, bool bSql)
// CP_XML_ATTR(L"containsString", 0); // CP_XML_ATTR(L"containsString", 0);
// } // }
//} //}
if (bInteger) if (bInteger && bNumber)
{ {
if (bNumber) bInteger = false; bInteger = false;
else bNumber = true;
} }
if ((bDate & bNumber) || (bNumber & bString)) if ((bDate & bNumber) || (bNumber & bString))
{ {
CP_XML_ATTR(L"containsSemiMixedTypes", 1); CP_XML_ATTR(L"containsSemiMixedTypes", 1);
} }
else if ( bDate & bString) else if (bDate & bString)
{ {
CP_XML_ATTR(L"containsMixedTypes", 1); CP_XML_ATTR(L"containsMixedTypes", 1);
} }
...@@ -277,9 +276,9 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -277,9 +276,9 @@ int FDB::serialize(std::wostream & strm, bool bSql)
CP_XML_ATTR(L"containsString", 0); CP_XML_ATTR(L"containsString", 0);
} }
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1); if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger) CP_XML_ATTR(L"containsInteger", 1); if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger && !bDate & bString) CP_XML_ATTR(L"containsInteger", 1);
if (fdb->fnumMinMaxValid) if (fdb->fnumMinMaxValid)
{ {
......
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