Compare commits

..

14 Commits

Author SHA1 Message Date
aa8471b024 [x2t] Fix reading from Editor.bin 2019-04-08 19:52:54 +03:00
d11b74007d . 2019-04-02 12:16:22 +03:00
45d5f3b130 . 2019-04-01 18:48:43 +03:00
d898f0ef2f OdfFormatW - ... 2019-03-27 18:35:33 +03:00
c645ed6aeb OdfFormatW - ... 2019-03-27 13:46:53 +03:00
3dcb378de7 . 2019-03-25 19:24:44 +03:00
87c4ebe1d4 x2t - ... 2019-03-25 16:18:54 +03:00
498d58e856 x2t - ... 2019-03-25 13:50:29 +03:00
441aa277e3 XlsFormat - fixbug #40932 2019-03-25 13:15:18 +03:00
e8c314e535 . 2019-03-21 13:54:38 +03:00
12c8cf112a . 2019-03-21 13:51:57 +03:00
c9fb5cbe4d x2t - ... 2019-03-21 13:09:52 +03:00
4e337b5ef1 XlsFormat - fix user file 2019-03-20 18:49:38 +03:00
7e0e30d00f [x2t] Fix xlsx->Editor.bin conversion with invalid cell refs
<x:c r="2:1" instead of "B1"
2019-03-20 14:00:05 +03:00
59 changed files with 419 additions and 201 deletions

View File

@ -769,12 +769,21 @@ namespace DocFileFormat
return bytes;
}
#if !defined(_WIN32) && !defined(_WIN64)
static inline std::wstring IntToWideString(unsigned int value)
{
return (std::to_wstring(value));
}
static inline std::wstring IntToWideString(int value)
{
return (std::to_wstring(value));
}
#endif
static inline std::wstring IntToWideString(size_t value)
{
return (std::to_wstring((unsigned int)value));
}
static inline std::wstring DoubleToWideString(double value)
{
std::wstringstream src;

View File

@ -87,15 +87,14 @@ namespace DocFileFormat
}
else
{
m_nDTTM = reader->ReadUInt32();
m_nDTTM = DateAndTime(reader->ReadUInt32());
reader->ReadUInt16(); //padding1
m_nDepth = reader->ReadUInt32();
m_nDiatrdParent = reader->ReadUInt32();
unsigned int flag = reader->ReadUInt32();
m_fInkAtn = GETBIT(flag, 1);
}
return static_cast<ByteStructure*>(newObject);
}
}

View File

@ -32,6 +32,7 @@
#pragma once
#include "ByteStructure.h"
#include "DateAndTime.h"
namespace DocFileFormat
{
@ -72,7 +73,7 @@ namespace DocFileFormat
return (nWordVersion > 0) ? STRUCTURE_SIZE_OLD : STRUCTURE_SIZE;
}
AnnotationReferenceExDescriptor() : m_nDTTM(0), m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
AnnotationReferenceExDescriptor() : m_nDepth(0), m_nDiatrdParent(0), m_fInkAtn(false)
{
}
@ -82,7 +83,7 @@ namespace DocFileFormat
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
unsigned int m_nDTTM;
DateAndTime m_nDTTM;
unsigned int m_nDepth;
unsigned int m_nDiatrdParent;
bool m_fInkAtn;

View File

@ -85,9 +85,11 @@ namespace DocFileFormat
if (author_str)
{
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
XMLTools::XMLAttribute author( L"w:author", FormatUtils::XmlEncode(*author_str));
rPrChange.AppendAttribute( author );
}
XMLTools::XMLAttribute date( L"w:date", _revisionData->Dttm.getString());
rPrChange.AppendAttribute( date );
//convert revision stack
convertSprms( _revisionData->Changes, &rPrChange );

View File

@ -85,10 +85,14 @@ namespace DocFileFormat
for (size_t index = 0; index < count; ++index)
{
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
AnnotationReferenceExDescriptor* atrdPost10 = NULL;
if ((m_document->AnnotationsReferenceExPlex) && (index < m_document->AnnotationsReferenceExPlex->Elements.size()))
{
atrdPost10 = static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]);
}
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
if (atrdPre10->m_BookmarkId < 0)
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
{
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 + count + 1024 ));
}
@ -98,21 +102,14 @@ namespace DocFileFormat
}
if (atrdPost10)
{
//!!!TODO!!!
/*//ATRDpost10 is optional and not saved in all files
if (doc.AnnotationReferenceExtraTable != null &&
doc.AnnotationReferenceExtraTable.Count > index)
{
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
atrdPost10.Date.Convert(new DateMapping(_writer));
}*/
m_pXmlWriter->WriteAttribute( L"w:date", atrdPost10->m_nDTTM.getString());
}
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
{
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
}
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
m_pXmlWriter->WriteAttribute( L"w:initials", FormatUtils::XmlEncode(atrdPre10->m_UserInitials));

View File

@ -83,6 +83,14 @@ namespace DocFileFormat
//throw new ByteParseException("Cannot parse the struct DTTM, the length of the struct doesn't match");
}
}
std::wstring getString()
{
return std::to_wstring(yr) + L"-" + (mon < 9 ? L"0" : L"" ) + std::to_wstring(mon) + L"-" +
(dom < 9 ? L"0" : L"" ) + std::to_wstring(dom) + L"T" +
(hr < 9 ? L"0" : L"" ) + std::to_wstring(hr) + L":" +
(mint < 9 ? L"0" : L"" )+ std::to_wstring(mint) + L"Z";
}
#if defined(_WIN32) || defined(_WIN64)
SYSTEMTIME ToSYSTEMTIME()
{

View File

@ -406,8 +406,8 @@ namespace DocFileFormat
//if it's a inserted run
m_pXmlWriter->WriteNodeBegin(L"w:ins", true);
m_pXmlWriter->WriteAttribute(L"w:author", FormatUtils::XmlEncode(*author));
m_pXmlWriter->WriteAttribute(L"w:date", FormatUtils::XmlEncode(rev.Dttm.getString()));
m_pXmlWriter->WriteNodeEnd(L"", true, false);
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
}
//start run
@ -1079,7 +1079,15 @@ namespace DocFileFormat
else if ((m_document->AnnotationsReferencePlex) && (_commentNr <= m_document->AnnotationsReferencePlex->Elements.size()))
{
m_pXmlWriter->WriteNodeBegin( L"w:commentReference", true );
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( _commentNr++ ));
int index = _commentNr++;
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index - 1]);
if (atrdPre10->m_BookmarkId < 0)
index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(index));
m_pXmlWriter->WriteNodeEnd( L"", true );
}
}
@ -1792,7 +1800,7 @@ namespace DocFileFormat
if (m_document->AnnotStartEndCPs[i].second == cp)
{
result = writeAnnotationEnd(i + 1);
_commentNr = i + 1;
//_commentNr = i + 1;
}
}

