summaryrefslogtreecommitdiff
path: root/starmath
AgeCommit message (Collapse)Author
2022-06-09Accessibility for IconViewMike Kaganski
Change-Id: I65ca9d43f70a50e2e95aabfc3b8ba1b15f9ff8be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135226 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-09loplugin:unusedmethodsNoel Grandin
Change-Id: Ib89ab59f7ad7e90b2a44ddd122176cde904fba4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135520 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-08gtk: let math GtkIconViews flow to fill available space with iconsCaolán McNamara
Change-Id: I25f3433e9404ac1938568607a9a52a50ca8a7892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135513 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-06-07Fix ImageView without text on GTKMike Kaganski
Change-Id: I2c1884722de2d40e96282d1efbba4be0ad078bd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135465 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-02Fix typoAndrea Gelmini
Change-Id: Ie7d5a2b2a6fceb09ffcb6b24a462dd6911886a1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135307 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-06-02Use IconView in SmElementsControlMike Kaganski
Allows to send individual images over the wire in lok case, instead of sending full canvas at every scroll operation. The control's horizontal and vertical modes (when it's docked to a vertical or a horizontal parent window side) are now identical. Some TODOs: * Re-implement a11y - that needs to be implemented on IconView level; * Make sure that sub-pixel positioning is not used when creating the elements icons (makes elements look a bit slim on Windows); * Maybe restore mouse hover indication; in non-GTK case, a call to m_xIconView->SetHoverSelection would suffice in SalInstanceIconView. Change-Id: Idbc35f4e38e2b49fd0848a96da557fa2c1a1f6e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134761 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-01Fix domainMike Kaganski
Change-Id: I0391fb3d4b913967ed4f8459d6b30f7f39bf4b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135055 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-30fix another domainXisco Fauli
Change-Id: I3a0c5aab62a7b6723df5820abb3f56e3f110d8b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135113 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-05-26ofz#47639 avoid Integer-overflowCaolán McNamara
Change-Id: I3f89238187dfb8cfd7a929d5f5576b83f6ec37c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134982 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-25std::set->o3tl::sorted_vector in MathTypeFontSetNoel Grandin
Change-Id: I8b664f10bee232355eeb431de6b1445d9c797f6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134921 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-24modernize and improve PropertySetInfoNoel Grandin
(*) use o3tl::span for the array param, which means we don't need a null entry to terminate the array (*) use std::unordered_map to speed things up (*) mark the array as static at a few more call sites Change-Id: I05b6cae7552f44459e183ec05cb94e60edb3bfe0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134832 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-23elide some OUString allocationNoel Grandin
Change-Id: I5f0b9057b86ec98b66b4ce2d6c681b8cb93d49e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134802 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-23starmath: fix real use-after-free detected by GCC 12Michael Stahl
In file included from starmath/inc/mathml/iterator.hxx:12, from starmath/source/mathml/iterator.cxx:10: In member function ‘SmMlElement* SmMlElement::getParentElement()’, inlined from ‘void mathml::SmMlIteratorBottomToTop(SmMlElement*, runType, void*) [with runType = void (*)(SmMlElement*, void*)]’ at starmath/inc/mathml/iterator.hxx:43:39, inlined from ‘void mathml::SmMlIteratorFree(SmMlElement*)’ at starmath/source/mathml/iterator.cxx:57:28: starmath/inc/mathml/element.hxx:263:46: error: pointer ‘pCurrent’ used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free] 263 | SmMlElement* getParentElement() { return m_aParentElement; }; | ^~~~~~~~~~~~~~~~ In function ‘void mathml::deleteElement(SmMlElement*, void*)’, inlined from ‘void mathml::deleteElement(SmMlElement*, void*)’ at starmath/source/mathml/iterator.cxx:19:20, inlined from ‘void mathml::SmMlIteratorBottomToTop(SmMlElement*, runType, void*) [with runType = void (*)(SmMlElement*, void*)]’ at starmath/inc/mathml/iterator.hxx:65:21, inlined from ‘void mathml::SmMlIteratorFree(SmMlElement*)’ at starmath/source/mathml/iterator.cxx:57:28: starmath/source/mathml/iterator.cxx:19:77: note: call to ‘void operator delete(void*, std::size_t)’ here 19 | static inline void deleteElement(SmMlElement* aSmMlElement, void*) { delete aSmMlElement; } | ^~~~~~~~~~~~ Change-Id: I09acfe3f7e90bd7f919cfba161f72bdd7a8da70a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134742 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-05-21elide OUString allocationNoel Grandin
Change-Id: I45cc3b8df0c29237b69cab87f0fbb6853776394f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134701 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-20new loplugin:unnecessary lockingNoel Grandin
off by default, since each warning needs careful inspection Change-Id: I805c1d1cdde531a1afdc76e87b22f879fc3c9753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134641 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-19Simplify SmElementsControlMike Kaganski
Change-Id: Idcb075a474b440447b8566cc92a8f65bbc77127c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134643 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-19the size table in MathType can be compile-time dataNoel Grandin
Change-Id: Ie0769509e38d3414bf227d8d2b7248461bc41aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134598 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-18GtkCellRendererText 'text" attrib is the index of the text into the modelCaolán McNamara
and we need a trailing "id" column for [s|g]et_id which is assumed to exist Change-Id: Icb32e78ac76443cc15ca70f2e9248b92791b7890 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134494 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-17Simplify the UIMike Kaganski
Remove the intermediary containers, keeping those that are really needed to create the necessary structure. I'm curious, how much CPU could be wasted by the unused container layers when calculating the layout. Change-Id: I56bf13c52b4e14dcef6595d00223cd36f48793d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134463 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-17Use structured binding to clarify the codeMike Kaganski
Change-Id: I6b1c0532a64a18d961b7ab112675213eea2fd121 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134438 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-17use reserve before filling some vectorsNoel Grandin
Change-Id: Ib2ae513de46b2a0c16101747540ba09a7cdfb018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134481 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-17tdf#65067 Remove excessive spacing from Formula objectsRafael Lima
As described in bugs tdf#65067, tdf#103816, tdf#149052 and a few other duplicates, Formula objects in Writer receive 2 unnecessary spacings: 1) From the "Formula" frame style, which has a Left/Right internal spacing of 0.2cm 2) From the Math formula editor itself, that adds an additional 1pt of internal spacing (left/right) In MS Word the default behavior is setting all of these spaces to zero, which makes the formula flow better alongside text in paragraphs. Therefore, this patch set both of these spaces to Zero so that Formula objects in Writer behave similarly as Formulas in MS Word. Change-Id: Iedcef7124afed6b799f85bcefe37016c8fd972e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134185 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-16use explicit translatable="no" like we typically do in this caseCaolán McNamara
Change-Id: I6dfcca43fbeace4a75878f0eebe57289b221c4fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134388 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-14elid some OUString construction in SmXMLExportWrapper::ExportNoel Grandin
Change-Id: Icc091a7fab3c9ce368bd45536de1e75d29431c56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134314 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13use vector as backing for stackNoel Grandin
which is a little faster Change-Id: Id086b67eba3ec00dc86a48a0fdec1a467b600d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134268 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13tdf#121740 reduce cost of mathml parsingNoel Grandin
by re-using OUString instances instead of allocating new ones for each SmToken Change-Id: Ia897427d6c1ffeb0e741dea90fde1f4d56a70175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134264 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11cache the PropertySetInfo in lcl_createModelPropertyInfoNoel Grandin
we only need one of them Change-Id: I2f6f2c75da96f76d4bf9cb31ef31bf597a3f5e6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134159 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11reserve vector space in SmSymbolManager::GetSymbolsNoel Grandin
Change-Id: I9101e07fa54e35f1cec9797deaf1647763c9ebfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134158 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-06tdf#148962 starmath's UnicodeNotationToggle (alt+x) getting called twiceCaolán McNamara
Change-Id: Ib150e4825c547c19a30c7b66d3f33904b814a917 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133942 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-05loplugin:unusedvariableplusNoel Grandin
Change-Id: Id93086be1224b6f6bf0bdaa1d50b4f289099027e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133876 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04Just use Any ctor instead of makeAny in starmathStephan Bergmann
Change-Id: I8264c2330837fbd46ea372a8e370bb43ca1fb7b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133775 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03add o3tl::equalsAsciiNoel Grandin
Change-Id: I042b8dcadbf7581de325c161763fe35aecde5ca2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133694 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-01ofz#47162 Integer-overflowCaolán McNamara
Change-Id: I4d910a1844100415f95c89bda83843ddffdc3df0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133663 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-01use more string_view in variousNoel Grandin
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-30split comphelper::string::strip functions into String and view versionNoel Grandin
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-27tdf#148819: let the scroller know the custom widget's line sizeMike Kaganski
Change-Id: Ie30cd1db182aad5fbbf7e89498bd0ae9ce98c0f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133518 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-27Clean up includesMike Kaganski
Change-Id: Ied9a75953875e809e4284fdff03aab6add6800ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133511 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-27tdf#125931: add Properties panel to Math's Properties deckMike Kaganski
For now, it only contains buttons opening the dialogs accessible from Format menu. This is enough for the initial implementation, and should later be changed to individual controls allowing to set the formula properties directly. Change-Id: Ia0e52915198ddb2648d13d577d55b367f178b1ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133508 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-26tdf#125931: Add Elements deck and Elements panel to Math's sidebarMike Kaganski
Change-Id: Ie04a5dc48de38f318f0ddb42efc42cea022dc62c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133393 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-26tdf#125931: Enable sidebar in MathMike Kaganski
No panels yet, only one default deck (PropertyDeck). It is needed to have the uniform default deck like in all other modules (see commit c09f59eb6173a4a53a2d40ed80aebed18e3882ac); the panels for formula properties might appear later. Change-Id: If1785dc780111fe496638418f43e7b90a250ffce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133334 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-10loplugin:stringview check for getToken and trimNoel Grandin
since we now have o3tl versions of those that work on string_view. Also improve those o3tl functions to support both string_view and u16string_view Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-02loplugin:stringviewparam convert methods using indexOfNoel Grandin
.. and lastIndexOf, which convert to find and rfind Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-24loplugin:constantparamNoel Grandin
Change-Id: I86592be0717c062a918108bf4437074b0f70b372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132029 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-14new loplugin:trivialconstructorNoel Grandin
Change-Id: Iaaf63c49ce94987ab9c4ebc68e963cc3054a3c34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131342 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-12Related: tdf#128610 drop obsolete encoding attribute replacementMike Kaganski
It was needed once, when we used expat; now libxml2 does its own detection (in its xmlDetectCharEncoding) after the strange dance in our XMLFile2UTFConverter::readAndConvert (which does nothing useful for UTF-16 case). The original problem in tdf#128610 was addressed in commit c964700d16d99d1569373a1eb9a1352fb3512915. This one just drops the obsolete replacement. Change-Id: I2e6b28212619dd0f6cb90ae8234277092a37e7a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131409 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-11Related: tdf#128610 Avoid use-after-freeMike Kaganski
Creating SvMemoryStream from string makes it non-owning, i.e. pointing to the string's memory. So the string must outlive the stream. Since commit 64bc8b45b5c23efc5fe57585a69aa4263aaf4e83 Date Wed Jul 08 12:31:43 2015 +0000 i#107734 Support for Math Input Panel in Windows 7 Was only working by chance, when destructor didn't clean the memory (e.g., in optimized release builds) and the released memory hasn't been reused yet. Change-Id: I2e0c195de7bd2aff2889a94ef0f2eb084411933f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131373 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-10tdf#137008: starmath_import: Add unittestXisco Fauli
Change-Id: I4daadf45124331a2fb3b2ba28858c2cfe7c6950e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131312 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-03-06Fix tdf#147755 by copying the vector.Arnaud VERSINI
Revert partially 224953d896a3dba5d85992394525ab8b54d8c314 Change-Id: Ic12d3b0a080ad3af69fa5c4e8c9b4d331305a663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131066 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-01use SfxItemSet::GetItemIfSet in starmathNoel Grandin
Change-Id: Iaef2a2c507acfdabc6280e6cc8179319ea9d8a94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130735 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>