summaryrefslogtreecommitdiff
path: root/starmath/source/view.cxx
AgeCommit message (Collapse)Author
2023-09-12starmath: Keep focus on math widget when inline editing is enabledKhaled Hosny
Since originally all editing happened in the edit window, it was made to grab focus instead of the math widget, but we don’t want that anymore when inline editing is enable as we want to edit everything in the math widget. This also removes ancient test that is now failing. We will eventually drop the edit window altogether. Change-Id: Ia1628a454bbbdd923ff582564eca1ab4ec830f38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156579 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-08tdf#88744: Use real clipboard when inline editing is enabledKhaled Hosny
Instead of using a fake clipboard that works only inside the same formula. Change-Id: Ia1e97028e1aafa15912bc9b4397d66afb0d23ec7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156671 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-07starmath: Properly update the state to copy/cut/paste buttonsKhaled Hosny
Invalidate the slots explicitly instead of implicitly by updating the edit window. Followup to: commit 065609f86f730d4eedc6b7ae28382dc7daea11ac Author: Khaled Hosny <khaled@libreoffice.org> Date: Mon Sep 4 13:22:04 2023 +0300 starmath: Make cut/copy/paste buttons work with inline editing Change-Id: If0648c249d6145475202e1a48364d7fe142a5e35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156674 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-05starmath: Always insert using SmCursor when inline editing is enabledKhaled Hosny
Choosing which code path based on which widget has focus is not a very good idea, and leads to unreliable UI tests as each code path inserts the text slightly differently (one code path inserts plain text then parses the whole equation again, while the other parses the new text then inserts the parsed node directly). Change-Id: Ib2ca942c537e466f6ff100be7f95adaead99f1d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156578 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-04starmath: Make cut/copy/paste buttons work with inline editingKhaled Hosny
Check for visual cursor selection when in inline editing mode, and update edit window when updating visual cursor. Change-Id: Id1a259b67db47eea0b36b55d08ef5dc5f8aa8246 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156513 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-04tdf#134193: Fix RTL selection and cursor handlingKhaled Hosny
Change-Id: Ib9d7dd56d884aaca9b88a8b9403aeef30a9917d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156167 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-04tdf#134193: Allow setting math directionKhaled Hosny
Add LTR/RTL buttons to the toolbar and make them change the IsRightToLeft property. Change-Id: I8ae793a9899c50b6dfaf3563a7c22c1f1eab8c8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155739 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-04Math: enable in-place editing on desktopKhaled Hosny
Move the code outside the else block as it doesn’t get hit for me on desktop otherwise, and use SmViewShell::IsInlineEditEnabled() instead of comphelper::LibreOfficeKit::isActive() (which is included in the former). Followup to: commit 737a270c61cd2038ede7911b7d7b4afcf020f53c Date: Mon Jan 17 17:15:46 2022 +0300 lok: enable in-place editing of math equations Change-Id: Ie604f152344b83479eaf6024b6d58e374abb39b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156331 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-03starmath: Disable formula cursor toolbar button when inline editing is enabledKhaled Hosny
It is ignore when inline editing is enable, so better disable it to make it clear. Change-Id: Ie79a1c16109109e213658d44a6ffc0bff2291c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156487 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-09-03starmath: Graduate inline (visual) editing from experimental featuresKhaled Hosny
It has been experimental for as long as LibreOffice existed, lets make it non-experimental but add an option to disable it. If it turns to be a disaster, we can flip the option and disable it by default. Change-Id: I63672c054d1ead269863079e7f9c118a44b3ba19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156486 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
2023-08-18ITEM: preparations for more/easier changesArmin Le Grand (allotropia)
This change is not about speed improvements but diverse preparations to make changes/reading/understanding easier. It does not change speed AFAIK. Added a global static debug-only counter to allow getting an overview over number of all allocated SfxPoolItem's and the still alloated ones at office shutdown. The values are used in Application::~Application to make a short info statement. It allows to be able to quickly detect if an error in future changes may lead to memory losses - these would show in dramaitically higher numbers then (hopefully) immediately. Moved SfxVoidItem to own source/header. Added container library interface support to SfxItemSet, adapted already some methods to use it - not all possible, I will commit & get status from gerrit 1st if all still works and then continue. Changed INVALID_POOL_ITEM from -1 to use a global unique incarnation of an isolated derivation from SfxPoolItem. It allows to avoid the (-1) pointer hack. Since still just pointers are compared it's not worse. NOTE: That way, more 'special' SfxPoolItem's may be used for more States - a candidate is e.g. SfxVoidItem(0) which represents ::DISABLED state -- unfortunately not only, it is also used (mainly for UI stuff) with 'real' WhichIDs - hard to sort out, will have to stay that way for now AFAIK. Changed INVALID_POOL_ITEM stuff to use a static extern incarnated item in combination with a inline method to return it, called GetGlobalStaticInvalidItemInstance(). Isolated create/cleanup of a SfxPoolItem entry in SfxItemSet to further modularize/simplify that. It is currently from constructor & destructor but already shows that PoolDefaults are handled differently - probably an error. Still, for now, do no change in behaviour (yet). Got regular 'killed by the Kill-Wrapper' messages from gerrit, seems to have to do with UITest_sw_findReplace. That python/c++ scripting stuff is hard to debug, but finally I identified the problem has to do with the INVALID_POOL_ITEM change. It was in SfxItemSet::InvalidateAllItems() where still a (-1) was used -> chaos in detecting invalid items. Change-Id: I595e1f25ab660c35c4f2d19c233d1dfadfe25214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155675 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-07-27Fix typoAndrea Gelmini
Change-Id: I09fc9db6621a1e074a76e38d1d98a666ab2159f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154983 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-07-26tdf#149888 Make F1 work in Math initial stateRafael Lima
Currently, when Math is opened and F1 is pressed in its initial state, no help page is opened. This is caused by the GrabFocus call in InitialFocusTimerHdl (see comments in its implementation). This patch ensures that pressing F1 both in the Edit and Graphics windows will open the main help page of the Math module. NOTE: This patch will only work after the related patch in helpcontent2 gets accepted, since it is responsible for creating the HID target in the XHP file. Change-Id: I59980cea1816a863e1aaa2d0757d9b141437ead5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154691 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
2023-07-06starmath: check GetEditWindow()Xisco Fauli
it might return nullptr See https://crashreport.libreoffice.org/stats/signature/SmPrintOptionsTabPage::~SmPrintOptionsTabPage() Change-Id: I4b34b0da3dc282ae89fd58defa12045c34a12cfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154026 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2023-07-06lok: Register sidebar for frame explicitlyMike Kaganski
For some reason, it is needed in 22.05 (unlike master). Without this, sidebar sometimes isn't shown in inline edit mode. Change-Id: Ie225ff0676786e9164e8640c6e159efb8aebf241 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140640 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154022 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> (cherry picked from commit 8a1f78dab16e3b27752b76e9013ec2249c894dbc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154113 Tested-by: Jenkins
2023-05-25use more TypedWhichIdNoel Grandin
Change-Id: I6c54c1276b36cbc71417486ffcee2ef9ef0cff7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-10Use more *string_viewMike Kaganski
Change-Id: I1172febd45da4dba006f8495427fe45c6d9b9fa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150187 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-09new loplugin:unnecessarygetstrNoel Grandin
which prevents constructing unnecessary temporaries via getStr() Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-17SfxViewFrame* arg of SfxRequest ctor always dereferencedCaolán McNamara
change it to take a reference Change-Id: Ib9349f4c2660d297d93ee81256e7fa9873728ba3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147163 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-16SfxViewShell::GetViewFrame never returns null, change to a referenceCaolán McNamara
various null checks can be seen to be redundant and removed Change-Id: Icf49c1de4b0302795d2769a370af3abceaad0221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147147 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-16SfxViewShell never takes a null SfxViewFrame*Caolán McNamara
Change-Id: I36f3a5c77a7fb2d3cf267184e403e6cd24dbd70b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147112 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-23use more concrete SmModel typeNoel Grandin
Change-Id: I7804e7201e64f419383e37b916b212ac9c129ef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145984 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-13XUnoTunnel->dynamic_cast in TransferableHelperNoel Grandin
which leads us to find that we can skip all the dynamic_cast'ing altogether in SwView_Impl Change-Id: I8914f78df6bfdd743df370c0017d5b8521863594 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145483 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-14starmath: React to touchpad zoom gestures in SmGraphicWidgetPovilas Kanapickas
Change-Id: Id158d7778ec0c375c143cf9ce492af21b9625c9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143759 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-11-23lok: take borders into account in in-place Math cursor/selectionMike Kaganski
The offset is defined by formula's top/left borders (in UI under Format->Spacing). Change-Id: Ic17356f8c6e4db3cbe0df765d133ee240f5b088d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143136 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-07Use o3tl::convert instead of temporary FractionsMike Kaganski
Change-Id: I7e1f68e579e6520d17e0a058e6e0a8056e082c2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142360 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-05lok: show Math selectionMike Kaganski
Change-Id: I950ae3e5fb000d6acec4c26ff143b918a4e48a27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142342 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-05lok: show Math cursorMike Kaganski
Change-Id: I17a449f0a0662f0433de9cad1522a090434c1e30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142178 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-04lok: use twips in MathMike Kaganski
Change-Id: I11acd281da64b0023d74b3bc02e0f54864b94da9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142275 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-02Simplify LokStarMathHelperMike Kaganski
SfxInPlaceClient seems to have everything needed to check the OLE bounds; OTOH, the embedded Math windows/widgets lack that info. Set SmGraphicWidget MapMode to pixels when lok is active, as other windows do. Change-Id: Ib9b76a51a2d9253c20b782e8c53fbfa5dc776eca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142130 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-15Conditional jump or move depends on uninitialised valueCaolán McNamara
==1533286== Conditional jump or move depends on uninitialised value(s) ==1533286== at 0x12DEC3C9: param_double_validate (gparamspecs.c:592) ==1533286== by 0x12DEF924: g_param_value_validate (gparam.c:700) ==1533286== by 0x12DEFA9A: object_set_property (gobject.c:1594) ==1533286== by 0x12DF1F96: g_object_set_valist (gobject.c:2538) ==1533286== by 0x12DF2253: g_object_set (gobject.c:2705) ==1533286== by 0x241E8C44: gtk_adjustment_configure (gtkadjustment.c:833) ==1533286== by 0x23B6310A: (anonymous namespace)::GtkInstanceScrolledWindow::vadjustment_configure(int, int, int, int, int, int) (gtkinst.cxx:8207) ==1533286== by 0x23B63D3D: virtual thunk to (anonymous namespace)::GtkInstanceScrolledWindow::vadjustment_configure(int, int, int, int, int, int) (gtkinst.cxx:0) ==1533286== by 0x36424112: SmGraphicWindow::Resize() (view.cxx:227) Change-Id: Ib81e26b1042e7a5eebd0a2b561f57f7b4eb25dd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140002 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-26tdf#150489: Drop Elements docking windowMike Kaganski
and make uno:ElementsDockingWindow open the respective sidebar panel. Change-Id: I9736d6804c579b83404636d5e327c49c2fdeb914 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138458 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-17Return std::optional instead of using bool* argumentMike Kaganski
Change-Id: I47f03411a6677f22291bea4dc06920ab9052349a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138399 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-17lok: register view callback also for nested sm viewMike Kaganski
This allows to send context change events that originate in the embedded views. Change-Id: I574ca347a2ffa67f9645a2ee790e42088ad8721f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138303 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-15Resolves: tdf#149858 embedded starmath not using correct initial zoomCaolán McNamara
since... commit ea21b870f8549d0110ef65187af50694a06458ca Date: Mon Apr 19 15:22:22 2021 +0100 weld SmGraphicWindow where the outer Window is not directly drawn into any more Change-Id: I70f45590f0fb7ff2f7af80da8873d580d219aca4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138297 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-07-28lok: Properly update sidebar context in MathMike Kaganski
Change-Id: I830c0d9bdeaa6340283eafc3e91251d02602d7aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137247 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-07-28lok: Enable sidebar in MathMike Kaganski
Change-Id: I1554a924eef0bfcaffa893057a37ef45321a0cf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137246 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-07-25Handle Ctrl+Z / Ctrl+Y in Math graphic window correctlyMike Kaganski
... instead of trying to insert a control character in the formula. Change-Id: Ifcf4d3ce1111a381cd29de310b041c08f7314cff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137402 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-07-25Some refactorMike Kaganski
Change-Id: I58f315e39e33a09585d6325590998ac8195687db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137401 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.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-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-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-01-25lok: enable in-place editing of math equationsMike Kaganski
Change-Id: Ic4d187d1e2ee92eab74a6bb43e47bb4f3d47ebd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128506 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-18Drop useless indirectionMike Kaganski
Change-Id: I87f26e2a2cf10d3000b0955a6ba2d877ee92bdf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128547 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-03Resolves: tdf#145959 menu pos should be relative to SmCmdBoxWindowCaolán McNamara
Change-Id: Ie8da9bbb4385b3315fd62e6f2dc8ab394ea3709f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126263 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-11-23O[U]String::replaceAt overloads that take string_viewNoel Grandin
which results in lots of nice string_view improvements picked up by the plugins Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-08use more SfxItemSetFixedNoel Grandin
Change-Id: I18784bac5f7ad1d109f8a81e96084cd6e9548231 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123240 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-28gives names to all the Idles and TasksNoel Grandin
enforce it by making the constructor parameter non-default. Change-Id: I321543e4dcf15ea0a43ad8cce91d2f8dc22df6ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122766 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>