Compare commits

...

9 Commits

Author SHA1 Message Date
47318eef9c RtfFormatReader - fix users files 2019-07-26 17:33:24 +03:00
094a1d98d6 Add executable path to rpath 2019-07-26 16:55:00 +03:00
471219e59a [x2t] Fix dataValidations writing 2019-07-26 14:10:29 +03:00
2cfd2a0126 Change com object 2019-07-26 14:07:43 +03:00
f3ec039a01 Fix bug #42195
Fix the problem with reading EMF_BITBLT record in the EMF
2019-07-26 12:26:07 +03:00
f4795db0b8 Add allfonts path param 2019-07-26 11:30:21 +03:00
b52d9cb5d6 Correct "LoadConfig" method in doctrenderer 2019-07-25 19:00:07 +03:00
ff2303f386 . 2019-07-25 15:55:04 +03:00
d78fe3b9b1 OdfFormat 2019-07-25 14:27:48 +03:00
33 changed files with 634 additions and 101 deletions

View File

@ -259,6 +259,12 @@ namespace DocFileFormat
//compatibility settings
m_oXmlWriter.WriteNodeBegin( L"w:compat" );
m_oXmlWriter.WriteNodeBegin( L"w:compatSetting", TRUE);
m_oXmlWriter.WriteAttribute( L"w:name", L"compatibilityMode" );
m_oXmlWriter.WriteAttribute( L"w:uri", L"http://schemas.microsoft.com/office/word" );
m_oXmlWriter.WriteAttribute( L"w:val", L"11" );
m_oXmlWriter.WriteNodeEnd( L"", TRUE );
//some settings must always be written
if ( dop->fUseNormalStyleForList )

View File

@ -42,9 +42,9 @@ namespace Writers
class SettingWriter
{
std::wstring m_sDir;
NSStringUtils::CStringBuilder m_oSettingWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
std::wstring m_sDir;
NSStringUtils::CStringBuilder m_oSettingWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
SettingWriter(std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir),m_oHeaderFooterWriter(oHeaderFooterWriter)
{

View File

@ -83,7 +83,7 @@ namespace oox {
class _oox_drawing
{
public:
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), hidden(false), inGroup(false), lined(false), connector(false), name(L"object"), extExternal(false)
{
}
RelsType type;
@ -92,6 +92,7 @@ namespace oox {
size_t id;
bool lined;
bool connector;
bool hidden;
std::wstring name;
int sub_type; //odf

View File

@ -143,6 +143,8 @@ void xml_serialize_image(std::wostream & strm, _xlsx_drawing & val, const std::w
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
if (val.hidden) CP_XML_ATTR(L"hidden", 1);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
@ -185,9 +187,10 @@ void xml_serialize_shape(std::wostream & strm, _xlsx_drawing & val, const std::w
CP_XML_NODE(ns + L":cNvPr")
{
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
CP_XML_ATTR(L"name", val.name);
if (val.hidden) CP_XML_ATTR(L"hidden", 1);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(ns + L":cNvSpPr")//non visual properies (собственно тока 1 там)
@ -220,7 +223,24 @@ void xml_serialize_object(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_ATTR(L"id", val.id); //числовое значение val.rId
CP_XML_ATTR(L"name", val.name);
}
if (val.hidden) CP_XML_ATTR(L"hidden", 1);
if (false == val.objectId.empty())
{
CP_XML_NODE(L"a:extLst")
{
CP_XML_NODE(L"a:ext")
{
CP_XML_ATTR(L"uri", L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}");
CP_XML_NODE(L"a14:compatExt")
{
CP_XML_ATTR(L"spid", L"_x0000_s" + std::to_wstring(val.id));
}
}
}
}
}
CP_XML_NODE(L"xdr:cNvSpPr");
}
@ -248,7 +268,9 @@ void xml_serialize_group(std::wostream & strm, _xlsx_drawing & val, const std::w
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
}
if (val.hidden) CP_XML_ATTR(L"hidden", 1);
}
CP_XML_NODE(ns + L":cNvGrpSpPr");
}
CP_XML_NODE(ns + L":grpSpPr")
@ -273,7 +295,9 @@ void xml_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
}
if (val.hidden) CP_XML_ATTR(L"hidden", 1);
}
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
}

View File

