Compare commits

..

13 Commits

Author SHA1 Message Date
597414ea6b DocFormatFile - fix users file (1995) without codepage 2017-12-26 13:08:02 +03:00
7f06ce7064 . 2017-12-26 11:21:39 +03:00
adf39680b6 OdfFormatWriter - extendede condition conditional formatting (x14) 2017-12-25 20:06:22 +03:00
ce77d478e3 x2t version 2.4.498 2017-12-25 15:42:59 +03:00
e1e14ae243 . 2017-12-25 13:52:57 +03:00
4f6e364225 . 2017-12-25 13:48:50 +03:00
26c02c5766 . 2017-12-23 19:33:05 +03:00
0d8c668f95 OdfFormat, fix bug 36596 (only for onlyoffice editors) 2017-12-23 17:34:20 +03:00
310cff0dfe change non-defined temp directory to unique 2017-12-23 14:48:44 +03:00
7f6611ab21 .. 2017-12-23 14:35:52 +03:00
bb37e348f5 . 2017-12-23 13:26:11 +03:00
6b5e03df5e . 2017-12-23 12:29:40 +03:00
d0e0109560 . 2017-12-22 15:10:45 +03:00
92 changed files with 1063 additions and 598 deletions

View File

@ -47,30 +47,17 @@ namespace DocFileFormat
virtual ~ConversionContext()
{
}
// Adds a new RSID to the set
inline void AddRsid(const std::wstring& rsid)
{
if (AllRsids.find(rsid) == AllRsids.end())
AllRsids.insert(rsid);
}
inline WordDocument* GetDocument()
{
return _doc;
}
inline WordprocessingDocument* GetXmlDocument()
{
return _docx;
}
public:
WordprocessingDocument* _docx;
WordDocument* _doc;
/// A set thta contains all revision ids.
std::set<std::wstring> AllRsids;
};
}

View File

@ -63,8 +63,16 @@ namespace DocFileFormat
{
long Converter::Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress)
{
if (!doc || !docx) return S_FALSE;
ConversionContext context( doc, docx );
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
doc->FontTable->Convert( &fontTableMapping );
}
//Write styles.xml
if (doc->Styles)
{
@ -107,14 +115,6 @@ namespace DocFileFormat
return S_FALSE;
}
}
//Write fontTable.xml
if (doc->FontTable)
{
FontTableMapping fontTableMapping( &context );
doc->FontTable->Convert( &fontTableMapping );
}
if ( progress != NULL )
{
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 875000 );

View File

@ -48,7 +48,8 @@ namespace DocFileFormat
class FontFamilyName: public ByteStructure
{
friend class CharacterPropertiesMapping;
friend class WordDocument;
friend class CharacterPropertiesMapping;
friend class DocumentMapping;
friend class FontTableMapping;
friend class StyleSheetMapping;

View File

@ -34,32 +34,30 @@
namespace DocFileFormat
{
FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
FontTableMapping::FontTableMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() )
{
_ctx = ctx;
}
/*========================================================================================================*/
FontTableMapping::~FontTableMapping()
{
RELEASEOBJECT (m_pXmlWriter);
}
/*========================================================================================================*/
void FontTableMapping::Apply( IVisitable* visited )
{
StringTable<FontFamilyName>* table = static_cast<StringTable<FontFamilyName>*>( visited );
this->_ctx->_docx->RegisterFontTable();
_ctx->_docx->RegisterFontTable();
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
m_pXmlWriter->WriteNodeBegin( L"w:fonts", TRUE );
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
int sz_fonts = table->Data.size();
int sz_fonts = table->Data.size();
int users_fonts = 0;
for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ )
@ -140,6 +138,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( L"w:fonts");
this->_ctx->_docx->FontTableXML = std::wstring( m_pXmlWriter->GetXmlString() );
_ctx->_docx->FontTableXML = m_pXmlWriter->GetXmlString() ;
}
}

View File

@ -38,8 +38,8 @@ namespace DocFileFormat
{
if (m_context)
{
m_document = m_context->GetDocument();
m_xmldocument = m_context->GetXmlDocument();
m_document = m_context->_doc;
m_xmldocument = m_context->_docx;
}
}

View File

@ -41,6 +41,7 @@ namespace DocFileFormat
{
template<class T> class StringTable: public IVisitable
{
friend class WordDocument;
friend class CharacterPropertiesMapping;
friend class FontTableMapping;
friend class StyleSheetMapping;

View File

@ -40,8 +40,45 @@
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
#include <unordered_map>
namespace DocFileFormat
{
static const int aCodePages[][2] = {
//charset codepage
0, 1252, //ANSI
1, 0,//Default
2, 42,//Symbol
77, 10000,//Mac Roman
78, 10001,//Mac Shift Jis
79, 10003,//Mac Hangul
80, 10008,//Mac GB2312
81, 10002,//Mac Big5
83, 10005,//Mac Hebrew
84, 10004,//Mac Arabic
85, 10006,//Mac Greek
86, 10081,//Mac Turkish
87, 10021,//Mac Thai
88, 10029,//Mac East Europe
89, 10007,//Mac Russian
128, 932,//Shift JIS
129, 949,//Hangul
130, 1361,//Johab
134, 936,//GB2312
136, 950,//Big5
238, 1250,//Greek
161, 1253,//Greek
162, 1254,//Turkish
163, 1258,//Vietnamese
177, 1255,//Hebrew
178, 1256, //Arabic
186, 1257,//Baltic
204, 1251,//Russian
222, 874,//Thai
238, 1250,//Eastern European
254, 437,//PC 437
255, 850//OEM
};
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder ) :
m_PieceTable(NULL), WordDocumentStream(NULL), TableStream(NULL), DataStream(NULL), FIB(NULL),
Text(NULL), RevisionAuthorTable(NULL), FontTable(NULL), BookmarkNames(NULL), AutoTextNames(NULL),
@ -55,12 +92,15 @@ namespace DocFileFormat
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL),
AnnotStartPlex(NULL), AnnotEndPlex(NULL), encryptionHeader(NULL)
{
m_pCallFunc = pCallFunc;
m_sTempFolder = sTempFolder;
m_pCallFunc = pCallFunc;
m_sTempFolder = sTempFolder;
m_pStorage = NULL;
officeArtContent = NULL;
bOlderVersion = false;
m_pStorage = NULL;
officeArtContent = NULL;
bOlderVersion = false;
bDocumentCodePage = false;
nDocumentCodePage = ENCODING_WINDOWS_1250;
}
WordDocument::~WordDocument()
@ -178,8 +218,6 @@ namespace DocFileFormat
m_pStorage->GetStream (L"SummaryInformation", &Summary);
m_pStorage->GetStream (L"DocumentSummaryInformation", &DocSummary);
document_code_page = ENCODING_WINDOWS_1250;
if ((Summary) && (Summary->size() > 0))
{
@ -188,7 +226,10 @@ namespace DocFileFormat
int document_code_page1 = summary_info.GetCodePage(); //from software last open
if (document_code_page1 > 0)
document_code_page = document_code_page1;
{
nDocumentCodePage = document_code_page1;
bDocumentCodePage = true;
}
}
if ((DocSummary) && (DocSummary->size() > 0))
{
@ -197,12 +238,18 @@ namespace DocFileFormat
int document_code_page2 = doc_summary_info.GetCodePage();
if (document_code_page2 > 0)
document_code_page = document_code_page2;
{
nDocumentCodePage = document_code_page2;
bDocumentCodePage = true;
}
}
if (!bOlderVersion)
document_code_page = ENCODING_UTF16;
{
nDocumentCodePage = ENCODING_UTF16;
bDocumentCodePage = true;
}
FIB->m_CodePage = document_code_page;
FIB->m_CodePage = nDocumentCodePage;
//-------------------------------------------------------------------------------------------------
try
{
@ -353,6 +400,31 @@ namespace DocFileFormat
return AVS_ERROR_FILEFORMAT;
}
}
if (!bDocumentCodePage && FontTable)
{
std::unordered_map<int, int> fonts_charsets;
for ( std::vector<ByteStructure*>::iterator iter = FontTable->Data.begin();!bDocumentCodePage && iter != FontTable->Data.end(); iter++ )
{
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
if (!font) continue;
if (fonts_charsets.find(font->chs) == fonts_charsets.end())
{
fonts_charsets.insert(std::make_pair(font->chs, font->ff));
for (int i = 0 ; i < sizeof(aCodePages) / 2; i++)
{
if (aCodePages[i][0] == font->chs && font->chs != 0)
{
nDocumentCodePage = aCodePages[i][1];
bDocumentCodePage = true;
break;
}
}
}
}
}
if (FIB->m_FibWord97.lcbClx > 0)
{
@ -371,7 +443,7 @@ namespace DocFileFormat
WordDocumentStream->read (bytes, cb);
Text = new std::vector<wchar_t>();
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, document_code_page);
FormatUtils::GetSTLCollectionFromBytes<std::vector<wchar_t> >(Text, bytes, cb, nDocumentCodePage);
RELEASEARRAYOBJECTS(bytes);
}

View File

@ -69,7 +69,6 @@ namespace DocFileFormat
{
class WordDocument: public IVisitable
{
/*Mapping classes with direct access to the Word Document.*/
friend class FootnotesMapping;
friend class EndnotesMapping;
friend class CommentsMapping;
@ -98,7 +97,8 @@ namespace DocFileFormat
long LoadDocument (const std::wstring & fileName, const std::wstring & password);
bool bOlderVersion;
int document_code_page;
int nDocumentCodePage;
bool bDocumentCodePage;
inline StructuredStorageReader* GetStorage() const
{

View File

@ -67,7 +67,7 @@
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMT.lib"
IgnoreDefaultLibraryNames="LIBCMTD.lib"
IgnoreEmbeddedIDL="true"
GenerateDebugInformation="true"
SubSystem="1"

View File

@ -103,7 +103,7 @@ public:
reset_fill(l.fill_);
//floor_.content_= l;
}
void set_legend(odf_reader::chart::simple & l)
void set_legend(odf_reader::chart::legend & l)
{
reset_fill(l.fill_);
legend_.content_= l;

View File

@ -52,10 +52,9 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:legend")
{
CP_XML_NODE(L"c:legendPos")
{
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
CP_XML_ATTR(L"val", content_.position);
}
layout_.oox_serialize(CP_XML_STREAM());

View File

@ -48,7 +48,7 @@ public:
void oox_serialize(std::wostream & _Wostream);
odf_reader::chart::simple content_;
odf_reader::chart::legend content_;
private:
cpdoccore::oox::oox_layout layout_; //layout (Layout) §21.2.2.88

View File

@ -762,6 +762,28 @@ void process_build_object::visit(const chart_footer& val)
void process_build_object::visit(const chart_legend& val)
{
object_odf_context_.legend_.bEnabled = true;
object_odf_context_.legend_.position = L"r";
if (val.attlist_.chart_legend_position_)
{
std::wstring pos = val.attlist_.chart_legend_position_.get();
if ( pos == L"bottom") object_odf_context_.legend_.position = L"b";
if ( pos == L"start") object_odf_context_.legend_.position = L"l";
if ( pos == L"top") object_odf_context_.legend_.position = L"t";
if ( pos == L"top-end") object_odf_context_.legend_.position = L"tr";
if ( pos == L"top-start") object_odf_context_.legend_.position = L"tl";
if ( pos == L"bottom-start") object_odf_context_.legend_.position = L"bl";
if ( pos == L"bottom-end") object_odf_context_.legend_.position = L"br";
}
if (val.attlist_.chart_legend_align_)
{
std::wstring align = val.attlist_.chart_legend_align_.get();
//if ( pos == L"start") object_odf_context_.legend_.align = L"b";
//if ( pos == L"center") object_odf_context_.legend_.align = L"l";
//if ( pos == L"end") object_odf_context_.legend_.align = L"t";
}
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);

View File

@ -188,7 +188,7 @@ public:
office_element_ptr_array title_odf_context_;
chart::title sub_title_;
chart::simple legend_;
chart::legend legend_;
chart::plot_area plot_area_;
chart::simple wall_;

View File

@ -76,6 +76,7 @@ namespace chart {
struct simple
{
simple() : bEnabled(false) {}
bool bEnabled;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
@ -92,6 +93,11 @@ namespace chart {
treadline(){bEquation = false; bREquation = false;}
};
struct legend : public simple
{
std::wstring position;
std::wstring align;
};
struct plot_area : public simple
{
std::wstring cell_range_address_;

View File

@ -58,6 +58,9 @@ std::wostream & operator << (std::wostream & _Wostream, const calcext_type & _Va
break;
case calcext_type::Minimum:
_Wostream << L"minimum";
break;
case calcext_type::Percentile:
_Wostream << L"percentile";
break;
default:
break;
@ -84,6 +87,8 @@ calcext_type calcext_type::parse(const std::wstring & Str)
return calcext_type( Minimum );
else if (tmp == L"formula")
return calcext_type( Formula );
else if (tmp == L"percentile")
return calcext_type( Percentile );
else
{
return calcext_type( Number );

View File

@ -49,7 +49,8 @@ public:
Minimum,
AutoMaximum,
AutoMinimum,
Formula
Formula,
Percentile
};
calcext_type() {}

View File

@ -72,7 +72,6 @@ class common_chart_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_style_name_;
};
@ -117,7 +116,6 @@ class chart_title_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) table_cell_range_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
@ -194,13 +192,13 @@ class chart_legend_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_legend_position_;
_CP_OPT(std::wstring) chart_legend_align_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
_CP_OPT(std::wstring) style_legend_expansion_;
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
common_chart_attlist common_attlist_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
};

View File

@ -67,10 +67,11 @@ void table_format_properties::add_attributes( const xml::attributes_wc_ptr & Att
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"style:may-break-between-rows", style_may_break_between_rows_);
CP_APPLY_ATTR(L"table:align", table_align_);
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
CP_APPLY_ATTR(L"table:align", table_align_);
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
CP_APPLY_ATTR(L"style:use-optimal-column-width",style_use_optimal_column_width_);
}
bool table_format_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
@ -94,17 +95,22 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (style_rel_width_)
{
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
}
else if (style_width_)
else if (style_use_optimal_column_width_)
{
_tblPr << L"<w:tblW w:type=\"auto\" w:w=\"0\"/>";
}
else if (style_width_)
{
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
if (w_w > 31680)w_w = 31680;
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
}
else
{
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\"/>";
}
if (common_break_attlist_.fo_break_before_)
@ -127,23 +133,26 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
{
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\"/>";
}
}
else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
_tblPr << L"<w:jc w:val=\"" << w_val << "\"/>";
}
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
if (!style_use_optimal_column_width_)
{
_tblPr << "<w:tblLayout w:type=\"fixed\"/>";
}
if (common_background_color_attlist_.fo_background_color_)
{
const std::wstring w_fill = (common_background_color_attlist_.fo_background_color_->get_type() == background_color::Enabled
? common_background_color_attlist_.fo_background_color_->get_color().get_hex_value() : L"auto");
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\" />";
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\"/>";
}
}

View File

@ -79,7 +79,6 @@ public:
_CP_OPT(odf_types::length) style_width_;
_CP_OPT(odf_types::percent) style_rel_width_;
office_element_ptr style_background_image_;
_CP_OPT(bool) style_may_break_between_rows_;
_CP_OPT(odf_types::border_model) table_border_model_;
@ -87,6 +86,8 @@ public:
_CP_OPT(bool) table_display_;
_CP_OPT(odf_types::color) tableooo_tab_color_;
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_; //not specification
office_element_ptr style_background_image_;
};
class style_table_properties : public office_element_impl<style_table_properties>

