Compare commits

...

25 Commits

Author SHA1 Message Date
02e8649a61 . 2018-06-06 19:32:16 +03:00
447dc81426 [ios][x2t] enable txt format 2018-06-06 16:02:57 +03:00
0f3c883d24 . 2018-06-06 15:24:54 +03:00
0b16b9a7f9 . 2018-06-05 19:35:00 +03:00
7014faa9a1 . 2018-06-04 15:27:48 +03:00
93287c84c8 OdfFormatReader - meta data file, new convert tabs stop 2018-06-04 15:24:49 +03:00
dafcbacfaf [ios][x2t] add version property 2018-06-04 13:48:09 +03:00
1c73ff0c3f Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-06-01 18:18:31 +03:00
5a8c9069be OdfFormatReader - fix users file 2018-06-01 18:17:56 +03:00
4ba2e1fa6d x2t - split version info in separate file 2018-06-01 16:11:13 +03:00
95af281145 x2t - write embedded ms package with zero offsets 2018-05-31 17:29:44 +03:00
00fb2ba7bb [ios][x2t] update converter 2018-05-31 14:44:14 +03:00
0f65e36517 Merge branch 'feature/graphics' into develop 2018-05-31 11:39:29 +03:00
aa1af73fda x2t version up 2018-05-30 19:20:18 +03:00
1610978821 [ios][se][pe] fixed build 2018-05-30 18:08:43 +03:00
20faf24556 RtfFormatWriter - add comments (fix bug #37807) 2018-05-30 16:37:41 +03:00
ae90e4ae96 Merge pull request #87 from ONLYOFFICE/feature/onlypass
Feature/onlypass
2018-05-30 13:58:42 +03:00
6fae9115ea Merge branch 'hotfix/v5.1.5' into feature/onlypass 2018-05-30 13:58:29 +03:00
c14a21b2da Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-05-30 13:21:14 +03:00
b952692225 . 2018-05-30 12:50:50 +03:00
23249e69f9 . 2018-05-29 19:53:13 +03:00
09f6c3f4e8 . 2018-05-29 19:03:58 +03:00
867b0634f3 Fix bug #36423
Fix problem with the clip in the EMF
2018-05-29 18:33:49 +03:00
1c2b86519e [bug] Fix bug 37565 2018-05-23 16:38:24 +03:00
323d1b44cd openssl 2018-05-23 13:36:26 +03:00
72 changed files with 4014 additions and 1502 deletions

View File

@ -19,9 +19,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormulasConvert", "..\wi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeFileCrypt", "..\..\OfficeCryptReader\win32\ECMACryptReader.vcproj", "{C27E9A9F-3A17-4482-9C5F-BF15C01E747C}"

View File

@ -77,6 +77,7 @@ SOURCES += \
../src/odf/office_settings.cpp \
../src/odf/office_spreadsheet.cpp \
../src/odf/office_text.cpp \
../src/odf/office_meta.cpp \
../src/odf/paragraph_elements.cpp \
../src/odf/ruby.cpp \
../src/odf/search_table_cell.cpp \
@ -342,6 +343,7 @@ HEADERS += \
../src/odf/office_settings.h \
../src/odf/office_spreadsheet.h \
../src/odf/office_text.h \
../src/odf/office_meta.h \
../src/odf/paragraph_elements.h \
../src/odf/ruby.h \
../src/odf/search_table_cell.h \

View File

@ -67,6 +67,7 @@
#include "../src/odf/office_settings.cpp"
#include "../src/odf/office_spreadsheet.cpp"
#include "../src/odf/office_text.cpp"
#include "../src/odf/office_meta.cpp"
#include "../src/odf/paragraph_elements.cpp"
#include "../src/odf/ruby.cpp"
#include "../src/odf/search_table_cell.cpp"

View File

@ -334,10 +334,12 @@ void docx_conversion_context::end_math_formula()
output_stream() << L"<m:oMath>" << math_content << L"</m:oMath>";
}
}
void docx_conversion_context::start_table_content(int type)
void docx_conversion_context::start_sdt(int type)
{
in_table_content_ = true;
table_content_context_.type_table_content = type;
std::wstring sType;
switch(type)
@ -349,15 +351,72 @@ void docx_conversion_context::start_table_content(int type)
output_stream() << L"<w:sdt>";
output_stream() << L"<w:sdtPr>";
//output_stream() << L"<w:id w:val=\"-505364165\"/>";
output_stream() << L"<w:docPartObj>";
output_stream() << L"<w:docPartGallery w:val=\"" << sType << L"\"/>";
output_stream() << L"<w:docPartUnique/>";
output_stream() << L"</w:docPartObj>";
if (false == sType.empty())
{
output_stream() << L"<w:docPartObj>";
output_stream() << L"<w:docPartGallery w:val=\"" << sType << L"\"/>";
output_stream() << L"<w:docPartUnique/>";
output_stream() << L"</w:docPartObj>";
}
output_stream() << L"</w:sdtPr>";
output_stream() << L"<w:sdtContent>";
}
void docx_conversion_context::end_table_content()
void docx_conversion_context::start_index_content()
{
if (!in_table_content_) return;
start_paragraph(false);
std::wstring sInstrText;
switch(table_content_context_.type_table_content)
{
case 1: sInstrText += L" TOC \\h \\o \"1-3\" \\u \\l 1-3 "; break;
case 2: sInstrText += L" TOC \\h \\z"; break;
case 5: sInstrText += L" INDEX \\c \"2\" \\z \"1049\" "; break;
}
if (!table_content_context_.caption_sequence_name.empty())
{
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\" ";
}
output_stream() << L"<w:r>";
output_stream() << L"<w:fldChar w:fldCharType=\"begin\"/>";
output_stream() << L"</w:r>";
output_stream() << L"<w:r>";
output_stream() << L"<w:instrText xml:space=\"preserve\">" + sInstrText + L"</w:instrText>";
output_stream() << L"</w:r>";
output_stream() << L"<w:r>";
//output_stream() << L"<w:rPr>
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:eastAsia="DejaVuSans" w:hAnsi="Minion Pro"/>
//output_stream() << L"<w:bCs w:val="0"/>
//output_stream() << L"<w:sz w:val="21"/>
//output_stream() << L"<w:szCs w:val="24"/>
//output_stream() << L"</w:rPr>
output_stream() << L"<w:fldChar w:fldCharType=\"separate\"/>";
output_stream() << L"</w:r>";
finish_paragraph();
}
void docx_conversion_context::end_index_content()
{
if (!in_table_content_) return;
start_paragraph(false);
output_stream() << L"<w:r>";
//output_stream() << L"<w:rPr>";
//output_stream() << L"<w:rFonts w:ascii="Minion Pro" w:hAnsi="Minion Pro"/>";
//output_stream() << L"<w:sz w:val="20"/>
//output_stream() << L"</w:rPr>";
output_stream() << L"<w:fldChar w:fldCharType=\"end\"/>";
output_stream() << L"</w:r>";
finish_paragraph();
}
void docx_conversion_context::end_sdt()
{
if (!in_table_content_) return;
@ -366,6 +425,14 @@ void docx_conversion_context::end_table_content()
in_table_content_ = false;
}
void docx_conversion_context::start_index_element()
{
table_content_context_.clear_current_level_index();
}
void docx_conversion_context::end_index_element()
{
table_content_context_.clear_current_level_index();
}
void docx_conversion_context::start_bookmark (const std::wstring &name)
{
std::map<std::wstring, int>::iterator pFind = mapBookmarks.find(name);
@ -1062,7 +1129,8 @@ void docx_conversion_context::start_automatic_style(const std::wstring & ParentI
void docx_conversion_context::end_automatic_style()
{
in_automatic_style_ = false;
automatic_parent_style_ = L"";
automatic_parent_style_.clear();
tabs_context_.clear();
}
bool docx_conversion_context::in_automatic_style()
@ -1266,7 +1334,11 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
if (false == Attr->text_style_name_.empty())
{
if (odf_reader::style_instance * styleInst =
if (in_table_content_ && Attr->text_style_name_.empty())
{
table_content_context_.set_current_level(Attr->text_style_name_);
}
if (odf_reader::style_instance * styleInst =
root()->odf_context().styleContainer().style_by_name(Attr->text_style_name_, odf_types::style_family::Paragraph, process_headers_footers_)
)
{
@ -1276,33 +1348,39 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
if (odf_reader::style_content * styleContent = styleInst->content())
{
std::wstring id;
//office_element_ptr parent_tab_stops_;
if (const odf_reader::style_instance * parentStyleContent = styleInst->parent())
{
id = styles_map_.get( parentStyleContent->name(), parentStyleContent->type() );
std::wstring parent_name = parentStyleContent->name();
id = styles_map_.get( parent_name, parentStyleContent->type() );
if (in_table_content_ && table_content_context_.empty_current_table_content_level_index())
{
table_content_context_.set_current_level(parent_name);
}
}
start_automatic_style(id);
{//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
if (properties.style_writing_mode_)
odf_reader::calc_tab_stops(styleInst, get_tabs_context());
//вытаскивает rtl c цепочки стилей !! - просто прописать в наследуемом НЕЛЬЗЯ !!
odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst);
if (properties.style_writing_mode_)
{
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
switch(type)
{
odf_types::writing_mode::type type = properties.style_writing_mode_->get_type();
switch(type)
{
case odf_types::writing_mode::RlTb:
case odf_types::writing_mode::TbRl:
case odf_types::writing_mode::Rl:
set_rtl(true);
break;
default:
set_rtl(false);
}
case odf_types::writing_mode::RlTb:
case odf_types::writing_mode::TbRl:
case odf_types::writing_mode::Rl:
set_rtl(true);
break;
default:
set_rtl(false);
}
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
//for calculate tabs
}
set_margin_left(properties.fo_margin_left_? 20.0 * properties.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt) : 0);
styleContent->docx_convert(*this);
@ -1415,7 +1493,7 @@ void docx_conversion_context::process_page_break_after(const odf_reader::style_i
{
if (inst->content() && inst->content()->get_style_paragraph_properties())
{
_CP_OPT(odf_types::fo_break) fo_break_val = inst->content()->get_style_paragraph_properties()->content().fo_break_after_;
_CP_OPT(odf_types::fo_break) fo_break_val = inst->content()->get_style_paragraph_properties()->content_.fo_break_after_;
if (fo_break_val)
{
if (fo_break_val->get_type() == odf_types::fo_break::Page)
@ -1811,6 +1889,7 @@ void docx_conversion_context::add_user_field(const std::wstring & name, const st
{
map_user_fields.insert(std::make_pair(name, value));
}
std::wstring docx_conversion_context::get_user_field(const std::wstring & name)
{
std::map<std::wstring, std::wstring>::iterator pFind = map_user_fields.find(name);

View File

@ -613,6 +613,112 @@ private:
_state current_state_;
std::map<std::wstring, _state> mapElements_;
};
class table_content_context
{
public:
enum template_type
{
TableContent = 1,
Illustrations = 2,
Bibliography = 3,
Tables = 4
};
enum level_type
{
Span = 1,
Text = 2,
LinkStart = 3,
LinkEnd = 4,
TabStop = 5,
PageNumber = 6,
Chapter = 7
};
struct _state
{
std::wstring name;
std::vector<int> levels;
void clear()
{
name.clear();
levels.clear();
}
};
void start_template(int type)
{
current_template.clear();
caption_sequence_name.clear();
type_table_content = type;
}
void end_template()
{
}
void add_level_content(int type)
{
current_state.levels.push_back(type);
}
void start_level(const std::wstring& style_name)
{
current_state.name = style_name;
}
void end_level()
{
current_template.insert(std::make_pair(current_state.name, current_state));
current_state.clear();
}
//std::vector<int> find(const std::wstring &name)
//{
// std::map<std::wstring, _state>::iterator pFind = current_template.find(name);
// if (pFind == current_template.end())
// {
// std::vector<int> empty;
// return empty;
// }
// return pFind->second.levels;
//}
void set_current_level(const std::wstring &name)
{
std::map<std::wstring, _state>::iterator pFind = current_template.find(name);
if (pFind == current_template.end())
{
current_level_.clear();
}
current_level_ = pFind->second.levels;
current_level_index_ = 0;
}
void next_level_index()
{
current_level_index_++;
}
int get_type_current_level_index()
{
if (current_level_index_ < (int)current_level_.size() && current_level_index_ >= 0)
return current_level_[current_level_index_];
return 0;
}
void clear_current_level_index()
{
current_level_index_ = 0;
current_level_.clear();
}
bool empty_current_table_content_level_index()
{
return current_level_.empty();
}
std::wstring caption_sequence_name;
int type_table_content;
private:
std::vector<int> current_level_;
int current_level_index_;
std::map<std::wstring, _state> current_template;
_state current_state;
};
//---------------------------------------------------------------------------------------------------------
class docx_conversion_context : boost::noncopyable
{
@ -636,7 +742,7 @@ public:
void add_user_field (const std::wstring & name, const std::wstring & value);
std::wstring get_user_field (const std::wstring & name);
void add_element_to_run (std::wstring parenStyleId = _T(""));
void add_element_to_run (std::wstring parenStyleId = _T(""));
void finish_run ();
void add_new_run (std::wstring parentStyleId = _T(""));
bool get_run_state () { return in_run_; }
@ -684,8 +790,14 @@ public:
void start_office_text ();
void end_office_text ();
void start_table_content (int type);
void end_table_content ();
void start_sdt (int type);
void end_sdt ();
void start_index_content();
void end_index_content();
void start_index_element();
void end_index_element();
void process_styles ();
void process_fonts ();
@ -761,6 +873,9 @@ public:
notes_context & get_notes_context() { return notes_context_; }
text_tracked_context& get_text_tracked_context(){ return text_tracked_context_; }
text_forms_context & get_forms_context() { return text_forms_context_; }
tabs_context & get_tabs_context() { return tabs_context_;}
table_content_context & get_table_content_context() { return table_content_context_;}
void docx_convert_delayed ();
void add_delayed_element (odf_reader::office_element * Elm);
@ -822,6 +937,7 @@ private:
std::wstringstream footer_xml_;
std::wstringstream header_xml_;
std::wstringstream settings_xml_;
std::wstringstream meta_xml_;
styles_context styles_context_;
math_context math_context_;
@ -834,6 +950,8 @@ private:
notes_context notes_context_;
text_tracked_context text_tracked_context_;
text_forms_context text_forms_context_;
tabs_context tabs_context_;
table_content_context table_content_context_;
boost::shared_ptr<streams_man> streams_man_;
@ -880,6 +998,7 @@ private:
std::map<std::wstring, std::wstring> map_user_fields;
std::map<std::wstring, int> mapBookmarks;
};
}

View File

@ -39,9 +39,58 @@
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_paragraph_properties.h"
namespace cpdoccore {
void tabs_context::reset()
{
for (size_t i = 0; i < tabs.size(); i++)
{
odf_reader::style_tab_stop *tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(tabs[i].get());
if (tab_stop)
{
clear_tabs.insert(std::make_pair(tab_stop->style_position_.get_value(), tabs[i]));
}
}
tabs.clear();
}
void tabs_context::add(const odf_reader::office_element_ptr & element)
{
odf_reader::style_tab_stop *tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(element.get());
if (tab_stop)
{
std::map<double, odf_reader::office_element_ptr>::iterator pFind = clear_tabs.find(tab_stop->style_position_.get_value());
if (pFind != clear_tabs.end())
{
clear_tabs.erase(pFind);
}
tabs.push_back(element);
}
}
void tabs_context::docx_convert(oox::docx_conversion_context & Context)
{
if (clear_tabs.empty() && tabs.empty()) return;
std::wstringstream & _pPr = Context.get_styles_context().paragraph_nodes();
_pPr << L"<w:tabs>";
for (std::map<double, odf_reader::office_element_ptr>::iterator it = clear_tabs.begin(); it != clear_tabs.end(); ++it)
{
odf_reader::style_tab_stop * tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(it->second.get());
tab_stop->docx_convert(Context, true);
}
for (size_t i = 0; i < tabs.size(); i++)
{
odf_reader::style_tab_stop * tab_stop = dynamic_cast<odf_reader::style_tab_stop*>(tabs[i].get());
tab_stop->docx_convert(Context, false);
}
_pPr << L"</w:tabs>";
}
void styles_context::start_process_style(const odf_reader::style_instance * Instance)
{
current_processed_style_ = Instance;

View File

@ -33,6 +33,8 @@
#include <sstream>
#include <iosfwd>
#include <map>
#include <vector>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
@ -40,14 +42,41 @@
namespace cpdoccore {
namespace oox{
class docx_conversion_context;
class pptx_conversion_context;
};
namespace odf_reader
{
class style_instance;
class style_text_properties;
class fonts_container;
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
class office_element;
typedef boost::shared_ptr<office_element> office_element_ptr;
};
class tabs_context : boost::noncopyable
{
public:
std::vector<odf_reader::office_element_ptr> tabs;
std::map<double, odf_reader::office_element_ptr> clear_tabs;
void clear()
{
tabs.clear();
clear_tabs.clear();
}
void reset();
void add(const odf_reader::office_element_ptr & element);
void docx_convert(oox::docx_conversion_context & Context);
};
class styles_context : boost::noncopyable
{
public:

View File

@ -31,8 +31,6 @@
*/
#include "calcs_styles.h"
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
namespace cpdoccore {
@ -44,10 +42,10 @@ namespace odf_reader {
text_format_properties_content calc_text_properties_content(const std::vector<const style_text_properties*> & textProps)
{
text_format_properties_content result;
BOOST_FOREACH(const style_text_properties* v, textProps)
for (size_t i = 0; i < textProps.size(); i++)
{
if (v)
result.apply_from(v->content());
if (textProps[i])
result.apply_from(textProps[i]->content());
}
return result;
}
@ -60,20 +58,21 @@ text_format_properties_content calc_text_properties_content(const style_instance
{
if (const style_content * content = styleInstance->content())
if (const style_text_properties * textProp = content->get_style_text_properties())
textProps.push_back(textProp);
{
textProps.insert(textProps.begin(), textProp);
}
styleInstance = styleInstance->parent();
}
reverse(textProps.begin(), textProps.end());
return calc_text_properties_content(textProps);
}
text_format_properties_content calc_text_properties_content(const std::vector<const style_instance *> & styleInstances)
{
text_format_properties_content result;
BOOST_FOREACH(const style_instance * inst, styleInstances)
for (size_t i = 0; i < styleInstances.size(); i++)
{
result.apply_from(calc_text_properties_content(inst));
result.apply_from(calc_text_properties_content(styleInstances[i]));
}
return result;
}
@ -82,10 +81,10 @@ text_format_properties_content calc_text_properties_content(const std::vector<co
graphic_format_properties calc_graphic_properties_content(const std::vector<const graphic_format_properties*> & graphicProps)
{
graphic_format_properties result;
BOOST_FOREACH(const graphic_format_properties* v, graphicProps)
for (size_t i = 0; i < graphicProps.size(); i++)
{
if (v)
result.apply_from(v);
if (graphicProps[i])
result.apply_from(graphicProps[i]);
}
return result;
}
@ -97,20 +96,22 @@ graphic_format_properties calc_graphic_properties_content(const style_instance *
{
if (const style_content * content = styleInstance->content())
if (const graphic_format_properties * graphicProp = content->get_graphic_properties())
graphicProps.push_back(graphicProp);
{
graphicProps.insert(graphicProps.begin(), graphicProp);
}
styleInstance = styleInstance->parent();
}
reverse(graphicProps.begin(), graphicProps.end());
return calc_graphic_properties_content(graphicProps);
}
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances)
{
graphic_format_properties result;
BOOST_FOREACH(const style_instance * inst, styleInstances)
{
graphic_format_properties f = calc_graphic_properties_content(inst);
for (size_t i = 0; i < styleInstances.size(); i++)
{
graphic_format_properties f = calc_graphic_properties_content(styleInstances[i]);
result.apply_from(&f);
}
return result;
@ -121,10 +122,11 @@ graphic_format_properties calc_graphic_properties_content(const std::vector<cons
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_paragraph_properties*> & parProps)
{
paragraph_format_properties result;
BOOST_FOREACH(const style_paragraph_properties* v, parProps)
for (size_t i = 0; i < parProps.size(); i++)
{
if (v)
result.apply_from(v->content());
if (parProps[i])
result.apply_from(parProps[i]->content_);
}
return result;
}
@ -136,32 +138,60 @@ paragraph_format_properties calc_paragraph_properties_content(const style_instan
{
if (const style_content * content = styleInstance->content())
if (const style_paragraph_properties * parProp = content->get_style_paragraph_properties())
parProps.push_back(parProp);
{
parProps.insert(parProps.begin(), parProp);
}
styleInstance = styleInstance->parent();
}
reverse(parProps.begin(), parProps.end());
return calc_paragraph_properties_content(parProps);
}
paragraph_format_properties calc_paragraph_properties_content(const std::vector<const style_instance *> & styleInstances)
{
paragraph_format_properties result;
BOOST_FOREACH(const style_instance * inst, styleInstances)
for (size_t i = 0; i < styleInstances.size(); i++)
{
result.apply_from(calc_paragraph_properties_content(inst));
result.apply_from(calc_paragraph_properties_content(styleInstances[i]));
}
return result;
}
void calc_tab_stops(const style_instance * styleInstance, tabs_context & context)
{
std::vector<const style_paragraph_properties*> parProps;
while (styleInstance)
{
if (const style_content * content = styleInstance->content())
if (const style_paragraph_properties * parProp = content->get_style_paragraph_properties())
{
parProps.insert(parProps.begin(), parProp);
}
styleInstance = styleInstance->parent();
}
for (size_t i = 0; i < parProps.size(); i++)
{
if (parProps[i]->content_.style_tab_stops_)
{
style_tab_stops *tab_stops = dynamic_cast<style_tab_stops*>(parProps[i]->content_.style_tab_stops_.get());
context.reset();
for (size_t j = 0; j < tab_stops->content_.size(); j++)
{
context.add(tab_stops->content_[j]);
}
}
}
}
//////
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_table_cell_properties*> & props)
{
style_table_cell_properties_attlist result;
BOOST_FOREACH(const style_table_cell_properties* v, props)
for (size_t i = 0; i < props.size(); i++)
{
if (v)
result.apply_from(v->attlist_);
if (props[i])
result.apply_from(props[i]->attlist_);
}
return result;
}
@ -173,19 +203,20 @@ style_table_cell_properties_attlist calc_table_cell_properties(const style_insta
{
if (const style_content * content = styleInstance->content())
if (const style_table_cell_properties * prop = content->get_style_table_cell_properties())
props.push_back(prop);
{
props.insert(props.begin(), prop);
}
styleInstance = styleInstance->parent();
}
reverse(props.begin(), props.end());
return calc_table_cell_properties(props);
}
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances)
{
style_table_cell_properties_attlist result;
BOOST_FOREACH(const style_instance * inst, styleInstances)
for (size_t i = 0; i < styleInstances.size(); i++)
{
result.apply_from(calc_table_cell_properties(inst));
result.apply_from(calc_table_cell_properties(styleInstances[i]));
}
return result;
}

View File

@ -41,6 +41,7 @@
#include <vector>
namespace cpdoccore {
class tabs_context;
namespace odf_reader {
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance);
@ -55,5 +56,6 @@ paragraph_format_properties calc_paragraph_properties_content(const std::vector<
style_table_cell_properties_attlist calc_table_cell_properties(const style_instance * styleInstance);
style_table_cell_properties_attlist calc_table_cell_properties(const std::vector<const style_instance *> & styleInstances);
void calc_tab_stops(const style_instance * styleInstance, tabs_context & context);
}
}

View File

@ -58,6 +58,8 @@ namespace _image_file_
{
bool GetResolution(const wchar_t* fileName, int & Width, int &Height, NSFonts::IApplicationFonts* appFonts)
{
if (!appFonts) return false;
CBgraFrame image;
MetaFile::IMetaFile* meta_file = MetaFile::Create(appFonts);

View File

@ -77,6 +77,10 @@ void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & N
create_element_and_read(Reader, Ns, Name, content_, &context_, true);
}
else if CP_CHECK_NAME(L"office", L"document-settings")
{
create_element_and_read(Reader, Ns, Name, content_, &context_, true);
}
else if CP_CHECK_NAME(L"office", L"document-meta")
{
create_element_and_read(Reader, Ns, Name, content_, &context_, true);
}
@ -88,6 +92,7 @@ void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & N
{
create_element_and_read(Reader, Ns, Name, content_, &context_, true);
}
}
void content_xml_t::add_text(const std::wstring & Text)

View File

@ -56,6 +56,7 @@
#include "office_scripts.h"
#include "office_forms.h"
#include "office_event_listeners.h"
#include "office_meta.h"
#include "styles.h"
#include "style_regions.h"
@ -142,6 +143,9 @@ odf_document::Impl::Impl(xml::sax * Reader, const std::wstring & tempPath):
_CP_LOG << L"[info] parse manifest" << std::endl;
parse_manifests(content_xml_->get_content());
_CP_LOG << L"[info] parse meta" << std::endl;
parse_meta(content_xml_->get_content());
_CP_LOG << L"[info] parse settings" << std::endl;
parse_settings(content_xml_->get_content());
@ -207,6 +211,8 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
_CP_LOG << L"[info] read styles.xml" << std::endl;
styles_xml_ = read_file_content(styles_xml);
_CP_LOG << L"[info] read meta.xml" << std::endl;
meta_xml_ = read_file_content(meta_xml);
//----------------------------------------------------------------------------------------
_CP_LOG << L"[info] parse fonts" << std::endl;
parse_fonts(content_xml_ ? content_xml_->get_content() : NULL);
@ -217,6 +223,8 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
_CP_LOG << L"[info] parse settings" << std::endl;
parse_settings(settings_xml_ ? settings_xml_->get_content() : NULL);
_CP_LOG << L"[info] parse meta" << std::endl;
parse_meta(meta_xml_ ? meta_xml_->get_content() : NULL);
}
else
{
@ -636,7 +644,26 @@ void odf_document::Impl::parse_settings(office_element *element)
}
}
}
}
}
void odf_document::Impl::parse_meta(office_element *element)
{
office_document_base * document = dynamic_cast<office_document_base *>( element );
if (!document) return;
office_meta * meta = dynamic_cast<office_meta*>(document->office_meta_.get());
if (!meta) return;
for (size_t i = 0; i < meta->meta_user_defined_.size(); i++)
{
meta_user_defined * user_defined = dynamic_cast<meta_user_defined*>(meta->meta_user_defined_[i].get());
if (!user_defined) continue;
if (user_defined->meta_name_.empty()) continue;
context_->Settings().add_user_defined(user_defined->meta_name_, user_defined->content_);
}
}
void odf_document::Impl::parse_styles(office_element *element)

View File

@ -96,6 +96,7 @@ private:
void parse_fonts (office_element *elemen);
void parse_manifests(office_element *element);
void parse_settings (office_element *element);
void parse_meta (office_element *element);
bool decrypt_folder (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
bool decrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr data, int size );

View File

@ -74,7 +74,9 @@ void office_document_base::add_child_element( xml::sax * Reader, const std::wstr
CP_CREATE_ELEMENT(office_scripts_);
else if CP_CHECK_NAME(L"office", L"settings")
CP_CREATE_ELEMENT(office_settings_);
else if CP_CHECK_NAME(L"manifest", L"file-entry")
else if CP_CHECK_NAME(L"office", L"meta")
CP_CREATE_ELEMENT(office_meta_);
else if CP_CHECK_NAME(L"manifest", L"file-entry")
CP_CREATE_ELEMENT(manifests_);
else
CP_NOT_APPLICABLE_ELM();

View File

@ -50,6 +50,7 @@ enum ElementType
typeTextReferenceMark,
typeTextReferenceMarkStart,
typeTextReferenceMarkEnd,
typeTextReferenceRef,
typeTextFieldFieldmarkStart,
typeTextFieldFieldmarkEnd,
@ -98,12 +99,19 @@ enum ElementType
typeTextSequenceDecls,
typeTextSequenceDecl,
typeTextSequence,
typeTextSequenceRef,
typeTextHiddenParagraph,
typeTextHiddenText,
typePresentationFooter,
typePresentationDateTime,
typeDcCreator,
typeDcDate,
typeDcDescription,
typeDcSubject,
typeDcTitle,
typeDrawA,
@ -122,27 +130,62 @@ enum ElementType
typeTextNumberedParagraph,
typeTextExpression,
typeTextCommonEntryTemplate,
typeTextTableOfContent,
typeTextTableOfContentSource,
typeTextTableOfContentEntryTemplate,
typeTextIndexEntryText,
typeTextIndexEntryTabStop,
typeTextIndexEntrySpan,
typeTextIndexEntryPageNumber,
typeTextIndexEntryLinkStart,
typeTextIndexEntryLinkEnd,
typeTextIndexEntryChapter,
typeTextIndexEntryBibliography,
typeTextIllustrationIndex,
typeTextIllustrationIndexSource,
typeTextIllustrationIndexEntryTemplate,
typeTextTableIndex,
typeTextTableIndexSource,
typeTextTableIndexEntryTemplate,
typeTextObjectIndex,
typeTextObjectIndexSource,
typeTextObjectIndexEntryTemplate,
typeTextUserIndex,
typeTextUserIndexSource,
typeTextUserIndexEntryTemplate,
typeTextAlphabeticalIndex,
typeTextAlphabeticalIndexSource,
typeTextAlphabeticalIndexEntryTemplate,
typeTextBibliography,
typeTextBibliographySource,
typeTextBibliographyEntryTemplate,
typeTextBibliographyMark,
typeTextBibliographySource,
typeTextAlphabeticalIndexAutoMarkFile,
typeTextAlphabeticalIndexMarkStart,
typeTextAlphabeticalIndexMarkEnd,
typeTextAlphabeticalIndexMark,
typeTextTocMarkStart,
typeTextTocMarkEnd,
typeTextTocMark,
typeTextUserIndexMarkStart,
typeTextUserIndexMarkEnd,
typeTextUserIndexMark,
typeTextIndexSourceStyles,
typeTextIndexSourceStyle,
typeTextVariableInput,
typeTextVariableGet,
@ -156,6 +199,8 @@ enum ElementType
typeTextUserFieldSet,
typeTextUserFieldInput,
typeTextUserDefined,
typeTextTrackedChanges,
typeTextChangedRegion,
typeTextChangeStart,
@ -234,6 +279,8 @@ enum ElementType
typeTableOddColumnsTemplate,
typeTableOddRowsTemplate,
typeTextIndexTitleTemplate,
typeTextNotesConfiguration,
typeStyleFontFace,
@ -374,6 +421,15 @@ enum ElementType
typeOfficeSettingsConfigItemMapNamed,
typeOfficeSettingsConfigItemMapEntry,
typeOfficeMeta,
typeOfficeMetaUserDefined,
typeOfficeMetaDocumentStatistic,
typeOfficeMetaGenerator,
typeOfficeMetaCreationDate,
typeOfficeMetaKeyword,
typeOfficeMetaEditingCycles,
typeOfficeMetaEditingDuration,
typeDrawG,
typeDrawFrame,
typeDrawImage,

View File

@ -0,0 +1,111 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* 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 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
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "office_meta.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
namespace cpdoccore {
namespace odf_reader {
// office:meta
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_meta::ns = L"office";
const wchar_t * office_meta::name = L"meta";
void office_meta::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void office_meta::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if (Ns==L"meta" && Name == L"generator")
{
CP_CREATE_ELEMENT(meta_generator_);
}
else if (Ns==L"meta" && Name == L"document-statistic")
{
CP_CREATE_ELEMENT(meta_document_statistic_);
}
else if (Ns==L"meta" && Name == L"user-defined")
{
CP_CREATE_ELEMENT(meta_user_defined_);
}
else
{
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * meta_generator::ns = L"meta";
const wchar_t * meta_generator::name = L"generator";
void meta_generator::add_text(const std::wstring & text)
{
content_ = text;
}
// config_item
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * meta_document_statistic::ns = L"meta";
const wchar_t * meta_document_statistic::name = L"document-statistic";
void meta_document_statistic::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"meta:table-count", meta_table_count_);
CP_APPLY_ATTR(L"meta:image-count", meta_image_count_);
CP_APPLY_ATTR(L"meta:object-count", meta_object_count_);
CP_APPLY_ATTR(L"meta:page-count", meta_page_count_);
CP_APPLY_ATTR(L"meta:paragraph-count", meta_paragraph_count_);
CP_APPLY_ATTR(L"meta:word-count", meta_word_count_);
CP_APPLY_ATTR(L"meta:character-count", meta_character_count_);
}
// meta_user_defined
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * meta_user_defined::ns = L"meta";
const wchar_t * meta_user_defined::name = L"user-defined";
void meta_user_defined::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"meta:name", meta_name_, std::wstring(L""));
}
void meta_user_defined::add_text(const std::wstring & text)
{
content_ = text;
}
}
}

View File

@ -0,0 +1,132 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* 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 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
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf_reader {
// office:meta
class office_meta : public office_element_impl<office_meta>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeMeta;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr_array meta_user_defined_;
office_element_ptr meta_generator_;
office_element_ptr meta_document_statistic_;
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);
virtual void add_text(const std::wstring & Text){}
};
CP_REGISTER_OFFICE_ELEMENT2(office_meta);
// meta:generator
class meta_generator : public office_element_impl<meta_generator>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeMetaGenerator;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring content_;
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){}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(meta_generator);
// meta:document-statistic
class meta_document_statistic : public office_element_impl<meta_document_statistic>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeMetaDocumentStatistic;
CPDOCCORE_DEFINE_VISITABLE();
_CP_OPT(int) meta_table_count_;
_CP_OPT(int) meta_image_count_;
_CP_OPT(int) meta_object_count_;
_CP_OPT(int) meta_page_count_;
_CP_OPT(int) meta_paragraph_count_;
_CP_OPT(int) meta_word_count_;
_CP_OPT(int) meta_character_count_;
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){}
virtual void add_text(const std::wstring & Text){}
};
CP_REGISTER_OFFICE_ELEMENT2(meta_document_statistic);
// meta:user-defined
class meta_user_defined : public office_element_impl<meta_user_defined>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeMetaUserDefined;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring meta_name_;
std::wstring content_;
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){}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(meta_user_defined);
}
}

View File

@ -91,7 +91,7 @@ void paragraph_content_element<ElementT>::docx_serialize_field(const std::wstrin
}
}
template <class ElementT>
void paragraph_content_element<ElementT>::docx_serialize_sdt(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context)
void paragraph_content_element<ElementT>::docx_serialize_sdt_placeholder(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context)
{
std::wostream & strm = Context.output_stream();
Context.finish_run();
@ -101,11 +101,6 @@ void paragraph_content_element<ElementT>::docx_serialize_sdt(const std::wstring
strm << L"\"/><w:temporary/>";
strm << L"<w:showingPlcHdr/><w:text/></w:sdtPr><w:sdtContent>";
//if (!text)
//{
// text = text::create(L"Enter your text here") ;
//}
docx_serialize_run(text, Context);
strm << L"</w:sdtContent></w:sdt>";
@ -153,7 +148,13 @@ void text::docx_convert(oox::docx_conversion_context & Context)
Context.output_stream() << L"<w:del>";
}
}
if (Context.is_table_content())
{
int type = Context.get_table_content_context().get_type_current_level_index();
if (type == 6)
{
}
}
Context.add_element_to_run();
std::wstring textNode = L"w:t";
@ -364,30 +365,34 @@ void bookmark_end::docx_convert(oox::docx_conversion_context & Context)
const wchar_t * bookmark_ref::ns = L"text";
const wchar_t * bookmark_ref::name = L"bookmark-ref";
std::wostream & bookmark_ref::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void bookmark_ref::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:ref-name", text_ref_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:reference-format", text_reference_format_);
CP_APPLY_ATTR(L"text:ref-name", ref_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:reference-format", reference_format_);
}
void bookmark_ref::add_text(const std::wstring & Text)
{
content_ = Text;
}
// text:reference-ref
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * reference_ref::ns = L"text";
const wchar_t * reference_ref::name = L"reference-ref";
void reference_ref::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:ref-name", ref_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:reference-format", reference_format_);
}
void reference_ref::add_text(const std::wstring & Text)
{
content_ = Text;
}
// text:reference-mark
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * reference_mark::ns = L"text";
const wchar_t * reference_mark::name = L"reference-mark";
std::wostream & reference_mark::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void reference_mark::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_, std::wstring(L""));
@ -398,11 +403,6 @@ void reference_mark::add_attributes( const xml::attributes_wc_ptr & Attributes )
const wchar_t * reference_mark_start::ns = L"text";
const wchar_t * reference_mark_start::name = L"reference-mark-start";
std::wostream & reference_mark_start::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void reference_mark_start::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_, std::wstring(L""));
@ -413,16 +413,43 @@ void reference_mark_start::add_attributes( const xml::attributes_wc_ptr & Attrib
const wchar_t * reference_mark_end::ns = L"text";
const wchar_t * reference_mark_end::name = L"reference-mark-end";
std::wostream & reference_mark_end::text_to_stream(std::wostream & _Wostream) const
{
return _Wostream;
}
void reference_mark_end::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:name", text_name_, std::wstring(L""));
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * hidden_paragraph::ns = L"text";
const wchar_t * hidden_paragraph::name = L"hidden-paragraph";
void hidden_paragraph::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:is-hidden", is_hidden_);
CP_APPLY_ATTR(L"text:condition", condition_);
}
void hidden_paragraph::add_text(const std::wstring & Text)
{
content_ = Text;
}
void hidden_paragraph::docx_convert(oox::docx_conversion_context & Context)
{
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * hidden_text::ns = L"text";
const wchar_t * hidden_text::name = L"hidden-text";
void hidden_text::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:is-hidden", is_hidden_);
CP_APPLY_ATTR(L"text:condition", condition_);
CP_APPLY_ATTR(L"text:string-value", string_value_);
}
void hidden_text::add_text(const std::wstring & Text)
{
content_ = Text;
}
void hidden_text::docx_convert(oox::docx_conversion_context & Context)
{
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * span::ns = L"text";
const wchar_t * span::name = L"span";
@ -584,6 +611,9 @@ void a::docx_convert(oox::docx_conversion_context & Context)
if (Context.is_table_content())
{
_Wostream << L"<w:hyperlink w:anchor=\"" << ref.substr(1) << L"\" w:history=\"1\">"; //без #
int type = Context.get_table_content_context().get_type_current_level_index();
//type == 3 (LinkStart)
Context.get_table_content_context().next_level_index();
}
else
{
@ -594,7 +624,8 @@ void a::docx_convert(oox::docx_conversion_context & Context)
}
style_instance * styleInst = NULL;
style_text_properties_ptr tempStyleTextProp;
if (!text_style_name_.empty())
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text, Context.process_headers_footers_);
else if (false == Context.is_table_content())
@ -616,8 +647,6 @@ void a::docx_convert(oox::docx_conversion_context & Context)
}
else
{
style_text_properties_ptr tempStyleTextProp;
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
tempStyleTextProp = style_text_properties_ptr( new style_text_properties(id) );
Context.push_text_properties( tempStyleTextProp.get() );
@ -634,7 +663,11 @@ void a::docx_convert(oox::docx_conversion_context & Context)
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
if (Context.is_table_content())
{
Context.get_table_content_context().next_level_index();
}
}
Context.finish_run();
@ -931,7 +964,7 @@ void text_placeholder::add_text(const std::wstring & Text)
void text_placeholder::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Click placeholder and overwrite", text_, Context);
docx_serialize_sdt_placeholder(L"Click placeholder and overwrite", text_, Context);
}
void text_placeholder::pptx_convert(oox::pptx_conversion_context & Context)
@ -1167,15 +1200,25 @@ void text_file_name::pptx_convert(oox::pptx_conversion_context & Context)
// Context.get_text_context().end_field();
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sequence_ref::ns = L"text";
const wchar_t * sequence_ref::name = L"sequence-ref";
void sequence_ref::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:ref-name", ref_name_);
CP_APPLY_ATTR(L"text:reference-format", reference_format_);
}
void sequence_ref::add_text(const std::wstring & Text)
{
content_ = Text;
}
void sequence_ref::docx_convert(oox::docx_conversion_context & Context)
{
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sequence::ns = L"text";
const wchar_t * sequence::name = L"sequence";
std::wostream & sequence::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(text_);
return _Wostream;
}
void sequence::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:num-format", style_num_format_);
@ -1184,7 +1227,11 @@ void sequence::add_attributes( const xml::attributes_wc_ptr & Attributes )
CP_APPLY_ATTR(L"text:ref-name", text_ref_name_);
CP_APPLY_ATTR(L"text:name", text_name_);
}
std::wostream & sequence::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(text_);
return _Wostream;
}
void sequence::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(text_);
@ -1352,7 +1399,7 @@ void sheet_name::add_text(const std::wstring & Text)
}
void sheet_name::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"sheet name", text_, Context);
docx_serialize_sdt_placeholder(L"sheet name", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * author_name::ns = L"text";
@ -1398,7 +1445,7 @@ void sender_city::add_text(const std::wstring & Text)
}
void sender_city::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender city", text_, Context);
docx_serialize_sdt_placeholder(L"Sender city", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sender_email::ns = L"text";
@ -1413,7 +1460,7 @@ void sender_email::add_text(const std::wstring & Text)
}
void sender_email::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender email", text_, Context);
docx_serialize_sdt_placeholder(L"Sender email", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sender_lastname::ns = L"text";
@ -1428,7 +1475,7 @@ void sender_lastname::add_text(const std::wstring & Text)
}
void sender_lastname::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender last name", text_, Context);
docx_serialize_sdt_placeholder(L"Sender last name", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sender_firstname::ns = L"text";
@ -1443,7 +1490,7 @@ void sender_firstname::add_text(const std::wstring & Text)
}
void sender_firstname::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender first name", text_, Context);
docx_serialize_sdt_placeholder(L"Sender first name", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sender_company::ns = L"text";
@ -1458,7 +1505,7 @@ void sender_company::add_text(const std::wstring & Text)
}
void sender_company::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender company", text_, Context);
docx_serialize_sdt_placeholder(L"Sender company", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sender_postal_code::ns = L"text";
@ -1480,7 +1527,7 @@ void sender_postal_code::add_text(const std::wstring & Text)
}
void sender_postal_code::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender postal code", text_, Context);
docx_serialize_sdt_placeholder(L"Sender postal code", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sender_street::ns = L"text";
@ -1495,7 +1542,7 @@ void sender_street::add_text(const std::wstring & Text)
}
void sender_street::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender street", text_, Context);
docx_serialize_sdt_placeholder(L"Sender street", text_, Context);
}
//------------------------------------------------------------------------------------------------------------
@ -1511,7 +1558,7 @@ void sender_state_or_province::add_text(const std::wstring & Text)
}
void sender_state_or_province::docx_convert(oox::docx_conversion_context & Context)
{
docx_serialize_sdt(L"Sender state or province", text_, Context);
docx_serialize_sdt_placeholder(L"Sender state or province", text_, Context);
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_user_field_get::ns = L"text";
@ -1534,11 +1581,228 @@ void text_user_field_get::docx_convert(oox::docx_conversion_context & Context)
if (!text_)
{
std::wstring value = Context.get_user_field(*text_name_);
text_ = text::create(value) ;
if (!value.empty())
text_ = text::create(value) ;
}
docx_serialize_run(text_, Context);
}
//---------------------------------------------------------------------------------------------------
const wchar_t * text_user_defined::ns = L"text";
const wchar_t * text_user_defined::name = L"user-defined";
void text_user_defined::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_);
CP_APPLY_ATTR(L"text:name", text_name_);
CP_APPLY_ATTR(L"text:fixed", text_fixed_);
office_value_.add_attributes(Attributes);
}
void text_user_defined::add_text(const std::wstring & Text)
{
text_ = text::create(Text) ;//cache
}
void text_user_defined::docx_convert(oox::docx_conversion_context & Context)
{
if (!text_name_) return;
odf_reader::odf_read_context & odfContext = Context.root()->odf_context();
std::wstring value = odfContext.Settings().get_user_defined(*text_name_);
if (!value.empty())
text_ = text::create(value) ;
docx_serialize_run(text_, Context);
}
//-----------------------------------------------------------------------------------------------
// text:bibliography-mark
//-----------------------------------------------------------------------------------------------
const wchar_t * bibliography_mark::ns = L"text";
const wchar_t * bibliography_mark::name = L"bibliography-mark";
void bibliography_mark::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:identifier", identifier_, std::wstring(L""));
CP_APPLY_ATTR(L"text:bibliography-type", bibliography_type_, std::wstring(L""));
CP_APPLY_ATTR(L"text:author", author_);
CP_APPLY_ATTR(L"text:url", url_);
CP_APPLY_ATTR(L"text:title", title_);
CP_APPLY_ATTR(L"text:year", year_);
}
void bibliography_mark::add_text(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text) ;
content_ = elm;
}
std::wostream & bibliography_mark::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(content_);
return _Wostream;
}
void bibliography_mark::docx_convert(oox::docx_conversion_context & Context)
{
if (content_)
content_->docx_convert(Context);
}
void bibliography_mark::pptx_convert(oox::pptx_conversion_context & Context)
{
if (content_)
content_->pptx_convert(Context);
}
//-----------------------------------------------------------------------------------------------
// text:alphabetical-index-auto-mark-file
//-----------------------------------------------------------------------------------------------
const wchar_t * alphabetical_index_auto_mark_file::ns = L"text";
const wchar_t * alphabetical_index_auto_mark_file::name = L"alphabetical-index-auto-mark-file";
void alphabetical_index_auto_mark_file::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
xlink_attlist_.add_attributes(Attributes);
}
void alphabetical_index_auto_mark_file::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:alphabetical-index-mark
//-----------------------------------------------------------------------------------------------
const wchar_t * alphabetical_index_mark::ns = L"text";
const wchar_t * alphabetical_index_mark::name = L"alphabetical-index-mark";
void alphabetical_index_mark::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:key1", key1_);
CP_APPLY_ATTR(L"text:key1-phonetic", key1_phonetic_);
CP_APPLY_ATTR(L"text:key2", key2_);
CP_APPLY_ATTR(L"text:key2-phonetic", key2_phonetic_);
CP_APPLY_ATTR(L"text:main-entry", main_entry_);
CP_APPLY_ATTR(L"text:string-value-phonetic", string_value_phonetic_);
}
void alphabetical_index_mark::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:alphabetical-index-mark-start
//-----------------------------------------------------------------------------------------------
const wchar_t * alphabetical_index_mark_start::ns = L"text";
const wchar_t * alphabetical_index_mark_start::name = L"alphabetical-index-mark-start";
void alphabetical_index_mark_start::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:id", id_, std::wstring(L""));
CP_APPLY_ATTR(L"text:key1", key1_);
CP_APPLY_ATTR(L"text:key1-phonetic", key1_phonetic_);
CP_APPLY_ATTR(L"text:key2", key2_);
CP_APPLY_ATTR(L"text:key2-phonetic", key2_phonetic_);
CP_APPLY_ATTR(L"text:main-entry", main_entry_);
CP_APPLY_ATTR(L"text:string-value-phonetic", string_value_phonetic_);
}
void alphabetical_index_mark_start::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:alphabetical-index-mark-end
//-----------------------------------------------------------------------------------------------
const wchar_t * alphabetical_index_mark_end::ns = L"text";
const wchar_t * alphabetical_index_mark_end::name = L"alphabetical-index-mark-end";
void alphabetical_index_mark_end::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:id", id_, std::wstring(L""));
}
void alphabetical_index_mark_end::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:user-index-mark
//-----------------------------------------------------------------------------------------------
const wchar_t * user_index_mark::ns = L"text";
const wchar_t * user_index_mark::name = L"user-index-mark";
void user_index_mark::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:index-name", index_name_);
CP_APPLY_ATTR(L"text:outline-level", outline_level_);
CP_APPLY_ATTR(L"text:string-value", string_value_);
}
void user_index_mark::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:user-index-mark-start
//-----------------------------------------------------------------------------------------------
const wchar_t * user_index_mark_start::ns = L"text";
const wchar_t * user_index_mark_start::name = L"user-index-mark-start";
void user_index_mark_start::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:id", id_, std::wstring(L""));
CP_APPLY_ATTR(L"text:index-name", index_name_);
CP_APPLY_ATTR(L"text:outline-level", outline_level_);
}
void user_index_mark_start::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:user-index-mark-end
//-----------------------------------------------------------------------------------------------
const wchar_t * user_index_mark_end::ns = L"text";
const wchar_t * user_index_mark_end::name = L"user-index-mark-end";
void user_index_mark_end::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:id", id_, std::wstring(L""));
}
void user_index_mark_end::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:toc-mark
//-----------------------------------------------------------------------------------------------
const wchar_t * toc_mark::ns = L"text";
const wchar_t * toc_mark::name = L"toc-mark";
void toc_mark::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:outline-level", outline_level_);
CP_APPLY_ATTR(L"text:string-value", string_value_);
}
void toc_mark::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:toc-mark-start
//-----------------------------------------------------------------------------------------------
const wchar_t * toc_mark_start::ns = L"text";
const wchar_t * toc_mark_start::name = L"toc-mark-start";
void toc_mark_start::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:id", id_, std::wstring(L""));
CP_APPLY_ATTR(L"text:outline-level", outline_level_);
}
void toc_mark_start::docx_convert(oox::docx_conversion_context & Context)
{
}
//-----------------------------------------------------------------------------------------------
// text:toc-mark-end
//-----------------------------------------------------------------------------------------------
const wchar_t * toc_mark_end::ns = L"text";
const wchar_t * toc_mark_end::name = L"toc-mark-end";
void toc_mark_end::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:id", id_, std::wstring(L""));
}
void toc_mark_end::docx_convert(oox::docx_conversion_context & Context)
{
}
//------------------------------------------------------------------------------------------------------------
}//namespace text
//------------------------------------------------------------------------------------------------------------

