Bug 160225 - "Duplicate Sheet" Causes Axis Label to Appear in Chart
Summary: "Duplicate Sheet" Causes Axis Label to Appear in Chart
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.2.1.2 release
Hardware: All All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:24.8.0 target:24.2.3 target:7.6.7
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-15 20:55 UTC by Tex2002ans
Modified: 2024-03-19 17:48 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Duplicate.Sheets.-.Chart.Axis.Label.Bug.-.Fruits.ods (21.54 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-03-15 20:58 UTC, Tex2002ans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tex2002ans 2024-03-15 20:55:56 UTC
Description:
A chart with NO labels gets duplicated into a 2nd sheet WITH labels.

Steps to Reproduce:
In Calc:

0. Open attachment.
1. Alt+1 (to open Properties sidebar)
2. Double-click on chart.

Now, in the Properties sidebar, down towards the middle...

Under "Elements" > "Axes", there are 6 checkboxes:

- X axis      - X axis title
- Y axis      - Y axis title
- Z axis      - Z axis title

4. Check "X axis title" box ON.
5. Check "X axis title" box OFF.

6. Back in Calc, along the very bottom bar of the UI...

On the "Fruits" Sheet:

- Right-Click > "Duplicate Sheet"

Actual Results:
- Duplicated chart has an X axis "Title" showing.
- Original chart has no X axis title showing.

Expected Results:
- Both sheets/charts look exactly the same.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

- - -

Note 1: It looks like Right-Click > "Duplicate Sheet" was first introduced in:

- LO 7.4.0:
- Bug #145745

I found that in the Release Notes:

- https://wiki.documentfoundation.org/ReleaseNotes/7.4

- - -

Note 2: Before LO 7.4, you have to go into an extra menu for Step 6 duplicating:

6A. Right-Click > "Move or Copy Sheet".
7A. Press OK.

- - -

Note 3: The entire "linux-64-7.6" repo has same exact symptoms.

In 7.1.0.0.alpha0+, Step 5 doesn't turn the label OFF.

So this exact issue probably(?) lurked somewhere between 7.1<->7.5.
Comment 1 Tex2002ans 2024-03-15 20:58:18 UTC
Created attachment 193136 [details]
Duplicate.Sheets.-.Chart.Axis.Label.Bug.-.Fruits.ods
Comment 2 Armondo Lopez 2024-03-15 22:47:50 UTC
Thank you for reporting the bug. I can confirm that the bug is present in Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

and version:
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: a2265e8faa099d9652efd12392c2877c2df1d1eb
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 3 Julien Nabet 2024-03-16 20:10:53 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

I noticed that if I don't use sidebar but "Insert Axis Title"  from right click in chart then removed X Axis Title/Y Axis Title by clicking on the title and typed DEL, "duplicate sheet" was ok.

"Insert Axis Title" is done with "createTitle" which is called from:
#0  chart::TitleHelper::createTitle(chart::TitleHelper::eTitleType, rtl::OUString const&, rtl::Reference<chart::ChartModel> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, chart::ReferenceSizeProvider*)
    (eTitleType=chart::TitleHelper::X_AXIS_TITLE, rTitleText="X Axis Title", xModel=rtl::Reference to 0x55bd93a4dde0, xContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x55bd90a7d8f8, pRefSizeProvider=0x7fffd867eea0) at chart2/source/tools/TitleHelper.cxx:206
#1  0x00007f1439ab7222 in chart::ChartController::executeDispatch_InsertAxisTitle() (this=0x55bd9a2ff0c0) at chart2/source/controller/main/ChartController_Insert.cxx:844
#2  0x00007f1439a96c0d in chart::ChartController::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    (this=0x55bd9a2ff0c0, rURL=..., rArgs=empty uno::Sequence) at chart2/source/controller/main/ChartController.cxx:1217
#3  0x00007f1439b3bdd3 in chart::ControllerCommandDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    (this=0x55bd9837d8a0, URL=..., Arguments=empty uno::Sequence) at chart2/source/controller/main/ControllerCommandDispatch.cxx:777

Removing title is done with "removeTitle" called from:
#0  chart::TitleHelper::removeTitle(chart::TitleHelper::eTitleType, rtl::Reference<chart::ChartModel> const&) (nTitleIndex=chart::TitleHelper::X_AXIS_TITLE, xModel=rtl::Reference to 0x55bd93a4dde0)
    at chart2/source/tools/TitleHelper.cxx:384
#1  0x00007f1439ad3dae in chart::ChartController::executeDispatch_Delete() (this=0x55bd9a2ff0c0) at chart2/source/controller/main/ChartController_Tools.cxx:621
#2  0x00007f1439aec211 in chart::ChartController::execute_KeyInput(KeyEvent const&) (this=0x55bd9a2ff0c0, rKEvt=...) at chart2/source/controller/main/ChartController_Window.cxx:1602
#3  0x00007f1439b16c54 in chart::ChartWindow::KeyInput(KeyEvent const&) (this=0x55bd9ac5bf60, rKEvt=...) at chart2/source/controller/main/ChartWindow.cxx:176


But when using sidebar "createTitle" is called from:

#0  chart::TitleHelper::createTitle(chart::TitleHelper::eTitleType, rtl::OUString const&, rtl::Reference<chart::ChartModel> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, chart::ReferenceSizeProvider*)
    (eTitleType=chart::TitleHelper::X_AXIS_TITLE, rTitleText="Title", xModel=rtl::Reference to 0x55bd93a4dde0, xContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x55bd90a7d8f8, pRefSizeProvider=0x0) at chart2/source/tools/TitleHelper.cxx:206
#1  0x00007f143a36ca69 in chart::TitleHelper::createOrShowTitle(chart::TitleHelper::eTitleType, rtl::OUString const&, rtl::Reference<chart::ChartModel> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
    (eTitleType=chart::TitleHelper::X_AXIS_TITLE, rTitleText="Title", xModel=rtl::Reference to 0x55bd93a4dde0, xContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x55bd90a7d8f8)
    at chart2/source/tools/TitleHelper.cxx:195
#2  0x00007f1439b959b7 in chart::sidebar::ChartElementsPanel::setTitleVisible(chart::TitleHelper::eTitleType, bool) (this=0x55bd9a754650, eTitle=chart::TitleHelper::X_AXIS_TITLE, bVisible=true)
    at chart2/source/controller/sidebar/ChartElementsPanel.cxx:653
#3  0x00007f1439b95060 in chart::sidebar::ChartElementsPanel::CheckBoxHdl(weld::Toggleable&) (this=0x55bd9a754650, rCheckBox=...) at chart2/source/controller/sidebar/ChartElementsPanel.cxx:593

and "removeTitle" never called because we call "hideTitle" instead from:
648  void ChartElementsPanel::setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible)
649  {
650      if (bVisible)
651      {
652          OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle;
653          TitleHelper::createOrShowTitle(eTitle, aText, mxModel, comphelper::getProcessComponentContext());
654      }
655      else
656      {
657          TitleHelper::hideTitle(eTitle, mxModel);
658      }
659  }
See https://opengrok.libreoffice.org/xref/core/chart2/source/controller/sidebar/ChartElementsPanel.cxx?r=950d8b64#657

If we call removeTitle instead, it works.

But hideTitle has been add with tdf#92768 so we don't lose the text and the formatting.

So the goal is to find the find to set the visibility of the title to true or false when duplicating sheet.
Comment 4 Julien Nabet 2024-03-17 08:30:42 UTC
I also noticed that if you do this:
1. Check "X axis title" box ON.
2. Check "X axis title" box OFF.
3. Save file
4. Close file
3. Reopen file
the "X axis title" box is ON.

So there's definitely something lacking to save the state of PROP_TITLE_VISIBLE.
Comment 5 Julien Nabet 2024-03-17 08:43:17 UTC
I gave a try with https://gerrit.libreoffice.org/c/core/+/164938
Comment 6 Commit Notification 2024-03-17 10:14:35 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9661b094e10602148c3cf68bcce01f4a6714bedd

tdf#160225, related tdf#92768: hide axis title not taken into account when...

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Julien Nabet 2024-03-17 10:15:07 UTC
Patch for libreoffice-24-2 branch waiting for review here:
https://gerrit.libreoffice.org/c/core/+/164878
Comment 8 Commit Notification 2024-03-18 06:47:30 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/b97348107831c5699e679dc8d2c36d626122ae0c

tdf#160225, related tdf#92768: hide axis title not taken into account when...

It will be available in 24.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2024-03-19 17:48:15 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/2c11aa68477e957fb298605baca08ec48acffcd7

tdf#160225, related tdf#92768: hide axis title not taken into account when...

It will be available in 7.6.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.