[Libreoffice-bugs] [Bug 112127] Rename page dialog title says 'Rename Slide'

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Jul 2 15:54:43 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=112127

Muhammet Kara <muhammet.kara at collabora.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |difficultyBeginner,
                   |                            |easyHack, skillCpp, skillUI

--- Comment #4 from Muhammet Kara <muhammet.kara at collabora.com> ---
(In reply to Muhammet Kara from comment #3)
> Actually, the Draw page is also named as "Slide 1". It should be "Page 1"
> instead.

Let's keep this separate for now.

Here are the code pointers (or, suggested workflow):

Let's try to find the code pointers together. We will use the Linux/bash
terminal command "grep" to search through the source files. We will issue
commands inside the "core" repo.

 core  git grep "Rename Slide"
android/source/res/values/strings.xml:    <string
name="action_rename_slide">Rename Slide</string>
officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu:      
   <value xml:lang="en-US">Rename Slide</value>
sd/inc/strings.hrc:#define STR_TITLE_RENAMESLIDE                          
NC_("STR_TITLE_RENAMESLIDE", "Rename Slide")

So there are 3 possible candidates where this string is used. Pay attention to
sd/inc/strings.hrc:#define STR_TITLE_RENAMESLIDE

STR_TITLE_RENAMESLIDE here is called a define, and it is used as a shortcut
(google "preprocessor macros" for more info) to the string, and it allows
localization. Wherever we use this shortcut instead of directly using the
string itself, it will come up as a localized version for the user's language.

Now, let's see where this shortcut is used:
 core  git grep -n STR_TITLE_RENAMESLIDE
sd/inc/strings.hrc:235:#define STR_TITLE_RENAMESLIDE                          
NC_("STR_TITLE_RENAMESLIDE", "Rename Slide")
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867:        aTitle =
SdResId( STR_TITLE_RENAMESLIDE );
sd/source/ui/view/drviews2.cxx:792:                OUString aTitle =
SdResId(STR_TITLE_RENAMESLIDE);
sd/source/ui/view/unmodpg.cxx:175:    ,
maComment(SdResId(STR_TITLE_RENAMESLIDE))

Since we are interested in the title of a dialog, it is probably a good idea to
check the instances of variable named "aTitle". (Btw, you see that we used
"grep -n" instead of "grep" this time. "-n" brings the results with line
numbers.)

A quick way to check which one is correct is to put a break point to the
concerned lines, open a new Draw doc, right click on the page on the page pane,
and select "Rename Page". If you hit a break point, you will know it is the
right place. Let's do that:

(You need to have gdb installed on your system, you should be inside the core
directory, and you should have a debug build: simply add these to your
autogen.input file before building:
--enable-debug
--enable-dbgutil)

 core  make debugrun
.....

(gdb) b
/home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867
No source file named
/home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1
(/home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867)
pending.

(gdb) b /home/kara/core/sd/source/ui/view/drviews2.cxx:792
No source file named /home/kara/core/sd/source/ui/view/drviews2.cxx.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (/home/kara/core/sd/source/ui/view/drviews2.cxx:792) pending.

(WATCH OUT! We have put the full paths of the source files beginning with
/home...)

(gdb) run --draw

...

Thread 1 "soffice.bin" hit Breakpoint 2,
sd::slidesorter::controller::SlotManager::RenameSlide (this=0x1ef8190,
rRequest=...) at
/home/kara/core/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx:867
867             aTitle = SdResId( STR_TITLE_RENAMESLIDE );

Ahhaa!

That's where the title of our rename dialog is determined.

Now:
* Just put an if-check against DocumentType, and put STR_TITLE_RENAMESLIDE or
STR_TITLE_RENAMEPAGE based on the document type. (If there is no
STR_TITLE_RENAMEPAGE, go to where STR_TITLE_RENAMESLIDE is defined, and add it
there)

* You can get the document type with
mrSlideSorter.GetModel().GetDocument()->GetDocumentType()

May it be easy! :)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190702/7532660f/attachment.html>


More information about the Libreoffice-bugs mailing list