Commit Graph

428 Commits

Author SHA1 Message Date
Yorik van Havre
6efe74a554 Merged crowdin translations 2022-03-14 12:21:01 +01:00
wmayer
0054cbddaa Fix coverity issue:
* CID 332682: Resource leak
* CID 350607: Resource leak
* CID 332677: Resource leak
2022-03-14 11:35:04 +01:00
Uwe
bda12907de [Gui] rename the Qt header list 2022-03-07 20:35:38 +01:00
wmayer
1ca7429705 Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
wmayer
58a719e207 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
95c70e7f4c App: use forward declarations 2022-03-04 21:09:46 +01:00
wmayer
032cea587d Base: implement a lightweight smart pointer for PyObject like Py::Object to reduce includes of Python.h in header files 2022-03-04 15:51:51 +01:00
andrea reale
5d5f31725d Code clean 2022-03-02 18:55:10 +01:00
andrea reale
36d865df04 fix uninitialized variables 2022-03-01 02:03:44 +01:00
Uwe
b4fff07d9e [App] Expression and Extension: remove unused includes 2022-02-25 18:06:57 +01:00
Zheng, Lei
bfb9d342d9 Spreadsheet: fix auto completer triggering 2022-02-20 22:09:07 -06:00
Yorik van Havre
19b89b1085 Merged crowdin translations 2022-02-14 12:31:57 +01:00
Yorik van Havre
b3e2c87530 Merged crowdin translations 2022-01-26 14:15:14 +01:00
wmayer
10ca067d95 Spreadsheet: unit test for expressions using an input spreadsheet
A bug was reported here: https://forum.freecadweb.org/viewtopic.php?p=564502#p564502
2022-01-24 14:20:26 +01:00
Zheng, Lei
c14e6b318e Spreadsheet: fix dependency calculation on external spreadsheet 2022-01-23 19:43:53 -06:00
wmayer
f147986fa9 App: Bugfix for NULL-Pointer dereference of Property->getName() 2022-01-16 14:30:51 +01:00
wmayer
b836712c83 Test: [skip ci] clean up documents for unit test with cross links 2022-01-15 16:34:13 +01:00
wmayer
94e2ce44b4 Test: [skip ci] add unit test with cross links
Forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=58603
2022-01-15 14:28:08 +01:00
Yorik van Havre
e33ef084ff Merged crowdin translations 2022-01-10 11:23:59 +01:00
wmayer
26f9e7869f App: replace three boolean of CellAddress::toString() with a bitmask of enums 2022-01-09 10:39:54 +01:00
wmayer
e7c2f8b703 Spreadsheet: proper implementation of mp_subscript of Mapping protocol of PropertySheetPy 2022-01-07 19:55:21 +01:00
Mark Ganson TheMarkster
8d6ff3c07b [Spreadsheet] Use DontUseNativeColorDialog parameter when using QtCol… (#5326)
* [Spreadsheet] Use DontUseNativeColorDialog parameter when using QtColorDialog::getColor()
2022-01-05 12:23:14 +01:00
Chris Hennes
4098c88171 [Spreadsheet] Use stylesheet for alias color
When setting the text color for an invalid alias, use the Qt stylesheeet
mechanism rather than QPalette, so that it works correctly with
an applied QSS stylesheeet. Also attempt to detect a darkmode stylesheet
and use lighter shade of red so that the alias is more legible. Finally,
instead of explicitly setting the text color to black when it's valid,
reset to the original stylesheet (usually an empty string). This ensures
that in a dark stylesheet the text color is legible.

Fixes #0004803.
2021-12-29 21:49:00 -06:00
Yorik van Havre
6cb3782c03 Merged crowdin translations 2021-12-29 12:20:12 +01:00
Zheng, Lei
35d7b71466 Spreadsheet: code style change 2021-12-21 21:41:02 -07:00
Zheng, Lei
0029f3206d 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
caa29060cf Spreadsheet: fix handling of absolute cell address 2021-12-21 21:41:02 -07:00
Zheng, Lei
bd201c82ce 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
7d23d5b984 Spreadsheet: support mapping protocol in PropertySheetPy
Read only mapping protocol support to retrieve a range of cell values.
Expects the key to be a string of either a single cell address or a
range.
2021-12-21 21:41:02 -07:00
Chris Hennes
82759f6203 Spreadsheet: Compilation fixes for cherry-picked commits 2021-12-21 21:41:02 -07:00
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
Chris Hennes
79cda0a1b7 Spreadsheet: Compilation fixes for cherry-picked commits 2021-12-21 21:41:02 -07:00
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
wmayer
e743c30f3b Add Global.h headers to modules 2021-12-18 14:06:40 +01:00
Mateusz Skowroński
a2b6f55d17 Fix Qt deprecation warning. QPrinter::setOrientation() is obsolete. 2021-12-11 18:46:29 +01:00
wmayer
67f8a4c61c Spreadsheet: fix format of table cells when used for printing, by default use landscape orientation 2021-12-05 12:16:54 +01:00
wmayer
d3a0bf018f Spreadsheet: issue 0002957: spreadsheet direct printing 2021-12-04 23:36:11 +01: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
wmayer
9bfab4262f Mod: change error text of Python wrapper when trying to access deleted view 2021-11-21 19:57:21 +01:00
wmayer
2c701c0985 Spreadsheet: [skip ci] return Py::None() instead of Py::Object() 2021-11-20 14:40:12 +01:00
Chris Hennes
d60a0fb760 Spreadsheet: Remove unnecessary functions & files
Remove functions from they Python code for ViewProviderSpreadsheet that
are now in SheetView, and eliminate the unneded files for SheetView now
that it's being generated by hand to facilitate pseudo-inheritance.
2021-11-20 14:40:12 +01:00
Chris Hennes
79a0c6b54c Spreadsheet: Implement Python SheetView functions
Add the following functions to the Python interface of SheetView:
* selectedRanges()
* selectedCells()
* select(cell, flags)
* select(upperLeft, lowerRight, flags)
* currentIndex()
* setCurrentIndex(cell)
2021-11-20 14:40:12 +01:00
wmayer
8eb099d4e1 Gui: add MDIViewPy.cast_to_base and implement in Python wrappers for sub-classes of MDIView 2021-11-19 15:44:23 +01:00
Yorik van Havre
a26fb4db1a Merged crowdin translations 2021-11-16 17:30:39 +01: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
wmayer
5eb97d0028 Spreadsheet: several improvements
* do not simply return with Py_None from Python handler without incrementing the ref. counter as otherwise the interpreter steals a reference and the program will crash after a while
* avoid using the plain Python C API and instead use the PyCXX API
2021-11-13 21:56:15 +01:00
wmayer
63e1f95a97 Spreadsheet: get access to the sheet view from the view provider via Python 2021-11-13 21:43:58 +01:00