tdf#50998 tdf#87892 Add sinusoid shape

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>
This commit is contained in:
RMZeroFour 2024-03-26 21:41:59 +05:30 committed by Heiko Tietze
parent f1697d2b1e
commit afb18ac062
25 changed files with 103 additions and 5 deletions

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

View file

@ -0,0 +1,3 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
<path d="m3.852 16.293 2.04-.041c.106-.603.43-2.262.699-3.392.44-1.857 1.12-4.083 1.887-5.394.383-.656.78-1.039 1.023-1.143.243-.105.398-.137.865.268.934.81 2.518 3.735 4.231 9.77 1.762 6.203 3.31 9.425 5.113 10.895.902.735 1.98.925 2.879.572.898-.353 1.567-1.096 2.139-1.965 1.145-1.738 1.947-4.105 2.501-6.073.463-1.643.69-2.806.771-3.215h-2.076c-.128.604-.31 1.437-.614 2.519-.522 1.854-1.318 4.074-2.187 5.394-.434.66-.878 1.054-1.195 1.179-.317.124-.55.143-1.054-.268-1.01-.823-2.646-3.725-4.357-9.753-1.76-6.196-3.23-9.394-4.94-10.877a3.102 3.102 0 0 0-1.384-.715 2.314 2.314 0 0 0-1.4.125c-.866.374-1.472 1.146-1.982 2.019-1.02 1.746-1.69 4.107-2.155 6.073-.082.344-.153.65-.22.964z" style="fill:#fff;fill-opacity:0;stroke:#fff;stroke-width:1;stroke-dasharray:none;stroke-opacity:1" fill="none"/>
</svg>

After

Width:  |  Height:  |  Size: 879 B

View file

@ -0,0 +1,3 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
<path d="m3.852 16.293 2.04-.041c.106-.603.43-2.262.699-3.392.44-1.857 1.12-4.083 1.887-5.394.383-.656.78-1.039 1.023-1.143.243-.105.398-.137.865.268.934.81 2.518 3.735 4.231 9.77 1.762 6.203 3.31 9.425 5.113 10.895.902.735 1.98.925 2.879.572.898-.353 1.567-1.096 2.139-1.965 1.145-1.738 1.947-4.105 2.501-6.073.463-1.643.69-2.806.771-3.215h-2.076c-.128.604-.31 1.437-.614 2.519-.522 1.854-1.318 4.074-2.187 5.394-.434.66-.878 1.054-1.195 1.179-.317.124-.55.143-1.054-.268-1.01-.823-2.646-3.725-4.357-9.753-1.76-6.196-3.23-9.394-4.94-10.877a3.102 3.102 0 0 0-1.384-.715 2.314 2.314 0 0 0-1.4.125c-.866.374-1.472 1.146-1.982 2.019-1.02 1.746-1.69 4.107-2.155 6.073-.082.344-.153.65-.22.964z" style="fill:#fff;fill-opacity:1;stroke:#393937;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"/>
</svg>

After

Width:  |  Height:  |  Size: 870 B

View file

@ -478,6 +478,7 @@ enum MSO_SPT: sal_Int32 {
mso_sptTextBox = 202,
//for pptx shape which doesn't exist in ppt
mso_sptTearDrop = 203,
mso_sptSinusoid = 204,
mso_sptMax = 0x0FFF,
mso_sptNil = mso_sptMax
};

View file

@ -391,6 +391,14 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
<value>1</value>
</prop>
</node>
<node oor:name=".uno:BasicShapes.sinusoid" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Sinusoid</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
<node oor:name=".uno:BasicShapes.can" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Cylinder</value>

View file

@ -621,12 +621,13 @@ constexpr frozen::set<std::u16string_view, 57> constDenySet(
u"flowchart-display"
});
constexpr frozen::set<std::u16string_view, 4> constAllowSet(
constexpr frozen::set<std::u16string_view, 5> constAllowSet(
{
u"heart",
u"puzzle",
u"col-60da8460",
u"col-502ad400"
u"col-502ad400",
u"sinusoid"
});
} // end anonymous namespace

View file

@ -43,4 +43,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cube"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.paper"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -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;

View file

@ -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;

View file

@ -87,7 +87,8 @@ SvxShapeCommandsMap::SvxShapeCommandsMap()
{20, ".uno:BasicShapes.cube"},
{21, ".uno:BasicShapes.paper"},
{22, ".uno:BasicShapes.frame"},
{23, ".uno:BasicShapes.ring"}
{23, ".uno:BasicShapes.ring"},
{24, ".uno:SymbolShapes.sinusoid"}
};
mpSymbolShapes = decltype(mpSymbolShapes){

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -43,4 +43,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cube"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.paper"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>

View file

@ -45,4 +45,6 @@
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.cross"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.frame"/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.ring"/>
<toolbar:toolbarbreak/>
<toolbar:toolbaritem xlink:href=".uno:BasicShapes.sinusoid"/>
</toolbar:toolbar>