323 Commits

Author SHA1 Message Date
Miklos Vajna
60e57960f2 lok_doc_view_reset_view: don't touch the view id
Otherwise the following can happen:

- view #0 is created
- view #1 is created
- view #1 changes part, so lok_doc_view_reset_view() gets called
- view #1 calls postMouseEvent(), but claims it happened on view #0

Also log all setView() calls in the widget.

Change-Id: Iefcf82d9396b2af75586e79dde59998320f41d60
Reviewed-on: https://gerrit.libreoffice.org/26245
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-14 11:02:54 +00:00
Pranav Kant
0241896fad lokdocview: Add debug info; paintTile rendering time
Change-Id: Icdb14e9a5fedb3dcfbad502e323b333c3dbcc534
2016-05-11 21:33:06 +05:30
Stephan Bergmann
14cd5182c5 Replace fallthrough comments with new SAL_FALLTHROUGH macro
...which (in LIBO_INTERNAL_ONLY) for Clang expands to [[clang::fallthrough]] in
preparation of enabling -Wimplicit-fallthrough.  (This is only relevant for
C++11, as neither C nor old C++ has a way to annotate intended fallthroughs.)

Could use BOOST_FALLTHROUGH instead of introducing our own SAL_FALLTHROUGH, but
that would require adding back in dependencies on boost_headers to many
libraries where we carefully removed any remaining Boost dependencies only
recently.  (At least make SAL_FALLTHROUGH strictly LIBO_INTERNAL_ONLY, so its
future evolution will not have any impact on the stable URE interface.)  C++17
will have a proper [[fallthroug]], eventually removing the need for a macro
altogether.

Change-Id: I342a7610a107db7d7a344ea9cbddfd9714d7e9ca
2016-05-10 16:42:16 +02:00
Miklos Vajna
99ea437f75 lokdocview: log postMouseEvent() arguments
Change-Id: Idd4db9259448d3dcf4e0820b8845a1ab395f0bff
Reviewed-on: https://gerrit.libreoffice.org/24427
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-04-27 15:00:36 +00:00
Miklos Vajna
f9ade68d8d lokdocview: log setGraphicSelection() arguments
Change-Id: I36af712274e1a3f9dacd5d62ab42032ca9e9acdd
Reviewed-on: https://gerrit.libreoffice.org/24390
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2016-04-26 12:12:04 +00:00
Miklos Vajna
df784ec1bf tdf#99314 lokdocview: add new userprofileurl property
So that users of the widget can use a custom user profile, allowing
running widgets users and LibreOffice in parallel.

Change-Id: I1bd0a8e53aa3216adc721052cf30f0dd174327bd
Reviewed-on: https://gerrit.libreoffice.org/24237
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-04-19 08:10:35 +00:00
Pranav Kant
610db8d5d0 lok context menu: Expose context menu
Change-Id: I0968689630e10f838c075e86357eb36a9a220d0d
2016-04-08 09:43:50 +02:00
Miklos Vajna
73e6b95ed2 cid#1354270 fix uninitialized members
Change-Id: I35fda96885375996a1b0b05ecc04a0ac35104b88
2016-02-25 21:22:19 +01:00
Pranav Kant
f4e13bc973 tdf#97235: Protect reset_view when called with no tile buffer initialized
This can happen when no document has been loaded yet.

Change-Id: Ib9c18e22b6c344528d05eb781bf9b3052060089a
2016-02-21 22:14:40 +05:30
Pranav Kant
dbd7ce16d6 tdf#97236: Refresh the view when part is changed
Change-Id: I189d33cd25f394f5740d54fb5fe5567ac71299e4
2016-02-21 22:14:28 +05:30
Pranav Kant
60b1fb6edb lokdocview: Protect set_part from setting an invalid part number
Change-Id: Iffbe71ab161d5c50a98fd17ee0fdd0ab4d065e9d
2016-02-21 22:08:10 +05:30
Pranav Kant
58ec66da42 lokdocview: Center the widget vertically inside the allocation
Change-Id: I891519d54212ecd99273a54aca2a44e2d54c1933
2016-02-14 20:45:19 +05:30
Pranav Kant
f01bac5cc2 tdf#97301: Return silently when no document is loaded
Change-Id: Id6cf77ee7597fb992a306649c2f2a3639bf6dad8
2016-02-14 02:54:39 +05:30
Miklos Vajna
12c59662f7 cid#1351879 missing break
Change-Id: I3e86b57b6384370666f023115ae7d4671f1eaca1
2016-02-05 21:05:26 +01:00
Noel Grandin
4e9b528dcc new loplugin fpcomparison
Find code that compares floating point values with == or !=
It should rather use rtl::math::approxEqual

