diff --git a/src/Mod/Spreadsheet/App/AppSpreadsheet.cpp b/src/Mod/Spreadsheet/App/AppSpreadsheet.cpp
index 7aebf3c8a0..6c2d124348 100644
--- a/src/Mod/Spreadsheet/App/AppSpreadsheet.cpp
+++ b/src/Mod/Spreadsheet/App/AppSpreadsheet.cpp
@@ -17,7 +17,7 @@
#include
#include "Sheet.h"
-#include "Expression.h"
+#include "SpreadsheetExpression.h"
/* registration table */
diff --git a/src/Mod/Spreadsheet/App/CMakeLists.txt b/src/Mod/Spreadsheet/App/CMakeLists.txt
index 92777373a8..7ab5f20fd6 100644
--- a/src/Mod/Spreadsheet/App/CMakeLists.txt
+++ b/src/Mod/Spreadsheet/App/CMakeLists.txt
@@ -17,8 +17,8 @@ set(Spreadsheet_LIBS
)
set(Spreadsheet_SRCS
- Expression.cpp
- Expression.h
+ SpreadsheetExpression.cpp
+ SpreadsheetExpression.h
Cell.cpp
Cell.h
DisplayUnit.h
diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp
index 32700c4779..65b1474fb1 100644
--- a/src/Mod/Spreadsheet/App/Cell.cpp
+++ b/src/Mod/Spreadsheet/App/Cell.cpp
@@ -30,7 +30,7 @@
#include
#include
#include
-#include "Expression.h"
+#include "SpreadsheetExpression.h"
#include "Sheet.h"
#include
@@ -38,7 +38,7 @@
#define __func__ __FUNCTION__
#endif
-using namespace App;
+using namespace Base;
using namespace Spreadsheet;
const int Cell::EXPRESSION_SET = 1;
@@ -183,7 +183,7 @@ const Expression *Cell::getExpression() const
bool Cell::getStringContent(std::string & s) const
{
if (expression) {
- if (Spreadsheet::freecad_dynamic_cast(expression)) {
+ if (freecad_dynamic_cast(expression)) {
s = static_cast(expression)->getText();
char * end;
errno = 0;
@@ -192,9 +192,9 @@ bool Cell::getStringContent(std::string & s) const
if (!*end && errno == 0)
s = "'" + s;
}
- else if (Spreadsheet::freecad_dynamic_cast(expression))
+ else if (freecad_dynamic_cast(expression))
s = "=" + expression->toString();
- else if (Spreadsheet::freecad_dynamic_cast(expression))
+ else if (freecad_dynamic_cast(expression))
s = expression->toString();
else
s = "=" + expression->toString();
@@ -307,7 +307,7 @@ bool Cell::getStyle(std::set & _style) const
*
*/
-void Cell::setForeground(const Color &color)
+void Cell::setForeground(const App::Color &color)
{
if (color != foregroundColor) {
PropertySheet::Signaller signaller(*owner);
@@ -322,7 +322,7 @@ void Cell::setForeground(const Color &color)
*
*/
-bool Cell::getForeground(Color &color) const
+bool Cell::getForeground(App::Color &color) const
{
color = foregroundColor;
return isUsed(FOREGROUND_COLOR_SET);
@@ -333,7 +333,7 @@ bool Cell::getForeground(Color &color) const
*
*/
-void Cell::setBackground(const Color &color)
+void Cell::setBackground(const App::Color &color)
{
if (color != backgroundColor) {
PropertySheet::Signaller signaller(*owner);
@@ -350,7 +350,7 @@ void Cell::setBackground(const Color &color)
*
*/
-bool Cell::getBackground(Color &color) const
+bool Cell::getBackground(App::Color &color) const
{
color = backgroundColor;
return isUsed(BACKGROUND_COLOR_SET);
@@ -569,12 +569,12 @@ void Cell::restore(Base::XMLReader &reader)
setAlignment(alignmentCode);
}
if (foregroundColor) {
- Color color = decodeColor(foregroundColor, Color(0, 0, 0, 1));
+ App::Color color = decodeColor(foregroundColor, App::Color(0, 0, 0, 1));
setForeground(color);
}
if (backgroundColor) {
- Color color = decodeColor(backgroundColor, Color(1, 1, 1, 1));
+ App::Color color = decodeColor(backgroundColor, App::Color(1, 1, 1, 1));
setBackground(color);
}
@@ -609,7 +609,7 @@ void Cell::save(Base::Writer &writer) const
std::string content;
getStringContent(content);
- writer.Stream() << "content=\"" << Property::encodeAttribute(content) << "\" ";
+ writer.Stream() << "content=\"" << App::Property::encodeAttribute(content) << "\" ";
}
if (isUsed(ALIGNMENT_SET))
@@ -625,10 +625,10 @@ void Cell::save(Base::Writer &writer) const
writer.Stream() << "backgroundColor=\"" << encodeColor(backgroundColor) << "\" ";
if (isUsed(DISPLAY_UNIT_SET))
- writer.Stream() << "displayUnit=\"" << Property::encodeAttribute(displayUnit.stringRep) << "\" ";
+ writer.Stream() << "displayUnit=\"" << App::Property::encodeAttribute(displayUnit.stringRep) << "\" ";
if (isUsed(ALIAS_SET))
- writer.Stream() << "alias=\"" << Property::encodeAttribute(alias) << "\" ";
+ writer.Stream() << "alias=\"" << App::Property::encodeAttribute(alias) << "\" ";
if (isUsed(SPANS_SET)) {
writer.Stream() << "rowSpan=\"" << rowSpan<< "\" ";
@@ -759,7 +759,7 @@ std::string Cell::encodeAlignment(int alignment)
*
*/
-std::string Cell::encodeColor(const Color & color)
+std::string Cell::encodeColor(const App::Color & color)
{
std::stringstream tmp;
@@ -807,10 +807,10 @@ std::string Cell::encodeStyle(const std::set & style)
*
*/
-Color Cell::decodeColor(const std::string & color, const Color & defaultColor)
+App::Color Cell::decodeColor(const std::string & color, const App::Color & defaultColor)
{
if (color.size() == 7 || color.size() == 9) {
- Color c;
+ App::Color c;
if (color[0] != '#')
return defaultColor;
diff --git a/src/Mod/Spreadsheet/App/ExpressionParser.tab.h b/src/Mod/Spreadsheet/App/ExpressionParser.tab.h
new file mode 100644
index 0000000000..f671e8df6e
--- /dev/null
+++ b/src/Mod/Spreadsheet/App/ExpressionParser.tab.h
@@ -0,0 +1,74 @@
+/* A Bison parser, made by GNU Bison 2.5. */
+
+/* Bison interface for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see . */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ FUNC = 258,
+ NUM = 259,
+ IDENTIFIER = 260,
+ UNIT = 261,
+ INTEGER = 262,
+ CONSTANT = 263,
+ CELLADDRESS = 264,
+ EQ = 265,
+ NEQ = 266,
+ LT = 267,
+ GT = 268,
+ GTE = 269,
+ LTE = 270,
+ STRING = 271,
+ MINUSSIGN = 272,
+ PROPERTY_REF = 273,
+ DOCUMENT = 274,
+ OBJECT = 275,
+ EXPONENT = 276,
+ NEG = 277,
+ POS = 278
+ };
+#endif
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+extern YYSTYPE yylval;
+
+
diff --git a/src/Mod/Spreadsheet/App/PreCompiled.h b/src/Mod/Spreadsheet/App/PreCompiled.h
index 767e0fca10..af4d260d86 100644
--- a/src/Mod/Spreadsheet/App/PreCompiled.h
+++ b/src/Mod/Spreadsheet/App/PreCompiled.h
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2002 *
+ * Copyright (c) Eivind Kvedalen (eivind@kvedalen.name) 2015 *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -21,41 +22,58 @@
***************************************************************************/
-#ifndef __PRECOMPILED__
-#define __PRECOMPILED__
+#ifndef SPREADSHEET_PRECOMPILED_H
+#define SPREADSHEET_PRECOMPILED_H
#include
-// Exporting of App classes
+// Importing of App classes
#ifdef FC_OS_WIN32
# define SpreadsheetExport __declspec(dllexport)
+# define SpreadsheetGuiExport __declspec(dllexport)
#else // for Linux
# define SpreadsheetExport
+# define SpreadsheetGuiExport
#endif
-/// here get the warnings of to long specifieres disabled (needed for VC6)
+
+// here get the warnings of too long specifiers disabled (needed for VC6)
#ifdef _MSC_VER
-# pragma warning( disable : 4251 )
-# pragma warning( disable : 4275 )
-# pragma warning( disable : 4503 )
-# pragma warning( disable : 4786 ) // specifier longer then 255 chars
+# pragma warning( disable : 4251 )
+# pragma warning( disable : 4503 )
+# pragma warning( disable : 4786 ) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
-// standard
-#include
-#include
-#include
-#include
-#include
-#include