Commit graph

222 commits

Author SHA1 Message Date
Pranam Lashkari
a2757f3a47 loolwsd: after comment operation update status
send status after performing any comment operation,
updating status send page dimensions,
which help in canvas layer to resize actual page size
without updating page size comments may go out of view
and will also not be scrollable into view

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I489648bb5ccd7223746fea42050088e078046a1a
2021-04-09 09:56:13 +02:00
Tor Lillqvist
9492ef6142 Include the view id in the tunnelled dialog image hash
Otherwise this will break badly in the collaborative editing (multiple
views) case.

Change-Id: I63d391cb5a7d118c34564c4e1a4df7710b13e90e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-02-19 14:29:40 +02:00
Ashod Nakashian
81da7c7bff wsd: download templates by wsd
Templates were downloaded by Core
upon loading. This works fine, as
long as there is no special network
setup in loolwsd. However, when
loolwsd has a complex network setup,
such as when using reverse proxies,
Core wouldn't know about the details
and would likely fail to download
the template.

Luckily, there is no reason to rely
on Core for downloading templates.
Instead, we download it in loolwsd,
just like any other document, and
load it in Core as normal. The
remaining post-load saving of
templates remain unchanged.

Change-Id: Ib22ada4ae469863d5e5c8baeee27f667f7cd40ff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-02-15 09:41:17 -05:00
Tor Lillqvist
5cc5e19ed6 Add comment describing a way to intentionally induce cache inconsistency
Change-Id: I4dabc1e70b2bca6751a60e5655a530c0025b09c5
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-26 17:09:09 +02:00
Tamás Zolnai
fd14e92314 Revert "leaflet: wsd: select the page before opening the slide wizard"
This reverts commit 0a54b23251.

Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: Id41a85d920a470d784f4c6158bb25c9ba46f43d2
2021-01-26 12:32:36 +01:00
Tor Lillqvist
c535040952 Use correct naming convention
Change-Id: I6aa3b7b25ae9eff462580eb17ceaa5bc40359c53
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-25 18:06:56 +02:00
Tor Lillqvist
f1e074f6bc Add caching of tunnelled dialog images
The same cache size is used in server and client. The caches use the
invalidation algorithm. Pass the hash of the pixmap in the
windowpaint: message. The client stores dialog images in its cache.
The server stores hashes of the images. When the server knows that the
client already has an image cached, it sends just its hash and the
client will use the cached image.

Pass the size of the cache to the client so that we don't have to keep
the the cache size synchronised in two places in the code.

Change-Id: Ie6cbfca79a9ede48fcc115e3acc669b925bb624e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-25 17:48:33 +02:00
Tor Lillqvist
78691886f3 Use winId here, too
The other code in this function carefully checks before indexing the
tokens vexctor. We have already stored the integer from tokens[1] (if
it exists) in winId. So use that in one more place instead of
tokens[1] for consistency.

Change-Id: I2bc09b3e44e0549a94469d7569f724df17a113b3
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-21 14:59:22 +02:00
Tamás Zolnai
218e47e65a Switch to the correct view before calling getSelectionType() method.
This method needs to be called with having the correct view activated.

