Commit Graph

66 Commits

Author SHA1 Message Date
Benjamin Nauck
cb2c8a5a2d Spreadsheet: Add #include <limits> where used 2025-03-31 23:52:48 +02:00
Benjamin Nauck
cd5c4b8acd Spreadsheet: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:39 +01:00
xtemp09
0f68c0403a [Spreadsheet] Remove prepended apostrophe if cell content is copied into clipboard (#19781)
* [Spreadsheet] Remove prepended apostrophe if cell content is copied into
clipboard

Closes #10058.
2025-02-26 21:27:55 -06:00
Benjamin Nauck
b9a8730145 Spreadsheet: Center text (v+h) vertical headers 2025-01-06 18:15:30 +01:00
wmayer
02a5538fba Fix several compiler warnings:
* Fix [-Wsign-compare]
* Fix [-Wc++20-designator]: designated initializers are a C++20 extension
* Fix [-Wunused-parameter]
2024-12-13 20:28:04 -05:00
xtemp09
64b4382462 [Spreadsheet] Enable zoom in Spreadsheet (#16130)
* [Spreadsheet] Enable zoom in Spreadsheet

Closes #6094. This commit also fixes page tab order of Spreadsheet
settings in Preferences.

* Spreadsheet: apply clang-format

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-12-13 10:52:51 -06:00
wmayer
3b91fd33e0 Qt6: QColor::setNamedColor is deprecated since Qt 6.6 2024-09-11 15:41:04 +02:00
wmayer
cc54e9856f Spreadsheet: Delete key doesn't clear contents in selected cells
Fixes #15023. On macOS a different shortcut is defined for the 'Delete' key
2024-07-23 23:20:41 -05:00
wmayer
643fe0cf03 Sheet: remove double call of 'mimeData->hasText()' 2023-10-18 23:05:24 -05:00
pre-commit-ci[bot]
e92ed45df9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-09-12 13:02:35 -04:00
wmayer
b5d363baf1 Sheet: Apply clang format 2023-09-10 16:01:37 +02:00
wmayer
8027aed557 Sheet: modernize C++: use equals default 2023-08-22 12:45:58 +02:00
wmayer
25824cc363 Sheet: modernize C++: use range-based for loop 2023-08-15 20:21:20 +02:00
wmayer
52e1c7c33b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
wmayer
b6f331f4fa modernize C++: use transparent functors 2023-08-07 16:08:35 +02:00
Chris Hennes
42a910982d Spreadsheet: Fix unintended copies 2023-02-27 15:58:32 -06:00
Chris Hennes
05837719f6 Spreadsheet: Fix possible null dereference
Fixes Coverity CID 184299.
2023-02-26 10:22:37 +01:00
luzpaz
be64da3de5 Spreadsheet: fix header uniformity
+ trailing whitespace
2023-01-22 21:46:17 +01:00
wmayer
e0076161c9 Spreadsheet: move to new style connect() 2023-01-13 20:02:46 +01: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
2dd9f90f57 [Spread] Gui: remove unused includes
- also sort includes
2022-10-10 01:04:07 +02:00
wmayer
6e0f43df92 Spreadsheet: Handle language change event for context-menu 2022-09-18 19:36:24 +02:00
berniev
53ba98d636 Mod: use empty 2022-08-06 19:30:13 +02:00
wmayer
e2f1452cb8 Spreadsheet: [skip ci] Fix several clazy issues:
* Mixing iterators with const_iterators [-Wclazy-strict-iterators]
* Q_PROPERTY should have either NOTIFY or CONSTANT [-Wclazy-qproperty-without-notify]
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference]
* Missing emit keyword on signal call SpreadsheetGui::SheetViewHeader::resizeFinished [-Wclazy-incorrect-emit]
* Missing emit keyword on signal call QAbstractItemModel::dataChanged [-Wclazy-incorrect-emit]
* c++11 range-loop might detach Qt container (QStringList) [-Wclazy-range-loop-detach]
2022-07-25 11:23:27 +02:00
Uwe
763a575b23 Mod: remove some unnecessary nullptr checks 2022-07-18 12:58:12 +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
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
2df514c743 Spreadsheet: fix extra row or column when printing
If there is only one single row or column in the table
2022-05-06 08:40:11 -05: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
0penBrain
922bcea6ec Sheet: use wrapper function to clarify intention 2022-04-15 12:14:55 -05:00
0penBrain
cd007dd3c8 Sheet: enable Merge action only if at least 2 cells are selected
Both main menu and context menu
2022-04-15 12:14:55 -05:00
0penBrain
9eca8454ca Sheet: enable Split action only if only one merged cell is selected
Both main menu and context menu
 Partially fixes #6744
2022-04-15 12:14:55 -05:00
0penBrain
b33478f8d0 Sheet: update commands status when selection is changed
Notice it doesn't cover the case of the context menu actions
 Partially fixes #6744
2022-04-15 12:14:55 -05:00
wmayer
2a2b8835c0 Spreadsheet: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
wmayer
91e4e468dd Base: move ILogger sub-classes to their own source files in order to reduce including stream classes in client code 2022-03-06 10:13:47 +01:00
wmayer
5e0cfc64ee App: use forward declarations 2022-03-04 21:09:46 +01:00
Zheng, Lei
c7255f196b Spreadsheet: improve copy/cut/paste cells
Add color bound around user copy/cut ranges. Do not touch Spreadsheet
object when cutting, only do so when pasting.
2021-12-21 21:41:02 -07:00
Zheng, Lei
7ebb142b2c Spreadsheet: add menu action 'Configuration table...'
To make it easy for user to create dynamically switchable configuration
tables using spreadsheet.
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
wmayer
45de32c4e1 Spreadsheet: fix format of table cells when used for printing, by default use landscape orientation 2021-12-05 12:16:54 +01:00
wmayer
1d3822822d Spreadsheet: issue 0002957: spreadsheet direct printing 2021-12-04 23:36:11 +01:00
Chris Hennes
7c7b30e79d [Spreadsheet] Fix missing header context menu 2021-10-31 23:38:11 -05:00
Zheng, Lei
49074f5af1 Spreadsheet: add a few context menu options 2021-10-12 14:34:58 -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
wmayer
f4e0abc9d2 Spreadsheet: [skip ci] fix gcc warnings about unused variables 2021-04-03 12:21:42 +02:00
Benjamin Nauck
4e4a8df724 Spreadsheet: Fix UI issues when trying to insert rows/cols
* Add support for better translations (using pluralizations)
* Add support for inserting rows/columns after the selection
* Informs the user that it will insert rows/cols above/under/left/right of the selection
* Informs the user how many rows/cols that will be inserted
2021-04-02 19:33:06 +02:00
luz paz
786d84d288 Spreadsheet: Issue #0004473: Expose openCommand() to translation
Continuing the work to expose the undo/redo functionality to translation. This commit does so for the Spreadsheet Wb.  
Ticket: https://tracker.freecadweb.org/view.php?id=4473
2020-12-01 14:53:35 +01:00
wmayer
d6169d6478 boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00