mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-03 01:01:53 +08:00
Compare commits
48 Commits
core-win-3
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| a038e1562f | |||
| 9c7a03fdc5 | |||
| 9272b27a69 | |||
| ef57330a79 | |||
| d35619eeae | |||
| b38c552cc5 | |||
| 1b91ee579c | |||
| 337c92e522 | |||
| 8fe1eb7525 | |||
| 1deb2a6905 | |||
| 69a787411c | |||
| 22f986295f | |||
| 86d2bde83b | |||
| 07041d60f6 | |||
| a5466ab740 | |||
| dfd54ff53f | |||
| 6ec7d77e19 | |||
| 3813be21c7 | |||
| 356ccba104 | |||
| 68c8c0cb29 | |||
| 3044d1122a | |||
| fb00ba7ecb | |||
| ab0c5703a5 | |||
| e22b63347f | |||
| 9dd115ec56 | |||
| 438ba3aded | |||
| 29b002ca80 | |||
| 34083d996b | |||
| 244d549cf8 | |||
| ef96571879 | |||
| 7a27150de6 | |||
| 2197fddb7b | |||
| d31344d7d3 | |||
| f7617b42cb | |||
| 8312cce2c3 | |||
| dc89e1d484 | |||
| 17f4903347 | |||
| ebdfb2f785 | |||
| ec2901bf48 | |||
| f9e87624c0 | |||
| 5f0e6349cc | |||
| 3bdf44b8c7 | |||
| d586698025 | |||
| eb6fb03ca5 | |||
| ad40f51dee | |||
| 5e60456fc1 | |||
| 1f9e3f4fd8 | |||
| 828df16fe5 |
@ -501,7 +501,7 @@ namespace DocFileFormat
|
||||
|
||||
facet.widen((char*)bytes, (char*)bytes + size, &result[0]);
|
||||
|
||||
for (long i=0; i < result.length(); i++)
|
||||
for (size_t i=0; i < result.length(); i++)
|
||||
{
|
||||
STLCollection->push_back(result[i]);
|
||||
}
|
||||
@ -536,7 +536,7 @@ namespace DocFileFormat
|
||||
delete [] pStrUtf16;
|
||||
return GetSTLCollectionFromLocale(STLCollection, bytes,size);
|
||||
}
|
||||
for (long i=0; i < nLength; i++)
|
||||
for (unsigned int i = 0; i < nLength; i++)
|
||||
{
|
||||
STLCollection->push_back(pStrUtf16[i]);
|
||||
}
|
||||
@ -566,7 +566,7 @@ namespace DocFileFormat
|
||||
delete [] pStrUtf32;
|
||||
return GetSTLCollectionFromLocale(STLCollection, bytes, size);
|
||||
}
|
||||
for (long i=0; i < nLength; i++)
|
||||
for (unsigned int i = 0; i < nLength; i++)
|
||||
{
|
||||
STLCollection->push_back(pStrUtf32[i]);
|
||||
}
|
||||
@ -652,7 +652,7 @@ namespace DocFileFormat
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
std::wstring unicode_string = oConverter.toUnicode((char*)bytes, size, sCodePage.c_str());
|
||||
|
||||
for (long i=0; i < unicode_string.size(); i++)
|
||||
for (size_t i = 0; i < unicode_string.size(); i++)
|
||||
{
|
||||
STLCollection->push_back(unicode_string[i]);
|
||||
}
|
||||
|
||||
@ -885,6 +885,11 @@ public:
|
||||
pCStringWriter->WriteString(oSectPr.Write());
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:sectPr>")));
|
||||
}break;
|
||||
case c_oSerProp_pPrType::outlineLvl:
|
||||
{
|
||||
long outlineLvl = m_oBufferedStream.GetLong();
|
||||
pCStringWriter->WriteString(L"<w:outlineLvl w:val=\"" + std::to_wstring(outlineLvl) + L"\"/>");
|
||||
}break;
|
||||
default:
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
break;
|
||||
|
||||
@ -344,7 +344,8 @@ extern int g_nCurFormatVersion;
|
||||
FramePr = 30,
|
||||
SectPr = 31,
|
||||
numPr_Ins = 32,
|
||||
pPrChange = 33
|
||||
pPrChange = 33,
|
||||
outlineLvl = 34
|
||||
};}
|
||||
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
|
||||
{
|
||||
|
||||
@ -1024,6 +1024,12 @@ namespace BinDocxRW
|
||||
WritePPrChange(pPr.m_oPPrChange.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(pPr.m_oOutlineLvl.IsInit() && pPr.m_oOutlineLvl->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::outlineLvl);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pPr.m_oOutlineLvl->m_oVal->GetValue());
|
||||
}
|
||||
//SectPr
|
||||
if(NULL != m_oBinaryHeaderFooterTableWriter && pPr.m_oSectPr.IsInit())
|
||||
{
|
||||
|
||||
@ -402,6 +402,7 @@
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = YES;
|
||||
GCC_ENABLE_CPP_RTTI = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
|
||||
@ -454,7 +454,7 @@ namespace formulasconvert {
|
||||
// boost::match_default | boost::format_all);
|
||||
|
||||
bool isFormula = check_formula(workstr);
|
||||
|
||||
|
||||
boost::regex_replace(
|
||||
workstr,
|
||||
boost::wregex(L"('.*?')|(\".*?\")"),
|
||||
@ -477,6 +477,12 @@ namespace formulasconvert {
|
||||
}
|
||||
//todooo INDEX((A1:C6~A8:C11),2,2,2) - ???? - INDEX_emb.ods
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t sz_workstr = workstr.length();
|
||||
if (workstr.substr(0, (std::min)((size_t)3, sz_workstr)) == L"of:")//sample_02neu_crashes.ods
|
||||
workstr = workstr.substr(3);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
@ -154,7 +154,7 @@ namespace cpdoccore
|
||||
if (val)
|
||||
{
|
||||
std::wstring tmp = *val;
|
||||
XmlUtils::GetLower(tmp);
|
||||
tmp = XmlUtils::GetLower(tmp);
|
||||
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
|
||||
}
|
||||
else
|
||||
|
||||
@ -800,7 +800,7 @@ bool docx_conversion_context::process_page_properties(std::wostream & strm)
|
||||
|
||||
if (page_layout_instance_)
|
||||
{
|
||||
page_layout_instance_->docx_convert_serialize(strm, *this);
|
||||
page_layout_instance_->docx_serialize(strm, *this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -181,7 +181,11 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
sub_path = L"embeddings/";
|
||||
}
|
||||
else
|
||||
{
|
||||
isMediaInternal = is_internal(href, odf_packet_);
|
||||
if (href.empty() && type == typeImage)
|
||||
return L"";
|
||||
}
|
||||
|
||||
int number=0;
|
||||
|
||||
@ -205,9 +209,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
if ( type == typeChart) outputPath = outputPath + L".xml";
|
||||
|
||||
std::wstring id;
|
||||
for (int i = 0 ; i < items_.size(); i++)
|
||||
for (size_t i = 0 ; i < items_.size(); i++)
|
||||
{
|
||||
if (items_[i].href == inputPath)
|
||||
if ((items_[i].href == inputPath && !inputPath.empty()) || (items_[i].type == type && inputPath.empty()))
|
||||
{
|
||||
id = items_[i].Id;
|
||||
outputPath = items_[i].outputName;
|
||||
|
||||
@ -144,7 +144,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
|
||||
namespace oox
|
||||
{
|
||||
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
|
||||
base_font_size_(12), fonts_container_(fonts)
|
||||
base_font_size_(12), fonts_container_(fonts), is_need_e_(false)
|
||||
{
|
||||
graphRPR_ = graphic;
|
||||
|
||||
|
||||
@ -106,6 +106,8 @@ namespace oox {
|
||||
|
||||
std::wstring nsRPr_;
|
||||
bool graphRPR_;
|
||||
|
||||
bool is_need_e_;
|
||||
private:
|
||||
std::wstringstream math_stream_;
|
||||
std::wstringstream math_style_stream_;
|
||||
|
||||
@ -436,8 +436,14 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:path")
|
||||
{
|
||||
CP_XML_ATTR(L"w", w ? *w : cx);
|
||||
CP_XML_ATTR(L"h", h ? *h : cy);
|
||||
int path_w = w ? *w : cx;
|
||||
int path_h = h ? *h : cy;
|
||||
|
||||
if (path_w < 1) path_w = 1024;
|
||||
if (path_h < 1) path_h = 1024;
|
||||
|
||||
CP_XML_ATTR(L"w", path_w);
|
||||
CP_XML_ATTR(L"h", path_h);
|
||||
|
||||
if (sCustomPath)
|
||||
{
|
||||
|
||||
@ -83,7 +83,7 @@ namespace oox {
|
||||
class _oox_drawing
|
||||
{
|
||||
public:
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object")
|
||||
_oox_drawing() : type(typeUnknown), id(0), x(0), y(0), cx(0), cy(0), sub_type(0), inGroup(false), name(L"object"), extExternal(false)
|
||||
{
|
||||
}
|
||||
RelsType type;
|
||||
@ -103,6 +103,7 @@ namespace oox {
|
||||
std::wstring objectProgId;
|
||||
|
||||
std::wstring extId;
|
||||
bool extExternal;
|
||||
|
||||
_action_desc action;
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false),bTile(false),isInternal(true)
|
||||
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true)
|
||||
{
|
||||
memset(cropRect,0,sizeof(double)*4);
|
||||
}
|
||||
@ -186,10 +186,10 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
CP_XML_NODE(L"a:srcRect")
|
||||
{
|
||||
CP_XML_ATTR(L"l", static_cast<size_t>(val.bitmap->cropRect[0]*1000));
|
||||
CP_XML_ATTR(L"t", static_cast<size_t>(val.bitmap->cropRect[1]*1000));
|
||||
CP_XML_ATTR(L"r", static_cast<size_t>(val.bitmap->cropRect[2]*1000));
|
||||
CP_XML_ATTR(L"b", static_cast<size_t>(val.bitmap->cropRect[3]*1000));
|
||||
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));
|
||||
}
|
||||
}
|
||||
if (val.bitmap->bTile)
|
||||
|
||||
@ -147,6 +147,6 @@ namespace oox {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,13 +70,14 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"tif" == extension) return L"image/x-tiff";
|
||||
else if (L"tiff" == extension) return L"image/x-tiff";
|
||||
else if (L"pdf" == extension) return L"application/pdf";
|
||||
else if (L"bmp" == extension) return L"image/bmp";
|
||||
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"mp3" == extension) return L"audio/mpeg";
|
||||
else if (L"wma" == extension) return L"audio/x-ms-wma";
|
||||
else if (L"m4a" == extension) return L"audio/unknown";
|
||||
|
||||
else if (L"avi" == extension) return L"video/avi";
|
||||
else if (L"avi" == extension) return L"video/x-msvideo";
|
||||
else if (L"wmv" == extension) return L"video/x-ms-wmv";
|
||||
else if (L"mov" == extension) return L"video/unknown";
|
||||
else if (L"mp4" == extension) return L"video/unknown";
|
||||
|
||||
@ -150,15 +150,30 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_NODE(L"p14:media")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
if (val.extExternal)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.extId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (val.fill.bitmap)
|
||||
{
|
||||
val.fill.bitmap->name_space = L"p";
|
||||
oox_serialize_fill(CP_XML_STREAM(), val.fill);
|
||||
oox_serialize_bitmap_fill(strm, val.fill);
|
||||
|
||||
val.fill.bitmap.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"p:blipFill");
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"p:spPr")
|
||||
{
|
||||
@ -169,7 +184,8 @@ void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_ATTR(L"prst", L"rect");
|
||||
CP_XML_NODE(L"a:avLst");
|
||||
}
|
||||
oox_serialize_ln(CP_XML_STREAM(), val.additional);
|
||||
oox_serialize_fill (CP_XML_STREAM(), val.fill);
|
||||
oox_serialize_ln (CP_XML_STREAM(), val.additional);
|
||||
}
|
||||
//_CP_OPT(std::wstring) strTextContent;
|
||||
//odf::GetProperty(properties,L"text-content",strTextContent);
|
||||
|
||||
@ -554,8 +554,9 @@ void pptx_slide_context::Impl::process_image(drawing_object_description& obj, _p
|
||||
std::wstring ref;/// это ссылка на выходной внешний объект
|
||||
bool isMediaInternal = false;
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(obj.xlink_href_, typeImage, isMediaInternal, ref);
|
||||
drawing.fill.bitmap->isInternal = isMediaInternal;
|
||||
|
||||
if (drawing.type == typeShape)
|
||||
{
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);//собственно это не объект, а доп рел и ref объекта
|
||||
@ -647,11 +648,12 @@ void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _p
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
drawing.extExternal = !isMediaInternal;
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
add_additional_rels( true, drawing.extId, ref, typeMedia);
|
||||
add_additional_rels( isMediaInternal, drawing.extId, ref, typeMedia);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
@ -751,10 +753,10 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"spd",impl_->transition_.Speed.get());
|
||||
}
|
||||
if (impl_->transition_.Time)
|
||||
/* if (impl_->transition_.Time)
|
||||
{
|
||||
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
|
||||
}
|
||||
}*/
|
||||
if (impl_->transition_.PageTime)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
|
||||
|
||||
@ -332,21 +332,34 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_)
|
||||
{
|
||||
CP_XML_ATTR(L"marT", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
CP_XML_ATTR(L"marB", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
CP_XML_ATTR(L"marL", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
CP_XML_ATTR(L"marR", *style_cell_attlist.common_padding_attlist_.fo_padding_);
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marT", (long)padding);
|
||||
CP_XML_ATTR(L"marB", (long)padding);
|
||||
CP_XML_ATTR(L"marL", (long)padding);
|
||||
CP_XML_ATTR(L"marR", (long)padding);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_top_)
|
||||
CP_XML_ATTR(L"marT", *style_cell_attlist.common_padding_attlist_.fo_padding_top_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_top_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marT", (long)padding);
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_bottom_)
|
||||
CP_XML_ATTR(L"marB", *style_cell_attlist.common_padding_attlist_.fo_padding_bottom_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_bottom_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marB", (long)padding);
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_left_)
|
||||
CP_XML_ATTR(L"marL", *style_cell_attlist.common_padding_attlist_.fo_padding_left_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_left_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marL", (long)padding);
|
||||
}
|
||||
if (style_cell_attlist.common_padding_attlist_.fo_padding_right_)
|
||||
CP_XML_ATTR(L"marR", *style_cell_attlist.common_padding_attlist_.fo_padding_right_);
|
||||
{
|
||||
double padding = style_cell_attlist.common_padding_attlist_.fo_padding_right_->get_value_unit(odf_types::length::emu);
|
||||
CP_XML_ATTR(L"marR", (long)padding);
|
||||
}
|
||||
}
|
||||
//vert //
|
||||
//style_cell_attlist.pptx_serialize(Context, CP_XML_STREAM()); //nodes
|
||||
|
||||
@ -55,8 +55,8 @@ public:
|
||||
|
||||
void add_format(std::wstring const & condition, std::wstring const & format)
|
||||
{
|
||||
std::wstring c = condition;
|
||||
XmlUtils::GetLower(c);
|
||||
std::wstring c = XmlUtils::GetLower(condition);
|
||||
|
||||
XmlUtils::replace_all( c, L" ", L"");
|
||||
XmlUtils::replace_all( c, L"\t", L"");
|
||||
|
||||
|
||||
@ -281,6 +281,11 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f)
|
||||
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-error")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsErrors";
|
||||
impl_->conditionalFormattings_.back().rules.back().formula = L"0";
|
||||
}
|
||||
else if (0 <= (pos = f.find(L"duplicate")))
|
||||
{
|
||||
impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues";
|
||||
|
||||
@ -576,11 +576,31 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
if (drawing.type_anchor == 2) // absolute
|
||||
{
|
||||
//пересчет нужен для оле
|
||||
xlsx_table_position from, to;
|
||||
|
||||
process_position_properties (obj, table_metrics, from, to);
|
||||
|
||||
drawing.from_.type = xlsx_drawing_position::from;
|
||||
drawing.from_.position.col = from.col;
|
||||
drawing.from_.position.colOff = static_cast<size_t>(odf_types::length(from.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
drawing.from_.position.row = from.row;
|
||||
drawing.from_.position.rowOff = static_cast<size_t>(odf_types::length(from.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
|
||||
drawing.to_.type = xlsx_drawing_position::to;
|
||||
drawing.to_.position.col = to.col;
|
||||
drawing.to_.position.colOff = static_cast<size_t>(odf_types::length(to.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
drawing.to_.position.row = to.row;
|
||||
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
}
|
||||
|
||||
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
|
||||
drawing.objectProgId = obj.descriptor_;
|
||||
|
||||
@ -602,7 +622,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
{
|
||||
xlsx_drawings_ptr xlsx_drawings_child(xlsx_drawings::create(true));
|
||||
|
||||
process_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
|
||||
process_group_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
@ -620,9 +640,9 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
|
||||
}
|
||||
void xlsx_drawing_context::process_objects(xlsx_table_metrics & table_metrics)
|
||||
{
|
||||
process_objects(impl_->objects_, table_metrics, impl_->get_drawings());
|
||||
process_group_objects(impl_->objects_, table_metrics, impl_->get_drawings());
|
||||
}
|
||||
void xlsx_drawing_context::process_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
|
||||
void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
for (size_t i = 0 ; i < objects.size(); i++)
|
||||
{
|
||||
@ -661,7 +681,7 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
|
||||
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject:
|
||||
process_object ( obj, drawing, xlsx_drawings_); break;
|
||||
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,13 +133,13 @@ private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
void process_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
|
||||
void process_group (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
|
||||
void process_group_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
|
||||
|
||||
void process_image (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
|
||||
void process_chart (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
|
||||
void process_shape (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
|
||||
void process_object (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
|
||||
void process_object (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
|
||||
|
||||
void process_common_properties (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics);
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public:
|
||||
|
||||
if (sheet_rel)
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_sheet_rels_[i].rid == rid && xlsx_sheet_rels_[i].ref == ref)
|
||||
present = true;
|
||||
@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
|
||||
present = true;
|
||||
@ -89,7 +89,7 @@ public:
|
||||
{
|
||||
if (inGroup)
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
xlsx_drawings_[i].serialize(strm);
|
||||
}
|
||||
@ -114,7 +114,7 @@ public:
|
||||
}
|
||||
void serialize_objects(std::wostream & strm)
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
|
||||
void dump_rels_drawing(rels & Rels)
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
|
||||
{
|
||||
if (xlsx_drawing_rels_[i].type == typeImage ||
|
||||
xlsx_drawing_rels_[i].type == typeMedia ||
|
||||
@ -146,7 +146,7 @@ public:
|
||||
}
|
||||
void dump_rels_sheet(rels & Rels)
|
||||
{
|
||||
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
|
||||
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
|
||||
{
|
||||
Rels.add(relationship( xlsx_sheet_rels_[i].rid,
|
||||
mediaitems::get_rel_type(xlsx_sheet_rels_[i].type),
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include"../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include"../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -68,9 +70,22 @@ public:
|
||||
std::wstring sVal;
|
||||
std::wstring sNode;
|
||||
};
|
||||
struct _reference
|
||||
{
|
||||
std::wstring name;
|
||||
int type = -1;
|
||||
std::wstring member_name;
|
||||
int member_type = -1;
|
||||
};
|
||||
struct _group
|
||||
{
|
||||
std::wstring name;
|
||||
std::vector<_field_value> caches;
|
||||
};
|
||||
struct _field
|
||||
{
|
||||
std::wstring name;
|
||||
std::wstring display_name;
|
||||
int type = -1;
|
||||
int hierarchy = -1;
|
||||
int function = -1;
|
||||
@ -78,12 +93,20 @@ public:
|
||||
bool data_layout = false;
|
||||
bool show_empty = false;
|
||||
bool repeat_item_labels = true;
|
||||
int type_groups = 0;
|
||||
int sort = 0;
|
||||
|
||||
std::vector<int> subtotals;
|
||||
|
||||
std::vector<_field_value> caches;
|
||||
std::vector<_reference> references;
|
||||
int references_field = -1;
|
||||
bool used_in_referenes = false;
|
||||
|
||||
int type_groups = 0;
|
||||
int base_group = -1;
|
||||
std::wstring source_groups;
|
||||
std::vector<_group> groups;
|
||||
std::vector<int> groups_discrete;
|
||||
|
||||
bool bDataFieldEnabled = false;
|
||||
bool bString = false;
|
||||
@ -139,13 +162,19 @@ public:
|
||||
|
||||
bool identify_categories = false;
|
||||
bool drill_enabled = true;
|
||||
bool ignore_empty_rows = false;
|
||||
|
||||
bool data_on_row = false;
|
||||
bool in_group = false;
|
||||
}current_;
|
||||
|
||||
void sort_fields();
|
||||
|
||||
void serialize_view(std::wostream & strm);
|
||||
void serialize_cache(std::wostream & strm);
|
||||
|
||||
void serialize_type_field(CP_ATTR_NODE, _field & field);
|
||||
|
||||
private:
|
||||
bool clear_header_map(std::map<size_t, size_t> & map)
|
||||
{//отсев по секонд - нужны тока повторы
|
||||
@ -243,12 +272,172 @@ private:
|
||||
}
|
||||
connections_ += strm.str();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl())
|
||||
{
|
||||
}
|
||||
void xlsx_pivots_context::Impl::sort_fields()
|
||||
{
|
||||
size_t count_skip = 0;
|
||||
for (size_t i = 0; i < current_.fields.size() - count_skip; i++)
|
||||
{
|
||||
if (!current_.fields[i].source_groups.empty() && i != current_.fields.size() - count_skip)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
count_skip++;
|
||||
}
|
||||
}
|
||||
count_skip = 0;
|
||||
for (size_t i = 0; i < current_.fields.size() - count_skip; i++)
|
||||
{
|
||||
if (current_.fields[i].name.empty() && i != current_.fields.size() - count_skip)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
count_skip++;
|
||||
}
|
||||
}
|
||||
|
||||
bool bEmptyRowCache = false, bAddRepeateCol = false;
|
||||
bool bEmptyColCache = false, bAddRepeateRow = false;
|
||||
|
||||
int index_current = 0;
|
||||
for (size_t i = 0; i < current_.fields.size(); i++, index_current++)
|
||||
{
|
||||
if ( current_.fields[i].type_groups > 0 )
|
||||
{
|
||||
current_.fields[i].base_group = 0;
|
||||
|
||||
int index_group = 0;
|
||||
for (size_t k = 0; k < current_.fields.size(); k++)
|
||||
{
|
||||
if (current_.fields[k].type == 7) continue;
|
||||
if (current_.fields[k].name == current_.fields[i].source_groups && !current_.fields[i].source_groups.empty())
|
||||
{
|
||||
if (current_.fields[k].type_groups == 0)
|
||||
current_.fields[k].base_group = index_current; //опорный (если он и базовый - не писать)
|
||||
current_.fields[i].base_group = index_group;
|
||||
|
||||
for (size_t c = 0; !current_.fields[i].groups.empty() && c < current_.fields[k].caches.size(); c++)
|
||||
{
|
||||
for (size_t g = 0; g < current_.fields[i].groups.size(); g++)
|
||||
{
|
||||
for (size_t h = 0; h < current_.fields[i].groups[g].caches.size(); h++)
|
||||
{
|
||||
if (current_.fields[i].groups[g].caches[h].sVal == current_.fields[k].caches[c].sVal)
|
||||
current_.fields[i].groups_discrete.push_back(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
index_group++;
|
||||
}
|
||||
}
|
||||
if ( current_.fields[i].name.empty() &&
|
||||
!current_.fields[i].data_layout)
|
||||
continue;
|
||||
|
||||
switch(current_.fields[i].type)
|
||||
{
|
||||
case 0: // column
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
current_.col_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
if ((current_.col_fields.empty()) || (current_.col_fields.back() != -2))
|
||||
{
|
||||
bAddRepeateCol = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyColCache = true;
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
int index_field = -1;
|
||||
|
||||
for (size_t j = 0; j < i/*current_.fields.size()*/; j++)
|
||||
{
|
||||
if ( current_.fields[j].name == current_.fields[i].name )
|
||||
{
|
||||
current_.fields[j].bDataFieldEnabled = true;
|
||||
index_field = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index_field >= 0)
|
||||
{
|
||||
if (current_.fields[i].caches.empty())
|
||||
{
|
||||
current_.fields[i].type = 7; //skip
|
||||
current_.fields_count--;
|
||||
index_current--;
|
||||
}
|
||||
|
||||
current_.fields[i].references_field = index_field;
|
||||
}
|
||||
|
||||
index_field = i;
|
||||
current_.fields[i].bDataFieldEnabled = true;
|
||||
current_.data_fields.push_back(index_field);
|
||||
}break;
|
||||
case 2: // hidden
|
||||
{
|
||||
}break;
|
||||
case 3: // page
|
||||
{
|
||||
current_.page_fields.push_back(i);
|
||||
}break;
|
||||
case 4: // row
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
current_.row_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
current_.data_on_row = true;
|
||||
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyRowCache = true;
|
||||
|
||||
}break;
|
||||
}
|
||||
|
||||
if (current_.fields[i].name.empty())
|
||||
{
|
||||
current_.fields.erase(current_.fields.begin() + i, current_.fields.begin() + i + 1);
|
||||
current_.fields_count--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (bAddRepeateCol || bEmptyColCache)
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if (bAddRepeateRow)
|
||||
current_.row_fields.push_back(-2);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
if (current_.headers.empty()) return;
|
||||
@ -403,6 +592,7 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
CP_XML_ATTR(L"colPageCount", 1);
|
||||
}
|
||||
}
|
||||
std::map<std::wstring, bool> used_field_name;
|
||||
CP_XML_NODE(L"pivotFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields_count);
|
||||
@ -411,6 +601,11 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
|
||||
if (used_field_name.end() != used_field_name.find(current_.fields[i].name))
|
||||
continue;
|
||||
|
||||
used_field_name.insert(std::make_pair(current_.fields[i].name, true));
|
||||
|
||||
CP_XML_NODE(L"pivotField")
|
||||
{
|
||||
switch(current_.fields[i].type)
|
||||
@ -440,22 +635,38 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
CP_XML_ATTR(L"defaultSubtotal", 0);
|
||||
|
||||
if (!current_.fields[i].caches.empty() && current_.fields[i].type != 2)
|
||||
if (current_.fields[i].type != 2)
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
if (!current_.fields[i].groups.empty())
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!current_.fields[i].caches.empty())
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//CP_XML_STREAM() << fields_[i].view_;
|
||||
}
|
||||
}
|
||||
if (!current_.row_fields.empty())
|
||||
@ -509,35 +720,85 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
CP_XML_ATTR(L"count", current_.data_fields.size());
|
||||
for (size_t i = 0; i < current_.data_fields.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"dataField")
|
||||
{
|
||||
CP_XML_ATTR(L"fld", current_.data_fields[i]);
|
||||
CP_XML_ATTR(L"baseField", current_.data_fields[i]);
|
||||
//CP_XML_ATTR(L"baseItem", -1);
|
||||
//CP_XML_ATTR(L"name", L"");
|
||||
int ind_field_dirty = current_.data_fields[i];
|
||||
|
||||
int ind_field = current_.data_fields[i];
|
||||
if (ind_field >= 0 && ind_field < current_.fields.size())
|
||||
CP_XML_NODE(L"dataField")
|
||||
{
|
||||
int fld = 0, ind_fld = current_.fields[ind_field_dirty].references_field < 0 ? ind_field_dirty :
|
||||
current_.fields[ind_field_dirty].references_field;
|
||||
for (size_t k = 0; k < ind_fld; k++)
|
||||
{
|
||||
switch(current_.fields[ind_field].function)
|
||||
if (current_.fields[k].type != 7 ) fld++;
|
||||
}
|
||||
|
||||
CP_XML_ATTR(L"fld", fld);
|
||||
if (current_.fields[ind_field_dirty].references.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"baseField", fld);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t base_field = 0, base_item = 0;
|
||||
for (size_t k = 0; k < current_.fields.size(); k++)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"subtotal", L"average"); break;
|
||||
case 2: CP_XML_ATTR(L"subtotal", L"count"); break;
|
||||
case 3: CP_XML_ATTR(L"subtotal", L"countNums"); break;
|
||||
case 4: CP_XML_ATTR(L"subtotal", L"max"); break;
|
||||
case 5: CP_XML_ATTR(L"subtotal", L"min"); break;
|
||||
case 6: CP_XML_ATTR(L"subtotal", L"product"); break;
|
||||
case 7: CP_XML_ATTR(L"subtotal", L"stdDev"); break;
|
||||
case 8: CP_XML_ATTR(L"subtotal", L"stdDevp"); break;
|
||||
case 9: CP_XML_ATTR(L"subtotal", L"sum"); break;
|
||||
case 10: CP_XML_ATTR(L"subtotal", L"var"); break;
|
||||
case 11: CP_XML_ATTR(L"subtotal", L"varp"); break;
|
||||
if (current_.fields[k].type == 7 ) continue;
|
||||
|
||||
if (current_.fields[k].name == current_.fields[ind_field_dirty].references[0].name)
|
||||
{
|
||||
for (size_t j = 0; j < current_.fields[k].caches.size(); j++)
|
||||
{
|
||||
if (current_.fields[k].caches[j].sVal == current_.fields[ind_field_dirty].references[0].member_name)
|
||||
{
|
||||
base_item = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
base_field++;
|
||||
}
|
||||
CP_XML_ATTR(L"baseField", base_field);
|
||||
CP_XML_ATTR(L"baseItem", base_item);
|
||||
|
||||
switch(current_.fields[ind_field_dirty].references[0].type)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"showDataAs", L"difference"); break;
|
||||
case 2: CP_XML_ATTR(L"showDataAs", L"percent"); break;
|
||||
case 3: CP_XML_ATTR(L"showDataAs", L"percentDiff"); break;
|
||||
}
|
||||
}
|
||||
std::wstring name;
|
||||
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < current_.fields.size())
|
||||
{
|
||||
switch(current_.fields[ind_field_dirty].function)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"subtotal", L"average"); name = L"average "; break;
|
||||
case 2: CP_XML_ATTR(L"subtotal", L"count"); name = L"count "; break;
|
||||
case 3: CP_XML_ATTR(L"subtotal", L"countNums"); name = L"countNums "; break;
|
||||
case 4: CP_XML_ATTR(L"subtotal", L"max"); name = L"max "; break;
|
||||
case 5: CP_XML_ATTR(L"subtotal", L"min"); name = L"min "; break;
|
||||
case 6: CP_XML_ATTR(L"subtotal", L"product"); name = L"product "; break;
|
||||
case 7: CP_XML_ATTR(L"subtotal", L"stdDev"); name = L"stdDev Dev "; break;
|
||||
case 8: CP_XML_ATTR(L"subtotal", L"stdDevp"); name = L"stdDevp "; break;
|
||||
case 9: CP_XML_ATTR(L"subtotal", L"sum"); name = L"sum by "; break;
|
||||
case 10: CP_XML_ATTR(L"subtotal", L"var"); name = L"var "; break;
|
||||
case 11: CP_XML_ATTR(L"subtotal", L"varp"); name = L"varp "; break;
|
||||
case 12:
|
||||
{
|
||||
CP_XML_ATTR(L"subtotal", current_.fields[current_.data_fields[i]].user_function);
|
||||
}break;
|
||||
default: break;
|
||||
}
|
||||
if (current_.fields[ind_field_dirty].display_name.empty())
|
||||
{
|
||||
name += current_.fields[ind_field_dirty].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = current_.fields[ind_field_dirty].display_name;
|
||||
}
|
||||
CP_XML_ATTR(L"name", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -554,9 +815,90 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_type_field(CP_ATTR_NODE, _field & field)
|
||||
{
|
||||
_CP_OPT(bool) containsSemiMixedTypes;
|
||||
_CP_OPT(bool) containsMixedTypes;
|
||||
_CP_OPT(bool) containsNonDate;
|
||||
_CP_OPT(bool) containsDate;
|
||||
_CP_OPT(bool) containsString;
|
||||
_CP_OPT(bool) containsBlank;
|
||||
_CP_OPT(bool) containsNumber;
|
||||
_CP_OPT(bool) containsInteger;
|
||||
|
||||
if (field.bDate & field.bNumber/* ||
|
||||
field.bNumber & field.bString*/)
|
||||
{
|
||||
containsSemiMixedTypes = true;
|
||||
}
|
||||
else if (field.bDate & field.bString ||
|
||||
field.bNumber & field.bString ||
|
||||
field.bInteger & field.bString)
|
||||
{
|
||||
containsMixedTypes = true;
|
||||
|
||||
if (field.bInteger)
|
||||
{
|
||||
if (field.bNumber) field.bInteger = false;
|
||||
field.bNumber = true;
|
||||
}
|
||||
}
|
||||
else if (!field.bEmpty && !field.bString && !field.bBool)
|
||||
{
|
||||
containsSemiMixedTypes = false;
|
||||
}
|
||||
if (field.bDate &&
|
||||
!(field.bNumber || field.bInteger || field.bString || field.bEmpty ))
|
||||
{
|
||||
containsNonDate = false;
|
||||
}
|
||||
if (field.bDate)
|
||||
{
|
||||
containsDate = true;
|
||||
}
|
||||
if (!field.bString &&
|
||||
(field.bInteger || field.bDate || field.bNumber || field.bEmpty))
|
||||
{
|
||||
containsString = false;
|
||||
if (field.bInteger)
|
||||
{
|
||||
if (field.bNumber) field.bInteger = false;
|
||||
field.bNumber = true;
|
||||
}
|
||||
if (/*!field.bDate && */field.bEmpty)
|
||||
containsNonDate = false;
|
||||
}
|
||||
if (field.bEmpty)
|
||||
{
|
||||
containsBlank = true;
|
||||
}
|
||||
if (field.bNumber)
|
||||
{
|
||||
containsNumber = true;
|
||||
}
|
||||
if (field.bInteger && !field.bDate)
|
||||
{
|
||||
if (containsMixedTypes)
|
||||
{
|
||||
containsNumber = true;
|
||||
containsInteger = true;
|
||||
}
|
||||
else
|
||||
containsInteger = true;
|
||||
}
|
||||
|
||||
if (containsNonDate) CP_XML_ATTR(L"containsNonDate", *containsNonDate);
|
||||
if (containsSemiMixedTypes) CP_XML_ATTR(L"containsSemiMixedTypes", *containsSemiMixedTypes);
|
||||
if (containsString) CP_XML_ATTR(L"containsString", *containsString);
|
||||
if (containsBlank) CP_XML_ATTR(L"containsBlank", *containsBlank);
|
||||
if (containsMixedTypes) CP_XML_ATTR(L"containsMixedTypes", *containsMixedTypes);
|
||||
if (containsDate) CP_XML_ATTR(L"containsDate", *containsDate);
|
||||
if (containsNumber) CP_XML_ATTR(L"containsNumber", *containsNumber);
|
||||
if (containsInteger) CP_XML_ATTR(L"containsInteger", *containsInteger);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
std::map<std::wstring, bool> used_field_name;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"pivotCacheDefinition")
|
||||
@ -599,6 +941,7 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
int index_current = 0;
|
||||
|
||||
if (current_.fields.empty() == false)
|
||||
{
|
||||
@ -611,67 +954,38 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
|
||||
if (used_field_name.end() != used_field_name.find(current_.fields[i].name))
|
||||
continue;
|
||||
|
||||
used_field_name.insert(std::make_pair(current_.fields[i].name, true));
|
||||
|
||||
CP_XML_NODE(L"cacheField")
|
||||
{
|
||||
CP_XML_ATTR(L"name", current_.fields[i].name);
|
||||
CP_XML_ATTR(L"numFmtId", 0);
|
||||
|
||||
if (!current_.fields[i].source_groups.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"databaseField", 0);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"sharedItems")
|
||||
{
|
||||
if (current_.fields[i].caches.empty() == false/* &&
|
||||
current_.fields[i].type != 2*/)
|
||||
{
|
||||
{
|
||||
if (current_.fields[i].type_groups == 0)
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (current_.fields[i].type_groups < 8)
|
||||
{//group by date
|
||||
current_.fields[i].bDate = true;
|
||||
current_.fields[i].bString = false;
|
||||
}
|
||||
|
||||
if ((current_.fields[i].bDate & current_.fields[i].bNumber) ||
|
||||
(current_.fields[i].bNumber & current_.fields[i].bString))
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
|
||||
}
|
||||
else if (current_.fields[i].bDate & current_.fields[i].bString)
|
||||
{
|
||||
CP_XML_ATTR(L"containsMixedTypes", 1);
|
||||
}
|
||||
else if (!current_.fields[i].bEmpty && !current_.fields[i].bString && !current_.fields[i].bBool)
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 0);
|
||||
}
|
||||
if (current_.fields[i].bDate &&
|
||||
!(current_.fields[i].bNumber || current_.fields[i].bInteger || current_.fields[i].bString || current_.fields[i].bEmpty ))
|
||||
{
|
||||
CP_XML_ATTR(L"containsNonDate", 0);
|
||||
}
|
||||
if (current_.fields[i].bDate) CP_XML_ATTR(L"containsDate", 1);
|
||||
if (!current_.fields[i].bString &&
|
||||
(current_.fields[i].bInteger || current_.fields[i].bDate || current_.fields[i].bNumber || current_.fields[i].bEmpty))
|
||||
{
|
||||
CP_XML_ATTR(L"containsString", 0);
|
||||
}
|
||||
if (current_.fields[i].bEmpty) CP_XML_ATTR(L"containsBlank", 1);
|
||||
|
||||
if (current_.fields[i].bNumber) CP_XML_ATTR(L"containsNumber", 1);
|
||||
|
||||
if (current_.fields[i].bInteger && !current_.fields[i].bDate)
|
||||
{
|
||||
if (current_.fields[i].bString)
|
||||
{
|
||||
CP_XML_ATTR(L"containsInteger", 1);
|
||||
}
|
||||
else if (!current_.fields[i].bNumber)
|
||||
{
|
||||
CP_XML_ATTR(L"containsNumber", 1);
|
||||
CP_XML_ATTR(L"containsInteger", 1);
|
||||
}
|
||||
}
|
||||
//else group by fields
|
||||
|
||||
serialize_type_field(CP_GET_XML_NODE(), current_.fields[i]);
|
||||
if ( current_.fields[i].type_groups == 0 )
|
||||
{
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
@ -687,37 +1001,78 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( current_.fields[i].type_groups != 0 )
|
||||
if (current_.fields[i].base_group >= 0)
|
||||
{
|
||||
CP_XML_NODE(L"fieldGroup")
|
||||
{
|
||||
CP_XML_ATTR(L"base", i);
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
if ( current_.fields[i].type_groups > 0)
|
||||
{
|
||||
switch(current_.fields[i].type_groups)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
|
||||
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
|
||||
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
|
||||
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
|
||||
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
|
||||
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
|
||||
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
|
||||
}
|
||||
CP_XML_ATTR(L"startDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"endDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"base", current_.fields[i].base_group);
|
||||
}
|
||||
CP_XML_NODE(L"groupItems")
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
CP_XML_ATTR(L"par", current_.fields[i].base_group);
|
||||
}
|
||||
if (current_.fields[i].type_groups > 0)
|
||||
{
|
||||
if (current_.fields[i].type_groups < 8)
|
||||
{
|
||||
CP_XML_NODE(current_.fields[i].caches[j].sNode)
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
if (current_.fields[i].caches[j].sVal.empty() == false)
|
||||
switch(current_.fields[i].type_groups)
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j].sVal);
|
||||
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
|
||||
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
|
||||
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
|
||||
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
|
||||
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
|
||||
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
|
||||
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
|
||||
}
|
||||
CP_XML_ATTR(L"startDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"endDate", L"1899-12-31T00:00:00");
|
||||
}
|
||||
}
|
||||
if (!current_.fields[i].groups_discrete.empty())
|
||||
{
|
||||
CP_XML_NODE(L"discretePr")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups_discrete.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups_discrete.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].groups_discrete[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"groupItems")
|
||||
{
|
||||
if (!current_.fields[i].groups.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"s")
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].groups[j].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(current_.fields[i].caches[j].sNode)
|
||||
{
|
||||
if (current_.fields[i].caches[j].sVal.empty() == false)
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j].sVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -725,6 +1080,8 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index_current++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -823,6 +1180,8 @@ int xlsx_pivots_context::end_table()
|
||||
std::wstringstream view_strm;
|
||||
std::wstringstream cache_strm;
|
||||
std::wstringstream rec_strm;
|
||||
|
||||
impl_->sort_fields();
|
||||
|
||||
impl_->serialize_view(view_strm);
|
||||
impl_->serialize_cache(cache_strm);
|
||||
@ -859,6 +1218,10 @@ void xlsx_pivots_context::set_identify_categories(bool val)
|
||||
{
|
||||
impl_->current_.identify_categories = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_ignore_empty_rows(bool val)
|
||||
{
|
||||
impl_->current_.ignore_empty_rows = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_drill(bool val)
|
||||
{
|
||||
impl_->current_.drill_enabled = val;
|
||||
@ -874,75 +1237,86 @@ void xlsx_pivots_context::set_field_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_display(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().display_name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_type(int type, int hierarchy)
|
||||
{
|
||||
impl_->current_.fields.back().type = type;
|
||||
impl_->current_.fields.back().hierarchy = hierarchy;
|
||||
|
||||
if ( impl_->current_.fields.back().name.empty() &&
|
||||
!impl_->current_.fields.back().data_layout)
|
||||
return;
|
||||
//if ( impl_->current_.fields.back().name.empty() &&
|
||||
// !impl_->current_.fields.back().data_layout)
|
||||
// return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 0: // column
|
||||
{
|
||||
if (impl_->current_.fields.back().data_layout)
|
||||
{
|
||||
if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
//impl_->current_.fields.back().repeat_item_labels )) //????
|
||||
impl_->current_.col_fields.push_back(-2);
|
||||
}
|
||||
else
|
||||
impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
int index_field = -1;
|
||||
|
||||
for (size_t i = 0; i < impl_->current_.fields.size(); i++)
|
||||
{
|
||||
if (impl_->current_.fields[i].name == impl_->current_.fields.back().name &&
|
||||
impl_->current_.fields[i].type != 1)
|
||||
{
|
||||
impl_->current_.fields[i].bDataFieldEnabled = true;
|
||||
index_field = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index_field >= 0)
|
||||
{
|
||||
impl_->current_.fields.back().type = 7;
|
||||
impl_->current_.fields_count--;
|
||||
impl_->current_.data_fields.push_back(index_field);
|
||||
}
|
||||
else
|
||||
{
|
||||
index_field = impl_->current_.fields.size() - 1;
|
||||
impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
impl_->current_.data_fields.push_back(index_field);
|
||||
}
|
||||
}break;
|
||||
case 2: // hidden
|
||||
break;
|
||||
case 3: // page
|
||||
impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
break;
|
||||
case 4: // row
|
||||
if (impl_->current_.fields.back().data_layout)
|
||||
{
|
||||
impl_->current_.data_on_row = true;
|
||||
//switch(type)
|
||||
//{
|
||||
// case 0: // column
|
||||
// {
|
||||
// if (impl_->current_.fields.back().data_layout)
|
||||
// {
|
||||
// if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
// //impl_->current_.fields.back().repeat_item_labels )) //????
|
||||
// impl_->current_.col_fields.push_back(-2);
|
||||
// }
|
||||
// else
|
||||
// impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// }break;
|
||||
// case 1: // data
|
||||
// {
|
||||
// int index_field = -1;
|
||||
//
|
||||
// for (size_t i = 0; i < impl_->current_.fields.size() - 1; i++)
|
||||
// {
|
||||
// if (impl_->current_.fields[i].name == impl_->current_.fields.back().name &&
|
||||
// (impl_->current_.fields[i].type != 1 || !impl_->current_.fields.back().references.empty()))
|
||||
// {
|
||||
// impl_->current_.fields[i].bDataFieldEnabled = true;
|
||||
// index_field = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (index_field >= 0)
|
||||
// {
|
||||
// impl_->current_.fields.back().type = 7; //skip
|
||||
// impl_->current_.fields_count--;
|
||||
//
|
||||
// if (!impl_->current_.fields.back().references.empty())
|
||||
// {
|
||||
// impl_->current_.fields.back().references_field = index_field;
|
||||
// impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
//
|
||||
// index_field = impl_->current_.fields.size() - 1;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// index_field = impl_->current_.fields.size() - 1;
|
||||
// impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
// }
|
||||
// impl_->current_.data_fields.push_back(index_field);
|
||||
// }break;
|
||||
// case 2: // hidden
|
||||
// break;
|
||||
// case 3: // page
|
||||
// impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// break;
|
||||
// case 4: // row
|
||||
// if (impl_->current_.fields.back().data_layout)
|
||||
// {
|
||||
// impl_->current_.data_on_row = true;
|
||||
|
||||
if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
//(impl_->current_.fields.back().repeat_item_labels ||
|
||||
// !impl_->current_.identify_categories ))
|
||||
impl_->current_.row_fields.push_back(-2);
|
||||
// if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
// //(impl_->current_.fields.back().repeat_item_labels ||
|
||||
// // !impl_->current_.identify_categories ))
|
||||
// impl_->current_.row_fields.push_back(-2);
|
||||
|
||||
}
|
||||
else
|
||||
impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
break;
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_function(int type)
|
||||
{
|
||||
@ -973,10 +1347,60 @@ void xlsx_pivots_context::set_field_groups(int type)
|
||||
{
|
||||
impl_->current_.fields.back().type_groups = type + 1;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_groups_source(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().source_groups = name;
|
||||
}
|
||||
void xlsx_pivots_context::start_field_group()
|
||||
{
|
||||
impl_->current_.in_group = true;
|
||||
Impl::_group group;
|
||||
impl_->current_.fields.back().groups.push_back(group);
|
||||
}
|
||||
void xlsx_pivots_context::set_field_group_name (std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().groups.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::end_field_group()
|
||||
{
|
||||
impl_->current_.in_group = false;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_sort(int type)
|
||||
{
|
||||
impl_->current_.fields.back().sort = type + 1;
|
||||
}
|
||||
void xlsx_pivots_context::start_field_reference()
|
||||
{
|
||||
Impl::_reference ref;
|
||||
impl_->current_.fields.back().references.push_back(ref);
|
||||
}
|
||||
void xlsx_pivots_context::end_field_reference()
|
||||
{
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().name = name;
|
||||
|
||||
for (size_t i = 0; i < impl_->current_.fields.size(); i++)
|
||||
{
|
||||
if (impl_->current_.fields[i].name == name)
|
||||
{
|
||||
impl_->current_.fields[i].used_in_referenes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_type (int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().type = type;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_member_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_member_type(int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_type = type;
|
||||
}
|
||||
void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
{
|
||||
if (index < 0)
|
||||
@ -1002,15 +1426,16 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
_CP_OPT(double) dVal;
|
||||
if (pos >= 0)//финановый .. todooo общее правило бы...
|
||||
{
|
||||
value = value.substr(pos + 1);
|
||||
XmlUtils::replace_all(value, L",", L"");
|
||||
XmlUtils::replace_all(value, L" ", L"");
|
||||
XmlUtils::replace_all(value, L"\x00A0", L"");
|
||||
//value = value.substr(pos + 1);
|
||||
//XmlUtils::replace_all(value, L",", L"");
|
||||
//XmlUtils::replace_all(value, L" ", L"");
|
||||
//XmlUtils::replace_all(value, L"\x00A0", L"");
|
||||
}
|
||||
if (oox::IsNumber(value))
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlUtils::replace_all(value, L",", L".");
|
||||
dVal = boost::lexical_cast<double>(value);
|
||||
}
|
||||
catch(...)
|
||||
@ -1021,7 +1446,7 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
{
|
||||
node_name = L"n";
|
||||
|
||||
int iVal = *dVal;
|
||||
_INT64 iVal = *dVal;
|
||||
if (abs(iVal - *dVal) > 0.00001)
|
||||
{
|
||||
value = std::to_wstring(*dVal);
|
||||
@ -1045,14 +1470,20 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
}
|
||||
}
|
||||
impl_->current_.fields.back().caches.push_back(Impl::_field_value(value, node_name));
|
||||
|
||||
if (impl_->current_.in_group)
|
||||
{
|
||||
impl_->current_.fields.back().groups.back().caches.push_back(impl_->current_.fields.back().caches.back());
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_pivots_context::end_field()
|
||||
{
|
||||
if (impl_->current_.fields.back().name.empty())
|
||||
{
|
||||
impl_->current_.fields_count--;
|
||||
impl_->current_.fields.pop_back();
|
||||
}
|
||||
//if (impl_->current_.fields.back().name.empty())
|
||||
//{
|
||||
// impl_->current_.fields_count--;
|
||||
// impl_->current_.fields.pop_back();
|
||||
//}
|
||||
}
|
||||
void xlsx_pivots_context::set_source_range(std::wstring table_name, std::wstring ref)
|
||||
{
|
||||
|
||||
@ -51,6 +51,7 @@ public:
|
||||
|
||||
void start_field ();
|
||||
void set_field_name (std::wstring name);
|
||||
void set_field_display (std::wstring name);
|
||||
void set_field_type (int type, int hierarchy);
|
||||
void set_field_function (int type);
|
||||
void set_field_user_function (std::wstring f);
|
||||
@ -59,8 +60,22 @@ public:
|
||||
void set_field_show_empty (bool val);
|
||||
void set_field_data_layout (bool val);
|
||||
void set_field_sort (int type);
|
||||
void set_field_groups (int type);
|
||||
void set_repeat_item_labels(bool val);
|
||||
|
||||
void set_field_groups (int type);
|
||||
void set_field_groups_source(std::wstring name);
|
||||
|
||||
void start_field_group();
|
||||
void set_field_group_name (std::wstring name);
|
||||
void end_field_group();
|
||||
|
||||
void start_field_reference();
|
||||
void set_field_ref_name(std::wstring name);
|
||||
void set_field_ref_type (int type);
|
||||
void set_field_ref_member_name(std::wstring name);
|
||||
void set_field_ref_member_type(int type);
|
||||
void end_field_reference();
|
||||
|
||||
void end_field();
|
||||
|
||||
int get_count();
|
||||
@ -72,6 +87,7 @@ public:
|
||||
void add_button_header(std::wstring ref);
|
||||
|
||||
void set_identify_categories(bool val);
|
||||
void set_ignore_empty_rows(bool val);
|
||||
void set_drill(bool val);
|
||||
|
||||
void set_source_range(std::wstring table_name, std::wstring ref);
|
||||
@ -97,7 +113,6 @@ public:
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -358,7 +358,18 @@ void xlsx_table_state::serialize_page_properties (std::wostream & strm)
|
||||
|
||||
page_layout->xlsx_serialize(strm, *context_);
|
||||
}
|
||||
void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
{
|
||||
if (tableBackground_.empty()) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"picture")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", tableBackground_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
|
||||
|
||||
@ -120,10 +120,12 @@ public:
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
|
||||
|
||||
void table_column_last_width(double w) { table_column_last_width_ = w; }
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
|
||||
void start_hyperlink ();
|
||||
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
|
||||
std::wstring end_hyperlink (std::wstring const & ref, std::wstring const & href, std::wstring const & display);
|
||||
|
||||
void set_background (std::wstring rId) { tableBackground_ = rId; }
|
||||
|
||||
void serialize_conditionalFormatting (std::wostream & _Wostream);
|
||||
void serialize_table_format (std::wostream & _Wostream);
|
||||
@ -131,6 +133,7 @@ public:
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
@ -154,6 +157,7 @@ private:
|
||||
|
||||
std::wstring tableName_;
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
std::wstring table_style_;
|
||||
std::wstring table_row_style_;
|
||||
|
||||
@ -320,6 +320,10 @@ void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_page_properties(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_background(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_background(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_hyperlinks(_Wostream);
|
||||
|
||||
@ -90,6 +90,7 @@ public:
|
||||
void serialize_hyperlinks (std::wostream & _Wostream);
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ namespace oox {
|
||||
|
||||
bool IsNumber(const std::wstring &value)
|
||||
{
|
||||
boost::wregex rule(L"\\-?^[0-9]*[.,]?[0-9]*$");
|
||||
boost::wregex rule(L"^\\-{0,1}[0-9]*[.,]{0,1}[0-9]*$");
|
||||
boost::match_results<std::wstring::const_iterator> results;
|
||||
|
||||
return boost::regex_search(value/*.begin(), value.end(), results*/, rule);
|
||||
|
||||
@ -475,9 +475,10 @@ void xlsx_conversion_context::end_table()
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", drawingName.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
get_table_context().serialize_background (current_sheet().drawing());
|
||||
|
||||
}
|
||||
if (!get_comments_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
@ -495,7 +496,6 @@ void xlsx_conversion_context::end_table()
|
||||
current_sheet().set_comments_link(commentsName.first, commentsName.second);
|
||||
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
|
||||
}
|
||||
//background picture
|
||||
get_table_context().end_table();
|
||||
}
|
||||
|
||||
@ -547,7 +547,10 @@ int xlsx_conversion_context::current_table_row()
|
||||
|
||||
std::wstring xlsx_conversion_context::current_cell_address()
|
||||
{
|
||||
return oox::getCellAddress(current_table_column(), current_table_row());
|
||||
int col = current_table_column();
|
||||
int row = current_table_row();
|
||||
|
||||
return oox::getCellAddress(col < 0 ? 0 : col, row < 0 ? 0 : row); //under covered cell
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_office_spreadsheet(const odf_reader::office_element * elm)
|
||||
|
||||
@ -46,8 +46,7 @@ std::wostream & operator << (std::wostream & _Wostream, const Bool & _Val)
|
||||
}
|
||||
Bool Bool::parse(const std::wstring & Str)
|
||||
{
|
||||
std::wstring tmp = Str;
|
||||
XmlUtils::GetLower(tmp);
|
||||
std::wstring tmp = XmlUtils::GetLower(Str);
|
||||
|
||||
if (tmp == L"0" || tmp == L"false") return Bool(false);
|
||||
else return Bool(true);
|
||||
|
||||
@ -91,47 +91,47 @@ smil_transition_type smil_transition_type::parse(const std::wstring & Str)
|
||||
std::wstring tmp = Str;
|
||||
boost::algorithm::to_lower(tmp);
|
||||
|
||||
if(tmp == L"barWipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxWipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxWipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorWipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalWipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtieWipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalWipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veeWipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveeWipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagWipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagWipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"irisWipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"triangleWipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadWipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonWipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonWipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipseWipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyeWipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectWipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starWipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapeWipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockWipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelWipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepWipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanWipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanWipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepWipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorWipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldWipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakeWipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralWipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakesWipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakesWipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallWipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushWipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slideWipe") return smil_transition_type( slideWipe );
|
||||
if(tmp == L"barwipe") return smil_transition_type( barWipe );
|
||||
else if(tmp == L"boxwipe") return smil_transition_type( boxWipe );
|
||||
else if(tmp == L"fourboxwipe") return smil_transition_type( fourBoxWipe );
|
||||
else if(tmp == L"barndoorwipe") return smil_transition_type( barnDoorWipe );
|
||||
else if(tmp == L"diagonalwipe") return smil_transition_type( diagonalWipe );
|
||||
else if(tmp == L"bowtiewipe") return smil_transition_type( bowTieWipe );
|
||||
else if(tmp == L"miscdiagonalwipe") return smil_transition_type( miscDiagonalWipe );
|
||||
else if(tmp == L"veewipe") return smil_transition_type( veeWipe );
|
||||
else if(tmp == L"barnveewipe") return smil_transition_type( barnVeeWipe );
|
||||
else if(tmp == L"zigzagwipe") return smil_transition_type( zigZagWipe );
|
||||
else if(tmp == L"barnzigzagwipe") return smil_transition_type( barnZigZagWipe );
|
||||
else if(tmp == L"iriswipe") return smil_transition_type( irisWipe);
|
||||
else if(tmp == L"trianglewipe") return smil_transition_type( triangleWipe);
|
||||
else if(tmp == L"arrowheadwipe") return smil_transition_type( arrowHeadWipe );
|
||||
else if(tmp == L"pentagonwipe") return smil_transition_type( pentagonWipe );
|
||||
else if(tmp == L"hexagonwipe") return smil_transition_type( hexagonWipe );
|
||||
else if(tmp == L"ellipsewipe") return smil_transition_type( ellipseWipe );
|
||||
else if(tmp == L"eyewipe") return smil_transition_type( eyeWipe );
|
||||
else if(tmp == L"roundrectwipe") return smil_transition_type( roundRectWipe );
|
||||
else if(tmp == L"starwipe") return smil_transition_type( starWipe );
|
||||
else if(tmp == L"miscshapewipe") return smil_transition_type( miscShapeWipe );
|
||||
else if(tmp == L"clockwipe") return smil_transition_type( clockWipe );
|
||||
else if(tmp == L"pinwheelwipe") return smil_transition_type( pinWheelWipe );
|
||||
else if(tmp == L"singlesweepwipe") return smil_transition_type( singleSweepWipe);
|
||||
else if(tmp == L"fanwipe") return smil_transition_type( fanWipe );
|
||||
else if(tmp == L"doublefanwipe") return smil_transition_type( doubleFanWipe );
|
||||
else if(tmp == L"doublesweepwipe") return smil_transition_type( doubleSweepWipe );
|
||||
else if(tmp == L"saloondoorwipe") return smil_transition_type( saloonDoorWipe );
|
||||
else if(tmp == L"windshieldwipe") return smil_transition_type( windshieldWipe );
|
||||
else if(tmp == L"snakewipe") return smil_transition_type( snakeWipe );
|
||||
else if(tmp == L"spiralwipe") return smil_transition_type( spiralWipe );
|
||||
else if(tmp == L"parallelsnakeswipe")return smil_transition_type( parallelSnakesWipe );
|
||||
else if(tmp == L"boxsnakeswipe") return smil_transition_type( boxSnakesWipe );
|
||||
else if(tmp == L"waterfallwipe") return smil_transition_type( waterfallWipe );
|
||||
else if(tmp == L"pushwipe") return smil_transition_type( pushWipe );
|
||||
else if(tmp == L"slidewipe") return smil_transition_type( slideWipe );
|
||||
else if(tmp == L"fade") return smil_transition_type( fade );
|
||||
else if(tmp == L"checkerboardWipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindsWipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"checkerboardwipe") return smil_transition_type( checkerBoardWipe);
|
||||
else if(tmp == L"blindswipe") return smil_transition_type( blindsWipe);
|
||||
else if(tmp == L"dissolve") return smil_transition_type( dissolve);
|
||||
else if(tmp == L"randombarWipe") return smil_transition_type( randomBarWipe);
|
||||
else if(tmp == L"randombarwipe") return smil_transition_type( randomBarWipe);
|
||||
else
|
||||
{
|
||||
return smil_transition_type( barWipe );
|
||||
|
||||
@ -754,7 +754,7 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
|
||||
|
||||
}
|
||||
|
||||
void common_draw_docx_convert(oox::docx_conversion_context & Context, const union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing)
|
||||
void common_draw_docx_convert(oox::docx_conversion_context & Context, union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing)
|
||||
{
|
||||
const std::wstring styleName = attlists_.shape_with_text_and_styles_.
|
||||
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
|
||||
@ -899,7 +899,16 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
|
||||
}
|
||||
}
|
||||
///////////////////////////
|
||||
|
||||
if (attlists_.rel_size_.common_draw_size_attlist_.svg_width_)
|
||||
{
|
||||
double w_shape = attlists_.rel_size_.common_draw_size_attlist_.svg_width_->get_value_unit(length::pt);
|
||||
if (w_shape < 1) attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = length(1, length::pt);
|
||||
}
|
||||
if (attlists_.rel_size_.common_draw_size_attlist_.svg_height_)
|
||||
{
|
||||
double h_shape = attlists_.rel_size_.common_draw_size_attlist_.svg_height_->get_value_unit(length::pt);
|
||||
if (h_shape < 1) attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = length(1, length::pt);
|
||||
}
|
||||
drawing->x = get_value_emu(attlists_.position_.svg_x_);
|
||||
drawing->y = get_value_emu(attlists_.position_.svg_y_);
|
||||
|
||||
|
||||
@ -298,6 +298,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
|
||||
|
||||
set_shape = true;
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
@ -306,8 +308,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
int w = boost::lexical_cast<int>(splitted[0]);
|
||||
int h = boost::lexical_cast<int>(splitted[1]);
|
||||
w = boost::lexical_cast<int>(splitted[0]);
|
||||
h = boost::lexical_cast<int>(splitted[1]);
|
||||
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path_w", w));
|
||||
shape->additional_.push_back(odf_reader::_property(L"custom_path_h", h));
|
||||
@ -320,6 +322,17 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
int b = boost::lexical_cast<int>(splitted[3]);
|
||||
|
||||
}
|
||||
|
||||
//if (shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_)
|
||||
//{
|
||||
// int w_shape = shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_->get_value();
|
||||
// if (w_shape < 1) shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = length(1, length::pt);
|
||||
//}
|
||||
//if (shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_)
|
||||
//{
|
||||
// int h_shape = shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_->get_value();
|
||||
// if (h_shape < 1) shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = length(1, length::pt);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "math_layout_elements.h"
|
||||
#include "math_token_elements.h"
|
||||
#include "style_text_properties.h"
|
||||
#include "math_limit_elements.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -95,6 +96,7 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
bDPr = true;
|
||||
}
|
||||
|
||||
bool need_e_old = Context.is_need_e_, need_e = false;
|
||||
if (bDPr)
|
||||
{
|
||||
Context.output_stream() << L"<m:d>";
|
||||
@ -114,20 +116,31 @@ void math_mrow::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
Context.output_stream() << Context.math_style_stream().str();
|
||||
Context.output_stream() << L"</m:dPr>";
|
||||
Context.output_stream() << L"<m:e>";
|
||||
|
||||
need_e = true;
|
||||
}
|
||||
else need_e = Context.is_need_e_;
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
|
||||
for (int i = i_start; i < i_end ; i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
}
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
if (bDPr)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
Context.output_stream() << L"</m:d>";
|
||||
}
|
||||
Context.is_need_e_ = need_e_old;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
const wchar_t * math_mfrac::ns = L"math";
|
||||
@ -149,13 +162,23 @@ void math_mfrac::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool need_e = Context.is_need_e_;
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
office_math_element* math_element = NULL;
|
||||
|
||||
Context.output_stream() << L"<m:f>";
|
||||
Context.output_stream() << L"<m:num>";
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
Context.output_stream() << L"</m:num>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
Context.output_stream() << L"<m:den>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
@ -163,6 +186,12 @@ void math_mfrac::oox_convert(oox::math_context & Context)
|
||||
Context.output_stream() << L"</m:den>";
|
||||
|
||||
Context.output_stream() << L"</m:f>";
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
Context.is_need_e_ = need_e;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
const wchar_t * math_msqrt::ns = L"math";
|
||||
@ -191,6 +220,8 @@ void math_msqrt::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:deg/>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
@ -229,6 +260,9 @@ void math_mroot::oox_convert(oox::math_context & Context)
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:deg>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
strm << L"<m:e>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
@ -294,11 +328,26 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
}
|
||||
}
|
||||
}
|
||||
bool need_e_old = Context.is_need_e_;
|
||||
Context.is_need_e_ = content_.size() > 1 ? true : need_e_old;
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"<m:e>";
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"</m:e>";
|
||||
|
||||
//office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
//math_element->oox_convert(Context);
|
||||
}
|
||||
//reset to default math text props
|
||||
Context.text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties());
|
||||
@ -306,6 +355,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
|
||||
Context.text_properties_->content().style_font_name_ = L"Cambria Math";
|
||||
Context.text_properties_->content().fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt);
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
{
|
||||
std::wstringstream & strm = Context.math_style_stream();
|
||||
strm.str( std::wstring() );
|
||||
|
||||
@ -71,11 +71,15 @@ void math_msub::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:sSub>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
|
||||
strm << L"<m:sub>";
|
||||
Context.is_need_e_ = false; //??
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[1].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:sub>";
|
||||
@ -109,6 +113,8 @@ void math_msup::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:sSup>";
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
@ -142,6 +148,8 @@ void math_msubsup::oox_convert(oox::math_context & Context)
|
||||
office_math_element* math_element = NULL;
|
||||
|
||||
strm << L"<m:sSubSup>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
strm << L"<m:e>";
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
@ -328,6 +336,9 @@ void math_mover::oox_convert(oox::math_context & Context)
|
||||
strm << L"<m:limUpp>";
|
||||
strm << L"<m:limUppPr/>";
|
||||
strm << L"<m:e>";
|
||||
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
math_element = dynamic_cast<office_math_element*>(content_[0].get());
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:e>";
|
||||
@ -355,6 +366,13 @@ void math_munder::oox_convert(oox::math_context & Context)
|
||||
{//2 elements
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
bool need_e = Context.is_need_e_;
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"<m:e>";
|
||||
}
|
||||
Context.is_need_e_ = false;
|
||||
|
||||
office_math_element* math_element = NULL;
|
||||
strm << L"<m:limLow>";
|
||||
strm << L"<m:limLowPr/>";
|
||||
@ -367,6 +385,12 @@ void math_munder::oox_convert(oox::math_context & Context)
|
||||
math_element->oox_convert(Context);
|
||||
strm << L"</m:lim>";
|
||||
strm << L"</m:limLow>";
|
||||
|
||||
if (need_e)
|
||||
{
|
||||
Context.output_stream() << L"</m:e>";
|
||||
}
|
||||
Context.is_need_e_ = need_e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
#include "math_table_elements.h"
|
||||
#include "math_layout_elements.h"
|
||||
#include "math_limit_elements.h"
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -91,19 +92,30 @@ void math_mtr::oox_convert(oox::math_context & Context)
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
strm << L"<m:mr>";
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
math_mrow* mrow_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
if (mrow_test)
|
||||
Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
if (mrow_test)
|
||||
strm << L"</m:e>";
|
||||
}
|
||||
bool need_e_old = Context.is_need_e_;
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
//Context.is_need_e_ = content_.size() > 1 ? true : false;
|
||||
Context.is_need_e_ = true;
|
||||
|
||||
//math_mrow* row_test = dynamic_cast<math_mrow*>(content_[i].get());
|
||||
//math_munder* munder_test = dynamic_cast<math_munder*>(content_[i].get());
|
||||
//math_mfrac* frac_test = dynamic_cast<math_mfrac*>(content_[i].get());
|
||||
//
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// Context.output_stream() << L"<m:e>";// EqArray записался в числитель вместо знаменателя.docx - дублирование
|
||||
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
math_element->oox_convert(Context);
|
||||
|
||||
//if (row_test || munder_test || frac_test)
|
||||
// strm << L"</m:e>";
|
||||
}
|
||||
strm << L"</m:mr>";
|
||||
|
||||
Context.is_need_e_ = need_e_old;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -146,6 +158,7 @@ void math_mtd::oox_convert(oox::math_context & Context)
|
||||
std::wostream & strm = Context.output_stream();
|
||||
|
||||
strm << L"<m:e>";
|
||||
Context.is_need_e_ = false;
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
|
||||
|
||||
@ -283,7 +283,12 @@ void math_mtext::add_text(const std::wstring & Text)
|
||||
|
||||
void math_mtext::oox_convert(oox::math_context & Context)
|
||||
{
|
||||
|
||||
if (text_)
|
||||
{
|
||||
Context.output_stream() << L"<m:r><m:rPr><m:nor/></m:rPr><m:t>";
|
||||
Context.output_stream() << XmlUtils::EncodeXmlString(*text_);
|
||||
Context.output_stream() << L"</m:t></m:r>";
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
const wchar_t * math_mglyph::ns = L"math";
|
||||
|
||||
@ -104,8 +104,7 @@ void styles_container::add_style( const std::wstring & Name,
|
||||
map_[n] = pos;
|
||||
|
||||
// TODO: как правильно??
|
||||
std::wstring lName = Name;
|
||||
XmlUtils::GetLower(lName);
|
||||
std::wstring lName = XmlUtils::GetLower(Name);
|
||||
//if ( boost::algorithm::contains(lName, L"internet_20_link") )
|
||||
if (lName == L"internet_20_link")///???????????????
|
||||
hyperlink_style_pos_ = pos;
|
||||
@ -331,7 +330,7 @@ void page_layout_instance::xlsx_serialize(std::wostream & strm, oox::xlsx_conver
|
||||
props->xlsx_serialize(strm, Context);
|
||||
}
|
||||
|
||||
void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
void page_layout_instance::docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get());
|
||||
const style_footer_style * footerStyle = dynamic_cast<style_footer_style *>(style_page_layout_->style_footer_style_.get());
|
||||
@ -357,7 +356,7 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
|
||||
|
||||
style_page_layout_properties * props = properties();
|
||||
if (props)
|
||||
props->docx_convert_serialize(strm, Context);
|
||||
props->docx_serialize(strm, Context);
|
||||
}
|
||||
void page_layout_instance::pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -193,9 +193,9 @@ public:
|
||||
const std::wstring & name() const;
|
||||
style_page_layout_properties * properties() const;
|
||||
|
||||
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
void docx_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void pptx_serialize (std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
const style_page_layout * style_page_layout_;
|
||||
|
||||
|
||||
@ -40,9 +40,10 @@
|
||||
#include "serialize_elements.h"
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
#include "../odf/odfcontext.h"
|
||||
#include "odfcontext.h"
|
||||
|
||||
#include "../odf/calcs_styles.h"
|
||||
#include "calcs_styles.h"
|
||||
#include "../docx/xlsx_utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -215,8 +216,12 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
std::wstring ref = Context.current_cell_address();
|
||||
Context.get_comments_context().end_comment(ref,Context.current_table_column(), Context.current_table_row());
|
||||
int col = Context.current_table_column(); if (col < 0) col = 0;
|
||||
int row = Context.current_table_row(); if (row < 0) row = 0;
|
||||
|
||||
std::wstring ref = oox::getCellAddress(col, row);
|
||||
|
||||
Context.get_comments_context().end_comment(ref, col, row);
|
||||
}
|
||||
// officeooo:annotation
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -152,7 +152,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
|
||||
{
|
||||
lastPageLayout->docx_convert_serialize(Context.output_stream(), Context);
|
||||
lastPageLayout->docx_serialize(Context.output_stream(), Context);
|
||||
//Context.remove_page_properties();
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,20 +90,38 @@ void text::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.get_delete_text_state())
|
||||
return; //в ms нет рецензирования notes
|
||||
|
||||
Context.add_element_to_run();
|
||||
std::wostream & strm = Context.output_stream();
|
||||
bool add_del_run = false;
|
||||
if (Context.get_drawing_state_content() && Context.get_delete_text_state())
|
||||
{ //0503IG-AddingFormattingText.odt - удаленый текст в удаленом объекте
|
||||
|
||||
oox::text_tracked_context::_state &state = Context.get_text_tracked_context().get_tracked_change(L"");
|
||||
if (state.type == 2)
|
||||
{
|
||||
add_del_run = true;
|
||||
Context.output_stream() << L"<w:del>";
|
||||
}
|
||||
}
|
||||
|
||||
Context.add_element_to_run();
|
||||
|
||||
std::wstring textNode = L"w:t";
|
||||
|
||||
if (Context.get_delete_text_state()) textNode = L"w:delText";
|
||||
|
||||
strm << L"<" << textNode;
|
||||
Context.output_stream() << L"<" << textNode;
|
||||
if (preserve_ && !Context.get_delete_text_state())
|
||||
strm << L" xml:space=\"preserve\"";
|
||||
strm << L">";
|
||||
Context.output_stream() << L" xml:space=\"preserve\"";
|
||||
Context.output_stream() << L">";
|
||||
|
||||
Context.output_stream() << xml::utils::replace_text_to_xml( text_ );
|
||||
Context.output_stream() << L"</" << textNode << L">";
|
||||
|
||||
if (add_del_run)
|
||||
{
|
||||
Context.finish_run();
|
||||
Context.output_stream() << L"</w:del>";
|
||||
}
|
||||
|
||||
strm << xml::utils::replace_text_to_xml( text_ );
|
||||
strm << L"</" << textNode << L">";
|
||||
}
|
||||
|
||||
void text::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
@ -407,7 +407,7 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
switch (style_text_underline_style_->get_type())
|
||||
{
|
||||
case line_style::Solid:
|
||||
if (underlineBold) underline = L"thick";
|
||||
if (underlineBold) underline = L"heavy";
|
||||
else underline = L"sng";
|
||||
break;
|
||||
case line_style::Dotted:
|
||||
|
||||
@ -1254,7 +1254,6 @@ bool style_page_layout_properties::docx_background_serialize(std::wostream & str
|
||||
void style_page_layout_properties::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
|
||||
void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -1319,31 +1318,28 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
}
|
||||
}
|
||||
}
|
||||
if (elements_.style_background_image_)
|
||||
}
|
||||
if (elements_.style_background_image_)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
|
||||
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
|
||||
if (fill.bitmap)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
|
||||
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
|
||||
if (fill.bitmap)
|
||||
if ( fill.bitmap->rId.empty())
|
||||
{
|
||||
if ( 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::wstring href = fill.bitmap->xlink_href_;
|
||||
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
|
||||
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
|
||||
}
|
||||
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"picture")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", fill.bitmap->rId );
|
||||
}
|
||||
}
|
||||
}
|
||||
Context.get_table_context().state()->set_background(fill.bitmap->rId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
void style_page_layout_properties::docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
style_columns * columns = dynamic_cast<style_columns *>( elements_.style_columns_.get());
|
||||
|
||||
|
||||
@ -975,11 +975,12 @@ public:
|
||||
static const ElementType type = typeStylePageLayout;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void pptx_convert (oox::pptx_conversion_context & Context);
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context);
|
||||
|
||||
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
|
||||
|
||||
void docx_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
|
||||
|
||||
@ -790,7 +790,7 @@ namespace svg_path
|
||||
}
|
||||
}
|
||||
|
||||
if ((aCurrPoly.points.size() > 0 || !bIsClosed) && !aCurrPoly.command.empty() && aCurrPoly.command != L"a:cubicBezTo")
|
||||
if ((aCurrPoly.points.size() > 0/* || !bIsClosed*/) && !aCurrPoly.command.empty() && aCurrPoly.command != L"a:cubicBezTo")
|
||||
{
|
||||
// end-process last poly
|
||||
|
||||
|
||||
@ -123,6 +123,9 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
if (table_identify_categories_)
|
||||
Context.get_pivots_context().set_identify_categories(table_identify_categories_->get());
|
||||
|
||||
if (table_ignore_empty_rows_)
|
||||
Context.get_pivots_context().set_ignore_empty_rows(table_ignore_empty_rows_->get());
|
||||
|
||||
if (table_drill_down_ondouble_click_)
|
||||
Context.get_pivots_context().set_drill(table_drill_down_ondouble_click_->get());
|
||||
|
||||
@ -155,6 +158,7 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
CP_APPLY_ATTR(L"loext:ignore-selected-page" , loext_ignore_selected_page_);
|
||||
CP_APPLY_ATTR(L"table:selected-page" , table_selected_page_);
|
||||
CP_APPLY_ATTR(L"table:is-data-layout-field" , table_is_data_layout_field_);
|
||||
CP_APPLY_ATTR(L"tableooo:display-name" , table_display_name_);
|
||||
}
|
||||
|
||||
void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -175,6 +179,9 @@ void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
|
||||
Context.get_pivots_context().set_field_name(table_source_field_name_.get_value_or(L""));
|
||||
|
||||
if (table_display_name_)
|
||||
Context.get_pivots_context().set_field_display(*table_display_name_);
|
||||
|
||||
if (table_is_data_layout_field_)
|
||||
Context.get_pivots_context().set_field_data_layout(table_is_data_layout_field_->get());
|
||||
|
||||
@ -217,7 +224,24 @@ void table_data_pilot_field_reference::add_attributes( const xml::attributes_wc_
|
||||
|
||||
void table_data_pilot_field_reference::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
Context.get_pivots_context().start_field_reference();
|
||||
if (table_field_name_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_name(*table_field_name_);
|
||||
}
|
||||
if (table_type_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_type(table_type_->get_type());
|
||||
}
|
||||
if (table_member_name_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_member_name(*table_member_name_);
|
||||
}
|
||||
if (table_member_type_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_member_type(table_member_type_->get_type());
|
||||
}
|
||||
Context.get_pivots_context().end_field_reference();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_database_source_table::ns = L"table";
|
||||
@ -405,6 +429,12 @@ void table_data_pilot_groups::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
{
|
||||
if (table_grouped_by_)
|
||||
Context.get_pivots_context().set_field_groups(table_grouped_by_->get_type());
|
||||
else
|
||||
Context.get_pivots_context().set_field_groups(7);
|
||||
|
||||
if (table_source_field_name_)
|
||||
Context.get_pivots_context().set_field_groups_source(*table_source_field_name_);
|
||||
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -425,10 +455,16 @@ void table_data_pilot_group::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
void table_data_pilot_group::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
Context.get_pivots_context().start_field_group();
|
||||
|
||||
if (table_name_)
|
||||
Context.get_pivots_context().set_field_group_name (*table_name_);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.get_pivots_context().end_field_group();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_members::ns = L"table";
|
||||
@ -466,12 +502,12 @@ const wchar_t * table_data_pilot_group_member::name = L"data-pilot-group-member"
|
||||
|
||||
void table_data_pilot_group_member::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
}
|
||||
|
||||
void table_data_pilot_group_member::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
Context.get_pivots_context().add_field_cache(-1, table_name_.get_value_or(L""));
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_subtotals::ns = L"table";
|
||||
|
||||
@ -130,6 +130,7 @@ public:
|
||||
_CP_OPT(odf_types::Bool) loext_ignore_selected_page_;
|
||||
_CP_OPT(std::wstring) table_selected_page_;
|
||||
_CP_OPT(odf_types::Bool) table_is_data_layout_field_;
|
||||
_CP_OPT(std::wstring) table_display_name_;
|
||||
|
||||
office_element_ptr reference_;
|
||||
office_element_ptr level_;
|
||||
|
||||
@ -44,7 +44,7 @@ namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
|
||||
_mediaitems::item::item( std::wstring const & _oox_ref,
|
||||
_mediaitems::item::item(std::wstring const & _oox_ref,
|
||||
Type _type,
|
||||
std::wstring const & _odf_ref
|
||||
)
|
||||
@ -58,23 +58,31 @@ _mediaitems::item::item( std::wstring const & _oox_ref,
|
||||
|
||||
void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref)
|
||||
{
|
||||
std::wstring output_sub_path;//
|
||||
std::wstring output_sub_path;
|
||||
std::wstring output_fileName;
|
||||
int number=0;
|
||||
|
||||
if (type == typeImage)
|
||||
{
|
||||
output_sub_path = L"Pictures/";
|
||||
number= count_image+1;
|
||||
number = count_image + 1;
|
||||
}
|
||||
else
|
||||
else if (type == typeMedia)
|
||||
{
|
||||
output_sub_path = L"Media/";
|
||||
number= count_media+1;
|
||||
number = count_media + 1;
|
||||
}
|
||||
|
||||
|
||||
output_fileName = utils::media::create_file_name(oox_ref, type, number);//guid???
|
||||
else if (type == typeOleObject)
|
||||
{
|
||||
output_sub_path = L"";
|
||||
number = count_object + 1;
|
||||
}
|
||||
else if (type == typeObjectReplacement)
|
||||
{
|
||||
output_sub_path = L"ObjectReplacements/";
|
||||
number = count_image_object + 1;
|
||||
}
|
||||
output_fileName = utils::media::create_file_name(oox_ref, type, number); //guid???
|
||||
|
||||
std::wstring input_path = oox_ref;
|
||||
|
||||
@ -92,16 +100,25 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (output_path .length() < 1)
|
||||
if (output_path.length() < 1)
|
||||
{
|
||||
output_path = ( output_sub_path + output_fileName) ;
|
||||
if ( type == typeImage)
|
||||
{
|
||||
count_image++;
|
||||
}
|
||||
else
|
||||
else if ( type == typeMedia)
|
||||
{
|
||||
count_media++;
|
||||
|
||||
}
|
||||
else if ( type == typeOleObject)
|
||||
{
|
||||
count_object++;
|
||||
}
|
||||
else if ( type == typeObjectReplacement)
|
||||
{
|
||||
count_image_object++;
|
||||
}
|
||||
|
||||
items_.push_back( item(input_path, type, xml::utils::replace_text_to_xml(output_path)) );
|
||||
}
|
||||
|
||||
@ -42,13 +42,14 @@ class rels;
|
||||
class _mediaitems
|
||||
{
|
||||
public:
|
||||
enum Type { typeUnknown = 0, typeImage, typeMedia};
|
||||
//oleObject ???
|
||||
enum Type { typeUnknown = 0, typeImage, typeMedia, typeOleObject, typeObjectReplacement};
|
||||
|
||||
_mediaitems()
|
||||
{
|
||||
count_image =0;
|
||||
count_media =0;
|
||||
count_image = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_image_object = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
@ -66,6 +67,8 @@ public:
|
||||
|
||||
size_t count_image;
|
||||
size_t count_media;
|
||||
size_t count_object;
|
||||
size_t count_image_object;
|
||||
|
||||
void add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref);
|
||||
|
||||
|
||||
@ -29,12 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "mediaitems_utils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer{
|
||||
namespace utils {
|
||||
@ -45,9 +41,11 @@ std::wstring get_rel_type(_mediaitems::Type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case _mediaitems::typeImage:
|
||||
return L"";
|
||||
default:
|
||||
case _mediaitems::typeOleObject:
|
||||
return L"application/vnd.sun.star.oleobject";
|
||||
case _mediaitems::typeMedia:
|
||||
case _mediaitems::typeImage:
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
@ -58,6 +56,9 @@ std::wstring get_default_file_name(_mediaitems::Type type)
|
||||
{
|
||||
case _mediaitems::typeImage:
|
||||
return L"image";
|
||||
case _mediaitems::typeOleObject:
|
||||
case _mediaitems::typeObjectReplacement:
|
||||
return L"Object ";
|
||||
default:
|
||||
return L"media";
|
||||
}
|
||||
@ -66,11 +67,15 @@ std::wstring get_default_file_name(_mediaitems::Type type)
|
||||
std::wstring create_file_name(const std::wstring & uri, _mediaitems::Type type, size_t Num)
|
||||
{
|
||||
std::wstring sExt;
|
||||
int n = uri.rfind(L".");
|
||||
if (n>=0) sExt = uri.substr(n);
|
||||
//todooo проверить
|
||||
|
||||
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
|
||||
if (type == _mediaitems::typeOleObject &&
|
||||
type == _mediaitems::typeObjectReplacement)
|
||||
{
|
||||
int n = uri.rfind(L".");
|
||||
if (n >= 0) sExt = uri.substr(n);
|
||||
}
|
||||
|
||||
return get_default_file_name(type) + std::to_wstring(Num) + sExt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -77,8 +77,7 @@ namespace odf_writer
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content, utf8);
|
||||
}
|
||||
|
||||
////////////
|
||||
//-------------------------------------------------------------------------------
|
||||
content_simple_ptr content_simple::create()
|
||||
{
|
||||
return boost::make_shared<content_simple>();
|
||||
@ -87,7 +86,7 @@ namespace odf_writer
|
||||
{
|
||||
return boost::make_shared<content_content>();
|
||||
}
|
||||
///////////////
|
||||
//-------------------------------------------------------------------------------
|
||||
void manifect_file::add_rels(rels & r)
|
||||
{
|
||||
std::vector<relationship> & rels = r.relationships();
|
||||
@ -174,23 +173,21 @@ namespace odf_writer
|
||||
simple_element elm(L"meta.xml", resStream.str());
|
||||
elm.write(RootPath);
|
||||
}
|
||||
///////////////////////////
|
||||
|
||||
media::media(_mediaitems & mediaitems) : mediaitems_(mediaitems)
|
||||
//-------------------------------------------------------------------------------
|
||||
media::media(_mediaitems & mediaitems, const std::wstring internal_folder, int type) : mediaitems_(mediaitems), type_(type), folder_(internal_folder)
|
||||
{
|
||||
}
|
||||
|
||||
void media::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (mediaitems_.count_media < 1)return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
|
||||
std::wstring path = RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_;
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
std::vector< _mediaitems::item > & items = mediaitems_.items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++)
|
||||
{
|
||||
if (items[i].type == _mediaitems::typeMedia)
|
||||
if (items[i].type == type_)
|
||||
{
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
|
||||
|
||||
@ -198,49 +195,31 @@ namespace odf_writer
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
pictures::pictures(_mediaitems & mediaitems) : mediaitems_(mediaitems)
|
||||
{
|
||||
}
|
||||
|
||||
void pictures::write(const std::wstring & RootPath)//folder by content.xml
|
||||
{
|
||||
if (mediaitems_.count_image < 1 )return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Pictures";
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
std::vector< _mediaitems::item > & items = mediaitems_.items();
|
||||
for (size_t i = 0; i < items.size(); i++)
|
||||
{
|
||||
if (items[i].type == _mediaitems::typeImage && items[i].oox_ref.length()>0)
|
||||
{
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
|
||||
|
||||
try
|
||||
{
|
||||
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
|
||||
}catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
void object_files::set_content(content_content_ptr & _content)
|
||||
{
|
||||
content_.set_content(_content);
|
||||
meta_ = element_ptr(new meta_file());
|
||||
}
|
||||
void object_files::set_media(_mediaitems & mediaitems)
|
||||
void object_files::set_mediaitems(_mediaitems & mediaitems)
|
||||
{
|
||||
media_ = element_ptr( new media(mediaitems) );
|
||||
}
|
||||
void object_files::set_pictures(_mediaitems & mediaitems)
|
||||
{
|
||||
pictures_ = element_ptr( new pictures(mediaitems) );
|
||||
if (mediaitems.count_image > 0)
|
||||
{
|
||||
pictures_ = element_ptr( new media(mediaitems, L"Picture", 1) );
|
||||
}
|
||||
if (mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(mediaitems, L"Media", 2) );
|
||||
}
|
||||
if (mediaitems.count_object > 0)
|
||||
{
|
||||
oleObjects_ = element_ptr( new media(mediaitems, L"", 3) );
|
||||
}
|
||||
if (mediaitems.count_object > 0)
|
||||
{
|
||||
imageObjects_ = element_ptr( new media(mediaitems, L"ObjectReplacements", 4) );
|
||||
}
|
||||
}
|
||||
void object_files::set_styles(content_simple_ptr & _content)
|
||||
{
|
||||
@ -258,8 +237,10 @@ namespace odf_writer
|
||||
|
||||
if (meta_) meta_->write(RootPath);
|
||||
|
||||
if (media_) media_->write(RootPath);
|
||||
if (pictures_) pictures_->write(RootPath);
|
||||
if (media_) media_->write(RootPath);
|
||||
if (pictures_) pictures_->write(RootPath);
|
||||
if (oleObjects_) oleObjects_->write(RootPath);
|
||||
if (imageObjects_) imageObjects_->write(RootPath);
|
||||
}
|
||||
|
||||
void odf_document::add_object(element_ptr _object, bool root)
|
||||
|
||||
@ -174,21 +174,13 @@ namespace odf_writer
|
||||
class media : public element
|
||||
{
|
||||
public:
|
||||
media(_mediaitems & mediaitems);
|
||||
media(_mediaitems & mediaitems, const std::wstring internal_folder, int type);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
_mediaitems & mediaitems_;
|
||||
|
||||
};
|
||||
class pictures : public element
|
||||
{
|
||||
public:
|
||||
pictures(_mediaitems & mediaitems);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
_mediaitems & mediaitems_;
|
||||
_mediaitems& mediaitems_;
|
||||
int type_;
|
||||
std::wstring folder_;
|
||||
|
||||
};
|
||||
class object_files : public element
|
||||
@ -201,8 +193,7 @@ namespace odf_writer
|
||||
void set_styles (content_simple_ptr & _styles);
|
||||
void set_settings (content_simple_ptr & _settings);
|
||||
|
||||
void set_media (_mediaitems & mediaitems);
|
||||
void set_pictures (_mediaitems & mediaitems);
|
||||
void set_mediaitems (_mediaitems & mediaitems);
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
@ -212,16 +203,18 @@ namespace odf_writer
|
||||
styles_file styles_;
|
||||
|
||||
element_ptr meta_;
|
||||
|
||||
element_ptr media_;
|
||||
element_ptr pictures_;
|
||||
};
|
||||
|
||||
element_ptr oleObjects_;
|
||||
element_ptr imageObjects_;
|
||||
};
|
||||
class odf_document : public element
|
||||
{
|
||||
public:
|
||||
odf_document(std::wstring type);
|
||||
|
||||
void add_object(element_ptr _object,bool root=false);
|
||||
void add_object(element_ptr _object,bool root = false);
|
||||
|
||||
void set_rels(rels & r);
|
||||
|
||||
|
||||
@ -150,13 +150,12 @@ void odf_conversion_context::end_document()
|
||||
{
|
||||
object_files->set_content (content_root_);
|
||||
object_files->set_styles (content_style_);
|
||||
object_files->set_media (object.mediaitems);
|
||||
object_files->set_pictures (object.mediaitems);
|
||||
object_files->set_mediaitems(object.mediaitems);
|
||||
object_files->set_settings (content_settings_);
|
||||
|
||||
if (!isRoot)object_files->local_path = object.name + L"/";
|
||||
|
||||
object.mediaitems.dump_rels(rels_,object_files->local_path);
|
||||
object.mediaitems.dump_rels(rels_, object_files->local_path);
|
||||
|
||||
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"styles.xml"));
|
||||
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"content.xml"));
|
||||
@ -311,6 +310,24 @@ std::wstring odf_conversion_context::add_media(const std::wstring & file_name)
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_imageobject(const std::wstring & file_name)
|
||||
{
|
||||
if (file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(file_name,_mediaitems::typeObjectReplacement, odf_ref_name);
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_oleobject(const std::wstring & file_name)
|
||||
{
|
||||
if (file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(file_name,_mediaitems::typeOleObject, odf_ref_name);
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
|
||||
{
|
||||
if (!temporary_.elm) return;
|
||||
|
||||
@ -96,8 +96,10 @@ public:
|
||||
virtual void start_text_context() = 0;
|
||||
virtual void end_text_context() = 0;
|
||||
|
||||
std::wstring add_image(const std::wstring & image_file_name);
|
||||
std::wstring add_media(const std::wstring & file_name);
|
||||
std::wstring add_image (const std::wstring & image_file_name);
|
||||
std::wstring add_media (const std::wstring & file_name);
|
||||
std::wstring add_oleobject (const std::wstring & ole_file_name);
|
||||
std::wstring add_imageobject(const std::wstring & ole_file_name);
|
||||
|
||||
virtual odf_style_context * styles_context();
|
||||
|
||||
|
||||
@ -222,6 +222,7 @@ struct odf_drawing_state
|
||||
_CP_OPT(presentation_class) presentation_class_;
|
||||
_CP_OPT(std::wstring) presentation_placeholder_;
|
||||
|
||||
std::wstring program_;
|
||||
std::wstring replacement_;
|
||||
std::wstring path_;
|
||||
std::wstring view_box_;
|
||||
@ -2655,6 +2656,10 @@ void odf_drawing_context::start_object_ole(std::wstring ref)
|
||||
{
|
||||
start_frame();
|
||||
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
|
||||
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::None);
|
||||
impl_->current_graphic_properties->draw_ole_draw_aspect_ = 1;
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
office_element_ptr object_elm;
|
||||
create_element(L"draw", L"object-ole", object_elm, impl_->odf_context_);
|
||||
|
||||
@ -2682,6 +2687,11 @@ void odf_drawing_context::set_image_replacement(std::wstring ref)
|
||||
impl_->current_drawing_state_.replacement_ = ref;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_program(std::wstring program)
|
||||
{
|
||||
impl_->current_drawing_state_.program_ = program;
|
||||
}
|
||||
|
||||
bool odf_drawing_context::is_exist_content()
|
||||
{
|
||||
return (impl_->drawing_list_.empty() ? false : true);
|
||||
|
||||
@ -153,6 +153,8 @@ public:
|
||||
void add_image_replacement();
|
||||
void set_image_replacement(std::wstring ref);
|
||||
|
||||
void set_program(std::wstring program);
|
||||
|
||||
bool isLineShape();
|
||||
void corrected_line_fill();
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ namespace utils
|
||||
|
||||
void calculate_size_font_symbols(_font_metrix & metrix, CApplicationFonts *appFonts)
|
||||
{
|
||||
double appr_px = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name,metrix.font_size,metrix.italic,metrix.bold, appFonts);
|
||||
double appr_px = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name, metrix.font_size, metrix.italic, metrix.bold, appFonts);
|
||||
|
||||
if (appr_px <0.01)
|
||||
{
|
||||
@ -357,12 +357,15 @@ void ods_conversion_context::end_cell()
|
||||
}
|
||||
void ods_conversion_context::calculate_font_metrix(std::wstring name, double size, bool italic, bool bold)
|
||||
{
|
||||
if (font_metrix_.IsCalc)return;
|
||||
if (font_metrix_.IsCalc) return;
|
||||
|
||||
font_metrix_.font_size = size;
|
||||
font_metrix_.italic = italic;
|
||||
font_metrix_.bold = bold;
|
||||
font_metrix_.font_name = name;
|
||||
if (size < 1)
|
||||
size = 12;
|
||||
|
||||
font_metrix_.font_size = size;
|
||||
font_metrix_.italic = italic;
|
||||
font_metrix_.bold = bold;
|
||||
font_metrix_.font_name = name;
|
||||
|
||||
////////////////////////////////////////////
|
||||
utils::calculate_size_font_symbols(font_metrix_, applicationFonts_);
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
void add_column(int start_column, int repeated, int level = 0, bool _default = false);
|
||||
void end_columns();
|
||||
|
||||
void calculate_font_metrix(std::wstring name, double size, bool italic, bool bold);
|
||||
void calculate_font_metrix(std::wstring name, double size, bool italic, bool bold);
|
||||
|
||||
void start_rows();
|
||||
void start_row(int _start_row, int repeated, int level = 0, bool _default = false);
|
||||
|
||||
@ -62,7 +62,9 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
|
||||
_CP_APPLY_PROP2(draw_auto_grow_width_);
|
||||
_CP_APPLY_PROP2(draw_fit_to_size_);
|
||||
_CP_APPLY_PROP2(draw_fit_to_contour_);
|
||||
|
||||
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
|
||||
_CP_APPLY_PROP2(draw_ole_draw_aspect_);
|
||||
|
||||
_CP_APPLY_PROP2(svg_stroke_color_);
|
||||
_CP_APPLY_PROP2(svg_stroke_width_);
|
||||
_CP_APPLY_PROP2(svg_stroke_opacity_);
|
||||
@ -86,7 +88,6 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
|
||||
_CP_APPLY_PROP2(style_overflow_behavior_);
|
||||
_CP_APPLY_PROP2(style_mirror_);
|
||||
_CP_APPLY_PROP2(fo_clip_);
|
||||
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
|
||||
|
||||
common_draw_fill_attlist_.apply_from(Other.common_draw_fill_attlist_);
|
||||
common_draw_rel_size_attlist_.apply_from(Other.common_draw_rel_size_attlist_);
|
||||
@ -123,6 +124,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
|
||||
CP_XML_ATTR_OPT(L"draw:auto-grow-width", draw_auto_grow_width_);
|
||||
CP_XML_ATTR_OPT(L"draw:fit-to-size", draw_fit_to_size_);
|
||||
CP_XML_ATTR_OPT(L"draw:fit-to-contour", draw_fit_to_contour_);
|
||||
CP_XML_ATTR_OPT(L"draw:ole-draw-aspect", draw_ole_draw_aspect_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"draw:stroke", draw_stroke_);
|
||||
CP_XML_ATTR_OPT(L"draw:stroke-dash", draw_stroke_dash_);
|
||||
|
||||
@ -103,7 +103,8 @@ public:
|
||||
_CP_OPT(odf_types::color) draw_shadow_color_;
|
||||
_CP_OPT(odf_types::length) draw_shadow_offset_y_;
|
||||
_CP_OPT(odf_types::length) draw_shadow_offset_x_;
|
||||
|
||||
_CP_OPT(unsigned int) draw_ole_draw_aspect_;
|
||||
|
||||
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
|
||||
odf_types::common_draw_rel_size_attlist common_draw_rel_size_attlist_;
|
||||
|
||||
@ -143,8 +144,8 @@ public:
|
||||
_CP_OPT(std::wstring) style_mirror_;
|
||||
|
||||
_CP_OPT(std::wstring) fo_clip_;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
office_element_ptr style_background_image_;
|
||||
//-------------------------------------------------------------------------------------
|
||||
office_element_ptr style_background_image_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -203,25 +203,25 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
std::wstring odf_ref_image;
|
||||
bool bEmbedded = true;
|
||||
std::wstring pathImage;
|
||||
if (oox_picture->blipFill.blip.IsInit())
|
||||
{
|
||||
bool bEmbedded = true;
|
||||
if (oox_picture->blipFill.blip->embed.IsInit())
|
||||
{
|
||||
std::wstring sID = oox_picture->blipFill.blip->embed->get();
|
||||
pathImage = find_link_by_id(sID, 1);
|
||||
|
||||
odf_ref_image = odf_context()->add_image(pathImage);
|
||||
}
|
||||
else if (oox_picture->blipFill.blip->link.IsInit())
|
||||
{
|
||||
odf_ref_image = oox_picture->blipFill.blip->link->get();
|
||||
pathImage = oox_picture->blipFill.blip->link->get();
|
||||
bEmbedded = false;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
std::wstring odf_ref_image;
|
||||
|
||||
if (oox_picture->nvPicPr.nvPr.media.is_init())
|
||||
{
|
||||
if (oox_picture->nvPicPr.nvPr.media.is<PPTX::Logic::MediaFile>())
|
||||
@ -238,7 +238,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
PPTX::Logic::Ext & ext = oox_picture->nvPicPr.nvPr.extLst[i];
|
||||
if (pathMedia.empty() && ext.link.IsInit())
|
||||
{
|
||||
pathMedia= find_link_by_id(ext.link->get(), 3);
|
||||
pathMedia = find_link_by_id(ext.link->get(), 3);
|
||||
//например файлики mp3
|
||||
}
|
||||
if (ext.st.IsInit()) start = *ext.st;
|
||||
@ -255,6 +255,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
|
||||
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
|
||||
|
||||
odf_ref_image = bEmbedded ? odf_context()->add_image(pathImage) : pathImage;
|
||||
odf_context()->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
odf_context()->drawing_context()->end_media();
|
||||
@ -265,15 +266,32 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
}
|
||||
if (oox_picture->oleObject.IsInit())
|
||||
{
|
||||
//nullable_limit<Limit::OLEDrawAspectType>m_oDrawAspect;
|
||||
//nullable<OOX::RId> m_oId;
|
||||
//nullable_string m_sObjectId;
|
||||
//nullable_string m_sProgId;
|
||||
//nullable_string m_sShapeId;
|
||||
//nullable_limit<Limit::OLEType> m_oType;
|
||||
//nullable_limit<Limit::OLEUpdateMode> m_oUpdateMode;
|
||||
std::wstring pathOle;
|
||||
|
||||
if (oox_picture->oleObject->m_oId.IsInit())
|
||||
{
|
||||
pathOle = find_link_by_id(oox_picture->oleObject->m_oId->get(), 4);
|
||||
}
|
||||
std::wstring odf_ref_ole = odf_context()->add_oleobject(pathOle);
|
||||
|
||||
if (!odf_ref_ole.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->start_object_ole(odf_ref_ole);
|
||||
|
||||
if (oox_picture->oleObject->m_sProgId.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_program(*oox_picture->oleObject->m_sProgId);
|
||||
}
|
||||
odf_ref_image = bEmbedded ? odf_context()->add_imageobject(pathImage) : pathImage;
|
||||
odf_context()->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
odf_context()->drawing_context()->end_object_ole();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
odf_ref_image = bEmbedded ? odf_context()->add_image(pathImage) : pathImage;
|
||||
|
||||
odf_context()->drawing_context()->start_image(odf_ref_image);
|
||||
{
|
||||
double Width = 0, Height = 0;
|
||||
|
||||
@ -328,6 +328,13 @@ std::wstring OoxConverter::find_link_by (smart_ptr<OOX::File> & oFile, int type)
|
||||
if (pMedia)
|
||||
ref = pMedia->filename().GetPath();
|
||||
}
|
||||
if (type == 4)
|
||||
{
|
||||
OOX::OleObject* pOleObject = dynamic_cast<OOX::OleObject*>(oFile.operator->());
|
||||
|
||||
if (pOleObject)
|
||||
ref = pOleObject->filename().GetPath();
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
@ -3150,7 +3150,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
int id = oox_num_lvl->m_oLvlPicBulletId->m_oVal->GetValue();
|
||||
OOX::CNumbering * lists_styles = docx_document->GetNumbering();
|
||||
|
||||
for (size_t i = 0; (lists_styles) && (i< lists_styles->m_arrNumPicBullet.size()); i++)
|
||||
for (size_t i = 0; (lists_styles) && (i < lists_styles->m_arrNumPicBullet.size()); i++)
|
||||
{
|
||||
if ((lists_styles->m_arrNumPicBullet[i]) && (lists_styles->m_arrNumPicBullet[i]->m_oNumPicBulletId.GetValue() == id))
|
||||
{
|
||||
|
||||
@ -295,17 +295,20 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
{
|
||||
OOX::Spreadsheet::CDrawing* pDrawing = (OOX::Spreadsheet::CDrawing*)oFile.operator->();
|
||||
|
||||
convert(pDrawing);
|
||||
convert(pDrawing, oox_sheet);
|
||||
}
|
||||
}
|
||||
////сортировки
|
||||
|
||||
convert(oox_sheet->m_oOleObjects.GetPointer(), oox_sheet);
|
||||
|
||||
//сортировки
|
||||
//convert(oox_sheet->m_oSortState.GetPointer());
|
||||
|
||||
//автофильтры
|
||||
convert(oox_sheet->m_oAutofilter.GetPointer());
|
||||
|
||||
//условное форматирование
|
||||
if (oox_sheet->m_arrConditionalFormatting.size() >0)
|
||||
if (!oox_sheet->m_arrConditionalFormatting.empty() )
|
||||
{
|
||||
ods_context->start_conditional_formats();
|
||||
for (size_t fmt =0; fmt < oox_sheet->m_arrConditionalFormatting.size(); fmt++)
|
||||
@ -1232,7 +1235,7 @@ void XlsxConverter::convert_styles()
|
||||
|
||||
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_text_properties * text_properties)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFont *font, odf_writer::style_text_properties *text_properties)
|
||||
{
|
||||
if (font == NULL)return;
|
||||
if (text_properties == NULL)return;
|
||||
@ -1271,7 +1274,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_te
|
||||
}
|
||||
}
|
||||
}
|
||||
if (font->m_oItalic.IsInit() && (font->m_oItalic->m_oVal.ToBool() ==true))font_italic = true;
|
||||
if (font->m_oItalic.IsInit() && (font->m_oItalic->m_oVal.ToBool() ==true)) font_italic = true;
|
||||
|
||||
if (font_italic) text_properties->content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
|
||||
else text_properties->content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Normal);
|
||||
@ -1322,7 +1325,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_te
|
||||
if ((font->m_oStrike.IsInit()) && (font->m_oStrike->m_oVal.ToBool()))
|
||||
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Single);
|
||||
|
||||
ods_context->calculate_font_metrix(font_name,font_size,font_italic,font_bold);
|
||||
ods_context->calculate_font_metrix(font_name, font_size, font_italic, font_bold);
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(double oox_size, _CP_OPT(odf_types::length) & odf_size)
|
||||
@ -1818,7 +1821,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
|
||||
{
|
||||
if (!oox_anchor) return;
|
||||
|
||||
if (oox_anchor->m_bShapeOle) return;
|
||||
//////////////////
|
||||
if (oox_anchor->m_oFrom.IsInit() || oox_anchor->m_oTo.IsInit())
|
||||
{
|
||||
@ -1859,22 +1861,107 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing, OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
{
|
||||
if (!oox_drawing)return;
|
||||
|
||||
OOX::IFileContainer* old_container = xlsx_current_container;
|
||||
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing);
|
||||
|
||||
for (size_t dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
|
||||
for (size_t i = 0; i < oox_drawing->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Spreadsheet::CCellAnchor * oox_anchor = oox_drawing->m_arrItems[i];
|
||||
|
||||
if (oox_anchor->m_bShapeOle) continue;
|
||||
|
||||
if (oox_sheet->m_oOleObjects.IsInit() && oox_anchor->m_nId.IsInit())
|
||||
{
|
||||
std::map<int, OOX::Spreadsheet::COleObject*>::const_iterator pFind = oox_sheet->m_oOleObjects->m_mapOleObjects.find(oox_anchor->m_nId.get());
|
||||
if (pFind != oox_sheet->m_oOleObjects->m_mapOleObjects.end())
|
||||
{
|
||||
//??? перенести даные привязки
|
||||
oox_anchor->m_bShapeOle = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ods_context->start_drawings();
|
||||
convert(oox_drawing->m_arrItems[dr]);
|
||||
convert(oox_anchor);
|
||||
ods_context->end_drawings();
|
||||
}
|
||||
|
||||
xlsx_current_container = old_container;
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
{
|
||||
if (!oox_objects) return;
|
||||
|
||||
for (std::map<int, OOX::Spreadsheet::COleObject*>::const_iterator it = oox_objects->m_mapOleObjects.begin(); it != oox_objects->m_mapOleObjects.end(); ++it)
|
||||
{
|
||||
OOX::Spreadsheet::COleObject* object = it->second;
|
||||
ods_context->start_drawings();
|
||||
|
||||
bool bAnchor = false;
|
||||
std::wstring odf_ref_object, odf_ref_image;
|
||||
if (object->m_oObjectPr.IsInit())
|
||||
{
|
||||
if (object->m_oObjectPr->m_oAnchor.IsInit())
|
||||
{
|
||||
bAnchor = true;
|
||||
oox_table_position from = {}, to = {};
|
||||
|
||||
convert(object->m_oObjectPr->m_oAnchor->m_oFrom.GetPointer(), &from);
|
||||
convert(object->m_oObjectPr->m_oAnchor->m_oTo.GetPointer(), &to);
|
||||
|
||||
double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
|
||||
ods_context->current_table().convert_position(from, x1, y1);
|
||||
ods_context->current_table().convert_position(to, x2, y2);
|
||||
|
||||
ods_context->drawing_context()->set_drawings_rect(x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
}
|
||||
if (object->m_oRid.IsInit())
|
||||
{
|
||||
std::wstring pathOle;
|
||||
|
||||
std::wstring sID = object->m_oRid->GetValue();
|
||||
pathOle = find_link_by_id(sID, 4);
|
||||
|
||||
odf_ref_object = odf_context()->add_oleobject(pathOle);
|
||||
}
|
||||
if ((object->m_oObjectPr.IsInit()) && (object->m_oObjectPr->m_oRid.IsInit()))
|
||||
{
|
||||
std::wstring pathImage;
|
||||
|
||||
std::wstring sID = object->m_oObjectPr->m_oRid->GetValue();
|
||||
pathImage = find_link_by_id(sID, 1);
|
||||
|
||||
odf_ref_image = odf_context()->add_imageobject(pathImage);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
if (!bAnchor || odf_ref_image.empty())
|
||||
{
|
||||
//from vml drawing or oox drawing
|
||||
//m_oShapeId;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ods_context->drawing_context()->start_drawing();
|
||||
|
||||
ods_context->drawing_context()->start_object_ole(odf_ref_object);
|
||||
|
||||
ods_context->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
if (object->m_oProgId.IsInit())
|
||||
{
|
||||
ods_context->drawing_context()->set_program(*object->m_oProgId);
|
||||
}
|
||||
|
||||
ods_context->drawing_context()->end_object_ole();
|
||||
ods_context->drawing_context()->end_drawing();
|
||||
|
||||
ods_context->end_drawings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_position * pos)
|
||||
|
||||
@ -47,7 +47,6 @@ namespace OOX
|
||||
class WritingElement;
|
||||
|
||||
class CWorksheet;
|
||||
class CDrawing;
|
||||
class CTable;
|
||||
class CCol;
|
||||
class CRow;
|
||||
@ -69,8 +68,9 @@ namespace OOX
|
||||
class CDxf;
|
||||
class CCellStyle;
|
||||
class CNumFmt;
|
||||
class CCellAnchor;
|
||||
class COleObjects;
|
||||
class CDrawing;
|
||||
class CCellAnchor;
|
||||
class CFromTo;
|
||||
class CCommentItem;
|
||||
class CDefinedName;
|
||||
@ -182,18 +182,19 @@ namespace Oox2Odf
|
||||
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::background_color) & odf_bckgrd_color);
|
||||
void convert(OOX::Spreadsheet::CBorderProp *borderProp, std::wstring & odf_border_prop);
|
||||
void convert(OOX::Spreadsheet::CAligment *aligment, odf_writer::style_paragraph_properties * paragraph_properties,
|
||||
odf_writer::style_table_cell_properties * cell_properties);
|
||||
void convert(OOX::Spreadsheet::CAligment *aligment, odf_writer::style_paragraph_properties *paragraph_properties,
|
||||
odf_writer::style_table_cell_properties *cell_properties);
|
||||
|
||||
void convert(OOX::Spreadsheet::CXfs *cell_style, int oox_id, bool automatic=true, bool root = false);
|
||||
void convert(OOX::Spreadsheet::CXfs *cell_style, int oox_id, bool automatic = true, bool root = false);
|
||||
void convert(OOX::Spreadsheet::CCellStyle *cell_style);
|
||||
void convert(OOX::Spreadsheet::CNumFmt *numFmt);
|
||||
void convert(OOX::Spreadsheet::CDxf *dxFmt, int oox_id);
|
||||
|
||||
void convert(OOX::Spreadsheet::CCellAnchor *oox_anchor);
|
||||
void convert(OOX::Spreadsheet::CDrawing *oox_drawing);
|
||||
void convert(OOX::Spreadsheet::CDrawing *oox_drawing, OOX::Spreadsheet::CWorksheet *oox_sheet);
|
||||
void convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spreadsheet::CWorksheet *oox_sheet);
|
||||
|
||||
void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position * pos);
|
||||
void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position *pos);
|
||||
|
||||
void convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt);
|
||||
void convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule);
|
||||
|
||||
@ -99,7 +99,7 @@ namespace PPTX
|
||||
ext.fromXML(oReader);
|
||||
if (ext.spid.IsInit())
|
||||
{
|
||||
oleSpid = ext.spid;
|
||||
vmlSpid = ext.spid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ namespace PPTX
|
||||
ext.fromXML(oNode);
|
||||
if (ext.spid.IsInit())
|
||||
{
|
||||
oleSpid = ext.spid;
|
||||
vmlSpid = ext.spid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace PPTX
|
||||
nullable<Hyperlink> hlinkHover;
|
||||
|
||||
//std::vector<Ext> extLst;
|
||||
nullable_string oleSpid;
|
||||
nullable_string vmlSpid;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -112,7 +112,7 @@ namespace PPTX
|
||||
void GraphicFrame::ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), oleSpid )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), vmlSpid )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
void GraphicFrame::fromXML2(XmlUtils::CXmlLiteReader& oReader)
|
||||
@ -293,7 +293,7 @@ namespace PPTX
|
||||
}
|
||||
else if (L"legacyDrawing" == strName)
|
||||
{
|
||||
oNode.ReadAttributeBase(L"spid", oleSpid);
|
||||
oNode.ReadAttributeBase(L"spid", vmlSpid);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@ -377,7 +377,7 @@ namespace PPTX
|
||||
|
||||
bool GraphicFrame::IsEmpty() const
|
||||
{
|
||||
return !olePic.is_init() && !smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !oleSpid.is_init() && !element.is_init();
|
||||
return !olePic.is_init() && !smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !vmlSpid.is_init() && !element.is_init();
|
||||
}
|
||||
|
||||
void GraphicFrame::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -394,12 +394,12 @@ namespace PPTX
|
||||
std::wstring xml_object_vml;
|
||||
smart_ptr<OOX::IFileContainer> xml_object_rels;
|
||||
|
||||
if (oleSpid.is_init())
|
||||
if (vmlSpid.is_init())
|
||||
{
|
||||
xml_object_vml = GetVmlXmlBySpid(xml_object_rels);
|
||||
}
|
||||
|
||||
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !oleSpid.is_init())
|
||||
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !vmlSpid.is_init())
|
||||
{
|
||||
smartArt->LoadDrawing(pWriter);
|
||||
|
||||
@ -482,7 +482,7 @@ namespace PPTX
|
||||
pWriter->StartRecord(SPTREE_TYPE_GRFRAME);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteString2(0, oleSpid);
|
||||
pWriter->WriteString2(0, vmlSpid);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord1(0, nvGraphicFramePr);
|
||||
@ -523,7 +523,7 @@ namespace PPTX
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
oleSpid = pReader->GetString2();
|
||||
vmlSpid = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -640,17 +640,17 @@ namespace PPTX
|
||||
std::wstring xml;
|
||||
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(vmlSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::Slide>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
xml = parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(vmlSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(vmlSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ namespace PPTX
|
||||
|
||||
nullable<Xfrm> xfrm;
|
||||
|
||||
nullable_string oleSpid;
|
||||
nullable_string vmlSpid;
|
||||
nullable<Pic> olePic;
|
||||
|
||||
nullable<Table> table;
|
||||
|
||||
@ -174,7 +174,8 @@ namespace PPTX
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
BinDocxRW::CDocxSerializer* old_serial = pWriter->m_pMainDocument;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(pWriter, &oFontProcessor, &oDrawingConverter, NULL);
|
||||
|
||||
@ -189,6 +190,7 @@ namespace PPTX
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
pWriter->m_pMainDocument = old_serial;
|
||||
*pWriter->m_pTheme = old_theme;
|
||||
}
|
||||
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX ||
|
||||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
|
||||
@ -201,9 +203,10 @@ namespace PPTX
|
||||
DocWrapper::FontProcessor fp;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSBinPptxRW::CBinaryFileWriter* old_writer = oDrawingConverter.m_pBinaryWriter;
|
||||
NSCommon::smart_ptr<OOX::IFileContainer> old_rels = *pWriter->m_pCurrentContainer;
|
||||
|
||||
NSCommon::smart_ptr<PPTX::Theme> old_theme = *pWriter->m_pTheme;
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = pWriter;
|
||||
|
||||
BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(fp);
|
||||
@ -215,7 +218,8 @@ namespace PPTX
|
||||
|
||||
oDrawingConverter.m_pBinaryWriter = old_writer;
|
||||
*pWriter->m_pCurrentContainer = old_rels;
|
||||
}
|
||||
*pWriter->m_pTheme = old_theme;
|
||||
}
|
||||
//else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX)
|
||||
//{
|
||||
//}
|
||||
|
||||
@ -44,10 +44,67 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
|
||||
|
||||
Ole1FormatReader ole1Reader(pData, nSize);
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
file.CreateFileW(sOle2Name);
|
||||
file.WriteFile(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
file.CloseFile();
|
||||
if (ole1Reader.NativeDataSize > 0)
|
||||
{
|
||||
POLE::Storage * storageOut = new POLE::Storage(sOle2Name.c_str());
|
||||
if ( (storageOut) && (storageOut->open(true, true)))
|
||||
{
|
||||
_UINT32 tmp = 0;
|
||||
std::string name = ole1Reader.Header.ClassName.val;
|
||||
_UINT32 name_size = name.length() + 1;
|
||||
//Ole
|
||||
BYTE dataOleInfo[] = {0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
POLE::Stream oStream3(storageOut, "\001Ole", true, 20);
|
||||
oStream3.write(dataOleInfo, 20);
|
||||
oStream3.flush();
|
||||
//CompObj
|
||||
BYTE dataCompObjHeader[28] = {0x01,0x00,0xfe,0xff,0x03,0x0a,0x00,0x00,0xff,0xff,0xff,0xff,0x0a,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
|
||||
POLE::Stream oStream1(storageOut, "\001CompObj", true, 28 + (name_size + 5) + 2 * (ole1Reader.Header.ClassName.size + 4) + 4 * 4);
|
||||
oStream1.write(dataCompObjHeader, 28);
|
||||
|
||||
oStream1.write((BYTE*)&name_size, 4);
|
||||
oStream1.write((BYTE*)name.c_str(), name_size);
|
||||
|
||||
//oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
//oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
oStream1.write((BYTE*)&ole1Reader.Header.ClassName.size, 4);
|
||||
oStream1.write((BYTE*)ole1Reader.Header.ClassName.val.c_str(), ole1Reader.Header.ClassName.size);
|
||||
|
||||
tmp = 0x71B239F4;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeMarker
|
||||
|
||||
tmp = 0;
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeUserType
|
||||
oStream1.write((BYTE*)&tmp, 4); // UnicodeClipboardFormat
|
||||
oStream1.write((BYTE*)&tmp, 4); //
|
||||
oStream1.flush();
|
||||
|
||||
//ObjInfo
|
||||
BYTE dataObjInfo[] = {0x00,0x00,0x03,0x00,0x04,0x00};
|
||||
POLE::Stream oStream2(storageOut, "\003ObjInfo", true, 6);
|
||||
oStream2.write(dataObjInfo, 6);
|
||||
oStream2.flush();
|
||||
//Ole10Native
|
||||
POLE::Stream streamData(storageOut, "\001Ole10Native", true, ole1Reader.NativeDataSize + 4);
|
||||
streamData.write((BYTE*)&ole1Reader.NativeDataSize, 4);
|
||||
streamData.write(ole1Reader.NativeData, ole1Reader.NativeDataSize);
|
||||
streamData.flush();
|
||||
|
||||
storageOut->close();
|
||||
delete storageOut;
|
||||
}
|
||||
}
|
||||
else //conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
|
||||
file.CreateFileW(sOle2Name);
|
||||
file.WriteFile(pData, nSize);
|
||||
file.CloseFile();
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------
|
||||
@ -817,8 +874,7 @@ bool RtfShadingRowCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRe
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter, RtfCharProperty * charProps, bool bLookOnBorder)
|
||||
{
|
||||
if (!charProps) return false;
|
||||
@ -1645,7 +1701,64 @@ bool RtfFieldInstReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
|
||||
return RtfParagraphPropDestination::ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter );
|
||||
}
|
||||
}
|
||||
bool RtfOleBinReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
|
||||
{
|
||||
if ( "objdata" == sCommand )
|
||||
return true;
|
||||
|
||||
if ( "bin" == sCommand ) // from RtfOleReader - conv_NI38P7GBIpw1aD84H3k.rtf
|
||||
{
|
||||
int nDataSize = 0;
|
||||
if ( hasParameter )
|
||||
nDataSize = parameter;
|
||||
|
||||
BYTE *pData = NULL;
|
||||
|
||||
oReader.m_oLex.ReadBytes( parameter, &pData );
|
||||
|
||||
m_arData.push_back(std::string((char*)pData, nDataSize));
|
||||
|
||||
RELEASEOBJECT(pData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void RtfOleBinReader::ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText)
|
||||
{
|
||||
m_arData.push_back(std::string(sText.begin(), sText.end()));
|
||||
}
|
||||
void RtfOleBinReader::GetData( BYTE** ppData, long& nSize)
|
||||
{
|
||||
nSize = 0;
|
||||
size_t pos = 0, start = 0, nSizeRead = 0;
|
||||
|
||||
if (m_arData.size() > 1)
|
||||
{
|
||||
nSizeRead = *((short*)m_arData[0].c_str());
|
||||
start = 1; // first content all size
|
||||
}
|
||||
for (size_t i = start; i < m_arData.size(); i++)
|
||||
{
|
||||
nSize += m_arData[i].length();
|
||||
}
|
||||
|
||||
(*ppData) = new BYTE[ nSize];
|
||||
|
||||
for (size_t i = start; i < m_arData.size(); i++)
|
||||
{
|
||||
BYTE *buf = (BYTE*)m_arData[i].c_str();
|
||||
|
||||
for (size_t j = 0; j < m_arData[i].length(); j += 2)
|
||||
{
|
||||
BYTE nByte = 0;
|
||||
|
||||
nByte = RtfUtility::ToByte(buf[ j ]) << 4;
|
||||
nByte |= RtfUtility::ToByte(buf[ j + 1]);
|
||||
|
||||
(*ppData)[pos++] = nByte;
|
||||
}
|
||||
}
|
||||
nSize = pos;
|
||||
}
|
||||
bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
|
||||
{
|
||||
if ( "object" == sCommand )
|
||||
@ -1663,13 +1776,15 @@ bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, st
|
||||
}
|
||||
else if ( "objdata" == sCommand )
|
||||
{
|
||||
std::wstring sOleData;
|
||||
TextReader oTextReader( sOleData, false );
|
||||
StartSubReader( oTextReader, oDocument, oReader );
|
||||
RtfOleBinReader oBinReader;
|
||||
|
||||
StartSubReader( oBinReader, oDocument, oReader );
|
||||
|
||||
BYTE *pData = NULL;
|
||||
long nSize = 0;
|
||||
RtfUtility::WriteDataToBinary( sOleData, &pData, nSize );
|
||||
|
||||
oBinReader.GetData(&pData, nSize );
|
||||
|
||||
if ( 0 != nSize && pData)
|
||||
{
|
||||
HRESULT hRes = S_FALSE;
|
||||
@ -1689,7 +1804,7 @@ bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, st
|
||||
std::wstring sOleStorageName = Utils::CreateTempFile( oReader.m_sTempFolder );
|
||||
|
||||
IStorage* piMSStorage = NULL;
|
||||
if ( SUCCEEDED( StgCreateDocfile( sOleStorageName, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED/* | STGM_DELETEONRELEASE*/, NULL, &piMSStorage) ) )
|
||||
if ( SUCCEEDED( StgCreateDocfile( sOleStorageName.c_str(), STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED/* | STGM_DELETEONRELEASE*/, NULL, &piMSStorage) ) )
|
||||
{
|
||||
hRes = OleConvertOLESTREAMToIStorage( &oStream, piMSStorage, NULL );
|
||||
piMSStorage->Commit( STGC_DEFAULT );
|
||||
|
||||
@ -109,13 +109,13 @@ public:
|
||||
}
|
||||
};
|
||||
//class RtfOldList;
|
||||
class TextReader: public RtfAbstractReader
|
||||
class TextReader : public RtfAbstractReader
|
||||
{
|
||||
private:
|
||||
std::wstring& m_sName;
|
||||
bool m_bErease;
|
||||
bool m_bErease;
|
||||
public:
|
||||
TextReader( std::wstring& sName, bool bErease = true ):m_sName(sName),m_bErease(bErease)
|
||||
TextReader( std::wstring& sName, bool bErease = true ) : m_sName(sName), m_bErease(bErease)
|
||||
{
|
||||
}
|
||||
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText)
|
||||
@ -782,6 +782,20 @@ public:
|
||||
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter);
|
||||
};
|
||||
|
||||
class RtfOleBinReader : public RtfAbstractReader
|
||||
{
|
||||
private:
|
||||
std::vector<std::string>/*&*/ m_arData;
|
||||
public:
|
||||
RtfOleBinReader()
|
||||
{
|
||||
}
|
||||
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter);
|
||||
|
||||
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText);
|
||||
void GetData( BYTE** ppData, long& nSize);
|
||||
};
|
||||
|
||||
class RtfTrackerChangesReader: public RtfAbstractReader
|
||||
{
|
||||
private:
|
||||
|
||||
@ -300,26 +300,30 @@ public:
|
||||
|
||||
Ole1FormatReader(BYTE *pData, int Size)
|
||||
{
|
||||
NativeDataSize = 0;
|
||||
if (!pData || Size < 8) return;
|
||||
|
||||
CDataStream stream(pData, Size);
|
||||
|
||||
stream >> Header.OLEVersion >> Header.FormatID;
|
||||
|
||||
if (Header.OLEVersion & 0x00000500)
|
||||
if (Header.FormatID == 2)
|
||||
{
|
||||
stream >> Header.ClassName;
|
||||
}
|
||||
stream >> Header.Width >> Header.Height;
|
||||
|
||||
stream >> NativeDataSize;
|
||||
if (Header.OLEVersion & 0x00000500)
|
||||
{
|
||||
stream >> Header.ClassName;
|
||||
}
|
||||
stream >> Header.Width >> Header.Height;
|
||||
|
||||
NativeData = stream.GetCurPtr();
|
||||
stream.Skip(NativeDataSize);
|
||||
stream >> NativeDataSize;
|
||||
|
||||
NativeData = stream.GetCurPtr();
|
||||
stream.Skip(NativeDataSize);
|
||||
|
||||
int sz = stream.CanRead();
|
||||
int sz = stream.CanRead();
|
||||
|
||||
/// далее графическое представление
|
||||
/// далее графическое представление
|
||||
}
|
||||
|
||||
}
|
||||
ObjectHeader Header;
|
||||
|
||||
@ -93,10 +93,14 @@ std::wstring RtfOle::RenderToOOX(RenderParameter oRenderParameter)
|
||||
|
||||
RenderParameter oNewRenderParameter = oRenderParameter;
|
||||
oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
|
||||
m_oResultPic->m_bIsOle = true;
|
||||
sResult += m_oResultPic->RenderToOOX(oNewRenderParameter);
|
||||
|
||||
oNewRenderParameter.nValue = m_oResultPic->m_nID;
|
||||
if (m_oResultPic)
|
||||
{
|
||||
m_oResultPic->m_bIsOle = true;
|
||||
sResult += m_oResultPic->RenderToOOX(oNewRenderParameter);
|
||||
|
||||
oNewRenderParameter.nValue = m_oResultPic->m_nID;
|
||||
}
|
||||
sResult += RenderToOOXOnlyOle(oNewRenderParameter);
|
||||
|
||||
sResult += L"</w:object>";
|
||||
|
||||
@ -617,21 +617,6 @@ public:
|
||||
file.CloseFile();
|
||||
|
||||
}
|
||||
static void WriteDataToBinary( std::wstring sData, BYTE** ppData, long& nSize)
|
||||
{
|
||||
wchar_t * buf = (wchar_t *)sData.c_str();
|
||||
int nLengthText = (int)sData.length();
|
||||
nSize = nLengthText/2;
|
||||
BYTE * buf2 = new BYTE[ nSize];
|
||||
(*ppData) = buf2;
|
||||
BYTE nByte=0;
|
||||
for (long i=0; i < nSize ; i++ )
|
||||
{
|
||||
nByte = ToByte(buf[ 2*i])<<4;
|
||||
nByte |= ToByte(buf[ 2*i+1]);
|
||||
buf2[i] = nByte;
|
||||
}
|
||||
}
|
||||
static std::wstring DecodeHex( std::wstring sText )
|
||||
{
|
||||
std::wstring sHexText;
|
||||
|
||||
@ -514,49 +514,31 @@ const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>&
|
||||
return L"#REF";
|
||||
}
|
||||
|
||||
//
|
||||
const std::wstring xti2sheets(const unsigned short ixti, std::vector<std::wstring>& xti_parsed)
|
||||
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix)
|
||||
{
|
||||
if(ixti >= 0 && static_cast<unsigned short>(ixti) < xti_parsed.size())
|
||||
{
|
||||
return xti_parsed[ixti];
|
||||
}
|
||||
return L"#REF!";
|
||||
}
|
||||
//
|
||||
const std::wstring xti_indexes2sheet_name(const short itabFirst, const short itabLast, std::vector<std::wstring>& sheets_names)
|
||||
{
|
||||
if(-1 == itabFirst)
|
||||
if(-1 == tabFirst)
|
||||
{
|
||||
return L"#REF";
|
||||
}
|
||||
static boost::wregex correct_sheet_name(L"^\\'.+?\\'$");
|
||||
static boost::wregex test_sheet_name(L"[\\s)(\\':.-]+");
|
||||
static boost::wregex test_sheet_name(L"[\\s)(\\'&:-]+"); //.??? 6442946.xls
|
||||
|
||||
std::wstring sheet_first = prefix + tab2sheet_name(tabFirst, names);
|
||||
|
||||
std::wstring sheet_first = tab2sheet_name(itabFirst, sheets_names);
|
||||
if(!boost::regex_search(sheet_first.begin(), sheet_first.end(), correct_sheet_name))
|
||||
{
|
||||
if(boost::regex_search(sheet_first.begin(), sheet_first.end(), test_sheet_name))
|
||||
{
|
||||
sheet_first = boost::algorithm::replace_all_copy(sheet_first, L"'", L"''");
|
||||
sheet_first = std::wstring(L"\'") + sheet_first + std::wstring(L"\'");
|
||||
sheet_first = std::wstring(L"'") + sheet_first + std::wstring(L"'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//todooo найти хоть один файл где в апострофах уже есть внутренний не экранированный апостроф
|
||||
//static boost::wregex test_sheet_name1(L"[\']+");
|
||||
//if(boost::regex_search(sheet_first.begin() + 1, sheet_first.end() - 1, test_sheet_name1))
|
||||
//{
|
||||
// sheet_first = boost::algorithm::replace_all_copy(sheet_first.begin()+1, sheet_first.end() - 1 , L"'", L"''");
|
||||
// sheet_first = std::wstring(L"\'") + sheet_first + std::wstring(L"\'");
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
std::wstring sheet_last;
|
||||
if (itabLast != itabFirst)
|
||||
if (tabLast != tabFirst)
|
||||
{
|
||||
sheet_last = tab2sheet_name(itabLast, sheets_names);
|
||||
sheet_last = prefix + tab2sheet_name(tabLast, names);
|
||||
|
||||
if(!boost::regex_search(sheet_last.begin(), sheet_last.end(), correct_sheet_name))
|
||||
{
|
||||
@ -572,20 +554,6 @@ const std::wstring xti_indexes2sheet_name(const short itabFirst, const short ita
|
||||
return sheet_first + sheet_last;
|
||||
}
|
||||
|
||||
const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed, bool full_ref)
|
||||
{
|
||||
std::wstring sheets_prefix = xti2sheets(ixti, xti_parsed);
|
||||
|
||||
if(L"#REF!" == sheets_prefix)
|
||||
{
|
||||
return sheets_prefix;
|
||||
}
|
||||
else if (!sheets_prefix.empty()) sheets_prefix += L"!";
|
||||
else if (sheets_prefix.empty() && full_ref) sheets_prefix += L"#REF!";
|
||||
|
||||
return sheets_prefix + cell_ref;
|
||||
}
|
||||
|
||||
|
||||
} //namespace XMLSTUFF
|
||||
|
||||
|
||||
@ -95,13 +95,7 @@ namespace STR
|
||||
namespace XMLSTUFF
|
||||
{;
|
||||
|
||||
// Makes a new tag and append it to parent (no attributes set)
|
||||
//BiffStructurePtr createElement(const std::wstring & tag_name, BiffStructurePtr & parent);
|
||||
|
||||
const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed, bool full_ref = false);
|
||||
//const unsigned short sheetsnames2ixti(const std::wstring str, MSXML2::IXMLDOMDocumentPtr doc);
|
||||
|
||||
const std::wstring xti_indexes2sheet_name(const short itabFirst, const short itabLast, std::vector<std::wstring>& sheets_names);
|
||||
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix = L"");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ const bool CFRecord::isEOF() const
|
||||
{
|
||||
if(rdPtr > size_)
|
||||
{
|
||||
throw;// EXCEPT::LE::WrongFormatInterpretation(__FUNCTION__);
|
||||
true;//throw;
|
||||
}
|
||||
return rdPtr >= size_;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m
|
||||
Open(file_path, mode);
|
||||
}
|
||||
|
||||
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot)
|
||||
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool bWithRoot)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storage_, streamName);
|
||||
if (!stream) return;
|
||||
@ -105,7 +105,7 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
|
||||
if (withRoot == false)
|
||||
if (bWithRoot == false)
|
||||
{
|
||||
int pos = streamName.find("/");
|
||||
if (pos >= 0)
|
||||
@ -132,9 +132,9 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
|
||||
delete stream;
|
||||
}
|
||||
|
||||
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot)
|
||||
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool bWithRoot, bool bSortFiles)
|
||||
{
|
||||
std::list<std::string> entries, entries_sort;
|
||||
std::list<std::string> entries, entries_files, entries_dir;
|
||||
entries = storage_->entries( path );
|
||||
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
@ -144,27 +144,29 @@ void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOu
|
||||
|
||||
if( storage_->isDirectory( fullname ) )
|
||||
{
|
||||
entries_sort.push_back(name);
|
||||
entries_dir.push_back(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
entries_sort.push_front(name);
|
||||
entries_files.push_front(name);
|
||||
}
|
||||
}
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
for( std::list<std::string>::iterator it = entries_dir.begin(); it != entries_dir.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::string fullname = path + *it;
|
||||
|
||||
if( storage_->isDirectory( fullname ) )
|
||||
{
|
||||
copy( indent + 1, fullname + "/", storageOut, withRoot );
|
||||
}
|
||||
else
|
||||
{
|
||||
copy_stream(fullname, storageOut, withRoot);
|
||||
}
|
||||
copy( indent + 1, fullname + "/", storageOut, bWithRoot, bSortFiles );
|
||||
}
|
||||
if (bSortFiles)
|
||||
{
|
||||
entries_files.sort();
|
||||
//todooo ??? со спецсимволами выше
|
||||
}
|
||||
for( std::list<std::string>::iterator it = entries_files.begin(); it != entries_files.end(); it++ )
|
||||
{
|
||||
std::string fullname = path + *it;
|
||||
|
||||
copy_stream(fullname, storageOut, bWithRoot);
|
||||
}
|
||||
}
|
||||
CFStreamPtr CompoundFile::getWorkbookStream()
|
||||
|
||||
@ -58,14 +58,14 @@ public:
|
||||
|
||||
bool isError();
|
||||
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true);
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool bWithRoot = true, bool bSortFiles = false);
|
||||
|
||||
CFStreamPtr getWorkbookStream ();
|
||||
CFStreamPtr getNamedStream (const std::string& name);
|
||||
|
||||
POLE::Storage *storage_;
|
||||
private:
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true);
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool bWithRoot = true);
|
||||
|
||||
POLE::Stream* openStream (const std::string & stream_name); // Opens a stream in the storage (shall be called not more than once per stream)
|
||||
POLE::Stream* createStream (const std::string & stream_name); // Creates a new stream in the storage
|
||||
@ -73,10 +73,11 @@ private:
|
||||
CFStreamPtr createNamedStream (const std::string& name);
|
||||
void closeNamedStream (const std::string& name);
|
||||
|
||||
private:
|
||||
std::map<std::string, CFStreamPtr> streams;
|
||||
ReadWriteMode rwMode;
|
||||
};
|
||||
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
|
||||
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -32,14 +32,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/BookExt_Conditional11.h>
|
||||
#include <Logic/Biff_structures/BookExt_Conditional12.h>
|
||||
|
||||
#include "../Biff_structures/BookExt_Conditional11.h"
|
||||
#include "../Biff_structures/BookExt_Conditional12.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of BookExt record in BIFF8
|
||||
class BookExt: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(BookExt)
|
||||
@ -49,13 +47,11 @@ public:
|
||||
~BookExt();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeBookExt;
|
||||
static const ElementType type = typeBookExt;
|
||||
|
||||
//-----------------------------
|
||||
_UINT32 cb;
|
||||
|
||||
bool fDontAutoRecover;
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "CRN.h"
|
||||
#include <Logic/Biff_structures/SerAr.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -40,12 +39,10 @@ CRN::CRN()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CRN::~CRN()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr CRN::clone()
|
||||
{
|
||||
return BaseObjectPtr(new CRN(*this));
|
||||
@ -55,10 +52,12 @@ BaseObjectPtr CRN::clone()
|
||||
void CRN::readFields(CFRecord& record)
|
||||
{
|
||||
record >> colLast >> colFirst >> row;
|
||||
|
||||
for(int i = 0; i < colLast - colFirst + 1; ++i)
|
||||
{
|
||||
unsigned char rec_type;
|
||||
record >> rec_type;
|
||||
|
||||
SerArPtr ser(SerAr::createSerAr(rec_type));
|
||||
record >> *ser;
|
||||
crnOper.push_back(ser);
|
||||
|
||||
@ -32,13 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/SerAr.h>
|
||||
#include "../Biff_structures/SerAr.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of CRN record in BIFF8
|
||||
class CRN: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(CRN)
|
||||
@ -48,18 +46,16 @@ public:
|
||||
~CRN();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeCRN;
|
||||
static const ElementType type = typeCRN;
|
||||
|
||||
//-----------------------------
|
||||
unsigned char colLast;
|
||||
unsigned char colFirst;
|
||||
_UINT16 row;
|
||||
|
||||
BiffStructurePtrVector crnOper;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -53,7 +53,10 @@ BaseObjectPtr CodeName::clone()
|
||||
|
||||
void CodeName::readFields(CFRecord& record)
|
||||
{
|
||||
XLUnicodeString codeName;
|
||||
record >> codeName;
|
||||
|
||||
value = codeName.value();
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -37,8 +37,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of CodeName record in BIFF8
|
||||
class CodeName: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(CodeName)
|
||||
@ -49,14 +47,11 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeCodeName;
|
||||
|
||||
//-----------------------------
|
||||
XLUnicodeString codeName;
|
||||
static const ElementType type = typeCodeName;
|
||||
|
||||
std::wstring value;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
ExternName::ExternName(const unsigned short supporting_link_type)
|
||||
: supbook_cch(supporting_link_type), cf(0)
|
||||
ExternName::ExternName(const unsigned short supporting_link_type, bool bOle)
|
||||
: supbook_cch(supporting_link_type), cf(-1), bOleVirtualPath(bOle)
|
||||
{
|
||||
}
|
||||
|
||||
@ -70,53 +70,40 @@ void ExternName::readFields(CFRecord& record)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fOle && !fOleLink) // DDE data item
|
||||
if(fOle && !fOleLink)
|
||||
{
|
||||
body = BiffStructurePtr(new ExternDdeLinkNoOper);
|
||||
}
|
||||
if(!fOle && fOleLink) // DDE data item
|
||||
if(!fOle && fOleLink)
|
||||
{
|
||||
body = BiffStructurePtr(new ExternOleDdeLink);
|
||||
}
|
||||
// Nu i kak ya dolzhen opredelit', DDE eto ili OLE?!!!
|
||||
// V Mikrosofte vse ebanutye - pust' sami parsyat, debily
|
||||
if(!fOle && !fOleLink)
|
||||
{
|
||||
body = BiffStructurePtr(new ExternDocName);
|
||||
}
|
||||
// This fills in the gaps between AddinUdfs if the body is not AddinUdf. The simplest way to maintain indexing from my point of view.
|
||||
}
|
||||
body->load(record);
|
||||
|
||||
if(0x3A01 != supbook_cch)
|
||||
{
|
||||
std::wstring name;
|
||||
if(!fOle && !fOleLink)
|
||||
{
|
||||
ExternDocName* n = dynamic_cast<ExternDocName*>(body.get());
|
||||
|
||||
if (n->ixals > 0)
|
||||
if (bOleVirtualPath)
|
||||
{
|
||||
//from SupBook
|
||||
body = BiffStructurePtr(new ExternOleDdeLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = n->nameDefinition.getAssembledFormula();
|
||||
if (name.empty())
|
||||
name = n->extName.value();
|
||||
body = BiffStructurePtr(new ExternDocName);
|
||||
}
|
||||
}
|
||||
if(fOle && !fOleLink) // DDE data item
|
||||
{
|
||||
ExternDdeLinkNoOper* n = dynamic_cast<ExternDdeLinkNoOper*>(body.get());
|
||||
name = n->linkName.value();
|
||||
}
|
||||
if(!fOle && fOleLink)
|
||||
{
|
||||
ExternOleDdeLink* n = dynamic_cast<ExternOleDdeLink*>(body.get());
|
||||
name = n->linkName.value();
|
||||
}
|
||||
record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
|
||||
}
|
||||
body->load(record);
|
||||
|
||||
|
||||
//cache
|
||||
switch(cf)
|
||||
{
|
||||
case 0: // is text
|
||||
break;
|
||||
case 5: //csv (,)
|
||||
case 6: //Microsoft Symbolic Link (SYLK).
|
||||
case 8: //biff8
|
||||
case 44: //unicode text
|
||||
case 63: //biff12
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,11 +48,10 @@ class ExternName: public BiffRecord
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ExternName)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(ExternName)
|
||||
public:
|
||||
ExternName(const unsigned short supporting_link_type);
|
||||
ExternName(const unsigned short supporting_link_type, bool bOle);
|
||||
~ExternName();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
@ -64,24 +63,13 @@ public:
|
||||
bool fWantPict;
|
||||
bool fOle;
|
||||
bool fOleLink;
|
||||
_UINT16 cf;
|
||||
short cf;
|
||||
bool fIcon;
|
||||
BiffStructurePtr body;
|
||||
|
||||
//-----------------------------
|
||||
_UINT16 supbook_cch;
|
||||
|
||||
//if(0x3A01 == supbook_cch)
|
||||
//{
|
||||
// if(!body)
|
||||
// {
|
||||
// body = BiffStructurePtr(new AddinUdf);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//}
|
||||
|
||||
_UINT16 supbook_cch;
|
||||
bool bOleVirtualPath;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<ExternName> ExternNamePtr;
|
||||
|
||||
@ -58,14 +58,14 @@ void ExternSheet::readFields(CFRecord& record)
|
||||
if (record.getGlobalWorkbookInfo()->Version < 0x0600)
|
||||
{
|
||||
unsigned char type;
|
||||
//record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
|
||||
ShortXLAnsiString stName;
|
||||
record >> type >> stName;
|
||||
|
||||
std::wstring name = stName.value();
|
||||
//int type = stName.value().substr(0, 1).c_str()[0];
|
||||
if (!name.empty())
|
||||
record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
|
||||
name = stName.value();
|
||||
//int type = stName.value().substr(0, 1).c_str()[0];
|
||||
//if (!name.empty())
|
||||
// record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@ -32,13 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/XTI.h>
|
||||
#include "../Biff_structures/XTI.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of ExternSheet record in BIFF8
|
||||
class ExternSheet: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ExternSheet)
|
||||
@ -48,15 +46,15 @@ public:
|
||||
~ExternSheet();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeExternSheet;
|
||||
static const ElementType type = typeExternSheet;
|
||||
|
||||
//-----------------------------
|
||||
ForwardOnlyParam<_UINT16> cXTI;
|
||||
BiffStructurePtrVector rgXTI;
|
||||
_UINT16 cXTI;
|
||||
BiffStructurePtrVector rgXTI;
|
||||
//------------------------------------------------
|
||||
std::wstring name; //biff5
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -67,8 +67,12 @@ void MsoDrawing::readFields()
|
||||
rgChildRec.rh_own.recLen = stored_record->getDataSize();
|
||||
|
||||
rgChildRec.loadFields(*stored_record);
|
||||
|
||||
if (stored_record->getRdPtr() < stored_record->getDataSize())
|
||||
{
|
||||
int g = 0;
|
||||
}
|
||||
}
|
||||
|
||||
isReading = true;
|
||||
}
|
||||
|
||||
@ -77,6 +81,11 @@ void MsoDrawing::readFields(CFRecord& record)
|
||||
record >> rgChildRec;
|
||||
|
||||
isReading = true;
|
||||
|
||||
if (record.getRdPtr() < record.getDataSize())
|
||||
{
|
||||
int g = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ BaseObjectPtr ObProj::clone()
|
||||
|
||||
void ObProj::readFields(CFRecord& record)
|
||||
{
|
||||
// the tag doesn't contain data
|
||||
//vba present in file .. выше .. по наличию собствено стороджа
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of ObProj record in BIFF8
|
||||
class ObProj: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ObProj)
|
||||
@ -47,13 +45,10 @@ public:
|
||||
~ObProj();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeObProj;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -57,9 +57,9 @@
|
||||
#define OBJ_Label 0x000E
|
||||
#define OBJ_DialogBox 0x000F
|
||||
#define OBJ_SpinControl 0x0010
|
||||
#define OBJ_Scrollbar 0x0011
|
||||
#define OBJ_List 0x0012
|
||||
#define OBJ_GroupBox 0x0013
|
||||
#define OBJ_Scrollbar 0x0011
|
||||
#define OBJ_DropdownList 0x0014
|
||||
#define OBJ_Note 0x0019
|
||||
|
||||
@ -80,7 +80,6 @@ BaseObjectPtr Obj::clone()
|
||||
void Obj::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cmo;
|
||||
size_t rdPtr = record.getRdPtr();
|
||||
|
||||
if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
|
||||
{
|
||||
@ -88,62 +87,74 @@ void Obj::readFields(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(6); // Skip FtGmo (obsolete)
|
||||
}
|
||||
if(OBJ_Picture == cmo.ot)
|
||||
if( OBJ_Picture == cmo.ot)
|
||||
{
|
||||
record >> pictFormat;
|
||||
record >> pictFlags;
|
||||
}
|
||||
if(0x0B == cmo.ot || 0x0C == cmo.ot)
|
||||
if( OBJ_CheckBox == cmo.ot ||
|
||||
OBJ_RadioButton == cmo.ot)
|
||||
{
|
||||
record.skipNunBytes(16); // Skip FtCbls (obsolete)
|
||||
}
|
||||
if(0x0C == cmo.ot)
|
||||
if( OBJ_RadioButton == cmo.ot)
|
||||
{
|
||||
record.skipNunBytes(10); // Skip FtRbo (obsolete)
|
||||
}
|
||||
if(0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot || 0x14 == cmo.ot)
|
||||
if( OBJ_SpinControl == cmo.ot ||
|
||||
OBJ_Scrollbar == cmo.ot ||
|
||||
OBJ_List == cmo.ot ||
|
||||
OBJ_DropdownList == cmo.ot)
|
||||
{
|
||||
record >> sbs;
|
||||
}
|
||||
if(0x19 == cmo.ot)
|
||||
if( OBJ_Note == cmo.ot)
|
||||
{
|
||||
record >> nts;
|
||||
}
|
||||
//if(false) // TODO: Find out the condition
|
||||
//{
|
||||
// macro.load(record);
|
||||
//}
|
||||
|
||||
if(0x0B == cmo.ot || 0x0C == cmo.ot || 0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot /*|| 0x14 == cmo.ot*/)
|
||||
macro.load(record);
|
||||
|
||||
if( OBJ_Picture == cmo.ot)
|
||||
{
|
||||
pictFmla.load(record, pictFlags);
|
||||
}
|
||||
if( OBJ_CheckBox == cmo.ot ||
|
||||
OBJ_RadioButton == cmo.ot ||
|
||||
OBJ_SpinControl == cmo.ot ||
|
||||
OBJ_Scrollbar == cmo.ot ||
|
||||
OBJ_List == cmo.ot /*|| OBJ_DropdownList == cmo.ot*/)
|
||||
{
|
||||
linkFmla.load(record);
|
||||
}
|
||||
if(0x0B == cmo.ot || 0x0C == cmo.ot)
|
||||
if( OBJ_CheckBox == cmo.ot ||
|
||||
OBJ_RadioButton == cmo.ot)
|
||||
{
|
||||
checkBox.load(record);
|
||||
}
|
||||
if(0x0C == cmo.ot)
|
||||
if( OBJ_RadioButton == cmo.ot)
|
||||
{
|
||||
radioButton.load(record);
|
||||
}
|
||||
if(0x0D == cmo.ot)
|
||||
if( OBJ_EditBox == cmo.ot)
|
||||
{
|
||||
edit.load(record);
|
||||
}
|
||||
if(0x12 == cmo.ot || 0x14 == cmo.ot)
|
||||
if( OBJ_List == cmo.ot ||
|
||||
OBJ_DropdownList == cmo.ot)
|
||||
{
|
||||
list.load(record, cmo.ot);
|
||||
}
|
||||
if(0x13 == cmo.ot)
|
||||
if( OBJ_GroupBox == cmo.ot)
|
||||
{
|
||||
gbo.load(record);
|
||||
}
|
||||
|
||||
if(0x12 != cmo.ot && 0x14 != cmo.ot)
|
||||
}
|
||||
if( OBJ_List != cmo.ot && OBJ_DropdownList != cmo.ot)
|
||||
{
|
||||
record.skipNunBytes(4); // reserved
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
if (continue_records.size() > 0)
|
||||
{
|
||||
std::list<CFRecordPtr>& recs = continue_records[rt_Continue];
|
||||
|
||||
@ -32,27 +32,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecordContinued.h"
|
||||
#include "MsoDrawing.h"
|
||||
|
||||
#include <Logic/Biff_structures/FtCmo.h>
|
||||
#include <Logic/Biff_structures/FtCf.h>
|
||||
#include <Logic/Biff_structures/FtPioGrbit.h>
|
||||
#include <Logic/Biff_structures/FtSbs.h>
|
||||
#include <Logic/Biff_structures/FtNts.h>
|
||||
#include <Logic/Biff_structures/FtMacro.h>
|
||||
#include <Logic/Biff_structures/FtPictFmla.h>
|
||||
#include <Logic/Biff_structures/ObjLinkFmla.h>
|
||||
#include <Logic/Biff_structures/FtCblsData.h>
|
||||
#include <Logic/Biff_structures/FtRboData.h>
|
||||
#include <Logic/Biff_structures/FtEdoData.h>
|
||||
#include <Logic/Biff_structures/FtLbsData.h>
|
||||
#include <Logic/Biff_structures/FtGboData.h>
|
||||
|
||||
#include <Logic/Biff_records/MsoDrawing.h>
|
||||
#include "../Biff_structures/FtCmo.h"
|
||||
#include "../Biff_structures/FtCf.h"
|
||||
#include "../Biff_structures/FtPioGrbit.h"
|
||||
#include "../Biff_structures/FtSbs.h"
|
||||
#include "../Biff_structures/FtNts.h"
|
||||
#include "../Biff_structures/FtMacro.h"
|
||||
#include "../Biff_structures/FtPictFmla.h"
|
||||
#include "../Biff_structures/ObjLinkFmla.h"
|
||||
#include "../Biff_structures/FtCblsData.h"
|
||||
#include "../Biff_structures/FtRboData.h"
|
||||
#include "../Biff_structures/FtEdoData.h"
|
||||
#include "../Biff_structures/FtLbsData.h"
|
||||
#include "../Biff_structures/FtGboData.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
// Logical representation of Obj record in BIFF8
|
||||
class Obj : public BiffRecordContinued
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Obj)
|
||||
@ -65,11 +63,10 @@ public:
|
||||
~Obj();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeObj;
|
||||
static const ElementType type = typeObj;
|
||||
|
||||
//-----------------------------
|
||||
FtCmo cmo;
|
||||
@ -104,8 +101,6 @@ public:
|
||||
_UINT16 flag;
|
||||
_UINT16 flag2;
|
||||
}old_version;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -39,12 +39,10 @@ Pls::Pls()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Pls::~Pls()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr Pls::clone()
|
||||
{
|
||||
return BaseObjectPtr(new Pls());
|
||||
@ -71,9 +69,9 @@ void Pls::readFields(CFRecord& record)
|
||||
}
|
||||
|
||||
int size = record.getDataSize() - 2;
|
||||
const char* data = record.getData() + 2;
|
||||
const BYTE* data = (BYTE*)record.getData() + 2;
|
||||
|
||||
boost::shared_array<char> buffer(new char[size]);
|
||||
boost::shared_array<BYTE> buffer(new BYTE[size]);
|
||||
memcpy(buffer.get(), data, size);
|
||||
|
||||
bin_data_id = -1;
|
||||
@ -81,7 +79,7 @@ void Pls::readFields(CFRecord& record)
|
||||
GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get();
|
||||
if (globla_info)
|
||||
{
|
||||
globla_info->bin_data.push_back(std::pair<boost::shared_array<char>, size_t>(buffer, size));
|
||||
globla_info->bin_data.push_back(std::pair<boost::shared_array<BYTE>, size_t>(buffer, size));
|
||||
|
||||
bin_data_id = globla_info->bin_data.size() - 1;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/Biff_records/BiffRecordContinued.h>
|
||||
#include "BiffRecordContinued.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
|
||||
@ -109,9 +109,7 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of Pls record in BIFF8
|
||||
class Pls : public BiffRecordContinued
|
||||
class Pls : public BiffRecordContinued
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Pls)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(Pls)
|
||||
|
||||
@ -32,14 +32,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include <Logic/Biff_structures/RkRec.h>
|
||||
#include <Logic/Biff_structures/Cell.h>
|
||||
#include "../Biff_structures/RkRec.h"
|
||||
#include "../Biff_structures/Cell.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of RK record in BIFF8
|
||||
class RK: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(RK)
|
||||
@ -49,7 +47,6 @@ public:
|
||||
~RK();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user