Compare commits

...

21 Commits

Author SHA1 Message Date
b75495c4ba write tableStyle without tableStyleElement 2016-11-30 12:21:01 +03:00
49939a7f19 build error (macOS, clang) 2016-11-25 18:00:33 +03:00
e690aa0c53 . 2016-11-25 16:01:03 +03:00
bb4483fd7d Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - fix errors ...
2016-11-25 12:08:47 +03:00
b93c7a2620 mobile-coautoring 2016-11-25 12:08:42 +03:00
42c94d5cd0 OdfFormatReader - fix errors ... 2016-11-24 18:23:41 +03:00
41b3c6fb16 mobile-coautoring 2016-11-24 16:54:01 +03:00
ddb708eb62 x2t ... 2016-11-23 18:37:37 +03:00
429c0a5a37 stroke bug 2016-11-23 18:30:59 +03:00
4c12ba9c1a OdfFormatReader - fix bugs... 2016-11-23 17:45:21 +03:00
eae048a8a3 OdfFormatReader - fix bugs conditionalFormatting, number styles, ... 2016-11-22 20:15:30 +03:00
a52c18608d Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  for bug 33490
  RtfFormatReader - two and more levels in fields (contents, ...)
  fix bug 33488
2016-11-22 19:00:57 +03:00
7824ce640c up 2016-11-22 19:00:52 +03:00
83bae8fabd for bug 33490 2016-11-22 17:00:55 +03:00
623d89d197 RtfFormatReader - two and more levels in fields (contents, ...) 2016-11-22 14:28:04 +03:00
fb9d2cbf49 fix bug 33488 2016-11-22 14:16:48 +03:00
0d7c8ebc07 for bug 32797 2016-11-21 17:23:23 +03:00
929252f681 RtfFormatReader -fix read spec char in field 2016-11-21 17:17:44 +03:00
2207cee065 x2t version up 2016-11-21 16:10:22 +03:00
467cb760f3 OdfFormatReader - fix backgroud presentation 2016-11-21 16:08:55 +03:00
23718718c4 fix bug #33449 2016-11-21 11:35:56 +03:00
47 changed files with 642 additions and 435 deletions

View File

@ -4404,6 +4404,17 @@ public:
if(m_oMath_rPr.IsNoEmpty())
m_oMath_rPr.Write(&GetRunStringWriter());
}
else if ( c_oSerRunType::arPr == type )
{
PPTX::Logic::RunProperties rPr;
m_oBufferedStream.Skip(1);//skip type
rPr.fromPPTY(&m_oBufferedStream);
rPr.m_name = L"a:rPr";
//todo use one writer
NSBinPptxRW::CXmlWriter oWriter;
rPr.toXmlWriter(&oWriter);
GetRunStringWriter().WriteString(oWriter.GetXmlString());
}
else if ( c_oSerRunType::del == type )
{
TrackRevision oRPrChange;

View File

@ -503,7 +503,8 @@ extern int g_nCurFormatVersion;
footnoteRef = 24,
endnoteRef = 25,
footnoteReference = 26,
endnoteReference = 27
endnoteReference = 27,
arPr = 28
};}
namespace c_oSerImageType{enum c_oSerImageType
{

View File

@ -3966,6 +3966,12 @@ namespace BinDocxRW
brPrs.Write_rPr(pCtrlPr.m_oRPr.get());
m_oBcw.WriteItemEnd(nCurPos2);
}
if ( pCtrlPr.m_oARPr.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerRunType::arPr);
m_oBcw.m_oStream.WriteRecord2(0, pCtrlPr.m_oARPr);
m_oBcw.WriteItemEnd(nCurPos2);
}
if ( pCtrlPr.m_oDel.IsInit() )
{
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerRunType::del);

View File

@ -50,7 +50,7 @@ public:
std::wstring convert(std::wstring const & expr);
// $Лист1.$A$1 -> Лист1!$A$1
std::wstring convert_named_ref(std::wstring const & expr, bool withTableName = true);
std::wstring convert_named_ref(std::wstring const & expr, bool withTableName = true, std::wstring separator = L" ");
//a-la convert without check formula
std::wstring convert_named_expr(std::wstring const & expr, bool withTableName = true);

View File

