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

картинки

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55475 954022d7-b5bf-4e40-9824-e11837661b57
parent e89c705f
......@@ -22,6 +22,9 @@ std::wostream & operator << (std::wostream & _Wostream, const xlink_actuate & _A
{
switch (_Actuate.get_type())
{
case xlink_actuate::OnLoad:
_Wostream << "onLoad";
break;
default:
case xlink_actuate::OnRequest:
_Wostream << "onRequest";
......@@ -34,13 +37,16 @@ std::wostream & operator << (std::wostream & _Wostream, const xlink_show & _Show
{
switch (_Show.get_type())
{
case xlink_show::Replace:
_Wostream << L"replace";
break;
case xlink_show::Embed:
_Wostream << L"embed";
break;
default:
case xlink_show::New:
_Wostream << L"new";
break;
case xlink_show::Replace:
_Wostream << L"replace";
break;
}
return _Wostream;
}
......
......@@ -962,14 +962,6 @@
RelativePath=".\OdfFormat\ods_conversion_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\ods_drawing_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\ods_drawing_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\ods_table_context.cpp"
>
......
......@@ -236,36 +236,36 @@ void draw_path::serialize(std::wostream & _Wostream)
}
void draw_path::reset_svg_path()//todooo
{
if (draw_path_attlist_.svg_d_)
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::createSvgD(o_Polyline_cm,draw_path_attlist_.svg_d_.get(),false);
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
{
for (long i=0;i<poly.points.size();i++)
{
if (poly.points[i].x)
{
poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu);
}
if (poly.points[i].y)
{
poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu);
}
}
o_Polyline_pt.push_back(poly);
}
if (o_Polyline_pt.size()>0)
{
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
//if (draw_path_attlist_.svg_d_)
//{
// std::vector<svg_path::_polyline> o_Polyline_pt;
// std::vector<svg_path::_polyline> o_Polyline_cm;
//
// bool res = svg_path::createSvgD(o_Polyline_cm,draw_path_attlist_.svg_d_.get(),false);
//
// BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
// {
// for (long i=0;i<poly.points.size();i++)
// {
// if (poly.points[i].x)
// {
// poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu);
// }
// if (poly.points[i].y)
// {
// poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu);
// }
// }
// o_Polyline_pt.push_back(poly);
// }
// if (o_Polyline_pt.size()>0)
// {
// // xml-oox ... drawing .. ..
// std::wstringstream output_;
// //svg_path::oox_serialize(output_, o_Polyline_pt);
// additional_.push_back(odf::_property(L"custom_path",output_.str()));
// }
//}
}
///////////////////////////////////////
void draw_polygon_attlist::serialize(CP_ATTR_NODE)
......@@ -297,36 +297,36 @@ void draw_polygon::serialize(std::wostream & _Wostream)
}
void draw_polygon::reset_polygon_path()
{
if (draw_polygon_attlist_.draw_points_)
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::createPolygon(o_Polyline_cm,draw_polygon_attlist_.draw_points_.get(),false);
//if (draw_polygon_attlist_.draw_points_)
//{
// std::vector<svg_path::_polyline> o_Polyline_pt;
// std::vector<svg_path::_polyline> o_Polyline_cm;
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
{
for (long i=0;i<poly.points.size();i++)
{
if (poly.points[i].x)
{
poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu);
}
if (poly.points[i].y)
{
poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu);
}
}
o_Polyline_pt.push_back(poly);
}
if (o_Polyline_pt.size()>0)
{
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
// bool res = svg_path::createPolygon(o_Polyline_cm,draw_polygon_attlist_.draw_points_.get(),false);
//
// BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
// {
// for (long i=0;i<poly.points.size();i++)
// {
// if (poly.points[i].x)
// {
// poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu);
// }
// if (poly.points[i].y)
// {
// poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu);
// }
// }
// o_Polyline_pt.push_back(poly);
// }
// if (o_Polyline_pt.size()>0)
// {
// // xml-oox ... drawing .. ..
// std::wstringstream output_;
// svg_path::oox_serialize(output_, o_Polyline_pt);
// additional_.push_back(odf::_property(L"custom_path",output_.str()));
// }
//}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void draw_equation_attlist::serialize(CP_ATTR_NODE)
......@@ -437,6 +437,24 @@ void draw_enhanced_geometry::create_child_element( const ::std::wstring & Ns, co
//not_applicable_element(L"draw_enhanced_geometry", Reader, Ns, Name);
}
}
void draw_enhanced_geometry::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeDrawHandle)
{
draw_handle_.push_back(child_element);
}
else if (type == typeDrawEquation)
{
draw_equation_.push_back(child_element);
}
else
{
//not_applicable_element(L"draw_enhanced_geometry", Reader, Ns, Name);
}
}
void draw_enhanced_geometry::find_draw_type_odf(std::wstring & oox_type)
{
......@@ -542,40 +560,40 @@ void draw_connector::serialize(std::wostream & _Wostream)
}
void draw_connector::reset_svg_path()
{
if (draw_connector_attlist_.svg_d_)
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::createSvgD(o_Polyline_cm,draw_connector_attlist_.svg_d_.get(),false);
double x1=common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::emu);
double y1=common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::emu);
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
{
for (long i=0;i<poly.points.size();i++)
{
if (poly.points[i].x)
{
poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu)-x1;
}
if (poly.points[i].y)
{
poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu)-y1;
}
}
o_Polyline_pt.push_back(poly);
}
if (o_Polyline_pt.size()>0)
{
sub_type_ = 6;
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
//if (draw_connector_attlist_.svg_d_)
//{
// std::vector<svg_path::_polyline> o_Polyline_pt;
// std::vector<svg_path::_polyline> o_Polyline_cm;
//
// bool res = svg_path::createSvgD(o_Polyline_cm,draw_connector_attlist_.svg_d_.get(),false);
//
// double x1=common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::emu);
// double y1=common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::emu);
//
// BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
// {
// for (long i=0;i<poly.points.size();i++)
// {
// if (poly.points[i].x)
// {
// poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu)-x1;
// }
// if (poly.points[i].y)
// {
// poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu)-y1;
// }
// }
// o_Polyline_pt.push_back(poly);
// }
// if (o_Polyline_pt.size()>0)
// {
// sub_type_ = 6;
// // xml-oox ... drawing .. ..
// std::wstringstream output_;
// svg_path::oox_serialize(output_, o_Polyline_pt);
// additional_.push_back(odf::_property(L"custom_path",output_.str()));
// }
//}
}
///////////////////////////////////////
......
......@@ -26,9 +26,6 @@ public:
static const ElementType type = typeDrawShape;
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element);
......@@ -121,8 +118,6 @@ CP_REGISTER_OFFICE_ELEMENT2(draw_circle);
class draw_line_attlist
{
public:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(length) svg_x1_;
_CP_OPT(length) svg_y1_;
......
......@@ -18,13 +18,13 @@ namespace odf {
using boost::filesystem::wpath;
mediaitems::item::item( std::wstring const & _href,
mediaitems::item::item( std::wstring const & _oox_ref,
Type _type,
std::wstring const & _outputName
std::wstring const & _odf_ref
)
: href(_href),
: oox_ref(_oox_ref),
type(_type),
outputName(_outputName)
odf_ref(_odf_ref)
{
}
......@@ -32,68 +32,55 @@ mediaitems::item::item( std::wstring const & _href,
namespace fs = boost::filesystem;
void mediaitems::add_or_find(const std::wstring & href, Type type, std::wstring & ref)
void mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref)
{
std::wstring sub_path;//
std::wstring inputFileName;
std::wstring output_sub_path;//
std::wstring output_fileName;
int number=0;
if (type == typeImage)
{
sub_path = L"Pictures/";
output_sub_path = L"Pictures/";
number= count_image+1;
}
else
{
sub_path = L"Media/";
output_sub_path = L"Media/";
number= count_media+1;
}
inputFileName = utils::media::create_file_name(href, type, number);//guid???
output_fileName = utils::media::create_file_name(oox_ref, type, number);//guid???
std::wstring inputPath = BOOST_STRING_PATH(wpath(oox_packet_) / href);
std::wstring outputPath ;
std::wstring input_path = oox_ref;
boost::to_lower(input_path);
std::wstring output_path ;
std::wstring id;
BOOST_FOREACH(item const & elm, items_)
{
if (elm.href == inputPath)
if (elm.oox_ref == input_path)
{
outputPath = elm.outputName;
output_path = elm.odf_ref;
break;
}
}
if (outputPath .length() < 1)
if (output_path .length() < 1)
{
outputPath = ( sub_path + inputFileName) ;
output_path = ( output_sub_path + output_fileName) ;
if ( type == typeImage)
{
fs::wpath file_name = fs::wpath(inputPath);
if (file_name.extension() == L".svm" || file_name.extension().empty())
{
outputPath = outputPath + L".png";
}
//fs::wpath file_name = fs::wpath(inputPath);
count_image++;
}
else
count_media++;
items_.push_back( item(inputPath, type, xml::utils::replace_text_to_xml(outputPath)) );
}
ref = outputPath;
}
void mediaitems::dump_rels(rels & Rels)
{
size_t i = 0;
BOOST_FOREACH(item & elm, items_)
{
Rels.add( relationship(
utils::media::get_rel_type(elm.type),
elm.outputName)
);
items_.push_back( item(input_path, type, xml::utils::replace_text_to_xml(output_path)) );
}
odf_ref = output_path;
}
......
......@@ -14,7 +14,7 @@ public:
enum Type { typeUnknown = 0, typeImage, typeAudio, typeVideo};
//oleObject ???
mediaitems(const std::wstring & ooxPacket) : oox_packet_(ooxPacket)
mediaitems()
{
count_image =0;
count_media =0;
......@@ -23,27 +23,25 @@ public:
struct item
{
item(
std::wstring const & _href,
std::wstring const & _oox_ref,
Type _type,
std::wstring const & _outputName);
std::wstring const & _odf_ref);
std::wstring href;
std::wstring oox_ref;
Type type;
std::wstring outputName;
std::wstring odf_ref;
};
typedef std::vector< item > items_array;
size_t count_image;
size_t count_media;
void add_or_find(const std::wstring & href, Type type, std::wstring & ref);
void add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref);
void dump_rels(rels & Rels);
items_array & items() { return items_; }
private:
items_array items_;
std::wstring oox_packet_;
};
......
......@@ -155,7 +155,7 @@ namespace odf
void media::write(const std::wstring & RootPath)
{
if (mediaitems_.count_media )return;
if (mediaitems_.count_media < 1)return;
fs::wpath path = fs::wpath(RootPath) / L"media";
fs::create_directory(path);
......@@ -164,10 +164,10 @@ namespace odf
{
if (item.type == mediaitems::typeAudio || item.type == mediaitems::typeVideo)
{
fs::wpath file_name = fs::wpath(item.href);
fs::wpath file_name_out = fs::wpath(RootPath) / item.outputName;
fs::wpath file_name = fs::wpath(item.oox_ref);
fs::wpath file_name_out = fs::wpath(RootPath) / item.odf_ref;
boost::filesystem::copy_file(item.href, file_name_out);
boost::filesystem::copy_file(file_name, file_name_out);
}
}
......@@ -180,7 +180,7 @@ namespace odf
void pictures::write(const std::wstring & RootPath)//folder by content.xml
{
if (mediaitems_.count_image )return;
if (mediaitems_.count_image < 1 )return;
fs::wpath path = fs::wpath(RootPath) / L"Pictures";
fs::create_directory(path);
......@@ -189,10 +189,10 @@ namespace odf
{
if (item.type == mediaitems::typeImage )
{
fs::wpath file_name = fs::wpath(item.href);
fs::wpath file_name_out = fs::wpath(RootPath) / item.outputName;
fs::wpath file_name = fs::wpath(item.oox_ref);
fs::wpath file_name_out = fs::wpath(RootPath) / item.odf_ref;
boost::filesystem::copy_file(item.href, file_name_out);
boost::filesystem::copy_file(file_name, file_name_out);
}
}
......
......@@ -13,7 +13,7 @@ namespace odf {
//////////////////////////////////////////////////////////////////////////////////////////////////
odf_conversion_context::odf_conversion_context(package::odf_document * outputDocument) : style_context_(*this),drawing_context_(&style_context_, this)
odf_conversion_context::odf_conversion_context(package::odf_document * outputDocument) : style_context_(*this)
{
output_document_ = outputDocument;
}
......@@ -70,6 +70,8 @@ void odf_conversion_context::end_document()
{
object_files->set_content(content_root_);
object_files->set_styles(content_style_);
object_files->set_media(mediaitems_);
object_files->set_pictures(mediaitems_);
output_document_->add_object(package::element_ptr(object_files ),true);
......
......@@ -2,7 +2,7 @@
#include "object_package.h"
#include "odf_style_context.h"
#include "odf_drawing_context.h"
#include "mediaitems.h"
namespace cpdoccore {
namespace odf {
......@@ -32,39 +32,36 @@ public:
package::odf_document * output_document_;
odf_style_context & styles_context(){return style_context_;}
odf_drawing_context& drawing_context(){return drawing_context_;}
odf_number_styles_context & numbers_styles_context() {return style_context_.numbers_styles();}
private:
rels rels_;
void process_styles();
public:
odf_drawing_context drawing_context_;
odf_style_context style_context_;
//styles_container & styleContainer() { return major_style_container_; }
//page_layout_container & pageLayoutContainer() { return page_layout_container_; }
//fonts_container & fontContainer() { return fonts_container_; }
//list_style_container & listStyleContainer() { return list_style_container_; }
//notes_configuration & noteConfiguration() { return notes_configuration_; }
//styles_lite_container & numberStyles() { return number_style_container_; }
//styles_lite_container & drawStyles() { return draw_style_container_; }
//styles_lite_container & Templates() { return template_container_; }
private:
mediaitems mediaitems_;
//styles_container major_style_container_;
//page_layout_container page_layout_container_;
//fonts_container fonts_container_;
//list_style_container list_style_container_;
//notes_configuration notes_configuration_;
//styles_lite_container number_style_container_;
//styles_lite_container draw_style_container_;
//styles_lite_container template_container_;
};
......
......@@ -2,6 +2,7 @@
#include "logging.h"
#include <boost/foreach.hpp>
#include <iostream>
#include "odf_drawing_context.h"
......@@ -9,69 +10,147 @@
#include "odf_style_context.h"
#include "odf_conversion_context.h"
#include "draw_frame.h"
#include "draw_shapes.h"
#include "styles.h"
namespace cpdoccore {
#include "style_table_properties.h"
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
namespace cpdoccore
{
namespace odf
{
odf_drawing_context::odf_drawing_context(odf_style_context * styles_context,odf_conversion_context *odf_context)
struct odf_element_state
{
office_element_ptr elm;
std::wstring style_name;
office_element_ptr style_elm;
int level;
};
struct odf_drawing_state
{
void clear()
{
elements_.clear();
svg_x_= boost::none;
svg_y_= boost::none;
svg_height_= boost::none;
svg_width_= boost::none;
}
std::vector<odf_element_state> elements_;
_CP_OPT(length) svg_x_;
_CP_OPT(length) svg_y_;
_CP_OPT(length) svg_height_;
_CP_OPT(length) svg_width_;
};
class odf_drawing_context::Impl
{
styles_context_ = styles_context;
odf_context_ = odf_context;
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
current_drawing_state_.clear();
styles_context_ = &odf_context_->styles_context();
}
std::vector<odf_drawing_state> drawing_list_;// .. ""
odf_drawing_state current_drawing_state_;
std::vector<office_element_ptr> current_level_;//
odf_style_context * styles_context_;
odf_conversion_context *odf_context_;
};
////////////////////////////////////////////////////////////////////////////
odf_drawing_context::odf_drawing_context(odf_conversion_context *odf_context)
: impl_(new odf_drawing_context::Impl(odf_context))
{
}
odf_drawing_context::~odf_drawing_context()
{
}
office_element_ptr & odf_drawing_context::get_current_element(){return impl_->current_level_.back();}
void odf_drawing_context::set_styles_context(odf_style_context* styles_context)
{
styles_context_ = styles_context;
impl_->styles_context_ = styles_context;
}
void odf_drawing_context::start_drawing()//frame???
void odf_drawing_context::start_frame()
{
office_element_ptr frame_elm;
create_element(L"draw", L"frame", frame_elm, odf_context_);
create_element(L"draw", L"frame", frame_elm, impl_->odf_context_);
draw_frame* frame = dynamic_cast<draw_frame*>(frame_elm.get());
if (frame == NULL)return;
//////////////////////////////////////////////////////////////////////////////////////////////
styles_context_->create_style(L"",style_family::Graphic, true, false, -1);
impl_->styles_context_->create_style(L"",style_family::Graphic, true, false, -1);
office_element_ptr & style_frame_elm = styles_context_.last_state().get_office_element();
office_element_ptr & style_frame_elm = impl_->styles_context_->last_state().get_office_element();
std::wstring style_name;
style* style = dynamic_cast<style*>(style_frame_elm.get());
if (style)
style* style_ = dynamic_cast<style*>(style_frame_elm.get());
if (style_)
{
style_name = style->style_name_;
odf::style_table_graphic_properties * gr_properties = style->style_content_.get_style_graphic_properties()
style_name = style_->style_name_;
style_graphic_properties * gr_properties = style_->style_content_.get_style_graphic_properties();
if (gr_properties)
{
}
}
/////////////////////////////////////////////////////////////////////////////////////////////
frame->draw_style_name_ = style_name;
frame->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_ = style_ref(style_name);
frame->common_draw_attlists_.position_.svg_x_ = impl_->current_drawing_state_.svg_x_;
frame->common_draw_attlists_.position_.svg_y_ = impl_->current_drawing_state_.svg_y_;
frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = impl_->current_drawing_state_.svg_height_;
frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = impl_->current_drawing_state_.svg_width_;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int level = impl_->current_level_.size();
/////////////////////////////////////////////////////////////////////////////////////////////
int level = current_level_.size();
if (impl_->current_level_.size()>0)
impl_->current_level_.back()->add_child_element(frame_elm);
odf_drawing_state state={frame_elm, style_name, style_frame_elm, level};
impl_->current_level_.push_back(frame_elm);
drawing_elements_list_.push_back(state);
if (current_level_.size()>0)
current_level_.back()->add_child_element(elm);
odf_element_state state={frame_elm, style_name, style_frame_elm, level};
impl_->current_drawing_state_.elements_.push_back(state);
current_level_.push_back(elm);
}
void odf_drawing_context::end_drawing()
void odf_drawing_context::start_drawing()//frame???
{
impl_->current_drawing_state_.clear();
//text_context_.clear();
}
void odf_drawing_context::end_frame()
{
end_element();
}
void odf_drawing_context::end_drawing()
{
impl_->drawing_list_.push_back(impl_->current_drawing_state_);// frame, shape, ???
impl_->current_drawing_state_.clear();
}
void odf_drawing_context::start_image(std::wstring & path)
{
office_element_ptr image_elm;
create_element(L"draw", L"image", image_elm, odf_context_);
create_element(L"draw", L"image", image_elm, impl_->odf_context_);
draw_image* image = dynamic_cast<draw_image*>(image_elm.get());
if (image == NULL)return;
......@@ -89,19 +168,45 @@ void odf_drawing_context::end_image()
}
void odf_drawing_context::start_element(office_element_ptr & elm)
{
int level = current_level_.size();
int level = impl_->current_level_.size();
odf_element_state state={elm, L"", office_element_ptr(), level};
odf_drawing_state state={elm, L"", office_element_ptr(), level};
impl_->current_drawing_state_.elements_.push_back(state);
drawing_elements_list_.push_back(state);
if (current_level_.size()>0)
current_level_.back()->add_child_element(elm);
if (impl_->current_level_.size()>0)
impl_->current_level_.back()->add_child_element(elm);
current_level_.push_back(elm);
impl_->current_level_.push_back(elm);
}
void odf_drawing_context::end_element()
{
current_level_.pop_back();
impl_->current_level_.pop_back();
}
void odf_drawing_context::set_rect(double x_pt, double y_pt, double width_pt, double height_pt)
{
// ( )
impl_->current_drawing_state_.svg_x_ = length(length(x_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_y_ = length(length(y_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_height_ = length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
}
bool odf_drawing_context::is_exist_content()
{
return (impl_->drawing_list_.size()>0 ? true : false);
}
void odf_drawing_context::finalize(office_element_ptr & root_elm)
{
for (int i=0; i< impl_->drawing_list_.size()>0; i++)
{
if (impl_->drawing_list_[i].elements_.size() > 0)
{
root_elm->add_child_element(impl_->drawing_list_[i].elements_[0].elm);
}
}
}
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
#include <string>
#include <vector>
//
//#include "ods_drawing_context.h"
//#include "ods_comments_context.h"
//#include "ods_hyperlinks.h"
......@@ -19,40 +19,39 @@ class odf_conversion_context;
class odf_style_context;
class paragraph;
struct odf_drawing_state
{
office_element_ptr elm;
std::wstring style_name;
office_element_ptr style_elm;
int level;
};
class odf_drawing_context: boost::noncopyable
class odf_drawing_context
{
public:
odf_drawing_context(odf_style_context * styles_context_,odf_conversion_context *odf_context);
odf_drawing_context(odf_conversion_context *odf_context);
~odf_drawing_context();
public:
void set_styles_context(odf_style_context* styles_context);// embedded
void start_drawing();
void end_drawing();
void start_frame();
void end_frame();
void start_image(std::wstring & path);
void end_image();
void start_element(office_element_ptr & elm);
void end_element();
std::vector<office_element_ptr> current_level_;//
office_element_ptr & get_current_element();
void set_rect(double x_pt, double y_pt, double width_pt, double height_pt);
bool is_exist_content();
void finalize(office_element_ptr & root_elm);
std::vector<odf_drawing_state> drawing_elements_list_;//
private:
odf_style_context * styles_context_;
odf_conversion_context *odf_context_;
class Impl;
_CP_PTR(Impl) impl_;
};
}
......
......@@ -116,6 +116,16 @@ void ods_conversion_context::set_sheet_dimension(std::wstring & ref)
void ods_conversion_context::end_sheet()
{
if (current_table().drawing_context().is_exist_content())
{
office_element_ptr shapes_root_elm;
create_element(L"table", L"shapes",shapes_root_elm,this);
current_table().drawing_context().finalize(shapes_root_elm);
current_table().add_child_element(shapes_root_elm);
}
table_context_.end_table();
styles_context().reset_defaults();
......@@ -413,5 +423,13 @@ void ods_conversion_context::end_cell_text()
}
}
void ods_conversion_context::start_image(std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems_.add_or_find(image_file_name,mediaitems::typeImage,odf_ref_name);
current_table().drawing_context().start_image(odf_ref_name);
}
}
}
......@@ -45,6 +45,14 @@ public:
void start_text_context();
void end_text_context();
odf_drawing_context& drawing_context(){return current_table().drawing_context();}
void start_drawing(){drawing_context().start_drawing();}
void end_drawing(){drawing_context().end_drawing();}
void start_image(std::wstring & image_file_name);
void end_image(){drawing_context().end_image();}
private:
ods_table_context table_context_;
......
......@@ -5,6 +5,8 @@
namespace cpdoccore {
namespace odf {
class ods_conversion_context;
......
......@@ -87,15 +87,13 @@ std::wstring convert_time(std::wstring & oox_time)
///////////////////////////////////////////////////////////////
ods_table_state::ods_table_state(ods_conversion_context & Context, office_element_ptr & elm): context_(Context)
ods_table_state::ods_table_state(ods_conversion_context & Context, office_element_ptr & elm): context_(Context),drawing_context_(&Context)
{
office_table_ = elm;
current_table_row_ =0;
current_table_column_ =0;
current_column_level_ = 1;
current_level_.push_back(office_table_);
//default dimension
......@@ -103,6 +101,10 @@ ods_table_state::ods_table_state(ods_conversion_context & Context, office_elemen
dimension_columns = 1024;
dimension_row = 1024;
defaut_row_height_ = 9;//
defaut_column_width_ = 28.34467120181406 * 1.674;//
}
void ods_table_state::set_table_name(std::wstring name)
......@@ -168,7 +170,7 @@ void ods_table_state::add_column(office_element_ptr & elm, int repeated,office_e
odf::style* style = dynamic_cast<odf::style*>(style_elm.get());
if (style)style_name = style->style_name_;
ods_element_state state = {elm, repeated,style_name, style_elm, current_column_level_};
ods_element_state state = {elm, repeated,style_name, style_elm, defaut_column_width_ , current_level_.size()};
if (repeated > 10000)repeated = 1024;//????
......@@ -200,6 +202,8 @@ void ods_table_state::set_column_width(int width)//cm, pt ???
style_table_column_properties * column_properties = style->style_content_.get_style_table_column_properties();
if (column_properties == NULL)return; //error ????
columns_.back().size = width; //pt
column_properties->style_table_column_properties_attlist_.style_column_width_ = length(width/4.35,length::cm);
}
void ods_table_state::set_column_optimal_width(bool val)
......@@ -218,8 +222,8 @@ void ods_table_state::set_table_dimension(int col, int row)
{
if (col<1 || row <1 )return;
dimension_columns = col +1;
dimension_row = row+1;
if (dimension_columns < col) dimension_columns = col +1;
if (dimension_row < row) dimension_row = row+1;
}
void ods_table_state::add_row(office_element_ptr & elm, int repeated,office_element_ptr & style_elm)
......@@ -234,7 +238,7 @@ void ods_table_state::add_row(office_element_ptr & elm, int repeated,office_elem
odf::style* style = dynamic_cast<odf::style*>(style_elm.get());
if (style)style_name = style->style_name_;
ods_element_state state = {elm, repeated,style_name, style_elm};
ods_element_state state = {elm, repeated,style_name, style_elm, defaut_row_height_ , current_level_.size()};
rows_.push_back(state);
......@@ -273,6 +277,8 @@ void ods_table_state::set_row_height(double height)
style_table_row_properties * row_properties = style->style_content_.get_style_table_row_properties();
if (row_properties == NULL)return; //error ????
rows_.back().size = height;//pt
row_properties->style_table_row_properties_attlist_.style_row_height_ = length(height/22.85,length::cm);
}
......@@ -478,11 +484,52 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
cell->table_table_cell_attlist_.table_formula_ = odfFormula;
}
void ods_table_state::add_child_element(office_element_ptr & child_element)
{
office_table_->add_child_element(child_element);
}
void ods_table_state::convert_position(oox_table_position & oox_pos, double & x, double & y)//c 0
{
double sz_col=0;
int curr_col = 1,i;
for (i=0; i< columns_.size(); i++)
{
if (oox_pos.col > columns_[i].repeated - curr_col)
{
sz_col += (columns_[i].repeated ) * columns_[i].size;
}
else
{
sz_col += (oox_pos.col + 1 - curr_col ) * columns_[i].size;
break;
}
curr_col += columns_[i].repeated;
}
x= sz_col + oox_pos.col_off;
double sz_row=0;
int curr_row = 1;
for (i=0; i< rows_.size(); i++)
{
if (oox_pos.row > rows_[i].repeated - curr_row)
{
sz_row += (rows_[i].repeated ) * rows_[i].size;
}
else
{
sz_row += (oox_pos.row - curr_row +1) * rows_[i].size;
break;
}
curr_row += rows_[i].repeated;
}
y= sz_row + oox_pos.row_off;
}
void ods_table_state::set_cell_text(odf_text_context* text_context)
{
if (text_context == NULL)return;
......
......@@ -6,8 +6,10 @@
//#include "ods_row_spanned.h"
//#include "ods_merge_cells.h"
//#include "ods_table_metrics.h"
//#include "ods_drawing_context.h"
//#include "ods_comments_context.h"
#include "odf_drawing_context.h"
#include "office_elements.h"
#include "office_elements_create.h"
......@@ -15,6 +17,15 @@
#include "officevaluetype.h"
namespace cpdoccore {
struct oox_table_position
{
int col;
double col_off;
int row;
double row_off;
};
namespace odf {
class ods_conversion_context;
......@@ -32,6 +43,8 @@ struct ods_element_state
std::wstring style_name;
office_element_ptr style_elm;
double size;
int level;
};
......@@ -107,9 +120,16 @@ public:
int dimension_columns;
int dimension_row;
double defaut_column_width_;
double defaut_row_height_;
void convert_position(oox_table_position & oox_pos, double & x, double & y);
odf_drawing_context& drawing_context(){return drawing_context_;}
//
// xlsx_table_metrics & get_table_metrics() { return xlsx_table_metrics_; }
// xlsx_drawing_context & get_drawing_context() { return xlsx_drawing_context_; }
// xlsx_comments_context & get_comments_context() { return xlsx_comments_context_; }
// void table_column_last_width(double w) { table_column_last_width_ = w; }
......@@ -127,8 +147,6 @@ private:
int current_table_column_;
int current_table_row_;
int current_column_level_;
std::vector<ods_element_state> columns_;
std::vector<ods_element_state> rows_;
......@@ -137,9 +155,10 @@ private:
std::vector<ods_cell_state> cells_;
std::vector<ods_hyperlink_state> hyperlinks_;
odf_drawing_context drawing_context_;
// xlsx_merge_cells merge_cells_;
// xlsx_table_metrics xlsx_table_metrics_;
// xlsx_drawing_context xlsx_drawing_context_;
// xlsx_comments_context xlsx_comments_context_;
// xlsx_hyperlinks xlsx_hyperlinks_;
......
......@@ -9,6 +9,12 @@ namespace odf {
using xml::xml_char_wc;
graphic_format_properties::graphic_format_properties()
{
draw_stroke_ = line_style::None;
style_mirror_ = L"none";
common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
}
void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar_t * ns, const wchar_t * name )
{
CP_XML_WRITER(_Wostream)
......
......@@ -31,7 +31,8 @@ namespace odf {
class graphic_format_properties
{
public:
void apply_from(const graphic_format_properties & Other);
graphic_format_properties(); //for defaults set
//void apply_from(const graphic_format_properties & Other);
void serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name );
......
......@@ -22,15 +22,12 @@ namespace svg_path
_CP_OPT(double) x;
_CP_OPT(double) y;
friend void oox_serialize(std::wostream & _Wostream, _point const & val);
};
struct _polyline
{
std::wstring command;
std::vector<_point> points; //
friend void oox_serialize(std::wostream & _Wostream, _polyline const & val);
friend void oox_serialize(std::wostream & _Wostream, std::vector<svg_path::_polyline> & path);
};
//m - 1 point
//c - 3 point
......
......@@ -105,13 +105,17 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oSheetFormatPr.GetPointer());
if (oox_sheet->m_oSheetPr.IsInit())
convert(oox_sheet->m_oSheetPr.GetPointer());
// .. .
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
for (long hyp = 0; oox_sheet->m_oHyperlinks.IsInit() && hyp < oox_sheet->m_oHyperlinks->m_arrItems.GetSize(); hyp++)
{
convert(oox_sheet->m_oHyperlinks->m_arrItems[hyp],oox_sheet);
}
//
//
//todooo -
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
ods_context->start_columns();
for (long col = 0 ; oox_sheet->m_oCols.IsInit() && col < oox_sheet->m_oCols->m_arrItems.GetSize(); col++)
......@@ -134,8 +138,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit())
ods_context->add_merge_cells(string2std_string(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get()));
}
//
// - () ...
if (oox_sheet->m_oDrawing.IsInit() && oox_sheet->m_oDrawing->m_oId.IsInit())
{
smart_ptr<OOX::File> oFile = oox_sheet->Find(oox_sheet->m_oDrawing->m_oId->GetValue());
......@@ -146,16 +149,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(pDrawing);
}
}
//for (long dr =0; oox_sheet->m_oDrawing.IsInit() && dr < oox_sheet->m_oDrawing->m_arrItems.GetSize(); dr++)
//{
// convert(oox_sheet->m_oDrawing->m_arrItems[dr]);
//}
//
//m_mapComments
//m_oAutofilter
}
void XlsxConverter::convert(OOX::Spreadsheet::CHyperlink *oox_hyperlink,OOX::Spreadsheet::CWorksheet *oox_sheet)
......@@ -500,6 +493,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p
{
width = oox_sheet_format_pr->m_oDefaultColWidth->GetValue();
}
ods_context->current_table().defaut_column_width_ = 6*width;//pt
column_properties->style_table_column_properties_attlist_.style_column_width_ = odf::length(width/4.35,odf::length::cm);
}
}
......@@ -517,6 +511,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_p
if (oox_sheet_format_pr->m_oDefaultRowHeight.IsInit())
{
double height = oox_sheet_format_pr->m_oDefaultRowHeight->GetValue();
ods_context->current_table().defaut_row_height_ = height;//pt
row_properties->style_table_row_properties_attlist_.style_row_height_ = odf::length(height/32.,odf::length::cm);
}
row_properties->style_table_row_properties_attlist_.style_use_optimal_row_height_ = true; //???? c
......@@ -952,16 +948,21 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
{
ods_context->drawing_context().start_drawing();
//SimpleTypes::Spreadsheet::CCellAnchorType<> m_oAnchorType;
std::wstring ref_from, ref_to;
int col_from, col_to, row_from, row_to;
//////////////////
if (oox_anchor->m_oFrom.IsInit())
convert(oox_anchor->m_oFrom.GetPointer(),ref_from, col_from, row_from);
if (oox_anchor->m_oFrom.IsInit() || oox_anchor->m_oTo.IsInit())
{
oox_table_position from={}, to={};
convert(oox_anchor->m_oFrom.GetPointer(), &from);
convert(oox_anchor->m_oTo.GetPointer(),&to);
double x1=0, y1=0, x2=0, y2=0;
ods_context->current_table().convert_position(from, x1, y1);
ods_context->current_table().convert_position(to, x2, y2);
ods_context->drawing_context().set_rect(x1, y1, x2-x1, y2-y1);
}
if (oox_anchor->m_oTo.IsInit())
convert(oox_anchor->m_oTo.GetPointer(),ref_to,col_to,row_to);
//////////////
if (oox_anchor->m_oPos.IsInit())
{
......@@ -971,19 +972,30 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
{
}
//
if (oox_anchor->m_oGraphicFrame.IsInit())
if (oox_anchor->m_oPicture.IsInit())//picture
{
//m_oChartGraphic
ods_context->drawing_context().start_frame();
convert(oox_anchor->m_oPicture.GetPointer());
ods_context->drawing_context().end_frame();
}
if (oox_anchor->m_oPicture.IsInit())
//else if (oox_anchor->m_oGraphicFrame.IsInit())//shape
//{
// //m_oChartGraphic
//}
else if (oox_anchor->m_oGraphicFrame.IsInit())//chart
{
convert(oox_anchor->m_oPicture.GetPointer());
ods_context->drawing_context().start_frame();
//m_oChartGraphic
ods_context->drawing_context().end_frame();
}
if (oox_anchor->m_oXml.IsInit())
{
//m_oXml
}
ods_context->current_table().add_child_element(ods_context->drawing_context().end_drawing());
}
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
......@@ -993,51 +1005,27 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
for (long dr = 0 ; dr < oox_drawing->m_arrItems.GetSize(); dr++)
{
ods_context->start_drawing();
convert(oox_drawing->m_arrItems[dr]);
ods_context->end_drawing();
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, std::wstring & odf_ref, int & col, int & row)
void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_position * pos)
{
if (!oox_from_to || !pos)return;
if (oox_from_to->m_oCol.IsInit()) pos->col = oox_from_to->m_oCol->GetValue();
if (oox_from_to->m_oRow.IsInit()) pos->row = oox_from_to->m_oRow->GetValue();
if (oox_from_to->m_oRowOff.IsInit()) pos->row_off = oox_from_to->m_oRowOff->GetValue();//pt
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
}
void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
{
if (!oox_picture)return;
//std::wstring name;
//if (oox_picture->m_oNvPicPr.IsInit())
//{
// //OOX::Drawing::CNonVisualPictureProperties m_oCNvPicPr;
// //OOX::Drawing::CNonVisualDrawingProps m_oCNvPr;
//
// //
// if(oox_picture->m_oNvPicPr->m_oCNvPr.IsInit())
// {
// name = string2std_string(oox_picture->m_oNvPicPr->m_oCNvPr->m_sName.get());
// //nullable<CString> m_sDescr;
// //nullable<SimpleTypes::COnOff<>> m_oHidden;
// //nullable<SimpleTypes::CDrawingElementId<>> m_oId;
// //nullable<CString> m_sTitle;
// }
// if (oox_picture->m_oCNvPicPr.IsInit() && oox_picture->m_oCNvPicPr->m_oPicLocks.IsInit())
// {
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect.IsInit())
// {
// }
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoCrop.IsInit())
// {
// }
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoResize.IsInit())
// {
// }
// }
//
//}
//if (oox_picture->m_oSpPr.IsInit())
//{
//}
CString pathImage;
int type = 1;
if (oox_picture->m_oBlipFill.IsInit())
......@@ -1064,10 +1052,44 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
}
}
ods_context->drawing_context().start_image(string2std_string(pathImage));
ods_context->start_image(string2std_string(pathImage));
///////////////////////////////////////////////////////////////////////////////////////////////////////
std::wstring name;
int id=0;
if (oox_picture->m_oNvPicPr.IsInit())
{
//OOX::Drawing::CNonVisualPictureProperties m_oCNvPicPr;
//OOX::Drawing::CNonVisualDrawingProps m_oCNvPr;
//
if(oox_picture->m_oNvPicPr->m_oCNvPr.IsInit())
{
name = string2std_string(oox_picture->m_oNvPicPr->m_oCNvPr->m_sName.get());
id = oox_picture->m_oNvPicPr->m_oCNvPr->m_oId->GetValue();
//nullable<CString> m_sDescr;
//nullable<SimpleTypes::COnOff<>> m_oHidden;
//nullable<CString> m_sTitle;
}
//if (oox_picture->m_oCNvPicPr.IsInit() && oox_picture->m_oCNvPicPr->m_oPicLocks.IsInit())
//{
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect.IsInit())
// {
// }
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoCrop.IsInit())
// {
// }
// if (oox_picture->m_oCNvPicPr->m_oPicLocks->m_oNoResize.IsInit())
// {
// }
//}
ods_context->drawing_context().end_image();
}
//if (oox_picture->m_oSpPr.IsInit())
//{
//}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
ods_context->end_image();
}
} // namespace Docx2Odt
\ No newline at end of file
......@@ -13,6 +13,8 @@ namespace OOX
namespace cpdoccore
{
struct oox_table_position;
namespace odf
{
class office_element;
......@@ -101,7 +103,7 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CDrawing *oox_drawing);
void convert_sharing_string(int number);
void convert(OOX::Spreadsheet::CFromTo* oox_from_to, std::wstring & odf_ref, int & col, int & row);
void convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_position * pos);
void convert(OOX::Spreadsheet::CPic* oox_picture);
};
......
......@@ -10,6 +10,136 @@ namespace OOX
namespace Spreadsheet
{
//--------------------------------------------------------------------------------
// Non-Visual Properties for a Picture 20.5.2.22
//--------------------------------------------------------------------------------
class CNonVisualDrawingProps : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CNonVisualDrawingProps)
CNonVisualDrawingProps()
{
}
virtual ~CNonVisualDrawingProps()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
//if ( _T("xdr:cNvPicPr") == sName )
// m_oCNvPicPr = oReader;
//else if ( _T("xdr:cNvPr") == sName )
// m_oCNvPr = oReader;
}
}
virtual EElementType getType () const
{
return et_NonVisualDrawingProps;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("descr"), m_sDescr )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hidden"), m_oHidden )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("name"), m_sName )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("title"), m_sTitle )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
// Attributes
nullable<CString> m_sDescr;
nullable<SimpleTypes::COnOff<>> m_oHidden;
nullable<SimpleTypes::CDrawingElementId<>> m_oId;
nullable<CString> m_sName;
nullable<CString> m_sTitle;
// Childs
//nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
//nullable<OOX::Drawing::CHyperlink > m_oHlinkClick;
//nullable<OOX::Drawing::CHyperlink > m_oHlinkHover;
};
//--------------------------------------------------------------------------------
// Non-Visual Picture Drawing Properties 20.5.2.5
//--------------------------------------------------------------------------------
class CPictureNonVisual : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CPictureNonVisual)
CPictureNonVisual()
{
}
virtual ~CPictureNonVisual()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
/* if ( _T("xdr:cNvPicPr") == sName )
m_oCNvPicPr = oReader;
else */if ( _T("xdr:cNvPr") == sName )
m_oCNvPr = oReader;
}
}
virtual EElementType getType () const
{
return et_PictureNonVisual;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
// Childs
//nullable<CNonVisualPictureProperties> m_oCNvPicPr;
nullable<CNonVisualDrawingProps> m_oCNvPr;
};
class CBlipFill : public WritingElement
{
public:
......@@ -114,8 +244,8 @@ namespace OOX
if ( _T("xdr:blipFill") == sName )
m_oBlipFill = oReader;
//if ( _T("xdr:nvPicPr") == sName )
// m_oBlipFill = oReader;
if ( _T("xdr:nvPicPr") == sName )
m_oNvPicPr = oReader;
//if ( _T("xdr:spPr") == sName )
// m_oBlipFill = oReader;
}
......@@ -132,8 +262,8 @@ namespace OOX
}
public:
nullable<CBlipFill> m_oBlipFill;
//CNonVisualPictureProperties m_oCNvPicPr;
//CNonVisualDrawingProps m_oCSpPr;
nullable<CPictureNonVisual> m_oNvPicPr;
//nullable<CNonVisualDrawingProps> m_oCSpPr;
};
} //Spreadsheet
} // namespace OOX
......
......@@ -300,7 +300,12 @@ et_alternatecontentfallback,
et_IconSet,
et_ConditionalFormatValueObject,
et_SheetPr,
et_Pane
et_Pane,
et_PictureNonVisual,
et_NonVisualDrawingProps
};
class WritingElement
{
......
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