Bug 92685 - Add PageNumber Header option ...
Summary: Add PageNumber Header option ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.0.0.beta1
Hardware: Other All
: medium enhancement
Assignee: Gülşah Köse
URL:
Whiteboard: target:6.1.0
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Fields-Page-Number
  Show dependency treegraph
 
Reported: 2015-07-11 16:03 UTC by Michael Meeks
Modified: 2018-07-31 19:18 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Current header context menu (3.37 KB, image/png)
2017-10-23 15:02 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2015-07-11 16:03:50 UTC
We nowadays have a very nice drop-down menu for adding headers and footers in writer. The menu contains a few items; I'd like to add:

"Add Page Number" - to make it easy for newbies that don't know that a page-number is a field (etc.) to trivially add a page number to their documents =)

The code to add these items is here:

sw/source/uibase/docvw/HeaderFooterWin.cxx

    // Create and set the PopupMenu
    m_pPopupMenu = new PopupMenu(SW_RES(MN_HEADERFOOTER_BUTTON));

    // Rewrite the menu entries' text
    if (m_bIsHeader)
    {
        m_pPopupMenu->SetItemText(FN_HEADERFOOTER_EDIT, SW_RESSTR(STR_FORMAT_HEADER));
        m_pPopupMenu->SetItemText(FN_HEADERFOOTER_DELETE, SW_RESSTR(STR_DELETE_HEADER));
    }

It might be great to add an: "Insert PageNumber" menu there to make this common case much simpler. Of course, that would also require a new string:

$ git grep STR_FORMAT_HEADER

And a new slot for that (cf. FN_HEADERFOOTER_EDIT) which is perhaps a pain - and some code to actually create and insert the field - and then we can argue if a sub-menu with left/right/center is required ;-) and what to do if the header has something in it already ;-) but ...

An idea to play with.
Comment 1 Michael Meeks 2015-07-11 16:04:18 UTC
Kendy - can we poke the UX team to see if this might be worth turning into an easy-hack ? I didn't add the keywords yet =)
Comment 2 Jan Holesovsky 2015-07-20 09:06:27 UTC
Changing the component to ux-advise to collect the UX input :-)
Comment 3 Heiko Tietze 2015-07-20 11:04:47 UTC Comment hidden (obsolete)
Comment 4 Robinson Tryon (qubit) 2016-08-25 05:39:18 UTC Comment hidden (obsolete)
Comment 5 Heiko Tietze 2017-10-23 15:02:22 UTC
Created attachment 137235 [details]
Current header context menu

Ignore comment 3; the idea is to have "Add page number" in the header context menu. Code pointers in comment 0.
Comment 6 zhengqiang 2017-11-16 09:03:38 UTC
I could not find the callback function of the button "Insert|Page Number" within the menu bar, would you like to tell me some clues? I plan to add that to the public function SwHeaderFooterWin::ExecuteCommand(), Thanks. :)
Comment 7 Michael Meeks 2017-11-16 09:08:30 UTC
If you checkout sw/uiconfig/swriter/menubar/menubar.xml  you can see all the menu commands and their UNO names:

      <menu:menuitem menu:id=".uno:InsertPageNumberField"/>

if you git grep for that UNO  name 'InsertPageNumberField' you should find what you need.