@ -69,16 +69,16 @@ namespace formulasconvert {
if (splitted.size()==3)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[2];
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[2];
return true;
}
if (splitted.size()==4)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[3];
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[3];
return true;
}
return false;
@ -239,7 +239,7 @@ namespace formulasconvert {
bool odf2oox_converter::Impl::check_formula(std::wstring& expr)
{
boost::match_results<std::wstring::const_iterator> res;
if (boost::regex_search(expr, res, boost::wregex(L"(?:[\\w]+:)?=(.+)"), boost::match_default))
if (boost::regex_search(expr, res, boost::wregex(L"^(?:[\\w]+:)?=(.+)"), boost::match_default))
{
expr = res[1].str();
while (expr.find(L"=") == 0)
@ -300,7 +300,6 @@ namespace formulasconvert {
if (what[1].matched)
{
std::wstring inner = what[1].str();
boost::algorithm::replace_all(inner, L".", L"ТОСHKA");
boost::algorithm::replace_all(inner, L" ", L"PROBEL");
return inner;
}
@ -314,6 +313,7 @@ namespace formulasconvert {
if (what[1].matched)
{
std::wstring inner = what[1].str();
boost::algorithm::replace_all(inner, L".", L"ТОСHKA");
boost::algorithm::replace_all(inner, L"(", L"SCOBCAIN");
boost::algorithm::replace_all(inner, L")", L"SCOBCAOUT");
@ -327,6 +327,8 @@ namespace formulasconvert {
else if (what[2].matched)
{
std::wstring inner = what[2].str();
boost::algorithm::replace_all(inner, L".", L"ТОСHKA");
boost::algorithm::replace_all(inner, L"(", L"SCOBCAIN");
boost::algorithm::replace_all(inner, L")", L"SCOBCAOUT");
@ -407,47 +409,54 @@ namespace formulasconvert {
if (is_forbidden(expr))
return L"NULLFORMULA()";
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");
std::wstring workstr = expr;
//boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// Better_Donut.ods- cell(c27)
//std::wstring workstr = boost::regex_replace(
// expr,
// complexRef,
// &replace_point_space,
// boost::match_default | boost::format_all);
std::wstring workstr = boost::regex_replace(
expr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
check_formula(workstr);
bool isFormula = check_formula(workstr);
workstr = boost::regex_replace(
boost::regex_replace(
workstr,
boost::wregex(L"('.*?')|(\".*?\")"),
&convert_scobci, boost::match_default | boost::format_all);
//boost::algorithm::replace_all(workstr, L"'", L"APOSTROF");
replace_cells_range (workstr, true);
replace_semicolons (workstr);
replace_vertical (workstr);
int res_find=0;
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
if (isFormula)
{
//могут быть частично заданы диапазоны
//todooo
boost::algorithm::replace_all(workstr, L"FDIST(", L"_xlfn.F.DIST(");
// ROUNDUP( - тут в oox 2 параметра - разрядность нужно - ,0) - EV Requirements v2.2.3.ods
int res_find=0;
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
{
//могут быть частично заданы диапазоны
//todooo
}
//todooo INDEX((A1:C6~A8:C11),2,2,2) - ???? - INDEX_emb.ods
}
//-----------------------------------------------------------
boost::algorithm::replace_all(workstr, L"PROBEL" , L" ");
boost::algorithm::replace_all(workstr, L"APOSTROF" , L"'");
boost::algorithm::replace_all(workstr, L"TOCHKA" , L".");
boost::algorithm::replace_all(workstr, L"ТОСHKA" , L".");
boost::algorithm::replace_all(workstr, L"SCOBCAIN", L"(");
boost::algorithm::replace_all(workstr, L"SCOBCAOUT", L")");
boost::algorithm::replace_all(workstr, L"SCOBCAIN" , L"(");
boost::algorithm::replace_all(workstr, L"SCOBCAOUT" , L")");
boost::algorithm::replace_all(workstr, L"KVADRATIN", L"[");
boost::algorithm::replace_all(workstr, L"KVADRATIN" , L"[");
boost::algorithm::replace_all(workstr, L"KVADRATOUT", L"]");
boost::algorithm::replace_all(workstr, L"PROBEL", L" ");
boost::algorithm::replace_all(workstr, L"KAVYCHKA", L"\"");
boost::algorithm::replace_all(workstr, L"PROBEL" , L" ");
boost::algorithm::replace_all(workstr, L"KAVYCHKA" , L"\"");
return workstr;
}
@ -535,7 +544,7 @@ namespace formulasconvert {
{
return impl_->convert_chart_distance(expr);
}
std::wstring odf2oox_converter::convert_named_ref(const std::wstring& expr, bool withTableName)
std::wstring odf2oox_converter::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
{
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
@ -550,6 +559,11 @@ namespace formulasconvert {
impl_->replace_named_ref(workstr, withTableName);
if (separator != L" ")
{
boost::algorithm::replace_all(workstr, L" " , separator);
}
boost::algorithm::replace_all(workstr, L"PROBEL" , L" ");
boost::algorithm::replace_all(workstr, L"APOSTROF" , L"'");
boost::algorithm::replace_all(workstr, L"TOCHKA" , L".");

View File

@ -86,20 +86,28 @@ std::wstring static get_default_file_name(RelsType type)
return L"";
}
}
std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType type, size_t Num)
std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType type, bool & isInternal, size_t Num)
{
if (uri.empty()) return L"";
std::wstring sExt;
std::wstring f_name = odf_packet_ + FILE_SEPARATOR_STR + uri;
sExt = detectImageFileExtension(f_name); //4EA0AA6E-479D-4002-A6AA-6D6C88EC6D65.odt - image - "opentbs_added_1.phpxvkeg" = png
if (type == typeImage)
{
sExt = detectImageFileExtension(f_name); //4EA0AA6E-479D-4002-A6AA-6D6C88EC6D65.odt - image - "opentbs_added_1.phpxvkeg" = png
}
else
{
}
if (sExt.empty())
{
int n = uri.find(L"ObjectReplacements");
if (n >= 0)
{
if (!isInternal) return L"";
f_name = odf_packet_ + uri.substr(1, uri.length() - 1);
sExt = detectImageFileExtension(f_name);
}
@ -113,7 +121,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
}
}
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
return get_default_file_name(type) + std::to_wstring(Num) + sExt;
}
std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
@ -139,7 +147,7 @@ std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref)
{
const bool isMediaInternal = utils::media::is_internal(href, odf_packet_);
bool isMediaInternal = utils::media::is_internal(href, odf_packet_);
std::wstring sub_path = L"media/";
@ -150,36 +158,41 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
}
int number=0;
if ( type == typeChart) number= count_charts+1;
else if ( type == typeImage) number= count_image+1;
else if ( type == typeShape) number= count_shape+1;
else if ( type == typeMedia) number= count_media+1;
if ( type == typeChart) number = count_charts + 1;
else if ( type == typeImage) number = count_image + 1;
else if ( type == typeShape) number = count_shape + 1;
else if ( type == typeMedia) number = count_media + 1;
else
number= items_.size()+1;
number = items_.size()+1;
inputFileName = create_file_name(href, type, number);
inputFileName = create_file_name(href, type, isMediaInternal, number);
std::wstring inputPath = isMediaInternal ? odf_packet_ + FILE_SEPARATOR_STR + href : href;
std::wstring outputPath = isMediaInternal ? ( sub_path + inputFileName) : href;
std::wstring inputPath = isMediaInternal ? odf_packet_ + FILE_SEPARATOR_STR + href : href;
std::wstring outputPath = isMediaInternal ? ( sub_path + inputFileName) : href;
if ( type == typeChart)outputPath= outputPath + L".xml";
if ( type == typeChart) outputPath= outputPath + L".xml";
std::wstring id;
BOOST_FOREACH(item & elm, items_)
for (int i = 0 ; i < items_.size(); i++)
{
if (elm.href == inputPath)
if (items_[i].href == inputPath)
{
id = elm.Id;
outputPath = elm.outputName;
elm.count_add++;
id = items_[i].Id;
outputPath = items_[i].outputName;
items_[i].count_add++;
break;
}
}
if (id.length() < 1)
ref = outputPath;
isInternal = isMediaInternal;
if (id.empty())
{
if ( type == typeChart)
{
id = std::wstring(L"chId") + boost::lexical_cast<std::wstring>(count_charts+1);
id = std::wstring(L"chId") + std::to_wstring(count_charts+1);
count_charts++;
}
else if ( type == typeImage)
@ -190,12 +203,14 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
outputPath = outputPath.substr(0, n_svm) + L".png";
}
//------------------------------------------------
id = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image+1);
if (inputFileName.empty()) return L"";
id = std::wstring(L"picId") + std::to_wstring(count_image+1);
count_image++;
}
else
{
id = std::wstring(L"rId") + boost::lexical_cast<std::wstring>(count_shape+1);
id = std::wstring(L"rId") + std::to_wstring(count_shape+1);
count_shape++;
}
@ -204,7 +219,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
ref = outputPath;
isInternal = isMediaInternal;
return id;
return id;
}
void mediaitems::dump_rels(rels & Rels)

View File

@ -85,7 +85,7 @@ public:
items_array & items() { return items_; }
private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, size_t Num);
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (std::wstring &fileName);
items_array items_;

View File

@ -108,7 +108,8 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
}
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.bitmap)return;
if (!val.bitmap) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(std::wstring(val.bitmap->name_space + L":blipFill"))
@ -116,17 +117,17 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
//if (val.bitmap->rotate) CP_XML_ATTR(L"a:rotWithShape",*(val.bitmap->rotate));
//else CP_XML_ATTR(L"a:rotWithShape",1);
if (val.bitmap->dpi) CP_XML_ATTR(L"a:dpi",*val.bitmap->dpi);
if (val.bitmap->dpi) CP_XML_ATTR(L"a:dpi", *val.bitmap->dpi);
CP_XML_NODE(L"a:blip")
{
if (val.bitmap->isInternal)
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:embed",val.bitmap->rId );
CP_XML_ATTR(L"r:embed", val.bitmap->rId );
}
else
CP_XML_ATTR(L"r:link",val.bitmap->rId );
CP_XML_ATTR(L"r:link", val.bitmap->rId );
if (val.opacity)
{
@ -151,8 +152,8 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
CP_XML_NODE(L"a:tile")
{
//tx="0" ty="0" sx="100000" sy="100000"
CP_XML_ATTR(L"flip","none");
CP_XML_ATTR(L"algn",L"ctr");
CP_XML_ATTR(L"flip", "none");
CP_XML_ATTR(L"algn", L"ctr");
}
}
else if (val.bitmap->bStretch)
@ -173,7 +174,11 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
}
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.gradient)return;
if (!val.gradient)
{
return;
}
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:gradFill")
@ -186,8 +191,8 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(L"a:gs")
{
CP_XML_ATTR(L"pos",(int)(col.pos *1000));//%
oox_serialize_srgb(CP_XML_STREAM(),col.color_ref,col.opacity);
CP_XML_ATTR(L"pos", (int)(col.pos * 1000));//%
oox_serialize_srgb(CP_XML_STREAM(), col.color_ref, col.opacity);
}
}
}
@ -234,13 +239,13 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
CP_XML_ATTR(L"prst",val.hatch->preset);
CP_XML_NODE(L"a:fgClr")//опять для ms важно что этот цвет перед back
{
oox_serialize_srgb(CP_XML_STREAM(),val.hatch->color_ref,val.opacity);
oox_serialize_srgb(CP_XML_STREAM(), val.hatch->color_ref, val.opacity);
}
if (val.hatch->color_back_ref)
{
CP_XML_NODE(L"a:bgClr")
{
oox_serialize_srgb(CP_XML_STREAM(),*val.hatch->color_back_ref,val.opacity);
oox_serialize_srgb(CP_XML_STREAM(), *val.hatch->color_back_ref ,val.opacity);
}
}

View File

@ -44,17 +44,18 @@ namespace oox {
class oox_solid_fill;
typedef _CP_PTR(oox_solid_fill) oox_solid_fill_ptr;
class oox_solid_fill
{
public:
std::wstring color;
static oox_solid_fill_ptr create();
};
///////////////////////////////////
class oox_bitmap_fill;
typedef _CP_PTR(oox_bitmap_fill) oox_bitmap_fill_ptr;
class oox_bitmap_fill
{
public:
@ -78,6 +79,7 @@ namespace oox {
/////////////////////////////////////////////////////////
class oox_hatch_fill;
typedef _CP_PTR(oox_hatch_fill) oox_hatch_fill_ptr;
class oox_hatch_fill
{
public:
@ -92,25 +94,26 @@ namespace oox {
////////////////////////////////////////////////////////////
class oox_gradient_fill;
typedef _CP_PTR(oox_gradient_fill) oox_gradient_fill_ptr;
class oox_gradient_fill
{
public:
struct _color_position
{
double pos;
std::wstring color_ref;
double pos;
std::wstring color_ref;
_CP_OPT(double) opacity;
};
static oox_gradient_fill_ptr create();
oox_gradient_fill() : style(0), angle(0)
oox_gradient_fill() : style(0), angle(90)//from top to bottom
{
memset(rect,0,sizeof(double)*4);
memset(rect, 0, sizeof(double) * 4);
}
int style;
double rect[4];
double angle;
int style;
double rect[4];
double angle;
std::vector<_color_position> colors;
@ -119,14 +122,14 @@ namespace oox {
struct _oox_fill
{
_oox_fill() : type(-1){}
oox_gradient_fill_ptr gradient;
oox_hatch_fill_ptr hatch;
oox_bitmap_fill_ptr bitmap;
oox_solid_fill_ptr solid;
_CP_OPT(double) opacity;
int type;
int type;
void clear()
{

View File

@ -454,7 +454,7 @@ void pptx_slide_context::process_images()
std::wstring rId = impl_->get_mediaitems().add_or_find(L"", typeShape, isMediaInternal, ref);
impl_->add_drawing(drawing, isMediaInternal, rId, ref, typeShape);//объект
}else
}else if (!drawing.fill.bitmap->rId.empty())
{
impl_->add_drawing(drawing, isMediaInternal, drawing.fill.bitmap->rId , ref, drawing.type);//объект
}

View File

@ -399,9 +399,10 @@ void pptx_text_context::Impl::write_t(std::wostream & strm)
void pptx_text_context::Impl::write_rPr(std::wostream & strm)
{
if (paragraph_style_name_.length()<1 && span_style_name_.length()<1 && !(hyperlink_hId.length()>0) && base_style_name_.length()<1)return;
if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty())
return;
odf_reader::text_format_properties_content text_properties_paragraph_;
odf_reader::text_format_properties_content text_properties_paragraph_;
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf_types::style_family::Paragraph);
odf_reader::text_format_properties_content text_properties_span_;
@ -415,6 +416,7 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
get_styles_context().start();
get_styles_context().hlinkClick() = hyperlink_hId;
text_properties_.pptx_convert(pptx_context_);
strm << get_styles_context().text_style().str();

View File

@ -34,10 +34,10 @@
#include "xlsx_utils.h"
#include <vector>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../formulasconvert/formulasconvert.h"
namespace cpdoccore {
namespace oox {
@ -82,6 +82,9 @@ namespace oox {
//expr
_CP_OPT(std::wstring) formula;
_CP_OPT(std::wstring) formula_type;
_CP_OPT(std::wstring) text;
_CP_OPT(std::wstring) formula2;
_CP_OPT(int) rank;
//color scale icon set data_bar
std::vector<_cfvo> cfvo;
//color scale data_bar(1 element)
@ -131,26 +134,33 @@ public:
{
CP_XML_ATTR(L"priority", priority++);
if (c.rules[j].dxfId) CP_XML_ATTR(L"dxfId", *c.rules[j].dxfId);
if (c.rules[j].percent) CP_XML_ATTR(L"percent", *c.rules[j].percent);
if (c.rules[j].operator_) CP_XML_ATTR(L"operator", *c.rules[j].operator_);
if (c.rules[j].stopIfTrue) CP_XML_ATTR(L"stopIfTrue", *c.rules[j].stopIfTrue);
//CP_XML_ATTR(L"text" , L"");
//CP_XML_ATTR(L"rank" , 0);
if (c.rules[j].dxfId) CP_XML_ATTR(L"dxfId", *c.rules[j].dxfId);
if (c.rules[j].percent) CP_XML_ATTR(L"percent", *c.rules[j].percent);
if (c.rules[j].operator_) CP_XML_ATTR(L"operator", *c.rules[j].operator_);
if (c.rules[j].stopIfTrue) CP_XML_ATTR(L"stopIfTrue", *c.rules[j].stopIfTrue);
if (c.rules[j].text) CP_XML_ATTR(L"text", *c.rules[j].text);
if (c.rules[j].rank) CP_XML_ATTR(L"rank", *c.rules[j].rank);
//CP_XML_ATTR(L"bottom" , 0);
//CP_XML_ATTR(L"equalAverage" , 0);
//CP_XML_ATTR(L"aboveAverage" , 0);
if (c.rules[j].type == 1)
{
CP_XML_ATTR(L"type", *c.rules[j].formula_type);
if (c.rules[j].formula)
if ((c.rules[j].formula) && (!c.rules[j].formula->empty()))
{
CP_XML_NODE(L"formula")
{
CP_XML_CONTENT(*c.rules[j].formula);
}
}
if ((c.rules[j].formula2) && (!c.rules[j].formula2->empty()))
{
CP_XML_NODE(L"formula")
{
CP_XML_CONTENT(*c.rules[j].formula2);
}
}
}
else if (c.rules[j].type == 2)
{
@ -233,7 +243,7 @@ void xlsx_conditionalFormatting_context::add(std::wstring ref)
formulasconvert::odf2oox_converter converter;
impl_->conditionalFormattings_.push_back(conditionalFormatting());
impl_->conditionalFormattings_.back().ref = converter.convert_named_ref(ref, false);
impl_->conditionalFormattings_.back().ref = converter.convert_named_ref(ref, false, L";");
}
void xlsx_conditionalFormatting_context::add_rule(int type)
@ -244,18 +254,54 @@ void xlsx_conditionalFormatting_context::add_rule(int type)
}
void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
{
formulasconvert::odf2oox_converter converter;
int pos = -1;
std::wstring val;
if ( 0 <= (pos = f.find(L"formula-is(")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
val = f.substr(11, f.size() - 12);
if (0 == (pos = val.find(L"\""))) //Raport_7A.ods или выкинуть ограждающие кавычки с формулы?
{
impl_->conditionalFormattings_.back().rules.back().text = val;
val.clear();
}
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert(val);
}
else if (0 <= (pos = f.find(L"is-between(")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
}
else if (0 <= (pos = f.find(L"is-time(")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"expression";
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
}
else if (0 <= (pos = f.find(L"duplicate")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
}
else if (0 <= (pos = f.find(L"top")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"top10";
if (0 < (pos = f.find(L"percent")))
{
impl_->conditionalFormattings_.back().rules.back().percent = true;
}
if (0 <= (pos = f.find(L"(")))
{
val = f.substr(pos + 1, f.length() - pos - 2);
impl_->conditionalFormattings_.back().rules.back().rank = boost::lexical_cast<int>(val);
}
}
else if (0 <= (pos = f.find(L"contains-text")))
{
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText";
impl_->conditionalFormattings_.back().rules.back().text = f.substr(15, f.length() - 17);
}
else
{
@ -263,54 +309,66 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
if (0 <= (pos = f.find(L"!empty")))
{
val = converter.convert_named_expr( f );
}
else if (0 <= (pos = f.find(L"empty")))
{
val = converter.convert_named_expr( f );
}
else if (0 <= (pos = f.find(L"bottom")))
{
}
else if (0 <= (pos = f.find(L"top")))
{
val = converter.convert_named_expr( f );
}
else if (0 <= (pos = f.find(L"!=")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"notEqual";
val = f.substr(2);
val = converter.convert_named_expr( f.substr(2) );
}
else if (0 <= (pos = f.find(L"<=")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"lessThanOrEqual";
val = f.substr(2);
val = converter.convert_named_expr( f.substr(2) );
}
else if (0 <= (pos = f.find(L">=")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"greaterThanOrEqual";
val = f.substr(2);
val = converter.convert_named_expr( f.substr(2) );
}
else if (0 <= (pos = f.find(L"=")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"equal";
val = f.substr(1);
val = converter.convert_named_expr( f.substr(1) );
}
else if (0 <= (pos = f.find(L"<")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"lessThan";
val = f.substr(1);
val = converter.convert_named_expr( f.substr(1) );
}
else if (0 <= (pos = f.find(L">")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"greaterThan";
val = f.substr(1);
val = converter.convert_named_expr( f.substr(1) );
}
else if (0 <= (pos = f.find(L"between")))
{
impl_->conditionalFormattings_.back().rules.back().operator_ = L"between";
val = f.substr(8, f.length() - 9);
if (0 <= (pos = val.find(L",")))
{
impl_->conditionalFormattings_.back().rules.back().formula2 = converter.convert_named_expr( val.substr(pos + 1) );
val = val.substr(0, pos);
}
val = converter.convert_named_expr( val );
}
else
{
val = f;
val = converter.convert( f );
}
}
formulasconvert::odf2oox_converter converter;
impl_->conditionalFormattings_.back().rules.back().formula = converter.convert_named_expr(val);
if (!val.empty())
impl_->conditionalFormattings_.back().rules.back().formula = val;
}
}
void xlsx_conditionalFormatting_context::set_dataBar(_CP_OPT(int) min, _CP_OPT(int) max)
{

View File

@ -471,6 +471,9 @@ void xlsx_drawing_context::process_position_properties(drawing_object_descriptio
x = obj.anchor_x_ - cx;
y = obj.anchor_y_ - cy;
if (x < 0) x = 0;
if (y < 0) y = 0; // calcul dun MS.ods
to = pos_anchor;
from = table_metrics.calc(x, y);

View File

@ -30,6 +30,7 @@
*
*/
#include <vector>
#include <cpdoccore/xml/utils.h>
#include "xlsx_numFmts.h"
@ -77,7 +78,7 @@ void xlsx_num_fmts::serialize(std::wostream & _Wostream) const
_Wostream << L"<numFmts count=\"" << impl_->formats_.size() << L"\">";
for (size_t i = 0; i < impl_->formats_.size(); ++i)
{
_Wostream << L"<numFmt formatCode=\"" << impl_->formats_[i] <<
_Wostream << L"<numFmt formatCode=\"" << xml::utils::replace_text_to_xml(impl_->formats_[i]) <<
L"\" numFmtId=\"" << impl_->transform_id(i) << "\" />";
}

View File

@ -188,7 +188,12 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
void xlsx_style_manager::Impl::serialize(std::wostream & _Wostream)
{
_Wostream << L"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">";
_Wostream << L"<styleSheet";
_Wostream << L" xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"";
_Wostream << L" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"";
_Wostream << L" mc:Ignorable=\"x14ac\"";
_Wostream << L" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\"";
_Wostream << L">";
numFmts_.serialize (_Wostream);
fonts_.serialize (_Wostream);
@ -201,8 +206,6 @@ void xlsx_style_manager::Impl::serialize(std::wostream & _Wostream)
cellStyles_.serialize(_Wostream);
dxfs_.serialize(_Wostream);
_Wostream << L"</styleSheet>";
}
@ -253,7 +256,7 @@ size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content
const std::wstring &num_format, bool default_set)
{
bool is_visible;
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format,default_set, is_visible);
return impl_->xfId(textProp, parProp, cellProp, xlxsCellFormat, num_format, default_set, is_visible);
}
size_t xlsx_style_manager::xfId(const odf_reader::text_format_properties_content * textProp,

View File

@ -40,15 +40,15 @@ namespace oox
struct region
{
region(size_t sCell, double sPos, size_t c, double l) : start_cell(sCell),
region(int sCell, double sPos, int c, double l) : start_cell(sCell),
start_pos(sPos),
count(c),
length(l)
{}
size_t start_cell;
int start_cell;
double start_pos;
size_t count;
int count;
double length;
};
@ -59,17 +59,19 @@ public:
{}
public:
void add(size_t count, double length_pt)
void add(int count, double length_pt)
{
region_.push_back(region(next_cell_, next_pos_, count, length_pt));
next_cell_ += count;
next_pos_ += count * length_pt;
}
double search(size_t cell)
double search(int cell)
{
double length_pt =0;
BOOST_FOREACH(region const & r, region_)
for (int i = 0; i < region_.size(); i++)
{
region & r = region_[i];
if (cell <= r.start_cell + r.count)
{
length_pt += (cell-r.start_cell)*r.length;
@ -87,34 +89,57 @@ public:
{
offset =0;
}
length_pt+= offset * region_.back().length;
length_pt += offset * region_.back().length;
}
}
return length_pt;
}
std::pair<size_t, double> search(size_t offset, double pos)
std::pair<int, double> search(int offset, double pos)
{
double skip_length =0;
BOOST_FOREACH(region const & r, region_)
if (pos < 0)//cs102.ods
{
int c_skip = 0, i = 0;
for (i = 0; i < region_.size(); i++)
{
if (region_[i].count + c_skip > offset)
break;
c_skip += region_[i].count;
}
for (; i >= 0 && pos < 0; i--)
{
pos += region_[i].length * region_[i].count;
offset--;
}
if (offset < 0) offset = 0;
if (pos < 0) pos = 0;
}
for (int i = 0; i < region_.size(); i++)
{
region & r = region_[i];
if (r.start_cell + r.count <= offset)
{
skip_length = r.start_pos +r.count*r.length;
skip_length = r.start_pos + r.count*r.length;
continue;
}
if (pos+skip_length >= r.start_pos && pos+skip_length < (r.start_pos + r.count * r.length))
if (pos + skip_length >= r.start_pos && pos + skip_length < (r.start_pos + r.count * r.length))
{
skip_length += (offset-r.start_cell) * r.length;
const double diff = pos+skip_length - r.start_pos;
const size_t cell = diff / r.length ;
skip_length += (offset - r.start_cell) * r.length;
const double diff = pos + skip_length - r.start_pos;
int cell = diff / r.length ;
double offset_cell = diff - cell * r.length;
if (offset_cell < 0)
{
offset_cell =0;
}
return std::pair<size_t, double>(r.start_cell + cell , offset_cell);
return std::pair<int, double>(r.start_cell + cell, offset_cell);
}
}
@ -122,38 +147,47 @@ public:
{
if (region_.back().start_cell + region_.back().count < offset)
{
skip_length+= (offset-region_.back().start_cell-region_.back().count/*-1*/) * region_.back().length;
skip_length += (offset - region_.back().start_cell - region_.back().count /*- 1*/) * region_.back().length;
}
region const & last_r = region_[region_.size() - 1];
const size_t last_cell = last_r.start_cell + last_r.count;
const double last_pos = last_r.start_pos + last_r.count * last_r.length;
double diff = pos+skip_length-last_r.start_pos-(last_r.count * last_r.length);
const size_t cell = diff / last_r.length;
double offset_cell = diff - cell * last_r.length;
region const & last_r = region_[region_.size() - 1];
const int last_cell = last_r.start_cell + last_r.count;
const double last_pos = last_r.start_pos + last_r.count * last_r.length;
double diff = pos + skip_length - last_r.start_pos - (last_r.count * last_r.length);
if (diff < 0)
diff = 0;
const int cell = diff / last_r.length;
double offset_cell = diff - cell * last_r.length;
if (offset_cell < 0)
{
offset_cell =0;
offset_cell = 0;
}
return std::pair<size_t, double>(last_cell + cell , offset_cell);
return std::pair<int, double>(last_cell + cell , offset_cell);
}
else
return std::pair<size_t, double>(offset, pos);
return std::pair<int, double>(offset, pos);
}
std::pair<size_t, double> search(double pos)
std::pair<int, double> search(double pos)
{
BOOST_FOREACH(region const & r, region_)
for (int i = 0; i < region_.size(); i++)
{
region & r = region_[i];
if (pos >= r.start_pos && pos < (r.start_pos + r.count * r.length))
{
const double diff = pos - r.start_pos;
const size_t cell = diff / r.length;
double offset = diff - cell * r.length;
const double diff = pos - r.start_pos;
const int cell = diff / r.length;
double offset = diff - cell * r.length;
if (offset < 0)
{
offset =0;
}
return std::pair<size_t, double>(r.start_cell + cell, offset);
return std::pair<int, double>(r.start_cell + cell, offset);
}
}
@ -162,20 +196,21 @@ public:
region const & last_r = region_[region_.size() - 1];
const size_t last_cell = last_r.start_cell + last_r.count;
const double last_pos = last_r.start_pos + last_r.count * last_r.length;
const double diff = pos - last_pos;
const size_t cell = diff / last_r.length;
double offset = diff - cell * last_r.length;
const double diff = pos - last_pos;
const int cell = diff / last_r.length;
double offset = diff - cell * last_r.length;
if (offset < 0)
{
offset =0;
}
return std::pair<size_t, double>(last_cell + cell, offset);
return std::pair<int, double>(last_cell + cell, offset);
}
else
return std::pair<size_t, double>(0, pos);
return std::pair<int, double>(0, pos);
}
private:
size_t next_cell_;
int next_cell_;
double next_pos_;
std::vector<region> region_;
};
@ -185,48 +220,48 @@ class xlsx_table_metrics::Impl
public:
xlsx_table_position calc(double x_pt, double y_pt)
{
const std::pair<size_t, double> c = cols_.search(x_pt);
const std::pair<size_t, double> r = rows_.search(y_pt);
const std::pair<int, double> c = cols_.search (x_pt);
const std::pair<int, double> r = rows_.search (y_pt);
xlsx_table_position res = {c.first, c.second, r.first, r.second};
xlsx_table_position res = {(size_t)c.first, c.second, (size_t)r.first, r.second};
return res;
}
xlsx_table_position calc(size_t offset_col,size_t offset_row,double x_pt, double y_pt)
xlsx_table_position calc(int offset_col, int offset_row, double x_pt, double y_pt)
{
std::pair<size_t, double> c ;
std::pair<size_t, double> r ;
std::pair<int, double> c ;
std::pair<int, double> r ;
c = cols_.search(offset_col,x_pt);
c = cols_.search(offset_col, x_pt);
r = rows_.search(offset_row,y_pt);
r = rows_.search(offset_row, y_pt);
xlsx_table_position res = {c.first, c.second, r.first, r.second};
xlsx_table_position res = {(size_t)c.first, c.second, (size_t)r.first, r.second};
return res;
}
xlsx_table_position calc(size_t last_col,size_t last_row)
xlsx_table_position calc(int last_col,int last_row)
{
std::pair<size_t, double> c = cols_.search(last_col,0);
std::pair<size_t, double> r = rows_.search(last_row,0);
std::pair<int, double> c = cols_.search (last_col, 0);
std::pair<int, double> r = rows_.search (last_row, 0);
xlsx_table_position res = {c.first, c.second, r.first, r.second};
xlsx_table_position res = {(size_t)c.first, c.second, (size_t)r.first, r.second};
return res;
}
void update_pt(size_t offset_col,size_t offset_row,double &x_pt, double &y_pt)
void update_pt(int offset_col,int offset_row,double &x_pt, double &y_pt)
{
x_pt += cols_.search(offset_col);
y_pt += rows_.search(offset_row);
x_pt += cols_.search (offset_col);
y_pt += rows_.search (offset_row);
}
void add_cols(size_t count, double widht_pt)
void add_cols(int count, double widht_pt)
{
return cols_.add(count, widht_pt);
}
void add_rows(size_t count, double height_pt)
void add_rows(int count, double height_pt)
{
return rows_.add(count, height_pt);
}
@ -247,30 +282,30 @@ xlsx_table_metrics::~xlsx_table_metrics()
xlsx_table_position xlsx_table_metrics::calc(double x_pt, double y_pt)
{
return impl_->calc(x_pt, y_pt);
return impl_->calc (x_pt, y_pt);
}
xlsx_table_position xlsx_table_metrics::calc(size_t offset_col,size_t offset_row,double x_pt, double y_pt)
xlsx_table_position xlsx_table_metrics::calc(int offset_col,int offset_row,double x_pt, double y_pt)
{
return impl_->calc(offset_col,offset_row,x_pt, y_pt);
return impl_->calc(offset_col, offset_row, x_pt, y_pt);
}
xlsx_table_position xlsx_table_metrics::calc(size_t last_col,size_t last_row)
xlsx_table_position xlsx_table_metrics::calc(int last_col,int last_row)
{
return impl_->calc(last_col,last_row);
return impl_->calc (last_col, last_row);
}
void xlsx_table_metrics::update_pt(size_t offset_col,size_t offset_row,double &x_pt, double &y_pt)
void xlsx_table_metrics::update_pt(int offset_col,int offset_row,double &x_pt, double &y_pt)
{
return impl_->update_pt(offset_col,offset_row,x_pt, y_pt);
return impl_->update_pt (offset_col, offset_row, x_pt, y_pt);
}
void xlsx_table_metrics::add_cols(size_t count, double width_pt)
void xlsx_table_metrics::add_cols(int count, double width_pt)
{
return impl_->add_cols(count, width_pt);
return impl_->add_cols (count, width_pt);
}
void xlsx_table_metrics::add_rows(size_t count, double height_pt)
void xlsx_table_metrics::add_rows(int count, double height_pt)
{
return impl_->add_rows(count, height_pt);
return impl_->add_rows (count, height_pt);
}
}

View File

@ -44,18 +44,18 @@ namespace oox
class xlsx_table_metrics
{
public:
xlsx_table_metrics();
~xlsx_table_metrics();
xlsx_table_metrics ();
~xlsx_table_metrics ();
public:
xlsx_table_position calc(double x_pt, double y_pt);
xlsx_table_position calc(size_t offset_col,size_t offset_row,double x_pt, double y_pt);
xlsx_table_position calc(size_t last_col,size_t last_row);
xlsx_table_position calc (double x_pt, double y_pt);
xlsx_table_position calc (int offset_col, int offset_row, double x_pt, double y_pt);
xlsx_table_position calc (int last_col, int last_row);
void update_pt(size_t offset_col,size_t offset_row,double &x_pt, double &y_pt);
void update_pt (int offset_col, int offset_row, double &x_pt, double &y_pt);
void add_cols(size_t count, double widht_pt);
void add_rows(size_t count, double height_pt);
void add_cols (int count, double widht_pt);
void add_rows (int count, double height_pt);
private:
class Impl;

View File

@ -191,8 +191,8 @@ std::wstring xlsx_table_state::default_row_cell_style() const
std::wstring xlsx_table_state::default_column_cell_style() const
{
if (current_table_column_ < column_default_cell_style_name_.size())
return column_default_cell_style_name_.at(current_table_column_);
if (current_table_column_ + 1 < column_default_cell_style_name_.size())
return column_default_cell_style_name_.at(current_table_column_ + 1);
else
{
//непонятная хрень!! - неправильно сформирован ods???

View File

@ -119,6 +119,7 @@ private:
std::wstringstream paragraph_; //перманенто скидываемые параграфы
std::wstringstream run_; //перманенто скидываемые куски с быть может разными свойствами
std::wstring store_cell_string_;
xlsx_shared_strings xlsx_shared_strings_;
std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится
@ -427,12 +428,12 @@ std::wstring xlsx_text_context::Impl::dump_paragraph(/*bool last*/)
std::wstring xlsx_text_context::Impl::dump_run()
{
const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
if (content.length()<1)
if (content.empty())
return L"";
std::wstring prefix_draw;
if (in_draw) prefix_draw=L"a:";
if (in_draw) prefix_draw = L"a:";
CP_XML_WRITER(run_)
{
@ -445,6 +446,7 @@ std::wstring xlsx_text_context::Impl::dump_run()
CP_XML_NODE(prefix_draw + L"t")
{
if (!in_draw)CP_XML_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM() << content;
}
}
@ -452,19 +454,21 @@ std::wstring xlsx_text_context::Impl::dump_run()
}
}
hyperlink_hId =L"";
return content;
}
void xlsx_text_context::Impl::start_cell_content()
{
paragraphs_cout_ = 0;
local_styles_ptr_ =NULL;
paragraphs_cout_ = 0;
local_styles_ptr_ = NULL;
run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring());
store_cell_string_.clear();
hyperlink_hId.clear();
paragraph_style_name_ = L"";
span_style_name_ = L"";
@ -488,6 +492,13 @@ void xlsx_text_context::Impl::start_comment_content()
}
void xlsx_text_context::Impl::start_drawing_content()
{
if (in_cell_content)
{
dump_run();
store_cell_string_ = run_.str();
}
paragraphs_cout_ = 0;
run_.str(std::wstring());
@ -539,9 +550,12 @@ int xlsx_text_context::Impl::end_cell_content()
{
dump_run();
const int sharedStrId = run_.str().empty() ? (-1) : static_cast<int>(xlsx_shared_strings_.add(run_.str()));
//???? нужно ли здесь очищать все ????? - проверить стили на кучках - и проверить как меняются стили внутри одной ячейки - то есть здешнее переопределение внешнего стиля
in_cell_content = false;
std::wstring cell_string = store_cell_string_ + run_.str();
store_cell_string_.clear();
in_cell_content = false;
const int sharedStrId = cell_string.empty() ? (-1) : xlsx_shared_strings_.add(cell_string);
return sharedStrId;
}

View File

@ -113,7 +113,7 @@ void xlsx_conversion_context::start_document()
std::vector<const odf_reader::style_instance *> instances;
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell));
instances.push_back(odfContext.styleContainer().style_by_name(L"Default",odf_types::style_family::TableCell,false));
instances.push_back(odfContext.styleContainer().style_by_name(L"Default", odf_types::style_family::TableCell, false));
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
odf_reader::paragraph_format_properties parFormatProperties = calc_paragraph_properties_content(instances);
@ -124,7 +124,7 @@ void xlsx_conversion_context::start_document()
cellFormat.set_cell_type(XlsxCellType::s);
cellFormat.set_num_format(oox::odf_string_to_build_in(0));
default_style_ = get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, L"",true);
default_style_ = get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, L"", true);
}
@ -179,7 +179,7 @@ void xlsx_conversion_context::end_document()
{
CP_XML_NODE(L"sheet")
{
CP_XML_ATTR(L"name", sheet->name());
CP_XML_ATTR(L"name", sheet->name()); // office 2010 ! ограничение на длину имени !!!
CP_XML_ATTR(L"sheetId", count);
CP_XML_ATTR(L"state", L"visible");
CP_XML_ATTR(L"r:id", id);

View File

@ -80,8 +80,8 @@ void calcext_date_is_attr::add_attributes( const xml::attributes_wc_ptr & Attrib
}
// calcext_conditional_formats
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_conditional_formats::ns = L"calcext";
const wchar_t * calcext_conditional_formats::name = L"conditional-formats";
const wchar_t * calcext_conditional_formats::ns = L"calcext";
const wchar_t * calcext_conditional_formats::name = L"conditional-formats";
void calcext_conditional_formats::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -100,8 +100,8 @@ void calcext_conditional_formats::xlsx_convert(oox::xlsx_conversion_context & Co
// calcext_conditional_format
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_conditional_format::ns = L"calcext";
const wchar_t * calcext_conditional_format::name = L"conditional-format";
const wchar_t * calcext_conditional_format::ns = L"calcext";
const wchar_t * calcext_conditional_format::name = L"conditional-format";
void calcext_conditional_format::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -126,8 +126,8 @@ void calcext_conditional_format::xlsx_convert(oox::xlsx_conversion_context & Con
// calcext_data_bar
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_data_bar::ns = L"calcext";
const wchar_t * calcext_data_bar::name = L"data-bar";
const wchar_t * calcext_data_bar::ns = L"calcext";
const wchar_t * calcext_data_bar::name = L"data-bar";
void calcext_data_bar::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -158,8 +158,8 @@ void calcext_data_bar::xlsx_convert(oox::xlsx_conversion_context & Context)
}
// calcext_color_scale
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_color_scale::ns = L"calcext";
const wchar_t * calcext_color_scale::name = L"color-scale";
const wchar_t * calcext_color_scale::ns = L"calcext";
const wchar_t * calcext_color_scale::name = L"color-scale";
void calcext_color_scale::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -179,8 +179,8 @@ void calcext_color_scale::xlsx_convert(oox::xlsx_conversion_context & Context)
}
// calcext_icon_set
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_icon_set::ns = L"calcext";
const wchar_t * calcext_icon_set::name = L"icon-set";
const wchar_t * calcext_icon_set::ns = L"calcext";
const wchar_t * calcext_icon_set::name = L"icon-set";
void calcext_icon_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -206,8 +206,8 @@ void calcext_icon_set::xlsx_convert(oox::xlsx_conversion_context & Context)
// calcext_formatting_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_formatting_entry::ns = L"calcext";
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
const wchar_t * calcext_formatting_entry::ns = L"calcext";
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
void calcext_formatting_entry::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
@ -226,11 +226,14 @@ void calcext_formatting_entry::xlsx_convert(oox::xlsx_conversion_context & Conte
// calcext_color_scale_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
const wchar_t * calcext_color_scale_entry::name = L"color_scale_entry";
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
const wchar_t * calcext_color_scale_entry::name = L"color-scale-entry";
void calcext_color_scale_entry::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"calcext:value", calcext_value_);
CP_APPLY_ATTR(L"calcext:type", calcext_type_);
CP_APPLY_ATTR(L"calcext:color", calcext_color_);
}
void calcext_color_scale_entry::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
@ -248,7 +251,7 @@ void calcext_color_scale_entry::xlsx_convert(oox::xlsx_conversion_context & Cont
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_condition::ns = L"calcext";
const wchar_t * calcext_condition::ns = L"calcext";
const wchar_t * calcext_condition::name = L"condition";
void calcext_condition::add_attributes( const xml::attributes_wc_ptr & Attributes )
@ -286,8 +289,8 @@ void calcext_condition::xlsx_convert(oox::xlsx_conversion_context & Context)
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_date_is::ns = L"calcext";
const wchar_t * calcext_date_is::name = L"date-is";
const wchar_t * calcext_date_is::ns = L"calcext";
const wchar_t * calcext_date_is::name = L"date-is";
void calcext_date_is::add_attributes( const xml::attributes_wc_ptr & Attributes )
{

View File

@ -220,8 +220,11 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{L"concave-star6" ,L"" ,0 ,0 ,0 },
{L"signet" ,L"" ,0 ,0 ,0 },
{L"doorplate" ,L"" ,0 ,0 ,0 },
{L"" ,L"round1Rect" ,0 ,0 ,0 },
{L"" ,L"round1Rect" ,0 ,0 ,0 },
{L"" ,L"round2DiagRect" ,0 ,0 ,0 },
{L"" ,L"snip2DiagRect" ,0 ,0 ,0 },
{L"" ,L"round2SameRect" ,0 ,0 ,0 },
{L"" ,L"mathPlus" ,0 ,0 ,0 },
{L"" ,L"mathMinus" ,0 ,0 ,0 },
{L"" ,L"mathMultiply" ,0 ,0 ,0 },

View File

@ -501,7 +501,34 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
}
}
if (props.draw_fill_)
{
fill.type = props.draw_fill_->get_type();
}
switch(fill.type)
{
case 1:
if (!fill.solid) fill.type = -1;
case 2:
if (!fill.bitmap)
{
if (fill.solid) fill.type = 1;
else fill.type = -1;
}
break;
case 3:
if (!fill.gradient)
{
fill.gradient = oox::oox_gradient_fill::create();
}
break;
case 4:
if (!fill.hatch)
{
fill.hatch = oox::oox_hatch_fill::create();
}
break;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -414,12 +414,23 @@ void number_number::oox_convert(oox::num_format_context & Context)
void number_text::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
std::wstringstream strm;
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->text_to_stream(strm);
}
std::wstring text_ = strm.str();
if (text_ == L"%")
{
}
else
{
text_ = L"\"" + text_ + L"\""; //Book 70.ods Design of Pile Cap.ods
}
Context.output() << text_;
}

View File

@ -133,6 +133,9 @@ std::wostream & s::text_to_stream(std::wostream & _Wostream) const
else
_Wostream << std::wstring(1, L' ');
if (content_)
_Wostream << *content_;
return _Wostream;
}
@ -140,7 +143,10 @@ void s::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:c", text_c_);
}
void s::add_text(const std::wstring & Text)
{
content_ = Text;
}
void s::docx_convert(oox::docx_conversion_context & Context)
{
Context.add_element_to_run();

View File

@ -51,7 +51,6 @@
namespace cpdoccore {
namespace odf_reader {
namespace text {
template <class ElementT>
@ -59,33 +58,25 @@ class paragraph_content_element : public paragraph_content_impl<ElementT>
{
};
// TODO:
// 5.6 Индексные метки
// 5.7 Метки изменений
// 5.8 Внедренные графические объекты и текстовые блоки
// simple text
//////////////////////////////////////////////////////////////////////////////////////////////////
class text : public paragraph_content_element<text>
{
public:
static office_element_ptr create(const std::wstring & Text);
public:
static const wchar_t * ns;
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeText;
static const ElementType type = typeTextText;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
bool preserve_;
text(const std::wstring & Text) : text_(Text) {preserve_ = true;};
text() {preserve_ = true;};
@ -94,15 +85,10 @@ public:
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes )
{};
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{};
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ) {}
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text);
private:
std::wstring text_;
};
@ -118,16 +104,12 @@ public:
static const ElementType type = typeTextS;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
s(unsigned int c) : text_c_(c) {};
s() {};
@ -136,10 +118,10 @@ public:
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ) ;
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
virtual void add_text(const std::wstring & Text);
private:
_CP_OPT(unsigned int) text_c_;
_CP_OPT(std::wstring) content_;
};
CP_REGISTER_OFFICE_ELEMENT2(s);
@ -155,26 +137,22 @@ public:
static const ElementType type = typeTextTab;
CPDOCCORE_DEFINE_VISITABLE();
public:
tab(unsigned int ab_ref) : text_tab_ref_(ab_ref) {};
tab() {};
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
_CP_OPT(unsigned int) attr_tab_ref() const { return text_tab_ref_; }
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
public:
tab(unsigned int ab_ref) : text_tab_ref_(ab_ref) {};
tab() {};
_CP_OPT(unsigned int) attr_tab_ref() const { return text_tab_ref_; }
private:
_CP_OPT(unsigned int) text_tab_ref_;
};
@ -191,15 +169,12 @@ public:
static const ElementType type = typeTextLineBreak;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
line_break() {};
private:
@ -222,10 +197,9 @@ public:
static const ElementType type = typeTextBookmark;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
bookmark() {}
bookmark() {}
bookmark(const std::wstring & Name) : text_name_(Name){};
const std::wstring & attr_name() const { return text_name_; }
@ -235,7 +209,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
private:
std::wstring text_name_;
};
@ -252,10 +225,9 @@ public:
static const ElementType type = typeTextBookmarkStart;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
bookmark_start() {}
bookmark_start() {}
bookmark_start(const std::wstring & Name) : text_name_(Name){};
const std::wstring & attr_name() const { return text_name_; }
@ -265,7 +237,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
private:
std::wstring text_name_;
};
@ -282,10 +253,9 @@ public:
static const ElementType type = typeTextBookmarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
bookmark_end() {} ;
bookmark_end() {} ;
bookmark_end(const std::wstring & Name) : text_name_(Name){};
const std::wstring & attr_name() const { return text_name_; }
@ -295,7 +265,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
private:
std::wstring text_name_;
};
@ -372,10 +341,9 @@ public:
static const ElementType type = typeTextReferenceMarkEnd;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
reference_mark_end() {};
reference_mark_end() {};
reference_mark_end(const std::wstring & Name) : text_name_(Name){};
const std::wstring & attr_name() const { return text_name_; }
@ -385,7 +353,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
virtual void add_text(const std::wstring & Text) {}
private:
std::wstring text_name_;
};
@ -403,15 +370,13 @@ public:
static const ElementType type = typeTextSpan;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
span() {}
span() {}
office_element_ptr_array paragraph_content_;
@ -438,22 +403,19 @@ public:
static const ElementType type = typeTextA;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
public:
a() {}
a() {}
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
odf_types::common_xlink_attlist common_xlink_attlist_;
std::wstring office_name_;
@ -513,6 +475,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
@ -660,7 +623,6 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -668,8 +630,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
// TODO: attributes
// todooo attributes
office_element_ptr_array text_;
};
@ -699,7 +660,7 @@ private:
virtual void add_text(const std::wstring & Text);
private:
// TODO: attributes
// todooo attributes
office_element_ptr_array text_;
};
@ -816,7 +777,6 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -824,8 +784,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
// TODO: attributes
// todooo attributes
office_element_ptr_array text_;
};
@ -846,7 +805,6 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
@ -854,8 +812,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
// TODO: attributes
// todooo attributes
office_element_ptr_array text_;
};
@ -878,7 +835,6 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private:
office_element_ptr_array text_;
};

View File

@ -62,6 +62,8 @@ static formulasconvert::odf2oox_converter formulas_converter;
int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Context, text_format_properties_content *text_properties)
{
if (elements_.empty()) return -1;
Context.get_table_context().start_cell_content();
Context.get_text_context().set_cell_text_properties(text_properties);
@ -80,7 +82,7 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
///обработка чтилей для роу -
size_t Default_Cell_style_in_row_ = 0;
const std::wstring rowStyleName = table_table_row_attlist_.table_style_name_.get_value_or(L"");
const std::wstring rowStyleName = table_table_row_attlist_.table_style_name_.get_value_or(L"");
const std::wstring defaultCellStyleName = table_table_row_attlist_.table_default_cell_style_name_.get_value_or( L"");
style_instance * instStyle_CellDefault =
@ -136,6 +138,7 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
ht = ht_s.str();
}
}
int row_current = Context.current_table_row() + 1;
bool hidden = table_table_row_attlist_.table_visibility_.get_type() == table_visibility::Collapse;
@ -604,45 +607,49 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std::wostream & strm = Context.current_sheet().sheetData();
const std::wstring formula = table_table_cell_attlist_.table_formula_.get_value_or(L"");
const std::wstring styleName = table_table_cell_attlist_.table_style_name_.get_value_or(L"");
const common_value_and_type_attlist & attr = table_table_cell_attlist_.common_value_and_type_attlist_;
office_value_type::type odf_value_type = office_value_type::Custom;
oox::XlsxCellType::type t_val = oox::XlsxCellType::s;
std::wstring number_val = L"";
std::wstring formula = table_table_cell_attlist_.table_formula_.get_value_or(L"");
std::wstring number_val;
_CP_OPT(bool) bool_val;
_CP_OPT(std::wstring) str_val;
std::wstring num_format = L"";
std::wstring num_format;
size_t xfId_last_set = 0;
int empty_cell_count = 0;
bool skip_next_cell = false;
bool is_style_visible = true;
bool is_data_visible = false;
// вычислить стиль для ячейки
// вычислить стиль для ячейки
odf_read_context & odfContext = Context.root()->odf_context();
std::wstring cellStyleName = table_table_cell_attlist_.table_style_name_.get_value_or(L"");
std::wstring columnStyleName = Context.get_table_context().default_column_cell_style();
std::wstring rowStyleName = Context.get_table_context().default_row_cell_style();
if (table_table_cell_attlist_.table_number_columns_repeated_ > 1)
columnStyleName.clear(); // могут быть разные стили колонок Book 24.ods
odf_read_context & odfContext = Context.root()->odf_context();
style_instance *defaultCellStyle=NULL, *defaultColumnCellStyle = NULL, *defaultRowCellStyle =NULL, *cellStyle = NULL;
try
{
defaultCellStyle = odfContext.styleContainer().style_default_by_type(style_family::TableCell);
defaultColumnCellStyle = odfContext.styleContainer().style_by_name(Context.get_table_context().default_column_cell_style(), style_family::TableCell,false);
defaultRowCellStyle = odfContext.styleContainer().style_by_name(Context.get_table_context().default_row_cell_style(), style_family::TableCell,false);
cellStyle = odfContext.styleContainer().style_by_name(styleName, style_family::TableCell, false);
defaultColumnCellStyle = odfContext.styleContainer().style_by_name(columnStyleName, style_family::TableCell, false);
defaultRowCellStyle = odfContext.styleContainer().style_by_name(rowStyleName, style_family::TableCell, false);
cellStyle = odfContext.styleContainer().style_by_name(cellStyleName, style_family::TableCell, false);
}
catch(...)
{
_CP_LOG << L"[error]: style wrong\n";
}
std::wstring data_style = CalcCellDataStyle(Context,
Context.get_table_context().default_column_cell_style(),
Context.get_table_context().default_row_cell_style(),
styleName);
std::wstring data_style = CalcCellDataStyle(Context, columnStyleName, rowStyleName, cellStyleName);
// стили не наследуются
std::vector<const style_instance *> instances;
@ -733,8 +740,8 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
if (!data_style.empty())
{
office_element_ptr elm = odfContext.numberStyles().find_by_style_name(data_style);
number_style_base *num_style = dynamic_cast<number_style_base*>(elm.get());
office_element_ptr elm = odfContext.numberStyles().find_by_style_name(data_style);
number_style_base *num_style = dynamic_cast<number_style_base*>(elm.get());
if (num_style)
{
@ -751,10 +758,8 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
cellFormat.set_cell_type(t_val);
cellFormat.set_num_format(oox::odf_string_to_build_in(odf_value_type));
is_style_visible = (styleName.length() > 0 || defaultColumnCellStyle) ? true : false;
xfId_last_set= Context.get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, num_format,false, is_style_visible);
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
if ( table_table_cell_content_.elements_.size() > 0 ||
!formula.empty() ||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
@ -762,12 +767,26 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
if (table_table_cell_attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
int cell_repeated_max = Context.current_table_column() + table_table_cell_attlist_.table_number_columns_repeated_ + 1;
if (cell_repeated_max >= 1024 && cellStyleName.empty() && last_cell_ && !is_data_visible)
{//Book 24.ods
return;
}
if (is_style_visible)
{
xfId_last_set = Context.get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, num_format, false, is_style_visible);
}
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r)
{
Context.start_table_cell ( formula, table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1 ,
table_table_cell_attlist_extra_.table_number_rows_spanned_ - 1 );
Context.set_current_cell_style_id(xfId_last_set);
if (is_style_visible)
Context.set_current_cell_style_id(xfId_last_set);
const int sharedStringId = table_table_cell_content_.xlsx_convert(Context, &textFormatProperties);

View File

@ -1507,32 +1507,9 @@ namespace NSBinPptxRW
if (sizeof(wchar_t) == 4)
{
wchar_t * sBuffer = new wchar_t[lSize + 1];
memset(sBuffer, 0, lSize + 1);
std::wstring val = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)m_pDataCur, lSize);
CString res(val.c_str(), val.length());
UTF16* pStrUtf16 = (UTF16 *) m_pDataCur;
UTF32 *pStrUtf32 = (UTF32 *) sBuffer;
// this values will be modificated
const UTF16 *pStrUtf16_Conv = pStrUtf16;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult =
ConvertUTF16toUTF32 (&pStrUtf16_Conv
, &pStrUtf16[lSize]
, &pStrUtf32_Conv
, &pStrUtf32 [lSize]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete []sBuffer;
return _T("");
}
CString res((WCHAR*)sBuffer, lSize);
delete []sBuffer;
m_lPos += len;
m_pDataCur += len;
@ -1557,48 +1534,11 @@ namespace NSBinPptxRW
_UINT32 lSize = len >> 1; //string in char
if (sizeof(wchar_t) == 4)
{
wchar_t * sBuffer = new wchar_t[lSize + 1];
memset(sBuffer, 0, lSize + 1);
std::wstring res = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)m_pDataCur, lSize);
m_lPos += len;
m_pDataCur += len;
UTF16* pStrUtf16 = (UTF16 *)m_pDataCur;
UTF32 *pStrUtf32 = (UTF32 *)sBuffer;
// this values will be modificated
const UTF16 *pStrUtf16_Conv = pStrUtf16;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult =
ConvertUTF16toUTF32(&pStrUtf16_Conv
, &pStrUtf16[lSize]
, &pStrUtf32_Conv
, &pStrUtf32[lSize]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete[]sBuffer;
return _T("");
}
std::wstring res((WCHAR*)sBuffer, lSize);
delete[]sBuffer;
m_lPos += len;
m_pDataCur += len;
return res;
}
else
{
std::wstring res((WCHAR*)m_pDataCur, lSize);
m_lPos += len;
m_pDataCur += len;
return res;
}
return res;
}
bool CBinaryFileReader::GetArray(BYTE **pBuffer, _INT32 len)

