Commit graph

414 commits

Author SHA1 Message Date
Tor Lillqvist
07986199ad Just call lok_init_2() and LibreOfficeKit::setLanguageTag() once on iOS
... when the app starts.

Change-Id: Icac4a9e1074fb6c5f3c9b5282e20a4513717a323
Reviewed-on: https://gerrit.libreoffice.org/80881
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2019-10-16 13:16:42 +02:00
Miklos Vajna
1e36adb72a kit: also add missing modeline
Change-Id: Ibfc531b65d68928111df213bef08655ef21cea62
2019-10-15 22:18:05 +02:00
Miklos Vajna
fd21e2b34d kit: add missing header/footer
Change-Id: I111aeafb2e2376983e47bb09cc134883ffee64bb
2019-10-15 22:15:41 +02:00
mert
a1c58c04cc Added Watermark.hpp
Change-Id: I3619283031865f59f94157d5b8df14a94ac9327b
2019-10-15 20:25:26 +03:00
mert
86489d3dcd Include normalizedViewId to TileCache
Change-Id: Ib23afa023d79189f7fd7aca8b5b0e198c3011fbc
2019-10-15 18:13:03 +03:00
Szymon Kłos
74ce4a9261 jsdialogs: send events to the core
Change-Id: I23a5a14b93bda205c9c276a697e58d1dc4147f0c
Reviewed-on: https://gerrit.libreoffice.org/80838
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
2019-10-15 15:59:16 +02:00
Szymon Kłos
ca4351e6ef Revert "jsdialogs: send events to the core"
core not yet ready

This reverts commit 80ecaa60f6.
2019-10-15 14:06:08 +02:00
Ashod Nakashian
77e7cae689 wsd: fix password-protect file loading from multiple views
With password-protected files, the first loading attempt
always fails due to missing password. At that point the
client is notified of the missing password and the user
is prompted. The second attempt includes a (hopefully)
correct password and the document loading commences.

Due to the fact that an exception is raised when
the loading fails, this left the loading latch
triggered, which blocked subsequent attempts.

Change-Id: I7cc257a36eb1cc080f460aac8cdb7030783a5914
2019-10-14 21:35:27 +01:00
Szymon Kłos
80ecaa60f6 jsdialogs: send events to the core
Change-Id: I23a5a14b93bda205c9c276a697e58d1dc4147f0c
2019-10-14 19:18:07 +02:00
Miklos Vajna
bb8fc2df43 kit: fix UB in ChildSession::paste()
Seen during unit-large-paste with log level set to trace:

common/SpookyV2.h:139:13: runtime error: load of misaligned address 0x62500042b919 for type 'const uint64' (aka 'const unsigned long'), which requires 8 byte alignment
0x62500042b919: note: pointer points here
 74 6d 6c  0a 63 37 30 30 66 36 39  33 61 32 61 62 35 66 36  62 39 33 64 65 64 61 63  36 31 31 66 39
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior common/SpookyV2.h:139:13 in

Change-Id: I6f15421bcdead839dac85adae5da10f4b41c04d1
2019-10-09 09:05:32 +02:00
Tor Lillqvist
e51d0a642d Fix build for MOBILEAPP where we don't have Log::shutdown()
(Because a mobile app is not supposed to ever exit voluntarily and
cleanly anyway.)

Perhaps we should call abort() in thse cases, though, and not just
continue as if nothing is wrong?

Change-Id: Iceb10cc767522c1fee587624ea6e810c62586207
Reviewed-on: https://gerrit.libreoffice.org/80446
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-10-08 14:08:23 +02:00
Andras Timar
d1ae1b36c2 typo fixes in comments and code
Change-Id: Idd98516d30d98dea18eda9bbec8ac9777063b553
2019-10-08 11:49:45 +02:00
Michael Meeks
5e0e6006e3 Fatal exceptions need to take the kit process down.
Otherwise the Kit main-loop continues while its event processing thread
is dead, leaving the client stalled.

Change-Id: I7089ed5b5bd8499623624ffdb84c22cedd80cc7e
2019-10-03 18:52:29 +01:00
Marco Cecchetti
8741339064 single msg for deleting multiple characters
Change-Id: I589dbc933e4450d5dbcf35e99b1a55598d3dee76
2019-10-03 14:50:17 +01:00
Tor Lillqvist
e4a763b284 tdf#127669: Implement "export as" in the iOS app in general, not just for PDF
Change-Id: Ib0c20e3e818f498e0fe386676698b38358c84658
Reviewed-on: https://gerrit.libreoffice.org/79965
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
(cherry picked from commit f0799ce78e8df8f7da92181ec732648e6d4e1976)
Reviewed-on: https://gerrit.libreoffice.org/79999
2019-10-01 22:33:03 +02:00
Tor Lillqvist
908240741d tdf#125575: Must reset the "kit" callback to null when closing document
As we register the global "kit" callback with the Document object
pointer as callback data, we must unregister it when the document is
being "unloaded" and the Document object will destruct shortly.
Otherwise the callback might be called for the next document with a
stale pointer.

