Compare commits

..

16 Commits

14 changed files with 73 additions and 45 deletions

View File

@ -3025,7 +3025,7 @@ namespace BinDocxRW
std::wstring& sShapeType = aShapeTypes[i];
pOfficeDrawingConverter->AddShapeType(sShapeType);
}
pOfficeDrawingConverter->SetRels(oldRels);
pOfficeDrawingConverter->SetRels(oldRels);
}
void WriteVbaProjectContent(OOX::VbaProject& oVbaProject)
{

View File

@ -1274,16 +1274,27 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
{
if (horizontal_margins.fo_margin_left_ && horizontal_margins.fo_margin_left_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"left" , horizontal_margins.fo_margin_left_->get_length().get_value_unit(odf_types::length::inch));
else CP_XML_ATTR(L"left", 0);
if (horizontal_margins.fo_margin_right_ && horizontal_margins.fo_margin_right_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"right" , horizontal_margins.fo_margin_right_->get_length().get_value_unit(odf_types::length::inch));
else CP_XML_ATTR(L"right", 0);
if (vertical_margins.fo_margin_top_ && vertical_margins.fo_margin_top_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"top" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
else CP_XML_ATTR(L"top", 1.025);
if (vertical_margins.fo_margin_bottom_ && vertical_margins.fo_margin_bottom_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"bottom" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
else CP_XML_ATTR(L"bottom", 1.025);
CP_XML_ATTR(L"header" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
CP_XML_ATTR(L"footer" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
if (vertical_margins.fo_margin_top_)
CP_XML_ATTR(L"header" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
else CP_XML_ATTR(L"header", 0.7875);
if (vertical_margins.fo_margin_bottom_)
CP_XML_ATTR(L"footer" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
else CP_XML_ATTR(L"footer", 0.7875);
}
}
if (attlist_.fo_page_width_ || attlist_.fo_page_height_ || attlist_.style_print_orientation_)

View File

@ -264,28 +264,20 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_rows_->xlsx_convert(Context);
else
{
if (table_table_row_.size() > 1)
while (table_table_row_.size() > 1)
{
//check 2 last rows for repeate > 65000 & 1024
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());
if (row_last->empty_content_cells() && row_last_1->empty_content_cells())
{
if (row_last->attlist_.table_number_rows_repeated_ > 1000 &&
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"");
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();
}
}
}
std::wstring style = row_last->attlist_.table_style_name_.get_value_or(L"");
std::wstring style_1 = row_last->attlist_.table_style_name_.get_value_or(L"");
if (style != style_1)break;
if (row_last_1->empty_content_cells() == false) break;
if (row_last->empty_content_cells() == false) break;
row_last_1->attlist_.table_number_rows_repeated_ += row_last->attlist_.table_number_rows_repeated_;
table_table_row_.pop_back();
}
for (size_t i = 0; i < table_table_row_.size(); i++)
{

View File

@ -113,7 +113,7 @@ void calcext_conditional_format::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"calcext:target-range-address",calcext_target_range_address_);
for (size_t i = content_.size() - 1; i >= 0; i--)
for (int i = (int)content_.size() - 1; i >= 0; i--)
{
content_[i]->serialize(CP_XML_STREAM());
}
@ -269,4 +269,4 @@ void calcext_date_is::serialize(std::wostream & _Wostream)
}
}
}
}
}

View File

@ -54,8 +54,9 @@ static int style_family_counts_[26]={};//согласно количеству
void calc_paragraph_properties_content(std::vector<style_paragraph_properties*> & parProps, paragraph_format_properties * result)
{
if (result == NULL)return;
if (parProps.empty()) return;
for (size_t i = parProps.size() - 1; i >= 0; i--)
for (int i = (int)parProps.size() - 1; i >= 0; i--)
{
if (parProps[i])
result->apply_from(parProps[i]->content_);
@ -444,4 +445,4 @@ void odf_style_context::calc_paragraph_properties(std::wstring style_name, style
}
}
}

View File

@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\Common\OfficeDrawing;&quot;..\..\DesktopEditor\freetype-2.5.2\include&quot;;..\..\Common\OfficeDrawing\Shapes"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="_DEBUG;_CONSOLE;USE_ATL_CSTRINGS;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
BasicRuntimeChecks="3"

View File

@ -2228,8 +2228,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
std::wstring strPos = arSplit[i].substr(0, p);
std::wstring strColor = arSplit[i].substr(p + 1);
double pos;
pos = _wtof(strPos.c_str());
double pos = strPos.empty() ? 0 : _wtof(strPos.c_str());
NSPresentationEditor::CColor color = NS_DWC_Common::getColorFromString(strColor);
PPTX::Logic::UniColor *oColor = new PPTX::Logic::UniColor();

