40 Commits
Author SHA1 Message Date
Skyler Grey 7648e7f164 fix: hide edit bookmark button in LOK
While we've added a way to edit text in treeview items, this button
isn't hooked up to use it. Therefore, we should hide it to avoid user
confusion

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Ic8cc49a6c8cb7212fc7f6793f76a5fee89e05d35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187194
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit ae62dbba4d75880940af5febea3c5a62843a661e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193850
Tested-by: Jenkins
2025-11-18 10:52:00 +01:00
Skyler Grey 8244c85bd0 feat: enable renameobjectdialog.ui for jsdialog
To fully enable jsdialogs for insertbookmark.ui, it's nice to enable
jsdialogs for all dialogs it uses too.

There's nothing particularly complex here which needs extra focus
ontop of Just Turning The Setting On

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I635354496f719f43d8ebf690f766a435864763fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187192
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 1e561bdd193c82ed0e1e42c481bcd6fcf6e3f05a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193849
Tested-by: Jenkins
2025-11-18 06:48:29 +01:00
Skyler Grey d0f4e06750 feat(jsdialog): allow editing treeview items
There are some dialogs which we need to edit items in, for example the
bookmarks dialog.

This isn't hooked up to any existing editing functions - the client
won't recieve events that say we intend to edit, say. Instead, the client
should implement its own way to edit an editable item.

This requires the client to know whether a given cell is editable so we
will send that to the client. If the client allows editing non-editable
cells it will cause strange effects (such as editing the document
with text from a different cell in the case of the bookmark dialog).
Additionally, the client needs a way to tell us that it has edited
a cell.

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: Icd510aab1ce236609e84ed672210d68c4d0c6583
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187193
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193851
Tested-by: Jenkins
2025-11-14 07:17:49 +01:00
Skyler Grey 12c50f2206 fix(lok): avoid remembering hyperlink dialog tab
In tdf#90496, insert hyperlink was set up to remember the last view used

Normally, this is desireable. With LibreOfficeKit, however, it's not
necessarily the case that the same user is accessing the dialog on
consecutive openings

This is a problem in Collabora Online, say, where the dialog would open
on different tabs depending on where the last person closed it...

...all this to say: let's pick a reasonable default ("internet") for Kit
and use that all the time

Change-Id: I6a6a6964c6796141af4a0b73a208e49cb6e3fa4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191204
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit c8325d123ac7c16699a594897881571980f687db)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191498
Tested-by: Jenkins
Reviewed-by: Skyler Grey <skyler.grey@collabora.com>
2025-09-25 14:05:41 +02:00
Skyler Grey 366c8a0321 fix(mobile): Include DialogFactoryServices
Without these, we cannot open any dialogs in the mobile app.

It looks like they were added in I8c199421c66de2dcf339ccc2d5cb9340d3bea914,
I90dae749f777446f67342d121e4dc29b974cb9b6 and I389fcafd80f1a450befbffdc252be497ba20f6d5
to better support mergelibs, and presumably they were unintentionally
omitted from the mobile app at that time.

Change-Id: Icf0d48ed40e17cfbcd5c2720432bc15bf7b55e6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186013
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-05-29 19:46:02 +02:00
Skyler Grey ba2d75a993 fix(slideshow): Use CoreGraphics to render on iOS
Similarly to `doc_paintTile` in init.cxx, we can't use the regular
initialization for our graphics backend on iOS. If we do so, we render
a completely white area. Instead, we need to use CoreGraphics, which is
the iOS library for rendering graphics

Change-Id: I94cb620d422c02f8343db30eea24cecc53d928c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185095
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-05-09 15:51:45 +02:00
Skyler Grey 60f9660382 feat(iOS): enable AVMedia
Previously, AVMedia was disabled entirely for iOS. As we intend to
support AVMedia in Collabora Office Mobile for iOS, this is rather
inconvenient. In reality, we can support some of the AVMedia stuff -
albeit using webkit to play videos rather than gstreamer.

