Commit Graph

133 Commits

Author SHA1 Message Date
Stephan Bergmann
5678a4ce9e loplugin:nullptr (automatic rewrite)
Change-Id: Ibdb6409664cdf9499b6fec95c5de3549887b8106
2015-11-10 10:31:30 +01:00
Miklos Vajna
c044e51b99 lokdocview: assert that loading of handle bitmaps succeeded
A number of such bitmaps were removed by accident in commit
74463457b3 (android: chanhe handles to use
alias, tint handles with color, 2015-11-01).

Change-Id: I253c4b5790e82de32e6fd06896645adf360fa586
2015-11-10 09:41:09 +01:00
László Németh
63d2d50ecb gtktiledviewer: add Ctrl, Alt, Shift shortcut support
For example in Writer:

Ctrl-B for bold text
Ctrl-Shift-B/P for subscript/superscript
Ctrl-Alt-C insert comment
Ctrl-1 apply Heading 1 paragraph style

Change-Id: Iaeb8341f2cb273980b637ff2fed89585094e0d9d
2015-11-06 19:33:14 +01:00
Andrzej Hunt
799406068d sc lok: Cell Cursor callback
This only works correctly for the default zoom level - since
the updateLibreOfficeKitCellCursor call happens during the
internal / hidden rendering, it uses the internal zoom values,
which can differ from the tiled-rendering zoom values.

Conflicts:
	include/LibreOfficeKit/LibreOfficeKitEnums.h

Change-Id: Ie4f344fe771078fca10ad9d6f7a93e88fb93880a
2015-11-05 12:54:21 +01:00
Pranav Kant
93f98e98e4 lokdocview: Don't render tiles while tile buffer has changed
This is common when widget gets a zoom request, resulting in a
new tile buffer, and the tiles from the old tile buffer are still
waiting to be processed in the LOK thread, for old tile buffer. If
we allow these useless operations to execute successfully, they
would end up writing in new tile buffer giving false results.

Lets tag every paint tile operations with their respective tile
buffer during `task` creation, and then check whether the tile
buffer has changed or not before writing to the tile buffer.

Change-Id: If784341a67ad430bc3415b765137badaad6b97f6
Reviewed-on: https://gerrit.libreoffice.org/19726
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-11-04 10:31:33 +00:00
Stephan Bergmann
02b39996fa -Werror,-Wformat-security
Change-Id: I23f4b906456fdba84f2772a4ed15ac6c141a094d
2015-11-03 22:20:45 +01:00
Jan Holesovsky
8c987fabab lok: Introduce LOK_CALLBACK_UNO_COMMAND_RESULT callback.
Posting of the .uno:Something commands is asynchronous.  To be able to find
out when eg. .uno:Save finished, this commit introduces a callback that fires
when that happens.

To be able to receive such a notification, the appropriate postUnoCommand()
must be called with 'true' as the parameter for bNotifyWhenFinished (defaults
to 'false').

Change-Id: I254939ebc8ea5f309ae39686dcaaeddd5148b0c9
2015-11-03 13:25:23 +01:00
Jan Holesovsky
c0f37892a2 lok: Fix typo search-result_count -> search-result-count.
Change-Id: Iccd5b39f6bdf1c7a43131fc50186ea5a2838d77e
2015-11-03 12:59:56 +01:00
Miklos Vajna
602c1b4e29 libreofficekit: -Werror=unused-parameter
Change-Id: I89c4d9752ef650d516bed8fcdc5873de8ae87e18
2015-11-03 11:19:03 +01:00
Pranav Kant
de0c7e1783 lokdocview: Separate "painting" and "saving" of tiles
Lets separate the task of painting the tile, and saving the tile
in tile buffer using GAsyncReadyCallback. This will provide us
with better control over tiles -- cancelling the painting operation,
and filtering tiles that should not be saved in the tile buffer.

Change-Id: I6aae928d8cc0c906034570ed0e9a054763d493a3
Reviewed-on: https://gerrit.libreoffice.org/19725
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-11-03 10:18:29 +00:00
Pranav Kant
cfbc36e2ea lokdocview: Fix memory leaks
Change-Id: I5107e4fa1828145a709e1edffe02831f4faae3c8
Reviewed-on: https://gerrit.libreoffice.org/19676
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-10-31 08:01:22 +00:00
Miklos Vajna
bd0ec1e68d lokdocview: ensure private structure is allocated with operator new
It's undesirable to malloc a struct that has a TileBuffer member, while
TileBuffer doesn't have a default ctor.

Change-Id: I72dfacc0088f238ee101d84838bd7eea51ced82a
2015-10-30 08:32:24 +01:00
Pranav Kant
54409159b8 lokdocview: Emit a warning after error
Change-Id: Id8e20e6561239096438d420c65d0da6dcc7f5e2e
Reviewed-on: https://gerrit.libreoffice.org/19474
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-10-21 12:10:49 +00:00
Pranav Kant
d2d5a00e0e lokdocview: Use G_PARAM_STATIC_STRINGS
... as `name`, `nick`, and `blurb` are guaranteed to remain valid
and unmodified for the lifetime of the parameters.