View File

@ -89,7 +89,7 @@ namespace DocFileFormat
GroupContainer* group = static_cast<GroupContainer*>(groupChild);
if (group)
{
group->Index = i;
group->Index = (int)i;
}
}
else if (ShapeContainer::TYPE_CODE_0xF004 == groupChild->TypeCode)

View File

@ -1809,7 +1809,7 @@ namespace DocFileFormat
//append size and position ...
//if (m_pSpa->fAnchorLock)//это возможность смены привязки , а не ее тип
if (m_pSpa->bx == TEXT && m_pSpa->by == TEXT)
if (m_isInlineShape)/*m_pSpa->bx == TEXT && m_pSpa->by == TEXT*/
{
// appendStyleProperty( style, L"position", L"static" );
}

View File

@ -84,7 +84,7 @@ namespace DocFileFormat
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
IndividualFootnotesPlex(NULL), FootnoteReferenceCharactersPlex(NULL), IndividualEndnotesPlex(NULL),
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), AnnotationsFieldsPlex(NULL),
AnnotationsReferencePlex(NULL), AnnotationsReferenceExPlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
@ -353,7 +353,7 @@ namespace DocFileFormat
TextboxIndividualPlex = new Plex<FTXBXS> (FTXBXS::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcftxbxTxt, FIB->m_FibWord97.lcbPlcftxbxTxt, nWordVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed, FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
SectionPlex = new Plex<SectionDescriptor> (SectionDescriptor::GetSize(nWordVersion), TableStream, FIB->m_FibWord97.fcPlcfSed,FIB->m_FibWord97.lcbPlcfSed, nWordVersion);
BookmarkStartPlex = new Plex<BookmarkFirst> (BookmarkFirst::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkf, FIB->m_FibWord97.lcbPlcfBkf, nWordVersion);
BookmarkEndPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBkl, FIB->m_FibWord97.lcbPlcfBkl, nWordVersion);
@ -387,10 +387,13 @@ namespace DocFileFormat
}
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, nWordVersion);
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, nWordVersion);
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, nWordVersion);
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, nWordVersion);
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, nWordVersion);
AnnotationsFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldAtn, FIB->m_FibWord97.lcbPlcfFldAtn, nWordVersion);
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, nWordVersion);
if (m_pCallFunc)
@ -872,6 +875,7 @@ namespace DocFileFormat
RELEASEOBJECT(FootnoteDocumentFieldsPlex);
RELEASEOBJECT(EndnoteDocumentFieldsPlex);
RELEASEOBJECT(HeadersAndFootersDocumentFieldsPlex);
RELEASEOBJECT(AnnotationsFieldsPlex);
RELEASEOBJECT(HeaderStoriesPlex);
RELEASEOBJECT(IndividualCommentsPlex);
RELEASEOBJECT(AnnotationsReferencePlex);

View File

@ -224,6 +224,7 @@ namespace DocFileFormat
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
Plex<FieldCharacter> *AnnotationsFieldsPlex;
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
Plex<AnnotationReferenceExDescriptor> *AnnotationsReferenceExPlex;
Plex<EmptyStructure> *AutoTextPlex;

View File

@ -2,20 +2,17 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "..\..\ASCOfficeXlsFile2\source\win32\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"

View File

@ -2624,7 +2624,7 @@ int Binary_tblPrReader::ReadTrPrChange(BYTE type, long length, void* poResult)
int res = c_oSerConstants::ReadOk;
TrackRevision* pTrackRevision = static_cast<TrackRevision*>(poResult);
READ1_TRACKREV(type, length, pTrackRevision)
else if (c_oSerProp_RevisionType::tblPrChange == type)
else if (c_oSerProp_RevisionType::trPrChange == type)
{
pTrackRevision->trPr = new NSStringUtils::CStringBuilder();
READ2_DEF(length, res, this->Read_RowPr, pTrackRevision->trPr);

View File

@ -188,7 +188,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
if ((0 == expr.find(L"KAVYCHKA")) && (expr.length() - 8 == expr.rfind(L"KAVYCHKA") ))
return;
boost::wregex re(L"([:$!])+");
boost::wregex re(L"(([:$!])+)|(\\S+\\d+)");
boost::wsmatch result;
bool b = boost::regex_search(expr, result, re);

View File

@ -1071,7 +1071,7 @@ void docx_conversion_context::process_styles()
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
_Wostream << L"<w:name w:val=\"" << displayName << L"\"/>";
_Wostream << L"<w:name w:val=\"" << XmlUtils::EncodeXmlString(displayName) << L"\"/>";
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
{

View File

@ -462,7 +462,9 @@ void odf_drawing_context::end_group()
impl_->current_group_ = impl_->group_list_.back()->prev_group;
impl_->group_list_.pop_back();
impl_->current_level_.pop_back();
if (!impl_->current_level_.empty())
impl_->current_level_.pop_back();
}
@ -2373,6 +2375,7 @@ void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring &
}
void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor)
{
if (hexColor.empty()) return;
if (impl_->current_drawing_state_.elements_.empty())return;
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);

View File