Change-Id: I1c5b791f7f37185c2b92ba5e6d41f934ac215411
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184333
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-04-17 19:38:55 +02:00
Skyler Grey 6f8516d055 fix(wordcount): Add docComments on mobile
In I29ca811065cce83f9c8630f79a2b78c2c3fe0da1, we added a widget for
docComments to the word counter UI. Unfortunately, we didn't properly
handle the mobile case, leading to mobile crashing over it missing the
label to display the result whenever the word count dialog was opened.

Change-Id: Ib94c8db5beb88d0b71035081680ce25a74774d08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176945
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit a9f87065f2725a467d60b49fff6a1b21a14aa0f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181502
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Jenkins
2025-02-13 01:52:07 +01:00
Skyler Grey 523662727c feat(iOS): Allow use of desktop clipboard code
Historically, iOS has used pasteboard code instead of the normal
clipboard code, forming a different clipboard flow for the Collabora
Online app for iOS. This is "not ideal" for consistency in clipboard
behavior between iOS and other platforms, so we're switching iOS to use
the same clipboard APIs as everywhere else. This means that we need this
desktop clipboard code to be compiled into iOS.

Change-Id: I42567ad64641913817a26d1494858393501b6503
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180946
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-30 16:30:56 +01:00
Skyler Grey 4260ae0541 fix(iOS): Remove missed clipboard method
In I49671a0bdbd1e1699253c9e710366c1a860ca38d, we cleaned up the old
obsolete iOS clipboard code. Unfortunately, we missed removing a method
in our header files elsewhere. Worse, while we can build with a missing
method we aren't able to package testflight builds for iOS with it,
leading to everything working until the packaging step which fails.

Change-Id: I47f8fbb6762d82da449886798f0fb7eacf76047a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180883
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-29 12:00:48 +01:00
Skyler Grey 1bd9ac53f0 chore(iOS): Cleanup old iOS pasteboard code
Since as we're switching to handling the clipboard the same in iOS as
everywhere else, this old pasteboard code is no longer needed

Change-Id: I49671a0bdbd1e1699253c9e710366c1a860ca38d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180785
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-27 16:57:01 +01:00
Skyler Grey dd7d9a61c9 fix(ooxmlexport): Prevent unknown media type crash
To determine the extension of a media file, we just take whatever parts
of the URL were left after the final dot.

Normally this is something normal such as `mp4`, `mp3` or suchlike

Unfortunately, sometimes (such as when in Collabora Online) this URL
would is actually be something Uno-y, leaving an extension like

   Package:Media

That's no good, because in Zip files we can't have colons in our names,
at least according to our Zip file name checker, which looks through and
denies access to any file names that have colons in

    bool OStorageHelper::IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed )
    {
        long nDots{0};
        for ( size_t i = 0; i < aName.size(); i++ )
        {
            switch ( aName[i] )
            {
                // ------------------ 8< cut ------------------
                case ':':
                    return false;

Promptly causing us not to open a file output stream...

    if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) )
        throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );

    -> leading to implOpenSubStorage failing to set xSubXStorage...

    if( mxStorage.is() ) try
    {
        // XStorage::isStorageElement may throw various exceptions...
        if( mxStorage->isStorageElement( rElementName ) )
            xSubXStorage = mxStorage->openStorageElement(
                rElementName, css::embed::ElementModes::READ );
    } catch ... { ... }

...and eventually to us never having an output stream in the first place...

    Reference<XOutputStream> xOutStream = mpFB->openFragmentStream(sFileName, aMimeType);

    gdb$ print xOutStream
    $1 = empty uno::Reference

...and crashing the code that tries to copy to that stream.

The upshot of this bug is that any videos inserted with Collabora Online
(or presumably similar .uno command use) crash LO when you later try to
save your .pptx

The quick fix here is to replace colons with another character, which is
what I've done here. Future followup patches could do other sensible
things like stopping crashes if we can't open an output stream for
whatever reason or figuring out what to do with names that aren't
permitted for reasons other than colon use.

Change-Id: I9113b272d29f74882dc25bf6e74306bd9ecd58a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180635
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-23 16:42:38 +01:00
Skyler Grey 3a9caad863 feat(json): Allow serializing any
Previously, as far as I can tell, there was no way to send a Size in a
.uno command (as would be needed in, say, '.uno:InsertAVMedia').

