Commit Graph

40 Commits

Author SHA1 Message Date
Zheng, Lei
2a3951ca32 Spreadsheet: change alias handling
No longer add dynamic property for alias, simply rely on
get(Dynamic)PropertyByName() to check for aliases.

Add new API PropertyContainer::getPropertyNamedList() so that
ExpressionCompleter can discover properties with aliases.
2021-12-21 21:41:02 -07:00
Zheng, Lei
93beb9fabd Spreadsheet: preserve component reference in cell 2021-10-12 14:58:36 -05:00
Benjamin Nauck
f6c9cc90ee [Base] Remove includes to StdStlTools.h as that's not needed anymore
std::make_unique was introduced in c++14, so no need to use the back
ported version
2021-03-06 21:20:32 +01:00
Benjamin Nauck
41de6c3d99 [Spreadsheet] Use std::shared_ptr instead of boost::shared_ptr
There's no need to use boost version when stl has support for shared_ptr
2021-03-06 19:32:03 +01:00
Yorik van Havre
aa52a3f55c Merge pull request #4215 from hyarion/feature-spreadsheet-equal-prefix-for-expressions
[Spreadsheet] Only evaluate cell values when prefixed with '='
2021-02-05 13:29:57 +01:00
Benjamin Nauck
f4c2539765 Spreadsheet: Allow alias removed by undo to be reused
Fixes issue descripted in the forum post:
https://forum.freecadweb.org/viewtopic.php?f=3&t=54009
2021-01-30 14:04:57 +01:00
Benjamin Nauck
24c6183661 Spreadsheet: make setContent use unique_ptr and cleanup
Make `Cell::setContent` use `unique_ptr` and
`make_unique` for expressions to avoid potential memory
leaks.
Also renames `expo` to `newExpr` to avoid mixup with the
member variable `expression`.

Both changes was made at the request of @chennes.
2021-01-20 18:55:27 +01:00
Benjamin Nauck
dbedb21676 [Spreadsheet] Only evaluate cell values when prefixed with '='
This commit only changes the user interaction with spreadsheet and does
not affect backwards compatibility (as valid cell expressions are
prefixed with '=' when serialized).