@ -240,14 +240,14 @@ void odf_number_styles_context::set_odf_context(odf_conversion_context * Context
}
void odf_number_styles_context::create(int oox_num_fmt, std::wstring formatCode)
{
if (oox_num_fmt <164)return create_default(oox_num_fmt,formatCode);
if (oox_num_fmt < 164) return create_default(oox_num_fmt, formatCode);
number_format_state state;
state.oox_num_fmt = oox_num_fmt;
state.style_name = std::wstring(L"NF1000") + boost::lexical_cast<std::wstring>( number_format_array_.size()+1);
state.ods_type = office_value_type::Custom;
state.language_code=0;
state.language_code = 0;
//////////////////////////////
@ -259,7 +259,7 @@ void odf_number_styles_context::create(int oox_num_fmt, std::wstring formatCode)
}
number_format_array_.push_back(state);
named_link_map_[oox_num_fmt] = number_format_array_.size() - 1;
named_link_map_[oox_num_fmt] = (int)number_format_array_.size() - 1;
detect_format(number_format_array_.back());
}
@ -271,8 +271,14 @@ void odf_number_styles_context::create_default(int oox_num_fmt, std::wstring for
state.oox_num_fmt = oox_num_fmt;
state.ods_type = office_value_type::Custom;
state.style_name = std::wstring(L"NF1000") + boost::lexical_cast<std::wstring>( number_format_array_.size()+1);
state.language_code=0;
state.language_code = 0;
if (oox_num_fmt == 0 && formatCode.empty())
{
//general
}
else
state.style_name = std::wstring(L"NF1000") + boost::lexical_cast<std::wstring>( number_format_array_.size()+1);
switch (oox_num_fmt)
{
@ -342,7 +348,7 @@ void odf_number_styles_context::create_default(int oox_num_fmt, std::wstring for
////////////////////////////////////////////
number_format_array_.push_back(state);
named_link_map_[oox_num_fmt] = number_format_array_.size() - 1;
named_link_map_[oox_num_fmt] = (int)number_format_array_.size() - 1;
detect_format(number_format_array_.back());
@ -355,7 +361,7 @@ number_format_state & odf_number_styles_context::add_or_find(int oox_num_fmt, st
}
else
{
create(oox_num_fmt,formatCode);
create(oox_num_fmt, formatCode);
return number_format_array_.back();
}
}
@ -434,7 +440,7 @@ void odf_number_styles_context::create_numbers(number_format_state & state, offi
if (std::wstring::npos != splits[i].find(L"\""))
{
bText = true;
indText = i;
indText = (int)i;
break;
}
}
@ -442,7 +448,7 @@ void odf_number_styles_context::create_numbers(number_format_state & state, offi
{
if (i != indText)
{
indNumber = i;
indNumber = (int)i;
break;
}
}

View File

@ -601,15 +601,23 @@ void odf_table_context::set_cell_row_span(int spanned)
else
{
int col = impl_->current_table().current_column - 1;
odf_column_state & state = impl_->current_table().columns[col];
if (col < (int)impl_->current_table().columns.size())
{
odf_column_state & state = impl_->current_table().columns[col];
state.spanned_row_cell.push_back(impl_->current_table().cells.back().elm);
state.spanned_row_cell.push_back(impl_->current_table().cells.back().elm);
}
}
}
void odf_table_context::set_cell_row_span_restart()
{
int col = impl_->current_table().current_column - 1;
if (col >= (int)impl_->current_table().columns.size())
return;
odf_column_state & state = impl_->current_table().columns[col];
unsigned int sz = (unsigned int)state.spanned_row_cell.size();

View File

@ -77,7 +77,7 @@ std::wstring convert_date(const std::wstring & oox_date)
{
return oox_date;
}
boost::gregorian::date date_ = boost::gregorian::date(1900, 1, 1) + boost::gregorian::date_duration(iDate-2);
boost::gregorian::date date_ = boost::gregorian::date(1900, 1, 1) + boost::gregorian::date_duration(iDate - 2);
////to for example, "1899-12-31T05:37:46.66569
std::wstring date_str;
@ -110,19 +110,18 @@ std::wstring convert_time(const std::wstring & oox_time)
}
//PT12H15M42S
int hours=0, minutes=0;
double sec=0;
int hours = 0, minutes = 0;
double sec = 0;
//todooo ПЕРЕПИСАТЬ !!!
//boost::posix_time::time_duration day(24, 0, 0);
//
//double millisec = day.total_milliseconds() * dTime;
boost::posix_time::time_duration day(24, 0, 0);
double millisec = day.total_milliseconds() * dTime;
//sec = millisec /1000.;
//hours = sec/60./60.;
//minutes = (sec - (hours * 60 * 60))/60.;
//sec = sec - (hours *60 + minutes) * 60.;
sec = millisec /1000.;
hours = sec/60./60.;
minutes = (sec - (hours * 60 * 60))/60.;
sec = sec - (hours *60 + minutes) * 60.;
int sec1 = sec;

View File

@ -102,7 +102,7 @@ namespace utils
f = false;
else
v += 1;
res += v * mul;
res += (int)(v * mul);
mul *= r;
}
return res;

View File

@ -748,7 +748,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
odf_context()->drawing_context()->set_no_fill();
odf_context()->drawing_context()->end_line_properties();
odf_context()->drawing_context()->end_text_box();
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
odf_context()->drawing_context()->end_group();
@ -1689,7 +1689,9 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
if (size_pt < 0.001 && odf_list_type == 1000)
{
odf_writer::style_text_properties * text_props = odf_context()->styles_context()->last_state(odf_types::style_family::Paragraph)->get_text_properties();
odf_writer::odf_style_state_ptr state = odf_context()->styles_context()->last_state(odf_types::style_family::Paragraph);
odf_writer::style_text_properties *text_props = state ? state->get_text_properties() : NULL;
if (text_props && text_props->content_.fo_font_size_)
{
size_pt = text_props->content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt);
@ -1977,11 +1979,11 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
odf_writer::odf_drawing_context *drawing = odf_context()->drawing_context();
if (drawing) //from styles drawing impossible( ... todoooo ???
{
if ((oox_run_pr->Fill.is<PPTX::Logic::GradFill>()) ||
(oox_run_pr->ln.IsInit() /*&& (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() != OOX::et_a_noFill)*/))
{
drawing->change_text_box_2_wordart();
}
//if ((oox_run_pr->Fill.is<PPTX::Logic::GradFill>()) ||
// (oox_run_pr->ln.IsInit() /*&& (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() != OOX::et_a_noFill)*/))
//{
// drawing->change_text_box_2_wordart();
//}
if (drawing->is_wordart())
{
@ -2014,7 +2016,8 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
if (oox_run_pr->ln.is_init())
{
drawing->start_line_properties(true);
if (drawing)
drawing->start_line_properties(true);
if (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() == OOX::et_a_solidFill )
{
solidFill = &oox_run_pr->ln->Fill.as<PPTX::Logic::SolidFill>();

View File

@ -310,8 +310,8 @@ void PptxConverter::convert_slides()
bool bShowLayoutMasterAnim = slide->Layout->showMasterPhAnim.get_value_or(true);
bool bShowLayoutMasterSp = slide->Layout->showMasterSp.get_value_or(true);
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
else if ((current_theme) && (current_theme->name.IsInit())) master_style_name = current_theme->name.get();
master_style_name += L"_" ;

View File

@ -502,15 +502,18 @@ namespace PPTX
{
if (parentFileIs<Slide>())
{
parentFileAs<Slide>().Layout->GetLevelUp(this);
if (parentFileAs<Slide>().Layout.IsInit())
parentFileAs<Slide>().Layout->GetLevelUp(this);
}
else if(parentFileIs<SlideLayout>())
{
parentFileAs<SlideLayout>().Master->GetLevelUp(this);
if (parentFileAs<SlideLayout>().Master.IsInit())
parentFileAs<SlideLayout>().Master->GetLevelUp(this);
}
else if(parentFileIs<NotesSlide>())
{
parentFileAs<NotesSlide>().master_->GetLevelUp(this);
if (parentFileAs<NotesSlide>().master_.IsInit())
parentFileAs<NotesSlide>().master_->GetLevelUp(this);
}
}
}

View File

@ -279,7 +279,7 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
}
else if (( st_inline == m_eAnchorTypeShape || st_none == m_eAnchorTypeShape) && !m_bIsOle)
{
if( NULL != m_oPicture && m_nShapeType == ODRAW::sptPictureFrame)
if( NULL != m_oPicture && m_nShapeType == ODRAW::sptPictureFrame && !m_bInGroup)
{
if (m_oPicture->m_nWidth == PROP_DEF)
{
@ -361,7 +361,13 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
//sResult += L"{\\sp{\\sn fLockRotation}{\\sv 1}}";
//picture
if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 3 || m_nFillType == 9)
if( NULL != m_oPicture && m_nShapeType == ODRAW::sptPictureFrame && m_bInGroup)
{
sResult += L"{\\sp{\\sn pib}{\\sv ";
sResult += m_oPicture->RenderToRtf( oRenderParameter );
sResult += L"}}";
}
else if( NULL != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 3 || m_nFillType == 9)
{
sResult += L"{\\sp{\\sn fillBlip}{\\sv ";
sResult += m_oPicture->RenderToRtf( oRenderParameter );

View File

@ -343,6 +343,14 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\BinaryReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\BinaryWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of Dimensions record in BIFF8
class Dimensions: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Dimensions)
@ -47,11 +45,10 @@ public:
~Dimensions();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeDimensions;
static const ElementType type = typeDimensions;
int serialize(std::wostream & stream);

View File

@ -40,18 +40,15 @@ DropDownObjIds::DropDownObjIds()
{
}
DropDownObjIds::~DropDownObjIds()
{
}
BaseObjectPtr DropDownObjIds::clone()
{
return BaseObjectPtr(new DropDownObjIds(*this));
}
void DropDownObjIds::readFields(CFRecord& record)
{
FrtHeader frtHeader(rt_DropDownObjIds);

View File

@ -32,13 +32,10 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/DropDownObjId.h>
#include "../Biff_structures/DropDownObjId.h"
namespace XLS
{
// Logical representation of DropDownObjIds record in BIFF8
class DropDownObjIds: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(DropDownObjIds)
@ -48,7 +45,6 @@ public:
~DropDownObjIds();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -58,12 +58,15 @@ void ExternSheet::readFields(CFRecord& record)
if (record.getGlobalWorkbookInfo()->Version < 0x0600)
{
unsigned char type;
unsigned char size;
ShortXLAnsiString stName;
record >> type >> stName;
record >> size >> type;
LPAnsiStringNoCch stName(size);
record >> stName;
name = stName.value();
//int type = stName.value().substr(0, 1).c_str()[0];
//if (!name.empty())
// record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);

View File

@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/LongRGB.h>
#include "../Biff_structures/LongRGB.h"
namespace XLS
{
// Logical representation of LineFormat record in BIFF8
class LineFormat: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(LineFormat)
@ -48,7 +46,6 @@ public:
~LineFormat();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -179,10 +179,7 @@ void Obj::readFields(CFRecord& record)
old_version.anchor->loadFields(record);
record >> nMacrosSize;
record.skipNunBytes(2);
record >> nNameLen;
record.skipNunBytes(2);
record.skipNunBytes(6);
if(OBJ_Line == cmo.ot)
{
@ -190,6 +187,26 @@ void Obj::readFields(CFRecord& record)
record >> old_version.flag;
record >> old_version.flag2;
}
else if(OBJ_DropdownList == cmo.ot)
{
old_version.bFill = true;
record >> old_version.fill;
record >> old_version.line;
record.skipNunBytes(6);
short iVal, iMin, iMax, dInc, dPage, fHoriz, dxScroll, grbit, ifnt;
record >> iVal >> iMin >> iMax >> dInc >> dPage >> fHoriz >> dxScroll >> grbit;
record.skipNunBytes(18);
record >> ifnt;
record.skipNunBytes(14);
short xLeft, yTop, xRight, yBot;
record >> xLeft >> yTop >> xRight >> yBot;
record.skipNunBytes(4);
}
else
{
old_version.bFill = true;
@ -261,9 +278,38 @@ void Obj::readFields(CFRecord& record)
old_version.name = txO->name;
}
else if(OBJ_DropdownList == cmo.ot)
{
record >> old_version.name;
short cbFmla1, cbFmla2, cbFmla3;
ObjectParsedFormula fmla1, fmla2, fmla3;
record >> cbFmla1;
if (cbFmla1 > 0)
{
fmla1.load(record);
}
record >> cbFmla2;
if (cbFmla2 > 0)
{
fmla2.load(record);
}
record >> cbFmla3;
if (cbFmla3 > 0)
{
fmla3.load(record);
}
short cLines, iSel, flag1, flag2, cLine, dxMin;
record >> cLines >> iSel >> flag1;
record.skipNunBytes(2);
record >> flag2 >> cLine >> dxMin;
//record.skipNunBytes(2);
}
else
{
if (nNameLen > 0)
//if (nNameLen > 0)
{
record >> old_version.name;
}

View File

@ -95,8 +95,8 @@ public:
bool bFill = false;
ShortXLAnsiString name;
_UINT32 fill = 0;
_UINT32 line = 0;
_UINT32 fill = 0;//(icvBack, icvFore, fls, fAuto)
_UINT32 line = 0;//(icv, lns, lnw, fAuto)
_UINT16 flag = 0;
_UINT16 flag2 = 0;
}old_version;

View File

@ -50,7 +50,6 @@ BaseObjectPtr Sort::clone()
return BaseObjectPtr(new Sort(*this));
}
void Sort::readFields(CFRecord& record)
{
unsigned short flags;
@ -68,20 +67,52 @@ void Sort::readFields(CFRecord& record)
unsigned char cchKey2;
unsigned char cchKey3;
record >> cchKey1 >> cchKey2 >> cchKey3;
if(cchKey1)
if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
{
stKey1.setSize(cchKey1);
record >> stKey1;
XLUnicodeStringNoCch stKey1_, stKey2_, stKey3_;
if(cchKey1)
{
stKey1_.setSize(cchKey1);
record >> stKey1_;
stKey1 = stKey1_.value();
}
if(cchKey2)
{
stKey2_.setSize(cchKey2);
record >> stKey2_;
stKey2 = stKey2_.value();
}
if(cchKey3)
{
stKey3_.setSize(cchKey3);
record >> stKey3_;
stKey3 = stKey3_.value();
}
}
if(cchKey2)
else
{
stKey2.setSize(cchKey2);
record >> stKey2;
}
if(cchKey3)
{
stKey3.setSize(cchKey3);
record >> stKey3;
LPAnsiStringNoCch stKey1_, stKey2_, stKey3_;
if(cchKey1)
{
stKey1_.setSize(cchKey1);
record >> stKey1_;
stKey1 = stKey1_.value();
}
if(cchKey2)
{
stKey2_.setSize(cchKey2);
record >> stKey2_;
stKey2 = stKey2_.value();
}
if(cchKey3)
{
stKey3_.setSize(cchKey3);
record >> stKey3_;
stKey3 = stKey3_.value();
}
}
record.skipNunBytes(1); // reserved
}

View File

@ -63,9 +63,9 @@ public:
_INT16 iOrder;
bool fAltMethod;
XLUnicodeStringNoCch stKey1;
XLUnicodeStringNoCch stKey2;
XLUnicodeStringNoCch stKey3;
std::wstring stKey1;
std::wstring stKey2;
std::wstring stKey3;
};
} // namespace XLS

View File

@ -36,13 +36,11 @@
namespace XLS
{
BiffStructurePtr DropDownObjId::clone()
{
return BiffStructurePtr(new DropDownObjId(*this));
}
void DropDownObjId::load(CFRecord& record)
{
record >> id;

View File

@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record);
ObjId id;
};

View File

@ -74,7 +74,7 @@ public:
unsigned short nElems, nElemsAlloc;
unsigned short cbElem;
int pos1 = record.getRdPtr();
size_t pos1 = record.getRdPtr();
record >> nElems >> nElemsAlloc >> cbElem;

View File

@ -59,7 +59,7 @@ public:
XLS::BiffStructurePtr clone()
{
return XLS::BiffStructurePtr(new OfficeArtBlip(recType));
return XLS::BiffStructurePtr(new OfficeArtBlip((unsigned short)recType));
}
static const XLS::ElementType type = XLS::typeOfficeArtBlip;

View File

@ -131,7 +131,7 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
ptg_stack.push(strRange + range_ref);
}
}
if (ixti & 0xfff0 != 0xfff0)
if (ixti < global_info->arXti_External.size())
{
std::wstring link = global_info->arXti_External[ixti].link;
if (!link.empty() && !range_ref.empty())

View File

@ -80,13 +80,13 @@ void PtgFuncVar::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool
{
arguments += ptg_stack.top();
ptg_stack.pop();
for(unsigned char i = 0; i < nparams - 1 ; ++i)
for(unsigned char i = 0; i < nparams - 1 && !ptg_stack.empty(); ++i)
{
arguments = ptg_stack.top() + L',' + arguments;
ptg_stack.pop();
}
}
if(0xFF == tab.getIndex() && ptg_stack.size() > 0) // user-defined function
if(0xFF == tab.getIndex()&& !ptg_stack.empty()) // user-defined function
{
func_name = ptg_stack.top();

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of AUTOFILTER union of records
class AUTOFILTER: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(AUTOFILTER)
@ -57,7 +55,7 @@ public:
std::vector<BaseObjectPtr> m_arSORTDATA12;
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr;
GlobalWorkbookInfoPtr global_info_;
};

View File

@ -42,7 +42,6 @@
namespace XLS
{
AUTOFILTER::AUTOFILTER()
{
}
@ -87,11 +86,11 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc)
return false;
}
pGlobalWorkbookInfoPtr = proc.getGlobalWorkbookInfo();
global_info_ = proc.getGlobalWorkbookInfo();
m_AutoFilterInfo = elements_.back();
elements_.pop_back();
int count = proc.repeated<Parenthesis_AUTOFILTER_1>(0, 0);
while(count > 0)
{
@ -139,13 +138,13 @@ int AUTOFILTER::serialize(std::wostream & stream)
AutoFilterInfo *info = dynamic_cast<AutoFilterInfo*>(m_AutoFilterInfo.get());
std::map<std::wstring, std::vector<std::wstring>>::iterator it = pGlobalWorkbookInfoPtr->mapDefineNames.find(L"_xlnm._FilterDatabase");
std::map<std::wstring, std::vector<std::wstring>>::iterator it = global_info_->mapDefineNames.find(L"_xlnm._FilterDatabase");
if (it == pGlobalWorkbookInfoPtr->mapDefineNames.end()) return 0;
if (it == global_info_->mapDefineNames.end()) return 0;
int count_columns = info->cEntries;
size_t ind = pGlobalWorkbookInfoPtr->current_sheet;
size_t ind = global_info_->current_sheet;
std::wstring ref;
if (ind < it->second.size() && ind >= 0)
@ -159,7 +158,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
}
if (ref.empty()) return 0;
std::wstring sheet_name = ind <= pGlobalWorkbookInfoPtr->sheets_info.size() ? pGlobalWorkbookInfoPtr->sheets_info[ind-1].name : L"";
std::wstring sheet_name = ind <= global_info_->sheets_info.size() ? global_info_->sheets_info[ind-1].name : L"";
if (!sheet_name.empty())
{
int pos = ref.find(sheet_name);

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of AXISPARENT union of records
class AXISPARENT: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(AXISPARENT)

View File

@ -31,9 +31,12 @@
*/
#include "CHART.h"
#include <Logic/Biff_records/BOF.h>
#include <Logic/ChartSheetSubstream.h>
#include <Logic/Biff_records/Continue.h>
#include "../ChartSheetSubstream.h"
#include "../Biff_records/BOF.h"
#include "../Biff_records/Continue.h"
#include "../Biff_unions/CELLTABLE.h"
#include "../Biff_structures/CellRangeRef.h"
#include "../Biff_records/EOF.h"
namespace XLS
{
@ -51,12 +54,17 @@ BaseObjectPtr CHART::clone()
const bool CHART::loadContent(BinProcessor& proc)
{
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
unsigned short ss_type;
if(!proc.getNextSubstreamType(ss_type) || BOF::st_Chart != ss_type)
{
return false;
}
ChartSheetSubstream chart_sheet(-1);
size_t tmp_index_table = global_info->sheets_info.size(); //if present table
ChartSheetSubstream chart_sheet(tmp_index_table);
if(!proc.mandatory(chart_sheet))
{
return false;
@ -82,6 +90,20 @@ const bool CHART::loadContent(BinProcessor& proc)
elements_.pop_back();
count--;
}
//chart_sourcedata_missing_import_biff5.xls
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
std::vector<CellRangeRef> shared_formulas_locations;
CELLTABLE cell_table_temlate(shared_formulas_locations);
if (proc.optional(cell_table_temlate))
{
//cash table
}
if (proc.optional<EOF_T>())
{//???
}
}
return true;
}

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of CRT union of records
class CRT: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(CRT)

View File

@ -31,9 +31,9 @@
*/
#include "INTERFACE.h"
#include <Logic/Biff_records/InterfaceHdr.h>
#include <Logic/Biff_records/Mms.h>
#include <Logic/Biff_records/InterfaceEnd.h>
#include "../Biff_records/InterfaceHdr.h"
#include "../Biff_records/Mms.h"
#include "../Biff_records/InterfaceEnd.h"
namespace XLS
{

View File

@ -95,7 +95,7 @@ const bool IVAXIS::loadContent(BinProcessor& proc)
elements_.pop_back();
}
if (proc.mandatory<AxcExt>()) // 4-th place
if (proc.optional<AxcExt>()) // 4-th place
{
m_AxcExt = elements_.back();
elements_.pop_back();
@ -109,7 +109,7 @@ const bool IVAXIS::loadContent(BinProcessor& proc)
m_CatLab = elements_.back();
elements_.pop_back();
}
if (proc.mandatory<AXS>())
if (proc.optional<AXS>())
{
m_AXS = elements_.back();
elements_.pop_back();

View File

@ -134,7 +134,14 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
m_Series = elements_.back();
elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back(); //skip
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
if (proc.optional<Begin>()) elements_.pop_back(); //skip
}
else
{
if (proc.mandatory<Begin>()) elements_.pop_back(); //skip
}
count = proc.repeated<AI>(4, 4);
while(count > 0 && elements_.size() > 0)
@ -174,7 +181,7 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
count = elements_.size();
while(count > 0)
{
if ("SerParent" == elements_.front()->getClassName())
if ("SerParent" == elements_.front()->getClassName())
m_SerParent = elements_.front();
else if ("SerToCrt" == elements_.front()->getClassName())
m_SerToCrt = elements_.front();
@ -224,7 +231,14 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
m_SeriesEx.push_back(ex);
}
if (proc.mandatory<End>()) elements_.pop_back(); //skip
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
if (proc.optional<End>()) elements_.pop_back(); //skip
}
else
{
if (proc.mandatory<End>()) elements_.pop_back(); //skip
}
return true;
}

View File

@ -113,9 +113,18 @@ const bool SS::loadContent(BinProcessor& proc)
m_DataFormat = elements_.back();
elements_.pop_back();
if (proc.mandatory<Begin>())
bool bRead = false;
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
bRead = true;
}
if (proc.optional<Begin>()) //при biff5 может быть или нет, biff8 - обязано быть
{
bRead = true;
elements_.pop_back();
}
if (bRead)
{
while (true)
{
CFRecordType::TypeId type = proc.getNextRecordType();

View File

@ -143,7 +143,7 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
{
CFRecordType::TypeId type = proc.getNextRecordType();
//Log::warning(CFRecordType::getStringById(type));
Log::warning(CFRecordType::getStringById(type));
if (type == rt_NONE || type == rt_BOF ) break;
if (type == rt_EOF)

View File

@ -54,6 +54,9 @@
#include "Biff_records/List12.h"
#include "Biff_records/PLV.h"
#include "Biff_records/CFEx.h"
#include "Biff_records/Country.h"
#include "Biff_records/WsBool.h"
#include "Biff_records/ExternSheet.h"
#include "Biff_unions/BACKGROUND.h"
#include "Biff_unions/BIGNAME.h"
@ -243,7 +246,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
if (proc.optional(cell_table_temlate))
{
if (m_CELLTABLE)
{
{//Daily Flash Report - Demand_Store_427.xls
CELLTABLE *cell_table = dynamic_cast<CELLTABLE*>(elements_.back().get());
cell_table->isConcatinate_ = true;
}
@ -264,13 +267,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
case rt_Obj:
case rt_MsoDrawing:
{
OBJECTS objects(false);
if (proc.optional(objects))
OBJECTS objects_template(false);
if (proc.optional(objects_template))
{
if (!m_OBJECTS) m_OBJECTS = elements_.back();
else
{
Log::warning(L"Double set OBJECTS!!!");
OBJECTS *objects = dynamic_cast<OBJECTS*>(elements_.back().get());
OBJECTS *prev_objects = dynamic_cast<OBJECTS*>(m_OBJECTS.get());
prev_objects->elements_.insert(prev_objects->elements_.end(), objects->elements_.begin(), objects->elements_.end());
}
elements_.pop_back();
}
@ -485,6 +493,51 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count--;
}
}break;
case rt_Window1: //biff5
{
count = proc.repeated<Window1>(0, 0);
while(count > 0)
{
//m_arWindow1.insert(m_arWindow1.begin(), elements_.back());
elements_.pop_back();
count--;
}
}break;
case rt_Country: //biff5
{
if (proc.optional<Country>())
{
Country *Country_ = dynamic_cast<Country*>(elements_.back().get());
if (Country_)
{
int countryDef = Country_->iCountryDef;
int countryWinIni = Country_->iCountryWinIni;
global_info_->CodePage;
}
//m_Country = elements_.back();
elements_.pop_back();
}
}break;
case rt_WsBool: //biff5
{
bool is_dialog;
WsBool wsbool_template(is_dialog);
if (proc.optional(wsbool_template)) // The most interesting
{
//m_WsBool = elements_.back();
elements_.pop_back();
}
}break;
case rt_ExternSheet: //biff5
{
if (proc.optional<ExternSheet>())
{
//m_ExternSheet = elements_.back();
elements_.pop_back();
}
}break;
default://unknown .... skip
{
proc.SkipRecord();

View File

@ -300,8 +300,8 @@ private:
{
std::vector<std::wstring> oArrayParams;
NSStringUtils::ParseString(_T(" "), strFormula, oArrayParams);
int nCount = oArrayParams.size();
if (0 >= nCount)
size_t nCount = oArrayParams.size();
if (nCount == 0)
return;
bool bRes = true;
@ -387,14 +387,14 @@ private:
}
void AddFormula(std::wstring strFormula)
{
CFormula oFormula(m_arFormulas.size());
CFormula oFormula((int)m_arFormulas.size());
oFormula.FromString(strFormula, m_lShapeWidth, m_lShapeHeight);
m_arFormulas.push_back(oFormula);
m_arResults.push_back(0xFFFFFFFF);
}
void AddFormula(CFormula oFormula)
{
oFormula.m_lIndex = m_arFormulas.size();
oFormula.m_lIndex = (int)m_arFormulas.size();
m_arFormulas.push_back(oFormula);
m_arResults.push_back(0xFFFFFFFF);
}

View File

@ -526,7 +526,7 @@ namespace NSCustomShapesConvert
if (NULL == ppArray)
return;
int nCount = this->m_arPoints.size();
size_t nCount = this->m_arPoints.size();
nCountOut = 2 * (nCount + 1);
@ -540,7 +540,7 @@ namespace NSCustomShapesConvert
if (bR)
{
for (int nIndex = 0; nIndex < nCount; ++nIndex)
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
*pBuffer = (this->m_arPoints[nIndex].dX + pointCur.dX); ++pBuffer;
*pBuffer = (this->m_arPoints[nIndex].dY + pointCur.dY); ++pBuffer;
@ -554,7 +554,7 @@ namespace NSCustomShapesConvert
}
else
{
for (int nIndex = 0; nIndex < nCount; ++nIndex)
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
*pBuffer = this->m_arPoints[nIndex].dX; ++pBuffer;
*pBuffer = this->m_arPoints[nIndex].dY; ++pBuffer;
@ -592,7 +592,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray)
{
pRenderer->PathCommandLinesTo(pArray, nCount /*this->m_arPoints.size()*/);
pRenderer->PathCommandLinesTo(pArray, (int)nCount /*this->m_arPoints.size()*/);
}
break;
@ -605,7 +605,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray)
{
pRenderer->PathCommandCurvesTo (pArray, nCount/*this->m_arPoints.size()*/);
pRenderer->PathCommandCurvesTo (pArray, (int)nCount/*this->m_arPoints.size()*/);
}
break;
@ -633,7 +633,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray)
{
pRenderer->PathCommandLinesTo(pArray, nCount/*this->m_arPoints.size()*/);
pRenderer->PathCommandLinesTo(pArray, (int)nCount/*this->m_arPoints.size()*/);
}
break;
@ -646,7 +646,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray)
{
pRenderer->PathCommandCurvesTo(pArray, nCount/*this->m_arPoints.size()*/);
pRenderer->PathCommandCurvesTo(pArray, (int)nCount/*this->m_arPoints.size()*/);
}
break;
}
@ -794,8 +794,8 @@ namespace NSCustomShapesConvert
bool bIsX = true;
CheckLastPoint(pRenderer, pointCur);
int nCount = this->m_arPoints.size();
for (int nIndex = 0; nIndex < nCount; ++nIndex)
size_t nCount = this->m_arPoints.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
double x1 = pointCur.dX;
double y1 = pointCur.dY;
@ -819,8 +819,8 @@ namespace NSCustomShapesConvert
bool bIsX = false;
CheckLastPoint(pRenderer, pointCur);
int nCount = this->m_arPoints.size();
for (int nIndex = 0; nIndex < nCount; ++nIndex)
size_t nCount = this->m_arPoints.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
double x1 = pointCur.dX;
double y1 = pointCur.dY;
@ -847,7 +847,7 @@ namespace NSCustomShapesConvert
if (NULL != pArray)
{
pRenderer->PathCommandLinesTo(pArray, nCount/*this->m_arPoints.size()*/);
pRenderer->PathCommandLinesTo(pArray, (int)nCount/*this->m_arPoints.size()*/);
}
CheckLastPoint(pRenderer, pointCur);
@ -887,7 +887,7 @@ namespace NSCustomShapesConvert
void AddRuler(const RulesType& eType)
{
int lCount = m_arParts.size();
size_t lCount = m_arParts.size();
CPart oPart;
oPart.m_eType = eType;
@ -896,7 +896,7 @@ namespace NSCustomShapesConvert
}
void AddPoint(const double& x, const double& y)
{
int lCount = m_arParts.size();
size_t lCount = m_arParts.size();
if (0 != lCount)
{
CDoublePoint point;

View File

@ -2794,14 +2794,14 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case Formula: return _T("formula"); break;
case Maximum: return _T("min"); break;
case Minimum: return _T("max"); break;
case Number: return _T("num"); break;
case Percent: return _T("percent"); break;
case Percentile:return _T("percentile"); break;
case autoMin: return _T("autoMin"); break;
case autoMax: return _T("autoMax"); break;
case Formula: return _T("formula");
case Maximum: return _T("max");
case Minimum: return _T("min");
case Number: return _T("num");
case Percent: return _T("percent");
case Percentile:return _T("percentile");
case autoMin: return _T("autoMin");
case autoMax: return _T("autoMax");
default : return _T("num");
}
}

View File

@ -94,7 +94,15 @@ void CConditionalFormatValueObject::toXML2(NSStringUtils::CStringBuilder& writer
}
if (!bExtendedWrite)
{
WritingStringNullableAttrEncodeXmlString(L"val", m_oVal, m_oVal.get());
if (m_oVal.IsInit())
{
WritingStringNullableAttrEncodeXmlString(L"val", m_oVal, m_oVal.get());
}
else if (m_oFormula.IsInit())
{
WritingStringAttrString(L"val", m_oFormula->m_sText);
}
}
writer.WriteString(L">");

View File

@ -199,32 +199,28 @@ namespace OOX
{
m_oRef = sRef;
}
void getRowCol(int& nRow, int& nCol) const
bool getRowCol(int& nRow, int& nCol) const
{
bool bRes = false;
nRow = 0;
nCol = 0;
if (m_oRef.IsInit())
{
if (parseRef(m_oRef.get(), nRow, nCol))
{
bRes = true;
nRow--;
nCol--;
}
else
{
nRow = 0;
nCol = 0;
}
}
else if (m_oRow.IsInit() && m_oCol.IsInit())
{
bRes = true;
nRow = m_oRow->GetValue();
nCol = m_oCol->GetValue();
}
else
{
nRow = 0;
nCol = 0;
}
return bRes;
}
void setRowCol(int nRow, int nCol)
{

View File

@ -134,7 +134,7 @@ void ReadMapEntry(POLE::Stream *pStream, ECMACryptFile::_mapEntry & m)
_UINT32 refCount = 0;
pStream->read((unsigned char*)&refCount, 4);
for (int i = 0 ; i < refCount; i++)
for (_UINT32 i = 0 ; i < refCount; i++)
{
ECMACryptFile::_refComponent r;
pStream->read((unsigned char*)&r.type, 4);
@ -151,7 +151,7 @@ std::string DecodeBase64(const std::string & value)
unsigned char *pData = NULL;
std::string result;
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
NSFile::CBase64Converter::Decode(value.c_str(), (int)value.length(), pData, nLength);
if (pData)
{
result = std::string((char*)pData, nLength);
@ -165,7 +165,7 @@ std::string EncodeBase64(const std::string & value)
char *pData = NULL;
std::string result;
NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), (int)value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
if (pData)
{
result = std::string(pData, nLength);
@ -530,7 +530,7 @@ bool WriteStandartEncryptionInfo(unsigned char* data, int &size, _ecmaCryptData
mem_stream.WriteUInt32((_UINT32)cryptData.hashSize);
//int szEncryptedVerifierHash = (ProviderType == 0x0001) ? 0x14 : 0x20; //RC4 | AES(DES) .. md5?
mem_stream.WriteBytes((unsigned char*)cryptData.encryptedVerifierValue.c_str(), cryptData.encryptedVerifierValue.length()/*szEncryptedVerifierHash*/);
mem_stream.WriteBytes((unsigned char*)cryptData.encryptedVerifierValue.c_str(), (int)cryptData.encryptedVerifierValue.length()/*szEncryptedVerifierHash*/);
size = mem_stream.GetPosition();

View File

@ -2963,12 +2963,10 @@ void BinaryWorksheetTableWriter::WriteCell(const OOX::Spreadsheet::CCell& oCell)
{
int nCurPos;
//Ref
if (oCell.isInitRef())
int nRow = 0;
int nCol = 0;
if (oCell.isInitRef() && oCell.getRowCol(nRow, nCol))
{
int nRow = 0;
int nCol = 0;
oCell.getRowCol(nRow, nCol);
// Пишем теперь не строку, а 2 числа (чтобы не парсить на JavaScript, т.к. на C++ быстрее парсинг). Ускорение открытия файла.
nCurPos = m_oBcw.WriteItemStart(c_oSerCellTypes::RefRowCol);
m_oBcw.m_oStream.WriteLONG(nRow);

View File

@ -234,9 +234,8 @@ namespace CSVWriter
INT nRowTmp = 0;
INT nCol = 0;
if (pCell->isInitRef())
if (pCell->isInitRef() && pCell->getRowCol(nRowTmp, nCol))
{
pCell->getRowCol(nRowTmp, nCol);
nRowTmp++;
nCol++;
}