We do, however, already have a way to send an `[]any`, and we can use a
similar method to allow sending arbitrary types with `any` rather than
`[]any`.

To use this, the type you really want to send has to be wrapped in any,
so for example...

{
  type: "any",
  value: {
    type: "com.sun.star.awt.Size",
    value: {
      Width: {
        type: "long",
	value: 0,
      },
      Height: {
        type: "long",
	value: 0,
      }
    }
  }
}

Change-Id: Ic33594dee955d475d81733adb21950c0458435e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174740
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit cccbf8608f3b76651993bc8576c672367c228fa2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175982
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-11-04 09:39:27 +01:00
Skyler Grey eeb72ef257 feat(lok): Add extra impress export formats
Previously we had the ability to export to various formats, but these
weren't exposed in a way that LOK could request them. We want to
increase the options available for export, so we need to make these
available.

Change-Id: I1c05aeec8de32929481059bcfd02cac05a46788d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174602
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 541272d3eaa322ccdd1b926add031a39faeccf49)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175981
Tested-by: Jenkins
2024-11-04 09:39:18 +01:00
Skyler Grey 0a8e62a0b2 fix(lok): Expose the import options dialog
In a very similar way to the character encoding dialog, handled in
Ibd36e695e733e07053bb6e22a510ac988be3ded2, we need to see this dialog
before the document opens.

I've used the same trick, where I've made the dialog into a JSDialog and
registered an early listener, but I haven't asynced it as it's never
useful to have more than 1 person using it at once.

Change-Id: I1a61660523ae2d4812890b62d16f0e6cef133e67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174269
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 335bb5b39c03b7ef7d7426259b41d479ff9ea7f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174951
Tested-by: Jenkins
2024-10-21 10:34:29 +02:00
Skyler Grey 60fef0bfeb fix(lok): Expose the character encoding dialog
The character encoding dialog appears when importing a dialog with an
ambiguous character encoding. At the point when it appears, the document
isn't loaded, so we have to handle it in a similar way to the text
import dialog or password prompt dialog, allowing it to function early.

It's also required to make the dialog into a jsdialog, as tunneled
dialogs do not work this early in the document loading process.

I have not asynced the dialog here because there's no point. I did write
code where I set up a dialog factory to do this similar to how other
modules (sw, sc, sd, etc.) handle dialogs and make them async.
Unfortunately, this dialog is not useful with multiple users, since as
it's used on opening a document. It may, in the future, be useful to
someone to make a patch that asyncs the other writerperfect dialog (epub
export) so I have uploaded and abandoned my dialog factory patch as
Id8ec474510f3c8637639ad59331156c6e75dafb4.

Documents that require this dialog, whether async or not, cause crashes
when someone opens the document before the first person has finished
responding to this dialog. I still consider this behavior better than
crashing whenever we attempt to show this dialog at all.

Change-Id: Ibd36e695e733e07053bb6e22a510ac988be3ded2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174044
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 283f771b92a14c06871c931b01174622b855abe5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174950
Tested-by: Jenkins
2024-10-21 10:34:18 +02:00
Skyler Grey 4e04e96334 fix(invert): Avoid spurious LOK invalidations
Using the same mechanism as with theme changes, we can avoid LOK getting
invalidations if we have an invert-background change that doesn't apply.

The trouble is that this method of inverting the background causes *lots
of* properties to change, so there's no single "If we inverted the
background" to check...

To get there, I've checked if all of the following are true
- We didn't change the color scheme
- We didn't have any new colors after this change
- All of the properties we were changing should have been within this
  color scheme

While they don't necessarily mean "there was a background inversion",
they do mean "something changed in your theme but no action is needed
from you" - which should only be a background inversion - and if we
added anything else that could fit in that category, it should also
avoid LOK invalidations

Change-Id: Idb680d5241db7879d9be834268ab616848c1f165
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172505
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-08-28 09:41:18 +02:00
Skyler Grey 8d9a96fca2 feat(invert): Allow inverted background on init
Previously for Online there was no way to save the background invert
state and reload it. Worse, when someone changed the state it would
become the default for new document loads.

