Bug 153995 - No ability for flipping the column order of a table
Summary: No ability for flipping the column order of a table
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: ImpressDraw-Tables RTL-UI
  Show dependency treegraph
 
Reported: 2023-03-05 23:31 UTC by Eyal Rozenberg
Modified: 2023-03-25 08:55 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Table direction flipping in writer (13.64 KB, application/vnd.oasis.opendocument.text)
2023-03-24 12:56 UTC, Eyal Rozenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2023-03-05 23:31:33 UTC
Sometimes, you want to flip the order of columns in a table: Replace columns 1...N with N...1 respectively, with each column keeping its width and formatting - just with their orders reversed. (Possibly you also want the Left and Right border formatting flipped for each column - but maybe not; let's ignore that for now.)

There is no UI for doing that, and probably no code either. There should be! When we want to switch the direct of a paragraph, we can do that; so - why not also that of a table?
Comment 1 Eyal Rozenberg 2023-03-05 23:33:51 UTC
Should I file a separate bug for the same issue for Writer? As... Writer and Impress/Draw tables are not quite the same.
Comment 2 Heiko Tietze 2023-03-06 07:48:54 UTC
(In reply to Eyal Rozenberg from comment #0)
> There is no UI for doing that, and probably no code either. There should be!
> When we want to switch the direct of a paragraph, we can do that; so - why
> not also that of a table?

Have you ever seen such a UI? Rather than some interface I'd want to use a shortcut, something like ctrl+c and <random>+v that not only inserts the copied content but switches it. Would be hard to figure out, if not existent anywhere else.
Comment 3 Maxim Monastirsky 2023-03-06 08:45:19 UTC
In Writer you can switch the direction of a table using the "Text Direction" property in the Table Properties dialog. By default this affects also the paragraph direction inside the table, but you can override this on the paragraph level either via a style or DF.
Comment 4 Eyal Rozenberg 2023-03-06 09:38:05 UTC
(In reply to Heiko Tietze from comment #2)
> Have you ever seen such a UI?

Well, I see it for paragraphs: A two-state button group...

I'm being a little facetious of course, because table direction switching is needed much more rarely and does merit "toolbar real-estate". But let's start with having the functionality, e.g. as an UNO command which has a potential menu item / items, and maybe an off-toolbar pair of buttons.

> Rather than some interface I'd want to use a
> shortcut, something like ctrl+c and <random>+v that not only inserts the
> copied content but switches it. Would be hard to figure out, if not existent
> anywhere else.

I would not want to mix copying and switching, because what this would effectively mean is that you have to copy-switch then delete, which is a hassle, especially for large tables which fill an Impress slide etc.

But - if the functionality existed and was only accessible via some keyboard shortcut - that would already be pretty good.

So, changing the title to focus on the functionality rather than the UI
Comment 5 Heiko Tietze 2023-03-06 10:30:14 UTC
What comes in mind is the move column left/right function (resp. up/down for rows). Would be bug 99457 and bug 116948.
Comment 6 Eyal Rozenberg 2023-03-06 10:40:55 UTC
(In reply to Heiko Tietze from comment #5)
> What comes in mind is the move column left/right function (resp. up/down for
> rows). Would be bug 99457 and bug 116948.

So, those issues are somewhat related, but:

1. They're about Calc and Writer, respectively
2. If that were implemented in Impress, it would make the flipping less painful, but you would still need to make floor(N/2) column moves per table to make it happen, for an N-column table.
Comment 7 Regina Henschel 2023-03-06 13:09:45 UTC
Tables in Draw/Impress are inside shapes and the edit engine for shape content is not able to interpret and render the style:writing-mode attribute of a table style. This cannot be simple solved by introducing an uno-command. It needs adding features to the shape text edit engine.

The request belongs to the group of not implemented ODF features.
Comment 8 Eyal Rozenberg 2023-03-06 22:51:59 UTC
(In reply to Regina Henschel from comment #7)
> Tables in Draw/Impress are inside shapes and the edit engine for shape
> content is not able to interpret and render the style:writing-mode attribute
> of a table style. This cannot be simple solved by introducing an
> uno-command. It needs adding features to the shape text edit engine.

While that is a possibility, it is not necessary for what I'm asking. I'm not asking (in this bug) for tables to have a persistent, recognizable direction - just that we automate the procedure of:

Add new column N+1
Move column 1 to N+1 (+ set width)
Move column N to 1 (+ set width)
Move column N+1 to N (+ set width)
Move column 2 to N+1 (+ set width)
Move column N-1 to 2 (+ set width)
Move column N+1 to N-1 (+ set width)
...
Remove column N+1

> The request belongs to the group of not implemented ODF features.

So, I believe that would be a separate request
Comment 9 Regina Henschel 2023-03-07 00:01:07 UTC
Automate such procedure could likely be done by a macro.
Comment 10 Heiko Tietze 2023-03-24 09:45:47 UTC
We discussed the topic in the design meeting.

The request is not about moving some columns or rows to another position but rather flip the whole table. Calc has such option with Sheet > [ ] Right-to-Left. Having such option for Draw/Impress and also Writer is desired but probably needs an enhancement for ODF. 

The alternative is to introduce a special UNO command to flip the table content. Could also be realized via macro/extension but the function is likely required often enough to deserve a build-in solution.
Comment 11 Heiko Tietze 2023-03-24 09:47:33 UTC
(In reply to Heiko Tietze from comment #10)
> [ ] Right-to-Left... for (tables in) Draw/Impress and also Writer

Regina, what do you think about adding this to the format?
Comment 12 Maxim Monastirsky 2023-03-24 10:17:25 UTC
(In reply to Heiko Tietze from comment #10)
> Having such option for Draw/Impress and also Writer is
> desired but probably needs an enhancement for ODF.
I don't think this needs any enhancements for ODF. The same way this is done for Calc (i.e. style:writing-mode attribute under <style:table-properties>) can also work for tables in other apps, and in fact already work in Writer as per comment 3. It's only Impress that is lacking in table-wide settings support (besides shadow).
Comment 13 Heiko Tietze 2023-03-24 10:33:51 UTC
How do you flip a table in Writer?
Comment 14 Maxim Monastirsky 2023-03-24 11:24:22 UTC
(In reply to Heiko Tietze from comment #13)
> How do you flip a table in Writer?
Right click > Table Properties ... , in the Table tab there is a "Text direction" setting that can be set to RTL. You might need to activate support for CTL langs to see this setting.
Comment 15 Heiko Tietze 2023-03-24 11:41:06 UTC
(In reply to Maxim Monastirsky from comment #14)
> You might need to activate support for CTL langs to see this setting.

Works when CTL is checked. Do you think it is easyhackable?
Comment 16 Eyal Rozenberg 2023-03-24 12:56:00 UTC
Created attachment 186188 [details]
Table direction flipping in writer

A document with a table each of whose columns has some different properties, for observing the behavior during table direction flip.

You can either flip the page direction, or the table direction directly via table properties. The initial state is LTR page with a "use superordinate" table direction.
Comment 17 Eyal Rozenberg 2023-03-24 12:59:11 UTC
So, Heiko, Gabby, we should perhaps have focused more, in our discussion yesterday, on the state of affairs in Writer rather than in Calc, because indeed Writer tables have the "better" version of this feature, i.e. proper stateful direction.

If, as Maxim notes, the relevant ODF property can already be applied to Impress tables, that's great. But - I wonder if the application of this property is actually supported in Draw/Impress right now.
Comment 18 flywire 2023-03-25 07:46:35 UTC
Should also consider extending to columns/rows and supporting header columns/rows in all apps.
Comment 19 Eyal Rozenberg 2023-03-25 08:55:45 UTC
(In reply to flywire from comment #18)
> Should also consider extending to columns/rows and supporting header
> columns/rows in all apps.

Please file a separate bug about that.