Commit 5f9c25a9 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

текст, картинки, шейпы, диаграммы

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56836 954022d7-b5bf-4e40-9824-e11837661b57
parent 491ff201
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileW", "ASCOfficeOdfFileW.vcproj", "{6258296E-ABCE-4BC6-9F4A-8522CD615603}"
ProjectSection(ProjectDependencies) = postProject
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormat", "source\OdfFormat.vcproj", "{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormat", "source\OdfFormat.vcproj", "{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A} {94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
...@@ -15,8 +8,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormat", "source\OdfForm ...@@ -15,8 +8,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormat", "source\OdfForm
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "source\Oox2OdfConverter.vcproj", "{BEE01B53-244A-44E6-8947-ED9342D9247E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "source\Oox2OdfConverter.vcproj", "{BEE01B53-244A-44E6-8947-ED9342D9247E}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD} {E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileWTest", "ASCOfficeOdfFileWTest\ASCOfficeOdfFileWTest.vcproj", "{FBA8446A-150F-4A10-B4DA-1022048D6473}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileWTest", "ASCOfficeOdfFileWTest\ASCOfficeOdfFileWTest.vcproj", "{FBA8446A-150F-4A10-B4DA-1022048D6473}"
...@@ -26,49 +19,69 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileWTest", "AS ...@@ -26,49 +19,69 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileWTest", "AS
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpformulasconvert", "..\ASCOfficeOdfFile\formulasconvert\formulasconvert.vcproj", "{94954A67-A853-43B1-A727-6EF2774C5A6A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpformulasconvert", "..\ASCOfficeOdfFile\formulasconvert\formulasconvert.vcproj", "{94954A67-A853-43B1-A727-6EF2774C5A6A}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileW", "ASCOfficeOdfFileW.vcproj", "{6258296E-ABCE-4BC6-9F4A-8522CD615603}"
ProjectSection(ProjectDependencies) = postProject
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32 ReleaseASC|Win32 = ReleaseASC|Win32
ReleaseOpenSource|Win32 = ReleaseOpenSource|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Debug|Win32.ActiveCfg = Debug|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Debug|Win32.Build.0 = Debug|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Release|Win32.ActiveCfg = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Release|Win32.Build.0 = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.ReleaseASC|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.Build.0 = ReleaseOpenSource|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.ActiveCfg = Debug|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.ActiveCfg = Debug|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.Build.0 = Debug|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.Build.0 = Debug|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.ActiveCfg = Release|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.ActiveCfg = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.Build.0 = Release|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.Build.0 = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.ReleaseASC|Win32.ActiveCfg = Release|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.ReleaseASC|Win32.Build.0 = Release|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.ReleaseASC|Win32.Build.0 = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.ActiveCfg = Debug|Win32 {BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.ActiveCfg = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.Build.0 = Debug|Win32 {BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.Build.0 = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.ActiveCfg = Release|Win32 {BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.ActiveCfg = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.Build.0 = Release|Win32 {BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.Build.0 = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.ReleaseASC|Win32.ActiveCfg = Release|Win32 {BEE01B53-244A-44E6-8947-ED9342D9247E}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.ReleaseASC|Win32.Build.0 = Release|Win32 {BEE01B53-244A-44E6-8947-ED9342D9247E}.ReleaseASC|Win32.Build.0 = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.ActiveCfg = Debug|Win32 {FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.ActiveCfg = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.Build.0 = Debug|Win32 {FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.Build.0 = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.ActiveCfg = Release|Win32 {FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.ActiveCfg = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.Build.0 = Release|Win32 {FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.Build.0 = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.ReleaseASC|Win32.ActiveCfg = Release|Win32 {FBA8446A-150F-4A10-B4DA-1022048D6473}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.ReleaseASC|Win32.Build.0 = Release|Win32 {FBA8446A-150F-4A10-B4DA-1022048D6473}.ReleaseASC|Win32.Build.0 = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|Win32.ActiveCfg = Debug|Win32 {94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|Win32.ActiveCfg = Debug|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|Win32.Build.0 = Debug|Win32 {94954A67-A853-43B1-A727-6EF2774C5A6A}.Debug|Win32.Build.0 = Debug|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.ActiveCfg = Release|Win32 {94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.ActiveCfg = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.Build.0 = Release|Win32 {94954A67-A853-43B1-A727-6EF2774C5A6A}.Release|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseASC|Win32.ActiveCfg = Release|Win32 {94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseASC|Win32.Build.0 = Release|Win32 {94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseASC|Win32.Build.0 = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{94954A67-A853-43B1-A727-6EF2774C5A6A}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.Build.0 = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Debug|Win32.ActiveCfg = Debug|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Debug|Win32.Build.0 = Debug|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Release|Win32.ActiveCfg = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.Release|Win32.Build.0 = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.ReleaseASC|Win32.Build.0 = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{6258296E-ABCE-4BC6-9F4A-8522CD615603}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "odf_conversion_context.h" #include "odf_conversion_context.h"
#include "ods_table_state.h"//???
#include "office_chart.h" #include "office_chart.h"
#include "styles.h" #include "styles.h"
...@@ -40,6 +42,14 @@ namespace odf ...@@ -40,6 +42,14 @@ namespace odf
std::wstring name; std::wstring name;
office_element_ptr elm; office_element_ptr elm;
}; };
struct odf_cash_state
{
std::wstring ref;
std::wstring format;
//std::vector<double> data_double;
std::vector<std::wstring> data_str;
};
struct odf_chart_state struct odf_chart_state
{ {
odf_chart_state() {clear();} odf_chart_state() {clear();}
...@@ -82,6 +92,9 @@ public: ...@@ -82,6 +92,9 @@ public:
std::vector<office_element_ptr> group_series_; std::vector<office_element_ptr> group_series_;
std::vector<unsigned int> axis_group_series_; std::vector<unsigned int> axis_group_series_;
std::vector<std::wstring> data_cell_ranges_; std::vector<std::wstring> data_cell_ranges_;
std::vector<odf_cash_state> cash_;
bool local_table_enabled_;
std::vector<odf_chart_level_state> current_level_; // std::vector<odf_chart_level_state> current_level_; //
std::vector<odf_chart_state> chart_list_; // .. "" std::vector<odf_chart_state> chart_list_; // .. ""
...@@ -94,6 +107,8 @@ public: ...@@ -94,6 +107,8 @@ public:
chart_chart *get_current_chart(); chart_chart *get_current_chart();
chart_axis *get_current_axis(); chart_axis *get_current_axis();
chart_series *get_current_series(); chart_series *get_current_series();
void create_local_table();
}; };
chart_chart* odf_chart_context::Impl::get_current_chart() chart_chart* odf_chart_context::Impl::get_current_chart()
{ {
...@@ -126,8 +141,10 @@ void odf_chart_context::Impl::clear_current() ...@@ -126,8 +141,10 @@ void odf_chart_context::Impl::clear_current()
axis_.clear(); axis_.clear();
group_series_.clear(); group_series_.clear();
data_cell_ranges_.clear(); data_cell_ranges_.clear();
cash_.clear();
current_series_count_ = 0; current_series_count_ = 0;
local_table_enabled_ = false;
} }
void odf_chart_context::Impl::set_default_series_color() void odf_chart_context::Impl::set_default_series_color()
{ {
...@@ -206,6 +223,8 @@ void odf_chart_context::start_chart(office_element_ptr & root) ...@@ -206,6 +223,8 @@ void odf_chart_context::start_chart(office_element_ptr & root)
} }
void odf_chart_context::set_chart_size(double width_pt, double height_pt) void odf_chart_context::set_chart_size(double width_pt, double height_pt)
{ {
if (width_pt <0.01 || height_pt < 0.01)return;
impl_->current_chart_state_.chart_height_pt = height_pt; impl_->current_chart_state_.chart_height_pt = height_pt;
impl_->current_chart_state_.chart_width_pt = width_pt; impl_->current_chart_state_.chart_width_pt = width_pt;
...@@ -726,7 +745,7 @@ void odf_chart_context::end_plot_area() ...@@ -726,7 +745,7 @@ void odf_chart_context::end_plot_area()
{ {
cell_range = cell_range + impl_->data_cell_ranges_[i] + L" "; cell_range = cell_range + impl_->data_cell_ranges_[i] + L" ";
} }
plot_area->chart_plot_area_attlist_.table_cell_range_address_ = cell_range; //plot_area->chart_plot_area_attlist_.table_cell_range_address_ = cell_range; - !!!
} }
end_element(); end_element();
} }
...@@ -1162,10 +1181,13 @@ void odf_chart_context::end_element() ...@@ -1162,10 +1181,13 @@ void odf_chart_context::end_element()
void odf_chart_context::end_chart() void odf_chart_context::end_chart()
{ {
if (impl_->current_chart_state_.elements_.size() < 1) return; if (impl_->current_chart_state_.elements_.size() < 1) return;
impl_->create_local_table();
end_element(); end_element();
/////////////////// ///////////////////
for (long i=0; i< impl_->axis_.size() && impl_->categories_.size() > 0; i++) for (long i=0; i< impl_->axis_.size() && impl_->categories_.size() > 0; i++)
{ {
if (impl_->axis_[i].elm == NULL)continue; if (impl_->axis_[i].elm == NULL)continue;
...@@ -1191,11 +1213,24 @@ static formulasconvert::oox2odf_converter formulas_converter; ...@@ -1191,11 +1213,24 @@ static formulasconvert::oox2odf_converter formulas_converter;
void odf_chart_context::set_series_value_formula(std::wstring oox_formula) void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
{ {
//if (impl_->local_table_enabled_)
//{
// //rename table name -> local_table
// std::wstring table_name ;
// int res= oox_formula.find(L"!");
// if (res > 0)
// {
// table_name = oox_formula.substr(0,res);
// boost::algorithm::replace_all(oox_formula, table_name, L"local-table");
// }
//}
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula); std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
if (series == NULL)return; if (series == NULL)return;
series->chart_series_attlist_.chart_values_cell_range_address_ = odfFormula; series->chart_series_attlist_.chart_values_cell_range_address_ = odfFormula;
impl_->data_cell_ranges_.push_back(odfFormula); impl_->data_cell_ranges_.push_back(odfFormula);
...@@ -1203,6 +1238,18 @@ void odf_chart_context::set_series_value_formula(std::wstring oox_formula) ...@@ -1203,6 +1238,18 @@ void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
} }
void odf_chart_context::set_series_label_formula(std::wstring oox_formula) void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
{ {
//if (impl_->local_table_enabled_)
//{
// //rename table name -> local_table
// std::wstring table_name ;
// int res= oox_formula.find(L"!");
// if (res > 0)
// {
// table_name = oox_formula.substr(0,res);
// boost::algorithm::replace_all(oox_formula, table_name, L"local-table");
// }
//}
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula); std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
...@@ -1214,6 +1261,18 @@ void odf_chart_context::set_series_label_formula(std::wstring oox_formula) ...@@ -1214,6 +1261,18 @@ void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type) void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type)
{ {
//if (impl_->local_table_enabled_)
//{
// //rename table name -> local_table
// std::wstring table_name ;
// int res= oox_formula.find(L"!");
// if (res > 0)
// {
// table_name = oox_formula.substr(0,res);
// boost::algorithm::replace_all(oox_formula, table_name, L"local-table");
// }
//}
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula); std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
impl_->data_cell_ranges_.push_back(odfFormula); impl_->data_cell_ranges_.push_back(odfFormula);
...@@ -1226,6 +1285,177 @@ void odf_chart_context::set_series_pie_explosion(int val) ...@@ -1226,6 +1285,177 @@ void odf_chart_context::set_series_pie_explosion(int val)
impl_->current_level_.back().chart_properties_->content().chart_pie_offset_ = val; impl_->current_level_.back().chart_properties_->content().chart_pie_offset_ = 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;
//
// std::wstring ref = impl_->data_cell_ranges_.back();
// std::vector<std::wstring> data_str;
//
// odf_cash_state state = {ref, format,/*data_double,*/data_str};
// impl_->cash_.push_back(state);
//}
void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> & data_str)
{
if (data_str.size() <1 || impl_->data_cell_ranges_.size() < 1) return;
std::wstring ref = impl_->data_cell_ranges_.back();
std::vector<double> data_double;
odf_cash_state state = {ref, format/*,data_double*/,data_str};
impl_->cash_.push_back(state);
}
void odf_chart_context::set_local_table (bool Val)
{
if (Val == false) return;
impl_->local_table_enabled_ = Val;
}
void odf_chart_context::Impl::create_local_table()
{
if (local_table_enabled_ == false)return;
struct _cell_cash
{
int col;
int row;
std::wstring val;
};
struct _sort_cells
{
bool operator() (_cell_cash i, _cell_cash j)
{
if (i.row==j.row)
return (i.col<j.col);
else
return (i.row<j.row);
}
} sort_cells;
std::vector<_cell_cash> cells_cash;
std::wstring table_name = L"local-table";
for (long i=0; i < cash_.size(); i++)
{
std::vector<std::wstring> refs;
boost::algorithm::split(refs,cash_[i].ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
__int32 col1,col2,row1,row2;
if (refs.size()<1) continue;
int r = refs[0].find(L".");
if (r>0)
{
table_name = refs[0].substr (0,r);
refs[0] = refs[0].substr(r+1,refs[0].size()-r);
}
utils::parsing_ref( refs[0],col1,row1);
if (refs.size()>1)
{
r = refs[1].find(L".");
if (r>0)refs[1] = refs[1].substr(r+1,refs[1].size()-r);
utils::parsing_ref( refs[1],col2,row2);
}
else
{
col2=col1;row2=row1;
}
for (long j=0;j<cash_[i].data_str.size(); j++)
{
_cell_cash c;
c.col = (col2==col1) ? col1 : col1+j;
c.row = (row2==row1) ? row1 : row1+j;
c.val = cash_[i].data_str[j];
cells_cash.push_back(c);
}
}
std::sort(cells_cash.begin(), cells_cash.end(),sort_cells);
/////////////////////////
//create tables
office_element_ptr table_elm;
create_element(L"table", L"table",table_elm, odf_context_);
ods_table_state * table_state = new ods_table_state(odf_context_, table_elm);
if (table_state)
{
current_level_[0].elm->add_child_element(table_elm);
int level = current_level_.size();
odf_element_state state={table_elm, L"", office_element_ptr(), level+1};
current_chart_state_.elements_.push_back(state);
table_state->set_table_name(table_name);
int curr_row = 0;
int max_columns=0;
int curr_cell = 0;
for (long i = 0; i< cells_cash.size(); i++)
{
if (cells_cash[i].row > curr_row+1)
{
office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_);
table_state->add_row(row_elm,cells_cash[i].row - curr_row -2,office_element_ptr());
curr_row = cells_cash[i].row-1;
}
if (cells_cash[i].row == curr_row+1)
{
office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_);
table_state->add_row(row_elm,1 ,office_element_ptr());
curr_row++;
curr_cell=1;
}
if (curr_cell < cells_cash[i].col)
table_state->add_default_cell(cells_cash[i].col - curr_cell);
office_element_ptr cell_elm;
create_element(L"table", L"table-cell",cell_elm, odf_context_);
table_state->start_cell(cell_elm,office_element_ptr());
table_state->set_cell_value(cells_cash[i].val, true);
//add type
table_state->end_cell();
curr_cell = cells_cash[i].col;
if (curr_cell > max_columns) max_columns = curr_cell;
}
//office_element_ptr hc_elm;
//create_element(L"table", L"table-header-columns",hc_elm, odf_context_);
//table_elm->add_child_element(hc_elm);
//office_element_ptr hr_elm;
//create_element(L"table", L"table-header-rows",hr_elm, odf_context_);
//table_elm->add_child_element(hr_elm);
office_element_ptr cols_elm;
create_element(L"table", L"table-columns",cols_elm, odf_context_);
table_elm->add_child_element(cols_elm);
office_element_ptr col_elm;
create_element(L"table", L"table-column",col_elm, odf_context_);
for (long i=0; i < max_columns; i++)
{
cols_elm->add_child_element(col_elm);
//table_state->add_column(col_elm,1,office_element_ptr());
}
}
delete table_state;
}
} }
} }
\ No newline at end of file
...@@ -110,6 +110,10 @@ public: ...@@ -110,6 +110,10 @@ public:
void set_layout_w(double *val,int mode); void set_layout_w(double *val,int mode);
void set_layout_h(double *val,int mode); void set_layout_h(double *val,int mode);
void set_local_table(bool Val);
//void set_cash(std::wstring format, std::vector<double> &data);
void set_cash(std::wstring format, std::vector<std::wstring> &data);
void end_chart(); void end_chart();
private: private:
......
...@@ -136,6 +136,8 @@ public: ...@@ -136,6 +136,8 @@ public:
std::vector<odf_group_state> group_list_; // std::vector<odf_group_state> group_list_; //
std::vector<odf_drawing_state> drawing_list_; // ( ) .. "" std::vector<odf_drawing_state> drawing_list_; // ( ) .. ""
office_element_ptr root_element_;
}; };
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
...@@ -261,6 +263,8 @@ void odf_drawing_context::clear() ...@@ -261,6 +263,8 @@ void odf_drawing_context::clear()
impl_->global_svg_y_ = boost::none; impl_->global_svg_y_ = boost::none;
impl_->global_svg_height_ = boost::none; impl_->global_svg_height_ = boost::none;
impl_->global_svg_width_ = boost::none; impl_->global_svg_width_ = boost::none;
impl_->root_element_ = office_element_ptr();
} }
void odf_drawing_context::start_drawing() void odf_drawing_context::start_drawing()
...@@ -385,6 +389,7 @@ office_element_ptr odf_drawing_context::Impl::create_draw_element(int type) ...@@ -385,6 +389,7 @@ office_element_ptr odf_drawing_context::Impl::create_draw_element(int type)
create_element(L"draw", L"g", element, odf_context_); create_element(L"draw", L"g", element, odf_context_);
break; break;
} }
if (root_element_ == NULL) root_element_ = element;
return element; return element;
} }
...@@ -720,14 +725,14 @@ void odf_drawing_context::set_rotate(int iVal) ...@@ -720,14 +725,14 @@ void odf_drawing_context::set_rotate(int iVal)
double dRotate = (360 - iVal/60000.)/180. * 3.14159265358979323846; double dRotate = (360 - iVal/60000.)/180. * 3.14159265358979323846;
impl_->current_drawing_state_.rotateAngle = dRotate; impl_->current_drawing_state_.rotateAngle = dRotate;
} }
void odf_drawing_context::set_drawings_rect(double x_pt, double y_pt, double width_pt, double height_pt) void odf_drawing_context::set_drawings_rect(double x_pt, double y_pt, double width_pt, double height_pt)// "- 1"
{ {
// ( ) // ( )
impl_->global_svg_x_ = length(length(x_pt,length::pt).get_value_unit(length::cm),length::cm); if (x_pt >= 0) impl_->global_svg_x_ = length(length(x_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->global_svg_y_ = length(length(y_pt,length::pt).get_value_unit(length::cm),length::cm); if (y_pt >= 0) impl_->global_svg_y_ = length(length(y_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->global_svg_height_ = length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm); if (width_pt >= 0) impl_->global_svg_height_ = length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->global_svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm); if (height_pt >= 0)impl_->global_svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
} }
void odf_drawing_context::set_position(double x_pt, double y_pt) void odf_drawing_context::set_position(double x_pt, double y_pt)
{ {
...@@ -1578,6 +1583,11 @@ void odf_drawing_context::set_bitmap_tile_translate_x(double x) ...@@ -1578,6 +1583,11 @@ void odf_drawing_context::set_bitmap_tile_translate_x(double x)
if (!impl_->current_graphic_properties)return; if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_image_ref_point_x_ = percent(x); impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_image_ref_point_x_ = percent(x);
} }
office_element_ptr & odf_drawing_context::get_root_element()
{
return impl_->root_element_;
}
/////////////////// ///////////////////
} }
} }
\ No newline at end of file
...@@ -59,6 +59,8 @@ public: ...@@ -59,6 +59,8 @@ public:
void start_object(std::wstring name); void start_object(std::wstring name);
void end_object(); void end_object();
office_element_ptr & get_root_element();
void start_element(office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr()); void start_element(office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr());
void end_element(); void end_element();
......
...@@ -56,7 +56,7 @@ void odf_text_context::add_text_content(const std::wstring & text) ...@@ -56,7 +56,7 @@ void odf_text_context::add_text_content(const std::wstring & text)
//} //}
//else //else
{ {
if (current_level_.size() >=0 ) if (current_level_.size() > 0 )
current_level_.back()->add_text(text); current_level_.back()->add_text(text);
} }
} }
......
...@@ -149,7 +149,7 @@ void ods_table_context::add_defined_expression(std::wstring & name,std::wstring ...@@ -149,7 +149,7 @@ void ods_table_context::add_defined_expression(std::wstring & name,std::wstring
void ods_table_context::start_table(office_element_ptr & elm) void ods_table_context::start_table(office_element_ptr & elm)
{ {
table_state_list_.push_back( ods_table_state(context_, elm) ); table_state_list_.push_back( ods_table_state(&context_, elm) );
std::wstring style_name_new = L"ta" + boost::lexical_cast<std::wstring>(table_state_list_.size()); std::wstring style_name_new = L"ta" + boost::lexical_cast<std::wstring>(table_state_list_.size());
......
...@@ -94,7 +94,7 @@ std::wstring convert_time(std::wstring & oox_time) ...@@ -94,7 +94,7 @@ std::wstring convert_time(std::wstring & oox_time)
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
static formulasconvert::oox2odf_converter formulas_converter; static formulasconvert::oox2odf_converter formulas_converter;
ods_table_state::ods_table_state(ods_conversion_context & Context, office_element_ptr & elm): context_(Context),drawing_context_(&Context) ods_table_state::ods_table_state(odf_conversion_context * Context, office_element_ptr & elm): context_(Context),drawing_context_(Context)
{ {
office_table_ = elm; office_table_ = elm;
...@@ -501,7 +501,7 @@ void ods_table_state::add_definded_expression(office_element_ptr & elm) ...@@ -501,7 +501,7 @@ void ods_table_state::add_definded_expression(office_element_ptr & elm)
{ {
if (!table_defined_expressions_) if (!table_defined_expressions_)
{ {
create_element(L"table", L"named-expressions",table_defined_expressions_,&context_); create_element(L"table", L"named-expressions",table_defined_expressions_,context_);
office_table_->add_child_element(table_defined_expressions_); office_table_->add_child_element(table_defined_expressions_);
} }
if (!table_defined_expressions_)return; if (!table_defined_expressions_)return;
...@@ -521,7 +521,7 @@ void ods_table_state::start_comment(__int32 col, __int32 row, std::wstring & aut ...@@ -521,7 +521,7 @@ void ods_table_state::start_comment(__int32 col, __int32 row, std::wstring & aut
ods_comment_state state; ods_comment_state state;
state.row=row; state.col =col; state.author = author; state.row=row; state.col =col; state.author = author;
create_element(L"office", L"annotation",state.elm,&context_); create_element(L"office", L"annotation",state.elm,context_);
comments_.push_back(state); comments_.push_back(state);
} }
...@@ -552,7 +552,7 @@ void ods_table_state::end_comment(odf_text_context *text_context) ...@@ -552,7 +552,7 @@ void ods_table_state::end_comment(odf_text_context *text_context)
if (comments_.back().author.length() > 0 && comments_.back().elm) if (comments_.back().author.length() > 0 && comments_.back().elm)
{ {
office_element_ptr dc_elm; office_element_ptr dc_elm;
create_element(L"dc", L"creator",dc_elm,&context_); create_element(L"dc", L"creator",dc_elm,context_);
if (dc_elm) if (dc_elm)
{ {
dc_elm->add_text(comments_.back().author); dc_elm->add_text(comments_.back().author);
...@@ -852,7 +852,7 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va ...@@ -852,7 +852,7 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va
// table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix); // table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix);
//} //}
} }
void ods_table_state::set_cell_value(std::wstring & value) void ods_table_state::set_cell_value(std::wstring & value, bool need_cash)
{ {
if (cells_size_ < 1)return; if (cells_size_ < 1)return;
...@@ -910,18 +910,27 @@ void ods_table_state::set_cell_value(std::wstring & value) ...@@ -910,18 +910,27 @@ void ods_table_state::set_cell_value(std::wstring & value)
{ {
if (need_test_cach) if (need_test_cach)
{ {
double test = boost::lexical_cast<double>(value); double test = boost::lexical_cast<double>(value);
need_cash =true;
} }
context_.start_text_context();
context_.text_context()->start_paragraph();
context_.text_context()->add_text_content(value);
context_.text_context()->end_paragraph();
set_cell_text(context_.text_context(), true);
context_.end_text_context();
} }
catch(...) catch(...)
{ {
if (need_cash)
{
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_ = boost::none;
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::String);
}
}
if (need_cash)
{
context_->start_text_context();
context_->text_context()->start_paragraph();
context_->text_context()->add_text_content(value);
context_->text_context()->end_paragraph();
set_cell_text(context_->text_context(), true);
context_->end_text_context();
} }
} }
} }
...@@ -959,7 +968,7 @@ void ods_table_state::add_default_cell( __int16 repeated) ...@@ -959,7 +968,7 @@ void ods_table_state::add_default_cell( __int16 repeated)
////////////////////////////////////////////////// //////////////////////////////////////////////////
office_element_ptr default_cell_elm; office_element_ptr default_cell_elm;
create_element(L"table", L"table-cell",default_cell_elm, &context_); create_element(L"table", L"table-cell",default_cell_elm, context_);
current_row_element()->add_child_element(default_cell_elm); current_row_element()->add_child_element(default_cell_elm);
...@@ -990,7 +999,7 @@ void ods_table_state::add_default_cell( __int16 repeated) ...@@ -990,7 +999,7 @@ void ods_table_state::add_default_cell( __int16 repeated)
void ods_table_state::start_conditional_formats() void ods_table_state::start_conditional_formats()
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"calcext", L"conditional-formats",elm,&context_); create_element(L"calcext", L"conditional-formats",elm,context_);
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
current_level_.push_back(elm); current_level_.push_back(elm);
...@@ -1003,7 +1012,7 @@ void ods_table_state::end_conditional_formats() ...@@ -1003,7 +1012,7 @@ void ods_table_state::end_conditional_formats()
void ods_table_state::start_conditional_format(std::wstring ref) void ods_table_state::start_conditional_format(std::wstring ref)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"calcext", L"conditional-format",elm,&context_); create_element(L"calcext", L"conditional-format",elm,context_);
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
current_level_.push_back(elm); current_level_.push_back(elm);
...@@ -1028,13 +1037,13 @@ void ods_table_state::start_conditional_rule(__int32 rule_type) ...@@ -1028,13 +1037,13 @@ void ods_table_state::start_conditional_rule(__int32 rule_type)
{ {
office_element_ptr elm; office_element_ptr elm;
if (rule_type == 3) create_element(L"calcext", L"color-scale",elm,&context_); if (rule_type == 3) create_element(L"calcext", L"color-scale",elm,context_);
else if (rule_type == 7)create_element(L"calcext", L"data-bar",elm,&context_); else if (rule_type == 7)create_element(L"calcext", L"data-bar",elm,context_);
else if (rule_type ==10)create_element(L"calcext", L"icon-set",elm,&context_); else if (rule_type ==10)create_element(L"calcext", L"icon-set",elm,context_);
else if (rule_type ==14)create_element(L"calcext", L"date-is",elm,&context_); else if (rule_type ==14)create_element(L"calcext", L"date-is",elm,context_);
else else
{ {
create_element(L"calcext", L"condition",elm,&context_); create_element(L"calcext", L"condition",elm,context_);
calcext_condition* condition = dynamic_cast<calcext_condition*> (elm.get()); calcext_condition* condition = dynamic_cast<calcext_condition*> (elm.get());
if (condition) if (condition)
...@@ -1147,7 +1156,7 @@ void ods_table_state::set_conditional_value(__int32 type, std::wstring value ) ...@@ -1147,7 +1156,7 @@ void ods_table_state::set_conditional_value(__int32 type, std::wstring value )
if (icon_set || data_bar) if (icon_set || data_bar)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"calcext", L"formatting-entry",elm, &context_); create_element(L"calcext", L"formatting-entry",elm, context_);
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
...@@ -1170,7 +1179,7 @@ void ods_table_state::set_conditional_value(__int32 type, std::wstring value ) ...@@ -1170,7 +1179,7 @@ void ods_table_state::set_conditional_value(__int32 type, std::wstring value )
if (color_scale) if (color_scale)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"calcext", L"color-scale-entry",elm, &context_); create_element(L"calcext", L"color-scale-entry",elm, context_);
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
......
...@@ -171,7 +171,7 @@ struct ods_array_formula_state ...@@ -171,7 +171,7 @@ struct ods_array_formula_state
class ods_table_state class ods_table_state
{ {
public: public:
ods_table_state(ods_conversion_context & Context, office_element_ptr & elm); ods_table_state(odf_conversion_context * Context, office_element_ptr & elm);
void set_table_name(std::wstring name); void set_table_name(std::wstring name);
void set_table_style(office_element_ptr & _style); void set_table_style(office_element_ptr & _style);
void set_table_hidden(bool Val); void set_table_hidden(bool Val);
...@@ -206,7 +206,7 @@ public: ...@@ -206,7 +206,7 @@ public:
void set_cell_format_value(office_value_type::type value_type); void set_cell_format_value(office_value_type::type value_type);
void set_cell_type(__int32 type); void set_cell_type(__int32 type);
void set_cell_value(std::wstring & value); void set_cell_value(std::wstring & value, bool need_cash = false);
void set_cell_text(odf_text_context *text_context, bool cash_value = false); void set_cell_text(odf_text_context *text_context, bool cash_value = false);
void set_cell_formula(std::wstring &formula); void set_cell_formula(std::wstring &formula);
void set_cell_array_formula(std::wstring & formula, std::wstring ref); void set_cell_array_formula(std::wstring & formula, std::wstring ref);
...@@ -267,7 +267,7 @@ public: ...@@ -267,7 +267,7 @@ public:
private: private:
ods_conversion_context & context_; odf_conversion_context * context_;
std::wstring office_table_name_; std::wstring office_table_name_;
office_element_ptr office_table_; office_element_ptr office_table_;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "style_paragraph_properties.h" #include "style_paragraph_properties.h"
#include <XlsxFormat\Xlsx.h> #include <XlsxFormat\Xlsx.h>
#include <DocxFormat\Docx.h>
namespace Oox2Odf namespace Oox2Odf
{ {
......
...@@ -28,6 +28,9 @@ namespace OOX ...@@ -28,6 +28,9 @@ namespace OOX
namespace Drawing namespace Drawing
{ {
class CPicture;
class CChart;
class CGraphic;
class CInline; class CInline;
class CAnchor; class CAnchor;
class CNonVisualDrawingProps; class CNonVisualDrawingProps;
...@@ -313,6 +316,10 @@ public: ...@@ -313,6 +316,10 @@ public:
void convert(OOX::Spreadsheet::CT_DLbls *ser_lbls); void convert(OOX::Spreadsheet::CT_DLbls *ser_lbls);
void convert(OOX::Spreadsheet::CT_Marker *marker); void convert(OOX::Spreadsheet::CT_Marker *marker);
void convert(OOX::Spreadsheet::CT_Marker *marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt); void convert(OOX::Spreadsheet::CT_Marker *marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt);
void convert(OOX::Spreadsheet::CT_ExternalData *external_data);
void convert(OOX::Spreadsheet::CT_NumData *num_data);
void convert(OOX::Spreadsheet::CT_StrData *str_data);
////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size); void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
}; };
......
...@@ -23,6 +23,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart) ...@@ -23,6 +23,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
{ {
if (!oox_chart)return; if (!oox_chart)return;
convert(oox_chart->m_externalData);
convert(oox_chart->m_oSpPr.GetPointer()); convert(oox_chart->m_oSpPr.GetPointer());
convert(oox_chart->m_oTxPr.GetPointer()); convert(oox_chart->m_oTxPr.GetPointer());
...@@ -901,7 +903,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx) ...@@ -901,7 +903,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
if (ser_tx->m_strRef) if (ser_tx->m_strRef)
{ {
if (ser_tx->m_strRef->m_f)odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f)); if (ser_tx->m_strRef->m_f)odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f));
if (ser_tx->m_strRef->m_strCache){}
convert(ser_tx->m_strRef->m_strCache);
} }
//if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(string2std_string(*ser_tx->m_v)); //if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(string2std_string(*ser_tx->m_v));
...@@ -917,12 +920,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type) ...@@ -917,12 +920,14 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_AxDataSource* cat, int type)
if (cat->m_strRef) if (cat->m_strRef)
{ {
if (cat->m_strRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_strRef->m_f),type); if (cat->m_strRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_strRef->m_f),type);
if (cat->m_strRef->m_strCache){}
convert(cat->m_strRef->m_strCache);
} }
else if (cat->m_numRef) else if (cat->m_numRef)
{ {
if (cat->m_numRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_numRef->m_f),type); if (cat->m_numRef->m_f)odf_context()->chart_context()->set_category_axis_formula(string2std_string(*cat->m_numRef->m_f),type);
if (cat->m_numRef->m_numCache){}
convert(cat->m_numRef->m_numCache);
} }
else if (cat->m_numLit) else if (cat->m_numLit)
{ {
...@@ -937,7 +942,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val) ...@@ -937,7 +942,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumDataSource* val)
if (val->m_numRef) if (val->m_numRef)
{ {
if (val->m_numRef->m_f)odf_context()->chart_context()->set_series_value_formula(string2std_string(*val->m_numRef->m_f)); if (val->m_numRef->m_f)odf_context()->chart_context()->set_series_value_formula(string2std_string(*val->m_numRef->m_f));
if (val->m_numRef->m_numCache){}
convert(val->m_numRef->m_numCache);
} }
else if (val->m_numLit) else if (val->m_numLit)
{ {
...@@ -955,4 +961,66 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Surface* ct_surface, int type) ...@@ -955,4 +961,66 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Surface* ct_surface, int type)
//odf_context()->chart_context()->end_element(); //odf_context()->chart_context()->end_element();
} }
void OoxConverter::convert(OOX::Spreadsheet::CT_ExternalData *external_data)
{
if (external_data == NULL)return;
// !!!
if (external_data->m_id == NULL)return;
//CString pathEmbeddings = GetEmbeddings(*external_data->m_id);
//oO
//unpack
//get/check Format - xlsx
// sheets -> table:table
//
//convert xlsx -> ods & read tables???
odf_context()->chart_context()->set_local_table(true);// ....
}
void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data)
{
if (num_data == NULL)return;
//std::vector<double> data;
std::vector<std::wstring> data;
for (long i=0; i < num_data->m_pt.GetCount(); i++)
{
if (num_data->m_pt[i] && num_data->m_pt[i]->m_v)
{
data.push_back(string2std_string(*num_data->m_pt[i]->m_v));
//double val=0;
//try
//{
// val = boost::lexical_cast<double>(num_data->m_pt[i]->m_v->GetBuffer());
//}catch(...)
//{
//}
//data.push_back(val);
}
}
std::wstring format;
if (num_data->m_formatCode) format = string2std_string(*num_data->m_formatCode);
odf_context()->chart_context()->set_cash(format, data);
}
void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data)
{
if (str_data == NULL)return;
std::vector<std::wstring> data;
for (long i=0; i < str_data->m_pt.GetCount(); i++)
{
if (str_data->m_pt[i] && str_data->m_pt[i]->m_v)
data.push_back(string2std_string(*str_data->m_pt[i]->m_v));
}
std::wstring format;
odf_context()->chart_context()->set_cash(format, data);
}
} }
\ No newline at end of file
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
#include "stdAfx.h" #include "stdAfx.h"
#include "DocxConverter.h" #include "DocxConverter.h"
#include "../utils.h"
#include <DocxFormat\Docx.h> #include <DocxFormat\Docx.h>
#include <XlsxFormat\Chart\Chart.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -46,7 +48,10 @@ odf::odf_conversion_context* DocxConverter::odf_context() ...@@ -46,7 +48,10 @@ odf::odf_conversion_context* DocxConverter::odf_context()
} }
OOX::CTheme* DocxConverter::oox_theme() OOX::CTheme* DocxConverter::oox_theme()
{ {
return NULL; if (docx_document)
return docx_document->GetTheme();
else
return NULL;
} }
CString DocxConverter::find_link_by_id (CString sId, int type) CString DocxConverter::find_link_by_id (CString sId, int type)
{ {
...@@ -94,7 +99,7 @@ void DocxConverter::convertDocument() ...@@ -94,7 +99,7 @@ void DocxConverter::convertDocument()
delete docx_document; docx_document = NULL; delete docx_document; docx_document = NULL;
odt_context->end_document(); odt_context->end_document();
} }
void DocxConverter::convert_document() void DocxConverter::convert_document()
...@@ -147,11 +152,21 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -147,11 +152,21 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
{ {
OOX::Logic::CDrawing* pDrawing= static_cast<OOX::Logic::CDrawing*>(oox_unknown); OOX::Logic::CDrawing* pDrawing= static_cast<OOX::Logic::CDrawing*>(oox_unknown);
convert(pDrawing); convert(pDrawing);
} }break;
case OOX::et_w_Shape:
{
OOX::Logic::CShape* pShape = static_cast<OOX::Logic::CShape*>(oox_unknown);
convert(pShape);
}break;
case OOX::et_w_GroupShape:
{
OOX::Logic::CGroupShape* pGroupShape= static_cast<OOX::Logic::CGroupShape*>(oox_unknown);
convert(pGroupShape);
}break;
default: default:
{ {
OoxConverter::convert(oox_unknown); OoxConverter::convert(oox_unknown);
} }break;
} }
} }
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
...@@ -210,17 +225,230 @@ void DocxConverter::convert(OOX::Logic::CDrawing *oox_drawing) ...@@ -210,17 +225,230 @@ void DocxConverter::convert(OOX::Logic::CDrawing *oox_drawing)
{ {
if (oox_drawing == NULL) return; if (oox_drawing == NULL) return;
convert(oox_drawing->m_oAnchor.GetPointer()); odt_context->start_drawings();
convert(oox_drawing->m_oInline.GetPointer()); convert(oox_drawing->m_oAnchor.GetPointer());
convert(oox_drawing->m_oInline.GetPointer());
odt_context->end_drawings();
} }
void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor) void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
{ {
if (oox_anchor == NULL)return; if (oox_anchor == NULL)return;
double width =0, height=0;
if (oox_anchor->m_oExtent.IsInit()) //size
{
width = oox_anchor->m_oExtent->m_oCx.ToPoints();
height = oox_anchor->m_oExtent->m_oCx.ToPoints();
}
odt_context->drawing_context()->set_drawings_rect(-1, -1, width, height);
convert(oox_anchor->m_oGraphic.GetPointer());
} }
void DocxConverter::convert(OOX::Drawing::CInline *oox_inline) void DocxConverter::convert(OOX::Drawing::CInline *oox_inline)
{ {
if (oox_inline == NULL)return; if (oox_inline == NULL)return;
double width =0, height=0;
if (oox_inline->m_oExtent.IsInit()) //size
{
width = oox_inline->m_oExtent->m_oCx.ToPoints();
height = oox_inline->m_oExtent->m_oCy.ToPoints();
}
odt_context->drawing_context()->set_drawings_rect(-1, -1, width, height);
convert(oox_inline->m_oGraphic.GetPointer());
}
void DocxConverter::convert(OOX::Drawing::CGraphic *oox_graphic)
{
if (oox_graphic == NULL)return;
convert(oox_graphic->m_oPicture.GetPointer());
convert(oox_graphic->m_oChart.GetPointer());
convert(oox_graphic->m_oShape.GetPointer());
convert(oox_graphic->m_oGroupShape.GetPointer());
}
void DocxConverter::convert(OOX::Drawing::CPicture * oox_picture)
{
if (!oox_picture)return;
odt_context->drawing_context()->start_drawing();
CString pathImage;
double Width=0, Height = 0;
if (oox_picture->m_oBlipFill.m_oBlip.IsInit())
{
CString sID = oox_picture->m_oBlipFill.m_oBlip->m_oEmbed.GetValue();
pathImage = find_link_by_id(sID,1);
if (pathImage.GetLength() < 1)
{
sID = oox_picture->m_oBlipFill.m_oBlip->m_oLink.GetValue();
//???
}
_gdi_graphics_::GetResolution(pathImage, Width, Height);
}
odt_context->start_image(string2std_string(pathImage));
{
if (oox_picture->m_oBlipFill.m_oTile.IsInit())
{
odt_context->drawing_context()->set_image_style_repeat(2);
}
if (oox_picture->m_oBlipFill.m_oStretch.IsInit())
{
odt_context->drawing_context()->set_image_style_repeat(1);
}
if (oox_picture->m_oBlipFill.m_oSrcRect.IsInit() && Width >0 && Height >0)
{
odt_context->drawing_context()->set_image_client_rect(oox_picture->m_oBlipFill.m_oSrcRect->m_oL.GetValue() * Width/100. ,
oox_picture->m_oBlipFill.m_oSrcRect->m_oT.GetValue() * Height/100.,
oox_picture->m_oBlipFill.m_oSrcRect->m_oR.GetValue() * Width/100. ,
oox_picture->m_oBlipFill.m_oSrcRect->m_oB.GetValue() * Height/100.);
}
OoxConverter::convert(&oox_picture->m_oNvPicPr.m_oCNvPr);
//oox_picture->m_oNvPicPr.m_oCNvPicPr
//oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks
{
//if (oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks->m_oNoChangeAspect)
//{
//}
//if (oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks->m_oNoCrop))
//{
//}
//if (oox_picture->m_oNvPicPr.m_oCNvPicPr.m_oPicLocks->m_oNoResize)
//{
//}
}
//m_oExtLst
OoxConverter::convert(&oox_picture->m_oSpPr, NULL);
}
odt_context->drawing_context()->end_image();
odt_context->drawing_context()->end_drawing();
}
void DocxConverter::convert(OOX::Drawing::CChart * oox_chart)
{
if (oox_chart == NULL)return;
if (oox_chart->m_oRId.IsInit())
{
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(oox_chart->m_oRId->GetValue());
if (oFile.IsInit() && OOX::FileTypes::Chart == oFile->type())
{
OOX::Spreadsheet::CChartSpace* pChart = (OOX::Spreadsheet::CChartSpace*)oFile.operator->();
if (pChart)
{
odt_context->drawing_context()->start_drawing();
odt_context->drawing_context()->start_object(odf_context()->get_next_name_object());
double width =0, height =0;
odt_context->drawing_context()->get_size(width, height);
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
oox_current_chart = pChart;
odf_context()->start_chart();
odf_context()->chart_context()->set_chart_size(width, height);
OoxConverter::convert(&pChart->m_oChartSpace);
odf_context()->end_chart();
oox_current_chart = NULL; // object???
odt_context->drawing_context()->end_object();
odt_context->drawing_context()->end_drawing();
}
}
}
}
void DocxConverter::convert(OOX::Logic::CGroupShape *oox_group_shape)
{
if (oox_group_shape == NULL)return;
if (oox_group_shape->m_arrItems.GetSize() < 1) return;
std::wstring name;
int id = -1;
//if (oox_group_shape->m_oCNvPr.IsInit())
{
//if (oox_group_shape->m_oCNvPr->m_sName.IsInit())
// name = string2std_string(*oox_group_shape->m_oCNvPr->m_sName);
//if (oox_group_shape->m_oCNvPr->m_oId.IsInit())
// id = oox_group_shape->m_oCNvPr->m_oId->GetValue();
}
odt_context->drawing_context()->start_group(name,id);
OoxConverter::convert(oox_group_shape->m_oGroupSpPr.GetPointer());
for (long i=0; i < oox_group_shape->m_arrItems.GetSize(); i++)
{
convert(oox_group_shape->m_arrItems[i]);
}
odt_context->drawing_context()->end_group();
}
void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
{
if (oox_shape == NULL)return;
if (!oox_shape->m_oSpPr.IsInit()) return;
odt_context->drawing_context()->start_drawing();
int type = -1;
if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
{
type = 1000;//6???
}
if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
{
OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
type =(geometry->m_oPrst.GetValue());
}
if (oox_shape->m_oCNvSpPr.IsInit())
{
if (oox_shape->m_oCNvSpPr->m_otxBox.GetValue() == 1)
type = 2000; //textBox
}
if (type < 0)return;
/////////////////////////////////////////////////////////////////////////////////
if (type == 2000) odt_context->drawing_context()->start_text_box();
else odt_context->drawing_context()->start_shape(type);
OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
//, , ...
OoxConverter::convert(oox_shape->m_oCNvPr.GetPointer());
//
OoxConverter::convert(oox_shape->m_oCNvSpPr.GetPointer());
OoxConverter::convert(oox_shape->m_oCNvConnSpPr.GetPointer());
if (oox_shape->m_oTxBody.IsInit() && oox_shape->m_oTxBody->m_oTxtbxContent.IsInit())
{
odt_context->start_text_context();
odt_context->text_context()->set_single_object(true, NULL, NULL);
for (long i=0 ; i < oox_shape->m_oTxBody->m_oTxtbxContent->m_arrItems.GetSize();i++)
{
convert(oox_shape->m_oTxBody->m_oTxtbxContent->m_arrItems[i]);
}
odt_context->drawing_context()->set_text( odt_context->text_context());
odt_context->end_text_context();
}
if (type == 2000) odt_context->drawing_context()->end_text_box();
else odt_context->drawing_context()->end_shape();
odt_context->drawing_context()->end_drawing();
} }
} }
\ No newline at end of file
...@@ -9,13 +9,15 @@ namespace OOX ...@@ -9,13 +9,15 @@ namespace OOX
namespace Logic namespace Logic
{ {
class CDrawing;
class CParagraph; class CParagraph;
class CParagraphProperty; class CParagraphProperty;
class CRun; class CRun;
class CRunProperty; class CRunProperty;
class CText; class CText;
class CAlternateContent; class CAlternateContent;
class CDrawing;
class CGroupShape;
class CShape;
} }
} }
...@@ -69,6 +71,11 @@ namespace Oox2Odf ...@@ -69,6 +71,11 @@ namespace Oox2Odf
void convert(OOX::Logic::CDrawing *oox_drawing); void convert(OOX::Logic::CDrawing *oox_drawing);
void convert(OOX::Drawing::CAnchor *oox_anchor); void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline); void convert(OOX::Drawing::CInline *oox_inline);
void convert(OOX::Drawing::CGraphic *oox_graphic);
void convert(OOX::Logic::CGroupShape *oox_group_shape);
void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Drawing::CChart *oox_chart);
void convert(OOX::Drawing::CPicture *oox_chart);
}; };
} }
\ No newline at end of file
...@@ -1418,12 +1418,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor) ...@@ -1418,12 +1418,12 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
{ {
oox_table_position from={}, to={}; oox_table_position from={}, to={};
convert(oox_anchor->m_oFrom.GetPointer(), &from); convert(oox_anchor->m_oFrom.GetPointer(), &from);
convert(oox_anchor->m_oTo.GetPointer(),&to); convert(oox_anchor->m_oTo.GetPointer(), &to);
double x1=0, y1=0, x2=0, y2=0; double x1=0, y1=0, x2=0, y2=0;
ods_context->current_table().convert_position(from, x1, y1); ods_context->current_table().convert_position(from, x1, y1);
ods_context->current_table().convert_position(to, x2, y2); ods_context->current_table().convert_position(to, x2, y2);
ods_context->drawing_context()->set_drawings_rect(x1, y1, x2-x1, y2-y1); ods_context->drawing_context()->set_drawings_rect(x1, y1, x2-x1, y2-y1);
} }
...@@ -1566,8 +1566,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape) ...@@ -1566,8 +1566,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
if (type < 0)return; if (type < 0)return;
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
if (type == 2000)ods_context->drawing_context()->start_text_box(); if (type == 2000) ods_context->drawing_context()->start_text_box();
else ods_context->drawing_context()->start_shape(type); else ods_context->drawing_context()->start_shape(type);
{ {
OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer()); OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
...@@ -1743,10 +1744,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture) ...@@ -1743,10 +1744,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
} }
if (oox_picture->m_oNvPicPr.IsInit()) if (oox_picture->m_oNvPicPr.IsInit())
{ {
if (oox_picture->m_oNvPicPr->m_oCNvPr.IsInit()) OoxConverter::convert(oox_picture->m_oNvPicPr->m_oCNvPr.GetPointer());
{
OoxConverter::convert(oox_picture->m_oNvPicPr->m_oCNvPr.GetPointer());
}
if (oox_picture->m_oNvPicPr->m_oCNvPicPr.IsInit()) if (oox_picture->m_oNvPicPr->m_oCNvPicPr.IsInit())
{ {
......
...@@ -365,18 +365,6 @@ ...@@ -365,18 +365,6 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="Sections"
>
<File
RelativePath="..\Source\DocxFormat\Logic\SectionProperty.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Logic\SectionProperty.h"
>
</File>
</Filter>
<Filter <Filter
Name="Fields and Hyperlinks" Name="Fields and Hyperlinks"
> >
...@@ -680,6 +668,14 @@ ...@@ -680,6 +668,14 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="Drawing"
>
<File
RelativePath="..\Source\DocxFormat\Logic\Shape.h"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Numbering" Name="Numbering"
...@@ -864,6 +860,18 @@ ...@@ -864,6 +860,18 @@
RelativePath="..\Source\DocxFormat\Drawing\DrawingTransform.h" RelativePath="..\Source\DocxFormat\Drawing\DrawingTransform.h"
> >
</File> </File>
<Filter
Name="Sections"
>
<File
RelativePath="..\Source\DocxFormat\Logic\SectionProperty.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Logic\SectionProperty.h"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Utility" Name="Utility"
......
...@@ -96,6 +96,8 @@ namespace OOX ...@@ -96,6 +96,8 @@ namespace OOX
m_eType = et_pic_cNvPr; m_eType = et_pic_cNvPr;
else if ( _T("xdr:cNvPr") == sName ) else if ( _T("xdr:cNvPr") == sName )
m_eType = et_xdr_cNvPr; m_eType = et_xdr_cNvPr;
else if ( _T("wps:cNvPr") == sName )
m_eType = et_w_cNvPr;
else else
return; return;
...@@ -126,6 +128,8 @@ namespace OOX ...@@ -126,6 +128,8 @@ namespace OOX
sResult = _T("<pic:cNvPr "); sResult = _T("<pic:cNvPr ");
else if ( et_xdr_cNvPr == m_eType ) else if ( et_xdr_cNvPr == m_eType )
sResult = _T("<xdr:cNvPr "); sResult = _T("<xdr:cNvPr ");
else if ( et_w_cNvPr == m_eType )
sResult = _T("<wps:cNvPr ");
else else
return _T(""); return _T("");
...@@ -165,6 +169,8 @@ namespace OOX ...@@ -165,6 +169,8 @@ namespace OOX
sResult += _T("</p:cNvPr>"); sResult += _T("</p:cNvPr>");
else if ( et_pic_cNvPr == m_eType ) else if ( et_pic_cNvPr == m_eType )
sResult += _T("</pic:cNvPr>"); sResult += _T("</pic:cNvPr>");
else if ( et_w_cNvPr == m_eType )
sResult += _T("</wps:cNvPr>");
else if ( et_xdr_cNvPr == m_eType ) else if ( et_xdr_cNvPr == m_eType )
sResult += _T("</xdr:cNvPr>"); sResult += _T("</xdr:cNvPr>");
return sResult; return sResult;
......
...@@ -793,6 +793,8 @@ namespace OOX ...@@ -793,6 +793,8 @@ namespace OOX
m_eType = et_xdr_spPr; m_eType = et_xdr_spPr;
else if ( _T("c:spPr") == sName ) else if ( _T("c:spPr") == sName )
m_eType = et_c_spPr; m_eType = et_c_spPr;
else if ( _T("wps:spPr") == sName )
m_eType = et_w_spPr;
else else
return; return;
...@@ -879,6 +881,8 @@ namespace OOX ...@@ -879,6 +881,8 @@ namespace OOX
sResult = _T("<xdr:spPr "); sResult = _T("<xdr:spPr ");
else if ( et_c_spPr == m_eType ) else if ( et_c_spPr == m_eType )
sResult = _T("<c:spPr "); sResult = _T("<c:spPr ");
else if ( et_w_spPr == m_eType )
sResult = _T("<wps:spPr ");
else else
return _T(""); return _T("");
...@@ -982,6 +986,8 @@ namespace OOX ...@@ -982,6 +986,8 @@ namespace OOX
sResult = _T("</xdr:spPr>"); sResult = _T("</xdr:spPr>");
else if ( et_c_spPr == m_eType ) else if ( et_c_spPr == m_eType )
sResult = _T("</c:spPr>"); sResult = _T("</c:spPr>");
else if ( et_w_spPr == m_eType )
sResult = _T("</wps:spPr>");
return sResult; return sResult;
} }
virtual EElementType getType() const virtual EElementType getType() const
...@@ -1092,6 +1098,8 @@ namespace OOX ...@@ -1092,6 +1098,8 @@ namespace OOX
m_eType = et_a_groupSpPr; m_eType = et_a_groupSpPr;
else if ( _T("xdr:grpSpPr") == sName ) else if ( _T("xdr:grpSpPr") == sName )
m_eType = et_xdr_groupSpPr; m_eType = et_xdr_groupSpPr;
else if ( _T("wpg:grpSpPr") == sName )
m_eType = et_w_groupSpPr;
else else
return; return;
......
...@@ -16,20 +16,24 @@ ...@@ -16,20 +16,24 @@
#include "DrawingPicture.h" #include "DrawingPicture.h"
#include "DrawingCoreInfo.h" #include "DrawingCoreInfo.h"
#include "../Logic/Shape.h"
namespace OOX namespace OOX
{ {
namespace Drawing namespace Drawing
{ {
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// CGraphic 20.1.2.2.16;20.1.2.2.17 (Part 1) // CGraphic 20.1.2.2.16; 20.1.2.2.17 (Part 1)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
enum EGraphicType enum EGraphicType
{ {
// Docx .3456 (20.4) // Docx .3456 (20.4)
graphictypePicture = 0, // 20.2 graphictypePicture = 0, // 20.2
graphictypeLockedCanvas = 1, // 20.3 graphictypeLockedCanvas = 1, // 20.3
graphictypeChart = 2, // 21.2 graphictypeChart = 2, // 21.2
graphictypeDiagram = 3, // 21.4 graphictypeDiagram = 3, // 21.4
graphictypeShape = 4, // 20.4
graphictypeGroupShape = 5, // 20.4
}; };
class CGraphic : public WritingElement class CGraphic : public WritingElement
...@@ -59,6 +63,8 @@ namespace OOX ...@@ -59,6 +63,8 @@ namespace OOX
CWCharWrapper sName = oReader.GetName(); CWCharWrapper sName = oReader.GetName();
if ( _T("a:graphicData") == sName ) if ( _T("a:graphicData") == sName )
{ {
// 20.1.2.2.17 graphicData (Graphic Object Data)
//Child Elements/Subclause = Any element in any namespace/n/a
ReadAttributes( oReader ); ReadAttributes( oReader );
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
...@@ -78,9 +84,18 @@ namespace OOX ...@@ -78,9 +84,18 @@ namespace OOX
m_oChart = oReader; m_oChart = oReader;
m_eGraphicType = graphictypeChart; m_eGraphicType = graphictypeChart;
} }
else if ( _T("wps:wsp") == sName )
{
m_oShape = oReader;
m_eGraphicType = graphictypeShape;
}
else if ( _T("wpg:wgp") == sName )
{
m_oGroupShape = oReader;
m_eGraphicType = graphictypeGroupShape;
}
} }
} }
} }
} }
virtual CString toXML() const virtual CString toXML() const
...@@ -115,6 +130,10 @@ namespace OOX ...@@ -115,6 +130,10 @@ namespace OOX
nullable<OOX::Drawing::CPicture> m_oPicture; nullable<OOX::Drawing::CPicture> m_oPicture;
nullable<OOX::Drawing::CChart> m_oChart; nullable<OOX::Drawing::CChart> m_oChart;
nullable<OOX::Logic::CGroupShape> m_oGroupShape;
nullable<OOX::Logic::CShape> m_oShape;
}; };
} // Drawing } // Drawing
......
...@@ -16,72 +16,6 @@ ...@@ -16,72 +16,6 @@
#include "VmlOfficeDrawing.h" #include "VmlOfficeDrawing.h"
namespace OOX
{
namespace Logic
{
//--------------------------------------------------------------------------------
// CTxbxContent 9.8.1.1 (Part 4)
//--------------------------------------------------------------------------------
class CTxbxContent : public WritingElement
{
public:
CTxbxContent()
{
}
CTxbxContent(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CTxbxContent(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CTxbxContent()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
const CTxbxContent &operator =(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CTxbxContent &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
virtual EElementType getType() const
{
return et_w_txbxContent;
}
public:
// Childs
CSimpleArray<WritingElement *> m_arrItems;
};
} // namespace Logic
} // namespace OOX
namespace OOX namespace OOX
{ {
......
...@@ -676,6 +676,18 @@ namespace OOX ...@@ -676,6 +676,18 @@ namespace OOX
et_w15_presenceInfo, // <w15:presenceInfo> et_w15_presenceInfo, // <w15:presenceInfo>
et_w15_person, // <w15:person> et_w15_person, // <w15:person>
et_w15_commentEx, // <w15:commentEx> et_w15_commentEx, // <w15:commentEx>
et_w_ShapeTextBody, //<wps:txbx>
et_w_Shape, //<wps:wsp>
et_w_GroupShape, //<wpg:wgp>
et_w_cNvPr, //<wps:cNvPr>
et_w_spPr, //<wps:spPr>
et_w_groupSpPr, //<wpg:grpSpPr>
et_w_ConnectionNonVisualShapeProps,//<wps:cNvSpPr>
et_w_NonVisualGroupShapeDrawingProps,//<wpg:cNvGrpSpPr>
et_w_ConnectionNonVisualConnShapeProps,
et_w_ShapeNonVisual //<wps:spPr>
}; };
class WritingElement class WritingElement
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#define OOX_SHAPE_FILE_INCLUDE_H_ #define OOX_SHAPE_FILE_INCLUDE_H_
#include "../CommonInclude.h" #include "../CommonInclude.h"
//#include "../../DocxFormat/Logic/Paragraph.h"
namespace OOX namespace OOX
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment