323 Commits

Author SHA1 Message Date
Pranav Kant
b3178e2fce lokdocview: 'comment' signal for comment callbacks
Change-Id: I82040893added83ff13395db3917b230ef6b01d5
2017-01-27 21:57:01 +05:30
Pranav Kant
3616f875b0 lokdocview: Separate gobject property for turning off comments
Pass --enable-tiled-annotations to gtktiledviewer on command line
to turn comments on again, by default they are turned off now.

Change-Id: I40e93ab683ec9538e088ae9aa83cda2eaaf9939e
Reviewed-on: https://gerrit.libreoffice.org/33622
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-01-27 16:13:04 +00:00
Pranav Kant
5f5073a845 lok: Implement new callbacks for comment notifications
Change-Id: I298183b295c68c4a39cb1f6fffe4b89b4eaee0f3
Reviewed-on: https://gerrit.libreoffice.org/33469
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-01-27 11:50:02 +00:00
Pranav Kant
0f0164d647 lokdocview: Turn off annotations rendering here
Change-Id: Ia1ee4f54a05ab3daca62a78fe335e731e4cfc02d
Reviewed-on: https://gerrit.libreoffice.org/33465
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-01-27 10:48:56 +00:00
Noel Grandin
c5df32e5cb loplugin: unnecessary destructor jvmfwk..lotuswordpro
Change-Id: Iaa4f9b178ab265342255066af7fff09f5b33ab37
Reviewed-on: https://gerrit.libreoffice.org/33496
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-01-24 15:56:31 +00:00
Pranav Kant
5128e503ba lokdocview: Handle keypad enter
Change-Id: Ia892c346d4a3c0a5439c7977963cc502d287e6f7
Reviewed-on: https://gerrit.libreoffice.org/33445
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-01-23 07:00:23 +00:00
Stephan Bergmann
7267e2b50d New loplugin:externvar: libreofficekit
Change-Id: Ib2a19249e1dd8d187b1fdc5559a9b4b9c2825e8c
2017-01-09 15:42:20 +01:00
Pranav Kant
de6e3d1e87 lokdocview: Handle insert key
Change-Id: Idb5ad17a3a94b9a6fba1113a759207c59acfb7bd
2017-01-06 14:33:36 +05:30
Muhammet Kara
8885343a33 Fix inefficient usage of string::find() in condition (CWE597)
string::compare() will be faster when string::find's result is
compared with 0, because it will not scan the whole string.

Change-Id: I78596a6d796fe9779f88b7c7b91da09aa27b7035
Reviewed-on: https://gerrit.libreoffice.org/32430
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-01-02 10:39:04 +00:00
Noel Grandin
6320a0f210 revert string::find changes
this reverts

    commit 610f59651563205564a0f4818b5c1d347ca02132
    fix "cppcheck:stlIfStrFind"

and

    commit 5c1bb338ef0d781648d5b33ffc9d64c2be6d9926
    cppcheck:stlIfStrFind

which are deficient in one way or another, the original logic, while
inefficient, is still most accurate

Change-Id: I4907d2569c9c2976533f8ac9f4b8b45eb1807b72
2016-10-24 11:30:14 +02:00
Noel Grandin
610f596515 fix "cppcheck:stlIfStrFind"
in commit 5c1bb338ef0d781648d5b33ffc9d64c2be6d9926, compare does not do
a startswith

Change-Id: If518b3f6880848a5b5463c09fb73974d972010fd
2016-10-24 10:56:08 +02:00
Julien Nabet
5c1bb338ef cppcheck:stlIfStrFind
Change-Id: Ic3c1b37b0c2cf9995e0bd1017cdbaed427fb296c
Reviewed-on: https://gerrit.libreoffice.org/30185
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-24 06:11:08 +00:00
Marco Cecchetti
21327496cb LOK: handle "EMPTY" invalid tile msg with part number in payload
What's new:
1) RectangleAndPart handles "EMPTY" payloads
2) LOK_CALLBACK_INVALIDATE_TILES msg type with "EMPTY" payload are
handled in CallbackFlushHandler::queue
3) gtktiledviewer handles "EMPTY" LOK_CALLBACK_INVALIDATE_TILES msg
even if the part number is included in the payload

Change-Id: I21f4a71ec875d24f4bbd100e4aacf8437d745ae4
2016-10-14 14:16:24 +02:00
Stephan Bergmann
1dac51334b Handle loplugin:fpcomparison false positives by whitelist
Change-Id: I58e2beb0695a27922856bd8f8988d9e4508aceb6
2016-10-10 13:10:48 +02:00
Eike Rathke
2135eae2a9 let approxEqual() not scale too early for large representable integer values
And since this is now too much code for inline move implementation to math.cxx
Which again made it necessary to give libreofficekit lokdocview.cxx its own
implementation that doesn't even claim to build against sal ...

