mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
45 Commits
v4.2.0.260
...
win-v4.2.8
| Author | SHA1 | Date | |
|---|---|---|---|
| 0bd10c28ac | |||
| 765ca861fb | |||
| 95e32f00d0 | |||
| 61c632ce55 | |||
| a97518359a | |||
| 06dea5685a | |||
| eb29cee9ad | |||
| ef69fc4b34 | |||
| 6e3b7b1146 | |||
| f925e5cae9 | |||
| 80d95d41c5 | |||
| 13d57361e4 | |||
| e6c334199f | |||
| a639fc9eaf | |||
| 9cc54393a0 | |||
| 16386f4b5c | |||
| 149c0ae72a | |||
| 29b4a10435 | |||
| 1cf9401e0a | |||
| c6a05e493f | |||
| 82e82971d0 | |||
| 4b8c2b4f6d | |||
| a7e3158c06 | |||
| 329077caaf | |||
| b75495c4ba | |||
| 807eace056 | |||
| cfdc8c9051 | |||
| da18ecd89c | |||
| 7ae68b53db | |||
| 57bd7a0d93 | |||
| daba1ad2a3 | |||
| 755ea97af8 | |||
| 0f9669aa2b | |||
| 71aabb5f3f | |||
| 18a963231a | |||
| e3d6d370f7 | |||
| b06681bd97 | |||
| ab4412155d | |||
| 49939a7f19 | |||
| e690aa0c53 | |||
| bb4483fd7d | |||
| b93c7a2620 | |||
| f37394db00 | |||
| 42c94d5cd0 | |||
| 41b3c6fb16 |
@ -41,7 +41,7 @@
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller) : _skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL),
|
||||
_fldCharCounter(0), AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0),
|
||||
_endnoteNr(0), _commentNr(0), _caller(caller)
|
||||
{
|
||||
@ -53,6 +53,10 @@ namespace DocFileFormat
|
||||
_writeInstrText = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
|
||||
//--------------------------------------------
|
||||
_embeddedObject = false;
|
||||
_writeInstrText = false;
|
||||
}
|
||||
|
||||
DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false),
|
||||
@ -67,6 +71,7 @@ namespace DocFileFormat
|
||||
_writeInstrText = false;
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
_embeddedObject = false;
|
||||
}
|
||||
|
||||
DocumentMapping::~DocumentMapping()
|
||||
@ -643,13 +648,13 @@ namespace DocFileFormat
|
||||
}
|
||||
cpFieldSep1 = cpFieldSep2;
|
||||
}
|
||||
_skipRuns = 5;
|
||||
_skipRuns = 5; //with separator
|
||||
}
|
||||
}
|
||||
else if ( bEMBED || bLINK || bQUOTE)
|
||||
{
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
|
||||
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
|
||||
|
||||
if (cpPic < cpFieldEnd)
|
||||
{
|
||||
@ -731,14 +736,8 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
if (bEMBED)
|
||||
{
|
||||
//Приложения_011015.doc(9 стр) ellipt_eq.doc конфликтные
|
||||
cp = cpFieldEnd;
|
||||
_skipRuns = 3;
|
||||
}
|
||||
else
|
||||
_skipRuns = 5;
|
||||
_skipRuns = 3;
|
||||
_embeddedObject = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -759,6 +758,7 @@ namespace DocFileFormat
|
||||
|
||||
m_pXmlWriter->WriteString( elem.GetXMLString().c_str() );
|
||||
}
|
||||
if (_embeddedObject) _skipRuns += 2;
|
||||
}
|
||||
else if (TextMark::FieldEndMark == code)
|
||||
{
|
||||
@ -781,6 +781,7 @@ namespace DocFileFormat
|
||||
{
|
||||
_writeInstrText = false;
|
||||
}
|
||||
_embeddedObject = false;
|
||||
}
|
||||
else if ((TextMark::Symbol == code) && fSpec)
|
||||
{
|
||||
|
||||
@ -137,6 +137,7 @@ namespace DocFileFormat
|
||||
ParagraphPropertyExceptions* _lastValidPapx;
|
||||
SectionPropertyExceptions* _lastValidSepx;
|
||||
|
||||
bool _embeddedObject;
|
||||
int _skipRuns;
|
||||
int _sectionNr;
|
||||
int _footnoteNr;
|
||||
|
||||
@ -87,19 +87,19 @@ namespace DocFileFormat
|
||||
|
||||
case sprmOldTDefTable:
|
||||
case sprmTDefTable:
|
||||
{ //table definition
|
||||
|
||||
{
|
||||
//table definition
|
||||
SprmTDefTable tDef( iter->Arguments, iter->argumentsSize );
|
||||
//Workaround for retrieving the indent of the table:
|
||||
//In some files there is a indent but no sprmTWidthIndent is set.
|
||||
//For this cases we can calculate the indent of the table by getting the
|
||||
//first boundary of the TDef and adding the padding of the cells
|
||||
|
||||
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
|
||||
//add the gabHalf
|
||||
tblIndent += gabHalf;
|
||||
//If there follows a real sprmTWidthIndent, this value will be overwritten
|
||||
|
||||
tblIndent = (std::max)((int)tblIndent,0);
|
||||
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ namespace formulasconvert {
|
||||
bool odf2oox_converter::Impl::check_formula(std::wstring& expr)
|
||||
{
|
||||
boost::match_results<std::wstring::const_iterator> res;
|
||||
if (boost::regex_search(expr, res, boost::wregex(L"(?:[\\w]+:)?=(.+)"), boost::match_default))
|
||||
if (boost::regex_search(expr, res, boost::wregex(L"^(?:[\\w]+:)?=(.+)"), boost::match_default))
|
||||
{
|
||||
expr = res[1].str();
|
||||
while (expr.find(L"=") == 0)
|
||||
@ -431,6 +431,7 @@ namespace formulasconvert {
|
||||
if (isFormula)
|
||||
{
|
||||
boost::algorithm::replace_all(workstr, L"FDIST(", L"_xlfn.F.DIST(");
|
||||
// ROUNDUP( - тут в oox 2 параметра - разрядность нужно - ,0) - EV Requirements v2.2.3.ods
|
||||
|
||||
int res_find=0;
|
||||
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
|
||||
|
||||
@ -82,12 +82,13 @@ void text_tracked_context::start_changes_content()
|
||||
|
||||
void text_tracked_context::end_changes_content()
|
||||
{
|
||||
current_state_.content.push_back(changes_stream_.str());
|
||||
|
||||
docx_context_.set_delete_text_state (false);
|
||||
docx_context_.set_paragraph_state (bParaStateDocx_);
|
||||
docx_context_.set_run_state (bRunStateDocx_);
|
||||
docx_context_.set_delete_text_state (false);
|
||||
|
||||
current_state_.content = changes_stream_.str();
|
||||
docx_context_.set_stream_man(docx_stream_);
|
||||
docx_context_.set_stream_man (docx_stream_);
|
||||
}
|
||||
void text_tracked_context::start_change (std::wstring id)
|
||||
{
|
||||
@ -130,28 +131,27 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
|
||||
|
||||
docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfDocument) :
|
||||
mediaitems_ (OdfDocument->get_folder() ),
|
||||
next_dump_page_properties_(false),
|
||||
page_break_after_ (false),
|
||||
page_break_before_ (false),
|
||||
in_run_ (false),
|
||||
in_automatic_style_ (false),
|
||||
in_paragraph_ (false),
|
||||
in_header_ (false),
|
||||
in_drawing_content_ (false),
|
||||
text_tracked_context_ (*this),
|
||||
table_context_ (*this),
|
||||
output_document_ (NULL),
|
||||
section_properties_in_table_(NULL),
|
||||
process_note_ (noNote),
|
||||
new_list_style_number_ (0),
|
||||
is_rtl_ (false),
|
||||
is_paragraph_keep_ (false),
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_(false),
|
||||
process_comment_ (false),
|
||||
math_context_ (false),
|
||||
odf_document_ (OdfDocument)
|
||||
next_dump_page_properties_ (false),
|
||||
page_break_after_ (false),
|
||||
page_break_before_ (false),
|
||||
in_run_ (false),
|
||||
in_automatic_style_ (false),
|
||||
in_paragraph_ (false),
|
||||
in_header_ (false),
|
||||
in_drawing_content_ (false),
|
||||
text_tracked_context_ (*this),
|
||||
table_context_ (*this),
|
||||
output_document_ (NULL),
|
||||
process_note_ (noNote),
|
||||
new_list_style_number_ (0),
|
||||
is_rtl_ (false),
|
||||
is_paragraph_keep_ (false),
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
process_comment_ (false),
|
||||
math_context_ (false),
|
||||
odf_document_ (OdfDocument)
|
||||
{
|
||||
streams_man_ = streams_man::create(temp_stream_);
|
||||
applicationFonts_ = new CApplicationFonts();
|
||||
@ -1102,7 +1102,7 @@ void docx_conversion_context::docx_serialize_list_properties(std::wostream & str
|
||||
|
||||
void docx_conversion_context::add_delayed_element(odf_reader::office_element * Elm)
|
||||
{
|
||||
delayed_elements_.push_back(Elm);
|
||||
delayed_elements_.push_back(Elm);
|
||||
}
|
||||
|
||||
void docx_conversion_context::docx_convert_delayed()
|
||||
@ -1110,14 +1110,15 @@ void docx_conversion_context::docx_convert_delayed()
|
||||
if (delayed_elements_.empty()) return;
|
||||
|
||||
if(delayed_converting_)return; //зацикливание иначе
|
||||
if(get_drawing_context().get_current_level() > 0 )return; //вложенный frame
|
||||
if(get_drawing_context().get_current_level() > 0 )
|
||||
return; //вложенный frame
|
||||
|
||||
delayed_converting_ = true;
|
||||
while(!delayed_elements_.empty())
|
||||
{
|
||||
odf_reader::office_element * elm = delayed_elements_.front();
|
||||
elm->docx_convert(*this);
|
||||
delayed_elements_.pop_front();
|
||||
delayed_elements_.pop_front();
|
||||
}
|
||||
delayed_converting_=false;
|
||||
}
|
||||
@ -1128,19 +1129,6 @@ void section_context::add_section(const std::wstring & SectionName, const std::w
|
||||
sections_.push_back(newSec);
|
||||
}
|
||||
|
||||
|
||||
void docx_conversion_context::section_properties_in_table(odf_reader::office_element * Elm)
|
||||
{
|
||||
section_properties_in_table_ = Elm;
|
||||
}
|
||||
|
||||
odf_reader::office_element * docx_conversion_context::get_section_properties_in_table()
|
||||
{
|
||||
odf_reader::office_element * elm = section_properties_in_table_;
|
||||
section_properties_in_table_ = NULL;
|
||||
return elm;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// обработка Header/Footer
|
||||
@ -1273,31 +1261,47 @@ typedef std::map<std::wstring, text_tracked_context::_state>::iterator map_chang
|
||||
|
||||
void docx_conversion_context::start_text_changes (std::wstring id)
|
||||
{
|
||||
text_tracked_context::_state &state = text_tracked_context_.get_tracked_change(id);
|
||||
if (state.id != id) return;
|
||||
text_tracked_context::_state &state_add = text_tracked_context_.get_tracked_change(id);
|
||||
if (state_add.id != id) return;
|
||||
|
||||
map_current_changes_.insert(std::pair<std::wstring, text_tracked_context::_state> (id, state));
|
||||
map_current_changes_.insert(std::pair<std::wstring, text_tracked_context::_state> (id, state_add));
|
||||
|
||||
if (in_paragraph_ && (state.type == 1 || state.type == 2))
|
||||
if (in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
{
|
||||
finish_run();
|
||||
|
||||
if (state.type == 1) output_stream() << L"<w:ins";
|
||||
if (state.type == 2) output_stream() << L"<w:del";
|
||||
|
||||
output_stream() << L" w:date=\"" << state.date << L"\"";
|
||||
output_stream() << L" w:author=\"" << state.author << L"\"";
|
||||
output_stream() << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\"";
|
||||
output_stream() << L">";
|
||||
map_changes_iterator it = map_current_changes_.find(id);
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
if (state.type == 2)
|
||||
output_stream() << state.content;
|
||||
std::wstring format_change = L" w:date=\"" + state.date + L"\"" +
|
||||
L" w:author=\"" + state.author + L"\"" ;
|
||||
|
||||
finish_run();
|
||||
state.active = true;
|
||||
|
||||
if (state.type == 1)
|
||||
{
|
||||
|
||||
output_stream() << L"<w:ins" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
|
||||
}
|
||||
|
||||
if (state.type == 2)
|
||||
{
|
||||
for (int i = 0 ; i < state.content.size(); i++)
|
||||
{
|
||||
output_stream() << L"<w:del" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
|
||||
|
||||
output_stream() << state.content[i];
|
||||
|
||||
output_stream() << L"</w:del>";
|
||||
}
|
||||
map_current_changes_.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void docx_conversion_context::start_changes()
|
||||
{
|
||||
if (map_current_changes_.empty()) return;
|
||||
if (process_comment_) return;
|
||||
|
||||
text_tracked_context_.dumpPPr_.clear();
|
||||
text_tracked_context_.dumpRPr_.clear();
|
||||
@ -1309,8 +1313,8 @@ void docx_conversion_context::start_changes()
|
||||
{
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
if (state.type == 0) continue; //unknown change ... todooo
|
||||
|
||||
if (state.type == 0) continue; //unknown change ... todooo
|
||||
if (state.active) continue;
|
||||
|
||||
std::wstring change_attr;
|
||||
change_attr += L" w:date=\"" + state.date + L"\"";
|
||||
@ -1396,16 +1400,21 @@ void docx_conversion_context::start_changes()
|
||||
|
||||
void docx_conversion_context::end_changes()
|
||||
{
|
||||
//for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
|
||||
//{
|
||||
// text_tracked_context::_state &state = it->second;
|
||||
if (process_comment_) return;
|
||||
|
||||
// if (state.type == 0) continue; //unknown change ... libra format change skip
|
||||
// if (state.type == 3) continue;
|
||||
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
|
||||
{
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
// if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
// if (state.type == 2) output_stream() << L"</w:del>";
|
||||
//}
|
||||
if (state.type == 0) continue; //unknown change ... libra format change skip
|
||||
if (state.type == 3) continue;
|
||||
if (!state.active) continue;
|
||||
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
if (state.type == 2) output_stream() << L"</w:del>";
|
||||
|
||||
state.active = false;
|
||||
}
|
||||
|
||||
text_tracked_context_.dumpTcPr_.clear();
|
||||
text_tracked_context_.dumpTblPr_.clear();
|
||||
@ -1421,14 +1430,15 @@ void docx_conversion_context::end_text_changes (std::wstring id)
|
||||
|
||||
if (it == map_current_changes_.end()) return;
|
||||
|
||||
if (in_paragraph_)
|
||||
text_tracked_context::_state &state = it->second;
|
||||
|
||||
if (state.active)
|
||||
{
|
||||
finish_run();
|
||||
|
||||
text_tracked_context::_state &state = it->second;
|
||||
if (in_paragraph_)
|
||||
finish_run();
|
||||
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
if (state.type == 2) output_stream() << L"</w:del>";
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
if (state.type == 2) output_stream() << L"</w:del>";
|
||||
}
|
||||
|
||||
map_current_changes_.erase(it);
|
||||
|
||||
@ -490,13 +490,14 @@ class text_tracked_context
|
||||
public:
|
||||
struct _state
|
||||
{
|
||||
std::wstring id;
|
||||
std::wstring author;
|
||||
std::wstring date;
|
||||
int type;
|
||||
std::wstring content; //delete elements
|
||||
std::wstring style_name;
|
||||
|
||||
std::wstring id;
|
||||
std::wstring author;
|
||||
std::wstring date;
|
||||
int type;
|
||||
std::wstring style_name;
|
||||
std::vector<std::wstring> content; //delete elements
|
||||
bool active;
|
||||
|
||||
void clear()
|
||||
{
|
||||
type = 0;
|
||||
@ -504,6 +505,7 @@ public:
|
||||
author.clear();
|
||||
date.clear();
|
||||
content.clear();
|
||||
active = false;
|
||||
}
|
||||
};
|
||||
std::wstring dumpPPr_;
|
||||
@ -683,9 +685,6 @@ public:
|
||||
|
||||
docx_table_context & get_table_context() { return table_context_; }
|
||||
|
||||
odf_reader::office_element * get_section_properties_in_table();
|
||||
void section_properties_in_table (odf_reader::office_element * Elm);
|
||||
|
||||
StreamsManPtr get_stream_man() const { return streams_man_; }
|
||||
void set_stream_man(StreamsManPtr Sm) { streams_man_ = Sm; }
|
||||
|
||||
@ -752,23 +751,23 @@ private:
|
||||
odf_reader::odf_document * odf_document_;
|
||||
CApplicationFonts * applicationFonts_;
|
||||
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
std::vector<odf_reader::_property> settings_properties_;
|
||||
|
||||
hyperlinks hyperlinks_;
|
||||
mediaitems mediaitems_;
|
||||
hyperlinks hyperlinks_;
|
||||
mediaitems mediaitems_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
headers_footers headers_footers_;
|
||||
|
||||
std::wstring automatic_parent_style_;
|
||||
|
||||
std::list< const odf_reader::style_text_properties * > text_properties_stack_;
|
||||
std::wstring automatic_parent_style_;
|
||||
std::wstring current_master_page_name_;
|
||||
std::wstring text_list_style_name_;
|
||||
std::list<std::wstring> list_style_stack_;
|
||||
bool first_element_list_item_;
|
||||
|
||||
bool page_break_after_;
|
||||
bool page_break_before_;
|
||||
bool page_break_;
|
||||
|
||||
std::wstring text_list_style_name_;
|
||||
std::list<std::wstring> list_style_stack_;
|
||||
bool first_element_list_item_;
|
||||
|
||||
|
||||
bool in_automatic_style_;
|
||||
bool in_drawing_content_;
|
||||
bool in_paragraph_;
|
||||
@ -777,25 +776,14 @@ private:
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
bool is_paragraph_keep_;
|
||||
|
||||
NoteType process_note_;
|
||||
|
||||
|
||||
int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
NoteType process_note_;
|
||||
std::list<odf_reader::office_element *> delayed_elements_;
|
||||
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
|
||||
odf_reader::office_element * section_properties_in_table_;
|
||||
|
||||
headers_footers headers_footers_;
|
||||
std::wstring current_master_page_name_;
|
||||
|
||||
// счетчик для нумерации имен созданных в процессе конвертации стилей
|
||||
int new_list_style_number_;
|
||||
|
||||
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
|
||||
|
||||
// цепочки переименований нумераций
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;
|
||||
std::list< const odf_reader::style_text_properties * > text_properties_stack_;
|
||||
std::map<std::wstring, text_tracked_context::_state> map_current_changes_;
|
||||
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;// цепочки переименований нумераций
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -435,11 +435,12 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
|
||||
CP_XML_ATTR(L"y",0);
|
||||
}
|
||||
|
||||
|
||||
CP_XML_NODE(L"wp:positionH")
|
||||
{
|
||||
std::wstring relativeFrom = L"margin";
|
||||
if (val.styleHorizontalRel) relativeFrom =val.styleHorizontalRel->get_type_str();
|
||||
|
||||
if (relativeFrom == L"column") relativeFrom = L"margin";
|
||||
|
||||
CP_XML_ATTR(L"relativeFrom", relativeFrom);
|
||||
|
||||
@ -453,15 +454,14 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"wp:posOffset") {CP_XML_STREAM() << val.posOffsetH;}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"wp:positionV")
|
||||
{
|
||||
|
||||
std::wstring relativeFrom = L"paragraph";
|
||||
if (val.styleVerticalRel)relativeFrom = val.styleVerticalRel->get_type_str();
|
||||
|
||||
CP_XML_ATTR(L"relativeFrom",relativeFrom);
|
||||
|
||||
if (val.styleVerticalPos &&
|
||||
@ -481,7 +481,6 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"wp:extent")
|
||||
{
|
||||
CP_XML_ATTR(L"cx",val.cx);
|
||||
@ -492,6 +491,37 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
|
||||
}
|
||||
|
||||
docx_serialize_common(CP_XML_STREAM(), val);
|
||||
|
||||
if (val.pctWidth)
|
||||
{
|
||||
std::wstring relativeFrom = L"margin";
|
||||
if (val.styleHorizontalRel) relativeFrom =val.styleHorizontalRel->get_type_str();
|
||||
|
||||
if (relativeFrom == L"column") relativeFrom = L"margin";
|
||||
|
||||
CP_XML_NODE(L"wp14:sizeRelH")
|
||||
{
|
||||
CP_XML_ATTR(L"relativeFrom", relativeFrom);
|
||||
CP_XML_NODE(L"wp14:pctWidth")
|
||||
{
|
||||
CP_XML_STREAM() << (val.pctWidth.get() * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.pctHeight)
|
||||
{
|
||||
std::wstring relativeFrom = L"paragraph";
|
||||
if (val.styleVerticalRel)relativeFrom = val.styleVerticalRel->get_type_str();
|
||||
|
||||
CP_XML_NODE(L"wp14:sizeRelV")
|
||||
{
|
||||
CP_XML_ATTR(L"relativeFrom", relativeFrom);
|
||||
CP_XML_NODE(L"wp14:pctHeight")
|
||||
{
|
||||
CP_XML_STREAM() << (val.pctHeight.get() * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,17 +49,18 @@ struct _docx_drawing : _oox_drawing
|
||||
_docx_drawing():_oox_drawing(), parallel(0), isInline(false), number_wrapped_paragraphs(0), posOffsetV(0), posOffsetH(0)
|
||||
{
|
||||
}
|
||||
unsigned int parallel;
|
||||
bool isInline;
|
||||
|
||||
unsigned int parallel;
|
||||
|
||||
//_CP_OPT(run_through) styleRunThrough ;
|
||||
//_CP_OPT(run_through) styleRunThrough ;
|
||||
_CP_OPT(odf_types::horizontal_rel) styleHorizontalRel;
|
||||
_CP_OPT(odf_types::horizontal_pos) styleHorizontalPos;
|
||||
_CP_OPT(odf_types::vertical_pos) styleVerticalPos;
|
||||
_CP_OPT(odf_types::vertical_rel) styleVerticalRel;
|
||||
|
||||
_CP_OPT(odf_types::style_wrap) styleWrap;
|
||||
_CP_OPT(odf_types::style_wrap) styleWrap;
|
||||
|
||||
bool isInline;
|
||||
int number_wrapped_paragraphs;
|
||||
|
||||
std::wstring relativeHeight;
|
||||
@ -67,6 +68,9 @@ struct _docx_drawing : _oox_drawing
|
||||
|
||||
int posOffsetV;
|
||||
int posOffsetH;
|
||||
|
||||
_CP_OPT(int) pctWidth;
|
||||
_CP_OPT(int) pctHeight;
|
||||
|
||||
int margin_rect[4];//0-left, 1 -top, 2- right, 3 - bottom
|
||||
//std::wstring distB;
|
||||
|
||||
@ -61,18 +61,21 @@ static void ConvertSvmToImage(std::wstring &file_svm, std::wstring &file_png, CA
|
||||
|
||||
static std::wstring get_mime_type(const std::wstring & extension)
|
||||
{
|
||||
if (L"eps" == extension) return L"image/x-eps";
|
||||
if (L"wmf" == extension) return L"image/x-wmf";
|
||||
if (L"emf" == extension) return L"image/x-emf";
|
||||
if (L"gif" == extension) return L"image/x-gif";
|
||||
if (L"png" == extension) return L"image/x-png";
|
||||
if (L"jpg" == extension) return L"image/x-jpeg";
|
||||
if (L"jpeg" == extension) return L"image/x-jpeg";
|
||||
if (L"tiff" == extension) return L"image/x-tiff";
|
||||
if (L"pdf" == extension) return L"application/pdf";
|
||||
if (L"wav" == extension) return L"audio/wav";
|
||||
if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
if (L"eps" == extension) return L"image/x-eps";
|
||||
else if (L"wmf" == extension) return L"image/x-wmf";
|
||||
else if (L"emf" == extension) return L"image/x-emf";
|
||||
else if (L"gif" == extension) return L"image/x-gif";
|
||||
else if (L"png" == extension) return L"image/x-png";
|
||||
else if (L"jpg" == extension) return L"image/x-jpeg";
|
||||
else if (L"jpeg" == extension) return L"image/x-jpeg";
|
||||
else if (L"tif" == extension) return L"image/x-tiff";
|
||||
else if (L"tiff" == extension) return L"image/x-tiff";
|
||||
else if (L"pdf" == extension) return L"application/pdf";
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
else return L"application/octet-stream";
|
||||
|
||||
|
||||
return L"";
|
||||
}
|
||||
|
||||
@ -89,11 +89,14 @@ void pptx_xml_slide::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:sld")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_ATTR(L"name", name());
|
||||
|
||||
@ -147,15 +150,19 @@ void pptx_xml_slideLayout::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:sldLayout")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
//if (slideLayoutData_.str().length()<0)
|
||||
// CP_XML_ATTR(L"type",L"cust");//---------------------------!!!!!!!!!!!!
|
||||
//else
|
||||
// CP_XML_ATTR(L"type",L"cust");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
// CP_XML_ATTR(L"type",L"cust");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
CP_XML_NODE(L"p:spTree")
|
||||
{
|
||||
@ -239,9 +246,12 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"p:sldMaster")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
CP_XML_NODE(L"p:cSld")
|
||||
{
|
||||
|
||||
@ -363,19 +363,20 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
|
||||
odf_reader::paragraph_format_properties paragraph_properties_;
|
||||
|
||||
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph);
|
||||
ApplyListProperties (paragraph_properties_,level);//выравнивания листа накатим на свойства параграфа
|
||||
ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа
|
||||
|
||||
paragraph_properties_.pptx_convert(pptx_context_);
|
||||
|
||||
const std::wstring & paragraphAttr = get_styles_context().paragraph_attr().str();
|
||||
const std::wstring & paragraphNodes = get_styles_context().paragraph_nodes().str();
|
||||
|
||||
if (level < 0 && paragraphAttr.length() <1 && paragraphNodes.length()<1) return;
|
||||
if (level < 0 && paragraphAttr.length() < 1 && !paragraphNodes.empty()) return;
|
||||
|
||||
strm << L"<a:pPr ";
|
||||
|
||||
if (level>=0)
|
||||
if (level >= 0)
|
||||
{
|
||||
if (level > 8) level = 0;
|
||||
strm << L"lvl=\"" << level << L"\" ";
|
||||
}
|
||||
|
||||
@ -384,7 +385,7 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
|
||||
strm << ">";
|
||||
strm << paragraphNodes;
|
||||
|
||||
if (level >=0 )
|
||||
if (level >= 0 )
|
||||
{
|
||||
|
||||
|
||||
@ -399,9 +400,10 @@ void pptx_text_context::Impl::write_t(std::wostream & strm)
|
||||
|
||||
void pptx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
{
|
||||
if (paragraph_style_name_.length()<1 && span_style_name_.length()<1 && !(hyperlink_hId.length()>0) && base_style_name_.length()<1)return;
|
||||
if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty())
|
||||
return;
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_paragraph_;
|
||||
odf_reader::text_format_properties_content text_properties_paragraph_;
|
||||
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf_types::style_family::Paragraph);
|
||||
|
||||
odf_reader::text_format_properties_content text_properties_span_;
|
||||
@ -415,6 +417,7 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
|
||||
get_styles_context().start();
|
||||
|
||||
get_styles_context().hlinkClick() = hyperlink_hId;
|
||||
|
||||
text_properties_.pptx_convert(pptx_context_);
|
||||
|
||||
strm << get_styles_context().text_style().str();
|
||||
|
||||
@ -34,10 +34,10 @@
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
#include <vector>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -84,6 +84,7 @@ namespace oox {
|
||||
_CP_OPT(std::wstring) formula_type;
|
||||
_CP_OPT(std::wstring) text;
|
||||
_CP_OPT(std::wstring) formula2;
|
||||
_CP_OPT(int) rank;
|
||||
//color scale icon set data_bar
|
||||
std::vector<_cfvo> cfvo;
|
||||
//color scale data_bar(1 element)
|
||||
@ -138,7 +139,8 @@ public:
|
||||
if (c.rules[j].operator_) CP_XML_ATTR(L"operator", *c.rules[j].operator_);
|
||||
if (c.rules[j].stopIfTrue) CP_XML_ATTR(L"stopIfTrue", *c.rules[j].stopIfTrue);
|
||||
if (c.rules[j].text) CP_XML_ATTR(L"text", *c.rules[j].text);
|
||||
//CP_XML_ATTR(L"rank" , 0);
|
||||
if (c.rules[j].rank) CP_XML_ATTR(L"rank", *c.rules[j].rank);
|
||||
|
||||
//CP_XML_ATTR(L"bottom" , 0);
|
||||
//CP_XML_ATTR(L"equalAverage" , 0);
|
||||
//CP_XML_ATTR(L"aboveAverage" , 0);
|
||||
@ -271,12 +273,36 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"is-between(")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"is-time(")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"duplicate")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"top")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
|
||||
if (0 < (pos = f.find(L"percent")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().percent = true;
|
||||
}
|
||||
if (0 <= (pos = f.find(L"(")))
|
||||
{
|
||||
val = f.substr(pos + 1, f.length() - pos - 2);
|
||||
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
|
||||
}
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
impl_->conditionalFormattings_.back().rules.back().text = f.substr(15, f.length() - 17);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"cellIs";
|
||||
@ -293,11 +319,6 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
{
|
||||
val = converter.convert_named_expr( f );
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"top")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
|
||||
val = converter.convert_named_expr( f );
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"!=")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"notEqual";
|
||||
@ -328,12 +349,6 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"greaterThan";
|
||||
val = converter.convert_named_expr( f.substr(1) );
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"contains-text")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
|
||||
impl_->conditionalFormattings_.back().rules.back().text = f.substr(15, f.length() - 17);
|
||||
val.clear();
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"between")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().operator_ = L"between";
|
||||
@ -353,8 +368,7 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
|
||||
if (!val.empty())
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = val;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void xlsx_conditionalFormatting_context::set_dataBar(_CP_OPT(int) min, _CP_OPT(int) max)
|
||||
{
|
||||
|
||||
@ -223,7 +223,7 @@ public:
|
||||
const std::pair<int, double> c = cols_.search (x_pt);
|
||||
const std::pair<int, double> r = rows_.search (y_pt);
|
||||
|
||||
xlsx_table_position res = {c.first, c.second, r.first, r.second};
|
||||
xlsx_table_position res = {(size_t)c.first, c.second, (size_t)r.first, r.second};
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ public:
|
||||
|
||||
r = rows_.search(offset_row, y_pt);
|
||||
|
||||
xlsx_table_position res = {c.first, c.second, r.first, r.second};
|
||||
xlsx_table_position res = {(size_t)c.first, c.second, (size_t)r.first, r.second};
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -246,7 +246,7 @@ public:
|
||||
std::pair<int, double> r = rows_.search (last_row, 0);
|
||||
|
||||
|
||||
xlsx_table_position res = {c.first, c.second, r.first, r.second};
|
||||
xlsx_table_position res = {(size_t)c.first, c.second, (size_t)r.first, r.second};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -119,6 +119,7 @@ private:
|
||||
std::wstringstream paragraph_; //перманенто скидываемые параграфы
|
||||
std::wstringstream run_; //перманенто скидываемые куски с быть может разными свойствами
|
||||
|
||||
std::wstring store_cell_string_;
|
||||
xlsx_shared_strings xlsx_shared_strings_;
|
||||
|
||||
std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится
|
||||
@ -427,12 +428,12 @@ std::wstring xlsx_text_context::Impl::dump_paragraph(/*bool last*/)
|
||||
std::wstring xlsx_text_context::Impl::dump_run()
|
||||
{
|
||||
const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
|
||||
|
||||
if (content.length()<1)
|
||||
|
||||
if (content.empty())
|
||||
return L"";
|
||||
|
||||
std::wstring prefix_draw;
|
||||
if (in_draw) prefix_draw=L"a:";
|
||||
if (in_draw) prefix_draw = L"a:";
|
||||
|
||||
CP_XML_WRITER(run_)
|
||||
{
|
||||
@ -445,6 +446,7 @@ std::wstring xlsx_text_context::Impl::dump_run()
|
||||
CP_XML_NODE(prefix_draw + L"t")
|
||||
{
|
||||
if (!in_draw)CP_XML_ATTR(L"xml:space", L"preserve");
|
||||
|
||||
CP_XML_STREAM() << content;
|
||||
}
|
||||
}
|
||||
@ -452,19 +454,21 @@ std::wstring xlsx_text_context::Impl::dump_run()
|
||||
}
|
||||
}
|
||||
|
||||
hyperlink_hId =L"";
|
||||
return content;
|
||||
}
|
||||
|
||||
void xlsx_text_context::Impl::start_cell_content()
|
||||
{
|
||||
paragraphs_cout_ = 0;
|
||||
local_styles_ptr_ =NULL;
|
||||
paragraphs_cout_ = 0;
|
||||
local_styles_ptr_ = NULL;
|
||||
|
||||
run_.str(std::wstring());
|
||||
paragraph_.str(std::wstring());
|
||||
text_.str(std::wstring());
|
||||
|
||||
|
||||
store_cell_string_.clear();
|
||||
hyperlink_hId.clear();
|
||||
|
||||
paragraph_style_name_ = L"";
|
||||
span_style_name_ = L"";
|
||||
|
||||
@ -488,6 +492,13 @@ void xlsx_text_context::Impl::start_comment_content()
|
||||
}
|
||||
void xlsx_text_context::Impl::start_drawing_content()
|
||||
{
|
||||
if (in_cell_content)
|
||||
{
|
||||
dump_run();
|
||||
|
||||
store_cell_string_ = run_.str();
|
||||
}
|
||||
|
||||
paragraphs_cout_ = 0;
|
||||
|
||||
run_.str(std::wstring());
|
||||
@ -539,9 +550,12 @@ int xlsx_text_context::Impl::end_cell_content()
|
||||
{
|
||||
dump_run();
|
||||
|
||||
const int sharedStrId = run_.str().empty() ? (-1) : static_cast<int>(xlsx_shared_strings_.add(run_.str()));
|
||||
//???? нужно ли здесь очищать все ????? - проверить стили на кучках - и проверить как меняются стили внутри одной ячейки - то есть здешнее переопределение внешнего стиля
|
||||
in_cell_content = false;
|
||||
std::wstring cell_string = store_cell_string_ + run_.str();
|
||||
store_cell_string_.clear();
|
||||
|
||||
in_cell_content = false;
|
||||
|
||||
const int sharedStrId = cell_string.empty() ? (-1) : xlsx_shared_strings_.add(cell_string);
|
||||
return sharedStrId;
|
||||
}
|
||||
|
||||
|
||||
@ -533,8 +533,9 @@ void common_draw_rel_size_attlist::apply_from(const common_draw_rel_size_attlist
|
||||
void common_draw_rel_size_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
common_draw_size_attlist_.serialize(CP_GET_XML_NODE());
|
||||
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
|
||||
CP_XML_ATTR_OPT(L"style:rel-height", style_rel_height_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
|
||||
CP_XML_ATTR_OPT(L"style:rel-height", style_rel_height_);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -443,10 +443,10 @@ public:
|
||||
void apply_from(const common_draw_rel_size_attlist & Other);
|
||||
void serialize(CP_ATTR_NODE);
|
||||
|
||||
public:
|
||||
common_draw_size_attlist common_draw_size_attlist_;
|
||||
_CP_OPT(percent_or_scale) style_rel_width_;
|
||||
_CP_OPT(percent_or_scale) style_rel_height_;
|
||||
|
||||
common_draw_size_attlist common_draw_size_attlist_;
|
||||
_CP_OPT(percent_or_scale) style_rel_width_;
|
||||
_CP_OPT(percent_or_scale) style_rel_height_;
|
||||
};
|
||||
|
||||
/// common-vertical-rel-attlist
|
||||
|
||||
@ -185,6 +185,7 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"mso-spt179" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt180" ,L"" ,0 ,0 ,0 },
|
||||
{L"mso-spt182" ,L"leftRightUpArrow" ,0 ,0 ,0 },
|
||||
{L"mso-spt188" ,L"flowChartPunchedTape",0 ,0 ,0 },
|
||||
{L"mso-spt189" ,L"actionButtonBlank" ,0 ,0 ,0 },
|
||||
{L"mso-spt190" ,L"actionButtonHome" ,0 ,0 ,0 },
|
||||
{L"mso-spt191" ,L"actionButtonHelp" ,0 ,0 ,0 },
|
||||
@ -220,8 +221,11 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
|
||||
{L"concave-star6" ,L"" ,0 ,0 ,0 },
|
||||
{L"signet" ,L"" ,0 ,0 ,0 },
|
||||
{L"doorplate" ,L"" ,0 ,0 ,0 },
|
||||
{L"" ,L"round1Rect" ,0 ,0 ,0 },
|
||||
|
||||
{L"" ,L"round1Rect" ,0 ,0 ,0 },
|
||||
{L"" ,L"round2DiagRect" ,0 ,0 ,0 },
|
||||
{L"" ,L"snip2DiagRect" ,0 ,0 ,0 },
|
||||
{L"" ,L"round2SameRect" ,0 ,0 ,0 },
|
||||
{L"" ,L"mathPlus" ,0 ,0 ,0 },
|
||||
{L"" ,L"mathMinus" ,0 ,0 ,0 },
|
||||
{L"" ,L"mathMultiply" ,0 ,0 ,0 },
|
||||
@ -281,7 +285,7 @@ static const _shape_converter _OO_OOX_wordart[]=
|
||||
{L"fontwork-triangle-up" ,L"textTriangle" ,0 ,0 ,0 },
|
||||
{L"fontwork-triangle-down" ,L"textTriangleInverted" ,0 ,0 ,0 },
|
||||
|
||||
{L"fontwork-circle-pour" ,L"textCirclePour" ,0 ,0 ,0 },
|
||||
{L"fontwork-circle-pour" ,L"textCirclePour" ,0 ,0 ,0 },
|
||||
{L"fontwork-circle-curve" ,L"textCircle" ,0 ,0 ,0 },
|
||||
{L"fontwork-open-circle-curve" ,L"textPlain" ,1 ,30000 , 70000 },
|
||||
{L"fontwork-open-circle-pour" ,L"textPlain" ,1 ,30000 , 70000 },
|
||||
@ -293,18 +297,18 @@ static const _shape_converter _OO_OOX_wordart[]=
|
||||
|
||||
{L"mso-spt142" ,L"textRingInside" ,0 ,0 ,0 },
|
||||
{L"mso-spt143" ,L"textRingOutside" ,0 ,0 ,0 },
|
||||
{L"mso-spt157" ,L"textWave2" ,0 ,0 ,0 },
|
||||
{L"mso-spt157" ,L"textWave2" ,0 ,0 ,0 },
|
||||
{L"mso-spt158" ,L"textDoubleWave1" ,0 ,0 ,0 },
|
||||
{L"mso-spt159" ,L"textWave4" ,0 ,0 ,0 },
|
||||
{L"mso-spt160" ,L"textInflate" ,0 ,0 ,0 },//???
|
||||
{L"mso-spt161" ,L"textDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt159" ,L"textWave4" ,0 ,0 ,0 },
|
||||
{L"mso-spt160" ,L"textInflate" ,0 ,0 ,0 },//???
|
||||
{L"mso-spt161" ,L"textDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt162" ,L"textInflateBottom" ,0 ,0 ,0 },
|
||||
{L"mso-spt163" ,L"textDeflateBottom" ,0 ,0 ,0 },
|
||||
{L"mso-spt164" ,L"textInflateTop" ,0 ,0 ,0 },
|
||||
{L"mso-spt165" ,L"textDeflateTop" ,0 ,0 ,0 },
|
||||
{L"mso-spt166" ,L"textDeflateInflateDeflate" ,0 ,0 ,0 },
|
||||
{L"mso-spt174" ,L"textCanUp" ,0 ,0 ,0 },
|
||||
{L"mso-spt175" ,L"textCanDown" ,0 ,0 ,0 },
|
||||
{L"mso-spt174" ,L"textCanUp" ,0 ,0 ,0 },
|
||||
{L"mso-spt175" ,L"textCanDown" ,0 ,0 ,0 },
|
||||
{L"mso-spt188" ,L"textDoubleWave1" ,0 ,0 ,0 },
|
||||
|
||||
};
|
||||
@ -31,12 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "length.h"
|
||||
#include "../../../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace cpdoccore { namespace odf_types {
|
||||
|
||||
std::wostream & operator << (std::wostream & _Wostream, const length::unit _Unit)
|
||||
@ -223,9 +222,9 @@ double to_pt(const length & Val)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
int pt_to_emu(double Val)
|
||||
_INT64 pt_to_emu(double Val)
|
||||
{
|
||||
return static_cast<int>(Val * 360000 * 2.54) / 72;
|
||||
return static_cast<_INT64>(Val * 360000 * 2.54) / 72;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -855,7 +855,6 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
|
||||
drawing. behindDoc = L"1";
|
||||
}
|
||||
|
||||
|
||||
drawing.margin_rect[0] = GetMargin(graphicProperties, sideLeft);
|
||||
drawing.margin_rect[1] = GetMargin(graphicProperties, sideTop);
|
||||
drawing.margin_rect[2] = GetMargin(graphicProperties, sideRight);
|
||||
@ -864,6 +863,21 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
|
||||
drawing.posOffsetH = ComputeMarginX(pagePropertiesNode, pageProperties, attlists_, graphicProperties, drawing.additional);
|
||||
drawing.posOffsetV = ComputeMarginY( pageProperties, attlists_, graphicProperties, drawing.additional);
|
||||
|
||||
if (attlists_.rel_size_.style_rel_width_)
|
||||
{
|
||||
int type = attlists_.rel_size_.style_rel_width_->get_type();
|
||||
|
||||
if (type == odf_types::percent_or_scale::Percent)
|
||||
drawing.pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
|
||||
}
|
||||
if (attlists_.rel_size_.style_rel_height_ )
|
||||
{
|
||||
int type = attlists_.rel_size_.style_rel_height_->get_type();
|
||||
|
||||
if (type == odf_types::percent_or_scale::Percent)
|
||||
drawing.pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
|
||||
}
|
||||
|
||||
}
|
||||
drawing.number_wrapped_paragraphs=graphicProperties.style_number_wrapped_paragraphs_.
|
||||
get_value_or( integer_or_nolimit( integer_or_nolimit::NoLimit) ).get_value();
|
||||
@ -998,7 +1012,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
|
||||
}
|
||||
void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
/////...../////
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
oox::_docx_drawing drawing = oox::_docx_drawing();
|
||||
|
||||
@ -1016,10 +1030,17 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
|
||||
Context.get_drawing_context().clear_stream_shape();
|
||||
|
||||
/////////
|
||||
common_draw_docx_convert(Context, common_draw_attlists_, drawing);
|
||||
/////////
|
||||
|
||||
if (bad_shape_ && drawing.fill.bitmap) // CV_Kucheruk_Maria(rus).odt - картинка по дебильному
|
||||
{
|
||||
drawing.sub_type = 1;
|
||||
bad_shape_ = false;
|
||||
}
|
||||
|
||||
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional,L"stroke"))//бывает что и не определено ничего
|
||||
{
|
||||
drawing.fill.solid = oox::oox_solid_fill::create();
|
||||
@ -1027,6 +1048,12 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
drawing.fill.type = 1;
|
||||
}
|
||||
|
||||
if (bad_shape_)
|
||||
{
|
||||
Context.get_drawing_context().stop_shape();
|
||||
return;
|
||||
}
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool pState = Context.get_paragraph_state();
|
||||
@ -1170,13 +1197,6 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
// if (Context.get_drawing_context().get_current_level() > 1 )
|
||||
//{
|
||||
// if(Context.delayed_converting_ == false)
|
||||
// Context.add_delayed_element(Context.get_drawing_context().get_current_frame());
|
||||
// return;
|
||||
//}
|
||||
|
||||
//тут может быть не только текст , но и таблицы, другие объекты ...
|
||||
oox::StreamsManPtr prev = Context.get_stream_man();
|
||||
|
||||
@ -1185,11 +1205,11 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool keepState = Context.get_paragraph_keep ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
Context.set_drawing_state_content(true);
|
||||
@ -1205,6 +1225,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
/////...../////
|
||||
|
||||
@ -1229,6 +1250,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
//+ локальные
|
||||
|
||||
bool auto_fit_text = false;
|
||||
bool auto_fit_shape = false;
|
||||
|
||||
if (!draw_text_box_attlist_.fo_min_height_) draw_text_box_attlist_.fo_min_height_ = frame->draw_frame_attlist_.fo_min_height_;
|
||||
if (!draw_text_box_attlist_.fo_min_width_) draw_text_box_attlist_.fo_min_width_ = frame->draw_frame_attlist_.fo_min_width_;
|
||||
@ -1238,19 +1260,25 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
size_t min_y = get_value_emu(draw_text_box_attlist_.fo_min_height_->get_length());
|
||||
if (drawing.cy < min_y)
|
||||
{
|
||||
drawing.cy = min_y;
|
||||
auto_fit_text = true;
|
||||
drawing.cy = min_y;
|
||||
}
|
||||
if (drawing.cy < 36000) auto_fit_shape = true;
|
||||
}
|
||||
|
||||
|
||||
if ((draw_text_box_attlist_.fo_min_width_) && (draw_text_box_attlist_.fo_min_width_->get_type()==length_or_percent::Length))
|
||||
{
|
||||
size_t min_x = get_value_emu(draw_text_box_attlist_.fo_min_width_->get_length());
|
||||
if (drawing.cx < min_x)
|
||||
{
|
||||
drawing.cx = min_x;
|
||||
auto_fit_text = true;
|
||||
drawing.cx = min_x;
|
||||
}
|
||||
if (drawing.cx < 36000) auto_fit_shape = true;
|
||||
}
|
||||
|
||||
|
||||
if ((draw_text_box_attlist_.fo_max_height_) && (draw_text_box_attlist_.fo_max_height_->get_type()==length_or_percent::Length))
|
||||
{
|
||||
size_t max_y = get_value_emu(draw_text_box_attlist_.fo_max_height_->get_length());
|
||||
@ -1261,9 +1289,15 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
size_t max_x = get_value_emu(draw_text_box_attlist_.fo_max_width_->get_length());
|
||||
if (drawing.cx > max_x) drawing.cy = max_x;
|
||||
}
|
||||
if (auto_fit_text)
|
||||
if (auto_fit_shape)
|
||||
{
|
||||
drawing.additional.push_back(_property(L"text-wrap" , 0));
|
||||
drawing.additional.push_back(_property(L"auto-grow-height", auto_fit_shape));
|
||||
}
|
||||
else if (auto_fit_text)
|
||||
drawing.additional.push_back(_property(L"fit-to-size", auto_fit_text));
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
@ -1277,6 +1311,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_paragraph_keep(true);
|
||||
pState = Context.get_paragraph_state();
|
||||
}
|
||||
keepState = Context.get_paragraph_keep();
|
||||
|
||||
Context.set_paragraph_state(false);
|
||||
|
||||
@ -1288,7 +1323,8 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (!Context.get_drawing_context().in_group())
|
||||
Context.finish_run();
|
||||
|
||||
Context.set_paragraph_state(pState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
}
|
||||
void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1406,7 +1442,6 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
//if ((!Context.get_paragraph_state() && !Context.get_drawing_context().in_group()) && !Context.delayed_converting_)
|
||||
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() )
|
||||
{
|
||||
Context.add_delayed_element(this);
|
||||
|
||||
@ -109,8 +109,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
double x_pt = common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
double y_pt = common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
|
||||
if (x_pt <0) x_pt =0;
|
||||
if (y_pt <0) y_pt =0;
|
||||
if (x_pt < 0) x_pt =0;
|
||||
if (y_pt < 0) y_pt =0;
|
||||
|
||||
Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt);
|
||||
}
|
||||
|
||||
@ -467,8 +467,6 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
void draw_enhanced_geometry::find_draw_type_oox()
|
||||
{
|
||||
word_art_ = false;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_text_path_ &&
|
||||
*draw_enhanced_geometry_attlist_.draw_text_path_ == true)
|
||||
{
|
||||
@ -489,12 +487,13 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
{
|
||||
if (_OO_OOX_wordart[i].odf_reader == odf_type)
|
||||
{
|
||||
word_art_ = true;
|
||||
draw_type_oox_index_ = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!draw_type_oox_index_)
|
||||
{
|
||||
int count = sizeof(_OO_OOX_custom_shapes) / sizeof(_shape_converter);
|
||||
int pos = odf_type.find(L"ooxml-");
|
||||
@ -546,7 +545,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
if (min <0 ) min=0;
|
||||
if (min < 0 ) min=0;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -65,6 +65,8 @@ public:
|
||||
static const ElementType type = typeDrawShape;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
draw_shape() : bad_shape_(false), word_art_(false) {}
|
||||
|
||||
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);
|
||||
|
||||
@ -87,6 +89,7 @@ public:
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
friend class odf_document;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
bool bad_shape_;
|
||||
bool word_art_;
|
||||
int sub_type_;
|
||||
std::vector<odf_reader::_property> additional_;
|
||||
|
||||
@ -60,8 +60,6 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
|
||||
|
||||
void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.get_drawing_context().start_shape(this);
|
||||
@ -115,7 +113,6 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
void draw_rect::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
//if (Context.get_drawing_context().get_current_level() >0 )return;
|
||||
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() )
|
||||
{
|
||||
if(Context.delayed_converting_ == false)
|
||||
@ -245,17 +242,21 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
|
||||
shape->word_art_ = word_art_;
|
||||
|
||||
bool set_shape = false;
|
||||
|
||||
if (draw_type_oox_index_)
|
||||
{
|
||||
shape->additional_.push_back(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
|
||||
|
||||
if (shape->word_art_ == true)
|
||||
shape->additional_.push_back(_property(L"wordArt", true));
|
||||
shape->additional_.push_back(_property(L"wordArt", true));
|
||||
|
||||
set_shape = true;
|
||||
}
|
||||
if (sub_type_)
|
||||
{
|
||||
shape->sub_type_ = sub_type_.get();
|
||||
set_shape = true;
|
||||
}
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
@ -279,6 +280,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
std::wstringstream output_;
|
||||
svg_path::oox_serialize(output_, o_Polyline);
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
|
||||
|
||||
set_shape = true;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
@ -303,12 +306,9 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!draw_type_oox_index_)
|
||||
{
|
||||
draw_type_oox_index_ = 0;
|
||||
}
|
||||
}
|
||||
else if (draw_enhanced_geometry_attlist_.draw_modifiers_)
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
|
||||
{
|
||||
shape->additional_.push_back(_property(L"draw-modifiers",draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
|
||||
if (draw_handle_geometry_.size()>0)
|
||||
@ -320,6 +320,12 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!set_shape)
|
||||
{
|
||||
shape->bad_shape_ = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,8 +166,6 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"text-content",text_content_));
|
||||
}
|
||||
|
||||
//Context.get_slide_context().end_drawing();
|
||||
}
|
||||
void draw_rect::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
@ -304,6 +302,8 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
{
|
||||
find_draw_type_oox();
|
||||
|
||||
bool set_shape = false;
|
||||
|
||||
if (draw_type_oox_index_)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
|
||||
@ -311,10 +311,12 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
if (word_art_ == true)
|
||||
Context.get_slide_context().set_property(_property(L"wordArt", true));
|
||||
|
||||
set_shape = true;
|
||||
}
|
||||
if (sub_type_)
|
||||
{
|
||||
Context.get_slide_context().start_shape(sub_type_.get());
|
||||
set_shape = true;
|
||||
}
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
@ -339,6 +341,8 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
svg_path::oox_serialize(output_, o_Polyline);
|
||||
Context.get_slide_context().set_property(odf_reader::_property(L"custom_path", output_.str()));
|
||||
|
||||
set_shape = true;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
std::vector< std::wstring > splitted;
|
||||
@ -362,10 +366,6 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!draw_type_oox_index_)
|
||||
{
|
||||
draw_type_oox_index_ = 0;
|
||||
}
|
||||
}
|
||||
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
|
||||
{
|
||||
@ -380,6 +380,10 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!set_shape)
|
||||
{
|
||||
Context.get_slide_context().start_shape(1); //restart type shape
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,6 +147,14 @@ void office_text::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
const wchar_t * office_change_info::ns = L"office";
|
||||
const wchar_t * office_change_info::name = L"change-info";
|
||||
|
||||
void office_change_info::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
int count = Attributes->size();
|
||||
|
||||
CP_APPLY_ATTR(L"office:chg-author", office_chg_author_);
|
||||
CP_APPLY_ATTR(L"office:chg-date-time", office_chg_date_time_);
|
||||
}
|
||||
|
||||
void office_change_info::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"dc", L"date")
|
||||
@ -165,14 +173,23 @@ void office_change_info::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wstring date;
|
||||
std::wstring author;
|
||||
|
||||
if (dc_date_)
|
||||
{
|
||||
date = xml::utils::replace_text_to_xml(dynamic_cast<dc_date * >(dc_date_.get())->content_);
|
||||
}
|
||||
else if (office_chg_date_time_)
|
||||
{
|
||||
date = *office_chg_date_time_;
|
||||
}
|
||||
if (dc_creator_)
|
||||
{
|
||||
author = xml::utils::replace_text_to_xml(dynamic_cast<dc_creator * >(dc_creator_.get())->content_);
|
||||
}
|
||||
else if (office_chg_author_)
|
||||
{
|
||||
author = *office_chg_author_;
|
||||
}
|
||||
|
||||
Context.get_text_tracked_context().set_user_info(author, date);
|
||||
}
|
||||
|
||||
@ -88,11 +88,14 @@ public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
|
||||
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);
|
||||
|
||||
office_element_ptr dc_date_;
|
||||
office_element_ptr dc_creator_;
|
||||
|
||||
_CP_OPT(std::wstring) office_chg_author_;
|
||||
_CP_OPT(std::wstring) office_chg_date_time_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_change_info)
|
||||
|
||||
@ -133,6 +133,9 @@ std::wostream & s::text_to_stream(std::wostream & _Wostream) const
|
||||
else
|
||||
_Wostream << std::wstring(1, L' ');
|
||||
|
||||
if (content_)
|
||||
_Wostream << *content_;
|
||||
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
@ -140,7 +143,10 @@ void s::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"text:c", text_c_);
|
||||
}
|
||||
|
||||
void s::add_text(const std::wstring & Text)
|
||||
{
|
||||
content_ = Text;
|
||||
}
|
||||
void s::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.add_element_to_run();
|
||||
@ -326,7 +332,7 @@ const wchar_t * span::name = L"span";
|
||||
|
||||
std::wostream & span::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, content_)
|
||||
{
|
||||
parElement->text_to_stream(_Wostream);
|
||||
}
|
||||
@ -353,13 +359,13 @@ void span::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
void span::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(paragraph_content_);
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void span::add_text(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text);
|
||||
paragraph_content_.push_back( elm );
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void span::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -400,7 +406,7 @@ void span::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
if (!addNewRun)Context.add_new_run();
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, content_)
|
||||
{
|
||||
parElement->docx_convert(Context);
|
||||
}
|
||||
@ -414,7 +420,7 @@ void span::docx_convert(oox::docx_conversion_context & Context)
|
||||
void span::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_span(text_style_name_.style_name());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
}
|
||||
@ -426,7 +432,7 @@ void span::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
Context.get_text_context().get_styles_context().start_process_style(styleInst);
|
||||
|
||||
Context.get_text_context().start_span(text_style_name_.style_name());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
}
|
||||
@ -440,7 +446,7 @@ const wchar_t * a::name = L"a";
|
||||
|
||||
std::wostream & a::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
BOOST_FOREACH(const office_element_ptr & element, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & element, content_)
|
||||
{
|
||||
element->text_to_stream(_Wostream);
|
||||
}
|
||||
@ -459,13 +465,13 @@ void a::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
void a::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(paragraph_content_);
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void a::add_text(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
paragraph_content_.push_back( elm );
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void a::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -521,7 +527,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (!addNewRun)
|
||||
Context.add_new_run();
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & parElement, content_)
|
||||
{
|
||||
parElement->docx_convert(Context);
|
||||
}
|
||||
@ -536,7 +542,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
|
||||
void a::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_hyperlink(text_style_name_.style_name());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
}
|
||||
@ -545,7 +551,7 @@ void a::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
void a::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_text_context().start_hyperlink();
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
}
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
|
||||
namespace text {
|
||||
|
||||
template <class ElementT>
|
||||
@ -59,33 +58,25 @@ class paragraph_content_element : public paragraph_content_impl<ElementT>
|
||||
{
|
||||
};
|
||||
|
||||
// TODO:
|
||||
// 5.6 Индексные метки
|
||||
// 5.7 Метки изменений
|
||||
// 5.8 Внедренные графические объекты и текстовые блоки
|
||||
|
||||
// simple text
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class text : public paragraph_content_element<text>
|
||||
{
|
||||
public:
|
||||
static office_element_ptr create(const std::wstring & Text);
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeText;
|
||||
static const ElementType type = typeTextText;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
public:
|
||||
bool preserve_;
|
||||
text(const std::wstring & Text) : text_(Text) {preserve_ = true;};
|
||||
text() {preserve_ = true;};
|
||||
@ -94,15 +85,10 @@ public:
|
||||
|
||||
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_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);
|
||||
|
||||
private:
|
||||
std::wstring text_;
|
||||
|
||||
};
|
||||
@ -118,16 +104,12 @@ public:
|
||||
static const ElementType type = typeTextS;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
|
||||
public:
|
||||
s(unsigned int c) : text_c_(c) {};
|
||||
s() {};
|
||||
|
||||
@ -136,10 +118,10 @@ public:
|
||||
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) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
_CP_OPT(unsigned int) text_c_;
|
||||
_CP_OPT(std::wstring) content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(s);
|
||||
@ -155,26 +137,22 @@ public:
|
||||
static const ElementType type = typeTextTab;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
tab(unsigned int ab_ref) : text_tab_ref_(ab_ref) {};
|
||||
tab() {};
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
_CP_OPT(unsigned int) attr_tab_ref() const { return text_tab_ref_; }
|
||||
|
||||
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) {}
|
||||
|
||||
public:
|
||||
tab(unsigned int ab_ref) : text_tab_ref_(ab_ref) {};
|
||||
tab() {};
|
||||
|
||||
_CP_OPT(unsigned int) attr_tab_ref() const { return text_tab_ref_; }
|
||||
|
||||
private:
|
||||
_CP_OPT(unsigned int) text_tab_ref_;
|
||||
};
|
||||
|
||||
@ -191,15 +169,12 @@ public:
|
||||
static const ElementType type = typeTextLineBreak;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
public:
|
||||
line_break() {};
|
||||
|
||||
private:
|
||||
@ -222,10 +197,9 @@ public:
|
||||
static const ElementType type = typeTextBookmark;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
public:
|
||||
bookmark() {}
|
||||
|
||||
bookmark() {}
|
||||
bookmark(const std::wstring & Name) : text_name_(Name){};
|
||||
|
||||
const std::wstring & attr_name() const { return text_name_; }
|
||||
@ -235,7 +209,6 @@ 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:
|
||||
std::wstring text_name_;
|
||||
};
|
||||
|
||||
@ -252,10 +225,9 @@ public:
|
||||
static const ElementType type = typeTextBookmarkStart;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
public:
|
||||
bookmark_start() {}
|
||||
|
||||
bookmark_start() {}
|
||||
bookmark_start(const std::wstring & Name) : text_name_(Name){};
|
||||
|
||||
const std::wstring & attr_name() const { return text_name_; }
|
||||
@ -265,7 +237,6 @@ 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:
|
||||
std::wstring text_name_;
|
||||
};
|
||||
|
||||
@ -282,10 +253,9 @@ public:
|
||||
static const ElementType type = typeTextBookmarkEnd;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
public:
|
||||
bookmark_end() {} ;
|
||||
|
||||
bookmark_end() {} ;
|
||||
bookmark_end(const std::wstring & Name) : text_name_(Name){};
|
||||
|
||||
const std::wstring & attr_name() const { return text_name_; }
|
||||
@ -295,7 +265,6 @@ 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:
|
||||
std::wstring text_name_;
|
||||
};
|
||||
|
||||
@ -372,10 +341,9 @@ public:
|
||||
static const ElementType type = typeTextReferenceMarkEnd;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
public:
|
||||
reference_mark_end() {};
|
||||
|
||||
reference_mark_end() {};
|
||||
reference_mark_end(const std::wstring & Name) : text_name_(Name){};
|
||||
|
||||
const std::wstring & attr_name() const { return text_name_; }
|
||||
@ -385,7 +353,6 @@ 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:
|
||||
std::wstring text_name_;
|
||||
};
|
||||
|
||||
@ -403,17 +370,15 @@ public:
|
||||
static const ElementType type = typeTextSpan;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
public:
|
||||
span() {}
|
||||
|
||||
span() {}
|
||||
|
||||
office_element_ptr_array paragraph_content_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
odf_types::style_ref text_style_name_;
|
||||
odf_types::style_ref_array text_class_names_;
|
||||
@ -438,22 +403,19 @@ public:
|
||||
static const ElementType type = typeTextA;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
public:
|
||||
a() {}
|
||||
|
||||
a() {}
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
|
||||
std::wstring office_name_;
|
||||
@ -462,7 +424,7 @@ private:
|
||||
odf_types::style_ref text_style_name_;
|
||||
odf_types::style_ref text_visited_style_name_;
|
||||
|
||||
office_element_ptr_array paragraph_content_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(a);
|
||||
@ -513,6 +475,7 @@ public:
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
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);
|
||||
@ -660,7 +623,6 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
private:
|
||||
@ -668,8 +630,7 @@ 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:
|
||||
// TODO: attributes
|
||||
// todooo attributes
|
||||
office_element_ptr_array text_;
|
||||
|
||||
};
|
||||
@ -699,7 +660,7 @@ private:
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
// TODO: attributes
|
||||
// todooo attributes
|
||||
office_element_ptr_array text_;
|
||||
|
||||
};
|
||||
@ -816,7 +777,6 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
private:
|
||||
@ -824,8 +784,7 @@ 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:
|
||||
// TODO: attributes
|
||||
// todooo attributes
|
||||
office_element_ptr_array text_;
|
||||
|
||||
};
|
||||
@ -846,7 +805,6 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
public:
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
private:
|
||||
@ -854,8 +812,7 @@ 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:
|
||||
// TODO: attributes
|
||||
// todooo attributes
|
||||
office_element_ptr_array text_;
|
||||
|
||||
};
|
||||
@ -878,7 +835,6 @@ 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:
|
||||
office_element_ptr_array text_;
|
||||
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@ const wchar_t * ruby_base::name = L"ruby-base";
|
||||
|
||||
std::wostream & ruby_base::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
serialize_elements_text(_Wostream, paragraph_content_);
|
||||
serialize_elements_text(_Wostream, content_);
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
@ -65,13 +65,13 @@ void ruby_base::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
void ruby_base::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(paragraph_content_);
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void ruby_base::add_text(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
paragraph_content_.push_back( elm );
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
// text:ruby-text
|
||||
|
||||
@ -64,7 +64,7 @@ private:
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
office_element_ptr_array paragraph_content_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -94,8 +94,8 @@ private:
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
odf_types::style_ref text_style_name_;
|
||||
office_element_ptr_array content_;
|
||||
odf_types::style_ref text_style_name_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -276,25 +276,6 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
|
||||
{
|
||||
std::wstringstream & _pPr = Context.get_text_context().get_styles_context().paragraph_attr();
|
||||
//сначала аттрибуты к самому pPr или defPPr
|
||||
|
||||
if (fo_text_align_)
|
||||
{
|
||||
std::wstring jc;
|
||||
switch(fo_text_align_->get_type())
|
||||
{
|
||||
case text_align::Start:
|
||||
case text_align::Left:
|
||||
jc = L"l"; break;
|
||||
case text_align::End:
|
||||
case text_align::Right:
|
||||
jc = L"r"; break;
|
||||
case text_align::Center:
|
||||
jc = L"ctr"; break;
|
||||
case text_align::Justify:
|
||||
jc = L"just"; break;
|
||||
}
|
||||
if (jc.length()>0) _pPr << L"algn=\"" << jc << "\" ";
|
||||
}
|
||||
if (fo_margin_left_ || fo_margin_right_ || fo_text_indent_ )
|
||||
{
|
||||
// TODO auto indent
|
||||
@ -315,6 +296,26 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
|
||||
if (!w_firstLine.empty())
|
||||
_pPr << L"indent=\"" << w_firstLine << "\" ";
|
||||
}
|
||||
|
||||
if (fo_text_align_)
|
||||
{
|
||||
std::wstring jc;
|
||||
switch(fo_text_align_->get_type())
|
||||
{
|
||||
case text_align::Start:
|
||||
case text_align::Left:
|
||||
jc = L"l"; break;
|
||||
case text_align::End:
|
||||
case text_align::Right:
|
||||
jc = L"r"; break;
|
||||
case text_align::Center:
|
||||
jc = L"ctr"; break;
|
||||
case text_align::Justify:
|
||||
jc = L"just"; break;
|
||||
}
|
||||
if (jc.length()>0) _pPr << L"algn=\"" << jc << "\" ";
|
||||
}
|
||||
|
||||
if (style_vertical_align_)
|
||||
{
|
||||
std::wstring w_val;
|
||||
@ -329,7 +330,6 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
|
||||
|
||||
if (!w_val.empty())
|
||||
_pPr << L"fontAlgn=\"" << w_val << "\" ";
|
||||
|
||||
}
|
||||
//if (style_writing_mode_)
|
||||
//{
|
||||
|
||||
@ -115,13 +115,13 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
|
||||
if (style_rel_width_)
|
||||
{
|
||||
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
|
||||
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
|
||||
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
|
||||
}
|
||||
else if (style_width_)
|
||||
{
|
||||
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
|
||||
if (w_w > 31680)w_w = 31680;
|
||||
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
|
||||
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -137,7 +137,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
|
||||
if (table_align_)
|
||||
{
|
||||
std::wstring w_val = L"left";
|
||||
if (table_align_->get_type() == table_align::Margins)
|
||||
if (table_align_->get_type() == table_align::Margins || table_align_->get_type() == table_align::Left)
|
||||
{
|
||||
if (common_horizontal_margin_attlist_.fo_margin_left_ && common_horizontal_margin_attlist_.fo_margin_right_)
|
||||
{
|
||||
@ -147,19 +147,15 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
|
||||
if (w_val != L"center" && common_horizontal_margin_attlist_.fo_margin_left_ )
|
||||
{
|
||||
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
|
||||
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20<< "\" w:type=\"dxa\" />";
|
||||
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
|
||||
}
|
||||
}
|
||||
else
|
||||
else //if (table_align_->get_type() == table_align::Center)
|
||||
w_val = boost::lexical_cast<std::wstring>(*table_align_);
|
||||
|
||||
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
|
||||
}
|
||||
|
||||
if (table_align_ && table_align_->get_type() == table_align::Center)
|
||||
{
|
||||
// TODO ()
|
||||
}
|
||||
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
|
||||
|
||||
if (common_background_color_attlist_.fo_background_color_)
|
||||
|
||||
@ -343,7 +343,18 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
|
||||
CP_XML_ATTR(L"cap", "small");
|
||||
}
|
||||
}
|
||||
// underline
|
||||
if (fo_text_transform_)
|
||||
{
|
||||
if (fo_text_transform_->get_type() == text_transform::Uppercase)
|
||||
{
|
||||
CP_XML_ATTR(L"cap", "all");
|
||||
}
|
||||
else if (fo_text_transform_->get_type() == text_transform::Lowercase)
|
||||
{
|
||||
CP_XML_ATTR(L"cap", "small");
|
||||
}
|
||||
}
|
||||
// underline
|
||||
line_width under = style_text_underline_width_.get_value_or(line_width::Auto);
|
||||
bool underlineBold = under.get_type() == line_width::Bold ||
|
||||
under.get_type() == line_width::Thick;
|
||||
@ -363,7 +374,7 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
|
||||
switch (style_text_underline_type_->get_type())
|
||||
{
|
||||
case line_type::Single: underline = L"sng"; break;
|
||||
case line_type::Double: underline = L"double"; break;
|
||||
case line_type::Double: underline = L"dbl"; break;
|
||||
}
|
||||
}
|
||||
else if (style_text_underline_style_)
|
||||
@ -397,8 +408,8 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
|
||||
case line_style::Wave:
|
||||
if (underlineBold) underline = L"wavyHeavy";
|
||||
else if (style_text_underline_type_.get_value_or( line_type(line_type::Single) ).get_type() == line_type::Double)
|
||||
underline = L"wavyDouble";
|
||||
else underline = L"wave";
|
||||
underline = L"wavyDbl";
|
||||
else underline = L"wavy";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -425,10 +436,10 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
|
||||
if (fo_language_ || style_language_asian_ || style_language_complex_)
|
||||
{
|
||||
std::wstring w_val;
|
||||
if (fo_language_) w_val = *fo_language_;
|
||||
else if (fo_country_) w_val = *fo_country_;
|
||||
else if (style_country_asian_)w_val = *style_country_asian_;
|
||||
else if (style_language_asian_)w_val = *style_language_asian_;
|
||||
if (fo_language_) w_val = *fo_language_;
|
||||
else if (fo_country_) w_val = *fo_country_;
|
||||
else if (style_country_asian_) w_val = *style_country_asian_;
|
||||
else if (style_language_asian_) w_val = *style_language_asian_;
|
||||
else if (style_language_complex_)w_val = *style_language_complex_;
|
||||
else if (style_country_complex_)w_val = *style_country_complex_;
|
||||
|
||||
@ -619,7 +630,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
|
||||
underline = L"single";
|
||||
break;
|
||||
case line_type::Double:
|
||||
underline = L"double";
|
||||
underline = L"dbl";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -666,9 +677,9 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
|
||||
if (underlineBold)
|
||||
underline = L"wavyHeavy";
|
||||
else if (style_text_underline_type_.get_value_or( line_type(line_type::Single) ).get_type() == line_type::Double)
|
||||
underline = L"wavyDouble";
|
||||
underline = L"wavyDbl";
|
||||
else
|
||||
underline = L"wave";
|
||||
underline = L"wavy";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1109,7 +1120,7 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra
|
||||
underline = L"single";
|
||||
break;
|
||||
case line_type::Double:
|
||||
underline = L"double";
|
||||
underline = L"dbl";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1156,9 +1167,9 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra
|
||||
if (underlineBold)
|
||||
underline = L"wavyHeavy";
|
||||
else if (style_text_underline_type_.get_value_or( line_type(line_type::Single) ).get_type() == line_type::Double)
|
||||
underline = L"wavyDouble";
|
||||
underline = L"wavyDbl";
|
||||
else
|
||||
underline = L"wave";
|
||||
underline = L"wavy";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -747,11 +747,11 @@ const wchar_t * style_column::name = L"column";
|
||||
|
||||
void style_column::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
|
||||
CP_APPLY_ATTR(L"fo:start-indent", fo_start_indent_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:end-indent", fo_end_indent_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:space-before", fo_space_before_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:space-after", fo_space_after_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
|
||||
CP_APPLY_ATTR(L"fo:start-indent", fo_start_indent_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:end-indent", fo_end_indent_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:space-before", fo_space_before_, length(0.0, length::cm));
|
||||
CP_APPLY_ATTR(L"fo:space-after", fo_space_after_, length(0.0, length::cm));
|
||||
|
||||
}
|
||||
|
||||
@ -1177,20 +1177,23 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
|
||||
|
||||
if (fo_page_width_ || fo_page_height_ || style_print_orientation_)
|
||||
{
|
||||
std::wstring w_w = L"",w_h = L"";
|
||||
std::wstring w_w, w_h;
|
||||
|
||||
int h=0,w=0;
|
||||
_INT64 h = 0, w = 0;
|
||||
|
||||
if (fo_page_width_)
|
||||
{
|
||||
w = fo_page_width_->get_value_unit(length::emu);
|
||||
if (w < 914400) w = 914400;
|
||||
|
||||
w_w = boost::lexical_cast<std::wstring>(w);
|
||||
w_w = std::to_wstring(w);
|
||||
}
|
||||
if (fo_page_height_)
|
||||
{
|
||||
h = fo_page_height_->get_value_unit(length::emu);
|
||||
w_h = boost::lexical_cast<std::wstring>(h);
|
||||
if (h < 914400) h = 914400;
|
||||
|
||||
w_h = std::to_wstring(h);
|
||||
}
|
||||
|
||||
std::wstring w_orient = L"custom";
|
||||
@ -1219,13 +1222,13 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
|
||||
// style-footnote-sep-attlist
|
||||
void style_footnote_sep_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"style:width", style_width_);
|
||||
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
|
||||
CP_APPLY_ATTR(L"style:color", style_color_);
|
||||
CP_APPLY_ATTR(L"style:line-style", style_line_style_);
|
||||
CP_APPLY_ATTR(L"style:type", style_adjustment_, style_type(style_type::Left)); // default Left
|
||||
CP_APPLY_ATTR(L"style:distance-before-sep", style_distance_before_sep_);
|
||||
CP_APPLY_ATTR(L"style:distance-after-sep", style_distance_after_sep_);
|
||||
CP_APPLY_ATTR(L"style:width", style_width_);
|
||||
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
|
||||
CP_APPLY_ATTR(L"style:color", style_color_);
|
||||
CP_APPLY_ATTR(L"style:line-style", style_line_style_);
|
||||
CP_APPLY_ATTR(L"style:type", style_adjustment_, style_type(style_type::Left)); // default Left
|
||||
CP_APPLY_ATTR(L"style:distance-before-sep", style_distance_before_sep_);
|
||||
CP_APPLY_ATTR(L"style:distance-after-sep", style_distance_after_sep_);
|
||||
}
|
||||
|
||||
/// style:footnote-sep
|
||||
@ -1275,13 +1278,6 @@ bool style_page_layout_properties::docx_back_serialize(std::wostream & strm, oox
|
||||
}
|
||||
void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (Context.get_table_context().in_table())
|
||||
{
|
||||
// мы находимся внутри таблицы, устанавливаем специальное значение
|
||||
Context.section_properties_in_table(this);
|
||||
return;
|
||||
}
|
||||
|
||||
style_columns * columns = dynamic_cast<style_columns *>( style_page_layout_properties_elements_.style_columns_.get());
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
@ -1462,39 +1458,42 @@ void style_master_page::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
////////////////
|
||||
|
||||
const wchar_t * hdrHeader = L"<w:hdr \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
|
||||
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
|
||||
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
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/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/2010/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/2010/wordprocessingShape\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
|
||||
const wchar_t * ftrHeader = L"<w:ftr \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
|
||||
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
|
||||
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
|
||||
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
|
||||
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
|
||||
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
|
||||
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
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/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/2010/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/2010/wordprocessingShape\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
void style_header::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
@ -754,7 +754,7 @@ namespace svg_path
|
||||
}
|
||||
}
|
||||
|
||||
if ((aCurrPoly.points.size() > 0 || !bIsClosed) && !aCurrPoly.command.empty())
|
||||
if ((aCurrPoly.points.size() > 0 || !bIsClosed) && !aCurrPoly.command.empty() && aCurrPoly.command != L"a:cubicBezTo")
|
||||
{
|
||||
// end-process last poly
|
||||
|
||||
|
||||
@ -175,18 +175,6 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_table_context().end_table();
|
||||
_Wostream << L"</w:tbl>";
|
||||
|
||||
if (office_element * elm = Context.get_section_properties_in_table())
|
||||
{
|
||||
if (Context.get_table_context().in_table())
|
||||
Context.section_properties_in_table(elm);
|
||||
else
|
||||
{
|
||||
_Wostream << L"<w:p><w:pPr>";
|
||||
elm->docx_convert(Context);
|
||||
_Wostream << L"</w:pPr></w:p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void table_columns::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
@ -62,6 +62,8 @@ static formulasconvert::odf2oox_converter formulas_converter;
|
||||
|
||||
int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Context, text_format_properties_content *text_properties)
|
||||
{
|
||||
if (elements_.empty()) return -1;
|
||||
|
||||
Context.get_table_context().start_cell_content();
|
||||
Context.get_text_context().set_cell_text_properties(text_properties);
|
||||
|
||||
@ -136,6 +138,7 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
ht = ht_s.str();
|
||||
}
|
||||
}
|
||||
int row_current = Context.current_table_row() + 1;
|
||||
|
||||
bool hidden = table_table_row_attlist_.table_visibility_.get_type() == table_visibility::Collapse;
|
||||
|
||||
|
||||
@ -188,21 +188,26 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
|
||||
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
|
||||
Context.output_stream() << L"<w:pPr>";
|
||||
//todooo причесать
|
||||
if (Context.is_paragraph_header() && !Context.get_section_context().dump_.empty())
|
||||
if (!Context.get_section_context().dump_.empty() &&
|
||||
!Context.get_table_context().in_table() &&
|
||||
(Context.get_process_note() == oox::docx_conversion_context::noNote))
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
if (Context.is_paragraph_header() )
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
|
||||
Context.output_stream() << L"</w:pPr>";
|
||||
Context.finish_paragraph();
|
||||
Context.start_paragraph();
|
||||
Context.output_stream() << L"<w:pPr>";
|
||||
Context.output_stream() << L"</w:pPr>";
|
||||
Context.finish_paragraph();
|
||||
Context.start_paragraph();
|
||||
Context.output_stream() << L"<w:pPr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
}
|
||||
}
|
||||
else if ( !Context.get_table_context().in_table())
|
||||
{
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
Context.get_section_context().dump_.clear();
|
||||
}
|
||||
|
||||
Context.output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
|
||||
|
||||
@ -231,7 +236,9 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Context.get_section_context().dump_.empty() && !Context.get_table_context().in_table())
|
||||
if (!Context.get_section_context().dump_.empty() &&
|
||||
!Context.get_table_context().in_table() &&
|
||||
(Context.get_process_note() == oox::docx_conversion_context::noNote))
|
||||
{
|
||||
Context.output_stream() << L"<w:pPr>";
|
||||
Context.output_stream() << Context.get_section_context().dump_;
|
||||
@ -249,25 +256,25 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
|
||||
std::wostream & paragraph::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
// TODO!!!!
|
||||
CP_SERIALIZE_TEXT(paragraph_content_);
|
||||
CP_SERIALIZE_TEXT(content_);
|
||||
_Wostream << L"\n";
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
void paragraph::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
paragraph_attrs_.add_attributes(Attributes);
|
||||
attrs_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void paragraph::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
|
||||
{
|
||||
CP_CREATE_ELEMENT_SIMPLE(paragraph_content_);
|
||||
CP_CREATE_ELEMENT_SIMPLE(content_);
|
||||
}
|
||||
|
||||
void paragraph::add_text(const std::wstring & Text)
|
||||
{
|
||||
office_element_ptr elm = text::create(Text) ;
|
||||
paragraph_content_.push_back( elm );
|
||||
content_.push_back( elm );
|
||||
}
|
||||
|
||||
void paragraph::afterCreate(document_context * Context)
|
||||
@ -301,7 +308,7 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
|
||||
|
||||
str = store_str.substr(0,Context.get_drop_cap_context().Length);
|
||||
|
||||
int textStyle = process_paragraph_attr(paragraph_attrs_, Context);
|
||||
int textStyle = process_paragraph_attr(attrs_, Context);
|
||||
first_text_paragraph->docx_convert(Context);
|
||||
|
||||
int str_start = Context.get_drop_cap_context().Length;
|
||||
@ -314,16 +321,16 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
|
||||
}
|
||||
void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if ( paragraph_content_.empty()) return;
|
||||
if ( content_.empty()) return;
|
||||
|
||||
//в рассчет берутся только первые элементы !!! разные там break-и отменяют реэжим drop_cap!!- todooo сделать возможным множественным span
|
||||
if ( paragraph_content_[0]->get_type() == typeTextText)
|
||||
if ( content_[0]->get_type() == typeTextText)
|
||||
{
|
||||
drop_cap_text_docx_convert(paragraph_content_[0],Context);
|
||||
drop_cap_text_docx_convert(content_[0],Context);
|
||||
}
|
||||
else if (paragraph_content_[0]->get_type() == typeTextSpan)
|
||||
else if (content_[0]->get_type() == typeTextSpan)
|
||||
{
|
||||
span* first_span_in_paragraph = dynamic_cast<span*>(paragraph_content_[0].get());
|
||||
span* first_span_in_paragraph = dynamic_cast<span*>(content_[0].get());
|
||||
if (Context.get_drop_cap_context().FontSize < 1)
|
||||
{
|
||||
style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(first_span_in_paragraph->text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_);
|
||||
@ -343,15 +350,17 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
//в рассчет берутся только первые элементы !!! разные там break-и отменяют реэжим drop_cap!!
|
||||
if ((first_span_in_paragraph->paragraph_content_.size()>0) &&
|
||||
(first_span_in_paragraph->paragraph_content_[0]->get_type() == typeTextText))
|
||||
if ((first_span_in_paragraph->content_.size()>0) &&
|
||||
(first_span_in_paragraph->content_[0]->get_type() == typeTextText))
|
||||
{
|
||||
drop_cap_text_docx_convert(first_span_in_paragraph->paragraph_content_[0],Context);
|
||||
drop_cap_text_docx_convert(first_span_in_paragraph->content_[0],Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
const std::wstring & styleName = attrs_.text_style_name_.style_name();
|
||||
|
||||
bool drawing = false;
|
||||
|
||||
if (Context.get_drawing_context().get_current_shape() || Context.get_drawing_context().get_current_frame())
|
||||
@ -361,31 +370,23 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
bool bIsNewParagraph = true;
|
||||
|
||||
if (Context.get_paragraph_state() && (Context.get_process_note() == oox::docx_conversion_context::noNote) && !drawing )
|
||||
{//вложеннные элементы
|
||||
if (paragraph_content_.empty())//??
|
||||
{
|
||||
Context.output_stream() << L"<w:p>";
|
||||
Context.output_stream() << emptyParagraphContent;
|
||||
Context.output_stream() << L"</w:p>";
|
||||
bool is_empty = content_.empty();
|
||||
|
||||
if (Context.get_paragraph_state() && (Context.get_process_note() == oox::docx_conversion_context::noNote) && !drawing)
|
||||
{//вложеннные элементы ... или после графики embedded_linux_kernel_and_drivers_labs_zh_TW.odt
|
||||
bIsNewParagraph = false;
|
||||
|
||||
if (!Context.get_paragraph_keep())// например Appendix I_IPP.odt - tracked elements (
|
||||
{
|
||||
for (int i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
if (!Context.get_delete_text_state())
|
||||
Context.set_paragraph_state(false);// например Appendix I_IPP.odt - tracked elements (вложенные списки из 2 элементов)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
bIsNewParagraph = false;
|
||||
|
||||
if (!Context.get_paragraph_keep())
|
||||
{
|
||||
for (int i = 0; i < paragraph_content_.size(); i++)
|
||||
{
|
||||
paragraph_content_[i]->docx_convert(Context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool is_empty = paragraph_content_.empty();
|
||||
|
||||
if (bIsNewParagraph)
|
||||
Context.start_paragraph(is_header_);
|
||||
@ -398,7 +399,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в конце текущего параграфа
|
||||
// распечатать свойства секции
|
||||
//проверить ... не она ли основная - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const std::wstring & next_styleName = next_par_->paragraph_attrs_.text_style_name_.style_name();
|
||||
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_.style_name();
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
|
||||
|
||||
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
|
||||
@ -413,7 +414,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
const std::wstring & styleName = paragraph_attrs_.text_style_name_.style_name();
|
||||
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(styleName);
|
||||
|
||||
if (masterPageName)
|
||||
@ -430,7 +430,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
process_paragraph_drop_cap_attr(paragraph_attrs_, Context);
|
||||
process_paragraph_drop_cap_attr(attrs_, Context);
|
||||
|
||||
if (Context.get_drop_cap_context().state() == 2)//active
|
||||
{
|
||||
@ -444,11 +444,11 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
}
|
||||
|
||||
int textStyle = process_paragraph_attr(paragraph_attrs_, Context);
|
||||
int textStyle = process_paragraph_attr(attrs_, Context);
|
||||
|
||||
Context.add_note_reference();
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
if (Context.get_page_break())
|
||||
{
|
||||
@ -501,8 +501,8 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_paragraph(paragraph_attrs_.text_style_name_.style_name());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
Context.start_paragraph(attrs_.text_style_name_.style_name());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
}
|
||||
@ -510,12 +510,14 @@ void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
void paragraph::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_text_context().start_paragraph(paragraph_attrs_.text_style_name_.style_name());
|
||||
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
|
||||
Context.get_text_context().start_paragraph(attrs_.text_style_name_.style_name());
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
}
|
||||
Context.get_text_context().end_paragraph();
|
||||
|
||||
Context.get_text_context().end_paragraph();
|
||||
}
|
||||
///////////////////////////////////////////
|
||||
void soft_page_break::docx_convert(oox::docx_conversion_context & Context)
|
||||
@ -546,7 +548,7 @@ void h::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
paragraph_.add_attributes(Attributes);
|
||||
|
||||
paragraph_.is_header_ = true;
|
||||
paragraph_.paragraph_attrs_.outline_level_ = text_outline_level_;
|
||||
paragraph_.attrs_.outline_level_ = text_outline_level_;
|
||||
}
|
||||
|
||||
void h::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -1031,14 +1033,19 @@ void text_changed_region::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
|
||||
void text_changed_region::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(element_);
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void text_changed_region::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!element_ || !text_id_) return;
|
||||
if (content_.empty() || !text_id_) return;
|
||||
|
||||
Context.get_text_tracked_context().start_change (*text_id_);
|
||||
element_->docx_convert(Context);
|
||||
|
||||
for (int i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.get_text_tracked_context().end_change ();
|
||||
}
|
||||
|
||||
@ -1066,12 +1073,30 @@ void text_unknown_base_change::docx_convert(oox::docx_conversion_context & Conte
|
||||
if (content_.empty()) return;
|
||||
|
||||
//тут удаленный текст. не по стандарту сделать бы и форматы - стилями чтоли ....
|
||||
Context.get_text_tracked_context().start_changes_content();
|
||||
for (int i = 0; i < content_.size(); i++)
|
||||
|
||||
for (int i = 0; i < content_.size(); i++)
|
||||
{
|
||||
Context.get_text_tracked_context().start_changes_content();
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
//h *h_ = dynamic_cast<h*>(content_[i].get());
|
||||
//p *p_ = dynamic_cast<p*>(content_[i].get());
|
||||
|
||||
//paragraph *para = NULL;
|
||||
|
||||
//if (h_) para = &h_->paragraph_;
|
||||
//if (p_) para = &p_->paragraph_;
|
||||
|
||||
//if (para)
|
||||
//{
|
||||
// for (int j = 0; j < para->content_.size(); j++)
|
||||
// {
|
||||
// para->content_[j]->docx_convert(Context);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
Context.get_text_tracked_context().end_changes_content();
|
||||
Context.get_text_tracked_context().end_changes_content();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
const wchar_t * text_insertion::ns = L"text";
|
||||
|
||||
@ -56,12 +56,12 @@ public:
|
||||
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
|
||||
void add_text(const std::wstring & Text);
|
||||
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
|
||||
void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
|
||||
void add_text (const std::wstring & Text);
|
||||
|
||||
paragraph * get_next() { return next_par_; }
|
||||
void set_next(paragraph * next) {next_par_ = next;}
|
||||
paragraph * get_next() { return next_par_; }
|
||||
void set_next(paragraph * next) {next_par_ = next;}
|
||||
|
||||
void set_next_section(bool Val)
|
||||
{
|
||||
@ -75,17 +75,17 @@ public:
|
||||
|
||||
void afterCreate(document_context * ctx);
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context) ;
|
||||
void pptx_convert (oox::pptx_conversion_context & Context) ;
|
||||
|
||||
void drop_cap_docx_convert(oox::docx_conversion_context & Context);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
private:
|
||||
void drop_cap_text_docx_convert(office_element_ptr first_text_paragraph,oox::docx_conversion_context & Context);
|
||||
|
||||
paragraph_attrs paragraph_attrs_;
|
||||
office_element_ptr_array paragraph_content_;
|
||||
paragraph_attrs attrs_;
|
||||
|
||||
paragraph *next_par_;
|
||||
|
||||
@ -117,6 +117,7 @@ public:
|
||||
virtual void afterCreate();
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
paragraph paragraph_;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
@ -130,8 +131,6 @@ private:
|
||||
_CP_OPT(bool) text_is_list_header_;
|
||||
_CP_OPT(std::wstring) text_number_;
|
||||
|
||||
paragraph paragraph_;
|
||||
|
||||
friend class par_docx_convert_class;
|
||||
|
||||
};
|
||||
@ -545,8 +544,8 @@ 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_OPT(std::wstring) text_id_; //== xml:id
|
||||
office_element_ptr element_;
|
||||
_CP_OPT(std::wstring) text_id_; //== xml:id
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(text_changed_region);
|
||||
|
||||
|
||||
@ -369,6 +369,14 @@
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/bigobj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
|
||||
@ -4206,7 +4206,7 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const CString&
|
||||
if (-1 == nIndexF)
|
||||
return S_FALSE;
|
||||
|
||||
int nIndexTail = (std::min)(strMainProps.Find(_T("<wp14:sizeRelH")), strMainProps.Find(_T("<wp14:sizeRelV")));
|
||||
int nIndexTail = strMainProps.Find(_T("<wp14:sizeRel"));
|
||||
if(-1 != nIndexTail)
|
||||
{
|
||||
strMainPropsTail = strMainProps.Right(strMainProps.GetLength() - nIndexTail);
|
||||
|
||||
@ -116,42 +116,44 @@ namespace NSGuidesVML
|
||||
ptValue = 2
|
||||
};
|
||||
|
||||
static LONG GetValue(CString strParam, ParamType& ptType, bool& bRes,
|
||||
static long GetValue(CString strParam, ParamType& ptType, bool& bRes,
|
||||
long lShapeWidth = ShapeSizeVML, long lShapeHeight = ShapeSizeVML)
|
||||
{
|
||||
ptType = ptValue;
|
||||
bRes = true;
|
||||
ptType = ptValue;
|
||||
bRes = true;
|
||||
long val = 0;
|
||||
|
||||
if ('#' == strParam[0])
|
||||
{
|
||||
ptType = ptAdjust;
|
||||
return (LONG)XmlUtils::GetInteger(strParam.Mid(1));
|
||||
val = XmlUtils::GetInteger(strParam.Mid(1));
|
||||
}
|
||||
else if ('@' == strParam[0])
|
||||
{
|
||||
ptType = ptFormula;
|
||||
return (LONG)XmlUtils::GetInteger(strParam.Mid(1));
|
||||
val = XmlUtils::GetInteger(strParam.Mid(1));
|
||||
}
|
||||
else if (!NSStringUtils::IsNumber(strParam))
|
||||
{
|
||||
if (_T("width") == strParam)
|
||||
{
|
||||
return lShapeWidth;
|
||||
val = lShapeWidth;
|
||||
}
|
||||
else if (_T("height") == strParam)
|
||||
{
|
||||
return lShapeHeight;
|
||||
val = lShapeHeight;
|
||||
}
|
||||
else if (_T("pixelWidth") == strParam)
|
||||
{
|
||||
return lShapeWidth;
|
||||
val = lShapeWidth;
|
||||
}
|
||||
else if (_T("pixelHeight") == strParam)
|
||||
{
|
||||
return lShapeHeight;
|
||||
val = lShapeHeight;
|
||||
}
|
||||
else if (_T("pixelLineWidth") == strParam || _T("lineDrawn") == strParam)
|
||||
{
|
||||
return 1;
|
||||
val = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -162,8 +164,9 @@ namespace NSGuidesVML
|
||||
else
|
||||
{
|
||||
ptType = ptValue;
|
||||
return (LONG)XmlUtils::GetInteger(strParam);
|
||||
val = XmlUtils::GetInteger(strParam);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
static FormulaType GetFormula(CString strName, bool& bRes)
|
||||
|
||||
@ -2669,6 +2669,11 @@ namespace NSGuidesVML
|
||||
{
|
||||
if (0 != m_arSlicesPath.size())
|
||||
{
|
||||
if ( lValue >= 0x7fffff00 || lValue <= -0x7fffff00)
|
||||
{
|
||||
lValue = 0; //process(2).ppt - todooo разобраться что за хрень это ваще приплыла
|
||||
}
|
||||
|
||||
m_arSlicesPath[m_arSlicesPath.size() - 1].AddParam(lValue, eParamType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,14 +324,14 @@ namespace NSBinPptxRW
|
||||
m_lFlag = 0;
|
||||
m_lGroupIndex = 0;
|
||||
m_lObjectId = 0;
|
||||
m_lObjectIdVML = 0;
|
||||
m_lObjectIdVML = 0;
|
||||
m_lObjectIdOle = 0;
|
||||
|
||||
m_bIsUseOffice2007 = false;
|
||||
m_strStyleMain = _T("");
|
||||
m_strStyleMain = _T("");
|
||||
m_strAttributesMain = _T("");
|
||||
m_strNodes = _T("");
|
||||
m_strOleXlsx = _T("");
|
||||
m_strNodes = _T("");
|
||||
m_strOleXlsx = _T("");
|
||||
|
||||
m_pOOXToVMLRenderer = NULL;
|
||||
m_bIsTop = false;
|
||||
|
||||
@ -750,5 +750,6 @@
|
||||
|
||||
#define ASC_MENU_EVENT_TYPE_AUTH_PARTICIPANTS_CHANGED 2416
|
||||
#define ASC_MENU_EVENT_TYPE_LOST_CONNECTION 2420
|
||||
#define ASC_MENU_EVENT_TYPE_DROP_CONNECTION 2421
|
||||
|
||||
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_
|
||||
|
||||
@ -529,10 +529,11 @@ namespace NSDoctRenderer
|
||||
if (js_func_get_file_s->IsFunction())
|
||||
{
|
||||
v8::Handle<v8::Function> func_get_file_s = v8::Handle<v8::Function>::Cast(js_func_get_file_s);
|
||||
int nArgument = pParams->m_nSaveToPDFParams;
|
||||
if (pParams->m_bIsOnlyOnePage)
|
||||
args[0] = v8::Int32::New(isolate, pParams->m_nSaveToPDFParams);
|
||||
else
|
||||
args[0] = v8::Int32::New(isolate, 0x0100);
|
||||
nArgument |= 0x0100;
|
||||
args[0] = v8::Int32::New(isolate, nArgument);
|
||||
|
||||
v8::Local<v8::Value> js_result2 = func_get_file_s->Call(global_js, 1, args);
|
||||
|
||||
if (try_catch.HasCaught())
|
||||
|
||||
@ -218,7 +218,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
|
||||
double dKoef1 = nRasterW / w;
|
||||
double dKoef2 = nRasterW / h;
|
||||
double dKoef2 = nRasterH / h;
|
||||
if (dKoef1 > dKoef2)
|
||||
dKoef1 = dKoef2;
|
||||
|
||||
|
||||
2
Makefile
2
Makefile
@ -226,7 +226,7 @@ endef
|
||||
|
||||
.PHONY : all bin lib clean
|
||||
|
||||
all: lib bin
|
||||
all: lib bin
|
||||
|
||||
bin: $(X2T) $(ALLFONTSGEN)
|
||||
|
||||
|
||||
@ -288,8 +288,12 @@ namespace PdfReader
|
||||
oFrame.put_Height(nHeight);
|
||||
oFrame.put_Stride(-4 * nWidth);
|
||||
|
||||
oRenderer.CreateFromBgraFrame(&oFrame);
|
||||
oRenderer.CreateFromBgraFrame(&oFrame);
|
||||
oRenderer.SetSwapRGB(false);
|
||||
|
||||
dWidth *= 25.4 / dDpiX;
|
||||
dHeight *= 25.4 / dDpiY;
|
||||
|
||||
oRenderer.put_Width(dWidth);
|
||||
oRenderer.put_Height(dHeight);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
[](http://www.gnu.org/licenses/agpl-3.0.ru.html)   
|
||||
[](http://www.gnu.org/licenses/agpl-3.0.ru.html)  
|
||||
|
||||
## Core
|
||||
Server core components which are a part of [ONLYOFFICE Document Server][2]. Enable the conversion between the most popular office document formats: DOC, DOCX, ODT, RTF, TXT, PDF, HTML, EPUB, XPS, DjVu, XLS, XLSX, ODS, CSV, PPT, PPTX, ODP.
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 2.0.2.412
|
||||
VERSION = 2.0.2.417
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
TARGET = x2t
|
||||
|
||||
@ -32,5 +32,5 @@ core_linux_32 {
|
||||
DESTDIR = $$DESTDIR/linux_32
|
||||
}
|
||||
core_mac {
|
||||
DESTDIR = $$DESTDIR/mac
|
||||
DESTDIR = $$DESTDIR/mac_64
|
||||
}
|
||||
@ -231,9 +231,9 @@ namespace NExtractTools
|
||||
}
|
||||
else return AVS_FILEUTILS_ERROR_CONVERT; }
|
||||
|
||||
return xlsx_dir2xlst_bin(sTempUnpackedXLSX, sTo, params);
|
||||
return xlsx_dir2xlst_bin(sTempUnpackedXLSX, sTo, params, true);
|
||||
}
|
||||
int xlsx_dir2xlst_bin (const std::wstring &sXlsxDir, const std::wstring &sTo, InputParams& params)
|
||||
int xlsx_dir2xlst_bin (const std::wstring &sXlsxDir, const std::wstring &sTo, InputParams& params, bool bXmlOptions)
|
||||
{
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
@ -242,7 +242,8 @@ namespace NExtractTools
|
||||
m_oCXlsxSerializer.setFontDir(sFontPath);
|
||||
|
||||
CString sTo1 = std_string2string(sTo);
|
||||
return m_oCXlsxSerializer.saveToFile (sTo1, std_string2string(sXlsxDir), std_string2string(params.getXmlOptions())) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
CString sXmlOptions = bXmlOptions ? std_string2string(params.getXmlOptions()) : L"";
|
||||
return m_oCXlsxSerializer.saveToFile (sTo1, std_string2string(sXlsxDir), sXmlOptions) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
// xslx -> xslt
|
||||
@ -697,6 +698,26 @@ namespace NExtractTools
|
||||
NSFile::CFileBinary::Remove(sPdfBinFile);
|
||||
return nRes;
|
||||
}
|
||||
std::wstring getExtentionByRasterFormat(int format)
|
||||
{
|
||||
std::wstring sExt;
|
||||
switch(format)
|
||||
{
|
||||
case 1:
|
||||
sExt = L".bmp";
|
||||
break;
|
||||
case 2:
|
||||
sExt = L".gif";
|
||||
break;
|
||||
case 3:
|
||||
sExt = L".jpg";
|
||||
break;
|
||||
default:
|
||||
sExt = L".png";
|
||||
break;
|
||||
}
|
||||
return sExt;
|
||||
}
|
||||
//doct_bin -> image
|
||||
int doct_bin2image(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bPaid, const std::wstring &sThemeDir, InputParams& params)
|
||||
{
|
||||
@ -756,9 +777,7 @@ namespace NExtractTools
|
||||
{
|
||||
sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails");
|
||||
FileSystem::Directory::CreateDirectory(sThumbnailDir);
|
||||
std::wstring::size_type pos = sTo.find_last_of('.');
|
||||
std::wstring sExt = std::wstring::npos == pos ? L"" : sTo.substr(pos);
|
||||
imageWriter.m_sFileName = sThumbnailDir + FILE_SEPARATOR_STR + L"image" + sExt;
|
||||
imageWriter.m_sFileName = sThumbnailDir + FILE_SEPARATOR_STR + L"image" + getExtentionByRasterFormat(imageWriter.m_nRasterFormat);
|
||||
}
|
||||
BYTE* pData;
|
||||
DWORD nBytesCount;
|
||||
@ -1777,9 +1796,7 @@ namespace NExtractTools
|
||||
{
|
||||
sThumbnailDir = sTemp + FILE_SEPARATOR_STR + _T("thumbnails");
|
||||
FileSystem::Directory::CreateDirectory(sThumbnailDir);
|
||||
std::wstring::size_type pos = sTo.find_last_of('.');
|
||||
|
||||
sFileToExt = std::wstring::npos == pos ? L"" : sTo.substr(pos);
|
||||
sFileToExt = getExtentionByRasterFormat(nRasterFormat);
|
||||
}
|
||||
int nPagesCount = pReader->GetPagesCount();
|
||||
if (bIsOnlyFirst)
|
||||
@ -1796,7 +1813,7 @@ namespace NExtractTools
|
||||
pReader->GetPageInfo(i, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY);
|
||||
|
||||
double dKoef1 = nRasterWCur / dWidth;
|
||||
double dKoef2 = nRasterWCur / dHeight;
|
||||
double dKoef2 = nRasterHCur / dHeight;
|
||||
if (dKoef1 > dKoef2)
|
||||
dKoef1 = dKoef2;
|
||||
|
||||
@ -1908,7 +1925,7 @@ namespace NExtractTools
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo)
|
||||
else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
|
||||
{
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::DOCT;
|
||||
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||
@ -2036,11 +2053,11 @@ namespace NExtractTools
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_OTHER_JSON == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params);
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params, true);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params);
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2048,9 +2065,9 @@ namespace NExtractTools
|
||||
FileSystem::Directory::CreateDirectory(sXlstDir);
|
||||
std::wstring sTFile = sXlstDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatTo)
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params);
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params, false);
|
||||
else
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params);
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params, true);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = fromXlstBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
||||
@ -2075,7 +2092,7 @@ namespace NExtractTools
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST;
|
||||
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo)
|
||||
else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
|
||||
{
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST;
|
||||
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||
@ -2204,7 +2221,7 @@ namespace NExtractTools
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::PPTT;
|
||||
nRes = doct_bin2pdf(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo)
|
||||
else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
|
||||
{
|
||||
NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::PPTT;
|
||||
nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params);
|
||||
@ -2334,7 +2351,7 @@ namespace NExtractTools
|
||||
oHtmlRenderer.CloseFile();
|
||||
RELEASEOBJECT(pReader);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_IMAGE == nFormatTo)
|
||||
else if(0 != (AVS_OFFICESTUDIO_FILE_IMAGE & nFormatTo))
|
||||
{
|
||||
IOfficeDrawingFile* pReader = NULL;
|
||||
nRes = PdfDjvuXpsToImage(&pReader, sFrom, nFormatFrom, sTo, sTemp, params, &oApplicationFonts);
|
||||
|
||||
@ -56,7 +56,7 @@ namespace NExtractTools
|
||||
int doct2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
|
||||
|
||||
int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
|
||||
int xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
|
||||
int xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params, bool bXmlOptions);
|
||||
int xlsx2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
|
||||
int xlst_bin2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
|
||||
int xlst_bin2xlsx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
|
||||
|
||||
@ -293,6 +293,10 @@ namespace NExtractTools
|
||||
}
|
||||
oBuilder.WriteString(_T("</Changes>"));
|
||||
oBuilder.WriteString(sMailMerge);
|
||||
if (NULL != params.m_oThumbnail && (NULL == params.m_oThumbnail->first || true == *params.m_oThumbnail->first))
|
||||
{
|
||||
oBuilder.WriteString(_T("<OnlyOnePage>1</OnlyOnePage>"));
|
||||
}
|
||||
oBuilder.WriteString(_T("</Settings>"));
|
||||
return oBuilder.GetData();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user