From 076de8bb1385c3f2014f730fc1596aefe009a4c4 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Thu, 23 Jun 2016 11:54:34 +0300 Subject: [PATCH] =?UTF-8?q?OdfFormatWriter=20-=20=D0=BD=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D0=BA=20(=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BB=D0=B8=D1=81=D1=82,=20=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=83=D1=89=D0=B8=D0=B5=20=D1=8F=D1=87=D0=B5=D0=B9=D0=BA=D0=B8?= =?UTF-8?q?,=20...)=20+=20=D0=B7=D0=B0=D0=BA=D1=80=D0=B5=D0=BF=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OdfFormat/odf_conversion_context.cpp | 11 +- .../source/OdfFormat/odf_conversion_context.h | 11 +- .../source/OdfFormat/odf_settings_context.cpp | 123 ++++++++++--- .../source/OdfFormat/odf_settings_context.h | 26 ++- .../OdfFormat/ods_conversion_context.cpp | 12 +- .../source/OdfFormat/ods_conversion_context.h | 2 +- .../source/OdfFormat/office_settings.cpp | 13 +- .../source/OdfFormat/office_settings.h | 7 +- .../source/Oox2OdfConverter/XlsxConverter.cpp | 172 ++++++++++++++---- .../source/Oox2OdfConverter/XlsxConverter.h | 20 +- .../Worksheets/WorksheetChildOther.h | 84 ++++++++- .../Source/XlsxFormat/WritingElement.h | 1 + 12 files changed, 379 insertions(+), 103 deletions(-) diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp index 981f3ee4c9..a6c44fab87 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp @@ -47,21 +47,30 @@ void odf_conversion_context::set_fonts_directory(std::wstring pathFonts) odf_style_context* odf_conversion_context::styles_context() { - if (objects_.size() > 0) + if (!objects_.empty()) return objects_[current_object_].style_context.get(); else return NULL; } +odf_settings_context* odf_conversion_context::settings_context() +{ + if (!objects_.empty()) + return objects_[current_object_].settings_context.get(); + else + return NULL; +} odf_page_layout_context* odf_conversion_context::page_layout_context() { return &page_layout_context_; } + odf_chart_context* odf_conversion_context::chart_context() { return &chart_context_; } + odf_number_styles_context* odf_conversion_context::numbers_styles_context() { if (objects_.size() > 0 && objects_[current_object_].style_context) diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h b/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h index acee3092be..8c92506db7 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h @@ -51,16 +51,17 @@ public: CApplicationFonts *applicationFonts_; - virtual odf_drawing_context * drawing_context() = 0; - virtual odf_text_context * text_context() = 0; + virtual odf_drawing_context * drawing_context() = 0; + virtual odf_text_context * text_context() = 0; - virtual void start_text_context() = 0; - virtual void end_text_context() = 0; + virtual void start_text_context() = 0; + virtual void end_text_context() = 0; virtual void start_image(const std::wstring & image_file_name) = 0; virtual odf_style_context * styles_context(); - + + odf_settings_context * settings_context(); odf_chart_context * chart_context(); odf_page_layout_context * page_layout_context(); diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp index 337bf36166..da93cc2a53 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp @@ -15,6 +15,8 @@ namespace odf_writer { odf_settings_context::odf_settings_context() { + current_view_ = -1; + current_table_ = -1; } void odf_settings_context::set_odf_context(odf_conversion_context * Context) @@ -23,6 +25,68 @@ void odf_settings_context::set_odf_context(odf_conversion_context * Context) } +void odf_settings_context::start_view() +{ + _view v; + views_.push_back(v); + current_view_ = views_.size() - 1; +} + +void odf_settings_context::end_view() +{ + current_view_ = -1; +} + +void odf_settings_context::set_current_view(int id) +{ + if (id < 0 || id >= views_.size()) return; + + current_view_ = id; +} + +void odf_settings_context::start_table(std::wstring name) +{ + if (current_view_ < 0) return; + + _table t; + t.name = name; + + views_[current_view_].tables.push_back(t); + + current_table_ = views_[current_view_].tables.size() - 1; +} + +void odf_settings_context::end_table() +{ + current_table_ = -1; +} + +void odf_settings_context::add_property(std::wstring name, std::wstring type, std::wstring value) +{ + if (current_view_ < 0) return; + if (name.empty() || type.empty()) return; + + office_element_ptr prop; + create_element (L"config", L"config-item", prop, odf_context_); + + settings_config_item *item = NULL; + item = dynamic_cast(prop.get()); + if (!item) return; + + item->config_name_ = name; + item->config_type_ = type; + item->content_ = value; + + if (current_table_ < 0) + { + views_[current_view_].content.push_back(prop); + } + else + { + views_[current_view_].tables.back().content.push_back(prop); + } +} + void odf_settings_context::process_office_settings(office_element_ptr root ) { settings_config_item_set *item_set = NULL; @@ -30,7 +94,7 @@ void odf_settings_context::process_office_settings(office_element_ptr root ) settings_config_item_map_indexed *item_map_indexed = NULL; settings_config_item_map_entry *item_map_entry = NULL; - if (!views_.content.empty() || !views_.tables.empty()) + if (!views_.empty()) { office_element_ptr ooo_view_elm; { @@ -47,36 +111,41 @@ void odf_settings_context::process_office_settings(office_element_ptr root ) if (item_map_indexed) item_map_indexed->config_name_ = L"Views"; } - office_element_ptr views_entry_elm; + for (int v = 0 ; v < views_.size(); v++) { - create_element (L"config", L"config-item-map-entry" , views_entry_elm, odf_context_); - views_elm->add_child_element(views_entry_elm); - } - - for (int i = 0; i < views_.content.size(); i++) - { - views_entry_elm->add_child_element(views_.content[i]); - } - - if (!views_.tables.empty()) - { - office_element_ptr tables_elm; - create_element(L"config", L"config-item-map-named", tables_elm, odf_context_); - views_entry_elm->add_child_element(tables_elm); - item_map_named= dynamic_cast(tables_elm.get()); - if (item_map_named) item_map_indexed->config_name_ = L"Tables"; - - for (std::map>::iterator it = views_.tables.begin(); it != views_.tables.end(); it++) + office_element_ptr views_entry_elm; { - office_element_ptr table_elm; - create_element(L"config", L"config-item-map-entry", table_elm, odf_context_); - tables_elm->add_child_element(table_elm); - item_map_entry= dynamic_cast(table_elm.get()); - if (item_map_entry) item_map_indexed->config_name_ = it->first; + create_element (L"config", L"config-item-map-entry" , views_entry_elm, odf_context_); + views_elm->add_child_element(views_entry_elm); + } - for (int j = 0; j < it->second.size(); j++) + for (int i = 0; i < views_[v].content.size(); i++) + { + views_entry_elm->add_child_element(views_[v].content[i]); + } + + if (!views_[v].tables.empty()) + { + office_element_ptr tables_elm; + create_element(L"config", L"config-item-map-named", tables_elm, odf_context_); + views_entry_elm->add_child_element(tables_elm); + + item_map_named= dynamic_cast(tables_elm.get()); + if (item_map_named) item_map_named->config_name_ = L"Tables"; + + for (int t = 0 ; t < views_[v].tables.size(); t++) { - table_elm->add_child_element(it->second[j]); + office_element_ptr table_elm; + create_element(L"config", L"config-item-map-entry", table_elm, odf_context_); + tables_elm->add_child_element(table_elm); + + item_map_entry= dynamic_cast(table_elm.get()); + if (item_map_entry) item_map_entry->config_name_ = views_[v].tables[t].name; + + for (int j = 0; j < views_[v].tables[t].content.size(); j++) + { + table_elm->add_child_element(views_[v].tables[t].content[j]); + } } } } diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h b/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h index 1383d759d4..4af648c70e 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h @@ -26,16 +26,34 @@ public: void process_office_settings(office_element_ptr root ); + void start_view (); + void end_view (); + void set_current_view(int id); + + void start_table(std::wstring name); + void end_table (); + + void add_property(std::wstring name, std::wstring type, std::wstring value); private: - struct views + struct _table { - std::map> tables; - std::vector content; - }views_; + std::wstring name; + std::vector content; + }; + struct _view + { + std::vector<_table> tables; + std::vector content; + }; + + std::vector<_view> views_; std::vector config_content_; odf_conversion_context* odf_context_; + int current_table_; + int current_view_; + }; diff --git a/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp index 97ca299d8f..50416338d1 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp @@ -101,10 +101,10 @@ void ods_conversion_context::start_sheet() void ods_conversion_context::set_sheet_dimension(const std::wstring & ref) { std::vector ref_cells; - boost::algorithm::split(ref_cells,ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on); + boost::algorithm::split(ref_cells, ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on); int max_col = 0, max_row = 0; - for (long i=0; i max_col) max_col = col; if (col > max_row) max_row = row; } - current_table().set_table_dimension(max_col,max_row); + current_table().set_table_dimension(max_col, max_row); } void ods_conversion_context::end_sheet() @@ -488,12 +488,16 @@ double ods_conversion_context::convert_symbol_width(double val) return pixels * 0.75; //* 9525. * 72.0 / (360000.0 * 2.54); } -void ods_conversion_context::start_table_view(std::wstring table_name, int view_id) +void ods_conversion_context::start_table_view( int view_id ) { + settings_context()->set_current_view(view_id); + settings_context()->start_table(current_table().office_table_name_); } void ods_conversion_context::end_table_view() { + settings_context()->end_table(); + settings_context()->set_current_view(-1); } diff --git a/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h b/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h index bdaaf9e55c..eda5e7fe38 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h @@ -83,7 +83,7 @@ public: void start_conditional_formats(); void end_conditional_formats(){} - void start_table_view(std::wstring table_name, int view_id); + void start_table_view(int view_id); void end_table_view(); private: diff --git a/ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp b/ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp index 54edc4ac68..9a242de945 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp @@ -112,10 +112,7 @@ void settings_config_item_map_indexed::serialize(std::wostream & _Wostream) { CP_XML_NODE_SIMPLE() { - if (!config_name_.empty()) - { - CP_XML_ATTR( L"config:name", config_name_); - } + CP_XML_ATTR_OPT( L"config:name", config_name_); BOOST_FOREACH(const office_element_ptr & elm, content_) { @@ -144,10 +141,8 @@ void settings_config_item_map_named::serialize(std::wostream & _Wostream) { CP_XML_NODE_SIMPLE() { - if (!config_name_.empty()) - { - CP_XML_ATTR( L"config:name", config_name_); - } + CP_XML_ATTR_OPT( L"config:name", config_name_); + BOOST_FOREACH(const office_element_ptr & elm, content_) { elm->serialize(CP_XML_STREAM()); @@ -175,6 +170,8 @@ void settings_config_item_map_entry::serialize(std::wostream & _Wostream) { CP_XML_NODE_SIMPLE() { + CP_XML_ATTR_OPT( L"config:name", config_name_); + BOOST_FOREACH(const office_element_ptr & elm, content_) { elm->serialize(CP_XML_STREAM()); diff --git a/ASCOfficeOdfFileW/source/OdfFormat/office_settings.h b/ASCOfficeOdfFileW/source/OdfFormat/office_settings.h index df7e2c5b43..322caeb257 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/office_settings.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/office_settings.h @@ -88,7 +88,7 @@ public: virtual void serialize(std::wostream & _Wostream); - std::wstring config_name_; + _CP_OPT(std::wstring) config_name_; office_element_ptr_array content_; }; CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_indexed); @@ -108,7 +108,7 @@ public: virtual void serialize(std::wostream & _Wostream); - std::wstring config_name_; + _CP_OPT(std::wstring) config_name_; office_element_ptr_array content_; }; CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_named); @@ -128,7 +128,8 @@ public: virtual void serialize(std::wostream & _Wostream); - office_element_ptr_array content_; + _CP_OPT(std::wstring) config_name_; + office_element_ptr_array content_; }; CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_entry); diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp index 8c14641ed8..4470983669 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp @@ -136,6 +136,13 @@ void XlsxConverter::convert_sheets() std::map &arrWorksheets = xlsx_document->GetWorksheets(); + if(Workbook->m_oBookViews.IsInit()) + { + for (unsigned int i = 0; i < Workbook->m_oBookViews->m_arrItems.size(); i++) + { + convert(Workbook->m_oBookViews->m_arrItems[i]); + } + } if(Workbook->m_oSheets.IsInit()) { for(unsigned int i = 0, length = Workbook->m_oSheets->m_arrItems.size(); i < length; ++i) @@ -238,7 +245,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet) oox_sheet->m_oSheetData->m_arrItems[row] = NULL; } ods_context->end_rows(); - //грохнем память .. а то на больших доках не остается ее :( - нужно переходить на х64 или делсть постраничное чтение-запись oox_sheet->m_oSheetData.reset(); } @@ -248,7 +254,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet) if (oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.IsInit()) ods_context->add_merge_cells(string2std_string(oox_sheet->m_oMergeCells->m_arrItems[mrg]->m_oRef.get())); } - //рисование - делаем ВСЕГДА привязку с таблице(странице) ... так проще if (oox_sheet->m_oDrawing.IsInit() && oox_sheet->m_oDrawing->m_oId.IsInit()) { smart_ptr oFile = oox_sheet->Find(oox_sheet->m_oDrawing->m_oId->GetValue()); @@ -773,55 +778,146 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetPr *oox_sheet_pr) ods_context->current_table().set_table_tab_color(odf_color); } } +void XlsxConverter::convert(OOX::Spreadsheet::CWorkbookView *oox_book_views) +{ + if (!oox_book_views)return; + const OOX::Spreadsheet::CWorkbook *Workbook= xlsx_document->GetWorkbook(); + if (!Workbook) return; + + ods_context->settings_context()->start_view(); + + if (oox_book_views->m_oActiveTab.IsInit()) + { + int table_id = oox_book_views->m_oActiveTab->GetValue() + 1; + + for (int i = 0; i < Workbook->m_oSheets->m_arrItems.size(); i++) + { + OOX::Spreadsheet::CSheet* pSheet = Workbook->m_oSheets->m_arrItems[i]; + if (!pSheet) continue; + + if (pSheet->m_oSheetId.IsInit() && pSheet->m_oSheetId->GetValue() == table_id) + { + ods_context->settings_context()->add_property(L"ActiveTable", L"string", string2std_string(pSheet->m_oName.get2())); + } + } + } + ods_context->settings_context()->add_property(L"ZoomType", L"short", L"0"); + ods_context->settings_context()->add_property(L"ZoomValue", L"int", L"100"); + + ods_context->settings_context()->end_view(); + + //nullable> m_oAutoFilterDateGrouping; + //nullable> m_oFirstSheet; + //nullable> m_oMinimized; + //nullable> m_oShowHorizontalScroll; + //nullable> m_oShowSheetTabs; + //nullable> m_oShowVerticalScroll; + //nullable> m_oTabRatio; + //nullable> m_oVisibility; + //nullable> m_oWindowHeight; + //nullable> m_oWindowWidth; + //nullable> m_oXWindow; + //nullable> m_oYWindow; +} + void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) { if (!oox_sheet_views)return; - for (unsigned long i =0; i < oox_sheet_views->m_arrItems.size(); i++) { if (!oox_sheet_views->m_arrItems[i]) continue; - int view_id = -1; + int view_id = oox_sheet_views->m_arrItems[i]->m_oWorkbookViewId->GetValue(); + if (view_id < 0) continue; - if (oox_sheet_views->m_arrItems[i]->m_oWorkbookViewId.IsInit()) - view_id = oox_sheet_views->m_arrItems[i]->m_oWorkbookViewId->GetValue(); + ods_context->start_table_view( view_id ); + + if (oox_sheet_views->m_arrItems[i]->m_oRightToLeft.IsInit() && oox_sheet_views->m_arrItems[i]->m_oRightToLeft->GetValue()==1) + ods_context->current_table().set_table_rtl(true); - ods_context->start_table_view(ods_context->current_table().office_table_name_, view_id); + if (oox_sheet_views->m_arrItems[i]->m_oShowGridLines.IsInit() && oox_sheet_views->m_arrItems[i]->m_oShowGridLines->GetValue()==0) + { + ods_context->settings_context()->add_property(L"ShowGrid", L"boolean", L"false"); + } + else + { + ods_context->settings_context()->add_property(L"ShowGrid", L"boolean", L"true"); + } - if (oox_sheet_views->m_arrItems[i]->m_oRightToLeft.IsInit() && oox_sheet_views->m_arrItems[i]->m_oRightToLeft->GetValue()==1) - ods_context->current_table().set_table_rtl(true); + if (oox_sheet_views->m_arrItems[i]->m_oView.IsInit()) + { + //ods_context->set_settings_table_viewtype(oox_sheet_views->m_arrItems[i]->m_oView->GetValue()); + } - if (oox_sheet_views->m_arrItems[i]->m_oShowGridLines.IsInit() && oox_sheet_views->m_arrItems[i]->m_oShowGridLines->GetValue()==0) + ods_context->settings_context()->add_property(L"ZoomType", L"short", L"0"); + if (oox_sheet_views->m_arrItems[i]->m_oZoomScale.IsInit()) + { + ods_context->settings_context()->add_property(L"ZoomValue", L"int", oox_sheet_views->m_arrItems[i]->m_oZoomScale->ToString().GetBuffer()); + }else + { + ods_context->settings_context()->add_property(L"ZoomValue", L"int", L"100"); + } + + if (oox_sheet_views->m_arrItems[i]->m_oColorId.IsInit() && !oox_sheet_views->m_arrItems[i]->m_oDefaultGridColor.IsInit()) + { + ods_context->settings_context()->add_property(L"GridColor", L"int", oox_sheet_views->m_arrItems[i]->m_oColorId->ToString().GetBuffer()); + } + if (oox_sheet_views->m_arrItems[i]->m_oSelection.IsInit()) + { + if (oox_sheet_views->m_arrItems[i]->m_oSelection->m_oActiveCell.IsInit()) + { + int col = -1, row = -1; + odf_writer::utils::parsing_ref (oox_sheet_views->m_arrItems[i]->m_oSelection->m_oActiveCell->GetBuffer(), col, row); + + if (col >= 0 && row >= 0) { - //ods_context->set_settings_show_gridlines(false); + ods_context->settings_context()->add_property(L"CursorPositionX", L"int", boost::lexical_cast(col)); + ods_context->settings_context()->add_property(L"CursorPositionY", L"int", boost::lexical_cast(row)); } - - if (oox_sheet_views->m_arrItems[i]->m_oView.IsInit()) - { - //ods_context->set_settings_table_viewtype(oox_sheet_views->m_arrItems[i]->m_oView->GetValue()); - } - - //nullable m_oPane; - - //nullable> m_oColorId; - //nullable> m_oDefaultGridColor; - //nullable> m_oShowFormulas; - //nullable> m_oShowGridLines; - //nullable> m_oShowOutlineSymbols; - //nullable> m_oShowRowColHeaders; - //nullable> m_oShowRuler; - //nullable> m_oShowWhiteSpace; - //nullable> m_oShowZeros; - //nullable> m_oTabSelected; - //nullable m_oTopLeftCell; - //nullable>m_oView; - //nullable> m_oWindowProtection; - //nullable> m_oWorkbookViewId; - //nullable> m_oZoomScale; - //nullable> m_oZoomScaleNormal; - //nullable> m_oZoomScalePageLayoutView; - //nullable> m_oZoomScaleSheetLayoutView; + } + if (oox_sheet_views->m_arrItems[i]->m_oSelection->m_oSqref.IsInit()) + { + //D6:D9 I9:I12 M16:M21 C20:I24 + //в OpenOffice этого нету + } + } + if (oox_sheet_views->m_arrItems[i]->m_oPane.IsInit()) + { + + if (oox_sheet_views->m_arrItems[i]->m_oPane->m_oXSplit.IsInit()) + { + std::wstring sVal = boost::lexical_cast((int)oox_sheet_views->m_arrItems[i]->m_oPane->m_oXSplit->GetValue()); + + ods_context->settings_context()->add_property(L"HorizontalSplitMode", L"short", L"2"); + ods_context->settings_context()->add_property(L"HorizontalSplitPosition", L"int", sVal); + ods_context->settings_context()->add_property(L"PositionLeft", L"int", L"0"); + ods_context->settings_context()->add_property(L"PositionRight", L"int", sVal); + } + if (oox_sheet_views->m_arrItems[i]->m_oPane->m_oYSplit.IsInit()) + { + std::wstring sVal = boost::lexical_cast((int)oox_sheet_views->m_arrItems[i]->m_oPane->m_oYSplit->GetValue()); + ods_context->settings_context()->add_property(L"VerticalSplitMode", L"short", L"2"); + ods_context->settings_context()->add_property(L"VerticalSplitPosition", L"int", sVal); + ods_context->settings_context()->add_property(L"PositionTop", L"int", L"0"); + ods_context->settings_context()->add_property(L"PositionBottom", L"int", sVal); + } + } + //nullable> m_oDefaultGridColor; + //nullable> m_oShowFormulas; + //nullable> m_oShowOutlineSymbols; + //nullable> m_oShowRowColHeaders; + //nullable> m_oShowRuler; + //nullable> m_oShowWhiteSpace; + //nullable> m_oShowZeros; + //nullable> m_oTabSelected; + //nullable m_oTopLeftCell; + //nullable>m_oView; + //nullable> m_oWindowProtection; + //nullable> m_oWorkbookViewId; + //nullable> m_oZoomScaleNormal; + //nullable> m_oZoomScalePageLayoutView; + //nullable> m_oZoomScaleSheetLayoutView; ods_context->end_table_view(); } } @@ -1683,7 +1779,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape) if (oox_shape->m_oNvSpPr.IsInit()) { OoxConverter::convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer()); //имя, описалово, номер ... - convert(oox_shape->m_oNvSpPr->m_oCNvSpPr.GetPointer()); //заблокированности + convert(oox_shape->m_oNvSpPr->m_oCNvSpPr.GetPointer()); //заблокированности ... todooo } if (oox_shape->m_oShapeStyle.IsInit()) { diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.h b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.h index 1a562e75da..42ac510521 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.h +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.h @@ -61,6 +61,7 @@ namespace OOX class CPageSetup; class CPageMargins; class CSi; + class CWorkbookView; } } @@ -140,7 +141,8 @@ namespace Oox2Odf void convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views); void convert(OOX::Spreadsheet::CPageSetup *oox_page); void convert(OOX::Spreadsheet::CPageMargins *oox_page); - + void convert(OOX::Spreadsheet::CWorkbookView *oox_book_views); + void convert(OOX::Spreadsheet::CFont *font, odf_writer::style_text_properties *text_properties); void convert(OOX::Spreadsheet::CBorder *border, odf_writer::style_table_cell_properties *cell_properties); void convert(OOX::Spreadsheet::CFill *fill, odf_writer::style_table_cell_properties *cell_properties); @@ -156,16 +158,16 @@ namespace Oox2Odf void convert(OOX::Spreadsheet::CNumFmt *numFmt); void convert(OOX::Spreadsheet::CDxf *dxFmt, int oox_id); - void convert(OOX::Spreadsheet::CCellAnchor *oox_anchor); - void convert(OOX::Spreadsheet::CDrawing *oox_drawing); + void convert(OOX::Spreadsheet::CCellAnchor *oox_anchor); + void convert(OOX::Spreadsheet::CDrawing *oox_drawing); - void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position * pos); + void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position * pos); - void convert(OOX::Spreadsheet::CPic *oox_picture); - void convert(OOX::Spreadsheet::CShape *oox_shape); - void convert(OOX::Spreadsheet::CConnShape *oox_conn_shape); - void convert(OOX::Spreadsheet::CGraphicFrame *oox_graphic_frame); - void convert(OOX::Spreadsheet::CGroupShape *oox_group_shape); + void convert(OOX::Spreadsheet::CPic *oox_picture); + void convert(OOX::Spreadsheet::CShape *oox_shape); + void convert(OOX::Spreadsheet::CConnShape *oox_conn_shape); + void convert(OOX::Spreadsheet::CGraphicFrame *oox_graphic_frame); + void convert(OOX::Spreadsheet::CGroupShape *oox_group_shape); void convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt); void convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule); diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h index cea1856dc7..5c7c31448a 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h @@ -409,7 +409,6 @@ namespace OOX nullable> m_oThickTop; nullable> m_oZeroHeight; }; - class CPane : public WritingElement { public: @@ -487,10 +486,84 @@ namespace OOX nullable m_oYSplit; }; + class CSelection : public WritingElement + { + public: + WritingElementSpreadsheet_AdditionConstructors(CSelection) + CSelection() + { + } + virtual ~CSelection() + { + } + + public: + virtual CString toXML() const + { + return _T(""); + } + virtual void toXML(XmlUtils::CStringWriter& writer) const + { + writer.WriteString(_T("")); + } + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + + virtual EElementType getType () const + { + return et_Selection; + } + + private: + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + + WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCell") , m_oActiveCell) + WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCellId") , m_oActiveCellId) + WritingElement_ReadAttributes_Read_if ( oReader, _T("sqref") , m_oSqref) + WritingElement_ReadAttributes_Read_if ( oReader, _T("pane") , m_oPane) + + WritingElement_ReadAttributes_End( oReader ) + } + + public: + nullable m_oActiveCell; + nullable> m_oActiveCellId; + nullable m_oSqref; + nullable m_oPane; //bottomLeft, bottomRight, topLeft, topRight + }; + //необработано: // // - // class CSheetView : public WritingElement { public: @@ -609,6 +682,9 @@ namespace OOX if (m_oPane.IsInit()) m_oPane->toXML(writer); + + if (m_oSelection.IsInit()) + m_oSelection->toXML(writer); writer.WriteString(_T("")); } @@ -626,7 +702,8 @@ namespace OOX if (_T("pane") == sName) m_oPane = oReader; - } + if (_T("selection") == sName) + m_oSelection = oReader; } } virtual EElementType getType () const @@ -666,6 +743,7 @@ namespace OOX public: nullable m_oPane; + nullable m_oSelection; nullable> m_oColorId; nullable> m_oDefaultGridColor; diff --git a/Common/DocxFormat/Source/XlsxFormat/WritingElement.h b/Common/DocxFormat/Source/XlsxFormat/WritingElement.h index e88ad08132..3aac9d4c13 100644 --- a/Common/DocxFormat/Source/XlsxFormat/WritingElement.h +++ b/Common/DocxFormat/Source/XlsxFormat/WritingElement.h @@ -304,6 +304,7 @@ namespace Spreadsheet et_SheetPr, et_Pane, et_ExternalBook, + et_Selection, et_PictureNonVisual, et_NonVisualDrawingProperties,