This fixes [#4156](https://tracker.freecadweb.org/view.php?id=4156),
which is discussed in the forum thread:
https://forum.freecadweb.org/viewtopic.php?f=3&t=39665

There has been additional logic added to handle numbers and simple
fractions without using '='.
The behaviour is what is expected by the spreadsheet test cases
and in line with how other spreadsheet software works.
The '-prefix can still be used to force the input to be handled as
as string instead.

Example of numbers and fractions handled are:
  3
  2mm
  1/8
  1mm/2
  1/2mm
  2/m
  1mm/2s

More complex expressions are not handled without '=' and will be stored
as strings instead, for example:
  2 / 3 / 2
  1 + 1/3
2021-01-20 18:55:27 +01:00
luz paz
44636aca2f Spreadsheet: Make all file headers uniform [skip-ci] 2020-11-03 14:52:53 +01:00
wmayer
dff82ea08a PVS: V506 Pointer to local variable '_value' is stored outside the scope of this variable. Such a pointer will become invalid. 2020-07-18 10:59:28 +02:00
wmayer
ec8b1bc072 [skip ci] use QLocale class consistently to make it possible to change it application-wide 2020-03-26 16:37:45 +01:00
Zheng, Lei
976952db63 Spreadsheet: improve cyclic dependency exception handling 2019-10-07 17:24:30 +02:00
wandererfan
bed78b0b7b [SS]Fix Integer Formatted Value 2019-10-01 20:34:11 -04:00
Zheng, Lei
ea7eee8061 Expression: split Expression.h to ExpressionParser.h
Split Expression details into a separate header to reduce recompilation
time on changes.
2019-09-28 15:30:41 +02:00
wandererfan
019198a30c [TD][SS]Fix 4131 SS formatting in TD View 2019-09-20 12:56:26 -04:00
wmayer
a247b7e6a5 force strict ISO C++ (-Wpedantic)
for Drawing, Image, Inspection, Mesh, MeshPart, Part, Path, Points, Raytracing, ReverseEngineering, Spreadsheet, Start, Surface, Web

TODO: fix several -Woverflow in area
2019-09-18 11:32:42 +02:00
Zheng, Lei
e911b69769 Spreadsheet changes
Various changes to support in-place editing, and more.
2019-08-17 15:15:47 +02:00
Zheng, Lei
34ed8a8e00 Spreadsheet: convert PropertySheet to link type property
PropertySheet is changed to derive from PropertyExpressionContainer,
which makes it a link type property that is capable of external linking.
It now relies on the unified link property API to manage object
depenency, and tracking of object life time, relabeling, etc.

This patch also includes various fix and improvement of Spreadsheet,
such as improved recompute efficiency, correct handling of document
label change, etc.
2019-08-17 14:52:09 +02:00
wmayer
fc16bcbfca Replace Base::Exception with appropriate subclass 2018-11-14 18:02:49 +01:00
Eivind Kvedalen
d2f9ab6a11 Spreadsheet: Fixed issue #3361. 2018-07-31 16:11:37 -03:00
luz.paz
0dead11c3e Spreadsheet: typo fixes 2018-04-30 08:30:20 +02:00
hgutsche
942d30c057 Address is actually spelled with two "d" 2017-02-28 18:52:04 +01:00
hgutsche
63ccfdde82 fix typo and and add explanation for a cell address 2017-02-28 18:52:04 +01:00
hgutsche
de8f66f857 Some fixes for doygen syntax errors and some configuration to make it run smoother under Windows 2017-02-28 18:52:04 +01:00
wmayer
9fe82bfbb9 fixes #0002460: Use keyword 'explicit' for Quantity constructor 2016-11-05 23:21:42 +01:00
Eivind Kvedalen
8fe0d42450 Spreadsheet: Fixed undo/redo (issue #2483). 2016-04-04 19:58:19 +02:00
Eivind Kvedalen
a21571a652 Spreadsheet: Removed own expression parser and instead use the one in App. 2016-04-02 12:01:04 +02:00
Eivind Kvedalen
6c80dd4eae Spreadsheet: Fixed crash when invalid unit was given as input. 2016-04-02 12:01:04 +02:00
Eivind Kvedalen
e230f3c5e7 Spreadsheet: Expose parse error to user. 2016-04-02 12:01:04 +02:00
Eivind Kvedalen
8c943d0ad7 Spreadsheet: Refactored code to use AtomicPropertyChangeInterface. 2016-02-18 16:54:40 +01:00
Eivind Kvedalen
9fe3b0146a Spreadsheet: Added alias as tooltip. Made background of cell light yellow if an alias is defined for it. Can be overridden by setting a background color. 2015-10-11 09:41:14 +02:00
Eivind Kvedalen
4d5646fa5d Spreadsheet: Replaced own Expression classed by the ones in App. 2015-09-21 14:51:11 +02:00
Eivind Kvedalen
61cbad8a12 Spreadsheet: Removed 'using namespace App'; preparation for moving Expression
classes to App.
2015-09-21 14:51:00 +02:00
Eivind Kvedalen
f7625481a2 Spreadsheet: Made freecad_dynamic_cast calls unambiguous (preparation for next commit). 2015-09-21 14:50:58 +02:00
wmayer
32bcbda232 + fix various warnings 2015-08-30 11:48:26 +02:00
wmayer
cac09437c8 + fix various warnings 2015-08-29 23:01:19 +02:00
Eivind Kvedalen
3743008cda - Self-reference bug
- Refactoring/clean-up of code
- Dependency tracking of aliased cells
- Various resolution errors
- Rewriting of ranges when columns/rows are inserted/removed
- References to aliases keep their units.
2015-03-04 22:18:20 +01:00
Eivind Kvedalen
43e777c7e5 Spreadsheet: docDeps property was not properly maintained, resulting in spurious links to other objects. 2015-02-17 11:46:12 +01:00
Eivind Kvedalen
d153fb2dbd + Fixed merge of cells to retain value in upper left cell+ Replaced std::map::at() with iterators and find. Removed some superfluous calls to std::map::find()
+ Visual Studio fixes
+ Fixed return values
+ Removed unused variables
2015-02-13 21:53:59 +01:00
Eivind Kvedalen
383ffa6e15 Initial implementation of Spreadsheet module (C++ version) by Eivind Kvedalen.
Various fixes for Windows by
Peter Lama <peterldev94@gmail.com>
Werner Mayer <wmayer@users.sourceforge.net>
2015-02-13 21:53:58 +01:00