View File

@ -56,7 +56,7 @@ template <class ElementT>
class paragraph_content_element : public office_element_impl<ElementT>
{
public:
void docx_serialize_sdt(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context);
void docx_serialize_sdt_placeholder(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context);
void docx_serialize_field(const std::wstring & field_name, office_element_ptr & text, oox::docx_conversion_context & Context, bool bLock = false);
void docx_serialize_run(office_element_ptr & text, oox::docx_conversion_context & Context);
};
@ -175,8 +175,6 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
line_break() {};
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) {}
@ -199,9 +197,6 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
bookmark() {}
bookmark(const std::wstring & Name) : text_name_(Name){};
std::wstring text_name_;
private:
@ -227,9 +222,6 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
virtual void docx_convert(oox::docx_conversion_context & Context);
bookmark_start() {}
bookmark_start(const std::wstring & Name) : name_(Name){};
std::wstring name_;
private:
@ -254,9 +246,6 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
bookmark_end() {} ;
bookmark_end(const std::wstring & Name) : name_(Name){};
std::wstring name_;
private:
@ -279,12 +268,8 @@ public:
static const ElementType type = typeTextBookmarkRef;
CPDOCCORE_DEFINE_VISITABLE();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
bookmark_ref() {} ;
std::wstring text_ref_name_;
_CP_OPT(std::wstring) text_reference_format_;
std::wstring ref_name_;
_CP_OPT(std::wstring) reference_format_;
std::wstring content_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -293,7 +278,29 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(bookmark_ref);
//-------------------------------------------------------------------------------------------------------------------
// text:reference-ref
//-------------------------------------------------------------------------------------------------------------------
class reference_ref : public paragraph_content_element<reference_ref>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextReferenceRef;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring ref_name_;
_CP_OPT(std::wstring) reference_format_;
std::wstring content_;
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) {}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(reference_ref);
//-------------------------------------------------------------------------------------------------------------------
// text:reference-mark
//-------------------------------------------------------------------------------------------------------------------
@ -306,10 +313,6 @@ public:
static const ElementType type = typeTextReferenceMark;
CPDOCCORE_DEFINE_VISITABLE();
reference_mark() {};
reference_mark(const std::wstring & Name) : text_name_(Name){};
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
std::wstring text_name_;
private:
@ -318,7 +321,6 @@ private:
virtual void add_text(const std::wstring & Text) {}
};
CP_REGISTER_OFFICE_ELEMENT2(reference_mark);
//-------------------------------------------------------------------------------------------------------------------
// text:reference-mark-start
@ -332,10 +334,6 @@ public:
static const ElementType type = typeTextReferenceMarkStart;
CPDOCCORE_DEFINE_VISITABLE();
reference_mark_start() {}
reference_mark_start(const std::wstring & Name) : text_name_(Name){};
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
std::wstring text_name_;
private:
@ -357,11 +355,6 @@ public:
static const ElementType type = typeTextReferenceMarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
reference_mark_end() {};
reference_mark_end(const std::wstring & Name) : text_name_(Name){};
std::wstring text_name_;
private:
@ -800,7 +793,55 @@ private:
//text:display
};
CP_REGISTER_OFFICE_ELEMENT2(text_file_name);
//-------------------------------------------------------------------------------------------------------------------
// text:hidden-paragraph
//-------------------------------------------------------------------------------------------------------------------
class hidden_paragraph : public paragraph_content_element<hidden_paragraph>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextHiddenParagraph;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(odf_types::Bool) is_hidden_;
_CP_OPT(std::wstring) condition_;
std::wstring content_;
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){}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(hidden_paragraph);
//-------------------------------------------------------------------------------------------------------------------
// text:hidden-text
//-------------------------------------------------------------------------------------------------------------------
class hidden_text : public paragraph_content_element<hidden_text>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextHiddenText;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(odf_types::Bool) is_hidden_;
_CP_OPT(std::wstring) condition_;
_CP_OPT(std::wstring) string_value_;
std::wstring content_;
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){}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(hidden_text);
//-------------------------------------------------------------------------------------------------------------------
// text:sequence
//-------------------------------------------------------------------------------------------------------------------
@ -830,11 +871,34 @@ 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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(sequence);
//-------------------------------------------------------------------------------------------------------------------
// text:sequence_ref
//-------------------------------------------------------------------------------------------------------------------
class sequence_ref : public paragraph_content_element<sequence_ref>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextSequenceRef;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(std::wstring) reference_format_;//caption, category-and-value, value, chapter, direction, page, text, number, number-all-superior, number-no-superior
_CP_OPT(std::wstring) ref_name_;
std::wstring content_;
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){}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(sequence_ref);
//-------------------------------------------------------------------------------------------------------------------
//text:drop-down
//-------------------------------------------------------------------------------------------------------------------
class text_drop_down : public paragraph_content_element<text_drop_down>
@ -1153,6 +1217,298 @@ private:
office_element_ptr text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_user_field_get);
//-------------------------------------------------------------------------------------------------------------------
//text:user-defined
//---------------------------------------------------------------------------------------------------
class text_user_defined : public paragraph_content_element<text_user_defined>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserDefined;
CPDOCCORE_DEFINE_VISITABLE()
virtual void docx_convert(oox::docx_conversion_context & Context);
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){}
virtual void add_text(const std::wstring & Text);
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_name_;
_CP_OPT(odf_types::Bool) text_fixed_;
odf_types::common_value_and_type_attlist office_value_;
office_element_ptr text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_user_defined);
//---------------------------------------------------------------------------------------------------
//text:bibliography-mark
//---------------------------------------------------------------------------------------------------
class bibliography_mark : public paragraph_content_element<bibliography_mark>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextBibliographyMark;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
std::wstring identifier_;
std::wstring bibliography_type_; // todoooo in datatype
_CP_OPT(std::wstring) url_;
_CP_OPT(std::wstring) author_;
_CP_OPT(std::wstring) title_;
_CP_OPT(std::wstring) year_;
_CP_OPT(std::wstring) isbn_;
_CP_OPT(std::wstring) chapter_;
office_element_ptr content_;
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){}
virtual void add_text (const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(bibliography_mark);
//---------------------------------------------------------------------------------------------------
//text:alphabetical-index-auto-mark-file
//---------------------------------------------------------------------------------------------------
class alphabetical_index_auto_mark_file : public paragraph_content_element<alphabetical_index_auto_mark_file>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextAlphabeticalIndexAutoMarkFile;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
odf_types::common_xlink_attlist xlink_attlist_;
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(alphabetical_index_auto_mark_file);
//---------------------------------------------------------------------------------------------------
//text:alphabetical-index-mark-start
//---------------------------------------------------------------------------------------------------
class alphabetical_index_mark_start : public paragraph_content_element<alphabetical_index_mark_start>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextAlphabeticalIndexMarkStart;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
std::wstring id_;
_CP_OPT(std::wstring) key1_;
_CP_OPT(std::wstring) key1_phonetic_;
_CP_OPT(std::wstring) key2_;
_CP_OPT(std::wstring) key2_phonetic_;
_CP_OPT(odf_types::Bool) main_entry_;
_CP_OPT(std::wstring) string_value_phonetic_;
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(alphabetical_index_mark_start);
//---------------------------------------------------------------------------------------------------
//text:alphabetical-index-mark-end
//---------------------------------------------------------------------------------------------------
class alphabetical_index_mark_end : public paragraph_content_element<alphabetical_index_mark_end>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextAlphabeticalIndexMarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
std::wstring id_;
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(alphabetical_index_mark_end);
//---------------------------------------------------------------------------------------------------
//text:alphabetical-index-mark
//---------------------------------------------------------------------------------------------------
class alphabetical_index_mark : public paragraph_content_element<alphabetical_index_mark>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextAlphabeticalIndexMark;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(std::wstring) key1_;
_CP_OPT(std::wstring) key1_phonetic_;
_CP_OPT(std::wstring) key2_;
_CP_OPT(std::wstring) key2_phonetic_;
_CP_OPT(odf_types::Bool) main_entry_;
_CP_OPT(std::wstring) string_value_phonetic_;
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(alphabetical_index_mark);
//---------------------------------------------------------------------------------------------------
//text:user-index-mark-start
//---------------------------------------------------------------------------------------------------
class user_index_mark_start : public paragraph_content_element<user_index_mark_start>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserIndexMarkStart;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
std::wstring id_;
_CP_OPT(std::wstring) index_name_;
_CP_OPT(int) outline_level_;
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(user_index_mark_start);
//---------------------------------------------------------------------------------------------------
//text:user-index-mark-end
//---------------------------------------------------------------------------------------------------
class user_index_mark_end : public paragraph_content_element<user_index_mark_end>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserIndexMarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
std::wstring id_;
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(user_index_mark_end);
//---------------------------------------------------------------------------------------------------
//text:user-index-mark
//---------------------------------------------------------------------------------------------------
class user_index_mark : public paragraph_content_element<user_index_mark>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserIndexMark;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(std::wstring) index_name_;
_CP_OPT(int) outline_level_;
_CP_OPT(std::wstring) string_value_;
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(user_index_mark);
//---------------------------------------------------------------------------------------------------
//text:toc-mark-start
//---------------------------------------------------------------------------------------------------
class toc_mark_start : public paragraph_content_element<toc_mark_start>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextTocMarkStart;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(int) outline_level_;
std::wstring id_;
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(toc_mark_start);
//---------------------------------------------------------------------------------------------------
//text:toc-mark-end
//---------------------------------------------------------------------------------------------------
class toc_mark_end : public paragraph_content_element<toc_mark_end>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextTocMarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
std::wstring id_;
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(toc_mark_end);
//---------------------------------------------------------------------------------------------------
//text:toc-mark
//---------------------------------------------------------------------------------------------------
class toc_mark : public paragraph_content_element<toc_mark>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextTocMark;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(std::wstring) string_value_;
_CP_OPT(int) outline_level_;
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(toc_mark);
//-------------------------------------------------------------------------------------------------------------------
} // namespace text
//-------------------------------------------------------------------------------------------------------------------
//presentation:footer

View File

@ -89,22 +89,16 @@ std::wostream & style_tab_stops::text_to_stream(std::wostream & _Wostream) const
return _Wostream;
}
void style_tab_stops::add_attributes( const xml::attributes_wc_ptr & Attributes )
{}
void style_tab_stops::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if (L"style" == Ns && L"tab-stop" == Name)
CP_CREATE_ELEMENT(style_tab_stops_);
CP_CREATE_ELEMENT(content_);
else
{
CP_NOT_APPLICABLE_ELM();
}
}
void style_tab_stops::add_text(const std::wstring & Text)
{}
// style:drop-cap
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_drop_cap::ns = L"style";
@ -408,14 +402,12 @@ void paragraph_format_properties::apply_from(const paragraph_format_properties &
_CP_APPLY_PROP(fo_widows_, Other.fo_widows_);
_CP_APPLY_PROP(fo_orphans_, Other.fo_orphans_);
// TODO
_CP_APPLY_PROP(style_tab_stops_, Other.style_tab_stops_);
//style_tab_stops_ calc in context
_CP_APPLY_PROP(style_tab_stop_distance_, Other.style_tab_stop_distance_);
_CP_APPLY_PROP(fo_hyphenation_keep_, Other.fo_hyphenation_keep_);
_CP_APPLY_PROP(fo_hyphenation_ladder_count_, Other.fo_hyphenation_ladder_count_);
// TODO
_CP_APPLY_PROP(style_drop_cap_, Other.style_drop_cap_);
_CP_APPLY_PROP(style_register_true_, Other.style_register_true_);

View File

@ -88,6 +88,8 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void docx_convert(oox::docx_conversion_context & Context, bool clear = false);
void pptx_convert(oox::pptx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
@ -96,8 +98,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
odf_types::length style_position_;
public:
odf_types::length style_position_;
_CP_OPT(odf_types::style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
@ -124,20 +126,17 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
size_t size() const { return style_tab_stops_.size(); }
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
office_element_ptr_array content_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
virtual void add_text(const std::wstring & Text);
virtual void add_text(const std::wstring & Text){}
private:
office_element_ptr_array style_tab_stops_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_tab_stops);
@ -239,7 +238,7 @@ public:
office_element_ptr style_background_image_;
office_element_ptr style_drop_cap_;
office_element_ptr style_tab_stops_;
office_element_ptr style_tab_stops_;
_CP_OPT(odf_types::border_style) fo_border_;
_CP_OPT(odf_types::border_style) fo_border_top_;
@ -290,7 +289,7 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
const paragraph_format_properties & content() const { return content_; }
paragraph_format_properties content_;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
@ -302,7 +301,6 @@ private:
private:
paragraph_format_properties content_;
};

View File

@ -415,126 +415,101 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
Context.set_page_break_after(true);
}
}
if (style_tab_stops_)
style_tab_stops_->docx_convert(Context);
Context.get_tabs_context().docx_convert(Context);
//if (style_tab_stops_)
//{
// style_tab_stops_->docx_convert(Context);
//}
}
void style_tab_stops::docx_convert(oox::docx_conversion_context & Context)
{
if (style_tab_stops_.size()<1)return;
if (content_.empty()) return;
std::wstringstream & _pPr = Context.get_styles_context().paragraph_nodes();
_pPr << L"<w:tabs>";
if (style_tab_stops_.size() > 0)
{
for (size_t i = 0; i < style_tab_stops_.size(); i++)
for (size_t i = 0; i < content_.size(); i++)
{
style_tab_stops_[i]->docx_convert(Context);
content_[i]->docx_convert(Context);
}
}
_pPr << L"</w:tabs>";
}
void style_tab_stop::docx_convert(oox::docx_conversion_context & Context)
void style_tab_stop::docx_convert(oox::docx_conversion_context & Context, bool clear)
{
std::wstringstream & _pPr = Context.get_styles_context().paragraph_nodes();
_pPr << L"<w:tab ";
_pPr << L"<w:tab";
length def_tab = length(1.0, length::cm);// в ms значение 0.8 не корректно оО
int tab_pos = (int)( 20.0 * style_position_.get_value_unit(length::pt) ) ;
int min_tab_pos = (int)( 20.0 * def_tab.get_value_unit(length::pt) ) ;
int margin_left_pos = Context.get_margin_left();
if ((style_type_) && (style_type_->get_type() == style_type::Right))
{
tab_pos += margin_left_pos;
}
tab_pos += margin_left_pos;
if (tab_pos < min_tab_pos)
tab_pos = min_tab_pos;
_pPr << L"w:pos=\"" << tab_pos << "\" ";
{
std::wstring val = L"left"; //????
if (style_type_)
{
switch(style_type_->get_type())
{
case style_type::Left:
val = L"left";
break;
case style_type::Center:
val = L"center";
break;
case style_type::Right:
val = L"right";
break;
case style_type::Char:
val = L"decimal";
break;
}
}
if (!val.empty())
_pPr << L"w:val=\"" << val << "\" ";
}
{
std::wstring leader;
std::wstring val = clear ? L"clear" : L"left"; //????
if (style_type_ && !clear)
{
switch(style_type_->get_type())
{
case style_type::Left: val = L"left"; break;
case style_type::Center:val = L"center"; break;
case style_type::Right: val = L"right"; break;
case style_type::Char: val = L"decimal"; break;
}
}
_pPr << L" w:val=\"" << val << "\"";
_pPr << L" w:pos=\"" << tab_pos << "\"";
std::wstring leader;
if ((style_leader_type_ && style_leader_type_->get_type() == line_type::None) ||
(style_leader_style_ && style_leader_style_->get_type() == line_style::None))
{
leader = L"none";
}
else if (!style_leader_type_ || style_leader_type_ && style_leader_type_->get_type() != line_type::None)
{
if (style_leader_style_)
{
switch(style_leader_style_->get_type())
{
case line_style::None:
leader = L"";
break;
case line_style::Solid:
if (style_leader_text_)
{
if (*style_leader_text_ == L"-")
leader = L"hyphen";
else if (*style_leader_text_ == L"_")
leader = L"underscore";
}
break;
case line_style::Dotted:
leader = L"dot";
break;
case line_style::Dash:
leader = L"hyphen";
break;
case line_style::LongDash:
leader = L"middleDot";
break;
case line_style::DotDash:
leader = L"middleDot";
break;
case line_style::DotDotDash:
leader = L"middleDot";
break;
case line_style::Wave:
leader = L"middleDot";
break;
}
}
}
if (!leader.empty())
_pPr << L"w:leader=\"" << leader << "\" ";
}
_pPr << L" />";
if ((style_leader_type_ && style_leader_type_->get_type() == line_type::None) ||
(style_leader_style_ && style_leader_style_->get_type() == line_style::None))
{
leader = L"none";
}
else if (!style_leader_type_ || style_leader_type_ && style_leader_type_->get_type() != line_type::None)
{
if (style_leader_style_)
{
switch(style_leader_style_->get_type())
{
case line_style::None: leader.clear(); break;
case line_style::Solid:
{
if (style_leader_text_)
{
if (*style_leader_text_ == L"-")
leader = L"hyphen";
else if (*style_leader_text_ == L"_")
leader = L"underscore";
}
}break;
case line_style::Dotted: leader = L"dot"; break;
case line_style::Dash: leader = L"hyphen"; break;
case line_style::LongDash: leader = L"middleDot"; break;
case line_style::DotDash: leader = L"middleDot"; break;
case line_style::DotDotDash: leader = L"middleDot"; break;
case line_style::Wave: leader = L"middleDot"; break;
}
}
}
if (!clear && !leader.empty())
{
_pPr << L" w:leader=\"" << leader << "\"";
}
_pPr << L"/>";
}
void style_tab_stop::docx_convert(oox::docx_conversion_context & Context)
{
docx_convert(Context, false);
}
void style_paragraph_properties::docx_convert(oox::docx_conversion_context & Context)