Change-Id: Ic6463b470546669d5a815842daedb170df85d161
Reviewed-on: https://gerrit.libreoffice.org/19472
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-10-20 19:33:20 +00:00
Miklos Vajna
2e1503dbd0 lokdocview: log postUnoCommand() arguments
Change-Id: I0febc2b89d95bde59ad9d3a90d404b3932cc3624
2015-10-09 13:45:26 +02:00
Miklos Vajna
f0e3fe840b LOK: CALLBACK_SEARCH_RESULT_COUNT is redundant
1) The size of the searchResultSelection array in
LOK_CALLBACK_SEARCH_RESULT_SELECTION provides the same information.

2) None of the clients except lokdocview used it.

3) Only sw provided this callback, not sc/sd.

Change-Id: I9da639b6693f24634f298f9bc4773f705e944359
2015-10-09 08:09:16 +02:00
Miklos Vajna
c5ceddf344 lokdocview: invalidate after selection change
Without this e.g. Calc search does not show the selection rectangle
correctly.

Change-Id: I5bc20a93ee861d3353bc2e1c1ed7ea8d0e6c8ed4
2015-10-07 17:19:23 +02:00
Miklos Vajna
23ac7f2fb5 lokdocview: log paintTile() arguments
Change-Id: I8015c8030c1c7f53ae1de053fe268a33464834ad
2015-10-06 12:03:34 +02:00
Miklos Vajna
2b6060d6c5 gtktiledviewer: recognize LOK_CALLBACK_SEARCH_RESULT_SELECTION
Change-Id: Ib932ee36e41afcb53d15a6362b998cc673d474f2
2015-10-06 10:18:43 +02:00
Mihai Varga
a6ef571847 LOK: fixed duplicated switch case values 2015-10-05 18:08:46 +03:00
Mihai Varga
c30defcf8e LOK: add the search phrase to the search result count callback
We need this to notify the user for which search phrase no results were
found

Change-Id: I8cc7ab235b9129dfdcb022145456180ff7e4ca92
2015-10-05 17:50:20 +03:00
Mihai Varga
c90c08a65c LOK: added the button type and key modifier to postMouseEvent()
To get a better functionality we need to know the button type (left,
right, middle). We also need the key modifier (ctrl, alt, shift) for
actions such as ctrl+click (to open a link) or shift+click to select

Change-Id: Iaccb93b276f8a6870dd41cc5132dbb85d2bbf71b
2015-10-05 15:02:36 +03:00
Miklos Vajna
22d342a82f lokdocview: handle LOK_CALLBACK_SEARCH_RESULT_COUNT
Change-Id: I0d1b641654e0de65169e19bb5843ea11b43a90a3
2015-10-05 12:05:00 +02:00
Pranav Kant
c3ce35f0a1 lokdocview: Reset view completely
Resetting tiles only is not enough. We need to empty stale
selection rectangles, handle bars, cursor positions etc., so that
they do not interfere with next view to be opened using same
widget instance.

We are not destroying the document here, so the widget would
still point to the same document unless it is made to point to
another document by subsequent lok_doc_view_open_document calls.

Change-Id: I3c7cc789c8c7393b3793b4edf6aa96d54bc0b1a3
Reviewed-on: https://gerrit.libreoffice.org/18866
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-09-29 11:32:16 +00:00
Miklos Vajna
0067b4df75 libreofficekit: fix mismatched free() / delete
Change-Id: I60eb53d4bf9943fd52e0a9d8e3574a7d1cc027e0
2015-09-28 09:26:39 +02:00
Pranav Kant
392437393d Move all introspection comments to header file
... wherever possible. There are few things we can't move to
header file, for example, the comments corresponding to GObject
properties, and signals.

Change-Id: If74d61b17ccee11f8a056f3a93040d2cff2dd98d
Reviewed-on: https://gerrit.libreoffice.org/18863
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-09-25 12:03:11 +00:00
Miklos Vajna
43b2103f93 gtktiledviewer: don't crash on opening non-existing files
Change-Id: Ic48adaf038e8fbcc86a94b5e351d2f963fcfcd16
2015-09-21 07:30:26 +02:00
Miklos Vajna
d3446bc860 lokdocview: set view before calling lok::Document member functions
getTextSelection() is still to be done, but has to be moved to the
widget first.

Change-Id: I780a31f1dbce38b2b7398bfdacbbc1c40881229d
2015-09-21 07:30:22 +02:00
Miklos Vajna
c9ebc92a1e LOK: allow postMouseEvent() in multiple views
Change-Id: Iafb08cb44a96dbc03d12367d21b4120063bd0222
2015-09-21 07:30:21 +02:00
Miklos Vajna
f2e55ea106 gtktiledviewer: use setView() before postKeyEvent()
Also in SfxLokHelper::setView() set the current view shell directly,
GetFocus() in VCL may be a NOP for hidden windows.

With this, the Writer layout dump shows that two Gtk windows can have
different cursor positions correctly.

Change-Id: I81890c1d8ad7972f1194db3d5f2e9d8a39fc2f87
2015-09-21 07:30:20 +02:00
Miklos Vajna
b3498e9fcd lokdocview: set up the widget in all windows
With this finally the number of GTK+ windows always match the number
returned by SfxLokHelper::getViews().

