diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-06-27 18:00:27 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-09-13 08:22:55 +0200 |
commit | e6e7b8498aba69af8eee8edd1d3a1fb17c36836a (patch) | |
tree | 0b363a2f5f9fa9f120fff887919ebad5eb6622d4 /sd/source | |
parent | 76c6436faa5e87132cc13be42ac4510baf1c9f8a (diff) |
lok: export transition info to getPresentationInfo JSON structure
Added only basic transitions (type + subtype conversion)
+ added test case
Change-Id: Ibebc34005ee0ffe1fdc2d1587c746538f657fbdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169620
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172869
Tested-by: Jenkins
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index e7b77cf52b97..797ec3495982 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -30,6 +30,8 @@ #include <com/sun/star/document/IndexedPropertyValues.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/util/XTheme.hpp> +#include <com/sun/star/animations/TransitionType.hpp> +#include <com/sun/star/animations/TransitionSubType.hpp> #include <com/sun/star/embed/Aspects.hpp> @@ -141,6 +143,10 @@ #include <svx/ColorSets.hxx> #include <docmodel/theme/Theme.hxx> +#include <frozen/bits/defines.h> +#include <frozen/bits/elsa_std.h> +#include <frozen/unordered_map.h> + #include <app.hrc> using namespace ::cppu; @@ -3021,6 +3027,59 @@ void SdXImpressDocument::initializeDocument() } } +namespace +{ + +constexpr auto constTransitionTypeToString = frozen::make_unordered_map<sal_Int16, std::string_view>({ + { animations::TransitionType::BARWIPE, "BarWipe" }, // Wipe + { animations::TransitionType::PINWHEELWIPE, "PineWheelWipe" }, // Wheel + { animations::TransitionType::SLIDEWIPE, "SlideWipe" }, // Cover, Uncover + { animations::TransitionType::RANDOMBARWIPE, "RandomBarWipe" }, // Bars + { animations::TransitionType::CHECKERBOARDWIPE, "CheckerBoardWipe" }, // Checkers + { animations::TransitionType::FOURBOXWIPE, "FourBoxWipe" }, // Shape + { animations::TransitionType::IRISWIPE, "IrisWipe" }, // Box + { animations::TransitionType::FANWIPE, "FanWipe" }, // Wedge + { animations::TransitionType::BLINDSWIPE, "BlindWipe"}, // Venetian + { animations::TransitionType::FADE, "Fade"}, + { animations::TransitionType::DISSOLVE, "Dissolve"}, + { animations::TransitionType::PUSHWIPE, "PushWipe"}, // Comb + { animations::TransitionType::ELLIPSEWIPE, "EllipseWipe"}, // Shape + { animations::TransitionType::BARNDOORWIPE, "BarnDoorWipe"}, // Split + { animations::TransitionType::WATERFALLWIPE, "WaterfallWipe"}, // Diagonal +}); + +constexpr auto constTransitionSubTypeToString = frozen::make_unordered_map<sal_Int16, std::string_view>({ + { animations::TransitionSubType::LEFTTORIGHT, "LeftToRight" }, + { animations::TransitionSubType::TOPTOBOTTOM, "TopToBottom" }, + { animations::TransitionSubType::EIGHTBLADE, "8Blade" }, + { animations::TransitionSubType::FOURBLADE, "4Blade" }, + { animations::TransitionSubType::THREEBLADE, "3Blade" }, + { animations::TransitionSubType::TWOBLADEVERTICAL, "2BladeVertical" }, + { animations::TransitionSubType::ONEBLADE, "1Blade" }, + { animations::TransitionSubType::FROMTOPLEFT, "FromTopLeft" }, + { animations::TransitionSubType::FROMTOPRIGHT, "FromTopRight"}, + { animations::TransitionSubType::FROMBOTTOMLEFT, "FromBottomLeft"}, + { animations::TransitionSubType::FROMBOTTOMRIGHT, "FromBottomRight"}, + { animations::TransitionSubType::VERTICAL, "Vertical"}, + { animations::TransitionSubType::HORIZONTAL, "Horizontal"}, + { animations::TransitionSubType::DOWN, "Down"}, + { animations::TransitionSubType::ACROSS, "Across"}, + { animations::TransitionSubType::CORNERSOUT, "CornersOut"}, + { animations::TransitionSubType::DIAMOND, "Diamond"}, + { animations::TransitionSubType::CIRCLE, "Circle"}, + { animations::TransitionSubType::RECTANGLE, "Rectangle"}, + { animations::TransitionSubType::CENTERTOP, "CenterTop"}, + { animations::TransitionSubType::CROSSFADE, "CrossFade"}, + { animations::TransitionSubType::FADEOVERCOLOR, "FadeOverColor"}, + { animations::TransitionSubType::FROMLEFT, "FromLeft"}, + { animations::TransitionSubType::FROMRIGHT, "FromRight"}, + { animations::TransitionSubType::FROMTOP, "FromTop"}, + { animations::TransitionSubType::HORIZONTALLEFT, "HorizontalLeft"}, + { animations::TransitionSubType::HORIZONTALRIGHT, "HorizontalRight"}, +}); + +} + OString SdXImpressDocument::getPresentationInfo() const { ::tools::JsonWriter aJsonWriter; @@ -3093,6 +3152,36 @@ OString SdXImpressDocument::getPresentationInfo() const } } } + + sal_Int32 nTransitionType = 0; + xPropSet->getPropertyValue("TransitionType") >>= nTransitionType; + + if (nTransitionType != 0) + { + auto iterator = constTransitionTypeToString.find(nTransitionType); + + if (iterator != constTransitionTypeToString.end()) + { + aJsonWriter.put("transitionType", iterator->second); + + sal_Int32 nTransitionSubtype = 0; + xPropSet->getPropertyValue("TransitionSubtype") >>= nTransitionSubtype; + + auto iteratorSubType = constTransitionSubTypeToString.find(nTransitionSubtype); + if (iteratorSubType != constTransitionSubTypeToString.end()) + { + aJsonWriter.put("transitionSubtype", iteratorSubType->second); + } + else + { + SAL_WARN("sd", "Transition sub-type unknown: " << nTransitionSubtype); + } + + bool nTransitionDirection = false; + xPropSet->getPropertyValue("TransitionDirection") >>= nTransitionDirection; + aJsonWriter.put("transitionDirection", nTransitionDirection); + } + } } } } |