Compare commits

..

11 Commits

Author SHA1 Message Date
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
124 changed files with 1626 additions and 5935 deletions

3
.gitignore vendored
View File

@ -63,6 +63,5 @@ X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
*.zip
*.tar.gz
**/*.build/
*.dat
*.txt
*.log

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

@ -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

@ -47,7 +47,6 @@
#include "../odf/style_graphic_properties.h"
#include "docx_package.h"
#include "xlsx_package.h"
#include "oox_rels.h"
#include "logging.h"
@ -131,7 +130,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
}
//----------------------------------------------------------------------------------------------------------------
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf_document) :
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
last_dump_page_properties_ (true),
next_dump_page_properties_ (false),
page_break_ (false),
@ -153,13 +152,11 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * _odf
delayed_converting_ (false),
process_headers_footers_ (false),
process_comment_ (false),
odf_document_ (_odf_document),
math_context_ (_odf_document->odf_context().fontContainer(), false)
mediaitems_ (OdfDocument->get_folder() ),
math_context_ (OdfDocument->odf_context().fontContainer(), false),
odf_document_ (OdfDocument)
{
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
chart_drawing_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
streams_man_ = streams_man::create(temp_stream_);
streams_man_ = streams_man::create(temp_stream_);
}
docx_conversion_context::~docx_conversion_context()
{
@ -170,7 +167,7 @@ void docx_conversion_context::set_output_document(package::docx_document * docum
}
void docx_conversion_context::set_font_directory(std::wstring pathFonts)
{
mediaitems_->set_font_directory(pathFonts);
mediaitems_.set_font_directory(pathFonts);
}
std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family::type Type)
{
@ -688,14 +685,11 @@ void docx_conversion_context::end_document()
{
output_stream() << L"</w:document>";
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->get_word_files().set_document ( package::simple_element::create(L"document.xml", document_xml_.str()) );
output_document_->get_word_files().set_settings ( package::simple_element::create(L"settings.xml", dump_settings_document()));
output_document_->get_word_files().set_media ( mediaitems_);
output_document_->get_word_files().set_comments ( comments_context_);
output_document_->get_word_files().set_headers_footers( headers_footers_);
package::xl_drawings_ptr drawings = package::xl_drawings::create(chart_drawing_handle_->content());
output_document_->get_word_files().set_drawings(drawings);
output_document_->get_word_files().set_headers_footers( headers_footers_);
package::content_types_file & content_file_ = output_document_->get_content_types_file();
content_file_.set_media( mediaitems_);
@ -1077,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())
{
@ -1834,7 +1828,7 @@ namespace
//слить если есть mediaitems, добавить релсы и обнулить их для основного документа.
rels internal_rels;
Context.get_mediaitems()->dump_rels(internal_rels);
Context.get_mediaitems().dump_rels(internal_rels);
Context.dump_hyperlinks(internal_rels, hyperlinks::document_place);
Context.get_headers_footers().add(styleName, dbgStr, type, internal_rels);

View File

@ -42,7 +42,6 @@
#include "docx_table_context.h"
#include "oox_conversion_context.h"
#include "oox_chart_context.h"
#include "xlsx_drawing_context.h"
#include "headers_footers.h"
#include "hyperlinks.h"
@ -735,7 +734,7 @@ class docx_conversion_context : boost::noncopyable
public:
enum NoteType { noNote, footNote, footNoteRefSet, endNote, endNoteRefSet };
docx_conversion_context(odf_reader::odf_document * _odf_document);
docx_conversion_context(odf_reader::odf_document * OdfDocument);
~docx_conversion_context();
void set_output_document (package::docx_document * document);
@ -888,7 +887,7 @@ public:
styles_map * get_style_map() { return &styles_map_; }
mediaitems_ptr & get_mediaitems() {return mediaitems_;}
mediaitems & get_mediaitems() {return mediaitems_;}
styles_context & get_styles_context() { return styles_context_; }
drawing_context & get_drawing_context() { return drawing_context_; }
comments_context & get_comments_context() { return comments_context_; }
@ -898,9 +897,8 @@ public:
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
forms_context & get_forms_context() { return forms_context_; }
tabs_context & get_tabs_context() { return tabs_context_;}
table_content_context & get_table_content_context() { return table_content_context_;}
xlsx_drawing_context_handle_ptr & get_chart_drawing_handle() { return chart_drawing_handle_;}
table_content_context & get_table_content_context() { return table_content_context_;}
void set_drawing_text_props (const std::wstring &props);
@ -987,8 +985,6 @@ private:
std::wstringstream settings_xml_;
std::wstringstream meta_xml_;
xlsx_drawing_context_handle_ptr chart_drawing_handle_;
styles_context styles_context_;
math_context math_context_;
drawing_context drawing_context_;
@ -1011,7 +1007,7 @@ private:
std::vector<odf_reader::_property> settings_properties_;
hyperlinks hyperlinks_;
mediaitems_ptr mediaitems_;
mediaitems mediaitems_;
std::vector<oox_chart_context_ptr> charts_;
headers_footers headers_footers_;

View File

@ -102,11 +102,7 @@ void word_files::write(const std::wstring & RootPath)
{
embeddings_->write( path );
}
if (drawings_)
{
drawings_->set_main_document(get_main_document());
drawings_->write( path );
}
if (headers_footers_)
{
headers_footers_->write( path );
@ -144,22 +140,22 @@ void word_files::write(const std::wstring & RootPath)
void word_files::update_rels(docx_conversion_context & Context)
{
Context.get_mediaitems()->dump_rels(rels_files_.get_rel_file()->get_rels());
Context.get_mediaitems().dump_rels(rels_files_.get_rel_file()->get_rels());
Context.dump_hyperlinks (rels_files_.get_rel_file()->get_rels(), hyperlinks::document_place);
Context.dump_headers_footers(rels_files_.get_rel_file()->get_rels());
Context.dump_notes (rels_files_.get_rel_file()->get_rels());
}
void word_files::set_media(mediaitems_ptr & _mediaitems)
void word_files::set_media(mediaitems & _Mediaitems)
{
if (_mediaitems->count_image + _mediaitems->count_media > 0)
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
{
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
}
if (_mediaitems->count_object > 0)
if (_Mediaitems.count_object > 0)
{
embeddings_ = element_ptr( new embeddings(_mediaitems) );
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
embeddings_->set_main_document( get_main_document() );
}
}
@ -199,10 +195,6 @@ void word_files::add_jsaProject(const std::string &content)
{
jsaProject_ = package::simple_element::create(L"jsaProject.bin", content);
}
void word_files::set_drawings(element_ptr Element)
{
drawings_ = Element;
}
void word_files::set_headers_footers(headers_footers & HeadersFooters)
{
headers_footers_elements * elm = new headers_footers_elements(HeadersFooters);

View File

@ -137,11 +137,10 @@ public:
void set_numbering (element_ptr Element);
void set_settings (element_ptr Element);
bool has_numbering ();
void set_media (mediaitems_ptr & mediaitems_);
void set_media (mediaitems & mediaitems_);
void set_headers_footers(headers_footers & HeadersFooters);
void set_notes (notes_context & notesContext);
void set_comments (comments_context & commentsContext);
void set_drawings (element_ptr Element);
void add_charts(chart_content_ptr chart);
void add_jsaProject(const std::string &content);
@ -164,7 +163,6 @@ private:
element_ptr settings_;
element_ptr comments_;
element_ptr jsaProject_;
element_ptr drawings_;
};

View File

@ -62,9 +62,6 @@ struct drawing_object_description
double anchor_x_;
double anchor_y_;
_CP_OPT(_INT32) owner_cx_;
_CP_OPT(_INT32) owner_cy_;
_action_desc action_;
std::vector<_hlink_desc> hlinks_;

View File

@ -101,7 +101,6 @@ void mediaitems::set_font_directory(std::wstring pathFonts)
if (applicationFonts_)
applicationFonts_->InitializeFromFolder(pathFonts);
}
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal)
{
std::wstring ref;
@ -330,10 +329,6 @@ void mediaitems::dump_rels(rels & Rels)
{
for (size_t i = 0; i < items_.size(); i++)
{
if ( items_[i].type == typeUnknown ) continue;
if ( items_[i].type == typeShape ) continue;
if ( items_[i].type == typeGroupShape ) continue;
if (items_[i].count_used >= items_[i].count_add) continue; // уже использовали этот релс выше(колонтитул ....)
Rels.add( relationship(
@ -343,7 +338,7 @@ void mediaitems::dump_rels(rels & Rels)
items_[i].mediaInternal ? L"" : L"External" )
);
items_[i].count_used++;
}
}
}

View File

@ -137,7 +137,6 @@ public:
return typeMedia;
}
private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (const std::wstring &fileName);
@ -148,7 +147,6 @@ private:
NSFonts::IApplicationFonts *applicationFonts_;
};
typedef _CP_PTR(mediaitems) mediaitems_ptr;
}
}

View File

@ -53,7 +53,7 @@ public:
std::wstring drawingId_;
};
oox_chart_context::oox_chart_context(mediaitems_ptr & m, std::wstring name) :
oox_chart_context::oox_chart_context(mediaitems & m, std::wstring name) :
impl_(new oox_chart_context::Impl( name)), mediaitems_(m)
{
@ -65,7 +65,7 @@ void oox_chart_context::reset_fill(oox::_oox_fill &f)
{
bool isInternal = true;
std::wstring ref;
f.bitmap->rId = mediaitems_->add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
f.bitmap->rId = mediaitems_.add_or_find(f.bitmap->xlink_href_, typeImage, isInternal, ref);
rels_.push_back(_rel(isInternal, f.bitmap->rId, ref, typeImage));
}
@ -75,15 +75,9 @@ void oox_chart_context::set_externalData(const std::wstring & href)
bool isInternal = true;
std::wstring href_out;
externalDataId_ = mediaitems_->add_or_find(href, typeMsObject, isInternal, href_out);
externalDataId_ = mediaitems_.add_or_find(href, typeMsObject, isInternal, href_out);
rels_.push_back(_rel(isInternal, externalDataId_, href_out, typeMsObject));
}
void oox_chart_context::set_userShapes(std::pair<std::wstring, std::wstring> &link)
{
bool isInternal = true;
userShapesId_ = link.second;
rels_.push_back(_rel(isInternal, userShapesId_, link.first, typeChartUserShapes));
}
std::wostream & oox_chart_context::chartData()
{
return impl_->chartData_;
@ -122,15 +116,6 @@ void oox_chart_context::dump_rels(rels & Rels)
(r.is_internal ? L"" : L"External"))
);
}
else if (r.type == typeChartUserShapes)
{
Rels.add(relationship(
r.rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes",
r.is_internal ? std::wstring(L"../drawings/") + r.ref : r.ref,
(r.is_internal ? L"" : L"External"))
);
}
}
}
@ -241,13 +226,6 @@ void oox_chart_context::serialize(std::wostream & strm)
}
}
}
if (userShapesId_.empty() == false)
{
CP_XML_NODE(L"c:userShapes")
{
CP_XML_ATTR(L"r:id", userShapesId_);
}
}
}
}
}

View File

@ -53,7 +53,7 @@ typedef _CP_PTR(oox_chart_context) oox_chart_context_ptr;
class oox_chart_context
{
public:
oox_chart_context(mediaitems_ptr & mediaitems_, std::wstring name);
oox_chart_context(mediaitems & mediaitems_, std::wstring name);
~oox_chart_context();
std::wostream & chartData();
@ -83,8 +83,6 @@ public:
}
}
void set_externalData(const std::wstring & href);
void set_userShapes(std::pair<std::wstring, std::wstring> &link);
void add_chart(int type)
{
plot_area_.add_chart(type);
@ -130,7 +128,7 @@ private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
mediaitems_ptr mediaitems_;
mediaitems &mediaitems_;
std::vector<_rel> rels_;
cpdoccore::oox::oox_title title_;
@ -139,7 +137,6 @@ private:
std::wstring pivot_source_;
std::wstring externalDataId_;
std::wstring userShapesId_;
std::vector<odf_reader::_property> graphic_properties_;
_oox_fill fill_;

View File

@ -173,26 +173,6 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
return true;
}
void content_types_file::set_media(mediaitems_ptr & _Mediaitems)
{
std::vector<mediaitems::item> & items_ = _Mediaitems->items();
for (size_t i = 0; i < items_.size(); i++)
{
if ((items_[i].type == typeImage ||
items_[i].type == typeMedia ||
items_[i].type == typeVideo ||
items_[i].type == typeAudio) && items_[i].mediaInternal)
{
int n = items_[i].outputName.rfind(L".");
if (n > 0)
{
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
}
}
}
}
void content_types_file::set_media(mediaitems & _Mediaitems)
{
@ -369,7 +349,7 @@ void docProps_files::write(const std::wstring & RootPath)
////////////
media::media(mediaitems_ptr & _mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaItems_(_mediaitems), appFonts_(pAppFonts)
media::media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaitems_(_Mediaitems), appFonts_(pAppFonts)
{
}
@ -378,8 +358,7 @@ void media::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
NSDirectory::CreateDirectory(path.c_str());
mediaitems::items_array & items = mediaItems_->items();
mediaitems::items_array & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++ )
{
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
@ -402,7 +381,7 @@ void media::write(const std::wstring & RootPath)
}
//------------------------------------------------------------------------------------------------------------
charts::charts(mediaitems_ptr & _chartsItems) : chartsItems_(_chartsItems)
charts::charts(mediaitems & _ChartsItems) : chartsitems_(_ChartsItems)
{
}
@ -411,7 +390,7 @@ void charts::write(const std::wstring & RootPath)
}
//--------------------------------------------------------------------------------------------------------------
embeddings::embeddings(mediaitems_ptr & _EmbeddingsItems) : embeddingsItems_(_EmbeddingsItems)
embeddings::embeddings(mediaitems & _EmbeddingsItems) : embeddingsitems_(_EmbeddingsItems)
{
}
void embeddings::write(const std::wstring & RootPath)
@ -421,8 +400,7 @@ void embeddings::write(const std::wstring & RootPath)
content_types_file & content_types = get_main_document()->get_content_types_file();
mediaitems::items_array & items = embeddingsItems_->items();
mediaitems::items_array & items = embeddingsitems_.items();
for (size_t i = 0; i < items.size(); i++ )
{
if ( items[i].mediaInternal && items[i].valid &&

View File

@ -51,7 +51,6 @@ namespace cpdoccore {
namespace oox {
class mediaitems;
typedef _CP_PTR(mediaitems) mediaitems_ptr;
namespace package {
@ -82,17 +81,16 @@ inline element::~element()
class content_types_file : public element
{
public:
content_types_file ();
void write (const std::wstring & RootPath);
bool add_or_find_default (const std::wstring & extension);
bool add_or_find_override(const std::wstring & fileName);
void set_media (mediaitems & _Mediaitems);
void set_media (mediaitems_ptr & _Mediaitems);
content_type* content ();
content_types_file ();
void write (const std::wstring & RootPath);
bool add_or_find_default (const std::wstring & extension);
bool add_or_find_override(const std::wstring & fileName);
void set_media (mediaitems & _Mediaitems);
content_type * content ();
private:
content_type content_type_content_;
std::wstring filename_;
std::wstring filename_;
};
class simple_element;
@ -191,8 +189,8 @@ public:
std::wstring str() { return content_.str(); }
static _CP_PTR(chart_content) create();
private:
std::wstringstream content_;
rels_file_ptr rels_;
std::wstringstream content_;
rels_file_ptr rels_;
};
//------------------------------------------------------------------------
class document : public element
@ -230,39 +228,39 @@ private:
class media : public element
{
public:
media(mediaitems_ptr & _mediaItems, NSFonts::IApplicationFonts *pAppFonts);
media(mediaitems & _Mediaitems, NSFonts::IApplicationFonts *pAppFonts);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems_ptr mediaItems_;
NSFonts::IApplicationFonts* appFonts_;
mediaitems & mediaitems_;
NSFonts::IApplicationFonts * appFonts_;
};
class charts : public element
{
public:
charts(mediaitems_ptr & _chartsItems);
charts(mediaitems & _ChartsItems);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems_ptr chartsItems_;
mediaitems & chartsitems_;
};
class embeddings : public element
{
public:
embeddings(mediaitems_ptr & _embeddingsItems);
embeddings(mediaitems & _EmbeddingsItems);
public:
virtual void write(const std::wstring & RootPath);
private:
mediaitems_ptr embeddingsItems_;
mediaitems & embeddingsitems_;
};
} // namespace package

View File

@ -43,7 +43,6 @@ namespace oox {
enum RelsType
{
typeUnknown = 0,
typeDefault,
typeImage,
typeChart,
typeShape,
@ -60,8 +59,7 @@ enum RelsType
typeExternalLink,
typeActiveX,
typeControl,
typeControlProps,
typeChartUserShapes
typeControlProps
};
struct _rel
@ -73,10 +71,10 @@ struct _rel
type(type_)
{}
bool is_internal;
std::wstring rid;
std::wstring ref;
RelsType type;
bool is_internal;
std::wstring rid;
std::wstring ref;
RelsType type;
};
class relationship : public xml::element_impl<relationship>

View File

@ -83,7 +83,7 @@ void pptx_conversion_context::set_output_document(package::pptx_document * docum
void pptx_conversion_context::set_font_directory(std::wstring pathFonts)
{
pptx_slide_context_.get_mediaitems()->set_font_directory(pathFonts);
pptx_slide_context_.get_mediaitems().set_font_directory(pathFonts);
}
void pptx_conversion_context::process_layouts()

View File

@ -133,7 +133,7 @@ public:
pptx_table_context & get_table_context() { return pptx_table_context_; }
mediaitems_ptr & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
//void start_hyperlink(const std::wstring & styleName);
//void end_hyperlink(std::wstring const & href);

View File

@ -509,15 +509,15 @@ void ppt_files::add_notesMaster(slide_content_ptr slide)
{
notesMaster_files_.add_slide(slide);
}
void ppt_files::set_media(mediaitems_ptr & _mediaitems)
void ppt_files::set_media(mediaitems & _Mediaitems)
{
if (_mediaitems->count_image + _mediaitems->count_media > 0)
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
{
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
}
if (_mediaitems->count_object > 0)
if (_Mediaitems.count_object > 0)
{
embeddings_ = element_ptr( new embeddings(_mediaitems) );
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
}
}
void ppt_files::set_authors_comments(pptx_xml_authors_comments_ptr & authors_comments)

View File

@ -217,7 +217,7 @@ public:
void add_notes (slide_content_ptr sheet);
void add_notesMaster(slide_content_ptr sheet);
void set_media(mediaitems_ptr & _mediaitems);
void set_media(mediaitems & _Mediaitems);
void add_charts(chart_content_ptr chart);
void add_theme (pptx_xml_theme_ptr theme);

View File

@ -65,10 +65,8 @@ public:
bool onClick;
};
Impl(const std::wstring & _odfPacket) : odfPacket_(_odfPacket)
Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket), odfPacket_(odfPacket)
{
mediaitems_ = boost::make_shared<mediaitems>(odfPacket_);
clear();
}
@ -90,7 +88,7 @@ public:
{
pptx_drawings_->add(isInternal, rid, ref, type);
}
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
mediaitems & get_mediaitems() { return mediaitems_; }
bool empty() const
{
@ -140,7 +138,7 @@ private:
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
size_t rId_;
mediaitems_ptr mediaitems_;
mediaitems mediaitems_;
pptx_drawings_ptr pptx_drawings_;
pptx_drawings_ptr pptx_notes_drawings_;
};
@ -359,7 +357,7 @@ void pptx_slide_context::add_background(_oox_fill & fill)
bool isMediaInternal = false;
std::wstring ref;
fill.bitmap->rId = get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
}
impl_->background_fill_ = fill;
@ -423,7 +421,7 @@ void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
{
bool isMediaInternal = true;
impl_->object_description_.action_.hSoundId = get_mediaitems()->add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
}
else
@ -564,7 +562,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
}
std::wstring fileName = odfPacket_ + FILE_SEPARATOR_STR + obj.xlink_href_;
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems()->applicationFonts());
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, get_mediaitems().applicationFonts());
drawing.fill.bitmap->bStretch = true;
if ((sColorMode) && (*sColorMode == L"greyscale"))
@ -574,7 +572,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
std::wstring ref;/// это ссылка на выходной внешний объект
bool isMediaInternal = false;
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->isInternal = isMediaInternal;
if (drawing.type == typeShape)
@ -582,7 +580,7 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
isMediaInternal = true;
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
@ -597,7 +595,7 @@ void pptx_slide_context::Impl::process_chart(drawing_object_description & obj, _
std::wstring ref;
bool isMediaInternal = true;
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
}
@ -606,7 +604,7 @@ void pptx_slide_context::Impl::process_table(drawing_object_description & obj, _
{
std::wstring ref;
bool isMediaInternal = true;
std::wstring rId = get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
std::wstring rId = get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
add_drawing(drawing, isMediaInternal, rId, ref, drawing.type);
@ -621,12 +619,12 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
if (drawing.fill.bitmap)
{
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
}
std::wstring rId = get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
std::wstring rId = get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
////////////////////////////////////////////////////////////////
_CP_OPT(std::wstring) sPlaceHolderType;
@ -649,7 +647,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
std::wstring ref, ref_image;
bool isMediaInternal = true, isMediaInternal_image = true;
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectProgId = obj.descriptor_;
if (!drawing.fill.bitmap)
@ -660,7 +658,7 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
}
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
add_drawing(drawing, isMediaInternal, drawing.objectId, ref, drawing.type);
@ -672,7 +670,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
drawing.objectId = get_mediaitems()->add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
drawing.extId = L"ext" + drawing.objectId;
drawing.extExternal = !isMediaInternal;
@ -683,7 +681,7 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
_image_file_::GenerateZeroImage(odfPacket_ + FILE_SEPARATOR_STR + L"zero.png");
}
drawing.fill.bitmap->rId = get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal_image, ref_image);
add_additional_rels(isMediaInternal_image, drawing.fill.bitmap->rId, ref_image, typeImage);
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
@ -716,7 +714,7 @@ void pptx_slide_context::dump_rels(rels & Rels)
impl_->get_drawings()->dump_rels(Rels);
}
mediaitems_ptr & pptx_slide_context::get_mediaitems()
mediaitems & pptx_slide_context::get_mediaitems()
{
return impl_->get_mediaitems();
}

View File

@ -116,7 +116,7 @@ public:
void process_drawings();
mediaitems_ptr & get_mediaitems();
mediaitems & get_mediaitems();
void add_background (_oox_fill & fill);

View File

@ -390,7 +390,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
{
bool isMediaInternal = true;
std::wstring ref;
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
}
oox::oox_serialize_fill(CP_XML_STREAM(), fill);

View File

@ -48,17 +48,17 @@ std::wostream & operator << (std::wostream & strm, xlsx_drawing_position::type_t
}
}
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
{
_CP_OPT(std::wstring) strTextContent;
odf_reader::GetProperty ( val.additional, L"text-content", strTextContent);
odf_reader::GetProperty ( val.additional ,L"text-content", strTextContent);
if (!strTextContent)return;
if (strTextContent->empty())return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(ns + L":txBody")
CP_XML_NODE(L"xdr:txBody")
{
val.serialize_bodyPr(CP_XML_STREAM());
@ -71,28 +71,28 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val, const std::w
}
}
void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring & ns)
void xlsx_drawing_position::serialize(std::wostream & strm, std::wstring ns)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE( ns + (ns.empty() ? L"" : L":") + (type == xlsx_drawing_position::from ? L"from" : L"to") )
CP_XML_NODE( ns + (type == xlsx_drawing_position::from ? L"from" : L"to") )
{
CP_XML_NODE(ns + L":col")
CP_XML_NODE(L"xdr:col")
{
CP_XML_CONTENT(position.col);
}
CP_XML_NODE(ns + L":colOff")
CP_XML_NODE(L"xdr:colOff")
{
CP_XML_CONTENT(static_cast<size_t>(position.colOff));
}
CP_XML_NODE(ns + L":row")
CP_XML_NODE(L"xdr:row")
{
CP_XML_CONTENT(position.row);
}
CP_XML_NODE(ns + L":rowOff")
CP_XML_NODE(L"xdr:rowOff")
{
CP_XML_CONTENT(static_cast<size_t>(position.rowOff));
}
@ -100,15 +100,15 @@ void xlsx_drawing_position::serialize(std::wostream & strm, const std::wstring &
}
}
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(ns + L":pic")
CP_XML_NODE(L"xdr:pic")
{
CP_XML_NODE(ns + L":nvPicPr")
CP_XML_NODE(L"xdr:nvPicPr")
{
CP_XML_NODE(ns + L":cNvPr")
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
@ -116,7 +116,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(ns + L":cNvPicPr")
CP_XML_NODE(L"xdr:cNvPicPr")
{
if (val.fill.bitmap->bCrop)
{
@ -128,7 +128,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::
val.fill.bitmap->name_space = L"xdr";
oox_serialize_fill(CP_XML_STREAM(), val.fill);
CP_XML_NODE(ns + L":spPr")
CP_XML_NODE(L"xdr:spPr")
{
val.serialize_xfrm(CP_XML_STREAM());
@ -139,20 +139,20 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::
}
oox_serialize_ln(CP_XML_STREAM(), val.additional);
}
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
xlsx_serialize_text(CP_XML_STREAM(), val);
}
} // CP_XML_WRITER
}
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(ns + L":sp")
CP_XML_NODE(L"xdr:sp")
{
CP_XML_NODE(ns + L":nvSpPr")
CP_XML_NODE(L"xdr:nvSpPr")
{
CP_XML_NODE(ns + L":cNvPr")
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
@ -160,12 +160,12 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(ns + L":cNvSpPr")//non visual properies (собственно тока 1 там)
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
{
if (val.sub_type == 1)CP_XML_ATTR(L"txBox", 1);
}
} // xdr:nv_Pr
CP_XML_NODE(ns + L":spPr")
CP_XML_NODE(L"xdr:spPr")
{
val.serialize_xfrm(CP_XML_STREAM());
@ -174,7 +174,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::
oox_serialize_ln(CP_XML_STREAM(),val.additional, val.lined);
} // xdr:spPr
xlsx_serialize_text(CP_XML_STREAM(), val, ns);
xlsx_serialize_text(CP_XML_STREAM(), val);
}
} // CP_XML_WRITER
}
@ -206,22 +206,22 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
}
}
}
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(ns + L":grpSp")
CP_XML_NODE(L"xdr:grpSp")
{
CP_XML_NODE(ns + L":nvGrpSpPr")
CP_XML_NODE(L"xdr:nvGrpSpPr")
{
CP_XML_NODE(ns + L":cNvPr")
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
}
CP_XML_NODE(ns + L":cNvGrpSpPr");
CP_XML_NODE(L"xdr:cNvGrpSpPr");
}
CP_XML_NODE(ns + L":grpSpPr")
CP_XML_NODE(L"xdr:grpSpPr")
{
val.serialize_xfrm(CP_XML_STREAM());
@ -266,15 +266,15 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
}
}
}
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring & ns)
void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
{
if (val.type == typeShape)
{
xlsx_serialize_shape(strm, val, ns);
xlsx_serialize_shape(strm, val);
}
else if (val.type == typeImage)
{
xlsx_serialize_image(strm, val, ns);
xlsx_serialize_image(strm, val);
}
else if (val.type == typeChart)
{
@ -282,7 +282,7 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstrin
}
else if (val.type == typeGroupShape)
{
xlsx_serialize_group(strm, val, ns);
xlsx_serialize_group(strm, val);
}
else if (val.type == typeOleObject ||
val.type == typeMsObject ||
@ -292,76 +292,44 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstrin
}
}
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
void _xlsx_drawing::serialize(std::wostream & strm)
{
if (inGroup)
return xlsx_serialize(strm, *this, ns);
return xlsx_serialize(strm, *this);
CP_XML_WRITER(strm)
{
if (type_anchor == 1)
{
CP_XML_NODE(ns + L":twoCellAnchor")
CP_XML_NODE(L"xdr:twoCellAnchor")
{
CP_XML_ATTR(L"editAs", L"oneCell");//"absolute");oneCell
from_.serialize (CP_XML_STREAM());
to_.serialize (CP_XML_STREAM());
xlsx_serialize (CP_XML_STREAM(), *this, ns);
CP_XML_NODE(ns + L":clientData");
xlsx_serialize (CP_XML_STREAM(), *this);
CP_XML_NODE(L"xdr:clientData");
}
}
else if (type_anchor == 2)
else
{
CP_XML_NODE(ns + L":absoluteAnchor")
CP_XML_NODE(L"xdr:absoluteAnchor")
{
CP_XML_NODE(ns + L":pos")
CP_XML_NODE(L"xdr:pos")
{
CP_XML_ATTR(L"x", x);
CP_XML_ATTR(L"y", y);
}
CP_XML_NODE(ns + L":ext")
CP_XML_NODE(L"xdr:ext")
{
CP_XML_ATTR(L"cx", cx);
CP_XML_ATTR(L"cy", cy);
}
xlsx_serialize(CP_XML_STREAM(), *this, ns);
CP_XML_NODE(ns + L":clientData");
xlsx_serialize(CP_XML_STREAM(), *this);
CP_XML_NODE(L"xdr:clientData");
}
}
else if (type_anchor == 3)
{
CP_XML_NODE(ns + L":relSizeAnchor")
{
CP_XML_NODE(ns + L":from")
{
CP_XML_NODE(ns + L":x")
{
CP_XML_STREAM() << ((double)x / *owner_cx_);
}
CP_XML_NODE(ns + L":y")
{
CP_XML_STREAM() << ((double)y / *owner_cy_);
}
}
CP_XML_NODE(ns + L":to")
{
_INT32 x1 = x + cx;
_INT32 y1 = y + cy;
CP_XML_NODE(ns + L":x")
{
CP_XML_STREAM() << ((double)x1 / *owner_cx_);
}
CP_XML_NODE(ns + L":y")
{
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
}
}
xlsx_serialize(CP_XML_STREAM(), *this, ns);
}
}
}
}

View File

@ -49,7 +49,7 @@ struct xlsx_drawing_position
enum type_t {from, to} type;
xlsx_table_position position;
void serialize(std::wostream & _Wostream, const std::wstring & ns = L"xdr");
void serialize(std::wostream & _Wostream, std::wstring ns = L"xdr:");
};
@ -63,14 +63,9 @@ public:
xlsx_drawing_position from_;
xlsx_drawing_position to_;
_CP_OPT(_INT32) owner_cx_;
_CP_OPT(_INT32) owner_cy_;
std::wstring content_group_;
virtual void serialize (std::wostream & strm) {return serialize(strm, L"xdr");}
void serialize (std::wostream & strm, const std::wstring & ns);
void serialize (std::wostream & strm);
void serialize_object (std::wostream & strm);
void serialize_control (std::wostream & strm);
};

View File

@ -53,42 +53,41 @@ namespace oox {
class xlsx_drawing_context_handle::Impl
{
public:
Impl(mediaitems_ptr & items) : items_(items), next_rId_(1), next_drawing_id_(1)
Impl(mediaitems & items) : items_(items), next_rId_(1), next_drawing_id_(1)
{
}
mediaitems_ptr & get_mediaitems() { return items_; }
mediaitems & get_mediaitems() { return items_; }
size_t next_rId()
{
return next_rId_++;
}
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
{
const std::wstring id = std::to_wstring(next_drawing_id_++);
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
drawings_.push_back(drawing_elm(fileName, content, drawings, type_));
const std::wstring rId = std::wstring(L"rDrId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId);
drawings_.push_back(drawing_elm(fileName, content, drawings));
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
return std::pair<std::wstring, std::wstring>(fileName, rId);
}
const std::vector<drawing_elm> & content() const
{
return drawings_;
}
private:
mediaitems_ptr items_;
mediaitems & items_;
std::vector<drawing_elm> drawings_;
size_t next_rId_;
size_t next_drawing_id_;
};
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems_ptr & items) :
impl_(new xlsx_drawing_context_handle::Impl(items))
xlsx_drawing_context_handle::xlsx_drawing_context_handle(mediaitems & items)
: impl_(new xlsx_drawing_context_handle::Impl(items))
{
}
@ -96,9 +95,9 @@ xlsx_drawing_context_handle::~xlsx_drawing_context_handle()
{
}
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_)
std::pair<std::wstring, std::wstring> xlsx_drawing_context_handle::add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
{
return impl_->add_drawing_xml(content, drawings, type_);
return impl_->add_drawing_xml(content, drawings);
}
const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
@ -109,13 +108,13 @@ const std::vector<drawing_elm> & xlsx_drawing_context_handle::content() const
class xlsx_drawing_context::Impl
{
public:
Impl(xlsx_drawing_context_handle_ptr & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
Impl(xlsx_drawing_context_handle & handle) : xlsx_drawings_(xlsx_drawings::create(false)), handle_(handle)
{
current_level_ = &objects_;
use_image_replacement_ = false;
}
xlsx_drawing_context_handle_ptr handle_;
xlsx_drawing_context_handle& handle_;
drawing_object_description object_description_;
std::vector<drawing_object_description> objects_;
@ -125,11 +124,11 @@ public:
bool use_image_replacement_;
//-----------------------------------------------------------------------------------
mediaitems_ptr & get_mediaitems() { return handle_->impl_->get_mediaitems(); }
mediaitems & get_mediaitems() { return handle_.impl_->get_mediaitems(); }
void serialize(std::wostream & strm, const std::wstring & ns = L"xdr")
void serialize(std::wostream & strm)
{
xlsx_drawings_->serialize(strm, ns);
xlsx_drawings_->serialize(strm);
}
bool empty() const
@ -139,7 +138,7 @@ public:
size_t next_rId()
{
return handle_->impl_->next_rId();
return handle_.impl_->next_rId();
}
xlsx_drawings_ptr get_drawings()
@ -151,7 +150,7 @@ private:
};
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h)
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle & h)
: impl_(new xlsx_drawing_context::Impl(h))
{
hlinks_size_ = 0;
@ -387,12 +386,6 @@ void xlsx_drawing_context::set_scale(double cx_pt, double cy_pt)
}
}
void xlsx_drawing_context::set_rel_anchor(_INT32 owner_cx, _INT32 owner_cy)
{
impl_->object_description_.owner_cx_ = owner_cx;
impl_->object_description_.owner_cy_ = owner_cy;
}
void xlsx_drawing_context::set_anchor(std::wstring anchor, double x_pt, double y_pt, bool group)
{
if (group)
@ -451,17 +444,9 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
{
if (obj.anchor_.empty())
{
if (obj.owner_cx_ && obj.owner_cy_)
{
drawing.type_anchor = 3; // relative
drawing.owner_cx_ = obj.owner_cx_;
drawing.owner_cy_ = obj.owner_cy_;
}
else
drawing.type_anchor = 2; // absolute
drawing.type_anchor = 2; // absolute
}
if (drawing.type_anchor == 1)
else
{
xlsx_table_position from, to;
@ -485,19 +470,17 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
_rect & r = obj.svg_rect_.get();
//todooo непонятно что делать с отрицательными значениями
_INT32 val = 0;
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.x = val;
int val = 0.5 + odf_types::length(obj.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu);
if (val >=0) drawing.x = val;
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.y = val;
val = 0.5 + odf_types::length(obj.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu);
if (val >=0) drawing.y = val;
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.cx = val;
val = 0.5 + odf_types::length(obj.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu);
if (val >=0) drawing.cx = val;
val = (_INT32) (0.5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.cy = val;
val = .5 + odf_types::length(obj.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu);
if (val >=0) drawing.cy = val;
}
drawing.additional = obj.additional_;
@ -572,7 +555,7 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
}
std::wstring fileName = odf_packet_path_ + FILE_SEPARATOR_STR + obj.xlink_href_;
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems()->applicationFonts());
drawing.fill.bitmap->bCrop = odf_reader::parse_clipping(obj.clipping_string_, fileName, drawing.fill.bitmap->cropRect, impl_->get_mediaitems().applicationFonts());
drawing.fill.bitmap->bStretch = true;
if ((sColorMode) && (*sColorMode == L"greyscale"))
@ -581,14 +564,14 @@ void xlsx_drawing_context::process_image(drawing_object_description & obj, _xlsx
std::wstring ref;/// это ссылка на выходной внешний объект
bool isMediaInternal = false;
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
if (drawing.type == typeShape)
{
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
isMediaInternal=true;
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", typeShape, isMediaInternal, ref);
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, typeShape);//объект
@ -606,7 +589,7 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
std::wstring ref;
bool isMediaInternal = true;
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_);
if (drawing.inGroup)
@ -644,7 +627,7 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
}
else
{
drawing.objectId = impl_->get_mediaitems()->add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectProgId = obj.descriptor_;
xlsx_drawings_->add(drawing, isMediaInternal, drawing.objectId, ref, obj.type_, true);
@ -658,7 +641,7 @@ void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_
std::wstring ref;
bool isMediaInternal = true;
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
}
@ -670,7 +653,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
std::wstringstream strm;
xlsx_drawings_child->serialize(strm, L"xdr");
xlsx_drawings_child->serialize(strm);
drawing.content_group_ = strm.str();
@ -678,7 +661,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
std::wstring ref;
bool isMediaInternal = true;
std::wstring rId = impl_->get_mediaitems()->add_or_find(L"", obj.type_, isMediaInternal, ref);
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", obj.type_, isMediaInternal, ref);
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
}
@ -709,7 +692,7 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
std::wstring ref;
bool isMediaInternal = true;
drawing.fill.bitmap->rId = impl_->get_mediaitems()->add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
drawing.fill.bitmap->rId = impl_->get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
bool in_sheet = (obj.type_== typeOleObject || obj.type_== typeMsObject) ? true : false;
impl_->get_drawings()->add(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage, in_sheet);//собственно это не объект, а доп рел и ref объекта
@ -733,9 +716,9 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
}
}
void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& ns)
void xlsx_drawing_context::serialize(std::wostream & strm)
{
impl_->serialize(strm, ns);
impl_->serialize(strm);
}
xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
@ -773,5 +756,6 @@ void xlsx_drawing_context::set_is_connector_shape(bool val)
impl_->object_description_.connector_ = val;
}
}
}

View File

@ -53,16 +53,15 @@ namespace oox {
class xlsx_drawings;
struct _oox_fill;
typedef _CP_PTR(mediaitems) mediaitems_ptr;
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
class xlsx_drawing_context_handle
{
public:
xlsx_drawing_context_handle(mediaitems_ptr & items);
xlsx_drawing_context_handle(mediaitems & items);
~xlsx_drawing_context_handle();
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings, RelsType const & type_ = typeDefault);
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings);
const std::vector<drawing_elm> & content() const;
friend class xlsx_drawing_context;
@ -73,12 +72,10 @@ public:
typedef _CP_PTR(xlsx_drawing_context_handle) xlsx_drawing_context_handle_ptr;
class xlsx_drawing_context
{
public:
xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h);
xlsx_drawing_context(xlsx_drawing_context_handle & h);
~xlsx_drawing_context();
void set_odf_packet_path(std::wstring path){odf_packet_path_ = path;}//для анализа картинок
@ -108,7 +105,6 @@ public:
void set_scale (double cx_pt, double cy_pt);
void set_rotate (double angle, bool translate = false);
void set_rel_anchor (_INT32 owner_cx, _INT32 owner_cy);
void set_anchor (std::wstring anchor, double x_pt, double y_pt, bool group = false);
void set_property (odf_reader::_property p);
void set_clipping (const std::wstring & str );
@ -126,8 +122,7 @@ public:
bool empty() const;
void clear();
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr");
void serialize(std::wostream & strm);
std::wstring dump_path(std::vector<svg_path::_polyline> & path, double w,double h);
xlsx_drawings_ptr get_drawings();

View File

@ -85,35 +85,28 @@ public:
}
}
void serialize(std::wostream & strm, const std::wstring & ns)
void serialize(std::wostream & strm)
{
if (inGroup)
{
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_drawings_[i].serialize(strm, ns);
xlsx_drawings_[i].serialize(strm);
}
}
else
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(ns + L":wsDr")
CP_XML_NODE(L"xdr:wsDr")
{
if (ns == L"xdr")
{
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
}
if (ns == L"cdr")
{
CP_XML_ATTR(L"xmlns:cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing");
}
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_drawings_[i].serialize(CP_XML_STREAM(), ns);
xlsx_drawings_[i].serialize(CP_XML_STREAM());
}
}
}
@ -199,9 +192,9 @@ void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring
impl_->add(isInternal, rid, ref, type, sheet_rel);
}
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns)
void xlsx_drawings::serialize(std::wostream & strm)
{
impl_->serialize(strm, ns);
impl_->serialize(strm);
}
void xlsx_drawings::serialize_objects(std::wostream & strm)

View File

@ -46,14 +46,13 @@ typedef _CP_PTR(xlsx_drawings) xlsx_drawings_ptr;
struct drawing_elm
{
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings, RelsType const & _type)
: filename(_filename), content(_content), drawings(_drawings), type(_type)
drawing_elm(std::wstring const & _filename, std::wstring const & _content, xlsx_drawings_ptr _drawings)
: filename(_filename), content(_content), drawings(_drawings)
{}
std::wstring filename;
std::wstring content;
xlsx_drawings_ptr drawings;
RelsType type;
};
class _xlsx_drawing;
@ -72,7 +71,7 @@ public:
void dump_rels_sheet (rels & Rels);
void dump_rels_drawing (rels & Rels);
void serialize (std::wostream & _Wostream, const std::wstring & ns);
void serialize (std::wostream & _Wostream);
void serialize_objects (std::wostream & _Wostream);
void serialize_controls (std::wostream & _Wostream);
private:

View File

@ -31,8 +31,6 @@
*/
#include "xlsx_package.h"
#include "docx_package.h"
#include "pptx_package.h"
#include <boost/ref.hpp>
@ -300,16 +298,16 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
sheets_files_.add_sheet(sheet);
}
void xl_files::set_media(mediaitems_ptr & _mediaitems)
void xl_files::set_media(mediaitems & _Mediaitems)
{
if (_mediaitems->count_image + _mediaitems->count_media > 0)
if (_Mediaitems.count_image + _Mediaitems.count_media > 0)
{
media_ = element_ptr( new media(_mediaitems, _mediaitems->applicationFonts()) );
media_ = element_ptr( new media(_Mediaitems, _Mediaitems.applicationFonts()) );
}
if (_mediaitems->count_object > 0)
if (_Mediaitems.count_object > 0)
{
embeddings_ = element_ptr( new embeddings(_mediaitems) );
embeddings_ = element_ptr( new embeddings(_Mediaitems) );
}
}
void xl_files::set_comments(element_ptr Element)
@ -565,18 +563,10 @@ xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
void xl_drawings::write(const std::wstring & RootPath)
{
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"drawings";
NSDirectory::CreateDirectory(path.c_str());
pptx_document *pptx = dynamic_cast<pptx_document*>(this->get_main_document());
xlsx_document *xlsx = dynamic_cast<xlsx_document*>(this->get_main_document());
docx_document *docx = dynamic_cast<docx_document*>(this->get_main_document());
const std::wstring override_str = docx ? L"/word/drawings/" : (pptx ? L"/ppt/drawings/" : L"/xl/drawings/");
for (size_t i = 0; i < drawings_.size(); i++)
for (size_t i = 0; i < drawings_.size(); i++)
{
package::simple_element(drawings_[i].filename, drawings_[i].content).write(path);
@ -588,11 +578,10 @@ void xl_drawings::write(const std::wstring & RootPath)
relFiles.add_rel_file(r);
relFiles.write(path);
const std::wstring kDrawingCT = drawings_[i].type == typeChartUserShapes ?
L"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml" :
L"application/vnd.openxmlformats-officedocument.drawing+xml";
contentTypes->add_override(override_str + drawings_[i].filename, kDrawingCT);
content_type * contentTypes = this->get_main_document()->get_content_types_file().content();
const std::wstring kDrawingCT = L"application/vnd.openxmlformats-officedocument.drawing+xml";
contentTypes->add_override(L"/xl/drawings/" + drawings_[i].filename, kDrawingCT);
}
}

View File

@ -284,7 +284,7 @@ public:
void set_sharedStrings (element_ptr Element);
void set_connections (element_ptr Element);
void add_sheet (sheet_content_ptr sheet);
void set_media (mediaitems_ptr & _Mediaitems);
void set_media (mediaitems & _Mediaitems);
void set_drawings (element_ptr Element);
void set_vml_drawings (element_ptr Element);
void set_comments (element_ptr Element);

View File

@ -69,12 +69,12 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
xlsx_table_context_ (this, xlsx_text_context_),
math_context_ (odf_document_->odf_context().fontContainer(), true),
xlsx_style_ (this),
maxDigitSize_ (std::make_pair(-1.f, -1.f) ),
default_style_ ( (std::numeric_limits<size_t>::max)() )
default_style_ ( (std::numeric_limits<size_t>::max)() ),
mediaitems_ (odf_document_->get_folder()),
xlsx_drawing_context_handle_(mediaitems_)
{
mediaitems_ = boost::make_shared<mediaitems>(odf_document_->get_folder());
drawing_context_handle_ = boost::make_shared<xlsx_drawing_context_handle>(mediaitems_);
}
std::unordered_map<std::wstring, int> xlsx_conversion_context::mapExternalLink_;
@ -90,16 +90,7 @@ xlsx_conversion_context::~xlsx_conversion_context()
void xlsx_conversion_context::set_font_directory(std::wstring pathFonts)
{
mediaitems_->set_font_directory(pathFonts);
}
void xlsx_conversion_context::set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle)
{
drawing_context_handle_ = handle;
}
void xlsx_conversion_context::set_mediaitems(mediaitems_ptr &items)
{
mediaitems_ = items;
mediaitems_.set_font_directory(pathFonts);
}
void xlsx_conversion_context::start_chart(std::wstring name)
@ -332,7 +323,7 @@ void xlsx_conversion_context::end_document()
output_document_->get_content_types_file().set_media(get_mediaitems());
output_document_->get_xl_files().set_media(get_mediaitems());
package::xl_drawings_ptr drawings = package::xl_drawings::create(drawing_context_handle_->content());
package::xl_drawings_ptr drawings = package::xl_drawings::create(xlsx_drawing_context_handle_.content());
output_document_->get_xl_files().set_drawings(drawings);
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
@ -505,13 +496,13 @@ void xlsx_conversion_context::end_table()
L"../pivotTables/pivotTable" + std::to_wstring(it->second) + L".xml"));
}
if (false == get_drawing_context().empty())
if (!get_drawing_context().empty())
{
std::wstringstream strm;
get_drawing_context().serialize(strm);
const std::pair<std::wstring, std::wstring> drawingName
= drawing_context_handle_->add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
= xlsx_drawing_context_handle_.add_drawing_xml(strm.str(), get_drawing_context().get_drawings() );
current_sheet().set_drawing_link(drawingName.first, drawingName.second);
@ -739,7 +730,7 @@ std::pair<float,float> xlsx_conversion_context::getMaxDigitSize()
else
font_size =10;
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_->applicationFonts());
maxDigitSize_ = utils::GetMaxDigitSizePixels(font_name.c_str(), font_size, 96., 0, mediaitems_.applicationFonts());
}
return maxDigitSize_;
}
@ -758,9 +749,9 @@ xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
return get_table_context().get_drawing_context();
}
xlsx_drawing_context_handle_ptr & xlsx_conversion_context::get_drawing_context_handle()
xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle()
{
return drawing_context_handle_;
return xlsx_drawing_context_handle_;
}
xlsx_comments_context & xlsx_conversion_context::get_comments_context()
{

View File

@ -188,16 +188,12 @@ public:
xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;}
xlsx_table_metrics & get_table_metrics();
xlsx_drawing_context & get_drawing_context();
xlsx_drawing_context_handle & get_drawing_context_handle();
xlsx_comments_context & get_comments_context();
xlsx_comments_context_handle & get_comments_context_handle();
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
void set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle);
mediaitems_ptr & get_mediaitems() { return mediaitems_; }
void set_mediaitems(mediaitems_ptr &items);
mediaitems & get_mediaitems() { return mediaitems_; }
static std::unordered_map<std::wstring, int> mapExternalLink_;
std::map<std::wstring, int> mapUsedNames_;
@ -217,7 +213,7 @@ private:
std::pair<float,float> maxDigitSize_;
num_format_context num_format_context_;
size_t default_style_;
mediaitems_ptr mediaitems_;
mediaitems mediaitems_;
std::multimap<std::wstring, int> mapPivotsTableView_;
std::map<std::wstring, std::wstring> control_props_;
@ -227,9 +223,9 @@ private:
xlsx_table_context xlsx_table_context_;
xlsx_text_context xlsx_text_context_;
xlsx_pivots_context xlsx_pivots_context_;
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
xlsx_comments_context_handle xlsx_comments_context_handle_;
xlsx_dataValidations_context xlsx_dataValidations_context_;
xlsx_drawing_context_handle_ptr drawing_context_handle_;
math_context math_context_;
forms_context forms_context_;

View File

@ -221,11 +221,6 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
chart_context.set_cache_only(true);
}
if (false == userShapes.first.empty())
{
chart_context.set_userShapes(userShapes);
}
Context.end_chart();
}
else if (object_type_ == 2 && office_text_)

View File

@ -206,7 +206,6 @@ public:
std::map<std::wstring, _cell>cash_pivot;
std::wstring embeddedData;
std::pair<std::wstring, std::wstring> userShapes;
//---------------------------------------
std::wstring target_table_;
std::wstring table_name_;

View File

@ -124,8 +124,9 @@ namespace chart {
std::wstring chart_name_;
std::wstring style_name_;
std::vector<grid> grids_;
int type_;
};
int type_;
};
struct series : public simple
{
struct point : public simple

View File

@ -265,13 +265,7 @@ void common_break_attlist::serialize(CP_ATTR_NODE)
void common_page_number_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
_CP_OPT(std::wstring) str;
CP_APPLY_ATTR(L"style:page-number", str);
if ((str) && (*str != L"auto"))
{
style_page_number_ = XmlUtils::GetInteger(*str);
}
CP_APPLY_ATTR(L"style:page-number", style_page_number_);
}
void common_page_number_attlist::apply_from(const common_page_number_attlist & Other)
{

View File

@ -499,15 +499,6 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
fill.gradient = oox::oox_gradient_fill::create();
Compute_GradientFill(image_style, fill.gradient);
if (fill.opacity)
{
for (size_t i = 0; i < fill.gradient->colors.size(); i++)
{
if (!fill.gradient->colors[i].opacity)
fill.gradient->colors[i].opacity = fill.opacity;
}
}
}
}
}