View File

@ -345,13 +345,13 @@ void text_list_level_style_number::docx_convert(oox::docx_conversion_context & C
{
switch(text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_->get_type())
{
case odf_types::style_numformat::romanUc: num_format= L"romanUc"; break;
case odf_types::style_numformat::romanLc: num_format= L"romanLc"; break;
case odf_types::style_numformat::alphaUc: num_format= L"alphaUc"; break;
case odf_types::style_numformat::alphaLc: num_format= L"alphaLc"; break;
case odf_types::style_numformat::romanUc: num_format= L"upperRoman"; break;
case odf_types::style_numformat::romanLc: num_format= L"lowerRoman"; break;
case odf_types::style_numformat::alphaUc: num_format= L"upperLetter"; break;
case odf_types::style_numformat::alphaLc: num_format= L"lowerLetter"; break;
case odf_types::style_numformat::arabic:
default:
num_format= L"arabic"; break;
num_format= L"decimal"; break;
}
}
CP_XML_ATTR(L"w:val", num_format);

View File

@ -113,6 +113,8 @@ public:
bool inViewTable;
bool inView;
std::map<std::wstring, std::wstring> map_user_defineds;
};
settings_container::settings_container(): impl_(new settings_container::Impl() )
@ -264,6 +266,16 @@ _CP_OPT(std::wstring) settings_container::find_view_by_name(const std::wstring &
}
return value;
}
void settings_container::add_user_defined(const std::wstring & name, const std::wstring & value)
{
impl_->map_user_defineds.insert(std::make_pair(name, value));
}
std::wstring settings_container::get_user_defined(const std::wstring & name)
{
std::map<std::wstring, std::wstring>::iterator pFind = impl_->map_user_defineds.find(name);
return pFind != impl_->map_user_defineds.end() ? pFind->second : L"";
}
}
}

