Commit 0f04de34 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - dont write backgroud master notes, notes (errors in libre & open office)

parent 3f8c2c29
......@@ -34,8 +34,6 @@
#include "office_presentation.h"
#include "draw_page.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
......@@ -76,9 +74,10 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
{
Context.start_office_text();
_CP_LOG << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->docx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->docx_convert(Context);
}
Context.end_office_text();
}
......@@ -87,9 +86,10 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_office_spreadsheet(this);
_CP_LOG << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, pages_)
{
elm->xlsx_convert(Context);
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->xlsx_convert(Context);
}
Context.end_office_spreadsheet();
}
......@@ -100,29 +100,29 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
_CP_LOG << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
BOOST_FOREACH(const office_element_ptr & elm, footer_decls_)
for (size_t i = 0; i < footer_decls_.size(); i++)
{
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(elm.get());
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(footer_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"footer:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, footer_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, date_time_decls_)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(elm.get());
for (size_t i = 0; i < date_time_decls_.size(); i++)
{
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(date_time_decls_[i].get());
if (!style)
continue;
std::wstring style_name_ = L"datetime:" + style->presentation_name_.get_value_or(L"");
Context.root()->odf_context().drawStyles().add(style_name_, elm);
Context.root()->odf_context().drawStyles().add(style_name_, date_time_decls_[i]);
}
BOOST_FOREACH(const office_element_ptr & elm, pages_)
for (size_t i = 0; i < pages_.size(); i++)
{
elm->pptx_convert(Context);
pages_[i]->pptx_convert(Context);
}
Context.end_office_presentation();
}
......
......@@ -602,17 +602,24 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
bool bLine = odf_context()->drawing_context()->isLineShape();
if (!bLine)
if (custGeom && !custGeom->cxnLst.empty())
bLine = true;
odf_context()->drawing_context()->start_area_properties();
{
odf_context()->drawing_context()->start_area_properties();
if (bLine)
{
odf_context()->drawing_context()->set_no_fill();
}
else
{
if (oox_spPr->Fill.is_init())
convert(&oox_spPr->Fill);
else if (oox_sp_style)
convert(&oox_sp_style->fillRef, 1);
}
odf_context()->drawing_context()->end_area_properties();
}
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->start_line_properties();
{
......
......@@ -72,6 +72,7 @@ using namespace cpdoccore;
namespace Oox2Odf
{
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
current_clrMap = NULL;
......@@ -342,7 +343,7 @@ void PptxConverter::convert_slides()
current_slide = slide->Master.operator->();
if (bShowLayoutMasterSp && bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false, true, 2);
convert_slide(&slide->Master->cSld, current_txStyles, false, true, Master);
else
convert(slide->Master->cSld.bg.GetPointer());
......@@ -350,7 +351,7 @@ void PptxConverter::convert_slides()
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, Layout);
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
else convert (slide->Master->transition.GetPointer());
......@@ -402,7 +403,7 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, 1);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, Slide);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
......@@ -435,7 +436,7 @@ void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
odf_context()->page_layout_context()->set_page_size(width, height);
}
convert_slide(&oox_notes->cSld, NULL, true, true, 2);
convert_slide(&oox_notes->cSld, NULL, true, true, NotesMaster);
odp_context->end_note();
......@@ -468,7 +469,7 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
convert_slide(&oox_notes->cSld, NULL, true, true, 1);
convert_slide(&oox_notes->cSld, NULL, true, true, Notes);
odp_context->end_note();
......@@ -1312,13 +1313,19 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
}
odf_writer::style* page_style_ = dynamic_cast<odf_writer::style*>(odp_context->current_slide().page_style_elm_.get());
odf_writer::style_drawing_page_properties* page_props = page_style_->content_.get_style_drawing_page_properties();
//необязательно
//if (page_props->content_.common_draw_fill_attlist_.draw_fill_image_name_)
//{
// page_props->content_.draw_background_size_ = L"border";
//}
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
odp_context->end_drawings();
}
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type)
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type)
{
if (oox_slide == NULL) return;
......@@ -1328,7 +1335,10 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
if (oox_slide->attrName.IsInit())
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
convert(oox_slide->bg.GetPointer());
if (type != Notes && type != NotesMaster)
{
convert(oox_slide->bg.GetPointer());
}
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
{
......@@ -1348,7 +1358,7 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
{
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
if (type == 3 && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
if (type == Layout && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);
......
......@@ -100,6 +100,14 @@ using namespace cpdoccore;
namespace Oox2Odf
{
enum _typePages
{
Slide,
Master,
Layout,
NotesMaster,
Notes
};
class PptxConverter : public OoxConverter
{
public:
......@@ -119,7 +127,7 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type);
void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_notes);
......
......@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.462.0
VERSION = 2.4.463.0
DEFINES += INTVER=$$VERSION
TARGET = x2t
......
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