View File

@ -207,11 +207,6 @@ void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, cons
if (position_child_x2 < x + cx || position_child_x2 == 0x7fffffff) position_child_x2 = x + cx;
if (position_child_y2 < y + cy || position_child_y2 == 0x7fffffff) position_child_y2 = y + cy;
if (frame->is_object_)
{
object_index = content_.size() - 1;
}
}
else if (shape)
{
@ -261,20 +256,16 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
void draw_frame::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if (CP_CHECK_NAME(L"draw", L"text-box") ||
CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка
CP_CHECK_NAME(L"table", L"table") ||
CP_CHECK_NAME(L"draw", L"object-ole")||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"floating-frame")||
CP_CHECK_NAME(L"draw", L"plugin")
)
CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение embedded объекта
CP_CHECK_NAME(L"draw", L"object-ole") ||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
CP_CHECK_NAME(L"draw", L"plugin") ||
CP_CHECK_NAME(L"table", L"table")
)
{
CP_CREATE_ELEMENT(content_);
}
else if CP_CHECK_NAME(L"draw", L"object") //embedded объект
{
CP_CREATE_ELEMENT(content_);
is_object_ = true;
}
else if CP_CHECK_NAME(L"office", L"event-listeners")
{

View File

@ -153,7 +153,7 @@ public:
static const ElementType type = typeDrawFrame;
CPDOCCORE_DEFINE_VISITABLE();
draw_frame() : oox_drawing_(), idx_in_owner(-1), is_object_(false) {}
draw_frame() : oox_drawing_(), idx_in_owner(-1) {}
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
@ -185,10 +185,10 @@ public:
oox_drawing_ptr oox_drawing_;
bool is_object_;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_frame);
@ -209,7 +209,7 @@ public:
static const ElementType type = typeDrawG;
CPDOCCORE_DEFINE_VISITABLE();
draw_g() : object_index(-1), position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
draw_g() : position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
@ -228,8 +228,6 @@ public:
int position_child_x2;
int position_child_y2;
int object_index ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
@ -308,7 +306,6 @@ public:
odf_document_ptr odf_document_;
office_element_ptr_array content_; //for case group with object
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);