This patch allows Online to specify whether it wants the background to
be inverted, which should allow smooth tab refreshes while also avoiding
mingling state from different people.

There is a change to online to support this here:
https://github.com/CollaboraOnline/online/pull/9652

Change-Id: I8c22c03d3b4589736d48509004f7789dd5166389
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171955
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-08-16 21:56:41 +02:00
Skyler Grey 3a597235ea test(invert): ensure background-invert separation
I0aed702185e642f631854b1f8234355c9e69ff6e made inverted backgrounds
separated by view. This change adds a test to make sure that it really
works, based on the work in I05486860c5f562c3cfa59b4a7fc492d48913a181 to
allow a specific theme to be stated on a per-view basis

Change-Id: I3d0c4814cde5cafe069f984fe7904080660f10d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171953
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-08-16 15:14:56 +02:00
Skyler Grey 9f47fe2bfd feat(invert): Allow specifying a theme
In Online, we previously weren't able to specify what we wanted the
theme to be after an invert. This led to the theme being "whatever the
*last* person toggled it to" rather than "whatever isn't our current
theme"

This commit also lays the groundwork for loading the same invert theme
after a reload/rejoin/new doc in Online

There is a change to online to support this here:
https://github.com/CollaboraOnline/online/pull/9652

Change-Id: I05486860c5f562c3cfa59b4a7fc492d48913a181
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171889
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-08-15 11:50:33 +02:00
Skyler Grey 71d98f04b9 fix(invert): Use separate view IDs when inverted
Previously in Online the document background inversion was tied together
such that if someone inverted the background, everyone in dark theme
would end up with an inverted background.

By adding whether the document background is dark to the view render
state, we can create a new view when the background is inverted, and
avoid everyone getting an inverted view.

Change-Id: I0aed702185e642f631854b1f8234355c9e69ff6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171664
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-08-09 13:34:22 +02:00
Skyler Grey 784a146835 test: Refactor pixel assertion
When a test fails, the line the assertion failed on is printed.
Unfortunately, in the case of this assertion, it was always inside the
same function.

If we instead change the function to only return the pixel color, and
perform the assertion inside the test, assertion failure error messages
are more helpful

Change-Id: Ia56da1b245882c8ddbf21ad98f69facc36d3ec3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171593
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-08-08 08:41:04 +02:00
Skyler Grey 3215fcdc58 cool#9654 fix: Skip invalidation if it won't go through
On Android, we often hit this condition where we should get an
invalidation. Unfortunately, the invalidation is skipped due to being in
LOK Tiled Painting, leaving us to deal with whatever tile was rendered
on this go-around...

...Also because of this condition, the tile rendered here is broken.
pFrame->PaintSwFrame is never called, leading to a tile which renders
without things like its text. Normally, this wouldn't be a problem as
it's about to get invalidated, and is more of a nice performance
optimization...