View File

@ -79,6 +79,9 @@ public:
void end_table_view ();
void add_view (const std::wstring & name, const std::wstring & value);
void add_user_defined(const std::wstring & name, const std::wstring & value);
std::wstring get_user_defined(const std::wstring & name);
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -99,6 +99,7 @@ namespace
case XmlUtils::XmlNodeType_DocumentType:
return typeDocumentType;
case XmlUtils::XmlNodeType_Whitespace:
case XmlUtils::XmlNodeType_SIGNIFICANT_WHITESPACE:
return typeWhitespace;
case XmlUtils::XmlNodeType_EndElement:
return typeEndElement;

View File

@ -1591,6 +1591,14 @@
RelativePath="..\src\odf\office_forms.h"
>
</File>
<File
RelativePath="..\src\odf\office_meta.cpp"
>
</File>
<File
RelativePath="..\src\odf\office_meta.h"
>
</File>
<File
RelativePath="..\src\odf\office_presentation.cpp"
>

View File

@ -3590,28 +3590,28 @@ void DocxConverter::convert_comment(int oox_comm_id)
{
if (!docx_document->m_pComments)return;
for (size_t comm = 0 ; comm < docx_document->m_pComments->m_arrComments.size(); comm++)
{
OOX::CComment* oox_comment = docx_document->m_pComments->m_arrComments[comm];
if (oox_comment == NULL) continue;
if (oox_comment->m_oId.IsInit() == false) continue;
if (oox_comment->m_oId->GetValue() == oox_comm_id)
{
odt_context->start_comment_content();
{
if (oox_comment->m_oAuthor.IsInit()) odt_context->comment_context()->set_author (*oox_comment->m_oAuthor);
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
if (oox_comment->m_oInitials.IsInit()) {}
std::map<int, int>::iterator pFind = docx_document->m_pComments->m_mapComments.find(oox_comm_id);
for (std::vector<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); ++it)
{
convert(*it);
}
if (pFind == docx_document->m_pComments->m_mapComments.end()) return;
if ( pFind->second < docx_document->m_pComments->m_arrComments.size() && pFind->second >= 0)
{
OOX::CComment* oox_comment = docx_document->m_pComments->m_arrComments[pFind->second];
if (oox_comment == NULL) return;
odt_context->start_comment_content();
{
if (oox_comment->m_oAuthor.IsInit()) odt_context->comment_context()->set_author (*oox_comment->m_oAuthor);
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
if (oox_comment->m_oInitials.IsInit()) {}
for (std::vector<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); ++it)
{
convert(*it);
}
odt_context->end_comment_content();
}
odt_context->end_comment_content();
}
}
void DocxConverter::convert_footnote(int oox_ref_id)

View File

@ -163,78 +163,64 @@ namespace PPTX
COfficeFileFormatChecker office_checker;
office_checker.isOOXFormatFile(oox_file.GetPath());
//if ( std::wstring::npos != sProgID.find(L"Word.Document"))
//-----------------------------------------------------------------------------------------
DocWrapper::FontProcessor oFontProcessor;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
NSShapeImageGen::CMediaManager* old_manager = oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager;
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager;
oDrawingConverter.SetFontPicker(pWriter->m_pCommon->m_pFontPicker);
int type = 0;
if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX ||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM )
{
pWriter->StartRecord(1);
pWriter->WriteBYTE(1);
pWriter->EndRecord();
DocWrapper::FontProcessor oFontProcessor;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
BinDocxRW::CDocxSerializer oDocxSerializer;
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
BinDocxRW::CDocxSerializer* old_serial = pWriter->m_pMainDocument;
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
oDrawingConverter.m_pBinaryWriter = pWriter;
oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(pWriter, &oFontProcessor, &oDrawingConverter, NULL);
pWriter->m_pMainDocument = &oDocxSerializer;
type = 1;
BinDocxRW::CDocxSerializer* old_serializer = pWriter->m_pMainDocument;
BinDocxRW::CDocxSerializer oDocxSerializer;
oDrawingConverter.m_pBinaryWriter->m_pMainDocument = &oDocxSerializer;
oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(oDrawingConverter.m_pBinaryWriter, &oFontProcessor, &oDrawingConverter, NULL);
BinDocxRW::BinaryFileWriter oBinaryFileWriter(*oDocxSerializer.m_pParamsWriter);
pWriter->StartRecord(2);
oBinaryFileWriter.intoBindoc(oox_unpacked.GetPath());
pWriter->EndRecord();
oDrawingConverter.m_pBinaryWriter = old_writer;
*pWriter->m_pCurrentContainer = old_rels;
pWriter->m_pMainDocument = old_serial;
*pWriter->m_pTheme = old_theme;
oBinaryFileWriter.intoBindoc(oox_unpacked.GetPath());
pWriter->m_pMainDocument = old_serializer;
}
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX ||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
//if ( std::wstring::npos != sProgID.find(L"Excel.Sheet")) //"ET.Xlsx.6" !!!
{
pWriter->StartRecord(1);
pWriter->WriteBYTE(2);
pWriter->EndRecord();
DocWrapper::FontProcessor fp;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
type = 2;
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
oDrawingConverter.m_pBinaryWriter = pWriter;
BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(fp);
BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(oFontProcessor);
OOX::Spreadsheet::CXlsx oXlsxEmbedded(oox_unpacked);
pWriter->StartRecord(2);
xlsxBinaryWriter.intoBindoc(oXlsxEmbedded, *pWriter , NULL, &oDrawingConverter);
pWriter->EndRecord();
oDrawingConverter.m_pBinaryWriter = old_writer;
*pWriter->m_pCurrentContainer = old_rels;
*pWriter->m_pTheme = old_theme;
xlsxBinaryWriter.intoBindoc(oXlsxEmbedded, *oDrawingConverter.m_pBinaryWriter , NULL, &oDrawingConverter);
}
//else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX)
//{
//}
else
{//unknown ms package
pWriter->StartRecord(1);
pWriter->WriteBYTE(0);
pWriter->EndRecord();
pWriter->WriteString1(2, ole_file->filename().GetFilename());
oDrawingConverter.m_pBinaryWriter->WriteString1(2, ole_file->filename().GetFilename());
}
*pWriter->m_pCurrentContainer = old_rels;
*pWriter->m_pTheme = old_theme;
oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = old_manager;
//---------------------------------------------------------------------------------------------------------------------
pWriter->StartRecord(1);
pWriter->WriteBYTE(type);
pWriter->EndRecord();
pWriter->StartRecord(2);
pWriter->WriteBYTEArray(oDrawingConverter.m_pBinaryWriter->GetBuffer(), oDrawingConverter.m_pBinaryWriter->GetPosition());
pWriter->EndRecord();
NSDirectory::DeleteDirectory(oox_unpacked.GetPath());
}
else if ( std::wstring::npos != sProgID.find(L"Equation"))
@ -359,14 +345,8 @@ namespace PPTX
std::wstring sThemePath, sMediaPath, sEmbedPath;
oDocxSerializer.CreateDocxFolders (sDstEmbeddedTemp, sThemePath, sMediaPath, sEmbedPath);
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
//m_mapEnumeratedGlobal.clear();
oDrawingConverter.m_pReader = pReader;
pReader->m_pRels = new NSBinPptxRW::CRelsGenerator();
oDrawingConverter.m_pReader->Init(pReader->GetData() + pReader->GetPos(), 0, _embed_data_size);
oDrawingConverter.SetMainDocument(&oDocxSerializer);
@ -390,46 +370,24 @@ namespace PPTX
OOX::CContentTypes *pContentTypes = oDrawingConverter.GetContentTypes();
//docProps
OOX::CPath pathDocProps = sDstEmbeddedTemp + FILE_SEPARATOR_STR + _T("docProps");
OOX::CPath pathDocProps = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"docProps";
NSDirectory::CreateDirectory(pathDocProps.GetPath());
OOX::CPath DocProps = std::wstring(_T("docProps"));
OOX::CPath DocProps = std::wstring(L"docProps");
OOX::CApp oApp(NULL);
oApp.SetDefaults();
oApp.write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
OOX::CCore oCore(NULL);
oCore.SetDefaults();
oCore.write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes);
OOX::CApp* pApp = new OOX::CApp(NULL);
if (pApp)
{
pApp->SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
pApp->SetAppVersion(VALUE2STR(INTVER));
#endif
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore(NULL);
if (pCore)
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes);
delete pCore;
}
oDocxSerializer.m_pCurFileWriter->Write();
pContentTypes->Write(sDstEmbeddedTemp);
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sDstEmbeddedTemp, sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename, true);
pReader->m_pRels->CloseRels();
delete pReader->m_pRels;
pReader->m_pRels = old_rels;
oDrawingConverter.m_pReader = old_reader;
//------------------------------------------------------------------
//std::wstring sEmbWorksheetRelsName = L"embeddings/" + sDocxFilename;
//std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeWordDocument.RelationType();
@ -455,13 +413,9 @@ namespace PPTX
boost::unordered_map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
oXlsx.m_mapEnumeratedGlobal.clear();
oDrawingConverter.m_pReader = pReader;
pReader->m_pRels = new NSBinPptxRW::CRelsGenerator();
oDrawingConverter.m_pReader->Init(pReader->GetData() + pReader->GetPos(), 0, _embed_data_size);
oDrawingConverter.SetDstPath(sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl");
oDrawingConverter.SetSrcPath(pReader->m_strFolder, 2);
@ -470,7 +424,7 @@ namespace PPTX
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring( id ) + L".xlsx";
oEmbeddedReader.ReadMainTable(oXlsx, *pReader, pReader->m_strFolder, sDstEmbeddedTemp, oSaveParams, &oDrawingConverter);
oEmbeddedReader.ReadMainTable(oXlsx, *oDrawingConverter.m_pReader, pReader->m_strFolder, sDstEmbeddedTemp, oSaveParams, &oDrawingConverter);
oXlsx.PrepareToWrite();
@ -479,11 +433,6 @@ namespace PPTX
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sDstEmbeddedTemp, sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, true);
pReader->m_pRels->CloseRels();
delete pReader->m_pRels;
pReader->m_pRels = old_rels;
oDrawingConverter.m_pReader = old_reader;
oXlsx.m_mapEnumeratedGlobal = old_enum_map;
//------------------------------------------------------------------
//std::wstring sEmbWorksheetRelsName = L"embeddings/" + sXlsxFilename;

View File

@ -2852,8 +2852,8 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
//if ( pNewAnnotElem->IsValid() )
// m_oCurParagraph->AddItem( pNewAnnotElem );
if ( pNewAnnotElem->IsValid() )
m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "atnauthor" == sCommand )
{
@ -2862,8 +2862,8 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
oAbstrReader.StartSubReader( oAnnotElemReader, oDocument, oReader );
//if ( pNewAnnotElem->IsValid() )
// m_oCurParagraph->AddItem( pNewAnnotElem );
if ( pNewAnnotElem->IsValid() )
m_oCurParagraph->AddItem( pNewAnnotElem );
}
else if ( "atnref" == sCommand )
{

View File

@ -135,14 +135,14 @@ public:
int nId = ooxFtnEdn->m_oId->GetValue();
OOXTextItemReader oTextItemReader;
for (std::vector<OOX::WritingElement*>::iterator it = ooxFtnEdn->m_arrItems.begin(); it != ooxFtnEdn->m_arrItems.end(); ++it)
for (size_t i = 0; i < ooxFtnEdn->m_arrItems.size(); ++i)
{
if( nSeparatorId == nId )
{
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( *it, oParam ) )
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
{
if( true == bFootnote )
oParam.oRtf->m_oFootnoteSep = oNewTextItem;
@ -155,7 +155,7 @@ public:
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( *it, oParam ) )
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
{
if( true == bFootnote )
oParam.oRtf->m_oFootnoteCon = oNewTextItem;
@ -168,7 +168,7 @@ public:
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( *it, oParam ) )
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
{
if( true == bFootnote )
oParam.oReader->m_mapFootnotes[ nId] = oNewTextItem;

View File

@ -32,9 +32,9 @@
#include "OOXParagraphReader.h"
#include "OOXTextItemReader.h"
#include "OOXpPrFrameReader.h"
#include "OOXpPrTabReader.h"
#include "OOXTableReader.h"
#include "../RtfOle.h"
@ -457,6 +457,117 @@ bool OOXParagraphReader::Parse3( ReaderParameter oParam , RtfParagraph& oOutputP
}
}
}break;
case OOX::et_w_commentRangeStart:
case OOX::et_w_commentReference:
{
OOX::Logic::CCommentRangeStart * pCommentStart = dynamic_cast<OOX::Logic::CCommentRangeStart*>(m_ooxElement);
if(pCommentStart->m_oId.IsInit())
{
int nId = pCommentStart->m_oId->GetValue();
std::map<int, OOXReader::_comment>::iterator pFind = oParam.oReader->m_mapComments.find( nId );
if( pFind == oParam.oReader->m_mapComments.end())
{
RtfAnnotElemPtr oNewAnnotElem ( new RtfAnnotElem(1) );
oNewAnnotElem->m_sValue = std::to_wstring(0x7700000 + nId);
OOXReader::_comment comment;
comment.ref = oNewAnnotElem->m_sValue;
comment.index = oParam.oReader->m_mapComments.size();
oParam.oReader->m_mapComments.insert(std::make_pair( nId, comment));
oOutputParagraph.AddItem( oNewAnnotElem );
}
}
}break;
case OOX::et_w_commentRangeEnd:
{
OOX::Logic::CCommentRangeEnd * pCommentEnd = dynamic_cast<OOX::Logic::CCommentRangeEnd*>(m_ooxElement);
int nId = pCommentEnd->m_oId->GetValue();
std::map<int, OOXReader::_comment>::iterator pFindRef = oParam.oReader->m_mapComments.find( nId );
if( pFindRef != oParam.oReader->m_mapComments.end())
{
RtfAnnotElemPtr oNewAnnotElem ( new RtfAnnotElem(2) );
oNewAnnotElem->m_sValue = pFindRef->second.ref;
oOutputParagraph.AddItem( oNewAnnotElem );
//find comment and add info
std::map<int, int>::iterator pFindComment = oParam.oDocx->m_pComments->m_mapComments.find(nId);
if (pFindComment != oParam.oDocx->m_pComments->m_mapComments.end())
{
if ( pFindComment->second < oParam.oDocx->m_pComments->m_arrComments.size() && pFindComment->second >= 0)
{
OOX::CComment* oox_comment = oParam.oDocx->m_pComments->m_arrComments[pFindComment->second];
if (oox_comment)
{
if (oox_comment->m_oAuthor.IsInit())
{
RtfAnnotElemPtr oNewAnnotAuthor ( new RtfAnnotElem(4) );
oNewAnnotAuthor->m_sValue = *oox_comment->m_oAuthor;
oOutputParagraph.AddItem( oNewAnnotAuthor );
}
if (oox_comment->m_oInitials.IsInit())
{
RtfAnnotElemPtr oNewAnnotAuthorId ( new RtfAnnotElem(5) );
oNewAnnotAuthorId->m_sValue = *oox_comment->m_oInitials;
oOutputParagraph.AddItem( oNewAnnotAuthorId );
}
RtfAnnotationPtr oNewAnnotContent(new RtfAnnotation());
oNewAnnotContent->m_oRef = RtfAnnotElemPtr ( new RtfAnnotElem(3) );
oNewAnnotContent->m_oRef->m_sValue = pFindRef->second.ref;
if (oox_comment->m_oDate.IsInit())
{
oNewAnnotContent->m_oDate = RtfAnnotElemPtr ( new RtfAnnotElem(6) );
int nDate = RtfUtility::convertDateTime(oox_comment->m_oDate->GetValue());
oNewAnnotContent->m_oDate->m_sValue = std::to_wstring(nDate);
}
OOXTextItemReader oTextItemReader;
oTextItemReader.m_oTextItems = oNewAnnotContent->m_oContent;
for (size_t i = 0; i < oox_comment->m_arrItems.size(); ++i)
{
if (oParam.oDocx->m_pCommentsExt)
{
OOX::Logic::CParagraph *pParagraph = dynamic_cast<OOX::Logic::CParagraph*>(oox_comment->m_arrItems[i]);
if ((pParagraph) && (pParagraph->m_oParaId.IsInit()))
{
std::map<int, int>::iterator pFindPara = oParam.oDocx->m_pCommentsExt->m_mapComments.find(pParagraph->m_oParaId->GetValue());
if (pFindPara != oParam.oDocx->m_pCommentsExt->m_mapComments.end())
{
oParam.oReader->m_mapCommentsPara.insert(std::make_pair( pParagraph->m_oParaId->GetValue(), pFindRef->second.index));
if (oParam.oDocx->m_pCommentsExt->m_arrComments[pFindPara->second]->m_oParaIdParent.IsInit())
{
std::map<int, int>::iterator pFindParent = oParam.oReader->m_mapCommentsPara.find(oParam.oDocx->m_pCommentsExt->m_arrComments[pFindPara->second]->m_oParaIdParent->GetValue());
if (pFindParent != oParam.oReader->m_mapCommentsPara.end())
{
oNewAnnotContent->m_oParent = RtfAnnotElemPtr ( new RtfAnnotElem(7) );
oNewAnnotContent->m_oParent->m_sValue = std::to_wstring( pFindParent->second - pFindRef->second.index);
}
}
}
}
}
oTextItemReader.Parse(oox_comment->m_arrItems[i], oParam);
}
oOutputParagraph.AddItem( oNewAnnotContent );
}
}
}
}
}break;
default:
break;
}