View File

@ -923,7 +923,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
{
std::wstring href = drawing->fill.bitmap->xlink_href_;
drawing->fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
}
////////////////////////////////////////////////////
@ -1196,7 +1196,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap = oox::oox_bitmap_fill::create();
drawing->fill.type = 2;
drawing->fill.bitmap->isInternal = false;
drawing->fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->bStretch = true;
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
@ -1216,7 +1216,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + xlink_attlist_.href_.get_value_or(L"");
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems()->applicationFonts());
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, Context.get_mediaitems().applicationFonts());
}
if (properties->common_draw_fill_attlist_.draw_luminance_)
{
@ -1352,32 +1352,6 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
Context.add_delayed_element(this);
return;
}
if (object_index >= 0) //только в документах нельзя объект объединять с шейпами в группы (
{
draw_frame *frame = dynamic_cast<draw_frame*>(content_[object_index].get());
frame->common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_ =
common_draw_attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
for (size_t i = 0; i < frame->content_.size(); i++)
{
draw_object *object = dynamic_cast<draw_object*>(frame->content_[i].get());
if (!object)continue;
for (size_t j = 0; j < content_.size(); j++)
{
if (j == object_index) continue;
object->content_.push_back(content_[j]);
}
break;
}
frame->docx_convert(Context);
return;
}
oox::_docx_drawing drawing = oox::_docx_drawing();
@ -1567,10 +1541,6 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
process_build_object process_build_object_(objectBuild, odf_document_->odf_context());
contentSubDoc->accept(process_build_object_);
frame = Context.get_drawing_context().get_current_frame(); //owner
if (frame)
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
if (objectBuild.table_table_)
{
oox::xlsx_conversion_context xlsx_context(odf_document_.get());
@ -1586,7 +1556,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
NSDirectory::CreateDirectory(href_folder);
outputXlsx.write(href_folder);
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems()->count_object + 1) + L".xlsx";
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))
@ -1595,34 +1565,11 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
}
}
if (false == content_.empty())
{
oox::xlsx_conversion_context xlsx_context(Context.root());
xlsx_context.set_drawing_context_handle(Context.get_chart_drawing_handle());
xlsx_context.set_mediaitems(Context.get_mediaitems());
xlsx_context.get_table_context().start_table(L"", L"", 0);
for (size_t i = 0; i < content_.size(); ++i)
{
xlsx_context.get_drawing_context().set_rel_anchor(drawing->cx, drawing->cy);
content_[i]->xlsx_convert(xlsx_context);
}
xlsx_context.get_table_context().end_table();
xlsx_context.get_drawing_context().process_objects(xlsx_context.get_table_metrics());
std::wstringstream strm;
xlsx_context.get_drawing_context().serialize(strm, L"cdr");
const std::pair<std::wstring, std::wstring> drawingName =
xlsx_context.get_drawing_context_handle()->add_drawing_xml(strm.str(), xlsx_context.get_drawing_context().get_drawings(), oox::typeChartUserShapes );
objectBuild.userShapes = drawingName;
}
objectBuild.docx_convert(Context);
frame = Context.get_drawing_context().get_current_frame(); //owner
if (frame)
drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
}
//------------------------------------------------------------------------------------------------------------
if (!frame || !drawing)
@ -1635,7 +1582,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
drawing->type = oox::typeChart;
bool isMediaInternal = true;
drawing->objectId = Context.get_mediaitems()->add_or_find(href, drawing->type, isMediaInternal, href);
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
}
else if (objectBuild.object_type_ == 2 ) //embedded text
{
@ -1694,7 +1641,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
bool isMediaInternal = true;
href += FILE_SEPARATOR_STR + href_new;
drawing->objectId = Context.get_mediaitems()->add_or_find(href, drawing->type, isMediaInternal, href);
drawing->objectId = Context.get_mediaitems().add_or_find(href, drawing->type, isMediaInternal, href);
drawing->objectProgId = L"Excel.Sheet.12";
}
}
@ -1735,7 +1682,7 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
bool isMediaInternal = true;
drawing->objectId = Context.get_mediaitems()->add_or_find(href + extension, drawing->type, isMediaInternal, href);
drawing->objectId = Context.get_mediaitems().add_or_find(href + extension, drawing->type, isMediaInternal, href);
}
void draw_control::docx_convert(oox::docx_conversion_context & Context)