Thanks for working on this !
Comment 8 Himanshu Ranjan 2017-12-04 05:35:48 UTC
Anybody working on this bug?
I am a beginner and would like to work on this if no one's working on this.
Comment 9 Heiko Tietze 2017-12-04 08:12:01 UTC
(In reply to Himanshu Ranjan from comment #8)
> Anybody working on this bug?
> I am a beginner and would like to work on this if no one's working on this.

To my knowledge and what is stated on the ticket nobody is currently working on it. You are very welcome, feel free to ask any question.
Comment 10 Himanshu Ranjan 2017-12-06 10:37:35 UTC
Where can I find the code for the menu drop-down button of Header which is shown in the attachment above ( https://bug-attachments.documentfoundation.org/attachment.cgi?id=137235 )  ?

Moreover, can anyone tell what is required to add a field in the Header menu drop-down? I mean, is any language required other than c++ or is any software needed to do this.

I was thinking to write a similar code as of (Insert->Page Number) in the file where the code for Header menu drop-down is given.

Also any advice on how to understand this code would be really great.
Comment 11 Commit Notification 2018-01-25 08:37:36 UTC
Gulsah Kose committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=463ca11b764dfdf48d0422b0a392a462bf6681a3

[Pardus] tdf#92685 Add insert page number option to header menu.

It will be available in 6.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 12 Xisco Faulí 2018-05-01 19:27:42 UTC
@Gulsah Kose, I'm wondering if the 'insert page number' option should disappear once the page number has been added?

@Heike, what do you think?
Comment 13 Heiko Tietze 2018-05-02 04:20:06 UTC
(In reply to Xisco Faulí from comment #12)
> @Gulsah Kose, I'm wondering if the 'insert page number' option should
> disappear once the page number has been added?
> 
> @Heike, what do you think?

Sounds reasonable though some users may want to insert a page number at left and at right. Okay, likely less then "some". 

If we do so, depending on the effort for Gulsah, the menu entry should rather be disabled.
Comment 14 Gülşah Köse 2018-05-02 11:23:16 UTC
@Xisco and @Heiko, I am going to do it today. o/
Comment 15 Timur 2018-05-03 10:41:13 UTC Comment hidden (me-too)
Comment 16 Timur 2018-05-03 10:45:51 UTC
I'm not in favor of disappearing Page Number. 
IMHO way to go is to extend menu Insert-Page Number (via submenu) to create Header or Footer with Page Number (possibly offering another submenu for left, center or right position). And that's a bug 86630.
In that case we should not have disappearing menu but rather changing page number position if another option in menu is chosen.
Related to this bug, I'd rather see submenu on this new "Insert Page Number" in header/footer to offer left, center or right position.
Comment 17 Heiko Tietze 2018-05-03 12:07:31 UTC
(In reply to Timur from comment #16)
> I'm not in favor of disappearing Page Number. 
> IMHO way to go is to extend menu Insert-Page Number (via submenu) to create
> Header or Footer with Page Number (possibly offering another submenu for
> left, center or right position). And that's a bug 86630.
> In that case we should not have disappearing menu but rather changing page
> number position if another option in menu is chosen.
> Related to this bug, I'd rather see submenu on this new "Insert Page Number"
> in header/footer to offer left, center or right position.

Well, we could go with radio buttons Page Number > (o) None ( ) Left ( ) Right, if this isn't an overkill.
Comment 18 Gülşah Köse 2018-05-03 12:41:56 UTC
@Heike @Xisco and @Timur. I think it should be new bug report or edit bug 86630.I will continue to work when you make your final decision.
Comment 19 Gülşah Köse 2018-05-23 06:31:30 UTC
I have received a request for this bug from Pardus team. They also want like "1/10" page number option. I am prepearing a new patch for this. Please let me know if there is a problem.
Comment 20 Gülşah Köse 2018-05-23 06:58:36 UTC
Patch is ready https://gerrit.libreoffice.org/#/c/54687/ . Waiting your ideas and reviews.
Comment 21 Commit Notification 2018-05-24 07:26:10 UTC
Gulsah Kose committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2a93d2a4af7bb72b155f91e18239cc1b5bc90a4e

[Pardus] tdf#92685 Add insert page count option to header menu

It will be available in 6.1.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 22 Gülşah Köse 2018-05-24 07:29:38 UTC
I've just submit to master now. Still if there is a problem here i can revert orchange it again.
Comment 23 Gerry 2018-06-14 06:09:48 UTC
(In reply to Gülşah Köse from comment #22)
> I've just submit to master now. Still if there is a problem here i can
> revert orchange it again.

@Gülşah: Do you plan to also apply the same patch also for the Footer? It seems that the patch was only for the Header, but the feature would IMHO make also sense for the Footer.
Comment 24 Timur 2018-06-14 14:34:39 UTC
@Gerry: seems like you were reading, not trying this? Because both header and footer menu have Insert Page Number and Insert Page Count options.

@Gülşah: Is is feasible to have submenu on these new options to offer left, center or right position?
Comment 25 Gülşah Köse 2018-06-20 11:57:06 UTC
@Timur I recommend that we do not crowd the menu any more, as it is very easy to do with Tab.
Comment 26 Gerry 2018-06-24 07:19:23 UTC
(In reply to Timur from comment #24)
> @Gerry: seems like you were reading, not trying this? Because both header
> and footer menu have Insert Page Number and Insert Page Count options.

@Timur: Thanks for your reply. Is then the description in the 6.1 release notes incomplete? 

Should "Add insert page number option to header menu." correctly be "Add insert page number option to header or footer menu."?

https://wiki.documentfoundation.org/ReleaseNotes/6.1#General
Comment 27 Timur 2018-06-25 08:57:39 UTC
Yes, I corrected that. Thank you.