[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/uiconfig
starmath/inc/dialog.hxx |9 starmath/source/dialog.cxx | 53 +++ starmath/uiconfig/smath/ui/smathsettings.ui | 455 3 files changed, 393 insertions(+), 124 deletions(-) New commits: commit 278c5d22928a05cbfe887e38bc93a5051d0f59d4 Author: Balazs Varga AuthorDate: Wed Nov 22 14:21:00 2023 +0100 Commit: Balazs Varga CommitDate: Wed Nov 22 19:18:23 2023 +0100 tdf#158147 - UI: Part 38 - Unify lockdown behavior of Options dialog for Math - Settings Page. Change-Id: I05170a6c7edb6160e0e7804fa04325d329499854 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159819 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 66db01d295f4..3b4f80b8e61c 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -40,17 +40,26 @@ void SetFontStyle(std::u16string_view rStyleName, vcl::Font ); class SmPrintOptionsTabPage final : public SfxTabPage { std::unique_ptr m_xTitle; +std::unique_ptr m_xTitleImg; std::unique_ptr m_xText; +std::unique_ptr m_xTextImg; std::unique_ptr m_xFrame; +std::unique_ptr m_xFrameImg; std::unique_ptr m_xSizeNormal; std::unique_ptr m_xSizeScaled; std::unique_ptr m_xSizeZoomed; +std::unique_ptr m_xLockPrintImg; std::unique_ptr m_xZoom; std::unique_ptr m_xEnableInlineEdit; +std::unique_ptr m_xEnableInlineEditImg; std::unique_ptr m_xNoRightSpaces; +std::unique_ptr m_xNoRightSpacesImg; std::unique_ptr m_xSaveOnlyUsedSymbols; +std::unique_ptr m_xSaveOnlyUsedSymbolsImg; std::unique_ptr m_xAutoCloseBrackets; +std::unique_ptr m_xAutoCloseBracketsImg; std::unique_ptr m_xSmZoom; +std::unique_ptr m_xSmZoomImg; DECL_LINK(SizeButtonClickHdl, weld::Toggleable&, void); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index f96f43cfebba..1ad8376e5a7f 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -179,17 +180,26 @@ IMPL_LINK_NOARG(SmPrintOptionsTabPage, SizeButtonClickHdl, weld::Toggleable&, vo SmPrintOptionsTabPage::SmPrintOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rOptions) : SfxTabPage(pPage, pController, "modules/smath/ui/smathsettings.ui", "SmathSettings", ) , m_xTitle(m_xBuilder->weld_check_button("title")) +, m_xTitleImg(m_xBuilder->weld_widget("locktitle")) , m_xText(m_xBuilder->weld_check_button("text")) +, m_xTextImg(m_xBuilder->weld_widget("locktext")) , m_xFrame(m_xBuilder->weld_check_button("frame")) +, m_xFrameImg(m_xBuilder->weld_widget("lockframe")) , m_xSizeNormal(m_xBuilder->weld_radio_button("sizenormal")) , m_xSizeScaled(m_xBuilder->weld_radio_button("sizescaled")) , m_xSizeZoomed(m_xBuilder->weld_radio_button("sizezoomed")) +, m_xLockPrintImg(m_xBuilder->weld_widget("lockprintformat")) , m_xZoom(m_xBuilder->weld_metric_spin_button("zoom", FieldUnit::PERCENT)) , m_xEnableInlineEdit(m_xBuilder->weld_check_button("enableinlineedit")) +, m_xEnableInlineEditImg(m_xBuilder->weld_widget("lockenableinlineedit")) , m_xNoRightSpaces(m_xBuilder->weld_check_button("norightspaces")) +, m_xNoRightSpacesImg(m_xBuilder->weld_widget("locknorightspaces")) , m_xSaveOnlyUsedSymbols(m_xBuilder->weld_check_button("saveonlyusedsymbols")) +, m_xSaveOnlyUsedSymbolsImg(m_xBuilder->weld_widget("locksaveonlyusedsymbols")) , m_xAutoCloseBrackets(m_xBuilder->weld_check_button("autoclosebrackets")) +, m_xAutoCloseBracketsImg(m_xBuilder->weld_widget("lockautoclosebrackets")) , m_xSmZoom(m_xBuilder->weld_metric_spin_button("smzoom", FieldUnit::PERCENT)) +, m_xSmZoomImg(m_xBuilder->weld_widget("locksmzoom")) { m_xSizeNormal->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); m_xSizeScaled->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); @@ -271,21 +281,58 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet* rSet) m_xSizeNormal->set_active(ePrintSize == PRINT_SIZE_NORMAL); m_xSizeScaled->set_active(ePrintSize == PRINT_SIZE_SCALED); m_xSizeZoomed->set_active(ePrintSize == PRINT_SIZE_ZOOMED); +bool bReadOnly = officecfg::Office::Math::Print::Size::isReadOnly(); +if (bReadOnly) +{ +m_xSizeNormal->set_sensitive(false); +m_xSizeScaled->set_sensitive(false); +m_xSizeZoomed->set_sensitive(false); +m_xLockPrintImg->set_visible(true); +} -m_xZoom->set_sensitive(m_xSizeZoomed->get_active()); - +bReadOnly = officecfg::Office::Math::Print::ZoomFactor::isReadOnly(); m_xZoom->set_value(rSet->Get(SID_PRINTZOOM).GetValue(),
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|4 ++-- starmath/inc/cfgitem.hxx |4 ++-- starmath/inc/document.hxx |6 +++--- starmath/inc/mathml/import.hxx|4 ++-- starmath/inc/mathml/mathmlimport.hxx |6 +++--- starmath/source/ElementsDockingWindow.cxx |2 +- starmath/source/cfgitem.cxx |8 starmath/source/document.cxx |2 +- starmath/source/mathml/mathmlexport.cxx |2 +- starmath/source/unomodel.cxx |2 +- 10 files changed, 20 insertions(+), 20 deletions(-) New commits: commit c37022ff57b6efe11869e9901e874cff80eca0c6 Author: Julien Nabet AuthorDate: Sun Nov 5 14:42:51 2023 +0100 Commit: Julien Nabet CommitDate: Mon Nov 6 10:25:09 2023 +0100 "SyntaxVersion" has been declared as "sal_Int16" in unomodel not "sal_uInt16" See "aModelPropertyInfoMap" var in starmath/source/unomodel.cxx It fixes this message when loading https://bugs.documentfoundation.org/attachment.cgi?id=55799 warn:legacy.osl:19853:19853:xmloff/source/core/SettingsExportHelper.cxx:176: this type is not implemented now Change-Id: I18779b122555681f7544e64745c8074775e27277 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158952 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 22c7b899586e..6bbb4a542756 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -41,7 +41,7 @@ class SmElementsControl SmDocShell* mpDocShell; SmFormat maFormat; int mnCurrentSetIndex; -sal_uInt16m_nSmSyntaxVersion; +sal_Int16 m_nSmSyntaxVersion; std::vector> maItemDatas; std::unique_ptr mpIconView; @@ -67,7 +67,7 @@ public: static const std::vector& categories(); void setElementSetIndex(int nSetIndex); -void setSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion); +void setSmSyntaxVersion(sal_Int16 nSmSyntaxVersion); void SetSelectHdl(const Link& rLink) { maSelectHdlLink = rLink; } diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index 1dfbd3ef9dd4..08a6e834f1fd 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -195,8 +195,8 @@ public: bool IsShowFormulaCursor() const; void SetShowFormulaCursor(bool bVal); -sal_uInt16 GetDefaultSmSyntaxVersion() const; -void SetDefaultSmSyntaxVersion(sal_uInt16 nVal); +sal_Int16 GetDefaultSmSyntaxVersion() const; +void SetDefaultSmSyntaxVersion(sal_Int16 nVal); SmFontPickList& GetFontPickList(sal_uInt16 nIdent) { return vFontPickList[nIdent]; } diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index e7c767d12df7..c73723a434d0 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -92,7 +92,7 @@ class SM_DLLPUBLIC SmDocShell final : public SfxObjectShell, public SfxListener VclPtr mpTmpPrinter;//ditto sal_uInt16 mnModifyCount; boolmbFormulaArranged; -sal_uInt16 mnSmSyntaxVersion; +sal_Int16 mnSmSyntaxVersion; std::unique_ptr maParser; std::unique_ptr mpCursor; std::set< OUString >maUsedSymbols; // to export used symbols only when saving @@ -176,8 +176,8 @@ public: AbstractSmParser* GetParser() { return maParser.get(); } const SmTableNode *GetFormulaTree() const { return mpTree.get(); } voidSetFormulaTree(SmTableNode *pTree) { mpTree.reset(pTree); } -sal_uInt16 GetSmSyntaxVersion() const { return mnSmSyntaxVersion; } -voidSetSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion); +sal_Int16 GetSmSyntaxVersion() const { return mnSmSyntaxVersion; } +voidSetSmSyntaxVersion(sal_Int16 nSmSyntaxVersion); const std::set< OUString > &GetUsedSymbols() const { return maUsedSymbols; } diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx index 18c4334060ba..764d5451c652 100644 --- a/starmath/inc/mathml/import.hxx +++ b/starmath/inc/mathml/import.hxx @@ -138,11 +138,11 @@ public: /** Set syntax version */ -void SetSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion) { m_nSmSyntaxVersion = nSmSyntaxVersion; } +void SetSmSyntaxVersion(sal_Int16 nSmSyntaxVersion) { m_nSmSyntaxVersion = nSmSyntaxVersion; } /** Get syntax version */ -sal_uInt16 GetSmSyntaxVersion() const { return m_nSmSyntaxVersion; } +sal_Int16 GetSmSyntaxVersion() const { return m_nSmSyntaxVersion; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/starmath/inc/mathml/mathmlimport.hxx b/starmath/inc/mathml/mathmlimport.hxx index efa5c353700f..3e2b5d2a991d 100644 --- a/starmath/inc/mathml/mathmlimport.hxx +++ b/starmath/inc/mathml/mathmlimport.hxx @@
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/document.hxx|4 starmath/inc/view.hxx| 19 -- starmath/source/document.cxx | 314 ++ starmath/source/unomodel.cxx | 13 - starmath/source/view.cxx | 317 --- 5 files changed, 322 insertions(+), 345 deletions(-) New commits: commit e7aa16be823877f2273e75a4e8fe646c28b73731 Author: Mike Kaganski AuthorDate: Sat Oct 28 20:23:00 2023 +0300 Commit: Mike Kaganski CommitDate: Sat Oct 28 21:41:24 2023 +0200 Move Impl_Print from SmViewShell to SmDocShell All functionality is in the latter, anyway. This move allows to exclude dependency on existing views from SmModel::render. Change-Id: I3dff855b7f25089439c8afc57904a25a48fd127b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158594 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index ca36a6138a32..e7c767d12df7 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -61,6 +61,7 @@ inline constexpr OUString MATHML_XML = u"MathML XML (Math)"_ustr; class SmDocShell; class EditEngine; class SmEditEngine; +class SmPrintUIOptions; class SmPrinterAccess { @@ -224,6 +225,9 @@ public: } void SetRightToLeft(bool bRTL); + +void Impl_Print(OutputDevice& rOutDev, const SmPrintUIOptions& rPrintUIOptions, +tools::Rectangle aOutRect); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index a896cd41bf2d..8b17744d6171 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -37,6 +37,9 @@ class SmPrintUIOptions; class SmGraphicAccessible; class SmGraphicWidget; +#define MINZOOM sal_uInt16(25) +#define MAXZOOM sal_uInt16(800) + class SmGraphicWindow final : public InterimItemWindow { private: @@ -253,19 +256,6 @@ class SmViewShell final : public SfxViewShell DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); virtual voidNotify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; -static Size GetTextLineSize(OutputDevice const & rDevice, - const OUString& rLine); -static Size GetTextSize(OutputDevice const & rDevice, - std::u16string_view rText, - tools::Long MaxWidth); -static void DrawTextLine(OutputDevice& rDevice, - const Point& rPosition, - const OUString& rLine); -static void DrawText(OutputDevice& rDevice, - const Point& rPosition, - std::u16string_view rText, - sal_uInt16MaxWidth); - virtual SfxPrinter *GetPrinter(bool bCreate = false) override; virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL) override; @@ -331,9 +321,6 @@ public: void Execute( SfxRequest& rReq ); void GetState(SfxItemSet &); -void Impl_Print( OutputDevice , const SmPrintUIOptions , -tools::Rectangle aOutRect ); - static bool IsInlineEditEnabled(); // Opens the main help page for the Math module diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 18cdc237944f..91bdcc601ec4 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -1270,4 +1271,317 @@ void SmDocShell::SetRightToLeft(bool bRTL) Repaint(); } +static Size GetTextLineSize(OutputDevice const& rDevice, const OUString& rLine) +{ +Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight()); +const tools::Long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_digit_width() * 8; + +if (nTabPos) +{ +aSize.setWidth(0); +sal_Int32 nPos = 0; +do +{ +if (nPos > 0) +aSize.setWidth(((aSize.Width() / nTabPos) + 1) * nTabPos); + +const OUString aText = rLine.getToken(0, '\t', nPos); +aSize.AdjustWidth(rDevice.GetTextWidth(aText)); +} while (nPos >= 0); +} + +return aSize; +} + +static Size GetTextSize(OutputDevice const& rDevice, std::u16string_view rText, +tools::Long MaxWidth) +{ +Size aSize; +Size aTextSize; +if (rText.empty()) +return aTextSize; + +sal_Int32 nPos = 0; +do +{ +OUString aLine(o3tl::getToken(rText, 0, '\n', nPos)); +aLine = aLine.replaceAll("\r", ""); + +aSize = GetTextLineSize(rDevice, aLine); + +if (aSize.Width() > MaxWidth) +{ +do +{ +OUString aText; +sal_Int32 m = aLine.getLength(); +sal_Int32 nLen = m; + +for (sal_Int32 n = 0; n < nLen; n++) +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/symbol.hxx |4 ++-- starmath/source/cfgitem.cxx |2 +- starmath/source/dialog.cxx | 18 +- starmath/source/parse5.cxx |2 +- starmath/source/symbol.cxx | 18 +- starmath/source/unomodel.cxx |4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) New commits: commit 899522378bfb754af757c1a4a0f6bce699ac8721 Author: Khaled Hosny AuthorDate: Thu Sep 21 12:37:17 2023 +0300 Commit: خالد حسني CommitDate: Thu Sep 21 13:19:28 2023 +0200 starmath: Rename SmSym::GetName() -> GetUiName() To make it obvious this is the UI (localized) name. Change-Id: Id0dbffeaa9c331ce90dee3e7fbc88f93fab1b654 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157138 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index a7d5bcad6697..f337a0dfac21 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -38,7 +38,7 @@ class SmSym { private: SmFace m_aFace; -OUStringm_aName; +OUStringm_aUiName; OUStringm_aExportName; OUStringm_aSetName; sal_UCS4m_cChar; @@ -54,7 +54,7 @@ public: const vcl::Font& GetFace(const SmFormat* pFormat = nullptr) const; sal_UCS4GetCharacter() const { return m_cChar; } -const OUString& GetName() const { return m_aName; } +const OUString& GetUiName() const { return m_aUiName; } boolIsPredefined() const{ return m_bPredefined; } const OUString& GetSymbolSetName() const{ return m_aSetName; } diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 8906474c9f35..5287b05e018d 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -740,7 +740,7 @@ void SmMathConfig::StripFontFormatList( const std::vector< SmSym > ) SmFontFormatList aUsedList; for (i = 0; i < rSymbols.size(); ++i) { -OSL_ENSURE( rSymbols[i].GetName().getLength() > 0, "non named symbol" ); +OSL_ENSURE( !rSymbols[i].GetUiName().isEmpty(), "non named symbol" ); aUsedList.GetFontFormatId( SmFontFormat( rSymbols[i].GetFace() ) , true ); } const SmFormat & rStdFmt = GetStandardFormat(); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index c5e38f6cb684..f06cb60bc929 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -1325,7 +1325,7 @@ IMPL_LINK_NOARG(SmSymbolDialog, GetClickHdl, weld::Button&, void) const SmSym *pSym = GetSymbol(); if (pSym) { -OUString aText = "%" + pSym->GetName() + " "; +OUString aText = "%" + pSym->GetUiName() + " "; rViewSh.GetViewFrame().GetDispatcher()->ExecuteList( SID_INSERTSPECIAL, SfxCallMode::RECORD, @@ -1409,7 +1409,7 @@ void SmSymbolDialog::SelectSymbol(sal_uInt16 nSymbolNo) m_xSymbolSetDisplay->SelectSymbol(nSymbolNo); m_aSymbolDisplay.SetSymbol(pSym); -m_xSymbolName->set_label(pSym ? pSym->GetName() : OUString()); +m_xSymbolName->set_label(pSym ? pSym->GetUiName() : OUString()); } const SmSym* SmSymbolDialog::GetSymbol() const @@ -1491,7 +1491,7 @@ void SmSymDefineDialog::FillSymbols(weld::ComboBox& rComboBox, bool bDeleteText) weld::ComboBox& rBox = == m_xOldSymbols.get() ? *m_xOldSymbolSets : *m_xSymbolSets; SymbolPtrVec_t aSymSet(m_aSymbolMgrCopy.GetSymbolSet(rBox.get_active_text())); for (const SmSym* i : aSymSet) -rComboBox.append_text(i->GetName()); +rComboBox.append_text(i->GetUiName()); } void SmSymDefineDialog::FillSymbolSets(weld::ComboBox& rComboBox, bool bDeleteText) @@ -1657,7 +1657,7 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, weld::Button&, rButton, void ) // update display of new symbol m_aSymbolDisplay.SetSymbol( ); -m_xSymbolName->set_label(aNewSymbol.GetName()); +m_xSymbolName->set_label(aNewSymbol.GetUiName()); m_xSymbolSetName->set_label(aNewSymbol.GetSymbolSetName()); // update list box entries @@ -1693,7 +1693,7 @@ IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, weld::Button&, rButton, void ) // update display of new symbol m_aSymbolDisplay.SetSymbol(); -m_xSymbolName->set_label(aNewSymbol.GetName()); +m_xSymbolName->set_label(aNewSymbol.GetUiName()); m_xSymbolSetName->set_label(aNewSymbol.GetSymbolSetName()); // update list box entries @@ -1713,7 +1713,7 @@ IMPL_LINK(SmSymDefineDialog, DeleteClickHdl, weld::Button&, rButton, void) if (m_xOrigSymbol) { -m_aSymbolMgrCopy.RemoveSymbol(m_xOrigSymbol->GetName()); +m_aSymbolMgrCopy.RemoveSymbol(m_xOrigSymbol->GetUiName()); // clear display for original symbol SetOrigSymbol(nullptr, OUString()); @@ -1742,7 +1742,7 @@ void SmSymDefineDialog::UpdateButtons() //! (Font-, Style- and SymbolSet name comparison is
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/symbol.hxx|8 +++- starmath/source/dialog.cxx |8 starmath/source/node.cxx |6 ++ starmath/source/parse5.cxx | 18 ++ starmath/source/symbol.cxx | 35 --- 5 files changed, 47 insertions(+), 28 deletions(-) New commits: commit 7de4c6b95da7d187c403ee478786bb74467c1eb5 Author: Khaled Hosny AuthorDate: Thu Sep 21 12:20:07 2023 +0300 Commit: خالد حسني CommitDate: Thu Sep 21 12:33:19 2023 +0200 tdf#62174: Fix saving of localized iGreek symbols When saving symbols we use the non-localized name, but iGreek symbols are a bit of a hack since they are added at runtime and don’t have localizations of there own but use the Greek symbols names with an “i” prefix. Instead of looking directly for localized names, we now go through the symbol manager that already knows about iGreek and use the export name of the symbol. We have to also make sure the iGreek symbols has non-localized export name. Change-Id: Ia3e38579abba56ae12ade126f564f8c6f9c3229a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157137 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 321dbb500e03..a7d5bcad6697 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -93,11 +93,9 @@ public: boolAddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false ); voidRemoveSymbol( const OUString & rSymbolName ); -SmSym * GetSymbolByName(const OUString& rSymbolName); -const SmSym * GetSymbolByName(const OUString& rSymbolName) const -{ -return const_cast(this)->GetSymbolByName(rSymbolName); -} +SmSym* GetSymbolByName(std::u16string_view rSymbolName); +SmSym* GetSymbolByUiName(std::u16string_view rSymbolName); +SmSym* GetSymbolByExportName(std::u16string_view rSymbolName); boolIsModified() const { return m_bModified; } voidSetModified(bool bModify) { m_bModified = bModify; } diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 8625072c90e8..c5e38f6cb684 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -1544,7 +1544,7 @@ void SmSymDefineDialog::FillStyles() SmSym* SmSymDefineDialog::GetSymbol(const weld::ComboBox& rComboBox) { assert(( == m_xOldSymbols.get() || == m_xSymbols.get()) && "Sm : wrong combobox"); -return m_aSymbolMgrCopy.GetSymbolByName(rComboBox.get_active_text()); +return m_aSymbolMgrCopy.GetSymbolByUiName(rComboBox.get_active_text()); } IMPL_LINK(SmSymDefineDialog, OldSymbolChangeHdl, weld::ComboBox&, rComboBox, void) @@ -1652,7 +1652,7 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, weld::Button&, rButton, void ) // add symbol const SmSym aNewSymbol(m_xSymbols->get_active_text(), m_xCharsetDisplay->GetFont(), m_xCharsetDisplay->GetSelectCharacter(), m_xSymbolSets->get_active_text()); -//OSL_ENSURE( m_aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" ); +//OSL_ENSURE( m_aSymbolMgrCopy.GetSymbolByUiName(aTmpSymbolName) == NULL, "symbol already exists" ); m_aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol ); // update display of new symbol @@ -1750,7 +1750,7 @@ void SmSymDefineDialog::UpdateButtons() && m_xCharsetDisplay->GetSelectCharacter() == m_xOrigSymbol->GetCharacter(); // only add it if there isn't already a symbol with the same name -bAdd= m_aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == nullptr; +bAdd= m_aSymbolMgrCopy.GetSymbolByUiName(aTmpSymbolName) == nullptr; // only delete it if all settings are equal bDelete = bool(m_xOrigSymbol); @@ -1982,7 +1982,7 @@ bool SmSymDefineDialog::SelectSymbol(weld::ComboBox& rComboBox, OUString aTmpOldSymbolSetName; if (nPos != -1) { -pOldSymbol= m_aSymbolMgrCopy.GetSymbolByName(aNormName); +pOldSymbol= m_aSymbolMgrCopy.GetSymbolByUiName(aNormName); aTmpOldSymbolSetName = m_xOldSymbolSets->get_active_text(); } SetOrigSymbol(pOldSymbol, aTmpOldSymbolSetName); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 01b14c177e43..b0b91dabe99e 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2155,8 +2155,7 @@ static bool lcl_IsFromGreekSymbolSet( std::u16string_view aTokenText ) // valid symbol name needs to have a '%' at pos 0 and at least an additional char if (aTokenText.size() > 2 && aTokenText[0] == u'%') { -OUString aName( aTokenText.substr(1) ); -SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName ); +SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName(aTokenText.substr(1));
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/symbol.hxx|3 ++- starmath/source/node.cxx |5 + starmath/source/symbol.cxx |8 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) New commits: commit 37f91706e6efd36074187234530f8c8ee8a3edd8 Author: Khaled Hosny AuthorDate: Tue Sep 19 10:22:37 2023 +0300 Commit: خالد حسني CommitDate: Tue Sep 19 14:22:11 2023 +0200 starmath: Get the font from current format for special symbols We want to use the current format when using the symbol in a document, and fallback for stabdard format when rendering the symbol in symbols dialog. Fixup for the following two commits: commit f28b043b4eb40e90b330721fc43d19ae6c06951e Author: Khaled Hosny Date: Mon Sep 18 19:00:02 2023 +0300 starmath: Fix editing symbols in the Symbols Catalogue commit 32d2e001bb056e7d98aa143b222f2721967337dc Author: Khaled Hosny Date: Tue Sep 12 18:35:46 2023 +0300 tdf#101174: Don’t hard-code OpenSymbol font for predefined special symbols Change-Id: Id3730749a49015120ecf9719027f932fd90c605a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157043 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index a3d08b37d522..321dbb500e03 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -28,6 +28,7 @@ #include #include +#include "format.hxx" #include "utility.hxx" @@ -51,7 +52,7 @@ public: SmSym& operator = (const SmSym& rSymbol); -const vcl::Font& GetFace() const; +const vcl::Font& GetFace(const SmFormat* pFormat = nullptr) const; sal_UCS4GetCharacter() const { return m_cChar; } const OUString& GetName() const { return m_aName; } diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 92eafe8dbccb..01b14c177e43 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2192,10 +2192,7 @@ void SmSpecialNode::Prepare(const SmFormat , const SmDocShell sal_UCS4 cChar = pSym->GetCharacter(); OUString aTmp( , 1 ); SetText( aTmp ); -if (pSym->GetFace().GetFamilyName().isEmpty()) -GetFont() = rFormat.GetFont(FNT_VARIABLE); -else -GetFont() = pSym->GetFace(); +GetFont() = pSym->GetFace(); } else { diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 7bff8d995d5c..a75b6a912670 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -81,10 +81,14 @@ bool SmSym::IsEqualInUI( const SmSym& rSymbol ) const m_cChar == rSymbol.m_cChar; } -const vcl::Font& SmSym::GetFace() const +const vcl::Font& SmSym::GetFace(const SmFormat* pFormat) const { if (m_aFace.GetFamilyName().isEmpty()) -return SM_MOD()->GetConfig()->GetStandardFormat().GetFont(FNT_MATH); +{ +if (!pFormat) +pFormat = _MOD()->GetConfig()->GetStandardFormat(); +return pFormat->GetFont(FNT_VARIABLE); +} return m_aFace; }
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/symbol.hxx|2 +- starmath/source/symbol.cxx |8 2 files changed, 9 insertions(+), 1 deletion(-) New commits: commit f28b043b4eb40e90b330721fc43d19ae6c06951e Author: Khaled Hosny AuthorDate: Mon Sep 18 19:00:02 2023 +0300 Commit: خالد حسني CommitDate: Mon Sep 18 19:09:34 2023 +0200 starmath: Fix editing symbols in the Symbols Catalogue Fallout from: commit 32d2e001bb056e7d98aa143b222f2721967337dc Author: Khaled Hosny Date: Tue Sep 12 18:35:46 2023 +0300 tdf#101174: Don’t hard-code OpenSymbol font for predefined special symbols Change-Id: I1f440dccc920b24010160dbeee58795ffd8f85ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157025 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 39ce0be6e38c..a3d08b37d522 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -51,7 +51,7 @@ public: SmSym& operator = (const SmSym& rSymbol); -const vcl::Font& GetFace() const { return m_aFace; } +const vcl::Font& GetFace() const; sal_UCS4GetCharacter() const { return m_cChar; } const OUString& GetName() const { return m_aName; } diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 3baf79702faf..7bff8d995d5c 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -80,6 +81,13 @@ bool SmSym::IsEqualInUI( const SmSym& rSymbol ) const m_cChar == rSymbol.m_cChar; } +const vcl::Font& SmSym::GetFace() const +{ +if (m_aFace.GetFamilyName().isEmpty()) +return SM_MOD()->GetConfig()->GetStandardFormat().GetFont(FNT_MATH); +return m_aFace; +} + /**/
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cursor.hxx|1 - starmath/inc/view.hxx |2 ++ starmath/source/cursor.cxx |7 --- starmath/source/edit.cxx |5 + starmath/source/view.cxx | 28 +++- 5 files changed, 14 insertions(+), 29 deletions(-) New commits: commit beaea2e992912b4747d790070b26371f557b1f57 Author: Khaled Hosny AuthorDate: Thu Sep 7 19:19:56 2023 +0300 Commit: خالد حسني CommitDate: Thu Sep 7 23:54:46 2023 +0200 starmath: Properly update the state to copy/cut/paste buttons Invalidate the slots explicitly instead of implicitly by updating the edit window. Followup to: commit 065609f86f730d4eedc6b7ae28382dc7daea11ac Author: Khaled Hosny 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: خالد حسني diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 7e1f8ec83c53..0a8a35071f10 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -85,7 +85,6 @@ public: /** True, if the cursor has a selection */ bool HasSelection() const { return mpAnchor != mpPosition; } -const ESelection& GetSelection(); /** Move the position of this cursor */ void Move(OutputDevice* pDev, SmMovementDirection direction, bool bMoveAnchor = true); diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 4a79b94e4f02..a896cd41bf2d 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -321,6 +321,8 @@ public: void SendCaretToLOK() const; +void InvalidateSlots(); + private: /// SfxInterface initializer. static void InitInterface_Impl(); diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 41506dff3109..e8623517bcd7 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1141,13 +1141,6 @@ SmNode* SmCursor::FindSelectedNode(SmNode* pNode){ return nullptr; } -const ESelection& SmCursor::GetSelection() { -const SmNode* pNode = FindSelectedNode(mpTree); -if (!pNode) -return mpTree->GetSelection(); -return pNode->GetSelection(); -} - void SmCursor::LineToList(SmStructureNode* pLine, SmNodeList& list){ for(auto pChild : *pLine) { diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 90cb6cd5498a..77ab710fab69 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -160,10 +160,7 @@ void SmEditTextWindow::StartCursorMove() void SmEditWindow::InvalidateSlots() { -SfxBindings& rBind = GetView()->GetViewFrame().GetBindings(); -rBind.Invalidate(SID_COPY); -rBind.Invalidate(SID_CUT); -rBind.Invalidate(SID_DELETE); +GetView()->InvalidateSlots(); } SmViewShell * SmEditWindow::GetView() diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index eacab22901ad..2800e06ba387 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -371,10 +371,8 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) SmEditWindow* pEdit = GetView().GetEditWindow(); if (SmViewShell::IsInlineEditEnabled()) { -SmCursor& rCursor = GetCursor(); -rCursor.MoveTo(, aPos, !rMEvt.IsShift()); -if (pEdit) -pEdit->SetSelection(rCursor.GetSelection()); +GetCursor().MoveTo(, aPos, !rMEvt.IsShift()); +GetView().InvalidateSlots(); // 'on grab' window events are missing in lok, do it explicitly if (comphelper::LibreOfficeKit::isActive()) SetIsCursorVisible(true); @@ -715,7 +713,6 @@ bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) return GetView().KeyInput(rKEvt); bool bConsumed = true; -bool bSetSelection = false; SmCursor& rCursor = GetCursor(); switch (rKEvt.GetKeyCode().GetFunction()) @@ -740,32 +737,24 @@ bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) { case KEY_LEFT: rCursor.Move((), MoveLeft, !rKEvt.GetKeyCode().IsShift()); -bSetSelection = true; break; case KEY_RIGHT: rCursor.Move((), MoveRight, !rKEvt.GetKeyCode().IsShift()); -bSetSelection = true; break; case KEY_UP: rCursor.Move((), MoveUp, !rKEvt.GetKeyCode().IsShift()); -bSetSelection = true; break; case KEY_DOWN: rCursor.Move((), MoveDown, !rKEvt.GetKeyCode().IsShift()); -bSetSelection = true; break; case KEY_RETURN: if (!rKEvt.GetKeyCode().IsShift()) -{ rCursor.InsertRow(); -bSetSelection = true; -} break;
[Libreoffice-commits] core.git: starmath/inc starmath/source uitest/math_tests
starmath/inc/view.hxx | 14 -- starmath/source/edit.cxx |4 starmath/source/view.cxx | 29 + uitest/math_tests/start.py |3 ++- uitest/math_tests/tdf147755.py |4 ++-- 5 files changed, 17 insertions(+), 37 deletions(-) New commits: commit ee187f6ed7873f3ebc1f845a4384a84713be1e9c Author: Khaled Hosny AuthorDate: Tue Sep 5 20:24:13 2023 +0300 Commit: خالد حسني CommitDate: Tue Sep 5 20:28:34 2023 +0200 starmath: Always insert using SmCursor when inline editing is enabled 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: خالد حسني diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index dc42dde2fdc9..4a79b94e4f02 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -249,11 +249,6 @@ class SmViewShell final : public SfxViewShell SmGraphicController maGraphicController; OUString maStatusText; bool mbPasteState; -/** Used to determine whether insertions using SID_INSERTSPECIAL and SID_INSERTCOMMANDTEXT - * should be inserted into SmEditWindow or directly into the SmDocShell as done if the - * visual editor was last to have focus. - */ -bool mbInsertIntoEditWindow; DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); virtual voidNotify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; @@ -337,15 +332,6 @@ public: void Impl_Print( OutputDevice , const SmPrintUIOptions , tools::Rectangle aOutRect ); -/** Set bInsertIntoEditWindow so we know where to insert - * - * This method is called whenever SmGraphicWidget or SmEditWindow gets focus, - * so that when text is inserted from catalog or elsewhere we know whether to - * insert for the visual editor, or the text editor. - */ -void SetInsertIntoEditWindow(bool bEditWindowHadFocusLast){ -mbInsertIntoEditWindow = bEditWindowHadFocusLast; -} static bool IsInlineEditEnabled(); // Opens the main help page for the Math module diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 4cb4f6532f64..90cb6cd5498a 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -556,10 +556,6 @@ void SmEditTextWindow::GetFocus() EditEngine *pEditEngine = GetEditEngine(); if (pEditEngine) pEditEngine->SetStatusEventHdl(LINK(this, SmEditTextWindow, EditStatusHdl)); - -//Let SmViewShell know we got focus -if (mrEditWindow.GetView() && SmViewShell::IsInlineEditEnabled()) -mrEditWindow.GetView()->SetInsertIntoEditWindow(true); } void SmEditTextWindow::LoseFocus() diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 22ca4e575d3b..eacab22901ad 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -424,8 +424,6 @@ void SmGraphicWidget::GetFocus() return; if (SmEditWindow* pEdit = GetView().GetEditWindow()) pEdit->Flush(); -//Let view shell know what insertions should be done in visual editor -GetView().SetInsertIntoEditWindow(false); SetIsCursorVisible(true); ShowLine(true); CaretBlinkStart(); @@ -1784,7 +1782,7 @@ void SmViewShell::Execute(SfxRequest& rReq) case SID_CUT: -if (IsInlineEditEnabled() && !mbInsertIntoEditWindow) +if (IsInlineEditEnabled()) { GetDoc()->GetCursor().Cut(); GetGraphicWidget().GrabFocus(); @@ -1794,7 +1792,7 @@ void SmViewShell::Execute(SfxRequest& rReq) break; case SID_COPY: -if (IsInlineEditEnabled() && !mbInsertIntoEditWindow) +if (IsInlineEditEnabled()) { GetDoc()->GetCursor().Copy(); GetGraphicWidget().GrabFocus(); @@ -1814,7 +1812,7 @@ void SmViewShell::Execute(SfxRequest& rReq) case SID_PASTE: { -if (IsInlineEditEnabled() && !mbInsertIntoEditWindow) +if (IsInlineEditEnabled()) { GetDoc()->GetCursor().Paste(); GetGraphicWidget().GrabFocus(); @@ -1847,7 +1845,7 @@ void SmViewShell::Execute(SfxRequest& rReq) break; case SID_DELETE: -if (IsInlineEditEnabled() && !mbInsertIntoEditWindow) +if (IsInlineEditEnabled()) { if (!GetDoc()->GetCursor().HasSelection()) { @@ -1872,15 +1870,15 @@ void
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cursor.hxx|1 starmath/source/cursor.cxx |7 starmath/source/view.cxx | 64 - 3 files changed, 66 insertions(+), 6 deletions(-) New commits: commit 065609f86f730d4eedc6b7ae28382dc7daea11ac Author: Khaled Hosny AuthorDate: Mon Sep 4 13:22:04 2023 +0300 Commit: خالد حسني CommitDate: Mon Sep 4 19:29:45 2023 +0200 starmath: Make cut/copy/paste buttons work with inline editing 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: خالد حسني diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 0a8a35071f10..7e1f8ec83c53 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -85,6 +85,7 @@ public: /** True, if the cursor has a selection */ bool HasSelection() const { return mpAnchor != mpPosition; } +const ESelection& GetSelection(); /** Move the position of this cursor */ void Move(OutputDevice* pDev, SmMovementDirection direction, bool bMoveAnchor = true); diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index e8623517bcd7..41506dff3109 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1141,6 +1141,13 @@ SmNode* SmCursor::FindSelectedNode(SmNode* pNode){ return nullptr; } +const ESelection& SmCursor::GetSelection() { +const SmNode* pNode = FindSelectedNode(mpTree); +if (!pNode) +return mpTree->GetSelection(); +return pNode->GetSelection(); +} + void SmCursor::LineToList(SmStructureNode* pLine, SmNodeList& list){ for(auto pChild : *pLine) { diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 85dccb711ec6..22ca4e575d3b 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -368,8 +368,13 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) if (!pTree) return true; +SmEditWindow* pEdit = GetView().GetEditWindow(); + if (SmViewShell::IsInlineEditEnabled()) { -GetCursor().MoveTo(, aPos, !rMEvt.IsShift()); +SmCursor& rCursor = GetCursor(); +rCursor.MoveTo(, aPos, !rMEvt.IsShift()); +if (pEdit) +pEdit->SetSelection(rCursor.GetSelection()); // 'on grab' window events are missing in lok, do it explicitly if (comphelper::LibreOfficeKit::isActive()) SetIsCursorVisible(true); @@ -383,7 +388,6 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) if (!pNode) return true; -SmEditWindow* pEdit = GetView().GetEditWindow(); if (!pEdit) return true; @@ -713,6 +717,7 @@ bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) return GetView().KeyInput(rKEvt); bool bConsumed = true; +bool bSetSelection = false; SmCursor& rCursor = GetCursor(); switch (rKEvt.GetKeyCode().GetFunction()) @@ -737,24 +742,32 @@ bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) { case KEY_LEFT: rCursor.Move((), MoveLeft, !rKEvt.GetKeyCode().IsShift()); +bSetSelection = true; break; case KEY_RIGHT: rCursor.Move((), MoveRight, !rKEvt.GetKeyCode().IsShift()); +bSetSelection = true; break; case KEY_UP: rCursor.Move((), MoveUp, !rKEvt.GetKeyCode().IsShift()); +bSetSelection = true; break; case KEY_DOWN: rCursor.Move((), MoveDown, !rKEvt.GetKeyCode().IsShift()); +bSetSelection = true; break; case KEY_RETURN: if (!rKEvt.GetKeyCode().IsShift()) +{ rCursor.InsertRow(); +bSetSelection = true; +} break; case KEY_DELETE: if (!rCursor.HasSelection()) { rCursor.Move((), MoveRight, false); +bSetSelection = true; if (rCursor.HasComplexSelection()) break; } @@ -762,12 +775,17 @@ bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) break; case KEY_BACKSPACE: rCursor.DeletePrev(()); +bSetSelection = true; break; default: if (!CharInput(rKEvt.GetCharCode(), rCursor, GetOutputDevice())) bConsumed = GetView().KeyInput(rKEvt); } } + +SmEditWindow* pEdit = GetView().GetEditWindow(); +if (pEdit && bSetSelection) +pEdit->SetSelection(rCursor.GetSelection()); CaretBlinkStop();
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/visitors.hxx|2 +- starmath/source/document.cxx | 24 ++-- starmath/source/visitors.cxx |8 3 files changed, 23 insertions(+), 11 deletions(-) New commits: commit f80c2c70756e3620daed6675c8546caca4153d4b Author: Khaled Hosny AuthorDate: Tue Aug 29 20:51:06 2023 +0300 Commit: خالد حسني CommitDate: Mon Sep 4 18:18:37 2023 +0200 tdf#134193: Fix inline editing with RTL direction Change-Id: I65d3ed0d7c56839ce3674318144269719b043ba5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156261 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index c1a2a8983286..338e93432ba1 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -219,7 +219,7 @@ public: , maPosition( position ) , mrFormat( rFormat ) { -if (mrFormat.IsRightToLeft()) +if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(maPosition); pTree->Accept( this ); } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 9bdaad7530e6..8f8e184470a0 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -332,8 +332,10 @@ void SmDocShell::DrawFormula(OutputDevice , Point , bool bDrawSel rPosition.AdjustY(maFormat.GetDistance( DIS_TOPSPACE ) ); Point aPosition(rPosition); -if (bRTL) -aPosition.AdjustX(GetSize().Width() - maFormat.GetDistance(DIS_LEFTSPACE) - maFormat.GetDistance(DIS_RIGHTSPACE)); +if (bRTL && rDev.GetOutDevType() != OUTDEV_WINDOW) +aPosition.AdjustX(GetSize().Width() + - maFormat.GetDistance(DIS_LEFTSPACE) + - maFormat.GetDistance(DIS_RIGHTSPACE)); //! in case of high contrast-mode (accessibility option!) //! the draw mode needs to be set to default, because when embedding @@ -353,11 +355,21 @@ void SmDocShell::DrawFormula(OutputDevice , Point , bool bDrawSel vcl::PushFlags::RTLENABLED); // We want the device to always be LTR, we handle RTL formulas ourselves. -rDev.EnableRTL(false); +if (rDev.GetOutDevType() == OUTDEV_WINDOW) +rDev.EnableRTL(bRTL); +else +rDev.EnableRTL(false); -// For RTL formulas, we want the brackets to be mirrored. -rDev.SetLayoutMode(bRTL ? vcl::text::ComplexTextLayoutFlags::BiDiRtl -: vcl::text::ComplexTextLayoutFlags::Default); +auto nLayoutFlags = vcl::text::ComplexTextLayoutFlags::Default; +if (bRTL) +{ +// For RTL formulas, we want the brackets to be mirrored. +nLayoutFlags |= vcl::text::ComplexTextLayoutFlags::BiDiRtl; +if (rDev.GetOutDevType() == OUTDEV_WINDOW) +nLayoutFlags |= vcl::text::ComplexTextLayoutFlags::TextOriginLeft; +} + +rDev.SetLayoutMode(nLayoutFlags); // Numbers should not be converted, for now. rDev.SetDigitLanguage( LANGUAGE_ENGLISH ); diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index cece754de276..732c27f9840f 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -438,7 +438,7 @@ void SmDrawingVisitor::Visit( SmRootSymbolNode* pNode ) tools::Rectangle aBar( aBarPos, Size( nBarWidth, nBarHeight ) ); -if (mrFormat.IsRightToLeft()) +if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aBar); //! avoid GROWING AND SHRINKING of drawn rectangle when constantly @@ -465,7 +465,7 @@ void SmDrawingVisitor::Visit( SmPolyLineNode* pNode ) + Point( nBorderwidth, nBorderwidth ) ), aPos ( maPosition + aOffset ); -if (mrFormat.IsRightToLeft()) +if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aPos); pNode->GetPolygon( ).Move( aPos.X( ), aPos.Y( ) );//Works because Polygon wraps a pointer @@ -497,7 +497,7 @@ void SmDrawingVisitor::Visit( SmRectangleNode* pNode ) SAL_WARN_IF( aTmp.IsEmpty(), "starmath", "Empty rectangle" ); -if (mrFormat.IsRightToLeft()) +if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aTmp); //! avoid GROWING AND SHRINKING of drawn rectangle when constantly @@ -521,7 +521,7 @@ void SmDrawingVisitor::DrawTextNode( SmTextNode* pNode ) Point aPos ( maPosition ); aPos.AdjustY(pNode->GetBaselineOffset( ) ); -if (mrFormat.IsRightToLeft()) +if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aPos); // round to pixel coordinate
[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/uiconfig
starmath/inc/cfgitem.hxx |2 starmath/inc/dialog.hxx |1 starmath/source/dialog.cxx |9 +++ starmath/source/unomodel.cxx | 12 + starmath/uiconfig/smath/ui/fonttypedialog.ui | 61 ++- 5 files changed, 73 insertions(+), 12 deletions(-) New commits: commit 900ce2fa32ae1726f64fc6959010650e93854ab3 Author: Khaled Hosny AuthorDate: Thu Aug 24 16:30:43 2023 +0300 Commit: خالد حسني CommitDate: Fri Aug 25 08:56:21 2023 +0200 tdf#101174: Add the ability to change math font in Math The math font (default is OpenSymbol) can now be changed from the fonts dialog like other fonts (variables, numbers, etc). Change-Id: I57f416173abf7bef8bb66b5e5e393dd928e30652 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156053 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index 607f92d4e1b0..c81e9d086aed 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -102,7 +102,7 @@ class SmMathConfig final : public utl::ConfigItem, public SfxBroadcaster std::unique_ptr pSymbolMgr; bool bIsOtherModified; bool bIsFormatModified; -SmFontPickList vFontPickList[7]; +SmFontPickList vFontPickList[8]; sal_Int32 m_nCommitLock = 0; SmMathConfig(const SmMathConfig&) = delete; diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index a595917d450d..f8fa5a9d66fa 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -131,6 +131,7 @@ class SmFontTypeDialog final : public weld::GenericDialogController { VclPtr pFontListDev; +std::unique_ptr m_xMathFont; std::unique_ptr m_xVariableFont; std::unique_ptr m_xFunctionFont; std::unique_ptr m_xNumberFont; diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 03bbc60da66a..7d8a837be77f 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -430,7 +430,9 @@ IMPL_LINK(SmFontTypeDialog, MenuSelectHdl, const OUString&, rIdent, void) SmFontPickListBox *pActiveListBox; bool bHideCheckboxes = false; -if (rIdent == "variables") +if (rIdent == "math") +pActiveListBox = m_xMathFont.get(); +else if (rIdent == "variables") pActiveListBox = m_xVariableFont.get(); else if (rIdent == "functions") pActiveListBox = m_xFunctionFont.get(); @@ -481,6 +483,7 @@ IMPL_LINK_NOARG(SmFontTypeDialog, DefaultButtonClickHdl, weld::Button&, void) SmFontTypeDialog::SmFontTypeDialog(weld::Window* pParent, OutputDevice *pFntListDevice) : GenericDialogController(pParent, "modules/smath/ui/fonttypedialog.ui", "FontsDialog") , pFontListDev(pFntListDevice) +, m_xMathFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("mathCB"))) , m_xVariableFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("variableCB"))) , m_xFunctionFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("functionCB"))) , m_xNumberFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("numberCB"))) @@ -503,6 +506,7 @@ void SmFontTypeDialog::ReadFrom(const SmFormat ) { SmModule *pp = SM_MOD(); +*m_xMathFont = pp->GetConfig()->GetFontPickList(FNT_MATH); *m_xVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE); *m_xFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION); *m_xNumberFont = pp->GetConfig()->GetFontPickList(FNT_NUMBER); @@ -511,6 +515,7 @@ void SmFontTypeDialog::ReadFrom(const SmFormat ) *m_xSansFont = pp->GetConfig()->GetFontPickList(FNT_SANS); *m_xFixedFont= pp->GetConfig()->GetFontPickList(FNT_FIXED); +m_xMathFont->Insert( rFormat.GetFont(FNT_MATH) ); m_xVariableFont->Insert( rFormat.GetFont(FNT_VARIABLE) ); m_xFunctionFont->Insert( rFormat.GetFont(FNT_FUNCTION) ); m_xNumberFont->Insert( rFormat.GetFont(FNT_NUMBER) ); @@ -525,6 +530,7 @@ void SmFontTypeDialog::WriteTo(SmFormat ) const { SmModule *pp = SM_MOD(); +pp->GetConfig()->GetFontPickList(FNT_MATH) = *m_xMathFont; pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = *m_xVariableFont; pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = *m_xFunctionFont; pp->GetConfig()->GetFontPickList(FNT_NUMBER) = *m_xNumberFont; @@ -533,6 +539,7 @@ void SmFontTypeDialog::WriteTo(SmFormat ) const pp->GetConfig()->GetFontPickList(FNT_SANS) = *m_xSansFont; pp->GetConfig()->GetFontPickList(FNT_FIXED)= *m_xFixedFont; +rFormat.SetFont( FNT_MATH, m_xMathFont->Get() ); rFormat.SetFont( FNT_VARIABLE, m_xVariableFont->Get() ); rFormat.SetFont( FNT_FUNCTION, m_xFunctionFont->Get() ); rFormat.SetFont( FNT_NUMBER, m_xNumberFont->Get() ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index f2f8abfb50e2..5857c3832579 100644 --- a/starmath/source/unomodel.cxx +++
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/helpids.h |1 + starmath/inc/view.hxx|3 +++ starmath/source/edit.cxx |6 ++ starmath/source/view.cxx | 14 ++ 4 files changed, 24 insertions(+) New commits: commit 1f10a5b5a04a9d0cd5f456293e62e4f2c0fd7bb3 Author: Rafael Lima AuthorDate: Thu Jul 20 20:39:31 2023 +0200 Commit: Rafael Lima CommitDate: Wed Jul 26 23:29:17 2023 +0200 tdf#149888 Make F1 work in Math initial state 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 diff --git a/starmath/inc/helpids.h b/starmath/inc/helpids.h index 195ccfb570a9..19325ebd2a16 100644 --- a/starmath/inc/helpids.h +++ b/starmath/inc/helpids.h @@ -21,6 +21,7 @@ #include +inline constexpr OUStringLiteral HID_SMA_MAIN_HELP = u"STARMATH_HID_SMA_MAIN_HELP"; inline constexpr OUStringLiteral HID_SMA_WIN_DOCUMENT = u"STARMATH_HID_SMA_WIN_DOCUMENT"; inline constexpr OUStringLiteral HID_SMA_COMMAND_WIN_EDIT = u"STARMATH_HID_SMA_COMMAND_WIN_EDIT"; diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index bef51e8560e0..dc42dde2fdc9 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -348,6 +348,9 @@ public: } static bool IsInlineEditEnabled(); +// Opens the main help page for the Math module +void StartMainHelp(); + private: void ZoomByItemSet(const SfxItemSet *pSet); }; diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 1eee64ad04c7..4cb4f6532f64 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -288,6 +288,12 @@ bool SmEditTextWindow::Command(const CommandEvent& rCEvt) bool SmEditTextWindow::KeyInput(const KeyEvent& rKEvt) { +if (rKEvt.GetKeyCode().GetCode() == KEY_F1) +{ +mrEditWindow.GetView()->StartMainHelp(); +return true; +} + if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) { bool bCallBase = true; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index a67745184e34..449dc0e586e7 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -700,6 +701,12 @@ bool CharInput(sal_uInt32 c, SmCursor& rCursor, OutputDevice& rDevice) bool SmGraphicWidget::KeyInput(const KeyEvent& rKEvt) { +if (rKEvt.GetKeyCode().GetCode() == KEY_F1) +{ +GetView().StartMainHelp(); +return true; +} + if (!SmViewShell::IsInlineEditEnabled()) return GetView().KeyInput(rKEvt); @@ -2329,6 +2336,13 @@ bool SmViewShell::IsInlineEditEnabled() || officecfg::Office::Common::Misc::ExperimentalMode::get(); } +void SmViewShell::StartMainHelp() +{ +Help* pHelp = Application::GetHelp(); +if (pHelp) +pHelp->Start(HID_SMA_MAIN_HELP, GetViewFrame().GetFrameWeld()); +} + void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet) { assert(pSet);
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx|2 ++ starmath/source/view.cxx | 29 - 2 files changed, 30 insertions(+), 1 deletion(-) New commits: commit 4368c4bf80b2751705c500f2574d9cc3d0ee13a1 Author: Povilas Kanapickas AuthorDate: Wed Dec 7 03:13:32 2022 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Dec 14 13:50:43 2022 + starmath: React to touchpad zoom gestures in SmGraphicWidget Change-Id: Id158d7778ec0c375c143cf9ce492af21b9625c9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143759 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 1905edb02741..41e28a44c3df 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -159,6 +159,8 @@ private: AutoTimer aCaretBlinkTimer; rtl::Reference mxAccessible; SmViewShell& mrViewShell; +double mfLastZoomScale = 0; +double mfAccumulatedZoom = 0; }; class SmGraphicController final : public SfxControllerItem diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 3c7c8b1554d3..bdc8b0729335 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -795,8 +795,35 @@ bool SmGraphicWidget::Command(const CommandEvent& rCEvt) mrGraphicWindow.SetZoom(nTmpZoom); bCallBase = false; } +break; +} +case CommandEventId::GestureZoom: +{ +const CommandGestureZoomData* pData = rCEvt.GetGestureZoomData(); +if (pData) +{ +if (pData->meEventType == GestureEventZoomType::Begin) +{ +mfLastZoomScale = pData->mfScaleDelta; +} +else if (pData->meEventType == GestureEventZoomType::Update) +{ +double deltaBetweenEvents = (pData->mfScaleDelta - mfLastZoomScale) / mfLastZoomScale; +mfLastZoomScale = pData->mfScaleDelta; + +// Accumulate fractional zoom to avoid small zoom changes from being ignored +mfAccumulatedZoom += deltaBetweenEvents; +int nZoomChangePercent = mfAccumulatedZoom * 100; +mfAccumulatedZoom -= nZoomChangePercent / 100.0; + +sal_uInt16 nZoom = mrGraphicWindow.GetZoom(); +nZoom += nZoomChangePercent; +mrGraphicWindow.SetZoom(nZoom); +} +bCallBase = false; +} +break; } -break; default: break; }
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cursor.hxx |3 ++- starmath/inc/visitors.hxx| 25 + starmath/source/cursor.cxx |8 +++- starmath/source/view.cxx | 24 +++- starmath/source/visitors.cxx | 42 +++--- 5 files changed, 68 insertions(+), 34 deletions(-) New commits: commit 1b1a066b935158dc029939520c8fe70b029cb311 Author: Mike Kaganski AuthorDate: Sat Nov 5 21:16:29 2022 +0300 Commit: Mike Kaganski CommitDate: Sat Nov 5 23:37:35 2022 +0100 lok: show Math selection Change-Id: I950ae3e5fb000d6acec4c26ff143b918a4e48a27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142342 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index a1491c5decfe..0a8a35071f10 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -187,6 +187,7 @@ public: void Draw(OutputDevice& pDev, Point Offset, bool isCaretVisible); tools::Rectangle GetCaretRectangle(OutputDevice& rOutDev) const; +tools::Rectangle GetSelectionRectangle(OutputDevice& rOutDev) const; bool IsAtTailOfBracket(SmBracketType eBracketType) const; @@ -275,7 +276,7 @@ private: bool SetCaretPosition(SmCaretPos pos); /** Set selected on nodes of the tree */ -void AnnotateSelection(); +void AnnotateSelection() const; /** Clone list of nodes in a clipboard (creates a deep clone) */ static std::unique_ptr CloneList(SmClipboard& rClipboard); diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index b29bb26fb5b0..eaf329034c7d 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -424,31 +424,40 @@ private: }; -// SmSelectionDrawingVisitor +// SmSelectionRectanglesVisitor: collect selection -class SmSelectionDrawingVisitor final : public SmDefaultingVisitor +class SmSelectionRectanglesVisitor : public SmDefaultingVisitor { public: -/** Draws a selection on rDevice for the selection on pTree */ -SmSelectionDrawingVisitor( OutputDevice& rDevice, SmNode* pTree, const Point& rOffset ); -virtual ~SmSelectionDrawingVisitor() {} +SmSelectionRectanglesVisitor(OutputDevice& rDevice, SmNode* pTree); +virtual ~SmSelectionRectanglesVisitor() = default; void Visit( SmTextNode* pNode ) override; using SmDefaultingVisitor::Visit; + +const tools::Rectangle& GetSelection() { return maSelectionArea; } + private: /** Reference to drawing device */ OutputDevice& mrDev; -/** True if aSelectionArea have been initialized */ -bool mbHasSelectionArea; /** The current area that is selected */ tools::Rectangle maSelectionArea; /** Extend the area that must be selected */ -void ExtendSelectionArea(const tools::Rectangle& rArea); +void ExtendSelectionArea(const tools::Rectangle& rArea) { maSelectionArea.Union(rArea); } /** Default visiting method */ void DefaultVisit( SmNode* pNode ) override; /** Visit the children of a given pNode */ void VisitChildren( SmNode* pNode ); }; +// SmSelectionDrawingVisitor + +class SmSelectionDrawingVisitor final : public SmSelectionRectanglesVisitor +{ +public: +/** Draws a selection on rDevice for the selection on pTree */ +SmSelectionDrawingVisitor( OutputDevice& rDevice, SmNode* pTree, const Point& rOffset ); +}; + // SmNodeToTextVisitor /** Extract command text from pNodes */ diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index f6d93b8f11cf..c7c27616b3f9 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -165,7 +165,7 @@ bool SmCursor::SetCaretPosition(SmCaretPos pos){ return false; } -void SmCursor::AnnotateSelection(){ +void SmCursor::AnnotateSelection() const { //TODO: Manage a state, reset it upon modification and optimize this call SmSetSelectionVisitor(mpAnchor->CaretPos, mpPosition->CaretPos, mpTree); } @@ -179,6 +179,12 @@ tools::Rectangle SmCursor::GetCaretRectangle(OutputDevice& rOutDev) const return SmCaretRectanglesVisitor(rOutDev, GetPosition()).getCaret(); } +tools::Rectangle SmCursor::GetSelectionRectangle(OutputDevice& rOutDev) const +{ +AnnotateSelection(); +return SmSelectionRectanglesVisitor(rOutDev, mpTree).GetSelection(); +} + void SmCursor::DeletePrev(OutputDevice* pDev){ //Delete only a selection if there's a selection if(HasSelection()){ diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 95a175081737..1bcfc0d3efc7 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2324,10 +2324,28 @@ std::optional SmViewShell::getLOKPayload(int nType, int nViewId) const } return SfxLokHelper::makeVisCursorInvalidation(nViewId, sRectangle, false, {}); } -case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR: case LOK_CALLBACK_TEXT_SELECTION: +{ +OString
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/utility.hxx | 13 +++ starmath/source/ElementsDockingWindow.cxx |2 - starmath/source/cfgitem.cxx |4 +- starmath/source/dialog.cxx|4 +- starmath/source/document.cxx | 26 --- starmath/source/format.cxx|2 - starmath/source/mathml/mathmlexport.cxx |2 - starmath/source/node.cxx |6 +-- starmath/source/tmpdevice.cxx |6 ++- starmath/source/unomodel.cxx | 10 +++--- starmath/source/utility.cxx |2 - starmath/source/view.cxx | 49 +- 12 files changed, 76 insertions(+), 50 deletions(-) New commits: commit 4d493db529600c3ae39b39da0c708c36d679a76b Author: Mike Kaganski AuthorDate: Wed Nov 2 11:03:08 2022 +0300 Commit: Mike Kaganski CommitDate: Fri Nov 4 19:01:48 2022 +0100 lok: use twips in Math Change-Id: I11acd281da64b0023d74b3bc02e0f54864b94da9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142275 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index c0b473264532..a05578a53647 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -21,10 +21,13 @@ #include +#include +#include #include #include #include #include +#include #include @@ -113,4 +116,14 @@ public: virtual voidInsert(const vcl::Font ) override; }; +// Math uses 100ths of MM by default, but lok needs twips everywhere +inline MapUnit SmMapUnit() +{ +return comphelper::LibreOfficeKit::isActive() ? MapUnit::MapTwip : MapUnit::Map100thMM; +} +inline o3tl::Length SmO3tlLengthUnit() +{ +return comphelper::LibreOfficeKit::isActive() ? o3tl::Length::twip : o3tl::Length::mm100; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 0444db4ba42a..e768726eada5 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -497,7 +497,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin { std::unique_ptr pNode = maParser->ParseExpression(aElementVisual); VclPtr pDevice(mpIconView->create_virtual_device()); -pDevice->SetMapMode(MapMode(MapUnit::Map100thMM)); +pDevice->SetMapMode(MapMode(SmMapUnit())); pDevice->SetDrawMode(DrawModeFlags::Default); pDevice->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default); pDevice->SetDigitLanguage(LANGUAGE_ENGLISH); diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 9b6a4eadd184..3bf170c0afe4 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -988,7 +988,7 @@ void SmMathConfig::LoadFormat() ++pVal; // StandardFormat/BaseSize if (pVal->hasValue() && (*pVal >>= nTmp16)) -pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, o3tl::Length::mm100))); +pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, SmO3tlLengthUnit(; ++pVal; sal_uInt16 i; @@ -1060,7 +1060,7 @@ void SmMathConfig::SaveFormat() *pValue++ <<= static_cast(pFormat->GetHorAlign()); // StandardFormat/BaseSize *pValue++ <<= static_cast( -o3tl::convert(pFormat->GetBaseSize().Height(), o3tl::Length::mm100, o3tl::Length::pt)); +o3tl::convert(pFormat->GetBaseSize().Height(), SmO3tlLengthUnit(), o3tl::Length::pt)); sal_uInt16 i; for (i = SIZ_BEGIN; i <= SIZ_END; ++i) diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index f700b8e6ce9a..2aedbae19d05 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -393,7 +393,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat ) { //! watch out: round properly! m_xBaseSize->set_value( -o3tl::convert(rFormat.GetBaseSize().Height(), o3tl::Length::mm100, o3tl::Length::pt), +o3tl::convert(rFormat.GetBaseSize().Height(), SmO3tlLengthUnit(), o3tl::Length::pt), FieldUnit::NONE); m_xTextSize->set_value( rFormat.GetRelSize(SIZ_TEXT), FieldUnit::NONE ); @@ -405,7 +405,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat ) void SmFontSizeDialog::WriteTo(SmFormat ) const { -rFormat.SetBaseSize( Size(0, o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, o3tl::Length::mm100)) ); +rFormat.SetBaseSize( Size(0, o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, SmO3tlLengthUnit())) ); rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast(m_xTextSize->get_value(FieldUnit::NONE))); rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast(m_xIndexSize->get_value(FieldUnit::NONE))); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index d13cd8218055..b6d0c7193e5f
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/utility.hxx| 29 - starmath/source/cfgitem.cxx |6 +++--- starmath/source/dialog.cxx |7 --- starmath/source/format.cxx |2 +- starmath/source/mathml/mathmlexport.cxx | 14 +++--- starmath/source/node.cxx|6 +++--- starmath/source/unomodel.cxx|7 +++ starmath/source/utility.cxx |2 +- 8 files changed, 22 insertions(+), 51 deletions(-) New commits: commit a37a979107a8643136ff3733b5b350b6b1be2bb7 Author: Mike Kaganski AuthorDate: Thu Nov 3 21:36:26 2022 +0200 Commit: Mike Kaganski CommitDate: Fri Nov 4 05:32:27 2022 +0100 Use o3tl::convert in Math ... and use our standard definition of pt. Change-Id: I5a162b137360210335b84de33606dc7404cfc2de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142204 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index ee504017038a..c0b473264532 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -27,35 +27,6 @@ #include #include -inline tools::Long SmPtsTo100th_mm(tools::Long nNumPts) -// returns the length (in 100th of mm) that corresponds to the length -// 'nNumPts' (in units points). -// 72.27 [pt] = 1 [inch] = 2,54 [cm] = 2540 [100th of mm]. -// result is being rounded to the nearest integer. -{ -SAL_WARN_IF( nNumPts < 0, "starmath", "Ooops..." ); -// broken into multiple and fraction of 'nNumPts' to reduce chance -// of overflow -// (7227 / 2) is added in order to round to the nearest integer -return 35 * nNumPts + (nNumPts * 1055L + (7227 / 2)) / 7227L; -} - - -inline Fraction Sm100th_mmToPts(tools::Long nNum100th_mm) -// returns the length (in points) that corresponds to the length -// 'nNum100th_mm' (in 100th of mm). -{ -SAL_WARN_IF( nNum100th_mm < 0, "starmath", "Ooops..." ); -return Fraction(7227L, 254000L) * Fraction(nNum100th_mm); -} - - -inline tools::Long SmRoundFraction(const Fraction ) -{ -SAL_WARN_IF( rFrac <= Fraction(), "starmath", "Ooops..." ); -return (rFrac.GetNumerator() + rFrac.GetDenominator() / 2) / rFrac.GetDenominator(); -} - class SmViewShell; SmViewShell * SmGetActiveView(); diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index a8c0e5fcae38..9b6a4eadd184 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -988,7 +988,7 @@ void SmMathConfig::LoadFormat() ++pVal; // StandardFormat/BaseSize if (pVal->hasValue() && (*pVal >>= nTmp16)) -pFormat->SetBaseSize( Size(0, SmPtsTo100th_mm( nTmp16 )) ); +pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, o3tl::Length::mm100))); ++pVal; sal_uInt16 i; @@ -1059,8 +1059,8 @@ void SmMathConfig::SaveFormat() // StandardFormat/HorizontalAlignment *pValue++ <<= static_cast(pFormat->GetHorAlign()); // StandardFormat/BaseSize -*pValue++ <<= static_cast(SmRoundFraction( Sm100th_mmToPts( -pFormat->GetBaseSize().Height() ) )); +*pValue++ <<= static_cast( +o3tl::convert(pFormat->GetBaseSize().Height(), o3tl::Length::mm100, o3tl::Length::pt)); sal_uInt16 i; for (i = SIZ_BEGIN; i <= SIZ_END; ++i) diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 043739cf5c0d..f700b8e6ce9a 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -392,8 +392,9 @@ SmFontSizeDialog::~SmFontSizeDialog() void SmFontSizeDialog::ReadFrom(const SmFormat ) { //! watch out: round properly! -m_xBaseSize->set_value( SmRoundFraction( -Sm100th_mmToPts( rFormat.GetBaseSize().Height() ) ), FieldUnit::NONE ); +m_xBaseSize->set_value( +o3tl::convert(rFormat.GetBaseSize().Height(), o3tl::Length::mm100, o3tl::Length::pt), +FieldUnit::NONE); m_xTextSize->set_value( rFormat.GetRelSize(SIZ_TEXT), FieldUnit::NONE ); m_xIndexSize->set_value( rFormat.GetRelSize(SIZ_INDEX), FieldUnit::NONE ); @@ -404,7 +405,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat ) void SmFontSizeDialog::WriteTo(SmFormat ) const { -rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< tools::Long >(m_xBaseSize->get_value(FieldUnit::NONE ); +rFormat.SetBaseSize( Size(0, o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, o3tl::Length::mm100)) ); rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast(m_xTextSize->get_value(FieldUnit::NONE))); rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast(m_xIndexSize->get_value(FieldUnit::NONE))); diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx index 65ec09558d56..f1f7a00f3806 100644 --- a/starmath/source/format.cxx +++ b/starmath/source/format.cxx @@ -21,7 +21,7 @@ SmFormat::SmFormat() -: aBaseSize(0,
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/parse5.hxx|2 +- starmath/source/node.cxx |6 +++--- starmath/source/parse5.cxx |6 +++--- starmath/source/rect.cxx |8 4 files changed, 11 insertions(+), 11 deletions(-) New commits: commit 9ec9ace3f010dc654ac831cf66d9589a16b07931 Author: Noel Grandin AuthorDate: Fri Sep 30 09:06:25 2022 +0200 Commit: Noel Grandin CommitDate: Fri Sep 30 10:47:56 2022 +0200 use more string_view in starmath Change-Id: I3569d8dd41bf1c2db6a1fd379ca5596342922e45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140786 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse5.hxx b/starmath/inc/parse5.hxx index 5b72378676ee..92fc2a02917b 100644 --- a/starmath/inc/parse5.hxx +++ b/starmath/inc/parse5.hxx @@ -55,7 +55,7 @@ class SmParser5 final : public AbstractSmParser void NextTokenColor(SmTokenType dvipload); void NextTokenFontSize(); sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } -void Replace(sal_Int32 nPos, sal_Int32 nLen, const OUString& rText); +void Replace(sal_Int32 nPos, sal_Int32 nLen, std::u16string_view aText); inline bool TokenInGroup(TG nGroup); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 008ea0d3cc7d..421c9e03955e 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2162,14 +2162,14 @@ void SmMathSymbolNode::Arrange(OutputDevice , const SmFormat ) /**/ -static bool lcl_IsFromGreekSymbolSet( const OUString ) +static bool lcl_IsFromGreekSymbolSet( std::u16string_view aTokenText ) { bool bRes = false; // valid symbol name needs to have a '%' at pos 0 and at least an additional char -if (rTokenText.getLength() > 2 && rTokenText[0] == u'%') +if (aTokenText.size() > 2 && aTokenText[0] == u'%') { -OUString aName( rTokenText.copy(1) ); +OUString aName( aTokenText.substr(1) ); SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName ); if (pSymbol && SmLocalizedSymbolData::GetExportSymbolSetName(pSymbol->GetSymbolSetName()) == "Greek") bRes = true; diff --git a/starmath/source/parse5.cxx b/starmath/source/parse5.cxx index 06aa373aa037..13f3701db26a 100644 --- a/starmath/source/parse5.cxx +++ b/starmath/source/parse5.cxx @@ -374,12 +374,12 @@ static bool lcl_IsNotWholeNumber16(const OUString& rText) } //Text replace onto m_aBufferString -void SmParser5::Replace(sal_Int32 nPos, sal_Int32 nLen, const OUString& rText) +void SmParser5::Replace(sal_Int32 nPos, sal_Int32 nLen, std::u16string_view aText) { assert(nPos + nLen <= m_aBufferString.getLength()); //checks if length allows text replace -m_aBufferString = m_aBufferString.replaceAt(nPos, nLen, rText); //replace and reindex -sal_Int32 nChg = rText.getLength() - nLen; +m_aBufferString = m_aBufferString.replaceAt(nPos, nLen, aText); //replace and reindex +sal_Int32 nChg = aText.size() - nLen; m_nBufferIndex = m_nBufferIndex + nChg; m_nTokenIndex = m_nTokenIndex + nChg; } diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index e7b761a46729..807ab7d0c0fc 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -108,7 +108,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext , return bSuccess; } -bool SmIsMathAlpha(const OUString ) +bool SmIsMathAlpha(std::u16string_view aText) // true iff symbol (from StarMath Font) should be treated as letter { // Set of symbols, which should be treated as letters in StarMath Font @@ -125,11 +125,11 @@ bool SmIsMathAlpha(const OUString ) u'\x2130', u'\x2131' }); -if (rText.isEmpty()) +if (aText.empty()) return false; -OSL_ENSURE(rText.getLength() == 1, "Sm : string must be exactly one character long"); -sal_Unicode cChar = rText[0]; +OSL_ENSURE(aText.size() == 1, "Sm : string must be exactly one character long"); +sal_Unicode cChar = aText[0]; // is it a greek symbol? if (u'\xE0AC' <= cChar && cChar <= u'\xE0D4')
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx|6 +++--- starmath/source/view.cxx |8 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) New commits: commit 895d6716ba8f12d98e3685145d433fce72270faa Author: Caolán McNamara AuthorDate: Mon Aug 15 11:57:57 2022 +0100 Commit: Caolán McNamara CommitDate: Mon Aug 15 15:09:30 2022 +0200 Resolves: tdf#149858 embedded starmath not using correct initial zoom 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 diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 555beca74c2d..45df0f425574 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -53,9 +53,6 @@ private: DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); -void SetGraphicMapMode(const MapMode& rNewMapMode); -MapMode GetGraphicMapMode() const; - public: explicit SmGraphicWindow(SmViewShell& rShell); virtual void dispose() override; @@ -74,6 +71,9 @@ public: virtual void Resize() override; void ShowContextMenu(const CommandEvent& rCEvt); +void SetGraphicMapMode(const MapMode& rNewMapMode); +MapMode GetGraphicMapMode() const; + SmGraphicWidget& GetGraphicWidget() { return *mxGraphic; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 71dd3bc53946..39676971a93f 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1100,8 +1100,12 @@ void SmViewShell::InnerResizePixel(const Point , const Size , bool) if ( !aObjSize.IsEmpty() ) { Size aProvidedSize = GetWindow()->PixelToLogic(rSize, MapMode(MapUnit::Map100thMM)); -SfxViewShell::SetZoomFactor( Fraction( aProvidedSize.Width(), aObjSize.Width() ), -Fraction( aProvidedSize.Height(), aObjSize.Height() ) ); +Fraction aZoomX(aProvidedSize.Width(), aObjSize.Width()); +Fraction aZoomY(aProvidedSize.Height(), aObjSize.Height()); +MapMode aMap(mxGraphicWindow->GetGraphicMapMode()); +aMap.SetScaleX(aZoomX); +aMap.SetScaleY(aZoomY); +mxGraphicWindow->SetGraphicMapMode(aMap); } SetBorderPixel( SvBorder() );
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cfgitem.hxx |2 +- starmath/inc/mathml/export.hxx|5 +++-- starmath/inc/mathml/import.hxx|5 +++-- starmath/inc/mathml/mathmlMo.hxx |3 ++- starmath/inc/mathml/mathmlexport.hxx |5 +++-- starmath/inc/mathml/mathmlimport.hxx |5 +++-- starmath/inc/node.hxx |2 +- starmath/inc/parsebase.hxx|3 ++- starmath/inc/token.hxx| 15 --- starmath/source/ElementsDockingWindow.cxx |1 + starmath/source/cfgitem.cxx |7 --- starmath/source/node.cxx |5 +++-- 12 files changed, 34 insertions(+), 24 deletions(-) New commits: commit 057c60192aa34ae42f9f8abc2cb0ec93caa79130 Author: Noel Grandin AuthorDate: Fri Aug 5 10:43:59 2022 +0200 Commit: Noel Grandin CommitDate: Fri Aug 5 15:56:52 2022 +0200 clang-tidy modernize-pass-by-value in starmath Change-Id: Ib6bd1ed629980d4ff122114bc45396886c94ab78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137842 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index 16c65fd7f58f..607f92d4e1b0 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -64,7 +64,7 @@ struct SmFntFmtListEntry OUString aId; SmFontFormat aFntFmt; -SmFntFmtListEntry(const OUString& rId, const SmFontFormat& rFntFmt); +SmFntFmtListEntry(OUString aId, SmFontFormat rFntFmt); }; class SmFontFormatList diff --git a/starmath/inc/mathml/export.hxx b/starmath/inc/mathml/export.hxx index 0bd83e6ef238..12e541d31551 100644 --- a/starmath/inc/mathml/export.hxx +++ b/starmath/inc/mathml/export.hxx @@ -23,6 +23,7 @@ #include "element.hxx" // Xml tools +#include #include #include #include @@ -76,8 +77,8 @@ public: void setUseExportTag(bool bUseExportTag) { m_bUseExportTag = bUseExportTag; } public: -explicit SmMLExportWrapper(css::uno::Reference const& rRef) -: m_xModel(rRef) +explicit SmMLExportWrapper(css::uno::Reference xRef) +: m_xModel(std::move(xRef)) , m_bFlat(true) , m_bUseHTMLMLEntities(false) , m_pElementTree(nullptr) diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx index d98cc8cf4b66..29bd01bf0ed0 100644 --- a/starmath/inc/mathml/import.hxx +++ b/starmath/inc/mathml/import.hxx @@ -13,6 +13,7 @@ #include "element.hxx" // XML tools +#include #include #include @@ -39,8 +40,8 @@ public: public: /** Constructor */ -explicit SmMLImportWrapper(css::uno::Reference const& rRef) -: m_xModel(rRef) +explicit SmMLImportWrapper(css::uno::Reference xRef) +: m_xModel(std::move(xRef)) , m_pDocShell(nullptr) , m_pMlImport(nullptr) { diff --git a/starmath/inc/mathml/mathmlMo.hxx b/starmath/inc/mathml/mathmlMo.hxx index 10a8b00014f5..e6457fd459c6 100644 --- a/starmath/inc/mathml/mathmlMo.hxx +++ b/starmath/inc/mathml/mathmlMo.hxx @@ -28,6 +28,7 @@ #include #include +#include #include // https://www.w3.org/TR/MathML3/appendixc.html @@ -69,7 +70,7 @@ struct moOperatorData moOperatorData(OUString motxt, moOpDF form, sal_uInt16 priority, sal_uInt16 lspace, sal_uInt16 rspace, moOpDP properties) -: m_motxt(motxt) +: m_motxt(std::move(motxt)) , m_form(form) , m_priority(priority) , m_lspace(lspace) diff --git a/starmath/inc/mathml/mathmlexport.hxx b/starmath/inc/mathml/mathmlexport.hxx index b7c054440c8a..28e35a7c52a0 100644 --- a/starmath/inc/mathml/mathmlexport.hxx +++ b/starmath/inc/mathml/mathmlexport.hxx @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -48,8 +49,8 @@ private: bool m_bUseHTMLMLEntities; public: -explicit SmXMLExportWrapper(css::uno::Reference const& rRef) -: xModel(rRef) +explicit SmXMLExportWrapper(css::uno::Reference xRef) +: xModel(std::move(xRef)) , bFlat(true) , m_bUseHTMLMLEntities(false) { diff --git a/starmath/inc/mathml/mathmlimport.hxx b/starmath/inc/mathml/mathmlimport.hxx index 0a963a1b01d3..8e524f82b7a6 100644 --- a/starmath/inc/mathml/mathmlimport.hxx +++ b/starmath/inc/mathml/mathmlimport.hxx @@ -19,6 +19,7 @@ #pragma once +#include #include #include @@ -45,8 +46,8 @@ private: bool m_bUseHTMLMLEntities; public: -explicit SmXMLImportWrapper(css::uno::Reference const& rRef) -: xModel(rRef) +explicit SmXMLImportWrapper(css::uno::Reference xRef) +: xModel(std::move(xRef)) , m_bUseHTMLMLEntities(false) { } diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 0a8a6c369065..69cc0a323ce9 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -140,7 +140,7 @@ class SmNode : public SmRect sal_Int32 mnAccIndex; protected: -
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx| 13 ++- starmath/source/view.cxx | 169 ++- 2 files changed, 91 insertions(+), 91 deletions(-) New commits: commit 493b62c6805125b7f3ebfbd2b4b73a7d49aa0f67 Author: Mike Kaganski AuthorDate: Mon Jul 25 11:53:26 2022 +0300 Commit: Mike Kaganski CommitDate: Mon Jul 25 15:20:23 2022 +0200 Some refactor Change-Id: I58f315e39e33a09585d6325590998ac8195687db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137401 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 295b029457b7..555beca74c2d 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -113,10 +113,9 @@ public: void SetTotalSize(); -SmViewShell& GetView() -{ -return mrViewShell; -} +SmViewShell& GetView() { return mrViewShell; } +SmDocShell* GetDoc(); +SmCursor& GetCursor(); const Point& GetFormulaDrawPos() const { @@ -131,6 +130,12 @@ public: return mxAccessible.get(); } +OutputDevice& GetOutputDevice() +{ +assert(GetDrawingArea()); +return GetDrawingArea()->get_ref_device(); +} + private: void SetIsCursorVisible(bool bVis) { diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index e87b27ccb958..ebbf0bcea2e6 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -249,7 +249,7 @@ IMPL_LINK_NOARG(SmGraphicWindow, ScrollHdl, weld::ScrolledWindow&, void) void SmGraphicWindow::SetGraphicMapMode(const MapMode& rNewMapMode) { -OutputDevice& rDevice = mxGraphic->GetDrawingArea()->get_ref_device(); +OutputDevice& rDevice = mxGraphic->GetOutputDevice(); MapMode aMap( rNewMapMode ); aMap.SetOrigin( aMap.GetOrigin() + rDevice.PixelToLogic( aPixOffset, aMap ) ); rDevice.SetMapMode( aMap ); @@ -258,7 +258,7 @@ void SmGraphicWindow::SetGraphicMapMode(const MapMode& rNewMapMode) MapMode SmGraphicWindow::GetGraphicMapMode() const { -OutputDevice& rDevice = mxGraphic->GetDrawingArea()->get_ref_device(); +OutputDevice& rDevice = mxGraphic->GetOutputDevice(); MapMode aMap(rDevice.GetMapMode()); aMap.SetOrigin( aMap.GetOrigin() - rDevice.PixelToLogic( aPixOffset ) ); return aMap; @@ -266,15 +266,13 @@ MapMode SmGraphicWindow::GetGraphicMapMode() const void SmGraphicWindow::SetTotalSize( const Size& rNewSize ) { -OutputDevice& rDevice = mxGraphic->GetDrawingArea()->get_ref_device(); -aTotPixSz = rDevice.LogicToPixel(rNewSize); +aTotPixSz = mxGraphic->GetOutputDevice().LogicToPixel(rNewSize); Resize(); } Size SmGraphicWindow::GetTotalSize() const { -OutputDevice& rDevice = mxGraphic->GetDrawingArea()->get_ref_device(); -return rDevice.PixelToLogic(aTotPixSz); +return mxGraphic->GetOutputDevice().PixelToLogic(aTotPixSz); } void SmGraphicWindow::ShowContextMenu(const CommandEvent& rCEvt) @@ -301,7 +299,7 @@ void SmGraphicWidget::SetDrawingArea(weld::DrawingArea* pDrawingArea) { weld::CustomWidgetController::SetDrawingArea(pDrawingArea); -OutputDevice& rDevice = pDrawingArea->get_ref_device(); +OutputDevice& rDevice = GetOutputDevice(); rDevice.SetBackground(SM_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor); @@ -324,6 +322,14 @@ SmGraphicWidget::~SmGraphicWidget() CaretBlinkStop(); } +SmDocShell* SmGraphicWidget::GetDoc() { return GetView().GetDoc(); } + +SmCursor& SmGraphicWidget::GetCursor() +{ +assert(GetDoc()); +return GetDoc()->GetCursor(); +} + bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) { GrabFocus(); @@ -335,16 +341,16 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) if ( !rMEvt.IsLeft() ) return true; -OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); +OutputDevice& rDevice = GetOutputDevice(); // get click position relative to formula Point aPos(rDevice.PixelToLogic(rMEvt.GetPosPixel()) - GetFormulaDrawPos()); -const SmNode *pTree = mrViewShell.GetDoc()->GetFormulaTree(); +const SmNode *pTree = GetDoc()->GetFormulaTree(); if (!pTree) return true; if (SmViewShell::IsInlineEditEnabled()) { -mrViewShell.GetDoc()->GetCursor().MoveTo(, aPos, !rMEvt.IsShift()); +GetCursor().MoveTo(, aPos, !rMEvt.IsShift()); return true; } const SmNode *pNode = nullptr; @@ -355,7 +361,7 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) if (!pNode) return true; -SmEditWindow* pEdit = mrViewShell.GetEditWindow(); +SmEditWindow* pEdit = GetView().GetEditWindow(); if (!pEdit) return true; @@ -374,9 +380,9 @@ bool SmGraphicWidget::MouseMove(const MouseEvent ) { if (rMEvt.IsLeft() && SmViewShell::IsInlineEditEnabled()) { -OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|6 +++--- starmath/source/ElementsDockingWindow.cxx |7 +-- 2 files changed, 8 insertions(+), 5 deletions(-) New commits: commit 5d41aca772cb9c4afd92ad408c66bd9642bb3952 Author: Caolán McNamara AuthorDate: Sun Jun 19 12:38:51 2022 +0100 Commit: Caolán McNamara CommitDate: Sun Jun 19 16:56:13 2022 +0200 cid#1506514 Uninitialized scalar field Change-Id: I777d9008289b2afb464d1002e8be32072c0a4501 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136099 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 70ee4fafddc2..589694779f8d 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -40,7 +40,7 @@ class SmElementsControl SmDocShell* mpDocShell; SmFormat maFormat; -size_tmnCurrentSetIndex; +int mnCurrentSetIndex; sal_uInt16m_nSmSyntaxVersion; bool mbVerticalMode; @@ -50,7 +50,7 @@ class SmElementsControl Link maSelectHdlLink; void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); -void addElements(size_t nCategory); +void addElements(int nCategory); void build(); @@ -66,7 +66,7 @@ public: ~SmElementsControl(); static const std::vector& categories(); -void setElementSetIndex(size_t nSetIndex); +void setElementSetIndex(int nSetIndex); void setVerticalMode(bool bVertical); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 4ded72c08f2c..b946cea28949 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -454,6 +454,7 @@ const std::vector& SmElementsControl::categories() SmElementsControl::SmElementsControl(std::unique_ptr pIconView) : mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT)) +, mnCurrentSetIndex(-1) , m_nSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion()) , mbVerticalMode(true) , mpIconView(std::move(pIconView)) @@ -540,7 +541,7 @@ OUString SmElementsControl::GetElementHelpText(const OUString& itemId) return weld::fromId(itemId)->maHelpText; } -void SmElementsControl::setElementSetIndex(size_t nSetIndex) +void SmElementsControl::setElementSetIndex(int nSetIndex) { if (mnCurrentSetIndex == nSetIndex) return; @@ -548,13 +549,15 @@ void SmElementsControl::setElementSetIndex(size_t nSetIndex) build(); } -void SmElementsControl::addElements(size_t nCategory) +void SmElementsControl::addElements(int nCategory) { mpIconView->freeze(); mpIconView->clear(); mpIconView->set_item_width(0); maItemDatas.clear(); +assert(nCategory >= 0 && o3tl::make_unsigned(nCategory) < s_a5CategoryDescriptions.size()); + const auto& [aElementsArray, aElementsArraySize] = s_a5CategoryDescriptions[nCategory]; for (size_t i = 0; i < aElementsArraySize; i++)
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|6 +-- starmath/source/ElementsDockingWindow.cxx | 56 -- starmath/source/SmElementsPanel.cxx | 22 --- 3 files changed, 34 insertions(+), 50 deletions(-) New commits: commit 9a48563e33e54a04932ebf0ef195e7a0d2d1aa67 Author: Caolán McNamara AuthorDate: Sat Jun 18 15:45:21 2022 +0100 Commit: Caolán McNamara CommitDate: Sat Jun 18 18:05:31 2022 +0200 cid#1504663 workaround Resource leak in object and cid#1504667 Resource leak in object take a simpler approach over an unordered_map Change-Id: Ie0736dcb0c8e7cdcd3b4b6bd303642841b590bf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136087 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 5d6a0bd3dfc7..70ee4fafddc2 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -40,7 +40,7 @@ class SmElementsControl SmDocShell* mpDocShell; SmFormat maFormat; -TranslateId msCurrentSetId; +size_tmnCurrentSetIndex; sal_uInt16m_nSmSyntaxVersion; bool mbVerticalMode; @@ -50,7 +50,7 @@ class SmElementsControl Link maSelectHdlLink; void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); -void addElements(const TranslateId& rCategory); +void addElements(size_t nCategory); void build(); @@ -66,7 +66,7 @@ public: ~SmElementsControl(); static const std::vector& categories(); -void setElementSetId(TranslateId pSetId); +void setElementSetIndex(size_t nSetIndex); void setVerticalMode(bool bVertical); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index aab82cac3f11..4ded72c08f2c 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -431,23 +431,19 @@ constexpr std::pair asPair(const SmElementDescr ( return { category, N }; } -struct TranslateId_hash -{ -size_t operator()(const TranslateId& val) const { return std::hash()(val.mpId); } +const std::vector> s_a5CategoryDescriptions{ +{ asPair(s_a5UnaryBinaryOperatorsList) }, +{ asPair(s_a5RelationsList) }, +{ asPair(s_a5SetOperationsList) }, +{ asPair(s_a5FunctionsList) }, +{ asPair(s_a5OperatorsList) }, +{ asPair(s_a5AttributesList) }, +{ asPair(s_a5BracketsList) }, +{ asPair(s_a5FormatsList) }, +{ asPair(s_a5OthersList) }, +{ asPair(s_a5ExamplesList) }, }; -const std::unordered_map, TranslateId_hash> s_a5CategoryDescriptions{ -{ RID_CATEGORY_UNARY_BINARY_OPERATORS, asPair(s_a5UnaryBinaryOperatorsList) }, -{ RID_CATEGORY_RELATIONS, asPair(s_a5RelationsList) }, -{ RID_CATEGORY_SET_OPERATIONS, asPair(s_a5SetOperationsList) }, -{ RID_CATEGORY_FUNCTIONS, asPair(s_a5FunctionsList) }, -{ RID_CATEGORY_OPERATORS, asPair(s_a5OperatorsList) }, -{ RID_CATEGORY_ATTRIBUTES, asPair(s_a5AttributesList) }, -{ RID_CATEGORY_BRACKETS, asPair(s_a5BracketsList) }, -{ RID_CATEGORY_FORMATS, asPair(s_a5FormatsList) }, -{ RID_CATEGORY_OTHERS, asPair(s_a5OthersList) }, -{ RID_CATEGORY_EXAMPLES, asPair(s_a5ExamplesList) }, -}; } // namespace // static @@ -544,22 +540,22 @@ OUString SmElementsControl::GetElementHelpText(const OUString& itemId) return weld::fromId(itemId)->maHelpText; } -void SmElementsControl::setElementSetId(TranslateId pSetId) +void SmElementsControl::setElementSetIndex(size_t nSetIndex) { -if (msCurrentSetId == pSetId) +if (mnCurrentSetIndex == nSetIndex) return; -msCurrentSetId = pSetId; +mnCurrentSetIndex = nSetIndex; build(); } -void SmElementsControl::addElements(const TranslateId& rCategory) +void SmElementsControl::addElements(size_t nCategory) { mpIconView->freeze(); mpIconView->clear(); mpIconView->set_item_width(0); maItemDatas.clear(); -const auto& [aElementsArray, aElementsArraySize] = s_a5CategoryDescriptions.at(rCategory); +const auto& [aElementsArray, aElementsArraySize] = s_a5CategoryDescriptions[nCategory]; for (size_t i = 0; i < aElementsArraySize; i++) { @@ -588,7 +584,7 @@ void SmElementsControl::build() switch(m_nSmSyntaxVersion) { case 5: -addElements(msCurrentSetId); +addElements(mnCurrentSetIndex); break; case 6: default: @@ -637,9 +633,9 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf mxElementListBox->append_text(SmResId(category)); mxElementListBox->connect_changed(LINK(this, SmElementsDockingWindow, ElementSelectedHandle)); - mxElementListBox->set_active_text(SmResId(RID_CATEGORY_UNARY_BINARY_OPERATORS)); +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/starmathdatabase.hxx|6 ++-- starmath/inc/token.hxx | 34 ++-- starmath/source/mathml/export.cxx | 18 ++ starmath/source/mathml/mathmlexport.cxx |3 -- starmath/source/mathml/starmathdatabase.cxx | 19 --- starmath/source/parse5.cxx |6 ++-- starmath/source/visitors.cxx|4 +-- 7 files changed, 44 insertions(+), 46 deletions(-) New commits: commit 8ad920befe1290c40ef762e8d7d9797b1924f5d2 Author: Noel Grandin AuthorDate: Thu May 12 12:49:53 2022 +0200 Commit: Noel Grandin CommitDate: Fri May 13 10:58:26 2022 +0200 tdf#121740 reduce cost of mathml parsing 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 diff --git a/starmath/inc/mathml/starmathdatabase.hxx b/starmath/inc/mathml/starmathdatabase.hxx index 3a4e939973d9..b4d3d6d3f8b5 100644 --- a/starmath/inc/mathml/starmathdatabase.hxx +++ b/starmath/inc/mathml/starmathdatabase.hxx @@ -302,7 +302,7 @@ SmColorTokenTableEntry Identify_Color_DVIPSNAMES(sal_uInt32 cColor); * @param cColor * @param parser color */ -const SmColorTokenTableEntry* Identify_ColorName_Parser(const OUString& colorname); +const SmColorTokenTableEntry* Identify_ColorName_Parser(std::u16string_view colorname); /** * Identifies color from color name. @@ -315,7 +315,7 @@ const SmColorTokenTableEntry* Identify_ColorName_Parser(const OUString& colornam * @param cColor * @param parser color */ -SmColorTokenTableEntry Identify_ColorName_HTML(const OUString& colorname); +SmColorTokenTableEntry Identify_ColorName_HTML(std::u16string_view colorname); /** * Identifies color from color name. @@ -326,7 +326,7 @@ SmColorTokenTableEntry Identify_ColorName_HTML(const OUString& colorname); * @param cColor * @param parser color */ -const SmColorTokenTableEntry* Identify_ColorName_DVIPSNAMES(const OUString& colorname); +const SmColorTokenTableEntry* Identify_ColorName_DVIPSNAMES(std::u16string_view colorname); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 86ee287d51c8..d3e141e5adb9 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -29,6 +29,7 @@ #pragma once #include +#include #include // std imports @@ -148,7 +149,7 @@ enum SmTokenType struct SmTokenTableEntry { -std::u16string_view pIdent; +OUString aIdent; SmTokenType eType; sal_Unicode cMathChar; TG nGroup; @@ -157,48 +158,47 @@ struct SmTokenTableEntry struct SmColorTokenTableEntry { -const char* pIdent; +OUString aIdent; SmTokenType eType; Color cColor; SmColorTokenTableEntry() -: pIdent("") -, eType(TERROR) +: eType(TERROR) , cColor() { } SmColorTokenTableEntry(const SmColorTokenTableEntry* amColorTokenTableEntry) -: pIdent(amColorTokenTableEntry->pIdent) +: aIdent(amColorTokenTableEntry->aIdent) , eType(amColorTokenTableEntry->eType) , cColor(amColorTokenTableEntry->cColor) { } SmColorTokenTableEntry(const std::unique_ptr amColorTokenTableEntry) -: pIdent(amColorTokenTableEntry->pIdent) +: aIdent(amColorTokenTableEntry->aIdent) , eType(amColorTokenTableEntry->eType) , cColor(amColorTokenTableEntry->cColor) { } -SmColorTokenTableEntry(const char* name, SmTokenType ctype, Color ncolor) -: pIdent(name) +SmColorTokenTableEntry(const OUString& name, SmTokenType ctype, Color ncolor) +: aIdent(name) , eType(ctype) , cColor(ncolor) { } -SmColorTokenTableEntry(const char* name, SmTokenType ctype, sal_uInt32 ncolor) -: pIdent(name) +SmColorTokenTableEntry(const OUString& name, SmTokenType ctype, sal_uInt32 ncolor) +: aIdent(name) , eType(ctype) , cColor(ColorTransparency, ncolor) { } -bool equals(const OUString& colorname) const +bool equals(std::u16string_view colorname) const { -return colorname.compareToIgnoreAsciiCaseAscii(pIdent) == 0; +return o3tl::compareToIgnoreAsciiCase(colorname, aIdent) == 0; } bool equals(sal_uInt32 colorcode) const { return colorcode == static_cast(cColor); } @@ -224,9 +224,9 @@ struct SmToken { } -SmToken(SmTokenType eTokenType, sal_Unicode cMath, const char* pText, TG nTokenGroup = TG::NONE, -sal_uInt16 nTokenLevel = 0) -: aText(OUString::createFromAscii(pText)) +SmToken(SmTokenType eTokenType, sal_Unicode cMath, const OUString& rText, +TG nTokenGroup = TG::NONE, sal_uInt16
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/dialog.hxx|2 +- starmath/source/dialog.cxx |8 2 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 82f9e12b737b3dbdf8cb9175c94d61005b666725 Author: Arnaud VERSINI AuthorDate: Sat Mar 5 20:50:08 2022 +0100 Commit: Noel Grandin CommitDate: Sun Mar 6 14:37:20 2022 +0100 Fix tdf#147755 by copying the vector. Revert partially 224953d896a3dba5d85992394525ab8b54d8c314 Change-Id: Ic12d3b0a080ad3af69fa5c4e8c9b4d331305a663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131066 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 6fbaaff7b819..fee12d9a5130 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -279,7 +279,7 @@ public: void calccols(const vcl::RenderContext& rRenderContext); voidSelectSymbol(sal_uInt16 nSymbol); sal_uInt16 GetSelectSymbol() const { return nSelectSymbol; } -void SetSymbolSet(SymbolPtrVec_t && rSymbolSet); +void SetSymbolSet(const SymbolPtrVec_t & rSymbolSet); void SetSelectHdl(const Link& rLink) { aSelectHdlLink = rLink; } void SetDblClickHdl(const Link& rLink) { aDblClickHdlLink = rLink; } }; diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 559a7e55c789..66f42f6c662f 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -1103,9 +1103,9 @@ void SmShowSymbolSet::calccols(const vcl::RenderContext& rRenderContext) SetScrollBarRange(); } -void SmShowSymbolSet::SetSymbolSet(SymbolPtrVec_t && rSymbolSet) +void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t & rSymbolSet) { -aSymbolSet = std::move(rSymbolSet); +aSymbolSet = rSymbolSet; SetScrollBarRange(); Invalidate(); } @@ -1257,7 +1257,7 @@ IMPL_LINK_NOARG(SmSymbolDialog, EditClickHdl, weld::Button&, void) // just update display of current symbol set assert(aSymSetName == aSymSetName); //unexpected change in symbol set name aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName ); -m_xSymbolSetDisplay->SetSymbolSet( std::vector(aSymbolSet) ); +m_xSymbolSetDisplay->SetSymbolSet( aSymbolSet ); } if (nSymPos >= aSymbolSet.size()) @@ -1350,7 +1350,7 @@ bool SmSymbolDialog::SelectSymbolSet(const OUString ) } ); const bool bEmptySymbolSet = aSymbolSet.empty(); -m_xSymbolSetDisplay->SetSymbolSet( std::move(aSymbolSet) ); +m_xSymbolSetDisplay->SetSymbolSet( aSymbolSet ); if (!bEmptySymbolSet) SelectSymbol(0);
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/starmath.hrc | 25 +--- starmath/source/cfgitem.cxx | 45 +--- starmath/source/dialog.cxx | 14 ++--- 3 files changed, 43 insertions(+), 41 deletions(-) New commits: commit f1bf33a26b20a2fd0aa941cce5ad40e3737e0eb4 Author: Noel Grandin AuthorDate: Tue Mar 1 08:55:22 2022 +0200 Commit: Noel Grandin CommitDate: Tue Mar 1 09:12:45 2022 +0100 use SfxItemSet::GetItemIfSet in starmath Change-Id: Iaef2a2c507acfdabc6280e6cc8179319ea9d8a94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130735 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index c566783156ca..83c17c94da09 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -21,6 +21,9 @@ #include +class SfxBoolItem; +class SfxUInt16Item; + #define SID_NEXTERR (SID_SMA_START + 1) #define SID_PREVERR (SID_SMA_START + 2) #define SID_NEXTMARK(SID_SMA_START + 3) @@ -51,23 +54,23 @@ #define SID_MODIFYSTATUS(SID_SMA_START + 110) #define SID_TEXTSTATUS (SID_SMA_START + 111) -#define SID_PRINTTITLE (SID_SMA_START + 112) -#define SID_PRINTTEXT (SID_SMA_START + 113) -#define SID_PRINTFRAME (SID_SMA_START + 114) -#define SID_PRINTSIZE (SID_SMA_START + 115) -#define SID_PRINTZOOM (SID_SMA_START + 116) +#define SID_PRINTTITLE TypedWhichId(SID_SMA_START + 112) +#define SID_PRINTTEXT TypedWhichId(SID_SMA_START + 113) +#define SID_PRINTFRAME TypedWhichId(SID_SMA_START + 114) +#define SID_PRINTSIZE TypedWhichId(SID_SMA_START + 115) +#define SID_PRINTZOOM TypedWhichId(SID_SMA_START + 116) #define SID_COPYOBJECT (SID_SMA_START + 117) #define SID_PASTEOBJECT (SID_SMA_START + 118) -#define SID_AUTOREDRAW (SID_SMA_START + 119) +#define SID_AUTOREDRAW TypedWhichId(SID_SMA_START + 119) #define SID_GETEDITTEXT (SID_SMA_START + 121) #define SID_CMDBOXWINDOW(SID_SMA_START + 122) -#define SID_NO_RIGHT_SPACES (SID_SMA_START + 124) -#define SID_SAVE_ONLY_USED_SYMBOLS (SID_SMA_START + 125) +#define SID_NO_RIGHT_SPACES TypedWhichId(SID_SMA_START + 124) +#define SID_SAVE_ONLY_USED_SYMBOLS TypedWhichId(SID_SMA_START + 125) #define SID_ELEMENTSDOCKINGWINDOW (SID_SMA_START + 126) -#define SID_AUTO_CLOSE_BRACKETS (SID_SMA_START + 127) -#define SID_SMEDITWINDOWZOOM(SID_SMA_START + 129) -#define SID_DEFAULT_SM_SYNTAX_VERSION (SID_SMA_START + 130) +#define SID_AUTO_CLOSE_BRACKETS TypedWhichId(SID_SMA_START + 127) +#define SID_SMEDITWINDOWZOOMTypedWhichId(SID_SMA_START + 129) +#define SID_DEFAULT_SM_SYNTAX_VERSION TypedWhichId(SID_SMA_START + 130) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 16e6d67b7312..7692aaa3ff5c 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -1357,56 +1357,55 @@ void SmMathConfig::Notify( const css::uno::Sequence< OUString >& rNames ) void SmMathConfig::ItemSetToConfig(const SfxItemSet ) { CommitLocker aLock(*this); -const SfxPoolItem *pItem = nullptr; sal_uInt16 nU16; bool bVal; -if (rSet.GetItemState(SID_PRINTSIZE, true, ) == SfxItemState::SET) -{ nU16 = static_cast(pItem)->GetValue(); +if (const SfxUInt16Item* pPrintSizeItem = rSet.GetItemIfSet(SID_PRINTSIZE)) +{ nU16 = pPrintSizeItem->GetValue(); SetPrintSize( static_cast(nU16) ); } -if (rSet.GetItemState(SID_PRINTZOOM, true, ) == SfxItemState::SET) -{ nU16 = static_cast(pItem)->GetValue(); +if (const SfxUInt16Item* pPrintZoomItem = rSet.GetItemIfSet(SID_PRINTZOOM)) +{ nU16 = pPrintZoomItem->GetValue(); SetPrintZoomFactor( nU16 ); } -if (rSet.GetItemState(SID_SMEDITWINDOWZOOM, true, ) == SfxItemState::SET) -{ nU16 = static_cast(pItem)->GetValue(); +if (const SfxUInt16Item* pPrintZoomItem = rSet.GetItemIfSet(SID_SMEDITWINDOWZOOM)) +{ nU16 = pPrintZoomItem->GetValue(); SetSmEditWindowZoomFactor( nU16 ); } -if (rSet.GetItemState(SID_PRINTTITLE, true, ) == SfxItemState::SET) -{ bVal = static_cast(pItem)->GetValue(); +if (const SfxBoolItem* pPrintTitleItem = rSet.GetItemIfSet(SID_PRINTTITLE)) +{ bVal = pPrintTitleItem->GetValue(); SetPrintTitle( bVal ); } -if (rSet.GetItemState(SID_PRINTTEXT, true, ) == SfxItemState::SET) -{ bVal = static_cast(pItem)->GetValue(); +if (const SfxBoolItem* pPrintTextItem = rSet.GetItemIfSet(SID_PRINTTEXT)) +{ bVal = pPrintTextItem->GetValue(); SetPrintFormulaText( bVal ); } -if (rSet.GetItemState(SID_PRINTFRAME,
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/export.hxx|6 +++--- starmath/source/mathml/export.cxx | 18 +- starmath/source/mathml/import.cxx | 14 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) New commits: commit fc6c2c752d711dd6113441659ec046032e2c6f80 Author: Julien Nabet AuthorDate: Sun Feb 27 11:31:53 2022 +0100 Commit: Julien Nabet CommitDate: Sun Feb 27 12:09:51 2022 +0100 Typo: attributte->attribute Change-Id: Ic90047599effeea7d4959f9d44360361d87b98c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130619 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/starmath/inc/mathml/export.hxx b/starmath/inc/mathml/export.hxx index 3209c5aadb46..125f2602c491 100644 --- a/starmath/inc/mathml/export.hxx +++ b/starmath/inc/mathml/export.hxx @@ -173,12 +173,12 @@ private: public: /** Exports an attribute of type "length" */ -void exportMlAttributteLength(xmloff::token::XMLTokenEnum pAttribute, - const SmLengthValue& aLengthValue); +void exportMlAttributeLength(xmloff::token::XMLTokenEnum pAttribute, + const SmLengthValue& aLengthValue); /** Exports attributes of an element */ -void exportMlAttributtes(const SmMlElement* pMlElement); +void exportMlAttributes(const SmMlElement* pMlElement); /** Exports an element and all it's attributes */ diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index f439d537e7b3..554bb1b0d5d1 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -627,8 +627,8 @@ void SmMLExport::declareMlError() m_bSuccess = false; } -void SmMLExport::exportMlAttributteLength(xmloff::token::XMLTokenEnum pAttribute, - const SmLengthValue& aLengthValue) +void SmMLExport::exportMlAttributeLength(xmloff::token::XMLTokenEnum pAttribute, + const SmLengthValue& aLengthValue) { if (!aLengthValue.m_aOriginalText->isEmpty()) { @@ -677,7 +677,7 @@ void SmMLExport::exportMlAttributteLength(xmloff::token::XMLTokenEnum pAttribute } } -void SmMLExport::exportMlAttributtes(const SmMlElement* pMlElement) +void SmMLExport::exportMlAttributes(const SmMlElement* pMlElement) { size_t nAttributeCount = pMlElement->getAttributeCount(); for (size_t i = 0; i < nAttributeCount; ++i) @@ -776,7 +776,7 @@ void SmMLExport::exportMlAttributtes(const SmMlElement* pMlElement) { auto aSizeData = aAttribute.getMlLspace(); auto aLengthData = aSizeData->m_aLengthValue; -exportMlAttributteLength(XML_LSPACE, aLengthData); +exportMlAttributeLength(XML_LSPACE, aLengthData); break; } case SmMlAttributeValueType::MlMathbackground: @@ -828,7 +828,7 @@ void SmMLExport::exportMlAttributtes(const SmMlElement* pMlElement) { auto aSizeData = aAttribute.getMlMathsize(); auto aLengthData = aSizeData->m_aLengthValue; -exportMlAttributteLength(XML_MATHSIZE, aLengthData); +exportMlAttributeLength(XML_MATHSIZE, aLengthData); break; } case SmMlAttributeValueType::MlMathvariant: @@ -909,7 +909,7 @@ void SmMLExport::exportMlAttributtes(const SmMlElement* pMlElement) } case SmMlAttributeValueMaxsize::MlFinite: { -exportMlAttributteLength(XML_MAXSIZE, aLengthData); +exportMlAttributeLength(XML_MAXSIZE, aLengthData); break; } } @@ -919,7 +919,7 @@ void SmMLExport::exportMlAttributtes(const SmMlElement* pMlElement) { auto aSizeData = aAttribute.getMlMinsize(); auto aLengthData = aSizeData->m_aLengthValue; -exportMlAttributteLength(XML_MINSIZE, aLengthData); +exportMlAttributeLength(XML_MINSIZE, aLengthData); break; } case SmMlAttributeValueType::MlMovablelimits: @@ -943,7 +943,7 @@ void SmMLExport::exportMlAttributtes(const SmMlElement* pMlElement) { auto aSizeData = aAttribute.getMlRspace(); auto aLengthData = aSizeData->m_aLengthValue; -exportMlAttributteLength(XML_RSPACE, aLengthData); +exportMlAttributeLength(XML_RSPACE, aLengthData); break; } case SmMlAttributeValueType::MlSeparator: @@ -1037,7 +1037,7 @@ SvXMLElementExport* SmMLExport::exportMlElement(const SmMlElement* pMlElement) pElementExport = nullptr; } const OUString& aElementText = pMlElement->getText(); -
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx|1 - starmath/source/view.cxx | 31 +-- 2 files changed, 13 insertions(+), 19 deletions(-) New commits: commit 009e7406f2a1eb25aab4a3f0b647fa5c9f3766ee Author: Mike Kaganski AuthorDate: Tue Jan 18 12:04:01 2022 +0300 Commit: Mike Kaganski CommitDate: Tue Jan 18 11:14:10 2022 +0100 Drop useless indirection Change-Id: I87f26e2a2cf10d3000b0955a6ba2d877ee92bdf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128547 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 5ad4ac3842d9..90cb04831755 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -135,7 +135,6 @@ private: } void SetCursor(const SmNode *pNode); void SetCursor(const tools::Rectangle ); -static bool IsInlineEditEnabled(); virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual bool KeyInput(const KeyEvent& rKEvt) override; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 5bc143ab394b..4eda4001e81c 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -338,7 +338,7 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) if (!pTree) return true; -if (IsInlineEditEnabled()) { +if (SmViewShell::IsInlineEditEnabled()) { mrViewShell.GetDoc()->GetCursor().MoveTo(, aPos, !rMEvt.IsShift()); return true; } @@ -368,7 +368,7 @@ bool SmGraphicWidget::MouseButtonDown(const MouseEvent& rMEvt) bool SmGraphicWidget::MouseMove(const MouseEvent ) { -if (rMEvt.IsLeft() && IsInlineEditEnabled()) +if (rMEvt.IsLeft() && SmViewShell::IsInlineEditEnabled()) { OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); Point aPos(rDevice.PixelToLogic(rMEvt.GetPosPixel()) - GetFormulaDrawPos()); @@ -382,14 +382,9 @@ bool SmGraphicWidget::MouseMove(const MouseEvent ) return true; } -bool SmGraphicWidget::IsInlineEditEnabled() -{ -return SmViewShell::IsInlineEditEnabled(); -} - void SmGraphicWidget::GetFocus() { -if (!IsInlineEditEnabled()) +if (!SmViewShell::IsInlineEditEnabled()) return; if (mrViewShell.GetEditWindow()) mrViewShell.GetEditWindow()->Flush(); @@ -411,7 +406,7 @@ void SmGraphicWidget::LoseFocus() mxAccessible->LaunchEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); } -if (!IsInlineEditEnabled()) +if (!SmViewShell::IsInlineEditEnabled()) return; SetIsCursorVisible(false); ShowLine(false); @@ -444,7 +439,7 @@ void SmGraphicWidget::CaretBlinkInit() void SmGraphicWidget::CaretBlinkStart() { -if (!IsInlineEditEnabled()) +if (!SmViewShell::IsInlineEditEnabled()) return; if (aCaretBlinkTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME) aCaretBlinkTimer.Start(); @@ -452,7 +447,7 @@ void SmGraphicWidget::CaretBlinkStart() void SmGraphicWidget::CaretBlinkStop() { -if (!IsInlineEditEnabled()) +if (!SmViewShell::IsInlineEditEnabled()) return; aCaretBlinkTimer.Stop(); } @@ -460,7 +455,7 @@ void SmGraphicWidget::CaretBlinkStop() // shows or hides the formula-cursor depending on 'bShow' is true or not void SmGraphicWidget::ShowCursor(bool bShow) { -if (IsInlineEditEnabled()) +if (SmViewShell::IsInlineEditEnabled()) return; bool bInvert = bShow != IsCursorVisible(); @@ -475,7 +470,7 @@ void SmGraphicWidget::ShowCursor(bool bShow) void SmGraphicWidget::ShowLine(bool bShow) { -if (!IsInlineEditEnabled()) +if (!SmViewShell::IsInlineEditEnabled()) return; bIsLineVisible = bShow; @@ -483,7 +478,7 @@ void SmGraphicWidget::ShowLine(bool bShow) void SmGraphicWidget::SetCursor(const SmNode *pNode) { -if (IsInlineEditEnabled()) +if (SmViewShell::IsInlineEditEnabled()) return; const SmNode *pTree = mrViewShell.GetDoc()->GetFormulaTree(); @@ -502,7 +497,7 @@ void SmGraphicWidget::SetCursor(const tools::Rectangle ) // The old cursor will be removed, and the new one will be shown if // that is activated in the ConfigItem { -if (IsInlineEditEnabled()) +if (SmViewShell::IsInlineEditEnabled()) return; SmModule *pp = SM_MOD(); @@ -522,7 +517,7 @@ const SmNode * SmGraphicWidget::SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol) // rectangle. If not the formula-cursor will be hidden. // In any case the search result is being returned. { -if (IsInlineEditEnabled()) +if (SmViewShell::IsInlineEditEnabled()) return nullptr; // find visible node with token at nRow, nCol @@ -547,7 +542,7 @@ void SmGraphicWidget::Paint(vcl::RenderContext& rRenderContext, const tools::Rec rDoc.DrawFormula(rRenderContext, aPoint, true); //! modifies aPoint to be the topleft
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx|4 starmath/source/edit.cxx |5 ++--- starmath/source/view.cxx | 24 +++- 3 files changed, 25 insertions(+), 8 deletions(-) New commits: commit 4321fb516f4a65b047b182c4cb6f9c9a232efd85 Author: Caolán McNamara AuthorDate: Thu Dec 2 21:43:46 2021 + Commit: Caolán McNamara CommitDate: Fri Dec 3 14:39:20 2021 +0100 Resolves: tdf#145959 menu pos should be relative to SmCmdBoxWindow Change-Id: Ie8da9bbb4385b3315fd62e6f2dc8ab394ea3709f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126263 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 8d54cac903c5..a8e02addfba6 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -210,6 +210,10 @@ public: virtual void StateChanged( StateChangedType nStateChange ) override; virtual void Command(const CommandEvent& rCEvt) override; +Point WidgetToWindowPos(const weld::Widget& rWidget, const Point& rPos); + +void ShowContextMenu(const Point& rPos); + void AdjustPosition(); SmEditWindow& GetEditWindow() diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 2588e9f60325..e8e79a24e12c 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -266,10 +266,9 @@ bool SmEditTextWindow::Command(const CommandEvent& rCEvt) if (rCEvt.GetCommand() == CommandEventId::ContextMenu) { -// purely for "ExecutePopup" taking a vcl::Window and -// we assume SmEditTextWindow 0,0 is at SmEditWindow 0,0 ReleaseMouse(); -mrEditWindow.GetCmdBox().Command(rCEvt); +SmCmdBoxWindow& rCmdBox = mrEditWindow.GetCmdBox(); +rCmdBox.ShowContextMenu(rCmdBox.WidgetToWindowPos(*GetDrawingArea(), rCEvt.GetMousePosPixel())); GrabFocus(); return true; } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 6eb1213071cb..5bc143ab394b 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -831,15 +831,29 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi aInitialFocusTimer.SetTimeout(100); } +Point SmCmdBoxWindow::WidgetToWindowPos(const weld::Widget& rWidget, const Point& rPos) +{ +Point aRet(rPos); +int x(0), y(0), width(0), height(0); +rWidget.get_extents_relative_to(*m_xContainer, x, y, width, height); +aRet.Move(x, y); +aRet.Move(m_xBox->GetPosPixel().X(), m_xBox->GetPosPixel().Y()); +return aRet; +} + +void SmCmdBoxWindow::ShowContextMenu(const Point& rPos) +{ +ToTop(); +SmViewShell *pViewSh = GetView(); +if (pViewSh) +pViewSh->GetViewFrame()->GetDispatcher()->ExecutePopup("edit", this, ); +} + void SmCmdBoxWindow::Command(const CommandEvent& rCEvt) { if (rCEvt.GetCommand() == CommandEventId::ContextMenu) { -ToTop(); -Point aPoint = rCEvt.GetMousePosPixel(); -SmViewShell *pViewSh = GetView(); -if (pViewSh) -pViewSh->GetViewFrame()->GetDispatcher()->ExecutePopup("edit", this, ); +ShowContextMenu(rCEvt.GetMousePosPixel()); return; }
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cfgitem.hxx| 19 +++- starmath/source/cfgitem.cxx | 204 +--- 2 files changed, 174 insertions(+), 49 deletions(-) New commits: commit a5808c6446f6de536c44cf5bfba6566ad398fb8c Author: Mike Kaganski AuthorDate: Tue Nov 30 10:05:57 2021 +0200 Commit: Mike Kaganski CommitDate: Tue Nov 30 12:03:53 2021 +0100 tdf#132145: Synchronize SmMathConfig with configuration Change-Id: I690aa2f47afcd45eda3fb74ecead970b9e1513c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126095 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index 6342d740c35c..16c65fd7f58f 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -103,6 +103,7 @@ class SmMathConfig final : public utl::ConfigItem, public SfxBroadcaster bool bIsOtherModified; bool bIsFormatModified; SmFontPickList vFontPickList[7]; +sal_Int32 m_nCommitLock = 0; SmMathConfig(const SmMathConfig&) = delete; SmMathConfig& operator=(const SmMathConfig&) = delete; @@ -116,7 +117,7 @@ class SmMathConfig final : public utl::ConfigItem, public SfxBroadcaster void ReadFontFormat(SmFontFormat& rFontFormat, std::u16string_view rSymbolName, std::u16string_view rBaseNode) const; -void SetOtherIfNotEqual(bool& rbItem, bool bNewVal); +bool SetOtherIfNotEqual(bool& rbItem, bool bNewVal); void LoadOther(); void SaveOther(); @@ -137,6 +138,22 @@ class SmMathConfig final : public utl::ConfigItem, public SfxBroadcaster } virtual void ImplCommit() override; +void LockCommit() { ++m_nCommitLock; } +void UnlockCommit(); +// Used to avoid tens of atomic commits in e.g. ItemSetToConfig that calls individual setters +friend struct CommitLocker; +struct CommitLocker +{ +SmMathConfig& m_rConfig; +CommitLocker(SmMathConfig& rConfig) +: m_rConfig(rConfig) +{ +m_rConfig.LockCommit(); +} +~CommitLocker() { m_rConfig.UnlockCommit(); } +}; + +void Clear(); public: SmMathConfig(); diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 233b5fb7f351..efa994e2fa8a 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -32,7 +32,6 @@ #include -#include #include #include @@ -68,6 +67,23 @@ static Sequence< OUString > lcl_GetSymbolPropertyNames() }; } +static Sequence lcl_GetOtherPropertyNames() +{ +return Sequence{ "LoadSave/IsSaveOnlyUsedSymbols", + "Misc/AutoCloseBrackets", + "Misc/DefaultSmSyntaxVersion", + "Misc/IgnoreSpacesRight", + "Misc/SmEditWindowZoomFactor", + "Print/FormulaText", + "Print/Frame", + "Print/Size:", + "Print/Title", + "Print/ZoomFactor", + "View/AutoRedraw", + "View/FormulaCursor", + "View/ToolboxVisible" }; +} + static Sequence< OUString > lcl_GetFormatPropertyNames() { //! Beware of order according to *_BEGIN *_END defines in format.hxx ! @@ -343,6 +359,7 @@ SmMathConfig::SmMathConfig() : , bIsOtherModified(false) , bIsFormatModified(false) { +EnableNotification({ {} }); // Listen to everything under the node } @@ -470,6 +487,22 @@ void SmMathConfig::Save() } +void SmMathConfig::UnlockCommit() +{ +if (--m_nCommitLock == 0) +Commit(); +} + + +void SmMathConfig::Clear() +{ +// Re-read data on next request +pOther.reset(); +pFormat.reset(); +pFontFormatList.reset(); +} + + void SmMathConfig::GetSymbols( std::vector< SmSym > ) const { Sequence< OUString > aNodes(const_cast(this)->GetNodeNames(SYMBOL_LIST)); @@ -486,6 +519,7 @@ void SmMathConfig::GetSymbols( std::vector< SmSym > ) const void SmMathConfig::SetSymbols( const std::vector< SmSym > ) { +CommitLocker aLock(*this); auto nCount = sal::static_int_cast(rNewSymbols.size()); Sequence< OUString > aNames = lcl_GetSymbolPropertyNames(); @@ -537,7 +571,6 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > ) ReplaceSetProperties( SYMBOL_LIST, aValues ); StripFontFormatList( rNewSymbols ); -SaveFontFormatList(); } @@ -740,20 +773,68 @@ void SmMathConfig::LoadOther() if (!pOther) pOther.reset(new SmCfgOther); -pOther->bPrintTitle = officecfg::Office::Math::Print::Title::get(); -pOther->bPrintFormulaText = officecfg::Office::Math::Print::FormulaText::get(); -pOther->bPrintFrame = officecfg::Office::Math::Print::Frame::get(); -pOther->ePrintSize =
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/export.hxx|5 - starmath/inc/mathml/import.hxx|5 - starmath/source/mathml/export.cxx | 103 --- starmath/source/mathml/import.cxx | 123 ++ 4 files changed, 158 insertions(+), 78 deletions(-) New commits: commit 58a5bd793a2ed57077fc598281cc74e16373b877 Author: dante AuthorDate: Fri Aug 20 04:35:20 2021 +0200 Commit: Noel Grandin CommitDate: Fri Aug 20 12:46:40 2021 +0200 Fine tune new sm import / export Change-Id: I7e7ec875b3d0f8f1d62f22270a306bc2f57421ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120768 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/export.hxx b/starmath/inc/mathml/export.hxx index fa442b10d881..3209c5aadb46 100644 --- a/starmath/inc/mathml/export.hxx +++ b/starmath/inc/mathml/export.hxx @@ -82,6 +82,7 @@ public: , m_bFlat(true) , m_bUseHTMLMLEntities(false) , m_pElementTree(nullptr) +, m_bUseExportTag(false) { } @@ -101,7 +102,7 @@ protected: const css::uno::Reference& xComponent, css::uno::Reference const& rxContext, css::uno::Reference const& rPropSet, - const char16_t* pComponentName); + const char16_t* pComponentName, int_fast16_t nSyntaxVersion); /** export through an XML exporter component (storage version) */ @@ -110,7 +111,7 @@ protected: const char16_t* pStreamName, css::uno::Reference const& rxContext, css::uno::Reference const& rPropSet, -const char16_t* pComponentName); +const char16_t* pComponentName, int_fast16_t nSyntaxVersion); /** export through an XML exporter component (memory stream version) */ diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx index ae72b7b89b6e..6266b5ede6c0 100644 --- a/starmath/inc/mathml/import.hxx +++ b/starmath/inc/mathml/import.hxx @@ -62,7 +62,8 @@ public: const css::uno::Reference& xModelComponent, css::uno::Reference const& rxContext, css::uno::Reference const& rPropSet, - const char16_t* pFilterName, bool bEncrypted); + const char16_t* pFilterName, bool bEncrypted, + int_fast16_t nSyntaxVersion); /** read a component from storage */ @@ -71,7 +72,7 @@ public: const char16_t* pStreamName, css::uno::Reference const& rxContext, css::uno::Reference const& rPropSet, - const char16_t* pFilterName); + const char16_t* pFilterName, int_fast16_t nSyntaxVersion); /** read a component from text */ diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 76e79f1b7e75..11e91e35cbfc 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -53,6 +53,9 @@ #include #include +// Old parser +#include + using namespace ::com::sun::star; using namespace xmloff::token; @@ -113,7 +116,7 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) if (pDocShell->GetMedium() != ) { SAL_WARN("starmath", "Input medium and sm document medium do not match"); -return false; +//return false; } // Fetch progress bar @@ -156,7 +159,6 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) SAL_WARN("starmath", "Failed to fetch output storage"); return false; } -bool bOASIS = SotStorage::GetVersion(xStg) > SOFFICE_FILEFORMAT_60; // TODO/LATER: handle the case of embedded links gracefully if (bEmbedded) //&& !pStg->IsRoot() ) @@ -177,8 +179,7 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) xStatusIndicator->setValue(1); bRet = WriteThroughComponentS(xStg, xModelComp, u"meta.xml", xContext, xInfoSet, - bOASIS ? u"com.sun.star.comp.Math.XMLOasisMetaExporter" - : u"com.sun.star.comp.Math.XMLMetaExporter"); + u"com.sun.star.comp.Math.MLOasisMetaExporter", 6); } // Write starmath formula @@ -188,8 +189,12 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) if (xStatusIndicator.is()) xStatusIndicator->setValue(2); -bRet = WriteThroughComponentS(xStg, xModelComp, u"content.xml",
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/import.hxx| 32 +++-- starmath/source/mathml/import.cxx | 57 ++ 2 files changed, 45 insertions(+), 44 deletions(-) New commits: commit 4f7dd4985dd11e2e797f0ab05eaa7982b5a83b46 Author: dante AuthorDate: Fri Aug 20 04:30:01 2021 +0200 Commit: Noel Grandin CommitDate: Fri Aug 20 12:45:26 2021 +0200 Improve code reability with different function names Change-Id: I0799cb26642197813b054c1bde39cf1ced7519a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120767 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx index 4b9b1a8790f2..ae72b7b89b6e 100644 --- a/starmath/inc/mathml/import.hxx +++ b/starmath/inc/mathml/import.hxx @@ -57,27 +57,29 @@ public: /** read a component from input stream */ -ErrCode ReadThroughComponent(const css::uno::Reference& xInputStream, - const css::uno::Reference& xModelComponent, - css::uno::Reference const& rxContext, - css::uno::Reference const& rPropSet, - const char16_t* pFilterName, bool bEncrypted); +ErrCode +ReadThroughComponentIS(const css::uno::Reference& xInputStream, + const css::uno::Reference& xModelComponent, + css::uno::Reference const& rxContext, + css::uno::Reference const& rPropSet, + const char16_t* pFilterName, bool bEncrypted); /** read a component from storage */ -ErrCode ReadThroughComponent(const css::uno::Reference& xStorage, - const css::uno::Reference& xModelComponent, - const char16_t* pStreamName, - css::uno::Reference const& rxContext, - css::uno::Reference const& rPropSet, - const char16_t* pFilterName); +ErrCode ReadThroughComponentS(const css::uno::Reference& xStorage, + const css::uno::Reference& xModelComponent, + const char16_t* pStreamName, + css::uno::Reference const& rxContext, + css::uno::Reference const& rPropSet, + const char16_t* pFilterName); /** read a component from text */ -ErrCode ReadThroughComponent(std::u16string_view aText, - const css::uno::Reference& xModelComponent, - css::uno::Reference const& rxContext, - css::uno::Reference const& rPropSet); +ErrCode +ReadThroughComponentMS(std::u16string_view aText, + const css::uno::Reference& xModelComponent, + css::uno::Reference const& rxContext, + css::uno::Reference const& rPropSet); }; class SmMLImport : public SvXMLImport diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index 952e5c1ec39f..cdb2a7487658 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -194,10 +194,10 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) // Read metadata // read a component from storage -ErrCode nWarn = ReadThroughComponent(rMedium.GetStorage(), xModelComp, u"meta.xml", - xContext, xInfoSet, - bOASIS ? u"com.sun.star.comp.Math.MLOasisMetaImporter" -: u"com.sun.star.comp.Math.MLMetaImporter"); +ErrCode nWarn = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"meta.xml", + xContext, xInfoSet, + bOASIS ? u"com.sun.star.comp.Math.MLOasisMetaImporter" + : u"com.sun.star.comp.Math.MLMetaImporter"); // Check if successful if (nWarn != ERRCODE_NONE) @@ -214,10 +214,10 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) // Read settings // read a component from storage -nWarn = ReadThroughComponent(rMedium.GetStorage(), xModelComp, u"settings.xml", xContext, - xInfoSet, - bOASIS ? u"com.sun.star.comp.Math.MLOasisSettingsImporter" -: u"com.sun.star.comp.Math.MLSettingsImporter"); +nWarn = ReadThroughComponentS(rMedium.GetStorage(), xModelComp, u"settings.xml", xContext, + xInfoSet, +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/export.hxx|8 ++-- starmath/source/mathml/export.cxx | 72 +++--- 2 files changed, 40 insertions(+), 40 deletions(-) New commits: commit cf2082337c72eca4509fbdbb05d8c68b91fe8a69 Author: dante AuthorDate: Fri Aug 20 04:23:13 2021 +0200 Commit: Noel Grandin CommitDate: Fri Aug 20 12:44:12 2021 +0200 Fix typo in new SmMlElement exporter Change-Id: Ia1e7963dbb2f69a8b8f43903882521da94eaffe5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120766 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/export.hxx b/starmath/inc/mathml/export.hxx index d5767ef2e6db..fa442b10d881 100644 --- a/starmath/inc/mathml/export.hxx +++ b/starmath/inc/mathml/export.hxx @@ -34,7 +34,7 @@ class SfxMedium; class SmDocShell; -class SmMlExportWrapper +class SmMLExportWrapper { private: // Model @@ -77,7 +77,7 @@ public: void setUseExportTag(bool bUseExportTag) { m_bUseExportTag = bUseExportTag; } public: -explicit SmMlExportWrapper(css::uno::Reference const& rRef) +explicit SmMLExportWrapper(css::uno::Reference const& rRef) : m_xModel(rRef) , m_bFlat(true) , m_bUseHTMLMLEntities(false) @@ -120,7 +120,7 @@ protected: css::uno::Reference const& rPropSet); }; -class SmMlExport final : public SvXMLExport +class SmMLExport final : public SvXMLExport { private: SmMlElement* m_pElementTree; @@ -194,7 +194,7 @@ public: public: /** Constructor */ -SmMlExport(const css::uno::Reference& rContext, +SmMLExport(const css::uno::Reference& rContext, OUString const& implementationName, SvXMLExportFlags nExportFlags); private: diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 57d9626a239c..76e79f1b7e75 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -63,10 +63,10 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using namespace ::xmloff::token; -// SmMlExportWrapper +// SmMLExportWrapper /*/ -bool SmMlExportWrapper::Export(SfxMedium& rMedium) +bool SmMLExportWrapper::Export(SfxMedium& rMedium) { bool bRet = true; uno::Reference xContext(comphelper::getProcessComponentContext()); @@ -230,7 +230,7 @@ bool SmMlExportWrapper::Export(SfxMedium& rMedium) return bRet; } -OUString SmMlExportWrapper::Export(SmMlElement* pElementTree) +OUString SmMLExportWrapper::Export(SmMlElement* pElementTree) { uno::Reference xContext(comphelper::getProcessComponentContext()); @@ -283,7 +283,7 @@ OUString SmMlExportWrapper::Export(SmMlElement* pElementTree) } // export through an XML exporter component (output stream version) -bool SmMlExportWrapper::WriteThroughComponentOS(const Reference& xOutputStream, +bool SmMLExportWrapper::WriteThroughComponentOS(const Reference& xOutputStream, const Reference& xComponent, Reference const& rxContext, Reference const& rPropSet, @@ -325,12 +325,12 @@ bool SmMlExportWrapper::WriteThroughComponentOS(const Reference xFilter(xExporter, UNO_QUERY); -SmMlExport* pFilter = comphelper::getUnoTunnelImplementation(xFilter); +SmMLExport* pFilter = comphelper::getUnoTunnelImplementation(xFilter); // Setup filter if (pFilter == nullptr) { -SAL_WARN("starmath", "Failed to fetch SmMlExport"); +SAL_WARN("starmath", "Failed to fetch SmMLExport"); return false; } pFilter->setUseExportTag(m_bUseExportTag); @@ -343,7 +343,7 @@ bool SmMlExportWrapper::WriteThroughComponentOS(const Reference& xStorage, +bool SmMLExportWrapper::WriteThroughComponentS(const Reference& xStorage, const Reference& xComponent, const char16_t* pStreamName, Reference const& rxContext, @@ -388,7 +388,7 @@ bool SmMlExportWrapper::WriteThroughComponentS(const Reference& // export through an XML exporter component (memory stream version) OUString -SmMlExportWrapper::WriteThroughComponentMS(const Reference& xComponent, +SmMLExportWrapper::WriteThroughComponentMS(const Reference& xComponent, Reference const& rxContext, Reference const& rPropSet) { @@ -419,27 +419,27 @@ SmMlExportWrapper::WriteThroughComponentMS(const Reference& xCompone return OStringToOUString(aString, RTL_TEXTENCODING_UTF8); } -// SmMlExport technical +// SmMLExport technical
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/document.hxx|8 starmath/source/document.cxx |3 +++ 2 files changed, 11 insertions(+) New commits: commit 3ad6d41c1c88b0549c9be0f41e02d83a582fcdfd Author: dante AuthorDate: Fri Aug 20 04:17:34 2021 +0200 Commit: Noel Grandin CommitDate: Fri Aug 20 09:36:52 2021 +0200 Add a SmMlElement tree to the sm document Change-Id: Ide764b512004198277baed60ac4e1a5ef0d1c2dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120765 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 588a8d93f1b0..77d13aa77d08 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -32,6 +32,7 @@ #include "format.hxx" #include "parse.hxx" #include "smdllapi.hxx" +#include "mathml/iterator.hxx" class SfxPrinter; class Printer; @@ -82,6 +83,7 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener OUStringmaAccText; SvtLinguOptions maLinguOptions; std::unique_ptr mpTree; +SmMlElement* m_pMlElementTree; rtl::Reference mpEditEngineItemPool; std::unique_ptr mpEditEngine; VclPtr mpPrinter; //q.v. comment to SmPrinter Access! @@ -212,6 +214,12 @@ public: void readFormulaOoxml( oox::formulaimport::XmlStream& stream ); void UpdateEditEngineDefaultFonts(); + +SmMlElement* GetMlElementTree() { return m_pMlElementTree; } +void SetMlElementTree(SmMlElement* pMlElementTree) { +mathml::SmMlIteratorFree(m_pMlElementTree); +m_pMlElementTree = pMlElementTree; +} }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 23a0caf847fb..4acba208a61e 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -556,6 +556,7 @@ void SmDocShell::Repaint() SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags ) : SfxObjectShell(i_nSfxCreationFlags) +, m_pMlElementTree(nullptr) , mpPrinter(nullptr) , mpTmpPrinter(nullptr) , mnModifyCount(0) @@ -587,6 +588,8 @@ SmDocShell::~SmDocShell() mpEditEngine.reset(); mpEditEngineItemPool.clear(); mpPrinter.disposeAndClear(); + +mathml::SmMlIteratorFree(m_pMlElementTree); } bool SmDocShell::ConvertFrom(SfxMedium )
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/attribute.hxx| 30 +- starmath/inc/mathml/element.hxx |7 ++- starmath/source/mathml/attribute.cxx | 18 ++ starmath/source/mathml/element.cxx | 15 +-- starmath/source/mathml/export.cxx|3 +++ 5 files changed, 65 insertions(+), 8 deletions(-) New commits: commit ffaaec23ad94f9bec5fd0fcb02603270eb660b81 Author: dante AuthorDate: Fri Aug 13 19:51:33 2021 +0200 Commit: Noel Grandin CommitDate: Sun Aug 15 09:10:13 2021 +0200 Add the possibility to check if a mathml attribute is manually set Change-Id: I9c5eaee8e2cce47d9286306031e807ca2c0eed57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120473 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx index cbe042827d85..946e9f463e9c 100644 --- a/starmath/inc/mathml/attribute.hxx +++ b/starmath/inc/mathml/attribute.hxx @@ -49,6 +49,7 @@ class SmMlAttribute private: SmMlAttributeValueType m_aSmMlAttributeValueType; SmMlAttributeValue m_aAttributeValue; +bool m_bSet; private: void clearPreviousAttributeValue(); @@ -56,28 +57,42 @@ private: void setAttributeValue(const SmMlAttribute* aMlAttribute); public: -SmMlAttribute() { m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; }; +SmMlAttribute() +: m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) +, m_bSet(false){}; ~SmMlAttribute() { clearPreviousAttributeValue(); }; SmMlAttribute(SmMlAttributeValueType) +: m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) +, m_bSet(false) { -m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; setDefaultAttributeValue(); }; SmMlAttribute(const SmMlAttribute& aMlAttribute) +: m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) +, m_bSet(aMlAttribute.isSet()) { -m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; setAttributeValue(); } SmMlAttribute(const SmMlAttribute* aMlAttribute) +: m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) +, m_bSet(aMlAttribute->isSet()) { -m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; setAttributeValue(aMlAttribute); } +public: +/** Check if the attribute has been set +*/ +bool isSet() const { return m_bSet; } + +/** Set if the attribute has been set +*/ +void setSet(bool bSet) { m_bSet = bSet; } + public: /** * Returns the type of attribute we are dealing with. @@ -116,10 +131,15 @@ public: void setMlAttributeValue(const SmMlAttribute& aMlAttribute) { +m_bSet = true; setAttributeValue(); } -void setMlAttributeValue(const SmMlAttribute* aMlAttribute) { setAttributeValue(aMlAttribute); } +void setMlAttributeValue(const SmMlAttribute* aMlAttribute) +{ +m_bSet = true; +setAttributeValue(aMlAttribute); +} public: // Get values diff --git a/starmath/inc/mathml/element.hxx b/starmath/inc/mathml/element.hxx index 2c5ec40ab019..513b5d84b7ea 100644 --- a/starmath/inc/mathml/element.hxx +++ b/starmath/inc/mathml/element.hxx @@ -164,7 +164,7 @@ public: // attributes * @param nAttributePos * @return given attribute. */ -SmMlAttribute getAttribute(SmMlAttributeValueType aElementType) const; +SmMlAttribute getAttribute(SmMlAttributeValueType aAttributeType) const; /** * Set's a given attribute. @@ -174,6 +174,11 @@ public: // attributes */ void setAttribute(const SmMlAttribute* aAttribute); +/** Checks if an attribute has been manually set +* @param aElementType +*/ +bool isAttributeSet(SmMlAttributeValueType aAttributeType) const; + protected: // attributes /** * Get's a given attribute. diff --git a/starmath/source/mathml/attribute.cxx b/starmath/source/mathml/attribute.cxx index 61c4df609452..a1be708ae656 100644 --- a/starmath/source/mathml/attribute.cxx +++ b/starmath/source/mathml/attribute.cxx @@ -321,36 +321,42 @@ const struct SmMlSymmetric* SmMlAttribute::getMlSymmetric() const void SmMlAttribute::setMlAccent(const SmMlAccent* aAccent) { +m_bSet = true; clearPreviousAttributeValue(); m_aAttributeValue.m_aAccent.m_aAccent = aAccent->m_aAccent; } void SmMlAttribute::setMlDir(const SmMlDir* aDir) { +m_bSet = true; clearPreviousAttributeValue(); m_aAttributeValue.m_aDir.m_aDir = aDir->m_aDir; } void SmMlAttribute::setMlDisplaystyle(const SmMlDisplaystyle* aDisplaystyle) { +m_bSet = true; clearPreviousAttributeValue(); m_aAttributeValue.m_aDisplaystyle.m_aDisplaystyle = aDisplaystyle->m_aDisplaystyle; } void SmMlAttribute::setMlFence(const SmMlFence* aFence) { +m_bSet = true;
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/attribute.hxx|7 -- starmath/inc/mathml/def.hxx | 13 +++ starmath/source/mathml/attribute.cxx | 19 + starmath/source/mathml/def.cxx | 38 ++- 4 files changed, 57 insertions(+), 20 deletions(-) New commits: commit 73b6462b81080c63e6668979f4a9cd00242925e9 Author: dante AuthorDate: Fri Aug 13 19:13:46 2021 +0200 Commit: Noel Grandin CommitDate: Sun Aug 15 09:09:07 2021 +0200 Add the Form attribute to mo Change-Id: I4f64460e15c707fa8ecdcfdfbea460b2f1410947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120469 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx index a6b1bdec639c..cbe042827d85 100644 --- a/starmath/inc/mathml/attribute.hxx +++ b/starmath/inc/mathml/attribute.hxx @@ -25,6 +25,7 @@ union SmMlAttributeValue { struct SmMlDir m_aDir; struct SmMlDisplaystyle m_aDisplaystyle; struct SmMlFence m_aFence; +struct SmMlForm m_aForm; struct SmMlHref m_aHref; struct SmMlLspace m_aLspace; struct SmMlMathbackground m_aMathbackground; @@ -126,6 +127,7 @@ public: const struct SmMlDir* getMlDir() const; const struct SmMlDisplaystyle* getMlDisplaystyle() const; const struct SmMlFence* getMlFence() const; +const struct SmMlForm* getMlForm() const; const struct SmMlHref* getMlHref() const; const struct SmMlLspace* getMlLspace() const; const struct SmMlMathbackground* getMlMathbackground() const; @@ -146,6 +148,7 @@ public: void setMlDir(const SmMlDir* aDir); void setMlDisplaystyle(const SmMlDisplaystyle* aDisplaystyle); void setMlFence(const SmMlFence* aFence); +void setMlForm(const SmMlForm* aForm); void setMlHref(const SmMlHref* aHref); void setMlLspace(const SmMlLspace* aLspace); void setMlMathbackground(const SmMlMathbackground* aMathbackground); @@ -171,10 +174,10 @@ extern SmMlAttributePos MlAttributeListMath[1]; extern SmMlAttributePos MlAttributeListMi[7]; extern SmMlAttributePos MlAttributeListMerror[4]; extern SmMlAttributePos MlAttributeListMn[7]; -extern SmMlAttributePos MlAttributeListMo[17]; +extern SmMlAttributePos MlAttributeListMo[18]; extern SmMlAttributePos MlAttributeListMrow[4]; extern SmMlAttributePos MlAttributeListMtext[7]; -extern SmMlAttributePos MlAttributeListMstyle[17]; +extern SmMlAttributePos MlAttributeListMstyle[18]; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/starmath/inc/mathml/def.hxx b/starmath/inc/mathml/def.hxx index 52cf70206b2f..38073671189c 100644 --- a/starmath/inc/mathml/def.hxx +++ b/starmath/inc/mathml/def.hxx @@ -76,6 +76,7 @@ enum class SmMlAttributeValueType : uint_fast8_t MlDir, MlDisplaystyle, MlFence, +MlForm, MlHref, MlLspace, MlMathbackground, @@ -123,6 +124,13 @@ enum class SmMlAttributeValueFence : uint_fast8_t MlTrue = 0x01 }; +enum class SmMlAttributeValueForm : uint_fast8_t +{ +MlPrefix = 0x01, +MlInfix = 0x02, +MlPosfix = 0x04 +}; + enum class SmMlAttributeValueHref : uint_fast8_t { NMlEmpty = 0x00, @@ -236,6 +244,11 @@ struct SmMlFence SmMlAttributeValueFence m_aFence; }; +struct SmMlForm +{ +SmMlAttributeValueForm m_aForm; +}; + struct SmMlHref { SmMlAttributeValueHref m_aHref; diff --git a/starmath/source/mathml/attribute.cxx b/starmath/source/mathml/attribute.cxx index da7668417327..61c4df609452 100644 --- a/starmath/source/mathml/attribute.cxx +++ b/starmath/source/mathml/attribute.cxx @@ -63,6 +63,9 @@ void SmMlAttribute::setDefaultAttributeValue() case SmMlAttributeValueType::MlFence: m_aAttributeValue.m_aFence.m_aFence = SmMlAttributeValueFence::MlFalse; break; +case SmMlAttributeValueType::MlForm: +m_aAttributeValue.m_aForm.m_aForm = SmMlAttributeValueForm::MlInfix; +break; case SmMlAttributeValueType::MlHref: m_aAttributeValue.m_aHref.m_aHref = SmMlAttributeValueHref::NMlEmpty; m_aAttributeValue.m_aHref.m_aLnk = new OUString(u""); @@ -139,6 +142,9 @@ void SmMlAttribute::setAttributeValue(const SmMlAttribute* aAttribute) case SmMlAttributeValueType::MlFence: setMlFence(aAttribute->getMlFence()); break; +case SmMlAttributeValueType::MlForm: +setMlForm(aAttribute->getMlForm()); +break; case SmMlAttributeValueType::MlHref: setMlHref(aAttribute->getMlHref()); break; @@ -212,6 +218,13 @@ const struct SmMlFence* SmMlAttribute::getMlFence() const return nullptr; } +const struct SmMlForm* SmMlAttribute::getMlForm() const +{ +if (m_aSmMlAttributeValueType == SmMlAttributeValueType::MlForm) +return _aAttributeValue.m_aForm; +return nullptr; +} +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/def.hxx | 16 +--- starmath/source/mathml/attribute.cxx |2 -- 2 files changed, 5 insertions(+), 13 deletions(-) New commits: commit 6daf48b50e1ff3bdd6a9f948c3e267e76b8a89d3 Author: dante AuthorDate: Sun Aug 8 22:48:50 2021 +0200 Commit: Noel Grandin CommitDate: Mon Aug 9 09:28:47 2021 +0200 Corrections to starmath mathml definitions Change-Id: I6f545ced857190ed4b0f4090c0d47611ff475b57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120183 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/def.hxx b/starmath/inc/mathml/def.hxx index 2db1612b4f0d..52cf70206b2f 100644 --- a/starmath/inc/mathml/def.hxx +++ b/starmath/inc/mathml/def.hxx @@ -30,10 +30,11 @@ enum class SmLengthUnit : uint_fast8_t MlPx, MlIn, MlCm, -MlMM, +MlMm, MlPt, MlPc, -MlP // Percent +MlP, // Percent +MlM // Multiplier }; struct SmLengthValue @@ -125,7 +126,7 @@ enum class SmMlAttributeValueFence : uint_fast8_t enum class SmMlAttributeValueHref : uint_fast8_t { NMlEmpty = 0x00, -NMlValie = 0x01 +NMlValid = 0x01 }; enum class SmMlAttributeValueLspace : uint_fast8_t @@ -164,7 +165,7 @@ enum class SmMlAttributeValueMathvariant : uint_fast16_t bold_fraktur = 0x001 | 0x010, bold_script = 0x001 | 0x008, bold_sans_serif = 0x001 | 0x020, -sans_serif_italic = 0x001 | 0x002 | 0x20, +sans_serif_italic = 0x002 | 0x20, sans_serif_bold_italic = 0x001 | 0x002 | 0x020, // Non english initial = 0x080, @@ -179,12 +180,6 @@ enum class SmMlAttributeValueMaxsize : uint_fast8_t MlFinite = 0x01 }; -enum class SmMlAttributeValueMinsize : uint_fast8_t -{ -MlInfinity = 0x00, -MlFinite = 0x01 -}; - /* * Specifies whether attached under- and overscripts move to sub- and superscript positions when displaystyle is false. * Source: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo @@ -282,7 +277,6 @@ struct SmMlMaxsize struct SmMlMinsize { -SmMlAttributeValueMinsize m_aMinsize; SmLengthValue m_aLengthValue; }; diff --git a/starmath/source/mathml/attribute.cxx b/starmath/source/mathml/attribute.cxx index 754f3604a7a3..da7668417327 100644 --- a/starmath/source/mathml/attribute.cxx +++ b/starmath/source/mathml/attribute.cxx @@ -94,7 +94,6 @@ void SmMlAttribute::setDefaultAttributeValue() m_aAttributeValue.m_aMaxsize.m_aLengthValue.m_aOriginalText = new OUString(u"1%"); break; case SmMlAttributeValueType::MlMinsize: -m_aAttributeValue.m_aMinsize.m_aMinsize = SmMlAttributeValueMinsize::MlInfinity; m_aAttributeValue.m_aMinsize.m_aLengthValue.m_aLengthUnit = SmLengthUnit::MlP; m_aAttributeValue.m_aMinsize.m_aLengthValue.m_aLengthValue = 1; m_aAttributeValue.m_aMinsize.m_aLengthValue.m_aOriginalText = new OUString(u"1%"); @@ -393,7 +392,6 @@ void SmMlAttribute::setMlMaxsize(const SmMlMaxsize* aMaxsize) void SmMlAttribute::setMlMinsize(const SmMlMinsize* aMinsize) { clearPreviousAttributeValue(); -m_aAttributeValue.m_aMinsize.m_aMinsize = aMinsize->m_aMinsize; m_aAttributeValue.m_aMinsize.m_aLengthValue.m_aLengthUnit = aMinsize->m_aLengthValue.m_aLengthUnit; m_aAttributeValue.m_aMinsize.m_aLengthValue.m_aLengthValue
[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/uiconfig
starmath/inc/dialog.hxx |1 starmath/inc/edit.hxx |1 starmath/source/dialog.cxx |7 +++ starmath/source/edit.cxx| 10 +++-- starmath/source/smmod.cxx |3 + starmath/source/unomodel.cxx|1 starmath/uiconfig/smath/ui/smathsettings.ui | 53 7 files changed, 72 insertions(+), 4 deletions(-) New commits: commit 1a0fd1c1342969e5b4d08d13764483cd8bada589 Author: dante AuthorDate: Fri May 14 13:46:41 2021 +0200 Commit: Heiko Tietze CommitDate: Fri May 28 10:57:26 2021 +0200 tdf#130654 editable smeditwindow zoom UI Change-Id: Ibedf060ea838876e3598ff449e6f200119570cc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115605 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index ac1f65ac9913..016d13ea7e10 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -49,6 +49,7 @@ class SmPrintOptionsTabPage final : public SfxTabPage std::unique_ptr m_xNoRightSpaces; std::unique_ptr m_xSaveOnlyUsedSymbols; std::unique_ptr m_xAutoCloseBrackets; +std::unique_ptr m_xSmZoom; DECL_LINK(SizeButtonClickHdl, weld::Toggleable&, void); diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 9a6ec77fdf95..a5dee85fdbd4 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -118,6 +118,7 @@ public: ESelection GetSelection() const; void SetSelection(const ESelection& rSel); +void UpdateStatus(bool bSetDocModified); bool IsEmpty() const; bool IsSelected() const; diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 802588f9c38c..ff1d001578de 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -170,6 +170,7 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(weld::Container* pPage, weld::Dialo , m_xNoRightSpaces(m_xBuilder->weld_check_button("norightspaces")) , m_xSaveOnlyUsedSymbols(m_xBuilder->weld_check_button("saveonlyusedsymbols")) , m_xAutoCloseBrackets(m_xBuilder->weld_check_button("autoclosebrackets")) +, m_xSmZoom(m_xBuilder->weld_metric_spin_button("smzoom", FieldUnit::PERCENT)) { m_xSizeNormal->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); m_xSizeScaled->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl)); @@ -180,6 +181,7 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(weld::Container* pPage, weld::Dialo SmPrintOptionsTabPage::~SmPrintOptionsTabPage() { +SmGetActiveView()->GetEditWindow()->UpdateStatus(false); } bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) @@ -200,7 +202,9 @@ bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet* rSet) rSet->Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), m_xNoRightSpaces->get_active())); rSet->Put(SfxBoolItem(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), m_xSaveOnlyUsedSymbols->get_active())); rSet->Put(SfxBoolItem(GetWhich(SID_AUTO_CLOSE_BRACKETS), m_xAutoCloseBrackets->get_active())); +rSet->Put(SfxUInt16Item(GetWhich(SID_SMEDITWINDOWZOOM), sal::static_int_cast(m_xSmZoom->get_value(FieldUnit::PERCENT; +SmGetActiveView()->GetEditWindow()->UpdateStatus(false); return true; } @@ -216,6 +220,9 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet* rSet) m_xZoom->set_value(static_cast(rSet->Get(GetWhich(SID_PRINTZOOM))).GetValue(), FieldUnit::PERCENT); +m_xSmZoom->set_sensitive(true); +m_xSmZoom->set_value(static_cast(rSet->Get(GetWhich(SID_SMEDITWINDOWZOOM))).GetValue(), FieldUnit::PERCENT); + m_xTitle->set_active(static_cast(rSet->Get(GetWhich(SID_PRINTTITLE))).GetValue()); m_xNoRightSpaces->set_active(static_cast(rSet->Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue()); m_xSaveOnlyUsedSymbols->set_active(static_cast(rSet->Get(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS))).GetValue()); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 373d3e8349d7..079be31c88ae 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -711,13 +711,17 @@ void SmEditTextWindow::UpdateStatus(bool bSetDocModified) SmModule *pMod = SM_MOD(); if (pMod && pMod->GetConfig()->IsAutoRedraw()) Flush(); -SmDocShell* pDoc = bSetDocModified ? mrEditWindow.GetDoc() : nullptr; -if (pDoc) -pDoc->SetModified(); +if (bSetDocModified) +mrEditWindow.GetDoc()->SetModified(); static_cast(GetEditEngine())->executeZoom(GetEditView()); } +void SmEditWindow::UpdateStatus(bool bSetDocModified) +{ +mxTextControl->UpdateStatus(bSetDocModified); +} + void SmEditWindow::Cut() { if (mxTextControl) diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 640eba718a34..e3b6c041903e 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -211,7
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx|2 +- starmath/source/view.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 72ebbea09644568837853198dd83aae1ab33036c Author: Caolán McNamara AuthorDate: Sun May 9 16:32:55 2021 +0100 Commit: Caolán McNamara CommitDate: Sun May 9 21:34:59 2021 +0200 cid#1401328 silence Uncaught exception Change-Id: I7cd29462586b1dfe6fb7268ec3225317c1d2d782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115268 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 320a3b065863..3f77dd76c29c 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -183,7 +183,7 @@ public: class SmCmdBoxWindow : public SfxDockingWindow { -std::unique_ptr m_xEdit; +std::unique_ptr> m_xEdit; SmEditControlleraController; boolbExiting; diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 59ab4bcfc3b8..b6d832fb1130 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -811,7 +811,7 @@ void SmEditController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWindow, vcl::Window *pParent) : SfxDockingWindow(pBindings_, pChildWindow, pParent, "EditWindow", "modules/smath/ui/editwindow.ui") -, m_xEdit(std::make_unique(*this, *m_xBuilder)) +, m_xEdit(new SmEditWindow(*this, *m_xBuilder)) , aController(*m_xEdit, SID_TEXT, *pBindings_) , bExiting(false) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx|2 +- starmath/source/edit.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 92c047486ee3dc8f327e1de858b206a38e921883 Author: Caolán McNamara AuthorDate: Sat May 8 19:39:03 2021 +0100 Commit: Caolán McNamara CommitDate: Sat May 8 21:58:43 2021 +0200 cid#1482285 silence Uncaught exception Change-Id: I0550dadd2990cb0d93b51570b2cc3136afb50907 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115263 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 0bed0b169a2f..9a6ec77fdf95 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -96,7 +96,7 @@ class SmEditWindow final public: SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin, weld::Builder& rBuilder); -~SmEditWindow(); +~SmEditWindow() COVERITY_NOEXCEPT_FALSE; weld::Window* GetFrameWeld() const; diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 52c86a3b3f5e..53115b6c093e 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -129,7 +129,7 @@ SmEditWindow::SmEditWindow(SmCmdBoxWindow , weld::Builder& rBuilder CreateEditView(rBuilder); } -SmEditWindow::~SmEditWindow() +SmEditWindow::~SmEditWindow() COVERITY_NOEXCEPT_FALSE { DeleteEditView(); mxScrolledWindow.reset(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx| 30 -- starmath/inc/view.hxx| 16 +++ starmath/source/edit.cxx | 99 --- starmath/source/view.cxx | 99 ++- 4 files changed, 106 insertions(+), 138 deletions(-) New commits: commit 148ad7cf92b216351fce464528af8db057f4 Author: Caolán McNamara AuthorDate: Thu May 6 16:28:12 2021 +0100 Commit: Caolán McNamara CommitDate: Fri May 7 09:47:09 2021 +0200 remove an intermediate layer of widgets Change-Id: I4fe23f87d997057a2cb061110c8e325c8322b95e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115187 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 773355cfff14..0bed0b169a2f 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -20,7 +20,6 @@ #pragma once #include -#include #include #include @@ -72,6 +71,7 @@ public: virtual bool Command(const CommandEvent& rCEvt) override; virtual void GetFocus() override; virtual void LoseFocus() override; +virtual void StyleUpdated() override; void SetText(const OUString& rText); void InsertText(const OUString& rText); @@ -83,34 +83,38 @@ public: void StartCursorMove(); }; -class SmEditWindow final : public InterimItemWindow +class SmEditWindow final { SmCmdBoxWindow& rCmdBox; std::unique_ptr mxScrolledWindow; std::unique_ptr mxTextControl; std::unique_ptr mxTextControlWin; -virtual void ApplySettings(vcl::RenderContext&) override; -virtual void DataChanged(const DataChangedEvent&) override; - DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); -void CreateEditView(); +void CreateEditView(weld::Builder& rBuilder); public: -explicit SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin); -virtual ~SmEditWindow() override; -virtual void dispose() override; +SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin, weld::Builder& rBuilder); +~SmEditWindow(); + +weld::Window* GetFrameWeld() const; SmDocShell* GetDoc(); SmViewShell* GetView(); EditView* GetEditView() const; EditEngine* GetEditEngine(); +SmCmdBoxWindow& GetCmdBox() const { return rCmdBox; } + +void SetText(const OUString& rText); +OUString GetText() const; +void Flush(); +void GrabFocus(); -// Window -virtual void SetText(const OUString& rText) override; -virtual OUString GetText() const override; -virtual void Command(const CommandEvent& rCEvt) override; +css::uno::Reference GetClipboard() const +{ +return mxTextControl->GetClipboard(); +} ESelection GetSelection() const; void SetSelection(const ESelection& rSel); diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 94733e251cf5..320a3b065863 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "document.hxx" #include "edit.hxx" @@ -182,7 +183,7 @@ public: class SmCmdBoxWindow : public SfxDockingWindow { -VclPtraEdit; +std::unique_ptr m_xEdit; SmEditControlleraController; boolbExiting; @@ -192,12 +193,6 @@ class SmCmdBoxWindow : public SfxDockingWindow protected: -// Window -virtual voidGetFocus() override; -virtual void Resize() override; -virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; -virtual void StateChanged( StateChangedType nStateChange ) override; - virtual Size CalcDockingSize(SfxChildAlignment eAlign) override; virtual SfxChildAlignment CheckAlignment(SfxChildAlignment eActual, SfxChildAlignment eWish) override; @@ -212,11 +207,16 @@ public: virtual ~SmCmdBoxWindow () override; virtual void dispose() override; +// Window +virtual void GetFocus() override; +virtual void StateChanged( StateChangedType nStateChange ) override; +virtual void Command(const CommandEvent& rCEvt) override; + void AdjustPosition(); SmEditWindow& GetEditWindow() { -return *aEdit; +return *m_xEdit; } SmViewShell* GetView(); }; diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 2a23122d395a..52c86a3b3f5e 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -100,6 +100,8 @@ void SmEditTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) { weld::CustomWidgetController::SetDrawingArea(pDrawingArea); +SetHelpId(HID_SMA_COMMAND_WIN_EDIT); + EnableRTL(false); EditEngine* pEditEngine = GetEditEngine(); @@ -118,42 +120,24 @@ void SmEditTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) InitAccessible(); } -SmEditWindow::SmEditWindow(SmCmdBoxWindow ) -: InterimItemWindow(,
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx|5 + starmath/source/edit.cxx | 12 2 files changed, 1 insertion(+), 16 deletions(-) New commits: commit 23e99c75ee5e3b8d15e041cefab0e99e384442bd Author: Caolán McNamara AuthorDate: Thu Apr 29 09:51:26 2021 +0100 Commit: Caolán McNamara CommitDate: Fri Apr 30 09:42:57 2021 +0200 drop DropTargetHelper from SmEditWindow dnd into its child always worked while the inheritence from DropTargetHelper began in commit daf3e2909104fcb4c0a36d6e1fd6f44e1b61c980 Author: jp Date: Thu Jul 5 09:58:51 2001 + Changes for TFD636 but always returned DND_ACTION_NONE for the parent window Change-Id: Ida1ae0f8e68ba04452ed952c4eca3ac66f240132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114847 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index c89c23bd599e..536885794c06 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -83,7 +83,7 @@ public: void StartCursorMove(); }; -class SmEditWindow final : public InterimItemWindow, public DropTargetHelper +class SmEditWindow final : public InterimItemWindow { SmCmdBoxWindow& rCmdBox; std::unique_ptr mxScrolledWindow; @@ -93,9 +93,6 @@ class SmEditWindow final : public InterimItemWindow, public DropTargetHelper virtual void ApplySettings(vcl::RenderContext&) override; virtual void DataChanged(const DataChangedEvent&) override; -virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override; -virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override; - DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); void CreateEditView(); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 26359d774682..ae9b6b7c61da 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -123,7 +123,6 @@ void SmEditTextWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) SmEditWindow::SmEditWindow(SmCmdBoxWindow ) : InterimItemWindow(, "modules/smath/ui/editwindow.ui", "EditWindow") -, DropTargetHelper(this) , rCmdBox(rMyCmdBoxWin) , mxScrolledWindow(m_xBuilder->weld_scrolled_window("scrolledwindow", true)) { @@ -158,7 +157,6 @@ void SmEditWindow::dispose() mxScrolledWindow.reset(); -DropTargetHelper::dispose(); InterimItemWindow::dispose(); } @@ -733,16 +731,6 @@ static bool HasMark(const OUString& rText) return rText.indexOf("") != -1; } -sal_Int8 SmEditWindow::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) -{ -return DND_ACTION_NONE; -} - -sal_Int8 SmEditWindow::ExecuteDrop( const ExecuteDropEvent& /*rEvt*/ ) -{ -return DND_ACTION_NONE; -} - ESelection SmEditWindow::GetSelection() const { if (mxTextControl) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/attribute.hxx| 14 ++ starmath/inc/mathml/def.hxx | 14 ++ starmath/inc/mathml/element.hxx | 14 ++ starmath/source/mathml/attribute.cxx | 14 ++ starmath/source/mathml/def.cxx | 14 ++ starmath/source/mathml/element.cxx | 14 ++ 6 files changed, 12 insertions(+), 72 deletions(-) New commits: commit 09b0ddac64a29bba9d9b09d608c24f0f57bb7f08 Author: dante AuthorDate: Mon Apr 26 16:13:04 2021 +0200 Commit: Mike Kaganski CommitDate: Tue Apr 27 04:51:23 2021 +0200 Correct some c/c++ licenses The affected files where added from scratch in commit 565bbd2e46e57117eb401344689858c3d749dc5c. In consequence instead of the ASF license; the correct license is the pure MPLv2 found here: TEMPLATE.SOURCECODE.HEADER Change-Id: Ie2fa275a6a986fff026a5096a10f79ab3c6ea85c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114670 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx index 1991e752918a..d6d71e931daa 100644 --- a/starmath/inc/mathml/attribute.hxx +++ b/starmath/inc/mathml/attribute.hxx @@ -1,20 +1,10 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #pragma once @@ -187,4 +177,4 @@ extern SmMlAttributePos MlAttributeListMtext[7]; extern SmMlAttributePos MlAttributeListMstyle[17]; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/starmath/inc/mathml/def.hxx b/starmath/inc/mathml/def.hxx index e65598f45b0c..2db1612b4f0d 100644 --- a/starmath/inc/mathml/def.hxx +++ b/starmath/inc/mathml/def.hxx @@ -1,20 +1,10 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #pragma once @@ -330,4 +320,4 @@ struct SmMlAttributePos uint_fast8_t m_nPos; }; -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/starmath/inc/mathml/element.hxx b/starmath/inc/mathml/element.hxx index e58506077e33..8843d5e8767d 100644 --- a/starmath/inc/mathml/element.hxx +++ b/starmath/inc/mathml/element.hxx @@ -1,20 +1,10 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - *
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|1 + starmath/source/ElementsDockingWindow.cxx |7 +++ 2 files changed, 8 insertions(+) New commits: commit 55e2c6c648ed94664903c0c6f53922d03e76b7c1 Author: Caolán McNamara AuthorDate: Fri Apr 23 10:42:58 2021 +0100 Commit: Caolán McNamara CommitDate: Fri Apr 23 14:27:51 2021 +0200 Related: tdf#140659 designate which widget to get default focus Change-Id: I8c8200756a7120db9a9c946889a30f6c549fd617 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114536 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index bf4a8f056dd4..249af40b1461 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -185,6 +185,7 @@ public: virtual void EndDocking( const tools::Rectangle& rReactangle, bool bFloatMode) override; virtual void ToggleFloatingMode() override; +virtual void GetFocus() override; void setSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion); }; diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 29d4aef5a646..cd03a7f7d338 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -1211,6 +1211,13 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf mxElementsControl->SetSelectHdl(LINK(this, SmElementsDockingWindow, SelectClickHandler)); } +void SmElementsDockingWindow::GetFocus() +{ +SfxDockingWindow::GetFocus(); +if (mxElementListBox) +mxElementListBox->grab_focus(); +} + SmElementsDockingWindow::~SmElementsDockingWindow () { disposeOnce(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source sw/qa writerfilter/source
starmath/inc/mathml/attribute.hxx |4 ++-- starmath/inc/mathml/def.hxx |8 starmath/source/mathml/element.cxx|2 +- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |2 +- writerfilter/source/dmapper/GraphicImport.cxx |4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) New commits: commit af8eaeeb16991eb0b2804d7570521726f4913196 Author: Andrea Gelmini AuthorDate: Thu Apr 22 10:57:24 2021 +0200 Commit: Julien Nabet CommitDate: Thu Apr 22 19:56:39 2021 +0200 Fix typos Change-Id: Id06dc8750b735ecdba26ac607394c6e7dee16db2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114470 Reviewed-by: Julien Nabet Reviewed-by: Dante DM Tested-by: Jenkins diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx index c30053c9d037..1991e752918a 100644 --- a/starmath/inc/mathml/attribute.hxx +++ b/starmath/inc/mathml/attribute.hxx @@ -22,8 +22,8 @@ #include "def.hxx" /* All possible data needed to do the job outside mathml limits */ -// Ml prefix means it is part of mathml standar -// NMl means it is not part of mathml standar but needed info to work +// Ml prefix means it is part of mathml standard +// NMl means it is not part of mathml standard but needed info to work /* Union for storing the mathml attribute value */ /*/ diff --git a/starmath/inc/mathml/def.hxx b/starmath/inc/mathml/def.hxx index 6fccf79d6fab..e65598f45b0c 100644 --- a/starmath/inc/mathml/def.hxx +++ b/starmath/inc/mathml/def.hxx @@ -22,15 +22,15 @@ #include /* All possible data needed to do the job outside mathml limits */ -// Ml prefix means it is part of mathml standar -// NMl means it is not part of mathml standar but needed info to work +// Ml prefix means it is part of mathml standard +// NMl means it is not part of mathml standard but needed info to work /* For now empty, don't know yet what's needed besides default font size. */ struct SmGlobalData { }; -/* Mthml length tools */ +/* Mhtml length tools */ /*/ enum class SmLengthUnit : uint_fast8_t @@ -50,7 +50,7 @@ struct SmLengthValue { SmLengthUnit m_aLengthUnit; double m_aLengthValue; -// Keeps original text value to avoid numerial error data loss +// Keeps original text value to avoid numerical error data loss OUString* m_aOriginalText; }; diff --git a/starmath/source/mathml/element.cxx b/starmath/source/mathml/element.cxx index 32ac040e0f2e..1d5733860e53 100644 --- a/starmath/source/mathml/element.cxx +++ b/starmath/source/mathml/element.cxx @@ -106,7 +106,7 @@ void SmMlElement::setSubElement(size_t nPos, SmMlElement* aElement) { // This is the new parent element aElement->setParentElement(this); -// Check if the vector is long enought +// Check if the vector is long enough // Careful nOldSize can be 0 and -1 will underflow // We must put something on the empty locations size_t nOldSize = m_aSubElements.size(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 0a71b2535587..3e60031d6d59 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -126,7 +126,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlTextshapeB, "dml-textshapeB.docx") uno::Reference xShape(xGroup->getByIndex(3), uno::UNO_QUERY); // Connector was incorrectly shifted towards the top left corner, X was 192, Y was -5743. CPPUNIT_ASSERT_EQUAL(sal_Int32(3776), xShape->getPosition().X); -// Value as of LO7.2. Whole group is still shifted 3mm to rigth and 5mm down. +// Value as of LO7.2. Whole group is still shifted 3mm to right and 5mm down. CPPUNIT_ASSERT_EQUAL(sal_Int32(-5063), xShape->getPosition().Y); xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 56d274719805..66f36e38959d 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -512,7 +512,7 @@ void GraphicImport::putPropertyToFrameGrabBag( const OUString& sPropertyName, co static bool lcl_bHasGroupSlantedChild (const SdrObject* pObj) { -// Returns true, if a child object differs more then 0.02deg from horizontal or vertical. +// Returns true, if a child object differs more than 0.02deg from horizontal or vertical. // Because lines sometimes are imported as customshapes, a horizontal or vertical line // might not have exactly 0, 90, 180, or 270 degree as rotate angle. if (!pObj) @@ -927,7 +927,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) const awt::Point
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx|3 --- starmath/source/edit.cxx | 20 2 files changed, 23 deletions(-) New commits: commit f3bb88b67b350900f60934e0f7bd550fa4fd47ec Author: Caolán McNamara AuthorDate: Mon Apr 19 11:58:46 2021 +0100 Commit: Caolán McNamara CommitDate: Mon Apr 19 16:54:35 2021 +0200 remove apparently no longer necessary scrollbar hide/show hack before using weldeditview a revert of: commit 67311738157bced7b49e94b24845091995edb142 Date: Thu Nov 7 02:53:09 2013 -0200 fdo#65588 - Elements Dock: Scrollbar moves into input window and inserting multiple copies of the Taylor series rapidly shows a glitch with the horizontal scrollbar as described in command #6 but after using weldeditview reverting this doesn't show the broken behaviour so I'll drop this hackaround Change-Id: I09e654cbd05b08d8e46fbf1986dbc4959687ea02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114264 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 3a77af082008..c89c23bd599e 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -136,9 +136,6 @@ public: void SelPrevMark(); void DeleteEditView(); - -void HideScrollbars(); -void ShowScrollbars(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 555e4d8442e3..a02ad7436500 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -828,18 +828,6 @@ void SmEditWindow::InsertText(const OUString& rText) mxTextControl->InsertText(rText); } -void SmEditWindow::HideScrollbars() -{ -mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER); -mxScrolledWindow->set_hpolicy(VclPolicyType::NEVER); -} - -void SmEditWindow::ShowScrollbars() -{ -mxScrolledWindow->set_vpolicy(VclPolicyType::ALWAYS); -mxScrolledWindow->set_hpolicy(VclPolicyType::ALWAYS); -} - void SmEditTextWindow::InsertText(const OUString& rText) { EditView* pEditView = GetEditView(); @@ -871,15 +859,7 @@ void SmEditTextWindow::InsertText(const OUString& rText) if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ') string = " " + string; -/* - fdo#65588 - Elements Dock: Scrollbar moves into input window - This change "solves" the visual problem. But I don't think so - this is the best solution. -*/ -mrEditWindow.HideScrollbars(); pEditView->InsertText(string); -mrEditWindow.AdjustScrollBars(); -mrEditWindow.ShowScrollbars(); // Remember start of the selection and move the cursor there afterwards. aSelection.nEndPara = aSelection.nStartPara; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx|1 starmath/inc/node.hxx| 23 -- starmath/inc/parse5.hxx |1 starmath/inc/token.hxx | 18 --- starmath/source/edit.cxx |2 starmath/source/node.cxx |4 - starmath/source/parse5.cxx | 98 +++ starmath/source/view.cxx |9 --- starmath/source/visitors.cxx | 27 +++ 9 files changed, 132 insertions(+), 51 deletions(-) New commits: commit b3b1936ecdf5396892849d0e90d94324fad609ac Author: dante AuthorDate: Sun Mar 14 19:11:58 2021 +0100 Commit: Noel Grandin CommitDate: Thu Mar 18 09:48:25 2021 +0100 Use ESelection to locate code on node instead of SmToken Will allow to use different input sources besides starmath code. Also, for adopting mathml standar the purpose is to make smnodes separate from the starmath code. Change-Id: Iefab5943cf59a8d2e31f5d59406c253fbe680ead Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112477 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 78ab94bbd702..279c06867dc2 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -22,7 +22,6 @@ #include #include #include -#include class SmDocShell; class SmViewShell; diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index acbedccc7c2a..7014f7c2363f 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -67,6 +67,8 @@ #include "format.hxx" #include "nodetype.hxx" +#include + enum class FontAttribute { None = 0x, Bold = 0x0001, @@ -120,9 +122,12 @@ enum class SmScaleMode class SmNode : public SmRect { - +// Rendering info for SmRect SmFace maFace; +// Anclage to the code SmToken maNodeToken; +ESelection m_aESelection; +// Node information SmNodeType meType; SmScaleMode meScaleMode; RectHorAlignmeRectHorAlign; @@ -340,14 +345,14 @@ public: * It is used to do the visual <-> text correspondence. * @return line */ -sal_uInt16 GetRow() const { return sal::static_int_cast(maNodeToken.nRow); } +sal_uInt16 GetRow() const { return sal::static_int_cast(m_aESelection.nStartPara); } /** * Gets the column of the line in the text where the node is located. * It is used to do the visual <-> text correspondence. * @return column */ -sal_uInt16 GetColumn() const { return sal::static_int_cast(maNodeToken.nCol); } +sal_uInt16 GetColumn() const { return sal::static_int_cast(m_aESelection.nStartPos); } /** * Gets the scale mode. @@ -381,6 +386,18 @@ public: const SmToken & GetToken() const { return maNodeToken; } SmToken & GetToken() { return maNodeToken; } +/** + * Gets node position in input text. + * @return node position in input text + */ +ESelection GetSelection() const { return m_aESelection; } + +/** + * Gets node position in input text. + * @param aESelection + */ +void SetSelection(ESelection aESelection) { m_aESelection = aESelection; } + /** * Finds the node from the position in the text. * It is used to do the visual <-> text correspondence. diff --git a/starmath/inc/parse5.hxx b/starmath/inc/parse5.hxx index 1d312351fb36..bfc09a139e5a 100644 --- a/starmath/inc/parse5.hxx +++ b/starmath/inc/parse5.hxx @@ -29,6 +29,7 @@ class SmParser5 : public AbstractSmParser { OUString m_aBufferString; SmToken m_aCurToken; +ESelection m_aCurESelection; std::vector m_aErrDescList; int m_nCurError; sal_Int32 m_nBufferIndex, m_nTokenIndex; diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 8555d745fc72..e38b3e5afb5a 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -223,17 +223,11 @@ struct SmToken TG nGroup; sal_uInt16 nLevel; -// token position -sal_Int32 nRow; // 1-based -sal_Int32 nCol; // 1-based - SmToken() : eType(TUNKNOWN) , cMathChar('\0') , nGroup(TG::NONE) , nLevel(0) -, nRow(0) -, nCol(0) { } @@ -244,8 +238,6 @@ struct SmToken , cMathChar(cMath) , nGroup(nTokenGroup) , nLevel(nTokenLevel) -, nRow(0) -, nCol(0) { } @@ -256,8 +248,6 @@ struct SmToken cMathChar = OUString(, 1); nGroup = aTokenTableEntry.nGroup; nLevel = aTokenTableEntry.nLevel; -nRow = 0; -nCol = 0; } void operator=(const SmTokenTableEntry* aTokenTableEntry) @@ -267,8 +257,6 @@ struct SmToken cMathChar = OUString(>cMathChar, 1); nGroup = aTokenTableEntry->nGroup; nLevel = aTokenTableEntry->nLevel; -nRow = 0; -nCol = 0; } void operator=(const SmColorTokenTableEntry& aTokenTableEntry) @@ -278,8 +266,6 @@
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/node.hxx | 16 --- starmath/inc/nodetype.hxx | 97 ++ starmath/source/node.cxx | 14 -- 3 files changed, 98 insertions(+), 29 deletions(-) New commits: commit 50ef3d86ee8567bd5c84ff9aacc966675fe401cc Author: dante AuthorDate: Tue Mar 9 19:23:35 2021 +0100 Commit: Noel Grandin CommitDate: Mon Mar 15 07:30:00 2021 +0100 Provide node type with more analysis capabilities Change-Id: I3b3b866a9fdf0b5d0b9f40c0ce9bddbaf2c0b1ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112235 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 8d21a63dd508..acbedccc7c2a 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -65,6 +65,7 @@ #include "token.hxx" #include "rect.hxx" #include "format.hxx" +#include "nodetype.hxx" enum class FontAttribute { None = 0x, @@ -117,21 +118,6 @@ enum class SmScaleMode Height }; -enum class SmNodeType -{ -/* 0*/ Table, Brace, Bracebody, Oper,Align, -/* 5*/ Attribute, Font, UnHor, BinHor, BinVer, -/*10*/ BinDiagonal, SubSup,Matrix,Place, Text, -/*15*/ Special, GlyphSpecial, Math, Blank, Error, -/*20*/ Line,Expression,PolyLine, Root,RootSymbol, -/*25*/ Rectangle, VerticalBrace, MathIdent -}; - -namespace starmathdatabase -{ -bool isStructuralNode(SmNodeType ntype); -} - class SmNode : public SmRect { diff --git a/starmath/inc/nodetype.hxx b/starmath/inc/nodetype.hxx new file mode 100644 index ..f59e02895d4f --- /dev/null +++ b/starmath/inc/nodetype.hxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +/** + * This file provides definition for the nodetypes. + * Also provides analysis of the node functions + */ + +enum class SmNodeType : int_fast16_t +{ +Table, // tree header +Brace, // () [] {} +Bracebody, // content of () [] {} +Oper, // largeop +Align, // alignment +Attribute, // attributes +Font, // fonts +UnHor, // unmo +BinHor, // binmo +BinVer, // over frac +BinDiagonal, // slash +SubSup, // lsub lsup rsub rsup csub csup +Matrix, // binom matrix +Place, // +Text, // "text" +Special, // %glyph +GlyphSpecial, // %glyph +Math, // operator value +Blank, // ~ +Error, // Syntax error +Line, // a line of math untill newline +Expression, // { content in here } +PolyLine, // ^ +Root, // root node +RootSymbol, // 3 of cubic root +Rectangle, //just structual +VerticalBrace, // vertical {} +MathIdent // identities and variables +}; + +namespace starmathdatabase +{ +inline bool isStructuralNode(SmNodeType aNodeTypeName) +{ +return aNodeTypeName == SmNodeType::Table || aNodeTypeName == SmNodeType::Line + || aNodeTypeName == SmNodeType::UnHor || aNodeTypeName == SmNodeType::BinHor + || aNodeTypeName == SmNodeType::BinVer || aNodeTypeName == SmNodeType::BinDiagonal + || aNodeTypeName == SmNodeType::SubSup || aNodeTypeName == SmNodeType::Matrix + || aNodeTypeName == SmNodeType::Root || aNodeTypeName == SmNodeType::Expression + || aNodeTypeName == SmNodeType::Brace || aNodeTypeName == SmNodeType::Bracebody + || aNodeTypeName == SmNodeType::Oper || aNodeTypeName == SmNodeType::Align + || aNodeTypeName == SmNodeType::Attribute || aNodeTypeName == SmNodeType::Font; +} + +inline bool isBinOperatorNode(SmNodeType aNodeTypeName) +{ +return aNodeTypeName == SmNodeType::BinHor || aNodeTypeName == SmNodeType::BinVer + || aNodeTypeName == SmNodeType::BinDiagonal || aNodeTypeName == SmNodeType::SubSup; +} + +inline bool isUnOperatorNode(SmNodeType aNodeTypeName) +{ +return aNodeTypeName == SmNodeType::UnHor; +} + +inline bool isOperatorNode(SmNodeType aNodeTypeName) +{ +return aNodeTypeName == SmNodeType::BinHor || aNodeTypeName == SmNodeType::BinVer + || aNodeTypeName
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/mathmlexport.hxx| 35 +--- starmath/source/document.cxx|2 - starmath/source/mathml/mathmlexport.cxx | 20 +++--- 3 files changed, 28 insertions(+), 29 deletions(-) New commits: commit 4e57d6a51c5d619ff41e1a2990267fdc67b0e53a Author: dante AuthorDate: Sun Mar 7 12:30:57 2021 +0100 Commit: Noel Grandin CommitDate: Sun Mar 7 15:50:19 2021 +0100 Simplify the use of custom hmtl/mathml entities on matmlexport This patch also serves as a base for further improvements. Change-Id: I72967e3c9739576fb74d16e656f41c440af3a4ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112127 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/mathmlexport.hxx b/starmath/inc/mathml/mathmlexport.hxx index 3a32a6e164f5..eae2dd4d7423 100644 --- a/starmath/inc/mathml/mathmlexport.hxx +++ b/starmath/inc/mathml/mathmlexport.hxx @@ -57,22 +57,25 @@ public: bool Export(SfxMedium& rMedium); void SetFlat(bool bIn) { bFlat = bIn; } -void useHTMLMLEntities(bool bUseHTMLMLEntities) { m_bUseHTMLMLEntities = bUseHTMLMLEntities; } - -static bool -WriteThroughComponent(const css::uno::Reference& xOutputStream, - const css::uno::Reference& xComponent, - css::uno::Reference const& rxContext, - css::uno::Reference const& rPropSet, - const char* pComponentName, bool bUseHTMLMLEntities); - -static bool -WriteThroughComponent(const css::uno::Reference& xStor, - const css::uno::Reference& xComponent, - const char* pStreamName, - css::uno::Reference const& rxContext, - css::uno::Reference const& rPropSet, - const char* pComponentName, bool bUseHTMLMLEntities); + +bool IsUseHTMLMLEntities() const { return m_bUseHTMLMLEntities; } +void SetUseHTMLMLEntities(bool bUseHTMLMLEntities) +{ +m_bUseHTMLMLEntities = bUseHTMLMLEntities; +} + +bool WriteThroughComponent(const css::uno::Reference& xOutputStream, + const css::uno::Reference& xComponent, + css::uno::Reference const& rxContext, + css::uno::Reference const& rPropSet, + const char* pComponentName); + +bool WriteThroughComponent(const css::uno::Reference& xStor, + const css::uno::Reference& xComponent, + const char* pStreamName, + css::uno::Reference const& rxContext, + css::uno::Reference const& rPropSet, + const char* pComponentName); }; class SmXMLExport final : public SvXMLExport diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 67e216611e57..0b908d00fc76 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -862,7 +862,7 @@ bool SmDocShell::ConvertTo( SfxMedium ) Reference xModel(GetModel()); SmXMLExportWrapper aEquation(xModel); aEquation.SetFlat(true); -aEquation.useHTMLMLEntities(true); +aEquation.SetUseHTMLMLEntities(true); bRet = aEquation.Export(rMedium); } else if (pFlt->GetFilterName() == "MathType 3.x") diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index f1952b5057cc..d125e49be6a2 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -185,8 +185,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) bRet = WriteThroughComponent(xStg, xModelComp, "meta.xml", xContext, xInfoSet, (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaExporter" - : "com.sun.star.comp.Math.XMLMetaExporter"), - m_bUseHTMLMLEntities); + : "com.sun.star.comp.Math.XMLMetaExporter")); } if (bRet) { @@ -194,8 +193,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) xStatusIndicator->setValue(nSteps++); bRet = WriteThroughComponent(xStg, xModelComp, "content.xml", xContext, xInfoSet, - "com.sun.star.comp.Math.XMLContentExporter", - m_bUseHTMLMLEntities); + "com.sun.star.comp.Math.XMLContentExporter"); } if (bRet) @@ -205,8 +203,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) bRet = WriteThroughComponent(xStg, xModelComp,
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx| 43 +- starmath/source/ElementsDockingWindow.cxx | 90 -- starmath/source/document.cxx | 12 +++- 3 files changed, 99 insertions(+), 46 deletions(-) New commits: commit 9129dd6f168d9bc2a303edb4469f0590a8234059 Author: dante AuthorDate: Tue Mar 2 09:51:14 2021 +0100 Commit: Noel Grandin CommitDate: Sun Mar 7 13:26:09 2021 +0100 Starmath now allows multiple parsers fourth part Now smelementdockingwindow is version sensitible. Change-Id: I1ed172d03f0756f1603a9ff20aadcea59fe35e9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111805 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 74aab1865d45..bf4a8f056dd4 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -63,18 +63,26 @@ class SmElementsControl : public weld::CustomWidgetController friend class ElementSelectorUIObject; friend class ElementUIObject; -static const SmElementDescr m_aUnaryBinaryOperatorsList[]; -static const SmElementDescr m_aRelationsList[]; -static const SmElementDescr m_aSetOperationsList[]; -static const SmElementDescr m_aFunctionsList[]; -static const SmElementDescr m_aOperatorsList[]; -static const SmElementDescr m_aAttributesList[]; -static const SmElementDescr m_aBracketsList[]; -static const SmElementDescr m_aFormatsList[]; -static const SmElementDescr m_aOthersList[]; -static const SmElementDescr m_aExamplesList[]; -static const std::tuple m_aCategories[]; -static const size_t m_aCategoriesSize; +// SmParser 5 elements +static const SmElementDescr m_a5UnaryBinaryOperatorsList[]; +static const SmElementDescr m_a5RelationsList[]; +static const SmElementDescr m_a5SetOperationsList[]; +static const SmElementDescr m_a5FunctionsList[]; +static const SmElementDescr m_a5OperatorsList[]; +static const SmElementDescr m_a5AttributesList[]; +static const SmElementDescr m_a5BracketsList[]; +static const SmElementDescr m_a5FormatsList[]; +static const SmElementDescr m_a5OthersList[]; +static const SmElementDescr m_a5ExamplesList[]; +static const std::tuple m_a5Categories[]; +static const size_t m_a5CategoriesSize; + +// SmParser 6 elements +static const std::tuple m_a6Categories[0]; +static const size_t m_a6CategoriesSize = 0; + +// Parser for them +std::unique_ptr maParser; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; @@ -91,8 +99,8 @@ class SmElementsControl : public weld::CustomWidgetController OString msCurrentSetId; sal_uInt16m_nCurrentElement; sal_uInt16m_nCurrentRolloverElement; -sal_uInt16 m_nCurrentOffset; -SmParser maParser; +sal_uInt16m_nCurrentOffset; +sal_uInt16m_nSmSyntaxVersion; Link maSelectHdlLink; std::vector< std::unique_ptr > maElementList; @@ -123,8 +131,8 @@ public: explicit SmElementsControl(std::unique_ptr xScrolledWindow); virtual ~SmElementsControl() override; -static const auto& categories() { return m_aCategories; } -static size_t categoriesSize() { return m_aCategoriesSize; } +static const auto& categories() { return m_a5Categories; } +static size_t categoriesSize() { return m_a5CategoriesSize; } const OString& elementSetId() const { return msCurrentSetId; } void setElementSetId(const char* pSetId); @@ -139,6 +147,7 @@ public: OUString itemName(sal_uInt16) const; bool itemTrigger(sal_uInt16); void setItemHighlighted(sal_uInt16); +void setSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion); sal_uInt16 itemOffset() const { return m_nCurrentOffset; } virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; @@ -176,6 +185,8 @@ public: virtual void EndDocking( const tools::Rectangle& rReactangle, bool bFloatMode) override; virtual void ToggleFloatingMode() override; + +void setSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion); }; class SmElementsDockingWindowWrapper final : public SfxChildWindow diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 623f8202b079..4db585fa0d1a 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,7 @@ SmElementSeparator::SmElementSeparator() : SmElement(std::unique_ptr(), OUString(), OUString()) {} -const SmElementDescr SmElementsControl::m_aUnaryBinaryOperatorsList[] = +const SmElementDescr SmElementsControl::m_a5UnaryBinaryOperatorsList[] = { {RID_PLUSX,
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx|3 +++ starmath/source/view.cxx |9 + 2 files changed, 12 insertions(+) New commits: commit cbd4dba6d6f056f4ffa2e1a199d75a235cb037b0 Author: dante AuthorDate: Fri Mar 5 11:24:31 2021 +0100 Commit: Noel Grandin CommitDate: Sat Mar 6 13:12:25 2021 +0100 Add to smviewshell an acces to the docking window Change-Id: Ib5830ba0fef201cabb4e2589cbc277b72ed6b399 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111999 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index b3d5b72f4a6d..411904105059 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -35,6 +35,7 @@ class SmViewShell; class SmPrintUIOptions; class SmGraphicAccessible; +class SmElementsDockingWindow; namespace svtools { class ColorConfig; } @@ -274,6 +275,8 @@ public: return *mpGraphic; } +SmElementsDockingWindow* GetDockingWindow(); + voidSetStatusText(const OUString& rText); voidShowError( const SmErrorDesc *pErrorDesc ); diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index ee72fb55b40c..b9399656d006 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1276,6 +1276,15 @@ SmEditWindow *SmViewShell::GetEditWindow() return nullptr; } +SmElementsDockingWindow* SmViewShell::GetDockingWindow() +{ +auto eldockwinwrap = GetViewFrame()->GetChildWindow(SmElementsDockingWindowWrapper::GetChildWindowId()); +if(eldockwinwrap) +return dynamic_cast(eldockwinwrap->GetWindow()); +else +return nullptr; +} + void SmViewShell::SetStatusText(const OUString& rText) { maStatusText = rText; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|3 starmath/source/ElementsDockingWindow.cxx | 122 ++ 2 files changed, 62 insertions(+), 63 deletions(-) New commits: commit 1627539c847dc0afe7441855181a69bc614d60b5 Author: dante AuthorDate: Mon Mar 1 22:19:29 2021 +0100 Commit: Noel Grandin CommitDate: Tue Mar 2 07:18:31 2021 +0100 Simplify ElementsDockingWindow This is not related to the multiple smparsers. Just simple code simplification. Change-Id: Id95e3b106dfc02fbb8d9d4ee28f21aebc597cd5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111799 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 153518b210ba..74aab1865d45 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -92,6 +92,7 @@ class SmElementsControl : public weld::CustomWidgetController sal_uInt16m_nCurrentElement; sal_uInt16m_nCurrentRolloverElement; sal_uInt16 m_nCurrentOffset; +SmParser maParser; Link maSelectHdlLink; std::vector< std::unique_ptr > maElementList; @@ -101,7 +102,7 @@ class SmElementsControl : public weld::CustomWidgetController bool m_bFirstPaintAfterLayout; rtl::Reference m_xAccessible; -void addElement(SmParser , const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); +void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); void addElements(const SmElementDescr aElementsArray[], sal_uInt16 size); SmElement* current() const; void setCurrentElement(sal_uInt16); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 7dacc85e2a1f..623f8202b079 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -291,6 +291,7 @@ SmElementsControl::SmElementsControl(std::unique_ptr xScro { mxScroll->connect_hadjustment_changed( LINK(this, SmElementsControl, ScrollHdl) ); mxScroll->connect_vadjustment_changed( LINK(this, SmElementsControl, ScrollHdl) ); +maParser.SetImportSymbolNames(true); } SmElementsControl::~SmElementsControl() @@ -839,11 +840,11 @@ IMPL_LINK_NOARG( SmElementsControl, ScrollHdl, weld::ScrolledWindow&, void ) Invalidate(); } -void SmElementsControl::addElement(SmParser , const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) +void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) { // SAL_MAX_UINT16 is invalid, zero is the scrollbar assert(maElementList.size() < SAL_MAX_UINT16 - 2); -auto pNode = rParser.ParseExpression(aElementVisual); +auto pNode = maParser.ParseExpression(aElementVisual); OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); rDevice.Push(PushFlags::MAPMODE); @@ -878,9 +879,6 @@ void SmElementsControl::setElementSetId(const char* pSetId) void SmElementsControl::addElements(const SmElementDescr aElementsArray[], sal_uInt16 aElementsArraySize) { -SmParser aParser; -aParser.SetImportSymbolNames(true); - for (sal_uInt16 i = 0; i < aElementsArraySize ; i++) { const char* pElement = aElementsArray[i].first; @@ -890,122 +888,122 @@ void SmElementsControl::addElements(const SmElementDescr aElementsArray[], sal_u } else { OUString aElement(OUString::createFromAscii(pElement)); if (aElement == RID_NEWLINE) -addElement(aParser, OUString(u"\u21B5"), aElement, SmResId(pElementHelp)); +addElement(OUString(u"\u21B5"), aElement, SmResId(pElementHelp)); else if (aElement == RID_SBLANK) -addElement(aParser, "\"`\"", aElement, SmResId(pElementHelp)); +addElement("\"`\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_BLANK) -addElement(aParser, "\"~\"", aElement, SmResId(pElementHelp)); +addElement("\"~\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_PHANTOMX) -addElement(aParser, "\"" + SmResId(STR_HIDE) +"\"", aElement, SmResId(pElementHelp)); +addElement("\"" + SmResId(STR_HIDE) +"\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_BOLDX) -addElement(aParser, "bold B", aElement, SmResId(pElementHelp)); +addElement("bold B", aElement, SmResId(pElementHelp)); else if (aElement == RID_ITALX) -addElement(aParser, "ital I", aElement, SmResId(pElementHelp)); +addElement("ital I", aElement, SmResId(pElementHelp)); else if (aElement == RID_SIZEXY) -addElement(aParser, "\"" +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/AccessibleSmElement.hxx |6 ++ starmath/inc/AccessibleSmElementsControl.hxx |6 ++ starmath/inc/ElementsDockingWindow.hxx |5 + starmath/inc/action.hxx |1 + starmath/inc/caret.hxx |6 ++ starmath/inc/cfgitem.hxx |5 + starmath/inc/cursor.hxx |6 ++ starmath/inc/dialog.hxx |7 ++- starmath/inc/document.hxx|5 + starmath/inc/edit.hxx|6 ++ starmath/inc/format.hxx |5 + starmath/inc/helpids.h |6 ++ starmath/inc/mathml/mathmlMo.hxx |5 + starmath/inc/mathml/mathmlattr.hxx |5 + starmath/inc/mathml/mathmlexport.hxx |5 + starmath/inc/mathml/mathmlimport.hxx |5 + starmath/inc/mathml/starmathdatabase.hxx |2 ++ starmath/inc/mathml/xparsmlbase.hxx |5 ++--- starmath/inc/node.hxx|6 +- starmath/inc/parse.hxx |5 + starmath/inc/parse5.hxx |5 + starmath/inc/parsebase.hxx |5 + starmath/inc/rect.hxx|5 + starmath/inc/smdll.hxx |6 ++ starmath/inc/smdllapi.hxx|5 + starmath/inc/smmod.hrc |6 ++ starmath/inc/smmod.hxx |5 + starmath/inc/starmath.hrc|5 + starmath/inc/strings.hrc |5 + starmath/inc/strings.hxx |5 + starmath/inc/symbol.hxx |5 + starmath/inc/token.hxx |5 + starmath/inc/types.hxx |5 + starmath/inc/unomodel.hxx|7 ++- starmath/inc/utility.hxx |6 ++ starmath/inc/view.hxx|6 ++ starmath/inc/visitors.hxx|5 + starmath/source/accessibility.hxx|6 +- starmath/source/eqnolefilehdr.hxx|5 + starmath/source/mathtype.hxx |6 +- starmath/source/ooxmlexport.hxx |5 + starmath/source/ooxmlimport.hxx |5 + starmath/source/rtfexport.hxx|5 + starmath/source/smdetect.hxx |5 + starmath/source/tmpdevice.hxx|5 + starmath/source/uiobject.hxx |5 + starmath/source/wordexportbase.hxx |5 + 47 files changed, 61 insertions(+), 184 deletions(-) New commits: commit 1a9dd0084d2c6057eca57cf069c77a7bad4d9724 Author: dante AuthorDate: Sun Feb 28 11:25:21 2021 +0100 Commit: Roman Kuznetsov CommitDate: Mon Mar 1 12:43:08 2021 +0100 tdf#124176 on starmath Change-Id: I816a12d5f47dd258fb01f14b901328d3e3d68e28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111690 Tested-by: Jenkins Reviewed-by: Roman Kuznetsov diff --git a/starmath/inc/AccessibleSmElement.hxx b/starmath/inc/AccessibleSmElement.hxx index 2fb130719acf..c1e7e6526872 100644 --- a/starmath/inc/AccessibleSmElement.hxx +++ b/starmath/inc/AccessibleSmElement.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENT_HXX -#define INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENT_HXX + +#pragma once #include #include @@ -98,6 +98,4 @@ public: SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override; }; -#endif // INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENT_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/AccessibleSmElementsControl.hxx b/starmath/inc/AccessibleSmElementsControl.hxx index 7d7e75b6ff4d..bdb5e25ea724 100644 --- a/starmath/inc/AccessibleSmElementsControl.hxx +++ b/starmath/inc/AccessibleSmElementsControl.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENTSCONTROL_HXX -#define INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENTSCONTROL_HXX + +#pragma once #include #include @@ -103,6 +103,4 @@ void AccessibleSmElementsControl::AcquireFocus() { UpdateFocus(SAL_MAX_UINT16); void AccessibleSmElementsControl::ReleaseFocus(sal_uInt16 nPos) { UpdateFocus(nPos); } -#endif // INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENTSCONTROL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|7 +-- starmath/inc/caret.hxx|5 - starmath/inc/cfgitem.hxx |3 --- starmath/inc/cursor.hxx |5 - starmath/inc/dialog.hxx |1 - starmath/inc/document.hxx |5 - starmath/inc/edit.hxx |1 - starmath/inc/mathml/mathmlimport.hxx |1 - starmath/inc/node.hxx |6 -- starmath/inc/parsebase.hxx|4 starmath/inc/smmod.hxx|2 -- starmath/inc/token.hxx| 12 ++-- starmath/inc/unomodel.hxx |2 -- starmath/inc/view.hxx |4 starmath/inc/visitors.hxx |2 -- starmath/source/ElementsDockingWindow.cxx |2 -- starmath/source/accessibility.cxx |5 - starmath/source/accessibility.hxx |1 - starmath/source/cfgitem.cxx |4 starmath/source/cursor.cxx|2 -- starmath/source/dialog.cxx|2 -- starmath/source/document.cxx |1 - starmath/source/edit.cxx |1 - starmath/source/mathml/mathmlexport.cxx |1 - starmath/source/mathml/mathmlimport.cxx |2 -- starmath/source/mathtype.cxx |5 + starmath/source/mathtype.hxx |8 +--- starmath/source/node.cxx | 14 -- starmath/source/ooxmlexport.cxx |1 - starmath/source/parse5.cxx|5 - starmath/source/rect.cxx |2 -- starmath/source/rtfexport.cxx |2 -- starmath/source/symbol.cxx|2 -- starmath/source/uiobject.hxx |2 -- starmath/source/unofilter.cxx |2 -- starmath/source/view.cxx |2 -- starmath/source/visitors.cxx |2 +- starmath/source/wordexportbase.cxx|1 - starmath/source/wordexportbase.hxx| 11 +-- 39 files changed, 15 insertions(+), 125 deletions(-) New commits: commit b6d7a8929d77ef67bbeb584cb0283d5a4f82ebbb Author: dante AuthorDate: Sat Feb 27 19:26:41 2021 +0100 Commit: Noel Grandin CommitDate: Mon Mar 1 08:23:09 2021 +0100 Starmath cleanup unused includes Change-Id: I294c5bbeadb718e35c0c5e56332b4df71433555a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111687 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 1deafb09b805..ebb3541549dc 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -24,15 +24,10 @@ #include #include -#include "format.hxx" -#include -#include - +#include "parse.hxx" #include "AccessibleSmElementsControl.hxx" class SmDocShell; -class SmNode; -class SmParser; class SmElement { diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx index 6cc663206da4..1ae0dc438d34 100644 --- a/starmath/inc/caret.hxx +++ b/starmath/inc/caret.hxx @@ -10,13 +10,8 @@ #define INCLUDED_STARMATH_INC_CARET_HXX #include - #include "node.hxx" -#include -#include -#include - /** Representation of caret position with an equation */ struct SmCaretPos { diff --git a/starmath/inc/cfgitem.hxx b/starmath/inc/cfgitem.hxx index 8e450d04a1d3..c0a4be4c60be 100644 --- a/starmath/inc/cfgitem.hxx +++ b/starmath/inc/cfgitem.hxx @@ -23,14 +23,11 @@ #include "utility.hxx" #include -#include - #include #include #include #include "types.hxx" -#include namespace com::sun::star::uno { diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index a30beda63368..47d39819c54b 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -9,13 +9,8 @@ #ifndef INCLUDED_STARMATH_INC_CURSOR_HXX #define INCLUDED_STARMATH_INC_CURSOR_HXX -#include "node.hxx" #include "caret.hxx" -#include -#include -#include - /** Factor to multiple the squared horizontal distance with * Used for Up and Down movement. */ diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index d3017f8e9554..2d87467de870 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -23,7 +23,6 @@ #include #include #include "symbol.hxx" -#include class SubsetMap; class SmFormat; diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 17933546265c..88d2126ac579 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_STARMATH_INC_DOCUMENT_HXX #define INCLUDED_STARMATH_INC_DOCUMENT_HXX -#include #include #include #include @@ -30,11 +29,7 @@ #include #include -#include -#include - #include "format.hxx" -#include "node.hxx" #include "parse.hxx" #include "smdllapi.hxx" diff --git
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx|1 + starmath/source/edit.cxx | 24 2 files changed, 17 insertions(+), 8 deletions(-) New commits: commit 0154f04e8c64df937b793c73ac58d553637f324f Author: Caolán McNamara AuthorDate: Wed Feb 24 14:32:21 2021 + Commit: Caolán McNamara CommitDate: Wed Feb 24 21:21:32 2021 +0100 Resolves: rhbz#1931423 start update timer in IM events as well as keyevents Change-Id: I5a72adebd34c3983e7a414110c3192d05b725e45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111488 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 300a414d382b..60d0ad2bbb04 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -88,6 +88,7 @@ class SmEditWindow final : public vcl::Window, public DropTargetHelper void InitScrollBars(); void InvalidateSlots(); void UpdateStatus(bool bSetDocModified); +void UserPossiblyChangedText(); public: explicit SmEditWindow(SmCmdBoxWindow& rMyCmdBoxWin); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index b6734d6e1aa9..a53089bfa49b 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -364,7 +364,10 @@ void SmEditWindow::Command(const CommandEvent& rCEvt) if (bForwardEvt) { if (pEditView) -pEditView->Command( rCEvt ); +{ +if (pEditView->Command(rCEvt)) +UserPossiblyChangedText(); +} else Window::Command (rCEvt); } @@ -475,13 +478,7 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) } else { -// have doc-shell modified only for formula input/change and not -// cursor travelling and such things... -SmDocShell *pDocShell = GetDoc(); -EditEngine *pEditEngine = GetEditEngine(); -if (pDocShell && pEditEngine) -pDocShell->SetModified(pEditEngine->IsModified()); -aModifyIdle.Start(); +UserPossiblyChangedText(); } // get the current char of the key event @@ -509,6 +506,17 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt) } } +void SmEditWindow::UserPossiblyChangedText() +{ +// have doc-shell modified only for formula input/change and not +// cursor travelling and such things... +SmDocShell *pDocShell = GetDoc(); +EditEngine *pEditEngine = GetEditEngine(); +if (pDocShell && pEditEngine) +pDocShell->SetModified(pEditEngine->IsModified()); +aModifyIdle.Start(); +} + void SmEditWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { if (!pEditView) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/token.hxx | 12 ++-- starmath/source/mathml/mathmlexport.cxx |4 ++-- starmath/source/node.cxx|2 +- starmath/source/parse.cxx |8 +--- starmath/source/visitors.cxx| 10 +- 5 files changed, 19 insertions(+), 17 deletions(-) New commits: commit 8957cf1cc041839d7d1e96b4d2617a82777692d4 Author: dante AuthorDate: Sun Feb 14 17:50:02 2021 +0100 Commit: Noel Grandin CommitDate: Sun Feb 14 20:09:56 2021 +0100 Reorganize starmath color data flow This will make possible to edit structure nodes with graphic UI. Change-Id: I37500958dbd684d239d615fc1d8df562a0c5b486 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110490 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 5b903cc7bc1c..650884471aa5 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -267,9 +267,9 @@ struct SmToken void operator=(const SmColorTokenTableEntry& aTokenTableEntry) { -aText = OUString::number(static_cast(aTokenTableEntry.cColor), 16); +aText = u""; eType = aTokenTableEntry.eType; -cMathChar = u""; +cMathChar = OUString::number(static_cast(aTokenTableEntry.cColor), 16); nGroup = TG::Color; nLevel = 0; nRow = 0; @@ -278,9 +278,9 @@ struct SmToken void operator=(const SmColorTokenTableEntry* aTokenTableEntry) { -aText = OUString::number(static_cast(aTokenTableEntry->cColor), 16); +aText = u""; eType = aTokenTableEntry->eType; -cMathChar = u""; +cMathChar = OUString::number(static_cast(aTokenTableEntry->cColor), 16); nGroup = TG::Color; nLevel = 0; nRow = 0; @@ -289,9 +289,9 @@ struct SmToken void operator=(const std::unique_ptr& aTokenTableEntry) { -aText = OUString::number(static_cast(aTokenTableEntry->cColor), 16); +aText = u""; eType = aTokenTableEntry->eType; -cMathChar = u""; +cMathChar = OUString::number(static_cast(aTokenTableEntry->cColor), 16); nGroup = TG::Color; nLevel = 0; nRow = 0; diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index c70ef936ea9f..f9d7affd02e3 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -1146,7 +1146,7 @@ void SmXMLExport::ExportFont(const SmNode* pNode, int nLevel) break; case TMATHMLCOL: { -nc = pNode->GetToken().aText.toUInt32(16); +nc = pNode->GetToken().cMathChar.toUInt32(16); OUString sssStr = OUString::createFromAscii(starmathdatabase::Identify_Color_MATHML(nc).pIdent); AddAttribute(XML_NAMESPACE_MATH, XML_MATHCOLOR, sssStr); @@ -1161,7 +1161,7 @@ void SmXMLExport::ExportFont(const SmNode* pNode, int nLevel) { OUStringBuffer sStrBuf(7); sStrBuf.append('#'); -nc = pNode->GetToken().aText.toUInt32(16); +nc = pNode->GetToken().cMathChar.toUInt32(16); sStrBuf.append(Color(ColorTransparency, nc).AsRGBHEXString()); OUString ssStr(sStrBuf.makeStringAndClear()); AddAttribute(XML_NAMESPACE_MATH, XML_MATHCOLOR, ssStr); diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 7dd72829b47f..e5916a094224 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -1725,7 +1725,7 @@ void SmFontNode::Arrange(OutputDevice , const SmFormat ) case TDVIPSNAMESCOL: case TICONICCOL : case THEX : -nc = GetToken().aText.toUInt32(16); +nc = GetToken().cMathChar.toUInt32(16); SetColor(Color(ColorTransparency, nc)); break; diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 8e3afd989b1e..80922cfdf6e3 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2084,6 +2084,7 @@ std::unique_ptr SmParser::DoColor() DepthProtect aDepthGuard(m_nParseDepth); assert(m_aCurToken.eType == TCOLOR); +sal_Int32 nBufferIndex = m_nBufferIndex; NextTokenColor(TCOLOR); SmToken aToken; @@ -2111,7 +2112,7 @@ std::unique_ptr SmParser::DoColor() nb = m_aCurToken.aText.toUInt32(); if( nb > 255 )return DoError(SmParseError::ColorExpected); nc = nb | ng << 8 | nr << 16 | sal_uInt32(0) << 24; -aToken.aText = OUString::number(nc, 16); +aToken.cMathChar = OUString::number(nc, 16); } else if( m_aCurToken.eType == TRGBA ) //loads r, g and b { @@ -2137,7 +2138,7 @@ std::unique_ptr SmParser::DoColor() na = m_aCurToken.aText.toUInt32(); if( na > 255 )return DoError(SmParseError::ColorExpected);
[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/uiconfig
starmath/inc/strings.hrc |1 + starmath/inc/strings.hxx |1 + starmath/source/ElementsDockingWindow.cxx |2 +- starmath/source/mathtype.cxx |3 +++ starmath/uiconfig/smath/popupmenu/edit.xml |1 + 5 files changed, 7 insertions(+), 1 deletion(-) New commits: commit 1fa83df607b9721c8f12125942de1c586a624bd0 Author: Julien Nabet AuthorDate: Sun Feb 14 10:36:29 2021 +0100 Commit: Noel Grandin CommitDate: Sun Feb 14 20:09:12 2021 +0100 tdf#140386: Math: Add 'backepsilon' symbol to elements panel corresponds to GREEK REVERSED LUNATE EPSILON SYMBOL see https://www.unicodepedia.com/unicode/greek-and-coptic/3f6/greek-reversed-lunate-epsilon-symbol/ Change-Id: I39628c55642e549174a0e59798c401976fdfaef2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110880 Reviewed-by: Dante DM Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index daa90f02545d..ab85c5b49aa6 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -269,6 +269,7 @@ #define RID_NABLA_HELP NC_("RID_NABLA_HELP", "Nabla" ) #define RID_LAPLACE_HELPNC_("RID_LAPLACE_HELP", "Laplace transform" ) #define RID_FOURIER_HELPNC_("RID_FOURIER_HELP", "Fourier transform" ) +#define RID_BACKEPSILON_HELPNC_("RID_BACKEPSILON_HELP", "Backwards epsilon" ) #define RID_WP_HELP NC_("RID_WP_HELP", "Weierstrass p" ) #define RID_DOTSAXIS_HELP NC_("RID_DOTSAXIS_HELP", "Dots In Middle" ) #define RID_DOTSUP_HELP NC_("RID_DOTSUP_HELP", "Dots To Top" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index db89180937d7..258e2b800403 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -261,6 +261,7 @@ #define RID_NABLA "nabla " #define RID_WP "wp " #define RID_LAPLACE "laplace " +#define RID_BACKEPSILON "backepsilon " #define RID_FOURIER "fourier " #define RID_DOTSAXIS"dotsaxis " #define RID_DOTSUP "dotsup " diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 1c3cf9deb9f1..754d819aa3f1 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -240,7 +240,7 @@ const SmElementDescr SmElementsControl::m_aOthersList[] = {RID_EXISTS, RID_EXISTS_HELP}, {RID_NOTEXISTS, RID_NOTEXISTS_HELP}, {RID_FORALL, RID_FORALL_HELP}, {RID_HBAR, RID_HBAR_HELP}, {RID_LAMBDABAR, RID_LAMBDABAR_HELP}, {RID_RE, RID_RE_HELP}, {RID_IM, RID_IM_HELP}, {RID_WP, RID_WP_HELP}, {RID_LAPLACE, RID_LAPLACE_HELP}, -{RID_FOURIER, RID_FOURIER_HELP}, +{RID_FOURIER, RID_FOURIER_HELP}, {RID_BACKEPSILON, RID_BACKEPSILON_HELP}, {nullptr, nullptr}, {RID_LEFTARROW, RID_LEFTARROW_HELP}, {RID_RIGHTARROW, RID_RIGHTARROW_HELP}, {RID_UPARROW, RID_UPARROW_HELP}, {RID_DOWNARROW, RID_DOWNARROW_HELP}, diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 4bf9bcf0a7e2..e13dd7160f2e 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -314,6 +314,9 @@ bool MathType::LookupChar(sal_Unicode nChar,OUStringBuffer ,sal_uInt8 nVers case 0x2112: pC = " laplace "; break; +case 0x03F6: +pC = " backepsilon "; +break; case 0x2208: // in case 0x2209: // notin rRet.append(" func ").append(OUStringChar(nChar)).append(" "); diff --git a/starmath/uiconfig/smath/popupmenu/edit.xml b/starmath/uiconfig/smath/popupmenu/edit.xml index f5a7f0680d6c..c9626cc6a033 100644 --- a/starmath/uiconfig/smath/popupmenu/edit.xml +++ b/starmath/uiconfig/smath/popupmenu/edit.xml @@ -253,6 +253,7 @@ + ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/starmathdatabase.hxx| 10 ++--- starmath/source/mathml/mathmlexport.cxx |2 - starmath/source/mathml/mathmlimport.cxx |8 ++-- starmath/source/mathml/starmathdatabase.cxx | 56 +++- starmath/source/visitors.cxx|4 +- 5 files changed, 34 insertions(+), 46 deletions(-) New commits: commit 71fa2bc2061168b9a74cdb4b0428b00ea902666f Author: Noel Grandin AuthorDate: Sat Feb 13 19:00:00 2021 +0200 Commit: Noel Grandin CommitDate: Sat Feb 13 19:48:22 2021 +0100 no need to allocate these return values on the heap Change-Id: I4fd440c79c388527183a84676b2f32930f3bf8ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110845 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/starmathdatabase.hxx b/starmath/inc/mathml/starmathdatabase.hxx index b40a932809a4..cf8cf8b3b9d1 100644 --- a/starmath/inc/mathml/starmathdatabase.hxx +++ b/starmath/inc/mathml/starmathdatabase.hxx @@ -263,7 +263,7 @@ SmToken Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar); * @param cColor * @param parser color */ -std::unique_ptr Identify_Color_Parser(sal_uInt32 cColor); +SmColorTokenTableEntry Identify_Color_Parser(sal_uInt32 cColor); /** * Identifies color from color code cColor. @@ -271,7 +271,7 @@ std::unique_ptr Identify_Color_Parser(sal_uInt32 cColor) * @param cColor * @param parser color */ -std::unique_ptr Identify_Color_HTML(sal_uInt32 cColor); +SmColorTokenTableEntry Identify_Color_HTML(sal_uInt32 cColor); /** * Identifies color from color code cColor. @@ -283,7 +283,7 @@ std::unique_ptr Identify_Color_HTML(sal_uInt32 cColor); * @param cColor * @param parser color */ -std::unique_ptr Identify_Color_MATHML(sal_uInt32 cColor); +SmColorTokenTableEntry Identify_Color_MATHML(sal_uInt32 cColor); /** * Identifies color from color code cColor. @@ -291,7 +291,7 @@ std::unique_ptr Identify_Color_MATHML(sal_uInt32 cColor) * @param cColor * @param parser color */ -std::unique_ptr Identify_Color_DVIPSNAMES(sal_uInt32 cColor); +SmColorTokenTableEntry Identify_Color_DVIPSNAMES(sal_uInt32 cColor); /** * Identifies color from color name. @@ -315,7 +315,7 @@ const SmColorTokenTableEntry* Identify_ColorName_Parser(const OUString& colornam * @param cColor * @param parser color */ -std::unique_ptr Identify_ColorName_HTML(const OUString& colorname); +SmColorTokenTableEntry Identify_ColorName_HTML(const OUString& colorname); /** * Identifies color from color name. diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 56eb78cacab5..c70ef936ea9f 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -1148,7 +1148,7 @@ void SmXMLExport::ExportFont(const SmNode* pNode, int nLevel) { nc = pNode->GetToken().aText.toUInt32(16); OUString sssStr -= OUString::createFromAscii(starmathdatabase::Identify_Color_MATHML(nc)->pIdent); += OUString::createFromAscii(starmathdatabase::Identify_Color_MATHML(nc).pIdent); AddAttribute(XML_NAMESPACE_MATH, XML_MATHCOLOR, sssStr); } break; diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index 3c2f0e5aa2bf..9c455d5be86d 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -678,12 +678,12 @@ void SmXMLContext_Helper::ApplyAttrs() } if (!sColor.isEmpty()) { -std::unique_ptr aSmColorTokenTableEntry; +SmColorTokenTableEntry aSmColorTokenTableEntry; aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_HTML(sColor); -if (aSmColorTokenTableEntry->eType == TRGB) +if (aSmColorTokenTableEntry.eType == TRGB) aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( -sal_uInt32(aSmColorTokenTableEntry->cColor)); -if (aSmColorTokenTableEntry->eType != TERROR) +sal_uInt32(aSmColorTokenTableEntry.cColor)); +if (aSmColorTokenTableEntry.eType != TERROR) { aToken = aSmColorTokenTableEntry; std::unique_ptr pFontNode(new SmFontNode(aToken)); diff --git a/starmath/source/mathml/starmathdatabase.cxx b/starmath/source/mathml/starmathdatabase.cxx index f358a37be72c..d2c54931 100644 --- a/starmath/source/mathml/starmathdatabase.cxx +++ b/starmath/source/mathml/starmathdatabase.cxx @@ -695,60 +695,51 @@ const SmColorTokenTableEntry starmathdatabase::aColorTokenTableMATHML[] = { const SmColorTokenTableEntry starmathdatabase::aColorTokenTableERROR[] = { { "", TERROR, COL_SM_BLACK } }; -std::unique_ptr starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor) +SmColorTokenTableEntry starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor)
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/parse.hxx|4 ++-- starmath/source/parse.cxx | 21 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) New commits: commit 1e56cce16bbe07c6e8e900dd4c4d41b1fcd54614 Author: Noel AuthorDate: Tue Feb 9 13:51:45 2021 +0200 Commit: Noel Grandin CommitDate: Tue Feb 9 19:57:46 2021 +0100 no need to use unique_ptr for a simple value class Change-Id: Id83cd16fe3eb815ad419cc331e65fb731161bd30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110635 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 6349dc8c479f..752cde6b23e5 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -93,7 +93,7 @@ class SmParser { OUStringm_aBufferString; SmToken m_aCurToken; -std::vector> m_aErrDescList; +std::vector m_aErrDescList; int m_nCurError; sal_Int32 m_nBufferIndex, m_nTokenIndex; @@ -194,7 +194,7 @@ public: const SmErrorDesc* NextError(); const SmErrorDesc* PrevError(); -const SmErrorDesc* GetError(); +const SmErrorDesc* GetError() const; const std::set< OUString >& GetUsedSymbols() const { return m_aUsedSymbols; } }; diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 0aa1518eb4c2..8e3afd989b1e 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2599,8 +2599,8 @@ std::unique_ptr SmParser::DoError(SmParseError eError) xSNode->SetSubNode(0, pErr); // Append error to the error list -SmErrorDesc* pErrDesc = new SmErrorDesc(eError, xSNode.get(), m_aCurToken.cMathChar); -m_aErrDescList.push_back(std::unique_ptr(pErrDesc)); +SmErrorDesc aErrDesc(eError, xSNode.get(), m_aCurToken.cMathChar); +m_aErrDescList.push_back(aErrDesc); NextToken(); @@ -2659,11 +2659,11 @@ std::unique_ptr SmParser::ParseExpression(const OUString ) const SmErrorDesc *SmParser::NextError() { if ( !m_aErrDescList.empty() ) -if (m_nCurError > 0) return m_aErrDescList[ --m_nCurError ].get(); +if (m_nCurError > 0) return _aErrDescList[ --m_nCurError ]; else { m_nCurError = 0; -return m_aErrDescList[ m_nCurError ].get(); +return _aErrDescList[ m_nCurError ]; } else return nullptr; } @@ -2672,21 +2672,22 @@ const SmErrorDesc *SmParser::NextError() const SmErrorDesc *SmParser::PrevError() { if ( !m_aErrDescList.empty() ) -if (m_nCurError < static_cast(m_aErrDescList.size() - 1)) return m_aErrDescList[ ++m_nCurError ].get(); +if (m_nCurError < static_cast(m_aErrDescList.size() - 1)) +return _aErrDescList[ ++m_nCurError ]; else { m_nCurError = static_cast(m_aErrDescList.size() - 1); -return m_aErrDescList[ m_nCurError ].get(); +return _aErrDescList[ m_nCurError ]; } else return nullptr; } -const SmErrorDesc *SmParser::GetError() +const SmErrorDesc* SmParser::GetError() const { -if ( !m_aErrDescList.empty() ) -return m_aErrDescList.front().get(); -return nullptr; +if (m_aErrDescList.empty()) +return nullptr; +return _aErrDescList.front(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/parse.hxx|4 ++-- starmath/source/parse.cxx | 18 -- 2 files changed, 10 insertions(+), 12 deletions(-) New commits: commit e2342ca5155f27637770fc392916804c8ac4728f Author: Caolán McNamara AuthorDate: Tue Feb 9 09:44:31 2021 + Commit: Caolán McNamara CommitDate: Tue Feb 9 12:29:03 2021 +0100 ofz#30663 Direct-leak since... commit 17149f65f03a34e88bb4a10abcd20e6891f5d7ca Date: Sun Feb 7 10:41:46 2021 +0100 Let depthGuard handle everything Change-Id: Icb978724000aec75a84ca6ecfd0fe9e299291db6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110623 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 591db3637714..6349dc8c479f 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -148,8 +148,8 @@ class SmParser std::unique_ptr DoRelation(); std::unique_ptr DoSum(); std::unique_ptr DoProduct(); -std::unique_ptr DoSubSup(TG nActiveGroup, SmNode *pGivenNode); -std::unique_ptr DoSubSupEvaluate(SmNode *pGivenNode); +std::unique_ptr DoSubSup(TG nActiveGroup, std::unique_ptr xGivenNode); +std::unique_ptr DoSubSupEvaluate(std::unique_ptr xGivenNode); std::unique_ptr DoOpSubSup(); std::unique_ptr DoPower(); std::unique_ptr DoBlank(); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index b4541fea8bb7..0aa1518eb4c2 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1408,10 +1408,9 @@ std::unique_ptr SmParser::DoProduct() return xFirst; } -std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) +std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, std::unique_ptr xGivenNode) { DepthProtect aDepthGuard(m_nParseDepth); -std::unique_ptr xGivenNode(pGivenNode); assert(nActiveGroup == TG::Power || nActiveGroup == TG::Limit); assert(m_aCurToken.nGroup == nActiveGroup); @@ -1482,10 +1481,9 @@ std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) return pNode; } -std::unique_ptr SmParser::DoSubSupEvaluate(SmNode *pGivenNode) +std::unique_ptr SmParser::DoSubSupEvaluate(std::unique_ptr xGivenNode) { DepthProtect aDepthGuard(m_nParseDepth); -std::unique_ptr xGivenNode(pGivenNode); std::unique_ptr pNode(new SmSubSupNode(m_aCurToken)); pNode->SetUseLimits(true); @@ -1535,13 +1533,13 @@ std::unique_ptr SmParser::DoOpSubSup() DepthProtect aDepthGuard(m_nParseDepth); // get operator symbol -auto pNode = std::make_unique(m_aCurToken); +auto xNode = std::make_unique(m_aCurToken); // skip operator token NextToken(); // get sub- supscripts if any if (m_aCurToken.nGroup == TG::Power) -return DoSubSup(TG::Power, pNode.release()); -return pNode; +return DoSubSup(TG::Power, std::move(xNode)); +return xNode; } std::unique_ptr SmParser::DoPower() @@ -1552,7 +1550,7 @@ std::unique_ptr SmParser::DoPower() std::unique_ptr xNode(DoTerm(false)); if (m_aCurToken.nGroup == TG::Power) -return DoSubSup(TG::Power, xNode.release()); +return DoSubSup(TG::Power, std::move(xNode)); return xNode; } @@ -1857,7 +1855,7 @@ std::unique_ptr SmParser::DoOperator() auto xOperator = DoOper(); if (m_aCurToken.nGroup == TG::Limit || m_aCurToken.nGroup == TG::Power) -xOperator = DoSubSup(m_aCurToken.nGroup, xOperator.release()); +xOperator = DoSubSup(m_aCurToken.nGroup, std::move(xOperator)); // get argument auto xArg = DoPower(); @@ -2398,7 +2396,7 @@ std::unique_ptr SmParser::DoEvaluate() if ( m_aCurToken.nGroup == TG::Limit ) { std::unique_ptr rSNode; -rSNode = DoSubSupEvaluate(xSNode.release()); +rSNode = DoSubSupEvaluate(std::move(xSNode)); rSNode->GetToken().eType = TEVALUATE; return rSNode; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/parse.hxx|2 +- starmath/source/parse.cxx | 22 +++--- 2 files changed, 16 insertions(+), 8 deletions(-) New commits: commit 667a84c69140bae1020fa1cc019d310b0d382d14 Author: dante AuthorDate: Fri Feb 5 13:39:29 2021 +0100 Commit: Noel Grandin CommitDate: Mon Feb 8 13:58:21 2021 +0100 Simplified addition of color palettes For use of LO based code, won't implement more palettes But will be helpfull for definecolor command Change-Id: Id68b075fb69254a8d5e9c4c0358b3ee3cd99a0c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110474 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 88024572db82..591db3637714 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -134,7 +134,7 @@ class SmParser // Moves between tokens inside starmath code. voidNextToken(); -voidNextTokenColor(bool dvipload); +voidNextTokenColor(SmTokenType dvipload); voidNextTokenFontSize(); sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } voidReplace( sal_Int32 nPos, sal_Int32 nLen, const OUString ); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 7584c712b96e..41a6d482cf8f 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -980,7 +980,7 @@ void SmParser::NextToken() //Central part of the parser m_nBufferIndex = aRes.EndPos; } -void SmParser::NextTokenColor(bool dvipload) +void SmParser::NextTokenColor(SmTokenType dvipload) { sal_Int32 nBufLen = m_aBufferString.getLength(); @@ -1033,10 +1033,18 @@ void SmParser::NextTokenColor(bool dvipload) sal_Int32 n = aRes.EndPos - nRealStart; assert(n >= 0); OUString aName( m_aBufferString.copy( nRealStart, n ) ); -const SmColorTokenTableEntry* aSmColorTokenTableEntry; -if(dvipload) aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_DVIPSNAMES( aName ); -else aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_Parser( aName ); -m_aCurToken = aSmColorTokenTableEntry; +switch(dvipload) +{ +case TCOLOR: +m_aCurToken = starmathdatabase::Identify_ColorName_Parser( aName ); +break; +case TDVIPSNAMESCOL: +m_aCurToken = starmathdatabase::Identify_ColorName_DVIPSNAMES( aName ); +break; +default: +m_aCurToken = starmathdatabase::Identify_ColorName_Parser( aName ); +break; +} } else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR) { @@ -2070,10 +2078,10 @@ std::unique_ptr SmParser::DoColor() DepthProtect aDepthGuard(m_nParseDepth); assert(m_aCurToken.eType == TCOLOR); -NextTokenColor(false); +NextTokenColor(TCOLOR); SmToken aToken; -if( m_aCurToken.eType == TDVIPSNAMESCOL ) NextTokenColor(true); +if( m_aCurToken.eType == TDVIPSNAMESCOL ) NextTokenColor(TDVIPSNAMESCOL); if( m_aCurToken.eType == TERROR ) return DoError(SmParseError::ColorExpected); if (TokenInGroup(TG::Color)) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/parse.hxx|3 + starmath/source/parse.cxx | 72 +++--- 2 files changed, 8 insertions(+), 67 deletions(-) New commits: commit 17149f65f03a34e88bb4a10abcd20e6891f5d7ca Author: dante AuthorDate: Sun Feb 7 10:41:46 2021 +0100 Commit: Noel Grandin CommitDate: Mon Feb 8 08:00:25 2021 +0100 Let depthGuard handle everything Change-Id: I3887273aa0b4e88dd454099052db8ce3811b5d66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110524 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 6eb83500b3d3..88024572db82 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -112,8 +112,9 @@ class SmParser : m_rParseDepth(rParseDepth) { ++m_rParseDepth; +if(m_rParseDepth > DEPTH_LIMIT) +throw std::range_error("parser depth limit"); } -bool TooDeep() const { return m_rParseDepth > DEPTH_LIMIT; } ~DepthProtect() { --m_rParseDepth; diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 68aab9e8dc77..7584c712b96e 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1182,8 +1182,6 @@ namespace std::unique_ptr SmParser::DoTable() { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); std::vector> aLineArray; aLineArray.push_back(DoLine()); @@ -1202,8 +1200,6 @@ std::unique_ptr SmParser::DoAlign(bool bUseExtraSpaces) // parse alignment info (if any), then go on with rest of expression { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); std::unique_ptr xSNode; @@ -1232,8 +1228,6 @@ std::unique_ptr SmParser::DoAlign(bool bUseExtraSpaces) std::unique_ptr SmParser::DoLine() { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); std::vector> ExpressionArray; @@ -1264,8 +1258,6 @@ std::unique_ptr SmParser::DoLine() std::unique_ptr SmParser::DoExpression(bool bUseExtraSpaces) { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); std::vector> RelationArray; RelationArray.push_back(DoRelation()); @@ -1289,8 +1281,6 @@ std::unique_ptr SmParser::DoExpression(bool bUseExtraSpaces) std::unique_ptr SmParser::DoRelation() { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); int nDepthLimit = m_nParseDepth; @@ -1304,8 +1294,7 @@ std::unique_ptr SmParser::DoRelation() xFirst = std::move(xSNode); ++m_nParseDepth; -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); +DepthProtect bDepthGuard(m_nParseDepth); } m_nParseDepth = nDepthLimit; @@ -1316,8 +1305,6 @@ std::unique_ptr SmParser::DoRelation() std::unique_ptr SmParser::DoSum() { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); auto xFirst = DoProduct(); while (TokenInGroup(TG::Sum)) @@ -1334,8 +1321,6 @@ std::unique_ptr SmParser::DoSum() std::unique_ptr SmParser::DoProduct() { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); auto xFirst = DoPower(); @@ -1409,10 +1394,8 @@ std::unique_ptr SmParser::DoProduct() std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) { -std::unique_ptr xGivenNode(pGivenNode); DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); +std::unique_ptr xGivenNode(pGivenNode); assert(nActiveGroup == TG::Power || nActiveGroup == TG::Limit); assert(m_aCurToken.nGroup == nActiveGroup); @@ -1485,9 +1468,8 @@ std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) std::unique_ptr SmParser::DoSubSupEvaluate(SmNode *pGivenNode) { -std::unique_ptr xGivenNode(pGivenNode); DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) throw std::range_error("parser depth limit"); +std::unique_ptr xGivenNode(pGivenNode); std::unique_ptr pNode(new SmSubSupNode(m_aCurToken)); pNode->SetUseLimits(true); @@ -1535,8 +1517,6 @@ std::unique_ptr SmParser::DoSubSupEvaluate(SmNode *pGivenNode) std::unique_ptr SmParser::DoOpSubSup() { DepthProtect aDepthGuard(m_nParseDepth); -if (aDepthGuard.TooDeep()) -throw std::range_error("parser depth limit"); // get operator symbol auto pNode = std::make_unique(m_aCurToken); @@ -1551,8 +1531,6 @@
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/node.hxx |3 - starmath/inc/token.hxx | 14 ++-- starmath/source/cursor.cxx | 18 +++--- starmath/source/mathml/mathmlimport.cxx | 68 +++ starmath/source/node.cxx|8 +- starmath/source/ooxmlexport.cxx |3 - starmath/source/parse.cxx | 94 starmath/source/visitors.cxx|2 8 files changed, 105 insertions(+), 105 deletions(-) New commits: commit 96e9870b3204eabc6bca1c92f714f80592a54102 Author: dante AuthorDate: Fri Feb 5 16:27:40 2021 +0100 Commit: Caolán McNamara CommitDate: Sat Feb 6 20:53:22 2021 +0100 Use multichar operators There are no functional changes, only type change. This patch unlocks other possibilities like: - Syntax highlight for errors - Visual editor for structure nodes - Implement some mathml features Change-Id: I76a1b62126ae5fcb6a7285b07b24e9defa63fd44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110481 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 3c267bb4a9ad..61f98ec75d87 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -972,8 +972,7 @@ protected: SmMathSymbolNode(SmNodeType eNodeType, const SmToken ) : SmSpecialNode(eNodeType, rNodeToken, FNT_MATH) { -sal_Unicode cChar = GetToken().cMathChar; -if (u'\0' != cChar) SetText(OUString(cChar)); +SetText(GetToken().cMathChar); } public: diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 600c29b9f889..5b903cc7bc1c 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -211,7 +211,7 @@ struct SmToken { OUString aText; // token text SmTokenType eType; // token info -sal_Unicode cMathChar; +OUString cMathChar; // parse-help info TG nGroup; @@ -247,7 +247,7 @@ struct SmToken { aText = aTokenTableEntry.pIdent; eType = aTokenTableEntry.eType; -cMathChar = aTokenTableEntry.cMathChar; +cMathChar = OUString(, 1); nGroup = aTokenTableEntry.nGroup; nLevel = aTokenTableEntry.nLevel; nRow = 0; @@ -258,7 +258,7 @@ struct SmToken { aText = aTokenTableEntry->pIdent; eType = aTokenTableEntry->eType; -cMathChar = aTokenTableEntry->cMathChar; +cMathChar = OUString(>cMathChar, 1); nGroup = aTokenTableEntry->nGroup; nLevel = aTokenTableEntry->nLevel; nRow = 0; @@ -269,7 +269,7 @@ struct SmToken { aText = OUString::number(static_cast(aTokenTableEntry.cColor), 16); eType = aTokenTableEntry.eType; -cMathChar = MS_NULLCHAR; +cMathChar = u""; nGroup = TG::Color; nLevel = 0; nRow = 0; @@ -280,7 +280,7 @@ struct SmToken { aText = OUString::number(static_cast(aTokenTableEntry->cColor), 16); eType = aTokenTableEntry->eType; -cMathChar = MS_NULLCHAR; +cMathChar = u""; nGroup = TG::Color; nLevel = 0; nRow = 0; @@ -291,12 +291,14 @@ struct SmToken { aText = OUString::number(static_cast(aTokenTableEntry->cColor), 16); eType = aTokenTableEntry->eType; -cMathChar = MS_NULLCHAR; +cMathChar = u""; nGroup = TG::Color; nLevel = 0; nRow = 0; nCol = 0; } + +void setChar(sal_Unicode cChar) { cMathChar = OUString(, 1); } }; #endif diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index cdac53d4a234..a7d5ba76c542 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -864,7 +864,7 @@ void SmCursor::InsertText(const OUString& aString) SmToken token; token.eType = TIDENT; -token.cMathChar = '\0'; +token.cMathChar = u""; token.nGroup = TG::NONE; token.nLevel = 5; token.aText = aString; @@ -908,7 +908,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ { SmToken token; token.eType = TPLUS; -token.cMathChar = MS_PLUS; +token.setChar(MS_PLUS); token.nGroup = TG::UnOper | TG::Sum; token.nLevel = 5; token.aText = "+"; @@ -918,7 +918,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ { SmToken token; token.eType = TMINUS; -token.cMathChar = MS_MINUS; +token.setChar(MS_MINUS); token.nGroup = TG::UnOper | TG::Sum; token.nLevel = 5; token.aText = "-"; @@ -928,7 +928,7 @@ void SmCursor::InsertElement(SmFormulaElement element){ { SmToken token; token.eType = TCDOT; -token.cMathChar = MS_CDOT; +token.setChar(MS_CDOT); token.nGroup = TG::Product;
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/error.hxx| 56 - starmath/inc/parse.hxx| 46 +-- starmath/inc/strings.hrc |1 starmath/source/parse.cxx | 78 ++ 4 files changed, 83 insertions(+), 98 deletions(-) New commits: commit 7c959884d9a4a3f187a79cbb01407cd20d92a2f8 Author: dante AuthorDate: Sat Feb 6 11:19:36 2021 +0100 Commit: Noel Grandin CommitDate: Sat Feb 6 18:39:31 2021 +0100 Modifications on starmath smparse error handle Made modifications for: - Being able to highlight syntax errors - Displaying error description in visual editor - Easier constructor - Rely on starmathdatabase instead of long switch in code. Change-Id: Ic6c7f920463090176d80668f9b660ccf3e9b5708 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110497 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/error.hxx b/starmath/inc/error.hxx deleted file mode 100644 index dc798f6906e3.. --- a/starmath/inc/error.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_STARMATH_INC_ERROR_HXX -#define INCLUDED_STARMATH_INC_ERROR_HXX - -#include - -class SmNode; - -// Those are the errors that the parser (parser.hxx/parser.cxx) may encounter. -enum class SmParseError -{ -None, -UnexpectedChar, -UnexpectedToken, -PoundExpected, -ColorExpected, -LgroupExpected, -RgroupExpected, -LbraceExpected, -RbraceExpected, -ParentMismatch, -RightExpected, -FontExpected, -SizeExpected, -DoubleAlign, -DoubleSubsupscript, -NumberExpected -}; - -struct SmErrorDesc -{ -SmParseError m_eType; -SmNode* m_pNode; -OUString m_aText; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index b010db941832..6eb83500b3d3 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -30,7 +30,6 @@ #include #include "token.hxx" -#include "error.hxx" class SmBlankNode; class SmBinVerNode; @@ -46,6 +45,50 @@ class SmTextNode; #define DEPTH_LIMIT 1024 +// Those are the errors that the parser may encounter. +enum class SmParseError : uint_fast8_t +{ +None = 0, +UnexpectedChar = 1, +UnexpectedToken = 2, +PoundExpected = 3, +ColorExpected = 4, +LgroupExpected = 5, +RgroupExpected = 6, +LbraceExpected = 7, +RbraceExpected = 8, +ParentMismatch = 9, +RightExpected = 10, +FontExpected = 11, +SizeExpected = 12, +DoubleAlign = 13, +DoubleSubsupscript = 14, +NumberExpected = 15 +}; + +struct SmErrorDesc +{ +SmParseError m_eType; +SmNode* m_pNode; +OUString m_aText; + +SmErrorDesc(SmParseError eType, SmNode* pNode, OUString aText) +: m_eType(eType) +, m_pNode(pNode) +, m_aText(aText) +{} + +}; + +namespace starmathdatabase{ + +// Must be in sync with SmParseError list +extern const char* SmParseErrorDesc[16]; + +OUString getParseErrorDesc(SmParseError err); + +} + class SmParser { OUStringm_aBufferString; @@ -148,7 +191,6 @@ public: boolIsExportSymbolNames() const{ return m_bExportSymNames; } voidSetExportSymbolNames(bool bVal){ m_bExportSymNames = bVal; } -voidAddError(SmParseError Type, SmNode *pNode); const SmErrorDesc* NextError(); const SmErrorDesc* PrevError(); const SmErrorDesc* GetError(); diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 01dc7b864ee4..daa90f02545d 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -374,6 +374,7 @@ #define STR_STATSTR_WRITING NC_("STR_STATSTR_WRITING", "Saving document..." ) #define STR_MATH_DOCUMENT_FULLTYPE_CURRENT NC_("STR_MATH_DOCUMENT_FULLTYPE_CURRENT", "%PRODUCTNAME %PRODUCTVERSION Formula") #define RID_ERR_IDENT NC_("RID_ERR_IDENT", "ERROR : " ) +#define RID_ERR_NONENC_("RID_ERR_NONE", "no
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/mathml/starmathdatabase.hxx|5 +- starmath/source/mathml/starmathdatabase.cxx | 51 +--- starmath/source/parse.cxx |2 - 3 files changed, 35 insertions(+), 23 deletions(-) New commits: commit 4b055a51c501cec3f71600c1b87aa1fad85dd5af Author: dante AuthorDate: Fri Feb 5 13:33:24 2021 +0100 Commit: Noel Grandin CommitDate: Sat Feb 6 07:52:25 2021 +0100 Optimize starmath color search Needs Jenkins resume. Details: Uses ordered search Avoid useless data copy. Change-Id: I100dc08451788e705a0109f6c73172cb6964306b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110473 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/mathml/starmathdatabase.hxx b/starmath/inc/mathml/starmathdatabase.hxx index 096a38b1e4c2..b40a932809a4 100644 --- a/starmath/inc/mathml/starmathdatabase.hxx +++ b/starmath/inc/mathml/starmathdatabase.hxx @@ -203,6 +203,7 @@ extern const SmColorTokenTableEntry aColorTokenTableParse[159]; extern const SmColorTokenTableEntry aColorTokenTableHTML[148]; extern const SmColorTokenTableEntry aColorTokenTableMATHML[16]; extern const SmColorTokenTableEntry aColorTokenTableDVIPS[5]; +extern const SmColorTokenTableEntry aColorTokenTableERROR[1]; /** * Identifies operator chars tokens for importing mathml. @@ -301,7 +302,7 @@ std::unique_ptr Identify_Color_DVIPSNAMES(sal_uInt32 cCo * @param cColor * @param parser color */ -std::unique_ptr Identify_ColorName_Parser(const OUString& colorname); +const SmColorTokenTableEntry* Identify_ColorName_Parser(const OUString& colorname); /** * Identifies color from color name. @@ -325,5 +326,5 @@ std::unique_ptr Identify_ColorName_HTML(const OUString& * @param cColor * @param parser color */ -std::unique_ptr Identify_ColorName_DVIPSNAMES(const OUString& colorname); +const SmColorTokenTableEntry* Identify_ColorName_DVIPSNAMES(const OUString& colorname); } diff --git a/starmath/source/mathml/starmathdatabase.cxx b/starmath/source/mathml/starmathdatabase.cxx index 630fb343840d..f358a37be72c 100644 --- a/starmath/source/mathml/starmathdatabase.cxx +++ b/starmath/source/mathml/starmathdatabase.cxx @@ -692,6 +692,9 @@ const SmColorTokenTableEntry starmathdatabase::aColorTokenTableMATHML[] = { // clang-format on }; +const SmColorTokenTableEntry starmathdatabase::aColorTokenTableERROR[] += { { "", TERROR, COL_SM_BLACK } }; + std::unique_ptr starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor) { for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i) @@ -748,46 +751,54 @@ starmathdatabase::Identify_Color_DVIPSNAMES(sal_uInt32 cColor) new SmColorTokenTableEntry("", TRGBA, cColor)); } -std::unique_ptr -starmathdatabase::Identify_ColorName_Parser(const OUString& colorname) +const SmColorTokenTableEntry* starmathdatabase::Identify_ColorName_Parser(const OUString& colorname) { if (colorname.isEmpty()) -return std::unique_ptr( -new SmColorTokenTableEntry("", TERROR, COL_SM_BLACK)); +return [0]; for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i) -if (i->equals(colorname)) -return std::unique_ptr(new SmColorTokenTableEntry(i)); -return std::unique_ptr( -new SmColorTokenTableEntry("", TERROR, COL_SM_BLACK)); +{ +sal_Int32 matches = colorname.compareToIgnoreAsciiCaseAscii(i->pIdent); +if (matches == 0) +return i; +if (matches < 0) +break; +} +return [0]; } - std::unique_ptr starmathdatabase::Identify_ColorName_HTML(const OUString& colorname) { if (colorname.isEmpty()) return std::unique_ptr( new SmColorTokenTableEntry("", TERROR, COL_SM_BLACK)); -for (auto i = std::begin(aColorTokenTableHTML); i < std::end(aColorTokenTableHTML); ++i) -if (i->equals(colorname)) -return std::unique_ptr(new SmColorTokenTableEntry(i)); if (colorname[0] == '#') { Color col = Color::STRtoRGB(colorname); return std::unique_ptr(new SmColorTokenTableEntry("", TRGB, col)); } +for (auto i = std::begin(aColorTokenTableHTML); i < std::end(aColorTokenTableHTML); ++i) +{ +sal_Int32 matches = colorname.compareToIgnoreAsciiCaseAscii(i->pIdent); +if (matches == 0) +return std::unique_ptr(new SmColorTokenTableEntry(i)); +if (matches < 0) +break; +} return std::unique_ptr( new SmColorTokenTableEntry("", TERROR, COL_SM_BLACK)); } - -std::unique_ptr +const SmColorTokenTableEntry* starmathdatabase::Identify_ColorName_DVIPSNAMES(const OUString& colorname) { if (colorname.isEmpty()) -return std::unique_ptr( -new SmColorTokenTableEntry("", TERROR, COL_SM_BLACK)); +return [0]; for
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/token.hxx |2 +- starmath/source/mathml/starmathdatabase.cxx |6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit b2f7ca61494a88cb082d356e47beb7fc2c0d92bb Author: dante AuthorDate: Wed Feb 3 14:45:49 2021 +0100 Commit: Noel Grandin CommitDate: Wed Feb 3 19:50:36 2021 +0100 Previous patches fixes From https://gerrit.libreoffice.org/c/core/+/110321/1 Chopped u(s) from color names From https://gerrit.libreoffice.org/c/core/+/110252 const std::u16string_view -> std::u16string_view Change-Id: Ibbaf219b3a3f0626693bb3b3355fc446198fcc34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110374 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index ad1289a5e09c..600c29b9f889 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -149,7 +149,7 @@ enum SmTokenType struct SmTokenTableEntry { -const std::u16string_view pIdent; +std::u16string_view pIdent; SmTokenType eType; sal_Unicode cMathChar; TG nGroup; diff --git a/starmath/source/mathml/starmathdatabase.cxx b/starmath/source/mathml/starmathdatabase.cxx index 4aef49cd37ac..630fb343840d 100644 --- a/starmath/source/mathml/starmathdatabase.cxx +++ b/starmath/source/mathml/starmathdatabase.cxx @@ -476,7 +476,7 @@ const SmColorTokenTableEntry starmathdatabase::aColorTokenTableParse[] { "palevioletred", THTMLCOL, COL_SM_PALEVIOLETRED }, { "papayawhip", THTMLCOL, COL_SM_PAPAYAWHIP }, { "peachpuff", THTMLCOL, COL_SM_PEACHPUFF }, -{ "per", THTMLCOL, COL_SM_PERU }, +{ "peru", THTMLCOL, COL_SM_PERU }, { "pink", THTMLCOL, COL_SM_PINK }, { "plum", THTMLCOL, COL_SM_PLUM }, { "powderblue", THTMLCOL, COL_SM_POWDERBLUE }, @@ -506,7 +506,7 @@ const SmColorTokenTableEntry starmathdatabase::aColorTokenTableParse[] { "thistle", THTMLCOL, COL_SM_THISTLE }, { "tomato", THTMLCOL, COL_SM_TOMATO }, { "turquoise", THTMLCOL, COL_SM_TURQUOISE }, -{ "ubunt", TICONICCOL, COL_SM_UBUNTU_ORANGE }, +{ "ubuntu", TICONICCOL, COL_SM_UBUNTU_ORANGE }, { "violet", THTMLCOL, COL_SM_VIOLET }, { "wheat", THTMLCOL, COL_SM_WHEAT }, { "white", TMATHMLCOL, COL_SM_WHITE }, @@ -629,7 +629,7 @@ const SmColorTokenTableEntry starmathdatabase::aColorTokenTableHTML[] { "palevioletred", THTMLCOL, COL_SM_PALEVIOLETRED }, { "papayawhip", THTMLCOL, COL_SM_PAPAYAWHIP }, { "peachpuff", THTMLCOL, COL_SM_PEACHPUFF }, -{ "per", THTMLCOL, COL_SM_PERU }, +{ "peru", THTMLCOL, COL_SM_PERU }, { "pink", THTMLCOL, COL_SM_PINK }, { "plum", THTMLCOL, COL_SM_PLUM }, { "powderblue", THTMLCOL, COL_SM_POWDERBLUE }, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/node.hxx|4 starmath/source/node.cxx | 14 ++ 2 files changed, 18 insertions(+) New commits: commit 15a02261047cc60f3e080e74697bd88127124a03 Author: dante AuthorDate: Tue Feb 2 16:20:28 2021 +0100 Commit: Noel Grandin CommitDate: Tue Feb 2 20:53:02 2021 +0100 Support patch for starmath syntax hightlight Starmath syntax hightlight has dependences on node classes. But those classes are whidely used. So for avoiding future merge conflicts it should be merged separetely because syntax hightlight won't be merged soon. Change-Id: Ifaf33cd67c9ea0d5cfffaad787ce5fabc1447a65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110325 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 988a1024332a..d0b81737a31d 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -134,6 +134,10 @@ enum class SmNodeType /*25*/ Rectangle, VerticalBrace, MathIdent }; +namespace starmathdatabase +{ +bool isStructuralNode(SmNodeType ntype); +} class SmNode : public SmRect { diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 4de696dcabfa..e15d72312592 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -40,6 +40,20 @@ #include #include +bool starmathdatabase::isStructuralNode(SmNodeType ntype) +{ +// clang-format off +return ntype==SmNodeType::Table || ntype==SmNodeType::Line|| ntype==SmNodeType::UnHor +|| ntype==SmNodeType::BinHor || ntype==SmNodeType::BinVer +|| ntype==SmNodeType::BinDiagonal || ntype==SmNodeType::SubSup +|| ntype==SmNodeType::Matrix || ntype==SmNodeType::Root +|| ntype==SmNodeType::Expression || ntype==SmNodeType::Brace +|| ntype==SmNodeType::Bracebody || ntype==SmNodeType::Oper +|| ntype==SmNodeType::Align || ntype==SmNodeType::Attribut +|| ntype==SmNodeType::Font; +// clang-format on +} + namespace { template ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/token.hxx|6 starmath/source/parse.cxx | 442 +++--- 2 files changed, 224 insertions(+), 224 deletions(-) New commits: commit 52dc0879e48afb2be1bebb567b34ad9d8fbd3314 Author: dante AuthorDate: Mon Feb 1 13:25:51 2021 +0100 Commit: Stephan Bergmann CommitDate: Tue Feb 2 11:30:47 2021 +0100 SmToken use u16string_view pIdent The idea is to use 16 bits characters for node identities. Avoids some intermediate createTextFromAscii Will simplify the use of unicode 16 math identifiers Change-Id: Ie084477f00219ba3bab0c4b53d3a4a5a310fa452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110252 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 374e23876a9f..c7d26e1efe0b 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -149,7 +149,7 @@ enum SmTokenType struct SmTokenTableEntry { -const char* pIdent; +const std::u16string_view pIdent; SmTokenType eType; sal_Unicode cMathChar; TG nGroup; @@ -264,7 +264,7 @@ struct SmToken void operator=(const SmTokenTableEntry& aTokenTableEntry) { -aText = OUString::createFromAscii(aTokenTableEntry.pIdent); +aText = aTokenTableEntry.pIdent; eType = aTokenTableEntry.eType; cMathChar = aTokenTableEntry.cMathChar; nGroup = aTokenTableEntry.nGroup; @@ -275,7 +275,7 @@ struct SmToken void operator=(const SmTokenTableEntry* aTokenTableEntry) { -aText = OUString::createFromAscii(aTokenTableEntry->pIdent); +aText = aTokenTableEntry->pIdent; eType = aTokenTableEntry->eType; cMathChar = aTokenTableEntry->cMathChar; nGroup = aTokenTableEntry->nGroup; diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 1e0846eb7667..0f3101450023 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -42,224 +42,224 @@ using namespace ::com::sun::star::i18n; //Definition of math keywords const SmTokenTableEntry aTokenTable[] = { -{ "abs", TABS, '\0', TG::UnOper, 13 }, -{ "acute", TACUTE, MS_ACUTE, TG::Attribute, 5 }, -{ "aleph" , TALEPH, MS_ALEPH, TG::Standalone, 5 }, -{ "alignb", TALIGNC, '\0', TG::Align, 0}, -{ "alignc", TALIGNC, '\0', TG::Align, 0}, -{ "alignl", TALIGNL, '\0', TG::Align, 0}, -{ "alignm", TALIGNC, '\0', TG::Align, 0}, -{ "alignr", TALIGNR, '\0', TG::Align, 0}, -{ "alignt", TALIGNC, '\0', TG::Align, 0}, -{ "and", TAND, MS_AND, TG::Product, 0}, -{ "approx", TAPPROX, MS_APPROX, TG::Relation, 0}, -{ "arccos", TACOS, '\0', TG::Function, 5}, -{ "arccot", TACOT, '\0', TG::Function, 5}, -{ "arcosh", TACOSH, '\0', TG::Function, 5 }, -{ "arcoth", TACOTH, '\0', TG::Function, 5 }, -{ "arcsin", TASIN, '\0', TG::Function, 5}, -{ "arctan", TATAN, '\0', TG::Function, 5}, -{ "arsinh", TASINH, '\0', TG::Function, 5}, -{ "artanh", TATANH, '\0', TG::Function, 5}, -{ "backepsilon" , TBACKEPSILON, MS_BACKEPSILON, TG::Standalone, 5}, -{ "bar", TBAR, MS_BAR, TG::Attribute, 5}, -{ "binom", TBINOM, '\0', TG::NONE, 5 }, -{ "bold", TBOLD, '\0', TG::FontAttr, 5}, -{ "boper", TBOPER, '\0', TG::Product, 0}, -{ "breve", TBREVE, MS_BREVE, TG::Attribute, 5}, -{ "bslash", TBACKSLASH, MS_BACKSLASH, TG::Product, 0 }, -{ "cdot", TCDOT, MS_CDOT, TG::Product, 0}, -{ "check", TCHECK, MS_CHECK, TG::Attribute, 5}, -{ "circ" , TCIRC, MS_CIRC, TG::Standalone, 5}, -{ "circle", TCIRCLE, MS_CIRCLE, TG::Attribute, 5}, -{ "color", TCOLOR, '\0', TG::FontAttr, 5}, -{ "coprod", TCOPROD, MS_COPROD, TG::Oper, 5}, -{ "cos", TCOS, '\0', TG::Function, 5}, -{ "cosh", TCOSH, '\0', TG::Function, 5}, -{ "cot", TCOT, '\0', TG::Function, 5}, -{ "coth", TCOTH, '\0', TG::Function, 5}, -{ "csub", TCSUB, '\0', TG::Power, 0}, -{ "csup", TCSUP, '\0', TG::Power, 0}, -{ "dddot", TDDDOT, MS_DDDOT, TG::Attribute, 5}, -{ "ddot", TDDOT, MS_DDOT, TG::Attribute, 5}, -{ "def", TDEF, MS_DEF, TG::Relation, 0}, -{ "div", TDIV, MS_DIV, TG::Product, 0}, -{ "divides", TDIVIDES, MS_LINE, TG::Relation, 0}, -{ "dlarrow" , TDLARROW, MS_DLARROW, TG::Standalone, 5}, -{ "dlrarrow" , TDLRARROW, MS_DLRARROW, TG::Standalone, 5}, -{ "dot", TDOT, MS_DOT, TG::Attribute, 5}, -{ "dotsaxis", TDOTSAXIS, MS_DOTSAXIS, TG::Standalone, 5}, // 5 to continue expression -{ "dotsdiag", TDOTSDIAG, MS_DOTSUP, TG::Standalone, 5}, -{ "dotsdown", TDOTSDOWN, MS_DOTSDOWN, TG::Standalone, 5}, -{ "dotslow", TDOTSLOW, MS_DOTSLOW, TG::Standalone, 5}, -{ "dotsup", TDOTSUP, MS_DOTSUP, TG::Standalone, 5}, -{ "dotsvert", TDOTSVERT, MS_DOTSVERT, TG::Standalone, 5}, -{ "downarrow" , TDOWNARROW, MS_DOWNARROW, TG::Standalone, 5}, -{ "drarrow" , TDRARROW, MS_DRARROW, TG::Standalone, 5}, -{ "emptyset" , TEMPTYSET, MS_EMPTYSET,
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/node.hxx | 37 + starmath/source/node.cxx | 80 ++ starmath/source/parse.cxx | 15 +--- 3 files changed, 119 insertions(+), 13 deletions(-) New commits: commit ad57c26d4f16ac5b477a29106f4933ed1e1ca911 Author: dante AuthorDate: Thu Jan 7 18:46:50 2021 +0100 Commit: Noel Grandin CommitDate: Sun Jan 31 15:22:36 2021 +0100 Increase node parser mathematical abstraction The purpose is go to a simple parser in wich nodes are loaded by priorities. For that purpose we shall first increase the parser abstraction and simplify to maximum node releted operations. For that purpose: - Can set as subnodes unique_ptr and pointers alike. - Binary operators node->setsubnodes() will automatically adjust data order in base to data type. Change-Id: I050360cad34616709549e7461add0811dc26edc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108944 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 3bdb6bac6c9c..988a1024332a 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -499,6 +499,13 @@ public: using SmNode::GetSubNode; virtual SmNode * GetSubNode(size_t nIndex) override; +/** + * Gets the subnode of index nIndex, used for operators. + * @param nIndex + * @return subnode of index nIndex + */ +SmNode * GetSubNodeBinMo(size_t nIndex) const; + /** * Does the cleaning of the subnodes. * @return @@ -515,6 +522,36 @@ public: void SetSubNodes(std::unique_ptr pFirst, std::unique_ptr pSecond, std::unique_ptr pThird = nullptr); +/** + * Sets subnodes. + * @param pFirst + * @param pSecond + * @param pThird + * @return + */ +void SetSubNodes(SmNode* pFirst, SmNode* pSecond, SmNode* pThird); + +/** + * Sets subnodes, used for operators. + * The data is reordered so the items are correctly ordered. + * @param pFirst + * @param pSecond + * @param pThird + * @return + */ +void SetSubNodesBinMo(std::unique_ptr pFirst, std::unique_ptr pSecond, + std::unique_ptr pThird = nullptr); + +/** + * Sets subnodes, used for operators. + * The data is reordered so the items are correctly ordered. + * @param pFirst + * @param pSecond + * @param pThird + * @return + */ +void SetSubNodesBinMo(SmNode* pFirst, SmNode* pSecond, SmNode* pThird); + /** * Sets subnodes. * @param rNodeArray diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index f6fc8f0aed10..4de696dcabfa 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -387,6 +387,74 @@ void SmStructureNode::SetSubNodes(std::unique_ptr pFirst, std::unique_pt ClaimPaternity(); } +void SmStructureNode::SetSubNodes(SmNode* pFirst, SmNode* pSecond, SmNode* pThird) +{ +size_t nSize = pThird ? 3 : (pSecond ? 2 : (pFirst ? 1 : 0)); +maSubNodes.resize( nSize ); +if (pFirst) +maSubNodes[0] = pFirst; +if (pSecond) +maSubNodes[1] = pSecond; +if (pThird) +maSubNodes[2] = pThird; + +ClaimPaternity(); +} + +void SmStructureNode::SetSubNodesBinMo(std::unique_ptr pFirst, std::unique_ptr pSecond, std::unique_ptr pThird) +{ +if(GetType()==SmNodeType::BinDiagonal) +{ +size_t nSize = pSecond ? 3 : (pThird ? 2 : (pFirst ? 1 : 0)); +maSubNodes.resize( nSize ); +if (pFirst) +maSubNodes[0] = pFirst.release(); +if (pSecond) +maSubNodes[2] = pSecond.release(); +if (pThird) +maSubNodes[1] = pThird.release(); +} +else +{ +size_t nSize = pThird ? 3 : (pSecond ? 2 : (pFirst ? 1 : 0)); +maSubNodes.resize( nSize ); +if (pFirst) +maSubNodes[0] = pFirst.release(); +if (pSecond) +maSubNodes[1] = pSecond.release(); +if (pThird) +maSubNodes[2] = pThird.release(); +} +ClaimPaternity(); +} + +void SmStructureNode::SetSubNodesBinMo(SmNode* pFirst, SmNode* pSecond, SmNode* pThird) +{ +if(GetType()==SmNodeType::BinDiagonal) +{ +size_t nSize = pSecond ? 3 : (pThird ? 2 : (pFirst ? 1 : 0)); +maSubNodes.resize( nSize ); +if (pFirst) +maSubNodes[0] = pFirst; +if (pSecond) +maSubNodes[1] = pSecond; +if (pThird) +maSubNodes[2] = pThird; +} +else +{ +size_t nSize = pThird ? 3 : (pSecond ? 2 : (pFirst ? 1 : 0)); +maSubNodes.resize( nSize ); +if (pFirst) +maSubNodes[0] = pFirst; +if (pSecond) +maSubNodes[1] = pSecond; +if (pThird) +maSubNodes[2] = pThird; +} +ClaimPaternity(); +} + void SmStructureNode::SetSubNodes(SmNodeArray&&
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/strings.hrc |2 +- starmath/source/ElementsDockingWindow.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 2b5d320630aaa89fc3857f2926b82d116910f905 Author: Ming Hua AuthorDate: Thu Nov 26 01:08:33 2020 +0100 Commit: Julien Nabet CommitDate: Thu Nov 26 18:16:39 2020 +0100 Fix typo in code: caos -> chaos Change-Id: I8894d83d0131f5bc49d6be7b158cf90401174bab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106671 Tested-by: Jenkins Reviewed-by: Dante DM Reviewed-by: Andrea Gelmini diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 9ecaaf1baae4..01dc7b864ee4 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -325,7 +325,7 @@ #define RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP NC_("RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP", "Gauss distribution" ) #define RID_EXAMPLE_EULER_LAGRANGE_HELP NC_("RID_EXAMPLE_EULER_LAGRANGE_HELP", "Euler-Lagrange equation" ) #define RID_EXAMPLE_FTC_HELPNC_("RID_EXAMPLE_FTC_HELP", "Fundamental theorem of calculus" ) -#define RID_EXAMPLE_CAOS_HELP NC_("RID_EXAMPLE_CAOS_HELP", "Chaos equation" ) +#define RID_EXAMPLE_CHAOS_HELP NC_("RID_EXAMPLE_CHAOS_HELP", "Chaos equation" ) #define RID_EXAMPLE_EULER_IDENTITY_HELP NC_("RID_EXAMPLE_EULER_IDENTITY_HELP", "Euler's identity" ) #define RID_EXAMPLE_2NEWTON NC_("RID_EXAMPLE_2NEWTON", "Newton's second law" ) #define RID_EXAMPLE_GENERAL_RELATIVITY_HELP NC_("RID_EXAMPLE_GENERAL_RELATIVITY_HELP", "General relativity") diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index da7a6c10b343..5083d94ff010 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -262,7 +262,7 @@ const SmElementDescr SmElementsControl::m_aExamplesList[] = {" %DELTA t' = { %DELTA T } over sqrt{ 1 - v^2 over c^2 } ", RID_EXAMPLE_SPECIAL_RELATIVITY_HELP }, { "d over dt left( {partial L}over{partial dot q} = {partial L}over{partial q} right)", RID_EXAMPLE_EULER_LAGRANGE_HELP }, {"int from a to b f'(x) dx = f(a) - f(b)", RID_EXAMPLE_FTC_HELP}, -{ "abs{ %delta Z(t) } approx e^{%lambda t} abs{ %delta Z(0) }", RID_EXAMPLE_CAOS_HELP}, +{ "abs{ %delta Z(t) } approx e^{%lambda t} abs{ %delta Z(0) }", RID_EXAMPLE_CHAOS_HELP}, {"f ( x ) = sum from { { n = 0 } } to { infinity } { {f^{(n)}(x_0)} over {n!} (x-x_0)^n}", RID_EXAMPLE_A_TAYLOR_SERIES_HELP}, {"f ( x ) = {1} over {%sigma sqrt{2%pi} }func e^-{{(x-%mu)^2} over {2%sigma^2}}", RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP}, }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/starmathdatabase.hxx| 13 starmath/inc/token.hxx |2 starmath/source/mathmlexport.cxx | 10 +-- starmath/source/starmathdatabase.cxx | 108 +++ starmath/source/visitors.cxx |1 5 files changed, 91 insertions(+), 43 deletions(-) New commits: commit 88c343b50a1de197394e3e22bf82ff455386a80b Author: dante AuthorDate: Fri Nov 20 17:20:56 2020 +0100 Commit: Noel Grandin CommitDate: Sat Nov 21 13:51:25 2020 +0100 Corrected my previous mess on mathml export with color export 2. Now only exports HTML4 colors and others are treated as #RRGGBB. Now mathml can import #RGB colors. Change-Id: I6f9df916cb4e1d9c4a55eca5e447b7936207203a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106286 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/starmath/inc/starmathdatabase.hxx b/starmath/inc/starmathdatabase.hxx index 10e177493e68..06ec3438357f 100644 --- a/starmath/inc/starmathdatabase.hxx +++ b/starmath/inc/starmathdatabase.hxx @@ -199,6 +199,7 @@ namespace starmathdatabase // Variables containing color information. extern const SmColorTokenTableEntry aColorTokenTableParse[159]; extern const SmColorTokenTableEntry aColorTokenTableHTML[148]; +extern const SmColorTokenTableEntry aColorTokenTableMATHML[16]; extern const SmColorTokenTableEntry aColorTokenTableDVIPSNAMES[5]; /** @@ -249,6 +250,18 @@ std::unique_ptr Identify_Color_Parser(sal_uInt32 cColor) */ std::unique_ptr Identify_Color_HTML(sal_uInt32 cColor); +/** + * Identifies color from color code cColor. + * It will be returned with the MATHML syntax. + * + * This is used to export mathml. + * Identifies the color and allows it to export it in proper mathml code. + * + * @param cColor + * @param parser color + */ +std::unique_ptr Identify_Color_MATHML(sal_uInt32 cColor); + /** * Identifies color from color code cColor. * It will be returned with the dvipsnames syntax. diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index da33c818105b..a1cbe95d214c 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -139,7 +139,7 @@ enum SmTokenType TSQRT, TNROOT, TFACT, TABS, // roots, n! |z| // Color TRGB, TRGBA, THEX, THTMLCOL, TDVIPSNAMESCOL, -TICONICCOL +TICONICCOL, TMATHMLCOL // clang-format on }; diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 27d9d2b8696b..0956269d1b40 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1176,18 +1176,19 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) case TPHANTOM: // No attribute needed. An element will be used below. break; -case THTMLCOL: +case TMATHMLCOL: { std::unique_ptr aSmColorTokenTableEntry; nc = pNode->GetToken().aText.toUInt32(16); -aSmColorTokenTableEntry = starmathdatabase::Identify_Color_HTML( nc ); -OUString sssStr = OUString::createFromAscii( aSmColorTokenTableEntry->cIdent ); +aSmColorTokenTableEntry = starmathdatabase::Identify_Color_MATHML(nc); +OUString sssStr = OUString::createFromAscii(aSmColorTokenTableEntry->cIdent); AddAttribute(XML_NAMESPACE_MATH, XML_MATHCOLOR, sssStr); } break; case TRGB: case TRGBA: case THEX: +case THTMLCOL: case TDVIPSNAMESCOL: case TICONICCOL: { @@ -1195,8 +1196,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) sStrBuf.append('#'); std::unique_ptr aSmColorTokenTableEntry; nc = pNode->GetToken().aText.toUInt32(16); -aSmColorTokenTableEntry = starmathdatabase::Identify_Color_HTML( nc ); -sStrBuf.append( aSmColorTokenTableEntry->cColor.AsRGBHexString() ); +sStrBuf.append(Color(nc).AsRGBHEXString()); OUString ssStr(sStrBuf.makeStringAndClear()); AddAttribute(XML_NAMESPACE_MATH, XML_MATHCOLOR, ssStr); } diff --git a/starmath/source/starmathdatabase.cxx b/starmath/source/starmathdatabase.cxx index 90a29c62db6c..43ea4cd06443 100644 --- a/starmath/source/starmathdatabase.cxx +++ b/starmath/source/starmathdatabase.cxx @@ -360,14 +360,14 @@ SmToken starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_U const SmColorTokenTableEntry starmathdatabase::aColorTokenTableParse[] = { { "aliceblue", "aliceblue", THTMLCOL, COL_SM_ALICEBLUE }, { "antiquewhite", "antiquewhite", THTMLCOL, COL_SM_ANTIQUEWHITE }, -{ "aqua", "aqua", THTMLCOL, COL_SM_AQUA }, +{ "aqua", "aqua", TMATHMLCOL, COL_SM_AQUA }, { "aquamarine", "aquamarine", THTMLCOL, COL_SM_AQUAMARINE }, { "azure",
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/strings.hrc |9 - starmath/source/ElementsDockingWindow.cxx | 11 +-- 2 files changed, 17 insertions(+), 3 deletions(-) New commits: commit 2b29e16ea0fca627d71b61af98df0f543e6f206b Author: dante AuthorDate: Wed Nov 4 18:00:23 2020 +0100 Commit: Noel Grandin CommitDate: Sat Nov 7 07:10:33 2020 +0100 Starmath examples renovated Change-Id: Iff286171ddba92373d400763eb78769e37f40f37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105302 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index b9377eff1081..8a303127d245 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -298,8 +298,15 @@ #define RID_EXAMPLE_CIRCUMFERENCE_HELP NC_("RID_EXAMPLE_CIRCUMFERENCE_HELP", "Circumference" ) #define RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP NC_("RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP", "Mass–energy equivalence" ) #define RID_EXAMPLE_PYTHAGOREAN_THEO_HELP NC_("RID_EXAMPLE_PYTHAGOREAN_THEO_HELP", "Pythagorean theorem" ) -#define RID_EXAMPLE_A_SIMPLE_SERIES_HELP NC_("RID_EXAMPLE_A_SIMPLE_SERIES_HELP", "A simple series" ) +#define RID_EXAMPLE_A_TAYLOR_SERIES_HELP NC_("RID_EXAMPLE_A_TAYLOR_SERIES_HELP", "Taylor series" ) #define RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP NC_("RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP", "Gauss distribution" ) +#define RID_EXAMPLE_EULER_LAGRANGE_HELP NC_("RID_EXAMPLE_EULER_LAGRANGE_HELP", "Euler-Lagrange equation" ) +#define RID_EXAMPLE_FTC_HELPNC_("RID_EXAMPLE_FTC_HELP", "Fundamental theorem of calculus" ) +#define RID_EXAMPLE_CAOS_HELP NC_("RID_EXAMPLE_CAOS_HELP", "Chaos equation" ) +#define RID_EXAMPLE_EULER_IDENTITY_HELP NC_("RID_EXAMPLE_EULER_IDENTITY_HELP", "Euler's identity" ) +#define RID_EXAMPLE_2NEWTON NC_("RID_EXAMPLE_2NEWTON", "Newton's second law" ) +#define RID_EXAMPLE_GENERAL_RELATIVITY_HELP NC_("RID_EXAMPLE_GENERAL_RELATIVITY_HELP", "General relativity") +#define RID_EXAMPLE_SPECIAL_RELATIVITY_HELP NC_("RID_EXAMPLE_SPECIAL_RELATIVITY_HELP", "Special relativity") #define RID_FONTREGULAR NC_("RID_FONTREGULAR", "Standard" ) #define RID_FONTITALIC NC_("RID_FONTITALIC", "Italic" ) diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 8850ca49fcbb..aa96a1e0bb7f 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -244,10 +244,17 @@ const SmElementDescr SmElementsControl::m_aOthersList[] = const SmElementDescr SmElementsControl::m_aExamplesList[] = { +{"{func e}^{i %pi} + 1 = 0", RID_EXAMPLE_EULER_IDENTITY_HELP}, {"C=%pi cdot d = 2 cdot %pi cdot r", RID_EXAMPLE_CIRCUMFERENCE_HELP}, -{"E=mc^2", RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP}, {"a^2 + b^2 = c^2", RID_EXAMPLE_PYTHAGOREAN_THEO_HELP}, -{"f ( x ) = sum from { { i = 0 } } to { infinity } { {f^{(i)}(0)} over {i!} x^i}", RID_EXAMPLE_A_SIMPLE_SERIES_HELP}, +{"F = m a", RID_EXAMPLE_2NEWTON}, +{"E = m c^2", RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP}, +{"G_{%mu %nu} + %LAMBDA g_{%mu %nu}= frac{8 %pi G}{c^4} T_{%mu %nu}", RID_EXAMPLE_GENERAL_RELATIVITY_HELP}, +{" %DELTA t' = { %DELTA T } over sqrt{ 1 - v^2 over c^2 } ", RID_EXAMPLE_SPECIAL_RELATIVITY_HELP }, +{ "d over dt left( {partial L}over{partial dot q} = {partial L}over{partial q} right)", RID_EXAMPLE_EULER_LAGRANGE_HELP }, +{"int from a to b f'(x) dx = f(a) - f(b)", RID_EXAMPLE_FTC_HELP}, +{ "abs{ %delta Z(t) } approx e^{%lambda t} abs{ %delta Z(0) }", RID_EXAMPLE_CAOS_HELP}, +{"f ( x ) = sum from { { n = 0 } } to { infinity } { {f^{(n)}(x_0)} over {n!} (x-x_0)^n}", RID_EXAMPLE_A_TAYLOR_SERIES_HELP}, {"f ( x ) = {1} over {%sigma sqrt{2%pi} }func e^-{{(x-%mu)^2} over {2%sigma^2}}", RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP}, }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/error.hxx|1 starmath/inc/strings.hrc |2 starmath/inc/strings.hxx |2 starmath/inc/token.hxx| 108 ++ starmath/source/ElementsDockingWindow.cxx |2 starmath/source/parse.cxx |3 6 files changed, 72 insertions(+), 46 deletions(-) New commits: commit ed8fc341678f780ceedd77db2ea4a4441bdca3e9 Author: dante AuthorDate: Tue Nov 3 12:30:40 2020 +0100 Commit: Noel Grandin CommitDate: Tue Nov 3 20:58:13 2020 +0100 Reordered token.hxx. It will be easier to follow the list. Minor changes respecting set ( added it/s owns tokens to setminus, setquotient ). Change-Id: I879675db8634a54ff3f16e7c00e4aedcaeb429cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105242 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/error.hxx b/starmath/inc/error.hxx index d8179da593d5..bd2b7067a91c 100644 --- a/starmath/inc/error.hxx +++ b/starmath/inc/error.hxx @@ -23,6 +23,7 @@ class SmNode; +// Those are the errors that the parser (parser.hxx/parser.cxx) may encounter. enum class SmParseError { None, diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 50adc4a3e042..7cd2c73c09d7 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -69,7 +69,7 @@ #define RID_XUNIONY_HELPNC_("RID_XUNIONY_HELP", "Union" ) #define RID_XINTERSECTIONY_HELP NC_("RID_XINTERSECTIONY_HELP", "Intersection" ) #define RID_XSETMINUSY_HELP NC_("RID_XSETMINUSY_HELP", "Difference" ) -#define RID_XSLASHY_HELPNC_("RID_XSLASHY_HELP", "Quotient Set" ) +#define RID_XSETQUOTIENTY_HELP NC_("RID_XSETQUOTIENTY_HELP", "Quotient Set" ) #define RID_XSUBSETY_HELP NC_("RID_XSUBSETY_HELP", "Subset" ) #define RID_XSUBSETEQY_HELP NC_("RID_XSUBSETEQY_HELP", "Subset Or Equal To" ) #define RID_XSUPSETY_HELP NC_("RID_XSUPSETY_HELP", "Superset" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index 2daf463afd25..17de13505fdf 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -59,7 +59,7 @@ #define RID_XUNIONY " union " #define RID_XINTERSECTIONY " intersection " #define RID_XSETMINUSY " setminus " -#define RID_XSLASHY " slash " +#define RID_XSETQUOTIENTY " setquotient " #define RID_XSUBSETY" subset " #define RID_XSUBSETEQY " subseteq " #define RID_XSUPSETY" supset " diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index a58e28d42be8..5b5d8e80634f 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -49,56 +49,80 @@ namespace o3tl { template<> struct typed_flags : is_typed_flags {}; } +// Tokens identifiers. Allow to know what kind of information the node contains. enum SmTokenType { -TEND, TLGROUP,TRGROUP,TLPARENT, TRPARENT, -TLBRACKET, TRBRACKET, TPLUS, TMINUS, TMULTIPLY, -TDIVIDEBY, TASSIGN,TPOUND, TSPECIAL, TSLASH, -TBACKSLASH, TBLANK, TSBLANK,TRSUB, TRSUP, -TCSUB, TCSUP, TLSUB, TLSUP, TGT, -TLT,TAND, TOR,TINTERSECT, TUNION, -TNEWLINE, TBINOM, TFROM, TTO,TINT, -TSUM, TOPER, TABS, TSQRT, TFACT, -TNROOT, TOVER, TTIMES, TGE,TLE, -TGG,TLL,TDOTSAXIS, TDOTSLOW, TDOTSVERT, -TDOTSDIAG, TDOTSUP,TDOTSDOWN, TACUTE, TBAR, -TBREVE, TCHECK, TCIRCLE,TDOT, TDDOT, -TDDDOT, TGRAVE, THAT, TTILDE, TVEC, -TUNDERLINE, TOVERLINE, TOVERSTRIKE,TITALIC,TNITALIC, -TBOLD, TNBOLD, TPHANTOM, TFONT, TSIZE, -TCOLOR, TALIGNL,TALIGNC,TALIGNR,TLEFT, -TRIGHT, TLANGLE,TLBRACE,TLLINE, TLDLINE, -TLCEIL, TLFLOOR,TNONE, TMLINE, TRANGLE, -TRBRACE,TRLINE, TRDLINE,TRCEIL, TRFLOOR, -TSTACK, TMATRIX,TDPOUND,TPLACE, -TTEXT, TNUMBER,TCHARACTER, TIDENT, TNEQ, -TEQUIV, TDEF, TPROP, TSIM, TSIMEQ, -TAPPROX,TPARALLEL, TORTHO, TIN,TNOTIN, -TSUBSET,TSUBSETEQ, TSUPSET,TSUPSETEQ, TPLUSMINUS, -TMINUSPLUS, TOPLUS, TOMINUS,TDIV, TOTIMES, -TODIVIDE, TTRANSL,TTRANSR,TIINT, TIIINT, -
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/error.hxx|3 starmath/inc/parse.hxx|3 starmath/inc/strings.hrc |5 starmath/inc/strings.hxx |2 starmath/inc/token.hxx| 28 - starmath/source/ElementsDockingWindow.cxx |7 starmath/source/node.cxx | 41 -- starmath/source/parse.cxx | 601 +++--- starmath/source/visitors.cxx | 34 + 9 files changed, 463 insertions(+), 261 deletions(-) New commits: commit 351f620baa64ecabd4f7f93ec0139724766c7c59 Author: Dante DM AuthorDate: Wed Oct 21 15:43:30 2020 +0200 Commit: Noel Grandin CommitDate: Tue Nov 3 20:57:12 2020 +0100 Added hexadecimal number and color support for starmath. Adds hidden command on guy hex number wich allows to use numbers of base 16 and also 0-9-A-Z. Added support for custom RGB colors on hexadecimal on starmath via command color hex colornumber. Improved RGB color handle on starmath. Changed the way the color is handled on starmath. Colors keywords won't give errors. They have been moved to an independent tokens list so starmath will load tokens faster. Changed the way the font size is handeled on starmath. This won't change anything, just related with the structural change. Implemented premature support for rgba colors on math. This change only adds the possibility on the parser, node and node visitors. For now end-user can not access it since in a future there'll be work to do on the renderer to add full support. Added hex entrie on the docking window. Changes made on Color.hxx, will save some nanoseconds on build. If you are interested on allowing rgba and do the job on the renderer (and all the other stuff than there are a lot of .GetRGBColor()), you may find usefull color hex colnum. Since transparency setting is ignored, the hexadecimal color has hidden support for it since did not instore the max value (255 + 255*256 + 255*256*256) and everything is loaded into the sal_uInt32. Change-Id: Iafb38b142fffa329ca468e3d62643154fcdd2bbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104630 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/error.hxx b/starmath/inc/error.hxx index a05123d6e080..d8179da593d5 100644 --- a/starmath/inc/error.hxx +++ b/starmath/inc/error.hxx @@ -39,7 +39,8 @@ enum class SmParseError FontExpected, SizeExpected, DoubleAlign, -DoubleSubsupscript +DoubleSubsupscript, +NumberExpected }; diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 519a90041f65..4f1e3024ccb3 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -83,6 +83,8 @@ class SmParser SmParser& operator=(const SmParser&) = delete; voidNextToken(); +voidNextTokenColor(); +voidNextTokenFontSize(); sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } voidReplace( sal_Int32 nPos, sal_Int32 nLen, const OUString ); @@ -140,7 +142,6 @@ public: const SmErrorDesc* NextError(); const SmErrorDesc* PrevError(); const SmErrorDesc* GetError(); -static const SmTokenTableEntry* GetTokenTableEntry( const OUString ); const std::set< OUString >& GetUsedSymbols() const { return m_aUsedSymbols; } }; diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 64144759f5cc..50adc4a3e042 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -195,6 +195,8 @@ #define RID_COLORX_TEAL_HELPNC_("RID_COLORX_TEAL_HELP", "Color Teal" ) #define RID_COLORX_YELLOW_HELP NC_("RID_COLORX_YELLOW_HELP", "Color Yellow" ) #define RID_COLORX_RGB_HELP NC_("RID_COLORX_RGB_HELP", "Color RGB" ) +#define RID_COLORX_RGBA_HELPNC_("RID_COLORX_RGBA_HELP", "Color RGBA" ) +#define RID_COLORX_HEX_HELP NC_("RID_COLORX_HEX_HELP", "Color hexadecimal" ) #define RID_LRGROUPX_HELP NC_("RID_LRGROUPX_HELP", "Group Brackets" ) #define RID_LRPARENTX_HELP NC_("RID_LRPARENTX_HELP", "Round Brackets" ) #define RID_LRBRACKETX_HELP NC_("RID_LRBRACKETX_HELP", "Square Brackets" ) @@ -317,6 +319,8 @@ #define STR_TEALNC_("STR_TEAL", "teal" ) #define STR_YELLOW NC_("STR_YELLOW", "yellow" ) #define STR_RGB NC_("STR_RGB", "rgb" ) +#define STR_RGBANC_("STR_RGBA", "rgba" ) +#define STR_HEX NC_("STR_HEX", "hex" ) #define STR_HIDENC_("STR_HIDE", "hide" ) #define STR_SIZENC_("STR_SIZE", "size" ) #define STR_FONTNC_("STR_FONT", "font" ) @@
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/view.hxx| 17 + starmath/source/view.cxx | 25 - 2 files changed, 17 insertions(+), 25 deletions(-) New commits: commit 787d4d6dcac18da6205fe4762a99f44966fd49a5 Author: Noel Grandin AuthorDate: Sat Oct 31 09:29:49 2020 +0200 Commit: Noel Grandin CommitDate: Sat Oct 31 12:29:15 2020 +0100 remove pimpl from SmViewShell Change-Id: Iaa42a593cc76b03e507f34305fce0833f7eac40a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105096 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index d48f1b2dcd62..eab940b2ed86 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -24,11 +24,13 @@ #include #include +#include #include #include #include #include #include +#include #include #include "document.hxx" #include "edit.hxx" @@ -206,26 +208,25 @@ public: }; namespace sfx2 { class FileDialogHelper; } -struct SmViewShell_Impl; class SmViewShell: public SfxViewShell { -std::unique_ptr mpImpl; - +std::unique_ptr mpDocInserter; +std::unique_ptr mpRequest; +SvtMiscOptions maOpts; VclPtr mpGraphic; SmGraphicController maGraphicController; OUString maStatusText; - bool mbPasteState; - -DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); -virtual voidNotify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - /** Used to determine whether insertions using SID_INSERTSPECIAL and SID_INSERTCOMMANDTEXT * should be inserted into SmEditWindow or directly into the SmDocShell as done if the * visual editor was last to have focus. */ bool mbInsertIntoEditWindow; + +DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); +virtual voidNotify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + protected: static Size GetTextLineSize(OutputDevice const & rDevice, diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 82bd312062c6..b76012a6b084 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -855,13 +854,6 @@ SmCmdBoxWrapper::SmCmdBoxWrapper(vcl::Window *pParentWindow, sal_uInt16 nId, static_cast(GetWindow())->Initialize(pInfo); } -struct SmViewShell_Impl -{ -std::unique_ptr pDocInserter; -std::unique_ptr pRequest; -SvtMiscOptions aOpts; -}; - SFX_IMPL_SUPERCLASS_INTERFACE(SmViewShell, SfxViewShell) void SmViewShell::InitInterface_Impl() @@ -1568,10 +1560,10 @@ void SmViewShell::Execute(SfxRequest& rReq) case SID_IMPORT_FORMULA: { -mpImpl->pRequest.reset(new SfxRequest( rReq )); -mpImpl->pDocInserter.reset(new ::sfx2::DocumentInserter(pWin ? pWin->GetFrameWeld() : nullptr, +mpRequest.reset(new SfxRequest( rReq )); +mpDocInserter.reset(new ::sfx2::DocumentInserter(pWin ? pWin->GetFrameWeld() : nullptr, GetDoc()->GetFactory().GetFactoryName())); -mpImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) ); +mpDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) ); break; } @@ -1897,7 +1889,6 @@ void SmViewShell::GetState(SfxItemSet ) SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *) : SfxViewShell(pFrame_, SfxViewShellFlags::HAS_PRINTOPTIONS) -, mpImpl(new SmViewShell_Impl) , mpGraphic(VclPtr::Create(this)) , maGraphicController(*mpGraphic, SID_GAPHIC_SM, pFrame_->GetBindings()) , mbPasteState(false) @@ -1952,11 +1943,11 @@ void SmViewShell::Activate( bool bIsMDIActivate ) IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ) { assert(_pFileDlg && "SmViewShell::DialogClosedHdl(): no file dialog"); -assert(mpImpl->pDocInserter && "ScDocShell::DialogClosedHdl(): no document inserter"); +assert(mpDocInserter && "ScDocShell::DialogClosedHdl(): no document inserter"); if ( ERRCODE_NONE == _pFileDlg->GetError() ) { -std::unique_ptr pMedium = mpImpl->pDocInserter->CreateMedium(); +std::unique_ptr pMedium = mpDocInserter->CreateMedium(); if ( pMedium ) { @@ -1975,8 +1966,8 @@ IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, voi } } -mpImpl->pRequest->SetReturnValue( SfxBoolItem( mpImpl->pRequest->GetSlot(), true ) ); -mpImpl->pRequest->Done(); +mpRequest->SetReturnValue( SfxBoolItem( mpRequest->GetSlot(), true ) ); +mpRequest->Done(); } void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint ) @@ -1994,7 +1985,7 @@ void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint ) bool SmViewShell::IsInlineEditEnabled() const { -
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/edit.hxx|4 starmath/source/edit.cxx | 21 + 2 files changed, 25 insertions(+) New commits: commit 8dcbbea3802670004c3e78a1ff1ec56b23df674c Author: Caolán McNamara AuthorDate: Tue Oct 27 16:49:48 2020 + Commit: Caolán McNamara CommitDate: Wed Oct 28 10:04:43 2020 +0100 tdf#137620 add explicit SurroundingText support to starmath Edit Window Change-Id: Ie716dd66754dd774ee81fa97ebee8dc314002f12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104898 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index c1ce769ab1c6..43ef648ddd95 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -68,6 +68,10 @@ class SmEditWindow final : public vcl::Window, public DropTargetHelper virtual void MouseButtonUp(const MouseEvent ) override; virtual void MouseButtonDown(const MouseEvent ) override; +virtual OUString GetSurroundingText() const override; +virtual Selection GetSurroundingTextSelection() const override; +virtual bool DeleteSurroundingText(const Selection& rSelection) override; + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index c8f82355468e..ef1da5bca1ab 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -144,6 +144,27 @@ void SmEditWindow::dispose() vcl::Window::dispose(); } +OUString SmEditWindow::GetSurroundingText() const +{ +if (pEditView) +return pEditView->GetSurroundingText(); +return OUString(); +} + +Selection SmEditWindow::GetSurroundingTextSelection() const +{ +if (pEditView) +return pEditView->GetSurroundingTextSelection(); +return Selection(0, 0); +} + +bool SmEditWindow::DeleteSurroundingText(const Selection& rSelection) +{ +if (pEditView) +return pEditView->DeleteSurroundingText(rSelection); +return false; +} + void SmEditWindow::StartCursorMove() { if (!IsInlineEditEnabled()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/node.hxx| 20 ++-- starmath/source/visitors.cxx |2 +- 2 files changed, 11 insertions(+), 11 deletions(-) New commits: commit 218001e9f06f1cbe44abf2fbebfc360b682e432a Author: Andrea Gelmini AuthorDate: Tue Sep 22 13:13:39 2020 +0200 Commit: Julien Nabet CommitDate: Tue Sep 22 20:57:26 2020 +0200 Fix typos Change-Id: I2030700ea031c03242c13d1cb96babf2bc255bab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103163 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index c0320e6bef5e..6c28be36e98b 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -318,9 +318,9 @@ public: sal_uInt16 GetRow() const { return sal::static_int_cast(maNodeToken.nRow); } /** - * Gets the colum of the line in the text where the node is located. + * Gets the column of the line in the text where the node is located. * It is used to do the visual <-> text correspondence. - * @return colum + * @return column */ sal_uInt16 GetColumn() const { return sal::static_int_cast(maNodeToken.nCol); } @@ -464,7 +464,7 @@ public: void ClearSubNodes(); /** - * Sets subnodes, used for opperators. + * Sets subnodes, used for operators. * @param pFirst * @param pSecond * @param pThird @@ -695,8 +695,8 @@ public: SmTextNode(const SmToken , sal_uInt16 nFontDescP ); /** - * Returns the font type being used (text, variabla, symbol, ...). - * @retutn font type + * Returns the font type being used (text, variable, symbol, ...). + * @return font type */ sal_uInt16 GetFontDesc() const { return mnFontDesc; } @@ -1328,7 +1328,7 @@ public: void Accept(SmVisitor* pVisitor) override; /** - * Returns the node containing the data of the binary opperator. + * Returns the node containing the data of the binary operator. * @return symbol data */ const SmNode* Symbol() const { return const_cast(this)->Symbol(); } @@ -1514,7 +1514,7 @@ public: /** * Checks if it is going to be used for a limit. - * Example lim from { x towar 0 } { {sin x}over x } = 1 + * Example lim from { x toward 0 } { {sin x}over x } = 1 * @return is a limit */ bool IsUseLimits() const { return mbUseLimits; }; @@ -1755,15 +1755,15 @@ public: : SmStructureNode(SmNodeType::Oper, rNodeToken, 2) { } /** - * Returns the node with the opperator data - * @return opperator data + * Returns the node with the operator data + * @return operator data */ const SmNode * GetSymbol() const { return const_cast(this)->GetSymbol(); } SmNode * GetSymbol(); /** * Returns the height of the node in base to the symbol - * ( rSymbol contains the opperator data ) + * ( rSymbol contains the operator data ) * and the font format ( rFormat ). * @param rSymbol * @param rFormat diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index f663dcfb2d27..37a8fc7ab595 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -2435,7 +2435,7 @@ void SmNodeToTextVisitor::Visit( SmGlyphSpecialNode* pNode ) Append( pNode->GetToken( ).aText ); } -//TODO to improve this it is requiered to improve mathmlimport. +//TODO to improve this it is required to improve mathmlimport. void SmNodeToTextVisitor::Visit( SmMathSymbolNode* pNode ) { sal_Unicode cChar = pNode->GetToken().cMathChar; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/caret.hxx | 13 ++--- starmath/inc/cursor.hxx|3 +-- starmath/source/cursor.cxx | 17 ++--- starmath/source/view.cxx | 16 4 files changed, 17 insertions(+), 32 deletions(-) New commits: commit 5267b6c04eed2662726bb90899eb40414779fcb3 Author: Luke Dixon AuthorDate: Tue Sep 8 01:37:23 2020 +0100 Commit: Noel Grandin CommitDate: Tue Sep 8 08:17:59 2020 +0200 starmath: stop change to caret pos graph when moving after brace Currently, the code that moves the cursor after the brace changes the current caret pos instead of moving to the next pos. Because of this, we end up with one missing graph pos and a duplicate graph pos. This can be seen by moving to the end of a brace body, pressing the key for the closing brace and then pressing left and right to move in and out of the brace. This fix uses the existing code that sets the cursor position to the next element in the graph instead of changing the cursor pos directly. It also marks the caret pos as const to suggest not changing the caret pos inside a graph entry. Change-Id: I5492e54f1bddbfc90036f29698982fd8696f5e88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102214 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx index 327ee1d6ed16..c0e5c4f5fca0 100644 --- a/starmath/inc/caret.hxx +++ b/starmath/inc/caret.hxx @@ -103,15 +103,14 @@ private: /** An entry in SmCaretPosGraph */ struct SmCaretPosGraphEntry{ -SmCaretPosGraphEntry(SmCaretPos pos, - SmCaretPosGraphEntry* left, - SmCaretPosGraphEntry* right) { -CaretPos = pos; -Left = left; -Right = right; +SmCaretPosGraphEntry(SmCaretPos pos, SmCaretPosGraphEntry* left, SmCaretPosGraphEntry* right) +: CaretPos{pos} +, Left{left} +, Right{right} +{ } /** Caret position */ -SmCaretPos CaretPos; +const SmCaretPos CaretPos; /** Entry to the left visually */ SmCaretPosGraphEntry* Left; /** Entry to the right visually */ diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 236485d5e04c..47218e490865 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -184,8 +184,7 @@ public: /** Draw the caret */ void Draw(OutputDevice& pDev, Point Offset, bool isCaretVisible); -bool IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBraceNode) const; -void MoveAfterBracket(SmBraceNode* pBraceNode); +bool IsAtTailOfBracket(SmBracketType eBracketType) const; private: friend class SmDocShell; diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 5e69b5876a45..c476bd41228e 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1327,7 +1327,8 @@ void SmCursor::RequestRepaint(){ } } -bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBraceNode) const { +bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType) const +{ const SmCaretPos pos = GetPosition(); if (!pos.IsValid()) { return false; @@ -1391,23 +1392,9 @@ bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBra return false; } -if (ppBraceNode) { -*ppBraceNode = pBraceNode; -} - return true; } -void SmCursor::MoveAfterBracket(SmBraceNode* pBraceNode) -{ -mpPosition->CaretPos.pSelectedNode = pBraceNode; -mpPosition->CaretPos.nIndex = 1; -mpAnchor->CaretPos.pSelectedNode = pBraceNode; -mpAnchor->CaretPos.nIndex = 1; -RequestRepaint(); -} - - /// SmNodeListParser SmNode* SmNodeListParser::Parse(SmNodeList* list){ diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 19274324ada7..dd967232723b 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -490,7 +490,6 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt) default: { sal_Unicode code = rKEvt.GetCharCode(); -SmBraceNode* pBraceNode = nullptr; if(code == ' ') { rCursor.InsertElement(BlankElement); @@ -506,13 +505,14 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt) rCursor.InsertElement(FactorialElement); }else if(code == '%') { rCursor.InsertElement(PercentElement); -}else if(code == ')' && rCursor.IsAtTailOfBracket(SmBracketType::Round, )) { -rCursor.MoveAfterBracket(pBraceNode); -}else if(code == ']' && rCursor.IsAtTailOfBracket(SmBracketType::Square, )) { -rCursor.MoveAfterBracket(pBraceNode); -}else if(code == '}' && rCursor.IsAtTailOfBracket(SmBracketType::Curly, )) { -rCursor.MoveAfterBracket(pBraceNode); -
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/strings.hrc |1 + starmath/inc/strings.hxx |1 + starmath/inc/token.hxx|2 +- starmath/inc/types.hxx|1 + starmath/source/ElementsDockingWindow.cxx |1 + starmath/source/parse.cxx |2 ++ 6 files changed, 7 insertions(+), 1 deletion(-) New commits: commit 7473452c22197b7a44a53b61f91c210ef573a1b4 Author: dante AuthorDate: Wed Jul 15 03:03:12 2020 +0200 Commit: Andras Timar CommitDate: Sat Jul 18 18:26:51 2020 +0200 Added fourier transform symbol Change-Id: I6b6f09d7e094b5dafc6aca71f273ab23fce184e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98797 Tested-by: Jenkins Reviewed-by: Dante DM Reviewed-by: Andras Timar diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index a892c191220e..64144759f5cc 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -242,6 +242,7 @@ #define RID_PARTIAL_HELPNC_("RID_PARTIAL_HELP", "Partial" ) #define RID_NABLA_HELP NC_("RID_NABLA_HELP", "Nabla" ) #define RID_LAPLACE_HELPNC_("RID_LAPLACE_HELP", "Laplace transform" ) +#define RID_FOURIER_HELPNC_("RID_FOURIER_HELP", "Fourier transform" ) #define RID_WP_HELP NC_("RID_WP_HELP", "Weierstrass p" ) #define RID_DOTSAXIS_HELP NC_("RID_DOTSAXIS_HELP", "Dots In Middle" ) #define RID_DOTSUP_HELP NC_("RID_DOTSUP_HELP", "Dots To Top" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index d8fe00f803a6..fb00ac2f4782 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -236,6 +236,7 @@ #define RID_NABLA "nabla " #define RID_WP "wp " #define RID_LAPLACE "laplace " +#define RID_FOURIER "fourier " #define RID_DOTSAXIS"dotsaxis " #define RID_DOTSUP "dotsup " #define RID_DOTSDOWN"dotsdown " diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index cdc91ddf4838..1403e96987a2 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -102,7 +102,7 @@ enum SmTokenType TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, TSILVER, TGRAY, TMAROON,TPURPLE,TLIME, TOLIVE, TNAVY, TTEAL, TAQUA, TFUCHSIA, TINTD, -TRGB, TLAPLACE +TRGB, TLAPLACE, TFOURIER }; struct SmToken diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx index 044b2fab05d1..d71c87214a4f 100644 --- a/starmath/inc/types.hxx +++ b/starmath/inc/types.hxx @@ -79,6 +79,7 @@ sal_Unicode const MS_EQUIV = 0x2261; sal_Unicode const MS_PROP = 0x221D; sal_Unicode const MS_PARTIAL = 0x2202; sal_Unicode const MS_LAPLACE = 0x2112; +sal_Unicode const MS_FOURIER = 0x2131; sal_Unicode const MS_SUBSET = 0x2282; sal_Unicode const MS_SUPSET = 0x2283; diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index ca62820488a1..30bd64cb99e7 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -231,6 +231,7 @@ const SmElementDescr SmElementsControl::m_aOthersList[] = {RID_EXISTS, RID_EXISTS_HELP}, {RID_NOTEXISTS, RID_NOTEXISTS_HELP}, {RID_FORALL, RID_FORALL_HELP}, {RID_HBAR, RID_HBAR_HELP}, {RID_LAMBDABAR, RID_LAMBDABAR_HELP}, {RID_RE, RID_RE_HELP}, {RID_IM, RID_IM_HELP}, {RID_WP, RID_WP_HELP}, {RID_LAPLACE, RID_LAPLACE_HELP}, +{RID_FOURIER, RID_FOURIER_HELP}, {nullptr, nullptr}, {RID_LEFTARROW, RID_LEFTARROW_HELP}, {RID_RIGHTARROW, RID_RIGHTARROW_HELP}, {RID_UPARROW, RID_UPARROW_HELP}, {RID_DOWNARROW, RID_DOWNARROW_HELP}, diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index fd9bdfec262e..a51d65fbbc94 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -133,6 +133,7 @@ const SmTokenTableEntry aTokenTable[] = { "fixed", TFIXED, '\0', TG::Font, 0}, { "font", TFONT, '\0', TG::FontAttr, 5}, { "forall", TFORALL, MS_FORALL, TG::Standalone, 5}, +{ "fourier", TFOURIER, MS_FOURIER, TG::Standalone, 5}, { "from", TFROM, '\0', TG::Limit, 0}, { "fuchsia", TFUCHSIA, '\0', TG::Color, 0}, { "func", TFUNC, '\0', TG::Function, 5}, @@ -1483,6 +1484,7 @@ std::unique_ptr SmParser::DoTerm(bool bGroupNumberIdent) case TPARTIAL : case TNABLA : case TLAPLACE : +case TFOURIER : case TTOWARD : case TDOTSAXIS : case TDOTSDIAG : ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/strings.hrc |7 ++- starmath/inc/strings.hxx |5 + starmath/source/ElementsDockingWindow.cxx | 19 --- 3 files changed, 27 insertions(+), 4 deletions(-) New commits: commit 785f742b64a433d59f7bf80e2bd649659ae10f54 Author: dante AuthorDate: Wed Jul 15 03:01:21 2020 +0200 Commit: Noel Grandin CommitDate: Sat Jul 18 12:42:29 2020 +0200 Added to the left pane some interesting hidden features (func, oper) Added: func funcname (generic function) Added: oper opername (generig operator) The change is motivated by tdf#81267. Change-Id: I99cc8ce652b7b5e5e030b65f5617b285c26caecf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98796 Reviewed-by: Dante DM Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index b4a22c58e546..a892c191220e 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -78,6 +78,7 @@ #define RID_XNSUBSETEQY_HELPNC_("RID_XNSUBSETEQY_HELP", "Not Subset Or Equal" ) #define RID_XNSUPSETY_HELP NC_("RID_XNSUPSETY_HELP", "Not Superset" ) #define RID_XNSUPSETEQY_HELPNC_("RID_XNSUPSETEQY_HELP", "Not Superset Or Equal" ) +#define RID_FUNCX_HELP NC_("RID_FUNCX_HELP", "General function" ) #define RID_ABSX_HELP NC_("RID_ABSX_HELP", "Absolute Value" ) #define RID_FACTX_HELP NC_("RID_FACTX_HELP", "Factorial" ) #define RID_SQRTX_HELP NC_("RID_SQRTX_HELP", "Square Root" ) @@ -102,6 +103,10 @@ #define RID_ARCOSHX_HELPNC_("RID_ARCOSHX_HELP", "Area Hyperbolic Cosine" ) #define RID_ARTANHX_HELPNC_("RID_ARTANHX_HELP", "Area Hyperbolic Tangent" ) #define RID_ARCOTHX_HELPNC_("RID_ARCOTHX_HELP", "Area Hyperbolic Cotangent" ) +#define RID_OPERX_HELP NC_("RID_OPERX_HELP", "General operator" ) +#define RID_OPER_FROMX_HELP NC_("RID_OPER_FROMX_HELP", "General operator Subscript Bottom" ) +#define RID_OPER_TOX_HELP NC_("RID_OPER_TOX_HELP", "General operator Superscript Top" ) +#define RID_OPER_FROMTOX_HELP NC_("RID_OPER_FROMTOX_HELP", "General operator Sup/Sub script" ) #define RID_SUMX_HELP NC_("RID_SUMX_HELP", "Sum" ) #define RID_SUM_FROMX_HELP NC_("RID_SUM_FROMX_HELP", "Sum Subscript Bottom" ) #define RID_SUM_TOX_HELPNC_("RID_SUM_TOX_HELP", "Sum Superscript Top" ) @@ -236,7 +241,7 @@ #define RID_INFINITY_HELP NC_("RID_INFINITY_HELP", "Infinity" ) #define RID_PARTIAL_HELPNC_("RID_PARTIAL_HELP", "Partial" ) #define RID_NABLA_HELP NC_("RID_NABLA_HELP", "Nabla" ) -#define RID_LAPLACE_HELPNC_("RID_LAPLACE_HELP", "Laplace" ) +#define RID_LAPLACE_HELPNC_("RID_LAPLACE_HELP", "Laplace transform" ) #define RID_WP_HELP NC_("RID_WP_HELP", "Weierstrass p" ) #define RID_DOTSAXIS_HELP NC_("RID_DOTSAXIS_HELP", "Dots In Middle" ) #define RID_DOTSUP_HELP NC_("RID_DOTSUP_HELP", "Dots To Top" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index bedd9534716d..d8fe00f803a6 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -68,6 +68,7 @@ #define RID_XNSUBSETEQY " nsubseteq " #define RID_XNSUPSETY " nsupset " #define RID_XNSUPSETEQY " nsupseteq " +#define RID_FUNCX "func func() " #define RID_ABSX"abs{} " #define RID_FACTX "fact{} " #define RID_SQRTX "sqrt{} " @@ -92,6 +93,10 @@ #define RID_ARCOSHX "arcosh() " #define RID_ARTANHX "artanh() " #define RID_ARCOTHX "arcoth() " +#define RID_OPERX "oper oper " +#define RID_OPER_FROMX "oper oper from{} " +#define RID_OPER_TOX"oper oper to{} " +#define RID_OPER_FROMTOX"oper oper from{} to{} " #define RID_SUMX"sum " #define RID_SUM_FROMX "sum from{} " #define RID_SUM_TOX "sum to{} " diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index c21933fe1be2..ca62820488a1 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -69,7 +69,7 @@ const SmElementDescr SmElementsControl::m_aUnaryBinaryOperatorsList[] = {RID_XODIVIDEY, RID_XODIVIDEY_HELP}, {RID_XCIRCY, RID_XCIRCY_HELP}, {RID_XWIDESLASHY, RID_XWIDESLASHY_HELP}, {RID_XWIDEBSLASHY, RID_XWIDEBSLASHY_HELP}, {nullptr, nullptr}, -{RID_NEGX, RID_NEGX_HELP}, {RID_XANDY, RID_XANDY_HELP}, {RID_XORY, RID_XORY_HELP}, +{RID_NEGX, RID_NEGX_HELP}, {RID_XANDY, RID_XANDY_HELP}, {RID_XORY, RID_XORY_HELP} };
[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/uiconfig
starmath/inc/strings.hrc |3 + starmath/inc/strings.hxx |2 starmath/inc/token.hxx |4 + starmath/inc/types.hxx |2 starmath/source/ElementsDockingWindow.cxx |6 +- starmath/source/mathtype.cxx |3 + starmath/source/node.cxx | 29 ++ starmath/source/parse.cxx | 79 - starmath/uiconfig/smath/popupmenu/edit.xml |2 9 files changed, 103 insertions(+), 27 deletions(-) New commits: commit e7fee907fa8240c742bd8f6268768d1acad2774f Author: dante AuthorDate: Mon Jun 22 17:22:49 2020 +0200 Commit: Noel Grandin CommitDate: Wed Jun 24 12:01:02 2020 +0200 tdf#40436 tdf#47914 RGB personalized color for math and laplace symbol 2 Change-Id: Id0791609ada5b9f5460e46b20cfc7ce600cd3043 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96890 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index f12677d26eca..b4a22c58e546 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -189,6 +189,7 @@ #define RID_COLORX_SILVER_HELP NC_("RID_COLORX_SILVER_HELP", "Color Silver" ) #define RID_COLORX_TEAL_HELPNC_("RID_COLORX_TEAL_HELP", "Color Teal" ) #define RID_COLORX_YELLOW_HELP NC_("RID_COLORX_YELLOW_HELP", "Color Yellow" ) +#define RID_COLORX_RGB_HELP NC_("RID_COLORX_RGB_HELP", "Color RGB" ) #define RID_LRGROUPX_HELP NC_("RID_LRGROUPX_HELP", "Group Brackets" ) #define RID_LRPARENTX_HELP NC_("RID_LRPARENTX_HELP", "Round Brackets" ) #define RID_LRBRACKETX_HELP NC_("RID_LRBRACKETX_HELP", "Square Brackets" ) @@ -235,6 +236,7 @@ #define RID_INFINITY_HELP NC_("RID_INFINITY_HELP", "Infinity" ) #define RID_PARTIAL_HELPNC_("RID_PARTIAL_HELP", "Partial" ) #define RID_NABLA_HELP NC_("RID_NABLA_HELP", "Nabla" ) +#define RID_LAPLACE_HELPNC_("RID_LAPLACE_HELP", "Laplace" ) #define RID_WP_HELP NC_("RID_WP_HELP", "Weierstrass p" ) #define RID_DOTSAXIS_HELP NC_("RID_DOTSAXIS_HELP", "Dots In Middle" ) #define RID_DOTSUP_HELP NC_("RID_DOTSUP_HELP", "Dots To Top" ) @@ -308,6 +310,7 @@ #define STR_SILVER NC_("STR_SILVER", "silver" ) #define STR_TEALNC_("STR_TEAL", "teal" ) #define STR_YELLOW NC_("STR_YELLOW", "yellow" ) +#define STR_RGB NC_("STR_RGB", "rgb" ) #define STR_HIDENC_("STR_HIDE", "hide" ) #define STR_SIZENC_("STR_SIZE", "size" ) #define STR_FONTNC_("STR_FONT", "font" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index ba7826a3dd75..bedd9534716d 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -182,6 +182,7 @@ #define RID_COLORX_SILVER "color silver {} " #define RID_COLORX_TEAL "color teal {} " #define RID_COLORX_YELLOW "color yellow {} " +#define RID_COLORX_RGB "color rgb 0 0 0 {} " #define RID_LRGROUPX"{} " #define RID_LRPARENTX "() " #define RID_LRBRACKETX "[] " @@ -229,6 +230,7 @@ #define RID_PARTIAL "partial " #define RID_NABLA "nabla " #define RID_WP "wp " +#define RID_LAPLACE "laplace " #define RID_DOTSAXIS"dotsaxis " #define RID_DOTSUP "dotsup " #define RID_DOTSDOWN"dotsdown " diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 1bbe446fcca2..cdc91ddf4838 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -44,6 +44,7 @@ enum class TG { Limit = 0x01, FontAttr = 0x02 }; + namespace o3tl { template<> struct typed_flags : is_typed_flags {}; } @@ -100,7 +101,8 @@ enum SmTokenType TUNKNOWN, TPRECEDES, TSUCCEEDS, TPRECEDESEQUAL, TSUCCEEDSEQUAL, TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, TSILVER, TGRAY, TMAROON,TPURPLE,TLIME, TOLIVE, -TNAVY, TTEAL, TAQUA, TFUCHSIA, TINTD +TNAVY, TTEAL, TAQUA, TFUCHSIA, TINTD, +TRGB, TLAPLACE }; struct SmToken diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx index 5680e907c6e7..044b2fab05d1 100644 --- a/starmath/inc/types.hxx +++ b/starmath/inc/types.hxx @@ -78,6 +78,7 @@ sal_Unicode const MS_DEF = 0x225D; sal_Unicode const MS_EQUIV = 0x2261; sal_Unicode const MS_PROP = 0x221D; sal_Unicode const MS_PARTIAL = 0x2202; +sal_Unicode const MS_LAPLACE = 0x2112; sal_Unicode const MS_SUBSET = 0x2282; sal_Unicode const MS_SUPSET =
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/types.hxx |1 + starmath/source/ooxmlimport.cxx |3 +++ 2 files changed, 4 insertions(+) New commits: commit be23b4a91504b81a19510f8562e92203b4317edf Author: Julien Nabet AuthorDate: Wed Apr 22 15:44:07 2020 +0200 Commit: Julien Nabet CommitDate: Fri Apr 24 10:01:03 2020 +0200 tdf#132305: Teach Starmath MS_COMBOVERLINE = 0x0305 Change-Id: I04b282d3f0dae68d459002f5a3822ac06fdb7986 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92698 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx index b5cca6087346..5680e907c6e7 100644 --- a/starmath/inc/types.hxx +++ b/starmath/inc/types.hxx @@ -135,6 +135,7 @@ sal_Unicode const MS_TILDE = 0x007E; sal_Unicode const MS_COMBTILDE = 0x0303; sal_Unicode const MS_BAR = 0x00AF; sal_Unicode const MS_COMBBAR = 0x0304; +sal_Unicode const MS_COMBOVERLINE = 0x0305; sal_Unicode const MS_BREVE = 0x02D8; sal_Unicode const MS_COMBBREVE = 0x0306; sal_Unicode const MS_CIRCLE = 0x02DA; diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 731daa054120..034919787f4b 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -180,6 +180,9 @@ OUString SmOoxmlImport::handleAcc() case MS_COMBACUTE: acc = "acute"; break; +case MS_COMBOVERLINE: +acc = "overline"; +break; case MS_GRAVE: case MS_COMBGRAVE: acc = "grave"; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source stoc/source svl/source
starmath/inc/utility.hxx |3 +-- starmath/source/ElementsDockingWindow.cxx | 20 starmath/source/mathmlexport.cxx |5 - starmath/source/mathtype.cxx |7 ++- starmath/source/node.cxx | 30 +- starmath/source/parse.cxx |8 ++-- starmath/source/view.cxx |6 -- stoc/source/corereflection/crefl.cxx |6 -- stoc/source/typeconv/convert.cxx |3 ++- svl/source/items/itemset.cxx | 16 svl/source/numbers/zforfind.cxx | 19 ++- svl/source/numbers/zformat.cxx| 16 12 files changed, 98 insertions(+), 41 deletions(-) New commits: commit cd7471335a05e7dd7eca16ac0b181d96cfa7912b Author: Noel Grandin AuthorDate: Wed Apr 15 19:33:03 2020 +0200 Commit: Noel Grandin CommitDate: Thu Apr 16 08:15:54 2020 +0200 loplugin:buriedassign in starmath..svl Change-Id: I979faf4c476a7de91a0b6e06dd8717cee25525f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92313 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index 0ce2ff346079..2a462b98d727 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -46,8 +46,7 @@ inline Fraction Sm100th_mmToPts(long nNum100th_mm) // 'nNum100th_mm' (in 100th of mm). { SAL_WARN_IF( nNum100th_mm < 0, "starmath", "Ooops..." ); -Fraction aTmp (7227L, 254000L); -return aTmp *= Fraction(nNum100th_mm); +return Fraction(7227L, 254000L) * Fraction(nNum100th_mm); } diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 8eca86c24077..ebaa6b9e4fdd 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -1016,7 +1016,10 @@ FactoryFunction SmElementsControl::GetUITestFactory() const bool SmElementsControl::itemIsSeparator(sal_uInt16 nPos) const { -if (nPos < m_nCurrentOffset || (nPos -= m_nCurrentOffset) >= maElementList.size()) +if (nPos < m_nCurrentOffset) +return true; +nPos -= m_nCurrentOffset; +if (nPos >= maElementList.size()) return true; return maElementList[nPos]->isSeparator(); } @@ -1033,7 +1036,10 @@ css::uno::Reference SmElementsControl::CreateAc bool SmElementsControl::itemTrigger(sal_uInt16 nPos) { -if (nPos < m_nCurrentOffset || (nPos -= m_nCurrentOffset) >= maElementList.size()) +if (nPos < m_nCurrentOffset) +return false; +nPos -= m_nCurrentOffset; +if (nPos >= maElementList.size()) return false; maSelectHdlLink.Call(*maElementList[nPos]); @@ -1043,7 +1049,10 @@ bool SmElementsControl::itemTrigger(sal_uInt16 nPos) tools::Rectangle SmElementsControl::itemPosRect(sal_uInt16 nPos) const { -if (nPos < m_nCurrentOffset || (nPos -= m_nCurrentOffset) >= maElementList.size()) +if (nPos < m_nCurrentOffset) +return tools::Rectangle(); +nPos -= m_nCurrentOffset; +if (nPos >= maElementList.size()) return tools::Rectangle(); SmElement* pItem = maElementList[nPos].get(); @@ -1080,7 +1089,10 @@ void SmElementsControl::setItemHighlighted(sal_uInt16 nPos) OUString SmElementsControl::itemName(sal_uInt16 nPos) const { -if (nPos < m_nCurrentOffset || (nPos -= m_nCurrentOffset) >= maElementList.size()) +if (nPos < m_nCurrentOffset) +return OUString(); +nPos -= m_nCurrentOffset; +if (nPos >= maElementList.size()) return OUString(); return maElementList[nPos]->getHelpText(); diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 7fc7243d7e19..c619f22f4dc1 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1139,8 +1139,11 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) int nItalic = -1; // for the following variables: -1 = yet undefined; 0 = false; 1 = true; int nSansSerifFixed = -1; SmTokenType eNodeType = TUNKNOWN; -while (lcl_HasEffectOnMathvariant( (eNodeType = pNode->GetToken().eType) )) +for (;;) { +eNodeType = pNode->GetToken().eType; +if (!lcl_HasEffectOnMathvariant(eNodeType)) +break; switch (eNodeType) { case TBOLD : nBold = 1; break; diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 06655e112597..d0889ce393d8 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -684,8 +684,13 @@ bool MathType::HandleRecords(int nLevel, sal_uInt8 nSelector, { sal_Unicode cChar = 0; sal_Int32 nI = rRet.getLength()-1; -while (nI && ((cChar = rRet[nI]) == ' ')) +while (nI) +{ +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx |4 ++-- starmath/inc/action.hxx|4 ++-- starmath/inc/node.hxx |4 ++-- starmath/inc/parse.hxx |2 +- starmath/inc/token.hxx |8 starmath/inc/view.hxx |2 +- starmath/inc/visitors.hxx |4 ++-- starmath/source/accessibility.hxx |4 ++-- starmath/source/dialog.cxx |6 +++--- starmath/source/document.cxx |6 +++--- starmath/source/mathmlimport.cxx |2 +- starmath/source/mathtype.hxx |2 +- starmath/source/ooxmlexport.hxx|2 +- starmath/source/uiobject.hxx |2 +- 14 files changed, 26 insertions(+), 26 deletions(-) New commits: commit b70abeb9c3eea7ab24f3544ee95528278b53490d Author: Noel Grandin AuthorDate: Thu Mar 12 16:57:26 2020 +0200 Commit: Noel Grandin CommitDate: Fri Mar 13 08:42:26 2020 +0100 Revert "loplugin:constfields in starmath" This reverts commit e494cc2942899fd92a2273eaed2bf41eb74ea8a9. Change-Id: Ie73ecb4b7299e70dea729c374763f9e2df2aa6f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90421 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 5a5a46836658..e10273b88aca 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -37,8 +37,8 @@ class SmParser; class SmElement { std::unique_ptr mpNode; -OUString const maText; -OUString const maHelpText; +OUStringmaText; +OUStringmaHelpText; public: Point mBoxLocation; diff --git a/starmath/inc/action.hxx b/starmath/inc/action.hxx index da8d94402b56..cb4a4eddf740 100644 --- a/starmath/inc/action.hxx +++ b/starmath/inc/action.hxx @@ -28,8 +28,8 @@ class SmDocShell; class SmFormatAction final : public SfxUndoAction { SmDocShell *pDoc; -SmFormat constaOldFormat; -SmFormat constaNewFormat; +SmFormataOldFormat; +SmFormataNewFormat; public: SmFormatAction(SmDocShell *pDocSh, const SmFormat& rOldFormat, const SmFormat& rNewFormat); diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 7694007144d9..493f732529d2 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -97,7 +97,7 @@ class SmNode : public SmRect SmFace maFace; SmToken maNodeToken; -SmNodeType const meType; +SmNodeType meType; SmScaleMode meScaleMode; RectHorAlignmeRectHorAlign; FontChangeMask mnFlags; @@ -434,7 +434,7 @@ public: */ class SmSpecialNode : public SmTextNode { -bool const mbIsFromGreekSymbolSet; +bool mbIsFromGreekSymbolSet; protected: SmSpecialNode(SmNodeType eNodeType, const SmToken , sal_uInt16 _nFontDesc); diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 2d6036bb8df1..519a90041f65 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -75,7 +75,7 @@ class SmParser std::set< OUString > m_aUsedSymbols; // CharClass representing a locale for parsing numbers -CharClass const m_aNumCC; +CharClass m_aNumCC; // pointer to System locale's CharClass, which is alive inside SM_MOD() const CharClass* m_pSysCC; diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 786b4ff31d75..1bbe446fcca2 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -129,10 +129,10 @@ struct SmToken struct SmTokenTableEntry { const char* pIdent; -SmTokenType const eType; -sal_Unicode const cMathChar; -TG const nGroup; -sal_uInt16 const nLevel; +SmTokenType eType; +sal_Unicode cMathChar; +TG nGroup; +sal_uInt16 nLevel; }; #endif diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 687fd1850bf0..b3625b7dc76b 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -213,7 +213,7 @@ class SmViewShell: public SfxViewShell std::unique_ptr mpImpl; VclPtr mpGraphic; -SmGraphicController const maGraphicController; +SmGraphicController maGraphicController; OUString maStatusText; bool mbPasteState; diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index 7962180482ca..3f903aba8820 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -116,8 +116,8 @@ private: OutputDevice SmCaretPos maPos; /** Offset to draw from */ -Point const maOffset; -bool const mbCaretVisible; +Point maOffset; +bool mbCaretVisible; /** Default method for drawing pNodes */ void DefaultVisit( SmNode* pNode ) override; diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx index 60e247973b67..5fce05b193da 100644 ---
[Libreoffice-commits] core.git: starmath/inc starmath/source starmath/uiconfig
starmath/inc/AccessibleSmElement.hxx|2 starmath/inc/AccessibleSmElementsControl.hxx|6 starmath/inc/ElementsDockingWindow.hxx | 42 +- starmath/source/AccessibleSmElement.cxx | 10 starmath/source/AccessibleSmElementsControl.cxx | 117 +--- starmath/source/ElementsDockingWindow.cxx | 350 ++-- starmath/source/uiobject.cxx| 35 +- starmath/source/uiobject.hxx|8 starmath/uiconfig/smath/ui/dockingelements.ui | 53 ++- 9 files changed, 253 insertions(+), 370 deletions(-) New commits: commit 644ebf7823c85973e2724cbfcf403cb63b054bfe Author: Caolán McNamara AuthorDate: Tue Jan 28 20:40:15 2020 + Commit: Caolán McNamara CommitDate: Wed Jan 29 12:56:49 2020 +0100 weld SmElementsDockingWindow Change-Id: Ieeaa1f1e0deb708ec6d3daf261384c61d2ade22b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87659 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/starmath/inc/AccessibleSmElement.hxx b/starmath/inc/AccessibleSmElement.hxx index 9f63d1607ef7..202de6690899 100644 --- a/starmath/inc/AccessibleSmElement.hxx +++ b/starmath/inc/AccessibleSmElement.hxx @@ -40,7 +40,7 @@ typedef ::cppu::ImplHelper3 m_pSmElementsControl; +SmElementsControl* m_pSmElementsControl; const sal_Int32 m_nIndexInParent; ///< index in the parent XAccessible const sal_uInt16 m_nItemId; ///< index in the SmElementsControl bool m_bHasFocus; diff --git a/starmath/inc/AccessibleSmElementsControl.hxx b/starmath/inc/AccessibleSmElementsControl.hxx index ac0b68afa892..66cbd80bcef4 100644 --- a/starmath/inc/AccessibleSmElementsControl.hxx +++ b/starmath/inc/AccessibleSmElementsControl.hxx @@ -38,7 +38,7 @@ class AccessibleSmElementsControl final : public comphelper::OAccessibleComponen public AccessibleSmElementsControl_BASE { std::vector> m_aAccessibleChildren; -VclPtr m_pControl; +SmElementsControl* m_pControl; void UpdateFocus(sal_uInt16); inline void TestControl(); @@ -71,10 +71,6 @@ public: sal_Bool SAL_CALL containsPoint(const css::awt::Point& aPoint) override; css::uno::Reference SAL_CALL getAccessibleAtPoint(const css::awt::Point& aPoint) override; -css::awt::Rectangle SAL_CALL getBounds() override; -css::awt::Point SAL_CALL getLocation() override; -css::awt::Point SAL_CALL getLocationOnScreen() override; -css::awt::Size SAL_CALL getSize() override; void SAL_CALL grabFocus() override; sal_Int32 SAL_CALL getForeground() override; sal_Int32 SAL_CALL getBackground() override; diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index c5645b70894a..5a5a46836658 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -21,7 +21,8 @@ #define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX #include -#include +#include +#include #include "format.hxx" #include @@ -63,7 +64,7 @@ public: typedef std::pair SmElementDescr; -class SmElementsControl : public Control +class SmElementsControl : public weld::CustomWidgetController { friend class ElementSelectorUIObject; friend class ElementUIObject; @@ -81,16 +82,14 @@ class SmElementsControl : public Control static const std::tuple m_aCategories[]; static const size_t m_aCategoriesSize; -virtual void ApplySettings(vcl::RenderContext&) override; -virtual void DataChanged(const DataChangedEvent&) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; -virtual void MouseButtonDown(const MouseEvent& rMEvt) override; -virtual void MouseMove(const MouseEvent& rMEvt) override; -virtual void RequestHelp(const HelpEvent& rHEvt) override; +virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; +virtual bool MouseMove(const MouseEvent& rMEvt) override; +virtual OUString RequestHelp(tools::Rectangle& rRect) override; virtual void Resize() override; virtual void GetFocus() override; virtual void LoseFocus() override; -virtual void KeyInput(const KeyEvent& rKEvt) override; +virtual bool KeyInput(const KeyEvent& rKEvt) override; css::uno::Reference CreateAccessible() override; SmDocShell* mpDocShell; @@ -104,7 +103,7 @@ class SmElementsControl : public Control std::vector< std::unique_ptr > maElementList; Size maMaxElementDimensions; bool mbVerticalMode; -VclPtr< ScrollBar > mxScroll; +std::unique_ptr mxScroll; bool m_bFirstPaintAfterLayout; rtl::Reference m_xAccessible; @@ -122,14 +121,12 @@ class SmElementsControl : public Control void build(); -//if pContext is not NULL, then draw, otherwise -//just layout -void LayoutOrPaintContents(vcl::RenderContext *pContext =
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/node.hxx |8 starmath/source/accessibility.cxx |2 +- starmath/source/mathmlimport.cxx |2 +- 3 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 0b42faf3d09cb4e63feebcd056c7c014c657d404 Author: Andrea Gelmini AuthorDate: Wed Jul 31 18:46:37 2019 +0200 Commit: Julien Nabet CommitDate: Fri Aug 16 19:22:15 2019 +0200 Fix typos Change-Id: Id8c879b81cde8da6119ac08d9d9028221486dc6a Reviewed-on: https://gerrit.libreoffice.org/76764 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 73bfb17132c9..845da0a95fc0 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -117,7 +117,7 @@ public: virtual ~SmNode(); /** - * Returns true if this is a instance of SmVisibleNode's subclass, false otherwise. + * Returns true if this is an instance of SmVisibleNode's subclass, false otherwise. */ virtual boolIsVisible() const = 0; @@ -453,7 +453,7 @@ public: * * This node is used with commands: oper, uoper and boper. * E.g. in "A boper op B", "op" will be an instance of SmGlyphSpecialNode. - * "boper" simply interprets "op", the following token, as an binary operator. + * "boper" simply interprets "op", the following token, as a binary operator. * The command "uoper" interprets the following token as unary operator. * For these commands an instance of SmGlyphSpecialNode is used for the * operator token, following the command. @@ -560,7 +560,7 @@ public: /** Error node, for parsing errors * - * This node is used for parsing errors and draws an questionmark turned upside + * This node is used for parsing errors and draws a questionmark turned upside * down (inverted question mark). */ class SmErrorNode : public SmMathSymbolNode @@ -582,7 +582,7 @@ public: * * This is the root node for the formula tree. This node is also used for the * STACK and BINOM commands. When used for root node, its - * children are instances of SmLineNode, and in some obscure cases the a child + * children are instances of SmLineNode, and in some obscure cases the child * can be an instance of SmExpressionNode, mainly when errors occur. */ class SmTableNode : public SmStructureNode diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 2121f5da59e6..8fb20618c701 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -1034,7 +1034,7 @@ static SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, c rEditEngine.GetCharAttribs( nPara, aAttribs ); bool bEmpty = true; // we found no item inside the selection of this paragraph -bool bGaps = false;// we found items but theire gaps between them +bool bGaps = false;// we found items but there are gaps between them sal_Int32 nLastEnd = nPos; const SfxPoolItem* pParaItem = nullptr; diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index f49d88ca794b..48de32c3e0bd 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -890,7 +890,7 @@ public: }; -/*avert thy gaze from the proginator*/ +/*avert the gaze from the originator*/ class SmXMLRowContext_Impl : public SmXMLDocContext_Impl { protected: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cursor.hxx |4 ++-- starmath/inc/visitors.hxx|2 +- starmath/source/cursor.cxx |2 +- starmath/source/document.cxx |2 +- starmath/source/mathtype.cxx |2 +- starmath/source/parse.cxx|2 +- starmath/source/rect.cxx |2 +- starmath/source/visitors.cxx |6 +++--- 8 files changed, 11 insertions(+), 11 deletions(-) New commits: commit 3db23609d368687dd2b3122160d450e4bc5bbb78 Author: Andrea Gelmini AuthorDate: Fri Aug 16 16:34:34 2019 +0200 Commit: Julien Nabet CommitDate: Fri Aug 16 19:16:10 2019 +0200 Fix typos Split from https://gerrit.libreoffice.org/#/c/76764/ Change-Id: I19f11f80f08ce0d5b4ffda20449f1cddea980b7d Reviewed-on: https://gerrit.libreoffice.org/77596 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index b04b39748829..2ba17fb0a46c 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -62,7 +62,7 @@ class SmDocShell; /** Formula cursor * * This class is used to represent a cursor in a formula, which can be used to manipulate - * an formula programmatically. + * a formula programmatically. * @remarks This class is a very intimate friend of SmDocShell. */ class SmCursor{ @@ -140,7 +140,7 @@ public: /** Insert a new row or newline * - * Inserts a new row if position is in an matrix or stack command. + * Inserts a new row if position is in a matrix or stack command. * Otherwise a newline is inserted if we're in a toplevel line. * * @returns True, if a new row/line could be inserted. diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index 290f1bdeacb8..39f5c6323064 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -272,7 +272,7 @@ private: * denoted by | in "H|". * * Parameter variables: - * The following variables are used to transfer parameters in to calls and results out + * The following variables are used to transfer parameters into calls and results out * of calls. * pRightMost : SmCaretPosGraphEntry* * diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 2d74d454a2f6..f7d127bd25e9 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1299,7 +1299,7 @@ void SmCursor::EndEdit(){ //I think this notifies people around us that we've modified this document... mpDocShell->SetModified(); //I think SmDocShell uses this value when it sends an update graphics event -//Anyway comments elsewhere suggests it need to be updated... +//Anyway comments elsewhere suggests it needs to be updated... mpDocShell->mnModifyCount++; //TODO: Consider copying the update accessibility code from SmDocShell::SetText in here... diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index b8222e2c0a02..c3373f5968c9 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -394,7 +394,7 @@ void SmDocShell::DrawFormula(OutputDevice , Point , bool bDrawSel rPosition.AdjustY(maFormat.GetDistance( DIS_TOPSPACE ) ); //! in case of high contrast-mode (accessibility option!) -//! the draw mode needs to be set to default, because when imbedding +//! the draw mode needs to be set to default, because when embedding //! Math for example in Calc in "a over b" the fraction bar may not //! be visible else. More generally: the FillColor may have been changed. DrawModeFlags nOldDrawMode = DrawModeFlags::Default; diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 65a7bb834009..da48da787fa5 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -1817,7 +1817,7 @@ bool MathType::HandleSize(sal_Int16 nLstSize,sal_Int16 nDefSize, int ) } else { -/*sizetable should theoreticaly be filled with the default sizes +/*sizetable should theoretically be filled with the default sizes *of the various font groupings matching starmaths equivalents in aTypeFaces, and a test would be done to see if the new font size would be the same as what starmath would have chosen for diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 102851120a22..663aa1c22361 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1954,7 +1954,7 @@ std::unique_ptr SmParser::DoFontSize() { aValue = fTmp; -//!! keep the numerator and denominator from being to large +//!! keep the numerator and denominator from being too large //!! otherwise ongoing multiplications may result in overflows //!! (for example in SmNode::SetFontSize the font size calculated //!! may become 0 because of this!!! Happens e.g. for ftmp = 2.9 with Linux diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|3 - starmath/source/ElementsDockingWindow.cxx | 88 +++--- 2 files changed, 48 insertions(+), 43 deletions(-) New commits: commit 65167c708afb475aa628b8289e78a48abdf37119 Author: Jan-Marek Glogowski AuthorDate: Wed May 29 14:16:33 2019 + Commit: Jan-Marek Glogowski CommitDate: Wed May 29 20:15:14 2019 +0200 SM disable localized characters on element parsing The special character tokens are localized character names! This means that at least in German the %mu wasn't replaced in the example, as the parser expected %my. So tell the parser to expect non-localized input. And share it for all the parsing. Change-Id: I4c3c0f35eb61c37a2101b51b445e7cc888a1f429 Reviewed-on: https://gerrit.libreoffice.org/73172 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index aaa992b97f77..fe86ebd422f6 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -31,6 +31,7 @@ class SmDocShell; class SmNode; +class SmParser; class SmElement { @@ -107,7 +108,7 @@ class SmElementsControl : public Control bool m_bFirstPaintAfterLayout; rtl::Reference m_xAccessible; -void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); +void addElement(SmParser , const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); void addElements(const SmElementDescr aElementsArray[], sal_uInt16 size); SmElement* current() const; void setCurrentElement(sal_uInt16); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 45bfb7541099..7491e71823b1 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -863,10 +863,11 @@ void SmElementsControl::DoScroll(long nDelta) Invalidate(); } -void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) +void SmElementsControl::addElement(SmParser , const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText) { -assert(maElementList.size() <= SAL_MAX_UINT16); -auto pNode = SmParser().ParseExpression(aElementVisual); +// SAL_MAX_UINT16 is invalid, zero is the scrollbar +assert(maElementList.size() < SAL_MAX_UINT16 - 2); +auto pNode = rParser.ParseExpression(aElementVisual); pNode->Prepare(maFormat, *mpDocShell, 0); pNode->SetSize(Fraction(10,8)); @@ -895,6 +896,9 @@ void SmElementsControl::setElementSetId(const char* pSetId) void SmElementsControl::addElements(const SmElementDescr aElementsArray[], sal_uInt16 aElementsArraySize) { +SmParser aParser; +aParser.SetImportSymbolNames(true); + for (sal_uInt16 i = 0; i < aElementsArraySize ; i++) { const char* pElement = aElementsArray[i].first; @@ -904,86 +908,86 @@ void SmElementsControl::addElements(const SmElementDescr aElementsArray[], sal_u } else { OUString aElement(OUString::createFromAscii(pElement)); if (aElement == RID_NEWLINE) -addElement(OUString(u"\u21B5"), aElement, SmResId(pElementHelp)); +addElement(aParser, OUString(u"\u21B5"), aElement, SmResId(pElementHelp)); else if (aElement == RID_SBLANK) -addElement("\"`\"", aElement, SmResId(pElementHelp)); +addElement(aParser, "\"`\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_BLANK) -addElement("\"~\"", aElement, SmResId(pElementHelp)); +addElement(aParser, "\"~\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_PHANTOMX) -addElement("\"" + SmResId(STR_HIDE) +"\"", aElement, SmResId(pElementHelp)); +addElement(aParser, "\"" + SmResId(STR_HIDE) +"\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_BOLDX) -addElement("bold B", aElement, SmResId(pElementHelp)); +addElement(aParser, "bold B", aElement, SmResId(pElementHelp)); else if (aElement == RID_ITALX) -addElement("ital I", aElement, SmResId(pElementHelp)); +addElement(aParser, "ital I", aElement, SmResId(pElementHelp)); else if (aElement == RID_SIZEXY) -addElement("\"" + SmResId(STR_SIZE) + "\"", aElement, SmResId(pElementHelp)); +addElement(aParser, "\"" + SmResId(STR_SIZE) + "\"", aElement, SmResId(pElementHelp)); else if (aElement == RID_FONTXY) -addElement("\"" + SmResId(STR_FONT) + "\"", aElement, SmResId(pElementHelp)); +addElement(aParser, "\"" + SmResId(STR_FONT) +
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/strings.hrc |6 ++ starmath/source/ElementsDockingWindow.cxx | 10 +- 2 files changed, 11 insertions(+), 5 deletions(-) New commits: commit 3eba9602197da972b66f2b7cc72b61cbdffe5a52 Author: Jan-Marek Glogowski AuthorDate: Wed May 29 13:12:59 2019 + Commit: Jan-Marek Glogowski CommitDate: Wed May 29 20:13:26 2019 +0200 SM add some help to the examples This way the example buttons will have a name for better accessibility, instead of being blank. Change-Id: Ib8a509bc7a9895297eecd8a0db9455f367d93159 Reviewed-on: https://gerrit.libreoffice.org/73171 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index fc6f9bae05f0..eec600990ba0 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -282,6 +282,12 @@ #define RID_CATEGORY_OTHERS NC_("RID_CATEGORY_OTHERS", "Others" ) #define RID_CATEGORY_EXAMPLES NC_("RID_CATEGORY_EXAMPLES", "Examples" ) +#define RID_EXAMPLE_CIRCUMFERENCE_HELP NC_("RID_EXAMPLE_CIRCUMFERENCE_HELP", "Circumference" ) +#define RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP NC_("RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP", "Mass–energy equivalence" ) +#define RID_EXAMPLE_PYTHAGOREAN_THEO_HELP NC_("RID_EXAMPLE_PYTHAGOREAN_THEO_HELP", "Pythagorean theorem" ) +#define RID_EXAMPLE_A_SIMPLE_SERIES_HELP NC_("RID_EXAMPLE_A_SIMPLE_SERIES_HELP", "A simple series" ) +#define RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP NC_("RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP", "Gauss distribution" ) + #define RID_FONTREGULAR NC_("RID_FONTREGULAR", "Standard" ) #define RID_FONTITALIC NC_("RID_FONTITALIC", "Italic" ) #define RID_FONTBOLDNC_("RID_FONTBOLD", "Bold" ) diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index ef6876be7caa..d34062ddb158 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -234,11 +234,11 @@ const SmElementDescr SmElementsControl::m_aOthersList[] = const SmElementDescr SmElementsControl::m_aExamplesList[] = { -{"C=%pi cdot d = 2 cdot %pi cdot r", nullptr}, -{"E=mc^2", nullptr}, -{"a^2 + b^2 = c^2", nullptr}, -{"f ( x ) = sum from { { i = 0 } } to { infinity } { {f^{(i)}(0)} over {i!} x^i}", nullptr}, -{"f ( x ) = {1} over {%sigma sqrt{2%pi} }func e^-{{(x-%mu)^2} over {2%sigma^2}}", nullptr}, +{"C=%pi cdot d = 2 cdot %pi cdot r", RID_EXAMPLE_CIRCUMFERENCE_HELP}, +{"E=mc^2", RID_EXAMPLE_MASS_ENERGY_EQUIV_HELP}, +{"a^2 + b^2 = c^2", RID_EXAMPLE_PYTHAGOREAN_THEO_HELP}, +{"f ( x ) = sum from { { i = 0 } } to { infinity } { {f^{(i)}(0)} over {i!} x^i}", RID_EXAMPLE_A_SIMPLE_SERIES_HELP}, +{"f ( x ) = {1} over {%sigma sqrt{2%pi} }func e^-{{(x-%mu)^2} over {2%sigma^2}}", RID_EXAMPLE_GAUSS_DISTRIBUTION_HELP}, }; #define AS_PAIR(a) a, SAL_N_ELEMENTS(a) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx| 30 starmath/source/ElementsDockingWindow.cxx | 109 +- 2 files changed, 68 insertions(+), 71 deletions(-) New commits: commit c3435fc4c6eafec3155c9c85c5d1081dac97c688 Author: Jan-Marek Glogowski AuthorDate: Mon May 27 22:21:07 2019 + Commit: Jan-Marek Glogowski CommitDate: Tue May 28 16:02:03 2019 +0200 SM move categories into SmElementsControl... ... and drop the special examples handling. All these lists are already static. The only "drawback" are the previously range-based for loops in SmElementsDockingWindow. Change-Id: I7a6cfbe74c29fcc14557aef1d5ef31d599b33fc0 Reviewed-on: https://gerrit.libreoffice.org/73076 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index c68d442bef3d..0fdb3fc72369 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -25,6 +25,7 @@ #include "format.hxx" #include +#include class SmDocShell; class SmNode; @@ -57,20 +58,25 @@ public: bool isSeparator() const override { return true; } }; +typedef std::pair SmElementDescr; + class SmElementsControl : public Control { friend class ElementSelectorUIObject; friend class ElementUIObject; -static const std::pair aUnaryBinaryOperatorsList[]; -static const std::pair aRelationsList[]; -static const std::pair aSetOperations[]; -static const std::pair aFunctions[]; -static const std::pair aOperators[]; -static const std::pair aAttributes[]; -static const std::pair aBrackets[]; -static const std::pair aFormats[]; -static const std::pair aOthers[]; +static const SmElementDescr m_aUnaryBinaryOperatorsList[]; +static const SmElementDescr m_aRelationsList[]; +static const SmElementDescr m_aSetOperationsList[]; +static const SmElementDescr m_aFunctionsList[]; +static const SmElementDescr m_aOperatorsList[]; +static const SmElementDescr m_aAttributesList[]; +static const SmElementDescr m_aBracketsList[]; +static const SmElementDescr m_aFormatsList[]; +static const SmElementDescr m_aOthersList[]; +static const SmElementDescr m_aExamplesList[]; +static const std::tuple m_aCategories[]; +static const size_t m_aCategoriesSize; virtual void ApplySettings(vcl::RenderContext&) override; virtual void DataChanged(const DataChangedEvent&) override; @@ -97,7 +103,7 @@ class SmElementsControl : public Control bool m_bFirstPaintAfterLayout; void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); -void addElements(const std::pair aElementsArray[], sal_uInt16 size); +void addElements(const SmElementDescr aElementsArray[], sal_uInt16 size); SmElement* current() const; bool hasRollover() const { return m_nCurrentRolloverElement != SAL_MAX_UINT16; } @@ -118,6 +124,8 @@ public: virtual ~SmElementsControl() override; virtual void dispose() override; +static const auto& categories() { return m_aCategories; } +static size_t categoriesSize() { return m_aCategoriesSize; } void setElementSetId(const char* pSetId); void setVerticalMode(bool bVertical); @@ -134,8 +142,6 @@ public: class SmElementsDockingWindow : public SfxDockingWindow { -static const char* aCategories[]; - VclPtr mpElementsControl; VclPtrmpElementListBox; diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 43948cd18106..ef6876be7caa 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -55,7 +55,7 @@ SmElementSeparator::SmElementSeparator() : SmElement(std::unique_ptr(), OUString(), OUString()) {} -const std::pair SmElementsControl::aUnaryBinaryOperatorsList[] = +const SmElementDescr SmElementsControl::m_aUnaryBinaryOperatorsList[] = { {RID_PLUSX, RID_PLUSX_HELP}, {RID_MINUSX, RID_MINUSX_HELP}, {RID_PLUSMINUSX, RID_PLUSMINUSX_HELP}, {RID_MINUSPLUSX, RID_MINUSPLUSX_HELP}, @@ -72,7 +72,7 @@ const std::pair SmElementsControl::aUnaryBinaryOperato {RID_NEGX, RID_NEGX_HELP}, {RID_XANDY, RID_XANDY_HELP}, {RID_XORY, RID_XORY_HELP}, }; -const std::pair SmElementsControl::aRelationsList[] = +const SmElementDescr SmElementsControl::m_aRelationsList[] = { {RID_XEQY, RID_XEQY_HELP}, {RID_XNEQY, RID_XNEQY_HELP}, {RID_XLTY, RID_XLTY_HELP}, {RID_XLEY, RID_XLEY_HELP}, {RID_XLESLANTY, RID_XLESLANTY_HELP}, {RID_XGTY, RID_XGTY_HELP}, @@ -93,7 +93,7 @@ const std::pair SmElementsControl::aRelationsList[] = {RID_XNOTPRECEDESY, RID_XNOTPRECEDESY_HELP}, {RID_XNOTSUCCEEDSY, RID_XNOTSUCCEEDSY_HELP}, }; -const std::pair SmElementsControl::aSetOperations[] = +const SmElementDescr
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|1 + starmath/source/ElementsDockingWindow.cxx | 23 +++ 2 files changed, 20 insertions(+), 4 deletions(-) New commits: commit 67fd47e909aa88584420c3351ab17308aeb4e911 Author: Jan-Marek Glogowski AuthorDate: Tue May 14 02:48:37 2019 +0200 Commit: Jan-Marek Glogowski CommitDate: Tue May 28 06:06:48 2019 +0200 tdf#125454 SM use theming for element list This uses the same background color then the edit entries and changes the focus from the gray filled rectangle to a non-filled rectangle using the general highlight color. Change-Id: I4b44811e768266ccd2081a8e3ef61483a803da3b Reviewed-on: https://gerrit.libreoffice.org/72795 Reviewed-by: Heiko Tietze Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 874735a8a44f..c68d442bef3d 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -73,6 +73,7 @@ class SmElementsControl : public Control static const std::pair aOthers[]; virtual void ApplySettings(vcl::RenderContext&) override; +virtual void DataChanged(const DataChangedEvent&) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override; virtual void MouseMove(const MouseEvent& rMEvt) override; diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 385d33d795b5..43948cd18106 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -378,9 +378,10 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) if (pCurrentElement == element) { pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); -pContext->SetFillColor(Color(230, 230, 230)); -pContext->SetLineColor(Color(230, 230, 230)); - +const StyleSettings& rStyleSettings = pContext->GetSettings().GetStyleSettings(); +pContext->SetLineColor(rStyleSettings.GetHighlightColor()); +pContext->SetFillColor(COL_TRANSPARENT); +pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 1, y + 1, x + boxX - 1, y + boxY - 1))); pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2))); pContext->Pop(); } @@ -452,7 +453,21 @@ void SmElementsControl::Resize() void SmElementsControl::ApplySettings(vcl::RenderContext& rRenderContext) { -rRenderContext.SetBackground(COL_WHITE); +const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); +rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); +} + +void SmElementsControl::DataChanged(const DataChangedEvent& rDCEvt) +{ +Window::DataChanged(rDCEvt); + +if (!((rDCEvt.GetType() == DataChangedEventType::FONTS) || + (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) || + ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE +return; + +Invalidate(); } void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx|5 + starmath/source/ElementsDockingWindow.cxx | 111 +- 2 files changed, 98 insertions(+), 18 deletions(-) New commits: commit 73f8222109c3091d5119ed47eac5cad4a55b2212 Author: Jan-Marek Glogowski AuthorDate: Fri May 17 02:38:43 2019 +0200 Commit: Jan-Marek Glogowski CommitDate: Thu May 23 07:02:45 2019 +0200 tdf#65587 SM handle page keys in the ElementControl The page handling implementation is a little bit tricky, because the elemnt list is not handled like a grid but a list. Normally one would keep the horizontal cell and just scroll vertically. Instead this implements a kind of circle. Vertical offset is consistet, so you have the same amount of steps for up and down, but up runs left and down runs right. Change-Id: I296a46e98f7e00a59fd0a0ba358c981b49ac86cd Reviewed-on: https://gerrit.libreoffice.org/72793 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index e102250652c0..874735a8a44f 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -99,7 +99,12 @@ class SmElementsControl : public Control void addElements(const std::pair aElementsArray[], sal_uInt16 size); SmElement* current() const; bool hasRollover() const { return m_nCurrentRolloverElement != SAL_MAX_UINT16; } + void stepFocus(const bool bBackward); +void pageFocus(const bool bBackward); +// common code of page and step focus +inline void scrollToElement(const bool, const SmElement*); +inline sal_uInt16 nextElement(const bool, const sal_uInt16, const sal_uInt16); void build(); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index cbf8c80865b0..385d33d795b5 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -601,27 +601,23 @@ void SmElementsControl::LoseFocus() Invalidate(); } -void SmElementsControl::stepFocus(const bool bBackward) +sal_uInt16 SmElementsControl::nextElement(const bool bBackward, const sal_uInt16 nStartPos, const sal_uInt16 nLastElement) { -const sal_uInt16 nStartPos = m_nCurrentElement; -const sal_uInt16 nElementCount = maElementList.size(); sal_uInt16 nPos = nStartPos; -assert(nPos < nElementCount); while (true) { if (bBackward) { if (nPos == 0) -nPos = nElementCount - 1; -else -nPos--; +break; +nPos--; } else { +if (nPos == nLastElement) +break; nPos++; -if (nPos == nElementCount) -nPos = 0; } if (nStartPos == nPos) @@ -630,22 +626,94 @@ void SmElementsControl::stepFocus(const bool bBackward) break; } +return nPos; +} + +void SmElementsControl::scrollToElement(const bool bBackward, const SmElement *pCur) +{ +long nScrollPos = mxScroll->GetThumbPos(); +if (mbVerticalMode) +{ +nScrollPos += pCur->mBoxLocation.X(); +if (!bBackward) +nScrollPos += pCur->mBoxSize.Width() - GetOutputSizePixel().Width(); +} +else +{ +nScrollPos += pCur->mBoxLocation.Y(); +if (!bBackward) +nScrollPos += pCur->mBoxSize.Height() - GetOutputSizePixel().Height(); +} +mxScroll->DoScroll(nScrollPos); +} + +void SmElementsControl::stepFocus(const bool bBackward) +{ +const sal_uInt16 nStartPos = m_nCurrentElement; +const sal_uInt16 nLastElement = (maElementList.size() ? maElementList.size() - 1 : 0); +assert(nStartPos <= nLastElement); + +sal_uInt16 nPos = nextElement(bBackward, nStartPos, nLastElement); if (nStartPos != nPos) { m_nCurrentElement = nPos; -if (!hasRollover()) +m_nCurrentRolloverElement = SAL_MAX_UINT16; + +const tools::Rectangle outputRect(Point(0,0), GetOutputSizePixel()); +const SmElement *pCur = maElementList[nPos].get(); +tools::Rectangle elementRect(pCur->mBoxLocation, pCur->mBoxSize); +if (!outputRect.IsInside(elementRect)) +scrollToElement(bBackward, pCur); +Invalidate(); +} +} + +void SmElementsControl::pageFocus(const bool bBackward) +{ +const sal_uInt16 nStartPos = m_nCurrentElement; +const sal_uInt16 nLastElement = (maElementList.size() ? maElementList.size() - 1 : 0); +assert(nStartPos <= nLastElement); +tools::Rectangle outputRect(Point(0,0), GetOutputSizePixel()); +sal_uInt16 nPrevPos = nStartPos; +sal_uInt16 nPos = nPrevPos; + +bool bMoved = false; +while (true) +{ +nPrevPos = nPos; +nPos = nextElement(bBackward, nPrevPos, nLastElement); +if (nPrevPos ==
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx| 12 + starmath/source/ElementsDockingWindow.cxx | 208 -- starmath/source/uiobject.cxx |2 3 files changed, 181 insertions(+), 41 deletions(-) New commits: commit 2fdcd86ac08c0ed033398bdb85ed04b64f50c633 Author: Jan-Marek Glogowski AuthorDate: Tue May 14 12:03:48 2019 +0200 Commit: Jan-Marek Glogowski CommitDate: Thu May 23 07:00:56 2019 +0200 tdf#65587 SM add key navigation to ElementControl This adds arrows + home + end key navigation. The grid is handled like a list. For convenience Left + Up and Right + Down keys work in the same way. Change-Id: I757184e5161f2c7ac9b241294a5edc304c882497 Reviewed-on: https://gerrit.libreoffice.org/72792 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index c98072143bdc..e102250652c0 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -78,22 +78,28 @@ class SmElementsControl : public Control virtual void MouseMove(const MouseEvent& rMEvt) override; virtual void RequestHelp(const HelpEvent& rHEvt) override; virtual void Resize() override; +virtual void GetFocus() override; +virtual void LoseFocus() override; +virtual void KeyInput(const KeyEvent& rKEvt) override; SmDocShell* mpDocShell; SmFormat maFormat; OString msCurrentSetId; -SmElement*mpCurrentElement; +sal_uInt16m_nCurrentElement; +sal_uInt16m_nCurrentRolloverElement; Link maSelectHdlLink; std::vector< std::unique_ptr > maElementList; Size maMaxElementDimensions; bool mbVerticalMode; VclPtr< ScrollBar > mxScroll; -bool mbFirstPaintAfterLayout; +bool m_bFirstPaintAfterLayout; void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText); - void addElements(const std::pair aElementsArray[], sal_uInt16 size); +SmElement* current() const; +bool hasRollover() const { return m_nCurrentRolloverElement != SAL_MAX_UINT16; } +void stepFocus(const bool bBackward); void build(); diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index bd86a1df4337..cbf8c80865b0 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -235,10 +235,11 @@ const std::pair SmElementsControl::aOthers[] = SmElementsControl::SmElementsControl(vcl::Window *pParent) : Control(pParent, WB_TABSTOP) , mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT)) -, mpCurrentElement(nullptr) +, m_nCurrentElement(0) +, m_nCurrentRolloverElement(SAL_MAX_UINT16) , mbVerticalMode(true) , mxScroll(VclPtr::Create(this, WB_VERT)) -, mbFirstPaintAfterLayout(false) +, m_bFirstPaintAfterLayout(false) { set_id("element_selector"); SetMapMode( MapMode(MapUnit::Map100thMM) ); @@ -276,11 +277,19 @@ void SmElementsControl::setVerticalMode(bool bVerticalMode) Invalidate(); } +SmElement* SmElementsControl::current() const +{ +sal_uInt16 nCur = (m_nCurrentRolloverElement != SAL_MAX_UINT16) +? m_nCurrentRolloverElement +: (HasFocus() ? m_nCurrentElement : SAL_MAX_UINT16); +return (nCur < maElementList.size()) ? maElementList[nCur].get() : nullptr; +} + /** * !pContext => layout only * * Layouting is always done without a scrollbar and will show or hide it. - * The first paint (mbFirstPaintAfterLayout) therefore needs to update a + * The first paint (m_bFirstPaintAfterLayout) therefore needs to update a * visible scrollbar, because the layouting was wrong. **/ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) @@ -311,6 +320,7 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) else boxX = nControlWidth / perLine; +const SmElement* pCurrentElement = current(); for (std::unique_ptr & i : maElementList) { SmElement* element = i.get(); @@ -365,7 +375,7 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) if (pContext) { -if (mpCurrentElement == element) +if (pCurrentElement == element) { pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); pContext->SetFillColor(Color(230, 230, 230)); @@ -391,12 +401,12 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) if (pContext) { -if (!mbFirstPaintAfterLayout || !mxScroll->IsVisible()) +if (!m_bFirstPaintAfterLayout || !mxScroll->IsVisible()) return; -mbFirstPaintAfterLayout = false; +m_bFirstPaintAfterLayout =
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx| 26 +++--- starmath/source/ElementsDockingWindow.cxx |5 + 2 files changed, 8 insertions(+), 23 deletions(-) New commits: commit fb978737245bcde30ad4861c40c476b6da53eea3 Author: Jan-Marek Glogowski AuthorDate: Tue May 14 11:44:04 2019 +0200 Commit: Jan-Marek Glogowski CommitDate: Wed May 15 11:51:41 2019 +0200 SM constify SmElement Change-Id: I6334a6c87cb548c434f0dae05e7cb2cc6e6fd66a Reviewed-on: https://gerrit.libreoffice.org/72316 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 1e938f3e30e0..133c480d7100 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -34,6 +34,7 @@ class SmElement std::unique_ptr mpNode; OUString const maText; OUString const maHelpText; + public: Point mBoxLocation; Size mBoxSize; @@ -41,21 +42,11 @@ public: SmElement(std::unique_ptr&& pNode, const OUString& aText, const OUString& aHelpText); virtual ~SmElement(); -const std::unique_ptr& getNode(); -const OUString& getText() -{ -return maText; -} - -const OUString& getHelpText() -{ -return maHelpText; -} - -virtual bool isSeparator() -{ -return false; -} +const std::unique_ptr& getNode() const; +const OUString& getText() const { return maText; } +const OUString& getHelpText() const { return maHelpText; } + +virtual bool isSeparator() const { return false; } }; class SmElementSeparator : public SmElement @@ -63,10 +54,7 @@ class SmElementSeparator : public SmElement public: SmElementSeparator(); -virtual bool isSeparator() override -{ -return true; -} +bool isSeparator() const override { return true; } }; class SmElementsControl : public Control diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index f093723daf2a..95df76c4ec63 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -48,10 +48,7 @@ SmElement::SmElement(std::unique_ptr&& pNode, const OUString& aText, con SmElement::~SmElement() {} -const std::unique_ptr& SmElement::getNode() -{ -return mpNode; -} +const std::unique_ptr& SmElement::getNode() const { return mpNode; } SmElementSeparator::SmElementSeparator() : SmElement(std::unique_ptr(), OUString(), OUString()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/dialog.hxx|8 ++-- starmath/source/dialog.cxx |9 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) New commits: commit fdeada8c50c3e9126537ceafc649c85dc4be598c Author: Caolán McNamara AuthorDate: Fri Mar 29 13:51:50 2019 + Commit: Caolán McNamara CommitDate: Fri Mar 29 20:14:35 2019 +0100 tdf#124410 re-call SetScrollBarRange when aSymbolSet changes and do the work that depends on size happen at size-changed instead of first-draw Change-Id: Ia2605ba9bb875be9248a009a6f26f01cbbbd4632 Reviewed-on: https://gerrit.libreoffice.org/69928 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index da6c6eeaf2c5..713ecb5ae8e5 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -259,6 +259,7 @@ class SmShowSymbolSet : public weld::CustomWidgetController virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; virtual bool KeyInput(const KeyEvent& rKEvt) override; +virtual void Resize() override; DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void); @@ -268,8 +269,11 @@ public: virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override { CustomWidgetController::SetDrawingArea(pDrawingArea); - pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 27, - pDrawingArea->get_text_height() * 9); +m_aOldSize = Size(pDrawingArea->get_approximate_digit_width() * 27, + pDrawingArea->get_text_height() * 9); +pDrawingArea->set_size_request(m_aOldSize.Width(), m_aOldSize.Height()); +SetOutputSizePixel(m_aOldSize); +calccols(pDrawingArea->get_ref_device()); } void calccols(const vcl::RenderContext& rRenderContext); diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index b8fae68c547a..a9b77d1ca40b 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -940,15 +940,19 @@ Point SmShowSymbolSet::OffsetPoint(const Point ) const return Point(rPoint.X() + nXOffset, rPoint.Y() + nYOffset); } -void SmShowSymbolSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) +void SmShowSymbolSet::Resize() { +CustomWidgetController::Resize(); Size aWinSize(GetOutputSizePixel()); if (aWinSize != m_aOldSize) { -calccols(rRenderContext); +calccols(GetDrawingArea()->get_ref_device()); m_aOldSize = aWinSize; } +} +void SmShowSymbolSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) +{ Color aBackgroundColor; Color aTextColor; lclGetSettingColors(aBackgroundColor, aTextColor); @@ -1088,6 +1092,7 @@ void SmShowSymbolSet::calccols(const vcl::RenderContext& rRenderContext) void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t& rSymbolSet) { aSymbolSet = rSymbolSet; +SetScrollBarRange(); Invalidate(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/ElementsDockingWindow.hxx |4 ++-- starmath/inc/action.hxx|4 ++-- starmath/inc/node.hxx |4 ++-- starmath/inc/parse.hxx |2 +- starmath/inc/token.hxx |8 starmath/inc/view.hxx |2 +- starmath/inc/visitors.hxx |4 ++-- starmath/source/accessibility.hxx |4 ++-- starmath/source/dialog.cxx |6 +++--- starmath/source/document.cxx |6 +++--- starmath/source/mathmlimport.cxx |2 +- starmath/source/mathtype.hxx |2 +- starmath/source/ooxmlexport.hxx|2 +- starmath/source/uiobject.hxx |2 +- starmath/source/view.cxx |2 +- 15 files changed, 27 insertions(+), 27 deletions(-) New commits: commit e494cc2942899fd92a2273eaed2bf41eb74ea8a9 Author: Noel Grandin AuthorDate: Mon Oct 8 09:34:29 2018 +0200 Commit: Noel Grandin CommitDate: Mon Oct 8 11:10:57 2018 +0200 loplugin:constfields in starmath Change-Id: I5092401b4138ca15e93b36adf1b059e75d4e8f5a Reviewed-on: https://gerrit.libreoffice.org/61514 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 1b4836d8ff62..1e1cf4111bff 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -33,8 +33,8 @@ class SmNode; class SmElement { std::unique_ptr mpNode; -OUStringmaText; -OUStringmaHelpText; +OUString const maText; +OUString const maHelpText; public: Point mBoxLocation; Size mBoxSize; diff --git a/starmath/inc/action.hxx b/starmath/inc/action.hxx index 6684a7461e95..cde1e0ce3b47 100644 --- a/starmath/inc/action.hxx +++ b/starmath/inc/action.hxx @@ -28,8 +28,8 @@ class SmDocShell; class SmFormatAction: public SfxUndoAction { SmDocShell *pDoc; -SmFormataOldFormat; -SmFormataNewFormat; +SmFormat constaOldFormat; +SmFormat constaNewFormat; public: SmFormatAction(SmDocShell *pDocSh, const SmFormat& rOldFormat, const SmFormat& rNewFormat); diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index b9a11864b1a8..9ee746d9d04c 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -98,7 +98,7 @@ class SmNode : public SmRect SmFace maFace; SmToken maNodeToken; -SmNodeType meType; +SmNodeType const meType; SmScaleMode meScaleMode; RectHorAlignmeRectHorAlign; FontChangeMask mnFlags; @@ -435,7 +435,7 @@ public: */ class SmSpecialNode : public SmTextNode { -bool mbIsFromGreekSymbolSet; +bool const mbIsFromGreekSymbolSet; protected: SmSpecialNode(SmNodeType eNodeType, const SmToken , sal_uInt16 _nFontDesc); diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 851512030c5b..544ab1cf7dcb 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -66,7 +66,7 @@ class SmParser std::set< OUString > m_aUsedSymbols; // CharClass representing a locale for parsing numbers -CharClass m_aNumCC; +CharClass const m_aNumCC; // pointer to System locale's CharClass, which is alive inside SM_MOD() const CharClass* m_pSysCC; diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 7bf4da95f31f..c9093293ed43 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -128,10 +128,10 @@ struct SmToken struct SmTokenTableEntry { const sal_Char* pIdent; -SmTokenType eType; -sal_Unicode cMathChar; -TG nGroup; -sal_uInt16 nLevel; +SmTokenType const eType; +sal_Unicode const cMathChar; +TG const nGroup; +sal_uInt16 const nLevel; }; #endif diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 7b6e741895bb..43221c4a66d2 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -215,7 +215,7 @@ class SmViewShell: public SfxViewShell std::unique_ptr mpImpl; VclPtr mpGraphic; -SmGraphicController maGraphicController; +SmGraphicController const maGraphicController; OUString maStatusText; bool mbPasteState; diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index 6f3b17e733c6..290f1bdeacb8 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -116,8 +116,8 @@ private: OutputDevice SmCaretPos maPos; /** Offset to draw from */ -Point maOffset; -bool mbCaretVisible; +Point const maOffset; +bool const mbCaretVisible; protected: /** Default method for drawing pNodes */ void DefaultVisit( SmNode* pNode ) override; diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx index 8723d61e9309..e74b5581b0c4 100644 --- a/starmath/source/accessibility.hxx +++
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/parse.hxx| 28 +-- starmath/source/parse.cxx | 110 ++ 2 files changed, 68 insertions(+), 70 deletions(-) New commits: commit 3e15dd2915f6f0ebb485781e837f1d9c94268b68 Author: Noel Grandin AuthorDate: Thu Oct 4 15:34:38 2018 +0200 Commit: Noel Grandin CommitDate: Sun Oct 7 18:08:51 2018 +0200 use more unique_ptr in SmParser Change-Id: I132598f5829e02664040dff745011a59c6a19c1d Reviewed-on: https://gerrit.libreoffice.org/61401 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 17e20b4cdaea..851512030c5b 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -89,27 +89,27 @@ class SmParser std::unique_ptr DoSubSup(TG nActiveGroup, SmNode *pGivenNode); std::unique_ptr DoOpSubSup(); std::unique_ptr DoPower(); -SmBlankNode *DoBlank(); -SmNode *DoTerm(bool bGroupNumberIdent); -SmNode *DoEscape(); -SmOperNode *DoOperator(); +std::unique_ptr DoBlank(); +std::unique_ptr DoTerm(bool bGroupNumberIdent); +std::unique_ptr DoEscape(); +std::unique_ptr DoOperator(); std::unique_ptr DoOper(); -SmStructureNode *DoUnOper(); +std::unique_ptr DoUnOper(); std::unique_ptr DoAlign(bool bUseExtraSpaces = true); std::unique_ptr DoFontAttribut(); std::unique_ptr DoAttribut(); std::unique_ptr DoFont(); std::unique_ptr DoFontSize(); std::unique_ptr DoColor(); -SmStructureNode *DoBrace(); -SmBracebodyNode *DoBracebody(bool bIsLeftRight); -SmTextNode *DoFunction(); -SmTableNode *DoBinom(); -SmStructureNode *DoStack(); -SmStructureNode *DoMatrix(); -SmSpecialNode *DoSpecial(); -SmGlyphSpecialNode *DoGlyphSpecial(); -SmExpressionNode *DoError(SmParseError Error); +std::unique_ptr DoBrace(); +std::unique_ptr DoBracebody(bool bIsLeftRight); +std::unique_ptr DoFunction(); +std::unique_ptr DoBinom(); +std::unique_ptr DoStack(); +std::unique_ptr DoMatrix(); +std::unique_ptr DoSpecial(); +std::unique_ptr DoGlyphSpecial(); +std::unique_ptr DoError(SmParseError Error); // end of grammar public: diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 56d778f9b44c..71f9a3a4dce6 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -988,7 +988,7 @@ std::unique_ptr SmParser::DoAlign(bool bUseExtraSpaces) // allow for just one align statement in 5.0 if (TokenInGroup(TG::Align)) -return std::unique_ptr(DoError(SmParseError::DoubleAlign)); +return DoError(SmParseError::DoubleAlign); } auto pNode = DoExpression(bUseExtraSpaces); @@ -1146,7 +1146,7 @@ std::unique_ptr SmParser::DoProduct() //Let the glyph node know it's a binary operation m_aCurToken.eType = TBOPER; m_aCurToken.nGroup = TG::Product; -xOper.reset(DoGlyphSpecial()); +xOper = DoGlyphSpecial(); break; case TOVERBRACE : @@ -1243,7 +1243,7 @@ std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) { // forget the earlier one, remember an error instead aSubNodes[nIndex].reset(); -xENode.reset(DoError(SmParseError::DoubleSubsupscript)); // this also skips current token. +xENode = DoError(SmParseError::DoubleSubsupscript); // this also skips current token. } else { @@ -1261,7 +1261,7 @@ std::unique_ptr SmParser::DoSubSup(TG nActiveGroup, SmNode *pGivenNode) xSNode = DoRelation(); } else -xSNode.reset(DoTerm(true)); +xSNode = DoTerm(true); aSubNodes[nIndex] = std::move(xENode ? xENode : xSNode); } @@ -1308,7 +1308,7 @@ std::unique_ptr SmParser::DoPower() return xNode; } -SmBlankNode *SmParser::DoBlank() +std::unique_ptr SmParser::DoBlank() { DepthProtect aDepthGuard(m_nParseDepth); if (aDepthGuard.TooDeep()) @@ -1330,10 +1330,10 @@ SmBlankNode *SmParser::DoBlank() { pBlankNode->Clear(); } -return pBlankNode.release(); +return pBlankNode; } -SmNode *SmParser::DoTerm(bool bGroupNumberIdent) +std::unique_ptr SmParser::DoTerm(bool bGroupNumberIdent) { DepthProtect aDepthGuard(m_nParseDepth); if (aDepthGuard.TooDeep()) @@ -1362,18 +1362,18 @@ SmNode *SmParser::DoTerm(bool bGroupNumberIdent) xSNode->SetSubNodes(nullptr, nullptr); NextToken(); -return xSNode.release(); +return std::unique_ptr(xSNode.release()); } auto pNode = DoAlign(!bNoSpace); if (m_aCurToken.eType == TRGROUP) { NextToken(); -return pNode.release(); +return pNode; } auto
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/dialog.hxx | 11 --- starmath/inc/pch/precompiled_sm.hxx |2 -- starmath/inc/utility.hxx|4 starmath/source/dialog.cxx |2 -- starmath/source/utility.cxx |4 5 files changed, 23 deletions(-) New commits: commit 8d40a23aafc4c0972e052fbb58862228839cc7ef Author: Caolán McNamara AuthorDate: Wed Sep 19 08:54:42 2018 +0100 Commit: Caolán McNamara CommitDate: Wed Sep 19 22:20:21 2018 +0200 drop some unnecessary headers Change-Id: Ic26c41e1d6be76e28081cc0110cd2335c03d2e27 Reviewed-on: https://gerrit.libreoffice.org/60755 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index bd1c0d4bdd40..7c3f70c2d8e1 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -19,20 +19,9 @@ #ifndef INCLUDED_STARMATH_INC_DIALOG_HXX #define INCLUDED_STARMATH_INC_DIALOG_HXX -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include -#include -#include -#include #include #include #include diff --git a/starmath/inc/pch/precompiled_sm.hxx b/starmath/inc/pch/precompiled_sm.hxx index 38380c516ef8..2ce98e092949 100644 --- a/starmath/inc/pch/precompiled_sm.hxx +++ b/starmath/inc/pch/precompiled_sm.hxx @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -96,7 +95,6 @@ #include #include #include -#include #include #include #include diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index e6346d4dc6e4..bcd5736a27a5 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -23,14 +23,10 @@ #include #include -#include -#include -#include #include #include #include - inline long SmPtsTo100th_mm(long nNumPts) // returns the length (in 100th of mm) that corresponds to the length // 'nNumPts' (in units points). diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 748ad51575f0..127bcaac30d5 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -26,10 +26,8 @@ #include #include #include -#include #include #include -#include #include #include #include diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index 1018bad60c04..c82b5ec6b7aa 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -17,15 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include - #include - #include #include #include - // return pointer to active SmViewShell, if this is not possible // return 0 instead. //!! Since this method is based on the current focus it is somewhat ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cursor.hxx|4 ++-- starmath/source/cursor.cxx | 24 +++- 2 files changed, 13 insertions(+), 15 deletions(-) New commits: commit 9fd7808f79fe48af9d9a4d47561abb9b8c66cbc3 Author: Noel Grandin AuthorDate: Thu Aug 16 12:22:43 2018 +0200 Commit: Noel Grandin CommitDate: Sat Aug 18 09:38:28 2018 +0200 loplugin:useuniqueptr pass SmNodeList around by std::unique_ptr(2) Change-Id: I53b7f39ddc150367bc5f9c4a7ee7049d59e9f485 Reviewed-on: https://gerrit.libreoffice.org/59231 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 4c3e5b3eb0cd..b04b39748829 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -261,7 +261,7 @@ private: void BuildGraph(); /** Insert new nodes in the tree after position */ -void InsertNodes(SmNodeList* pNewNodes); +void InsertNodes(std::unique_ptr pNewNodes); /** tries to set position to a specific SmCaretPos * @@ -273,7 +273,7 @@ private: void AnnotateSelection(); /** Clone list of nodes in a clipboard (creates a deep clone) */ -static SmNodeList* CloneList(SmClipboard ); +static std::unique_ptr CloneList(SmClipboard ); /** Find an iterator pointing to the node in pLineList following rCaretPos * diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 4afe12d2e445..cc0037f2ef85 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -291,9 +291,8 @@ void SmCursor::Delete(){ FinishEdit(std::move(pLineList), pLineParent, nLineOffset, PosAfterDelete); } -void SmCursor::InsertNodes(SmNodeList* pNewNodes){ +void SmCursor::InsertNodes(std::unique_ptr pNewNodes){ if(pNewNodes->empty()){ -delete pNewNodes; return; } @@ -331,8 +330,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){ PatchLineList(pLineList.get(), patchIt); SmCaretPos PosAfterInsert = PatchLineList(pLineList.get(), it); //Release list, we've taken the nodes -delete pNewNodes; -pNewNodes = nullptr; +pNewNodes.reset(); //Finish editing FinishEdit(std::move(pLineList), pLineParent, nParentIndex, PosAfterInsert); @@ -881,9 +879,9 @@ void SmCursor::InsertText(const OUString& aString) pText->AdjustFontDesc(); pText->Prepare(mpDocShell->GetFormat(), *mpDocShell, 0); -SmNodeList* pList = new SmNodeList; +std::unique_ptr pList(new SmNodeList); pList->push_front(pText); -InsertNodes(pList); +InsertNodes(std::move(pList)); EndEdit(); } @@ -983,9 +981,9 @@ void SmCursor::InsertElement(SmFormulaElement element){ pNewNode->Prepare(mpDocShell->GetFormat(), *mpDocShell, 0); //Insert new node -SmNodeList* pList = new SmNodeList; +std::unique_ptr pList(new SmNodeList); pList->push_front(pNewNode); -InsertNodes(pList); +InsertNodes(std::move(pList)); EndEdit(); } @@ -1010,9 +1008,9 @@ void SmCursor::InsertSpecial(const OUString& _aString) pSpecial->Prepare(mpDocShell->GetFormat(), *mpDocShell, 0); //Insert the node -SmNodeList* pList = new SmNodeList; +std::unique_ptr pList(new SmNodeList); pList->push_front(pSpecial); -InsertNodes(pList); +InsertNodes(std::move(pList)); EndEdit(); } @@ -1035,7 +1033,7 @@ void SmCursor::InsertCommandText(const OUString& aCommandText) { Delete(); //Insert it -InsertNodes(pLineList.release()); +InsertNodes(std::move(pLineList)); EndEdit(); } @@ -1087,9 +1085,9 @@ void SmCursor::Paste() { EndEdit(); } -SmNodeList* SmCursor::CloneList(SmClipboard ){ +std::unique_ptr SmCursor::CloneList(SmClipboard ){ SmCloningVisitor aCloneFactory; -SmNodeList* pClones = new SmNodeList; +std::unique_ptr pClones(new SmNodeList); for(auto : rClipboard){ SmNode *pClone = aCloneFactory.Clone(xNode.get()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc starmath/source
starmath/inc/cursor.hxx| 15 +++--- starmath/source/cursor.cxx | 103 - 2 files changed, 63 insertions(+), 55 deletions(-) New commits: commit 0662f319324e55a80bb789e960a752c172feb530 Author: Noel Grandin AuthorDate: Thu Aug 16 12:19:54 2018 +0200 Commit: Noel Grandin CommitDate: Fri Aug 17 13:45:21 2018 +0200 loplugin:useuniqueptr pass SmNodeList around by std::unique_ptr Change-Id: I263a7afd23a38f68ee54ecb11f00bcfbdda30c64 Reviewed-on: https://gerrit.libreoffice.org/59230 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 476f021670e0..4c3e5b3eb0cd 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -225,14 +225,14 @@ private: * that includes pLine! * This method also deletes SmErrorNode's as they're just meta info in the line. */ -static SmNodeList* LineToList(SmStructureNode* pLine, SmNodeList* pList); +static void LineToList(SmStructureNode* pLine, SmNodeList& rList); /** Auxiliary function for calling LineToList on a node * * This method sets pNode = NULL and remove it from its parent. * (Assuming it has a parent, and is a child of it). */ -static SmNodeList* NodeToList(SmNode*& rpNode, SmNodeList* pList = new SmNodeList){ +static void NodeToList(SmNode*& rpNode, SmNodeList& rList){ //Remove from parent and NULL rpNode SmNode* pNode = rpNode; if(rpNode && rpNode->GetParent()){//Don't remove this, correctness relies on it @@ -242,11 +242,12 @@ private: } rpNode = nullptr; //Create line from node -if(pNode && IsLineCompositionNode(pNode)) -return LineToList(static_cast(pNode), pList); +if(pNode && IsLineCompositionNode(pNode)){ +LineToList(static_cast(pNode), rList); +return; +} if(pNode) -pList->push_front(pNode); -return pList; +rList.push_front(pNode); } /** Clone a visual line to a clipboard @@ -342,7 +343,7 @@ private: * @param pStartLineLine to take first position in, if PosAfterEdit cannot be found, * leave it NULL for pLineList. */ -void FinishEdit(SmNodeList* pLineList, +void FinishEdit(std::unique_ptr pLineList, SmStructureNode* pParent, int nParentIndex, SmCaretPos PosAfterEdit, diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 1d0e987e02cc..4afe12d2e445 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -195,20 +195,21 @@ void SmCursor::DeletePrev(OutputDevice* pDev){ OSL_ENSURE(pMergeLine, "pMergeLine cannot be NULL!"); SmCaretPos PosAfterDelete; //Convert first line to list -SmNodeList *pLineList = NodeToList(pMergeLine); +std::unique_ptr pLineList(new SmNodeList); +NodeToList(pMergeLine, *pLineList); if(!pLineList->empty()){ //Find iterator to patch SmNodeList::iterator patchPoint = pLineList->end(); --patchPoint; //Convert second line to list -NodeToList(pLine, pLineList); +NodeToList(pLine, *pLineList); //Patch the line list ++patchPoint; -PosAfterDelete = PatchLineList(pLineList, patchPoint); +PosAfterDelete = PatchLineList(pLineList.get(), patchPoint); //Parse the line -pLine = SmNodeListParser().Parse(pLineList); +pLine = SmNodeListParser().Parse(pLineList.get()); } -delete pLineList; +pLineList.reset(); pLineParent->SetSubNode(nLineOffset-1, pLine); //Delete the removed line slot SmNodeArray lines(pLineParent->GetNumSubNodes()-1); @@ -277,16 +278,17 @@ void SmCursor::Delete(){ //Position after delete SmCaretPos PosAfterDelete; -SmNodeList* pLineList = NodeToList(pLine); +std::unique_ptr pLineList(new SmNodeList); +NodeToList(pLine, *pLineList); //Take the selected nodes and delete them... -SmNodeList::iterator patchIt = TakeSelectedNodesFromList(pLineList); +SmNodeList::iterator patchIt = TakeSelectedNodesFromList(pLineList.get()); //Get the position to set after delete -PosAfterDelete = PatchLineList(pLineList, patchIt); +PosAfterDelete = PatchLineList(pLineList.get(), patchIt); //Finish editing -FinishEdit(pLineList, pLineParent, nLineOffset, PosAfterDelete); +FinishEdit(std::move(pLineList), pLineParent, nLineOffset, PosAfterDelete); } void SmCursor::InsertNodes(SmNodeList* pNewNodes){ @@ -310,10 +312,11 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){ assert(nParentIndex >= 0); //Convert line to list -SmNodeList* pLineList = NodeToList(pLine); +