View File

@ -303,7 +303,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
NSDirectory::CreateDirectory(href_folder);
outputXlsx.write(href_folder);
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems()->count_object + 1) + L".xlsx";
std::wstring href = L"Microsoft_Excel_Worksheet_" + std::to_wstring(Context.get_mediaitems().count_object + 1) + L".xlsx";
COfficeUtils oCOfficeUtils(NULL);
if (S_OK == oCOfficeUtils.CompressFileOrDirectory(href_folder, odfPath + FILE_SEPARATOR_STR + href, true))

View File

@ -102,7 +102,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
fill.bitmap->name_space = L"w14";
}

View File

@ -399,7 +399,7 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
if (state.ctrlPropId.empty())
{
std::wstring target;
state.ctrlPropId = Context.get_mediaitems()->add_control_props(target);
state.ctrlPropId = Context.get_mediaitems().add_control_props(target);
std::wstringstream strm;

View File

@ -126,7 +126,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
}
int id = Context.get_drawing_context().get_current_shape_id();
if (layout_properties->docx_background_serialize(Context.output_stream(), Context, fill, id))

View File

@ -1386,7 +1386,7 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
if ( fill.bitmap->rId.empty())
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.get_mediaitems()->add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
}

View File

@ -211,7 +211,7 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
{
bool isMediaInternal = false;
std::wstring ref;
fill.bitmap->rId = Context.get_slide_context().get_mediaitems()->add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);
}
oox::oox_serialize_fill(_Wostream, fill);

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