Change-Id: Ia45bef7dea86b80cfac00e2ad7c1a16d7f5b507b
2015-09-21 07:30:19 +02:00
Miklos Vajna
e6e5c248e5 lokdocview: avoid GTK+ calls in openDocumentInThread()
GTK+ calls should be made from the main thread.

Change-Id: Idcfa46d427d6e35fc544246a691bafc72f75a74c
2015-09-21 07:30:19 +02:00
Miklos Vajna
4fd59356cb lokdocview: allow not calling documentLoad()
Change-Id: I2ff57c4be11cd3908bc951ebf572a2c02e2c4585
2015-09-21 07:30:17 +02:00
Miklos Vajna
88b6dd3ea7 lokdocview: GTK+ calls should be made from the main thread
Change-Id: Ia76ef111170700ef507550222ca917986d4fe00e
2015-09-11 11:43:22 +02:00
Pranav Kant
520053459a Fix incomplete g-i annotations
Change-Id: I2665a12251921523045f4071df88ca69ecd5a5c0
2015-08-19 12:02:17 +02:00
Pranav Kant
a9b266aeea gtktiledviewer: Jump to cursor position when it changes
Change-Id: If50ac0bd21e59b0e0639aa353513451e88ae2a9f
2015-08-17 11:49:34 +02:00
Pranav Kant
4df957f725 lokdocview: Don't use extern variable: lokThreadPool
Change-Id: Ia208e3309bb64baf71ceb97cdf1b3b57b6120353
2015-08-04 14:55:57 +02:00
Jan Holesovsky
512b782cf4 LOK: Implement parts for Writer too.
In Writer, the meaning of 'parts' is a bit different than in Calc or Impress.
In Writer, the parts mean pages, and the document does not give a completely
different view, the cursor just jumps to the given page.

It is up to the client to follow the cursor appropriately to have the desired
effect.

Change-Id: I56b3264e0340cd639bdabfa92b74b52bd1f391a5
2015-08-01 02:23:32 +02:00
Miklos Vajna
b120adb290 libreofficekit: -Werror,-Wformat-security
Change-Id: I177ea091fb1061d9fa71f7fb1a84629128afd6a0
2015-07-28 16:35:02 +02:00
Pranav Kant
2d2b392dcd lokdocview: post_command arguments are not supposed to be const
Change-Id: Ibc22d03d9eee9fd151ecf5773e36c2519141a5eb
2015-07-28 15:04:15 +02:00
Pranav Kant
7c45a57081 lokdocview: setGraphicSelection in another thread
Change-Id: Ib7a6bf63ee6f300c6c5d50d02a3465d0a075a5be
2015-07-28 15:04:15 +02:00
Pranav Kant
de9224bf96 lokdocview: Move postMouseEvent in separate LOK thread
Change-Id: I9d1a08db2a91a596d3039a2388c22e6ea76dc2b1
2015-07-28 15:04:15 +02:00
Pranav Kant
4fb3d2e6be lokdocview: Use only one ctor for instantiating LOEvent
... and set each member variable manually.

Additionally, improves documentation of the struct LOEvent.

Change-Id: I2e8e1dc70298dc85943769e2f01c6127eedb8207
2015-07-28 15:04:15 +02:00
Pranav Kant
ee0f4f75d2 lokdocview: Follow the camelCase naming convention
Change-Id: I05582d33ee3535d4b677fa8138c9d573585a4252
2015-07-28 15:04:14 +02:00
Pranav Kant
57ec1780d6 lokdocview: Cannot use same GTask object for all calls.
Change-Id: I875d49a9e4360659087ae70456edefb15bc57b20
2015-07-28 15:04:14 +02:00
Pranav Kant
a7f12df929 Use thread pool for LOK call: paintTile()
Change-Id: I45e94248013277affa11e91439fbc16995b8ed8e
2015-07-28 15:04:14 +02:00
Pranav Kant
e032b64451 lokdocview, tilebuffer: Add DOxygen comments
Change-Id: I27377f0a758729a7877cfc6a56ea1b4bb3d1c3c9
2015-07-28 15:04:14 +02:00
Pranav Kant
4edbf5a01f lokdocview: Make paintTile() async
Change-Id: I57db9e3adf26996e6e1e105b8b95f53e88e7760f
2015-07-28 15:04:14 +02:00
Pranav Kant
a433ea9f46 lokdocview: Use a thread pool for most LOK calls
This is a thread pool with just single thread because LOK is
single threaded; using multiple threads in this case would be
useless.

Primary reason we are using a thread pool here is to avoid the
overhead in spawning a new thread for each LOK call.

Change-Id: Ibbfdb7cb0a8ef9f07bcc659e65ce8997716aa245
2015-07-28 15:04:14 +02:00
Pranav Kant
da129b682f lokdocview: Emit load-changed signal showing load progress
Change-Id: I69b4c05d12c0c0b2ca6b7d1ad76ed74cc1f4346a
2015-07-28 15:04:13 +02:00