Compare commits

..

14 Commits

39 changed files with 607 additions and 276 deletions

View File

@ -105,7 +105,7 @@ HRESULT convert_single(std::wstring srcFileName)
}
_CP_LOG << L"[info] " << srcFileName << std::endl;
nResult = ConvertODF2OOXml(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", srcTempPath2, L"password", NULL);
nResult = ConvertODF2OOXml(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", srcTempPath2, L"", NULL);
if (srcTempPath != srcFileName)
{

View File

@ -310,6 +310,7 @@ typedef xml::writer::element<wchar_t> xml_element;
#define CP_XML_WRITER(STRM) if (bool _b_ = false) {} else for (xml_writer _xml_wr_((STRM));!_b_;_b_=true)
#define CP_XML_NODE(NAME) if (bool _b_ = false) {} else for (xml_element _xml_node_(_xml_wr_, (NAME));!_b_;_b_=true)
#define CP_XML_ATTR(NAME, VAL) _xml_node_.attr((NAME),(VAL))
#define CP_XML_ATTR2(NAME, VAL) _xml_node_.attr((std::wstring(NAME).c_str()),(VAL))
#define CP_XML_CONTENT(VAL) _xml_node_.contents((VAL))
#define CP_XML_STREAM() _xml_node_.stream()

View File

@ -589,12 +589,17 @@ void docx_conversion_context::reset_context_state()
state_.in_run_ = false;
state_.is_paragraph_keep_ = false;
state_.drawing_text_props_.clear();
state_.text_properties_stack_.clear();
get_styles_context().text_style_ext().clear();
}
void docx_conversion_context::back_context_state()
{
state_ = keep_state_.back();
keep_state_.pop_back();
get_styles_context().text_style_ext().clear();
}
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
@ -1756,6 +1761,11 @@ void docx_conversion_context::serialize_list_properties(std::wostream & strm)
}
}
void docx_conversion_context::set_drawing_text_props (const std::wstring &props)
{
get_styles_context().text_style_ext() = props;
}
void docx_conversion_context::add_delayed_element(odf_reader::office_element * Elm)
{
delayed_elements_.push_back(Elm);

View File

@ -900,6 +900,8 @@ public:
table_content_context & get_table_content_context() { return table_content_context_;}
void set_drawing_text_props (const std::wstring &props);
void docx_convert_delayed ();
void add_delayed_element (odf_reader::office_element * Elm);
@ -940,10 +942,10 @@ public:
void add_alphabetical_index_text (odf_reader::office_element_ptr & elem);
void set_process_headers_footers(bool Val) { process_headers_footers_ = Val; }
headers_footers & get_headers_footers() { return headers_footers_; }
headers_footers & get_headers_footers() { return headers_footers_; }
header_footer_context & get_header_footer_context() { return header_footer_context_; }
drop_cap_context & get_drop_cap_context(){return drop_cap_context_;}
drop_cap_context & get_drop_cap_context() {return drop_cap_context_;}
styles_map styles_map_;
bool process_headers_footers_;
@ -962,6 +964,8 @@ private:
bool in_run_ = false;
bool is_paragraph_keep_ = false;
std::wstring drawing_text_props_;
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
}state_;
std::vector<_context_state> keep_state_;

View File

@ -231,7 +231,7 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
CP_XML_NODE(L"a:avLst");
}
oox_serialize_ln(CP_XML_STREAM(),val.additional);
oox_serialize_ln(CP_XML_STREAM(), val.additional);
}
}
}

View File

@ -171,7 +171,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
if (content_.dimension_ == L"y")
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
}
//oox_serialize_ln(_Wostream,content_.graphic_properties_);
//oox_serialize_ln(_Wostream, content_.graphic_properties_);
odf_reader::GetProperty(content_.properties_, L"num_format", strVal);
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", boolVal);

View File

@ -198,7 +198,9 @@ std::wstringstream & styles_context::list_style()
void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId, std::wstring & strChange)
{
if (!text_style_.str().empty())
const std::wstring & text_style_str = text_style_.str();
if (!text_style_str.empty() || !text_style_ext_.empty())
{
CP_XML_WRITER(strm)
{
@ -208,14 +210,17 @@ void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstrin
{
CP_XML_STREAM() << L"<w:rStyle w:val=\"" << parenStyleId << L"\" />";
}
const std::wstring & test_str = text_style_.str();
CP_XML_STREAM() << test_str;
CP_XML_STREAM() << text_style_str;
if (!strChange.empty())//rPrChange
{
CP_XML_STREAM() << strChange;
strChange.clear();
}
if (!text_style_ext_.empty())
{
CP_XML_STREAM() << text_style_ext_;
}
}
}
}

View File

@ -141,6 +141,7 @@ public:
std::wstring & extern_node(){return extern_node_;}
std::wstring & hlinkClick(){return hlinkClick_;}
std::wstring & text_style_ext(){return text_style_ext_;}
const odf_reader::style_instance * get_current_processed_style() const { return current_processed_style_; }
@ -152,6 +153,7 @@ private:
std::wstring extern_node_;
std::wstring hlinkClick_;
std::wstring text_style_ext_;
std::wstringstream list_style_;
std::wstringstream text_style_;

View File

@ -124,8 +124,14 @@ static const std::wstring _ooxDashStyle[]=
L"sysDashDotDot"
};
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw)
void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_property> & prop, bool always_draw, const std::wstring &ns)
{
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
std::wstring ns_node = L"a:ln";
if (ns == L"w14")
ns_node = L"w14:textOutline";
_CP_OPT(std::wstring) strStrokeColor;
_CP_OPT(int) iStroke;
_CP_OPT(double) dStrokeWidth;
@ -143,30 +149,30 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:ln")
CP_XML_NODE(ns_node)
{
std::wstring color, dash_style, fill = L"a:solidFill" ;
std::wstring color, dash_style, fill = ns + L":solidFill" ;
if (strStrokeColor) color = *strStrokeColor;
if (iStroke)
{
if (iStroke.get() == 0 || bWordArt) fill = L"a:noFill";
if (iStroke.get() == 0 || bWordArt) fill = ns + L":noFill";
else dash_style = _ooxDashStyle[iStroke.get()];
}
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != L"a:noFill")
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != ns + L":noFill")
{
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
if (val < 10) val = 12700;
CP_XML_ATTR(L"w", val);
CP_XML_ATTR2(ns_att + L"w", val);
if (color.length()<1)color = L"729FCF";
}
CP_XML_NODE(fill)
{
if (fill != L"a:noFill")
if (fill != ns + L":noFill")
{
if ( color.empty() )
{
@ -174,47 +180,49 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
else color = L"FFFFFF";
}
CP_XML_NODE(L"a:srgbClr")
CP_XML_NODE(ns + L":srgbClr")
{
CP_XML_ATTR(L"val",color);
CP_XML_ATTR2(ns_att + L"val",color);
if (dStrokeOpacity)
{
CP_XML_NODE(L"a:alpha")
CP_XML_NODE(ns + L":alpha")
{
CP_XML_ATTR(L"val", (int)(*dStrokeOpacity * 1000));
CP_XML_ATTR2(ns_att + L"val", (int)(*dStrokeOpacity * 1000));
}
}
}
}
}
if (fill != L"a:noFill")
if (fill != ns + L":noFill")
{
_CP_OPT(std::wstring) strVal;
if (dash_style.length() > 0 && dash_style != L"solid")
{
CP_XML_NODE(L"a:prstDash"){CP_XML_ATTR(L"val", dash_style);}
CP_XML_NODE(ns + L":prstDash"){CP_XML_ATTR2(ns_att + L"val", dash_style);}
}
odf_reader::GetProperty(prop,L"marker-start", strVal);
if (strVal)
{
CP_XML_NODE(L"a:headEnd"){CP_XML_ATTR(L"type", strVal.get());}
CP_XML_NODE(ns + L":headEnd"){CP_XML_ATTR2(ns_att + L"type", strVal.get());}
}
odf_reader::GetProperty(prop,L"marker-end",strVal);
if (strVal)
{
CP_XML_NODE(L"a:tailEnd"){CP_XML_ATTR(L"type",strVal.get());}
CP_XML_NODE(ns + L":tailEnd"){CP_XML_ATTR2(ns_att + L"type",strVal.get());}
}
}
}
}
}
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset, const std::wstring &ns)
{
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:avLst")
CP_XML_NODE(ns + L":avLst")
{
_CP_OPT(std::wstring) strModifiers;
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
@ -268,20 +276,20 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
{
if (values[i].empty()) continue;
CP_XML_NODE(L"a:gd")
CP_XML_NODE(ns + L":gd")
{
if (names.size() > i)
{
CP_XML_ATTR(L"name", names[i]);
CP_XML_ATTR2(ns_att + L"name", names[i]);
}
else
{
if (values.size() > 1)
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
CP_XML_ATTR2(ns_att + L"name", L"adj" + std::to_wstring(i + 1));
else
CP_XML_ATTR(L"name", L"adj");
CP_XML_ATTR2(ns_att + L"name", L"adj");
}
CP_XML_ATTR(L"fmla", L"val " + values[i]);
CP_XML_ATTR2(ns_att + L"fmla", L"val " + values[i]);
}
}
}

View File

@ -118,8 +118,8 @@ namespace oox {
};
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false, const std::wstring &ns = L"a");
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset, const std::wstring &ns = L"a");
void oox_serialize_action (std::wostream & strm, const _action_desc & val);
}

View File

@ -53,55 +53,59 @@ namespace oox {
//////////////////////////////////////////////////////////////////////////////////////////////////////
void oox_serialize_none_fill(std::wostream & strm)
void oox_serialize_none_fill(std::wostream & strm, const std::wstring &ns)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:noFill");
CP_XML_NODE(ns + L":noFill");
}
}
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity)
void oox_serialize_srgb(std::wostream & strm, const std::wstring &color,_CP_OPT(double) opacity, const std::wstring &ns)
{
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:srgbClr")
CP_XML_NODE(ns + L":srgbClr")
{
CP_XML_ATTR(L"val", color);
CP_XML_ATTR2(ns_att + L"val", color);
if (opacity)
{
CP_XML_NODE(L"a:alpha")
CP_XML_NODE(ns + L":alpha")
{
CP_XML_ATTR(L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
CP_XML_ATTR2(ns_att + L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
}
}
}
}
}
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity)
void oox_serialize_srgb(std::wostream & strm, const std::wstring &color, _CP_OPT(odf_types::percent) opacity, const std::wstring &ns)
{
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:srgbClr")
CP_XML_NODE(ns + L":srgbClr")
{
CP_XML_ATTR(L"val",color);
CP_XML_ATTR2(ns_att + L"val",color);
if (opacity)
{
CP_XML_NODE(L"a:alpha")
CP_XML_NODE(ns + L":alpha")
{
CP_XML_ATTR(L"val", std::to_wstring((int)opacity->get_value()*1000));// + L"%");
CP_XML_ATTR2(ns_att + L"val", std::to_wstring((int)opacity->get_value() * 1000));// + L"%");
}
}
}
}
}
void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
{
if (!val.solid)return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:solidFill")
CP_XML_NODE(ns + L":solidFill")
{
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity, ns);
}
}
@ -151,20 +155,25 @@ void vml_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
}
}
}
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
{
if (!val.bitmap) return;
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
CP_XML_WRITER(strm)
{
CP_XML_NODE(std::wstring(val.bitmap->name_space + L":blipFill"))
{
//if (val.bitmap->rotate) CP_XML_ATTR(L"a:rotWithShape",*(val.bitmap->rotate));
//else CP_XML_ATTR(L"a:rotWithShape",1);
//if (val.bitmap->rotate) CP_XML_ATTR(ns + L":rotWithShape",*(val.bitmap->rotate));
//else CP_XML_ATTR(ns + L":rotWithShape",1);
if (val.bitmap->dpi) CP_XML_ATTR(L"a:dpi", *val.bitmap->dpi);
if (val.bitmap->dpi)
{
CP_XML_ATTR2(ns + L":dpi", *val.bitmap->dpi);
}
CP_XML_NODE(L"a:blip")
CP_XML_NODE(ns + L":blip")
{
if (val.bitmap->isInternal)
{
@ -176,38 +185,38 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
if (val.opacity)
{
CP_XML_NODE(L"a:alphaModFix")
CP_XML_NODE(ns + L":alphaModFix")
{
CP_XML_ATTR(L"amt",(int)(*val.opacity * 1000));
CP_XML_ATTR2(ns_att + L"amt", (int)(*val.opacity * 1000));
}
}
}
if (val.bitmap->bCrop)
{
CP_XML_NODE(L"a:srcRect")
CP_XML_NODE(ns + L":srcRect")
{
CP_XML_ATTR(L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
CP_XML_ATTR(L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
CP_XML_ATTR(L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
CP_XML_ATTR(L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
CP_XML_ATTR2(ns_att + L"l", static_cast<int>(val.bitmap->cropRect[0]*1000));
CP_XML_ATTR2(ns_att + L"t", static_cast<int>(val.bitmap->cropRect[1]*1000));
CP_XML_ATTR2(ns_att + L"r", static_cast<int>(val.bitmap->cropRect[2]*1000));
CP_XML_ATTR2(ns_att + L"b", static_cast<int>(val.bitmap->cropRect[3]*1000));
}
}
if (val.bitmap->bTile)
{
CP_XML_NODE(L"a:tile")
CP_XML_NODE(ns + L":tile")
{
//tx="0" ty="0" sx="100000" sy="100000"
CP_XML_ATTR(L"flip", "none");
CP_XML_ATTR(L"algn", L"ctr");
CP_XML_ATTR2(ns_att + L"flip", "none");
CP_XML_ATTR2(ns_att + L"algn", L"ctr");
}
}
else if (val.bitmap->bStretch)
{
CP_XML_NODE(L"a:stretch")
CP_XML_NODE(ns + L":stretch")
{
if (!val.bitmap->bCrop)
{
CP_XML_NODE(L"a:fillRect");
CP_XML_NODE(ns + L":fillRect");
}
}
}
@ -269,25 +278,27 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
}
}
}
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
{
if (!val.gradient) return;
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:gradFill")
CP_XML_NODE(ns + L":gradFill")
{
if (val.gradient->colors.size()>0)
{
CP_XML_NODE(L"a:gsLst")
CP_XML_NODE(ns + L":gsLst")
{
for (int i = 0; i < val.gradient->colors.size(); i++)
{
oox_gradient_fill::_color_position & col = val.gradient->colors[i];
CP_XML_NODE(L"a:gs")
CP_XML_NODE(ns + L":gs")
{
CP_XML_ATTR(L"pos", (int)(col.pos * 1000));//%
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity);
CP_XML_ATTR2(ns_att + L"pos", (int)(col.pos * 1000));//%
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity, ns);
}
}
}
@ -298,25 +309,25 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
switch(val.gradient->style)
{
case 0:
CP_XML_NODE(L"a:lin")
CP_XML_NODE(ns + L":lin")
{
CP_XML_ATTR(L"ang",(int)angle);//gr in rad
CP_XML_ATTR2(ns_att + L"ang",(int)angle);//gr in rad
}break;
case 1:
case 2:
case 3:
CP_XML_NODE(L"a:path")
CP_XML_NODE(ns + L":path")
{
if (val.gradient->style == 1) CP_XML_ATTR(L"path", L"rect");
if (val.gradient->style == 2) CP_XML_ATTR(L"path", L"circle");
if (val.gradient->style == 3) CP_XML_ATTR(L"path", L"shape");
if (val.gradient->style == 1) CP_XML_ATTR2(ns_att + L"path", L"rect");
if (val.gradient->style == 2) CP_XML_ATTR2(ns_att + L"path", L"circle");
if (val.gradient->style == 3) CP_XML_ATTR2(ns_att + L"path", L"shape");
CP_XML_NODE(L"a:fillToRect")
CP_XML_NODE(ns + L":fillToRect")
{
CP_XML_ATTR(L"l", (int)(val.gradient->rect[0] * 1000));
CP_XML_ATTR(L"t", (int)(val.gradient->rect[1] * 1000));
CP_XML_ATTR(L"r", (int)(val.gradient->rect[2] * 1000));
CP_XML_ATTR(L"b", (int)(val.gradient->rect[3] * 1000));
CP_XML_ATTR2(ns_att + L"l", (int)(val.gradient->rect[0] * 1000));
CP_XML_ATTR2(ns_att + L"t", (int)(val.gradient->rect[1] * 1000));
CP_XML_ATTR2(ns_att + L"r", (int)(val.gradient->rect[2] * 1000));
CP_XML_ATTR2(ns_att + L"b", (int)(val.gradient->rect[3] * 1000));
}
}break;
}
@ -324,22 +335,24 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
//tileRect (Tile Rectangle) §20.1.8.59
}
}
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
{
if (!val.hatch)return;
std::wstring ns_att = (ns == L"a" ? L"" : ns + L":");
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:pattFill")
CP_XML_NODE(ns + L":pattFill")
{
CP_XML_ATTR(L"prst",val.hatch->preset);
CP_XML_NODE(L"a:fgClr")//опять для ms важно что этот цвет перед back
CP_XML_ATTR2(ns_att + L"prst", val.hatch->preset);
CP_XML_NODE(ns + L":fgClr")//опять для ms важно что этот цвет перед back
{
oox_serialize_srgb(CP_XML_STREAM(), val.hatch->color_ref, val.opacity);
}
if (val.hatch->color_back_ref)
{
CP_XML_NODE(L"a:bgClr")
CP_XML_NODE(ns + L":bgClr")
{
oox_serialize_srgb(CP_XML_STREAM(), *val.hatch->color_back_ref ,val.opacity);
}
@ -379,23 +392,23 @@ void vml_serialize_background (std::wostream & strm, const _oox_fill & val, cons
}
}
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val)
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns)
{
switch (val.type)
{
case 0:
oox_serialize_none_fill(strm);
oox_serialize_none_fill(strm, ns);
break;
case 1:
oox_serialize_solid_fill(strm, val);
oox_serialize_solid_fill(strm, val, ns);
break;
case 2:
oox_serialize_bitmap_fill(strm, val);
oox_serialize_bitmap_fill(strm, val, ns);
break;
case 3:
oox_serialize_gradient_fill(strm, val);
oox_serialize_gradient_fill(strm, val, ns);
break;
case 4: oox_serialize_hatch_fill(strm, val);
case 4: oox_serialize_hatch_fill(strm, val, ns);
break;
}
}

View File

@ -143,10 +143,12 @@ namespace oox {
}
};
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id);
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val);
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring &color, int id);
void oox_serialize_srgb (std::wostream & strm, const std::wstring &color, _CP_OPT(double) opacity, const std::wstring &ns = L"a");
void oox_serialize_srgb (std::wostream & strm, const std::wstring &color, _CP_OPT(odf_types::percent) opacity, const std::wstring &ns = L"a");
void oox_serialize_bitmap_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val, const std::wstring &ns = L"a");
}
}

View File

@ -274,7 +274,7 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
}
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
CP_XML_NODE(L"a:graphic")
{
@ -311,7 +311,7 @@ void pptx_serialize_table(std::wostream & strm, _pptx_drawing & val)
}
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
CP_XML_NODE(L"a:graphic")
{
@ -352,7 +352,7 @@ void pptx_serialize_object(std::wostream & strm, _pptx_drawing & val)
}
val.serialize_xfrm(CP_XML_STREAM(), L"p", true);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
CP_XML_NODE(L"a:graphic")
{

View File

@ -252,7 +252,7 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
}
val.serialize_xfrm(CP_XML_STREAM(), L"xdr");
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
//oox_serialize_ln(CP_XML_STREAM(), val.additional);
CP_XML_NODE(L"a:graphic")
{

View File

@ -284,7 +284,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
point.pos = 0;
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
//if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
@ -300,7 +300,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
point.pos = 0;
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
@ -312,7 +312,7 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
point.pos = 100;
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
}break;
@ -328,13 +328,13 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
point.pos = 0;
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
//if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
//if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);

View File

@ -855,8 +855,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
}
if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough
&& styleRunThrough && styleRunThrough->get_type() == run_through::Background
)
&& styleRunThrough && styleRunThrough->get_type() == run_through::Background)
{
drawing-> behindDoc = L"1";
}
@ -896,7 +895,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
//////////////////////////////////////////
bool bTxbx = (drawing->sub_type == 1);
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles() ,drawing->fill, bTxbx);
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles(),drawing->fill, bTxbx);
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
{
@ -1040,7 +1039,7 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
if (drawing.sub_type !=5 )//line
{
drawing.additional.push_back(_property(L"text-content",Context.get_drawing_context().get_text_stream_shape()));
drawing.additional.push_back(_property(L"text-content", Context.get_drawing_context().get_text_stream_shape()));
}
Context.get_drawing_context().clear_stream_shape();
@ -1055,7 +1054,7 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
bad_shape_ = false;
}
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional,L"stroke"))//бывает что и не определено ничего
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional, L"stroke"))//бывает что и не определено ничего
{
drawing.fill.solid = oox::oox_solid_fill::create();
drawing.fill.solid->color = L"729FCF";

View File

@ -69,7 +69,14 @@ void draw_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attribut
void draw_shape::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
if CP_CHECK_NAME(L"draw", L"enhanced-geometry")
{
CP_CREATE_ELEMENT(enhanced_geometry_);
}
else
{
CP_CREATE_ELEMENT(content_);
}
}
void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
{

View File

@ -85,7 +85,8 @@ public:
odf_types::common_xlink_attlist xlink_attlist_;
_CP_OPT(std::wstring) draw_id_; //используется для анимашек
office_element_ptr_array content_;
office_element_ptr_array content_;
office_element_ptr enhanced_geometry_;
bool bad_shape_;
bool word_art_;

View File

@ -72,34 +72,65 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
Context.get_drawing_context().add_name_object(name.get_value_or(L"Shape"));
//////////////////////////////на другом контексте
//---------------------------сначала элементы графики потом все остальное
if (enhanced_geometry_)
enhanced_geometry_->docx_convert(Context);
//---------------------------на другом контексте
//тут может быть не только текст , но и таблицы, другие объекты ...
oox::StreamsManPtr prev = Context.get_stream_man();
std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_shape());
Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) ));
//сначала элементы графики потом все остальное
for (size_t i = 0; i < content_.size(); i++)
{
ElementType type = content_[i]->get_type();
if (type == typeDrawCustomShape) // || ....
{
content_[i]->docx_convert(Context);
}
}
Context.reset_context_state();
if (word_art_)
{
const std::wstring styleName = common_draw_attlists_.shape_with_text_and_styles_.
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
style_content * content = styleInst ? styleInst->content() : NULL;
graphic_format_properties * graphicProp = content ? content->get_graphic_properties() : NULL;
if (graphicProp)
{
oox::_oox_fill fill;
Compute_GraphicFill(graphicProp->common_draw_fill_attlist_, graphicProp->style_background_image_,
Context.root()->odf_context().drawStyles(), fill);
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
}
std::wstringstream strm_fill, strm_ln;
oox::oox_serialize_fill(strm_fill, fill, L"w14");
std::wstring textFill = strm_fill.str();
std::vector<_property> props;
graphicProp->apply_to(props);
oox::oox_serialize_ln(strm_ln, props, false, L"w14");
std::wstring textLn = strm_ln.str();
std::wstring text_props;
if (!textLn.empty())
{
text_props += textLn;
}
if (!textFill.empty())
{
text_props += L"<w14:textFill>" + textFill + L"</w14:textFill>";
}
Context.set_drawing_text_props(text_props);
}
}
for (size_t i = 0; i < content_.size(); i++)
{
ElementType type = content_[i]->get_type();
if (type != typeDrawCustomShape)
{
content_[i]->docx_convert(Context);
}
content_[i]->docx_convert(Context);
}
Context.back_context_state();

View File

@ -162,13 +162,22 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
}
////////////////////////////////////////////////////////////////////////////////////
Context.get_text_context().start_object();
if (enhanced_geometry_)
enhanced_geometry_->pptx_convert(Context);
if (word_art_)
{
//set fill & stroke to text
}
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
std::wstring text_content_ = Context.get_text_context().end_object();
if (text_content_.length()>0)
if (!text_content_.empty())
{
Context.get_slide_context().set_property(_property(L"text-content",text_content_));
}

View File

@ -66,6 +66,9 @@ namespace odf_reader {
void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
{
if (enhanced_geometry_)
enhanced_geometry_->xlsx_convert(Context);
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
@ -130,11 +133,17 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
oox::_oox_fill fill;
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
Context.root()->odf_context().drawStyles() ,fill);
Context.root()->odf_context().drawStyles(), fill);
Context.get_drawing_context().set_fill(fill);
//////////////////////////////////////////////////////////////////////////////////////
Context.get_text_context().start_drawing_content();
if (word_art_)
{
//Context.get_text_context().start_drawing_fill(fill);
}
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
@ -143,7 +152,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
if (!text_content_.empty())
{
Context.get_drawing_context().set_property(_property(L"text-content",text_content_));
Context.get_drawing_context().set_property(_property(L"text-content", text_content_));
}
Context.get_drawing_context().end_drawing();

View File

@ -200,7 +200,11 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
if (false == map_encryptions_.empty())
{
if (password.empty()) return;
if (password.empty())
{
bError = true;
return;
}
//decrypt files
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(tempPath);
@ -286,17 +290,22 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
bool result = true;
for (size_t i = 0; i < arFiles.size(); ++i)
{
result = false;
std::wstring sFileName = NSFile::GetFileName(arFiles[i]);
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind = map_encryptions_.find(arFiles[i]);
if ( pFind != map_encryptions_.end() )
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind;
if (false == map_encryptions_.empty())
{
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
if (false == result)
break;
pFind = map_encryptions_.find(arFiles[i]);
if ( pFind != map_encryptions_.end() )
{
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
if (false == result)
break;
}
}
else
if (!result && false == map_encryptions_extra_.empty())
{
pFind = map_encryptions_extra_.find(arFiles[i]);
if ( pFind != map_encryptions_.end() )
@ -306,10 +315,11 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
if (false == result)
break;
}
else
{
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
}
}
if (!result)
{
NSFile::CFileBinary::Copy(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName);
result = true;
}
}
for (size_t i = 0; result && i < arDirectories.size(); ++i)

View File

@ -189,6 +189,8 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
if (str_start > store_str.length()) str_start = store_str.length(); // это если на буквы в буквице разные стили
str = store_str.substr(str_start, str_size);
if (textStyle==1) Context.pop_text_properties();
}
size_t paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)

View File

@ -407,6 +407,7 @@ void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:type", draw_type_);
CP_XML_ATTR_OPT(L"drawooo:sub-view-size", draw_sub_view_size_);
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
CP_XML_ATTR_OPT(L"draw:text-rotate-angle", draw_text_rotate_angle_);
CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_);
CP_XML_ATTR_OPT(L"drawooo:enhanced-path", draw_enhanced_path_);
//CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
@ -430,7 +431,7 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
attlist_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < draw_equation_.size(); i++)
{

View File

@ -331,6 +331,8 @@ public:
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
_CP_OPT(std::wstring) draw_text_path_mode_;
_CP_OPT(std::wstring) draw_text_path_scale_;
_CP_OPT(int) draw_text_rotate_angle_;
void serialize(CP_ATTR_NODE);
};
@ -350,7 +352,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_;
draw_enhanced_geometry_attlist attlist_;
_CP_OPT(std::wstring) svg_viewbox_;

View File

@ -186,6 +186,7 @@ struct odf_drawing_state
presentation_placeholder_ = boost::none;
rotateAngle_ = boost::none;
text_rotateAngle_ = boost::none;
path_ = L"";
view_box_ = L"";
@ -218,6 +219,7 @@ struct odf_drawing_state
_CP_OPT(double) rotateAngle_;
_CP_OPT(unsigned int) fill_color_;
_CP_OPT(int) text_rotateAngle_;
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_placeholder_;
@ -232,6 +234,7 @@ struct odf_drawing_state
int oox_shape_preset_;
bool in_group_;
bool text_box_tableframe_;
};
class odf_drawing_context::Impl
@ -536,7 +539,7 @@ void odf_drawing_context::end_drawing()
if (impl_->current_drawing_state_.rotateAngle_)
rotate += *impl_->current_drawing_state_.rotateAngle_;
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
if (fabs(rotate) > 0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
}
double x = impl_->current_drawing_state_.svg_x_ ? impl_->current_drawing_state_.svg_x_->get_value() : 0;
double y = impl_->current_drawing_state_.svg_y_ ? impl_->current_drawing_state_.svg_y_->get_value() : 0;
@ -615,8 +618,8 @@ void odf_drawing_context::end_drawing()
draw_enhanced_geometry* enhan = dynamic_cast<draw_enhanced_geometry*>(custom->draw_enhanced_geometry_.get());
if(enhan)
{
if (impl_->current_drawing_state_.flipV_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
if (impl_->current_drawing_state_.flipH_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
if (impl_->current_drawing_state_.flipV_) enhan->attlist_.draw_mirror_vertical_ = true;
if (impl_->current_drawing_state_.flipH_) enhan->attlist_.draw_mirror_horizontal_ = true;
}
}else
{
@ -986,15 +989,17 @@ void odf_drawing_context::end_shape()
{
if (text_shape)
{
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_same_letter_heights_ = false;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_scale_ = L"path" ;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_mode_ = L"shape" ;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_ = true;
enhanced->attlist_.draw_text_path_same_letter_heights_ = false;
enhanced->attlist_.draw_text_path_scale_ = L"path" ;
enhanced->attlist_.draw_text_path_mode_ = L"shape" ;
enhanced->attlist_.draw_text_path_ = true;
enhanced->attlist_.draw_text_rotate_angle_ = impl_->current_drawing_state_.text_rotateAngle_;
}
if (!impl_->current_drawing_state_.path_.empty())
{
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
enhanced->attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
}
if (!impl_->current_drawing_state_.view_box_.empty())
{
@ -1002,7 +1007,7 @@ void odf_drawing_context::end_shape()
}
if (!sub_type.empty())
{
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = sub_type;
enhanced->attlist_.draw_type_ = sub_type;
}
else
{
@ -1018,23 +1023,23 @@ void odf_drawing_context::end_shape()
else
enhanced->svg_viewbox_ = shape_define->view_box;
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
enhanced->attlist_.draw_type_ = shape_define->odf_type_name;
enhanced->attlist_.draw_text_areas_ = shape_define->text_areas;
enhanced->draw_enhanced_geometry_attlist_.draw_glue_points_ = shape_define->glue_points;
enhanced->draw_enhanced_geometry_attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
enhanced->attlist_.draw_glue_points_ = shape_define->glue_points;
enhanced->attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
if (impl_->current_drawing_state_.oox_shape_ && !impl_->current_drawing_state_.oox_shape_->modifiers.empty())
{
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
enhanced->attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
}
else // обязательно нужны дефолтовые
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = shape_define->modifiers;
enhanced->attlist_.draw_modifiers_ = shape_define->modifiers;
if (!shape_define->enhanced_path.empty())
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
enhanced->attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
else
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
enhanced->attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
for (size_t i = 0; i < shape_define->equations.size(); i++)
{
@ -1074,6 +1079,18 @@ void odf_drawing_context::end_shape()
}
end_element();
}
if (impl_->current_drawing_state_.flipV_)
{
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
}
if (impl_->current_drawing_state_.flipH_)
{
if (impl_->current_graphic_properties->style_mirror_)
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
else
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
}
end_element();
}
@ -1346,7 +1363,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
//impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = color(hexColor); - default transparent
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
@ -1599,26 +1616,10 @@ void odf_drawing_context::set_viewBox (double W, double H)
void odf_drawing_context::set_flip_H(bool bVal)
{
impl_->current_drawing_state_.flipH_ = bVal;
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
//for image
if (impl_->current_graphic_properties->style_mirror_)
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
else
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
}
void odf_drawing_context::set_flip_V(bool bVal)
{
impl_->current_drawing_state_.flipV_ = bVal;
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
//for image
if (impl_->current_graphic_properties->style_mirror_)
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" vertical");
else
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
}
void odf_drawing_context::set_rotate(double dVal)
@ -1658,7 +1659,7 @@ void odf_drawing_context::set_object_background(bool Val)
if (Val)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
//impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
}
}
void odf_drawing_context::set_object_foreground(bool Val)
@ -1673,7 +1674,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Foreground);
}
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
//impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
}
}
@ -2278,6 +2279,33 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
if (mode == 1) return;//незачем
if (impl_->current_drawing_state_.elements_.empty())return;
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
{
switch(mode)
{
case 5://textverticaltypeWordArtVert:
case 6://textverticaltypeWordArtVertRtl:
case 3://SimpleTypes::textverticaltypeVert:
case 2://SimpleTypes::textverticaltypeMongolianVert:
case 0://SimpleTypes::textverticaltypeEaVert:
impl_->current_drawing_state_.rotateAngle_ = 90. / 180. * 3.14159265358979323846;
break;
case 4://SimpleTypes::textverticaltypeVert270:
impl_->current_drawing_state_.rotateAngle_ = 270. / 180. * 3.14159265358979323846;
break;
case 1://SimpleTypes::textverticaltypeHorz:
default:
break;
}
if (impl_->current_drawing_state_.flipH_ && impl_->current_drawing_state_.rotateAngle_ )
{
impl_->current_drawing_state_.rotateAngle_ = - *impl_->current_drawing_state_.rotateAngle_;
impl_->current_drawing_state_.flipH_ = false;
}
return;
}
if (!impl_->current_paragraph_properties)
{
style* style_ = dynamic_cast<style*>(impl_->current_drawing_state_.elements_[0].style_elm.get());
@ -2483,6 +2511,12 @@ void odf_drawing_context::start_text_box()
}
void odf_drawing_context::set_text_box_min_size(bool val)
{
if (impl_->current_graphic_properties)
{
impl_->current_graphic_properties->draw_auto_grow_height_ = true;
impl_->current_graphic_properties->draw_auto_grow_width_ = true;
}
if (impl_->current_drawing_state_.elements_.empty()) return;
draw_text_box* draw = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
@ -2647,7 +2681,13 @@ void odf_drawing_context::end_image()
end_shape();
return;
}
if (impl_->current_drawing_state_.flipH_)
{
if (impl_->current_graphic_properties->style_mirror_)
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
else
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
}
end_element();
end_frame();
}
@ -2795,7 +2835,8 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
}
}
if (impl_->current_graphic_properties)
if ((impl_->current_graphic_properties) &&
!impl_->current_graphic_properties->draw_auto_grow_height_)
{
//автоувеличение при добавлении текста
impl_->current_graphic_properties->draw_auto_grow_height_ = false;
@ -2860,10 +2901,20 @@ void odf_drawing_context::start_gradient_style()
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
gradient->draw_border_ = 0;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
break;
case Line:
if (!impl_->current_graphic_properties->draw_stroke_)
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->svg_stroke_width_)
impl_->current_graphic_properties->svg_stroke_width_ = length(length(1, length::pt).get_value_unit(length::cm), length::cm);//default
break;
}
}
void odf_drawing_context::set_gradient_type(gradient_style::type style)
{
@ -2882,6 +2933,11 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
gradient->draw_start_color_ = hexColor;
gradient->draw_start_intensity_ = 100.;
if (impl_->current_drawing_part_ == Line)
{
impl_->current_graphic_properties->svg_stroke_color_ = hexColor;
}
}
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
{

View File

@ -593,7 +593,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
if (oox_shape->txBody.IsInit()) bodyPr = oox_shape->txBody->bodyPr.GetPointer();
else bodyPr = oox_shape->oTextBoxBodyPr.GetPointer();
if (bodyPr && bodyPr->fromWordArt.get_value_or(false))
if ((bodyPr) && (bodyPr->prstTxWarp.IsInit()))
{
int wordart_type = convert(bodyPr->prstTxWarp.GetPointer());
if (wordart_type > 0) type = wordart_type;
@ -782,9 +782,16 @@ void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
{
if (oox_text_preset == NULL) return -1;
if (oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextNoShape) return 2000;
return 2001 + oox_text_preset->prst.GetBYTECode();
if (oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextNoShape ||
oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextPlain) // в зависимости от других настроек
{
return 2000;
}
else
{
return 2001 + oox_text_preset->prst.GetBYTECode();
}
}
void OoxConverter::convert(PPTX::Logic::PrstGeom *oox_geom)
{
@ -1067,8 +1074,13 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
std::wstring hexColorStart, hexColorEnd;
_CP_OPT(double) opacityStart, opacityEnd;
convert(&oox_grad_fill->GsLst[0].color,hexColorEnd, opacityEnd, nARGB);
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size()-1].color,hexColorStart, opacityStart, nARGB);
convert(&oox_grad_fill->GsLst[0].color, hexColorEnd, opacityEnd, nARGB);
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size() - 1].color, hexColorStart, opacityStart, nARGB);
if (hexColorEnd == hexColorStart && opacityEnd == opacityStart && oox_grad_fill->GsLst.size() > 2)
{
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size() / 2].color, hexColorStart, opacityStart, nARGB);
}
odf_context()->drawing_context()->set_gradient_start(hexColorStart, opacityStart);
odf_context()->drawing_context()->set_gradient_end (hexColorEnd, opacityEnd);
@ -1253,6 +1265,16 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
{
if (!oox_bodyPr) return;
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
{
if (oox_bodyPr->prstTxWarp->avLst[i].fmla.IsInit())
{
odf_context()->drawing_context()->add_modifier(oox_bodyPr->prstTxWarp->avLst[i].fmla.get());
}
}
}
if (oox_bodyPr->vert.IsInit())
{
odf_context()->drawing_context()->set_textarea_writing_mode (oox_bodyPr->vert->GetBYTECode());
@ -1287,7 +1309,7 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
switch(oox_bodyPr->Fit.type)
{
case PPTX::Logic::TextFit::FitSpAuto:
{//изменяемы размеры
{//изменяемы размеры шейпа под текст
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
}break;
case PPTX::Logic::TextFit::FitNo:
@ -1300,17 +1322,6 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
{
}
}
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
{
if (oox_bodyPr->prstTxWarp->avLst[i].fmla.IsInit())
{
odf_context()->drawing_context()->add_modifier(oox_bodyPr->prstTxWarp->avLst[i].fmla.get());
}
}
}
}
void OoxConverter::convert(PPTX::Logic::NvSpPr *oox_nvSpPr)
{

View File

@ -254,7 +254,7 @@ void DocxConverter::convert_document()
//----------------------------------------------------------------------------------------------------------
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard");
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard", true);
odt_context->text_context()->clear_params();
@ -1507,7 +1507,7 @@ void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logi
}
}
}
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name)
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name, bool bAlways)
{
if (oox_section_pr == NULL) return;
current_section_properties = NULL;
@ -1684,7 +1684,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
//nullable<SimpleTypes::CDecimalNumber<> > m_oChapStyle;
}
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit())
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit() || bAlways)
{
OOX::Logic::CSectionProperty* s = last_section_properties ? last_section_properties : oox_section_pr;
@ -2244,51 +2244,95 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
text_properties->content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WNormal);
}
bool set_color = false;
if (oox_run_pr->m_oTextFill.getType() == OOX::et_a_gradFill || oox_run_pr->m_oTextOutline.IsInit())
{
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
if (drawing_context)
{
if (odf_context()->drawing_context()->change_text_box_2_wordart())
{
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
odf_context()->drawing_context()->start_area_properties(true);
if(gradFill.IsInit())
{
OoxConverter::convert(gradFill.operator->());
}
else if (solidFill.IsInit())
{
OoxConverter::convert(solidFill.operator->());
}
else
{
odf_context()->drawing_context()->set_no_fill();
}
odf_context()->drawing_context()->end_area_properties();
if (oox_run_pr->m_oTextOutline.IsInit())
{
odf_context()->drawing_context()->start_line_properties(true);
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
odf_context()->drawing_context()->end_line_properties();
}
set_color = true;
}
}
else{} //обычный текст .. градиент по телу абзаца (
}
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
if (!set_color && oox_run_pr->m_oColor.IsInit())
bool set_word_art = drawing_context ? drawing_context->is_wordart() : false;
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
bool bFillText = (oox_run_pr->m_oTextFill.m_type != PPTX::Logic::UniFill::notInit) &&
(oox_run_pr->m_oTextFill.m_type != PPTX::Logic::UniFill::noFill);
bool bOutlineText = ((oox_run_pr->m_oTextOutline.is_init()) &&
(oox_run_pr->m_oTextOutline->Fill.m_type != PPTX::Logic::UniFill::notInit) &&
(oox_run_pr->m_oTextOutline->Fill.m_type != PPTX::Logic::UniFill::noFill));
bool bOutline = oox_run_pr->m_oOutline.IsInit();
bool bColorText = !bOutline && (oox_run_pr->m_oColor.IsInit() && (oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorRGB));
_CP_OPT(odf_types::color) color;
if (oox_run_pr->m_oColor.IsInit())
{
if(oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorAuto)
text_properties->content_.fo_color_ = odf_types::color(L"#000000");
color = odf_types::color(L"#000000");
else
convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content_.fo_color_);
convert(oox_run_pr->m_oColor.GetPointer(), color);
text_properties->content_.fo_color_ = color;
}
if (gradFill.is_init() || (bOutlineText && (bFillText || bColorText)))
{
set_word_art = true;
}
if (drawing_context && set_word_art)
{
if (drawing_context->change_text_box_2_wordart())
{
drawing_context->start_area_properties(true);
if(gradFill.IsInit())
{
OoxConverter::convert(gradFill.operator->());
}
else if (solidFill.IsInit())
{
OoxConverter::convert(solidFill.operator->());
}
else if (color)
{
drawing_context->set_solid_fill(color->get_hex_value());
}
else
{
drawing_context->set_no_fill();
}
drawing_context->end_area_properties();
if (oox_run_pr->m_oTextOutline.IsInit())
{
drawing_context->start_line_properties(true);
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
drawing_context->end_line_properties();
}
}
else
{
set_word_art = false;
}
}
std::wstring hexString;
_CP_OPT(double) opacity;
if (bOutlineText)
{
text_properties->content_.style_text_outline_ = true;
gradFill = oox_run_pr->m_oTextOutline->Fill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
solidFill = oox_run_pr->m_oTextOutline->Fill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
}
if (solidFill.is_init())
{
OoxConverter::convert(&solidFill->Color, hexString, opacity);
}
else if ((gradFill.is_init()) && (false == gradFill->GsLst.empty()))
{
OoxConverter::convert(&gradFill->GsLst[0].color, hexString, opacity);
}
if (!hexString.empty())
{
text_properties->content_.fo_color_ = hexString;
}
//text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::None); //нельзя..если будет выше наследуемого то подчеркивания не будет
@ -2447,10 +2491,11 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
if (oox_run_pr->m_oShd.IsInit())
{
_CP_OPT(odf_types::color) odf_color;
convert(oox_run_pr->m_oShd->m_oFill.GetPointer(), oox_run_pr->m_oShd->m_oThemeFill.GetPointer(),
oox_run_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_run_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
convert(oox_run_pr->m_oShd.GetPointer(), odf_color);
if (odf_color)
text_properties->content_.fo_background_color_ = *odf_color;
{
text_properties->content_.fo_background_color_= *odf_color;
}
}
if (oox_run_pr->m_oOutline.IsInit())
text_properties->content_.style_text_outline_ = true; //контур

View File

@ -183,7 +183,7 @@ namespace Oox2Odf
void convert(OOX::Logic::CBackground *oox_background, int type);
void convert(OOX::Logic::CSdt *oox_sdt);
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"");
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"", bool bAlways = false);
void convert(OOX::Logic::CParagraph *oox_paragraph);
void convert(OOX::Logic::CRun *oox_run);
void convert(OOX::Logic::CParagraphProperty *oox_para_prop, odf_writer::style_paragraph_properties *paragraph_properties);

View File

@ -218,9 +218,11 @@ namespace NSBinPptxRW
}
std::wstring strExts = _T(".jpg");
int nIndexExt = (int)strInput.rfind(wchar_t('.'));
//use GetFileName to avoid defining '.' in the directory as extension
std::wstring strFileName = NSFile::GetFileName(strInput);
int nIndexExt = (int)strFileName.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strInput.substr(nIndexExt);
strExts = strFileName.substr(nIndexExt);
int typeAdditional = 0;
std::wstring strAdditional;

View File

@ -64,6 +64,7 @@ namespace OOX
m_mTable.insert( std::make_pair( _T("emf"), _T("image/x-emf")));
m_mTable.insert( std::make_pair( _T("emz"), _T("image/x-emz")));
m_mTable.insert( std::make_pair( _T("wmf"), _T("image/x-wmf")));
m_mTable.insert( std::make_pair( _T("svg"), _T("image/svg+xml")));
m_mTable.insert( std::make_pair( _T("svm"), _T("image/svm")));
m_mTable.insert( std::make_pair( _T("wav"), _T("audio/wav")));
m_mTable.insert( std::make_pair( _T("wma"), _T("audio/x-wma")));

View File

@ -102,3 +102,16 @@ void CFileDownloader::CheckSuspend()
{
return m_pInternal->CheckSuspend();
}
#ifdef _MAC
bool CFileDownloader::m_bIsARCEnabled = false;
void CFileDownloader::SetARCEnabled(const bool& enabled)
{
m_bIsARCEnabled = enabled;
}
bool CFileDownloader::GetARCEnabled()
{
return m_bIsARCEnabled;
}
#endif

View File

@ -41,6 +41,10 @@ protected:
// создаем в зависимости от платформы
CFileDownloader_private* m_pInternal;
#ifdef _MAC
static bool m_bIsARCEnabled;
#endif
public:
CFileDownloader(std::wstring sFileUrl, bool bDelete = true);
virtual ~CFileDownloader();
@ -63,4 +67,9 @@ public:
int GetPriority();
void CheckSuspend();
#ifdef _MAC
static void SetARCEnabled(const bool& enabled);
static bool GetARCEnabled();
#endif
};

View File

@ -1,4 +1,5 @@
#include "FileDownloader_private.h"
#include "FileDownloader.h"
#if _IOS
#import <Foundation/Foundation.h>
@ -27,12 +28,12 @@ public :
}
virtual int DownloadFile()
{
{
if (m_sFilePath.empty())
{
{
m_sFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD");
if (NSFile::CFileBinary::Exists(m_sFilePath))
NSFile::CFileBinary::Remove(m_sFilePath);
NSFile::CFileBinary::Remove(m_sFilePath);
}
NSString* stringURL = StringWToNSString(m_sFileUrl);
@ -50,9 +51,12 @@ public :
return 0;
#else
#ifndef _ASC_USE_ARC_
[stringURL release];
[url release];
[urlData release];
if (!CFileDownloader::GetARCEnabled())
{
[stringURL release];
[url release];
[urlData release];
}
#endif
#endif
return 0;
@ -62,8 +66,11 @@ public :
return 1;
#else
#ifndef _ASC_USE_ARC_
[stringURL release];
[url release];
if (!CFileDownloader::GetARCEnabled())
{
[stringURL release];
[url release];
}
#endif
#endif
return 1;

View File

@ -914,6 +914,25 @@ TFontCacheSizes CFontFile::GetChar(LONG lUnicode)
return oSizes;
}
double CFontFile::GetCharWidth(int gid)
{
if (!m_pFace)
return 0;
if (0 != FT_Load_Glyph(m_pFace, gid, 40970))
return 0;
FT_Glyph pGlyph = NULL;
if (0 != FT_Get_Glyph(m_pFace->glyph, &pGlyph))
return 0;
double dRet = (double)(m_pFace->glyph->linearHoriAdvance * m_dUnitsKoef / m_pFace->units_per_EM);
FT_Done_Glyph(pGlyph);
return dRet;
}
INT CFontFile::GetString(CGlyphString& oString)
{
int nCountGlyph = oString.GetLength();

View File

@ -239,6 +239,8 @@ public:
int SetCMapForCharCode(long lUnicode, int *pnCMapIndex);
int SetCMapForCharCode2(long lUnicode);
double GetCharWidth(int gid);
int GetKerning(FT_UInt unPrevGID, FT_UInt unGID);
void SetStringGID(const INT& bGID);
INT GetStringGID();

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
@ -256,7 +256,7 @@ namespace NSCommon
int nCount = 1;
++tmp;
while (nMask == *tmp && tmp < tmpLast)
while (tmp < tmpLast && nMask == *tmp)
{
++tmp;
nCount++;
@ -537,12 +537,13 @@ namespace NSCommon
pRenderer->put_FontFaceIndex(lFaceIndex);
pManager->LoadFontFromFile(strFontPath, lFaceIndex, 14, dDpi, dDpi);
bool bIsSymbol = FALSE;
bool bIsSymbol = false;
NSFonts::IFontFile* pFile = pManager->GetFile();
if (pManager->GetFile())
{
bIsSymbol = pManager->GetFile()->IsSymbolic(false);
}
if (pFile)
bIsSymbol = pFile->IsSymbolic(false);
std::wstring sFontName = pPair->second.m_sName;
if (bIsSymbol)
{
@ -557,6 +558,45 @@ namespace NSCommon
pRenderer->put_FontPath(pInfoCur->m_wsFontPath);
pRenderer->put_FontFaceIndex(0);
}
else if (pFile)
{
int nFontNameLen = (int)sFontName.length();
bool bIsPresentAll = true;
for (int nC = 0; nC < nFontNameLen; nC++)
{
int nCMapIndex = 0;
int nGid = pFile->SetCMapForCharCode(sFontName.at(nC), &nCMapIndex);
if (0 >= nGid)
{
bIsPresentAll = false;
break;
}
else
{
double offsetG = pFile->GetCharWidth(nGid);
if (offsetG < 0.0001)
{
bIsPresentAll = false;
break;
}
}
}
if (!bIsPresentAll)
{
NSFonts::CFontSelectFormat oSelectFormat;
oSelectFormat.wsName = new std::wstring(L"Arial");
NSFonts::CFontInfo* pInfoCur = pManager->GetFontInfoByParams(oSelectFormat);
if (NULL != pInfoCur)
{
pManager->LoadFontFromFile(pInfoCur->m_wsFontPath, 0, 14, dDpi, dDpi);
}
pRenderer->put_FontPath(pInfoCur->m_wsFontPath);
pRenderer->put_FontFaceIndex(0);
}
}
pRenderer->PathCommandStart();
pRenderer->BeginCommand(c_nClipType);
@ -568,7 +608,7 @@ namespace NSCommon
pRenderer->put_FontCharSpace(0);
pRenderer->put_FontSize(14);
pRenderer->CommandDrawText(pPair->second.m_sName, 5, 25.4 * (index * lH1_px + lH1_px) / dDpi - 2, 0, 0);
pRenderer->CommandDrawText(sFontName, 5, 25.4 * (index * lH1_px + lH1_px) / dDpi - 2, 0, 0);
pRenderer->BeginCommand(c_nResetClipType);
pRenderer->EndCommand(c_nResetClipType);

View File

@ -488,6 +488,7 @@ namespace NSFonts
virtual void SetFontMatrix(const double& fA, const double& fB, const double& fC, const double fD, double fE, double fF) = 0;
virtual int SetCMapForCharCode(long lUnicode, int *pnCMapIndex) = 0;
virtual double GetCharWidth(int gid) = 0;
};
namespace NSFontFile

View File

@ -172,15 +172,24 @@ namespace PdfReader
if (pEncryptDict->DictLookup("OE", &oOwnerEncryptionKey))
{
m_seOwnerEncryptionKey = oOwnerEncryptionKey.GetString()->Copy();
if (oOwnerEncryptionKey.IsString())
{
m_seOwnerEncryptionKey = oOwnerEncryptionKey.GetString()->Copy();
}
}
if (pEncryptDict->DictLookup("UE", &oUserEncryptionKey))
{
m_seUserEncryptionKey = oUserEncryptionKey.GetString()->Copy();
if (oUserEncryptionKey.IsString())
{
m_seUserEncryptionKey = oUserEncryptionKey.GetString()->Copy();
}
}
if (pEncryptDict->DictLookup("Perms", &oPermsValue))
{
m_sePermsValue = oPermsValue.GetString()->Copy();
if (oPermsValue.IsString())
{
m_sePermsValue = oPermsValue.GetString()->Copy();
}
}
if (oFileID.IsArray())