View File

@ -66,8 +66,17 @@ public:
int m_nCurOleChartId;
int m_nCurFittextId;
std::map<int, std::wstring> m_aBookmarks;
struct _comment
{
std::wstring ref;
int index;
};
std::map<int, _comment> m_mapComments; //nId, ref & index added
std::map<int, int> m_mapCommentsPara; //paraId, index added
std::map<int, int> m_mapPictureBullet;
std::map<int, TextItemContainerPtr> m_mapFootnotes;
std::map<int, TextItemContainerPtr> m_mapEndnotes;

View File

@ -124,39 +124,62 @@ std::wstring RtfAnnotElem::RenderToRtf(RenderParameter oRenderParameter)
std::wstring sResult;
if (m_nType == 1) sResult += L"{\\*\\atrfstart " + m_sValue + L"}";
else if (m_nType = 2) sResult += L"{\\*\\atrfend " + m_sValue + L"}";
else if (m_nType = 3) sResult += L"{\\*\\atnref " + m_sValue + L"}";
else if (m_nType == 2) sResult += L"{\\*\\atrfend " + m_sValue + L"}";
else if (m_nType == 3) sResult += L"{\\*\\atnref " + m_sValue + L"}";
else if (m_nType == 4) sResult += L"{\\*\\atnauthor " + m_sValue + L"}";
else if (m_nType == 5) sResult += L"{\\*\\atnid " + m_sValue + L"}";
else if (m_nType == 6) sResult += L"{\\*\\atndate " + m_sValue + L"}";
else if (m_nType == 7) sResult += L"{\\*\\atnparent " + m_sValue + L"}";
return sResult;
}
std::wstring RtfAnnotElem::RenderToOOX(RenderParameter oRenderParameter)
{
if (m_nType > 3 || m_nType < 1) return L"";
if (m_nType > 8 || m_nType < 1) return L"";
std::wstring sResult;
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
OOXCommentsWriter* poCommentsWriter = static_cast<OOXCommentsWriter*>( poOOXWriter->m_poCommentsWriter );
std::map<std::wstring, int>::iterator pFind = poCommentsWriter->m_mapRefs.find(m_sValue);
int id = -1;
if (pFind == poCommentsWriter->m_mapRefs.end())
if (m_nType == 4)
{
id = poCommentsWriter->m_mapRefs.size() ;//+ 1;
poCommentsWriter->m_mapRefs.insert(std::make_pair(m_sValue, id));
poCommentsWriter->AddCommentAuthor(m_sValue);
}
else if (m_nType == 5)
{
poCommentsWriter->AddCommentID(m_sValue);
}
else
{
id = pFind->second;
}
if (m_nType == 1) sResult += L"<w:commentRangeStart w:id=\"" + std::to_wstring(id) + L"\"/>";
else if (m_nType == 3) sResult += L"<w:commentReference w:id=\"" + std::to_wstring(id) + L"\"/>";
else if (m_nType == 2)
{
sResult += L"<w:commentRangeEnd w:id=\"" + std::to_wstring(id) + L"\"/>";
sResult += L"<w:r><w:commentReference w:id=\"" + std::to_wstring(id) + L"\"/></w:r>";
std::map<std::wstring,OOXCommentsWriter::_comment>::iterator pFind = poCommentsWriter->m_mapComments.find(m_sValue);
int id = -1;
if (pFind == poCommentsWriter->m_mapComments.end())
{
id = poCommentsWriter->m_mapComments.size() ;//+ 1;
poCommentsWriter->AddComment(m_sValue, id);
}
else
{
id = pFind->second.nID;
}
if (m_nType == 1)
{
sResult += L"<w:commentRangeStart w:id=\"" + std::to_wstring(id) + L"\"/>";
}
else if (m_nType == 3)
{
sResult += L"<w:commentReference w:id=\"" + std::to_wstring(id) + L"\"/>";
}
else if (m_nType == 2)
{
poCommentsWriter->SetCommentEnd(m_sValue);
sResult += L"<w:commentRangeEnd w:id=\"" + std::to_wstring(id) + L"\"/>";
sResult += L"<w:r><w:commentReference w:id=\"" + std::to_wstring(id) + L"\"/></w:r>";
}
}
return sResult;
@ -166,12 +189,24 @@ std::wstring RtfAnnotation::RenderToRtf(RenderParameter oRenderParameter)
{
std::wstring sResult;
sResult += L"\\chatn{\\*\\annotation";
if (m_oRef)
{
if (m_oRef->m_nType == 1) sResult += L"{\\*\\atrfstart " + m_oRef->m_sValue + L"}";
else if (m_oRef->m_nType = 2) sResult += L"{\\*\\atrfend " + m_oRef->m_sValue + L"}";
else if (m_oRef->m_nType = 3) sResult += L"{\\*\\atnref " + m_oRef->m_sValue + L"}";
sResult += m_oRef->RenderToRtf(oRenderParameter);
}
if (m_oDate)
{
sResult += m_oDate->RenderToRtf(oRenderParameter);
}
if (m_oParent)
{
sResult += m_oParent->RenderToRtf(oRenderParameter);
}
if (m_oContent)
{
sResult += m_oContent->RenderToRtf(oRenderParameter);
}
sResult += L"}";
return sResult;
}
@ -180,33 +215,14 @@ std::wstring RtfAnnotation::RenderToOOX(RenderParameter oRenderParameter)
OOXWriter* poOOXWriter = static_cast<OOXWriter*> (oRenderParameter.poWriter);
OOXCommentsWriter* poCommentsWriter = static_cast<OOXCommentsWriter*>( poOOXWriter->m_poCommentsWriter );
std::wstring sResult;
sResult += L"<w:comment";
int id = -1;
if (m_oRef)
{
std::map<std::wstring, int>::iterator pFind = poCommentsWriter->m_mapRefs.find(m_oRef->m_sValue);
if (!m_oRef) return L"";
if (pFind == poCommentsWriter->m_mapRefs.end())
{
id = poCommentsWriter->m_mapRefs.size();// + 1;
poCommentsWriter->m_mapRefs.insert(std::make_pair(m_oRef->m_sValue, id));
}
else
{
id = pFind->second;
}
sResult += L" w:id=\"" + std::to_wstring(id) + L"\"";
}
sResult += L" w:author=\"Elena S\"";
if (m_oDate)
{
int nValue = boost::lexical_cast<int>(m_oDate->m_sValue);
sResult += L" w:date=\"" + RtfUtility::convertDateTime(nValue) + L"\"";
poCommentsWriter->AddCommentDate(m_oRef->m_sValue, RtfUtility::convertDateTime(nValue));
}
sResult += L" w:initials=\"ES\"";
sResult += L">";
if (m_oContent)
{
RenderParameter oNewParameter = oRenderParameter;
@ -214,13 +230,16 @@ std::wstring RtfAnnotation::RenderToOOX(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_OOX_PARAM_COMMENT;
oNewParameter.poRels = poCommentsWriter->m_oRelsWriter.get();
sResult += m_oContent->RenderToOOX(oNewParameter);
std::wstring content = m_oContent->RenderToOOX(oNewParameter);
std::wstring sParaId = XmlUtils::IntToString(poOOXWriter->m_nextParaId, L"%08X");//last para id in comment
poCommentsWriter->AddCommentContent(m_oRef->m_sValue, sParaId, content);
}
if (m_oParent)
{
poCommentsWriter->AddCommentParent(m_oRef->m_sValue, m_oParent->m_sValue);
}
sResult += L"</w:comment>";
std::wstring sParaId = XmlUtils::IntToString(poOOXWriter->m_nextParaId, L"%08X");//last para id in comment
poCommentsWriter->AddComment(id, sResult, sParaId, m_oParent ? boost::lexical_cast<int>(m_oParent->m_sValue) : 0);
return L"";
}

View File

@ -130,9 +130,13 @@ std::wstring RtfParagraph::RenderToOOX(RenderParameter oRenderParameter)
if( NULL != m_oOldList )
bCanConvertToNumbering = m_oOldList->CanConvertToNumbering();
std::wstring sParaId = XmlUtils::IntToString(++poOOXWriter->m_nextParaId, L"%08X");
sResult += L"<w:p w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\">";
sResult += L"<w:pPr>";
sResult += L"<w:p";
if (oRenderParameter.nType == RENDER_TO_OOX_PARAM_COMMENT)
{
std::wstring sParaId = XmlUtils::IntToString(++poOOXWriter->m_nextParaId, L"%08X");
sResult += L" w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\"";
}
sResult += L"><w:pPr>";
m_oProperty.m_bOldList = (NULL != m_oOldList);
sResult += m_oProperty.RenderToOOX(oRenderParameter);

View File

@ -379,7 +379,7 @@ public:
return date_str;
}
static int convertDateTime (std::wstring & dt_)
static int convertDateTime (const std::wstring & dt_)
{
int result = 0;

View File

@ -43,30 +43,66 @@ public:
m_oRelsWriter = OOXRelsWriterPtr( new OOXRelsWriter( _T("comments.xml"), oDocument ) );
oWriter.m_oCustomRelsWriter.push_back( m_oRelsWriter );
}
void AddComment( int nID, std::wstring sText, const std::wstring & paraId, int nParentID)
void SetCommentEnd(const std::wstring & ref) //for author
{
m_sComments += sText;
m_mapCommentsParent.insert(std::make_pair(nID, paraId));
m_sCommentsExtended += L"<w15:commentEx w15:paraId=\"" + paraId + L"\"";
if (nParentID != 0)
{
nParentID = nID + nParentID;
std::map<int, std::wstring>::iterator pFind = m_mapCommentsParent.find(nParentID);
if (pFind != m_mapCommentsParent.end())
{
m_sCommentsExtended += L" w15:paraIdParent=\"" + pFind->second + L"\"";
}
}
m_sCommentsExtended += L" w15:done=\"0\"/>";
m_sCurrent_ref = ref;
}
bool Save( std::wstring sFolder )
void AddComment( const std::wstring & ref, int nID)
{
if( m_sComments.empty() ) return false;
_comment comment(nID);
m_mapComments.insert(std::make_pair(ref, comment));
}
void AddCommentID( const std::wstring & id)
{
std::map<std::wstring, _comment>::iterator pFind = m_mapComments.find(m_sCurrent_ref);
if (pFind != m_mapComments.end())
{
pFind->second.authorId = id;
}
}
void AddCommentAuthor( const std::wstring & author)
{
std::map<std::wstring, _comment>::iterator pFind = m_mapComments.find(m_sCurrent_ref);
if (pFind != m_mapComments.end())
{
pFind->second.author = author;
}
}
void AddCommentContent( const std::wstring & ref, const std::wstring & paraId, const std::wstring & content)
{
std::map<std::wstring, _comment>::iterator pFind = m_mapComments.find(ref);
if (pFind != m_mapComments.end())
{
pFind->second.content = content;
pFind->second.paraId = paraId;
m_mapCommentsParent.insert(std::make_pair(pFind->second.nID, paraId));
}
}
void AddCommentParent( const std::wstring & ref, const std::wstring & parent)
{
std::map<std::wstring, _comment>::iterator pFind = m_mapComments.find(ref);
if (pFind != m_mapComments.end())
{
pFind->second.nParentID = boost::lexical_cast<int>(parent);
}
}
void AddCommentDate( const std::wstring & ref, const std::wstring & date)
{
std::map<std::wstring, _comment>::iterator pFind = m_mapComments.find(ref);
if (pFind != m_mapComments.end())
{
pFind->second.date = date;
}
}
bool Save( std::wstring sFolder )
{
if( m_mapComments.empty() ) return false;
CFile file;
if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("comments.xml"))) return false;
@ -82,8 +118,6 @@ public:
file.CloseFile();
//-------------------------------------------------------------------------------------------------------------------------
if( m_sCommentsExtended.empty() ) return true;
if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + L"commentsExtended.xml")) return false;
m_oWriter.m_oDocRels.AddRelationship( L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml" );
@ -98,46 +132,82 @@ public:
file.CloseFile();
return true;
}
std::map<std::wstring, int> m_mapRefs;
std::map<int, std::wstring> m_mapCommentsParent;
struct _comment
{
_comment(int id) : nID(id) {}
int nID = 0;
int nParentID = 0;
std::wstring author;
std::wstring date;
std::wstring content;
std::wstring authorId;
std::wstring paraId;
};
std::map<std::wstring, _comment> m_mapComments;
private:
RtfDocument& m_oDocument;
OOXWriter& m_oWriter;
std::wstring m_sComments;
std::wstring m_sCommentsExtended;
std::wstring m_sCurrent_ref;
std::wstring m_sCommentsExtended;
std::map<int, std::wstring> m_mapCommentsParent;
std::wstring CreateXml()
{
std::wstring sResult;
sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
std::wstring sResult = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
sResult += _T("<w:comments \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingCanvas\" \
sResult += L"<w:comments \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2009/2/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingInk\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingShape\">");
sResult += m_sComments;
sResult += _T("</w:comments>");
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 w15 wp14\">";
for (std::map<std::wstring, _comment>::iterator it = m_mapComments.begin(); it != m_mapComments.end(); ++it)
{
sResult += L"<w:comment w:id=\"" + std::to_wstring(it->second.nID) + L"\" w:author=\"" +
it->second.author + L"\" w:date=\"" + it->second.date + L"\" w:initials=\"" + it->second.authorId + L"\">";
sResult += it->second.content;
sResult += L"</w:comment>";
//--------------------------------------------------------
m_sCommentsExtended += L"<w15:commentEx w15:paraId=\"" + it->second.paraId + L"\"";
if (it->second.nParentID != 0)
{
it->second.nParentID = it->second.nID + it->second.nParentID;
std::map<int, std::wstring>::iterator pFind = m_mapCommentsParent.find(it->second.nParentID);
if (pFind != m_mapCommentsParent.end())
{
m_sCommentsExtended += L" w15:paraIdParent=\"" + pFind->second + L"\"";
}
}
m_sCommentsExtended += L" w15:done=\"0\"/>";
}
sResult += L"</w:comments>";
return sResult;
}
std::wstring CreateXmlExtended()
{
std::wstring sResult;
sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
sResult += L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
sResult += _T("<w15:commentsEx \
sResult += L"<w15:commentsEx \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" \
xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" \
@ -157,9 +227,9 @@ xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\"
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 w15 w16se wp14\">");
mc:Ignorable=\"w14 w15 w16se wp14\">";
sResult += m_sCommentsExtended;
sResult += _T("</w15:commentsEx>");
sResult += L"</w15:commentsEx>";
return sResult;
}

View File