View File

@ -1597,7 +1597,7 @@ bool RtfFieldReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,C
if ( oNewFieldInst->IsValid() )
{
m_oField.m_pInsert = oNewFieldInst;
m_oField.m_pInsert = oNewFieldInst;
}
}
else if ( L"datafield" == sCommand )
@ -1611,7 +1611,7 @@ bool RtfFieldReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,C
if ( oNewFieldInst->IsValid() )
{
m_oField.m_pResult = oNewFieldInst;
m_oField.m_pResult = oNewFieldInst;
}
oReader.m_oLex.putString( "}{" );//чтобы не терять после fldrslt
@ -2380,6 +2380,14 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
{
m_oCurTab.m_eKind = RtfTab::tk_tqbar;
m_oCurTab.m_nTab = parameter;
if (!oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.empty())
{
if (oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.back().m_nTab > m_oCurTab.m_nTab)
{
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.clear();
}
}
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.push_back( m_oCurTab );
m_oCurTab.SetDefault();
}
@ -2389,6 +2397,14 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
if ( hasParameter )
{
m_oCurTab.m_nTab = parameter;
if (!oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.empty())
{
if (oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.back().m_nTab > m_oCurTab.m_nTab)
{
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.clear();
}
}
oReader.m_oState->m_oParagraphProp.m_oTabs.m_aTabs.push_back( m_oCurTab );
m_oCurTab.SetDefault();
}