@ -437,19 +437,17 @@ void OoxConverter::convert(PPTX::Logic::ChartRec *oox_chart)
if (oFile.IsInit())
{
OOX::Spreadsheet::CChartSpace* pChart = dynamic_cast<OOX::Spreadsheet::CChartSpace*>(oFile.operator->());
OOX::Spreadsheet::CChartSpaceEx* pChartEx = dynamic_cast<OOX::Spreadsheet::CChartSpaceEx*>(oFile.operator->());
if (pChart || pChartEx)
if (pChart)
{
oox_current_child_document = pChart ? dynamic_cast<OOX::IFileContainer*>(pChart) : dynamic_cast<OOX::IFileContainer*>(pChartEx);
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(pChart);
OOX::CChartDrawing* pChartDrawing = NULL;
if ( (pChart) && ((pChart->m_oChartSpace.m_userShapes) && (pChart->m_oChartSpace.m_userShapes->m_id)) )
if ((pChart->m_oChartSpace.m_userShapes) && (pChart->m_oChartSpace.m_userShapes->m_id))
{
oFile = find_file_by_id (*pChart->m_oChartSpace.m_userShapes->m_id);
pChartDrawing = dynamic_cast<OOX::CChartDrawing*>(oFile.operator->());
}
if ((pChartDrawing) && (false == pChartDrawing->m_arrItems.empty()))
{
odf_context()->drawing_context()->start_group();
@ -467,16 +465,9 @@ void OoxConverter::convert(PPTX::Logic::ChartRec *oox_chart)
odf_context()->start_chart();
odf_context()->chart_context()->set_chart_size(width, height);
if (pChart)
{
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
OoxConverter::convert(&pChart->m_oChartSpace);
}
else if (pChartEx)
{
OoxConverter::convert(pChartEx->m_oChartSpace.m_oSpPr.GetPointer());
OoxConverter::convert(&pChartEx->m_oChartSpace);
}
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
OoxConverter::convert(&pChart->m_oChartSpace);
odf_context()->end_chart();
}
odf_context()->drawing_context()->end_object();
@ -757,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();
@ -1698,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);
@ -1986,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())
{
@ -2023,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

@ -230,26 +230,6 @@ namespace OOX
class CT_Style;
class CT_TextLanguageID;
class CTextProperties;
namespace ChartEx
{
class CChartSpace;
class CChart;
class CChartData;
class CData;
class CDimension;
class CPlotArea;
class CLegend;
class CAxis;
class CTickMarks;
class CGridlines;
class CValScaling;
class CCatScaling;
class CSeries;
class CDataLabels;
class CTitle;
}
}
class CSizeAnchor;
namespace Vml
@ -542,12 +522,7 @@ public:
void convert(OOX::Spreadsheet::CT_StrData *str_data, bool categories, bool label);
void convert(OOX::CSizeAnchor *sz_anchor, double x0, double y0, double width, double height);
//.chart.ex...........................................................................................................................
void convert(OOX::Spreadsheet::ChartEx::CChartSpace *oox_chart);
void convert(OOX::Spreadsheet::ChartEx::CTitle *ct_title);
void convert(OOX::Spreadsheet::ChartEx::CChart *oox_chart);
void convert(OOX::Spreadsheet::ChartEx::CChartData *oox_chart_data);
void convert(OOX::Spreadsheet::ChartEx::CPlotArea *oox_plot_area);
//.vml............................................................................................................................
void convert(OOX::Vml::CShapeType *vml_shape_type);
void convert(OOX::Vml::CShape *vml_shape);

View File

@ -282,6 +282,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
odf_context()->chart_context()->end_element();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
{
if (axis == NULL)return;
@ -447,6 +448,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
convert(axis->m_minorGridlines, 2);
odf_context()->chart_context()->end_element();
}
////////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Spreadsheet::CT_ChartLines *line, int type)
{
if (line == NULL)return;
@ -1210,6 +1212,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
void OoxConverter::convert(OOX::Spreadsheet::CT_Surface* ct_surface, int type, bool chart3D)
{
if (ct_surface == NULL && chart3D == false)return;
@ -1290,59 +1293,4 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool categori
odf_context()->chart_context()->set_cash(format, data, categories, label);
}
//---------------------------------------------------------------------------------------------------------------
////chart ex ///////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------------------------------------------
void OoxConverter::convert(OOX::Spreadsheet::ChartEx::CPlotArea* oox_plotArea)
{
if (oox_plotArea == NULL)return;
//convert(oox_plotArea->m_layout);
///////////////////////
for (size_t i = 0; i < oox_plotArea->m_plotAreaRegion.m_arSeries.size(); i++)
{
convert(oox_plotArea->m_plotAreaRegion.m_arSeries[i]);
}
for (size_t i = 0; i < oox_plotArea->m_arAxis.size(); i++)
{
convert(oox_plotArea->m_arAxis[i]);
}
odf_context()->chart_context()->start_wall();
{
convert(oox_plotArea->m_oSpPr.GetPointer());
}
odf_context()->chart_context()->end_element();
}
void OoxConverter::convert(OOX::Spreadsheet::ChartEx::CChartData *oox_chart_data)
{
if (!oox_chart_data) return;
for (size_t i = 0; i < oox_chart_data->m_arData.size(); i++)
{
}
}
void OoxConverter::convert(OOX::Spreadsheet::ChartEx::CChartSpace *oox_chart)
{
if (!oox_chart)return;
convert(oox_chart->m_oSpPr.GetPointer());
convert_chart_text(oox_chart->m_oTxPr.GetPointer());
//convert(oox_chart->m_chart.m_title);
//convert(oox_chart->m_chart.m_legend);
convert(&oox_chart->m_chartData);
odf_context()->chart_context()->start_plot_area();
{
convert(&oox_chart->m_chart.m_plotArea);
}
odf_context()->chart_context()->end_plot_area();
}
}

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

@ -119,12 +119,6 @@ namespace PPTX
else if (relation.Type() == OOX::FileTypes::Chart)
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace(pMain, filename, filename));
else if (relation.Type() == OOX::FileTypes::ChartEx)
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpaceEx(pMain, filename, filename));
else if (relation.Type() == OOX::FileTypes::ChartStyle)
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartStyle(pMain, filename, filename));
else if (relation.Type() == OOX::FileTypes::ChartColorStyle)
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartColorStyle(pMain, filename, filename));
else if (relation.Type() == OOX::FileTypes::HyperLink)
return smart_ptr<OOX::File>(new OOX::HyperLink(pMain, relation.Target()));
else if (relation.Type() == OOX::FileTypes::Image)

View File

@ -508,14 +508,7 @@ namespace PPTX
}
else if (chartRec.is_init())
{
if (chartRec->m_bChartEx)
{
pWriter->WriteRecord2(4, chartRec);
}
else
{
pWriter->WriteRecord2(3, chartRec);
}
pWriter->WriteRecord2(3, chartRec);
}
else if (element.is_init())
{
@ -582,12 +575,6 @@ namespace PPTX
chartRec = new Logic::ChartRec();
chartRec->fromPPTY(pReader);
}
case 4:
{
chartRec = new Logic::ChartRec();
chartRec->m_bChartEx = true;
chartRec->fromPPTY(pReader);
}
default:
break;
}

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

@ -175,9 +175,9 @@ namespace PPTX
else if (pRels != NULL) file = pRels->Find(*id_data);
}
smart_ptr<OOX::Spreadsheet::CChartSpace> pChart = file.smart_dynamic_cast<OOX::Spreadsheet::CChartSpace>();
smart_ptr<OOX::Spreadsheet::CChartSpaceEx> pChartEx = file.smart_dynamic_cast<OOX::Spreadsheet::CChartSpaceEx>();
if (false == pChart.IsInit() && false == pChartEx.IsInit()) return;
if (pChart.IsInit() == false)
return;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
@ -190,14 +190,7 @@ namespace PPTX
oDrawingConverter.SetRels(pChart.smart_dynamic_cast<OOX::IFileContainer>());
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(*pWriter, &oDrawingConverter);
if (pChart.IsInit())
{
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
}
else if (pChartEx.IsInit())
{
//oBinaryChartWriter.WriteCT_ChartSpace(*pChartEx);
}
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
oDrawingConverter.SetRels(oldRels);

