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

(1.2.0.86): ASCOfficeOdfFileW

изменение подписи на ONLYOFFICE. Добавлен обязательный для FileChecker из FileConvereter2 необязательный по формату параметр. 

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57217 954022d7-b5bf-4e40-9824-e11837661b57
parent 420b5f4b
...@@ -1099,46 +1099,6 @@ ...@@ -1099,46 +1099,6 @@
RelativePath=".\OdfFormat\number_style.h" RelativePath=".\OdfFormat\number_style.h"
> >
</File> </File>
<File
RelativePath=".\OdfFormat\odf_number_styles_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_number_styles_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_state.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_state.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_state.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_state.h"
>
</File>
<File <File
RelativePath=".\OdfFormat\style_chart_properties.cpp" RelativePath=".\OdfFormat\style_chart_properties.cpp"
> >
...@@ -1227,6 +1187,58 @@ ...@@ -1227,6 +1187,58 @@
RelativePath=".\OdfFormat\styles_lite_container.h" RelativePath=".\OdfFormat\styles_lite_container.h"
> >
</File> </File>
<Filter
Name="contexts"
>
<File
RelativePath=".\OdfFormat\odf_number_styles_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_number_styles_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_state.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_page_layout_state.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_state.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_style_state.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_table_styles_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_table_styles_context.h"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="odf text" Name="odf text"
......
...@@ -251,6 +251,7 @@ namespace odf ...@@ -251,6 +251,7 @@ namespace odf
item->write(path.string()); item->write(path.string());
} }
if (manifest_) manifest_->write(RootPath); if (manifest_) manifest_->write(RootPath);
if (mimetype_) mimetype_->write(RootPath);
if (settings_) settings_->write(RootPath); if (settings_) settings_->write(RootPath);
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "odf_style_state.h" #include "odf_style_state.h"
#include "odf_number_styles_context.h" #include "odf_number_styles_context.h"
#include "odf_table_styles_context.h"
namespace cpdoccore { namespace cpdoccore {
...@@ -60,6 +61,7 @@ public: ...@@ -60,6 +61,7 @@ public:
odf_style_state * last_state(style_family family); odf_style_state * last_state(style_family family);
odf_number_styles_context & numbers_styles() {return number_styles_context_;} odf_number_styles_context & numbers_styles() {return number_styles_context_;}
odf_table_styles_context & table_styles() {return table_styles_context_;}
std::wstring find_free_name(const style_family family); std::wstring find_free_name(const style_family family);
...@@ -67,6 +69,7 @@ public: ...@@ -67,6 +69,7 @@ public:
void calc_paragraph_properties(std::wstring style_name, style_family::type family, paragraph_format_properties * result); void calc_paragraph_properties(std::wstring style_name, style_family::type family, paragraph_format_properties * result);
private: private:
odf_table_styles_context table_styles_context_;
odf_number_styles_context number_styles_context_; odf_number_styles_context number_styles_context_;
odf_conversion_context * odf_context_; odf_conversion_context * odf_context_;
......
...@@ -45,6 +45,8 @@ namespace odf ...@@ -45,6 +45,8 @@ namespace odf
__int32 count_header_row; __int32 count_header_row;
std::wstring base_style_name;
}; };
class odf_table_context::Impl class odf_table_context::Impl
...@@ -83,6 +85,15 @@ odf_table_context::~odf_table_context() ...@@ -83,6 +85,15 @@ odf_table_context::~odf_table_context()
{ {
} }
void odf_table_context::set_table_base_style(std::wstring base_style_name)
{
impl_->current_table().base_style_name = base_style_name;
}
bool odf_table_context::is_styled()
{
return impl_->current_table().base_style_name.length() >0 ? true : false;
}
void odf_table_context::start_table(office_element_ptr &elm, bool styled) void odf_table_context::start_table(office_element_ptr &elm, bool styled)
{ {
table_table * table = dynamic_cast<table_table *>(elm.get()); table_table * table = dynamic_cast<table_table *>(elm.get());
...@@ -211,6 +222,12 @@ int odf_table_context::current_column () ...@@ -211,6 +222,12 @@ int odf_table_context::current_column ()
return impl_->current_table().current_column; return impl_->current_table().current_column;
} }
int odf_table_context::current_row ()
{
if (impl_->empty()) return 0;
return impl_->current_table().current_row;
}
int odf_table_context::count_column () int odf_table_context::count_column ()
{ {
if (impl_->empty()) return 0; if (impl_->empty()) return 0;
...@@ -223,7 +240,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled) ...@@ -223,7 +240,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
if (impl_->empty()) return; if (impl_->empty()) return;
table_table_cell * cell = dynamic_cast<table_table_cell *>(elm.get());; table_table_cell * cell = dynamic_cast<table_table_cell *>(elm.get());;
table_covered_table_cell * covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());; table_covered_table_cell * covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());
if (!cell && !covered_cell)return; if (!cell && !covered_cell)return;
odf_element_state state; odf_element_state state;
......
...@@ -22,8 +22,12 @@ public: ...@@ -22,8 +22,12 @@ public:
~odf_table_context(); ~odf_table_context();
void set_styles_context(odf_style_context* styles_context); void set_styles_context(odf_style_context* styles_context);
void set_table_base_style(std::wstring base_style_name);
bool is_styled() ;
int current_column (); int current_column ();
int current_row ();
int count_column (); int count_column ();
void start_table(office_element_ptr &elm, bool styled = false); void start_table(office_element_ptr &elm, bool styled = false);
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include "odf_table_styles_context.h"
#include "ods_conversion_context.h"
#include "styles.h"
namespace cpdoccore {
namespace odf {
}
}
\ No newline at end of file
#pragma once
#include <string>
#include <vector>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf {
class style_table_cell_properties;
struct table_format_state
{
std::wstring style_name;
};
class odf_table_styles_context
{
public:
odf_table_styles_context(){}
style_table_cell_properties * get_table_cell_properties(int col, int row){return NULL;}
bool set_current_style(std::wstring name) {return false;}
private:
std::vector<table_format_state> table_format_array_;
//////////////////
};
}
}
...@@ -1645,11 +1645,9 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell) ...@@ -1645,11 +1645,9 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
{ {
if (oox_table_cell->m_oTableCellProperties->m_oVMerge.IsInit()) if (oox_table_cell->m_oTableCellProperties->m_oVMerge.IsInit())
{ {
if (oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal.IsInit() && if (!(oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal.IsInit() &&
oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart) oox_table_cell->m_oTableCellProperties->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart))
{} covered = true;
else
covered = true;
} }
} }
...@@ -1716,20 +1714,24 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr) ...@@ -1716,20 +1714,24 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr)
odf::style_table_properties * table_properties = odt_context->styles_context()->last_state().get_table_properties(); odf::style_table_properties * table_properties = odt_context->styles_context()->last_state().get_table_properties();
if (oox_table_pr->m_oTblStyle.IsInit() && oox_table_pr->m_oTblStyle->m_sVal.IsInit()) if (oox_table_pr->m_oTblStyle.IsInit() && oox_table_pr->m_oTblStyle->m_sVal.IsInit())
{ {
odt_context->styles_context()->last_state().set_parent_style_name(string2std_string(*oox_table_pr->m_oTblStyle->m_sVal)); std::wstring base_style_name = string2std_string(*oox_table_pr->m_oTblStyle->m_sVal);
bool res = odt_context->styles_context()->table_styles().set_current_style(base_style_name);
if (res) odt_context->table_context()->set_table_base_style(base_style_name );
} }
convert(oox_table_pr, table_properties); convert(oox_table_pr, table_properties);
///////////////////////////////////////////////////////////////////////////
if (oox_table_pr->m_oTblBorders.IsInit()) if (oox_table_pr->m_oTblBorders.IsInit())
{// cell_prop - default-cell-style-name columns & row {// cell_prop - default-cell-style-name columns & row
odf::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->last_state().get_table_cell_properties(); odf::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->last_state().get_table_cell_properties();
convert(oox_table_pr->m_oTblBorders.GetPointer(), table_cell_properties); convert(oox_table_pr->m_oTblBorders.GetPointer(), table_cell_properties);
} }
///////////////////////////////////////////////////////////////////////////
// - // -
table_properties->table_format_properties_.table_border_model_ = odf::border_model(odf::border_model::Collapsing); table_properties->table_format_properties_.table_border_model_ = odf::border_model(odf::border_model::Collapsing);
...@@ -1825,25 +1827,30 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, ...@@ -1825,25 +1827,30 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
} }
bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr) bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr)
{ {
if (oox_table_cell_pr == NULL) return false; bool is_base_styled = odt_context->table_context()->is_styled();
odf::style_table_cell_properties * parent_cell_properties = NULL;
odt_context->styles_context()->create_style(L"",odf::style_family::TableCell, true, false, -1); odf::odf_style_state * state = odt_context->styles_context()->last_state(odf::style_family::Table); //
// ,
if (state)parent_cell_properties = state->get_table_cell_properties();
if (oox_table_cell_pr == NULL && is_base_styled == false && parent_cell_properties == NULL) return false;
odt_context->styles_context()->create_style(L"",odf::style_family::TableCell, true, false, -1);
odf::style_table_cell_properties * cell_properties = odt_context->styles_context()->last_state().get_table_cell_properties(); odf::style_table_cell_properties * cell_properties = odt_context->styles_context()->last_state().get_table_cell_properties();
// () - - if (cell_properties == NULL) return false;
if (is_base_styled)
{ {
odf::odf_style_state * state = odt_context->styles_context()->last_state(odf::style_family::Table); // int col=odt_context->table_context()->current_column();
// , int row=odt_context->table_context()->current_row();
if (state)
{ odf::style_table_cell_properties *base_style = odt_context->styles_context()->table_styles().get_table_cell_properties(col, row);
odf::style_table_cell_properties * parent_cell_properties = state->get_table_cell_properties();
if (parent_cell_properties && cell_properties) cell_properties->apply_from(base_style);
{
cell_properties->apply_from(parent_cell_properties);
}
}
} }
cell_properties->apply_from(parent_cell_properties);
bool res = convert(oox_table_cell_pr, cell_properties); bool res = convert(oox_table_cell_pr, cell_properties);
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//85 //86
#define INTVER 1,2,0,85 #define INTVER 1,2,0,86
#define STRVER "1,2,0,85\0" #define STRVER "1,2,0,86\0"
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