[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/qa starmath/source
starmath/inc/utility.hxx |8 starmath/qa/extras/mmlimport-test.cxx |4 ++-- starmath/source/visitors.cxx | 17 - 3 files changed, 6 insertions(+), 23 deletions(-) New commits: commit 9e92a17cb6e03beedeeca40bfc8524c2623d31eb Author: Khaled Hosny AuthorDate: Tue Sep 19 10:56:35 2023 +0300 Commit: خالد حسني CommitDate: Tue Sep 19 14:22:32 2023 +0200 starmath: Improve glyph positioning Using twips everywhere and not rounding to pixels seems to improve positioning (at least on hipdi displays). Hopefully the issue that required rounding is no longer relevant. Change-Id: I0ee4a4453b2a3d8e06be56d586761f7960a2d4d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157044 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index 83f3cc124dc1..feaae1fedb40 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -22,7 +22,6 @@ #include #include "smdllapi.hxx" -#include #include #include #include @@ -117,14 +116,15 @@ public: virtual voidInsert(const vcl::Font ) override; }; -// Math uses 100ths of MM by default, but lok needs twips everywhere +// Math used to use 100ths of MM by default, but now uses twips +// which seems to improve (subpixel) positioning. inline MapUnit SmMapUnit() { -return comphelper::LibreOfficeKit::isActive() ? MapUnit::MapTwip : MapUnit::Map100thMM; +return MapUnit::MapTwip; } inline o3tl::Length SmO3tlLengthUnit() { -return comphelper::LibreOfficeKit::isActive() ? o3tl::Length::twip : o3tl::Length::mm100; +return o3tl::Length::twip; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index 2fcb1de13744..c6edd0b6481e 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -168,9 +168,9 @@ void Test::testTdf151842() SmFormat aFormat = pDocShell->GetFormat(); // Without the fix in place, this test would have failed with -// - Expected: 4233 +// - Expected: 2400 // - Actual : 423 -CPPUNIT_ASSERT_EQUAL(tools::Long(4233), aFormat.GetBaseSize().Height()); +CPPUNIT_ASSERT_EQUAL(tools::Long(2400), aFormat.GetBaseSize().Height()); } void Test::testMathmlEntities() diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index c2c4717df299..3e11201ebef2 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -441,13 +441,6 @@ void SmDrawingVisitor::Visit( SmRootSymbolNode* pNode ) if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aBar); -//! avoid GROWING AND SHRINKING of drawn rectangle when constantly -//! increasing zoomfactor. -// This is done by shifting its output-position to a point that -// corresponds exactly to a pixel on the output device. -Point aDrawPos( mrDev.PixelToLogic( mrDev.LogicToPixel( aBar.TopLeft( ) ) ) ); -aBar.SetPos( aDrawPos ); - mrDev.DrawRect( aBar ); } @@ -500,13 +493,6 @@ void SmDrawingVisitor::Visit( SmRectangleNode* pNode ) if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aTmp); -//! avoid GROWING AND SHRINKING of drawn rectangle when constantly -//! increasing zoomfactor. -// This is done by shifting its output-position to a point that -// corresponds exactly to a pixel on the output device. -Point aPos ( mrDev.PixelToLogic( mrDev.LogicToPixel( aTmp.TopLeft( ) ) ) ); -aTmp.SetPos( aPos ); - mrDev.DrawRect( aTmp ); } @@ -524,9 +510,6 @@ void SmDrawingVisitor::DrawTextNode( SmTextNode* pNode ) if (mrFormat.IsRightToLeft() && mrDev.GetOutDevType() != OUTDEV_WINDOW) mrDev.ReMirror(aPos); -// round to pixel coordinate -aPos = mrDev.PixelToLogic( mrDev.LogicToPixel( aPos ) ); - mrDev.DrawStretchText( aPos, pNode->GetWidth( ), pNode->GetText( ) ); }
[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/qa starmath/source
starmath/inc/cursor.hxx | 10 -- starmath/qa/cppunit/test_cursor.cxx | 10 +- starmath/source/cursor.cxx | 36 ++-- starmath/source/view.cxx| 12 ++-- starmath/source/visitors.cxx|2 ++ 5 files changed, 51 insertions(+), 19 deletions(-) New commits: commit 3c24177104dfa5b8d68d74bf1735839964e93ba6 Author: Khaled Hosny AuthorDate: Thu Sep 7 18:10:30 2023 +0300 Commit: خالد حسني CommitDate: Fri Sep 8 04:24:48 2023 +0200 tdf#88744: Use real clipboard when inline editing is enabled Instead of using a fake clipboard that works only inside the same formula. Change-Id: Ia1e97028e1aafa15912bc9b4397d66afb0d23ec7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156671 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 0a8a35071f10..a44c9ed61340 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -158,15 +158,15 @@ public: void InsertBrackets(SmBracketType eBracketType); /** Copy the current selection */ -void Copy(); +void Copy(vcl::Window* pWindow = nullptr); /** Cut the current selection */ -void Cut() +void Cut(vcl::Window* pWindow = nullptr) { -Copy(); +Copy(pWindow); Delete(); } /** Paste the clipboard */ -void Paste(); +void Paste(vcl::Window* pWindow = nullptr); /** Returns true if more than one node is selected * @@ -201,8 +201,6 @@ private: SmDocShell* mpDocShell; /** Graph over caret position in the current tree */ std::unique_ptr mpGraph; -/** Clipboard holder */ -SmClipboard maClipboard; /** Returns a node that is selected, if any could be found */ SmNode* FindSelectedNode(SmNode* pNode); diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index bbdebf503153..d76b446e6a41 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -87,7 +87,9 @@ void Test::testCopyPaste() aCursor.Move(pOutputDevice, MoveRight); aCursor.Paste(); +#ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason CPPUNIT_ASSERT_EQUAL(OUString("{ { a * b } + { c * b } }"), xDocShRef->GetText()); +#endif } void Test::testCopySelectPaste() @@ -113,7 +115,9 @@ void Test::testCopySelectPaste() aCursor.Move(pOutputDevice, MoveRight, false); aCursor.Paste(); +#ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason CPPUNIT_ASSERT_EQUAL(OUString("{ { b + { c * b } } + c }"), xDocShRef->GetText()); +#endif } void Test::testCutPaste() @@ -135,7 +139,9 @@ void Test::testCutPaste() aCursor.Move(pOutputDevice, MoveRight); aCursor.Paste(); +#ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason CPPUNIT_ASSERT_EQUAL(OUString("{ a + { c * b } }"), xDocShRef->GetText()); +#endif } void Test::testCutSelectPaste() @@ -161,7 +167,9 @@ void Test::testCutSelectPaste() aCursor.Move(pOutputDevice, MoveRight, false); aCursor.Paste(); -CPPUNIT_ASSERT_EQUAL(OUString("{ b + { c * } }"), xDocShRef->GetText()); +#ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason +CPPUNIT_ASSERT_EQUAL(OUString("{ b + { c * {} } }"), xDocShRef->GetText()); +#endif } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index e8623517bcd7..ef4853cb22a4 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -16,6 +16,8 @@ #include #include #include +#include +#include void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMoveAnchor){ SmCaretPosGraphEntry* NewPos = nullptr; @@ -1047,7 +1049,8 @@ void SmCursor::InsertCommandText(const OUString& aCommandText) { EndEdit(); } -void SmCursor::Copy(){ +void SmCursor::Copy(vcl::Window* pWindow) +{ if(!HasSelection()) return; @@ -1060,6 +1063,7 @@ void SmCursor::Copy(){ assert(pLine); //Clone selected nodes +// TODO: Simplify all this cloning since we only need a formula string now. SmClipboard aClipboard; if(IsLineCompositionNode(pLine)) CloneLineToClipboard(static_cast(pLine), ); @@ -1079,17 +1083,37 @@ void SmCursor::Copy(){ } } +// Parse list of nodes to a tree +SmNodeListParser parser; +SmNode* pTree(parser.Parse(CloneList(aClipboard).get())); + +// Parse the tree to a string +OUString aString; +SmNodeToTextVisitor(pTree, aString); + //Set clipboard -if (!aClipboard.empty()) -maClipboard = std::move(aClipboard); +auto xClipboard(pWindow ? pWindow->GetClipboard() : GetSystemClipboard()); +vcl::unohelper::TextDataObject::CopyStringTo(aString, xClipboard); }
[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/inc/smmod.hxx | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) New commits: commit 5ee84725f59e880d38ab7adb43b2a8126f2dfd65 Author: Noel Grandin AuthorDate: Mon Feb 27 09:17:03 2023 +0200 Commit: Noel Grandin CommitDate: Mon Feb 27 12:27:55 2023 + mpLocSymbolData is unused and SmLocalizedSymbolData cannot even be instantiated. It is better off as a namespace, rather than a class. Change-Id: I4d6daace649e3529cefe67cf18eed85f2cbfc980 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147857 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 9ab99c2420d7..54f339b550fb 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -49,23 +49,19 @@ class VirtualDevice; OUString SmResId(TranslateId aId); -class SmLocalizedSymbolData +namespace SmLocalizedSymbolData { -public: -SmLocalizedSymbolData() = delete; - -static OUString GetUiSymbolName( std::u16string_view rExportName ); -static OUString GetExportSymbolName( std::u16string_view rUiName ); +OUString GetUiSymbolName( std::u16string_view rExportName ); +OUString GetExportSymbolName( std::u16string_view rUiName ); -static OUString GetUiSymbolSetName( std::u16string_view rExportName ); -static OUString GetExportSymbolSetName( std::u16string_view rUiName ); +OUString GetUiSymbolSetName( std::u16string_view rExportName ); +OUString GetExportSymbolSetName( std::u16string_view rUiName ); }; class SmModule final : public SfxModule, public utl::ConfigurationListener { std::unique_ptr mpColorConfig; std::unique_ptr mpConfig; -std::unique_ptr mpLocSymbolData; std::optional moSysLocale; VclPtrmpVirtualDev;
[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/Library_sm.mk starmath/source starmath/uiconfig uitest/math_tests
starmath/Library_sm.mk |3 starmath/inc/AccessibleSmElement.hxx | 101 -- starmath/inc/AccessibleSmElementsControl.hxx | 106 -- starmath/inc/ElementsDockingWindow.hxx | 106 -- starmath/source/AccessibleSmElement.cxx| 281 --- starmath/source/AccessibleSmElementsControl.cxx| 369 - starmath/source/ElementsDockingWindow.cxx | 841 ++--- starmath/source/SmElementsPanel.cxx| 14 starmath/source/SmElementsPanel.hxx|3 starmath/source/uiobject.cxx | 106 -- starmath/source/uiobject.hxx | 57 - starmath/uiconfig/smath/ui/dockingelements.ui | 40 starmath/uiconfig/smath/ui/sidebarelements_math.ui | 42 - uitest/math_tests/start.py |5 14 files changed, 167 insertions(+), 1907 deletions(-) New commits: commit d79c527c2a599c7821d27cf03b95cb79e2abe685 Author: Mike Kaganski AuthorDate: Wed Jun 1 11:20:12 2022 +0300 Commit: Mike Kaganski CommitDate: Thu Jun 2 12:51:41 2022 +0200 Use IconView in SmElementsControl Allows to send individual images over the wire in lok case, instead of sending full canvas at every scroll operation. The control's horizontal and vertical modes (when it's docked to a vertical or a horizontal parent window side) are now identical. Some TODOs: * Re-implement a11y - that needs to be implemented on IconView level; * Make sure that sub-pixel positioning is not used when creating the elements icons (makes elements look a bit slim on Windows); * Maybe restore mouse hover indication; in non-GTK case, a call to m_xIconView->SetHoverSelection would suffice in SalInstanceIconView. Change-Id: Idbc35f4e38e2b49fd0848a96da557fa2c1a1f6e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134761 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index e4eca13440d7..aa824cee5890 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -64,8 +64,6 @@ $(eval $(call gb_Library_use_libraries,sm,\ )) $(eval $(call gb_Library_add_exception_objects,sm,\ -starmath/source/AccessibleSmElement \ -starmath/source/AccessibleSmElementsControl \ starmath/source/ElementsDockingWindow \ starmath/source/SmElementsPanel \ starmath/source/SmPanelFactory \ @@ -94,7 +92,6 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/symbol \ starmath/source/tmpdevice \ starmath/source/typemap \ -starmath/source/uiobject \ starmath/source/unodoc \ starmath/source/unofilter \ starmath/source/unomodel \ diff --git a/starmath/inc/AccessibleSmElement.hxx b/starmath/inc/AccessibleSmElement.hxx deleted file mode 100644 index c1e7e6526872.. --- a/starmath/inc/AccessibleSmElement.hxx +++ /dev/null @@ -1,101 +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 . - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class SmElementsControl; - -typedef ::cppu::ImplHelper3 -AccessibleSmElement_BASE; - -class AccessibleSmElement final : public comphelper::OAccessibleComponentHelper, - public AccessibleSmElement_BASE -{ -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; -sal_Int16 m_nRole; - -~AccessibleSmElement() override; -void SAL_CALL disposing() override; -css::awt::Rectangle implGetBounds() override; - -void testAction(sal_Int32) const; - -public: -explicit AccessibleSmElement(SmElementsControl* pSmElementsControl, sal_uInt16 nItemId, - sal_Int32 nIndexInParent); - -void SetFocus(bool _bFocus); -sal_uInt16 itemId()
[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/inc/edit.hxx |5 - starmath/inc/view.hxx |2 -- 2 files changed, 7 deletions(-) New commits: commit 44c05a9ae8de321875f2e9868b7bb1046eccd64a Author: Mike Kaganski AuthorDate: Mon Jan 17 15:04:47 2022 +0100 Commit: Mike Kaganski CommitDate: Mon Jan 17 16:18:43 2022 +0100 Drop unused declaration Change-Id: I17cd0d144b64fc6bfc8ce10f1de2db3ce4565ac3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128444 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index a5dee85fdbd4..3c5d498a364b 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -33,11 +33,6 @@ class SmCmdBoxWindow; class CommandEvent; class Timer; -namespace svtools -{ -class ColorConfig; -} - void SmGetLeftSelectionPart(const ESelection& rSelection, sal_Int32& nPara, sal_uInt16& nPos); class SmEditWindow; diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index a8e02addfba6..5ad4ac3842d9 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -38,8 +38,6 @@ class SmGraphicAccessible; class SmGraphicWidget; class SmElementsDockingWindow; -namespace svtools { class ColorConfig; } - class SmGraphicWindow final : public InterimItemWindow { private:
[Libreoffice-commits] core.git: starmath/inc
starmath/inc/strings.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 54115790926a5964534472dff7e4661ea34acb28 Author: Jeff Huang AuthorDate: Fri Dec 24 10:44:58 2021 +0800 Commit: Mike Kaganski CommitDate: Fri Dec 24 08:04:59 2021 +0100 tdf#140726 Change func func() to func () in Math Change-Id: I9b28097c0043c7c6daffb047683b6af1f0202223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127393 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index ccde8244032a..f0796a6622cb 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -75,7 +75,7 @@ inline constexpr OUStringLiteral RID_UNDOFORMATNAME = u"Format"; #define RID_XNSUBSETEQY " nsubseteq " #define RID_XNSUPSETY " nsupset " #define RID_XNSUPSETEQY " nsupseteq " -#define RID_FUNCX "func func() " +#define RID_FUNCX "func () " #define RID_ABSX"abs{} " #define RID_FACTX "fact{} " #define RID_SQRTX "sqrt{} "
[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/inc/strings.hrc |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 0c022ac0911fa1cdfcc722c875c8898a9d41d75d Author: dante AuthorDate: Wed Sep 1 20:40:22 2021 +0200 Commit: Mike Kaganski CommitDate: Thu Sep 2 10:18:58 2021 +0200 tdf#144189 Not Precedes (U+2280) and Not Succeeds (U+2281) Change-Id: Id2d619769012a1b26415656e7793a70c6b17c298 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121482 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 963b182c211c..bf73b1b5c614 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -140,7 +140,7 @@ #define RID_LIMSUP_TOX_HELP NC_("RID_LIMSUP_TOX_HELP", "Limit Superior Superscript Top" ) #define RID_LIMSUP_FROMTOX_HELP NC_("RID_LIMSUP_FROMTOX_HELP", "Limit Superior Sup/Sub script" ) #define RID_EXISTS_HELP NC_("RID_EXISTS_HELP", "There Exists" ) -#define RID_NOTEXISTS_HELP NC_("RID_NOTEXISTS_HELP", "There Not Exists" ) +#define RID_NOTEXISTS_HELP NC_("RID_NOTEXISTS_HELP", "There does not exist" ) #define RID_FORALL_HELP NC_("RID_FORALL_HELP", "For all" ) #define RID_INTX_HELP NC_("RID_INTX_HELP", "Integral" ) #define RID_INT_FROMX_HELP NC_("RID_INT_FROMX_HELP", "Integral Subscript Bottom" ) @@ -305,8 +305,8 @@ #define RID_XSUCCEEDSY_HELP NC_("RID_XSUCCEEDSY_HELP", "Succeeds" ) #define RID_XSUCCEEDSEQUALY_HELPNC_("RID_XSUCCEEDSEQUALY_HELP", "Succeeds or equal to" ) #define RID_XSUCCEEDSEQUIVY_HELPNC_("RID_XSUCCEEDSEQUIVY_HELP", "Succeeds or equivalent to" ) -#define RID_XNOTPRECEDESY_HELP NC_("RID_XNOTPRECEDESY_HELP", "Not precedes" ) -#define RID_XNOTSUCCEEDSY_HELP NC_("RID_XNOTSUCCEEDSY_HELP", "Not succeeds" ) +#define RID_XNOTPRECEDESY_HELP NC_("RID_XNOTPRECEDESY_HELP", "Does not precede" ) +#define RID_XNOTSUCCEEDSY_HELP NC_("RID_XNOTSUCCEEDSY_HELP", "Does not succeed" ) #define RID_CATEGORY_UNARY_BINARY_OPERATORS NC_("RID_CATEGORY_UNARY_BINARY_OPERATORS", "Unary/Binary Operators" ) #define RID_CATEGORY_RELATIONS NC_("RID_CATEGORY_RELATIONS", "Relations" ) #define RID_CATEGORY_SET_OPERATIONS NC_("RID_CATEGORY_SET_OPERATIONS", "Set Operations" )
[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/inc/mathml/import.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1e1a317be265a176fdbae171953fa8902a823eb8 Author: Andrea Gelmini AuthorDate: Tue Aug 17 15:58:17 2021 +0200 Commit: Julien Nabet CommitDate: Tue Aug 17 17:37:21 2021 +0200 Fix typo Change-Id: I93062ed58f820a0f88a236c4134ff9adce06006c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120601 Tested-by: Julien Nabet Reviewed-by: Julien Nabet diff --git a/starmath/inc/mathml/import.hxx b/starmath/inc/mathml/import.hxx index 916f929440a8..658d62360c4a 100644 --- a/starmath/inc/mathml/import.hxx +++ b/starmath/inc/mathml/import.hxx @@ -88,7 +88,7 @@ private: size_t m_nSmSyntaxVersion; public: -/** Get's parsed element tree +/** Gets parsed element tree */ SmMlElement* getElementTree() { return m_pElementTree; }
[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/Library_sm.mk starmath/source
starmath/Library_sm.mk |1 starmath/inc/mathml/element.hxx | 62 + starmath/inc/mathml/iterator.hxx| 125 starmath/source/mathml/element.cxx |1 starmath/source/mathml/iterator.cxx | 71 5 files changed, 260 insertions(+) New commits: commit e8d8dad6bba2bd0a4307ee3c1fc40f117680c1f3 Author: dante AuthorDate: Sun Aug 8 23:27:56 2021 +0200 Commit: Noel Grandin CommitDate: Mon Aug 9 17:49:22 2021 +0200 Add an iterator for the new starmath matml elements Change-Id: I7b57951795e8acd704f418d10e5fd0aded3f2b34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120187 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 297cca650684..e9bb53676b91 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -104,6 +104,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/mathml/mathmlexport \ starmath/source/mathml/mathmlimport \ starmath/source/mathml/mathmlMo \ +starmath/source/mathml/iterator \ starmath/source/mathml/attribute \ starmath/source/mathml/element \ starmath/source/mathml/def \ diff --git a/starmath/inc/mathml/element.hxx b/starmath/inc/mathml/element.hxx index 8843d5e8767d..2c5ec40ab019 100644 --- a/starmath/inc/mathml/element.hxx +++ b/starmath/inc/mathml/element.hxx @@ -10,6 +10,7 @@ #pragma once #include "attribute.hxx" +#include "starmathdatabase.hxx" #include #include @@ -27,6 +28,7 @@ public: , m_aAttributePosList(0) , m_aSubElements(0) , m_aParentElement(nullptr) +, m_nSubElementId(0) { SmImplAttributeType(); }; @@ -39,10 +41,26 @@ protected: , m_aESelection(0, 0, 0, 0) , m_aSubElements(0) , m_aParentElement(nullptr) +, m_nSubElementId(0) { SmImplAttributeType(); }; +public: +SmMlElement(const SmMlElement& aElement) +: SmRect(static_cast(aElement)) +, m_aElementType(aElement.getMlElementType()) +, m_aText(aElement.getText()) +, m_aESelection(aElement.getESelectionReference()) +, m_aSubElements(0) +, m_aParentElement(nullptr) +, m_nSubElementId(aElement.getSubElementId()) +{ +m_aAttributePosList = std::vector(aElement.getAttributeCount()); +for (size_t i = 0; i < aElement.getAttributeCount(); ++i) +setAttributeForce(i, aElement.getAttributePointer(i)); +}; + private: // Type of element SmMlElementType m_aElementType; @@ -65,6 +83,9 @@ private: // Parent element SmMlElement* m_aParentElement; +// Child id, so it is possible to iterata +size_t m_nSubElementId; + private: void SmImplAttributeType(); @@ -92,6 +113,12 @@ public: // location in the source */ ESelection getESelection() const { return m_aESelection; }; +/** + * Returns the location in the source code of the node type + * @return selection + */ +const ESelection& getESelectionReference() const { return m_aESelection; }; + /** * Sets the location in the source code of the node type * @param aESelection @@ -147,6 +174,30 @@ public: // attributes */ void setAttribute(const SmMlAttribute* aAttribute); +protected: // attributes +/** + * Get's a given attribute. + * If no available returns empty attribute. + * @param nAttributePos + * @return given attribute. + */ +const SmMlAttribute* getAttributePointer(size_t nAttributePos) const +{ +return nAttributePos < m_aAttributeList.size() ? _aAttributeList[nAttributePos] : nullptr; +} + +/** + * Set's a given attribute. + * If no available undefined behaviour. + * @param nAttributePos + * @param aAttribute + * @return given attribute. + */ +void setAttributeForce(size_t nAttributePos, const SmMlAttribute* aAttribute) +{ +m_aAttributeList[nAttributePos].setMlAttributeValue(aAttribute); +} + public: // sub elements /** * Returns the sub elements count @@ -181,6 +232,17 @@ public: // sub elements */ void setSubElement(size_t nPos, SmMlElement* aElement); +/** + * Get's subelement id + */ +size_t getSubElementId() const { return m_nSubElementId; } + +/** + * Set's subelement id + * @param nSubElementId + */ +void setSubElementId(size_t nSubElementId) { m_nSubElementId = nSubElementId; } + public: // parent elements /** * Returns the parent element diff --git a/starmath/inc/mathml/iterator.hxx b/starmath/inc/mathml/iterator.hxx new file mode 100644 index ..559829ce82f1 --- /dev/null +++ b/starmath/inc/mathml/iterator.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil;
[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/Library_sm.mk starmath/source
starmath/Library_sm.mk |3 starmath/inc/mathml/attribute.hxx| 190 ++ starmath/inc/mathml/def.hxx | 333 + starmath/inc/mathml/element.hxx | 236 ++ starmath/source/mathml/attribute.cxx | 450 +++ starmath/source/mathml/def.cxx | 132 ++ starmath/source/mathml/element.cxx | 134 ++ 7 files changed, 1478 insertions(+) New commits: commit 565bbd2e46e57117eb401344689858c3d749dc5c Author: dante AuthorDate: Tue Mar 16 20:21:51 2021 +0100 Commit: Noel Grandin CommitDate: Wed Apr 21 10:25:26 2021 +0200 Add mathml structures Change-Id: I8324456b9a6775842f39e984c569c068381dc952 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112593 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 89f9f34c59bf..2e3cc035ec5f 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -103,6 +103,9 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/mathml/mathmlexport \ starmath/source/mathml/mathmlimport \ starmath/source/mathml/mathmlMo \ +starmath/source/mathml/attribute \ +starmath/source/mathml/element \ +starmath/source/mathml/def \ starmath/source/mathml/starmathdatabase \ )) diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx new file mode 100644 index ..c30053c9d037 --- /dev/null +++ b/starmath/inc/mathml/attribute.hxx @@ -0,0 +1,190 @@ +/* -*- 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 . + */ + +#pragma once + +#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 + +/* Union for storing the mathml attribute value */ +/*/ + +union SmMlAttributeValue { +SmMlAttributeValue(){}; + +struct SmMlAccent m_aAccent; +struct SmMlDir m_aDir; +struct SmMlDisplaystyle m_aDisplaystyle; +struct SmMlFence m_aFence; +struct SmMlHref m_aHref; +struct SmMlLspace m_aLspace; +struct SmMlMathbackground m_aMathbackground; +struct SmMlMathcolor m_aMathcolor; +struct SmMlMathsize m_aMathsize; +struct SmMlMathvariant m_aMathvariant; +struct SmMlMaxsize m_aMaxsize; +struct SmMlMinsize m_aMinsize; +struct SmMlMovablelimits m_aMovablelimits; +struct SmMlRspace m_aRspace; +struct SmMlSeparator m_aSeparator; +struct SmMlStretchy m_aStretchy; +struct SmMlSymmetric m_aSymmetric; +}; + +/* Class managing the attribute value */ +/*/ + +class SmMlAttribute +{ +private: +SmMlAttributeValueType m_aSmMlAttributeValueType; +SmMlAttributeValue m_aAttributeValue; + +private: +void clearPreviousAttributeValue(); +void setDefaultAttributeValue(); +void setAttributeValue(const SmMlAttribute* aMlAttribute); + +public: +SmMlAttribute() { m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; }; + +virtual ~SmMlAttribute() { clearPreviousAttributeValue(); }; + +SmMlAttribute(SmMlAttributeValueType) +{ +m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; +setDefaultAttributeValue(); +}; + +SmMlAttribute(const SmMlAttribute& aMlAttribute) +{ +m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; +setAttributeValue(); +} + +SmMlAttribute(const SmMlAttribute* aMlAttribute) +{ +m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; +setAttributeValue(aMlAttribute); +} + +public: +/** + * Returns the type of attribute we are dealing with. + * Attribute Value Type + */ +SmMlAttributeValueType getMlAttributeValueType() const { return m_aSmMlAttributeValueType; }; + +/** +
[Libreoffice-commits] core.git: starmath/inc starmath/sdi starmath/source
starmath/inc/starmath.hrc|2 +- starmath/sdi/smath.sdi |2 +- starmath/sdi/smslots.sdi |2 +- starmath/source/document.cxx | 12 ++-- starmath/source/view.cxx |8 5 files changed, 13 insertions(+), 13 deletions(-) New commits: commit de90d47410164a663230f5b881190f10d0269311 Author: Caolán McNamara AuthorDate: Tue Apr 20 13:27:51 2021 +0100 Commit: Caolán McNamara CommitDate: Tue Apr 20 15:56:36 2021 +0200 SID_GAPHIC_SM->SID_GRAPHIC_SM Change-Id: Ie5446fc349778ad6dc50ac5f622ddb45ee18eefa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114335 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index b7733017cfbd..5001b29b0f51 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -40,7 +40,7 @@ #define SID_IMPORT_FORMULA (SID_SMA_START + 58) #define SID_IMPORT_MATHML_CLIPBOARD (SID_SMA_START + 59) #define SID_TEXT(SID_SMA_START + 100) -#define SID_GAPHIC_SM (SID_SMA_START + 101) +#define SID_GRAPHIC_SM (SID_SMA_START + 101) /** Command for inserting a symbol specified by a string (Inserts an SmSpecialNode) */ #define SID_INSERTSPECIAL (SID_SMA_START + 104) /** Command for inserting a math construction */ diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi index 575e464fa944..48045629ecd7 100644 --- a/starmath/sdi/smath.sdi +++ b/starmath/sdi/smath.sdi @@ -197,7 +197,7 @@ SfxVoidItem FormelCursor SID_FORMULACURSOR ] -SfxInt16Item Graphic SID_GAPHIC_SM +SfxInt16Item Graphic SID_GRAPHIC_SM [ AutoUpdate = FALSE, diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi index dee2a14b19b2..47468ce5f11d 100644 --- a/starmath/sdi/smslots.sdi +++ b/starmath/sdi/smslots.sdi @@ -107,7 +107,7 @@ interface FormulaDocument StateMethod = GetState ; ] //idlpp no menu entry, so no texts -SID_GAPHIC_SM //idlpp ole : no , status : no +SID_GRAPHIC_SM //idlpp ole : no , status : no [ ExecMethod = Execute ; StateMethod = GetState ; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 0b908d00fc76..c3faff24b8d1 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -123,7 +123,7 @@ void SmDocShell::Notify(SfxBroadcaster&, const SfxHint& rHint) { SetFormulaArranged(false); -mnModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState +mnModifyCount++; //! see comment for SID_GRAPHIC_SM in SmDocShell::GetState Repaint(); } @@ -203,14 +203,14 @@ void SmDocShell::SetFormat(SmFormat const & rFormat) SetFormulaArranged( false ); SetModified(); -mnModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState +mnModifyCount++; //! see comment for SID_GRAPHIC_SM in SmDocShell::GetState // don't use SmGetActiveView since the view shell might not be active (0 pointer) // if for example the Basic Macro dialog currently has the focus. Thus: SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); while (pFrm) { -pFrm->GetBindings().Invalidate(SID_GAPHIC_SM); +pFrm->GetBindings().Invalidate(SID_GRAPHIC_SM); pFrm = SfxViewFrame::GetNext( *pFrm, this ); } } @@ -236,7 +236,7 @@ void SmDocShell::Parse() mpTree.reset(); ReplaceBadChars(); mpTree = maParser->Parse(maText); -mnModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState +mnModifyCount++; //! see comment for SID_GRAPHIC_SM in SmDocShell::GetState SetFormulaArranged( false ); InvalidateCursor(); maUsedSymbols = maParser->GetUsedSymbols(); @@ -1144,12 +1144,12 @@ void SmDocShell::GetState(SfxItemSet ) rSet.Put(SfxStringItem(SID_TEXT, GetText())); break; -case SID_GAPHIC_SM: +case SID_GRAPHIC_SM: //! very old (pre UNO) and ugly hack to invalidate the SmGraphicWindow. //! If mnModifyCount gets changed then the call below will implicitly notify //! SmGraphicController::StateChanged and there the window gets invalidated. //! Thus all the 'mnModifyCount++' before invalidating this slot. -rSet.Put(SfxInt16Item(SID_GAPHIC_SM, mnModifyCount)); +rSet.Put(SfxInt16Item(SID_GRAPHIC_SM, mnModifyCount)); break; case SID_UNDO: diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 3a177f6276cb..73b52e9c2750 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1346,7 +1346,7 @@ void SmViewShell::Insert( SfxMedium& rMedium ) pDoc->SetModified(); SfxBindings = GetViewFrame()->GetBindings(); -rBnd.Invalidate(SID_GAPHIC_SM); +rBnd.Invalidate(SID_GRAPHIC_SM); rBnd.Invalidate(SID_TEXT); } @@
[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/inc/nodetype.hxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 7246c1b4971e780be8d027de5171f42cc0749c16 Author: Andrea Gelmini AuthorDate: Mon Mar 15 13:33:46 2021 +0100 Commit: Julien Nabet CommitDate: Mon Mar 15 17:11:02 2021 +0100 Fix typos Change-Id: I1e962f882f0c1fbf6c919f2c9a97242eac9d69c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112508 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/starmath/inc/nodetype.hxx b/starmath/inc/nodetype.hxx index f59e02895d4f..f0bf28cece67 100644 --- a/starmath/inc/nodetype.hxx +++ b/starmath/inc/nodetype.hxx @@ -44,12 +44,12 @@ enum class SmNodeType : int_fast16_t Math, // operator value Blank, // ~ Error, // Syntax error -Line, // a line of math untill newline +Line, // a line of math until newline Expression, // { content in here } PolyLine, // ^ Root, // root node RootSymbol, // 3 of cubic root -Rectangle, //just structual +Rectangle, //just structural VerticalBrace, // vertical {} MathIdent // identities and variables }; ___ 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 | 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/qa starmath/source
starmath/inc/parse5.hxx | 12 +-- starmath/qa/cppunit/test_cursor.cxx |8 +- starmath/qa/cppunit/test_node.cxx |2 starmath/qa/cppunit/test_nodetotextvisitors.cxx | 20 ++--- starmath/qa/cppunit/test_parse.cxx |4 - starmath/source/cursor.cxx |2 starmath/source/parse.cxx |4 - starmath/source/parse5.cxx | 88 8 files changed, 70 insertions(+), 70 deletions(-) New commits: commit 2dc105d9742814f9627d91232a47913ee105b103 Author: dante AuthorDate: Mon Mar 8 17:35:42 2021 +0100 Commit: Noel Grandin CommitDate: Tue Mar 9 17:47:12 2021 +0100 Rename SmParser to SmParser5 Change-Id: I6983dd4c187fc7114546e87c66dc2c011fccd3e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112176 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse5.hxx b/starmath/inc/parse5.hxx index 053202a56d10..1d312351fb36 100644 --- a/starmath/inc/parse5.hxx +++ b/starmath/inc/parse5.hxx @@ -25,7 +25,7 @@ #include "parsebase.hxx" -class SmParser : public AbstractSmParser +class SmParser5 : public AbstractSmParser { OUString m_aBufferString; SmToken m_aCurToken; @@ -45,8 +45,8 @@ class SmParser : public AbstractSmParser // pointer to System locale's CharClass, which is alive inside SM_MOD() const CharClass* m_pSysCC; -SmParser(const SmParser&) = delete; -SmParser& operator=(const SmParser&) = delete; +SmParser5(const SmParser5&) = delete; +SmParser5& operator=(const SmParser5&) = delete; // Moves between tokens inside starmath code. void NextToken(); @@ -94,8 +94,8 @@ class SmParser : public AbstractSmParser // end of grammar public: -SmParser(); -virtual ~SmParser(); +SmParser5(); +virtual ~SmParser5(); /** Parse rBuffer to formula tree */ std::unique_ptr Parse(const OUString& rBuffer); @@ -115,6 +115,6 @@ public: const std::set& GetUsedSymbols() const { return m_aUsedSymbols; } }; -inline bool SmParser::TokenInGroup(TG nGroup) { return bool(m_aCurToken.nGroup & nGroup); } +inline bool SmParser5::TokenInGroup(TG nGroup) { return bool(m_aCurToken.nGroup & nGroup); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index 720a885be3a3..1d5e5fad6d04 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -67,7 +67,7 @@ void Test::tearDown() void Test::testCopyPaste() { -auto xTree = SmParser().Parse("a * b + c"); +auto xTree = SmParser5().Parse("a * b + c"); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -89,7 +89,7 @@ void Test::testCopyPaste() void Test::testCopySelectPaste() { -auto xTree = SmParser().Parse("a * b + c"); +auto xTree = SmParser5().Parse("a * b + c"); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -115,7 +115,7 @@ void Test::testCopySelectPaste() void Test::testCutPaste() { -auto xTree = SmParser().Parse("a * b + c"); +auto xTree = SmParser5().Parse("a * b + c"); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -137,7 +137,7 @@ void Test::testCutPaste() void Test::testCutSelectPaste() { -auto xTree = SmParser().Parse("a * b + c"); +auto xTree = SmParser5().Parse("a * b + c"); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx index e543ac04027c..c51b86759879 100644 --- a/starmath/qa/cppunit/test_node.cxx +++ b/starmath/qa/cppunit/test_node.cxx @@ -64,7 +64,7 @@ void NodeTest::tearDown() void NodeTest::testTdf47813() { -SmParser aParser; +SmParser5 aParser; #define MATRIX "matrix {-2#33##4#-5##6,0#7}" auto pNodeA = aParser.Parse(MATRIX); auto pNodeC = aParser.Parse("alignc " MATRIX); diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 70cc01512f92..5d1694197b30 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -442,12 +442,12 @@ void Test::parseandparseagain(const char* formula, const char* test_name) // parse 1 OUString input = OUString::createFromAscii(formula); -auto pNode1 = SmParser().ParseExpression(input); +auto pNode1 = SmParser5().ParseExpression(input); pNode1->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmNodeToTextVisitor(pNode1.get(), output1); // parse 2 -auto pNode2 = SmParser().ParseExpression(output1); +auto pNode2 =
[Libreoffice-commits] core.git: starmath/inc
starmath/inc/token.hxx |1 - 1 file changed, 1 deletion(-) New commits: commit db2e9619397f1e53232824a649b5ad0ba3dd368a Author: dante AuthorDate: Sun Mar 7 12:07:02 2021 +0100 Commit: Noel Grandin CommitDate: Mon Mar 8 13:08:18 2021 +0100 Remove unused include Change-Id: I1b1a94be7e68f58f8915cd8c970a223877130c75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112126 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index ef405a45c2b4..8555d745fc72 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -29,7 +29,6 @@ #pragma once #include "types.hxx" -#include #include #include #include ___ 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/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/qa starmath/source
starmath/inc/document.hxx |7 ++ starmath/qa/cppunit/test_starmath.cxx | 34 starmath/source/document.cxx| 11 -- starmath/source/mathml/mathmlexport.cxx | 12 +-- starmath/source/mathml/mathmlimport.cxx | 12 +-- starmath/source/view.cxx|6 ++--- 6 files changed, 44 insertions(+), 38 deletions(-) New commits: commit c1659be6ff0e0c91e0c7d1e6acb6ab18821e2bf7 Author: dante AuthorDate: Sat Feb 27 18:49:19 2021 +0100 Commit: Noel Grandin CommitDate: Tue Mar 2 07:17:32 2021 +0100 Starmath now allows multiple parsers third part Allows SmDocShell to choose parser Change-Id: I36e7563943690ffe3bf031438061b302b7439258 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111684 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 17f0713a63ce..c7885c027019 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -77,7 +77,6 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener OUStringmaText; SmFormatmaFormat; -SmParsermaParser; OUStringmaAccText; SvtLinguOptions maLinguOptions; std::unique_ptr mpTree; @@ -88,6 +87,7 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener sal_uInt16 mnModifyCount; boolmbFormulaArranged; sal_uInt16 mnSmSyntaxVersion; +std::unique_ptr maParser; std::unique_ptr mpCursor; std::set< OUString >maUsedSymbols; // to export used symbols only when saving @@ -166,12 +166,11 @@ public: const SmFormat& GetFormat() const { return maFormat; } voidParse(); -SmParser & GetParser() { return maParser; } +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) -{ mnSmSyntaxVersion = nSmSyntaxVersion; } +voidSetSmSyntaxVersion(sal_uInt16 nSmSyntaxVersion); const std::set< OUString > &GetUsedSymbols() const { return maUsedSymbols; } diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 480796aaddd4..37bc23489a55 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -234,28 +234,28 @@ void Test::editFailure() { m_xDocShRef->SetText("color a b over {a/}"); -const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError(); +const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::ColorExpected", pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a SmParseError::ColorExpected", SmParseError::ColorExpected, pErrorDesc->m_eType); -pErrorDesc = m_xDocShRef->GetParser().PrevError(); +pErrorDesc = m_xDocShRef->GetParser()->PrevError(); CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::UnexpectedChar", pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a SmParseError::UnexpectedChar", SmParseError::UnexpectedChar, pErrorDesc->m_eType); -pErrorDesc = m_xDocShRef->GetParser().PrevError(); +pErrorDesc = m_xDocShRef->GetParser()->PrevError(); CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::RgroupExpected", pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a SmParseError::RgroupExpected", SmParseError::RgroupExpected, pErrorDesc->m_eType); -const SmErrorDesc *pLastErrorDesc = m_xDocShRef->GetParser().PrevError(); +const SmErrorDesc *pLastErrorDesc = m_xDocShRef->GetParser()->PrevError(); CPPUNIT_ASSERT_MESSAGE("Should be three syntax errors", pLastErrorDesc); @@ -266,7 +266,7 @@ void Test::editFailure() void Test::ParseErrorUnexpectedToken() { m_xDocShRef->SetText("\\foo"); -const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError(); +const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::UnexpectedToken expected", SmParseError::UnexpectedToken, pErrorDesc->m_eType); @@ -275,7 +275,7 @@ void Test::ParseErrorUnexpectedToken() void Test::ParseErrorPoundExpected() { m_xDocShRef->SetText("matrix {1#2##a##b#c}"); -const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError(); +const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc);
[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/Library_sm.mk starmath/source
starmath/Library_sm.mk|1 starmath/inc/parse.hxx|9 starmath/source/parse.cxx | 51 ++ 3 files changed, 61 insertions(+) New commits: commit f89e85f8bbccfa72ba9b4ad2ca31a8debcee Author: dante AuthorDate: Sat Feb 27 18:36:52 2021 +0100 Commit: Noel Grandin CommitDate: Sat Feb 27 20:36:49 2021 +0100 Introduce the abstractsmparser getter methods Change-Id: Id8dee76aa7dfa7355f79fab9afb9471b2ec4575c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111686 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index ece71cc8d143..89f9f34c59bf 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -81,6 +81,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/ooxmlimport \ starmath/source/rtfexport \ starmath/source/parsebase \ +starmath/source/parse \ starmath/source/parse5 \ starmath/source/rect \ starmath/source/scrwin \ diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index d033faa2bf06..9896eaa871fb 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -26,6 +26,15 @@ #include "parse5.hxx" +namespace starmathdatabase +{ + +AbstractSmParser* GetDefaultSmParser(); + +AbstractSmParser* GetVersionSmParser(sal_uInt16 nVersion); + +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx new file mode 100644 index ..3ea272faef6b --- /dev/null +++ b/starmath/source/parse.cxx @@ -0,0 +1,51 @@ +/* -*- 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 . + */ + +#include +#include +#include + +AbstractSmParser* starmathdatabase::GetDefaultSmParser() +{ +switch(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion()) +{ +case 5: +{ +AbstractSmParser* aParser = new SmParser(); +return aParser; +} +default: +throw std::range_error("parser depth limit"); +} +} + +AbstractSmParser* starmathdatabase::GetVersionSmParser(sal_uInt16 nVersion) +{ +switch(nVersion) +{ +case 5: +{ +AbstractSmParser* aParser = new SmParser(); +return aParser; +} +default: +throw std::range_error("parser depth limit"); +} +} +/* 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/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/Library_sm.mk starmath/source
starmath/Library_sm.mk |2 starmath/inc/parse.hxx | 181 -- starmath/inc/parse5.hxx| 123 ++ starmath/inc/parsebase.hxx | 122 ++ starmath/source/parse.cxx | 2683 starmath/source/parse5.cxx | 2739 + 6 files changed, 2986 insertions(+), 2864 deletions(-) New commits: commit 1d529ad0bd59cbbf029e45a715db5db87541d5c1 Author: dante AuthorDate: Fri Feb 19 20:52:30 2021 +0100 Commit: Noel Grandin CommitDate: Wed Feb 24 09:19:05 2021 +0100 Starmath now allows multiple parsers second part Uses AbstractSmParser as base for SmParser Renames parse._xx as parse5._xx rename of parse._xx is not recognized, so clang-formated New parse.hxx as a future mean to get the parser. Change-Id: I122c1fda0144a24316948fcc125e60ed1a130bcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111243 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 1ccbf48896f7..77fd47d1bfed 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -80,7 +80,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/ooxmlexport \ starmath/source/ooxmlimport \ starmath/source/rtfexport \ -starmath/source/parse \ +starmath/source/parse5 \ starmath/source/rect \ starmath/source/scrwin \ starmath/source/smdll \ diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 752cde6b23e5..d033faa2bf06 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -24,186 +24,7 @@ #ifndef INCLUDED_STARMATH_INC_PARSE_HXX #define INCLUDED_STARMATH_INC_PARSE_HXX -#include -#include -#include -#include - -#include "token.hxx" - -class SmBlankNode; -class SmBinVerNode; -class SmBracebodyNode; -class SmExpressionNode; -class SmGlyphSpecialNode; -class SmNode; -class SmOperNode; -class SmSpecialNode; -class SmStructureNode; -class SmTableNode; -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; -SmToken m_aCurToken; -std::vector m_aErrDescList; -int m_nCurError; -sal_Int32 m_nBufferIndex, -m_nTokenIndex; -sal_Int32 m_nRow,// 1-based -m_nColOff; // 0-based -boolm_bImportSymNames, -m_bExportSymNames; -sal_Int32 m_nParseDepth; - -class DepthProtect -{ -private: -sal_Int32& m_rParseDepth; -public: -DepthProtect(sal_Int32& rParseDepth) -: m_rParseDepth(rParseDepth) -{ -++m_rParseDepth; -if(m_rParseDepth > DEPTH_LIMIT) -throw std::range_error("parser depth limit"); -} -~DepthProtect() -{ ---m_rParseDepth; -} -}; - -// map of used symbols (used to reduce file size by exporting only actually used symbols) -std::set< OUString > m_aUsedSymbols; - -// CharClass representing a locale for parsing numbers -CharClass m_aNumCC; -// pointer to System locale's CharClass, which is alive inside SM_MOD() -const CharClass* m_pSysCC; - -SmParser(const SmParser&) = delete; -SmParser& operator=(const SmParser&) = delete; - -// Moves between tokens inside starmath code. -voidNextToken(); -voidNextTokenColor(SmTokenType dvipload); -voidNextTokenFontSize(); -sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } -voidReplace( sal_Int32 nPos, sal_Int32 nLen, const OUString ); - -inline bool TokenInGroup( TG nGroup ); - -// grammar -std::unique_ptr DoTable(); -std::unique_ptr DoLine(); -std::unique_ptr DoExpression(bool bUseExtraSpaces = true); -std::unique_ptr DoRelation(); -std::unique_ptr DoSum(); -std::unique_ptr DoProduct(); -std::unique_ptr DoSubSup(TG nActiveGroup,
[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/inc/action.hxx |5 + 1 file changed, 1 insertion(+), 4 deletions(-) New commits: commit 1e195878066f49bd78765e9a05081c496b770525 Author: ViKrAm-Baisclear AuthorDate: Mon Jan 11 15:05:50 2021 +0530 Commit: Ilmari Lauhakangas CommitDate: Sun Feb 7 12:44:12 2021 +0100 tdf#124176 used pragma once instead of include guards Change-Id: Idf57df70ac895915959e8d35e493c0e8b8db137f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109080 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas diff --git a/starmath/inc/action.hxx b/starmath/inc/action.hxx index 8f98d12cf2a4..d1d61f8b17b2 100644 --- a/starmath/inc/action.hxx +++ b/starmath/inc/action.hxx @@ -16,8 +16,7 @@ * 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_ACTION_HXX -#define INCLUDED_STARMATH_INC_ACTION_HXX +#pragma once #include #include "format.hxx" @@ -39,6 +38,4 @@ public: virtual OUString GetComment() const override; }; -#endif - /* 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/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/qa starmath/source
starmath/inc/node.hxx | 18 +- starmath/inc/parse.hxx |4 ++-- starmath/inc/visitors.hxx | 12 ++-- starmath/qa/cppunit/mock-visitor.hxx|6 +++--- starmath/source/mathml/mathmlexport.cxx |2 +- starmath/source/mathml/mathmlimport.cxx |4 ++-- starmath/source/mathtype.cxx|2 +- starmath/source/node.cxx| 28 ++-- starmath/source/ooxmlexport.cxx |2 +- starmath/source/ooxmlexport.hxx |2 +- starmath/source/parse.cxx |8 starmath/source/rtfexport.cxx |2 +- starmath/source/rtfexport.hxx |2 +- starmath/source/visitors.cxx| 18 +- starmath/source/wordexportbase.cxx |4 ++-- starmath/source/wordexportbase.hxx |4 ++-- 16 files changed, 59 insertions(+), 59 deletions(-) New commits: commit e3ea88c6db5facde01ad0c46d8f9393c4db08c5c Author: Andrea Gelmini AuthorDate: Thu Feb 4 10:16:38 2021 +0100 Commit: Andrea Gelmini CommitDate: Thu Feb 4 17:11:57 2021 +0100 Fix typo in code Here it passed "make build-nocheck" on Linux Change-Id: I1f6ea440e54f87a90abb1b6e9983443764516e06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110373 Reviewed-by: Julien Nabet Reviewed-by: Dante DM Reviewed-by: Andrea Gelmini Tested-by: Jenkins diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index d0b81737a31d..3c267bb4a9ad 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -40,7 +40,7 @@ * SmVerticalBraceNode overbrace; underbrace; * SmOperNode sum from to; int from to; * SmAlignNode text alignment - * SmAttributNode font attributes; bold; + * SmAttributeNode font attributes; bold; * SmFontNode font serif; ... * SmMatrixNodematrix * SmVisibleNode drawable node @@ -127,7 +127,7 @@ enum class SmScaleMode enum class SmNodeType { /* 0*/ Table, Brace, Bracebody, Oper,Align, -/* 5*/ Attribut,Font, UnHor, BinHor, BinVer, +/* 5*/ Attribute, Font, UnHor, BinHor, BinVer, /*10*/ BinDiagonal, SubSup,Matrix,Place, Text, /*15*/ Special, GlyphSpecial, Math, Blank, Error, /*20*/ Line,Expression,PolyLine, Root,RootSymbol, @@ -225,7 +225,7 @@ public: * @param nAttrib * @return */ -void SetAttribut(FontAttribute nAttrib); +void SetAttribute(FontAttribute nAttrib); /** * Clears the font attribute nAttrib. @@ -233,7 +233,7 @@ public: * @param nAttrib * @return */ -void ClearAttribut(FontAttribute nAttrib); +void ClearAttribute(FontAttribute nAttrib); /** * Gets the font. @@ -1902,11 +1902,11 @@ public: * 1: Body * None of these may be NULL. */ -class SmAttributNode final : public SmStructureNode +class SmAttributeNode final : public SmStructureNode { public: -explicit SmAttributNode(const SmToken ) -: SmStructureNode(SmNodeType::Attribut, rNodeToken, 2) {} +explicit SmAttributeNode(const SmToken ) +: SmStructureNode(SmNodeType::Attribute, rNodeToken, 2) {} /** * Prepares the SmRect to render. @@ -1928,14 +1928,14 @@ public: * Gets the attribute data. * @return attribute data */ -const SmNode* Attribute() const { return const_cast(this)->Attribute(); } +const SmNode* Attribute() const { return const_cast(this)->Attribute(); } SmNode* Attribute() { assert( GetNumSubNodes() == 2 ); return GetSubNode( 0 ); } /** * Gets the body data ( the nodes affected by the attribute ). * @return body data */ -const SmNode* Body() const { return const_cast(this)->Body(); } +const SmNode* Body() const { return const_cast(this)->Body(); } SmNode* Body() { assert( GetNumSubNodes() == 2 ); return GetSubNode( 1 ); } }; diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index dde0c3454958..b010db941832 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -115,8 +115,8 @@ class SmParser std::unique_ptr DoOper(); std::unique_ptr DoUnOper(); std::unique_ptr DoAlign(bool bUseExtraSpaces = true); -std::unique_ptr DoFontAttribut(); -std::unique_ptr DoAttribut(); +std::unique_ptr DoFontAttribute(); +std::unique_ptr DoAttribute(); std::unique_ptr DoFont(); std::unique_ptr DoFontSize(); std::unique_ptr DoColor(); diff --git a/starmath/inc/visitors.hxx
[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/Library_sm.mk starmath/mathml starmath/source
starmath/Library_sm.mk | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit e32075d09e1407cebe0f2247868294d5eb4583f4 Author: dante AuthorDate: Tue Jan 19 13:01:58 2021 +0100 Commit: Noel Grandin CommitDate: Fri Jan 22 13:47:40 2021 +0100 Relocate mathml Change-Id: I0eb512980261629827b411ab3009b48c1fe6075c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109629 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 88d33465ceaa..1ccbf48896f7 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -17,7 +17,7 @@ $(eval $(call gb_Library_set_precompiled_header,sm,starmath/inc/pch/precompiled_ $(eval $(call gb_Library_set_include,sm,\ -I$(SRCDIR)/starmath/inc \ --I$(SRCDIR)/starmath/mathml/inc \ +-I$(SRCDIR)/starmath/inc/mathml \ -I$(WORKDIR)/SdiTarget/starmath/sdi \ $$(INCLUDE) \ )) @@ -96,12 +96,12 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/view \ starmath/source/visitors \ starmath/source/wordexportbase \ -starmath/mathml/source/xparsmlbase \ -starmath/mathml/source/mathmlattr \ -starmath/mathml/source/mathmlexport \ -starmath/mathml/source/mathmlimport \ -starmath/mathml/source/mathmlMo \ -starmath/mathml/source/starmathdatabase \ +starmath/source/mathml/xparsmlbase \ +starmath/source/mathml/mathmlattr \ +starmath/source/mathml/mathmlexport \ +starmath/source/mathml/mathmlimport \ +starmath/source/mathml/mathmlMo \ +starmath/source/mathml/starmathdatabase \ )) diff --git a/starmath/mathml/inc/mathmlMo.hxx b/starmath/inc/mathml/mathmlMo.hxx similarity index 100% rename from starmath/mathml/inc/mathmlMo.hxx rename to starmath/inc/mathml/mathmlMo.hxx diff --git a/starmath/mathml/inc/mathmlattr.hxx b/starmath/inc/mathml/mathmlattr.hxx similarity index 100% rename from starmath/mathml/inc/mathmlattr.hxx rename to starmath/inc/mathml/mathmlattr.hxx diff --git a/starmath/mathml/inc/mathmlexport.hxx b/starmath/inc/mathml/mathmlexport.hxx similarity index 100% rename from starmath/mathml/inc/mathmlexport.hxx rename to starmath/inc/mathml/mathmlexport.hxx diff --git a/starmath/mathml/inc/mathmlimport.hxx b/starmath/inc/mathml/mathmlimport.hxx similarity index 100% rename from starmath/mathml/inc/mathmlimport.hxx rename to starmath/inc/mathml/mathmlimport.hxx diff --git a/starmath/mathml/inc/starmathdatabase.hxx b/starmath/inc/mathml/starmathdatabase.hxx similarity index 100% rename from starmath/mathml/inc/starmathdatabase.hxx rename to starmath/inc/mathml/starmathdatabase.hxx diff --git a/starmath/mathml/inc/xparsmlbase.hxx b/starmath/inc/mathml/xparsmlbase.hxx similarity index 100% rename from starmath/mathml/inc/xparsmlbase.hxx rename to starmath/inc/mathml/xparsmlbase.hxx diff --git a/starmath/mathml/source/mathmlMo.cxx b/starmath/source/mathml/mathmlMo.cxx similarity index 100% rename from starmath/mathml/source/mathmlMo.cxx rename to starmath/source/mathml/mathmlMo.cxx diff --git a/starmath/mathml/source/mathmlattr.cxx b/starmath/source/mathml/mathmlattr.cxx similarity index 100% rename from starmath/mathml/source/mathmlattr.cxx rename to starmath/source/mathml/mathmlattr.cxx diff --git a/starmath/mathml/source/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx similarity index 100% rename from starmath/mathml/source/mathmlexport.cxx rename to starmath/source/mathml/mathmlexport.cxx diff --git a/starmath/mathml/source/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx similarity index 100% rename from starmath/mathml/source/mathmlimport.cxx rename to starmath/source/mathml/mathmlimport.cxx diff --git a/starmath/mathml/source/starmathdatabase.cxx b/starmath/source/mathml/starmathdatabase.cxx similarity index 100% rename from starmath/mathml/source/starmathdatabase.cxx rename to starmath/source/mathml/starmathdatabase.cxx diff --git a/starmath/mathml/source/xparsmlbase.cxx b/starmath/source/mathml/xparsmlbase.cxx similarity index 100% rename from starmath/mathml/source/xparsmlbase.cxx rename to starmath/source/mathml/xparsmlbase.cxx ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc
starmath/inc/starmathdatabase.hxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 0498cc5a1b6f3fef7214553f3e61443238e49f56 Author: Caolán McNamara AuthorDate: Thu Dec 3 08:48:47 2020 + Commit: Caolán McNamara CommitDate: Thu Dec 3 10:59:29 2020 +0100 add a header guard Change-Id: I7be5558b834366c7a0cc96bcf20d811d176990e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107143 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/starmath/inc/starmathdatabase.hxx b/starmath/inc/starmathdatabase.hxx index 7841810aeb08..2828ecfd8a98 100644 --- a/starmath/inc/starmathdatabase.hxx +++ b/starmath/inc/starmathdatabase.hxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#pragma once + #include "token.hxx" // Starmath color types ___ 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 |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/inc/strings.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit db9e6d0788aec2090385861f8e54e2b1855df87d Author: Andrea Gelmini AuthorDate: Sun Nov 22 09:27:06 2020 +0100 Commit: Julien Nabet CommitDate: Sun Nov 22 10:52:27 2020 +0100 Fix typo in code Change-Id: I974cabe235a91080c4bbce95672d07041dec6d97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106336 Reviewed-by: Dante DM Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index 15b41ec03dab..22ed16a254d8 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -199,7 +199,7 @@ #define RID_COLORX_HEX "color hex 00 {} " #define RID_COLORX_CORAL"color coral {} " #define RID_COLORX_CRIMSON "color crimson {} " -#define RID_COLORX_MIDNIGHT "color mignightblue {} " +#define RID_COLORX_MIDNIGHT "color midnightblue {} " #define RID_COLORX_VIOLET "color violet {} " #define RID_COLORX_ORANGE "color orange {} " #define RID_COLORX_ORANGERED"color orangered {} " ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc
starmath/inc/starmathdatabase.hxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 3b86ce77e1400ba2024a5c6661b68ede669416d5 Author: Julien Nabet AuthorDate: Sun Nov 22 09:27:25 2020 +0100 Commit: Julien Nabet CommitDate: Sun Nov 22 10:00:08 2020 +0100 Typo apropiate->appropriate (starmath) Change-Id: I2c767c41bc321115023af38238df15d30f512a40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106338 Reviewed-by: Julien Nabet Tested-by: Andrea Gelmini diff --git a/starmath/inc/starmathdatabase.hxx b/starmath/inc/starmathdatabase.hxx index 87e1f7cbbf2b..fcd0f6cd8c06 100644 --- a/starmath/inc/starmathdatabase.hxx +++ b/starmath/inc/starmathdatabase.hxx @@ -207,7 +207,7 @@ extern const SmColorTokenTableEntry aColorTokenTableDVIPSNAMES[5]; * Identifies from char cChar * * While loading MO or MI elements might find an unicode16 symbol. - * This code allows to generate apropiate token for them. + * This code allows to generate appropriate token for them. * * @param cChar * @return closing fences' token @@ -219,7 +219,7 @@ SmToken Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar, bool bIsStretchy = * Identifies from char cChar * * While loading MO fenced elements might find braces symbols. - * This code allows to generate apropiate token for them. + * This code allows to generate appropriate token for them. * * @param cChar * @return closing fences' token @@ -231,7 +231,7 @@ SmToken Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode cChar); * Identifies from char cChar * * While loading MO elements ( with prefix value for form attribute ) might find braces symbols. - * This code allows to generate apropiate token for them. + * This code allows to generate appropriate token for them. * * @param cChar * @return closing fences' token @@ -243,7 +243,7 @@ SmToken Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar); * Identifies from char cChar * * While loading MO elements ( with postfix value for form attribute ) might find braces symbols. - * This code allows to generate apropiate token for them. + * This code allows to generate appropriate token for them. * * @param cChar * @return closing fences' token ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: starmath/inc
starmath/inc/starmathdatabase.hxx | 31 +++ 1 file changed, 31 insertions(+) New commits: commit 119b8e1d6b54137b3028ce58e62c1d2beb659dc3 Author: dante AuthorDate: Fri Nov 20 12:52:52 2020 +0100 Commit: Noel Grandin CommitDate: Sat Nov 21 13:52:24 2020 +0100 Added documentation on starmathdatabase. Clarify what are the databses used for. Change-Id: If9f294a5e3f94510efba7db15d1516527c17ba00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106226 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/starmathdatabase.hxx b/starmath/inc/starmathdatabase.hxx index 06ec3438357f..87e1f7cbbf2b 100644 --- a/starmath/inc/starmathdatabase.hxx +++ b/starmath/inc/starmathdatabase.hxx @@ -205,6 +205,10 @@ extern const SmColorTokenTableEntry aColorTokenTableDVIPSNAMES[5]; /** * Identifies operator chars tokens for importing mathml. * Identifies from char cChar + * + * While loading MO or MI elements might find an unicode16 symbol. + * This code allows to generate apropiate token for them. + * * @param cChar * @return closing fences' token */ @@ -213,6 +217,10 @@ SmToken Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar, bool bIsStretchy = /** * Identifies opening / closing brace tokens for importing mathml. * Identifies from char cChar + * + * While loading MO fenced elements might find braces symbols. + * This code allows to generate apropiate token for them. + * * @param cChar * @return closing fences' token */ @@ -221,6 +229,10 @@ SmToken Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode cChar); /** * Identifies opening brace tokens for importing mathml. * Identifies from char cChar + * + * While loading MO elements ( with prefix value for form attribute ) might find braces symbols. + * This code allows to generate apropiate token for them. + * * @param cChar * @return closing fences' token */ @@ -229,6 +241,10 @@ SmToken Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar); /** * Identifies closing brace tokens for importing mathml. * Identifies from char cChar + * + * While loading MO elements ( with postfix value for form attribute ) might find braces symbols. + * This code allows to generate apropiate token for them. + * * @param cChar * @return closing fences' token */ @@ -237,6 +253,10 @@ SmToken Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar); /** * Identifies color from color code cColor. * It will be returned with the parser syntax. + * + * For a given color returns the way it would be in the parser. + * Used for nodes to text visitors. + * * @param cColor * @param parser color */ @@ -273,6 +293,9 @@ std::unique_ptr Identify_Color_DVIPSNAMES(sal_uInt32 cCo /** * Identifies color from color name. * It will be returned with the parser syntax. + * + * This finds color values for the color names loaded by the parser. + * * @param cColor * @param parser color */ @@ -281,6 +304,11 @@ std::unique_ptr Identify_ColorName_Parser(const OUString /** * Identifies color from color name. * It will be returned with the HTML syntax. + * + * This finds color values for the color names loaded by mathmlimport. + * In theory mathml only supports HTML4 colors, but most browsers support all HTML5 colors. + * Thats why there is a hight risk of finding them inside mathml and have to give support. + * * @param cColor * @param parser color */ @@ -289,6 +317,9 @@ std::unique_ptr Identify_ColorName_HTML(const OUString& /** * Identifies color from color name. * It will be returned with the dvipsnames syntax. + * + * This code has been implemented to add a compatibility layer to import / export latex. + * * @param cColor * @param parser 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/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/qa starmath/source
starmath/inc/parse.hxx|2 starmath/inc/starmathdatabase.hxx | 137 +++ starmath/inc/strings.hrc | 22 + starmath/inc/strings.hxx | 551 +++--- starmath/inc/token.hxx|2 starmath/qa/extras/mmlimport-test.cxx |2 starmath/source/ElementsDockingWindow.cxx | 31 + starmath/source/mathmlimport.cxx |4 starmath/source/parse.cxx | 12 starmath/source/starmathdatabase.cxx | 319 +++-- starmath/source/visitors.cxx | 25 - 11 files changed, 779 insertions(+), 328 deletions(-) New commits: commit 0643dab6819bdf248321d27f6b58a2cce125e51c Author: dante AuthorDate: Sun Nov 15 10:11:16 2020 +0100 Commit: Noel Grandin CommitDate: Tue Nov 17 13:58:13 2020 +0100 Starmath has now full support of HTML colors. Some of them have been added to the UI ( from Css3 ). There was not a criteria for color picking so I chose those whose name told me something, those I liked and some to have a more complete palette. It would be nice to be able to ask our users whose colors from https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_Keywords they want in the UI. The color names have been left in alphabetical order. Starmathdatabse has clang format. Change-Id: I6ac1bdbc9e3ed10bff75a99b90bf92d3dcdcabcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105892 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 020d22fb37b4..d7db4772e81c 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -89,7 +89,7 @@ class SmParser // Moves between tokens inside starmath code. voidNextToken(); -voidNextTokenColor(); +voidNextTokenColor(bool dvipload); voidNextTokenFontSize(); sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } voidReplace( sal_Int32 nPos, sal_Int32 nLen, const OUString ); diff --git a/starmath/inc/starmathdatabase.hxx b/starmath/inc/starmathdatabase.hxx index 31e7f4651285..10e177493e68 100644 --- a/starmath/inc/starmathdatabase.hxx +++ b/starmath/inc/starmathdatabase.hxx @@ -43,9 +43,138 @@ constexpr Color COL_SM_BLUE(0xFF); constexpr Color COL_SM_TEAL(0x008080); constexpr Color COL_SM_AQUA(0x00); /* CSS Level 2 */ -// TODO +constexpr Color COL_SM_ORANGE(0xFFA500); /* CSS Level 3 */ -// TODO +constexpr Color COL_SM_ALICEBLUE(0xF0F8FF); +constexpr Color COL_SM_ANTIQUEWHITE(0xFAEBD7); +constexpr Color COL_SM_AQUAMARINE(0x7FFFD4); +constexpr Color COL_SM_AZURE(0xF0); +constexpr Color COL_SM_BEIGE(0xF5F5DC); +constexpr Color COL_SM_BISQUE(0xFFE4C4); +constexpr Color COL_SM_BLANCHEDALMOND(0xFFEBCD); +constexpr Color COL_SM_BLUEVIOLET(0x8A2BE2); +constexpr Color COL_SM_BROWN(0xA52A2A); +constexpr Color COL_SM_BURLYWOOD(0xDEB887); +constexpr Color COL_SM_CADETBLUE(0x5F9EA0); +constexpr Color COL_SM_CHARTREUSE(0x7FFF00); +constexpr Color COL_SM_CHOCOLATE(0xD2691E); +constexpr Color COL_SM_CORAL(0xFF7F50); +constexpr Color COL_SM_CORNFLOWERBLUE(0x6495ED); +constexpr Color COL_SM_CORNSILK(0xFFF8DC); +constexpr Color COL_SM_CRIMSON(0xDC143C); +constexpr Color COL_SM_CYAN(0x00); +constexpr Color COL_SM_DARKBLUE(0x8B); +constexpr Color COL_SM_DARKCYAN(0x008B8B); +constexpr Color COL_SM_DARKGOLDENROD(0xB8860B); +constexpr Color COL_SM_DARKGRAY(0xA9A9A9); +constexpr Color COL_SM_DARKGREEN(0x006400); +constexpr Color COL_SM_DARKGREY(0xA9A9A9); +constexpr Color COL_SM_DARKKHAKI(0xBDB76B); +constexpr Color COL_SM_DARKMAGENTA(0x8B008B); +constexpr Color COL_SM_DARKOLIVEGREEN(0x556B2F); +constexpr Color COL_SM_DARKORANGE(0xFF8C00); +constexpr Color COL_SM_DARKORCHID(0x9932CC); +constexpr Color COL_SM_DARKRED(0x8B); +constexpr Color COL_SM_DARKSALMON(0xE9967A); +constexpr Color COL_SM_DARKSEAGREEN(0x8FBC8F); +constexpr Color COL_SM_DARKSLATEBLUE(0x483D8B); +constexpr Color COL_SM_DARKSLATEGRAY(0x2F4F4F); +constexpr Color COL_SM_DARKSLATEGREY(0x2F4F4F); +constexpr Color COL_SM_DARKTURQUOISE(0x00CED1); +constexpr Color COL_SM_DARKVIOLET(0x9400D3); +constexpr Color COL_SM_DEEPPINK(0xFF1493); +constexpr Color COL_SM_DEEPSKYBLUE(0x00BFFF); +constexpr Color COL_SM_DIMGRAY(0x696969); +constexpr Color COL_SM_DIMGREY(0x696969); +constexpr Color COL_SM_DODGERBLUE(0x1E90FF); +constexpr Color COL_SM_FIREBRICK(0xB2); +constexpr Color COL_SM_FLORALWHITE(0xFFFAF0); +constexpr Color COL_SM_FORESTGREEN(0x228B22); +constexpr Color COL_SM_GAINSBORO(0xDCDCDC); +constexpr Color COL_SM_GHOSTWHITE(0xF8F8FF); +constexpr Color COL_SM_GOLD(0xFFD700); +constexpr Color COL_SM_GOLDENROD(0xDAA520); +constexpr Color COL_SM_GREENYELLOW(0xADFF2F); +constexpr Color COL_SM_GREY(0x808080); +constexpr Color COL_SM_HONEYDEW(0xF0FFF0); +constexpr Color COL_SM_HOTPINK(0xFF69B4); +constexpr Color
[Libreoffice-commits] core.git: starmath/inc wizards/source
starmath/inc/node.hxx | 16 starmath/inc/token.hxx |2 +- wizards/source/scriptforge/SF_Array.xba |2 +- 3 files changed, 10 insertions(+), 10 deletions(-) New commits: commit 20d125ce61561a2ab54a99d77112d83293820e70 Author: Andrea Gelmini AuthorDate: Sun Nov 8 09:43:14 2020 +0100 Commit: Julien Nabet CommitDate: Sun Nov 8 11:22:00 2020 +0100 Fix typos Change-Id: I79d8cd8f66ee83c2af42a828596e852248d51138 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105439 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index a1dbe90305f3..3bdb6bac6c9c 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -29,9 +29,9 @@ * SmTableNode binom * SmLineNode A line * SmExpressionNode{ content } - * SmUnHorNode unary opperators +-; -+; +x; -x; ... + * SmUnHorNode unary operators +-; -+; +x; -x; ... * SmRootNode Root structure - * SmBinHorNodebynary opperators A + B + * SmBinHorNodebinary operators A + B * SmBinVerNodeover; frac; ... * SmBinDiagonalNode wideslash * SmSubSupNodecsub, csup, lsub, from, to, ... @@ -40,7 +40,7 @@ * SmVerticalBraceNode overbrace; underbrace; * SmOperNode sum from to; int from to; * SmAlignNode text alignment - * SmAttributNode font attributtes; bold; + * SmAttributNode font attributes; bold; * SmFontNode font serif; ... * SmMatrixNodematrix * SmVisibleNode drawable node @@ -55,7 +55,7 @@ * SmMathIdentifierNodevariable * SmRootSymbolNoderoot symbol * SmPlaceNode - * SmErrorNode red ? for errores + * SmErrorNode red ? for errors * */ @@ -1369,15 +1369,15 @@ public: SmNode* Symbol() { assert( GetNumSubNodes() == 3 ); return GetSubNode( 1 ); } /** - * Returns the node containing the data of the left opperand. - * @return left opperand data + * Returns the node containing the data of the left operand. + * @return left operand data */ const SmNode* LeftOperand() const { return const_cast(this)->LeftOperand(); } SmNode* LeftOperand() { assert( GetNumSubNodes() == 3 ); return GetSubNode( 0 ); } /** - * Returns the node containing the data of the right opperand. - * @return right opperand data + * Returns the node containing the data of the right operand. + * @return right operand data */ const SmNode* RightOperand() const { return const_cast(this)->RightOperand(); } SmNode* RightOperand() { assert( GetNumSubNodes() == 3 ); return GetSubNode( 2 ); } diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index 353c26275bab..caae616e475a 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - /** The tokens cointain the information gathered by the parser. + /** The tokens contain the information gathered by the parser. * * They contain: *the data type (~ mathematical operation). diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 8ffc64127a0f..e219a792e134 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -879,7 +879,7 @@ Try: Check type and copy all items of the line For i = 0 To lCol If Left(vLine(i), 1) = Then sItem = SF_String.Unquote(vLine(i)) Else sItem = vLine(i) Unquote only when useful - Interprete the individual line item + Interpret the individual line item Select Case True Case IsNumeric(sItem) If InStr(sItem, .) + InStr(1, sItem, e, 1) 0 Then vItem = Val(sItem) Else vItem =
[Libreoffice-commits] core.git: starmath/inc
starmath/inc/node.hxx | 42 ++ starmath/inc/parse.hxx|6 ++ starmath/inc/strings.hrc |7 +++ starmath/inc/strings.hxx |6 ++ starmath/inc/symbol.hxx |5 + starmath/inc/token.hxx| 10 ++ starmath/inc/visitors.hxx | 13 + 7 files changed, 89 insertions(+) New commits: commit 7acf5fe037e50557c6ddbc8d9a797dc727ce4001 Author: dante AuthorDate: Wed Nov 4 13:49:06 2020 +0100 Commit: Noel Grandin CommitDate: Sat Nov 7 21:30:22 2020 +0100 Added documentation on starmath. Gives basic description about file content and functionallity. Will allow new programmers to follow the code better. Change-Id: I76a9d61781332e3341130276c1c78ecf82e799a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105290 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 2f0b940582d8..a1dbe90305f3 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -17,6 +17,48 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +/** The SmNode is the basic structure of formula data. + * + * Each token is stored in one node of specific kind. + * They can have SmNodeType. It allows to identify node type after abstraction. + * Here goes the subclasses tree: + * + * SmRect + * SmNode + * SmStructureNode Head of tree diagram + * SmTableNode binom + * SmLineNode A line + * SmExpressionNode{ content } + * SmUnHorNode unary opperators +-; -+; +x; -x; ... + * SmRootNode Root structure + * SmBinHorNodebynary opperators A + B + * SmBinVerNodeover; frac; ... + * SmBinDiagonalNode wideslash + * SmSubSupNodecsub, csup, lsub, from, to, ... + * SmBraceNode (); []; left lbrace right rbrace; ... + * SmBracebodyNode ( content ); [ content ]; ... + * SmVerticalBraceNode overbrace; underbrace; + * SmOperNode sum from to; int from to; + * SmAlignNode text alignment + * SmAttributNode font attributtes; bold; + * SmFontNode font serif; ... + * SmMatrixNodematrix + * SmVisibleNode drawable node + * SmGraphicNode graphics display + * SmRectangleNode + * SmPolyLineNode overline; underline; widehat; ... + * SmBlankNode blank space; ~; ... + * SmTextNode "text"; func functname; ... + * SmSpecialNode + * SmGlyphSpecialNode %symbolname + * SmMathSymbolNodemath symbols + * SmMathIdentifierNodevariable + * SmRootSymbolNoderoot symbol + * SmPlaceNode + * SmErrorNode red ? for errores + * + */ + #ifndef INCLUDED_STARMATH_INC_NODE_HXX #define INCLUDED_STARMATH_INC_NODE_HXX diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index e62f855bb723..f0783835fe21 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -16,6 +16,11 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + +/** Parses the starmath code and creates the nodes. + * + */ + #ifndef INCLUDED_STARMATH_INC_PARSE_HXX #define INCLUDED_STARMATH_INC_PARSE_HXX @@ -82,6 +87,7 @@ class SmParser SmParser(const SmParser&) = delete; SmParser& operator=(const SmParser&) = delete; +// Moves between tokens inside starmath code. voidNextToken(); voidNextTokenColor(); voidNextTokenFontSize(); diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 8a303127d245..09b2b394c619 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -17,6 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +/** Those are the starmath codes descriptions for ElementsDockingWindow.hxx. + * + * Those codes will be displayed as formulas on the ElementsDockingWindow. + * The user can then
[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/qa starmath/source
starmath/inc/parse.hxx|1 + starmath/inc/strings.hrc |1 + starmath/inc/strings.hxx |1 + starmath/inc/token.hxx|2 +- starmath/qa/extras/mmlimport-test.cxx |4 ++-- starmath/source/ElementsDockingWindow.cxx |1 + starmath/source/mathmlimport.cxx |2 +- starmath/source/parse.cxx | 20 starmath/source/visitors.cxx | 24 +--- 9 files changed, 45 insertions(+), 11 deletions(-) New commits: commit d3abe0a1fb2f2b546b164280c5562443dc1f4300 Author: dante AuthorDate: Tue Nov 3 15:12:08 2020 +0100 Commit: Noel Grandin CommitDate: Thu Nov 5 09:07:46 2020 +0100 Added frac command. Sould solve tdf#137234. Change-Id: I78dcd06a30b93c441dd5983711603f184d20c63b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105255 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 4f1e3024ccb3..e62f855bb723 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -116,6 +116,7 @@ class SmParser std::unique_ptr DoBracebody(bool bIsLeftRight); std::unique_ptr DoFunction(); std::unique_ptr DoBinom(); +std::unique_ptr DoFrac(); std::unique_ptr DoStack(); std::unique_ptr DoMatrix(); std::unique_ptr DoSpecial(); diff --git a/starmath/inc/strings.hrc b/starmath/inc/strings.hrc index 7cd2c73c09d7..b9377eff1081 100644 --- a/starmath/inc/strings.hrc +++ b/starmath/inc/strings.hrc @@ -35,6 +35,7 @@ #define RID_XSYMDIVIDEY_HELPNC_("RID_XSYMDIVIDEY_HELP", "Division (Slash)" ) #define RID_XDIVY_HELP NC_("RID_XDIVY_HELP", "Division (÷)" ) #define RID_XOVERY_HELP NC_("RID_XOVERY_HELP", "Division (Fraction)" ) +#define RID_FRACXY_HELP NC_("RID_FRACXY_HELP", "Fraction" ) #define RID_XODIVIDEY_HELP NC_("RID_XODIVIDEY_HELP", "Circled Slash" ) #define RID_XODOTY_HELP NC_("RID_XODOTY_HELP", "Circled Dot" ) #define RID_XOMINUSY_HELP NC_("RID_XOMINUSY_HELP", "Circled Minus" ) diff --git a/starmath/inc/strings.hxx b/starmath/inc/strings.hxx index 17de13505fdf..c38419b5638e 100644 --- a/starmath/inc/strings.hxx +++ b/starmath/inc/strings.hxx @@ -25,6 +25,7 @@ #define RID_XSYMDIVIDEY " / " #define RID_XDIVY " div " #define RID_XOVERY "{} over {} " +#define RID_FRACXY "frac {} {} " #define RID_XODIVIDEY " odivide " #define RID_XODOTY " odot " #define RID_XOMINUSY" ominus " diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx index f17d527fc54c..4153b91c0caa 100644 --- a/starmath/inc/token.hxx +++ b/starmath/inc/token.hxx @@ -56,7 +56,7 @@ enum SmTokenType TEND, TSPECIAL, TNONE, TESCAPE,TUNKNOWN, TBLANK, TSBLANK,TPLACE, TNOSPACE, TDOTSDOWN, TNEWLINE, TDOTSAXIS, TDOTSLOW, TDOTSVERT, TBACKEPSILON, -TDOTSDIAG, TDOTSUP, +TDOTSDIAG, TDOTSUP,TFRAC, // Basic TPLUS, TMINUS, TMULTIPLY, TDIVIDEBY, // +-*/ TGT,TLT,TGE,TLE,// > < >= <= diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index 279dbd56e4ad..4b204787a3cb 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -148,14 +148,14 @@ void Test::testtdf99556() void Test::testTdf103430() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf103430.mml")); -CPPUNIT_ASSERT_EQUAL(OUString("{ { nitalic d ^ 2 nitalic color blue y } over { nitalic d font sans bold italic color red x } }"), +CPPUNIT_ASSERT_EQUAL(OUString("frac { { nitalic d ^ 2 nitalic color blue y } } { { nitalic d font sans bold italic color red x } }"), mxDocShell->GetText()); } void Test::testTdf103500() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf103500.mml")); -CPPUNIT_ASSERT_EQUAL(OUString("{ { int csup b csub a { { 1 over x } ` nitalic d x } } = { intd csup b csub a { { 1 over y } ` nitalic d y } } }"), +CPPUNIT_ASSERT_EQUAL(OUString("{ { int csup b csub a { frac { 1 } { x } ` nitalic d x } } = { intd csup b csub a { frac { 1 } { y } ` nitalic d y } } }"), mxDocShell->GetText()); } diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 1e2f295c3e09..8850ca49fcbb 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -63,6 +63,7 @@ const SmElementDescr SmElementsControl::m_aUnaryBinaryOperatorsList[] = {RID_XPLUSY, RID_XPLUSY_HELP}, {RID_XMINUSY, RID_XMINUSY_HELP},