...However given we don't invalidate it, we really see that tile without
any text. Similar workarounds were considered (such as skipping the
condition in another case that appears to be true on Android or
rendering the tile anyway, even if we're about to invalidate it) but
this seems to be the safest bet to avoid something like this happening
on other platforms...

...The true solution is still elusive. It probably includes figuring out
why this happens on Android without happening on other platforms, and
fixing that, as well as perhaps figuring out what to do about this
condition if we *do* genuinely trigger it on Android - as the previous
solution of invalidating everything nearby won't work

Change-Id: Id58f5bae8ae357d116c5f2345e88ec3364cb2172
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171578
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-08-07 13:10:05 +02:00
Skyler Grey 07dec064c2 test: send document bg color on new theme
In I27c8409a6fcb771d741b07d77c5598c87e178f3b we fixed this feature,
here's a test to make sure we're doing the right thing

Change-Id: I32f3c410da6bc607f2e0cc3e48a440a09d92d6eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171398
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-08-02 16:07:07 +02:00
Skyler Grey 5292d8d52c fix(writer): send document bg color on new theme
In Ic025e542417da004c1c4a2bfd58a858deb4caa58, we intended to start
sending the document background color to kit after a configuration
change, which is useful when we change the document theme.

Unfortunately, we mistakenly sent the *application* background color
instead, which is normally darker/lighter than the document background
color, causing color flashes if you tried to use the document color as a
background before tiles were sent

Change-Id: I27c8409a6fcb771d741b07d77c5598c87e178f3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171373
Tested-by: Jenkins
Reviewed-by: Skyler Grey <skyler.grey@collabora.com>
2024-08-01 16:19:43 +02:00
Skyler Grey c332764020 exported SVGs: Stop bullets skipping animation
Previously, we used the incorrect format for bullet point IDs, leading
to them not being noticed by animation code, leading to them being
skipped during animation.

This meant that if you exported an SVG of an impress presentation, and
you had a bullet list animating to appear later, you would see the
bullets without the text from the start.

Change-Id: Ibce764c0843778dd09b108fb251ce606255afb90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164661
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com>
(cherry picked from commit 5ee89034692eb21f9a71c9a36cc205b09f24e856)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164871
Tested-by: Jenkins
2024-03-15 17:29:10 +01:00
Skyler Grey 20502992b8 calc: Add option to keep edit mode on enter/tab
This change makes it so that, rather than leaving edit mode, enter and
tab keep editing the new cell when they have moved. This is important on
devices with an onscreen keyboard (e.g. iPads, Android tablets,
Convertible Laptops, etc.), particularly in Collabora Online, as exiting
edit mode hides the onscreen keyboard.

It is not desirable to enable this by default, as arrow keys cannot move
around the document when we are in edit mode (they move within the
cell). Therefore, this commit also adds an .uno command so that we can
activate or deactivate the option.

In LibreOfficeKit we want to make sure not to share this setting among
different users, so we also add this option in the view shell and switch
which one we care about based on whether Kit is active.

Change-Id: I5e6c93c64af0d201a8ec045fea5546e189baca74
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160313
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161696
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-08 18:32:56 +01:00
Skyler Grey 7924d8fc27 Fix STYLEREF crashes and forwards-compatibility
This commit fixes a crash in STYLEREF caused by a dereferenced nullptr
when serializing chapter fields for .doc export. Along with the STYLEREF
changes, I also changed the chapter export logic to allow exporting
chapter fields when they were in document text, and to use the style of
the thing they pointed to. Unfortunately, in some cases that would be
null. This commit makes us fall back to previous behavior in those
cases.

This commit also adds import logic for styleref on the TEXT namespace in
addition to LO_EXT. This is important as if/when the STYLEREF field is
no longer LO_EXT we want to be able to open new documents in old
versions of libreoffice. This was erroneously missed when we changed
TEXT references to LO_EXT in our export logic.

Change-Id: I383828c9409afc8545af379307f528cee2e1a960
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159226
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-11-10 08:12:28 +01:00
Skyler Grey fd5c75750f Improve and extend STYLEREF tests
- I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19,
  Ib664fec059aa1f7f130acc76c253d5d298fa59f7 and
  Iad8e8001807f5ceeaedc9665838672695174a936 added STYLEREF flags. This
  commit adds tests for them
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were partly
  broken due to the fields occasionally being inserted in the wrong
  place (i.e. at the end of the document), this commit makes sure to
  move the cursor before inserting a field
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were not
  separated into sections which made it difficult to tell what was being
  tested. All STYLEREF tests that create documents are now clearly split
  into arrange/act/assert steps with comments denoting the sections
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 had a lot of
  repetition, particularly in creating the document, adding headings,
  etc. This has been refactored into some helper functions
- I35dc36197b62fa53def4745da1d4755ece79ed22 was missing an ODF import
  test. This commit adds one

Follow-Up-To: I25dd7a6940abee5651a784b9059fe23b32547d6c
Follow-Up-To: I35dc36197b62fa53def4745da1d4755ece79ed22
Follow-Up-To: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19
Follow-Up-To: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Follow-Up-To: Iad8e8001807f5ceeaedc9665838672695174a936
Follow-Up-To: Iecd3e83a6bd3f8c2c6adba5c7eba9ee55b773510
Follow-Up-To: Ifaa67fbc2d53b0d4fb85e7305b2dbdf78cf0a1ad
Follow-Up-To: Id991c92b9aeaa054b136f7a3d9c7c8ea0026e514
Change-Id: I941b477c8e860270a400869cb9ea15e5561e402a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158352
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-02 10:27:52 +01:00
Skyler Grey 3e6d4a563f Improve STYLE_FROM_BOTTOM compatability with Word
From my testing in Word, it doesn't honor the "search from bottom" flag
when it is in the body, only in marginals. Additionally, it doesn't
continue searching in the opposite order if the referenced content is
not found on the current page, instead it searches in the same order as
it would normally (i.e. pages above then pages below). This commit
changes the behavior and UI of our from bottom flag to match.

Change-Id: Id991c92b9aeaa054b136f7a3d9c7c8ea0026e514
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158452
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-30 20:11:31 +01:00
Skyler Grey 2ddd1378fc Improve HIDE_NON_NUMERICAL compatibility with Word
The previous implementation of REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL had
some major incompatibilites with Word. In particular, it stripped
letters even if they were included in the "numbering" system.

This commit fixes a lot of the flaws in the previous implementation, so
it's now a lot closer to Word.

Change-Id: Ifaa67fbc2d53b0d4fb85e7305b2dbdf78cf0a1ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158451
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-30 20:10:27 +01:00
Skyler Grey 15972993ff Fix incorrect marginal STYLEREF content in docx
STYLEREF fields were previously not importing with the correct content
when loading a docx document. This is because they were not updating
when the document had finished loading- only partway through, and where
a STYLEREF field is in relation to everything else in the document can
change its content.

This commit fixes that issue by adding STYLEREF fields to be refreshed
whenever other fields that can change based on pages (e.g. page number)
fields are updated. I suspect this could lead to double updates in some
cases where both reference and page fields are being updated. I consider
this a relatively minor issue in comparison to incorrect field content
when specific documents are loaded, but a followup could be made
improving this.

This commit also fixes a minor typo in reffld.cxx where m_sText is
always the filtered text when updating fields, even if we are updating
m_sTextRLHidden instead.

Change-Id: Iecd3e83a6bd3f8c2c6adba5c7eba9ee55b773510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158450
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-30 20:08:56 +01:00
Skyler Grey 6412a74b35 Enable STYLEREF flag export/import with ODF
This commit enables exporting the following STYLEREF flags with ODF
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO (Ib664fec059aa1f7f130acc76c253d5d298fa59f7)
- DOCX/ODF filters (here and Ib664fec059aa1f7f130acc76c253d5d298fa59f7)

Change-Id: Iad8e8001807f5ceeaedc9665838672695174a936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158351
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-30 20:07:01 +01:00
Skyler Grey e195c22533 Enable STYLEREF flag export/import with OOXML
This commit enables exporting the following STYLEREF flags with OOXML
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO
- DOCX filter

Change-Id: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158350
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-30 20:04:01 +01:00
Skyler Grey 4bb1a7836a Add flags to STYLEREF
This commit is part of an implementation for the following STYLEREF flags
- Search from bottom to top, which sets the STYLEREF field to search
  downwards first, or from the bottom of the page in marginals
- Hide non numerical, which hides all characters that are not either
  numbers or punctuation commonly used as delimiters. For example, if
  your STYLEREF said "Chapter 2.1", this setting would make it say "2.1"

This commit implements:
- The document model
- The layout
- The UI

Change-Id: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158349
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-10-27 08:07:21 +02:00
Skyler Grey 32c588dd11 tdf#86790: Add support for a word-style styleref
STYLEREF is a field type in Word which changes its content based on
nearby paragraphs. For example, upon creating a styleref referencing
"Heading 1" you will see the text of the nearest "Heading 1"-styled
paragraph that is above the field.

This patch implements STYLEREF in Writer as a cross-reference. By using
"insert>cross-reference>styles" you'll be presented with a list of
styles. Selecting one and clicking "insert" will create a field which
has text from the "most relevant" instance of the style. To find the
most relevant instance we first search up for paragraphs with the style,
and if there are any we take the closest. If there weren't any, we
search down for paragraphs with the style.

This patch also updates our use of STYLEREF for chapters exported to
docx by using it for all chapters not only those in headers and footers.
This allows us to approximate more chapter field functionality even when
moving between Writer and Word.

Finally, this patch adds some tests for STYLEREF:
- testTdf86790 tests that the "sample file with STYLEREF" document from
  tdf#86790 has the correct fields
- testStyleRefSearchUp tests that the STYLEREF searches up when there
  are bits of text both above and below it
- testStyleRefSearchDown tests that the STYLEREF searches down when
  there are bits of text below it only
- testMarginalStyleRef tests that the STYLEREF searches from the page
  top when it is placed in a footer
- testFootnotetyleRef tests that the STYLEREF searches from the
  reference mark when it is placed in a footnote

Still TODO:
- [  ] Update documentation
- [  ] Implement reverse-searching (\l) and nondelimiter
       suppression (\t)
       - Probably these 2 will be in a followup patch

Change-Id: I25dd7a6940abee5651a784b9059fe23b32547d6c
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157456
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-10-20 08:53:34 +02:00
Skyler Grey 328d6aae9e Re-enable Bullets and Numbering → Customize
- Revert change If0f7b953a40ca1d5f469087cb8f362a949c39b37
- Enable jsdialog for the customize page
- Fix numbering not being selected when switching level
- Fix start at field not having a default when changing level type to one that can use it
- Disable types that rely on supporting graphics in LOK as we cannot
  provide them

Change-Id: I2517289b553b8a3e9ed62c64b6514c6aab3702b6
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153806
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 6b9415005fee130e9d9b4b005a56975794a47934)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157957
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-14 14:30:17 +02:00
Skyler Grey ff568f6ec8 Make the format > sections > options dialog a jsdialog
- This dialog was not properly tunneled so did not show on collabora
  online