View File

@ -2122,6 +2122,8 @@ namespace NSGuidesVML
for (size_t nIndex = 0; nIndex < oArray.size(); ++nIndex)
{
if (oPath.m_arParts.size() <= nIndex)
break;
const CPartPath& oPart = oPath.m_arParts[nIndex];
m_lWidth = oPart.width;
m_lHeight = oPart.height;

View File

@ -166,23 +166,28 @@ namespace PPTX
pWriter->WriteBYTE(1);
pWriter->EndRecord();
DocWrapper::FontProcessor fp;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
DocWrapper::FontProcessor oFontProcessor;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
BinDocxRW::CDocxSerializer oDocxSerializer;
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
BinDocxRW::CDocxSerializer* old_serial = pWriter->m_pMainDocument;
oDrawingConverter.m_pBinaryWriter = pWriter;
oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(pWriter, &oFontProcessor, &oDrawingConverter, NULL);
BinDocxRW::ParamsWriter oParamsWriter(pWriter, &fp, &oDrawingConverter, NULL);
BinDocxRW::BinaryFileWriter oBinaryFileWriter(oParamsWriter);
pWriter->m_pMainDocument = &oDocxSerializer;
BinDocxRW::BinaryFileWriter oBinaryFileWriter(*oDocxSerializer.m_pParamsWriter);
pWriter->StartRecord(2);
oBinaryFileWriter.intoBindoc(oox_unpacked.GetPath());
pWriter->EndRecord();
oDrawingConverter.m_pBinaryWriter = old_writer;
*pWriter->m_pCurrentContainer = old_rels;
*pWriter->m_pCurrentContainer = old_rels;
pWriter->m_pMainDocument = old_serial;
}
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX)
//if ( std::wstring::npos != sProgID.find(L"Excel.Sheet")) //"ET.Xlsx.6" !!!

View File

@ -46,7 +46,10 @@ BiffStructurePtr XFExtGradient::clone()
void XFExtGradient::load(CFRecord& record)
{
record >> gradient >> cGradStops;
for(size_t i = 0; i < cGradStops; ++i)
if (cGradStops > 256) cGradStops = 256;
for(size_t i = 0; !record.isEOF() && i < cGradStops; ++i)
{
GradStop grad_stop;
record >> grad_stop;

View File

@ -61,8 +61,10 @@ void XFExtNoFRT::load(CFRecord& record)
unsigned short cexts;
record >> cexts;
for(unsigned short i = 0; !record.isEOF() && i < cexts; ++i)
for(unsigned short i = 0; i < cexts; ++i)
{
if (record.checkFitReadSafe(4) == false)
break;
ExtProp prop;
record >> prop;
rgExt.push_back(prop);

View File

@ -249,10 +249,6 @@ int FDB::serialize(std::wostream & strm, bool bSql)
// CP_XML_ATTR(L"containsString", 0);
// }
//}
if (bInteger && bNumber)
{
bInteger = false;
}
if ((bDate & bNumber) || (bNumber & bString))
{
@ -277,8 +273,21 @@ int FDB::serialize(std::wostream & strm, bool bSql)
}
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger && !bDate & bString) CP_XML_ATTR(L"containsInteger", 1);
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bInteger && !bDate)
{
if (bString)
{
CP_XML_ATTR(L"containsInteger", 1);
}
else if (!bNumber)
{
CP_XML_ATTR(L"containsNumber", 1);
CP_XML_ATTR(L"containsInteger", 1);
}
}
if (fdb->fnumMinMaxValid)
{

View File

@ -141,8 +141,9 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
{
case rt_Uncalced: proc.optional<Uncalced>(); break;
case rt_Index: proc.optional<Index>(); break;
case rt_CalcRefMode:
case rt_CalcRefMode://todooo сделать вариативно по всем проверку
case rt_CalcMode:
case rt_PrintRowCol:
{
GLOBALS globals(false);
if (proc.mandatory(globals))
@ -221,6 +222,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
elements_.pop_back();
}
}break;
case rt_LabelSst://order_history.xls
case rt_Label://file(6).xls
case rt_Row:
{

View File

@ -189,13 +189,15 @@ static const struct ActionNamesEmf
do
{
if (m_oStream.CanRead() < 8)
if (m_oStream.IsEof())
break;
if (m_oStream.CanRead() < 8)
return SetError();
m_oStream >> ulType;
m_oStream >> ulSize;
if (ulSize < 1)
if (ulSize < 1)
continue;
m_ulRecordPos = m_oStream.Tell();