diff options
author | RMZeroFour <ritobroto04@gmail.com> | 2024-03-26 21:41:59 +0530 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-04-08 09:54:55 +0200 |
commit | afb18ac0628c54fdffc1ee5b55db6110c20872cd (patch) | |
tree | e7a54d2f03e2c7a088cf6f4f92f1a1034b6f388f /svx/source/customshapes | |
parent | f1697d2b1e6b3ac63946070cc720234dc68efbe9 (diff) |
In response to #50998 (as well as #87892 indirectly),
regarding adding sinusoidal and coil-like shapes to the
shape gallery in LibreOffice, this commit adds a sinusoid
shape to the gallery.
The shape is still incomplete for release, at least lacking
icons for the sidebar. Further details posted on the Bugzilla
thread for issue #50998.
PS-2: Removed the previously added flag shape.
PS-4: Moved sinusoid to the end in a new subgroup.
Change-Id: Ie0f6e3948b6dce98dc2b4f87289cfd37f2d16911
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165353
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 57 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx | 6 |
2 files changed, 61 insertions, 2 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 7db0ff931ac4..026eac620416 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -8352,6 +8352,62 @@ const mso_CustomShape msoTearDrop = std::span<const SvxMSDffHandle>(mso_sptTearDropHandle), }; +///////////////////////////// sinusoid +const SvxMSDffVertPair mso_sptSinusoidVert[] = +{ + // calculations courtesy of section 6.3.2 of + // https://documentation.libreoffice.org/assets/Uploads/Documentation/en/Tutorials/CustomShapes7/Custom-Shape-Tutorial.pdf#page=52 + + // taking K = (3pi/2 - 3pi^2/8 - 1/2) + // transforming points to viewbox of size 21600 x 21600 + + // Start point + { 0, 10800 }, // (0, 0) + // First Bezier + { 1757, 5278 }, // (K, K) + { 3437, 0 }, // (1, 1) + { 5400, 0 }, // (pi/2, 1) + // Second Bezier + { 7362, 0 }, // (pi - 1, 1) + { 9042, 5278 }, // (pi - K, K) + { 10800, 10800 }, // (pi, 0) + // Third Bezier + { 12557, 16321 }, // (pi + K, -K) + { 14237, 21600 }, // (pi + 1, -1) + { 16200, 21600 }, // (3pi/2, -1) + // Fourth Bezier + { 18162, 21600 }, // (2pi - 1, -1) + { 19842, 16321 }, // (2pi - K, -K) + { 21600, 10800 } // (2pi, 0) +}; + +const sal_uInt16 mso_sptSinusoidSegm[] = +{ + 0x4000, 0x2004, 0x8000 +}; + +const SvxMSDffVertPair mso_sptSinusoidGluePoints[] = +{ + { 0, 10800 }, // x = 0.00 + { 5400, 0 }, // x = 0.25 + { 10800, 10800 }, // x = 0.50 + { 16200, 21600 }, // x = 0.75 + { 21600, 10800 } // x = 1.00 +}; + +const mso_CustomShape msoSinusoid = +{ + std::span<const SvxMSDffVertPair>(mso_sptSinusoidVert), // vertices + const_cast<sal_uInt16*>(mso_sptSinusoidSegm), sizeof(mso_sptSinusoidSegm) >> 1, // segments, count + std::span<const SvxMSDffCalculationData>(), // calculations (none) + nullptr, // default values (none) + std::span<const SvxMSDffTextRectangles>(), // text area (default) + 21600, 21600, // viewbox w, h (default) + MIN_INT32, MIN_INT32, // stretch x, y (unset) + std::span<const SvxMSDffVertPair>(mso_sptSinusoidGluePoints), // glue points + std::span<const SvxMSDffHandle>(), // handles (none) +}; + const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType ) { @@ -8481,6 +8537,7 @@ const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType ) case mso_sptCloudCallout : pCustomShape = &msoCloudCallout; break; case mso_sptWave : pCustomShape = &msoWave; break; case mso_sptDoubleWave : pCustomShape = &msoDoubleWave; break; + case mso_sptSinusoid : pCustomShape = &msoSinusoid; break; // callout case mso_sptCallout1 : pCustomShape = &msoCallout1; break; diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 472e5f265753..cafea3164a16 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -236,7 +236,8 @@ const NameTypeTable pNameTypeTableArray[] = { "mso-spt201", mso_sptHostControl }, { "mso-spt202", mso_sptTextBox }, { "teardrop", mso_sptTearDrop }, - { "ooxml-rect", mso_sptRectangle } + { "ooxml-rect", mso_sptRectangle }, + { "sinusoid", mso_sptSinusoid } }; // gallery: quadrat @@ -518,7 +519,8 @@ const ACCNameTypeTable pACCNameTypeTableArray[] = { "mso-spt202", mso_sptTextBox },*/ { "frame", "Frame" }, { "col-60da8460", "Octagon Bevel" }, - { "col-502ad400", "Diamond Bevel" } + { "col-502ad400", "Diamond Bevel" }, + { "sinusoid", "Sinusoid" } }; typedef std::unordered_map<OUString, OUString> TypeACCNameHashMap; |