Change-Id: I0f80be9d9172ee20693b9babde715206f2c3d8c1
Reviewed-on: https://gerrit.libreoffice.org/29428
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
2016-10-01 22:55:57 +00:00
Miklos Vajna
d5263c2c56 LOK: conditionally include part number in invalidation payload
Since desktop/ code queues, compresses and only emits callbacks on idle,
it's possible that two invalidations are in the queue, and there was a
setPart() call between them. In this case it's impossible to tell what
part the invalidation was sent for.

Fix this by conditionally including the part number in the invalidation
payload. It's off by default, a new feature flag is added to request
this behavior.

gtktiledviewer enables this feature flag by default, though just to show
the part number in the debug output. Android doesn't enable it.

Change-Id: I73e6def848c0eb61d64e71026002c7a0e750aab4
2016-09-29 12:53:02 +02:00
Miklos Vajna
d778828745 lok::Document::getCommandValues: expose sw redline author colors
These colors are used in the tiles, so it's a good idea if the client
can use matching colors for cursors and selections. But to be able to do
that, we need an API to expose these colors.

Change-Id: Ia688c07e6c300fecdf8dc428d5a3f000d1857387
2016-09-21 19:32:01 +02:00
Miklos Vajna
28447258fb lokdocview: guard against int overflow
If a too large rectangle is parsed, the width or the height may be
larger than std::numeric_limits<int>::max(), in that case just set
width/height to that max value, instead of allowing an overflow.

Change-Id: Ic01319b01a3f9286501c346ea765868be57466a1
2016-09-20 20:38:51 +02:00
Miklos Vajna
dc00592b4e lok::Document: rename getViews() to getViewsCount()
As this only returns the number of views, not the actual views. Since
it's a rename, it's just an API (but not an ABI) change.

Change-Id: Ib4f0ea56a90e5ae9c80ee1781aa2f29aff4259e7
2016-09-16 12:36:28 +02:00
Marco Cecchetti
b7b62d4a59 gtktiledviewer - Calc fix: selection handlers were not removed
Change-Id: I2b4ad4dbf281458d0994eff176a2f62e20fb603b
2016-09-12 11:04:25 +02:00
Miklos Vajna
127a34ef2c lokdocview: handle empty LOK_CALLBACK_DOCUMENT_SIZE_CHANGED payload
Calc omits the document size in the payload in several cases, and
online.git handles that, so handle it in lokdocview as well for now,
instead of fixing up all the sc code to always emit the doc size in the
payload.

Change-Id: Ib2cca1770d2a160e32540e3a3158eb00bf13207b
2016-08-31 13:33:47 +02:00
Tor Lillqvist
8f96ab602a Emit notification to a LibreOfficeKit client also when a redline is modified
Work in progress, not all modifications to a redline record cause
notifications yet.

Change-Id: I01614cd6ede9576e9cc329889fef86342567325f
2016-08-29 11:02:58 +03:00
Caolán McNamara
3ad3365c4f coverity#1354270 Uninitialized scalar field
Change-Id: I770e02a6f7ef09c50cf93982dd88dfdb1a163bea
2016-08-28 13:38:24 +01:00
Miklos Vajna
0bc553f3ef sw lok: add callbacks for redline table insertion / removal
An alternative would be to follow the Manage Changes dialog approach and
subscribe to the SFX_HINT_DOCCHANGED notification in SwDocShell, cache
the old redline table and find out the differences to the current one,
but that way sound much more complex without benefits.

Change-Id: I20a45285b88255ccea9d6646c0b5288ac1c91879
2016-08-19 16:21:32 +02:00
Caolán McNamara
951ceab401 coverity#1371131 Dereference after null check
Change-Id: I292ac0b59af2ed8897367d56ddb01bf4606a7693
2016-08-18 21:08:40 +01:00
Miklos Vajna
f2afe318ce gtktiledviewer: specify author name when calling initializeForRendering()
Open two views, and type into both of them when a Writer doc with
redlining enabled is open: the manage changes dialog now shows how the
correct author is used when creating the redline items.

Change-Id: I48fb90301bfcc04b06d5be5544324ca76fe7b3d7
2016-08-18 11:37:59 +02:00
Miklos Vajna
a141cba766 gtktiledviewer: expose undo/redo info in a repair document dialog
This shows the full undo and redo stack, with all the metadata available
via the LOK API.

Also fix SfxUndoManager::GetRedoActionsInfo(), so it's easy to show the
undo/redo stack in linear time; and fix a use-after-free in lokdocview.

