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

(1.2.0.50): ASCOfficeOdfFileW

условное форматирование

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56421 954022d7-b5bf-4e40-9824-e11837661b57
parent d4502d84
#ifndef _CPDOCCORE_ODF_ANCHORTYPE_H_
#define _CPDOCCORE_ODF_ANCHORTYPE_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -49,4 +44,3 @@ APPLY_PARSE_XML_ATTRIBUTES(odf::anchor_type);
}
#endif
#include "precompiled_cpodf.h"
#include "calcext_type.h"
#include <ostream>
namespace cpdoccore { namespace odf {
std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Val)
{
switch(_Val.get_type())
{
case calcext_type::Percent:
_Wostream << L"percent";
break;
case calcext_type::Number:
_Wostream << L"number";
break;
case calcext_type::AutoMaximum:
_Wostream << L"auto-maximum";
break;
case calcext_type::AutoMinimum:
_Wostream << L"auto-minimum";
break;
case calcext_type::Maximum:
_Wostream << L"maximum";
break;
case calcext_type::Minimum:
_Wostream << L"minimum";
break;
default:
break;
}
return _Wostream;
}
calcext_type calcext_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"auto-maximum")
return calcext_type( AutoMaximum );
else if (tmp == L"auto-minimum")
return calcext_type( AutoMinimum );
else if (tmp == L"number")
return calcext_type( Number );
else if (tmp == L"percent")
return calcext_type( Percent );
else if (tmp == L"maximum")
return calcext_type( Maximum );
else if (tmp == L"minimum")
return calcext_type( Minimum );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return calcext_type( Number );
}
}
} }
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf {
class calcext_type
{
public:
enum type
{
Percent,
Number,
Maximum,
Minimum,
AutoMaximum,
AutoMinimum
};
calcext_type() {}
calcext_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static calcext_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf::calcext_type);
}
#include "precompiled_cpodf.h"
#include "iconset_type.h"
#include <ostream>
namespace cpdoccore { namespace odf {
std::wostream & operator << (std::wostream & _Wostream, const iconset_type & _Val)
{
switch(_Val.get_type())
{
case iconset_type::Arrows3:
_Wostream << L"3Arrows";
break;
case iconset_type::Arrows3Grey:
_Wostream << L"3ArrowsGrey";
break;
case iconset_type::Flags3:
_Wostream << L"3Flags";
break;
case iconset_type::Traffic3Lights1:
_Wostream << L"3TrafficLights1";
break;
case iconset_type::Traffic3Lights2:
_Wostream << L"3TrafficLights2";
break;
default:
break;
}
return _Wostream;
}
iconset_type iconset_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"3Arrows")
return iconset_type( Arrows3 );
else if (tmp == L"3ArrowsGrey")
return iconset_type( Arrows3Grey );
else if (tmp == L"3Flags")
return iconset_type( Flags3 );
else if (tmp == L"3TrafficLights1")
return iconset_type( Traffic3Lights1 );
else if (tmp == L"3TrafficLights2")
return iconset_type( Traffic3Lights2 );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return iconset_type( Arrows3 );
}
}
} }
#pragma once
#include <iosfwd>
#include <string>
#include "odfattributes.h"
namespace cpdoccore { namespace odf {
class iconset_type
{
public:
enum type
{
Arrows3,
Arrows3Grey,
Flags3,
Traffic3Lights1,
Traffic3Lights2
};
iconset_type() {}
iconset_type(type _Type) : type_(_Type)
{}
type get_type() const
{
return type_;
};
static iconset_type parse(const std::wstring & Str);
private:
type type_;
};
std::wostream & operator << (std::wostream & _Wostream, const iconset_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf::iconset_type);
}
......@@ -198,6 +198,14 @@
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\borderwidths.h"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\calcext_type.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\calcext_type.h"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\chartdatalabelnumber.cpp"
>
......@@ -422,6 +430,14 @@
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\hyphenationladdercount.h"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\iconset_type.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\iconset_type.h"
>
</File>
<File
RelativePath="..\..\ASCOfficeOdfFile\src\odf\datatypes\keeptogether.cpp"
>
......@@ -894,6 +910,14 @@
<Filter
Name="elements"
>
<File
RelativePath=".\OdfFormat\calcext_elements.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\calcext_elements.h"
>
</File>
<File
RelativePath=".\OdfFormat\draw_base.cpp"
>
......
#include "precompiled_cpodf.h"
#include "calcext_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
namespace cpdoccore {
namespace odf {
void calcext_data_bar_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"calcext:axis-color", calcext_axis_color_);
CP_XML_ATTR_OPT(L"calcext:positive-color", calcext_positive_color_);
CP_XML_ATTR_OPT(L"calcext:negative-color", calcext_negative_color_);
}
void calcext_icon_set_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"calcext:icon-set-type", calcext_icon_set_type_);
}
void calcext_condition_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"calcext:base-cell-address", calcext_base_cell_address_);
CP_XML_ATTR_OPT(L"calcext:apply-style-name", calcext_apply_style_name_);
CP_XML_ATTR_OPT(L"calcext:value", calcext_value_);
}
void calcext_date_is_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"calcext:style", calcext_style_);
CP_XML_ATTR_OPT(L"calcext:date", calcext_date_);
}
// calcext_conditional_formats
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_conditional_formats::ns = L"calcext";
const wchar_t * calcext_conditional_formats::name = L"conditional-formats";
void calcext_conditional_formats::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void calcext_conditional_formats::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void calcext_conditional_formats::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
{
item->serialize(CP_XML_STREAM());
}
}
}
}
// calcext_conditional_format
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_conditional_format::ns = L"calcext";
const wchar_t * calcext_conditional_format::name = L"conditional-format";
void calcext_conditional_format::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void calcext_conditional_format::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void calcext_conditional_format::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"calcext:target-range-address",calcext_target_range_address_);
BOOST_FOREACH(const office_element_ptr & item, content_)
{
item->serialize(CP_XML_STREAM());
}
}
}
}
// calcext_data_bar
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_data_bar::ns = L"calcext";
const wchar_t * calcext_data_bar::name = L"data-bar";
void calcext_data_bar::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void calcext_data_bar::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void calcext_data_bar::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
{
item->serialize(CP_XML_STREAM());
}
}
}
}
// calcext_color_scale
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_color_scale::ns = L"calcext";
const wchar_t * calcext_color_scale::name = L"color-scale";
void calcext_color_scale::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void calcext_color_scale::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void calcext_color_scale::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
{
item->serialize(CP_XML_STREAM());
}
}
}
}
// calcext_icon_set
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_icon_set::ns = L"calcext";
const wchar_t * calcext_icon_set::name = L"icon-set";
void calcext_icon_set::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void calcext_icon_set::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void calcext_icon_set::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
{
item->serialize(CP_XML_STREAM());
}
}
}
}
// calcext_formatting_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_formatting_entry::ns = L"calcext";
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
void calcext_formatting_entry::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"calcext:value",calcext_value_);
CP_XML_ATTR_OPT(L"calcext:type", calcext_type_);
}
}
}
// calcext_color_scale_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
const wchar_t * calcext_color_scale_entry::name = L"color_scale_entry";
void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"calcext:value", calcext_value_);
CP_XML_ATTR_OPT(L"calcext:type", calcext_type_);
CP_XML_ATTR_OPT(L"calcext:color", calcext_color_);
}
}
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_condition::ns = L"calcext";
const wchar_t * calcext_condition::name = L"condition";
void calcext_condition::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_condition_attr_.serialize(CP_GET_XML_NODE());
}
}
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_date_is::ns = L"calcext";
const wchar_t * calcext_date_is::name = L"date-is";
void calcext_date_is::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_date_is_attr_.serialize(CP_GET_XML_NODE());
}
}
}
}
}
\ No newline at end of file
#pragma once
#include <iosfwd>
#include <vector>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/nodetype.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "office_elements_create.h"
#include "color.h"
#include "style_ref.h"
#include "iconset_type.h"
#include "calcext_type.h"
namespace cpdoccore {
namespace odf {
class calcext_data_bar_attr
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(color) calcext_axis_color_;
_CP_OPT(color) calcext_positive_color_;
_CP_OPT(color) calcext_negative_color_;
};
class calcext_condition_attr
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) calcext_base_cell_address_;
_CP_OPT(style_ref) calcext_apply_style_name_;
_CP_OPT(std::wstring) calcext_value_;
};
class calcext_icon_set_attr
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(iconset_type) calcext_icon_set_type_;
};
class calcext_date_is_attr
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
};
//////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief calcext:color-scale-entry
class calcext_color_scale_entry : public office_element_impl<calcext_color_scale_entry>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextColorScaleEntry;
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_element){}
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(color) calcext_color_;
_CP_OPT(std::wstring) calcext_value_;
_CP_OPT(calcext_type) calcext_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale_entry);
/// \brief calcext:formatting-entry
class calcext_formatting_entry : public office_element_impl<calcext_formatting_entry>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextFormattingEntry;
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_element){}
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(std::wstring) calcext_value_;
_CP_OPT(calcext_type) calcext_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_formatting_entry);
/// \brief calcext:icon-set
class calcext_icon_set : public office_element_impl<calcext_icon_set>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextIconSet;
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_element);
virtual void serialize(std::wostream & _Wostream);
calcext_icon_set_attr calcext_icon_set_attr_;
private:
office_element_ptr_array content_;//entries
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_icon_set);
/// \brief calcext:data-bar
class calcext_data_bar: public office_element_impl<calcext_data_bar>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextDataBar;
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_element);
virtual void serialize(std::wostream & _Wostream);
calcext_data_bar_attr calcext_data_bar_attr_;
private:
office_element_ptr_array content_;//entries
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar);
/// \brief calcext:color-scale
class calcext_color_scale: public office_element_impl<calcext_color_scale>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextColorScale;
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_element);
virtual void serialize(std::wostream & _Wostream);
private:
office_element_ptr_array content_;//color_scale_entries
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale);
/// \brief calcext:date-is
class calcext_date_is: public office_element_impl<calcext_date_is>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextDateIs;
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_element){}
virtual void serialize(std::wostream & _Wostream);
calcext_date_is_attr calcext_date_is_attr_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is);
/// \brief calcext:condition
class calcext_condition: public office_element_impl<calcext_condition>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextCondition;
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_element){}
virtual void serialize(std::wostream & _Wostream);
calcext_condition_attr calcext_condition_attr_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_condition);
/// \brief calcext:conditional-format
class calcext_conditional_format: public office_element_impl<calcext_conditional_format>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextConditionalFormat;
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_element);
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(std::wstring) calcext_target_range_address_;
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_conditional_format);
/// \brief calcext:conditional-formats
class calcext_conditional_formats: public office_element_impl<calcext_conditional_formats>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeCalcextConditionalFormats;
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_element);
virtual void serialize(std::wostream & _Wostream);
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_conditional_formats);
}
}
......@@ -413,7 +413,7 @@ void odf_number_styles_context::create_numbers(number_format_state & state, offi
number_number_->number_min_integer_digits_= min_digit;
number_number_->number_decimal_places_= min_decimal;
number_number_->number_grouping_ = true;
//number_number_->number_grouping_ = true;
}
}
void odf_number_styles_context::create_percentage_style(number_format_state & state, office_element_ptr & root_elm)
......
......@@ -46,10 +46,18 @@ void odf_text_context::set_single_object(bool val, style_paragraph_properties *p
void odf_text_context::add_text_content(const std::wstring & text)
{
if (current_level_.size() >=0 )
current_level_.back()->add_text(text);
else
//if (text == L" " && single_paragraph_ == false)
//{
// office_element_ptr elm;
// create_element(L"text", L"s", elm, odf_context_);
// current_level_.back()->add_child_element(elm);
//}
//else
{
if (current_level_.size() >=0 )
current_level_.back()->add_text(text);
}
}
void odf_text_context::start_paragraph(bool styled)
......
......@@ -51,8 +51,13 @@ void ods_conversion_context::start_defined_expressions()
create_element(L"table", L"named-expressions",root_spreadsheet_->getContent(),this);
table_context_.start_defined_expressions(root_spreadsheet_->getContent().back());
}
void ods_conversion_context::start_conditional_formats()
{
current_table().start_conditional_formats();
}
void ods_conversion_context::add_defined_range(std::wstring & name,std::wstring & cell_range, int sheet_id)
{
table_context_.add_defined_range(name,cell_range, sheet_id);
......@@ -61,11 +66,11 @@ void ods_conversion_context::add_defined_expression(std::wstring & name,std::wst
{
table_context_.add_defined_expression(name,value, sheet_id);
}
void ods_conversion_context::start_sheet(std::wstring & name)
void ods_conversion_context::start_sheet()
{
create_element(L"table", L"table",root_spreadsheet_->getContent(),this);
table_context_.start_table(root_spreadsheet_->getContent().back(),name);
table_context_.start_table(root_spreadsheet_->getContent().back());
drawing_context()->set_styles_context(styles_context());
}
......
......@@ -29,7 +29,7 @@ public:
virtual void start_document();
void start_sheet(std::wstring & name);
void start_sheet();
void set_sheet_dimension(std::wstring & ref);
void end_sheet();
......@@ -78,6 +78,10 @@ public:
void add_defined_range(std::wstring & name,std::wstring & cell_range, int sheet_id);
void add_defined_expression(std::wstring & name,std::wstring & value, int sheet_id);
void end_defined_expressions(){}
void start_conditional_formats();
void end_conditional_formats(){}
private:
_font_metrix font_metrix_;
ods_table_context table_context_;
......
......@@ -22,10 +22,12 @@ ods_table_state & ods_table_context::state()
{
return table_state_list_.back();
}
void ods_table_context::start_defined_expressions(office_element_ptr & root_elm)
{
table_defined_expressions_.root = root_elm;
}
void ods_table_context::add_defined_range(std::wstring & name,std::wstring & cell_range, int sheet_id)
{
office_element_ptr elm;
......@@ -102,12 +104,11 @@ void ods_table_context::add_defined_expression(std::wstring & name,std::wstring
table_defined_expressions_.defined.push_back(elm);
}
void ods_table_context::start_table(office_element_ptr & elm, std::wstring & name)
void ods_table_context::start_table(office_element_ptr & elm)
{
table_state_list_.push_back( ods_table_state(context_, elm) );
state().set_table_name(name);
std::wstring style_name_new = L"ta" + boost::lexical_cast<std::wstring>(table_state_list_.size());
office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::Table, true);
......
......@@ -28,7 +28,7 @@ public:
ods_table_context(ods_conversion_context & Context/*, ods_text_context & textCotnext*/);
public:
void start_table(office_element_ptr & elm,std::wstring & name);
void start_table(office_element_ptr & elm);
void end_table();
unsigned int columns_count();
......@@ -36,8 +36,10 @@ public:
ods_table_state & state();
void start_defined_expressions(office_element_ptr & root_elm);
void add_defined_range(std::wstring & name,std::wstring & cell_range, int sheet_id);
void add_defined_expression(std::wstring & name,std::wstring & value, int sheet_id);
private:
ods_conversion_context & context_;
......@@ -45,7 +47,6 @@ private:
std::list<ods_table_state> table_state_list_;
table_defined_expressions_state table_defined_expressions_;
};
......
......@@ -200,6 +200,16 @@ public:
void add_child_element(office_element_ptr & child_element);
void start_conditional_formats();
void start_conditional_format(std::wstring ref);
void start_conditional_rule(std::wstring rule_type);
void set_conditional_value(std::wstring type, std::wstring value );
void set_conditional_iconset(std::wstring type_iconset);
void add_conditional_colorscale(_CP_OPT(color) color);
void set_conditional_databar_color(_CP_OPT(color) color);
void end_conditional_rule();
void end_conditional_format();
void end_conditional_formats();
///////////////////////////////
void add_hyperlink(std::wstring & ref,int col, int row, std::wstring & link);
......@@ -248,7 +258,8 @@ private:
static int current_table_column_;
static int current_table_row_;
static int tmp_value_;
static int tmp_column_;
static int tmp_row_;
std::vector<ods_element_state> columns_;
std::vector<ods_element_state> rows_;
......
......@@ -227,6 +227,16 @@ enum ElementType
typeOfficePresentation,
typeOfficeChart,
typeOfficeEventListeners,
typeCalcextConditionalFormats,
typeCalcextConditionalFormat,
typeCalcextIconSet,
typeCalcextDataBar,
typeCalcextColorScale,
typeCalcextCondition,
typeCalcextDateIs,
typeCalcextFormattingEntry,
typeCalcextColorScaleEntry,
typePresentationEventListener,
......
......@@ -64,12 +64,7 @@ void text_s::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
if (text_c_)
{
CP_XML_ATTR(L"text:c", *text_c_);
}
else
CP_XML_ATTR(L"text:c", L' ');
CP_XML_ATTR_OPT(L"text:c", text_c_);
}
}
......
......@@ -178,6 +178,10 @@ void table_table::add_child_element(office_element_ptr & child_element)
{
table_named_expressions_ = child_element;
}
else if (type == typeCalcextConditionalFormats)
{
table_conditional_formats_ = child_element;
}
}
void table_table::serialize(std::wostream & _Wostream)
......@@ -193,7 +197,8 @@ void table_table::serialize(std::wostream & _Wostream)
table_columns_and_groups_.serialize(CP_XML_STREAM());
table_rows_and_groups_.serialize(CP_XML_STREAM());
if (table_named_expressions_)table_named_expressions_->serialize(CP_XML_STREAM());
if (table_named_expressions_) table_named_expressions_->serialize(CP_XML_STREAM());
if (table_conditional_formats_) table_conditional_formats_->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -614,7 +614,8 @@ public:
//table-scenario
//office-forms
office_element_ptr table_named_expressions_;
office_element_ptr table_shapes_;
office_element_ptr table_conditional_formats_;
office_element_ptr table_shapes_;
table_columns_and_groups table_columns_and_groups_;//table-columns-and-groups
table_rows_and_groups table_rows_and_groups_;
......
......@@ -123,15 +123,17 @@ void XlsxConverter::convert_sheets()
if (NULL != pPair)
{
OOX::Spreadsheet::CWorksheet *pWorksheet = pPair->m_value;
if (NULL != pWorksheet && pWorksheet->m_oSheetData.IsInit())
if (pWorksheet)
{
std::wstring name = string2std_string(pSheet->m_oName.get2());
ods_context->start_sheet(name);
if (pSheet->m_oState.IsInit() && ( pSheet->m_oState->GetValue() == SimpleTypes::Spreadsheet::visibleHidden ||
pSheet->m_oState->GetValue() == SimpleTypes::Spreadsheet::visibleVeryHidden))
ods_context->current_table().set_table_hidden(true);
convert(pWorksheet);
ods_context->end_sheet();
ods_context->start_sheet();
ods_context->current_table().set_table_name(string2std_string(pSheet->m_oName.get2()));
if (pSheet->m_oState.IsInit() && ( pSheet->m_oState->GetValue() == SimpleTypes::Spreadsheet::visibleHidden ||
pSheet->m_oState->GetValue() == SimpleTypes::Spreadsheet::visibleVeryHidden))
ods_context->current_table().set_table_hidden(true);
convert(pWorksheet);
ods_context->end_sheet();
}
}
......@@ -189,7 +191,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
if(pPair->m_value->IsValid())convert(pPair->m_value);
}
}
//
//todooo -
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
......@@ -225,6 +226,20 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(pDrawing);
}
}
//
convert(oox_sheet->m_oAutofilter.GetPointer());
//
if (oox_sheet->m_arrConditionalFormatting.GetCount() >0)
{
ods_context->start_conditional_formats();
for (long fmt =0; fmt < oox_sheet->m_arrConditionalFormatting.GetCount(); fmt++)
{
convert(oox_sheet->m_arrConditionalFormatting[fmt]);
}
ods_context->end_conditional_formats();
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
{
......@@ -407,6 +422,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown)
OOX::Spreadsheet::CText* pText = static_cast<OOX::Spreadsheet::CText*>(oox_unknown);
convert(pText);
}break;
case OOX::Spreadsheet::et_IconSet:
{
OOX::Spreadsheet::CIconSet *pIc = static_cast<OOX::Spreadsheet::CIconSet*>(oox_unknown);
convert(pIc);
}break;
case OOX::Spreadsheet::et_DataBar:
{
OOX::Spreadsheet::CDataBar *pB = static_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown);
convert(pB);
}break;
default:
{
std::wstringstream ss;
......@@ -1460,4 +1485,94 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
ods_context->end_image();
}
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
{
if (!oox_cond_fmt)return;
if (oox_cond_fmt->m_oSqRef.IsInit())
{
ods_context->current_table().start_conditional_format(string2std_string(oox_cond_fmt->m_oSqRef->GetValue()));
for (int i=0; i< oox_cond_fmt->m_arrItems.GetSize(); i++)
convert(oox_cond_fmt->m_arrItems[i]);//rule
ods_context->current_table().end_conditional_format();
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule)
{
if (!oox_cond_rule)return;
if (oox_cond_rule->m_oType.IsInit())
{
ods_context->current_table().start_conditional_rule(string2std_string(oox_cond_rule->m_oType.get2()));
for (long i=0; i< oox_cond_rule->m_arrItems.GetSize(); i++)
convert(oox_cond_rule->m_arrItems[i]);
ods_context->current_table().end_conditional_rule();
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CDataBar *oox_cond_databar)
{
if (!oox_cond_databar)return;
_CP_OPT(odf::color) color;
convert(oox_cond_databar->m_oColor.GetPointer(), color);
ods_context->current_table().set_conditional_databar_color(color);
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
for (long i=0; i< oox_cond_databar->m_arrItems.GetSize(); i++)
convert(oox_cond_databar->m_arrItems[i]);
}
void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
{
if (!oox_cond_colorscale)return;
for (long i=0; i< oox_cond_colorscale->m_arrItems.GetSize(); i++)
{
if (!oox_cond_colorscale->m_arrItems[i])continue;
OOX::Spreadsheet::EElementType type = oox_cond_colorscale->m_arrItems[i]->getType();
if (type == OOX::Spreadsheet::et_ConditionalFormatValueObject)
{
convert(oox_cond_colorscale->m_arrItems[i]);
}
else
{
_CP_OPT(odf::color) color;
convert(static_cast<OOX::Spreadsheet::CColor*>(oox_cond_colorscale->m_arrItems[i]),color);
ods_context->current_table().add_conditional_colorscale(color);
}
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CIconSet *oox_cond_iconset)
{
if (!oox_cond_iconset)return;
if (oox_cond_iconset->m_oIconSet.IsInit())
ods_context->current_table().set_conditional_iconset(string2std_string(oox_cond_iconset->m_oIconSet.get2()));
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMaxLength;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinLength;
//nullable<SimpleTypes::COnOff<>> m_oShowValue;
for (long i=0; i< oox_cond_iconset->m_arrItems.GetSize(); i++)
convert(oox_cond_iconset->m_arrItems[i]);
}
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox_cond_value)
{
if (!oox_cond_value)return;
std::wstring val, type;
if (oox_cond_value->m_oVal.IsInit()) val = string2std_string(oox_cond_value->m_oVal.get2());
if (oox_cond_value->m_oType.IsInit()) type = string2std_string(oox_cond_value->m_oType.get2());
ods_context->current_table().set_conditional_value(type,val);
}
void XlsxConverter::convert(OOX::Spreadsheet::CAutofilter *oox_filter)
{
if (!oox_filter)return;
}
} // namespace Docx2Odt
\ No newline at end of file
......@@ -45,6 +45,13 @@ namespace OOX
class CCommentItem;
class CGraphicFrame;
class CDefinedName;
class CConditionalFormatting;
class CConditionalFormattingRule;
class CDataBar;
class CColorScale;
class CIconSet;
class CConditionalFormatValueObject;
class CAutofilter;
}
}
......@@ -152,6 +159,14 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CConnShape *oox_conn_shape);
void convert(OOX::Spreadsheet::CGraphicFrame *oox_graphic_frame);
void convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt);
void convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule);
void convert(OOX::Spreadsheet::CAutofilter *oox_filter);
void convert(OOX::Spreadsheet::CDataBar *oox_cond_databar);
void convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale);
void convert(OOX::Spreadsheet::CIconSet *oox_cond_iconset);
void convert(OOX::Spreadsheet::CConditionalFormatValueObject*oox_cond_value);
void convert(double oox_size, _CP_OPT(odf::length) & odf_size);
void convert_sharing_string(int number);
};
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//49
#define INTVER 1,2,0,49
#define STRVER "1,2,0,49\0"
//51
#define INTVER 1,2,0,51
#define STRVER "1,2,0,51\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