Merge remote-tracking branch 'origin/fix/bug65366' into release/v8.0.0

This commit is contained in:
Elena.Subbotina
2023-12-21 17:37:33 +03:00
6 changed files with 253 additions and 19 deletions

View File

@ -1847,6 +1847,99 @@ void PptxConverter::convert(PPTX::Logic::ZoomTransition *oox_transition)
odp_context->current_slide().set_transition_type(11);
}
struct preset_subtype_maping
{
int OOX_PresetSubtype;
std::wstring ODF_PresetSubtype;
};
static const preset_subtype_maping s_preset_subtype_maping[] =
{
{ 1, L"from-top" },
{ 2, L"from-right" },
{ 3, L"from-top-right" },
{ 4, L"from-bottom" },
{ 5, L"horizontal" },
{ 6, L"from-bottom-right" },
{ 8, L"from-left" },
{ 9, L"from-top-left" },
{ 10, L"vertical" },
{ 12, L"from-bottom-left" },
{ 16, L"in" },
{ 21, L"vertical-in" },
{ 26, L"horizontal-in" },
{ 32, L"out" },
{ 36, L"out-from-screen-center" },
{ 37, L"vertical-out" },
{ 42, L"horizontal-out" },
{ 272, L"in-slightly" },
{ 288, L"out-slightly" },
{ 528, L"in-from-screen-center" },
{ 0, L"" }
};
static std::wstring convert_subtype(PPTX::Limit::TLPresetClass preset_class_, int preset_id_, int preset_subtype_)
{
std::wstring subtype;
const unsigned char entrance_bytecode = 1;
const unsigned char exit_bytecode = 2;
if ((preset_class_.GetBYTECode() == entrance_bytecode) || (preset_class_.GetBYTECode() == exit_bytecode))
{
// skip wheel effect
if (preset_id_ != 21)
{
if (preset_id_ == 5)
{
// checkerboard
switch (preset_subtype_)
{
case 5: subtype = L"downward"; break;
case 10: subtype = L"across"; break;
}
}
else if (preset_id_ == 17)
{
// stretch
if (preset_subtype_ == 10)
subtype = L"across";
}
else if (preset_id_ == 18)
{
// strips
switch (preset_subtype_)
{
case 3: subtype = L"right-to-top"; break;
case 6: subtype = L"right-to-bottom"; break;
case 9: subtype = L"left-to-top"; break;
case 12: subtype = L"left-to-bottom"; break;
}
}
if (subtype.empty())
{
const preset_subtype_maping* p = s_preset_subtype_maping;
while (p->OOX_PresetSubtype != 0)
{
if (p->OOX_PresetSubtype == preset_subtype_)
{
subtype = p->ODF_PresetSubtype;
break;
}
p++;
}
}
}
}
if (subtype.empty() && preset_subtype_ != 0)
return std::to_wstring(preset_subtype_);
return subtype;
}
void PptxConverter::convert(PPTX::Logic::CTn *oox_time_common)
{
if (!oox_time_common) return;
@ -1881,10 +1974,23 @@ void PptxConverter::convert(PPTX::Logic::CTn *oox_time_common)
if (oox_time_common->presetClass.IsInit())
{
convert(*oox_time_common->presetClass);
if(oox_time_common->presetID.IsInit())
if (oox_time_common->presetID.IsInit())
{
convert(*oox_time_common->presetClass, *oox_time_common->presetID);
if (oox_time_common->presetSubtype.IsInit())
{
const std::wstring odf_subtype = convert_subtype(
*oox_time_common->presetClass,
*oox_time_common->presetID,
*oox_time_common->presetSubtype);
if(!odf_subtype.empty())
odp_context->current_slide().set_anim_subtype(odf_subtype);
}
}
}
//nullable<CondLst> stCondLst;
//nullable<CondLst> endCondLst;

View File

@ -290,6 +290,18 @@ void odp_page_state::set_anim_auto_reverse(bool val)
anim_levels.back().attlist->smil_auto_reverse_ = val;
}
void odp_page_state::set_anim_subtype(const std::wstring& val)
{
if (anim_levels.empty()) return;
if (!anim_levels.back().attlist)return;
anim_par* animate = dynamic_cast<anim_par*>(anim_levels.back().elm.get());
if (!animate)
return;
anim_levels.back().par_attlist->presentation_preset_sub_type_ = val;
}
void odp_page_state::set_anim_animation_formula(const std::wstring& val)
{
if (anim_levels.empty()) return;

View File

@ -146,6 +146,7 @@ public:
void set_anim_to (const std::wstring& val);
void set_anim_target_element(const std::wstring& val);
void set_anim_auto_reverse (bool val);
void set_anim_subtype (const std::wstring& val);
void set_anim_animation_formula(const std::wstring& val);
void set_anim_animation_keytimes(const odf_types::smil_key_times& val);