[Libreoffice-commits] core.git: starmath/Library_sm.mk starmath/source

2021-02-27 Thread dante (via logerrit)
 starmath/Library_sm.mk|1 
 starmath/source/parse5.cxx|   26 -
 starmath/source/parsebase.cxx |   50 ++
 3 files changed, 51 insertions(+), 26 deletions(-)

New commits:
commit e9bae566f43dd6f26c2c4b7d84a449b7b01265dc
Author: dante 
AuthorDate: Sat Feb 27 18:21:47 2021 +0100
Commit: Noel Grandin 
CommitDate: Sat Feb 27 20:35:59 2021 +0100

Move smparsers shared error ressources to base class

Change-Id: Ica8c34162c7a2641e00de33105eb44eb99b167a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111685
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index 77fd47d1bfed..ece71cc8d143 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\
 starmath/source/ooxmlexport \
 starmath/source/ooxmlimport \
 starmath/source/rtfexport \
+starmath/source/parsebase \
 starmath/source/parse5 \
 starmath/source/rect \
 starmath/source/scrwin \
diff --git a/starmath/source/parse5.cxx b/starmath/source/parse5.cxx
index 09416c807b46..0f65252dd498 100644
--- a/starmath/source/parse5.cxx
+++ b/starmath/source/parse5.cxx
@@ -39,32 +39,6 @@
 
 using namespace ::com::sun::star::i18n;
 