Relevant only for the iOS app, and presumably the Android one. In
web-based Online, the kit process will exit anyway after the document
is closed. But in an app there is just one process that keeps running
for a long time handling all documents that are edited.

For some reason the crash only showed up when a document was created
from a template, closed, and another document was created from a
template.

Change-Id: Ieb47838a597c5bcab89c1a33d9bc2f2adb57b3b3
Reviewed-on: https://gerrit.libreoffice.org/79633
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
(cherry picked from commit ee497b873eadfa3ab4ba77793748e83ff649dacf)
Reviewed-on: https://gerrit.libreoffice.org/79650
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2019-09-29 13:23:25 +02:00
Szymon Kłos
d712d97e3c Draw reference marks for formulas
(cherry picked from commit fd1b3b2a744388309fbbbcb73b2060183780109e)

Change-Id: I3e361bd94cd6e0664e96494504064c2505c30774
2019-09-28 16:42:19 +02:00
DarkByt31
ef90709ad1 tdf#107038 Poco::Timestamp replacement with std::chrono
Change-Id: I55ba23fb104a90c882bc2af068b835e30877bc1e
Reviewed-on: https://gerrit.libreoffice.org/78925
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-09-28 12:51:18 +02:00
Szymon Kłos
022224b7b4 jsdialogs: introduce LOK_CALLBACK_JSDIALOG enum value
Change-Id: Ib1175dedcc8b6c66a10f81915da07b3bcfe0b3f1
Reviewed-on: https://gerrit.libreoffice.org/79717
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
2019-09-27 22:39:04 +02:00
Michael Meeks
53cd0a50a6 Remove invalidations triggered by LOK_CALLBACK_DOCUMENT_SIZE_CHANGED
Change-Id: I337471cdfdaa1f9b49f13bcb05340427f116cac0
2019-09-25 13:06:31 +02:00
Ashod Nakashian
720c26176a wsd: improved kit thread naming
Now the wsd docbroker thread and its peer kit
thread are trivial to match, since they are called
docbroker_xxx and kitbroker_xxx (where xxx is the
instance ID) respectively.

Also, label spare kit instances as kit_spare_xxx
to differentiate from ones with actual documents,
where xxx is a running counter to differentiate
spare instances from one another.

Now we are able to easily see (and count) the number
of spare kit instances, and match wsd and kit threads
handling a given document.

Unit-test logic updated to reflect the new thread
naming scheme.

Change-Id: I154dc8f200fbe0e65f3f5984e6dad2cef1b52e22
Reviewed-on: https://gerrit.libreoffice.org/79328
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:23:27 +02:00
Jan Holesovsky
5fcd8f38be Fix build.
Change-Id: Ibfe0d09ca156540f5ec535c6a5da5e9cd339b16d
(cherry picked from commit b52dd6b14e63ff160524a0f6fe2d3d4e2361d547)
2019-09-03 01:53:12 -04:00
Ashod Nakashian
30c3de53f7 wsd: support resizing of the sidebar
(cherry picked from commit d3a900d3484e4e6690d8c625f1edc73289baba4d)

Change-Id: If7d7b356563f503dfedfb0686c1d1b5be9b7b221
2019-09-03 01:53:12 -04:00
Ashod Nakashian
36b5109d21 wsd: cosmetic formatting
Change-Id: I552b2468432ce6ed52c50e22b6f19d8055c5dbb1
2019-09-03 01:53:12 -04:00
Michael Meeks
f384b8a414 Add watermark opacity setting.
Change-Id: I839e8aef91acfed40d4afd8c1b50176ed54c670a
2019-08-26 16:29:12 -04:00
Michael Meeks
327869fffe re-factor childsession onLoad callback to cleanup parameter clutter.
Change-Id: I0665db05845a910abf1cc56e13d2f9845cc5c373
2019-08-26 16:29:12 -04:00
Tor Lillqvist
634be102c7 tdf#126968: Implement "Save as PDF" in the iOS app
For now, add an entry "Save as PDF" to the File menu in the iOS app.
Handle in an iOS-specific way in ChildSession::downloadAs(). The PDF
is saved in the app's document directory on the device. The name of
the PDF is the basename of the document being edited with the "pdf"
extension.

Change-Id: Ib0059a86b03b978996eb4cadf230ba7f0abcba62
Reviewed-on: https://gerrit.libreoffice.org/77961
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2019-08-22 16:25:14 +02:00
Ashod Nakashian
64c5ec5bbc wsd: don't warn incorrectly when selecting current part
Change-Id: I3c872469911b1f232e40cc110859402fc0814f3a
Reviewed-on: https://gerrit.libreoffice.org/69640
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71104
2019-08-17 04:44:29 +02:00
Ashod Nakashian
d45ecd586c wsd: leaflet: track multi-selection
Change-Id: I17c092e950fb4d7a0cb4129c537d60a8e5edd06a
Reviewed-on: https://gerrit.libreoffice.org/69636
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71100
2019-08-17 04:41:36 +02:00
Ashod Nakashian
2eab5cea76 wsd: leaflet: support reordering of slides via drag-and-drop
Change-Id: I1b471ba07dd0a1016a0759de729171ae968262cb
Reviewed-on: https://gerrit.libreoffice.org/69635
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71099
2019-08-17 04:33:04 +02:00
Ashod Nakashian
7d03d68e1a wsd: leaflet: status now includes selected parts
Change-Id: I3eeb2fbc52d28047dd0ab7e4318fa44d5c5c0a98
Reviewed-on: https://gerrit.libreoffice.org/69632
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71096
2019-08-17 04:30:42 +02:00
Ashod Nakashian
eaed3615bb wsd: loleaflet: select multiple parts
Primarily support for selecting multiple slides
to edit their properties together.

Change-Id: I96c7ec048668494b5b769677db6874df91cbb42d
Reviewed-on: https://gerrit.libreoffice.org/69631
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71095
2019-08-17 04:30:05 +02:00
Ashod Nakashian
919a93cd4b wsd: improved anonymization algorithm
Better hashing algorithm based on FNV-1a.
Adds support for salting the hash, and
for providing salt via configuration.

More unit-tests added, and better formatting.

Change-Id: I2be42675d0cdbaa73c3d7faed99e07631a9c20fc
Reviewed-on: https://gerrit.libreoffice.org/70034
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71091
2019-08-17 04:26:35 +02:00
Ashod Nakashian
226c2fe71c wsd: unify anonymization flags under one
This simplifies the anonymization configuration
as virtually always they are all either enabled
together, or not at all.

Change-Id: I6fe60f5287fc5d71cd7a6ac3268eac67e5e6e9fb
Reviewed-on: https://gerrit.libreoffice.org/70033
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71090
2019-08-17 03:42:19 +02:00
Ashod Nakashian
32007cbb32 Update LOK headers and reuse callback-type-to-string helper
Also, avoid repeatedly converting INT_MAX to string.
It's an arbitrary large number, so use 1 billion,
which is probably more easily recognizable as an
arbitrary large number.

Change-Id: Ie6f898d6e8978efa29c355f3cb50b60114870f0d
Reviewed-on: https://gerrit.libreoffice.org/77593
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-08-17 03:38:08 +02:00
Miklos Vajna
85dbb4a9af kit: fix UB in ChildSession::disconnect()
Finally unit-copy-paste passes under sanitizers with this. Details:

==8988==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d0005e6de0 at pc 0x000000988e85 bp 0x7fff753316d0 sp 0x7fff753316c8
READ of size 4 at 0x60d0005e6de0 thread T0 (loolkit)
    #0 0x988e84 in std::pair<int const, UserInfo>::pair(std::pair<int const, UserInfo> const&) /home/vmiklos/git/libreoffice/lode/opt_private/gcc-7.3.0/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_pair.h:292:17
...
    #12 0x9322af in Document::notifyViewInfo() /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:1600:53
    #13 0x9303f9 in Document::onUnload(ChildSession const&) /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:1566:13
    #14 0x616dcd in ChildSession::disconnect() /home/vmiklos/git/libreoffice/online-san/kit/ChildSession.cpp:96:25
    #15 0x616535 in ChildSession::~ChildSession() /home/vmiklos/git/libreoffice/online-san/kit/ChildSession.cpp:85:5

freed by thread T0 (loolkit) here:
    #0 0x60f9b0 in operator delete(void*) _asan_rtl_:0
...
    #8 0x939292 in Document::~Document() /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:913:5

