Commit b767a207 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

(1.2.0.132): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57864 954022d7-b5bf-4e40-9824-e11837661b57
parent e553a25b
......@@ -928,9 +928,9 @@ void odf_drawing_context::set_z_order(int id)
}
void odf_drawing_context::set_path(std::wstring path_string)
{
boost::replace_all(path_string, L",,", L" 0 ");
boost::replace_all(path_string, L" -", L"-");
boost::replace_all(path_string, L",", L"0"); //
//boost::replace_all(path_string, L",,", L" 0 ");
//boost::replace_all(path_string, L" -", L"-");
//boost::replace_all(path_string, L",", L"0"); //
impl_->current_drawing_state_.path_ = path_string;
}
void odf_drawing_context::add_path_element(std::wstring command, std::wstring & strE)
......
......@@ -12,6 +12,8 @@ namespace cpdoccore {
namespace odf {
class ods_conversion_context;
class style_list_level_properties;
class style_list_level_label_alignment;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
......@@ -33,7 +35,8 @@ public:
void start_style(int abstract_number);
void 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();
void end_style_level();
void end_style();
......@@ -42,6 +45,7 @@ public:
void process_styles(office_element_ptr root );
std::wstring get_style_name(int oox_style_num);
std::wstring get_style_name1(int oox_style_num);
private:
std::vector<list_format_state> lists_format_array_;
......
......@@ -33,9 +33,7 @@ odf_text_context::odf_text_context(odf_conversion_context *odf_context)
keep_next_paragraph_ = false;
list_state_.currnet_level = -1 ;
list_state_.started_list = false;
list_state_.started_list_item = false;
}
odf_text_context::~odf_text_context()
{
......@@ -52,9 +50,9 @@ void odf_text_context::clear_params()
keep_next_paragraph_ = false;
list_state_.currnet_level = -1 ;
list_state_.levels.clear();
list_state_.started_list = false;
list_state_.started_list_item = false;
list_state_.style_name = L"";
}
void odf_text_context::set_styles_context(odf_style_context* styles_context)
{
......@@ -333,6 +331,9 @@ void odf_text_context::end_span()
void odf_text_context::start_list_item()
{
if (styles_context_ == NULL || single_paragraph_)return;
if (list_state_.levels.size() < 1) return;
if (list_state_.levels.back()) end_list_item();
office_element_ptr list_elm;
create_element(L"text", L"list-item", list_elm, odf_context_);
......@@ -350,20 +351,20 @@ void odf_text_context::start_list_item()
current_level_.back().elm->add_child_element(list_elm);
current_level_.push_back(state);
list_state_.started_list_item = true;
list_state_.currnet_level++;
list_state_.levels.back() = true;
}
void odf_text_context::end_list_item()
{
if (styles_context_ == NULL || single_paragraph_)
return;
if (styles_context_ == NULL || single_paragraph_) return;
if (list_state_.levels.size() < 1) return;
if (list_state_.levels.back() == false) return;
if (current_level_.size() > 0)
current_level_.pop_back();
list_state_.currnet_level--;
list_state_.started_list_item = false;
list_state_.levels.back() = false;
}
void odf_text_context::start_list(std::wstring style_name) //todoooo add new_numbering ???
{
......@@ -383,8 +384,9 @@ void odf_text_context::start_list(std::wstring style_name) //todoooo add new_num
if (list)
{
list->text_style_name_ = style_ref(style_name);
list->text_continue_numbering_ = true;
//list->text_continue_numbering_ = true;
}
list_state_.style_name = style_name;
}
text_elements_list_.push_back(state);
......@@ -393,17 +395,19 @@ void odf_text_context::start_list(std::wstring style_name) //todoooo add new_num
current_level_.push_back(state);
list_state_.levels.push_back(false);
list_state_.started_list = true;
}
void odf_text_context::end_list()
{
if (styles_context_ == NULL || single_paragraph_)return;
if (list_state_.levels.size() < 1) return;
if (list_state_.levels.back()) end_list_item();
if (current_level_.size() > 0)
current_level_.pop_back();
if (current_level_.size() > 0) current_level_.pop_back();
list_state_.started_list_item = false;
list_state_.started_list = false;
list_state_.levels.pop_back();
}
/////////////////////////////////////////////////////////////////////////////////////////// LIST
void odf_text_context::start_field(int type)
......
......@@ -86,14 +86,13 @@ public:
bool get_KeepNextParagraph() {return keep_next_paragraph_;}
void set_KeepNextParagraph(bool val) {keep_next_paragraph_ = val;}
bool get_list_item_state() {return list_state_.started_list_item;}
bool get_list_item_state() {return list_state_.levels.size() > 0 ? list_state_.levels.back() : false;}
struct _list_state
{
bool started_list_item;
bool started_list;
int currnet_level;
bool started_list;
std::vector<bool> levels;
std::wstring style_name;
}list_state_;
private:
bool keep_next_paragraph_;
......
......@@ -442,44 +442,56 @@ void odt_conversion_context::end_paragraph()
void odt_conversion_context::start_list_item(int level, std::wstring style_name )
{
if (text_context()->list_state_.started_list == false)
//if (text_context()->list_state_.started_list == false)
//{
// text_context()->start_list(style_name);
// add_to_root();
// text_context()->start_list_item();
//}
level = level +1; // 1 ( 0)
if (text_context()->list_state_.style_name != style_name && text_context()->list_state_.started_list)
{
text_context()->start_list(style_name);
add_to_root();
set_no_list();
}
if (text_context()->list_state_.currnet_level >= level)
while (text_context()->list_state_.levels.size() > level)
{
while (text_context()->list_state_.currnet_level >= level)
{
text_context()->end_list_item();
}
text_context()->end_list();
}
if (text_context()->list_state_.currnet_level < level)
if (text_context()->list_state_.started_list == false)
{
while (text_context()->list_state_.currnet_level < level)
text_context()->start_list(style_name);
add_to_root();
text_context()->start_list_item();
}
else
{
text_context()->start_list_item();
while (text_context()->list_state_.levels.size() < level)
{
text_context()->start_list(L"");
text_context()->start_list_item();
}
}
}
void odt_conversion_context::end_list_item()
{
if (text_context()->list_state_.currnet_level < 0)
return;
text_context()->end_list_item();
}
void odt_conversion_context::set_no_list()
{
if (text_context()->list_state_.started_list == false) return;
while (text_context()->list_state_.currnet_level >=0)
while (text_context()->list_state_.levels.size()>0)
{
text_context()->end_list_item();
text_context()->end_list();
}
text_context()->end_list();
text_context()->list_state_.started_list = false;
text_context()->list_state_.style_name = L"";
}
void odt_conversion_context::flush_section()
{
......
......@@ -20,9 +20,9 @@ void text_list_style_attr::serialize(CP_ATTR_NODE)
void text_list_level_style_number_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
CP_XML_ATTR(L"text:display-levels", text_display_levels_);
CP_XML_ATTR_OPT(L"text:start-value", text_start_value_);
CP_XML_ATTR_OPT(L"text:style-name" , text_style_name_);
CP_XML_ATTR_OPT(L"text:display-levels" , text_display_levels_);
CP_XML_ATTR_OPT(L"text:start-value" , text_start_value_);
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
......@@ -165,7 +165,11 @@ void style_list_level_properties::serialize(std::wostream & strm)
common_vertical_rel_attlist_.serialize(CP_GET_XML_NODE());
common_vertical_pos_attlist_.serialize(CP_GET_XML_NODE());
if (style_list_level_label_alignment_) style_list_level_label_alignment_->serialize(CP_XML_STREAM());
if (style_list_level_label_alignment_)
{
CP_XML_ATTR(L"text:list-level-position-and-space-mode", L"label-alignment");
style_list_level_label_alignment_->serialize(CP_XML_STREAM());
}
}
}
}
......@@ -193,6 +197,7 @@ void style_list_level_label_alignment::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"text:list-tab-stop-position", text_list_tab_stop_position_);
CP_XML_ATTR_OPT(L"fo:text-indent", fo_text_indent_);
CP_XML_ATTR_OPT(L"fo:margin-left", fo_margin_left_);
CP_XML_ATTR_OPT(L"fo:margin-right", fo_margin_right_);
}
}
}
......
......@@ -54,14 +54,14 @@ CP_REGISTER_OFFICE_ELEMENT2(text_list_style);
class text_list_level_style_number_attr
{
public:
text_list_level_style_number_attr() : text_display_levels_(1), text_start_value_(1) {}
text_list_level_style_number_attr() {}
_CP_OPT(style_ref) text_style_name_;
common_num_format_attlist common_num_format_attlist_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
unsigned int text_display_levels_;
_CP_OPT(unsigned int) text_display_levels_;
_CP_OPT(unsigned int) text_start_value_;
void serialize(CP_ATTR_NODE);
......@@ -98,11 +98,12 @@ public:
_CP_OPT(length) text_space_before_;
_CP_OPT(length) text_min_label_width_;
_CP_OPT(length) text_min_label_distance_;
_CP_OPT(std::wstring) style_font_name_;
_CP_OPT(length) fo_width_;
_CP_OPT(length) fo_height_;
common_text_align common_text_align_;
common_text_align common_text_align_;
common_vertical_rel_attlist common_vertical_rel_attlist_;
common_vertical_pos_attlist common_vertical_pos_attlist_;
......@@ -129,9 +130,13 @@ public:
virtual void serialize(std::wostream & strm);
_CP_OPT(std::wstring) text_label_followed_by_;
_CP_OPT(length) text_list_tab_stop_position_;
_CP_OPT(length) fo_text_indent_;
_CP_OPT(length) fo_margin_left_;
_CP_OPT(length) fo_margin_left_;
_CP_OPT(length) fo_margin_right_;
};
......
......@@ -147,8 +147,8 @@ void text_list::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR(L"text:style-name",text_style_name_);
CP_XML_ATTR_OPT(L"text_continue_numbering_", text_continue_numbering_ );
CP_XML_ATTR_OPT(L"text:style-name" , text_style_name_);
CP_XML_ATTR_OPT(L"text_continue_numbering_" , text_continue_numbering_ );
if (text_list_header_) text_list_header_->serialize(CP_XML_STREAM());
......
......@@ -128,7 +128,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
style_ref text_style_name_;
_CP_OPT(style_ref) text_style_name_;
_CP_OPT(Bool) text_continue_numbering_;
office_element_ptr text_list_header_;
......
......@@ -25,6 +25,7 @@
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
#include "styles_list.h"
using namespace cpdoccore;
......@@ -344,7 +345,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit())
{
list_style_name = odt_context->styles_context()->lists_styles().get_style_name(oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal->GetValue());
list_style_name = odt_context->styles_context()->lists_styles().get_style_name1(oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal->GetValue());
odt_context->styles_context()->last_state()->set_list_style_name(list_style_name);
}
}
......@@ -390,7 +391,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
if (!odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_paragraph();
if(bListItemNeed && !odt_context->text_context()->get_KeepNextParagraph())
{
odt_context->end_list_item();
}
else
bListItemNeed = bListItemNeed;
}
......@@ -2247,7 +2250,7 @@ void DocxConverter::convert_lists_styles()
odt_context->styles_context()->lists_styles().add_style( lists_styles->m_arrNum[i].m_oNumId->GetValue(), abstr_num);
}
convert(&lists_styles->m_arrNum[i]);
convert(&lists_styles->m_arrNum[i]);//for override ???
}
//nullable<ComplexTypes::Word::CDecimalNumber > m_oNumIdMacAtCleanup;
}
......@@ -2387,6 +2390,12 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
if (oox_num_lvl->m_oNumFmt->m_oVal.IsInit()== false) return; //???
odt_context->styles_context()->lists_styles().start_style_level(oox_num_lvl->m_oIlvl->GetValue(), oox_num_lvl->m_oNumFmt->m_oVal->GetValue());
odf::style_list_level_properties * level_props = odt_context->styles_context()->lists_styles().get_list_level_properties();
odf::style_list_level_label_alignment * aligment_props = odt_context->styles_context()->lists_styles().get_list_level_alignment_properties();
if (level_props == NULL)return;
if (aligment_props == NULL)return;
//nullable<SimpleTypes::COnOff<> > m_oTentative;
//nullable<SimpleTypes::CLongHexNumber<> > m_oTplc;
......@@ -2394,15 +2403,61 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
//// Childs
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oIsLgl;
//nullable<ComplexTypes::Word::CLvlLegacy > m_oLegacy;
//nullable<ComplexTypes::Word::CJc > m_oLvlJc;
//nullable<ComplexTypes::Word::CDecimalNumber > m_oLvlPicBulletId;
//nullable<ComplexTypes::Word::CDecimalNumber > m_oLvlRestart;
//nullable<ComplexTypes::Word::CLevelText > m_oLvlText;
//nullable<OOX::Logic::CParagraphProperty > m_oPPr;
//nullable<ComplexTypes::Word::CString_ > m_oPStyle;
//nullable<OOX::Logic::CRunProperty > m_oRPr;
if (oox_num_lvl->m_oLvlPicBulletId.IsInit())
{
// bullet
}
if (oox_num_lvl->m_oLvlJc.IsInit())
{
}
if (oox_num_lvl->m_oPPr.IsInit())
{
if (oox_num_lvl->m_oPPr->m_oInd.IsInit())
{
_CP_OPT(odf::length) length_indent;
convert(oox_num_lvl->m_oPPr->m_oInd->m_oHanging.GetPointer(), length_indent);
if (length_indent) aligment_props->fo_text_indent_ = odf::length(-length_indent->get_value_unit(odf::length::cm),odf::length::cm);//text_min_label_width_
_CP_OPT(odf::length) length_margin;
if (oox_num_lvl->m_oPPr->m_oInd->m_oStart.IsInit())
{
convert(oox_num_lvl->m_oPPr->m_oInd->m_oStart.GetPointer(), length_margin);
if (length_margin && length_indent) length_margin = *length_margin + *length_indent;
if (length_margin) aligment_props->fo_margin_left_ = odf::length(length_margin->get_value_unit(odf::length::cm),odf::length::cm);
}
if (oox_num_lvl->m_oPPr->m_oInd->m_oEnd.IsInit())
{
convert(oox_num_lvl->m_oPPr->m_oInd->m_oEnd.GetPointer(), length_margin);
if (length_margin && length_indent) length_margin = *length_margin + *length_indent;
if (length_margin) aligment_props->fo_margin_right_ = odf::length(length_margin->get_value_unit(odf::length::cm),odf::length::cm);
}
//level_props->text_space_before_ = odf::length(length_margin->get_value_unit(odf::length::cm),odf::length::cm);
//nullable<SimpleTypes::CDecimalNumber<> > m_oEndChars;
//nullable<SimpleTypes::CTwipsMeasure > m_oFirstLine;
//nullable<SimpleTypes::CDecimalNumber<> > m_oFirstLineChars;
//nullable<SimpleTypes::CDecimalNumber<> > m_oHangingChars;
//nullable<SimpleTypes::CDecimalNumber<> > m_oStartChars;
//level_props->text_min_label_width_
}
}
if (oox_num_lvl->m_oRPr.IsInit())//
{
}
//nullable<ComplexTypes::Word::CDecimalNumber > m_oStart;
//nullable<ComplexTypes::Word::CLevelSuffix > m_oSuffix;
if (oox_num_lvl->m_oSuffix.IsInit())
{
}
odt_context->styles_context()->lists_styles().end_style_level();
}
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//130
#define INTVER 1,2,0,130
#define STRVER "1,2,0,130\0"
//132
#define INTVER 1,2,0,132
#define STRVER "1,2,0,132\0"
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