@ -54,7 +54,7 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
m_sTargetFolder ( sPath.c_str() ),
m_oRels ( L"", oDocument ),
m_nCurTrackChangesId( 0),
m_nextParaId ( 0x77000000),
m_nextParaId ( 0x00000000),
m_oDocRels ( L"document.xml", oDocument )
{
m_nCurFitWidth = PROP_DEF;

View File

@ -40,6 +40,19 @@
#include <algorithm>
#include <string>
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#if defined(_DEBUG)
#pragma comment(lib, "../../build/lib/win_32/DEBUG/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/kernel.lib")
#else
#pragma comment(lib, "../../build/lib/win_32/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/kernel.lib")
#endif
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
HRESULT convert_single(std::wstring srcFileName)
{
int n1 = srcFileName.rfind(_T('.'));

View File

@ -2,82 +2,18 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtfFormatLib", "..\RtfFormatLib\Win32\RtfFormatLib.vcproj", "{AF2D00A7-A351-4700-AE88-C1D9ADE29345}"
ProjectSection(ProjectDependencies) = postProject
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
ProjectSection(ProjectDependencies) = postProject
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig", "..\..\DesktopEditor\cximage\jbig\jbig_vs2005.vcproj", "{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "..\..\DesktopEditor\cximage\jpeg\Jpeg_vs2005.vcproj", "{818753F2-DBB9-4D3B-898A-A604309BE470}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpsd", "..\..\DesktopEditor\cximage\libpsd\libpsd_vs2005.vcproj", "{9A037A69-D1DF-4505-AB2A-6CB3641C476E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mng", "..\..\DesktopEditor\cximage\mng\mng_vs2005.vcproj", "{40A69F40-063E-43FD-8543-455495D8733E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "png", "..\..\DesktopEditor\cximage\png\png_vs2005.vcproj", "{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdcr", "..\..\DesktopEditor\cximage\raw\libdcr_vs2005.vcproj", "{DF861D33-9BC1-418C-82B1-581F590FE169}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiff", "..\..\DesktopEditor\cximage\tiff\Tiff_vs2005.vcproj", "{0588563C-F05C-428C-B21A-DD74756628B3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2", "..\..\DesktopEditor\raster\JBig2\win32\jbig2.vcproj", "{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeUtilsLib", "..\..\OfficeUtils\win32\OfficeUtilsLib.vcproj", "{F8274B05-168E-4D6E-B843-AA7510725363}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtfFormatTest", "RtfFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{AF2D00A7-A351-4700-AE88-C1D9ADE29345} = {AF2D00A7-A351-4700-AE88-C1D9ADE29345}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"
ProjectSection(ProjectDependencies) = postProject
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "font_engine", "..\..\DesktopEditor\fontengine\font_engine_vs2005.vcproj", "{C739151F-5384-41DF-A1A6-F089E2C1AD56}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agg2d", "..\..\DesktopEditor\agg-2.4\agg_vs2005.vcproj", "{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\..\DesktopEditor\freetype-2.5.2\builds\windows\vc2005\freetype.vcproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\DesktopEditor\xml\build\vs2005\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -102,102 +38,6 @@ Global
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|x64.ActiveCfg = Release|x64
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|x64.Build.0 = Release|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|Win32.ActiveCfg = Debug|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|Win32.Build.0 = Debug|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|x64.ActiveCfg = Debug|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Debug|x64.Build.0 = Debug|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|Win32.ActiveCfg = Release|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|Win32.Build.0 = Release|Win32
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|x64.ActiveCfg = Release|x64
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}.Release|x64.Build.0 = Release|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|Win32.ActiveCfg = Debug|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|Win32.Build.0 = Debug|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|x64.ActiveCfg = Debug|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Debug|x64.Build.0 = Debug|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|Win32.ActiveCfg = Release|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|Win32.Build.0 = Release|Win32
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|x64.ActiveCfg = Release|x64
{BC52A07C-A797-423D-8C4F-8678805BBB36}.Release|x64.Build.0 = Release|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|Win32.ActiveCfg = Debug|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|Win32.Build.0 = Debug|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|x64.ActiveCfg = Debug|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Debug|x64.Build.0 = Debug|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|Win32.ActiveCfg = Release|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|Win32.Build.0 = Release|Win32
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|x64.ActiveCfg = Release|x64
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}.Release|x64.Build.0 = Release|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|Win32.ActiveCfg = Debug|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|Win32.Build.0 = Debug|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|x64.ActiveCfg = Debug|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Debug|x64.Build.0 = Debug|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|Win32.ActiveCfg = Release|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|Win32.Build.0 = Release|Win32
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|x64.ActiveCfg = Release|x64
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}.Release|x64.Build.0 = Release|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|Win32.ActiveCfg = Debug|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|Win32.Build.0 = Debug|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|x64.ActiveCfg = Debug|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Debug|x64.Build.0 = Debug|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|Win32.ActiveCfg = Release|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|Win32.Build.0 = Release|Win32
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|x64.ActiveCfg = Release|x64
{818753F2-DBB9-4D3B-898A-A604309BE470}.Release|x64.Build.0 = Release|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|Win32.ActiveCfg = Debug|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|Win32.Build.0 = Debug|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|x64.ActiveCfg = Debug|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Debug|x64.Build.0 = Debug|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|Win32.ActiveCfg = Release|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|Win32.Build.0 = Release|Win32
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|x64.ActiveCfg = Release|x64
{9A037A69-D1DF-4505-AB2A-6CB3641C476E}.Release|x64.Build.0 = Release|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|Win32.ActiveCfg = Debug|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|Win32.Build.0 = Debug|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|x64.ActiveCfg = Debug|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Debug|x64.Build.0 = Debug|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Release|Win32.ActiveCfg = Release|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Release|Win32.Build.0 = Release|Win32
{40A69F40-063E-43FD-8543-455495D8733E}.Release|x64.ActiveCfg = Release|x64
{40A69F40-063E-43FD-8543-455495D8733E}.Release|x64.Build.0 = Release|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|Win32.ActiveCfg = Debug|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|Win32.Build.0 = Debug|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|x64.ActiveCfg = Debug|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Debug|x64.Build.0 = Debug|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|Win32.ActiveCfg = Release|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|Win32.Build.0 = Release|Win32
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|x64.ActiveCfg = Release|x64
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7}.Release|x64.Build.0 = Release|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|Win32.ActiveCfg = Debug|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|Win32.Build.0 = Debug|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|x64.ActiveCfg = Debug|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Debug|x64.Build.0 = Debug|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|Win32.ActiveCfg = Release|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|Win32.Build.0 = Release|Win32
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|x64.ActiveCfg = Release|x64
{DF861D33-9BC1-418C-82B1-581F590FE169}.Release|x64.Build.0 = Release|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|Win32.ActiveCfg = Debug|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|Win32.Build.0 = Debug|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|x64.ActiveCfg = Debug|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Debug|x64.Build.0 = Debug|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|Win32.ActiveCfg = Release|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|Win32.Build.0 = Release|Win32
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|x64.ActiveCfg = Release|x64
{0588563C-F05C-428C-B21A-DD74756628B3}.Release|x64.Build.0 = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|Win32.ActiveCfg = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|Win32.Build.0 = Debug|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|x64.ActiveCfg = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Debug|x64.Build.0 = Debug|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|Win32.ActiveCfg = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|Win32.Build.0 = Release|Win32
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|x64.ActiveCfg = Release|x64
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}.Release|x64.Build.0 = Release|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|Win32.ActiveCfg = Debug|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|Win32.Build.0 = Debug|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|x64.ActiveCfg = Debug|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Debug|x64.Build.0 = Debug|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|Win32.ActiveCfg = Release|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|Win32.Build.0 = Release|Win32
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|x64.ActiveCfg = Release|x64
{F8274B05-168E-4D6E-B843-AA7510725363}.Release|x64.Build.0 = Release|x64
{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}.Debug|Win32.ActiveCfg = Debug|Win32
{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}.Debug|Win32.Build.0 = Debug|Win32
{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}.Debug|x64.ActiveCfg = Debug|x64
@ -214,46 +54,6 @@ Global
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|x64.ActiveCfg = Release|x64
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|x64.Build.0 = Release|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|Win32.ActiveCfg = Debug|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|Win32.Build.0 = Debug|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|x64.ActiveCfg = Debug|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Debug|x64.Build.0 = Debug|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|Win32.ActiveCfg = Release|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|Win32.Build.0 = Release|Win32
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|x64.ActiveCfg = Release|x64
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}.Release|x64.Build.0 = Release|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.ActiveCfg = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.Build.0 = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|x64.ActiveCfg = Debug|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|x64.Build.0 = Debug|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.Build.0 = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|x64.ActiveCfg = Release|x64
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|x64.Build.0 = Release|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|Win32.ActiveCfg = Debug|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|Win32.Build.0 = Debug|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|x64.ActiveCfg = Debug|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Debug|x64.Build.0 = Debug|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|Win32.ActiveCfg = Release|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|Win32.Build.0 = Release|Win32
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|x64.ActiveCfg = Release|x64
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}.Release|x64.Build.0 = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|Win32.ActiveCfg = Debug|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|Win32.Build.0 = Debug|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|x64.ActiveCfg = Debug|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Debug|x64.Build.0 = Debug|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|Win32.ActiveCfg = Release|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|Win32.Build.0 = Release|Win32
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|x64.ActiveCfg = Release|x64
{21663823-DE45-479B-91D0-B4FEF4916EF0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -427,23 +427,7 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
</File>
</Filter>
<File
RelativePath="..\..\build\bin\icu\win_32\icudt.lib"
>
</File>
<File
RelativePath="..\..\build\bin\icu\win_32\icuuc.lib"
>
</File>
<File
RelativePath="RtfFormatTest.cpp"
>

View File

@ -30,8 +30,8 @@ fi
echo "$platform$arch"
if [ ! -f Makefile ]; then
perl ./Configure $platform$arch
./config
#perl ./Configure $platform$arch
./config no-shared no-asm
fi
make

View File

@ -1,12 +1,8 @@
core_linux {
#DEFINES += XMLSEC_OPENSSL_110
#INCLUDEPATH += $$CORE_ROOT_DIR/Common/3dParty/openssl/openssl/include
#LIBS += -L$$CORE_ROOT_DIR/Common/3dParty/openssl/openssl -lssl
#LIBS += -L$$CORE_ROOT_DIR/Common/3dParty/openssl/openssl -lcrypto
INCLUDEPATH += $$PWD/openssl/include
#INCLUDEPATH += /usr/include/openssl
LIBS += -lssl
LIBS += -lcrypto
LIBS += -L$$PWD/openssl/libssl.a
LIBS += -L$$PWD/openssl/libcrypto.a
}

View File

@ -413,6 +413,18 @@ namespace OOX
{
return type().DefaultFileName();
}
void SetDefaults()
{
SetApplication(L"ONLYOFFICE");
#if defined(INTVER)
SetAppVersion(VALUE2STR(INTVER));
#endif
SetDocSecurity(0);
SetScaleCrop(false);
SetLinksUpToDate(false);
SetSharedDoc(false);
SetHyperlinksChanged(false);
}
void SetApplication(const std::wstring& sVal)
{
m_sApplication = sVal;

View File

@ -336,7 +336,15 @@ namespace OOX
{
sName = oReader.GetName();
if ( L"w:comment" == sName )
m_arrComments.push_back( new CComment(oReader) );
{
CComment* pComment = new CComment(oReader);
if ((pComment) && (pComment->m_oId.IsInit()))
{
m_mapComments.insert( std::make_pair( pComment->m_oId->GetValue(), m_arrComments.size()));
}
m_arrComments.push_back( pComment );
}
}
}
}
@ -357,7 +365,8 @@ namespace OOX
return type().DefaultFileName();
}
std::vector<CComment*> m_arrComments;
std::vector<CComment*> m_arrComments;
std::map<int, int> m_mapComments; //id, index
};
class CCommentExt : public WritingElement
@ -401,10 +410,9 @@ namespace OOX
}
public:
// Attributes
nullable<SimpleTypes::CLongHexNumber<> > m_oParaId;
nullable<SimpleTypes::CLongHexNumber<> > m_oParaIdParent;
nullable<SimpleTypes::COnOff<> > m_oDone;
nullable<SimpleTypes::CLongHexNumber<> > m_oParaId;
nullable<SimpleTypes::CLongHexNumber<> > m_oParaIdParent;
nullable<SimpleTypes::COnOff<> > m_oDone;
};
class CCommentsExt : public OOX::File
@ -449,7 +457,14 @@ namespace OOX
{
sName = oReader.GetName();
if ( L"w15:commentEx" == sName )
m_arrComments.push_back( new CCommentExt(oReader) );
{
CCommentExt* pCommentExt = new CCommentExt(oReader);
if ((pCommentExt) && (pCommentExt->m_oParaId.IsInit()))
{
m_mapComments.insert( std::make_pair( pCommentExt->m_oParaId->GetValue(), m_arrComments.size()));
m_arrComments.push_back( pCommentExt );
}
}
}
}
}
@ -470,7 +485,8 @@ namespace OOX
return type().DefaultFileName();
}
std::vector<CCommentExt*> m_arrComments;
std::vector<CCommentExt*> m_arrComments;
std::map<int, int> m_mapComments; //paraId, index
};
class CPresenceInfo : public WritingElement

View File