@ -44,13 +44,21 @@ namespace oox {
class xlsx_drawings::Impl
{
public:
void add(_xlsx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
void add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel )//объект
{
if (type == typeControl || type == typeControlProps || type == typeComment)
if ( type == typeControlProps || type == typeComment)
{
vml_drawings_.push_back(d);
add (isInternal, rid, ref, type, sheet_rel, true);
}
else if (type == typeControl)
{
vml_drawings_.push_back(d);
add (isInternal, rid, ref, type, sheet_rel, true);
d.hidden = true;
drawings_.push_back(d);
}
else
{
drawings_.push_back(d);
@ -129,6 +137,7 @@ public:
}
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
for (size_t i = 0 ; i < drawings_.size(); i++)
{
@ -295,7 +304,7 @@ xlsx_drawings::~xlsx_drawings()
{
}
void xlsx_drawings::add(_xlsx_drawing const & d, bool isInternal, std::wstring const & rid,
void xlsx_drawings::add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid,
std::wstring const & ref, RelsType type, bool sheet_rel)
{
impl_->add(d, isInternal, rid, ref, type, sheet_rel);

View File

@ -65,8 +65,8 @@ public:
~xlsx_drawings ();
static xlsx_drawings_ptr create(bool inGroup);
void add ( _xlsx_drawing const & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
void add ( _xlsx_drawing & d, bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel = false );
void add ( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel, bool vml_rel);
bool empty() const;
bool vml_empty() const;

View File

@ -720,6 +720,7 @@ const wchar_t * dr3d_scene::name = L"scene";
void dr3d_scene::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
dr3d_attlist_.add_attributes(Attributes);
draw_shape::add_attributes(Attributes);
sub_type_ = 12;
@ -789,8 +790,8 @@ void dr3d_sphere::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_shape::add_attributes(Attributes);
CP_APPLY_ATTR(L"dr3d:size", dr3d_size_); //vector3D
CP_APPLY_ATTR(L"dr3d:center", dr3d_center_); //vector3D
CP_APPLY_ATTR(L"dr3d:size", dr3d_size_);
CP_APPLY_ATTR(L"dr3d:center", dr3d_center_);
CP_APPLY_ATTR(L"dr3d:transform",dr3d_transform_);
sub_type_ = 16;

View File

@ -585,6 +585,7 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
odf_types::dr3d_attlist dr3d_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_scene);
@ -692,9 +693,9 @@ public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
_CP_OPT(std::wstring) dr3d_size_; //vector3D
_CP_OPT(std::wstring) dr3d_center_; //vector3D
_CP_OPT(std::wstring) dr3d_transform_;
_CP_OPT(odf_types::vector3D) dr3d_size_;
_CP_OPT(odf_types::vector3D) dr3d_center_;
_CP_OPT(std::wstring) dr3d_transform_;
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_sphere);

View File

@ -416,7 +416,6 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
if (control->linked_cell_)
{
Context.get_drawing_context().set_property(_property(L"linked_cell", control->linked_cell_.get()));
}
if (control->disabled_)
@ -431,6 +430,10 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_drawing_context().set_property(_property(L"value", control->current_value_.get()));
}
if (control->label_)
{
Context.get_drawing_context().set_property(_property(L"label", control->label_.get()));
}
//if (control->name_)
//{
// Context.get_drawing_context().set_name(control->name_.get());
@ -474,6 +477,24 @@ void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().set_property(_property(L"list_source", combobox->list_source_.get()));
}
}
form_listbox* listbox = dynamic_cast<form_listbox*>(control);
if (listbox)
{
if (listbox->source_cell_range_)
{
Context.get_drawing_context().set_property(_property(L"cell_range", listbox->source_cell_range_.get()));
}
if (listbox->list_source_)
{
Context.get_drawing_context().set_property(_property(L"list_source", listbox->list_source_.get()));
}
}
form_checkbox* checkbox = dynamic_cast<form_checkbox*>(control);
if (checkbox)
{
Context.get_drawing_context().set_property(_property(L"checkbox_state", checkbox->current_state_));
}
//_CP_OPT(std::wstring) label_;
//_CP_OPT(std::wstring) title_;
//_CP_OPT(odf_types::Bool) dropdown_;

View File

@ -813,7 +813,7 @@ void form_listbox::serialize_control_props(std::wostream & strm)
}
if (source_cell_range_)
{
std::wstring fmla = converter.convert_named_expr(*source_cell_range_);
std::wstring fmla = converter./*convert_named_expr*/convert_named_ref(*source_cell_range_);
CP_XML_ATTR(L"fmlaRange", fmla);
}
//CP_XML_ATTR(L"sel", L"3");

View File

@ -280,8 +280,8 @@ public:
//form:image-align
//form:image-position
//form:button-type 19.255,
//form:default-button 19.265,
//form:button-type
//form:default-button
//form:delayfor-repeat
//form:focus-on-click
//form:image-data
@ -316,7 +316,6 @@ private:
public:
//form:convert-empty-to-null
//form:current-value
//form:readonly
//form:max-length
@ -386,7 +385,6 @@ public:
bool current_state_;
//form:image-align
//form:image-position
//form:current-state
//form:is-tristate
//form:visual-effect
};

View File

