Bug 147791 - Add UNO command to "Print Current Page Directly"
Summary: Add UNO command to "Print Current Page Directly"
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.1.3 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyMedium, easyHack, skillCpp, topicUI
Depends on:
Blocks: UNO-Command-New
  Show dependency treegraph
 
Reported: 2022-03-06 07:00 UTC by mkassler
Modified: 2022-06-14 09:10 UTC (History)
5 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 mkassler 2022-03-06 07:00:19 UTC
I suggest that 'Print Current Page' be enabled by the user pressing two keys such as Alt+P. Microsoft Word has this useful feature, and I recommend that Writer enable it as well. (I am aware that macros exist to enable this function, but recommend a simpler implementation for the user.)
Comment 1 Dieter 2022-03-21 07:13:33 UTC
I think this is an enhancement request. I couldn't find a comment "Print current page", but I agree, that it might be useful.

cc: Design-Team
Comment 2 Heiko Tietze 2022-03-21 09:19:03 UTC
Would this "Print Current Page" action print directly or show the preview first?

The shortcut compared to Print (Ctrl+P) is that you don't need to press Alt+G (the mnemonic for "Pa_ges" in the English UI.

There is no shortcut for "Print Directly" (but it can be customized), and the alternative to the command envisioned above is "Print Current Page Directly".

By the way, this function feels dangerous to me. And if we are going to implement a new command I'm against assigning a default shortcut.
Comment 3 Dieter 2022-03-21 09:44:25 UTC
(In reply to Heiko Tietze from comment #2)
> Would this "Print Current Page" action print directly or show the preview
> first?

From my personal user perspective I propose command "Print current Page Directly" that can be assigned to a shortcut (similar with "Print Directly"), but shouldn't be assigned by default.
Comment 4 Heiko Tietze 2022-03-24 13:44:45 UTC
So let's do it. Could be a nice easy hack.
Comment 5 Jim Raykowski 2022-03-30 00:34:05 UTC
code pointers:
    
https://design.blog.documentfoundation.org/2018/02/28/easyhacking-all-about-terminology/
    
An article that illustrates how to add an UNO command for Calc:
https://dev.blog.documentfoundation.org/2022/02/23/adding-a-new-uno-command/ 
    
For Writer, instead, add the new command to officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu, perhaps .uno:PrintVisiblePagesDirect.
    
officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs contains information on properties used in the .xcu file.
    
core/sw/inc/cmdid.h
perhaps FN_PRINT_VISPAGESDIRECT or SID_PRINT_VISPAGESDIRECT (FN for FuNction, SID for Slot ID, either will work)

sw/sdi/swriter.sdi
sw/sdi/_viewsh.sdi
    
sw/source/uibase/uiview/viewprt.cxx
void SwView::ExecutePrint
add a case for the chosen command id:
    
sw/inc/viewsh.hxx
void GetFirstLastVisPageNumbers (not yet merged, please see https://gerrit.libreoffice.org/c/core/+/132252)
    
sfx2/source/view/viewprn.cxx
void SfxViewShell::ExecPrint

sw/source/uibase/uiview/viewstat.cxx
void SwView::GetState(SfxItemSet &rSet)
add a case for the chosen command id:
do similar to what is done in sfx2/source/view/viewsh.cxx void SfxViewShell::GetState_Impl for case SID_PRINTDOC and case SID_PRINTDOCDIRECT
	  	    
https://gerrit.libreoffice.org/c/core/+/91605 is an example of two UNO commands added to Writer.
Comment 6 mkassler 2022-06-14 00:08:11 UTC
Is anyone working o implement this suggested enhancement?
Comment 7 Buovjaga 2022-06-14 05:06:12 UTC
(In reply to mkassler from comment #6)
> Is anyone working o implement this suggested enhancement?

No, you can work on it, if you want. If someone was working on it, the Assignee would be set and the status would be Assigned.
Comment 8 mkassler 2022-06-14 09:08:59 UTC
I am unable to do this myself, and am hoping that someone else can do this task. A previous poster said it was an 'easy hack' to do.
Comment 9 mkassler 2022-06-14 09:10:38 UTC Comment hidden (no-value, obsolete)