View File

@ -337,23 +337,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
}
else
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
/*
if (CP_CHECK_NAME(L"table", L"table-column-group") && type_ != 1)
{
type_ = 0;
CP_CREATE_ELEMENT_SIMPLE(table_table_column_group_);
}
else if (( CP_CHECK_NAME(L"table", L"table-columns") ||
CP_CHECK_NAME(L"table", L"table-column") ||
CP_CHECK_NAME(L"table", L"table-header-columns") )
&& type_ != 0)
{
type_ = 1;
table_columns_no_group_.add_child_element(Reader, Ns, Name, Context);
}
else
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
*/
}
//////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -164,7 +164,6 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
if (inst && inst->content())
inst->content()->docx_convert(Context);
Context.get_styles_context().docx_serialize_table_style(_Wostream, Context.get_text_tracked_context().dumpTblPr_);
_Wostream << L"<w:tblGrid>";

View File

@ -49,6 +49,7 @@
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\OdfFileWriterTest.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -450,6 +451,14 @@
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
</Filter>
</Filter>

View File

@ -140,7 +140,7 @@ void calcext_data_bar::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_data_bar_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < content_.size(); i++)
{
@ -170,6 +170,7 @@ void calcext_color_scale::serialize(std::wostream & _Wostream)
{
for (size_t i = 0; i < content_.size(); i++)
{
if (!content_[i]) continue;
content_[i]->serialize(CP_XML_STREAM());
}
}
@ -194,7 +195,7 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_icon_set_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < content_.size(); i++)
{
@ -206,8 +207,8 @@ void calcext_icon_set::serialize(std::wostream & _Wostream)
// calcext_formatting_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_formatting_entry::ns = L"calcext";
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
const wchar_t * calcext_formatting_entry::ns = L"calcext";
const wchar_t * calcext_formatting_entry::name = L"formatting-entry";
void calcext_formatting_entry::serialize(std::wostream & _Wostream)
{
@ -223,8 +224,8 @@ void calcext_formatting_entry::serialize(std::wostream & _Wostream)
// calcext_color_scale_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
const wchar_t * calcext_color_scale_entry::name = L"color_scale_entry";
const wchar_t * calcext_color_scale_entry::ns = L"calcext";
const wchar_t * calcext_color_scale_entry::name = L"color-scale-entry";
void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
{
@ -240,7 +241,7 @@ void calcext_color_scale_entry::serialize(std::wostream & _Wostream)
}
// calcext_condition
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * calcext_condition::ns = L"calcext";
const wchar_t * calcext_condition::ns = L"calcext";
const wchar_t * calcext_condition::name = L"condition";
void calcext_condition::serialize(std::wostream & _Wostream)
@ -249,7 +250,7 @@ void calcext_condition::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_condition_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
}
}
}
@ -264,7 +265,7 @@ void calcext_date_is::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
calcext_date_is_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
}
}
}

View File