@ -105,7 +105,7 @@ void draw_rect::serialize(std::wostream & _Wostream)
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
/// draw-ellipse-attlist
void draw_ellipse_attlist::serialize(CP_ATTR_NODE)
@ -113,7 +113,9 @@ void draw_ellipse_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:filter-name", draw_filter_name_);
}
//-------------------------------------------------------------------------------------------
/// draw:ellipse
//-------------------------------------------------------------------------------------------
const wchar_t * draw_ellipse::ns = L"draw";
const wchar_t * draw_ellipse::name = L"ellipse";
@ -134,8 +136,9 @@ void draw_ellipse::serialize(std::wostream & _Wostream)
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
// draw:circle
//-------------------------------------------------------------------------------------------
const wchar_t * draw_circle::ns = L"draw";
const wchar_t * draw_circle::name = L"circle";
@ -153,7 +156,7 @@ void draw_circle::serialize(std::wostream & _Wostream)
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
/// draw-line-attlist
void draw_line_attlist::serialize(CP_ATTR_NODE)
{
@ -181,8 +184,9 @@ void draw_line::serialize(std::wostream & _Wostream)
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
// draw:custom_shape
//-------------------------------------------------------------------------------------------
const wchar_t * draw_custom_shape::ns = L"draw";
const wchar_t * draw_custom_shape::name = L"custom-shape";
@ -219,7 +223,9 @@ void draw_path_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
}
//-------------------------------------------------------------------------------------------
// draw:path
//-------------------------------------------------------------------------------------------
const wchar_t * draw_path::ns = L"draw";
const wchar_t * draw_path::name = L"path";
@ -280,7 +286,9 @@ void draw_polygon_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
}
//-------------------------------------------------------------------------------------------
// draw:polygon
//-------------------------------------------------------------------------------------------
const wchar_t * draw_polygon::ns = L"draw";
const wchar_t * draw_polygon::name = L"polygon";
@ -334,7 +342,7 @@ void draw_polygon::reset_polygon_path()
// }
//}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
void draw_equation_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
@ -355,7 +363,9 @@ void draw_handle_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:handle-polar", draw_handle_polar_);
}
//-------------------------------------------------------------------------------------------
// draw:path
//-------------------------------------------------------------------------------------------
const wchar_t * draw_handle::ns = L"draw";
const wchar_t * draw_handle::name = L"handle";
@ -401,6 +411,7 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val)
}
//-------------------------------------------------------------------------------------------
/// draw-enhanced_geometry_attlist
void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
{
@ -424,7 +435,9 @@ void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:text-path-scale", draw_text_path_scale_);
CP_XML_ATTR_OPT(L"draw:text-path-same-letter-heights", draw_text_path_same_letter_heights_);
}
//-------------------------------------------------------------------------------------------
// draw:enhanced_geometry
//-------------------------------------------------------------------------------------------
const wchar_t * draw_enhanced_geometry::ns = L"draw";
const wchar_t * draw_enhanced_geometry::name = L"enhanced-geometry";
@ -488,9 +501,9 @@ void draw_enhanced_geometry::add_child_element( const office_element_ptr & child
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
// draw:caption
//////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
const wchar_t * draw_caption::ns = L"draw";
const wchar_t * draw_caption::name = L"caption";
@ -508,7 +521,7 @@ void draw_caption::serialize(std::wostream & _Wostream)
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------
/// draw-connector-attlist
void draw_connector_attlist::serialize(CP_ATTR_NODE)
{
@ -517,7 +530,9 @@ void draw_connector_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:type",draw_type_);
}
//-------------------------------------------------------------------------------------------
// draw:connector
//-------------------------------------------------------------------------------------------
const wchar_t * draw_connector::ns = L"draw";
const wchar_t * draw_connector::name = L"connector";
@ -577,8 +592,9 @@ void draw_connector::reset_svg_path()
// }
//}
}
///////////////////////////////////////
//-------------------------------------------------------------------------------------------
// draw:control
//-------------------------------------------------------------------------------------------
const wchar_t * draw_control::ns = L"draw";
const wchar_t * draw_control::name = L"control";
@ -628,5 +644,132 @@ void draw_control::add_child_element( const office_element_ptr & child_element)
}
}
//-------------------------------------------------------------------------------------------
// dr3d:scene
//-------------------------------------------------------------------------------------------
const wchar_t * dr3d_scene::ns = L"dr3d";
const wchar_t * dr3d_scene::name = L"scene";
void dr3d_scene::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_shape::serialize_attlist(CP_GET_XML_NODE());
dr3d_attlist_.serialize(CP_GET_XML_NODE());
draw_shape::serialize(CP_XML_STREAM());
}
}
}
void dr3d_scene::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void dr3d_scene::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
content_.push_back(child_element);
}
//-------------------------------------------------------------------------------------------
// dr3d:extrude
//-------------------------------------------------------------------------------------------
const wchar_t * dr3d_extrude::ns = L"dr3d";
const wchar_t * dr3d_extrude::name = L"extrude";
void dr3d_extrude::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_path::serialize(CP_XML_STREAM());
}
}
}
//-------------------------------------------------------------------------------------------
// dr3d:rotate
//-------------------------------------------------------------------------------------------
const wchar_t * dr3d_rotate::ns = L"dr3d";
const wchar_t * dr3d_rotate::name = L"rotate";
void dr3d_rotate::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_path::serialize(CP_XML_STREAM());
}
}
}
//-------------------------------------------------------------------------------------------
// dr3d:light
//-------------------------------------------------------------------------------------------
const wchar_t * dr3d_light::ns = L"dr3d";
const wchar_t * dr3d_light::name = L"light";
void dr3d_light::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"dr3d:diffuse_color", dr3d_diffuse_color_);
CP_XML_ATTR_OPT(L"dr3d:direction", dr3d_direction_);
CP_XML_ATTR_OPT(L"dr3d:specular", dr3d_specular_);
CP_XML_ATTR_OPT(L"dr3d:enabled", dr3d_enabled_);
}
}
}
//-------------------------------------------------------------------------------------------
// dr3d:cube
//-------------------------------------------------------------------------------------------
const wchar_t * dr3d_cube::ns = L"dr3d";
const wchar_t * dr3d_cube::name = L"cube";
void dr3d_cube::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_shape::serialize_attlist(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"dr3d:max-edge", dr3d_max_edge_);
CP_XML_ATTR_OPT(L"dr3d:min-edge", dr3d_min_edge_);
CP_XML_ATTR_OPT(L"dr3d:transform", dr3d_transform_);
draw_shape::serialize(CP_XML_STREAM());
}
}
}
//-------------------------------------------------------------------------------------------
// dr3d:sphere
//-------------------------------------------------------------------------------------------
const wchar_t * dr3d_sphere::ns = L"dr3d";
const wchar_t * dr3d_sphere::name = L"sphere";
void dr3d_sphere::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_shape::serialize_attlist(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"dr3d:max-edge", dr3d_size_);
CP_XML_ATTR_OPT(L"dr3d:min-edge", dr3d_center_);
CP_XML_ATTR_OPT(L"dr3d:transform", dr3d_transform_);
draw_shape::serialize(CP_XML_STREAM());
}
}
}
}
}