View File

@ -1417,8 +1417,9 @@ private:
RtfAbstractReader reader;
CString sResultSymbol = reader.ExecuteTextInternal( oDocument, oReader, sCharA, false, 0, nSkipChar );
m_oField.m_pResult = RtfFieldInstPtr ( new RtfFieldInst() );
//свойства копировать ? ващето есть дубль - проверить
m_oField.m_pResult = RtfFieldInstPtr ( new RtfFieldInst() );
m_oField.m_pResult->SetDefault();
RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharPtr pNewChar( new RtfChar() );

View File

@ -49,7 +49,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -59,7 +59,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -89,7 +89,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -99,7 +99,7 @@ CString RtfChar::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -356,7 +356,7 @@ CString RtfCharSpecial::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_oProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -366,7 +366,7 @@ CString RtfCharSpecial::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_oProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";

View File

@ -164,7 +164,7 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
sAuthor = m_pInsert->m_oCharProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_pInsert->m_oCharProperty.m_nRevauth] : L"";
sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_pInsert->m_oCharProperty.m_nRevauth);
sDate = CString(RtfUtility::convertDateTime(m_pInsert->m_oCharProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -174,7 +174,7 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
sAuthor = m_pInsert->m_oCharProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_pInsert->m_oCharProperty.m_nRevauthDel ] : L"";
sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_pInsert->m_oCharProperty.m_nRevauthDel);
sDate = CString(RtfUtility::convertDateTime(m_pInsert->m_oCharProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -229,13 +229,15 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
sResult += props;
sResult += L"<w:fldChar w:fldCharType=\"begin\"/>";
sResult += L"</w:r>";
CString str = Utils::PrepareToXML( m_pInsert->m_pTextItems->RenderToOOX(oNewParametr) );
//-----------
sResult += L"<w:r>";
sResult += L"<w:instrText xml:space=\"preserve\">";
sResult += str;
if (m_pInsert->m_pTextItems)
{
sResult += Utils::PrepareToXML( m_pInsert->m_pTextItems->RenderToOOX(oNewParametr) );
}
sResult += L"</w:instrText></w:r>";
// разделитель
@ -243,11 +245,33 @@ CString RtfField::RenderToOOX(RenderParameter oRenderParameter)
sResult += L"<w:fldChar w:fldCharType=\"separate\"/></w:r>";
//пишем содержание-кэш
sResult += L"<w:r>";
if (!props.IsEmpty())
sResult += props;
sResult += m_pResult->m_pTextItems->RenderToOOX(oNewParametr);
sResult += L"</w:r>";
if ((m_pResult->m_pTextItems) && (m_pResult->m_pTextItems->GetCount() > 0))
{
oNewParametr.nType = RENDER_TO_OOX_PARAM_RUN;
sResult += m_pResult->m_pTextItems->m_aArray[0]->RenderToOOX(oNewParametr);
for (int i = 1; i < m_pResult->m_pTextItems->GetCount(); i++)
{
RtfParagraph *paragraph = dynamic_cast<RtfParagraph *>(m_pResult->m_pTextItems->m_aArray[i].get());
if (paragraph)
{
sResult += L"</w:p>";
sResult += L"<w:p>";
sResult += L"<w:pPr>";
sResult += paragraph->m_oProperty.RenderToOOX(oRenderParameter);
sResult += L"</w:pPr>";
}
sResult += m_pResult->m_pTextItems->m_aArray[i]->RenderToOOX(oNewParametr);
}
}
else
{
sResult += L"<w:r>";
if (!props.IsEmpty())
sResult += props;
sResult += L"</w:r>";
}
//заканчиваем Field
sResult += L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";

View File

@ -466,6 +466,14 @@ public:
i = AddItem(author);
return i;
}
CString GetAuthor(int ind)
{
if (ind == PROP_DEF || ind > m_aArray.size())
return L"";
return m_aArray[ind];
}
};
//class RtfRSIDTable : public IDocumentElement, public ItemContainer<rsidString>