- Running asynchronously as a jsdialog both fixes this issue and is a
  general improvement (in that jsdialog conversion improves
  accessability, looks more consistent with the rest of COOL, etc.)

Note- This commit was previously given the Change-Id
      Ie9a70da70bbb30de039ded82f738285b1b734421 however I have replaced
      it due to accidentally creating it against the wrong base branch.
      To see the old change go to
      https://gerrit.libreoffice.org/c/core/+/147295

Change-Id: I2715eb1d8e3e301e1519e2ef6b69c823e571d08c
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151188
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 6aff11f36ecd02613c0613c9e89883c81656d9f6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157814
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-10-11 15:21:21 +02:00
Skyler Grey 8e246331f6 Add a FunctionBasedURPConnection and a websocket URP connector
- FunctionBasedURPConnection is used to enable a client to open a URP
  connection to a fresh Kit instance in COOL.
- This URP connector can be used with that and
  https://github.com/CollaboraOnline/online/pull/6992 to use a Java Uno
  Remote Protocol client over websockets
- For interoperability with existing Collabora Online websockets a
  prefix (urp ) is added to each message sent and a similar prefix
  (urp: ) is expected on each message recieved. This allows sending over
  the same websocket as other data is being transmitted through. If you
  are writing a bridge to work with this, you will need to add/strip the
  prefixes accordingly
- This commit uses Java WebSocket
  (https://github.com/TooTallNate/Java-WebSocket) to send data over
  websockets.

Change-Id: I2bda3d0b988bef7883f9b6829eeb5b7ae8075f27
Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151171
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-01 16:55:37 +02:00
Skyler Grey 9a0a7ae8f6 Make the insert caption dialog an async jsdialog
- Using StartExecuteAsync instead of Execute to execute the dialog makes
  it run asyncly
- We need to add a handler for the OK button, otherwise the event won't
  be fired when it's clicked. There seem to be varying names for this
  throughout the codebase, I've chosen OKHdl as it's short, appears to
  be relatively common and fits well with the existing OptionHdl and
  CaptionHdl that the other buttons on the dialog use
- Lastly, we need to enable the JSDialog builder in
  vcl/jsdialog/enabled.cxx so that the dialog becomes a JSDialog

Still TODO:
- Convert the dialogs that open when you press "auto" or "options"
  buttons (will be in a followup review)

Change-Id: Ieabbc4e69c4aa065506f7dc6c823d83e4d784c2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138313
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142988
Tested-by: Jenkins
2022-11-20 15:34:05 +01:00