View File

@ -434,5 +434,124 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_control);
//----------------------------------------------------------------------------------------------
class dr3d_scene : public draw_shape
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeDr3dScene;
static const xml::NodeType xml_type = xml::typeElement;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
odf_types::dr3d_attlist dr3d_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_scene);
//------------------------------------------------------------------------------------------------------------
class dr3d_extrude : public draw_path
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeDr3dExtrude;
static const xml::NodeType xml_type = xml::typeElement;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream);
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_extrude);
//------------------------------------------------------------------------------------------------------------
class dr3d_rotate : public draw_path
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeDr3dRotate;
static const xml::NodeType xml_type = xml::typeElement;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream);
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_rotate);
//------------------------------------------------------------------------------------------------------------
class dr3d_light : public office_element_impl<dr3d_light>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDr3dLight;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(std::wstring) dr3d_diffuse_color_;
_CP_OPT(std::wstring) dr3d_direction_;
_CP_OPT(odf_types::Bool) dr3d_specular_;
_CP_OPT(odf_types::Bool) dr3d_enabled_;
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_light);
//------------------------------------------------------------------------------------------------------------
class dr3d_cube : public draw_shape
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeDr3dCube;
static const xml::NodeType xml_type = xml::typeElement;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(std::wstring) dr3d_max_edge_;
_CP_OPT(std::wstring) dr3d_min_edge_;
_CP_OPT(std::wstring) dr3d_transform_;
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_cube);
//------------------------------------------------------------------------------------------------------------
class dr3d_sphere : public draw_shape
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeDr3dSphere;
static const xml::NodeType xml_type = xml::typeElement;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(odf_types::vector3D) dr3d_size_;
_CP_OPT(odf_types::vector3D) dr3d_center_;
_CP_OPT(std::wstring) dr3d_transform_;
};
CP_REGISTER_OFFICE_ELEMENT2(dr3d_sphere);
}
}

View File

