Commit Graph

84 Commits

Author SHA1 Message Date
Uwe
140e89e858 Mod: remove some more superfluous Boolean checks 2022-07-19 02:40:59 +02:00
Uwe
763a575b23 Mod: remove some unnecessary nullptr checks 2022-07-18 12:58:12 +02:00
Uwe
24468b59ad re-add some nullptr
to be safe since their removal within assert() or bools might have some impact I don't know
2022-07-18 02:32:36 +02:00
Uwe
3e6f362959 [Spreadsheet] remove superfluous nullptr checks 2022-07-18 01:49:41 +02:00
mosfet80
c48a569696 Boost version <=1.60 is never used in freecad 0.20 (#7038)
* Boost version 1.60 is never used in freecad 0.20
2022-06-24 02:20:26 +02:00
Zheng, Lei
b5327f5db7 Spreadsheet: fix binding of merged cells 2022-06-12 16:11:59 +02:00
Zheng, Lei
b21507f6e3 Spreadsheet: replace obsolete href with hiddenref in binding 2022-06-12 16:11:59 +02:00
Zheng, Lei
1c8c6a48af Spreadsheet: fix range selection 2022-06-12 13:51:09 +02:00
Zheng Lei
3e81bd8c15 Spreadsheet: improve range binding feature (#6995)
* Spreadsheet: improve range binding feature
2022-06-08 19:19:41 +02:00
Zheng, Lei
5f17d5edca Spreadsheet: add new API PropertySheet::getNonEmptyCells()
To exclude cells without any text content. Used when printing (among
other cases) to skip empty cells.
2022-05-06 08:40:11 -05:00
Zheng, Lei
54ed4fe34f Spreadsheet: improve efficiency when pasting many cells 2022-04-22 12:28:56 -05:00
Zheng, Lei
98668ed947 Spreadsheet: do not copy empty cell
Because pasteCells() will clear empty cells in selected range
2022-04-22 12:28:56 -05:00
0penBrain
7edcc8358c Sheet: Warn user when cell merge is not done because already merge cells in the range
Partially fixes #6744
2022-04-15 12:14:55 -05:00
Chris Hennes
ed75cead6c Spreadsheet: PR6497 move return statement to new line 2022-03-29 13:25:44 -05:00
Zheng, Lei
fcd176aef0 Spreadsheet: fix owner property reference in PropertySheet
PropertySheet used to only work when refereceing its own cell either
through cell address or alias. It does not work for reference to other
property of the owner Spreadsheet object.
2022-03-26 10:19:20 -04:00
wmayer
2a2b8835c0 Spreadsheet: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
andrea reale
192a399b42 fix uninitialized variables 2022-03-01 02:03:44 +01:00
Uwe
a8c912d6f8 [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01:00
Zheng, Lei
d07479aba7 Spreadsheet: fix dependency calculation on external spreadsheet 2022-01-23 19:43:53 -06:00
Zheng, Lei
89ad08dffd Spreadsheet: code style change 2021-12-21 21:41:02 -07:00
Chris Hennes
a5ca0b7d15 Spreadsheet: Compilation fixes for cherry-picked commits 2021-12-21 21:41:02 -07:00
Zheng, Lei
753d51aedf 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
Chris Hennes
d0394ef878 Spreadsheet: Compilation fixes for cherry-picked commits 2021-12-21 21:41:02 -07:00
Zheng, Lei
0c2c334f87 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
55e2c918a9 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
4116a59813 [Sheet][Bugfix] Reject alignment change for merged cell except top-left one 2021-11-21 20:57:33 -06:00
0penBrain
28d10fc6e6 [Sheet] Assert non-null pointer before using it 2021-11-21 20:57:33 -06:00
0penBrain
0e13882a65 [Sheet] Prevent duplicate call to 'nonNullCellAt' 2021-11-21 20:57:33 -06:00
Zheng, Lei
fdae470c1b 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
da4ff7589f Spreadsheet: Fix copy of empty but used cell 2021-11-03 14:31:11 -05:00
Chris Hennes
8aa22d1a68 [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
4ebfb0c7f4 [Spreadsheet] Add support for copying empty cells 2021-09-21 14:32:42 -05:00
Chris Hennes
bbee3f05eb [Spreadsheet] Refactor and simplify paste code 2021-09-20 16:12:16 -05:00
mwganson
eb88ebafaf [Spreadsheet] Prevent infinite loop when copy/paste of non-rectangular selection 2021-09-14 15:15:59 -05:00
Benjamin Nauck
b690a69973 [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
068997112c Spreadsheet: Make all file headers uniform [skip-ci] 2020-11-03 14:52:53 +01:00
Cheuksan Wang
a178990acb 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
d6169d6478 boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
730154a684 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
4acdf2613d [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
f6ad70195f 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
38c47d6e95 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
e48c52c480 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
b869b6e29e Fix typos in various src/Mod directories 2019-08-17 15:32:49 +02:00
Zheng, Lei
b4751145b4 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
1444b64803 fix possible crash in PropertySheet when removing dependencies 2019-01-17 18:33:06 +01:00
wmayer
d4bf7d1f6f Replace Base::Exception with appropriate subclass 2018-11-14 18:02:49 +01:00
wmayer
9c996a41ae fixes 0003610: App::PropertyFloatList not updating in Spreadsheet 2018-10-13 14:02:03 +02:00
Eivind Kvedalen
e37f3827fd 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
edb44f5051 Spreadsheet: Fixed issue #3361. 2018-07-31 16:11:37 -03:00