Change-Id: I9026e08823340fa1d6a042c430515344c93215bd
Reviewed-on: https://gerrit.libreoffice.org/21997
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-04 06:41:35 +00:00
Jan Holesovsky
c406c90289 lok interaction handler: Add handling of io and network errors.
Change-Id: If7c84a7b24f2072439718fb0c473b73243f2ecc1
2016-02-03 10:33:04 +01:00
Pranav Kant
18fbddcca5 lokdocview: Handle password protected documents
Change-Id: I606a1112c8eb4c1cc4596d6947ce1223543cc87c
Reviewed-on: https://gerrit.libreoffice.org/21861
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2016-02-02 12:29:51 +00:00
Miklos Vajna
bd8610ebaf LOK: add Document::setClientVisibleArea()
... and implement it in Writer.

Otherwise there is no way we can perform e.g. page down in an expected
way. Without this, the core visible area depends on the zoom in the
document, and the client visible area can be something entirely
different.

Change-Id: Iadfb5a225da09a2551ffa41ddf503bb3d22b3eae
2016-02-02 10:56:40 +01:00
Miklos Vajna
9d8b330794 lokdocview: add a set_visible_area()
Change-Id: Ib63959ad64fe52b648e0c0d3fe6d49fb282d57ee
2016-02-02 10:56:40 +01:00
Miklos Vajna
c84e1e2521 lokdocview: call lok::Document::setClientZoom() after zoom change
This is similar to what is implemented in online.git's leaflet. If the
zoom factor changes, then inform LOK about it on the first keyboard hit.

Change-Id: I2db4ffed3897db5c852f4b8aea8f4e2d3500a25a
2016-02-01 18:56:23 +01:00
Miklos Vajna
dfe5531ec8 lokdocview: log lok::Document::postKeyEvent() arguments
Change-Id: I16e7c0fee34077d5bbb493d9d9502ff82355c2c6
2016-02-01 18:56:23 +01:00
Michael Stahl
23a0ee3c01 libreofficekit: password interaction optional and off by default
Add setOptionalFeatures() function that clients must call during
initialization, and enum LibreOfficeKitOptionalFeatures.

Change-Id: I73035193c87033052921c3aad94fdc057fe81111
Reviewed-on: https://gerrit.libreoffice.org/21809
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2016-01-27 08:26:19 +00:00
Michael Stahl
2b63e576a5 libreofficekit: ask for password when loading encrypted documents
Change-Id: I3b3b0c0e64965280c24842b0cf70a21b8abb4dfb
2016-01-25 12:31:39 +01:00
Miklos Vajna
455069c6ec lokdocview: handle page down and page up
Change-Id: I119633474236faa95ecf5fd26cd89789b313e382
2016-01-22 19:19:00 +01:00
Miklos Vajna
3d6dd6d83d lokdocview: log lok::Document::getTextSelection() parameters
Change-Id: I7706fe40705bc74bcebd53b58239c4b159bab7c0
2016-01-22 19:19:00 +01:00
Pranav Kant
070bfedb7c lokdocview: Center the widget inside the allocation
Change-Id: I8d7f8ffb1c5ddd07ccf7d56bdf0ccc866c927401
Reviewed-on: https://gerrit.libreoffice.org/21624
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Pranav Kant <pranavk@gnome.org>
2016-01-20 14:12:53 +00:00
Pranav Kant
11a3449429 lokdocview: Package and install selection handles
Now since, LOKDocView has started to get clients, we need to ship
all of its dependencies with the widget.

Reviewed on:
	https://gerrit.libreoffice.org/21605

Change-Id: I874eb416587a80b7760c5f00183d6004dfca4cce
2016-01-19 18:04:52 +01:00
Miklos Vajna
42cf5fe304 libreofficekit: log document paste arguments
Change-Id: I0e7783cf73d2d4bfcd4f0c75ca3ad82336048b27
2016-01-15 14:33:02 +01:00
Debarshi Ray
3ba1b60c97 lokdocview: Fix WARNING when creating an error
A GError needs a valid GQuark as the domain. Passing 0 leads to:
  GLib-WARNING **: (gerror.c:408):g_error_new_valist: runtime check
    failed: (domain != 0)

Change-Id: I2f252eaa83a1519b5d16c7ba22c8f593732807ca
Reviewed-on: https://gerrit.libreoffice.org/21261
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Pranav Kant <pranavk@gnome.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-01-11 12:30:58 +00:00
Stephan Bergmann
ac1f0b5904 Silence loplugin:implicitboolconversion between bool and gboolean
Change-Id: I83ce360622eea0fb805833650c0d2126bcd5d8db
2016-01-11 13:24:33 +01:00
Pranav Kant
ba539fa91f tdf#96513: Limit LOKDocView's zoom in [0.25, 5.0]
Change-Id: Ibee485909dca1ea4a3774fca7a840afbf2d9883c
Reviewed-on: https://gerrit.libreoffice.org/20819
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
2016-01-11 11:34:54 +00:00
Pranav Kant
4200a678fb tdf#96421: Return if no window is realized
Change-Id: I13de7e6eae4e73932e8441ba2e2ad3e4ff888f41
Reviewed-on: https://gerrit.libreoffice.org/20799
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
2016-01-11 11:23:50 +00:00
David Tardon
080a9c3a51 iostream is not needed
Change-Id: I481b402e0d3b42de5b486a159acb8a25e345b8b8
2016-01-11 12:20:36 +01:00
Pranav Kant
02b49890d5 lokdocview: Use shared_ptr to fix a possible memory leak
Possible because boost::property_tree can throw an exception.