I.e. when the Document dtor clears Document::_sessions, the ChildSession
dtor may be called. But ChildSession expected that it has a valid
Document during its lifetime, which is not a promise we can hold, see
the above trace.

Fix the problem by having a pointer (and not a reference) to a Document
in ChildSession and then:

1) Clear that Document pointer in ChildSessions at the end of the
Document dtor using a new resetDocManager()

2) Check if the Document is nullptr in ChildSession::disconnect()
instead of dereferencing it unconditionally.

Change-Id: I19d3d6bfe9e142a52c199f49aaa347d1a2edbf87
2019-08-16 09:05:54 +02:00
Tomaž Vajngerl
cc70602939 tdf#122529 Support for table overlay - column/row change markers
This adds table markers for resizing rows and columns if the user
has the table selected or the cursor is in the table. The code
reacts to the callback "tableselected:", where the markers are
created for each column and row, if the payload (json) of course
has any data. When the marker is dragged, a uno command to resize
the table column or row border is send to the core.

Change-Id: I9b21d09639c1b2be70a1a897f9e3340b453d847e
Reviewed-on: https://gerrit.libreoffice.org/77360
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2019-08-15 05:16:04 +02:00
Miklos Vajna
9a7768b420 common: wrap SigHandlerTrap in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
SigHandlerTrap:

==26186==ERROR: AddressSanitizer: odr-violation (0x000002090ae0):
  [1] size=40 'SigHandlerTrap' ../common/SigUtil.cpp:76:12
  [2] size=40 'SigHandlerTrap' common/SigUtil.cpp:76:12
These globals were registered at these points:
  [1]:
    #0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f8f537f1d8b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad8b)

  [2]:
    #0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2bcfe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2bcfe)

Change-Id: I54d5f6d4298848cacd437d302cff0e8c5003fb8c
2019-08-13 09:08:32 +02:00
Miklos Vajna
bd4d72d41f common: wrap TerminationFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:

==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
  [1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
  [2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
  [1]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)

  [2]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)

Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
2019-08-08 09:10:59 +02:00
Ashod Nakashian
b9674d51cd leaflet: Improve handling of paste without source document
Improve on handling paste without download and
handles onerror properly, which invokes the error
handler callback (where provided) where previously
it was ignored.

Change-Id: I3b527516dc4f90484fd1cfba411b45ff948ffc53
2019-08-06 14:50:51 -04:00
Michael Meeks
9e791fb0d4 clipboard: persist selections for a while after a view closes.
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.

Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
2019-08-05 22:21:54 -04:00
Michael Meeks
7f43d5d385 Use isComplex for calc too.
Change-Id: Ib209cca53079cb9d63a8955caf80945c7ea455d4
2019-08-05 21:53:06 -04:00
Ashod Nakashian
b57f6474dd leaflet: graphics are always complex
Change-Id: I56c5c185c3eeb50ce3c4674dbddce217982cb40a
2019-08-05 21:49:13 -04:00
Ashod Nakashian
8ce397b758 clipboard: Copying of complex data with detection
Complex data is now flagged based on Core's
feedback and/or the size of the payload.

Download now works as expected and copying
to the clipboard is also functional.

Change-Id: I7405517e3a6afcc4c8f5843130476578c1ff06f6
2019-08-05 21:46:31 -04:00
Michael Meeks
00a4fc0cd7 clipboard: good places to dump the raw byte stream.
Change-Id: Idb81bd9f1e090ad337c3f98c03c4fd79f7da51a6
2019-08-05 21:44:54 -04:00
Michael Meeks
e587562226 clipboard: null terminate the mime-type array.
Change-Id: I7d120c22bc95414c51639271abaebd5538551463
2019-08-05 21:42:50 -04:00
Szymon Kłos
18305c8a44 Request text/html in get clipboard
Change-Id: I9096fb2470da0255722f58bdeaeba87fcae3511d
2019-08-05 21:38:01 -04:00
Michael Meeks
b3415abea0 clipboard: test two separate views' clipboards.
Change-Id: Ie6f2eeb1f1dd3c762cca847f4c77a5cd7d39f70a
2019-08-05 21:36:49 -04:00
Michael Meeks
095edb28e2 Adapt to new 'getClipboard' API - works on clipboard not selection.
Vital for a working 'cut'.

Change-Id: I980a4d65ef14eb922343d1d321177a9b3e1629f3
2019-08-05 21:28:09 -04:00
Michael Meeks
13469e8b00 clipboard - set it with a post now.
Change-Id: I6b9234988185984335408da502f479ccda8a95a7
2019-08-05 21:18:44 -04:00