@ -88,7 +88,7 @@ public:
};
//////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief calcext:color-scale-entry
/// calcext:color-scale-entry
class calcext_color_scale_entry : public office_element_impl<calcext_color_scale_entry>
{
public:
@ -104,13 +104,13 @@ public:
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(odf_types::color) calcext_color_;
_CP_OPT(std::wstring) calcext_value_;
_CP_OPT(std::wstring) calcext_value_;
_CP_OPT(odf_types::calcext_type) calcext_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale_entry);
/// \brief calcext:formatting-entry
/// calcext:formatting-entry
class calcext_formatting_entry : public office_element_impl<calcext_formatting_entry>
{
public:
@ -125,13 +125,13 @@ public:
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(std::wstring) calcext_value_;
_CP_OPT(odf_types::calcext_type) calcext_type_;
_CP_OPT(std::wstring) calcext_value_;
_CP_OPT(odf_types::calcext_type) calcext_type_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_formatting_entry);
/// \brief calcext:icon-set
/// calcext:icon-set
class calcext_icon_set : public office_element_impl<calcext_icon_set>
{
public:
@ -146,15 +146,13 @@ public:
virtual void serialize(std::wostream & _Wostream);
calcext_icon_set_attr calcext_icon_set_attr_;
private:
office_element_ptr_array content_;//entries
calcext_icon_set_attr attr_;
office_element_ptr_array content_;//entries
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_icon_set);
/// \brief calcext:data-bar
/// calcext:data-bar
class calcext_data_bar: public office_element_impl<calcext_data_bar>
{
public:
@ -169,14 +167,12 @@ public:
virtual void serialize(std::wostream & _Wostream);
calcext_data_bar_attr calcext_data_bar_attr_;
private:
office_element_ptr_array content_;//entries
calcext_data_bar_attr attr_;
office_element_ptr_array content_;//entries
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar)
/// \brief calcext:color-scale
/// calcext:color-scale
class calcext_color_scale: public office_element_impl<calcext_color_scale>
{
public:
@ -191,12 +187,11 @@ public:
virtual void serialize(std::wostream & _Wostream);
private:
office_element_ptr_array content_;//color_scale_entries
office_element_ptr_array content_; //color_scale_entries
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_color_scale)
/// \brief calcext:date-is
/// calcext:date-is
class calcext_date_is: public office_element_impl<calcext_date_is>
{
public:
@ -211,11 +206,11 @@ public:
virtual void serialize(std::wostream & _Wostream);
calcext_date_is_attr calcext_date_is_attr_;
calcext_date_is_attr attr_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is)
/// \brief calcext:condition
/// calcext:condition
class calcext_condition: public office_element_impl<calcext_condition>
{
public:
@ -230,11 +225,11 @@ public:
virtual void serialize(std::wostream & _Wostream);
calcext_condition_attr calcext_condition_attr_;
calcext_condition_attr attr_;
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_condition)
/// \brief calcext:conditional-format
/// calcext:conditional-format
class calcext_conditional_format: public office_element_impl<calcext_conditional_format>
{
public:
@ -257,7 +252,7 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(calcext_conditional_format)
/// \brief calcext:conditional-formats
/// calcext:conditional-formats
class calcext_conditional_formats: public office_element_impl<calcext_conditional_formats>
{
public:

View File

@ -86,7 +86,7 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
std::wstring input_path = oox_ref;
#if defined (_WIN32) || defined(_WIN64) // + mac???
#if defined (_WIN32) || defined(_WIN64)
boost::to_lower(input_path);
#endif
@ -100,7 +100,7 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
break;
}
}
if (output_path.length() < 1)
if (output_path.empty())
{
output_path = ( output_sub_path + output_fileName) ;
if ( type == typeImage)

View File

@ -68,8 +68,8 @@ std::wstring create_file_name(const std::wstring & uri, _mediaitems::Type type,
{
std::wstring sExt;
if (type == _mediaitems::typeOleObject &&
type == _mediaitems::typeObjectReplacement)
//if (type == _mediaitems::typeOleObject &&
// type == _mediaitems::typeObjectReplacement)
{
int n = uri.rfind(L".");
if (n >= 0) sExt = uri.substr(n);

View File

@ -39,7 +39,7 @@
#include "../../../DesktopEditor/common/File.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace cpdoccore
{
@ -180,8 +180,8 @@ namespace odf_writer
void media::write(const std::wstring & RootPath)
{
std::wstring path = RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_;
NSDirectory::CreateDirectory(path);
OOX::CPath path (RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_);
NSDirectory::CreateDirectory(path.GetPath());
std::vector< _mediaitems::item > & items = mediaitems_.items();
@ -189,9 +189,10 @@ namespace odf_writer
{
if (items[i].type == type_)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
OOX::CPath file_name_inp ( items[i].oox_ref);
OOX::CPath file_name_out ( RootPath + FILE_SEPARATOR_STR + items[i].odf_ref); //ref содержит уже folder_
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
NSFile::CFileBinary::Copy(file_name_inp.GetPath(), file_name_out.GetPath());
}
}
@ -206,7 +207,7 @@ namespace odf_writer
{
if (mediaitems.count_image > 0)
{
pictures_ = element_ptr( new media(mediaitems, L"Picture", 1) );
pictures_ = element_ptr( new media(mediaitems, L"Pictures", 1) );
}
if (mediaitems.count_media > 0)
{

View File

@ -125,7 +125,7 @@ namespace odf_writer
class odf_chart_context::Impl
{
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
{
styles_context_ = NULL;
current_series_count_ = 0;
@ -151,6 +151,9 @@ public:
std::vector<office_element_ptr> group_series_;
std::vector<unsigned int> axis_group_series_;
_CP_OPT(int) bar_overlap;
_CP_OPT(int) bar_gap_width;
struct _range
{
_range(std::wstring &r, bool l, chart_series *s) : label(l), index_cash(-1), series(s), ref(r) {}
@ -277,6 +280,9 @@ void odf_chart_context::Impl::clear_current()
group_series_.clear();
data_cell_ranges_.clear();
cash_.clear();
bar_gap_width = boost::none;
bar_overlap = boost::none;
current_series_count_ = 0;
local_table_reset_ref_ = false;
@ -335,7 +341,7 @@ void odf_chart_context::start_chart(office_element_ptr & root)
root->add_child_element(chart_elm);
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -427,8 +433,6 @@ void odf_chart_context::set_chart_bar_direction(int type)
}
void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
{
if (!impl_->current_level_.back().chart_properties_) return;
int res = val.find(L"%");
bool percent=false;
@ -438,21 +442,22 @@ void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
percent=true;
}
double dVal = boost::lexical_cast<double>(val);
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = (int)dVal;
impl_->bar_gap_width = (int)dVal;
}
void odf_chart_context::set_chart_bar_overlap(std::wstring val)
{
if (!impl_->current_level_.back().chart_properties_) return;
int res = val.find(L"%");
bool percent=false;
bool percent = false;
if (res > 0)
{
val = val.substr(0,res);
percent=true;
percent = true;
}
double dVal = boost::lexical_cast<double>(val);
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = (int)dVal;
impl_->bar_overlap = (int)dVal;
}
void odf_chart_context::set_chart_stock_candle_stick(bool val)
@ -702,15 +707,17 @@ void odf_chart_context::end_group_series()
std::wstring axis_name;
bool presentZ = false;
long countX = 0;
long countY = 0;
long countZ = 0;
for (size_t j = 0; j < impl_->axis_.size(); j++)
{
if (impl_->axis_[j].dimension ==1) countX++;
else if (impl_->axis_[j].dimension ==3) presentZ = true;
else countY++;
if (impl_->axis_[j].dimension == 1) countX++;
else if (impl_->axis_[j].dimension == 2) countY++;
else if (impl_->axis_[j].dimension == 3) countZ++;
}
if (countX < 1 && countY > 1)
{
impl_->axis_[0].dimension == 1;
@ -718,15 +725,15 @@ void odf_chart_context::end_group_series()
axis->chart_axis_attlist_.chart_dimension_ = L"x";
countY--;
}
if (presentZ == false && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
{
impl_->axis_.back().dimension == 3;
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"z";
countY--;
}
//if (countZ > 0 && impl_->axis_group_series_.size() == 3 && (countY > 1 || countX > 1))
//{
// impl_->axis_.back().dimension == 3;
// chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_.back().elm.get());
// axis->chart_axis_attlist_.chart_dimension_ = L"z";
// countY--;
//}
for (size_t i=0; i < impl_->axis_group_series_.size(); i++)
for (size_t i = 0; i < impl_->axis_group_series_.size(); i++)
{
for (size_t j = 0; j < impl_->axis_.size(); j++)
{
@ -740,7 +747,7 @@ void odf_chart_context::end_group_series()
}
for (size_t i =0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
for (size_t i = 0; i < impl_->group_series_.size() && axis_name.length() > 0; i++)
{
chart_series *series= dynamic_cast<chart_series*>(impl_->group_series_[i].get());
if (series)
@ -796,7 +803,7 @@ void odf_chart_context::start_axis()
chart_axis *axis = dynamic_cast<chart_axis*>(elm.get());
if (axis == NULL)return;
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -810,10 +817,19 @@ void odf_chart_context::start_axis()
}
start_element(elm, style_elm, style_name);
odf_axis_state axis_state={0,0,L"",elm};
odf_axis_state axis_state={0, 0, L"", elm};
impl_->axis_.push_back(axis_state);
/////////////////////defaults
impl_->current_level_.back().chart_properties_->content_.chart_reverse_direction_ = false;
if (impl_->bar_overlap)
{
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = impl_->bar_overlap.get();
}
if (impl_->bar_gap_width)
{
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = impl_->bar_gap_width.get();
}
}
void odf_chart_context::start_grid(int type)
{
@ -826,7 +842,7 @@ void odf_chart_context::start_grid(int type)
if (type == 1) grid->chart_grid_attlist_.chart_class_ = L"major";
if (type == 2) grid->chart_grid_attlist_.chart_class_ = L"minor";
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -850,7 +866,7 @@ void odf_chart_context::start_title()
chart_title *title = dynamic_cast<chart_title*>(chart_elm.get());
if (title == NULL)return;
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -874,7 +890,7 @@ void odf_chart_context::start_plot_area()
plot_area->chart_plot_area_attlist_.chart_data_source_has_labels_ = L"both";
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
@ -911,23 +927,22 @@ void odf_chart_context::start_text()
impl_->odf_context_->start_text_context();
impl_->odf_context_->text_context()->set_styles_context(impl_->styles_context_);
style_text_properties *text_props = NULL;
style *style_ = dynamic_cast<style*>(impl_->current_chart_state_.elements_.back().style_elm.get());
if (style_)
{
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
}
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_level_.back().paragraph_properties_,impl_->current_level_.back().text_properties_);
impl_->odf_context_->text_context()->set_single_object(true, impl_->current_level_.back().paragraph_properties_, impl_->current_level_.back().text_properties_);
}
void odf_chart_context::end_text()
{
odf_text_context * text_context_ = text_context();
if (text_context_ == NULL || impl_->current_level_.size() <1 )return;
odf_text_context *text_context_ = text_context();
if (text_context_ == NULL || impl_->current_level_.size() < 1 )return;
for (size_t i=0; i< text_context_->text_elements_list_.size(); i++)
for (size_t i = 0; i < text_context_->text_elements_list_.size(); i++)
{
if (text_context_->text_elements_list_[i].level ==0)
{
@ -945,6 +960,45 @@ void odf_chart_context::end_text()
impl_->odf_context_->end_text_context();
}
void odf_chart_context::set_textarea_vertical_align(int align)
{
if (!impl_->current_level_.back().chart_properties_)return;
//switch(align)
//{
//case 0://SimpleTypes::textanchoringtypeB:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Bottom); break;
//case 1://SimpleTypes::textanchoringtypeCtr:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Middle); break;
//case 2://SimpleTypes::textanchoringtypeDist:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Baseline);break;
//case 3://SimpleTypes::textanchoringtypeJust:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Justify); break;
//case 4://SimpleTypes::textanchoringtypeT:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
//}
}
void odf_chart_context::set_textarea_rotation(double val)
{
if (!impl_->current_level_.back().chart_properties_)return;
if (val < 0.001 && val > -0.001) return;
if (val < -360 || val > 360) return;
if (val < 0) val += 360;
val = 360 - val;
impl_->current_level_.back().chart_properties_->content_.common_rotation_angle_attlist_.style_rotation_angle_ = (unsigned int)val;
}
void odf_chart_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_level_.back().chart_properties_)return;
//if (left) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_left_ = length(*left, length::pt);
//if (top) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_top_ = length(*top, length::pt);
//if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
//if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
}
void odf_chart_context::start_floor()
{
office_element_ptr elm;
@ -1478,6 +1532,13 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с
impl_->current_level_.back().chart_properties_->content_.chart_pie_offset_ = val;
}
void odf_chart_context::set_series_pie_bubble(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content_.chart_pie_bubble_ = val;
}
//void odf_chart_context::set_cash(std::wstring format, std::vector<double> &data_double)
//{
// if (data_double.size() <1 || impl_->data_cell_ranges_.size() < 1) return;

View File

@ -89,6 +89,7 @@ public:
long get_count_data_points_series();
void set_series_pie_explosion(int val);
void set_series_pie_bubble(bool val);
void end_series();
void end_group_series();
@ -136,6 +137,10 @@ public:
void start_text();
void end_text();
void set_textarea_vertical_align(int align);
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in pt
void set_textarea_rotation (double val);
void add_domain(std::wstring formula);
void add_categories(std::wstring formula, office_element_ptr & axis);

View File

@ -177,7 +177,7 @@ void odf_conversion_context::start_chart()
create_object();
create_element(L"office", L"chart", objects_.back().content, this, true);
chart_context_.set_styles_context(styles_context());
chart_context_.set_styles_context(odf_conversion_context::styles_context());
chart_context_.start_chart(get_current_object_element());
}
void odf_conversion_context::start_spreadsheet()

View File

@ -2101,6 +2101,36 @@ void odf_drawing_context::set_line_dash_preset(int style)
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Solid); break;
}
}
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_vertical_align(int align)
{
@ -2136,6 +2166,18 @@ void odf_drawing_context::set_textarea_fit_to_size(bool val)
impl_->current_graphic_properties->draw_fit_to_size_ = val;
}
void odf_drawing_context::set_textarea_rotation(double val)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
if (!impl_->current_text_properties) return;
impl_->current_text_properties->content_.style_text_rotation_angle_ = (int)val;
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{
@ -2249,36 +2291,6 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
}
}
}
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_graphic_properties)return;

View File

@ -231,6 +231,7 @@ public:
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
void set_textarea_fit_to_size (bool val);
void set_textarea_rotation (double val);
void set_placeholder_id (std::wstring val);
void set_placeholder_type (int val);

View File

@ -100,6 +100,7 @@ public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
default_column_width = -1;
optimal_column_width = false;
}
odf_table_state & current_table() {return tables_.back();}
@ -107,13 +108,21 @@ public:
void start_table(odf_table_state & state) {tables_.push_back(state);}
void end_table() {if (tables_.size() > 0) tables_.pop_back(); default_column_width = -1; default_cell_properties = L"";}
void end_table()
{
if (tables_.size() > 0) tables_.pop_back();
default_column_width = -1; // todo .. in level ???
default_cell_properties = L"";
optimal_column_width = false;
}
odf_style_context * styles_context() {return odf_context_->styles_context();}
odf_conversion_context *odf_context_;
double default_column_width;
double default_column_width;
bool optimal_column_width;
std::wstring default_cell_properties; // для предустановки ..
private:
@ -307,6 +316,10 @@ void odf_table_context::set_default_column_width(double width)
{
impl_->default_column_width = width;
}
void odf_table_context::set_optimal_column_width(bool val)
{
impl_->optimal_column_width = val;
}
void odf_table_context::set_column_optimal(bool val)
{
if (impl_->empty()) return;
@ -362,7 +375,11 @@ void odf_table_context::set_column_width(double width)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = false;
if (impl_->optimal_column_width)
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
}
impl_->current_table().table_width += width;
}
@ -370,7 +387,7 @@ void odf_table_context::set_column_width(double width)
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
if (impl_->default_column_width >=0)
if (impl_->default_column_width >= 0)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);

View File

@ -66,6 +66,7 @@ public:
void start_table(office_element_ptr &elm, bool styled = false);
void set_default_column_width(double width);
void set_optimal_column_width(bool val);
void change_current_column_width(double width);
void end_table();

View File