Change-Id: I68394ce3b30d448d40d8e22555bafdff1ffa6092
Reviewed-on: https://gerrit.libreoffice.org/21309
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2016-01-11 11:19:46 +00:00
Pranav Kant
398ef76d5d tdf#96514: Emits a 'notify' signal when zoom changes
Change-Id: I5f55e4cce26096afcae3ad3711efa37757aada39
Reviewed-on: https://gerrit.libreoffice.org/20798
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-30 09:46:32 +00:00
Pranav Kant
81f31f5151 lokdocview: Use an array to install properties
This way we can directly reference any property by pointers to
GParamSpec stored in a static array, rather than looking for
property using property name. The former is a faster approach.

This will come in handy for functions, such as, g_object_notify
which needs to access properties to notify the object of any
property change in a faster way.

Change-Id: Ic4087bff3bdb63a3e8853d158c7af688e5e67811
Reviewed-on: https://gerrit.libreoffice.org/20797
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-30 09:37:37 +00:00
Caolán McNamara
92305c3c41 coverity#1315075 Uninitialized scalar field
Change-Id: I003839589354f02f8064b6a6af6174d2793b9b3a
2015-12-21 10:46:57 +00:00
Caolán McNamara
746da6b7fb coverity#1343633 Resource leak
Change-Id: I2384091557c2a3b061e2c60118309f35b65b45d6
2015-12-19 18:10:13 +00:00
Caolán McNamara
5b05a3fa2d coverity#1343632 Resource leak
Change-Id: I79bf35a4c1a2f0463abc202f6c2b104ffdd5139c
2015-12-19 18:10:12 +00:00
Caolán McNamara
169298fa73 coverity#1343631 Resource leak
Change-Id: Ic5d7c88ae4080c2e103fb691c2e326a9e239aa12
2015-12-19 18:10:12 +00:00
Pranav Kant
df4a196b8f lokdocview: Return if no document is set
For example, when document has been destroyed using
lok_doc_view_destroy_document()

Change-Id: I531b85018ffa25bcf88fb101c912b9f11b489a97
Reviewed-on: https://gerrit.libreoffice.org/20779
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-17 15:52:54 +00:00
Pranav Kant
b902432b43 lokdocview: Use GLib basic types
Change-Id: I07add7b9dcb1dc53d7ed61ff71545489de3be155
Reviewed-on: https://gerrit.libreoffice.org/20778
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-17 15:47:43 +00:00
Pranav Kant
a2682e4b08 lokdocview: Superfluous *_set_zoom() call on widget initialization
G_PARAM_CONSTRUCT implies that parameter will be set upon widget
initialization which means calling lok_doc_view_set_zoom() while
document still points to null.

Change-Id: Ib576ac3b32c2349be2b2df6067ae79a056a03028
Reviewed-on: https://gerrit.libreoffice.org/20775
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-17 15:45:24 +00:00
Pranav Kant
244aad533b lokdocview: Remove an easy FIXME
Change-Id: I8305f3eb45330f457089ca0524a0df004410f59c
Reviewed-on: https://gerrit.libreoffice.org/20774
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-17 15:44:09 +00:00
Miklos Vajna
032e34d001 tdf#96250 LOK: guard against 0 pRenderingArguments
Change-Id: Ifa39777795ce966662c31c891ffc1b9b1a297b00
2015-12-16 20:31:47 +01:00
Pranav Kant
ea5c99428f tdf#96384: Add a new signal 'text-selection' to lokdocview
To help client know when the user has selected a non-null text.

Change-Id: Ie939612fc5f38e2e50e9ad9792e04e89ae918886
Reviewed-on: https://gerrit.libreoffice.org/20621
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2015-12-11 14:02:33 +00:00
Ashod Nakashian
deb9203741 Crash fix in gtktiledviewer when creating new view
Change-Id: I85bb71e775f300214e05e75636bbee200d35ffaa
Reviewed-on: https://gerrit.libreoffice.org/20418
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-10 14:43:49 +00:00
Stephan Bergmann
fb8a3fac5d loplugin:nullptr: More NULL -> nullptr automatic rewrite
Change-Id: Ie83819e2bcdc5fa160b39296b005ca9a5ff74b1d
2015-12-10 08:06:06 +01:00
Pranav Kant
7d7fad258d tdf#96317: Add API for copy/paste from/to the widget
Change-Id: Iac869ddb65cbdd2227f96d047d83159ca7819f11
Reviewed-on: https://gerrit.libreoffice.org/20534
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2015-12-09 16:36:22 +00:00
Stephan Bergmann
ab5d730b2a loplugin:nullptr
Change-Id: Id249baebf047bae083e36ad6e23d5bb8989f9a98
2015-12-09 17:25:18 +01:00