Commit 925bca71 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - small refactoring, fix chart size (from xls)

parent c9f23151
......@@ -32,8 +32,6 @@
#include "abstract_xml.h"
#include <boost/foreach.hpp>
namespace cpdoccore {
namespace odf_writer {
......
......@@ -31,8 +31,6 @@
*/
#include "calcext_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -86,9 +84,9 @@ void calcext_conditional_formats::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -115,9 +113,9 @@ void calcext_conditional_format::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"calcext:target-range-address",calcext_target_range_address_);
BOOST_REVERSE_FOREACH(const office_element_ptr & item, content_)
for (size_t i = content_.size() - 1; i >= 0; i--)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -144,9 +142,9 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
{
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -170,9 +168,9 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -198,9 +196,9 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
{
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/xml/xmlchar.h>
......@@ -68,11 +67,11 @@ void draw_base::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void draw_base::serialize(std::wostream & _Wostream)
void draw_base::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
void draw_base::serialize_attlist(CP_ATTR_NODE)
......
......@@ -36,7 +36,6 @@
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/regex.h>
......@@ -88,9 +87,9 @@ void draw_image::serialize(std::wostream & _Wostream)
if (office_binary_data_)office_binary_data_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -136,9 +135,9 @@ void draw_chart::serialize(std::wostream & _Wostream)
draw_chart_attlist_.serialize(CP_GET_XML_NODE());
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -167,9 +166,9 @@ void draw_g::serialize(std::wostream & _Wostream)
{
common_draw_attlists_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -430,16 +430,15 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, draw_equation_)
for (size_t i = 0; i < draw_equation_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
draw_equation_[i]->serialize(CP_XML_STREAM());
}
BOOST_FOREACH(office_element_ptr & elm, draw_handle_)
for (size_t i = 0; i < draw_handle_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
draw_handle_[i]->serialize(CP_XML_STREAM());
}
}
}
}
......
......@@ -32,8 +32,6 @@
#include "list.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -80,9 +78,9 @@ void text_list_item::serialize(std::wostream & _Wostream)
{
if (text_number_)text_number_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -129,9 +127,9 @@ void text_list_header::serialize(std::wostream & _Wostream)
{
if (text_number_)text_number_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & parElement, content_)
for (size_t i = 0; i < content_.size(); i++)
{
parElement->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -34,7 +34,6 @@
#include "odf_rels.h"
#include <boost/regex.h>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <cpdoccore/xml/utils.h>
......@@ -85,11 +84,11 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
std::wstring output_path ;
BOOST_FOREACH(item const & elm, items_)
for (size_t i = 0; i < items_.size(); i++)
{
if (elm.oox_ref == input_path)
if (items_[i].oox_ref == input_path)
{
output_path = elm.odf_ref;
output_path = items_[i].odf_ref;
break;
}
}
......@@ -110,12 +109,11 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
}
void _mediaitems::dump_rels(rels & Rels, std::wstring local_path)
{
size_t i = 0;
BOOST_FOREACH(item & elm, items_)
for (size_t i = 0; i < items_.size(); i++)
{
Rels.add( relationship(
utils::media::get_rel_type(elm.type),
local_path + elm.odf_ref)
utils::media::get_rel_type(items_[i].type),
local_path + items_[i].odf_ref)
);
}
......
......@@ -33,7 +33,6 @@
#include "mediaitems_utils.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace cpdoccore {
......
......@@ -30,9 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/xmlchar.h>
......@@ -67,13 +64,13 @@ void number_style_base::serialize(std::wostream & strm)
if (style_text_properties_)
style_text_properties_->serialize(strm);
BOOST_FOREACH(office_element_ptr & elm, style_map_)
for (size_t i = 0; i < style_map_.size(); i++)
{
elm->serialize(strm);
style_map_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(strm);
content_[i]->serialize(strm);
}
}
void number_style_base::serialize(CP_ATTR_NODE)
......@@ -166,9 +163,9 @@ void number_text::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -194,9 +191,9 @@ void number_embedded_text::serialize(std::wostream & strm)
{
CP_XML_ATTR_OPT(L"number:position", number_position_);
BOOST_FOREACH(office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -229,9 +226,9 @@ void number_number::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"number:min-integer-digits", number_min_integer_digits_);
CP_XML_ATTR_OPT(L"number:grouping", number_grouping_);
BOOST_FOREACH(office_element_ptr & elm, number_embedded_text_)
for (size_t i = 0; i < number_embedded_text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
number_embedded_text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -336,9 +333,9 @@ void number_text_content::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -30,8 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <cpdoccore/utf8cpp/utf8.h>
#include <cpdoccore/xml/simple_xml_writer.h>
......@@ -92,9 +90,10 @@ namespace odf_writer
///////////////
void manifect_file::add_rels(rels & r)
{
BOOST_FOREACH(relationship & item, r.relationships())
std::vector<relationship> & rels = r.relationships();
for (size_t i = 0; i < rels.size(); i++)
{
rels_.add(item);
rels_.add(rels[i]);
}
}
manifect_file::manifect_file(std::wstring t)
......@@ -188,13 +187,14 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
std::vector< _mediaitems::item > & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++)
{
if (item.type == _mediaitems::typeMedia)
if (items[i].type == _mediaitems::typeMedia)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
}
}
......@@ -212,15 +212,16 @@ namespace odf_writer
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Pictures";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
std::vector< _mediaitems::item > & items = mediaitems_.items();
for (size_t i = 0; i < items.size(); i++)
{
if (item.type == _mediaitems::typeImage && item.oox_ref.length()>0)
if (items[i].type == _mediaitems::typeImage && items[i].oox_ref.length()>0)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
try
{
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
}catch (...)
{
}
......@@ -289,13 +290,12 @@ namespace odf_writer
{
if (base_)base_->write(RootPath);
long count = 0;
BOOST_FOREACH(const element_ptr & item, objects_)
for (size_t i = 0; i < objects_.size(); i++)
{
std::wstring path = RootPath + FILE_SEPARATOR_STR + item->local_path;
std::wstring path = RootPath + FILE_SEPARATOR_STR + objects_[i]->local_path;
NSDirectory::CreateDirectory(path);
item->write(path);
objects_[i]->write(path);
}
if (manifest_) manifest_->write(RootPath);
if (mimetype_) mimetype_->write(RootPath);
......
......@@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"
......
......@@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
......
......@@ -30,8 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
......@@ -134,16 +132,15 @@ void odf_conversion_context::end_document()
objects_.back().scripts->serialize(content_root_->styles());
object.content->serialize(content_root_->content());
BOOST_FOREACH(const office_element_ptr & elm, object.content_styles)
for (size_t i = 0; i < object.content_styles.size(); i++)
{
elm->serialize(content_root_->styles());
object.content_styles[i]->serialize(content_root_->styles());
}
package::content_simple_ptr content_style_ = package::content_simple::create();
BOOST_FOREACH(const office_element_ptr & elm, object.styles)
for (size_t i = 0; i < object.styles.size(); i++)
{// мастер-пейджы, заданные заливки (градиенты, битмапы), дефолтные стили, колонтитулы, разметки, заметки,...
elm->serialize(content_style_->content());
object.styles[i]->serialize(content_style_->content());
}
package::content_simple_ptr content_settings_ = package::content_simple::create();
object.settings->serialize(content_settings_->content());
......
......@@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
......
......@@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
......
......@@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_page_layout_context.h"
......
......@@ -30,9 +30,6 @@
*
*/
#include <boost/foreach.hpp>
#include "odf_rels.h"
#include <cpdoccore/xml/attributes.h>
......@@ -54,11 +51,11 @@ void relationship::serialize(std::wostream & _Wostream)
}
}
void rels::serialize(std::wostream & _Wostream)
void rels::serialize(std::wostream & strm)
{
BOOST_FOREACH(relationship & r, relationship_)
for (size_t i = 0; i < relationship_.size(); i++)
{
r.serialize(_Wostream);
relationship_[i].serialize(strm);
}
}
......
......@@ -40,7 +40,6 @@
#include "style_paragraph_properties.h"
#include <boost/foreach.hpp>
#include <iostream>
namespace cpdoccore {
......@@ -56,10 +55,10 @@ void calc_paragraph_properties_content(std::vector<style_paragraph_properties*>
{
if (result == NULL)return;
BOOST_REVERSE_FOREACH(style_paragraph_properties* v, parProps)
for (size_t i = parProps.size() - 1; i >= 0; i--)
{
if (v)
result->apply_from(v->content_);
if (parProps[i])
result->apply_from(parProps[i]->content_);
}
}
......@@ -93,7 +92,7 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f
{
std::wstring odf_name = oox_name;
if (odf_name.length() <1)odf_name = find_free_name(family);
if (odf_name.empty()) odf_name = find_free_name(family);
office_element_ptr elm;
create_element(L"style", L"style", elm, odf_context_);
......
......@@ -32,8 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_conversion_context.h"
......
......@@ -32,7 +32,6 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <iostream>
......
......@@ -37,7 +37,6 @@
#include "ods_conversion_context.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"
......
......@@ -32,8 +32,6 @@
#include "office_annotation.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -159,9 +157,9 @@ void office_annotation::serialize(std::wostream & _Wostream)
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -210,9 +208,9 @@ void officeooo_annotation::serialize(std::wostream & _Wostream)
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & item, content_)
for (size_t i = 0; i < content_.size(); i++)
{
item->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -32,8 +32,6 @@
#include "office_body.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......
......@@ -33,10 +33,7 @@
#include "office_chart.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
......@@ -61,9 +58,9 @@ void office_chart::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -101,9 +98,9 @@ void chart_chart::serialize(std::wostream & _Wostream)
{
chart_chart_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -271,9 +268,9 @@ void chart_plot_area::serialize(std::wostream & _Wostream)
{
chart_plot_area_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -349,9 +346,9 @@ void chart_axis::serialize(std::wostream & _Wostream)
{
chart_axis_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -427,9 +424,9 @@ void chart_series::serialize(std::wostream & _Wostream)
{
chart_series_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -32,8 +32,6 @@
#include "office_settings.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -56,9 +54,9 @@ void office_settings::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -88,9 +86,9 @@ void settings_config_item_set::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -145,9 +143,9 @@ void settings_config_item_map_indexed::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -174,9 +172,9 @@ void settings_config_item_map_named::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -203,9 +201,9 @@ void settings_config_item_map_entry::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT( L"config:name", config_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -32,8 +32,6 @@
#include "office_spreadsheet.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -63,9 +61,9 @@ void office_spreadsheet::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -32,10 +32,7 @@
#include "office_text.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
......
......@@ -35,7 +35,6 @@
#include <ostream>
#include <string>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <cpdoccore/xml/xmlchar.h>
......@@ -250,9 +249,9 @@ void text_span::serialize(std::wostream & _Wostream)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
BOOST_FOREACH(const office_element_ptr & parElement, paragraph_content_)
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
if (parElement) parElement->serialize(CP_XML_STREAM());
paragraph_content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -547,9 +546,9 @@ void text_placeholder::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -585,12 +584,12 @@ void text_page_number::serialize(std::wostream & _Wostream)
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"text:page-adjust",text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page",text_select_page_);
CP_XML_ATTR_OPT(L"text:page-adjust", text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page", text_select_page_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -625,9 +624,9 @@ void text_page_count::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -662,9 +661,9 @@ void text_date::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -701,9 +700,9 @@ void text_time::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
CP_XML_ATTR_OPT(L"text:time-value", text_time_value_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -740,9 +739,9 @@ void text_file_name::serialize(std::wostream & _Wostream)
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -776,9 +775,9 @@ void text_sequence::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -823,9 +822,9 @@ void text_sheet_name::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, text_)
for (size_t i = 0; i < text_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
text_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -36,7 +36,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
......
......@@ -38,9 +38,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <boost/foreach.hpp>
#include "borderstyle.h"
namespace cpdoccore {
......@@ -85,9 +82,9 @@ void style_tab_stops::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr & elm, style_tab_stops_)
for (size_t i = 0; i < style_tab_stops_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
style_tab_stops_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -36,7 +36,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
......@@ -91,9 +90,9 @@ void style_columns::serialize(std::wostream & strm)
if(style_column_sep_) style_column_sep_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, style_column_)
for (size_t i = 0; i < style_column_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
style_column_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -37,7 +37,6 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <iostream>
#include <boost/foreach.hpp>
#include "office_elements_create.h"
......@@ -543,17 +542,17 @@ void styles::add_child_element( const office_element_ptr & child, odf_conversion
}
void styles::serialize(std::wostream & strm)//content from different element
{
BOOST_FOREACH(office_element_ptr & elm, number_styles_)
for (size_t i = 0; i < number_styles_.size(); i++)
{
elm->serialize(strm);
number_styles_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, style_style_)
for (size_t i = 0; i < style_style_.size(); i++)
{
elm->serialize(strm);
style_style_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, text_list_style_)
for (size_t i = 0; i < text_list_style_.size(); i++)
{
elm->serialize(strm);
text_list_style_[i]->serialize(strm);
}
}
void templates::create_child_element( const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
......@@ -576,9 +575,9 @@ void templates::add_child_element( const office_element_ptr & child)
}
void templates::serialize(std::wostream & strm)
{
BOOST_FOREACH(office_element_ptr & elm, table_templates_)
for (size_t i = 0; i < table_templates_.size(); i++)
{
elm->serialize(strm);
table_templates_[i]->serialize(strm);
}
}
void draw_styles::create_child_element(const std::wstring & Ns, const std::wstring & Name, odf_conversion_context * Context)
......@@ -632,29 +631,29 @@ void draw_styles::add_child_element( const office_element_ptr & child, odf_conve
void draw_styles::serialize(std::wostream & strm)
{
BOOST_FOREACH(office_element_ptr & elm, draw_fill_image_)
for (size_t i = 0; i < draw_fill_image_.size(); i++)
{
elm->serialize(strm);
draw_fill_image_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_hatch_)
for (size_t i = 0; i < draw_hatch_.size(); i++)
{
elm->serialize(strm);
draw_hatch_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_gradient_)
for (size_t i = 0; i < draw_gradient_.size(); i++)
{
elm->serialize(strm);
draw_gradient_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_opacity_)
for (size_t i = 0; i < draw_opacity_.size(); i++)
{
elm->serialize(strm);
draw_opacity_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_marker_)
for (size_t i = 0; i < draw_marker_.size(); i++)
{
elm->serialize(strm);
draw_marker_[i]->serialize(strm);
}
BOOST_FOREACH(office_element_ptr & elm, draw_stroke_dash_)
for (size_t i = 0; i < draw_stroke_dash_.size(); i++)
{
elm->serialize(strm);
draw_stroke_dash_[i]->serialize(strm);
}
}
// office:automatic-styles
......@@ -696,11 +695,10 @@ void office_automatic_styles::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(office_element_ptr elm, style_page_layout_)
for (size_t i = 0; i < style_page_layout_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
style_page_layout_[i]->serialize(CP_XML_STREAM());
}
styles_.serialize(CP_XML_STREAM());
}
}
......@@ -762,11 +760,10 @@ void office_master_styles::serialize(std::wostream & strm)
if (draw_layer_set_)
draw_layer_set_->serialize(CP_XML_STREAM());
BOOST_FOREACH(office_element_ptr elm, style_master_page_)
for (size_t i = 0; i < style_master_page_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
style_master_page_[i]->serialize(CP_XML_STREAM());
}
if (style_handout_master_)
style_handout_master_->serialize(CP_XML_STREAM());
......
......@@ -33,7 +33,6 @@
#include "table.h"
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -272,7 +271,7 @@ void table_table_columns::create_child_element(const std::wstring & Ns, const st
{
if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT(table_table_column_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
......@@ -284,7 +283,7 @@ void table_table_columns::add_child_element( const office_element_ptr & child_el
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_columns::serialize(std::wostream & _Wostream)
{
......@@ -292,9 +291,9 @@ void table_table_columns::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -309,7 +308,7 @@ void table_table_header_columns::create_child_element( const std::wstring & Ns,
{
if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT(table_table_column_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
......@@ -321,7 +320,7 @@ void table_table_header_columns::add_child_element( const office_element_ptr & c
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_header_columns::serialize(std::wostream & _Wostream)
{
......@@ -329,9 +328,9 @@ void table_table_header_columns::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -347,7 +346,7 @@ void table_columns::create_child_element( const std::wstring & Ns, const std::ws
}
else if CP_CHECK_NAME(L"table", L"table-column")
{
CP_CREATE_ELEMENT_SIMPLE(table_table_column_);
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else
not_applicable_element(L"table-columns", Ns, Name);
......@@ -367,15 +366,15 @@ void table_columns::add_child_element( const office_element_ptr & child_element)
table_table_columns_ = child_element;
}
else if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
content_.push_back(child_element);
}
void table_columns::serialize(std::wostream & _Wostream)
void table_columns::serialize(std::wostream & strm)
{
if (table_table_columns_) table_table_columns_->serialize(_Wostream);
if (table_table_columns_) table_table_columns_->serialize(strm);
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-columns-no-group
......@@ -521,11 +520,11 @@ void table_columns_and_groups::add_child_element( const office_element_ptr & chi
not_applicable_element(L"table-columns-and-groups", L"", L"");
}
}
void table_columns_and_groups::serialize(std::wostream & _Wostream)
void table_columns_and_groups::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-table-cell-content
......@@ -539,11 +538,11 @@ void table_table_cell_content::add_child_element( const office_element_ptr & chi
{
text_content_.push_back(child_element);
}
void table_table_cell_content::serialize(std::wostream & _Wostream)
void table_table_cell_content::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
for (size_t i = 0; i < text_content_.size(); i++)
{
if (elm) elm->serialize(_Wostream);
text_content_[i]->serialize(strm);
}
}
// table:table-cell
......@@ -635,9 +634,9 @@ void table_table_row::serialize(std::wostream & _Wostream)
{
table_table_row_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -650,21 +649,21 @@ const wchar_t * table_table_rows::name = L"table-rows";
void table_table_rows::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(table_table_row_);
CP_CREATE_ELEMENT(content_);
}
void table_table_rows::add_child_element( const office_element_ptr & child_element)
{
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_rows::serialize(std::wostream & _Wostream)
void table_table_rows::serialize(std::wostream & strm)
{
CP_XML_WRITER(_Wostream)
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(strm);
}
}
}
......@@ -679,7 +678,7 @@ void table_table_header_rows::create_child_element( const std::wstring & Ns, con
{
if CP_CHECK_NAME(L"table", L"table-row")
{
CP_CREATE_ELEMENT(table_table_row_);
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
......@@ -691,7 +690,7 @@ void table_table_header_rows::add_child_element( const office_element_ptr & chil
ElementType type = child_element->get_type();
if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_table_header_rows::serialize(std::wostream & _Wostream)
{
......@@ -699,9 +698,9 @@ void table_table_header_rows::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -716,7 +715,7 @@ void table_rows::create_child_element(const std::wstring & Ns, const std::wstrin
}
else if CP_CHECK_NAME(L"table", L"table-row")
{
CP_CREATE_ELEMENT_SIMPLE(table_table_row_);
CP_CREATE_ELEMENT_SIMPLE(content_);
}
else
{
......@@ -733,16 +732,16 @@ void table_rows::add_child_element( const office_element_ptr & child_element)
table_table_rows_ = child_element;
else if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
content_.push_back(child_element);
}
void table_rows::serialize(std::wostream & _Wostream)
void table_rows::serialize(std::wostream & strm)
{
if (table_table_rows_)
table_table_rows_->serialize(_Wostream);
table_table_rows_->serialize(strm);
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table-rows-no-group
......@@ -851,11 +850,11 @@ void table_rows_and_groups::add_child_element( const office_element_ptr & child_
content_.push_back(elm);
}
}
void table_rows_and_groups::serialize(std::wostream & _Wostream)
void table_rows_and_groups::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(_Wostream);
content_[i]->serialize(strm);
}
}
// table:table-row-group
......@@ -911,9 +910,9 @@ void table_shapes::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -187,7 +187,7 @@ public:
public:
office_element_ptr table_table_columns_;
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
......@@ -296,7 +296,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
......@@ -318,7 +318,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
office_element_ptr_array content_;
};
......@@ -472,7 +472,7 @@ public:
{
}
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
......@@ -494,7 +494,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
......@@ -509,7 +509,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_element_ptr table_table_rows_;
office_element_ptr_array table_table_row_;
office_element_ptr_array content_;
};
......
......@@ -32,10 +32,7 @@
#include "text_elements.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "paragraph_elements.h"
......@@ -76,11 +73,11 @@ void paragraph::add_text(const std::wstring & Text)
office_element_ptr elm = text_text::create(Text) ;
paragraph_content_.push_back( elm );
}
void paragraph::serialize(std::wostream & _Wostream)
void paragraph::serialize(std::wostream & strm)
{
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
elm->serialize(_Wostream);
paragraph_content_[i]->serialize(strm);
}
}
void paragraph::serialize_attr(CP_ATTR_NODE)
......@@ -95,11 +92,10 @@ void paragraph_attrs::serialize(CP_ATTR_NODE)
std::wstring text_class_names_all;
BOOST_FOREACH(const std::wstring & elm, text_class_names_)
for (size_t i = 0; i < text_class_names_.size(); i++)
{
text_class_names_all = elm + std::wstring(L" ");
text_class_names_all = text_class_names_[i] + std::wstring(L" ");
}
if (!text_class_names_all.empty())
CP_XML_ATTR(L"text:class-names", text_class_names_all);
}
......@@ -186,9 +182,9 @@ void text_list::serialize(std::wostream & _Wostream)
if (text_list_header_) text_list_header_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & listItem, text_list_items_)
for (size_t i = 0; i < text_list_items_.size(); i++)
{
listItem->serialize(CP_XML_STREAM());
text_list_items_[i]->serialize(CP_XML_STREAM());
}
}
}
......
......@@ -36,8 +36,6 @@
#include "../utils.h"
#include <boost/lexical_cast.hpp>
#include "XlsxConverter.h"
#include "DocxConverter.h"
#include "PptxConverter.h"
......
......@@ -33,7 +33,6 @@
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
......
......@@ -52,8 +52,6 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SplitTransition.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/ZoomTransition.h"
#include <boost/lexical_cast.hpp>
#include "../OdfFormat/odp_conversion_context.h"
#include "../OdfFormat/odf_text_context.h"
......
......@@ -33,7 +33,6 @@
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
......
......@@ -32,7 +32,7 @@
#pragma once
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
......
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