@ -54,10 +54,10 @@ namespace cpdoccore {
namespace odf_writer
{
odf_text_context::odf_text_context(odf_conversion_context *odf_context)
odf_text_context::odf_text_context(odf_conversion_context *odf_context, odf_style_context *styles_context)
{
odf_context_ = odf_context;
styles_context_ = odf_context->styles_context();
styles_context_ = styles_context;
single_paragraph_ = false;
paragraph_properties_ = NULL;

View File

@ -53,7 +53,7 @@ class style_text_properties;
class odf_text_context: boost::noncopyable
{
public:
odf_text_context (odf_conversion_context *odf_context);
odf_text_context (odf_conversion_context *odf_context, odf_style_context *styles_context);
~odf_text_context ();
public:
odf_style_context* get_styles_context();//для embedded

View File

@ -132,8 +132,7 @@ void odp_conversion_context::end_layout_slide()
}
void odp_conversion_context::start_text_context()
{
text_context_ = new odf_text_context(this);
text_context_->set_styles_context(slide_context_.get_styles_context());
text_context_ = new odf_text_context(this, slide_context_.get_styles_context());
}
void odp_conversion_context::end_text_context()
{

View File

@ -472,8 +472,7 @@ void ods_conversion_context::add_column(int start_column, int repeated, int leve
}
void ods_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
current_text_context_ = new odf_text_context(this, styles_context());
}
void ods_conversion_context::end_text_context()
{

View File

@ -1137,20 +1137,20 @@ void ods_table_state::start_conditional_rule(int rule_type)
boost::algorithm::split(splitted, test, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
cell = splitted[0];
condition->calcext_condition_attr_.calcext_base_cell_address_ = table + cell;
condition->attr_.calcext_base_cell_address_ = table + cell;
}
switch(rule_type)
{
case 4: condition->calcext_condition_attr_.calcext_value_ = L"contains-text( )"; break;
case 5: condition->calcext_condition_attr_.calcext_value_ = L"is-error"; break;
case 6: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break;
case 8: condition->calcext_condition_attr_.calcext_value_ = L"duplicate"; break;
case 9: condition->calcext_condition_attr_.calcext_value_ = L"formula-is()"; break;
case 11: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text( )"; break;
case 12: condition->calcext_condition_attr_.calcext_value_ = L"is-no-error"; break;
case 13: condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break;
case 15: condition->calcext_condition_attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
case 16: condition->calcext_condition_attr_.calcext_value_ = L"unique"; break;
case 4: condition->attr_.calcext_value_ = L"contains-text( )"; break;
case 5: condition->attr_.calcext_value_ = L"is-error"; break;
case 6: condition->attr_.calcext_value_ = L"contains-text()"; break;
case 8: condition->attr_.calcext_value_ = L"duplicate"; break;
case 9: condition->attr_.calcext_value_ = L"formula-is()"; break;
case 11: condition->attr_.calcext_value_ = L"not-contains-text( )"; break;
case 12: condition->attr_.calcext_value_ = L"is-no-error"; break;
case 13: condition->attr_.calcext_value_ = L"not-contains-text()"; break;
case 15: condition->attr_.calcext_value_ = L"top-elements()"; break;//bottom-elements ???
case 16: condition->attr_.calcext_value_ = L"unique"; break;
case 0: /*aboveAverage*/
case 1: /*beginsWith*/
case 2: /*cellIs*/
@ -1178,9 +1178,9 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
std::wstring operator_;
bool s = false;
if (condition->calcext_condition_attr_.calcext_value_)//есть опреатор
if (condition->attr_.calcext_value_)//есть опреатор
{
operator_ = *condition->calcext_condition_attr_.calcext_value_;
operator_ = *condition->attr_.calcext_value_;
int f = operator_.find(L"(");
if (f > 0)
{
@ -1188,7 +1188,7 @@ void ods_table_state::set_conditional_formula(std::wstring formula)
operator_ = operator_.substr(0,operator_.length() - 2);
}
}
condition->calcext_condition_attr_.calcext_value_= operator_ + (s ? L"(": L"") + odfFormula + (s ? L")": L"");
condition->attr_.calcext_value_= operator_ + (s ? L"(": L"") + odfFormula + (s ? L")": L"");
}
}
void ods_table_state::set_conditional_style_name(std::wstring style_name)
@ -1196,8 +1196,8 @@ void ods_table_state::set_conditional_style_name(std::wstring style_name)
calcext_condition* condition = dynamic_cast<calcext_condition*> (current_level_.back().get());
calcext_date_is* date_is = dynamic_cast<calcext_date_is*> (current_level_.back().get());
if (condition) condition->calcext_condition_attr_.calcext_apply_style_name_= style_name;
if (date_is) date_is->calcext_date_is_attr_.calcext_style_ = style_name;
if (condition) condition->attr_.calcext_apply_style_name_ = style_name;
if (date_is) date_is->attr_.calcext_style_ = style_name;
}
void ods_table_state::set_conditional_operator(int _operator)
{
@ -1206,18 +1206,18 @@ void ods_table_state::set_conditional_operator(int _operator)
{
switch(_operator)
{
case 0: condition->calcext_condition_attr_.calcext_value_ = L"begins-with()"; break;
case 1: condition->calcext_condition_attr_.calcext_value_ = L"between()"; break;
case 2: condition->calcext_condition_attr_.calcext_value_ = L"contains-text()"; break;
case 3: condition->calcext_condition_attr_.calcext_value_ = L"ends-with()"; break;
case 4: condition->calcext_condition_attr_.calcext_value_ = L"="; break;
case 5: condition->calcext_condition_attr_.calcext_value_ = L">"; break;
case 6: condition->calcext_condition_attr_.calcext_value_ = L">="; break;
case 7: condition->calcext_condition_attr_.calcext_value_ = L"<"; break;
case 8: condition->calcext_condition_attr_.calcext_value_ = L"<="; break;
case 9: condition->calcext_condition_attr_.calcext_value_ = L"not-between()"; break;
case 10:condition->calcext_condition_attr_.calcext_value_ = L"not-contains-text()"; break;
case 11:condition->calcext_condition_attr_.calcext_value_ = L"!="; break;
case 0: condition->attr_.calcext_value_ = L"begins-with()"; break;
case 1: condition->attr_.calcext_value_ = L"between()"; break;
case 2: condition->attr_.calcext_value_ = L"contains-text()"; break;
case 3: condition->attr_.calcext_value_ = L"ends-with()"; break;
case 4: condition->attr_.calcext_value_ = L"="; break;
case 5: condition->attr_.calcext_value_ = L">"; break;
case 6: condition->attr_.calcext_value_ = L">="; break;
case 7: condition->attr_.calcext_value_ = L"<"; break;
case 8: condition->attr_.calcext_value_ = L"<="; break;
case 9: condition->attr_.calcext_value_ = L"not-between()"; break;
case 10:condition->attr_.calcext_value_ = L"not-contains-text()"; break;
case 11:condition->attr_.calcext_value_ = L"!="; break;
}
}
}
@ -1229,8 +1229,8 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
if (icon_set || data_bar)
{
office_element_ptr elm;
create_element(L"calcext", L"formatting-entry",elm, context_);
office_element_ptr elm;
create_element(L"calcext", L"formatting-entry", elm, context_);
current_level_.back()->add_child_element(elm);
@ -1247,13 +1247,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
case 3: //Number
default: entry->calcext_type_ = calcext_type(calcext_type::Number);
}
entry->calcext_value_ = value;
}
}
if (color_scale)
{
office_element_ptr elm;
create_element(L"calcext", L"color-scale-entry",elm, context_);
office_element_ptr elm;
create_element(L"calcext", L"color-scale-entry", elm, context_);
current_level_.back()->add_child_element(elm);
@ -1263,13 +1264,14 @@ void ods_table_state::set_conditional_value(int type, std::wstring value )
switch(type)
{
case 0: //Formula
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
case 5: //Percentile
case 1: entry->calcext_type_ = calcext_type(calcext_type::Maximum); break;
case 2: entry->calcext_type_ = calcext_type(calcext_type::Minimum); break;
case 4: entry->calcext_type_ = calcext_type(calcext_type::Percent); break;
case 5: entry->calcext_type_ = calcext_type(calcext_type::Percentile); break;
case 3: //Number
default: entry->calcext_type_ = calcext_type(calcext_type::Number);
}
entry->calcext_value_ = value;
}
///color???? - прихоодят выше уровнем !!
}
@ -1281,11 +1283,22 @@ void ods_table_state::set_conditional_iconset(int type_iconset)
if (cond_format)
{
cond_format->calcext_icon_set_attr_.calcext_icon_set_type_ = iconset_type((iconset_type::type)type_iconset);
cond_format->attr_.calcext_icon_set_type_ = iconset_type((iconset_type::type)type_iconset);
}
}
void ods_table_state::add_conditional_colorscale(_CP_OPT(color) color)
void ods_table_state::add_conditional_colorscale(int index, _CP_OPT(color) color)
{
calcext_color_scale *scale = dynamic_cast<calcext_color_scale*>(current_level_.back().get());
if (!scale) return;
if (index >= scale->content_.size() || index < 0) return;
calcext_color_scale_entry* color_scale_entry = dynamic_cast<calcext_color_scale_entry*>(scale->content_[index].get());
if (color_scale_entry)
{
color_scale_entry->calcext_color_ = color;
}
}
void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
{
@ -1293,7 +1306,7 @@ void ods_table_state::set_conditional_databar_color(_CP_OPT(color) color)
if (cond_format)
{
cond_format->calcext_data_bar_attr_.calcext_positive_color_ = color;
cond_format->attr_.calcext_positive_color_ = color;
}
}

View File

@ -274,7 +274,7 @@ public:
void set_conditional_formula(std::wstring formula);
void set_conditional_value(int type, std::wstring value );
void set_conditional_iconset(int type_iconset);
void add_conditional_colorscale(_CP_OPT(odf_types::color) color);
void add_conditional_colorscale(int index, _CP_OPT(odf_types::color) color);
void set_conditional_databar_color(_CP_OPT(odf_types::color) color);
void set_conditional_style_name(std::wstring style_name);

View File

@ -105,7 +105,8 @@ void odt_conversion_context::start_document()
root_document_ = get_current_object_element();
root_text_ = dynamic_cast<office_text*>(root_document_.get());
main_text_context_ = new odf_text_context(this);
main_text_context_ = new odf_text_context(this, styles_context());
page_layout_context()->set_styles_context(styles_context());
@ -182,7 +183,7 @@ odf_text_context* odt_conversion_context::text_context()
}
void odt_conversion_context::start_text_context()
{
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this));
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this, odf_conversion_context::styles_context()));
if (!new_text_context_)return;
text_context_.push_back(new_text_context_);

View File

@ -43,7 +43,7 @@
namespace cpdoccore {
namespace odf_writer {
/// \brief office:chart
/// office:chart
class office_chart : public office_element_impl<office_chart>
{
public:
@ -86,7 +86,7 @@ public:
_CP_OPT(std::wstring) chart_row_mapping_;
};
/// \brief chart:chart
/// chart:chart
class chart_chart : public office_element_impl<chart_chart>
{
public:
@ -118,7 +118,7 @@ public:
common_chart_attlist common_attlist_;
};
/// \brief chart:title
/// chart:title
class chart_title : public office_element_impl<chart_title>
{
public:
@ -139,7 +139,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_title);
/// \brief chart:subtitle
/// chart:subtitle
class chart_subtitle : public office_element_impl<chart_subtitle>
{
public:
@ -161,7 +161,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_subtitle);
/// \brief chart:footer
/// chart:footer
class chart_footer : public office_element_impl<chart_footer>
{
public:
@ -200,7 +200,7 @@ public:
_CP_OPT(odf_types::length) chartooo_width_;
};
/// \brief chart:legend
/// chart:legend
class chart_legend : public office_element_impl<chart_legend>
{
public:
@ -239,7 +239,7 @@ public:
// common-dr3d-transform-attlist
};
/// \brief chart:plot-area
/// chart:plot-area
class chart_plot_area : public office_element_impl<chart_plot_area>
{
public:
@ -291,7 +291,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_wall);
/// \brief chart:floor
/// chart:floor
class chart_floor : public office_element_impl<chart_floor>
{
public:
@ -322,7 +322,7 @@ public:
common_chart_attlist common_attlist_;
};
/// \brief chart:axis
/// chart:axis
class chart_axis : public office_element_impl<chart_axis>
{
public:
@ -354,7 +354,7 @@ public:
};
/// \brief chart:grid
/// chart:grid
class chart_grid : public office_element_impl<chart_grid>
{
public:
@ -375,7 +375,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_grid);
/// \brief chart:categories
/// chart:categories
class chart_categories : public office_element_impl<chart_categories>
{
public:
@ -409,7 +409,7 @@ public:
};
/// \brief chart:series
/// chart:series
class chart_series : public office_element_impl<chart_series>
{
public:
@ -431,7 +431,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_series);
/// \brief chart:domain
/// chart:domain
class chart_domain : public office_element_impl<chart_domain>
{
public:
@ -461,7 +461,7 @@ public:
common_chart_attlist common_attlist_;
};
/// \brief chart:data-point
/// chart:data-point
class chart_data_point : public office_element_impl<chart_data_point>
{
public:
@ -482,7 +482,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_data_point);
/// \brief chart:mean-value
/// chart:mean-value
class chart_mean_value : public office_element_impl<chart_mean_value>
{
public:
@ -503,7 +503,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_mean_value);
/// \brief chart:error-indicator
/// chart:error-indicator
class chart_error_indicator : public office_element_impl<chart_error_indicator>
{
public:
@ -566,7 +566,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_regression_curve);
/// \brief chart:stock-gain-marker
/// chart:stock-gain-marker
class chart_stock_gain_marker : public office_element_impl<chart_stock_gain_marker>
{
public:
@ -587,7 +587,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_gain_marker);
/// \brief chart:stock-loss-marker
/// chart:stock-loss-marker
class chart_stock_loss_marker : public office_element_impl<chart_stock_loss_marker>
{
public:
@ -608,7 +608,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(chart_stock_loss_marker);
/// \brief chart:stock-range-line
/// chart:stock-range-line
class chart_stock_range_line : public office_element_impl<chart_stock_range_line>
{
public:

View File

@ -95,6 +95,7 @@ public:
_CP_OPT(int) chart_spline_order_;
_CP_OPT(int) chart_spline_resolution_;
_CP_OPT(int) chart_pie_offset_;
_CP_OPT(bool) chart_pie_bubble_;
_CP_OPT(int) chart_interval_minor_divisor_;
_CP_OPT(double) chart_maximum_;
@ -105,15 +106,15 @@ public:
_CP_OPT(double) chart_error_margin_;
_CP_OPT(double) chart_error_upper_limit_;
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
_CP_OPT(odf_types::chart_solid_type) chart_solid_type_;
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
_CP_OPT(odf_types::direction) style_direction_;
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
_CP_OPT(odf_types::length) chart_symbol_width_;
_CP_OPT(odf_types::length) chart_symbol_height_;
_CP_OPT(odf_types::chart_regression_type) chart_regression_type_;
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
_CP_OPT(odf_types::chart_error_category) chart_error_category_;
_CP_OPT(std::wstring) chart_axis_label_position_;

View File

@ -83,8 +83,13 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
common_keep_with_next_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
if (style_background_image_) style_background_image_->serialize(_Wostream);
CP_XML_ATTR_OPT(L"table:align", table_align_);
//not from specification !!
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
//not from specification !!
if (style_background_image_) style_background_image_->serialize(_Wostream);
}
}
}
@ -109,7 +114,8 @@ void table_format_properties::apply_from(const table_format_properties & Other)
common_keep_with_next_attlist_.apply_from(Other.common_keep_with_next_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
style_background_image_ = Other.style_background_image_;
style_background_image_ = Other.style_background_image_;
style_use_optimal_column_width_ = Other.style_use_optimal_column_width_;
}
// style:table-properties
@ -145,9 +151,10 @@ void style_table_column_properties_attlist::serialize(std::wostream & _Wostream,
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
common_break_attlist_.serialize(CP_GET_XML_NODE());
}
}