Change-Id: I66625ed453efa61b5738d99d7d1ad8f468908240
Reviewed-on: https://gerrit.libreoffice.org/27913
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-08-05 19:08:09 +00:00
Miklos Vajna
57c8915376 lokdocview: draw a lock inside the lock indicator
Hopefully less confusing, the crossed out rectangle is also used inside
the tiles for deleted comments, and the two are independent.

Change-Id: Id06fbf6ec1b21dfbab1c126c3c432f91cf51430c
Reviewed-on: https://gerrit.libreoffice.org/27503
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-25 08:41:10 +00:00
Miklos Vajna
897189cfc6 sw: add new LOK_CALLBACK_VIEW_LOCK callback
When we're after SdrBeginTextEdit(), but before SdrEndTextEdit(), and
have multiple views, then only the active view paints the edited text,
the other views look like the shape has no text at all.

Add a new callback that exposes the position and size of the rectangle
where the shape text will be painted after text edit ended, so clients
can draw some kind of locking indicator there. This way the rendered
result can differ in the "shape has no text" and the "shape text is
edited in an other view" cases.

Change-Id: I6096479a8a05c2547d15222e6d997b848af02945
Reviewed-on: https://gerrit.libreoffice.org/27441
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-22 15:13:07 +00:00
Miklos Vajna
3c425926d4 lokdocview: still allow view selections/cursors from other Writer views
Writer pages are exposed as parts, but it still makes sense showing
selections/cursors from other parts in that case.

Change-Id: Ic76d93291bde2d959c149cf2ef5eba7ed33a45e8
Reviewed-on: https://gerrit.libreoffice.org/27321
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-19 15:15:27 +00:00
Miklos Vajna
1ba00c2173 lokdocview: handle part number in view selections/cursors
This way we show view selections/cursors from other views only in case
the part number matches. Anything else looks buggy in Calc/Impress.

Change-Id: If3ecbfc4b05350606730319b1a570afc15fd9d0a
Reviewed-on: https://gerrit.libreoffice.org/27315
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-19 12:29:59 +00:00
Miklos Vajna
8090b53e0e lokdocview: ignore notifications on view shutdown
Callbacks are processed on idle on the main thread, so by the time we
parse them, possibly the widget is already gone, avoid that problem.

Change-Id: Ie8e16423d1ffe087e0dd21425026f7a5d644c27b
2016-07-15 18:07:44 +02:00
Miklos Vajna
99f05d9947 gtktiledviewer: allow testing of destroyView()
By calling it when we're not the last window.

Change-Id: I6fd4763243fc088ccfe015b6c03b6b3f25146fac
2016-07-15 16:09:26 +02:00
Pranav Kant
a54d466edc lokdocview: This can be fired even without document
... so handle it and avoid the assert

Change-Id: Ib244746fabeaf41b5ca927d94fc4c3bda19bef26
2016-07-13 12:19:48 +05:30
Pranav Kant
5ff1e6bdf7 lokdocview: Add missing callbacks
Change-Id: I2fd32bb210f1b5f0a090c29af707cb6ca6e8dd77
2016-07-13 12:03:56 +05:30
Miklos Vajna
29089b562e lokdocview: log the view id of the callback messages
So that e.g. it's possible to see which invalidation affects which view.

Change-Id: I6b6db2fa07eaecd1315ce8160c3b3b86e9e5a348
Reviewed-on: https://gerrit.libreoffice.org/27138
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-12 11:58:43 +00:00
Miklos Vajna
af8419fa1d sw lok: add LOK_CALLBACK_VIEW_CURSOR_VISIBLE
With this, in case a text cursor is turned into a graphic selection in
view#0, then view#1 can also hide the text cursor of view#0.

Change-Id: I7de89b8537ef8b0985336793b719d93733604bff
Reviewed-on: https://gerrit.libreoffice.org/27044
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-08 13:46:10 +00:00
Miklos Vajna
3ebfc5b955 svx lok: add LOK_CALLBACK_GRAPHIC_VIEW_SELECTION
So a view can be aware where the graphic selections of other views are.

Change-Id: I0cc420cfe4bf3824fbfa1a58da889cac5e9a7b60
Reviewed-on: https://gerrit.libreoffice.org/26863
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-01 17:20:17 +00:00
Miklos Vajna
cca44fe229 lokdocview: replace handle_graphic.png with manual drawing
If we draw a black graphic handle manually, then it's possible to color
it later, this isn't easy if a bitmap is painted.

Change-Id: Ib4456fd5155862d52e3ffa79ee49c7bfd16fb742
Reviewed-on: https://gerrit.libreoffice.org/26860
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-01 16:02:01 +00:00
Miklos Vajna
68c5c0bb7e sc lok: add LOK_CALLBACK_CELL_VIEW_CURSOR
So a view can be aware where the cell cursors of other views are.

