Commit Graph

99 Commits

Author SHA1 Message Date
wmayer
2ad2a0258d Sheet: modernize C++: use default member init 2023-08-23 00:55:03 +02:00
wmayer
25824cc363 Sheet: modernize C++: use range-based for loop 2023-08-15 20:21:20 +02:00
wmayer
948cbfccd9 modernize C++: avoid bind
In many cases std::bind() is kept because the code is much simpler
2023-08-08 21:10:16 +02:00
wmayer
52e1c7c33b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
wmayer
c2e17824fa modernize C++: raw string literal 2023-08-07 19:51:15 -06:00
wmayer
bf5059bf76 Sheet: modernize C++: redundant void arg 2023-08-05 16:50:31 +02:00
luzpaz
be64da3de5 Spreadsheet: fix header uniformity
+ trailing whitespace
2023-01-22 21:46:17 +01:00
Uwe
def72857b8 [Spread] App: enable precompiled headers 2022-12-08 02:10:46 +01:00
Chris Hennes
0c162d7f09 Spreadsheet: Add getUsedRange() and getNonEmptyRange() 2022-11-10 14:36:54 -06:00
Zheng, Lei
2053a90cbc Spreadsheet: fix cell span handling
When undo/redo, copy/paste, and removing row/column
2022-10-20 16:03:20 -05:00
Zheng, Lei
729f2e857a Spreadsheet: fix cell span synchronization with SheetTableView
Also, allow merge cell with overlaps, by auto split overlapped cells
first
2022-10-20 16:03:20 -05:00
Uwe
f1079e14ec [Spread] remove unused includes
- also sort includes
- also additions to precompiled header
2022-10-09 20:31:31 +02:00
berniev
d2babf0eb5 App: Single arg ctors must be explicit 2022-08-24 07:20:57 +02:00
berniev
53ba98d636 Mod: use empty 2022-08-06 19:30:13 +02:00
berniev
ba06e203be Fix column number calc
(cherry picked from commit 0a8b875751c9469a52548730539dfd4b4fc51acc)
2022-07-27 13:45:33 +02:00
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