View File

@ -84,8 +84,8 @@ public:
odf_types::common_border_attlist common_border_attlist_;
office_element_ptr style_background_image_;
office_element_ptr style_background_image_;
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_;
};

View File

@ -29,6 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "XlsxConverter.h"
#include "PptxConverter.h"
#include "DocxConverter.h"
@ -664,6 +665,8 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
if (effectLst) convert(effectLst);
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
//convert(oox_spPr->ExtLst.GetPointer());
//nullable<OOX::Drawing::CEffectContainer> EffectDag;
//nullable<OOX::Drawing::COfficeArtExtensionList> ExtLst;
@ -672,6 +675,40 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
//-----------------------------------------------------------------------------------------------------------------------------
}
void OoxConverter::convert(OOX::Drawing::COfficeArtExtensionList *ext_list)
{
if (ext_list == NULL)return;
for (size_t i = 0; i < ext_list->m_arrExt.size(); i++)
{
convert(ext_list->m_arrExt[i]);
}
}
void OoxConverter::convert(OOX::Drawing::COfficeArtExtension *art_ext)
{
if (art_ext == NULL)return;
if (art_ext->m_oSparklineGroups.IsInit() || art_ext->m_oAltTextTable.IsInit() || !art_ext->m_arrConditionalFormatting.empty())
{
XlsxConverter *xlsx_converter = dynamic_cast<XlsxConverter*>(this);
if (xlsx_converter)
{
xlsx_converter->convert(art_ext->m_oSparklineGroups.GetPointer());
xlsx_converter->convert(art_ext->m_oAltTextTable.GetPointer());
for (size_t i = 0; i < art_ext->m_arrConditionalFormatting.size(); i++)
{
xlsx_converter->convert(art_ext->m_arrConditionalFormatting[i]);
}
}
}
//convert(art_ext->m_oCompatExt.GetPointer());
//convert(art_ext->m_oDataModelExt.GetPointer());
}
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
{
if (oox_fill == NULL) return;
@ -1165,6 +1202,10 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->rot.IsInit())
{
odf_context()->drawing_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
}
switch(oox_bodyPr->Fit.type)
{
@ -1505,7 +1546,7 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
}
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
odf_writer::style_paragraph_properties* paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
odf_writer::style_text_properties* text_properties = NULL;
odf_writer::style_text_properties* text_properties = odf_context()->text_context()->get_text_properties();
if (!paragraph_properties)
{

View File

@ -58,6 +58,8 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
#define PROGRESSEVENT_ID 0
namespace Oox2Odf
@ -285,6 +287,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{
convert(dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown));
}break;
case OOX::et_a_extLst:
{
convert(dynamic_cast<OOX::Drawing::COfficeArtExtensionList*>(oox_unknown));
}break;
case OOX::et_a_ext:
{
convert(dynamic_cast<OOX::Drawing::COfficeArtExtension*>(oox_unknown));
}break;
// "ненужные" элементы
case OOX::et_w_softHyphen:
case OOX::et_w_proofErr:

View File

@ -78,6 +78,8 @@ namespace OOX
//class CPresetTextShape;
class CInline;
class CAnchor;
class COfficeArtExtensionList;
class COfficeArtExtension;
}
namespace Spreadsheet
{
@ -395,7 +397,6 @@ public:
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
@ -420,7 +421,12 @@ public:
void convert(PPTX::Logic::Run *oox_run);
void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br);
void convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style = NULL);
void convert_chart_text(PPTX::Logic::TxBody *oox_txBody);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::MathParaWrapper *oox_math);
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
@ -453,7 +459,9 @@ public:
void convert(OOX::Spreadsheet::CT_Area3DChart *chart);
void convert(OOX::Spreadsheet::CT_AreaChart *chart);
void convert(OOX::Spreadsheet::CT_Bar3DChart *chart);
void convert_before(OOX::Spreadsheet::CT_Bar3DChart *chart);
void convert(OOX::Spreadsheet::CT_BarChart *chart);
void convert_before(OOX::Spreadsheet::CT_BarChart *chart);
void convert(OOX::Spreadsheet::CT_Line3DChart *chart);
void convert(OOX::Spreadsheet::CT_LineChart *chart);
void convert(OOX::Spreadsheet::CT_Pie3DChart *chart);
@ -514,6 +522,9 @@ public:
void convert(OOX::Vml::CGroup *vml_group);
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
void convert(OOX::Vml::CFormulas *vml_formulas);
void convert(OOX::Drawing::COfficeArtExtensionList *ext_list);
void convert(OOX::Drawing::COfficeArtExtension *art_ext);
};
} // namespace Oox2Odf

View File

@ -49,6 +49,61 @@
namespace Oox2Odf
{
void OoxConverter::convert_chart_text(PPTX::Logic::TxBody *oox_txBody)
{
if (!oox_txBody) return;
if (oox_txBody->Paragrs.empty()) return;
odf_context()->chart_context()->start_text();
convert(oox_txBody->lstStyle.GetPointer());
for (size_t i = 0; i < oox_txBody->Paragrs.size(); i++)
{
convert(&oox_txBody->Paragrs[i], oox_txBody->lstStyle.GetPointer());
//внешние настройки для текста
convert_chart_text(oox_txBody->bodyPr.GetPointer());
}
odf_context()->chart_context()->end_text();
}
void OoxConverter::convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr)
{
if (!oox_bodyPr) return;
if (oox_bodyPr->vert.IsInit())
{
//odf_context()->chart_context()->set_textarea_writing_mode (oox_bodyPr->vert->GetBYTECode());
}
if (oox_bodyPr->anchor.IsInit())
{
//odf_context()->chart_context()->set_textarea_vertical_align (oox_bodyPr->anchor->GetBYTECode());
}
_CP_OPT(double) lIns, tIns, rIns, bIns;
if (oox_bodyPr->lIns.IsInit()) lIns = oox_bodyPr->lIns.get() / 12700.; //pt
if (oox_bodyPr->tIns.IsInit()) tIns = oox_bodyPr->tIns.get() / 12700.;
if (oox_bodyPr->rIns.IsInit()) rIns = oox_bodyPr->rIns.get() / 12700.;
if (oox_bodyPr->bIns.IsInit()) bIns = oox_bodyPr->bIns.get() / 12700.;
//odf_context()->chart_context()->set_textarea_padding (lIns, tIns, rIns, bIns);
//if (oox_bodyPr->wrap.IsInit())
// odf_context()->chart_context()->set_textarea_wrap(oox_bodyPr->wrap->GetBYTECode());
if ((oox_bodyPr->numCol.IsInit()) && (oox_bodyPr->numCol.get() > 1))
{
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->rot.IsInit())
{
odf_context()->chart_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
}
}
void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
{
if (!oox_chart)return;
@ -56,7 +111,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
convert(oox_chart->m_externalData);
convert(oox_chart->m_oSpPr.GetPointer());
convert(oox_chart->m_oTxPr.GetPointer());
convert_chart_text(oox_chart->m_oTxPr.GetPointer());
convert(oox_chart->m_chart->m_title);
convert(oox_chart->m_chart->m_legend);
@ -103,7 +158,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Tx* ct_tx)
{
if (ct_tx == NULL)return;
convert(ct_tx->m_oRich.GetPointer());
convert_chart_text(ct_tx->m_oRich.GetPointer());
}
void OoxConverter::convert(OOX::Spreadsheet::CT_Layout* ct_layout)
{
@ -130,7 +185,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Title* ct_title)
odf_context()->chart_context()->start_title();
convert(ct_title->m_oSpPr.GetPointer());
convert(ct_title->m_layout);
convert(ct_title->m_oTxPr.GetPointer());
convert_chart_text(ct_title->m_oTxPr.GetPointer());
///////////////////////////////
convert(ct_title->m_tx);
odf_context()->chart_context()->end_element();
@ -145,7 +200,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Legend* ct_legend)
if ((ct_legend->m_legendPos) && (ct_legend->m_legendPos->m_val))
odf_context()->chart_context()->set_legend_position(*ct_legend->m_legendPos->m_val);
convert(ct_legend->m_oTxPr.GetPointer());
convert_chart_text(ct_legend->m_oTxPr.GetPointer());
if (ct_legend->m_legendEntry.size() > 0)
{
convert(ct_legend->m_legendEntry[0]); // в odf_writer нет в легенде множественности стилей
@ -157,7 +212,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LegendEntry* ct_legend)
{
if (ct_legend == NULL)return;
convert(ct_legend->m_oTxPr.GetPointer());
convert_chart_text(ct_legend->m_oTxPr.GetPointer());
}
void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
{
@ -167,6 +222,17 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
convert(ct_plotArea->m_layout);
///////////////////////
for (size_t i=0; i< ct_plotArea->m_Items.size(); i++)//
{
if (!ct_plotArea->m_ItemsElementName0[i]) continue;
switch(*ct_plotArea->m_ItemsElementName0[i])
{
case OOX::Spreadsheet::itemschoicetype5BAR3DCHART: convert_before((OOX::Spreadsheet::CT_Bar3DChart*) ct_plotArea->m_Items[i]); break;
case OOX::Spreadsheet::itemschoicetype5BARCHART: convert_before((OOX::Spreadsheet::CT_BarChart*) ct_plotArea->m_Items[i]); break;
}
}
for (size_t i = 0; i < ct_plotArea->m_Items1.size(); i++)
{
if (!ct_plotArea->m_ItemsElementName1[i]) continue;
@ -222,7 +288,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -249,7 +317,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
odf_context()->chart_context()->set_axis_label_position(*axis->m_tickLblPos->m_val);
///////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -263,7 +331,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DateAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -288,7 +358,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DateAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
//////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -302,7 +372,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -327,7 +399,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
///////////////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -341,7 +413,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
odf_context()->chart_context()->set_axis_dimension(2);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
@ -365,7 +439,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
/////////////////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
@ -451,12 +525,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
if (chart->m_barDir && chart->m_barDir->m_val)
odf_context()->chart_context()->set_chart_bar_direction(*chart->m_barDir->m_val);
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
@ -470,6 +538,34 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Bar3DChart *chart)
}
odf_context()->chart_context()->end_group_series();
}
void OoxConverter::convert_before(OOX::Spreadsheet::CT_Bar3DChart *chart)
{
if (chart == NULL)return;
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
//if (chart->m_overlap && chart->m_overlap->m_val)
// odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
//else
// odf_context()->chart_context()->set_chart_bar_overlap(L"0");
}
void OoxConverter::convert_before(OOX::Spreadsheet::CT_BarChart *chart)
{
if (chart == NULL)return;
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
else
odf_context()->chart_context()->set_chart_bar_overlap(L"100");
if (chart->m_overlap && chart->m_overlap->m_val)
odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
else
odf_context()->chart_context()->set_chart_bar_overlap(L"0");
}
void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
{
if (chart == NULL)return;
@ -482,12 +578,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_BarChart *chart)
if (chart->m_barDir && chart->m_barDir->m_val)
odf_context()->chart_context()->set_chart_bar_direction(*chart->m_barDir->m_val);
if (chart->m_gapWidth && chart->m_gapWidth->m_val)
odf_context()->chart_context()->set_chart_bar_gap_width(*chart->m_gapWidth->m_val);
if (chart->m_overlap && chart->m_overlap->m_val)
odf_context()->chart_context()->set_chart_bar_overlap(*chart->m_overlap->m_val);
odf_context()->chart_context()->start_group_series();
convert(chart->m_dLbls);
@ -971,6 +1061,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, std::vector<OOX:
convert(dPt[i]->m_marker);
if (dPt[i]->m_explosion && dPt[i]->m_explosion->m_val)
odf_context()->chart_context()->set_series_pie_explosion(*dPt[i]->m_explosion->m_val);
if (dPt[i]->m_bubble3D && dPt[i]->m_bubble3D->m_val)
odf_context()->chart_context()->set_series_pie_bubble(*dPt[i]->m_bubble3D->m_val);
odf_context()->chart_context()->end_element();
current_point = set_point+1;

View File