Change-Id: Ifcf06c0019c6af8b859e2e92222e4f3fd18da74f
Reviewed-on: https://gerrit.libreoffice.org/26844
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-07-01 09:28:49 +00:00
Miklos Vajna
bfd4234fd8 lokdocview: avoid pointless setView() before getView()
This fixes the following use-case:

1) Start gtktiledviewer, click New View
2) Click Edit in the first view
3) Click somewhere in the document in the first view -> nothing happens

Change-Id: I79d63538607f03b78851a639adf158d918745276
Reviewed-on: https://gerrit.libreoffice.org/26789
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-30 07:45:45 +00:00
Miklos Vajna
615c37503c LOK: change back type of view ids to int
Commit 45c2410041c48c22bd860efb42d4daadad7869b0 (LOK: change type of
view ids to uintptr_t, 2016-06-17) fixed the problem of view IDs being
reused for the price of random IDs, which makes debugging harder.

Implement a simple shellToView() function that makes sure view IDs are
not reused, and stop exposing view shell pointer addresses, which allows
reverting the LOK API change.

Change-Id: I63089e6de08ee7e1c7706757d43a11f6cf4d6e06
Reviewed-on: https://gerrit.libreoffice.org/26773
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-30 06:16:28 +00:00
Miklos Vajna
380a646b95 lokdocview: ensure setView() + doSomethingElse is atomic
Otherwise it's possible that a keystroke is sent in for a different view,
when that other view reacts to an invalidation (invoking paintTile())
caused by a previous keystroke.

I.e. open two views, place the cursor at different positions, type fast,
and some of the characters appeared at the incorrect view.

Change-Id: Ie5e471f1b9c2d69adaa87111fba74d4abe184ef8
Reviewed-on: https://gerrit.libreoffice.org/26562
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-22 07:07:40 +00:00
Miklos Vajna
45182f36ef sw: add LOK_CALLBACK_TEXT_VIEW_SELECTION testcase
Fails with 9f66db9c474f71f43d7a3667230241fd4fa4183f (sw lok: add
LOK_CALLBACK_TEXT_VIEW_SELECTION, 2016-06-21) reverted.

Change-Id: Ide21167ce2dc4287b1860b5f03a6975dc9edd4c6
Reviewed-on: https://gerrit.libreoffice.org/26550
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-21 13:34:01 +00:00
Miklos Vajna
6b9053d371 lokdocview: handle LOK_CALLBACK_TEXT_VIEW_SELECTION
It's similar to the normal selection, but it's colored and has no
handles.

Change-Id: Ibd9594b4834ff4f9b1cfd85912ed5cee3c8b8c71
Reviewed-on: https://gerrit.libreoffice.org/26543
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-21 11:32:16 +00:00
Miklos Vajna
9f66db9c47 sw lok: add LOK_CALLBACK_TEXT_VIEW_SELECTION
So a view can be aware where selections of other views are.

Change-Id: I5026b1ff2b99a4eedfd0bde32a05ceb8e2f424bc
Reviewed-on: https://gerrit.libreoffice.org/26542
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-21 11:17:10 +00:00
Pranav Kant
90c75f775b lok: Expose LO version information
Change-Id: Ided924e928c04385457c7a2e231fdf57e7e38970
2016-06-21 14:35:59 +05:30
Miklos Vajna
ada901d2c4 lokdocview: handle LOK_CALLBACK_INVALIDATE_VIEW_CURSOR
It's similar to the normal cursor, but it's colored and does not blink.

Change-Id: I6a869a98f46979946f320905426e016fe011cbc6
Reviewed-on: https://gerrit.libreoffice.org/26522
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-20 16:23:25 +00:00
Miklos Vajna
c544a8b674 sw lok: add LOK_CALLBACK_INVALIDATE_VIEW_CURSOR
So a view can be aware where cursors of other views are.

Change-Id: I6133fb55aa2869843c0284b7d76264bab3b3d5da
Reviewed-on: https://gerrit.libreoffice.org/26513
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-20 15:12:54 +00:00
Miklos Vajna
45c2410041 LOK: change type of view ids to uintptr_t
This fixes the following problem:

- createView() = 1
- createView() = 2
- destroyView(1)

and then view #2 was renumbered to 1.

Instead expose the pointer address of the SfxViewShell as the ID, which
is not changing in such a situation.

Note that the SfxViewShell <-> ID mapping is an implementation detail of
SfxLokHelper, and only pointers are converted to IDs, user-supplied IDs
are never converted back to pointers.

Change-Id: If79ef8b99ba391011b5d82b219ad13447d44cd5a
Reviewed-on: https://gerrit.libreoffice.org/26423
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-17 16:00:44 +00:00