View File

@ -123,8 +123,10 @@ namespace PPTX
public:
WritingElement_AdditionConstructors(ChartRec)
ChartRec() : m_bChartEx(false), m_bData(false), m_lChartNumber(0)
ChartRec()
{
m_bData = false;
m_lChartNumber = 0;
}
ChartRec(const ChartRec& oSrc)
@ -146,11 +148,7 @@ namespace PPTX
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring ns = XmlUtils::GetNamespace(oReader.GetName());
m_bData = false;
m_bChartEx = false;
ReadAttributes( oReader );
FillParentPointersForChilds();
@ -158,18 +156,10 @@ namespace PPTX
{
m_bData = true;
}
if (ns == L"cx")
{
m_bChartEx = true;
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_bData = false;
m_bChartEx = false;
std::wstring ns = XmlUtils::GetNamespace(node.GetName());
XmlMacroReadAttributeBase(node, L"r:id", id_data);
FillParentPointersForChilds();
@ -178,10 +168,6 @@ namespace PPTX
{
m_bData = true;
}
if (ns == L"cx")
{
m_bChartEx = true;
}
}
virtual std::wstring toXML() const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
@ -193,7 +179,6 @@ namespace PPTX
LONG m_lChartNumber;
bool m_bData;
bool m_bChartEx;
protected:
virtual void FillParentPointersForChilds()
{

View File

@ -149,7 +149,7 @@ namespace PPTX
std::wstring SpPr::toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.WriteLimitNullable(L"bwMode", bwMode);
oAttr.WriteLimitNullable(_T("bwMode"), bwMode);
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(xfrm);
@ -160,7 +160,7 @@ namespace PPTX
oValue.WriteNullable(scene3d);
oValue.WriteNullable(sp3d);
return XmlUtils::CreateNode(m_namespace + L":spPr", oAttr, oValue);
return XmlUtils::CreateNode(m_namespace + _T(":spPr"), oAttr, oValue);
}
void SpPr::Merge(SpPr& spPr)const

View File

@ -137,6 +137,7 @@ namespace PPTX
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
void Merge(SpPr& spPr)const;
public:
nullable<Xfrm> xfrm;
Logic::Geometry Geometry;
UniFill Fill;
@ -146,8 +147,9 @@ namespace PPTX
nullable<Sp3d> sp3d;
nullable_limit<Limit::BWMode> bwMode;
std::wstring m_namespace;
//private:
public:
std::wstring m_namespace;
protected:
virtual void FillParentPointersForChilds();
};

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

@ -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

@ -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"
@ -490,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

@ -53,13 +53,11 @@ SOURCES += \
../Source/DocxFormat/Docx.cpp \
../Source/DocxFormat/Comments.cpp \
../Source/XlsxFormat/Chart/ChartSerialize.cpp \
../Source/XlsxFormat/Chart/ChartSerializeEx.cpp \
../Source/XlsxFormat/Common.cpp \
../Source/XlsxFormat/Xlsx.cpp \
../Source/XlsxFormat/Worksheets/Worksheet.cpp \
../Source/XlsxFormat/Worksheets/SheetData.cpp \
../Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp \
../Source/XlsxFormat/Worksheets/DataValidation.cpp \
../Source/DocxFormat/App.cpp \
../Source/DocxFormat/Core.cpp \
../Source/DocxFormat/FileFactory.cpp \
@ -186,7 +184,6 @@ HEADERS += docxformatlib.h \
../Source/XlsxFormat/CalcChain/CalcChain.h \
../Source/XlsxFormat/Chart/Chart.h \
../Source/XlsxFormat/Chart/ChartSerialize.h \
../Source/XlsxFormat/Chart/ChartSerializeEx.h \
../Source/XlsxFormat/Comments/Comments.h \
../Source/XlsxFormat/Drawing/CellAnchor.h \
../Source/XlsxFormat/Drawing/Drawing.h \
@ -219,7 +216,6 @@ HEADERS += docxformatlib.h \
../Source/XlsxFormat/Workbook/WorkbookPr.h \
../Source/XlsxFormat/Worksheets/Cols.h \
../Source/XlsxFormat/Worksheets/ConditionalFormatting.h \
../Source/XlsxFormat/Worksheets/DataValidation.h \
../Source/XlsxFormat/Worksheets/Hyperlinks.h \
../Source/XlsxFormat/Worksheets/MergeCells.h \
../Source/XlsxFormat/Worksheets/SheetData.h \

View File

@ -31,11 +31,9 @@
*/
#include "../Source/XlsxFormat/Chart/ChartSerialize.cpp"
#include "../Source/XlsxFormat/Chart/ChartSerializeEx.cpp"
#include "../Source/XlsxFormat/Common.cpp"
#include "../Source/XlsxFormat/FileFactory_Spreadsheet.cpp"
#include "../Source/XlsxFormat/Xlsx.cpp"
#include "../Source/XlsxFormat/Worksheets/SheetData.cpp"
#include "../Source/XlsxFormat/Worksheets/Worksheet.cpp"
#include "../Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp"
#include "../Source/XlsxFormat/Worksheets/DataValidation.cpp"

View File

@ -1516,14 +1516,6 @@
RelativePath="..\Source\XlsxFormat\Chart\ChartSerialize.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Chart\ChartSerializeEx.cpp"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Chart\ChartSerializeEx.h"
>
</File>
</Filter>
<Filter
Name="Comments"
@ -1704,14 +1696,6 @@
RelativePath="..\Source\XlsxFormat\Worksheets\ConditionalFormatting.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Worksheets\DataValidation.cpp"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Worksheets\DataValidation.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Worksheets\Hyperlinks.h"
>

View File

@ -93,55 +93,7 @@ namespace ComplexTypes
virtual void FromXML(XmlUtils::CXmlNode& oNode) = 0;
virtual std::wstring ToString() const = 0;
};
//--------------------------------------------------------------------------------
// DecimalNumber 17.3.1.10 (Part 1)
//--------------------------------------------------------------------------------
class CDecimalNumber : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CDecimalNumber)
CDecimalNumber()
{
}
virtual ~CDecimalNumber()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
XmlMacroReadAttributeBase( oNode, L"val", m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring ToString() const
{
std::wstring sResult;
if ( m_oVal.IsInit() )
{
sResult += L"val=\"" + m_oVal->ToString() + L"\"" ;
}
return sResult;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_oVal )
WritingElement_ReadAttributes_End_No_NS( oReader )
}
public:
nullable<SimpleTypes::CDecimalNumber<> > m_oVal;
};
namespace Word
{
@ -1132,7 +1084,7 @@ namespace ComplexTypes
//--------------------------------------------------------------------------------
// DecimalNumber 17.3.1.10 (Part 1)
//--------------------------------------------------------------------------------
class CDecimalNumber : public ComplexTypes::CDecimalNumber
class CDecimalNumber : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CDecimalNumber)
@ -1142,13 +1094,17 @@ namespace ComplexTypes
virtual ~CDecimalNumber()
{
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
ComplexTypes::CDecimalNumber::FromXML(oReader);
XmlMacroReadAttributeBase( oNode, _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal );
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring ToString() const
{
@ -1156,11 +1112,26 @@ namespace ComplexTypes
if ( m_oVal.IsInit() )
{
sResult += L"w:val=\"" + m_oVal->ToString() + L"\" ";
sResult += _T("w:val=\"");
sResult += m_oVal->ToString();
sResult += _T("\" ");
}
return sResult;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CDecimalNumber<> > m_oVal;
};
//--------------------------------------------------------------------------------
// DecimalNumberOrPrecent 17.3.1.10 (Part 1)
@ -1591,6 +1562,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -1666,6 +1638,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_sAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
@ -1676,10 +1649,10 @@ namespace ComplexTypes
public:
nullable<std::wstring> m_sAuthor;
nullable<SimpleTypes::CDateTime> m_oDate;
nullable<SimpleTypes::CDecimalNumber<>> m_oId;
nullable<std::wstring> m_sUserId;
nullable<std::wstring > m_sAuthor;
nullable<SimpleTypes::CDateTime > m_oDate;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
nullable<std::wstring > m_sUserId;
};
//--------------------------------------------------------------------------------
@ -1719,6 +1692,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -1771,6 +1745,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -1823,6 +1798,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -1901,6 +1877,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -1953,6 +1930,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
@ -2006,6 +1984,7 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("x"), m_oX )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("y"), m_oY )
@ -2015,6 +1994,7 @@ namespace ComplexTypes
public:
SimpleTypes::CCoordinate m_oX;
SimpleTypes::CCoordinate m_oY;
};
// -----------------------------------------------------------------------
// Extent (PositiveSize2D) 20.4.2.7
@ -2058,14 +2038,17 @@ namespace ComplexTypes
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("cx"), m_oCx )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cy"), m_oCy )
WritingElement_ReadAttributes_End( oReader )
}
public:
public:
SimpleTypes::CPositiveCoordinate<> m_oCx;
SimpleTypes::CPositiveCoordinate<> m_oCy;
}; // Drawing
}
} // ComplexTypes

View File

@ -12,8 +12,8 @@
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View File

@ -12,8 +12,8 @@
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

View File

@ -12,8 +12,8 @@
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under

Some files were not shown because too many files have changed in this diff Show More