@ -214,6 +214,7 @@ void DocxConverter::convert_document()
section.props = document->m_oSectPr.GetPointer();
section.start_para = last_section_start;
section.end_para = document->m_arrItems.end();
sections.push_back(section);
//----------------------------------------------------------------------------------------------------------
@ -2414,8 +2415,8 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
odf_context()->drawing_context()->set_name(std::wstring (L"Custom") + std::to_wstring(sptType));
odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType));
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
OoxConverter::convert(oox_pic->m_oShapeType.GetPointer());
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
odf_context()->drawing_context()->end_shape();
}
@ -3926,13 +3927,23 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer
if (oox_table_pr == NULL) return false;
if (table_properties == NULL) return false;
if (oox_table_pr->m_oTblW.IsInit())
if (oox_table_pr->m_oTblW.IsInit() && oox_table_pr->m_oTblW->m_oW.IsInit())
{
if ((oox_table_pr->m_oTblW->m_oType.IsInit() && oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthDxa) &&
(oox_table_pr->m_oTblW->m_oW.IsInit() && oox_table_pr->m_oTblW->m_oW->GetValue() >0))
if (oox_table_pr->m_oTblW->m_oType.IsInit() && oox_table_pr->m_oTblW->m_oW.IsInit())
{
if (oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue()/20.);
if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthDxa &&
oox_table_pr->m_oTblW->m_oW->GetValue() > 0 )
{
if ( oox_table_pr->m_oTblW->m_oW->IsPercent() == false)
odt_context->table_context()->set_default_column_width(oox_table_pr->m_oTblW->m_oW->GetValue() / 20.);
}
else if ( oox_table_pr->m_oTblW->m_oType->GetValue() == SimpleTypes::tblwidthAuto &&
oox_table_pr->m_oTblW->m_oW->GetValue() == 0 )
{
//динамическое расширение - автоподбор по содержимому.
odt_context->table_context()->set_optimal_column_width(true);
table_properties->table_format_properties_.style_use_optimal_column_width_ = true;
}
}
}
@ -4033,7 +4044,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_
{//напрямую задать cell_prop на саму таблицу низя - тока как default-cell-style-name на columns & row
//общие свойства ячеек
odt_context->styles_context()->create_style(L"",odf_types::style_family::TableCell, true, false, -1); //ради нормального задания дефолтовых свойств на cells
odt_context->styles_context()->create_style(L"", odf_types::style_family::TableCell, true, false, -1); //ради нормального задания дефолтовых свойств на cells
odt_context->styles_context()->last_state()->set_dont_write(true);
odf_writer::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->last_state()->get_table_cell_properties();

View File

@ -247,11 +247,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oSheetPr.GetPointer());
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Предобработка
for (std::list<OOX::Spreadsheet::CHyperlink*>::iterator it = oox_sheet->m_oHyperlinks->m_arrItems.begin();
it != oox_sheet->m_oHyperlinks->m_arrItems.end(); it++)
if (oox_sheet->m_oHyperlinks.IsInit())
{
convert(*it, oox_sheet);
}
for (std::list<OOX::Spreadsheet::CHyperlink*>::iterator it = oox_sheet->m_oHyperlinks->m_arrItems.begin();
it != oox_sheet->m_oHyperlinks->m_arrItems.end(); it++)
{
convert(*it, oox_sheet);
}
}
//комментарии
std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>::iterator pos = oox_sheet->m_mapComments.begin();
while ( oox_sheet->m_mapComments.end() != pos )
@ -262,13 +265,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
//todooo для оптимизации - перенести мержи в начало
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//колонки
ods_context->start_columns();
for (std::list<OOX::Spreadsheet::CCol*>::iterator it = oox_sheet->m_oCols->m_arrItems.begin();
it != oox_sheet->m_oCols->m_arrItems.end(); it++)
{
convert(*it);
}
ods_context->end_columns();
if (oox_sheet->m_oCols.IsInit())
{
ods_context->start_columns();
for (std::list<OOX::Spreadsheet::CCol*>::iterator it = oox_sheet->m_oCols->m_arrItems.begin();
it != oox_sheet->m_oCols->m_arrItems.end(); it++)
{
convert(*it);
}
ods_context->end_columns();
}
if (oox_sheet->m_oSheetData.IsInit() )
{
@ -287,15 +293,18 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
oox_sheet->m_oSheetData.reset();
}
for (std::list<OOX::Spreadsheet::CMergeCell*>::iterator it = oox_sheet->m_oMergeCells->m_arrItems.begin();
it != oox_sheet->m_oMergeCells->m_arrItems.end(); it++)
if (oox_sheet->m_oMergeCells.IsInit())
{
if ((*it) && ((*it)->m_oRef.IsInit()))
for (std::list<OOX::Spreadsheet::CMergeCell*>::iterator it = oox_sheet->m_oMergeCells->m_arrItems.begin();
it != oox_sheet->m_oMergeCells->m_arrItems.end(); it++)
{
ods_context->add_merge_cells((*it)->m_oRef.get());
if ((*it) && ((*it)->m_oRef.IsInit()))
{
ods_context->add_merge_cells((*it)->m_oRef.get());
}
}
}
if (oox_sheet->m_oDrawing.IsInit() && oox_sheet->m_oDrawing->m_oId.IsInit())
if ((oox_sheet->m_oDrawing.IsInit()) && (oox_sheet->m_oDrawing->m_oId.IsInit()))
{
smart_ptr<OOX::File> oFile = oox_sheet->Find(oox_sheet->m_oDrawing->m_oId->GetValue());
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Drawings == oFile->type())
@ -354,6 +363,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oPageSetup.GetPointer());
convert(oox_sheet->m_oPageMargins.GetPointer());
convert(oox_sheet->m_oPicture.GetPointer());
OoxConverter::convert(oox_sheet->m_oExtLst.GetPointer());
xlsx_current_container = old_container;
}
@ -413,8 +424,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
if (oox_table_part->m_oAutoFilter.IsInit())
ods_context->set_table_part_autofilter(true);
OoxConverter::convert(oox_table_part->m_oExtLst.GetPointer());
ods_context->end_table_part();
}
void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
@ -576,7 +588,7 @@ void XlsxConverter::convert_sharing_string(int number)
const OOX::Spreadsheet::CSharedStrings *SharedStrings= xlsx_document->GetSharedStrings();
if (!SharedStrings) return;
std::unordered_map<int, OOX::Spreadsheet::CSi*>::const_iterator pFind = SharedStrings->m_mapItems.find(number);
std::map<int, OOX::Spreadsheet::CSi*>::const_iterator pFind = SharedStrings->m_mapItems.find(number);
if (pFind != SharedStrings->m_mapItems.end())
{
@ -624,14 +636,24 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown)
OOX::Spreadsheet::CDataBar *pB = dynamic_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown);
convert(pB);
}break;
case OOX::et_x_ColorScale:
{
OOX::Spreadsheet::CColorScale *pB = dynamic_cast<OOX::Spreadsheet::CColorScale*>(oox_unknown);
convert(pB);
}break;
case OOX::et_x_FormulaCF:
{
OOX::Spreadsheet::CFormulaCF *pF = dynamic_cast<OOX::Spreadsheet::CFormulaCF*>(oox_unknown);
convert(pF);
}break;
case OOX::et_x_ConditionalFormatValueObject:
{
OOX::Spreadsheet::CConditionalFormatValueObject *pF = dynamic_cast<OOX::Spreadsheet::CConditionalFormatValueObject*>(oox_unknown);
convert(pF);
}break;
default:
{
_CP_LOG << L"[warning] : no convert element(" << oox_unknown->getType() << L")\n";
OoxConverter::convert(oox_unknown);
}
}
}
@ -2003,6 +2025,15 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
}
void XlsxConverter::convert(OOX::Spreadsheet::CSparklineGroups *sparkline)
{
if (!sparkline)return;
}
void XlsxConverter::convert(OOX::Spreadsheet::CAltTextTable *alt_text)
{
if (!alt_text)return;
}
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
{
if (!oox_cond_fmt)return;
@ -2066,6 +2097,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDataBar *oox_cond_databar)
void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
{
if (!oox_cond_colorscale)return;
int index = 0;
for (std::list<OOX::Spreadsheet::WritingElement*>::iterator it = oox_cond_colorscale->m_arrItems.begin();
it != oox_cond_colorscale->m_arrItems.end(); it++)
@ -2082,7 +2115,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
_CP_OPT(odf_types::color) color;
convert(dynamic_cast<OOX::Spreadsheet::CColor*>(*it), color);
ods_context->current_table().add_conditional_colorscale( color );
ods_context->current_table().add_conditional_colorscale( index++, color );
}
}
}
@ -2107,12 +2140,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatValueObject *oox
std::wstring val;
int type = 3;
if (oox_cond_value->m_oVal.IsInit()) val = oox_cond_value->m_oVal.get2();
if (oox_cond_value->m_oType.IsInit()) type = oox_cond_value->m_oType->GetValue();
ods_context->current_table().set_conditional_value(type,val);
if (oox_cond_value->m_oFormula.IsInit()) val = oox_cond_value->m_oFormula->m_sText;
else if (oox_cond_value->m_oVal.IsInit()) val = oox_cond_value->m_oVal.get2();
ods_context->current_table().set_conditional_value(type, val);
}
void XlsxConverter::convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula)
void XlsxConverter::convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula)
{
if (!oox_cond_formula)return;
ods_context->current_table().set_conditional_formula(oox_cond_formula->m_sText);

View File

@ -89,7 +89,9 @@ namespace OOX
class CSi;
class CWorkbookView;
class CPictureWorksheet;
class CHeaderFooter;
class CHeaderFooter;
class CSparklineGroups;
class CAltTextTable;
}
}
@ -126,6 +128,8 @@ namespace Oox2Odf
class XlsxConverter : public OoxConverter
{
public:
friend class OoxConverter;
XlsxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
~XlsxConverter();
@ -207,6 +211,9 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CFormulaCF *oox_cond_formula);
void convert(OOX::Spreadsheet::CSi *oox_rtf_text);
void convert(OOX::Spreadsheet::CSparklineGroups *sparkline);
void convert(OOX::Spreadsheet::CAltTextTable *alt_text);
void convert(double oox_size, _CP_OPT(odf_types::length) & odf_size);
void convert_sharing_string(int number);
};

View File

@ -60,6 +60,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -46,10 +46,12 @@
Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="_DEBUG;_CONSOLE;_USE_MATH_DEFINES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_;_SVG_CONVERT_TO_IMAGE_;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\PptFileFormatTest.pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -67,7 +69,7 @@
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMTD.lib;libcmt.lib"
IgnoreDefaultLibraryNames=""
IgnoreEmbeddedIDL="true"
GenerateDebugInformation="true"
SubSystem="1"

View File

@ -653,31 +653,34 @@ namespace PPTX
if (pVml->m_mapShapes.end() != pPair)
{
pPair->second.bUsed = true;
OOX::Vml::CShape* pShape = dynamic_cast<OOX::Vml::CShape*>(pPair->second.pElement);
for(std::list<OOX::WritingElement*>::iterator it = pShape->m_arrItems.begin();
(pShape) && (it != pShape->m_arrItems.end()); it++)
{
OOX::WritingElement* pChildElemShape = *it;
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
std::wstring sIdImageFileCache;
OOX::Vml::CVmlCommonElements* pShape = dynamic_cast<OOX::Vml::CVmlCommonElements*>(pPair->second.pElement);
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
if (!sIdImageFileCache.empty())
if (pShape)
{
for(std::list<OOX::WritingElement*>::iterator it = pShape->m_arrItems.begin();
it != pShape->m_arrItems.end(); it++)
{
OOX::WritingElement* pChildElemShape = *it;
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
std::wstring sIdImageFileCache;
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
if (!sIdImageFileCache.empty())
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
}
}
}
}
@ -1212,7 +1215,7 @@ namespace PPTX
}
}
bool bRect = bOle; //ole ВСЕГДА rect
bool bRect = bOle; //ole ВСЕГДА rect или shape c типом ctPictFrame(75)
if (spPr.Geometry.is<PPTX::Logic::PrstGeom>())
{

View File

@ -49,6 +49,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -103,27 +103,21 @@ public:
}
}
//----------------------------------------------------------------------------------------------------------
_section last_section;
m_poDocument->GetItem(last_section);
if (last_section.end_para != m_ooxDocument->m_arrItems.end())
_section section;
section.props = RtfSectionPtr(new RtfSection());
section.start_para = last_section_start;
section.end_para = m_ooxDocument->m_arrItems.end();
section.props->m_oProperty.SetDefaultOOX();
if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
{
_section section;
section.props = RtfSectionPtr(new RtfSection());
section.start_para = last_section.end_para;
section.end_para = m_ooxDocument->m_arrItems.end();
section.props->m_oProperty.SetDefaultOOX();
if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
if (oSectReader.Parse( oParam, section.props->m_oProperty ))
{
OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
if (oSectReader.Parse( oParam, section.props->m_oProperty ))
{
}
m_poDocument->AddItem( section );
}
m_poDocument->AddItem( section );
}
}
m_poDocument->RemoveItem(0);

View File

