Commit 84824631 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation styled list

parent dc3ecb1f
......@@ -262,6 +262,7 @@ void odf_conversion_context::process_settings(_object & object, bool isRoot)
void odf_conversion_context::process_styles(_object & object, bool isRoot)
{
create_element(L"office", L"styles", object.styles, this, true);//общие стили
object.style_context->process_office_styles(object.styles.back());
page_layout_context()->process_office_styles(object.styles.back());
......
......@@ -54,11 +54,12 @@ void odf_lists_styles_context::set_odf_context(odf_conversion_context * Context)
odf_context_ = Context;
}
void odf_lists_styles_context::process_styles(office_element_ptr root )
void odf_lists_styles_context::process_styles(office_element_ptr root, bool automatic)
{
for (size_t i = 0; i < lists_format_array_.size(); i++)
{
if (lists_format_array_[i].elements.size() < 1) continue;
if (lists_format_array_[i].elements.size() < 1) continue;
if (lists_format_array_[i].automatic != automatic) continue;
root->add_child_element(lists_format_array_[i].elements[0]);
}
......@@ -92,7 +93,13 @@ std::wstring odf_lists_styles_context::get_style_name1(int oox_style_num)
}
std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
{
if (link_format_map_.count(oox_style_num) > 0)
if (lists_format_array_.empty()) return L"";
if (oox_style_num < 0)
{
return lists_format_array_.back().odf_list_style_name;
}
else if (link_format_map_.count(oox_style_num) > 0)
{
return link_format_map_.at(oox_style_num);
}
......@@ -109,21 +116,30 @@ void odf_lists_styles_context::start_style(int based_number)
create_element(L"text", L"list-style", elm, odf_context_);
state.elements.push_back(elm);
state.oox_based_number = based_number;
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(based_number + 1);
if (based_number < 0)
{
state.oox_based_number = lists_format_array_.size();
state.odf_list_style_name = std::wstring(L"L") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
state.automatic = true; //document automatic style
}
else
{
state.oox_based_number = based_number;
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(state.oox_based_number + 1);
state.automatic = false; //office style
}
text_list_style *style = dynamic_cast<text_list_style *>(elm.get());
if (style == NULL)return;
style->text_list_style_attr_.style_name_ = state.odf_list_style_name;
lists_format_array_.push_back(state); //перенести в end??
}
style_list_level_properties * odf_lists_styles_context::get_list_level_properties()
{
if (lists_format_array_.size() < 1) return NULL;
if (lists_format_array_.back().elements.size() <1) return NULL;
if (lists_format_array_.empty()) return NULL;
if (lists_format_array_.back().elements.empty()) return NULL;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
......@@ -156,8 +172,8 @@ style_list_level_properties * odf_lists_styles_context::get_list_level_propertie
}
style_text_properties * odf_lists_styles_context::get_text_properties()
{
if (lists_format_array_.size() < 1) return NULL;
if (lists_format_array_.back().elements.size() <1) return NULL;
if (lists_format_array_.empty()) return NULL;
if (lists_format_array_.back().elements.empty()) return NULL;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
......@@ -167,14 +183,14 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
if (style_number_)
{
if (!style_number_->style_text_properties_)
create_element(L"style", L"text-properties",style_number_->style_text_properties_,odf_context_);
create_element(L"style", L"text-properties", style_number_->style_text_properties_, odf_context_);
props = dynamic_cast<style_text_properties *>(style_number_->style_text_properties_.get());
}
if (style_bullet_)
{
if (!style_bullet_->style_text_properties_)
create_element(L"style", L"text-properties",style_bullet_->style_text_properties_,odf_context_);
create_element(L"style", L"text-properties", style_bullet_->style_text_properties_, odf_context_);
props = dynamic_cast<style_text_properties *>(style_bullet_->style_text_properties_.get());
}
......@@ -190,8 +206,8 @@ style_text_properties * odf_lists_styles_context::get_text_properties()
style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alignment_properties()
{
if (lists_format_array_.size() < 1) return NULL;
if (lists_format_array_.back().elements.size() <1) return NULL;
if (lists_format_array_.empty()) return NULL;
if (lists_format_array_.back().elements.empty()) return NULL;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
......@@ -201,21 +217,21 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
if (style_number_)
{
if (!style_number_->style_list_level_properties_)
create_element(L"style", L"list-level-properties",style_number_->style_list_level_properties_,odf_context_);
create_element(L"style", L"list-level-properties", style_number_->style_list_level_properties_, odf_context_);
props = dynamic_cast<style_list_level_properties *>(style_number_->style_list_level_properties_.get());
}
if (style_bullet_)
{
if (!style_bullet_->style_list_level_properties_)
create_element(L"style", L"list-level-properties",style_bullet_->style_list_level_properties_,odf_context_);
create_element(L"style", L"list-level-properties", style_bullet_->style_list_level_properties_, odf_context_);
props = dynamic_cast<style_list_level_properties *>(style_bullet_->style_list_level_properties_.get());
}
if (style_image_)
{
if (!style_image_->style_list_level_properties_)
create_element(L"style", L"list-level-properties",style_image_->style_list_level_properties_,odf_context_);
create_element(L"style", L"list-level-properties", style_image_->style_list_level_properties_, odf_context_);
props = dynamic_cast<style_list_level_properties *>(style_image_->style_list_level_properties_.get());
}
......@@ -223,14 +239,15 @@ style_list_level_label_alignment * odf_lists_styles_context::get_list_level_alig
if (!props->style_list_level_label_alignment_)
{
create_element(L"style", L"list-level-label-alignment" ,props->style_list_level_label_alignment_,odf_context_);
create_element(L"style", L"list-level-label-alignment" , props->style_list_level_label_alignment_, odf_context_);
}
return dynamic_cast<style_list_level_label_alignment *>(props->style_list_level_label_alignment_.get());
}
int odf_lists_styles_context::start_style_level(int level, int type)
{
if (lists_format_array_.size() < 1) return -1;
if (lists_format_array_.empty()) return -1;
int odf_type =1;
int format_type = -1;
......@@ -451,10 +468,10 @@ wchar_t convert_bullet_char(wchar_t c)
}
void odf_lists_styles_context::set_numeric_format(std::wstring val)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if ( val.length() <1 )
return;
if ( lists_format_array_.empty() ) return;
if ( lists_format_array_.back().elements.empty() ) return;
if ( val.empty() ) return;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
if (style_number_)
......@@ -522,10 +539,10 @@ void odf_lists_styles_context::set_numeric_format(std::wstring val)
}
void odf_lists_styles_context::set_bullet_char(std::wstring val)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if ( val.length() <1 )
return;
if ( lists_format_array_.empty() ) return;
if ( lists_format_array_.back().elements.empty() ) return ;
if ( val.empty() ) return;
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
......@@ -536,8 +553,8 @@ void odf_lists_styles_context::set_bullet_char(std::wstring val)
void odf_lists_styles_context::set_bullet_image_size(double size)
{
if (size < 0.1) return;
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
style_list_level_properties *props = get_list_level_properties();
......@@ -548,8 +565,8 @@ void odf_lists_styles_context::set_bullet_image_size(double size)
}
void odf_lists_styles_context::set_bullet_image (std::wstring ref)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
text_list_level_style_image *style_image_ = dynamic_cast<text_list_level_style_image *>(lists_format_array_.back().elements.back().get());
......@@ -563,8 +580,8 @@ void odf_lists_styles_context::set_bullet_image (std::wstring ref)
}
void odf_lists_styles_context::set_start_number(int val)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
......@@ -574,8 +591,8 @@ void odf_lists_styles_context::set_start_number(int val)
}
void odf_lists_styles_context::set_text_style_name(std::wstring name)
{
if (lists_format_array_.size() < 1) return;
if (lists_format_array_.back().elements.size() <1) return ;
if (lists_format_array_.empty()) return;
if (lists_format_array_.back().elements.empty()) return ;
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(lists_format_array_.back().elements.back().get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(lists_format_array_.back().elements.back().get());
......
......@@ -55,7 +55,7 @@ struct list_format_state
std::vector<office_element_ptr> elements;
std::wstring odf_list_style_name;
bool automatic;
};
class odf_lists_styles_context
......@@ -64,7 +64,7 @@ public:
odf_lists_styles_context();
void set_odf_context(odf_conversion_context * Context);
void start_style(int abstract_number);
void start_style(int abstract_number = -1);
int start_style_level(int level, int type);
style_list_level_properties * get_list_level_properties();
style_list_level_label_alignment * get_list_level_alignment_properties();
......@@ -84,9 +84,9 @@ public:
void add_style(int oox_style_num, int oox_based_num);
void process_styles(office_element_ptr root );
void process_styles(office_element_ptr root, bool automatic);
std::wstring get_style_name(int oox_style_num);
std::wstring get_style_name(int oox_style_num = -1);
std::wstring get_style_name1(int oox_style_num);
private:
std::vector<list_format_state> lists_format_array_;
......
......@@ -161,6 +161,7 @@ void odf_style_context::process_automatic_styles(office_element_ptr root )
if (/*it->automatic_== true && */style_state_list_[i]->root_== false && style_state_list_[i]->odf_style_)
root->add_child_element(style_state_list_[i]->odf_style_);
}
lists_styles_context_.process_styles(root, true);
}
void odf_style_context::process_office_styles(office_element_ptr root )
......@@ -175,7 +176,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
root->add_child_element(style_state_list_[i]->odf_style_);
}
lists_styles_context_.process_styles(root );
lists_styles_context_.process_styles(root, false);
}
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root, bool automatic)
{
......
......@@ -34,7 +34,6 @@
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
......@@ -46,6 +45,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/TextFont.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
......@@ -55,6 +55,7 @@
#include "../OdfFormat/odf_drawing_context.h"
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#include "../OdfFormat/styles_list.h"
using namespace cpdoccore;
......@@ -1106,6 +1107,138 @@ void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
//nullable_limit<Limit::PlaceholderSize> sz;
}
}
void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_props, int level)
{//одномерные списки тока
//if (!oox_list)return;
if (!oox_para_props) return;
PPTX::Theme *theme = oox_theme();
PPTX::Logic::Bullet & bullet = oox_para_props->ParagraphBullet;
if (bullet.is<PPTX::Logic::BuNone>())return;
if (bullet.is<PPTX::Logic::BuAutoNum>())
{
const PPTX::Logic::BuAutoNum & buAutoNum = bullet.as<PPTX::Logic::BuAutoNum>();
int type = 13;
int pptx_type = buAutoNum.type.GetBYTECode();
if ( pptx_type < 3) type = 46;
if (pptx_type > 2 && pptx_type < 6) type = 60;
if (pptx_type > 28 && pptx_type < 32) type = 47;
if (pptx_type > 31 && pptx_type < 35) type = 61;
odf_context()->styles_context()->lists_styles().start_style_level(level, type);
if (buAutoNum.startAt.IsInit())
{
int start_value = *buAutoNum.startAt;
if (start_value > 1)
odf_context()->styles_context()->lists_styles().set_start_number(start_value);
}
}
if (bullet.is<PPTX::Logic::BuChar>())
{
const PPTX::Logic::BuChar & buChar = bullet.as<PPTX::Logic::BuChar>();
odf_context()->styles_context()->lists_styles().start_style_level(level, 5 );
odf_context()->styles_context()->lists_styles().set_bullet_char(buChar.Char);
}
if (bullet.is<PPTX::Logic::BuBlip>())
{
const PPTX::Logic::BuBlip & buBlip = bullet.as<PPTX::Logic::BuBlip>();
odf_context()->styles_context()->lists_styles().start_style_level(level, 1000 );
odf_context()->styles_context()->lists_styles().set_bullet_image(odf_context()->mediaitems()->items().back().odf_ref);
}
//odf_writer::style_list_level_label_alignment * aligment_props = odf_context()->styles_context()->lists_styles().get_list_level_alignment_properties();
odf_writer::style_list_level_properties * level_props = odf_context()->styles_context()->lists_styles().get_list_level_properties();
odf_writer::style_text_properties * text_properties = odf_context()->styles_context()->lists_styles().get_text_properties();
convert(oox_para_props->defRPr.GetPointer(), text_properties);
if (oox_para_props->indent.IsInit())
{
level_props->text_space_before_ = odf_types::length(- oox_para_props->indent.get() / 12700., odf_types::length::pt);
level_props->text_min_label_width_ = odf_types::length(1, odf_types::length::pt);
}else
{
//aligment_props->fo_text_indent_ = odf_types::length(0, odf_types::length::cm);
//aligment_props->fo_margin_left_ = odf_types::length(0, odf_types::length::cm);
}
if (oox_para_props->buColor.is<PPTX::Logic::BuClrTx>())
{
const PPTX::Logic::BuClrTx & buClrTx = oox_para_props->buColor.as<PPTX::Logic::BuClrTx>();
}
if (oox_para_props->buColor.is<PPTX::Logic::BuClr>())
{
PPTX::Logic::BuClr & buClr = oox_para_props->buColor.as<PPTX::Logic::BuClr>();
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&buClr.Color, hexColor, opacity);
if (!hexColor.empty())
{
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
text_properties->content_.fo_color_ = odf_types::color(hexColor);
}
}
if (oox_para_props->buSize.is<PPTX::Logic::BuSzTx>())
{
const PPTX::Logic::BuSzTx & buSzTx = oox_para_props->buSize.as<PPTX::Logic::BuSzTx>();
}
else if (oox_para_props->buSize.is<PPTX::Logic::BuSzPct>())
{
const PPTX::Logic::BuSzPct & buSzPct = oox_para_props->buSize.as<PPTX::Logic::BuSzPct>();
if (buSzPct.val.IsInit())
text_properties->content_.fo_font_size_ = odf_types::percent(*buSzPct.val / 1000.);
}
else
text_properties->content_.fo_font_size_ = odf_types::percent(100.);
if (oox_para_props->buSize.is<PPTX::Logic::BuSzPts>())
{
const PPTX::Logic::BuSzPts & buSzPts = oox_para_props->buSize.as<PPTX::Logic::BuSzPts>();
if (buSzPts.val.IsInit())
text_properties->content_.fo_font_size_ = odf_types::length(*buSzPts.val, odf_types::length::pt);
}
else if (oox_para_props->buTypeface.is<PPTX::Logic::BuFontTx>())
{
const PPTX::Logic::BuFontTx & buFontTx = oox_para_props->buTypeface.as<PPTX::Logic::BuFontTx>();
}
if (oox_para_props->buTypeface.is<PPTX::Logic::TextFont>())
{
const PPTX::Logic::TextFont & textFont = oox_para_props->buTypeface.as<PPTX::Logic::TextFont>();
std::wstring font = textFont.typeface;
convert_font(theme, font);
if (!font.empty()) text_properties->content_.fo_font_family_ = font;
}
odf_context()->styles_context()->lists_styles().end_style_level();
}
void OoxConverter::convert_list (PPTX::Logic::TextListStyle *oox_list_style)
{
if (!oox_list_style) return;
odf_context()->styles_context()->lists_styles().start_style();
for (int i = 0; i < 9; i++)
{
convert_list_level(oox_list_style->levels[0].GetPointer(), i);
}
odf_context()->styles_context()->lists_styles().end_style();
}
void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::TextListStyle *oox_list_style)
{
if (!oox_paragraph)return;
......@@ -1116,27 +1249,37 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
std::wstring list_style_name;
int list_level = 0;
NSCommon::nullable<PPTX::Logic::TextParagraphPr> paraPr;
if (oox_paragraph->pPr.IsInit() || oox_list_style)
if (oox_paragraph->pPr.IsInit() && oox_paragraph->pPr->lvl.IsInit())
{
if (oox_paragraph->pPr.IsInit())
{
if (oox_paragraph->pPr->ParagraphBullet.is_init())
{
list_present = true;
list_level = 1;
}
if (oox_paragraph->pPr->lvl.IsInit())
{
list_level = *oox_paragraph->pPr->lvl;
if (list_level > 0)
list_present = true;
}
}
list_level = *oox_paragraph->pPr->lvl;
}
if (oox_list_style && list_level >= 0 && list_level < 10)
{
if (oox_list_style->levels[list_level].IsInit())
oox_list_style->levels[list_level]->Merge(paraPr);
}
if (oox_paragraph->pPr.IsInit())
oox_paragraph->pPr->Merge(paraPr);
if (paraPr.IsInit())
{
list_level = paraPr->lvl.IsInit() ? *paraPr->lvl : 0;
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
if (list_level > 0) list_present = true;
if (paraPr->ParagraphBullet.is_init())
{
list_present = true;
if (paraPr->ParagraphBullet.is<PPTX::Logic::BuNone>())
list_present = false;
else if (list_level == 0) list_level = 1;
}
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
odf_writer::style_paragraph_properties* paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
odf_writer::style_text_properties* text_properties = NULL;
if (!paragraph_properties)
{
odf_context()->text_context()->get_styles_context()->create_style(L"", odf_types::style_family::Paragraph, true, false, -1);
......@@ -1144,37 +1287,38 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
paragraph_properties = odf_context()->text_context()->get_styles_context()->last_state()->get_paragraph_properties();
text_properties = odf_context()->text_context()->get_styles_context()->last_state()->get_text_properties();
//if(list_present && oox_list_style)
//{
// list_style_name = odf_context->styles_context()->lists_styles().get_style_name(list_style_id);
// odf_context->styles_context()->last_state()->set_list_style_name(list_style_name);
//}
styled = true;
}
convert(oox_list_style, list_level, paragraph_properties, text_properties);
convert(oox_paragraph->pPr.GetPointer(), paragraph_properties, text_properties);
convert(paraPr.GetPointer(), paragraph_properties, text_properties);
if (odf_context()->drawing_context()->is_wordart())
odf_context()->drawing_context()->set_paragraph_properties(paragraph_properties);
}
}
if (oox_paragraph->RunElems.empty() && list_present) list_present = false; // ms не обозначает присутствие списка, libra - показывает значек
while (odf_context()->text_context()->list_state_.levels.size() > list_level)
{
odf_context()->text_context()->end_list();
}
if(list_present)
{
while (odf_context()->text_context()->list_state_.levels.size() > list_level)
{
odf_context()->text_context()->end_list();
}
if (odf_context()->text_context()->list_state_.levels.size() < 1)
if (odf_context()->text_context()->list_state_.levels.empty())
{
odf_context()->text_context()->list_state_.started_list = false;
odf_context()->text_context()->list_state_.style_name = L"";
odf_context()->text_context()->list_state_.style_name = L"";
}
if (odf_context()->text_context()->list_state_.started_list == false)
{
odf_context()->styles_context()->lists_styles().start_style();
convert_list_level(paraPr.GetPointer(), list_level - 1);
odf_context()->styles_context()->lists_styles().end_style();
list_style_name = odf_context()->styles_context()->lists_styles().get_style_name();
odf_context()->text_context()->start_list(list_style_name);
//text_context()->set_list_continue(true); //??? держать в памяти все списки????
}
odf_context()->text_context()->start_list_item();
......@@ -1186,10 +1330,14 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
odf_context()->text_context()->start_list(list_style_name);
odf_context()->text_context()->start_list_item();
}
}
}
else if (odf_context()->text_context()->list_state_.started_list == true)
{
odf_context()->text_context()->end_list();
}
odf_context()->text_context()->start_paragraph(styled);
for (size_t i=0; i< oox_paragraph->RunElems.size();i++)
for (size_t i=0; i< oox_paragraph->RunElems.size(); i++)
{
convert(&oox_paragraph->RunElems[i].as<OOX::WritingElement>());
}
......
......@@ -263,6 +263,7 @@ namespace PPTX
class Theme;
namespace Logic
{
class Bullet;
class ClrMap;
class SpTreeElem;
class GraphicFrame;
......@@ -403,7 +404,10 @@ public:
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert_list_level (PPTX::Logic::TextParagraphPr *oox_para_props, int level);
void convert_list (PPTX::Logic::TextListStyle *oox_list_style);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
cpdoccore::odf_writer::style_text_properties *text_properties);
......
......@@ -3049,7 +3049,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
int type_list = odt_context->styles_context()->lists_styles().start_style_level(oox_num_lvl->m_oIlvl->GetValue(), oox_type_list );
if (type_list < 0) return;
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
odf_writer::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
odf_writer::style_list_level_label_alignment * aligment_props = odt_context->styles_context()->lists_styles().get_list_level_alignment_properties();
if (level_props == NULL)return;
......@@ -3101,8 +3101,8 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
}else
{
aligment_props->fo_text_indent_ = odf_types::length(0,odf_types::length::cm);
aligment_props->fo_margin_left_ = odf_types::length(0,odf_types::length::cm);
aligment_props->fo_text_indent_ = odf_types::length(0, odf_types::length::cm);
aligment_props->fo_margin_left_ = odf_types::length(0, odf_types::length::cm);
}
}
......@@ -3114,7 +3114,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
convert(oox_num_lvl->m_oRPr.GetPointer(), text_props);
//create text style for symbols list НА ЛОКАЛЬНОМ контексте - иначе пересечение имен стилей (todoo вытащить генерацию имен в общую часть)
styles_context->create_style(L"",odf_types::style_family::Text, false, true, -1);
styles_context->create_style(L"", odf_types::style_family::Text, false, true, -1);
odf_writer::odf_style_state_ptr style_state = styles_context->last_state(odf_types::style_family::Text);
if (style_state)
{
......
......@@ -986,9 +986,16 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
}
update_shape.txBody->lstStyle.reset(newListStyle);
}
pShape->Merge(update_shape);
//if (pShape->IsListStyleEmpty() == false)
//{
// //create list style
//}else if (listMasterStyle)
//{
//}
OoxConverter::convert(&update_shape);
}
else
......
......@@ -437,7 +437,6 @@ namespace PPTX
pWriter->EndRecord();
}
void Shape::FillLevelUp()
{
if ((m_pLevelUp == NULL) && (nvSpPr.nvPr.ph.IsInit()))
......@@ -452,6 +451,21 @@ namespace PPTX
}
}
bool Shape::IsListStyleEmpty()
{
if ((m_pLevelUp) && (m_pLevelUp->IsListStyleEmpty() == false)) return false;
if (txBody.IsInit() == false) return true;
if (txBody->lstStyle.IsInit() == false) return true;
for (int i = 0; i < 10; i++)
{
if (txBody->lstStyle->levels[i].IsInit())
return false;
}
return true;
}
void Shape::Merge(Shape& shape, bool bIsSlidePlaceholder)
{
if (m_pLevelUp)
......
......@@ -303,6 +303,7 @@ namespace PPTX
void FillLevelUp();
void Merge(Shape& shape, bool bIsSlidePlaceholder = false);
bool IsListStyleEmpty();
void SetLevelUpElement( Shape* p){m_pLevelUp = p;};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment