https://bugs.documentfoundation.org/show_bug.cgi?id=163512
--- Comment #17 from FredrikL <[email protected]> --- Created attachment 208308 --> https://bugs.documentfoundation.org/attachment.cgi?id=208308&action=edit Test file to look at the result of the new suggested code change I was thinking a little bit more and I was thinking that if the user change the width of a comment in "Show comment" mode that size is most likely the "hover" size of the comment that the user want if author display is set to disabled. I attach a file to open and see the "hover" and "show comment" result of different comments before and after suggested code change. Test instructions inside the file. Please see comment #16 above to see my answer to comment #15. This suggested code change would only auto-grow width when author display is enabled, or when the comment has the default width and the author display is disabled. If the user has manually resized the width of the comment and author display is disabled, the dimensions the user choosed in "Show comment" mode will be the dimensions that is used for "hovering" as well. In the file ~/libreoffice/sc/source/core/data/postit.cxx Replace line 917 to 920: pCaption->SetMergedItem( makeSdrTextAutoGrowWidthItem( true ) ); pCaption->SetMergedItem( makeSdrTextMinFrameWidthItem( SC_NOTECAPTION_WIDTH ) ); pCaption->SetMergedItem( makeSdrTextMaxFrameWidthItem( nMaxWidth ) ); pCaption->SetMergedItem( makeSdrTextAutoGrowHeightItem( true ) ); with this code block: // Bug #163512: Only auto-grow width when author display is enabled, or // when the comment has the default width and author display is disabled. // If the user has manually resized the width of the comment and author // display is disabled, use the stored dimensions. bool bAutoGrowWidth = true; if (!officecfg::Office::Calc::Content::Display::NoteAuthor::get() && pNoteCaption) { const tools::Long nCaptionWidth = pNoteCaption->GetLogicRect().GetWidth(); if (nCaptionWidth != SC_NOTECAPTION_WIDTH) { bAutoGrowWidth = false; // apply the user's custom width and height to the temp caption tools::Rectangle aCaptRect = pCaption->GetLogicRect(); aCaptRect.SetSize({ nCaptionWidth, pNoteCaption->GetLogicRect().GetHeight() }); pCaption->SetLogicRect( aCaptRect ); } } pCaption->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) ); pCaption->SetMergedItem( makeSdrTextMinFrameWidthItem( SC_NOTECAPTION_WIDTH ) ); pCaption->SetMergedItem( makeSdrTextMaxFrameWidthItem( nMaxWidth ) ); pCaption->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowWidth ) ); When building from source I had to run in the terminal: cd libreoffice cd sc make clean cd .. make sc.build && make because without the "make clean" command I could see no change in the behaviour. Also when testing the code you might have to select and deselect the Author display check box in LibreOffice settings because that is a bit buggy too. There is config:name="ShowNoteAuthor" in the settings.xml file inside ods files that can conflict with the global setting. I think that the config:name="ShowNoteAuthor" should be removed completely from the settings.xml file when not working properly anyway. I have a patch for that as well if it is of interest. What do you think of this solution? -- You are receiving this mail because: You are the assignee for the bug.