@ -91,7 +91,7 @@ void Font::readFields(CFRecord& record)
if (global_info->fonts_charsets.find(bCharSet) == global_info->fonts_charsets.end())
{
global_info->fonts_charsets.insert(global_info->fonts_charsets.begin(), std::pair<int,int>(bCharSet, bFamily));
global_info->fonts_charsets.insert(std::make_pair(bCharSet, bFamily));
}
}

View File

@ -38,8 +38,7 @@
namespace OLEPS
{
SummaryInformation::SummaryInformation(XLS::CFStreamPtr stream)
: property_set_stream(stream)
SummaryInformation::SummaryInformation(XLS::CFStreamPtr stream) : property_set_stream(stream)
{
}

View File

@ -48,6 +48,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -335,8 +335,10 @@
Optimization="0"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="_DEBUG;_WINDOWS;USE_PRECOMPILED_HEADERS;WIN32"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pch.h"
ObjectFile="$(IntDir)\"

View File

@ -48,6 +48,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
ProgramDataBaseFileName="$(IntDir)\DocxFormat.pdb"
WarningLevel="3"
DebugInformationFormat="4"

View File

@ -51,18 +51,17 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CComment)
CComment()
CComment()
{
}
virtual ~CComment()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -75,74 +74,74 @@ namespace OOX
std::wstring sName = oReader.GetName();
WritingElement *pItem = NULL;
/*if ( _T("w:altChunk") == sName )
/*if ( L"w:altChunk" ==sName )
pItem = new Logic::AltChunk( oItem );
else */if ( _T("w:bookmarkEnd") == sName )
else */if ( L"w:bookmarkEnd" ==sName )
pItem = new Logic::CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
else if ( L"w:bookmarkStart" ==sName )
pItem = new Logic::CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
else if ( L"w:commentRangeEnd" ==sName )
pItem = new Logic::CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
else if ( L"w:commentRangeStart" ==sName )
pItem = new Logic::CCommentRangeStart( oReader );
//else if ( _T("w:customXml") == sName )
//else if ( L"w:customXml" ==sName )
// pItem = new Logic::CCustomXml( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
else if ( L"w:customXmlDelRangeEnd" ==sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
else if ( L"w:customXmlDelRangeStart" ==sName )
pItem = new Logic::CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
else if ( L"w:customXmlInsRangeEnd" ==sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
else if ( L"w:customXmlInsRangeStart" ==sName )
pItem = new Logic::CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
else if ( L"w:customXmlMoveFromRangeEnd" ==sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
else if ( L"w:customXmlMoveFromRangeStart" ==sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
else if ( L"w:customXmlMoveToRangeEnd" ==sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
else if ( L"w:customXmlMoveToRangeStart" ==sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
else if ( L"w:del" ==sName )
pItem = new Logic::CDel( oReader );
else if ( _T("w:ins") == sName )
else if ( L"w:ins" ==sName )
pItem = new Logic::CIns( oReader );
else if ( _T("w:moveFrom") == sName )
else if ( L"w:moveFrom" ==sName )
pItem = new Logic::CMoveFrom( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
else if ( L"w:moveFromRangeEnd" ==sName )
pItem = new Logic::CMoveFromRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
else if ( L"w:moveFromRangeStart" ==sName )
pItem = new Logic::CMoveFromRangeStart( oReader );
else if ( _T("w:moveTo") == sName )
else if ( L"w:moveTo" ==sName )
pItem = new Logic::CMoveTo( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
else if ( L"w:moveToRangeEnd" ==sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
else if ( L"w:moveToRangeStart" ==sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
else if ( L"m:oMath" ==sName )
pItem = new Logic::COMath( oReader );
else if ( _T("m:oMathPara") == sName )
else if ( L"m:oMathPara" ==sName )
pItem = new Logic::COMathPara( oReader );
else if ( _T("w:p") == sName )
else if ( L"w:p" ==sName )
pItem = new Logic::CParagraph( oReader );
else if ( _T("w:permEnd") == sName )
else if ( L"w:permEnd" ==sName )
pItem = new Logic::CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
else if ( L"w:permStart" ==sName )
pItem = new Logic::CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
else if ( L"w:proofErr" ==sName )
pItem = new Logic::CProofErr( oReader );
else if ( _T("w:sdt") == sName )
else if ( L"w:sdt" ==sName )
pItem = new Logic::CSdt( oReader );
else if ( _T("w:tbl") == sName )
else if ( L"w:tbl" ==sName )
pItem = new Logic::CTbl( oReader );
if ( pItem )
m_arrItems.push_back( pItem );
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -160,7 +159,7 @@ namespace OOX
std::wstring getTextArr(const std::list<WritingElement* > & arrItems, bool& bFirstPar) const
{
std::wstring sRes;
for ( std::list<WritingElement *>::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
for ( std::list<WritingElement *>::const_iterator it = arrItems.begin(); it != arrItems.end(); it++)
{
WritingElement* item = *it;
if (item == NULL) continue;
@ -221,7 +220,7 @@ namespace OOX
if(bFirstPar)
bFirstPar = false;
else
sRes += _T("\n");
sRes += L"\n";
OOX::Logic::CParagraph* pParagraph = static_cast<OOX::Logic::CParagraph*>(item);
sRes += getTextArr(pParagraph->m_arrItems, bFirstPar);
}
@ -234,7 +233,7 @@ namespace OOX
break;
case OOX::et_w_cr:
case OOX::et_w_br:
sRes += _T("\n");
sRes += L"\n";
break;
case OOX::et_w_nonBreakHyphen:
{
@ -243,7 +242,7 @@ namespace OOX
break;
}
case OOX::et_w_tab:
sRes += _T(" ");
sRes += L" ";
break;
case OOX::et_w_sym:
{
@ -271,14 +270,13 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_oAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("oodata"), m_oOOData )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:initials"), m_oInitials )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w:author", m_oAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w:date", m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, L"oodata", m_oOOData )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w:id", m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w:initials", m_oInitials )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -309,7 +307,10 @@ namespace OOX
virtual ~CComments()
{
for(size_t i = 0, length = m_arrComments.size(); i < length; ++i)
{
if (m_arrComments[i]) delete m_arrComments[i];
m_arrComments[i] = NULL;
}
m_arrComments.clear();
}
virtual void read(const CPath& oFilePath)
@ -325,13 +326,13 @@ namespace OOX
return;
std::wstring sName = oReader.GetName();
if ( _T("w:comments") == sName && !oReader.IsEmptyNode() )
if ( L"w:comments" == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w:comment") == sName )
if ( L"w:comment" == sName )
m_arrComments.push_back( new CComment(oReader) );
}
}
@ -367,19 +368,19 @@ namespace OOX
virtual ~CCommentExt()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -390,12 +391,11 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:paraId"), m_oParaId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:paraIdParent"), m_oParaIdParent )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:done"), m_oDone )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w15:paraId", m_oParaId )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w15:paraIdParent", m_oParaIdParent )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w15:done", m_oDone )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -418,7 +418,10 @@ namespace OOX
virtual ~CCommentsExt()
{
for(size_t i = 0, length = m_arrComments.size(); i < length; ++i)
{
if (m_arrComments[i]) delete m_arrComments[i];
m_arrComments[i] = NULL;
}
m_arrComments.clear();
}
virtual void read(const CPath& oFilePath)
@ -434,13 +437,13 @@ namespace OOX
return;
std::wstring sName = oReader.GetName();
if ( _T("w15:commentsEx") == sName && !oReader.IsEmptyNode() )
if ( L"w15:commentsEx" == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w15:commentEx") == sName )
if ( L"w15:commentEx" == sName )
m_arrComments.push_back( new CCommentExt(oReader) );
}
}
@ -476,10 +479,10 @@ namespace OOX
virtual ~CPresenceInfo()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -488,7 +491,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -499,11 +502,10 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:providerId"), m_oProviderId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:userId"), m_oUserId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w15:providerId", m_oProviderId )
WritingElement_ReadAttributes_Read_else_if( oReader, L"w15:userId", m_oUserId )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -522,10 +524,10 @@ namespace OOX
virtual ~CPerson()
{
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -536,13 +538,13 @@ namespace OOX
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if ( _T("w15:presenceInfo") == sName )
if ( L"w15:presenceInfo" ==sName )
m_oPresenceInfo = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("");
std::wstring sResult = L"";
return sResult;
}
@ -553,10 +555,9 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:author"), m_oAuthor )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"w15:author", m_oAuthor )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -592,13 +593,13 @@ namespace OOX
return;
std::wstring sName = oReader.GetName();
if ( _T("w15:people") == sName && !oReader.IsEmptyNode() )
if ( L"w15:people" == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w15:person") == sName )
if ( L"w15:person" == sName )
m_arrPeoples.push_back( new CPerson(oReader) );
}
}

View File

@ -38,7 +38,7 @@
#include "../../DocxFormat/IFileContainer.h"
#include <map>
#include <unordered_map>
namespace OOX
{
@ -74,7 +74,7 @@ namespace OOX
return m_nRow.IsInit() && m_nCol.IsInit() && m_sAuthor.IsInit();
}
};
class CAuthors : public WritingElementWithChilds<std::wstring>
class CAuthors : public WritingElement
{
public:
WritingElement_AdditionConstructors(CAuthors)
@ -83,43 +83,49 @@ namespace OOX
}
virtual ~CAuthors()
{
ClearItems();
}
virtual void ClearItems()
{
m_mapItems.clear();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(L"<authors>");
for ( SpreadsheetElemArray::const_iterator it = m_arrItems.begin(); it != m_arrItems.end(); it++)
for ( std::unordered_map<int, std::wstring>::const_iterator it = m_mapItems.begin(); it != m_mapItems.end(); it++)
{
if ( *it )
{
writer.WriteString(L"<author>");
writer.WriteEncodeXmlString(*(*it));
writer.WriteString(L"</author>");
}
writer.WriteString(L"<author>");
writer.WriteEncodeXmlString(it->second);
writer.WriteString(L"</author>");
}
writer.WriteString(L"</authors>");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int index = 0;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("author") == sName )
m_arrItems.push_back(new std::wstring(oReader.GetText3()));
if ( L"author" == sName )
{
m_mapItems.insert(std::make_pair(index++, oReader.GetText3()));
}
}
}
@ -132,6 +138,8 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
std::unordered_map<int, std::wstring> m_mapItems;
};
class CComment : public WritingElement
{
@ -148,7 +156,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
@ -190,13 +198,10 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), m_oRef )
WritingElement_ReadAttributes_Read_if ( oReader, _T("authorId"), m_oAuthorId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"ref", m_oRef )
WritingElement_ReadAttributes_Read_if ( oReader, L"authorId", m_oAuthorId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId > m_oRef;
@ -219,7 +224,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
@ -247,7 +252,7 @@ namespace OOX
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("comment") == sName )
if ( L"comment" == sName )
m_arrItems.push_back(new CComment(oReader));
}
}
@ -277,8 +282,6 @@ namespace OOX
virtual ~CComments()
{
}
public:
virtual void read(const CPath& oPath)
{
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
@ -299,7 +302,7 @@ namespace OOX
return;
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("comments") == sName )
if ( L"comments" == sName )
{
ReadAttributes( oReader );
@ -310,9 +313,9 @@ namespace OOX
{
sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("authors") == sName )
if ( L"authors" == sName )
m_oAuthors = oReader;
else if ( _T("commentList") == sName )
else if ( L"commentList" == sName )
m_oCommentList = oReader;
}
}
@ -321,12 +324,12 @@ namespace OOX
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"));
sXml.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
if(m_oAuthors.IsInit())
m_oAuthors->toXML(sXml);
if(m_oCommentList.IsInit())
m_oCommentList->toXML(sXml);
sXml.WriteString(_T("</comments>"));
sXml.WriteString(L"</comments>");
std::wstring sPath = oPath.GetPath();
NSFile::CFileBinary::SaveToFile(sPath, sXml.GetData());
@ -375,7 +378,7 @@ namespace OOX
}
virtual std::wstring toXML() const
{
return _T("");
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
@ -403,12 +406,9 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"r:id", m_oId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId > m_oId;

View File

@ -36,7 +36,7 @@
#include "../CommonInclude.h"
#include "Si.h"
#include <unordered_map>
#include <map>
namespace OOX
{
@ -172,7 +172,7 @@ namespace OOX
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oUniqueCount;
std::unordered_map<int, CSi*> m_mapItems;
std::map<int, CSi*> m_mapItems;
int m_nCount;
};

View File

@ -42,6 +42,50 @@ namespace OOX
{
//необработано:
//<extLst>
class CFormulaCF : public WritingElement
{
public:
WritingElement_AdditionConstructors(CFormulaCF)
CFormulaCF()
{
m_sNodeName = L"formula";
}
virtual ~CFormulaCF()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(L"<" + m_sNodeName + L">");
writer.WriteEncodeXmlString(m_sText);
writer.WriteString(L"</" + m_sNodeName + L">");
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_sNodeName = oReader.GetName();
if (oReader.IsEmptyNode())
return;
m_sText = oReader.GetText3();
}
virtual EElementType getType () const
{
return et_x_FormulaCF;
}
std::wstring m_sNodeName;
std::wstring m_sText;
};
class CConditionalFormatValueObject : public WritingElement
{
public:
@ -75,8 +119,16 @@ namespace OOX
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
if (oReader.IsEmptyNode())
return;
int nCurDepth = oReader.GetDepth();
while (oReader.ReadNextSiblingNode(nCurDepth))
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (L"formula" == sName || L"f" == sName)
m_oFormula = oReader;
}
}
virtual EElementType getType () const
@ -102,6 +154,8 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oGte;
nullable<SimpleTypes::Spreadsheet::ST_CfvoType<>> m_oType;
nullable<std::wstring> m_oVal;
nullable<CFormulaCF> m_oFormula;
};
class CColorScale : public WritingElementWithChilds<>
@ -252,45 +306,6 @@ namespace OOX
nullable<CColor> m_oColor;
};
class CFormulaCF : public WritingElement
{
public:
WritingElement_AdditionConstructors(CFormulaCF)
CFormulaCF()
{
}
virtual ~CFormulaCF()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<formula>"));
writer.WriteEncodeXmlString(m_sText);
writer.WriteString(_T("</formula>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if (oReader.IsEmptyNode())
return;
m_sText = oReader.GetText3();
}
virtual EElementType getType () const
{
return et_x_FormulaCF;
}
std::wstring m_sText;
};
class CIconSet : public WritingElementWithChilds<CConditionalFormatValueObject>
{
public:

View File

@ -189,7 +189,7 @@ namespace OOX
}
void PrepareComments(OOX::Spreadsheet::CComments* pComments, OOX::CVmlDrawing* pVmlDrawing)
{
std::list<std::wstring*> & aAuthors = pComments->m_oAuthors->m_arrItems;
std::unordered_map<int, std::wstring> & mapAuthors = pComments->m_oAuthors->m_mapItems;
if(pComments->m_oCommentList.IsInit())
{
@ -212,12 +212,12 @@ namespace OOX
unsigned int nAuthorId = pComment->m_oAuthorId->GetValue();
std::list<std::wstring*>::iterator itA = aAuthors.begin();
for(int a = 0; a < nAuthorId; a++)
itA++;
if(itA != aAuthors.end())
pCommentItem->m_sAuthor = *itA;
std::unordered_map<int, std::wstring>::iterator pFind = mapAuthors.find(nAuthorId);
if (pFind != mapAuthors.end())
{
pCommentItem->m_sAuthor = pFind->second;
}
OOX::Spreadsheet::CSi* pSi = pComment->m_oText.GetPointerEmptyNullable();
if(NULL != pSi)

View File

@ -53,6 +53,7 @@
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="0"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\agg2d.pch"
ObjectFile="$(ConfigurationName)\"

View File

@ -850,35 +850,37 @@ namespace NSFile
static bool Copy(const std::wstring& strSrc, const std::wstring& strDst)
{
if (strSrc == strDst)
return true;
return true;
std::ifstream src;
std::ofstream dst;
std::ifstream src;
std::ofstream dst;
int nLenBuffer = 1024 * 1024; // 10
CFileBinary oFile;
if (oFile.OpenFile(strSrc))
{
int nFileSize = (int)oFile.GetFileSize();
if (nFileSize < nLenBuffer)
nLenBuffer = nFileSize;
}
int nLenBuffer = 1024 * 1024; // 10
CFileBinary oFile;
if (oFile.OpenFile(strSrc))
{
int nFileSize = (int)oFile.GetFileSize();
if (nFileSize < nLenBuffer)
nLenBuffer = nFileSize;
char* pBuffer_in = NULL;
char* pBuffer_out = NULL;
oFile.CloseFile();
}
if (nLenBuffer > 0)
{
pBuffer_in = new char[nLenBuffer];
pBuffer_out = new char[nLenBuffer];
char* pBuffer_in = NULL;
char* pBuffer_out = NULL;
src.rdbuf()->pubsetbuf(pBuffer_in, nLenBuffer);
dst.rdbuf()->pubsetbuf(pBuffer_out, nLenBuffer);
}
if (nLenBuffer > 0)
{
pBuffer_in = new char[nLenBuffer];
pBuffer_out = new char[nLenBuffer];
src.rdbuf()->pubsetbuf(pBuffer_in, nLenBuffer);
dst.rdbuf()->pubsetbuf(pBuffer_out, nLenBuffer);
}
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
src.open(strSrc.c_str(), std::ios::binary);
dst.open(strDst.c_str(), std::ios::binary);
src.open(strSrc.c_str(), std::ios::binary);
dst.open(strDst.c_str(), std::ios::binary);
#else
BYTE* pUtf8Src = NULL;
LONG lLenSrc = 0;
@ -887,25 +889,26 @@ namespace NSFile
LONG lLenDst = 0;
CUtf8Converter::GetUtf8StringFromUnicode(strDst.c_str(), strDst.length(), pUtf8Dst, lLenDst, false);
src.open((char*)pUtf8Src, std::ios::binary);
dst.open((char*)pUtf8Dst, std::ios::binary);
src.open((char*)pUtf8Src, std::ios::binary);
dst.open((char*)pUtf8Dst, std::ios::binary);
delete [] pUtf8Src;
delete [] pUtf8Dst;
#endif
bool bRet = false;
bool bRet = false;
if (src.is_open() && dst.is_open())
{
dst << src.rdbuf();
src.close();
dst.close();
bRet = true;
bRet = true;
}
RELEASEARRAYOBJECTS(pBuffer_in);
RELEASEARRAYOBJECTS(pBuffer_out);
return bRet;
RELEASEARRAYOBJECTS(pBuffer_in);
RELEASEARRAYOBJECTS(pBuffer_out);
return bRet;
}
static bool Remove(const std::wstring& strFileName)
{

View File

@ -502,6 +502,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -50,6 +50,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -343,7 +343,8 @@
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -337,8 +337,10 @@
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -345,6 +345,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -50,6 +50,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"

View File

@ -48,8 +48,10 @@
Optimization="0"
AdditionalIncludeDirectories="..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -196,6 +196,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -51,6 +51,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -199,6 +199,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -499,8 +499,10 @@
Optimization="0"
AdditionalIncludeDirectories="..\..\..\include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;FT_DEBUG_LEVEL_ERROR;FT_DEBUG_LEVEL_TRACE;FT2_BUILD_LIBRARY"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
DisableLanguageExtensions="true"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)/"

View File

@ -212,10 +212,11 @@
Optimization="0"
AdditionalIncludeDirectories="&quot;../agg-2.4/include&quot;;&quot;../freetype-2.5.2/include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;$(NOINHERIT)"
MinimalRebuild="false"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="0"
EnableEnhancedInstructionSet="0"
DisableLanguageExtensions="false"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"

View File

@ -47,6 +47,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\vc80.pdb"

View File

@ -496,6 +496,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
PrecompiledHeaderFile=""
AssemblerListingLocation="$(ConfigurationName)\"
ObjectFile="$(IntDir)\"

View File

@ -47,6 +47,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -48,6 +48,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.494.0
VERSION = 2.4.498.0
DEFINES += INTVER=$$VERSION
TARGET = x2t

View File

@ -3882,8 +3882,7 @@ namespace NExtractTools
}
else
{
sTempDir = NSDirectory::GetFolderPath(sFileFrom) + FILE_SEPARATOR_STR + _T("Temp");
NSDirectory::CreateDirectory(sTempDir);
sTempDir = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetFolderPath(sFileTo));
}
if (sTempDir.empty())
{

View File

@ -1376,7 +1376,7 @@ namespace BinXlsxRW
{
int nCurPos;
for ( auto it = sharedString.m_mapItems.begin(); it != sharedString.m_mapItems.end(); it++)
for ( std::map<int, OOX::Spreadsheet::CSi*>::iterator it = sharedString.m_mapItems.begin(); it != sharedString.m_mapItems.end(); it++)
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSharedStringTypes::Si);
WriteSharedString(it->second, pIndexedColors, pTheme, oFontProcessor);

View File

@ -74,22 +74,30 @@ namespace BinXlsxRW {
{
bool bEmpty = true;
SimpleTypes::Spreadsheet::CHexColor oRgbColor;
if(color.m_oIndexed.IsInit())
{
int nIndex = (int)color.m_oIndexed->GetValue();
bool bDefault = true;
std::map<int, OOX::Spreadsheet::CRgbColor*>::iterator pFind = pIndexedColors->mapIndexedColors.find(nIndex);
if(pFind != pIndexedColors->mapIndexedColors.end())
if (pIndexedColors)
{
OOX::Spreadsheet::CRgbColor* pRgbColor = pFind->second;
if(pRgbColor->m_oRgb.IsInit())
std::map<int, OOX::Spreadsheet::CRgbColor*>::iterator pFind = pIndexedColors->mapIndexedColors.find(nIndex);
if(pFind != pIndexedColors->mapIndexedColors.end())
{
bEmpty = false;
oRgbColor = pRgbColor->m_oRgb.get();
OOX::Spreadsheet::CRgbColor* pRgbColor = pFind->second;
if(pRgbColor->m_oRgb.IsInit())
{
bEmpty = false;
oRgbColor = pRgbColor->m_oRgb.get();
bDefault = false;
}
}
}
else
if (bDefault)
{
unsigned char ucA;
unsigned char ucR;

View File

@ -2535,14 +2535,14 @@ namespace BinXlsxRW {
{
m_pCurVmlDrawing->m_mapComments = &m_pCurWorksheet->m_mapComments;
std::map<std::wstring, unsigned int> mapAuthors;
std::unordered_map<std::wstring, unsigned int> mapByAuthors;
OOX::Spreadsheet::CComments* pComments = new OOX::Spreadsheet::CComments();
pComments->m_oCommentList.Init();
std::list<OOX::Spreadsheet::CComment*>& aComments = pComments->m_oCommentList->m_arrItems;
pComments->m_oAuthors.Init();
std::list<std::wstring*>& aAuthors = pComments->m_oAuthors->m_arrItems;
std::unordered_map<int, std::wstring> & mapByIndex = pComments->m_oAuthors->m_mapItems;
for (std::map<std::wstring, OOX::Spreadsheet::CCommentItem*>::const_iterator it = m_pCurWorksheet->m_mapComments.begin(); it != m_pCurWorksheet->m_mapComments.end(); ++it)
{
@ -2559,15 +2559,18 @@ namespace BinXlsxRW {
if(pCommentItem->m_sAuthor.IsInit())
{
const std::wstring& sAuthor = pCommentItem->m_sAuthor.get();
std::map<std::wstring, unsigned int>::const_iterator pair = mapAuthors.find(sAuthor);
std::unordered_map<std::wstring, unsigned int>::const_iterator pFind = mapByAuthors.find(sAuthor);
int nAuthorId;
if(mapAuthors.end() != pair)
nAuthorId = (int)pair->second;
if(pFind != mapByAuthors.end())
nAuthorId = pFind->second;
else
{
nAuthorId = (int)mapAuthors.size();
mapAuthors[sAuthor] = nAuthorId;
aAuthors.push_back(new std::wstring(sAuthor));
nAuthorId = (int)mapByAuthors.size();
mapByAuthors.insert(std::make_pair(sAuthor, nAuthorId));
mapByIndex.insert(std::make_pair(nAuthorId, sAuthor));
}
pNewComment->m_oAuthorId.Init();
pNewComment->m_oAuthorId->SetValue(nAuthorId);
@ -3519,7 +3522,7 @@ namespace BinXlsxRW {
{
int nValue = _wtoi(pCell->m_oValue->ToString().c_str());
std::unordered_map<int, OOX::Spreadsheet::CSi*>::iterator pFind = m_pSharedStrings->m_mapItems.find(nValue);
std::map<int, OOX::Spreadsheet::CSi*>::iterator pFind = m_pSharedStrings->m_mapItems.find(nValue);
if(pFind != m_pSharedStrings->m_mapItems.end())
{

View File

@ -243,7 +243,7 @@ namespace CSVWriter
{
int nValue = _wtoi(pCell->m_oValue->ToString().c_str());
std::unordered_map<int, OOX::Spreadsheet::CSi*>::iterator pFind = pSharedStrings->m_mapItems.find(nValue);
std::map<int, OOX::Spreadsheet::CSi*>::iterator pFind = pSharedStrings->m_mapItems.find(nValue);
if (pFind != pSharedStrings->m_mapItems.end())
{
OOX::Spreadsheet::CSi *pSi = pFind->second;