Commit Graph

61 Commits

Author SHA1 Message Date
Zheng, Lei
68fca40983 Spreadsheet: support cell binding
Cell binding allows one to bind a range of cells of one sheet to another
range of cells of an arbitary sheet, including any empty cells in the
range.

The binding is implemented with PropertyExpressionEngine and
PropertySheet::setPathValue(), which binds a special path of
PropertySheet, such as

    .cells.Bind.A1.D1

to an expression, such as

     tuple(.cells, <<A2>>, <<A5>>)

The A1 and D1 in the example above specifies the binding start and end
cell address. And <<A2>> and <<A5>> are the range of cells to bind to.
Note that you can use any expression that evalutes to string for the
binding destination, e.g. <<A%d>> % B1, which uses the value inside B1
to construct the binding destination. The '.cells' in the tuple shown
above is an example to bind cells of the same PropertySheet. It can be
change to to reference to any other spreadsheet, even those outside the
current document, e.g. Document#Spreadsheet001.cells
2021-12-21 21:41:02 -07:00
Zheng, Lei
3d1b9f5c90 Spreadsheet: support paste into cell range
For single range copy, the range selection when pasting determines the
start cell and the number of duplications.

For example, when copying a range A1:B2 (i.e. a 2x2 square) and pasting
into a selection of C1:C5 (i.e. a 5x1 vertical line), the square will be
duplicated once in horizontal, but twice in vertical, resulting new
cells range from C1:D4. This logic is borrowed from google sheet.

For multi-ranged copy, no multi duplication is intended. If more than
one selection range exists before pasting, only the top left cell of
the last selected range is used to determine the starting cell for
pasting. The cells will be copied with the exact cell layout keeping any
empty cells in between. This logic is different from google sheet, where
it disallows unalligned multi-ranged copy, and will condense and
eliminate any empty cells for aligned multi-range copy.
2021-12-21 21:41:02 -07:00
0penBrain
d5e750d262 [Sheet][Bugfix] Reject alignment change for merged cell except top-left one 2021-11-21 20:57:33 -06:00
0penBrain
dc8f20a9e4 [Sheet] Assert non-null pointer before using it 2021-11-21 20:57:33 -06:00
0penBrain
7349eb5198 [Sheet] Prevent duplicate call to 'nonNullCellAt' 2021-11-21 20:57:33 -06:00
Zheng, Lei
14dfae0597 App: add hiddenref() expression built-in function
Any object reference inside this function is treated as hidden to
exclude it from dependency calculation. This function allows some form
of cyclic depdenency.

Merger note: renamed from "HREF" to "HIDDENREF" to avoid confusion with
the standard "hypertext reference" use of HREF.
2021-11-14 20:45:09 -06:00
Chris Hennes
b8ad042986 Spreadsheet: Fix copy of empty but used cell 2021-11-03 14:31:11 -05:00
Chris Hennes
403a569315 [Spreadsheet] Refactor keyboard handling
LineEdit no longer actually handles motion, it simply indicates which
action was taken to cause it to lose focus (e.g. which key was pressed).
It's up to the client code to determine what this means. This allows
significant consolidation of keyboard-handling logic, and the
implementation of more extensive keyboard navigation features.

New keyboard shortcuts include a tab counter to implement auto-return,
plus Ctrl->Arrow, End, Home, Ctrl-End, and Ctrl-Home, matching the
behavior of OpenOffice, LibreOffice, etc.

Block selection via keyboard has also been added by holding down the
shift key during navigation with the arrow keys (this also works in
combination with the Ctrl modifier for region navigation).
2021-10-08 14:55:39 -05:00
Chris Hennes
a27d270fa9 [Spreadsheet] Add support for copying empty cells 2021-09-21 14:32:42 -05:00
Chris Hennes
f4c50e3701 [Spreadsheet] Refactor and simplify paste code 2021-09-20 16:12:16 -05:00
mwganson
d02e708e75 [Spreadsheet] Prevent infinite loop when copy/paste of non-rectangular selection 2021-09-14 15:15:59 -05:00
Benjamin Nauck
d525b29fa5 [Spreadsheet] Remove alias from dynamic properties on removeRows/Columns
When removing a row in a spreadsheet which has an assigned alias, the
alias will not be removed from the list of dynamic properties.

This makes it impossible to create a new alias which uses the same name
even if the original was removed (using removeRows/removeColumns)

Fixes #4492
2021-01-04 22:10:58 +01:00
luz paz
44636aca2f Spreadsheet: Make all file headers uniform [skip-ci] 2020-11-03 14:52:53 +01:00
Cheuksan Wang
0aa759b5c5 Move the aliases before other content of cells
When a user performs insert rows, remove rows, insert columns, or
remove rows, we need to move multiple cells as a batch. The cells are
moved sequentially. For each cell, its dependent alias positions are
looked up and dependencies are added.  However, those cells with
aliases may be moved later in the batch. Thus the earlier dependencies
become wrong. This commit fixes this bug by moving all the aliases
before moving the cells. Unit tests are added to for this bug.

