From f5b3e1c0df2a129bf07752f9ac388ff765aafe4f Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Tue, 14 Jan 2014 14:45:18 +0000 Subject: [PATCH] =?UTF-8?q?(1.0.1.164):=20ASCOfficeOdfFile=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D1=8B=20=D0=B8=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=D1=8B=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D1=85=D0=BE=D0=B4=D1=8B=20=D0=BC=D0=B5=D0=B6=D0=B4?= =?UTF-8?q?=D1=83=20=D1=81=D0=BB=D0=B0=D0=B9=D0=B4=D0=B0=D0=BC=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D0=BF=D1=80=D0=B5=D0=B7=D0=B5=D0=BD=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=D1=85=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20sta?= =?UTF-8?q?ble?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53574 954022d7-b5bf-4e40-9824-e11837661b57 --- ASCOfficeODFFile/ASCOfficeOdfFile/version.h | 8 +- ASCOfficeODFFile/cpodf.vcproj | 16 ++ .../src/docx/pptx_conversion_context.h | 20 +- .../src/docx/pptx_slide_context.cpp | 77 ++++--- .../src/docx/pptx_slide_context.h | 8 +- ASCOfficeODFFile/src/odf/anim_elements.cpp | 189 +++++++++++++++++- ASCOfficeODFFile/src/odf/anim_elements.h | 13 +- ASCOfficeODFFile/src/odf/clockvalue.cpp | 100 +++++++++ ASCOfficeODFFile/src/odf/clockvalue.h | 34 ++++ ASCOfficeODFFile/src/odf/color.h | 5 +- ASCOfficeODFFile/src/odf/common_attlists.cpp | 2 +- ASCOfficeODFFile/src/odf/common_attlists.h | 5 +- ASCOfficeODFFile/src/odf/draw_page.cpp | 16 ++ ASCOfficeODFFile/src/odf/length.h | 6 - .../src/odf/odf_document_impl.cpp | 1 - .../src/odf/smil_transitiontype.cpp | 60 ++++++ .../src/odf/smil_transitiontype.h | 77 +++++++ .../src/odf/style_presentation.cpp | 5 + ASCOfficeODFFile/src/odf/style_presentation.h | 12 +- 19 files changed, 571 insertions(+), 83 deletions(-) create mode 100644 ASCOfficeODFFile/src/odf/clockvalue.cpp create mode 100644 ASCOfficeODFFile/src/odf/clockvalue.h create mode 100644 ASCOfficeODFFile/src/odf/smil_transitiontype.cpp create mode 100644 ASCOfficeODFFile/src/odf/smil_transitiontype.h diff --git a/ASCOfficeODFFile/ASCOfficeOdfFile/version.h b/ASCOfficeODFFile/ASCOfficeOdfFile/version.h index 14dc3e6ce8..7b005572a7 100644 --- a/ASCOfficeODFFile/ASCOfficeOdfFile/version.h +++ b/ASCOfficeODFFile/ASCOfficeOdfFile/version.h @@ -1,7 +1,7 @@ #pragma once //1 //0 -//0 -//163 -#define INTVER 1,0,0,163 -#define STRVER "1,0,0,163\0" +//1 +//164 +#define INTVER 1,0,1,164 +#define STRVER "1,0,1,164\0" diff --git a/ASCOfficeODFFile/cpodf.vcproj b/ASCOfficeODFFile/cpodf.vcproj index f16e73466e..2af6c67fc8 100644 --- a/ASCOfficeODFFile/cpodf.vcproj +++ b/ASCOfficeODFFile/cpodf.vcproj @@ -481,6 +481,14 @@ RelativePath=".\src\odf\chartsymbol.h" > + + + + @@ -785,6 +793,14 @@ RelativePath=".\src\odf\shadowtype.h" > + + + + diff --git a/ASCOfficeODFFile/src/docx/pptx_conversion_context.h b/ASCOfficeODFFile/src/docx/pptx_conversion_context.h index fc4e143338..93a8f9a57a 100644 --- a/ASCOfficeODFFile/src/docx/pptx_conversion_context.h +++ b/ASCOfficeODFFile/src/docx/pptx_conversion_context.h @@ -47,12 +47,6 @@ public: void start_office_presentation(); void end_office_presentation(); - //void start_paragraph(const std::wstring & styleName); - //void end_paragraph(); - - //void start_span(const std::wstring & styleName); - //void end_span(); - bool start_page(const std::wstring & pageName, const std::wstring & pageStyleName, const std::wstring & pageLayoutName, @@ -89,21 +83,9 @@ public: pptx_table_context & get_table_context(){return pptx_table_context_;} - // num_format_context & get_num_format_context() { return num_format_context_; } - - // xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; } - - // xlsx_table_metrics & get_table_metrics(); - // xlsx_drawing_context & get_drawing_context(); - // xlsx_drawing_context_handle & get_drawing_context_handle(); - // - // xlsx_comments_context & get_comments_context(); - //xlsx_comments_context_handle & get_comments_context_handle(); - - mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); } - //void start_hyperlink(const std::wstring & styleName);//сюда сваливаются гиперлинки с текста + //void start_hyperlink(const std::wstring & styleName); //void end_hyperlink(std::wstring const & href); void process_master_pages(); diff --git a/ASCOfficeODFFile/src/docx/pptx_slide_context.cpp b/ASCOfficeODFFile/src/docx/pptx_slide_context.cpp index 99d8d01356..0f4f734364 100644 --- a/ASCOfficeODFFile/src/docx/pptx_slide_context.cpp +++ b/ASCOfficeODFFile/src/docx/pptx_slide_context.cpp @@ -27,11 +27,14 @@ public: struct _transition { - bool Enabled; - std::wstring Speed; - int Time; - std::wstring Type; - std::wstring Direction; + bool Enabled; + std::wstring Type; + + _CP_OPT(std::wstring) Speed; + _CP_OPT(int) Time; + _CP_OPT(std::wstring) Dir; + _CP_OPT(std::wstring) Param; + bool onClick; }; Impl(const std::wstring & odfPacket) : mediaitems_(odfPacket),odfPacket_(odfPacket) @@ -93,7 +96,9 @@ public: pptx_drawings_ = pptx_drawings::create(); - memset(&transition_,0,sizeof(_transition)); + transition_.Enabled = false; + transition_.Speed = boost::none; + transition_.onClick = true; } size_t next_rId() @@ -133,21 +138,31 @@ void pptx_slide_context::start_slide_animation() impl_->transition_.Enabled = true; //default - impl_->transition_.Speed = L"med"; - impl_->transition_.Type = L"wipe"; + impl_->transition_.Type = L"wipe"; + impl_->transition_.Time = boost::none; + + impl_->transition_.Dir = boost::none; + impl_->transition_.Param = boost::none; + //speed & onClick выставляются ранее } -//временно !!!! -void pptx_slide_context::set_animation_duration(int dur) + +void pptx_slide_context::set_transitionFilter(std::wstring & type,_CP_OPT(std::wstring) & dir,_CP_OPT(std::wstring) & dop,_CP_OPT(int) & time) { - impl_->transition_.Time = dur; + impl_->transition_.Type = type; + impl_->transition_.Time = time; // не путать длительность перехода с длительностью эффекта перехода (в oo его нет) + impl_->transition_.Dir = dir; + impl_->transition_.Param = dop; } -//smil_direction_,smil_type_,smil_subtype_,smil_mode_,color); -void pptx_slide_context::set_transitionFilter( _CP_OPT(std::wstring) direction, - _CP_OPT(std::wstring) type, - _CP_OPT(std::wstring) subtype, - _CP_OPT(std::wstring) mode, - _CP_OPT(std::wstring) fade_color) + +void pptx_slide_context::set_transitionAction(bool val) { + impl_->transition_.onClick = val; +} + +void pptx_slide_context::set_transitionSpeed(std::wstring val) +{ + if (val == L"medium")impl_->transition_.Speed=L"med"; + else impl_->transition_.Speed= val;//fast / slow } @@ -542,22 +557,34 @@ void pptx_slide_context::serialize_animations(std::wostream & strm) { CP_XML_NODE(L"p:transition") { - if (impl_->transition_.Time>0) + if (impl_->transition_.Speed) { - CP_XML_ATTR(L"spd",impl_->transition_.Speed); + CP_XML_ATTR(L"spd",impl_->transition_.Speed.get()); } - if (impl_->transition_.Time >0) + if (impl_->transition_.Time) { - CP_XML_ATTR(L"advTm",impl_->transition_.Time); - } + CP_XML_ATTR(L"advTm",impl_->transition_.Time.get()); + } + CP_XML_ATTR(L"advClick", impl_->transition_.onClick); CP_XML_NODE(std::wstring(L"p:" + impl_->transition_.Type)) { - if (!impl_->transition_.Direction.empty()) + if (impl_->transition_.Dir) { - CP_XML_ATTR(L"dir",impl_->transition_.Direction); + CP_XML_ATTR(L"dir",impl_->transition_.Dir.get()); } - } + + if (impl_->transition_.Param) + { + if (impl_->transition_.Type == L"wheel") + CP_XML_ATTR(L"spokes",impl_->transition_.Param.get()); + if (impl_->transition_.Type == L"fade") + CP_XML_ATTR(L"thruBlk",impl_->transition_.Param.get()); + if (impl_->transition_.Type == L"split") + CP_XML_ATTR(L"orient",impl_->transition_.Param.get()); + } + } + //p:sndAc } } //CP_XML_NODE(L"p:timing")- последовательности p:par diff --git a/ASCOfficeODFFile/src/docx/pptx_slide_context.h b/ASCOfficeODFFile/src/docx/pptx_slide_context.h index 0f9a1cbe21..b6aa70ca81 100644 --- a/ASCOfficeODFFile/src/docx/pptx_slide_context.h +++ b/ASCOfficeODFFile/src/docx/pptx_slide_context.h @@ -16,7 +16,7 @@ struct _oox_fill; class pptx_slide_context { public: - pptx_slide_context(pptx_conversion_context & Context/*, pptx_text_context & textCotnext*/); + pptx_slide_context(pptx_conversion_context & Context); void start_slide(); void end_slide(){} @@ -24,9 +24,9 @@ public: void start_slide_animation(); void end_slide_animation(){} - void set_animation_duration(int dur); - void set_transitionFilter(_CP_OPT(std::wstring),_CP_OPT(std::wstring),_CP_OPT(std::wstring),_CP_OPT(std::wstring),_CP_OPT(std::wstring)); - + void set_transitionFilter(std::wstring & type,_CP_OPT(std::wstring) & dir, _CP_OPT(std::wstring) & dop, _CP_OPT(int) & time); + void set_transitionAction(bool val); + void set_transitionSpeed(std::wstring val); /////////////////////////////////////////////////////////////////////////////////////////// void set_rect(double width_pt, double height_pt, double x_pt, double y_pt); diff --git a/ASCOfficeODFFile/src/odf/anim_elements.cpp b/ASCOfficeODFFile/src/odf/anim_elements.cpp index 5aa96692b1..c0e228fc24 100644 --- a/ASCOfficeODFFile/src/odf/anim_elements.cpp +++ b/ASCOfficeODFFile/src/odf/anim_elements.cpp @@ -90,6 +90,7 @@ void anim_transition_filter_attlist::add_attributes( const xml::attributes_wc_pt CP_APPLY_ATTR(L"smil:type", smil_type_); CP_APPLY_ATTR(L"smil:fadeColor", smil_fadeColor_); CP_APPLY_ATTR(L"smil:mode", smil_mode_); + CP_APPLY_ATTR(L"smil:dur", smil_dur_); } @@ -104,17 +105,189 @@ void anim_transitionFilter::add_attributes( const xml::attributes_wc_ptr & Attri void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context) { - if (common_anim_smil_attlist_.smil_dur_) - { - Context.get_slide_context().set_animation_duration(5000/*common_anim_smil_attlist_.smil_dur_*/);//*1000); - //need parsing ~ 3s - } _CP_OPT(std::wstring) color; - if (smil_fadeColor_) + _CP_OPT(std::wstring) dir; + _CP_OPT(int) time; + std::wstring type; + + _CP_OPT(std::wstring) param; + + if (anim_transition_filter_attlist_.smil_dur_) { - color = smil_fadeColor_->get_hex_value(); + time = anim_transition_filter_attlist_.smil_dur_->get_value(); + } + if (anim_transition_filter_attlist_.smil_fadeColor_) + { + color =anim_transition_filter_attlist_.smil_fadeColor_->get_hex_value(); } - Context.get_slide_context().set_transitionFilter(smil_direction_,smil_type_,smil_subtype_,smil_mode_,color); + + smil_transition_type::type transition_type; + + if (anim_transition_filter_attlist_.smil_type_) + { + transition_type = anim_transition_filter_attlist_.smil_type_->get_type(); + } + + switch(transition_type) + { + case smil_transition_type::barnVeeWipe: + type = L"split"; + break; + case smil_transition_type::irisWipe: + if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"diamond")) + type = L"diamond"; + else + type = L"zoom"; + break; + case smil_transition_type::miscDiagonalWipe: + if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"doubleDiamond")) + type = L"diamond"; + else + type = L"zoom"; + break; + case smil_transition_type::ellipseWipe: + case smil_transition_type::eyeWipe: + type = L"circle"; + break; + case smil_transition_type::roundRectWipe: + type = L"zoom"; + break; + case smil_transition_type::fourBoxWipe: + case smil_transition_type::triangleWipe: + case smil_transition_type::arrowHeadWipe: + case smil_transition_type::pentagonWipe: + case smil_transition_type::hexagonWipe: + case smil_transition_type::starWipe: + case smil_transition_type::miscShapeWipe: + type = L"plus"; + break; + case smil_transition_type::pinWheelWipe: + param = L"2"; + case smil_transition_type::clockWipe: + case smil_transition_type::singleSweepWipe: // + case smil_transition_type::doubleFanWipe: // + type = L"wheel"; + if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1"; + if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"threeBlade"))param = L"3"; + if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4"; + if ((anim_transition_filter_attlist_.smil_subtype_) && (anim_transition_filter_attlist_.smil_subtype_.get()==L"eightBlade"))param = L"8"; + break; + case smil_transition_type::fanWipe: + type = L"wedge"; + break; + case smil_transition_type::fade: + type = L"fade"; + param = L"1"; + break; + case smil_transition_type::checkerBoardWipe: + type = L"checker"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"across") dir = L"horz"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"down") dir = L"vert"; + break; + case smil_transition_type::blindsWipe: + type = L"blinds"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz"; + break; + case smil_transition_type::diagonalWipe: + case smil_transition_type::waterfallWipe: + type = L"strips"; + if (anim_transition_filter_attlist_.smil_subtype_) + { + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontalLeft") dir = L"rd"; + else if(anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontalRight")dir = L"lu"; + else if(anim_transition_filter_attlist_.smil_subtype_.get()==L"verticalRight") dir = L"ld"; + else dir = L"ru"; + } + break; + case smil_transition_type::dissolve: + type = L"dissolve"; + break; + case smil_transition_type::randomBarWipe: + type = L"randomBar"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz"; + break; + case smil_transition_type::pushWipe: + type = L"push"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";}; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"combHorizontal") {type = L"comb"; dir = L"horz";}; + break; + case smil_transition_type::slideWipe: + type = L"pull"; + break; + case smil_transition_type::boxWipe: + type = L"cover"; + break; + case smil_transition_type::barnDoorWipe: + type = L"split"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"vertical") param = L"vert"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"horizontal") param = L"horz"; + break; + case smil_transition_type::barWipe: + type = L"wipe"; + if (anim_transition_filter_attlist_.smil_subtype_) + { + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";} + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") {type = L"strips"; dir = L"ru";} + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";} + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomRight"){type = L"strips"; dir = L"lu";} + + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";} + } + break; +/////////////////////////////////////////////////////// + case smil_transition_type::bowTieWipe: + case smil_transition_type::veeWipe: + case smil_transition_type::zigZagWipe: + case smil_transition_type::barnZigZagWipe: + case smil_transition_type::doubleSweepWipe: + case smil_transition_type::saloonDoorWipe: + case smil_transition_type::windshieldWipe: + case smil_transition_type::snakeWipe: + case smil_transition_type::spiralWipe: + case smil_transition_type::parallelSnakesWipe: + case smil_transition_type::boxSnakesWipe: + break; +////////////////////////////////////////////////////// + } + if (anim_transition_filter_attlist_.smil_subtype_) + { + if (!dir) + { + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"leftToRight") + { + if ((anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))dir = L"l"; + else dir = L"r"; + } + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topToBottom") + { + if ((anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse"))dir = L"u"; + else dir = L"d"; + } + + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u"; + + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd"; + + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") dir = L"ru"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld"; + if (anim_transition_filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu"; + + } + + if (!dir && (anim_transition_filter_attlist_.smil_direction_) && (anim_transition_filter_attlist_.smil_direction_.get()==L"reverse")) + dir = L"in"; + } + + Context.get_slide_context().set_transitionFilter(type , dir, param , time); } diff --git a/ASCOfficeODFFile/src/odf/anim_elements.h b/ASCOfficeODFFile/src/odf/anim_elements.h index 9772b579e4..0e8b9caa55 100644 --- a/ASCOfficeODFFile/src/odf/anim_elements.h +++ b/ASCOfficeODFFile/src/odf/anim_elements.h @@ -7,6 +7,8 @@ #include "office_elements.h" #include "office_elements_create.h" +#include "common_attlists.h" +#include "smil_transitiontype.h" namespace cpdoccore { namespace odf { @@ -72,11 +74,11 @@ public: _CP_OPT(std::wstring) smil_direction_; _CP_OPT(std::wstring) smil_subtype_; - _CP_OPT(std::wstring) smil_type_; - _CP_OPT(std::wstring) smil_dur_; + _CP_OPT(smil_transition_type) smil_type_; _CP_OPT(std::wstring) smil_mode_; - _CP_OPT(color) smil_fadeColor; -} + _CP_OPT(color) smil_fadeColor_; + _CP_OPT(clockvalue) smil_dur_; +}; //anim:transitionFilter class anim_transitionFilter : public office_element_impl @@ -95,7 +97,8 @@ public: private: - virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); + virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name){} + virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); }; diff --git a/ASCOfficeODFFile/src/odf/clockvalue.cpp b/ASCOfficeODFFile/src/odf/clockvalue.cpp new file mode 100644 index 0000000000..119f30a36a --- /dev/null +++ b/ASCOfficeODFFile/src/odf/clockvalue.cpp @@ -0,0 +1,100 @@ +#include "precompiled_cpodf.h" +#include "clockvalue.h" + +#include +#include +#include +#include + +namespace cpdoccore { namespace odf { + +static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms) +{ + try + { + boost::match_results res; + +//Full clock values: +// 02:30:03 = 2 hours, 30 minutes and 3 seconds +// 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds + + boost::wregex r1 (L"([\\d]+):([\\d]+):([\\d+(\\.\\d{0,})?]+)"); + if (boost::regex_match(Time, res, r1)) + { + Hours = boost::lexical_cast(res[1].str()); + Minutes = boost::lexical_cast(res[2].str()); + Seconds = boost::lexical_cast(res[3].str()); + + return true; + } +//Partial clock value: +// 02:33 = 2 minutes and 33 seconds +// 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds + std::wstring Time2 = L"00:10.5"; + boost::wregex r2 (L"([\\d]+):([\\d+(\\.\\d{0,})?]+)"); + if (boost::regex_match(Time, res, r2)) + { + Minutes = boost::lexical_cast(res[1].str()); + Seconds = boost::lexical_cast(res[2].str()); + + return true; + } +//Timecount values: +// 3.2h = 3.2 hours = 3 hours and 12 minutes +// 45min = 45 minutes +// 30s = 30 seconds +// 5ms = 5 milliseconds +// 12.467 = 12 seconds and 467 milliseconds + boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]{0,})"); + if (boost::regex_match(Time, res, r3)) + { + if (!res[2].str().empty()) + { + std::wstring n = res[2].str(); + std::transform(n.begin(), n.end(), n.begin(), ::tolower); + if (n == L"h") + { + Hours = boost::lexical_cast(res[1].str()); + } + else if (n == L"min") + { + Minutes = boost::lexical_cast(res[1].str()); + } + else if (n == L"s") + { + Seconds = boost::lexical_cast(res[1].str()); + } + else if (n == L"ms") + { + Ms = boost::lexical_cast(res[1].str()); + } + } + else + Seconds = boost::lexical_cast(res[1].str()); + + return true; + } + } + catch(...) + { + } + return false; +} +clockvalue clockvalue::parse(const std::wstring & Str) +{ + int v=0; + + + int ms=0; + double h=0,m=0,s =0; + bool res = parseTime(Str,h,m,s,ms); + + v = (((h*60)+m)*60+s)*1000+ms; + + return clockvalue(v); +} + + + +} } + diff --git a/ASCOfficeODFFile/src/odf/clockvalue.h b/ASCOfficeODFFile/src/odf/clockvalue.h new file mode 100644 index 0000000000..6239a67fe0 --- /dev/null +++ b/ASCOfficeODFFile/src/odf/clockvalue.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include "odfattributes.h" + +namespace cpdoccore { namespace odf { + +class clockvalue +{ +public: + +public: + clockvalue(int ms = 0) : value_(ms) + {} + + int get_value() const + { + return value_; + } + + + static clockvalue parse(const std::wstring & Str); + +private: + int value_;//in ms +}; + +} + +APPLY_PARSE_XML_ATTRIBUTES(odf::clockvalue); + +} + diff --git a/ASCOfficeODFFile/src/odf/color.h b/ASCOfficeODFFile/src/odf/color.h index 74ecb11ac2..3064e131fb 100644 --- a/ASCOfficeODFFile/src/odf/color.h +++ b/ASCOfficeODFFile/src/odf/color.h @@ -1,5 +1,4 @@ -#ifndef _CPDOCCORE_ODF_COLOR_H_ -#define _CPDOCCORE_ODF_COLOR_H_ +#pragma once #include #include @@ -35,5 +34,3 @@ std::wostream & operator << (std::wostream & _Wostream, const color & _Color); APPLY_PARSE_XML_ATTRIBUTES(odf::color); } - -#endif diff --git a/ASCOfficeODFFile/src/odf/common_attlists.cpp b/ASCOfficeODFFile/src/odf/common_attlists.cpp index c2c83373c8..aade36b8fa 100644 --- a/ASCOfficeODFFile/src/odf/common_attlists.cpp +++ b/ASCOfficeODFFile/src/odf/common_attlists.cpp @@ -482,7 +482,7 @@ void common_anim_smil_attlist::add_attributes( const xml::attributes_wc_ptr & At //CP_APPLY_ATTR(L"smil:direction", smil_direction_); // CP_APPLY_ATTR(L"smil:subtype", smil_subtype_); // CP_APPLY_ATTR(L"smil:type", smil_type_); - CP_APPLY_ATTR(L"smil:dur", smil_dur_); + //CP_APPLY_ATTR(L"smil:dur", smil_dur_); } // diff --git a/ASCOfficeODFFile/src/odf/common_attlists.h b/ASCOfficeODFFile/src/odf/common_attlists.h index 95b01e2211..643da282f1 100644 --- a/ASCOfficeODFFile/src/odf/common_attlists.h +++ b/ASCOfficeODFFile/src/odf/common_attlists.h @@ -23,6 +23,7 @@ #include "presentationclass.h" #include "xlink.h" #include "drawfill.h" +#include "clockvalue.h" #define _CP_APPLY_PROP(A, B) \ if (B) \ @@ -802,14 +803,14 @@ public: //_CP_APPLY_PROP(smil_direction_, Other.smil_direction_); //_CP_APPLY_PROP(smil_subtype_, Other.smil_subtype_); //_CP_APPLY_PROP(smil_type_, Other.smil_type_); - _CP_APPLY_PROP(smil_dur_, Other.smil_dur_); + // _CP_APPLY_PROP(smil_dur_, Other.smil_dur_); } public: //_CP_OPT(std::wstring) smil_direction_; //_CP_OPT(std::wstring) smil_subtype_; //_CP_OPT(std::wstring) smil_type_; - _CP_OPT(std::wstring) smil_dur_; + //_CP_OPT(std::wstring) smil_dur_; //_CP_OPT(color) smil_fadeColor; diff --git a/ASCOfficeODFFile/src/odf/draw_page.cpp b/ASCOfficeODFFile/src/odf/draw_page.cpp index 3b5473662c..879c23f489 100644 --- a/ASCOfficeODFFile/src/odf/draw_page.cpp +++ b/ASCOfficeODFFile/src/odf/draw_page.cpp @@ -117,6 +117,22 @@ void draw_page::pptx_convert(oox::pptx_conversion_context & Context) oox::_oox_fill fill; Compute_GraphicFill(properties->content().common_draw_fill_attlist_, Context.root()->odf_context().drawStyles() ,fill); Context.get_slide_context().add_background(fill); + + //часть свойств переходов между слайдами тута + + if (properties->content().presentation_transition_type_) + { + if (properties->content().presentation_transition_type_.get() == L"automatic" || + properties->content().presentation_transition_type_.get() == L"semi-automatic") + { + Context.get_slide_context().set_transitionAction(false); + }else + Context.get_slide_context().set_transitionAction(true);//manual (default) + } + if (properties->content().presentation_transition_speed_) + { + Context.get_slide_context().set_transitionSpeed(properties->content().presentation_transition_speed_.get()); + } } } } diff --git a/ASCOfficeODFFile/src/odf/length.h b/ASCOfficeODFFile/src/odf/length.h index 094c299c1c..d477aedd7b 100644 --- a/ASCOfficeODFFile/src/odf/length.h +++ b/ASCOfficeODFFile/src/odf/length.h @@ -1,9 +1,4 @@ -#ifndef _CPDOCCORE_LENGTH_H_ -#define _CPDOCCORE_LENGTH_H_ - -#ifdef _MSC_VER #pragma once -#endif #include #include @@ -60,4 +55,3 @@ APPLY_PARSE_XML_ATTRIBUTES(odf::length); } -#endif diff --git a/ASCOfficeODFFile/src/odf/odf_document_impl.cpp b/ASCOfficeODFFile/src/odf/odf_document_impl.cpp index 50905d0941..74adcc4992 100644 --- a/ASCOfficeODFFile/src/odf/odf_document_impl.cpp +++ b/ASCOfficeODFFile/src/odf/odf_document_impl.cpp @@ -33,7 +33,6 @@ #include "paragraph_elements.h" #include "text_elements.h" -#include "anim_elements.h" #include "table_calculation_settings.h" #include "number_style.h" diff --git a/ASCOfficeODFFile/src/odf/smil_transitiontype.cpp b/ASCOfficeODFFile/src/odf/smil_transitiontype.cpp new file mode 100644 index 0000000000..adea174246 --- /dev/null +++ b/ASCOfficeODFFile/src/odf/smil_transitiontype.cpp @@ -0,0 +1,60 @@ +#include "precompiled_cpodf.h" +#include "smil_transitiontype.h" + +#include + +namespace cpdoccore { namespace odf { + +smil_transition_type smil_transition_type::parse(const std::wstring & Str) +{ + std::wstring tmp = Str; + boost::algorithm::to_lower(tmp); + + if(tmp == L"barwipe") return smil_transition_type( barWipe ); + else if(tmp == L"boxwipe") return smil_transition_type( boxWipe ); + else if(tmp == L"fourboxwipe") return smil_transition_type( fourBoxWipe ); + else if(tmp == L"barndoorwipe") return smil_transition_type( barnDoorWipe ); + else if(tmp == L"diagonalwipe") return smil_transition_type( diagonalWipe ); + else if(tmp == L"bowtiewipe") return smil_transition_type( bowTieWipe ); + else if(tmp == L"miscdiagonalwipe") return smil_transition_type( miscDiagonalWipe ); + else if(tmp == L"veewipe") return smil_transition_type( veeWipe ); + else if(tmp == L"barnveewipe") return smil_transition_type( barnVeeWipe ); + else if(tmp == L"zigzagwipe") return smil_transition_type( zigZagWipe ); + else if(tmp == L"barnzigzagwipe") return smil_transition_type( barnZigZagWipe ); + else if(tmp == L"iriswipe") return smil_transition_type( irisWipe); + else if(tmp == L"trianglewipe") return smil_transition_type( triangleWipe); + else if(tmp == L"arrowheadwipe") return smil_transition_type( arrowHeadWipe ); + else if(tmp == L"pentagonwipe") return smil_transition_type( pentagonWipe ); + else if(tmp == L"hexagonwipe") return smil_transition_type( hexagonWipe ); + else if(tmp == L"ellipsewipe") return smil_transition_type( ellipseWipe ); + else if(tmp == L"eyewipe") return smil_transition_type( eyeWipe ); + else if(tmp == L"roundrectwipe") return smil_transition_type( roundRectWipe ); + else if(tmp == L"starwipe") return smil_transition_type( starWipe ); + else if(tmp == L"miscshapewipe") return smil_transition_type( miscShapeWipe ); + else if(tmp == L"clockwipe") return smil_transition_type( clockWipe ); + else if(tmp == L"pinwheelwipe") return smil_transition_type( pinWheelWipe ); + else if(tmp == L"singlesweepwipe") return smil_transition_type( singleSweepWipe); + else if(tmp == L"fanwipe") return smil_transition_type( fanWipe ); + else if(tmp == L"doublefanwipe") return smil_transition_type( doubleFanWipe ); + else if(tmp == L"doublesweepwipe") return smil_transition_type( doubleSweepWipe ); + else if(tmp == L"saloondoorwipe") return smil_transition_type( saloonDoorWipe ); + else if(tmp == L"windshieldwipe") return smil_transition_type( windshieldWipe ); + else if(tmp == L"snakewipe") return smil_transition_type( snakeWipe ); + else if(tmp == L"spiralwipe") return smil_transition_type( spiralWipe ); + else if(tmp == L"parallelsnakeswipe")return smil_transition_type( parallelSnakesWipe ); + else if(tmp == L"boxsnakeswipe") return smil_transition_type( boxSnakesWipe ); + else if(tmp == L"waterfallwipe") return smil_transition_type( waterfallWipe ); + else if(tmp == L"pushwipe") return smil_transition_type( pushWipe ); + else if(tmp == L"slidewipe") return smil_transition_type( slideWipe ); + else if(tmp == L"fade") return smil_transition_type( fade ); + else if(tmp == L"checkerboardwipe") return smil_transition_type( checkerBoardWipe); + else if(tmp == L"blindswipe") return smil_transition_type( blindsWipe); + else if(tmp == L"dissolve") return smil_transition_type( dissolve); + else if(tmp == L"randombarwipe") return smil_transition_type( randomBarWipe); + else + { + return smil_transition_type( barWipe ); + } +} + +} } diff --git a/ASCOfficeODFFile/src/odf/smil_transitiontype.h b/ASCOfficeODFFile/src/odf/smil_transitiontype.h new file mode 100644 index 0000000000..8cbffa0f89 --- /dev/null +++ b/ASCOfficeODFFile/src/odf/smil_transitiontype.h @@ -0,0 +1,77 @@ +#pragma once + +#include +#include "odfattributes.h" + +namespace cpdoccore { namespace odf { + +class smil_transition_type +{ +public: + enum type + { + barWipe, + boxWipe, + fourBoxWipe, + barnDoorWipe, + diagonalWipe, + bowTieWipe, + miscDiagonalWipe, + veeWipe, + barnVeeWipe, + zigZagWipe, + barnZigZagWipe, + irisWipe, + triangleWipe, + arrowHeadWipe, + pentagonWipe, + hexagonWipe, + ellipseWipe, + eyeWipe, + roundRectWipe, + starWipe, + miscShapeWipe, + clockWipe, + pinWheelWipe, + singleSweepWipe, + fanWipe, + doubleFanWipe, + doubleSweepWipe, + saloonDoorWipe, + windshieldWipe, + snakeWipe, + spiralWipe, + parallelSnakesWipe, + boxSnakesWipe, + waterfallWipe, + pushWipe, + slideWipe, + fade, + checkerBoardWipe, + blindsWipe, + dissolve, + randomBarWipe + }; + + smil_transition_type() {} + + smil_transition_type(type _Type) : type_(_Type) + {} + + type get_type() const + { + return type_; + }; + + static smil_transition_type parse(const std::wstring & Str); + +private: + type type_; + +}; + std::wostream & operator << (std::wostream & _Wostream, const smil_transition_type & _Val); + + +} + APPLY_PARSE_XML_ATTRIBUTES(odf::smil_transition_type); +} diff --git a/ASCOfficeODFFile/src/odf/style_presentation.cpp b/ASCOfficeODFFile/src/odf/style_presentation.cpp index a176ca2f33..8f21e58df6 100644 --- a/ASCOfficeODFFile/src/odf/style_presentation.cpp +++ b/ASCOfficeODFFile/src/odf/style_presentation.cpp @@ -71,11 +71,16 @@ void style_drawing_page_properties::add_child_element( xml::sax * Reader, const void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) { common_draw_fill_attlist_.add_attributes(Attributes); + anim_transition_filter_attlist_.add_attributes(Attributes); CP_APPLY_ATTR(L"draw:fill-image-height", draw_fill_image_height_); CP_APPLY_ATTR(L"draw:fill-image-width", draw_fill_image_width_); CP_APPLY_ATTR(L"draw:background-size", draw_background_size_); + CP_APPLY_ATTR(L"presentation:transition-type", presentation_transition_type_); + CP_APPLY_ATTR(L"presentation:transition-style", presentation_transition_style_); + CP_APPLY_ATTR(L"presentation:transition-speed", presentation_transition_speed_); + } void drawing_page_properties::apply_from(const drawing_page_properties & Other) { diff --git a/ASCOfficeODFFile/src/odf/style_presentation.h b/ASCOfficeODFFile/src/odf/style_presentation.h index 07997af5e1..f6c198a7c9 100644 --- a/ASCOfficeODFFile/src/odf/style_presentation.h +++ b/ASCOfficeODFFile/src/odf/style_presentation.h @@ -9,6 +9,8 @@ #include "office_elements_create.h" #include "presentationclass.h" +#include "anim_elements.h" + #include "drawfill.h" namespace cpdoccore { @@ -50,15 +52,17 @@ public: void add_attributes( const xml::attributes_wc_ptr & Attributes ); void apply_from(const drawing_page_properties & Other); - common_draw_fill_attlist common_draw_fill_attlist_; + common_draw_fill_attlist common_draw_fill_attlist_; + anim_transition_filter_attlist anim_transition_filter_attlist_; _CP_OPT(length) draw_fill_image_height_; _CP_OPT(length) draw_fill_image_width_; _CP_OPT(std::wstring) draw_background_size_;//"border" or "full" - //_CP_OPT(std::wstring) presentation_transition_type_; - //presentation:transition-style - //presentation:transition-speed + + _CP_OPT(std::wstring)presentation_transition_type_;//manual, automatic, semi-automatic (переход отделен от эффектов кликом) + _CP_OPT(std::wstring)presentation_transition_style_;//none, fade, move, uncover,clockwise, .... игнор если smil + _CP_OPT(std::wstring)presentation_transition_speed_;//slow, medium, fast //presentation:display-footer //presentation:display-page-number