It caused a crash in writer/simultaneous_typing multi-user cypress test.

Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I57dd58a635ce7ea127200a6a3f0cadc8c0861aaf
2021-01-18 20:39:03 +01:00
Tor Lillqvist
c5118ea43a Fix crash in iOS app: Don't bother with UnitKit
I don't recall if simply ifdeffing is the proper way to bypass UnitKit
stuff (that I don't understand) for the mobile apps, but at least it
helps.

Signed-off-by: Tor Lillqvist <tml@iki.fi>
Change-Id: I85d477e4ee7d11c597d95a9b0b42af7e5f7ad122
2021-01-15 01:36:52 +02:00
Henry Castro
9f43878891 kit: send early dialog event to server
When the "Macro Security Warning" send clicks events,
the is no instance of Model/View/Controller yet.
So adjust to send to global events.

Change-Id: Idc395cfb86548481bbadc22874293d7d6238db89
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-01-05 11:10:22 -04:00
Ashod Nakashian
583c627a66 wsd: avoid single-character strings
Change-Id: I709e8e797bc5e68984823d8c46c590e109d23f18
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-09 17:19:58 +01:00
Ashod Nakashian
ba4e52e7b9 wsd: log: overload chrono duration to simplify logging
Also, makes the logging of units much less error prone.

The overloaded streaming operators are temporary as
they are provided in C++20. The ones here (though
incomplete) are fashioned after the C++20 specs.

Change-Id: Ieb499282ccb6e63fa939ba07bed3e5a4fbef1bd0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-08 09:26:41 +00:00
Ashod Nakashian
47630f826e wsd: use steady_clock for measuring time interval
chrono::system_clock can go back in time.
For time interval measurements, where we don't
care about the local time, a monotonic clock
should be used.

This avoids the server uptime jumping around
with daylight saving (or indeed by regular
synchronization with an atomic clock), among
other cases.

Change-Id: I09f9b24c82d19439348a2e66cad9e9de7d755208
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-08 09:26:41 +00:00
bayramcicek
d2330390ac Port to Util::make_unique for kit/ChildSession
Signed-off-by: bayramcicek <mail@bayramcicek.com.tr>
Change-Id: I735b9fb8f2e83da08eb50a6767cf127a80103cef
2020-12-03 15:32:05 +03:00
Ashod Nakashian
3724ab4e35 wsd: centralize temporary directory helpers in FileUtil
Change-Id: I9b55d0b8d4c55a68af4baa7e638627de6c73b64d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-11-22 22:26:36 -05:00
Michael Meeks
1a16ef9cdf Remove pseudo-code pushed in error.
Change-Id: Iad9a5d8cf5527f8803fb125f9f9b190a51070ad0
2020-10-26 19:59:55 +00:00
Michael Meeks
6bf4040bcb Clarify, re: E-mail.
Change-Id: Ic42e2779bf481f6bd12077e340f45f0aaeea5e12
2020-10-26 19:03:53 +00:00
Ashod Nakashian
4ce0bd9e3a wsd: fix templates with no chroot jail
Change-Id: Id47211e9e20173886af35ae92833f026354b2586
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-10-25 12:20:58 +01:00
Ashod Nakashian
d0dc93d910 wsd: better file size utility
std::ifstream's tellg() returns -1 on error.
This is handled very poorly and shows up as ULONG_MAX.

Luckily, we have Stat class that does the same
both more safely and more efficiently.

Without opening the file, we now get the necessary
information unambiguously.

Change-Id: I2448bc71e01b0f166a9dd66aa38a88ea97a50cdd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-10-25 12:20:58 +01:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
gokaysatir
805ff2f2a8 Online: Copy hyperlink location. / Online side.
Unused selection variable has been removed. "clipboardchanged" event is activated.
LOK_CALLBACK_CLIPBOARD_CHANGED is handled according to existence of payload.

Change-Id: I6e37cb2ca4d4c59e55555ba3397cb00dbb7eafa2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103165
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-09-30 15:10:19 +02:00
gokaysatir
f05906aac5 Online: Show input help on Online / Online part.
Change-Id: Ida8c5e8baccf87dae68c1c6d8f5302b1288741e7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102747
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-09-17 14:23:13 +02:00
Szymon Kłos
70827c372c Simplify download process
Use hash to identify download and pass that to the client.
This allows us to reduce parameters for download requests.
DocBroker maps download ids to URL in the file system.

Change-Id: I254d4f0ccaf3cff9f038a817c8162510ae228bc5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101992
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-09-07 15:00:20 +02:00
Pranam Lashkari
0a54b23251 leaflet: wsd: select the page before opening the slide wizard
problem:
In the mobile view taping on the selected slide preview would open the wizard
but when some object is selected on the slide
wizard would open for that object
this patch helps us to set the Page as selection and as result
mobile wizard opens for the slide even when some object on slide is selected

Change-Id: Ia4f0d5fe6a4d82d101ee26b75f557a44e0627704
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101422
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-09-02 10:41:33 +02:00
Andras Timar
e857c1212b fix: error: ‘id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Change-Id: Idabda74d64bb7ee00e3323aee6fa114bed1593fd
2020-08-06 16:00:34 +02:00
Michael Meeks
9142828282 textinput: use a single input message per key on the wire.
Change-Id: Ibd0f7afb98c8ed278751c4b5b46d7ce2467cd71f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100184
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-08-05 18:44:10 +02:00
Szymon Kłos
16be50d757 Send Action_Save_Resp when notification was requested on save as
Change-Id: Iafe06873fcd8c25e93eb9daa2eea187827e3ac47
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99593
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-07-28 14:51:10 +02:00
Gabriel Masei
9c6739eee0 kit: disable parallel handling of messages while processing load and save
The map._activate, among other actions, is sending indirectly some messages
to the server like clientzoom and clientvisiblearea. If these messages are send
before the document finishes processing the load message then there is
a chance that a nodocloaded error will be thrown because there is a
chance that the messages will be processed in parallel with load. This happens
constantly for xlsx files. This is generated by the Unipoll mechanism which,
in case of xlsx files, triggers a parallel processing.
To avoid the above scenario a mechanism of disabling parallel processing of
messages in kit was implemented and is used for load and save messages, for now.

Change-Id: I4c83e72e600f92d0bb4f1f18cebe694e326256d0
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98519
Tested-by: Jenkins
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-07-22 17:38:05 +02:00
Pranam Lashkari
22359767d6 tdf#129296 leaflet: Password protected document load failing
Do not send faileddocloading error if it is because of password.

When the document is password protected, we send to the client
both passwordrequired and faileddocloading.
These two are handled differently. While the first prompts the
user for password input, the second internally flags fatal error
and shows an error message that the document may be corrupted etc.
The end result is that the document is not loaded and displayed
when the user submits a correct password. To reset the fatal
error one has to reload, which is unhelpful when we need to
provide a password.

This patch makes sure that we only send one error message to
the client. If a password is required, it already implies that
the document didn't load, and that with the proper password we
should try again.
Similarly for when the password given is wrong. However, if
loading fails and it isn't a password-related failure,
faileddocloading error is returned and in this case the client
handles it as a final error (that requires reloading to retry).

Change-Id: I383418fd40b6e0749b20af0ef8dc40f391a05559
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-07-16 19:31:31 +02:00
Jan Holesovsky
1b3732b941 android: Call the SAVE directly from the native code.
Until now, for the "local save has completed, upload it back to the
content: URI" messages we were relying on the "local save" -> JavaScript
-> Java -> "upload to content:/ URI" chain.

It turns out though, that the WebView can be dead by the time we need
the notification that the save has completed.  This was particularly
seen on ChromeOS when the document was closed using the [x] in the
window decoration.

As a solution, we need to pass the info that the "local save" has
completed directly to Java.  So far this uses the same semantics as the
postMobileMessage() and reuse its code; but maybe in the future we'll
need to split this.

Change-Id: If1b93e4f76cee3abc6aebfc3e9072810ab73bb42
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98773
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-07-16 11:52:58 +02:00
Dennis Francis
d1b3f4c6af wsd/kit: use splitx/splity in clientvisiblearea message...
to filter tile-invalidation messages, so that the client gets
invalidations/new tiles for all split panes.

Change-Id: Ifacc452ed6bb43dfd36ff16386fb4a547ec8302b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98362
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
2020-07-08 17:18:33 +02:00
Dennis Francis
b976a4bfc9 handle LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY
Change-Id: I2f894f32d4c9e852d89159a55c0dd9effb45c09e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97955
Tested-by: Dennis Francis <dennis.francis@collabora.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
2020-07-04 12:30:16 +02:00
Ashod Nakashian
02da27a436 wsd: improve readability
Change-Id: I2f85ebff783ebb799324b0aa95f5d0d023c19231
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96381
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 07:40:10 +02:00
Tor Lillqvist
7f25109f72 tdf#128502: Chunk of work to enable "multi-tasking" in the iOS app
Seems to not cause any serious regressions in the iOS app or in "make
run", but of course I am not able to run a comprehensive check of all
functionality.

Change-Id: I44a0e8d60bdbc0a885db88475961575c5e95ce88
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93037
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-06-26 13:09:51 +02:00
Szymon Kłos
44b9f8f025 jsdialog: change sendDialogEvent API parameter
WindowId with 64bit length is needed

Change-Id: I681841f60636722aa96846d4130b22183876a500
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97107
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-06-26 09:24:02 +02:00
mert
d29c986e6a Fix insert local image for online
Change-Id: I4edde45cb6c36c5f52b34ac23692c10ef7a5148f
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96623
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-06-18 21:16:57 +02:00
mert
2231f1c568 online: fix io error on saveas
Change-Id: Icd91eacf2945c803660aaacb1d46d169b1f9bd86
Signed-off-by: mert <mert.tumer@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96546
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-06-18 16:32:14 +02:00
Andras Timar
945838ee50 fix bogus -Werror=maybe-uninitialized
Change-Id: Id8662bfdebe50ec87dd634f4564fab12c32ebdc1
2020-06-04 08:55:12 +02:00
Ashod Nakashian
d2d0492245 wsd: move LOOLProtocol::tokenize to Util::tokenize
The tokenizer(s) are more generic than the protocol
logic, and are used from contexts that don't involve
the protocol as such.

Change-Id: Ie8c256bf11a91e466bff794021f41603c9596a7f
2020-06-02 18:03:36 +01:00
Ashod Nakashian
d89f509609 wsd: overload getTokenInteger for string-literals
When parsing, we virtually always know the name
of the token we are parsing at compile time.
Taking advantage of that means we also know
its size at compile time, and can optimize
std::string allocation, size counting and
the implementation of getTokenInteger.

Change-Id: I502a643c14cace7dd755df565b3b5c445688faad
2020-06-02 18:00:20 +01:00
Ashod Nakashian
6ab64ac992 wsd: single-char string literals -> char
Change-Id: I163d6fe1c80334317d38f8fed2199ad2b31a0f8a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95335
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 17:22:26 +02:00
Ashod Nakashian
784b7dc39d wsd: optimize StringVector
StringVector is heavily used for tokenization
and benefits from inlining of small functions.

Also, cat doesn't need to be slower than necessary.

Change-Id: I4ab2ff1b1f1a81092049d2cde64b6df10b34b5f7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95287
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
2020-06-02 01:39:37 +02:00
Ashod Nakashian
224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
Tamás Zolnai
75dc61da7e MSForms: send item selection event to core.
Change-Id: I10fceb66a4f8cd777c43411ddace3456a315b5a2
2020-05-09 09:54:08 +02:00
Tamás Zolnai
d2629961e0 MSForms: handle formfieldbutton message.
Change-Id: I17243823d9bc0074b7fd015bca23de9399e0e26c
2020-05-09 09:54:08 +02:00
Jan Holesovsky
3cd1e0d439 function bar: Index the function by name, not by index.
Depends on a core change that changes the ABI of the completeFunction().

Change-Id: I27daf31d49347c4a308518e14a9b8b97f3b48991
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93667
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 870a7ec5620eb742bd8fb2a9680ff67101a37dd7)
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93541
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-05-08 12:03:11 +02:00
Pranam Lashkari
8b349716eb killpoco: removed Poco::Process completely
Change-Id: Iba67abf9342c11517c69c1d94903bf4752aa87d6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/83770
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-29 14:27:54 +02:00
Tor Lillqvist
1525f774d9 tdf#128502: Get rid of the static file-level variable 'document' in Kit.cpp
It is not a problem in the multi-process web-based Online, where the
variable exists separately in each KIT process (which handles exactly
one document). But in a mobile app, when we want to be able to handle
multiple document in the single process, we can't have such variables.

Change-Id: I1d3da48316eb3a8c72ff4957cc3fcba8f6870f16
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92582
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-21 12:15:07 +02:00
Michael Meeks
3e4ac31c7c killpoco: remove WebSocket includes from a couple of places.
Change-Id: I06740cd978bec8e6a74beb8ed9ef8f4f970a2535
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92470
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-18 18:29:04 +02:00