@ -57,8 +57,6 @@ namespace OOX
virtual ~CCore()
{
}
public:
virtual void read(const CPath& oPath)
{
XmlUtils::CXmlNode oProperties;
@ -230,7 +228,6 @@ namespace OOX
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
}
public:
virtual const FileType type() const
{
return FileTypes::Core;
@ -244,7 +241,11 @@ namespace OOX
{
return type().DefaultFileName();
}
void SetDefaults()
{
m_sCreator = L"";
m_sLastModifiedBy = L"";
}
void SetCreator(std::wstring sVal)
{
m_sCreator = sVal;

View File

@ -1,6 +1,10 @@
VERSION = 2.4.535.0
VERSION = $$cat(version.txt)
DEFINES += INTVER=$$VERSION
QMAKE_TARGET_COMPANY = Ascensio System SIA
QMAKE_TARGET_COPYRIGHT = Ascensio System SIA Copyright (c) 2018
# CONFIGURATION
CONFIG(debug, debug|release) {
CONFIG += core_debug

1
Common/version.txt Normal file
View File

@ -0,0 +1 @@
2.4.537.0

View File

@ -29,14 +29,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "ApplicationFonts.h"
//#include "ApplicationFonts.h"
#include "ApplicationFontsWorker.h"
#include "../common/File.h"
#include "../common/Array.h"
#include "../common/Directory.h"
#include "./MemoryStream.h"
#include "./../graphics/pro/Fonts.h"
using namespace NSFonts;
#include "./MemoryStream.h"
#include "./../graphics/pro/Fonts.h"
using namespace NSFonts;
namespace NSFontsApplication
{
@ -347,11 +348,11 @@ namespace NSFontsApplication
}
};
static std::vector<std::wstring> SaveAllFontsJS(CApplicationFonts& applicationFonts, CStringWriter& oWriterJS)
static std::vector<std::wstring> SaveAllFontsJS(NSFonts::IApplicationFonts* applicationFonts, CStringWriter& oWriterJS)
{
std::vector<std::wstring> arrNames;
std::vector<NSFonts::CFontInfo*>* pList = applicationFonts.GetList()->GetFonts();
std::vector<NSFonts::CFontInfo*>* pList = applicationFonts->GetList()->GetFonts();
#ifdef _IOS
@ -361,7 +362,7 @@ namespace NSFontsApplication
CFontInfo* pInfo = pList->operator [](i);
if (pInfo->m_wsFontName.find(L".") == 0)
{
{
pList->erase(pList->begin() + i);
// странные шрифты какие-то есть в ios
//pList->RemoveAt(i);
@ -556,7 +557,7 @@ namespace NSFontsApplication
{
BYTE* pData = NULL;
LONG lLen = 0;
applicationFonts.GetList()->ToBuffer(&pData, &lLen, L"", true);
applicationFonts->GetList()->ToBuffer(&pData, &lLen, L"", true);
char* cData64 = NULL;
int nData64Dst = 0;
@ -658,14 +659,14 @@ std::vector<std::wstring> CApplicationFontsWorker::CheckApplication(bool bIsNeed
std::vector<std::wstring> arrNames;
std::vector<std::wstring> fonts;
CApplicationFonts oFonts;
NSFonts::IApplicationFonts* pFonts = NSFonts::NSApplication::Create();
pDataDst = NULL;
nLenDst = 0;
if (bIsNeedSystemFonts)
{
fonts = oFonts.GetSetupFontFiles();
fonts = pFonts->GetSetupFontFiles();
}
for (std::vector<std::wstring>::iterator iter = m_arAdditionalFolders.begin(); iter != m_arAdditionalFolders.end(); ++iter)
@ -720,10 +721,10 @@ std::vector<std::wstring> CApplicationFontsWorker::CheckApplication(bool bIsNeed
}
// произошли изменения
oFonts.InitializeFromArrayFiles(fonts);
pFonts->InitializeFromArrayFiles(fonts);
NSFontsApplication::CStringWriter oWriterJS;
arrNames = NSFontsApplication::SaveAllFontsJS(oFonts, oWriterJS);
arrNames = NSFontsApplication::SaveAllFontsJS(pFonts, oWriterJS);
// теперь нужно записать новую дату
NSMemoryStream::CMemoryStream oStream;

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
@ -773,4 +773,32 @@ void CFontManager::SetSubpixelRendering(const bool& hmul, const bool& vmul)
m_nRENDER_MODE = FT_RENDER_MODE_LCD_V;
else
m_nRENDER_MODE = FT_RENDER_MODE_NORMAL;
}
void CFontManager::GetFace(double& d0, double& d1, double& d2)
{
d0 = 2048;
d1 = 0;
d2 = 0;
if (m_pFont)
{
TT_OS2* os2 = NULL;
TT_Header* header = NULL;
if (m_pFont->m_pFace)
{
if ((header = (TT_Header*)FT_Get_Sfnt_Table(m_pFont->m_pFace, ft_sfnt_head)) != NULL)
{
d1 = header->yMax;
d2 = header->yMin;
d0 = header->Units_Per_EM;
}
if ((os2 = (TT_OS2*)FT_Get_Sfnt_Table(m_pFont->m_pFace, ft_sfnt_os2)) != NULL && os2->version != 0xFFFFU)
{
d1 = os2->usWinAscent;
d2 = -os2->usWinDescent;
}
}
}
}

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
@ -217,7 +217,9 @@ public:
virtual std::wstring GetFontType();
virtual unsigned int GetNameIndex(const std::wstring& wsName);
virtual void SetSubpixelRendering(const bool& hmul, const bool& vmul);
virtual void SetSubpixelRendering(const bool& hmul, const bool& vmul);
virtual void GetFace(double& d0, double& d1, double& d2);
};
#endif // _BUILD_FONT_ENGINE_FONTMANAGER_H_

View File

@ -152,27 +152,7 @@ static inline unsigned char Div255(int nValue)
//-------------------------------------------------------------------------------------------------------------------------------
class CDIB : public IGrObject
{
public:
BYTE* m_pBits;
LONG m_lWidth;
LONG m_lHeight;
public:
CDIB() : IGrObject()
{
m_pBits = NULL;
m_lWidth = 0;
m_lHeight = 0;
}
virtual ~CDIB()
{
// delete all in system wrapper
}
virtual INT Create(LONG lWidth, LONG lHeight, double dDPIX, double dDPIY) = 0;
};
class CDIB;
class CGraphics_ClipStateRecord
{

View File

@ -718,6 +718,16 @@ namespace Aggplus
return Ok;
}
bool CGraphicsPath::IsPointInPath(const double& x, const double& y)
{
agg::rasterizer_scanline_aa<> rasterizer;
agg::conv_curve<agg::path_storage> c_c_path(m_internal->m_agg_ps);
rasterizer.add_path(c_c_path);
return rasterizer.hit_test((int)x, (int)y);
}
}
namespace Aggplus

View File

@ -97,6 +97,7 @@ namespace Aggplus
int EllipseArc3(double fX, double fY, double fXRad, double fYRad, double dAngle1, double dAngle2, double *pfXCur, double *pfYCur, INT bClockDirection = FALSE);
int Ellipse(double fX, double fY, double fXRad, double fYRad);
Status AddArc2(double fX, double fY, double fWidth, double fHeight, double fStartAngle, double fSweepAngle);
bool IsPointInPath(const double& x, const double& y);
public:
CGraphicsPath_private* m_internal;

View File

@ -213,8 +213,13 @@ namespace Aggplus
double CMatrix::ty() const
{
return m_internal->m_agg_mtx.ty;
}
double CMatrix::rotation()
{
return m_internal->m_agg_mtx.rotation();
}
void CMatrix::SetElements(const double& sx, const double& shy, const double& shx, const double& sy, const double& tx, const double& ty)
{
m_internal->m_agg_mtx.sx = sx;

View File

@ -71,7 +71,7 @@ namespace Aggplus
double shy() const;
double tx() const;
double ty() const;
double rotation();
void SetElements(const double& sx, const double& shy, const double& shx, const double& sy, const double& tx = 0, const double& ty = 0);
Status GetElements(float* m) const;

View File

@ -460,6 +460,10 @@ namespace NSFonts
virtual bool IsItalic() = 0;
virtual bool IsBold() = 0;
virtual void SetItalic(const INT& value) = 0;
virtual void SetNeedBold(const INT& value) = 0;
virtual bool IsSymbolic(bool bIsOS2Check = false) = 0;
virtual int IsUnicodeRangeAvailable(unsigned long ulBit, unsigned int un4ByteIndex) = 0;
@ -565,6 +569,8 @@ namespace NSFonts
virtual void SetSubpixelRendering(const bool& hmul, const bool& vmul) = 0;
virtual unsigned int GetNameIndex(const std::wstring& wsName) = 0;
virtual void GetFace(double& d0, double& d1, double& d2) = 0;
public:
static IFontFile* LoadFontFile(CLibrary& library, IFontStream* pStream, int lFaceIndex);

View File

@ -40,7 +40,31 @@
#include "./Image.h"
#include "../IRenderer.h"
#include "../structures.h"
namespace Aggplus {
class CDIB : public IGrObject
{
public:
BYTE* m_pBits;
LONG m_lWidth;
LONG m_lHeight;
public:
CDIB() : IGrObject()
{
m_pBits = NULL;
m_lWidth = 0;
m_lHeight = 0;
}
virtual ~CDIB()
{
// delete all in system wrapper
}
virtual INT Create(LONG lWidth, LONG lHeight, double dDPIX, double dDPIY) = 0;
};
}
namespace NSGraphics
{
class GRAPHICS_DECL IGraphicsRenderer : public IRenderer
@ -63,9 +87,46 @@ namespace NSGraphics
public:
virtual void CreateFromBgraFrame(CBgraFrame* pFrame) = 0;
virtual void SetCoordTransformOffset(double dOffsetX, double dOffsetY) = 0;
virtual void SavePen(NSStructures::CPen& oPen) = 0;
virtual void RestorePen(const NSStructures::CPen& oPen) = 0;
virtual void SaveBrush(NSStructures::CBrush& oBrush) = 0;
virtual void RestoreBrush(const NSStructures::CBrush& oBrush) = 0;
virtual void put_GlobalAlphaEnabled(const bool& bEnabled, const double& dVal) = 0;
virtual void put_IntegerGrid(const bool& bEnabled) = 0;
virtual bool get_IntegerGrid() = 0;
virtual void AddRect(const double& x, const double& y, const double& w, const double& h) = 0;
virtual void SetFontAttack() = 0;
virtual void Create(BYTE* pPixels, const Aggplus::CDoubleRect& oRect, LONG lWidthControl, LONG lHeightControl, Aggplus::CDIB* pDib = NULL) = 0;
virtual void CreateFlip(BYTE* pPixels, const Aggplus::CDoubleRect& oRect, LONG lWidthControl, LONG lHeightControl, Aggplus::CDIB* pDib = NULL) = 0;
virtual Aggplus::CMatrix* GetFullTransform() = 0;
virtual Aggplus::CMatrix* GetTransformMatrix() = 0;
virtual void CalculateFullTransform() = 0;
virtual void PathCommandRect(double x, double y, double w, double h) = 0;
virtual Aggplus::CMatrix* GetCoordTransform() = 0;
virtual void Fill() = 0;
virtual void Stroke() = 0;
virtual double GetPixW() = 0;
virtual double GetPixH() = 0;
// smart methods
virtual void drawHorLine(BYTE align, double y, double x, double r, double penW) = 0;
virtual void drawHorLine2(BYTE align, double y, double x, double r, double penW) = 0;
virtual void drawVerLine(BYTE align, double x, double y, double b, double penW) = 0;
virtual void drawHorLineExt(BYTE align, double y, double x, double r, double penW, double leftMW, double rightMW) = 0;
};
GRAPHICS_DECL IGraphicsRenderer* Create();
}
#endif // _GRAPHICS_EXPORTS_GRAPHICS_H_

View File

@ -515,6 +515,9 @@ namespace MetaFile
else //if (WINDING == unFillMode)
unClipMode |= c_nClipRegionTypeWinding;
if (RGN_COPY == unMode)
ResetClip();
m_pRenderer->put_ClipMode(unClipMode);
m_pRenderer->BeginCommand(c_nClipType);
m_pRenderer->BeginCommand(c_nPathType);

View File

@ -232,7 +232,7 @@ static const struct ActionNamesEmf
//-----------------------------------------------------------
// 2.3.2 Clipping
//-----------------------------------------------------------
case EMR_EXCLUDECLIPRECT: Read_EMR_EXCLUDECLIPRECT(); break;
case EMR_EXCLUDECLIPRECT: Read_EMR_EXCLUDECLIPRECT(); break;
case EMR_EXTSELECTCLIPRGN: Read_EMR_EXTSELECTCLIPRGN(); break;
case EMR_INTERSECTCLIPRECT: Read_EMR_INTERSECTCLIPRECT(); break;
case EMR_SELECTCLIPPATH: Read_EMR_SELECTCLIPPATH(); break;

View File

@ -211,7 +211,8 @@ namespace XmlUtils
if ((XmlNodeType_Element == eNodeType && nCurDepth == nDepth + 1)
|| ((XmlNodeType_Text == eNodeType ||
XmlNodeType_Whitespace == eNodeType) && nCurDepth == nDepth + 1))
XmlNodeType_Whitespace == eNodeType ||
XmlNodeType_SIGNIFICANT_WHITESPACE == eNodeType ) && nCurDepth == nDepth + 1))
return true;
else if (XmlNodeType_EndElement == eNodeType && nCurDepth == nDepth)
return false;

View File

@ -57,6 +57,7 @@
69DA32F91CEE100E00E10AF0 /* libraster_ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 69DA32491CEE094A00E10AF0 /* libraster_ios.a */; };
69EC66D91E01775B003527E2 /* libUnicodeConverter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 69EC66D21E01770D003527E2 /* libUnicodeConverter.a */; };
8A9FAC2B207772E1007787F6 /* libicu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A9FAC27207772CC007787F6 /* libicu.a */; };
8ADB5F4220C52EFE00B72D37 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 8ADB5F4120C52EFE00B72D37 /* version.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -479,6 +480,7 @@
69DA325C1CEE09BB00E10AF0 /* PPTXFormatLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PPTXFormatLib.xcodeproj; path = ../../../../ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj; sourceTree = "<group>"; };
69EC66CD1E01770C003527E2 /* UnicodeConverter.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UnicodeConverter.xcodeproj; path = ../../../../UnicodeConverter/build/UnicodeConverter/UnicodeConverter.xcodeproj; sourceTree = "<group>"; };
8A9FAC22207772CC007787F6 /* icu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = icu.xcodeproj; path = icu/icu.xcodeproj; sourceTree = "<group>"; };
8ADB5F4120C52EFE00B72D37 /* version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -567,6 +569,7 @@
isa = PBXGroup;
children = (
6967AFA51E27918600A129E2 /* src */,
8ADB5F4120C52EFE00B72D37 /* version.h */,
17C27A171AC2DB3D00E1D003 /* X2tConverter.h */,
17C27A191AC2DB3D00E1D003 /* X2tConverter.mm */,
);
@ -828,6 +831,7 @@
buildActionMask = 2147483647;
files = (
6967AFB11E2793A500A129E2 /* cextracttools.h in Headers */,
8ADB5F4220C52EFE00B72D37 /* version.h in Headers */,
6911A9691F6036DA0061AB4D /* OfficeFileErrorDescription.h in Headers */,
6967B10F1E27A65600A129E2 /* OfficeFileFormatChecker.h in Headers */,
6967AFB51E27940600A129E2 /* ASCConverters.h in Headers */,
@ -845,6 +849,7 @@
17C8DEC61ACD696100902C85 /* Sources */,
17C8DEC81ACD696100902C85 /* Frameworks */,
17C8DECB1ACD696100902C85 /* Headers */,
8ADB5F4420C52F6E00B72D37 /* ShellScript */,
);
buildRules = (
);
@ -1225,6 +1230,19 @@
shellPath = /bin/sh;
shellScript = "SIMULATOR_LIBRARY_PATH=\"${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a\" &&\nDEVICE_LIBRARY_PATH=\"${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a\" &&\nUNIVERSAL_LIBRARY_DIR=\"${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal\" &&\nFRAMEWORK=\"${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal/${PROJECT_NAME}.framework\" &&\n\n# Create framework directory structure.\nrm -rf \"${FRAMEWORK}\" &&\nmkdir -p \"${UNIVERSAL_LIBRARY_DIR}\" &&\n\n# Generate universal binary for the device and simulator.\nlipo \"${SIMULATOR_LIBRARY_PATH}\" \"${DEVICE_LIBRARY_PATH}\" -create -output \"${FRAMEWORK}\"";
};
8ADB5F4420C52F6E00B72D37 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "VERSION=$(cat \"../../../../Common/version.txt\")\n\necho \"#ifndef X2T_VERSION_H\n#define X2T_VERSION_H\n\n#define X2T_VERSION \\\"$VERSION\\\"\n\n#endif\" > \"X2tConverter/version.h\"\n\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */

View File

@ -41,6 +41,8 @@
@interface X2tConverter : NSObject
+ (NSString *)version;
@property (strong) NSString* password;
@property (assign) BOOL isNoBase64;
@property (strong) NSNumber* delimiter;
@ -70,6 +72,8 @@
- (int)sdk_xlst2csv:(NSString*)nsFrom nsTo:(NSString*)nsTo xmlOptions:(NSString*)xmlOptions nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath;
- (int)sdk_xlsx2csv:(NSString*)nsFrom nsTo:(NSString*)nsTo xmlOptions:(NSString*)xmlOptions nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath;
- (int)txt2doct_bin:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath;
- (int)sdk_dir2zip:(NSString*)nsFrom nsTo:(NSString*)nsTo;
- (int)sdk_zip2dir:(NSString*)nsFrom nsTo:(NSString*)nsTo;

View File

@ -32,6 +32,8 @@
#import "X2tConverter.h"
#include "version.h"
#include "cextracttools.h"
#include "ASCConverters.h"
@ -94,7 +96,7 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
if (self.password) {
if (nil != self.password && self.password.length > 0) {
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.docx";
@ -169,7 +171,7 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
if (self.password) {
if (nil != self.password && self.password.length > 0) {
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.xlsx";
@ -238,7 +240,7 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
NExtractTools::InputParams oInputParams;
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
if (self.password) {
if (nil != self.password && self.password.length > 0) {
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.pptx";
@ -347,6 +349,25 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
return NExtractTools::xlsx2csv(from, to, temp, oInputParams);
}
- (int)txt2doct_bin:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath {
std::wstring from = nsstring_to_wstring(nsFrom);
std::wstring to = nsstring_to_wstring(nsTo);
std::wstring temp = nsstring_to_wstring(nsTemp);
NExtractTools::InputParams oInputParams;
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
if (self.encoding != nil) {
oInputParams.m_nCsvTxtEncoding = new int(self.encoding.intValue);
}
oInputParams.m_nFormatFrom = new int(AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT);
oInputParams.m_nFormatTo = new int(AVS_OFFICESTUDIO_FILE_CANVAS_WORD);
return NExtractTools::txt2doct_bin(from, to, temp, oInputParams);
}
- (int)sdk_dir2zip:(NSString*)nsFrom nsTo:(NSString*)nsTo {
std::wstring from = nsstring_to_wstring(nsFrom);
std::wstring to = nsstring_to_wstring(nsTo);
@ -386,4 +407,8 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
return values;
}
+ (NSString *)version {
return [[NSString alloc] initWithUTF8String:X2T_VERSION];
}
@end

View File

@ -0,0 +1,6 @@
#ifndef X2T_VERSION_H
#define X2T_VERSION_H
#define X2T_VERSION "2.4.537.0"
#endif

View File

@ -52,6 +52,8 @@
{
[super viewDidLoad];
NSLog(@"x2t version converter: %@", [X2tConverter version]);
NSLog(@"%@", [X2tConverter delimiters]);
NSLog(@"%@", [X2tConverter encodingings]);

View File

@ -358,7 +358,7 @@ namespace XPS
ReadAttribute(oReader, L"Source", wsSource);
if (!wsSource.empty())
{
std::wstring wsPath = m_wsRootPath + wsSource.c_str();
std::wstring wsPath = m_wsRootPath + wsSource.c_stdstr();
pState->PushResource(m_pDocument->GetStaticResource(wsPath.c_str()), false);
}
else
@ -687,7 +687,14 @@ namespace XPS
if (oEntry.bGid)
pRenderer->CommandDrawTextExCHAR(oEntry.nUnicode, oEntry.nGid, xpsUnitToMM(dXorigin), xpsUnitToMM(dYorigin), 0, 0);
else
pRenderer->CommandDrawTextCHAR(oEntry.nUnicode, xpsUnitToMM(dXorigin), xpsUnitToMM(dYorigin), 0, 0);
{
LONG nRenType = 0;
pRenderer->get_Type(&nRenType);
if (c_nGrRenderer == nRenType)
pRenderer->put_FontStringGID(FALSE);
pRenderer->CommandDrawTextCHAR(oEntry.nUnicode, xpsUnitToMM(dXorigin), xpsUnitToMM(dYorigin), 0, 0);
}
if (bNeedBold)
{

View File

@ -152,13 +152,13 @@ namespace XPS
}
bool CImageBrush::SetToRenderer(IRenderer* pRenderer)
{
std::wstring wsPath = m_wsRoot.c_str();
wsPath += m_wsPath.c_str();
std::wstring wsPath = m_wsRoot.c_stdstr();
wsPath += m_wsPath.c_stdstr();
if (!NSFile::CFileBinary::Exists(wsPath))
{
wsPath = m_wsPage.c_str();
wsPath += m_wsPath.c_str();
wsPath = m_wsPage.c_stdstr();
wsPath += m_wsPath.c_stdstr();
if (!NSFile::CFileBinary::Exists(wsPath))
return false;
}

View File

@ -186,6 +186,13 @@ namespace XPS
return (const wchar_t*)m_pBuffer;
}
const std::wstring CWString::c_stdstr() const
{
const wchar_t* pData = c_str();
if (NULL == pData)
return L"";
return std::wstring(pData);
}
bool CWString::operator<(const CWString& wsString) const
{
const wchar_t* wsLeft = this->c_str();

View File

@ -59,6 +59,7 @@ namespace XPS
bool empty() const;
wchar_t operator[](const unsigned int& unIndex) const;
const wchar_t* c_str() const;
const std::wstring c_stdstr() const;
void clear();
int tointeger() const;