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

колонки и разделы

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57102 954022d7-b5bf-4e40-9824-e11837661b57
parent 886cca11
......@@ -1163,6 +1163,14 @@
RelativePath=".\OdfFormat\style_map.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_page_layout_properties.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\style_page_layout_properties.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_paragraph_properties.cpp"
>
......@@ -1171,6 +1179,14 @@
RelativePath=".\OdfFormat\style_paragraph_properties.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_section_properties.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\style_section_properties.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_table_properties.cpp"
>
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_conversion_context.h"
#include "odf_comment_context.h"
#include "styles.h"
#include "office_annotation.h"
//#include "style_table_properties.h"
//#include "style_text_properties.h"
//#include "style_paragraph_properties.h"
//#include "style_graphic_properties.h"
namespace cpdoccore
{
namespace odf
{
struct odf_comment_state
{
std::vector<office_element_ptr> elements_;
int oox_id;
std::wstring odf_name;
bool is_started;
};
class odf_comment_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
//styles_context_ = odf_context_->styles_context();
}
std::vector<odf_comment_state> comments_;
odf_conversion_context *odf_context_;
};
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
odf_comment_context::odf_comment_context(odf_conversion_context *odf_context)
: impl_(new odf_comment_context::Impl(odf_context))
{
}
odf_comment_context::~odf_comment_context()
{
}
void odf_comment_context::start_comment(office_element_ptr &elm, int oox_id)
{
odf_comment_state state;
impl_->comments_.push_back(state);
impl_->comments_.back().elements_.push_back(elm);//"0" - root comment eleemnt
impl_->comments_.back().oox_id = oox_id;
impl_->comments_.back().odf_name = L"comment_" + boost::lexical_cast<std::wstring>(oox_id);
impl_->comments_.back().is_started = false;
office_annotation* comm = dynamic_cast<office_annotation*>(elm.get());
if (!comm)return;
comm->office_annotation_attr_.name_ = impl_->comments_.back().odf_name;
}
void odf_comment_context::end_comment(office_element_ptr &elm, int oox_id)
{
for(long i=0; i < impl_->comments_.size(); i++)
{
if (impl_->comments_[i].oox_id == oox_id)
{
office_annotation_end* comm = dynamic_cast<office_annotation_end*>(elm.get());
if (!comm)return;
comm->office_annotation_attr_.name_ = impl_->comments_[i].odf_name;
impl_->comments_[i].elements_.push_back(elm);
return;
}
}
}
void odf_comment_context::start_comment_content()
{
impl_->comments_.back().is_started = true;
}
void odf_comment_context::end_comment_content()
{
impl_->comments_.back().is_started = false;
}
bool odf_comment_context::find_by_id(int oox_id)
{
for(long i=0; i < impl_->comments_.size(); i++)
{
if (impl_->comments_[i].oox_id == oox_id) return true;
}
return false;
}
std::wstring odf_comment_context::find_name_by_id(int oox_id)
{
for(long i=0; i < impl_->comments_.size(); i++)
{
if (impl_->comments_[i].oox_id == oox_id) return impl_->comments_[i].odf_name;
}
return L"";
}
bool odf_comment_context::is_started()
{
if (impl_->comments_.size()>0)
return impl_->comments_.back().is_started;
else return false;
}
void odf_comment_context::set_author(std::wstring author)
{
if ((impl_->comments_.size()<1) || !is_started()) return;
office_element_ptr elm;
create_element(L"dc", L"creator",elm,impl_->odf_context_);
dc_creator* creator = dynamic_cast<dc_creator*>(elm.get());
if (!creator)return;
creator->content_ = author;
impl_->comments_.back().elements_[0]->add_child_element(elm);
impl_->comments_.back().elements_.push_back(elm);
}
void odf_comment_context::set_date(std::wstring _date)
{
if ((impl_->comments_.size()<1) || !is_started()) return;
office_element_ptr elm;
create_element(L"dc", L"date",elm,impl_->odf_context_);
dc_date* date = dynamic_cast<dc_date*>(elm.get());
if (!date)return;
date->content_ = _date;
impl_->comments_.back().elements_[0]->add_child_element(elm);
impl_->comments_.back().elements_.push_back(elm);
}
}
}
\ No newline at end of file
#pragma once
#include <string>
#include <vector>
#include <cpdoccore/CPOptional.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf
{
class odf_conversion_context;
class odf_style_context;
class odf_comment_context
{
public:
odf_comment_context(odf_conversion_context *odf_context);
~odf_comment_context();
void set_styles_context(odf_style_context* styles_context);
bool find_by_id(int oox_id);
bool is_started();
void start_comment(office_element_ptr &elm, int oox_id);
void end_comment(office_element_ptr & elm, int oox_id);
void start_comment_content();
void end_comment_content();
void set_author(std::wstring author);
void set_date(std::wstring author);
private:
std::wstring find_name_by_id(int oox_id);
class Impl;
_CP_PTR(Impl) impl_;
};
}
}
\ No newline at end of file
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_page_layout_context.h"
#include "odf_style_context.h"
#include "ods_conversion_context.h"
#include "logging.h"
#include "styles.h"
#include "style_page_layout_properties.h"
#include <boost/foreach.hpp>
#include <iostream>
namespace cpdoccore {
namespace odf {
......
......@@ -5,6 +5,7 @@
#include "odf_conversion_context.h"
#include "styles.h"
#include "style_page_layout_properties.h"
namespace cpdoccore {
namespace odf {
......
......@@ -271,7 +271,7 @@ std::wstring odf_style_context::get_name_family(const style_family & family)
case style_family::None: return L"none";
case style_family::Paragraph: return L"P";
case style_family::Text: return L"T";
case style_family::Section: return L"sct";
case style_family::Section: return L"Sect";
case style_family::Table: return L"ta";
case style_family::TableColumn: return L"co";
case style_family::TableRow: return L"ro";
......
This diff is collapsed.
#pragma once
#include "odf_conversion_context.h"
#include "odf_comment_context.h"
namespace cpdoccore {
namespace odf {
class office_text;
class odf_text_context;
struct odt_section_state
{
office_element_ptr elm;
office_element_ptr style_elm;
std::wstring style_name;
bool empty;
};
class odt_conversion_context : public odf_conversion_context
{
public:
odt_conversion_context(package::odf_document * outputDocument);
~odt_conversion_context();
virtual void start_document();
virtual void end_document();
virtual void start_text_context();
virtual void end_text_context();
virtual odf_drawing_context * drawing_context();
virtual odf_text_context * text_context();
odf_comment_context * comment_context();
void start_drawings();
void end_drawings();
void start_image(std::wstring & image_file_name);
void add_text_content (std::wstring & text);
void start_paragraph(bool styled = false);
void end_paragraph();
void start_hyperlink(std::wstring ref);
void end_hyperlink();
void start_field();
void end_field();
void set_field_instr(std::wstring instr);
void start_run();
void end_run();
void add_section();
void add_section_columns(int count, double space_pt, bool separator );
void add_section_column(std::vector<std::pair<double,double>> width_space);
bool start_comment(int oox_comment_id);
void end_comment(int oox_comment_id);
void start_comment_content();
void end_comment_content();
private:
office_text* root_text_;
office_element_ptr root_document_;
odf_page_layout_context page_layout_context_;
odf_drawing_context drawing_context_;
odf_comment_context comment_context_;
odf_text_context* current_text_context_;//for embedded
odf_text_context* main_text_context_;
//std::vector<office_element_ptr> current_level_;// ("0- - )
std::vector<office_element_ptr> current_paragraphs_; // for section, if needed
std::vector<odt_section_state> sections_;
struct _field
{
bool enabled;
int type;
std::wstring value;
bool started;
}current_field_;
bool is_hyperlink_;
};
}
}
\ No newline at end of file
#include "precompiled_cpodf.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements.h"
#include "office_elements_create.h"
#include "style_page_layout_properties.h"
namespace cpdoccore {
namespace odf {
/// style:page-layout-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"fo:page-width", fo_page_width_);
CP_XML_ATTR_OPT(L"fo:page-height", fo_page_height_);
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"style:paper-tray-name", style_paper_tray_name_);
CP_XML_ATTR_OPT(L"style:print-orientation", style_print_orientation_);
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
common_vertical_margin_attlist_.serialize(CP_GET_XML_NODE());
common_margin_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize(CP_GET_XML_NODE());
common_padding_attlist_.serialize(CP_GET_XML_NODE());
common_shadow_attlist_.serialize(CP_GET_XML_NODE());
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_XML_ATTR_OPT(L"style:print", style_print_);
CP_XML_ATTR_OPT(L"style:print-page-order", style_print_page_order_);
CP_XML_ATTR_OPT(L"style:first-page-number", style_first_page_number_);
CP_XML_ATTR_OPT(L"style:scale-to", style_scale_to_);
CP_XML_ATTR_OPT(L"style:scale-to_pages", style_scale_to_pages_);
CP_XML_ATTR_OPT(L"style:table-centering", style_table_centering_);
CP_XML_ATTR_OPT(L"style:footnote-max-height", style_footnote_max_height_);
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"style:layout-grid-mode", style_layout_grid_mode_);
CP_XML_ATTR_OPT(L"style:layout-grid-base-height", style_layout_grid_base_height_);
CP_XML_ATTR_OPT(L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
CP_XML_ATTR_OPT(L"style:layout-grid-lines", style_layout_grid_lines_);
CP_XML_ATTR_OPT(L"style:layout-grid-color", style_layout_grid_color_);
CP_XML_ATTR_OPT(L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
CP_XML_ATTR_OPT(L"style:layout-grid-print", style_layout_grid_print_);
CP_XML_ATTR_OPT(L"style:layout-grid-display", style_layout_grid_display_);
}
const wchar_t * style_page_layout_properties::ns = L"style";
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
void style_page_layout_properties::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
style_page_layout_properties_elements_.create_child_element( Ns, Name, getContext());
}
void style_page_layout_properties::add_child_element( office_element_ptr & child)
{
style_page_layout_properties_elements_.add_child_element(child);
}
void style_page_layout_properties::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
style_page_layout_properties_attlist_.serialize( CP_GET_XML_NODE());
style_page_layout_properties_elements_.serialize(CP_XML_STREAM());
}
}
}
// style-page-layout-properties-elements
//////////////////////////////////////////////////////////////////////////////////////////////////
void style_page_layout_properties_elements::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context )
{
if (L"style" == Ns && L"background-image" == Name)
{
CP_CREATE_ELEMENT_SIMPLE(style_background_image_);
}
else if (L"style" == Ns && L"columns" == Name)
{
CP_CREATE_ELEMENT_SIMPLE(style_columns_);
}
else if (L"style" == Ns && L"footnote-sep" == Name)
{
CP_CREATE_ELEMENT_SIMPLE(style_footnote_sep_);
}
else
{
not_applicable_element(L"style-page-layout-properties-elements", Ns, Name);
}
}
void style_page_layout_properties_elements::add_child_element( office_element_ptr & child )
{
if (!child)return;
ElementType type = child->get_type();
switch(type)
{
case typeStyleBackgroundImage:
style_background_image_ = child;
break;
case typeStyleColumns:
style_columns_ = child;
break;
case typeStyleFootnoteSep:
style_footnote_sep_ = child;
}
}
void style_page_layout_properties_elements::serialize(std::wostream & strm)
{
if (style_background_image_) style_background_image_->serialize(strm);
if (style_columns_) style_columns_->serialize(strm);
if (style_footnote_sep_) style_footnote_sep_->serialize(strm);
}
}
}
\ No newline at end of file
#pragma once
#include <string>
#include <vector>
#include <iosfwd>
#include <cpdoccore/CPNoncopyable.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPWeakPtr.h>
#include <cpdoccore/CPOptional.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "common_attlists.h"
#include "tablecentering.h"
#include "layoutgridmode.h"
#include "direction.h"
namespace cpdoccore {
namespace odf {
// style:page-layout-properties-attlist
class style_page_layout_properties_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(length) fo_page_width_; // +
_CP_OPT(length) fo_page_height_; // +
common_num_format_attlist common_num_format_attlist_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
_CP_OPT(std::wstring) style_paper_tray_name_;
_CP_OPT(std::wstring) style_print_orientation_; // +
//15.2.5
common_horizontal_margin_attlist common_horizontal_margin_attlist_;
common_vertical_margin_attlist common_vertical_margin_attlist_;
common_margin_attlist common_margin_attlist_;
// 15.2.6
common_border_attlist common_border_attlist_;
// 15.2.7
common_border_line_width_attlist common_border_line_width_attlist_;
// 15.2.8
common_padding_attlist common_padding_attlist_;
// 15.2.9
common_shadow_attlist common_shadow_attlist_;
// 15.2.10
common_background_color_attlist common_background_color_attlist_;
// 15.2.12
_CP_OPT(style_ref) style_register_truth_ref_style_name_;
// 15.2.13 TODO
_CP_OPT(std::wstring) style_print_;
// 15.2.14
_CP_OPT(direction) style_print_page_order_;
// 15.2.15 TODO
_CP_OPT(std::wstring) style_first_page_number_;
// 15.2.16
_CP_OPT(percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_;
// 15.2.17
_CP_OPT(table_centering) style_table_centering_;
// 15.2.18
_CP_OPT(length) style_footnote_max_height_;
// 15.2.19
common_writing_mode_attlist common_writing_mode_attlist_;
// 15.2.21
_CP_OPT(layout_grid_mode) style_layout_grid_mode_;
// 15.2.22
_CP_OPT(length) style_layout_grid_base_height_;
// 15.2.23
_CP_OPT(length) style_layout_grid_ruby_height_;
// 15.2.24
_CP_OPT(unsigned int) style_layout_grid_lines_;
// 15.2.25
_CP_OPT(color) style_layout_grid_color_;
// 15.2.26
_CP_OPT(Bool) style_layout_grid_ruby_below_;
// 15.2.27
_CP_OPT(Bool) style_layout_grid_print_;
// 15.2.28
_CP_OPT(Bool) style_layout_grid_display_;
};
// style:page-layout-properties-elements
class style_page_layout_properties_elements
{
public:
void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
void add_child_element(office_element_ptr & child);
void serialize(std::wostream & strm);
office_element_ptr style_background_image_;
office_element_ptr style_columns_;
// 15.2.20
office_element_ptr style_footnote_sep_;
};
// style:page-layout-properties
class style_page_layout_properties : public office_element_impl<style_page_layout_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStylePageLayout;
CPDOCCORE_DEFINE_VISITABLE();
style_page_layout_properties() { }
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_page_layout_properties);
}
}
#include "precompiled_cpodf.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements.h"
#include "office_elements_create.h"
#include "style_section_properties.h"
namespace cpdoccore {
namespace odf {
/// style:columns
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_columns::ns = L"style";
const wchar_t * style_columns::name = L"columns";
void style_columns::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
if (L"style" == Ns && L"column" == Name)
CP_CREATE_ELEMENT(style_column_);
else if (L"style" == Ns && L"column-sep" == Name)
CP_CREATE_ELEMENT(style_column_sep_);
else
{
CP_NOT_APPLICABLE_ELM();
}
}
void style_columns::add_child_element(office_element_ptr & child)
{
if (!child)return;
ElementType type = child->get_type();
switch(type)
{
case typeStyleColumn:
style_column_.push_back(child);
break;
case typeStyleColumnSep:
style_column_sep_ = child;
break;
}
}
void style_columns::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"fo:column-count", fo_column_count_);
CP_XML_ATTR_OPT(L"fo:column-gap", fo_column_gap_);
if(style_column_sep_) style_column_sep_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, style_column_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
/// style:column
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_column::ns = L"style";
const wchar_t * style_column::name = L"column";
void style_column::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
void style_column::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"fo:start-indent", fo_start_indent_);
CP_XML_ATTR_OPT(L"fo:end-indent", fo_end_indent_);
CP_XML_ATTR_OPT(L"fo:space-before", fo_space_before_);
CP_XML_ATTR_OPT(L"fo:space-after", fo_space_after_);
}
}
}
/// style:column-sep
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_column_sep::ns = L"style";
const wchar_t * style_column_sep::name = L"column-sep";
void style_column_sep::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
void style_column_sep::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:style", style_style_); // default solid
CP_XML_ATTR_OPT(L"style:width", style_width_);
CP_XML_ATTR_OPT(L"style:height", style_height_); // default 100
CP_XML_ATTR_OPT(L"style:vertical-align",style_vertical_align_); //default top
CP_XML_ATTR_OPT(L"style:color", style_color_); // default #000000
}
}
}
/// style:section-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_section_properties::ns = L"style";
const wchar_t * style_section_properties::name = L"section-properties";
void style_section_properties::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
if (L"style" == Ns && L"background-image" == Name)
CP_CREATE_ELEMENT(style_background_image_);
else if (L"style" == Ns && L"columns" == Name)
CP_CREATE_ELEMENT(style_columns_);
else
{
CP_NOT_APPLICABLE_ELM();
}
}
void style_section_properties::add_child_element(office_element_ptr & child)
{
if (!child)return;
ElementType type = child->get_type();
switch(type)
{
case typeStyleBackgroundImage:
style_background_image_ = child;
break;
case typeStyleColumns:
style_columns_ = child;
break;
}
}
void style_section_properties::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"style:protect", style_protect_); // default false
CP_XML_ATTR_OPT(L"text:dont-balance-text-columns", text_dont_balance_text_columns_);
if (style_columns_) style_columns_->serialize(CP_XML_STREAM());
if (style_background_image_)style_background_image_->serialize(CP_XML_STREAM());
}
}
}
}
}
\ No newline at end of file
#pragma once
#include <iosfwd>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "common_attlists.h"
#include "verticalalign.h"
namespace cpdoccore {
namespace odf {
/// style:columns
class style_columns : public office_element_impl<style_columns>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleColumns;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
_CP_OPT(unsigned int) fo_column_count_;
_CP_OPT(length) fo_column_gap_;
office_element_ptr style_column_sep_;
office_element_ptr_array style_column_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_columns);
/// style:column
class style_column : public office_element_impl<style_column>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleColumn;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
_CP_OPT(length) style_rel_width_;
_CP_OPT(length) fo_start_indent_;
_CP_OPT(length) fo_end_indent_;
_CP_OPT(length) fo_space_before_;
_CP_OPT(length) fo_space_after_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_column);
/// style:column-sep
class style_column_sep : public office_element_impl<style_column_sep>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleColumnSep;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
_CP_OPT(std::wstring) style_style_; // default solid
_CP_OPT(length) style_width_;
_CP_OPT(percent) style_height_; // default 100
_CP_OPT(vertical_align) style_vertical_align_; // default top
_CP_OPT(color) style_color_; // default #000000
};
CP_REGISTER_OFFICE_ELEMENT2(style_column_sep);
/// style:section-properties
class style_section_properties : public office_element_impl<style_section_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleSectionProperties;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
common_background_color_attlist common_background_color_attlist_;
common_horizontal_margin_attlist common_horizontal_margin_attlist_;
common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(Bool) style_protect_; // default false
_CP_OPT(Bool) text_dont_balance_text_columns_;
office_element_ptr style_columns_;
office_element_ptr style_background_image_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_section_properties);
}
}
\ No newline at end of file
......@@ -618,107 +618,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(style_footer_left);
/// style:columns
class style_columns : public office_element_impl<style_columns>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleColumns;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
_CP_OPT(unsigned int) fo_column_count_;
_CP_OPT(length) fo_column_gap_;
office_element_ptr style_column_sep_;
office_element_ptr_array style_column_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_columns);
/// style:column
class style_column : public office_element_impl<style_column>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleColumn;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
_CP_OPT(length) style_rel_width_;
_CP_OPT( length) fo_start_indent_;
_CP_OPT(length) fo_end_indent_;
_CP_OPT(length) fo_space_before_;
_CP_OPT(length) fo_space_after_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_column);
/// style:column-sep
class style_column_sep : public office_element_impl<style_column_sep>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleColumnSep;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
_CP_OPT(std::wstring) style_style_; // default solid
_CP_OPT(length) style_width_;
_CP_OPT(percent) style_height_; // default 100
_CP_OPT(vertical_align) style_vertical_align_; // default top
_CP_OPT(color) style_color_; // default #000000
};
CP_REGISTER_OFFICE_ELEMENT2(style_column_sep);
/// style:section-properties
class style_section_properties : public office_element_impl<style_section_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleSectionProperties;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
common_background_color_attlist common_background_color_attlist_;
common_horizontal_margin_attlist common_horizontal_margin_attlist_;
common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(Bool) style_protect_; // default false
_CP_OPT(Bool) text_dont_balance_text_columns_;
office_element_ptr style_columns_;
office_element_ptr style_background_image_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_section_properties);
/// style:page-layout-attlist
class style_page_layout_attlist
{
......@@ -796,82 +695,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(style_page_layout);
// style:page-layout-properties-attlist
class style_page_layout_properties_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(length) fo_page_width_; // +
_CP_OPT(length) fo_page_height_; // +
common_num_format_attlist common_num_format_attlist_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
_CP_OPT(std::wstring) style_paper_tray_name_;
_CP_OPT(std::wstring) style_print_orientation_; // +
//15.2.5
common_horizontal_margin_attlist common_horizontal_margin_attlist_;
common_vertical_margin_attlist common_vertical_margin_attlist_;
common_margin_attlist common_margin_attlist_;
// 15.2.6
common_border_attlist common_border_attlist_;
// 15.2.7
common_border_line_width_attlist common_border_line_width_attlist_;
// 15.2.8
common_padding_attlist common_padding_attlist_;
// 15.2.9
common_shadow_attlist common_shadow_attlist_;
// 15.2.10
common_background_color_attlist common_background_color_attlist_;
// 15.2.12
_CP_OPT(style_ref) style_register_truth_ref_style_name_;
// 15.2.13 TODO
_CP_OPT(std::wstring) style_print_;
// 15.2.14
_CP_OPT(direction) style_print_page_order_;
// 15.2.15 TODO
_CP_OPT(std::wstring) style_first_page_number_;
// 15.2.16
_CP_OPT(percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_;
// 15.2.17
_CP_OPT(table_centering) style_table_centering_;
// 15.2.18
_CP_OPT(length) style_footnote_max_height_;
// 15.2.19
common_writing_mode_attlist common_writing_mode_attlist_;
// 15.2.21
_CP_OPT(layout_grid_mode) style_layout_grid_mode_;
// 15.2.22
_CP_OPT(length) style_layout_grid_base_height_;
// 15.2.23
_CP_OPT(length) style_layout_grid_ruby_height_;
// 15.2.24
_CP_OPT(unsigned int) style_layout_grid_lines_;
// 15.2.25
_CP_OPT(color) style_layout_grid_color_;
// 15.2.26
_CP_OPT(Bool) style_layout_grid_ruby_below_;
// 15.2.27
_CP_OPT(Bool) style_layout_grid_print_;
// 15.2.28
_CP_OPT(Bool) style_layout_grid_display_;
};
// style:footnote-sep-attlist
class style_footnote_sep_attlist
{
......@@ -909,45 +732,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(style_footnote_sep);
// style:page-layout-properties-elements
class style_page_layout_properties_elements
{
public:
void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
void add_child_element(office_element_ptr & child);
void serialize(std::wostream & strm);
office_element_ptr style_background_image_;
office_element_ptr style_columns_;
// 15.2.20
office_element_ptr style_footnote_sep_;
};
// style:page-layout-properties
class style_page_layout_properties : public office_element_impl<style_page_layout_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStylePageLayout;
CPDOCCORE_DEFINE_VISITABLE();
style_page_layout_properties() { }
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_page_layout_properties);
// text:notes-configuration
class text_notes_configuration : public office_element_impl<text_notes_configuration>
......
......@@ -196,6 +196,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CCommentReference* pCommRef = static_cast<OOX::Logic::CCommentReference*>(oox_unknown);
convert(pCommRef); // Start - Run
}break;
case OOX::et_w_sectPr:
{
OOX::Logic::CSectionProperty *pSectionPr = static_cast<OOX::Logic::CSectionProperty*>(oox_unknown);
convert(pSectionPr, true);
}break;
default:
{
OoxConverter::convert(oox_unknown);
......@@ -495,6 +500,80 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
paragraph_properties->content().outline_level_ = level;
odt_context->text_context()->set_outline_level ( level);
}
convert(oox_paragraph_pr->m_oSectPr.GetPointer());
}
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root)
{
if (oox_section_pr == NULL) return;
if (root) return;
if (oox_section_pr->m_oType.IsInit() && oox_section_pr->m_oType->m_oVal.IsInit())
{
switch(oox_section_pr->m_oType->m_oVal->GetValue())
{
case SimpleTypes::sectionmarkNextColumn :
case SimpleTypes::sectionmarkContinious :
case SimpleTypes::sectionmarkEvenPage :
case SimpleTypes::sectionmarkNextPage :
case SimpleTypes::sectionmarkOddPage :
break;
}
}
odt_context->add_section();
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oBidi;
//nullable<ComplexTypes::Word::CDocGrid > m_oDocGrid;
//nullable<OOX::Logic::CEdnProps > m_oEndnotePr;
//CSimpleArray<ComplexTypes::Word::CHdrFtrRef > m_arrFooterReference;
//nullable<OOX::Logic::CFtnProps > m_oFootnotePr;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oFormProt;
//CSimpleArray<ComplexTypes::Word::CHdrFtrRef > m_arrHeaderReference;
//nullable<ComplexTypes::Word::CLineNumber > m_oLnNumType;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oNoEndnote;
//nullable<ComplexTypes::Word::CPaperSource > m_oPaperSrc;
//nullable<OOX::Logic::CPageBorders > m_oPgBorders;
//nullable<ComplexTypes::Word::CPageMar > m_oPgMar;
//nullable<ComplexTypes::Word::CPageNumber > m_oPgNumType;
//nullable<ComplexTypes::Word::CPageSz > m_oPgSz;
//nullable<ComplexTypes::Word::CRel > m_oPrinterSettings;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oRtlGutter;
//nullable<OOX::Logic::CSectPrChange > m_oSectPrChange;
//nullable<ComplexTypes::Word::CTextDirection > m_oTextDirection;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oTitlePg;
//nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign;
if (oox_section_pr->m_oCols.IsInit() && oox_section_pr->m_oCols->m_oNum.IsInit())
{
int count = oox_section_pr->m_oCols->m_oNum->GetValue();
double default_space_pt = -1;
if (oox_section_pr->m_oCols->m_oSpace.IsInit()) default_space_pt = oox_section_pr->m_oCols->m_oSpace->ToPoints();
bool separator = oox_section_pr->m_oCols->m_oSep.IsInit() && oox_section_pr->m_oCols->m_oSep->ToBool();
odt_context->add_section_columns(count, default_space_pt, separator );
std::vector<std::pair<double,double>> width_space;
for (long i =0; i< oox_section_pr->m_oCols->m_arrColumns.GetSize(); i++)
{
double space = default_space_pt;
if (oox_section_pr->m_oCols->m_arrColumns[i].m_oSpace.IsInit())
space = oox_section_pr->m_oCols->m_arrColumns[i].m_oSpace->ToPoints();
double w = -1;
if (oox_section_pr->m_oCols->m_arrColumns[i].m_oW.IsInit())
w = oox_section_pr->m_oCols->m_arrColumns[i].m_oW->ToPoints();
width_space.push_back(std::pair<double,double>(w,space));
}
for (long i= oox_section_pr->m_oCols->m_arrColumns.GetSize(); i< count; i ++)
{
width_space.push_back(std::pair<double,double>(-1, default_space_pt));
}
odt_context->add_section_column(width_space);
}
}
void DocxConverter::convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_properties * paragraph_properties)
{
......
......@@ -21,6 +21,7 @@ namespace OOX
class CParagraphProperty;
class CRun;
class CRunProperty;
class CSectionProperty;
class CText;
class CAlternateContent;
class CDrawing;
......@@ -89,6 +90,7 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root = false);
void convert(OOX::Logic::CParagraph *oox_paragraph);
void convert(OOX::Logic::CRun *oox_run);
void convert(OOX::Logic::CParagraphProperty *oox_paragraph_prop, odf::style_paragraph_properties *paragraph_properties);
......
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