mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
12 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 49723e648a | |||
| b0a2104b21 | |||
| e4986f4202 | |||
| de51052f6a | |||
| bd1dc5a7b6 | |||
| 1ccbe323f4 | |||
| 2c8efcb183 | |||
| 9c2a717870 | |||
| 3811169415 | |||
| 2871769479 | |||
| 185dc3064f | |||
| c6f8a1cde8 |
@ -135,9 +135,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
page_break_ (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),
|
||||
in_table_content_ (false),
|
||||
@ -148,7 +146,6 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
|
||||
new_list_style_number_ (0),
|
||||
current_margin_left_ (0),
|
||||
is_rtl_ (false),
|
||||
is_paragraph_keep_ (false),
|
||||
is_delete_text_ (false),
|
||||
delayed_converting_ (false),
|
||||
process_headers_footers_ (false),
|
||||
@ -200,14 +197,14 @@ std::wstring styles_map::name(const std::wstring & Name, odf_types::style_family
|
||||
}
|
||||
void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
{
|
||||
if (!in_run_)
|
||||
if (!state_.in_run_)
|
||||
{
|
||||
in_run_ = true;
|
||||
state_.in_run_ = true;
|
||||
output_stream() << L"<w:r>";
|
||||
|
||||
if (!text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
if (!state_.text_properties_stack_.empty() || parenStyleId.length() > 0)
|
||||
{
|
||||
if (!text_properties_stack_.empty())
|
||||
if (!state_.text_properties_stack_.empty())
|
||||
{
|
||||
odf_reader::style_text_properties_ptr textProp = this->current_text_properties();
|
||||
get_styles_context().start();
|
||||
@ -225,36 +222,36 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
|
||||
|
||||
void docx_conversion_context::start_paragraph(bool is_header)
|
||||
{
|
||||
if (in_paragraph_)
|
||||
if (state_.in_paragraph_)
|
||||
finish_paragraph();
|
||||
|
||||
output_stream() << L"<w:p>";
|
||||
|
||||
in_header_ = is_header;
|
||||
in_paragraph_ = true;
|
||||
is_rtl_ = false;
|
||||
|
||||
state_.in_paragraph_ = true;
|
||||
start_changes();
|
||||
}
|
||||
|
||||
void docx_conversion_context::finish_paragraph()
|
||||
{
|
||||
if (in_paragraph_)
|
||||
if (state_.in_paragraph_)
|
||||
{
|
||||
end_changes();
|
||||
|
||||
output_stream() << L"</w:p>";
|
||||
}
|
||||
|
||||
in_paragraph_ = false;
|
||||
in_header_ = false;
|
||||
is_paragraph_keep_ = false;
|
||||
in_header_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
state_.in_paragraph_ = false;
|
||||
}
|
||||
|
||||
|
||||
void docx_conversion_context::finish_run()
|
||||
{
|
||||
if (false == in_run_) return;
|
||||
if (false == state_.in_run_) return;
|
||||
|
||||
if (get_comments_context().state() == 4)
|
||||
{
|
||||
@ -262,7 +259,7 @@ void docx_conversion_context::finish_run()
|
||||
get_comments_context().state(0);
|
||||
}
|
||||
output_stream() << L"</w:r>";
|
||||
in_run_ = false;
|
||||
state_.in_run_ = false;
|
||||
|
||||
if (get_comments_context().state() == 2)
|
||||
{
|
||||
@ -584,6 +581,22 @@ oox_chart_context & docx_conversion_context::current_chart()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
void docx_conversion_context::reset_context_state()
|
||||
{
|
||||
keep_state_.push_back(state_);
|
||||
|
||||
state_.in_paragraph_ = false;
|
||||
state_.in_run_ = false;
|
||||
state_.is_paragraph_keep_ = false;
|
||||
|
||||
state_.text_properties_stack_.clear();
|
||||
}
|
||||
void docx_conversion_context::back_context_state()
|
||||
{
|
||||
state_ = keep_state_.back();
|
||||
keep_state_.pop_back();
|
||||
}
|
||||
|
||||
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
|
||||
{
|
||||
finish_run();
|
||||
@ -999,13 +1012,36 @@ void docx_conversion_context::process_styles()
|
||||
_Wostream << L"<w:pPrDefault>";
|
||||
if ( odf_reader::style_content * content = defaultParStyle->content())
|
||||
{
|
||||
if (content->get_style_paragraph_properties())
|
||||
{
|
||||
if(content->get_style_paragraph_properties()->content_.fo_background_color_)
|
||||
{
|
||||
odf_types::background_color color = *content->get_style_paragraph_properties()->content_.fo_background_color_;
|
||||
if ((color.get_type() != odf_types::background_color::Transparent &&
|
||||
color.get_color() == odf_types::color(L"ffffff")) ||
|
||||
(color.get_type() == odf_types::background_color::Transparent))
|
||||
{
|
||||
content->get_style_paragraph_properties()->content_.fo_background_color_ = boost::none;
|
||||
}
|
||||
}
|
||||
}
|
||||
get_styles_context().start_process_style(defaultParStyle);
|
||||
content->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
_Wostream << L"</w:pPrDefault>";
|
||||
}
|
||||
|
||||
if (odf_reader::style_instance * defaultParStyle = styles.style_default_by_type(odf_types::style_family::Text))
|
||||
{
|
||||
_Wostream << L"<w:rPrDefault>";
|
||||
if ( odf_reader::style_content * content = defaultParStyle->content())
|
||||
{
|
||||
get_styles_context().start_process_style(defaultParStyle);
|
||||
content->docx_convert(*this);
|
||||
get_styles_context().end_process_style();
|
||||
}
|
||||
_Wostream << L"</w:rPrDefault>";
|
||||
}
|
||||
_Wostream << L"</w:docDefaults>";
|
||||
|
||||
for (size_t i = 0; i < arStyles.size(); i++)
|
||||
@ -1305,22 +1341,22 @@ bool docx_conversion_context::in_automatic_style()
|
||||
|
||||
void docx_conversion_context::push_text_properties(const odf_reader::style_text_properties * TextProperties)
|
||||
{
|
||||
text_properties_stack_.push_back(TextProperties);
|
||||
state_.text_properties_stack_.push_back(TextProperties);
|
||||
}
|
||||
|
||||
void docx_conversion_context::pop_text_properties()
|
||||
{
|
||||
text_properties_stack_.pop_back();
|
||||
state_.text_properties_stack_.pop_back();
|
||||
}
|
||||
|
||||
odf_reader::style_text_properties_ptr docx_conversion_context::current_text_properties()
|
||||
{
|
||||
odf_reader::style_text_properties_ptr cur = boost::make_shared<odf_reader::style_text_properties>();
|
||||
|
||||
for (size_t i = 0; i < text_properties_stack_.size(); i++)
|
||||
for (size_t i = 0; i < state_.text_properties_stack_.size(); i++)
|
||||
{
|
||||
if (text_properties_stack_[i])
|
||||
cur->content().apply_from( text_properties_stack_[i]->content() );
|
||||
if (state_.text_properties_stack_[i])
|
||||
cur->content().apply_from( state_.text_properties_stack_[i]->content() );
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
@ -1895,7 +1931,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id)
|
||||
|
||||
map_current_changes_.insert(std::pair<std::wstring, text_tracked_context::_state> (id, state_add));
|
||||
|
||||
if (in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
if (state_.in_paragraph_ && ( state_add.type == 1 || state_add.type == 2 ))
|
||||
{
|
||||
map_changes_iterator it = map_current_changes_.find(id);
|
||||
text_tracked_context::_state &state = it->second;
|
||||
@ -2067,7 +2103,7 @@ void docx_conversion_context::end_text_changes (const std::wstring &id)
|
||||
|
||||
if (state.active)
|
||||
{
|
||||
if (in_paragraph_)
|
||||
if (state_.in_paragraph_)
|
||||
finish_run();
|
||||
|
||||
if (state.type == 1) output_stream() << L"</w:ins>";
|
||||
|
||||
@ -756,9 +756,7 @@ public:
|
||||
|
||||
void add_element_to_run (std::wstring parenStyleId = _T(""));
|
||||
void finish_run ();
|
||||
void add_new_run (std::wstring parentStyleId = _T(""));
|
||||
bool get_run_state () { return in_run_; }
|
||||
void set_run_state (bool Val) { in_run_ = Val; }
|
||||
void add_new_run (std::wstring parentStyleId = _T(""));
|
||||
|
||||
void start_paragraph (bool is_header = false);
|
||||
void finish_paragraph ();
|
||||
@ -766,10 +764,18 @@ public:
|
||||
bool is_alphabetical_index () { return false == mapAlphabeticals.empty();}
|
||||
bool is_table_content () { return in_table_content_; }
|
||||
bool is_paragraph_header () { return in_header_; }
|
||||
bool get_paragraph_state () { return in_paragraph_; }
|
||||
void set_paragraph_state (bool val) { in_paragraph_ = val; }
|
||||
bool get_paragraph_keep () { return is_paragraph_keep_;}
|
||||
void set_paragraph_keep (bool val) { is_paragraph_keep_ = val; }
|
||||
|
||||
void reset_context_state();
|
||||
void back_context_state();
|
||||
|
||||
bool get_run_state () { return state_.in_run_; }
|
||||
void set_run_state (bool Val) { state_.in_run_ = Val; }
|
||||
|
||||
bool get_paragraph_state () { return state_.in_paragraph_; }
|
||||
void set_paragraph_state (bool val) { state_.in_paragraph_ = val; }
|
||||
|
||||
bool get_paragraph_keep () { return state_.is_paragraph_keep_;}
|
||||
void set_paragraph_keep (bool val) { state_.is_paragraph_keep_ = val; }
|
||||
|
||||
bool get_delete_text_state () { return is_delete_text_; }
|
||||
void set_delete_text_state (bool Val) { is_delete_text_ = Val; }
|
||||
@ -949,6 +955,17 @@ public:
|
||||
|
||||
void add_jsaProject(const std::string &content);
|
||||
private:
|
||||
|
||||
struct _context_state
|
||||
{
|
||||
bool in_paragraph_ = false;
|
||||
bool in_run_ = false;
|
||||
bool is_paragraph_keep_ = false;
|
||||
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
}state_;
|
||||
std::vector<_context_state> keep_state_;
|
||||
|
||||
std::wstringstream document_xml_;
|
||||
std::wstringstream styles_xml_;
|
||||
std::wstringstream fontTable_xml_;
|
||||
@ -1004,12 +1021,10 @@ private:
|
||||
bool in_automatic_style_;
|
||||
bool in_drawing_content_;
|
||||
bool in_table_content_;
|
||||
bool in_paragraph_;
|
||||
bool in_run_;
|
||||
|
||||
bool in_header_;
|
||||
bool is_delete_text_;
|
||||
bool is_rtl_; // right-to-left
|
||||
bool is_paragraph_keep_;
|
||||
|
||||
std::wstring current_alphabetic_index_;
|
||||
int current_margin_left_;
|
||||
@ -1018,7 +1033,6 @@ private:
|
||||
|
||||
std::vector<odf_reader::office_element*> delayed_elements_;
|
||||
|
||||
std::vector< 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_;// цепочки переименований нумераций
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (values_[i].strRef_.present > 0 && !bLocalTable_)
|
||||
else if (values_[i].strRef_.present && !bLocalTable_)
|
||||
{
|
||||
CP_XML_NODE(L"c:strRef")
|
||||
{
|
||||
|
||||
@ -282,7 +282,7 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
|
||||
|
||||
odf_reader::text_list_style * text_list_style = odf_context_.listStyleContainer().list_style_by_name(list_style_stack_.back());
|
||||
|
||||
if ((text_list_style) && (Level < text_list_style->get_content().size()))
|
||||
if ((text_list_style) && (Level < (int)text_list_style->get_content().size()))
|
||||
{
|
||||
odf_reader::office_element_ptr elm = text_list_style->get_content()[Level];
|
||||
odf_reader::office_element_ptr elm_list;
|
||||
|
||||
@ -232,11 +232,7 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
Context.get_math_context().base_font_size_ = baseFontHeight_;
|
||||
|
||||
@ -246,9 +242,9 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
|
||||
Context.set_stream_man (prev);
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.back_context_state();
|
||||
}
|
||||
else if(object_type_ == 4 && office_spreadsheet_)
|
||||
{
|
||||
|
||||
@ -312,7 +312,7 @@ std::wstring draw_object_ole::detectObject(const std::wstring &fileName)
|
||||
//skip the CompObjHeader
|
||||
pStream->seek(28);
|
||||
|
||||
int sz_obj = pStream->size() - 28;
|
||||
int sz_obj = (int)pStream->size() - 28;
|
||||
|
||||
std::vector<std::string> str;
|
||||
|
||||
|
||||
@ -1072,10 +1072,10 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
//Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
Context.set_run_state (runState);
|
||||
//Context.set_paragraph_state (false);
|
||||
|
||||
bool new_run = false;
|
||||
|
||||
@ -1107,7 +1107,8 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_paragraph_state(paraState);
|
||||
//Context.set_paragraph_state(paraState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().stop_shape();
|
||||
}
|
||||
@ -1143,19 +1144,14 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool runState = Context.get_run_state ();
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
@ -1209,13 +1205,8 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
bool keepState = Context.get_paragraph_keep ();
|
||||
Context.reset_context_state();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
Context.set_drawing_state_content(true);
|
||||
@ -1228,10 +1219,8 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().get_text_stream_frame() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
Context.back_context_state();
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -1356,11 +1345,7 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(drawing.content_group_);
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
bool pState = Context.get_paragraph_state ();
|
||||
bool runState = Context.get_run_state ();
|
||||
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -1369,9 +1354,9 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
drawing.content_group_ = temp_stream.str();
|
||||
|
||||
Context.set_stream_man (prev);
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_stream_man(prev);
|
||||
Context.back_context_state();
|
||||
|
||||
//--------------------------------------------------
|
||||
Context.get_drawing_context().get_size_group (drawing.cx , drawing.cy);
|
||||
Context.get_drawing_context().get_position_group(drawing.x , drawing.y);
|
||||
@ -1404,8 +1389,8 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
//--------------------------------------------------
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
runState = Context.get_run_state();
|
||||
pState = Context.get_paragraph_state();
|
||||
bool runState = Context.get_run_state();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !pState)
|
||||
{
|
||||
@ -1466,10 +1451,8 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
bool runState = Context.get_run_state();
|
||||
bool paraState = Context.get_paragraph_state();
|
||||
bool keepState = Context.get_paragraph_keep();
|
||||
|
||||
Context.set_run_state (false);
|
||||
Context.set_paragraph_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
if (!Context.get_drawing_context().in_group() && !runState)
|
||||
{
|
||||
@ -1491,9 +1474,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (paraState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().stop_frame();
|
||||
}
|
||||
@ -1578,6 +1559,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
|
||||
const std::wstring & content = Context.get_drawing_context().get_text_stream_frame();
|
||||
|
||||
bool in_frame = !drawing->isInline;
|
||||
|
||||
bool runState = Context.get_run_state();
|
||||
bool pState = Context.get_paragraph_state();
|
||||
|
||||
@ -1697,12 +1679,7 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
|
||||
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
|
||||
|
||||
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);
|
||||
Context.reset_context_state();
|
||||
|
||||
bool drState = Context.get_drawing_state_content();
|
||||
|
||||
@ -1740,10 +1717,9 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
Context.set_run_state (runState);
|
||||
Context.set_paragraph_state (pState);
|
||||
Context.set_drawing_state_content (drState);
|
||||
Context.set_paragraph_keep (keepState);
|
||||
|
||||
Context.back_context_state();
|
||||
|
||||
const std::wstring & content = Context.get_drawing_context().get_text_stream_shape();
|
||||
|
||||
@ -1763,9 +1739,9 @@ void draw_control::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
pState = Context.get_paragraph_state();
|
||||
runState = Context.get_run_state();
|
||||
keepState = Context.get_paragraph_keep();
|
||||
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);
|
||||
|
||||
@ -90,11 +90,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
bool pParaState = Context.get_paragraph_state();
|
||||
bool pRunState = Context.get_run_state();
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
Context.reset_context_state();
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -106,8 +102,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
Context.set_paragraph_state(pParaState);
|
||||
Context.set_run_state(pRunState);
|
||||
Context.back_context_state();
|
||||
|
||||
Context.get_drawing_context().get_text_stream_shape() = temp_stream.str();
|
||||
Context.set_stream_man(prev);
|
||||
|
||||
@ -230,7 +230,7 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
|
||||
{
|
||||
double kf_max_width_ms = 1.;
|
||||
|
||||
int val = 0.5 + 20.0 * page_width;
|
||||
int val = (int)(0.5 + 20.0 * page_width);
|
||||
if (val > 31680.)
|
||||
kf_max_width_ms = 31680./val;
|
||||
|
||||
@ -259,7 +259,7 @@ void style_table_column_properties::pptx_convert(oox::pptx_conversion_context &
|
||||
|
||||
if (attlist_.style_column_width_)
|
||||
{
|
||||
int val = attlist_.style_column_width_->get_value_unit(length::emu);
|
||||
int val = (int)attlist_.style_column_width_->get_value_unit(length::emu);
|
||||
|
||||
strm << L"<a:gridCol w=\"" << val << "\"/>";
|
||||
}
|
||||
|
||||
@ -1244,7 +1244,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
|
||||
Context.get_drop_cap_context().Scale + (Context.get_drop_cap_context().Scale-1) * 0.7);//вместо 1 ДОЛЖНОБЫТЬ коэфф. межстрочного интервала!!!
|
||||
|
||||
if (fontSize < 1)
|
||||
fontSize = Context.get_drop_cap_context().FontSize / 7.52;
|
||||
fontSize = (int)(Context.get_drop_cap_context().FontSize / 7.52);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -984,7 +984,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
|
||||
|
||||
if (fo_page_width_)
|
||||
{
|
||||
int val = 0.5 + 20.0 * fo_page_width_->get_value_unit(length::pt);
|
||||
int val = (int)( 0.5 + 20.0 * fo_page_width_->get_value_unit(length::pt) );
|
||||
if (val > 31680)
|
||||
{
|
||||
//Context.set_settings_property(odf_reader::_property(L"UnormalWidthPage",val));
|
||||
@ -994,7 +994,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
|
||||
}
|
||||
if (fo_page_height_)
|
||||
{
|
||||
int val = 0.5 + 20.0 * fo_page_height_->get_value_unit(length::pt);
|
||||
int val = (int)( 0.5 + 20.0 * fo_page_height_->get_value_unit(length::pt));
|
||||
if (val > 31680) val =31680;//22"
|
||||
w_h = std::to_wstring(val);
|
||||
|
||||
@ -1141,12 +1141,12 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
|
||||
int val_step = 0;
|
||||
if (style_layout_grid_base_height_ && style_layout_grid_ruby_height_)
|
||||
{
|
||||
val_step = 0.5 + 20. * style_layout_grid_ruby_height_->get_value_unit(odf_types::length::pt)
|
||||
+ 20. * style_layout_grid_base_height_->get_value_unit(odf_types::length::pt);
|
||||
val_step = (int)(0.5 + 20. * style_layout_grid_ruby_height_->get_value_unit(odf_types::length::pt)
|
||||
+ 20. * style_layout_grid_base_height_->get_value_unit(odf_types::length::pt));
|
||||
}
|
||||
else if (style_layout_grid_lines_ && height_page > 0)
|
||||
{
|
||||
val_step = height_page / (*style_layout_grid_lines_);
|
||||
val_step = (int)(height_page / (*style_layout_grid_lines_));
|
||||
}
|
||||
|
||||
if (val_step > 0)CP_XML_ATTR(L"w:linePitch", val_step);
|
||||
|
||||
@ -761,7 +761,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
double s;
|
||||
if (oox::parseTime(tv, h, m, s))
|
||||
{
|
||||
boost::int64_t intTime = oox::convertTime(h, m, s);
|
||||
boost::int64_t intTime = (boost::int64_t)oox::convertTime(h, m, s);
|
||||
if (intTime > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intTime);
|
||||
|
||||
@ -189,6 +189,8 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
|
||||
if (str_start > store_str.length()) str_start = store_str.length(); // это если на буквы в буквице разные стили
|
||||
|
||||
str = store_str.substr(str_start, str_size);
|
||||
|
||||
if (textStyle==1) Context.pop_text_properties();
|
||||
}
|
||||
|
||||
size_t paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
@ -407,6 +407,7 @@ void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
|
||||
CP_XML_ATTR_OPT(L"draw:type", draw_type_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:sub-view-size", draw_sub_view_size_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
|
||||
CP_XML_ATTR_OPT(L"draw:text-rotate-angle", draw_text_rotate_angle_);
|
||||
CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_);
|
||||
CP_XML_ATTR_OPT(L"drawooo:enhanced-path", draw_enhanced_path_);
|
||||
//CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
|
||||
@ -430,7 +431,7 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
|
||||
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < draw_equation_.size(); i++)
|
||||
{
|
||||
|
||||
@ -331,6 +331,8 @@ public:
|
||||
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
|
||||
_CP_OPT(std::wstring) draw_text_path_mode_;
|
||||
_CP_OPT(std::wstring) draw_text_path_scale_;
|
||||
|
||||
_CP_OPT(int) draw_text_rotate_angle_;
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
@ -350,7 +352,7 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_;
|
||||
draw_enhanced_geometry_attlist attlist_;
|
||||
|
||||
_CP_OPT(std::wstring) svg_viewbox_;
|
||||
|
||||
|
||||
@ -186,6 +186,7 @@ struct odf_drawing_state
|
||||
presentation_placeholder_ = boost::none;
|
||||
|
||||
rotateAngle_ = boost::none;
|
||||
text_rotateAngle_ = boost::none;
|
||||
|
||||
path_ = L"";
|
||||
view_box_ = L"";
|
||||
@ -218,6 +219,7 @@ struct odf_drawing_state
|
||||
|
||||
_CP_OPT(double) rotateAngle_;
|
||||
_CP_OPT(unsigned int) fill_color_;
|
||||
_CP_OPT(int) text_rotateAngle_;
|
||||
|
||||
_CP_OPT(presentation_class) presentation_class_;
|
||||
_CP_OPT(std::wstring) presentation_placeholder_;
|
||||
@ -232,6 +234,7 @@ struct odf_drawing_state
|
||||
int oox_shape_preset_;
|
||||
bool in_group_;
|
||||
bool text_box_tableframe_;
|
||||
|
||||
};
|
||||
|
||||
class odf_drawing_context::Impl
|
||||
@ -536,7 +539,7 @@ void odf_drawing_context::end_drawing()
|
||||
if (impl_->current_drawing_state_.rotateAngle_)
|
||||
rotate += *impl_->current_drawing_state_.rotateAngle_;
|
||||
|
||||
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
|
||||
if (fabs(rotate) > 0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
|
||||
}
|
||||
double x = impl_->current_drawing_state_.svg_x_ ? impl_->current_drawing_state_.svg_x_->get_value() : 0;
|
||||
double y = impl_->current_drawing_state_.svg_y_ ? impl_->current_drawing_state_.svg_y_->get_value() : 0;
|
||||
@ -615,8 +618,8 @@ void odf_drawing_context::end_drawing()
|
||||
draw_enhanced_geometry* enhan = dynamic_cast<draw_enhanced_geometry*>(custom->draw_enhanced_geometry_.get());
|
||||
if(enhan)
|
||||
{
|
||||
if (impl_->current_drawing_state_.flipV_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
|
||||
if (impl_->current_drawing_state_.flipH_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
|
||||
if (impl_->current_drawing_state_.flipV_) enhan->attlist_.draw_mirror_vertical_ = true;
|
||||
if (impl_->current_drawing_state_.flipH_) enhan->attlist_.draw_mirror_horizontal_ = true;
|
||||
}
|
||||
}else
|
||||
{
|
||||
@ -986,15 +989,17 @@ void odf_drawing_context::end_shape()
|
||||
{
|
||||
if (text_shape)
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_same_letter_heights_ = false;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_scale_ = L"path" ;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_mode_ = L"shape" ;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_ = true;
|
||||
enhanced->attlist_.draw_text_path_same_letter_heights_ = false;
|
||||
enhanced->attlist_.draw_text_path_scale_ = L"path" ;
|
||||
enhanced->attlist_.draw_text_path_mode_ = L"shape" ;
|
||||
enhanced->attlist_.draw_text_path_ = true;
|
||||
|
||||
enhanced->attlist_.draw_text_rotate_angle_ = impl_->current_drawing_state_.text_rotateAngle_;
|
||||
}
|
||||
|
||||
if (!impl_->current_drawing_state_.path_.empty())
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
|
||||
enhanced->attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
|
||||
}
|
||||
if (!impl_->current_drawing_state_.view_box_.empty())
|
||||
{
|
||||
@ -1002,7 +1007,7 @@ void odf_drawing_context::end_shape()
|
||||
}
|
||||
if (!sub_type.empty())
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = sub_type;
|
||||
enhanced->attlist_.draw_type_ = sub_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1018,23 +1023,23 @@ void odf_drawing_context::end_shape()
|
||||
else
|
||||
enhanced->svg_viewbox_ = shape_define->view_box;
|
||||
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
|
||||
enhanced->attlist_.draw_type_ = shape_define->odf_type_name;
|
||||
enhanced->attlist_.draw_text_areas_ = shape_define->text_areas;
|
||||
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_glue_points_ = shape_define->glue_points;
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
|
||||
enhanced->attlist_.draw_glue_points_ = shape_define->glue_points;
|
||||
enhanced->attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_ && !impl_->current_drawing_state_.oox_shape_->modifiers.empty())
|
||||
{
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
|
||||
enhanced->attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
|
||||
}
|
||||
else // обязательно нужны дефолтовые
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = shape_define->modifiers;
|
||||
enhanced->attlist_.draw_modifiers_ = shape_define->modifiers;
|
||||
|
||||
if (!shape_define->enhanced_path.empty())
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
|
||||
enhanced->attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
|
||||
else
|
||||
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
|
||||
enhanced->attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
|
||||
|
||||
for (size_t i = 0; i < shape_define->equations.size(); i++)
|
||||
{
|
||||
@ -1074,6 +1079,18 @@ void odf_drawing_context::end_shape()
|
||||
}
|
||||
end_element();
|
||||
}
|
||||
if (impl_->current_drawing_state_.flipV_)
|
||||
{
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
|
||||
}
|
||||
if (impl_->current_drawing_state_.flipH_)
|
||||
{
|
||||
if (impl_->current_graphic_properties->style_mirror_)
|
||||
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
|
||||
else
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
|
||||
}
|
||||
|
||||
end_element();
|
||||
}
|
||||
|
||||
@ -1346,7 +1363,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
|
||||
switch(impl_->current_drawing_part_)
|
||||
{
|
||||
case Area:
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
|
||||
//impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = color(hexColor); - default transparent
|
||||
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
|
||||
|
||||
@ -1599,26 +1616,10 @@ void odf_drawing_context::set_viewBox (double W, double H)
|
||||
void odf_drawing_context::set_flip_H(bool bVal)
|
||||
{
|
||||
impl_->current_drawing_state_.flipH_ = bVal;
|
||||
|
||||
if (impl_->current_graphic_properties == NULL) return;
|
||||
if (bVal == false)return;
|
||||
//for image
|
||||
if (impl_->current_graphic_properties->style_mirror_)
|
||||
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
|
||||
else
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
|
||||
}
|
||||
void odf_drawing_context::set_flip_V(bool bVal)
|
||||
{
|
||||
impl_->current_drawing_state_.flipV_ = bVal;
|
||||
|
||||
if (impl_->current_graphic_properties == NULL) return;
|
||||
if (bVal == false)return;
|
||||
//for image
|
||||
if (impl_->current_graphic_properties->style_mirror_)
|
||||
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" vertical");
|
||||
else
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_rotate(double dVal)
|
||||
@ -1658,7 +1659,7 @@ void odf_drawing_context::set_object_background(bool Val)
|
||||
if (Val)
|
||||
{
|
||||
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
|
||||
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
|
||||
//impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
|
||||
}
|
||||
}
|
||||
void odf_drawing_context::set_object_foreground(bool Val)
|
||||
@ -1673,7 +1674,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
|
||||
{
|
||||
impl_->anchor_settings_.run_through_ = run_through(run_through::Foreground);
|
||||
}
|
||||
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
|
||||
//impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1798,9 +1799,15 @@ void odf_drawing_context::set_default_wrap_style()
|
||||
}
|
||||
void odf_drawing_context::set_wrap_style(style_wrap::type type)
|
||||
{
|
||||
|
||||
impl_->anchor_settings_.style_wrap_ = style_wrap(type);
|
||||
}
|
||||
void odf_drawing_context::set_wrap_contour()
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
|
||||
impl_->current_graphic_properties->style_wrap_contour_ = true;
|
||||
impl_->current_graphic_properties->style_wrap_contour_mode_ = wrap_contour_mode(wrap_contour_mode::Full);
|
||||
}
|
||||
void odf_drawing_context::set_overlap (bool val)
|
||||
{
|
||||
if (val)
|
||||
@ -2272,6 +2279,33 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
|
||||
if (mode == 1) return;//незачем
|
||||
if (impl_->current_drawing_state_.elements_.empty())return;
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case 5://textverticaltypeWordArtVert:
|
||||
case 6://textverticaltypeWordArtVertRtl:
|
||||
case 3://SimpleTypes::textverticaltypeVert:
|
||||
case 2://SimpleTypes::textverticaltypeMongolianVert:
|
||||
case 0://SimpleTypes::textverticaltypeEaVert:
|
||||
impl_->current_drawing_state_.rotateAngle_ = 90. / 180. * 3.14159265358979323846;
|
||||
break;
|
||||
case 4://SimpleTypes::textverticaltypeVert270:
|
||||
impl_->current_drawing_state_.rotateAngle_ = 270. / 180. * 3.14159265358979323846;
|
||||
break;
|
||||
case 1://SimpleTypes::textverticaltypeHorz:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.flipH_ && impl_->current_drawing_state_.rotateAngle_ )
|
||||
{
|
||||
impl_->current_drawing_state_.rotateAngle_ = - *impl_->current_drawing_state_.rotateAngle_;
|
||||
impl_->current_drawing_state_.flipH_ = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!impl_->current_paragraph_properties)
|
||||
{
|
||||
style* style_ = dynamic_cast<style*>(impl_->current_drawing_state_.elements_[0].style_elm.get());
|
||||
@ -2477,6 +2511,12 @@ void odf_drawing_context::start_text_box()
|
||||
}
|
||||
void odf_drawing_context::set_text_box_min_size(bool val)
|
||||
{
|
||||
if (impl_->current_graphic_properties)
|
||||
{
|
||||
impl_->current_graphic_properties->draw_auto_grow_height_ = true;
|
||||
impl_->current_graphic_properties->draw_auto_grow_width_ = true;
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
|
||||
draw_text_box* draw = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
|
||||
@ -2641,7 +2681,13 @@ void odf_drawing_context::end_image()
|
||||
end_shape();
|
||||
return;
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.flipH_)
|
||||
{
|
||||
if (impl_->current_graphic_properties->style_mirror_)
|
||||
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
|
||||
else
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
|
||||
}
|
||||
end_element();
|
||||
end_frame();
|
||||
}
|
||||
@ -2789,7 +2835,8 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
|
||||
}
|
||||
}
|
||||
|
||||
if (impl_->current_graphic_properties)
|
||||
if ((impl_->current_graphic_properties) &&
|
||||
!impl_->current_graphic_properties->draw_auto_grow_height_)
|
||||
{
|
||||
//автоувеличение при добавлении текста
|
||||
impl_->current_graphic_properties->draw_auto_grow_height_ = false;
|
||||
@ -2854,10 +2901,20 @@ void odf_drawing_context::start_gradient_style()
|
||||
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
|
||||
|
||||
gradient->draw_border_ = 0;
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
|
||||
|
||||
|
||||
switch(impl_->current_drawing_part_)
|
||||
{
|
||||
case Area:
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
|
||||
break;
|
||||
case Line:
|
||||
if (!impl_->current_graphic_properties->draw_stroke_)
|
||||
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::Solid);//default
|
||||
if (!impl_->current_graphic_properties->svg_stroke_width_)
|
||||
impl_->current_graphic_properties->svg_stroke_width_ = length(length(1, length::pt).get_value_unit(length::cm), length::cm);//default
|
||||
break;
|
||||
}
|
||||
}
|
||||
void odf_drawing_context::set_gradient_type(gradient_style::type style)
|
||||
{
|
||||
@ -2876,6 +2933,11 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
|
||||
|
||||
gradient->draw_start_color_ = hexColor;
|
||||
gradient->draw_start_intensity_ = 100.;
|
||||
|
||||
if (impl_->current_drawing_part_ == Line)
|
||||
{
|
||||
impl_->current_graphic_properties->svg_stroke_color_ = hexColor;
|
||||
}
|
||||
}
|
||||
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
|
||||
{
|
||||
|
||||
@ -93,7 +93,9 @@ public:
|
||||
void set_horizontal_pos (double offset_pt);
|
||||
|
||||
void set_default_wrap_style();
|
||||
void set_wrap_style (odf_types::style_wrap::type style);
|
||||
void set_wrap_style(odf_types::style_wrap::type style);
|
||||
void set_wrap_contour();
|
||||
|
||||
void set_overlap (bool val);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -192,10 +192,30 @@ void ods_conversion_context::start_row(int _start_row, int repeated, int level,
|
||||
{
|
||||
if (_start_row > current_table().current_row() + 1)
|
||||
{
|
||||
int repeated_default = _start_row - current_table().current_row()-1;
|
||||
|
||||
start_row(_start_row - repeated_default, repeated_default, 0, true);
|
||||
end_row();
|
||||
int repeated_default = _start_row - current_table().current_row() - 1;
|
||||
|
||||
while(true)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int comment_idx = current_table().is_row_comment(current_table().current_row() + 1, repeated_default);
|
||||
|
||||
if (comment_idx < 0) break;
|
||||
int rows = current_table().comments_[comment_idx].row - current_table().current_row() - 1;
|
||||
|
||||
start_row(current_table().current_row() + 1, rows, 0, true);
|
||||
end_row();
|
||||
|
||||
start_row(current_table().current_row() + 1, 1, 0, true);
|
||||
end_row();
|
||||
|
||||
repeated_default -= (1 + rows);
|
||||
}
|
||||
|
||||
if (repeated_default > 0)
|
||||
{
|
||||
start_row(_start_row - repeated_default, repeated_default, 0, true);
|
||||
end_row();
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
while (level < current_table().current_level())
|
||||
|
||||
@ -423,7 +423,7 @@ int ods_table_state::is_cell_comment(int col, int row, unsigned int repeate_col)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row)
|
||||
if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row && comments_[i].used == false)
|
||||
{
|
||||
return (int)i;
|
||||
}
|
||||
@ -434,7 +434,7 @@ int ods_table_state::is_row_comment(int row, int repeate_row)
|
||||
{
|
||||
for (size_t i = 0; i < comments_.size(); i++)
|
||||
{
|
||||
if (comments_[i].row < row + repeate_row && comments_[i].row >= row)
|
||||
if (comments_[i].row < row + repeate_row && comments_[i].row >= row && comments_[i].used == false)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -1050,6 +1050,7 @@ void ods_table_state::end_cell()
|
||||
{
|
||||
office_element_ptr & comm_elm = comments_[cells_.back().comment_idx].elm;
|
||||
cells_.back().elm->add_child_element(comm_elm);
|
||||
comments_[cells_.back().comment_idx].used = true;
|
||||
}
|
||||
if (cells_.back().empty)
|
||||
{
|
||||
@ -1060,22 +1061,22 @@ void ods_table_state::end_cell()
|
||||
|
||||
void ods_table_state::add_default_cell( unsigned int repeated)
|
||||
{
|
||||
int comment_idx = is_cell_comment(current_table_column_ + 1 , current_table_row_, repeated);
|
||||
int comment_idx = is_cell_comment(current_table_column_ + 1, current_table_row_, repeated);
|
||||
if (comment_idx >= 0 && repeated > 1)
|
||||
{
|
||||
//делим на 3 - до, с комметом, после;
|
||||
int c = current_table_column_;
|
||||
|
||||
add_default_cell(comments_[comment_idx].col - c -1);
|
||||
add_default_cell(comments_[comment_idx].col - c - 1);
|
||||
add_default_cell(1);
|
||||
add_default_cell(repeated + c +1 - comments_[comment_idx].col);
|
||||
add_default_cell(repeated + c + 1 - comments_[comment_idx].col);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
office_element_ptr default_cell_elm;
|
||||
create_element(L"table", L"table-cell",default_cell_elm, context_);
|
||||
create_element(L"table", L"table-cell", default_cell_elm, context_);
|
||||
|
||||
current_row_element()->add_child_element(default_cell_elm);
|
||||
|
||||
|
||||
@ -202,7 +202,8 @@ struct ods_comment_state
|
||||
std::wstring author;
|
||||
|
||||
office_element_ptr elm;
|
||||
//style graphic
|
||||
|
||||
bool used = false;
|
||||
};
|
||||
struct ods_shared_formula_state
|
||||
{
|
||||
|
||||
@ -593,7 +593,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
|
||||
if (oox_shape->txBody.IsInit()) bodyPr = oox_shape->txBody->bodyPr.GetPointer();
|
||||
else bodyPr = oox_shape->oTextBoxBodyPr.GetPointer();
|
||||
|
||||
if (bodyPr && bodyPr->fromWordArt.get_value_or(false))
|
||||
if ((bodyPr) && (bodyPr->prstTxWarp.IsInit()))
|
||||
{
|
||||
int wordart_type = convert(bodyPr->prstTxWarp.GetPointer());
|
||||
if (wordart_type > 0) type = wordart_type;
|
||||
@ -782,9 +782,16 @@ void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
|
||||
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
|
||||
{
|
||||
if (oox_text_preset == NULL) return -1;
|
||||
if (oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextNoShape) return 2000;
|
||||
|
||||
return 2001 + oox_text_preset->prst.GetBYTECode();
|
||||
|
||||
if (oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextNoShape ||
|
||||
oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextPlain) // в зависимости от других настроек
|
||||
{
|
||||
return 2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 2001 + oox_text_preset->prst.GetBYTECode();
|
||||
}
|
||||
}
|
||||
void OoxConverter::convert(PPTX::Logic::PrstGeom *oox_geom)
|
||||
{
|
||||
@ -1067,8 +1074,13 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
|
||||
std::wstring hexColorStart, hexColorEnd;
|
||||
_CP_OPT(double) opacityStart, opacityEnd;
|
||||
|
||||
convert(&oox_grad_fill->GsLst[0].color,hexColorEnd, opacityEnd, nARGB);
|
||||
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size()-1].color,hexColorStart, opacityStart, nARGB);
|
||||
convert(&oox_grad_fill->GsLst[0].color, hexColorEnd, opacityEnd, nARGB);
|
||||
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size() - 1].color, hexColorStart, opacityStart, nARGB);
|
||||
|
||||
if (hexColorEnd == hexColorStart && opacityEnd == opacityStart && oox_grad_fill->GsLst.size() > 2)
|
||||
{
|
||||
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size() / 2].color, hexColorStart, opacityStart, nARGB);
|
||||
}
|
||||
|
||||
odf_context()->drawing_context()->set_gradient_start(hexColorStart, opacityStart);
|
||||
odf_context()->drawing_context()->set_gradient_end (hexColorEnd, opacityEnd);
|
||||
@ -1253,6 +1265,16 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
{
|
||||
if (!oox_bodyPr) return;
|
||||
|
||||
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
|
||||
{
|
||||
if (oox_bodyPr->prstTxWarp->avLst[i].fmla.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->add_modifier(oox_bodyPr->prstTxWarp->avLst[i].fmla.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oox_bodyPr->vert.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_textarea_writing_mode (oox_bodyPr->vert->GetBYTECode());
|
||||
@ -1287,7 +1309,7 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
switch(oox_bodyPr->Fit.type)
|
||||
{
|
||||
case PPTX::Logic::TextFit::FitSpAuto:
|
||||
{//изменяемы размеры
|
||||
{//изменяемы размеры шейпа под текст
|
||||
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
|
||||
}break;
|
||||
case PPTX::Logic::TextFit::FitNo:
|
||||
@ -1300,17 +1322,6 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
|
||||
{
|
||||
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
|
||||
{
|
||||
if (oox_bodyPr->prstTxWarp->avLst[i].fmla.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->add_modifier(oox_bodyPr->prstTxWarp->avLst[i].fmla.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void OoxConverter::convert(PPTX::Logic::NvSpPr *oox_nvSpPr)
|
||||
{
|
||||
|
||||
@ -254,7 +254,7 @@ void DocxConverter::convert_document()
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard");
|
||||
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard", true);
|
||||
|
||||
odt_context->text_context()->clear_params();
|
||||
|
||||
@ -1410,6 +1410,11 @@ void DocxConverter::convert( ComplexTypes::Word::CShading* shading, _CP_OPT(odf_
|
||||
|
||||
if (shading->m_oColor.IsInit())
|
||||
{
|
||||
if ((shading->m_oColor->GetValue() == SimpleTypes::hexcolorAuto) &&
|
||||
(shading->m_oVal.IsInit()) && (shading->m_oVal->GetValue() == SimpleTypes::shdClear))
|
||||
{
|
||||
return;
|
||||
}
|
||||
BYTE ucR = 0xff, ucB = 0xff, ucG = 0xff; //auto fill
|
||||
if (shading->m_oColor->GetValue() == SimpleTypes::hexcolorRGB)
|
||||
{
|
||||
@ -1502,7 +1507,7 @@ void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logi
|
||||
}
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name)
|
||||
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name, bool bAlways)
|
||||
{
|
||||
if (oox_section_pr == NULL) return;
|
||||
current_section_properties = NULL;
|
||||
@ -1679,7 +1684,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
//nullable<SimpleTypes::CDecimalNumber<> > m_oChapStyle;
|
||||
}
|
||||
|
||||
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit())
|
||||
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit() || bAlways)
|
||||
{
|
||||
OOX::Logic::CSectionProperty* s = last_section_properties ? last_section_properties : oox_section_pr;
|
||||
|
||||
@ -2239,51 +2244,95 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
|
||||
text_properties->content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WNormal);
|
||||
}
|
||||
|
||||
bool set_color = false;
|
||||
if (oox_run_pr->m_oTextFill.getType() == OOX::et_a_gradFill || oox_run_pr->m_oTextOutline.IsInit())
|
||||
{
|
||||
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
|
||||
if (drawing_context)
|
||||
{
|
||||
if (odf_context()->drawing_context()->change_text_box_2_wordart())
|
||||
{
|
||||
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
|
||||
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
|
||||
|
||||
odf_context()->drawing_context()->start_area_properties(true);
|
||||
if(gradFill.IsInit())
|
||||
{
|
||||
OoxConverter::convert(gradFill.operator->());
|
||||
}
|
||||
else if (solidFill.IsInit())
|
||||
{
|
||||
OoxConverter::convert(solidFill.operator->());
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_context()->drawing_context()->set_no_fill();
|
||||
}
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
|
||||
if (oox_run_pr->m_oTextOutline.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->start_line_properties(true);
|
||||
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
|
||||
odf_context()->drawing_context()->end_line_properties();
|
||||
}
|
||||
|
||||
set_color = true;
|
||||
}
|
||||
}
|
||||
else{} //обычный текст .. градиент по телу абзаца (
|
||||
}
|
||||
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
|
||||
|
||||
if (!set_color && oox_run_pr->m_oColor.IsInit())
|
||||
bool set_word_art = drawing_context ? drawing_context->is_wordart() : false;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
|
||||
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
|
||||
|
||||
bool bFillText = (oox_run_pr->m_oTextFill.m_type != PPTX::Logic::UniFill::notInit) &&
|
||||
(oox_run_pr->m_oTextFill.m_type != PPTX::Logic::UniFill::noFill);
|
||||
|
||||
bool bOutlineText = ((oox_run_pr->m_oTextOutline.is_init()) &&
|
||||
(oox_run_pr->m_oTextOutline->Fill.m_type != PPTX::Logic::UniFill::notInit) &&
|
||||
(oox_run_pr->m_oTextOutline->Fill.m_type != PPTX::Logic::UniFill::noFill));
|
||||
|
||||
bool bOutline = oox_run_pr->m_oOutline.IsInit();
|
||||
bool bColorText = !bOutline && (oox_run_pr->m_oColor.IsInit() && (oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorRGB));
|
||||
|
||||
_CP_OPT(odf_types::color) color;
|
||||
|
||||
if (oox_run_pr->m_oColor.IsInit())
|
||||
{
|
||||
if(oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorAuto)
|
||||
text_properties->content_.fo_color_ = odf_types::color(L"#000000");
|
||||
color = odf_types::color(L"#000000");
|
||||
else
|
||||
convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content_.fo_color_);
|
||||
convert(oox_run_pr->m_oColor.GetPointer(), color);
|
||||
|
||||
text_properties->content_.fo_color_ = color;
|
||||
}
|
||||
if (gradFill.is_init() || (bOutlineText && (bFillText || bColorText)))
|
||||
{
|
||||
set_word_art = true;
|
||||
}
|
||||
|
||||
if (drawing_context && set_word_art)
|
||||
{
|
||||
if (drawing_context->change_text_box_2_wordart())
|
||||
{
|
||||
drawing_context->start_area_properties(true);
|
||||
if(gradFill.IsInit())
|
||||
{
|
||||
OoxConverter::convert(gradFill.operator->());
|
||||
}
|
||||
else if (solidFill.IsInit())
|
||||
{
|
||||
OoxConverter::convert(solidFill.operator->());
|
||||
}
|
||||
else if (color)
|
||||
{
|
||||
drawing_context->set_solid_fill(color->get_hex_value());
|
||||
}
|
||||
else
|
||||
{
|
||||
drawing_context->set_no_fill();
|
||||
}
|
||||
drawing_context->end_area_properties();
|
||||
|
||||
if (oox_run_pr->m_oTextOutline.IsInit())
|
||||
{
|
||||
drawing_context->start_line_properties(true);
|
||||
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
|
||||
drawing_context->end_line_properties();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
set_word_art = false;
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring hexString;
|
||||
_CP_OPT(double) opacity;
|
||||
if (bOutlineText)
|
||||
{
|
||||
text_properties->content_.style_text_outline_ = true;
|
||||
|
||||
gradFill = oox_run_pr->m_oTextOutline->Fill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
|
||||
solidFill = oox_run_pr->m_oTextOutline->Fill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
|
||||
}
|
||||
if (solidFill.is_init())
|
||||
{
|
||||
OoxConverter::convert(&solidFill->Color, hexString, opacity);
|
||||
}
|
||||
else if ((gradFill.is_init()) && (false == gradFill->GsLst.empty()))
|
||||
{
|
||||
OoxConverter::convert(&gradFill->GsLst[0].color, hexString, opacity);
|
||||
}
|
||||
if (!hexString.empty())
|
||||
{
|
||||
text_properties->content_.fo_color_ = hexString;
|
||||
}
|
||||
|
||||
//text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::None); //нельзя..если будет выше наследуемого то подчеркивания не будет
|
||||
@ -2442,10 +2491,11 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
|
||||
if (oox_run_pr->m_oShd.IsInit())
|
||||
{
|
||||
_CP_OPT(odf_types::color) odf_color;
|
||||
convert(oox_run_pr->m_oShd->m_oFill.GetPointer(), oox_run_pr->m_oShd->m_oThemeFill.GetPointer(),
|
||||
oox_run_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_run_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
|
||||
convert(oox_run_pr->m_oShd.GetPointer(), odf_color);
|
||||
if (odf_color)
|
||||
text_properties->content_.fo_background_color_ = *odf_color;
|
||||
{
|
||||
text_properties->content_.fo_background_color_= *odf_color;
|
||||
}
|
||||
}
|
||||
if (oox_run_pr->m_oOutline.IsInit())
|
||||
text_properties->content_.style_text_outline_ = true; //контур
|
||||
@ -2895,14 +2945,30 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
|
||||
else if (oox_anchor->m_oWrapThrough.IsInit())//style:wrap="run-through" draw:wrap-influence-on-position style:wrap-contour
|
||||
{
|
||||
odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::RunThrough);
|
||||
|
||||
}
|
||||
else if (oox_anchor->m_oWrapTight.IsInit())
|
||||
{
|
||||
odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::Parallel);
|
||||
if (oox_anchor->m_oWrapTight->m_oWrapPolygon.IsInit())
|
||||
bool bPolygon = oox_anchor->m_oWrapTight->m_oWrapPolygon.IsInit();
|
||||
|
||||
if (oox_anchor->m_oWrapTight->m_oWrapText.IsInit())
|
||||
{
|
||||
switch(oox_anchor->m_oWrapTight->m_oWrapText->GetValue())
|
||||
{
|
||||
case SimpleTypes::wraptextBothSides:
|
||||
{
|
||||
odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::Dynamic);
|
||||
if (bPolygon)
|
||||
{
|
||||
odt_context->drawing_context()->set_wrap_contour();
|
||||
}
|
||||
}break;
|
||||
case SimpleTypes::wraptextLargest: odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::Biggest); break;
|
||||
case SimpleTypes::wraptextLeft: odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::Left); break;
|
||||
case SimpleTypes::wraptextRight: odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::Right); break;
|
||||
}
|
||||
}
|
||||
wrap_set = true;
|
||||
}
|
||||
else if (oox_anchor->m_oWrapTopAndBottom.IsInit())
|
||||
{
|
||||
@ -4397,7 +4463,7 @@ void DocxConverter::convert(OOX::Logic::CTableRowProperties *oox_table_row_pr)
|
||||
//nullable<ComplexTypes::Word::CTblWidth > m_oWAfter;
|
||||
//nullable<ComplexTypes::Word::CTblWidth > m_oWBefore;
|
||||
}
|
||||
bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,odf_writer::style_table_cell_properties * table_cell_properties)
|
||||
bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, odf_writer::style_table_cell_properties *table_cell_properties)
|
||||
{
|
||||
if (oox_table_cell_pr == NULL) return false;
|
||||
if (table_cell_properties == NULL) return false;
|
||||
@ -4420,13 +4486,23 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
|
||||
{
|
||||
switch(oox_table_cell_pr->m_oTextDirection->m_oVal->GetValue())
|
||||
{
|
||||
case SimpleTypes::textdirectionLr :
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ltr);break;
|
||||
case SimpleTypes::textdirectionTb :
|
||||
{
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ltr);
|
||||
}break;
|
||||
case SimpleTypes::textdirectionLr ://повернутость буковок
|
||||
case SimpleTypes::textdirectionLrV :
|
||||
case SimpleTypes::textdirectionTb ://повернутость буковок
|
||||
case SimpleTypes::textdirectionTbV :
|
||||
case SimpleTypes::textdirectionRlV :
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ttb);break;
|
||||
{
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf_types::direction(odf_types::direction::Ttb);
|
||||
odf_writer::style_text_properties *text_cell_properties = odt_context->styles_context()->last_state()->get_text_properties();
|
||||
if (text_cell_properties)
|
||||
{
|
||||
text_cell_properties->content_.style_text_rotation_angle_ = 90;
|
||||
text_cell_properties->content_.style_text_rotation_scale_ = odf_types::text_rotation_scale::LineHeight;
|
||||
}
|
||||
}break;
|
||||
case SimpleTypes::textdirectionRl ://rtl
|
||||
break;
|
||||
}
|
||||
@ -4501,7 +4577,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
|
||||
if (parent_name.length() > 0)
|
||||
{
|
||||
odf_writer::style * style_ = NULL;
|
||||
if (odt_context->styles_context()->find_odf_style(parent_name,odf_types::style_family::TableCell,style_))
|
||||
if (odt_context->styles_context()->find_odf_style(parent_name, odf_types::style_family::TableCell, style_))
|
||||
{
|
||||
parent_cell_properties = style_->content_.get_style_table_cell_properties();
|
||||
}
|
||||
@ -4510,14 +4586,15 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
|
||||
if (oox_table_cell_pr == NULL && is_base_styled == false && parent_cell_properties == NULL) return false;
|
||||
|
||||
odt_context->styles_context()->create_style(L"",odf_types::style_family::TableCell, true, false, -1);
|
||||
odf_writer::style_table_cell_properties *cell_properties = odt_context->styles_context()->last_state()->get_table_cell_properties();
|
||||
|
||||
odf_writer::style_table_cell_properties *cell_properties = odt_context->styles_context()->last_state()->get_table_cell_properties();
|
||||
|
||||
if (cell_properties == NULL) return false;
|
||||
|
||||
if (is_base_styled)
|
||||
{
|
||||
odf_writer::style_text_properties * text_properties = odt_context->styles_context()->last_state()->get_text_properties();
|
||||
odf_writer::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties();
|
||||
odf_writer::style_text_properties *text_properties = odt_context->styles_context()->last_state()->get_text_properties();
|
||||
odf_writer::style_paragraph_properties *paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties();
|
||||
|
||||
if (col < 0) col=odt_context->table_context()->current_column()+1;
|
||||
int row=odt_context->table_context()->current_row();
|
||||
|
||||
@ -183,7 +183,7 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::Logic::CBackground *oox_background, int type);
|
||||
void convert(OOX::Logic::CSdt *oox_sdt);
|
||||
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"");
|
||||
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"", bool bAlways = false);
|
||||
void convert(OOX::Logic::CParagraph *oox_paragraph);
|
||||
void convert(OOX::Logic::CRun *oox_run);
|
||||
void convert(OOX::Logic::CParagraphProperty *oox_para_prop, odf_writer::style_paragraph_properties *paragraph_properties);
|
||||
|
||||
@ -487,6 +487,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
{
|
||||
if (oox_row == NULL)return;
|
||||
|
||||
int row_number = oox_row->m_oR.IsInit() ? oox_row->m_oR->GetValue() : -1;
|
||||
|
||||
if (oox_row_prev)
|
||||
{
|
||||
if (oox_row_prev->m_arrItems.empty() &&
|
||||
@ -592,14 +594,15 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
|
||||
if (bEqual)
|
||||
{
|
||||
ods_context->add_row_repeated();
|
||||
return;
|
||||
if (false == ods_context->current_table().is_row_comment(row_number, 1))
|
||||
{
|
||||
ods_context->add_row_repeated();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int row_number = oox_row->m_oR.IsInit() ? oox_row->m_oR->GetValue() : -1;
|
||||
|
||||
bool _default = true;
|
||||
|
||||
if (oox_row->m_oHt.IsInit() || oox_row->m_oCustomHeight.IsInit() || oox_row->m_oHidden.IsInit() || oox_row->m_oCollapsed.IsInit()) _default = false;
|
||||
|
||||
@ -218,9 +218,11 @@ namespace NSBinPptxRW
|
||||
}
|
||||
|
||||
std::wstring strExts = _T(".jpg");
|
||||
int nIndexExt = (int)strInput.rfind(wchar_t('.'));
|
||||
//use GetFileName to avoid defining '.' in the directory as extension
|
||||
std::wstring strFileName = NSFile::GetFileName(strInput);
|
||||
int nIndexExt = (int)strFileName.rfind(wchar_t('.'));
|
||||
if (-1 != nIndexExt)
|
||||
strExts = strInput.substr(nIndexExt);
|
||||
strExts = strFileName.substr(nIndexExt);
|
||||
|
||||
int typeAdditional = 0;
|
||||
std::wstring strAdditional;
|
||||
|
||||
@ -64,6 +64,7 @@ namespace OOX
|
||||
m_mTable.insert( std::make_pair( _T("emf"), _T("image/x-emf")));
|
||||
m_mTable.insert( std::make_pair( _T("emz"), _T("image/x-emz")));
|
||||
m_mTable.insert( std::make_pair( _T("wmf"), _T("image/x-wmf")));
|
||||
m_mTable.insert( std::make_pair( _T("svg"), _T("image/svg+xml")));
|
||||
m_mTable.insert( std::make_pair( _T("svm"), _T("image/svm")));
|
||||
m_mTable.insert( std::make_pair( _T("wav"), _T("audio/wav")));
|
||||
m_mTable.insert( std::make_pair( _T("wma"), _T("audio/x-wma")));
|
||||
|
||||
@ -102,3 +102,16 @@ void CFileDownloader::CheckSuspend()
|
||||
{
|
||||
return m_pInternal->CheckSuspend();
|
||||
}
|
||||
|
||||
#ifdef _MAC
|
||||
bool CFileDownloader::m_bIsARCEnabled = false;
|
||||
|
||||
void CFileDownloader::SetARCEnabled(const bool& enabled)
|
||||
{
|
||||
m_bIsARCEnabled = enabled;
|
||||
}
|
||||
bool CFileDownloader::GetARCEnabled()
|
||||
{
|
||||
return m_bIsARCEnabled;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -41,6 +41,10 @@ protected:
|
||||
// создаем в зависимости от платформы
|
||||
CFileDownloader_private* m_pInternal;
|
||||
|
||||
#ifdef _MAC
|
||||
static bool m_bIsARCEnabled;
|
||||
#endif
|
||||
|
||||
public:
|
||||
CFileDownloader(std::wstring sFileUrl, bool bDelete = true);
|
||||
virtual ~CFileDownloader();
|
||||
@ -63,4 +67,9 @@ public:
|
||||
int GetPriority();
|
||||
|
||||
void CheckSuspend();
|
||||
|
||||
#ifdef _MAC
|
||||
static void SetARCEnabled(const bool& enabled);
|
||||
static bool GetARCEnabled();
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "FileDownloader_private.h"
|
||||
#include "FileDownloader.h"
|
||||
|
||||
#if _IOS
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -27,12 +28,12 @@ public :
|
||||
}
|
||||
|
||||
virtual int DownloadFile()
|
||||
{
|
||||
{
|
||||
if (m_sFilePath.empty())
|
||||
{
|
||||
{
|
||||
m_sFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD");
|
||||
if (NSFile::CFileBinary::Exists(m_sFilePath))
|
||||
NSFile::CFileBinary::Remove(m_sFilePath);
|
||||
NSFile::CFileBinary::Remove(m_sFilePath);
|
||||
}
|
||||
|
||||
NSString* stringURL = StringWToNSString(m_sFileUrl);
|
||||
@ -50,9 +51,12 @@ public :
|
||||
return 0;
|
||||
#else
|
||||
#ifndef _ASC_USE_ARC_
|
||||
[stringURL release];
|
||||
[url release];
|
||||
[urlData release];
|
||||
if (!CFileDownloader::GetARCEnabled())
|
||||
{
|
||||
[stringURL release];
|
||||
[url release];
|
||||
[urlData release];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
@ -62,8 +66,11 @@ public :
|
||||
return 1;
|
||||
#else
|
||||
#ifndef _ASC_USE_ARC_
|
||||
[stringURL release];
|
||||
[url release];
|
||||
if (!CFileDownloader::GetARCEnabled())
|
||||
{
|
||||
[stringURL release];
|
||||
[url release];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
@ -498,6 +498,8 @@ private:
|
||||
m_nDashStyle = Aggplus::DashStyleSolid;
|
||||
m_lDashPatternSize = 0;
|
||||
m_pDashPattern = NULL;
|
||||
|
||||
m_dDashOffset = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user