View File

@ -60,7 +60,7 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = pCharProps->m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ pCharProps->m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(pCharProps->m_nRevauth);
CString sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -70,7 +70,7 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = pCharProps->m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ pCharProps->m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(pCharProps->m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";

View File

@ -747,7 +747,7 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
{
bInsert = true;
CString sAuthor = m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauth);
CString sDate(RtfUtility::convertDateTime( m_nRevdttm ).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -757,7 +757,7 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
{
bDelete = true;
CString sAuthor = m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime( m_nRevdttmDel ).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -768,14 +768,14 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if ( PROP_DEF != m_nDeleted )//для rPr в pPr
{
CString sAuthor = m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauthDel] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
}
if ( PROP_DEF != m_nRevised )
{
CString sAuthor = m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
@ -962,7 +962,7 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if (m_pOldCharProp)
{
CString sAuthor = m_nCrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nCrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nCrAuth);
CString sDate(RtfUtility::convertDateTime(m_nCrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;
@ -2168,7 +2168,7 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
if (m_pOldParagraphProp)
{
CString sAuthor = m_nPrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nPrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nPrAuth);
CString sDate(RtfUtility::convertDateTime(m_nPrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;
@ -2859,19 +2859,19 @@ CString RtfRowProperty::RenderToOOX(RenderParameter oRenderParameter)
m_pOldRowProperty;
//if ( PROP_DEF != oReader.m_oState->m_oCharProp.m_nDeleted )
//{
// CString sAuthor = oReader.m_oState->m_oCharProp.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ oReader.m_oState->m_oCharProp.m_nRevauthDel] : L"";
// CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(oReader.m_oState->m_oCharProp.m_nRevauthDel);
// CString sDate(RtfUtility::convertDateTime(oReader.m_oState->m_oCharProp.m_nRevdttmDel).c_str());
// sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
//}
//if ( PROP_DEF != oReader.m_oState->m_oCharProp.m_nRevised )
//{
// CString sAuthor = m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ oReader.m_oState->m_oCharProp.m_nRevauth] : L"";
// CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(oReader.m_oState->m_oCharProp.m_nRevauth);
// CString sDate(RtfUtility::convertDateTime(oReader.m_oState->m_oCharProp.m_nRevdttm).c_str());
//
// sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\"/>";
//}
CString sAuthor = m_nTrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nTrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nTrAuth);
CString sDate(RtfUtility::convertDateTime(m_nTrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;

View File

@ -823,7 +823,7 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
}
if (m_pOldSectionProp)
{
CString sAuthor = m_nSrAuth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_nSrAuth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_nSrAuth);
CString sDate(RtfUtility::convertDateTime(m_nSrDate).c_str());
RenderParameter oRenderParameterNew = oRenderParameter;

View File

@ -753,7 +753,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
m_bInsert = true;
CString sAuthor = m_oCharProperty.m_nRevauth != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oCharProperty.m_nRevauth] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oCharProperty.m_nRevauth);
CString sDate(RtfUtility::convertDateTime(m_oCharProperty.m_nRevdttm).c_str());
sResult += L"<w:ins w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
@ -763,7 +763,7 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
m_bDelete = true;
CString sAuthor = m_oCharProperty.m_nRevauthDel != PROP_DEF ? poRtfDocument->m_oRevisionTable[ m_oCharProperty.m_nRevauthDel ] : L"";
CString sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(m_oCharProperty.m_nRevauthDel);
CString sDate(RtfUtility::convertDateTime(m_oCharProperty.m_nRevdttmDel).c_str());
sResult += L"<w:del w:date=\"" + sDate + L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";

View File

@ -600,6 +600,14 @@ namespace OOX
std::wstring sName = oReader.GetName();
if ( _T("w:rPr") == sName )
m_oRPr = oReader;
else if ( _T("a:rPr") == sName )
{
CString sXml = oReader.GetOuterXml();
XmlUtils::CXmlNode node;
node.FromXmlString(sXml.GetBuffer());
sXml.ReleaseBuffer();
m_oARPr = node;
}
else if ( _T("w:ins") == sName )
m_oIns = oReader;
else if ( _T("w:del") == sName )
@ -612,6 +620,8 @@ namespace OOX
if ( m_oRPr.IsInit() )
sResult += m_oRPr->toXML();
if ( m_oARPr.IsInit() )
sResult += m_oARPr->toXML();
if ( m_oIns.IsInit() )
sResult += m_oIns->toXML();
if ( m_oDel.IsInit() )
@ -629,6 +639,7 @@ namespace OOX
public:
//Childs
nullable<OOX::Logic::CRunProperty> m_oRPr;
nullable<PPTX::Logic::RunProperties> m_oARPr;
nullable<OOX::Logic::CRPrChange> m_oIns;
nullable<OOX::Logic::CRPrChange> m_oDel;
};

View File

@ -116,7 +116,7 @@ namespace OOX
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if(m_oName.IsInit() && m_arrItems.size() > 0)
if(m_oName.IsInit())
{
writer.WriteString(_T("<tableStyle"));
WritingStringNullableAttrEncodeXmlString(L"name", m_oName, m_oName.get());
@ -249,4 +249,4 @@ namespace OOX
} //Spreadsheet
} // namespace OOX
#endif // OOX_TABLESTYLES_FILE_INCLUDE_H_
#endif // OOX_TABLESTYLES_FILE_INCLUDE_H_

View File

@ -373,7 +373,13 @@ namespace OOX
if(false == pFont->m_oRFont.IsInit())
{
pFont->m_oRFont.Init();
pFont->m_oRFont->m_sVal = _T("Arial");
pFont->m_oRFont->m_sVal = _T("Calibri");
}
if(false == pFont->m_oScheme.IsInit())
{
pFont->m_oScheme.Init();
pFont->m_oScheme->m_oFontScheme.Init();
pFont->m_oScheme->m_oFontScheme->SetValue(SimpleTypes::Spreadsheet::fontschemeMinor);
}
if(false == pFont->m_oSz.IsInit() || false == pFont->m_oSz->m_oVal.IsInit())
{

View File

@ -744,11 +744,11 @@
#define ASC_MENU_EVENT_TYPE_ERROR 500
#define ASC_MENU_EVENT_TYPE_COLOR_SCHEMES 2404 // CAscColorSchemes
#define ASC_MENU_EVENT_TYPE_CHANGE_COLOR_SCHEME 2415 // SET(int)
#define ASC_MENU_EVENT_TYPE_COLOR_SCHEMES 2404 // CAscColorSchemes
#define ASC_MENU_EVENT_TYPE_CHANGE_COLOR_SCHEME 2415 // SET(int)
#define ASC_MENU_EVENT_TYPE_AUTH_PARTICIPANTS_CHANGED 2416
#define ASC_COAUTH_EVENT_TYPE_PARTICIPANTS_CHANGED 20101
#define ASC_COAUTH_EVENT_TYPE_LOST_CONNECTION 20102
#define ASC_COAUTH_EVENT_TYPE_DROP_CONNECTION 20103
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_

View File

@ -542,7 +542,7 @@ namespace NSFile
int nCurrent = 0;
while (nCurrent < nCount)
{
if (*pShort < 0xD800 || *pShort > 0xDFFF)
if (*pShort < 0xD800 || *pShort > 0xDBFF)
{
*pWCurrent = (wchar_t)(*pShort);
++pShort;
@ -550,7 +550,7 @@ namespace NSFile
}
else
{
*pWCurrent = (wchar_t)((((pShort[0]) & 0x03FF) << 10) | ((pShort[1]) & 0x03FF));
*pWCurrent = (wchar_t)(((((pShort[0] - 0xD800) & 0x03FF) << 10) | ((pShort[1] - 0xDC00) & 0x03FF)) + 0x10000);
pShort += 2;
nCurrent += 2;
}

View File

@ -853,7 +853,10 @@ namespace NSHtmlRenderer
{
// stroke
m_oDocument.WriteString(L"<path style=\"fill:none;stroke:", 30);
m_oDocument.WriteHexColor3(m_pPen->Color);
if (bStroke)
m_oDocument.WriteHexColor3(m_pPen->Color);
else
m_oDocument.WriteString(L"none");
m_oDocument.WriteString(L";stroke-width:", 14);
m_oDocument.AddInt(nPenW);
m_oDocument.WriteString(L";stroke-opacity:", 16);

View File

@ -46,7 +46,7 @@
//#define ONLINE_WORD_TO_PDF
//#define TO_PDF
#define TO_HTML_RENDERER
#define ONLY_TEXT
//#define ONLY_TEXT
int main(int argc, char *argv[])
{
@ -97,7 +97,7 @@ int main(int argc, char *argv[])
//std::wstring sFile = L"D:\\bankomats.xps";
//std::wstring sFile = L"\\\\kirillov8\\_Office\\DJVU\\Основы разработки приложений на платформе Microsoft .NET Framework. Учебный курс Microsoft экзамен 70-536.djvu";
//std::wstring sFile = L"D:\\TESTFILES\\Алгоритмы - построение и анализ.djvu";
std::wstring sFile = L"D:\\TESTFILES\\PDF 1-7 (756p).pdf";
std::wstring sFile = L"D:\\knopk5_0.pdf";
std::wstring sDst = L"D:\\test\\Document";
//std::wstring sFile = L"/home/oleg/activex/Android intro(2p).pdf";
@ -170,5 +170,7 @@ int main(int argc, char *argv[])
oRenderer.SaveToFile(L"/home/oleg/activex/1/1.pdf");
#endif
RELEASEOBJECT(pReader);
return 0;
}

View File

@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.0.2.409
VERSION = 2.0.2.412
DEFINES += INTVER=$$VERSION
TARGET = x2t

View File

@ -32,5 +32,5 @@ core_linux_32 {
DESTDIR = $$DESTDIR/linux_32
}
core_mac {
DESTDIR = $$DESTDIR/mac
}
DESTDIR = $$DESTDIR/mac_64
}

View File

@ -2596,7 +2596,7 @@ namespace NExtractTools
case TCD_PPT2PPTX:
{
result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
}
}break;
case TCD_PPT2PPTT:
{
result = ppt2pptt (sFileFrom, sFileTo, sTempDir, oInputParams);
@ -2668,7 +2668,7 @@ namespace NExtractTools
case TCD_ODF2OOT_BIN:
{
result = odf2oot_bin (sFileFrom, sFileTo, sTempDir, oInputParams);
}
}break;
case TCD_DOCX2ODT:
{
result = docx2odt (sFileFrom, sFileTo, sTempDir, oInputParams);