@ -297,7 +297,9 @@ void odf_controls_context::set_check_state(int val)
if (impl_->controls_.empty()) return;
odf_writer::form_checkbox *checkbox = dynamic_cast<odf_writer::form_checkbox*>(impl_->controls_.back().form_elm);
checkbox->current_state_ = (val == 1);
if (checkbox)
checkbox->current_state_ = (val == 1);
}
void odf_controls_context::set_value(const std::wstring & val)
{

View File

@ -367,6 +367,8 @@ void form_radio::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR(L"form:selected", current_state_ ? L"true" : L"false");
form_element::serialize_attlist(CP_GET_XML_NODE());
if (properties_) properties_->serialize(CP_XML_STREAM());

View File

@ -341,7 +341,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(form_checkbox);
//--------------------------------------------------------------------------------------------
// form:radio
class form_radio : public form_text
class form_radio : public form_checkbox
{
public:
static const wchar_t * ns;

View File

@ -232,12 +232,12 @@ std::wstring RtfFont::RenderToOOX(RenderParameter oRenderParameter)
else
{
RtfFont oCurFont;
if( true == poRtfDocument->m_oFontTable.GetFont(m_nID,oCurFont) )
if( true == poRtfDocument->m_oFontTable.GetFont(m_nID, oCurFont) )
{
std::wstring sHint;
switch(m_nCharset)
switch(oCurFont.m_nCharset)
{
case 128://Japanese
//case 128://Japanese //vedomost.rtf ????
case 129://Korean
case 130://Korean
case 134://China

View File

@ -275,7 +275,7 @@ public:
if(sResult.length() > 0)
{
std::string str;
ExecuteTextInternalSkipChars (sResult, oReader, str, nSkipChars);
// ExecuteTextInternalSkipChars (sResult, oReader, str, nSkipChars); //vedomost.rtf
ExecuteText ( oDocument, oReader, sResult);
}
}

View File

@ -263,7 +263,8 @@ std::wstring RtfDocumentProperty::RenderToOOX(RenderParameter oRenderParameter)
if( !sEndnoteProp.empty() && !m_aSpecialEndnotes.empty())
sResult += L"<w:endnotePr>" + sEndnoteProp + L"</w:endnotePr>";
std::wstring sCompat;
std::wstring sCompat = L"<w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"11\"/>";
if( 1 != m_bHtmlAutoSpace )
sCompat += L"<w:doNotUseHTMLParagraphAutoSpacing/>";
if( 0 == m_bUseTabAlignment )

View File

@ -96,7 +96,7 @@ void CDataValidation::toXML2(NSStringUtils::CStringBuilder& writer, bool bExtend
if (m_oFormula2.IsInit())
{
writer.WriteString(L"<x14:formula2>");
m_oFormula1->toXML2(writer, true);
m_oFormula2->toXML2(writer, true);
writer.WriteString(L"</x14:formula2>");
}
if (m_oSqRef.IsInit())

View File

@ -35,6 +35,8 @@ core_windows {
core_linux {
LIBS += -lz -pthread
QMAKE_LFLAGS += -Wl,--rpath=./
}
SOURCES += main.cpp

View File

@ -29,6 +29,8 @@ core_windows {
core_linux {
LIBS += -lz -pthread
QMAKE_LFLAGS += -Wl,--rpath=./
}
SOURCES += main.cpp

View File

@ -235,6 +235,7 @@ int main(int argc, char** argv)
std::wstring sSrcThemesDir = L"";
std::wstring sX2tPath = L"";
std::wstring sOutputThumbnails = L"";
std::wstring sAllFonts = L"";
bool bIsNeedCorrectSdkAll = false;
for (int i = 0; i < argc; ++i)
@ -281,6 +282,10 @@ int main(int argc, char** argv)
bIsNeedCorrectSdkAll = true;
}
}
else if (sKey == L"--allfonts")
{
sAllFonts = sValue;
}
}
}
@ -328,8 +333,13 @@ int main(int argc, char** argv)
oBuilder.WriteString(L"</m_sFileFrom><m_sFileTo>");
oBuilder.WriteEncodeXmlString(sOut + L"/theme.bin");
oBuilder.WriteString(L"</m_sFileTo><m_nFormatTo>8192</m_nFormatTo><m_sThemeDir>./</m_sThemeDir>");
oBuilder.WriteString(L"<m_bDontSaveAdditional>true</m_bDontSaveAdditional><m_sAllFontsPath>");
oBuilder.WriteString(L"AllFonts.js</m_sAllFontsPath>");
oBuilder.WriteString(L"<m_bDontSaveAdditional>true</m_bDontSaveAdditional>");
if (!sAllFonts.empty())
{
oBuilder.WriteString(L"<m_sAllFontsPath>");
oBuilder.WriteString(sAllFonts);
oBuilder.WriteString(L"</m_sAllFontsPath>");
}
oBuilder.WriteString(L"</TaskQueueDataConvert>");
std::wstring sXmlConvert = oBuilder.GetData();
@ -373,7 +383,7 @@ int main(int argc, char** argv)
std::wstring sXmlDoctRenderer = oBuilder.GetData();
NSDoctRenderer::CDoctrenderer oRenderer;
oRenderer.LoadConfig(sX2tPath);
oRenderer.LoadConfig(sX2tPath, sAllFonts);
std::wstring sError;
bool bIsSuccess = oRenderer.Execute(sXmlDoctRenderer, sError);

View File

@ -35,7 +35,7 @@
//
#define IDS_PROJNAME 100
#define IDR_ASCDOCBUILDER 101
#define IDR_ONLYOFFICEDOCBUILDER 101
// Next default values for new objects
//

View File

@ -0,0 +1,17 @@
SET SCRIPTPATH=%~dp0
CD /D %~dp0
SET VC64_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE
SET VC32_PATH=%ProgramFiles%\Microsoft Visual Studio 14.0\Common7\IDE
setlocal enabledelayedexpansion
if defined ProgramFiles(x86) (
SET PATH=!VC64_PATH!;!PATH!
) else (
SET PATH=!VC32_PATH!;!PATH!
)
call devenv docbuilder.com.sln /Rebuild "Release|x64"
call devenv docbuilder.com.sln /Rebuild "Release|Win32"
exit /b 0

View File

@ -37,9 +37,9 @@
#include "docbuilder.h"
// The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you
[ module(dll, uuid = "{B43F4AFD-2278-4175-992C-D7AE390507D8}",
name = "ascdocbuilder",
helpstring = "ascdocbuilder 1.0 Type Library",
resource_name = "IDR_ASCDOCBUILDER") ];
[ module(dll, uuid = "{7368AB25-7082-4815-8AE5-A30C2ABDD2A0}",
name = "onlyofficedocbuilder",
helpstring = "onlyofficedocbuilder 1.0 Type Library",
resource_name = "IDR_ONLYOFFICEDOCBUILDER") ];

View File

@ -60,11 +60,11 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "Ascensio System SIA"
VALUE "FileDescription", "Ascensio System SIA docbuilder ActiveX DLL"
VALUE "CompanyName", "Ascensio System SIA 2019"
VALUE "FileDescription", "ONLYOFFICE docbuilder ActiveX DLL"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "docbuilder.com.dll"
VALUE "LegalCopyright", "Ascensio System SIA Copyright (c) 2011-2016. All rights reserved."
VALUE "LegalCopyright", "Copyright (C) Ascensio System SIA 2019. All rights reserved."
VALUE "OriginalFilename", "docbuilder.com.dll"
VALUE "ProductName", "docbuilder.com"
VALUE "ProductVersion", "1.0.0.1"
@ -88,7 +88,7 @@ BEGIN
IDS_PROJNAME "docbuilder.com"
END
IDR_ASCDOCBUILDER REGISTRY "docbuilder.com.rgs"
IDR_ONLYOFFICEDOCBUILDER REGISTRY "docbuilder.com.rgs"
////////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -26,25 +26,25 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<UseOfAtl>false</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<UseOfAtl>Dynamic</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<UseOfAtl>Dynamic</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
<UseOfAtl>Dynamic</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -121,16 +121,12 @@
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>true</RegisterOutput>
<RegisterOutput>false</RegisterOutput>
<MergedIDLBaseFileName>_docbuilder.idl</MergedIDLBaseFileName>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>regsvr32 $(TargetPath)</Command>
<Message>Performing registration</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>
</Command>
@ -170,10 +166,6 @@
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>regsvr32 $(TargetPath)</Command>
<Message>Performing registration</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
@ -194,7 +186,7 @@
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -205,7 +197,7 @@
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<RegisterOutput>true</RegisterOutput>
<RegisterOutput>false</RegisterOutput>
<MergedIDLBaseFileName>_docbuilder.idl</MergedIDLBaseFileName>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@ -213,10 +205,6 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Message>Performing registration</Message>
<Command>regsvr32 $(TargetPath)</Command>
</PostBuildEvent>
<CustomBuildStep>
<Command>
</Command>
@ -258,10 +246,6 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Message>Performing registration</Message>
<Command>regsvr32 $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="docbuilder.com.cpp" />

View File

@ -31,6 +31,7 @@
*/
// docbuildercom.h : Declaration of the CDocbuilder
#pragma once
#include "stdafx.h"
#include "resource.h" // main symbols
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
@ -48,18 +49,18 @@ using namespace ATL;
#pragma comment(lib, "../../../build/lib/win_32/doctrenderer.lib")
#endif
#include "../docbuilder.h"
#include "../../common/File.h"
#include "../../../DesktopEditor/doctrenderer/docbuilder.h"
#include "../../../Common/OfficeFileFormats.h"
// IASCDocBuilder
[object, uuid("B0C0E80B-2076-4C33-BC6D-3DB1B0FE9687"), dual, pointer_default(unique)]
__interface IASCDocBuilder : IDispatch
// IONLYOFFICEDocBuilder
[object, uuid("0C07B7E7-86A4-42E1-8E42-2FA961992E0F"), dual, pointer_default(unique)]
__interface IONLYOFFICEDocBuilder : IDispatch
{
[id(1)] HRESULT CreateInstance([in] VARIANT_BOOL checkFonts);
[id(100)] HRESULT OpenFile([in] BSTR path, [in] BSTR params, [out, retval] VARIANT_BOOL* result);
[id(101)] HRESULT CreateFile([in] int type, [out, retval] VARIANT_BOOL* result);
[id(101)] HRESULT CreateFile([in] BSTR type, [out, retval] VARIANT_BOOL* result);
[id(102)] HRESULT SetTmpFolder([in] BSTR folder);
[id(103)] HRESULT SaveFile([in] int type, [in] BSTR path, [out, retval] VARIANT_BOOL* result);
[id(103)] HRESULT SaveFile([in] BSTR type, [in] BSTR path, [out, retval] VARIANT_BOOL* result);
[id(104)] HRESULT CloseFile(void);
[id(105)] HRESULT ExecuteCommand([in] BSTR command, [out, retval] VARIANT_BOOL* result);
[id(106)] HRESULT Run([in] BSTR path, [out, retval] VARIANT_BOOL* result);
@ -73,21 +74,41 @@ __interface IASCDocBuilder : IDispatch
[id(1002)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
// CASCDocBuilder
[coclass, uuid("227DE4AD-D992-4CCD-9704-0F041CE908F3"), threading(apartment), vi_progid("ASCDocBuilder.DocBuilder"), progid("ASCDocBuilder.DocBuilder.1"), version(1.0)]
class ATL_NO_VTABLE CASCDocBuilder : public IASCDocBuilder
static CStringW GetCurrentDllDirPath()
{
CStringW thisPath = L"";
WCHAR path[MAX_PATH];
HMODULE hm;
if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPWSTR)&GetCurrentDllDirPath, &hm))
{
GetModuleFileNameW(hm, path, sizeof(path));
PathRemoveFileSpecW(path);
thisPath = CStringW(path);
if (!thisPath.IsEmpty() &&
thisPath.GetAt(thisPath.GetLength() - 1) != '\\')
thisPath += L"\\";
}
return thisPath;
}
// CONLYOFFICEDocBuilder
[coclass, uuid("9BF69F3C-1506-41B9-B8EE-2839948C02E9"), threading(apartment), vi_progid("ONLYOFFICE.Builder"), progid("ONLYOFFICE.Builder.1"), version(1.0)]
class ATL_NO_VTABLE CONLYOFFICEDocBuilder : public IONLYOFFICEDocBuilder
{
protected:
NSDoctRenderer::CDocBuilder* m_pBuilder;
public:
CASCDocBuilder()
CONLYOFFICEDocBuilder()
{
m_pBuilder = NULL;
this->CreateInstance(VARIANT_TRUE);
}
~CASCDocBuilder()
~CONLYOFFICEDocBuilder()
{
if (NULL != m_pBuilder)
delete m_pBuilder;
@ -98,6 +119,10 @@ public:
delete m_pBuilder;
m_pBuilder = new NSDoctRenderer::CDocBuilder();
CStringW sCurrentDir = GetCurrentDllDirPath();
BSTR bsCurrentDir = sCurrentDir.AllocSysString();
m_pBuilder->SetProperty("--work-directory", (wchar_t*)bsCurrentDir);
SysFreeString(bsCurrentDir);
return S_OK;
}
STDMETHOD(OpenFile)(BSTR path, BSTR params, VARIANT_BOOL* result)
@ -109,12 +134,19 @@ public:
*result = bRet ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
STDMETHOD(CreateFile)(int type, VARIANT_BOOL* result)
STDMETHOD(CreateFile)(BSTR type, VARIANT_BOOL* result)
{
if (NULL == m_pBuilder)
return S_FALSE;
bool bRet = m_pBuilder->CreateFile(type);
int nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
CStringW sType = (CString)type;
if (L"pptx" == sType)
nType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
else if (L"xlsx" == sType)
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
bool bRet = m_pBuilder->CreateFile(nType);
*result = bRet ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
@ -126,12 +158,45 @@ public:
m_pBuilder->SetTmpFolder(folder);
return S_OK;
}
STDMETHOD(SaveFile)(int type, BSTR path, VARIANT_BOOL* result)
STDMETHOD(SaveFile)(BSTR type, BSTR path, VARIANT_BOOL* result)
{
if (NULL == m_pBuilder)
return S_FALSE;
bool bRet = m_pBuilder->SaveFile(type, path);
int nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
CStringW sType = (CString)type;
if (L"docx" == sType)
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
else if (L"doc" == sType)
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC;
else if (L"odt" == sType)
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT;
else if (L"rtf" == sType)
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF;
else if (L"txt" == sType)
nType = AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT;
else if (L"pptx" == sType)
nType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
else if (L"odp" == sType)
nType = AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP;
else if (L"xlsx" == sType)
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
else if (L"xls" == sType)
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
else if (L"ods" == sType)
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS;
else if (L"csv" == sType)
nType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
else if (L"pdf" == sType)
nType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
else if (L"image" == sType)
nType = AVS_OFFICESTUDIO_FILE_IMAGE;
else if (L"jpg" == sType)
nType = AVS_OFFICESTUDIO_FILE_IMAGE;
else if (L"png" == sType)
nType = AVS_OFFICESTUDIO_FILE_IMAGE;
bool bRet = m_pBuilder->SaveFile(nType, path);
*result = bRet ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}

View File

@ -0,0 +1,116 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef DOCBUILDER_H
#define DOCBUILDER_H
#ifdef _MSC_VER
#define BUILDING_DOCBUILDER __declspec(dllimport)
#else
#define BUILDING_DOCBUILDER
#endif
#define OFFICESTUDIO_FILE_DOCUMENT 0x0040
#define OFFICESTUDIO_FILE_DOCUMENT_DOCX OFFICESTUDIO_FILE_DOCUMENT + 0x0001
#define OFFICESTUDIO_FILE_DOCUMENT_DOC OFFICESTUDIO_FILE_DOCUMENT + 0x0002
#define OFFICESTUDIO_FILE_DOCUMENT_ODT OFFICESTUDIO_FILE_DOCUMENT + 0x0003
#define OFFICESTUDIO_FILE_DOCUMENT_RTF OFFICESTUDIO_FILE_DOCUMENT + 0x0004
#define OFFICESTUDIO_FILE_DOCUMENT_TXT OFFICESTUDIO_FILE_DOCUMENT + 0x0005
#define OFFICESTUDIO_FILE_DOCUMENT_DOTX OFFICESTUDIO_FILE_DOCUMENT + 0x000c
#define OFFICESTUDIO_FILE_DOCUMENT_OTT OFFICESTUDIO_FILE_DOCUMENT + 0x000f
#define OFFICESTUDIO_FILE_PRESENTATION 0x0080
#define OFFICESTUDIO_FILE_PRESENTATION_PPTX OFFICESTUDIO_FILE_PRESENTATION + 0x0001
#define OFFICESTUDIO_FILE_PRESENTATION_PPT OFFICESTUDIO_FILE_PRESENTATION + 0x0002
#define OFFICESTUDIO_FILE_PRESENTATION_ODP OFFICESTUDIO_FILE_PRESENTATION + 0x0003
#define OFFICESTUDIO_FILE_PRESENTATION_PPSX OFFICESTUDIO_FILE_PRESENTATION + 0x0004
#define OFFICESTUDIO_FILE_PRESENTATION_POTX OFFICESTUDIO_FILE_PRESENTATION + 0x0007
#define OFFICESTUDIO_FILE_PRESENTATION_OTP OFFICESTUDIO_FILE_PRESENTATION + 0x000a
#define OFFICESTUDIO_FILE_SPREADSHEET 0x0100
#define OFFICESTUDIO_FILE_SPREADSHEET_XLSX OFFICESTUDIO_FILE_SPREADSHEET + 0x0001
#define OFFICESTUDIO_FILE_SPREADSHEET_XLS OFFICESTUDIO_FILE_SPREADSHEET + 0x0002
#define OFFICESTUDIO_FILE_SPREADSHEET_ODS OFFICESTUDIO_FILE_SPREADSHEET + 0x0003
#define OFFICESTUDIO_FILE_SPREADSHEET_CSV OFFICESTUDIO_FILE_SPREADSHEET + 0x0004
#define OFFICESTUDIO_FILE_SPREADSHEET_XLTX OFFICESTUDIO_FILE_SPREADSHEET + 0x0006
#define OFFICESTUDIO_FILE_SPREADSHEET_OTS OFFICESTUDIO_FILE_SPREADSHEET + 0x0009
#define OFFICESTUDIO_FILE_CROSSPLATFORM 0x0200
#define OFFICESTUDIO_FILE_CROSSPLATFORM_PDF OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001
#define OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0003
#define OFFICESTUDIO_FILE_CROSSPLATFORM_XPS OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0004
#define OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0009
#define OFFICESTUDIO_FILE_IMAGE 0x0400
#define OFFICESTUDIO_FILE_IMAGE_JPG OFFICESTUDIO_FILE_IMAGE + 0x0001
#define OFFICESTUDIO_FILE_IMAGE_PNG OFFICESTUDIO_FILE_IMAGE + 0x0005
#define OFFICESTUDIO_FILE_IMAGE_BMP OFFICESTUDIO_FILE_IMAGE + 0x0008
namespace NSDoctRenderer
{
class CDocBuilder_Private;
class BUILDING_DOCBUILDER CDocBuilder
{
public:
CDocBuilder();
~CDocBuilder();
public:
int OpenFile(const wchar_t* path, const wchar_t* params);
bool CreateFile(const int& type);
void SetTmpFolder(const wchar_t* folder);
int SaveFile(const int& type, const wchar_t* path, const wchar_t* params = 0);
void CloseFile();
bool ExecuteCommand(const wchar_t* command);
bool Run(const wchar_t* path);
bool RunTextW(const wchar_t* commands);
bool RunTextA(const char* commands);
void SetProperty(const char* param, const wchar_t* value);
void SetPropertyW(const wchar_t* param, const wchar_t* value);
void WriteData(const wchar_t* path, const wchar_t* value, const bool& append);
bool IsSaveWithDoctrendererMode();
char* GetVersion();
public:
static void Initialize();
static void Dispose();
private:
CDocBuilder_Private* m_pInternal;
};
}
#endif // DOCBUILDER_H

View File

@ -269,6 +269,11 @@ namespace NSDoctRenderer
}
void LoadConfig(const std::wstring& sConfigDir, const std::wstring& sAllFontsPath = L"")
{
m_arrFiles.RemoveAll();
m_arDoctSDK.clear();
m_arPpttSDK.clear();
m_arXlstSDK.clear();
m_strConfigDir = sConfigDir + L"/";
m_strConfigPath = m_strConfigDir + L"DoctRenderer.config";

View File

@ -825,7 +825,10 @@ static const struct ActionNamesEmf
BYTE* pBgraBuffer = NULL;
unsigned int ulWidth, ulHeight;
if (ReadImage(oBitmap.offBmiSrc, oBitmap.cbBmiSrc, oBitmap.offBitsSrc, oBitmap.cbBitsSrc, sizeof(TEmfBitBlt) + 8, &pBgraBuffer, &ulWidth, &ulHeight))
// sizeof использовать нельзя, т.к. мы используем double в структуре TEmfBitBlt, а читаем его 4-байтовым
unsigned int unEmfBitBltRecordSize = 100; // sizeof(TEmfBitBlt) + 8
if (ReadImage(oBitmap.offBmiSrc, oBitmap.cbBmiSrc, oBitmap.offBitsSrc, oBitmap.cbBitsSrc, unEmfBitBltRecordSize, &pBgraBuffer, &ulWidth, &ulHeight))
{
DrawImage(oBitmap.xDest, oBitmap.yDest, oBitmap.cxDest, oBitmap.cyDest, pBgraBuffer, ulWidth, ulHeight);
}

View File

@ -6229,26 +6229,27 @@ void BinaryWorksheetTableWriter::WriteSparklineGroup(const OOX::Spreadsheet::CSp
}
void BinaryWorksheetTableWriter::WriteDataValidations(const OOX::Spreadsheet::CDataValidations& oDataValidations)
{
int nCurPos = 0;
if (oDataValidations.m_oDisablePrompts.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_DataValidation::DisablePrompts);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
nCurPos = m_oBcw.WriteItemStart(c_oSer_DataValidation::DisablePrompts);
m_oBcw.m_oStream.WriteBOOL(oDataValidations.m_oDisablePrompts->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oDataValidations.m_oXWindow.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_DataValidation::XWindow);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
nCurPos = m_oBcw.WriteItemStart(c_oSer_DataValidation::XWindow);
m_oBcw.m_oStream.WriteLONG(oDataValidations.m_oXWindow->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oDataValidations.m_oYWindow.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_DataValidation::YWindow);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
nCurPos = m_oBcw.WriteItemStart(c_oSer_DataValidation::YWindow);
m_oBcw.m_oStream.WriteLONG(oDataValidations.m_oYWindow->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
int nCurPos = m_oBcw.WriteItemStart(c_oSer_DataValidation::DataValidations);
nCurPos = m_oBcw.WriteItemStart(c_oSer_DataValidation::DataValidations);
WriteDataValidationsContent(oDataValidations);
m_oBcw.WriteItemEnd(nCurPos);
}