-const char* starmathdatabase::SmParseErrorDesc[] = {
-// clang-format off
-RID_ERR_NONE,
-RID_ERR_UNEXPECTEDCHARACTER,
-RID_ERR_UNEXPECTEDTOKEN,
-RID_ERR_POUNDEXPECTED,
-RID_ERR_COLOREXPECTED,
-RID_ERR_LGROUPEXPECTED,
-RID_ERR_RGROUPEXPECTED,
-RID_ERR_LBRACEEXPECTED,
-RID_ERR_RBRACEEXPECTED,
-RID_ERR_PARENTMISMATCH,
-RID_ERR_RIGHTEXPECTED,
-RID_ERR_FONTEXPECTED,
-RID_ERR_SIZEEXPECTED,
-RID_ERR_DOUBLEALIGN,
-RID_ERR_DOUBLESUBSUPSCRIPT,
-RID_ERR_NUMBEREXPECTED
-// clang-format on
-};
-
-OUString starmathdatabase::getParseErrorDesc(SmParseError err)
-{
-return 
SmResId(starmathdatabase::SmParseErrorDesc[static_cast(err)]);
-}
-
 //Definition of math keywords
 const SmTokenTableEntry aTokenTable[]
 = { { u"abs", TABS, '\0', TG::UnOper, 13 },
diff --git a/starmath/source/parsebase.cxx b/starmath/source/parsebase.cxx
new file mode 100644
index ..2e6d92694db5
--- /dev/null
+++ b/starmath/source/parsebase.cxx
@@ -0,0 +1,50 @@
+/* -*- 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 
+
+const char* starmathdatabase::SmParseErrorDesc[] = {
+// clang-format off
+RID_ERR_NONE,
+RID_ERR_UNEXPECTEDCHARACTER,
+RID_ERR_UNEXPECTEDTOKEN,
+RID_ERR_POUNDEXPECTED,
+RID_ERR_COLOREXPECTED,
+RID_ERR_LGROUPEXPECTED,
+RID_ERR_RGROUPEXPECTED,
+RID_ERR_LBRACEEXPECTED,
+RID_ERR_RBRACEEXPECTED,
+RID_ERR_PARENTMISMATCH,
+RID_ERR_RIGHTEXPECTED,
+RID_ERR_FONTEXPECTED,
+RID_ERR_SIZEEXPECTED,
+RID_ERR_DOUBLEALIGN,
+RID_ERR_DOUBLESUBSUPSCRIPT,
+RID_ERR_NUMBEREXPECTED
+// clang-format on
+};
+
+OUString starmathdatabase::getParseErrorDesc(SmParseError err)
+{
+return 
SmResId(starmathdatabase::SmParseErrorDesc[static_cast(err)]);
+}
+
+/* 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/Library_sm.mk starmath/source

2014-04-14 Thread Thomas Arnhold
 starmath/Library_sm.mk|1 
 starmath/source/node.cxx  |  115 ++
 starmath/source/tmpdevice.cxx |   76 +++
 starmath/source/tmpdevice.hxx |   48 +
 starmath/source/visitors.cxx  |   84 ++
 5 files changed, 151 insertions(+), 173 deletions(-)

New commits:
commit 88718a876e0d4467eaaccfc3c1873df2b53bf1d3
Author: Thomas Arnhold 
Date:   Tue Apr 15 01:22:08 2014 +0200

starmath: remove duplicate SmTmpDevice

Change-Id: Ib1733ece03ad0a5ffad5157a622546d0cbac0a35

diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index 3abafb7..fc1d1e1 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -78,6 +78,7 @@ $(eval $(call gb_Library_add_exception_objects,sm,\
 starmath/source/smmod \
 starmath/source/symbol \
 starmath/source/toolbox \
+starmath/source/tmpdevice \
 starmath/source/typemap \
 starmath/source/unodoc \
 starmath/source/unomodel \
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 24319df..d8bde2a 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -25,98 +25,19 @@
 #include "document.hxx"
 #include "view.hxx"
 #include "mathtype.hxx"
+#include "tmpdevice.hxx"
 #include "visitors.hxx"
 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
-#include 
 
 #include 
 #include 
 
 
 
-// SmTmpDevice
-// Allows for font and color changes. The original settings will be restored
-// in the destructor.
-// It's main purpose is to allow for the "const" in the 'OutputDevice'
-// argument in the 'Arrange' functions and restore changes made in the 'Draw'
-// functions.
-// Usually a MapMode of 1/100th mm will be used.
-
-
-class SmTmpDevice: private boost::noncopyable
-{
-OutputDevice  &rOutDev;
-
-Color   Impl_GetColor( const Color& rColor );
-
-public:
-SmTmpDevice(OutputDevice &rTheDev, bool bUseMap100th_mm);
-~SmTmpDevice()  { rOutDev.Pop(); }
-
-void SetFont(const Font &rNewFont);
-
-operator OutputDevice & () { return rOutDev; }
-};
-
-
-SmTmpDevice::SmTmpDevice(OutputDevice &rTheDev, bool bUseMap100th_mm) :
-rOutDev(rTheDev)
-{
-rOutDev.Push( PUSH_FONT | PUSH_MAPMODE |
-  PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR );
-if (bUseMap100th_mm  &&  MAP_100TH_MM != rOutDev.GetMapMode().GetMapUnit())
-{
-SAL_WARN("starmath", "incorrect MapMode?");
-rOutDev.SetMapMode( MAP_100TH_MM ); //Immer fuer 100% fomatieren
-}
-}
-
-
-Color SmTmpDevice::Impl_GetColor( const Color& rColor )
-{
-ColorData nNewCol = rColor.GetColor();
-if (COL_AUTO == nNewCol)
-{
-if (OUTDEV_PRINTER == rOutDev.GetOutDevType())
-nNewCol = COL_BLACK;
-else
-{
-Color aBgCol( rOutDev.GetBackground().GetColor() );
-if (OUTDEV_WINDOW == rOutDev.GetOutDevType())
-aBgCol = ((Window &) 
rOutDev).GetDisplayBackground().GetColor();
-
-nNewCol = 
SM_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
-
-Color aTmpColor( nNewCol );
-if (aBgCol.IsDark() && aTmpColor.IsDark())
-nNewCol = COL_WHITE;
-else if (aBgCol.IsBright() && aTmpColor.IsBright())
-nNewCol = COL_BLACK;
-}
-}
-return Color( nNewCol );
-}
-
-
-void SmTmpDevice::SetFont(const Font &rNewFont)
-{
-rOutDev.SetFont( rNewFont );
-rOutDev.SetTextColor( Impl_GetColor( rNewFont.GetColor() ) );
-}
-
-
-
-
-
 SmNode::SmNode(SmNodeType eNodeType, const SmToken &rNodeToken)
 : aNodeToken( rNodeToken )
 , eType( eNodeType )
@@ -862,7 +783,7 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const 
SmFormat &rFormat)
 nFormulaBaseline = GetBaseline();
 else
 {
-SmTmpDevice  aTmpDev ((OutputDevice &) rDev, true);
+SmTmpDevice aTmpDev ((OutputDevice &) rDev, true);
 aTmpDev.SetFont(GetFont());
 
 SmRect aRect = (SmRect(aTmpDev, &rFormat, OUString("a"),
@@ -914,7 +835,7 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const 
SmFormat &rFormat)
 if (NULL != (pNode = GetSubNode(i)))
 pNode->Arrange(rDev, rFormat);
 
-SmTmpDevice  aTmpDev ((OutputDevice &) rDev, true);
+SmTmpDevice aTmpDev ((OutputDevice &) rDev, true);
 aTmpDev.SetFont(GetFont());
 
 if (nSize < 1)
@@ -1485,7 +1406,7 @@ void SmBinDiagonalNode::Arrange(const OutputDevice &rDev, 
const SmFormat &rForma
 //! some routines being called extract some info from the OutputDevice's
 //! font (eg the space to be used for borders OR the font name(!!)).
 //! Thus the font should reflect the needs and has to be set!
-SmTmpDevice  aTmpDev ((OutputDevice &) rDev, true);
+SmTmpDevice aTmpDev ((OutputDevice &) rDev, true);
 aTmpDev.SetFont(