Bug 154088 - The implementation of drawing the grid of the characters should be unified
Summary: The implementation of drawing the grid of the characters should be unified
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Amos Aidoo
URL:
Whiteboard: target:24.2.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks: Special-Character
  Show dependency treegraph
 
Reported: 2023-03-09 09:47 UTC by Andreas Heinisch
Modified: 2023-11-22 20:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Heinisch 2023-03-09 09:47:38 UTC
Description:
In the special characters dialog there exists two almost identical implementations of drawing the grid, i.e., svx/source/dialog/charmap.cxx and svx/source/dialog/searchcharmap.cxx

They differ in only in very few lines in SvxSearchCharSet::DrawChars_Impl and SvxShowCharSet::DrawChars_Impl.

These leads to code duplication when enhancing the the special characters dialog grid like in https://gerrit.libreoffice.org/c/core/+/148051

Steps to Reproduce:
None

Actual Results:
Implementation is duplicated.

Expected Results:
Implementation is unified. This could also solve the problem of Bug 154087.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6c2542306bcc7caaab947664f252265058964fc2
CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: CL threaded
Comment 1 Stéphane Guillou (stragu) 2023-03-25 23:33:37 UTC
I can see the code duplication. Fair request for consolidation/simplification.

Hossein, what kind of easyHack could that be?
Comment 2 Hossein 2023-05-04 14:02:33 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
> I can see the code duplication. Fair request for
> consolidation/simplification.
> 
> Hossein, what kind of easyHack could that be?
This is a cleanup task, and I would say it is a relatively easy refactoring task. One should move the common code to a common function.
Comment 3 Commit Notification 2023-11-22 20:50:09 UTC
AmosAidoo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/94d2d9a59450fa4bccd0a3a450d8b273271d2ff2

tdf#154088 Merge code snippets for character retrieval and string construction

It will be available in 24.2.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.