fixes issue #4429
2020-09-13 11:58:54 +02:00
wmayer
f3b460e42e boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
4ec45b545e boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
luz.paz
2ed5786d07 [skip-ci] Various typo fixes
Found via codespell  v1.17.0.dev0  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml
```
2020-04-07 18:17:03 +02:00
Zheng, Lei
41387fd991 App: fix dynamic property undo/redo
Instead of enforce property type match when undo/redo, modify various
property Paste() to make it type safe.
2019-10-07 17:24:31 +02: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
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
luz.paz
039d6eac01 Fix typos in various src/Mod directories 2019-08-17 15:32:49 +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
c9b4f4ba67 fix possible crash in PropertySheet when removing dependencies 2019-01-17 18:33:06 +01:00
wmayer
fc16bcbfca Replace Base::Exception with appropriate subclass 2018-11-14 18:02:49 +01:00
wmayer
c6745d1b5b fixes 0003610: App::PropertyFloatList not updating in Spreadsheet 2018-10-13 14:02:03 +02:00
Eivind Kvedalen
5d2a889a80 Fixed issue #3506: Certain alias names with a number at the end caused exceptions when deleting cells in a spreadsheet. 2018-08-01 19:23:16 -03:00
Eivind Kvedalen
d2f9ab6a11 Spreadsheet: Fixed issue #3361. 2018-07-31 16:11:37 -03:00
Eivind Kvedalen
13da3dd830 Revert "fixes #0003361: Spreadsheet: Inserting Row Cause Crash - FC Daily v0.17"
This reverts commit f485a0786f.
2018-07-31 16:11:37 -03:00
wmayer
f485a0786f fixes #0003361: Spreadsheet: Inserting Row Cause Crash - FC Daily v0.17 2018-03-25 13:39:21 +02:00
Eivind Kvedalen
5fe7a9af71 Spreadsheet: Fix for issue #3225.
Done by adding a selector function to Document::renameObjectIdentifiers(...) to ensure
that the Spreadsheet document object is not rewritten twice.
2017-11-08 23:15:16 +01:00
luzpaz
ab8f8919b6 Misc. typos
+ some are doxy others are just comment code.  
+ some minor whitespace and grammatical tweaks. 
+ app/SCL/* typos have also been submitted upstream (https://github.com/stepcode/stepcode/pull/366). So it's ok to merge them in to master.
2017-10-04 17:59:11 +02:00
Eivind Kvedalen
338ca55622 Spreadsheet: Fixed issue #2894: Unit strings could be used as aliases. 2017-03-07 13:45:53 -03: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
b606ed8ce4 Spreadsheet: Added AtomicPropertyChange object to avoid excessive property change reporting. 2016-03-08 16:09:30 +01:00
Eivind Kvedalen
b74b3f3358 Spreadsheet: Refactor code and reuse visitors from ExpressionVisitors.h 2016-02-18 16:54:42 +01:00
Eivind Kvedalen
1802d94a1a Spreadsheet: Override DocumentObject::renameObjectIdentifiers() to get better renaming support. 2016-02-18 16:54:42 +01:00
Eivind Kvedalen
8c943d0ad7 Spreadsheet: Refactored code to use AtomicPropertyChangeInterface. 2016-02-18 16:54:40 +01:00
Eivind Kvedalen
53dcaccd4e Spreadsheet: Refactored alias checking code, so GUI and Python error messages are aligned. 2016-02-18 16:54:39 +01:00
Ed Martin
d71a12db05 Spreadsheet: Issue #2355: Do not recompute the spreadsheet and its dependents unless the change affects the spreadsheet 2016-01-26 12:04:55 +01:00
Eivind Kvedalen
ed29d8ef9a Spreadsheet: Fixed crash when removing aliases. 2016-01-26 11:14:06 +01:00
Eivind Kvedalen
d45a95bf3a Spreadsheet: Issue #2402: Added functionality to get cell address given an alias. 2016-01-26 10:52:00 +01:00
Eivind Kvedalen
ae6b934207 Spreadsheet: Fixed PropertySheet::Paste(); undo did not work correctly. 2015-12-09 12:15:15 +01:00
Eivind Kvedalen
71605e63ef Spreadsheet: Fixed issue #2352, removal of rows and columns. 2015-12-09 12:15:13 +01:00
Eivind Kvedalen
4b5ae54e88 App: Removed VariableExpression::setName(), and replace call by setPath(); it's use caused a crash (#2352). 2015-12-09 12:15:12 +01:00
Eivind Kvedalen
e2650860cc Spreadsheet: Expressions using a spreadsheet cell address are now correctly renamed when rows/columns are removed/inserted. 2015-10-11 09:41:16 +02:00
Eivind Kvedalen
a80ccb9451 Spreadsheet: Renaming an alias will now traverse the document and update expressions referencing it. 2015-10-11 09:41:15 +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
bee11897a1 Spreadsheet: Fixed bug with dangling pointer when a document object is deleted. 2015-09-21 14:51:01 +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