Thanks for new dialog Print with interesting options, especially for "Page layout" tab. It is useful. Thanks for ability to resize dialog.
But here is one problem: no option "Pirnt current page" on tab "General" on "Range and copies" part of window.
In open office this option works this way: in field "Pages" was automatically placed number of page, where cursor placed.
Changed the priority to enhancement.
This is even an EasyHack. Code pointers to get started:
I'll work on this one for sure until 3/28/11, but I'll make my deadline 4/3/11.
*** Bug 38830 has been marked as a duplicate of this bug. ***
Created attachment 49228 [details]
The patch for printing current page bug
We've tried to make it as OOO did. When the print dialog appears, the current page will be passed to SwPrintUIOption and stored in mhst11_nCrsrCurPage variable. The text box of Pages radio button (below All pages options) will be set to the current page.
PS: We are trying to add another radiobuton like Current Page option.
Created attachment 49235 [details]
New patch with coding convention for printing current page bug
Same patch as before but follow coding convention
Created attachment 49253 [details]
modified patch, see comment 6
May I, newbie in this project, post some of my nitpicking for your patch?
- You should ignore the whitespace-only changes, such as, delete trailing whitespace, and deleting blank lines without nearby coding change.
- The SCM-like comments aren't necessary. We're using git and diff which can track the change powerfully. These means: /*~~~v*/ and /*~~~^*/ should be ignored, too.
For the technical point, I wonder:
- whether we're using "short" data type? IMHO we're using sal_uInt16(?)
- whether we should copy&paste, then modify some of the overloaded constructor? IMHO the copy&paste isn't good idea, so can we just change the old constructor into new one?
- whether we could use only "m_nCrsrCurPage" instead of "SwPrintUIOptions::m_nCrsrCurPage" in the printdata.cxx ?
But please wait for more experienced developers to confirm these.
- Last nitpicking, what does "MHST" means? If it means your name, please also ignore it.
PS. I've attached modified patch which:
- ignores all whitespace-only changes and SCM-like comments
- changes old constructor into new one without duplicating it, extracting your changes into it
- ignores some (IMHO) obvious comments
- changes the "short" into other data type
- changes "SwPrintUIOptions::m_nCrsrCurPage"
- ignores "MHST"
- build and test at all
Thank you for your comment, Korrawit.
I'll fix the patch as you comment.
However, there is one thing. It's the constructor. I don't know if others will
call the constructor from other code. Therefore, making a new constructor
(IMHO) will be safer. Anyway, copy&paste the old constructor is quite lame :) I
really want to call the old constructor from the new one but the problem is
that I don't know how to set the value of the text box after it is constructed
(in old constructor).
Hi, first of all: sorry, if these comments are unqualified. Here they are:
* I can't really program but I would have expected the change to be made here:
* Second, the patch seems to take the position of the cursor to determine which page is the current page. Is there a way to instead use the page that's currently visible in the main window? I think that would be much more logical and also not be prone to errors when there is no cursor (reading mode).
Tatung, thanks for your work, by the way.
Hi Aaron, all,
* You're right that the change should be made from print3.cxx. However, I don't know how to get the current page in print3.cxx. In unotxdoc.cxx, I can get the current page where the cursor is from SwDocShell. Is there any way to get it in print3.cxx?
* For the first patch, I've just tried to make it as OOO did :D. I also want to use the page that is currently visible but still don't know how to get that page number :D. I see that when we scroll the document, a floating tooltip of the page number appears. I really want to know how to get that number! Any hint?
An thank you for your comment :D
I use this macro to print current page.
just assign it to an hotkey or toolbar button
oDoc = ThisComponent
oVC = oDoc.CurrentController.getViewCursor
CurrentPage = Str(oVC.getPage)
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Copies"
args1(0).Value = 1
args1(1).Name = "RangeText"
args1(1).Value = CurrentPage
args1(2).Name = "Collate"
args1(2).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args1())
Thanks for this macro. It is very useful for me
text from dupe 38830:
Print current page
Background: In previous versions of OOo, there used to be a possiblity to print
current page easily, but it got lost with the rework of the print dialog. The
previous printing dialog made sure to set the field "Pages" according the
currently active page number when the dialog was opened. It seems there is a
demand for this feature, so it might be good to get it back :-)
Code pointers: For Writer, should be possible to pass the current page number
to the SwPrintUIOptions's constructor wherever it is being constructed,
probably in SwDocShell. If that is correct, in SwDocShell you have
GetWrtShell(), and can do the same as this.
Something similar will be necessary for the other apps too.
Specification pointers: OOo CWS printerpullpages specification for mockups, OOo
3.1 printing dialog screenshots. Please also see: Bug 34697
Skills: building, C++
The following went in for Writer in the end:
- no need to remember the current page value, ie. removed m_nCrsrCurPage, it is not used anywhere else than in the constructor
- use sal_uInt16 instead of short, it is the type that is returned by GetPageNum()
- removed the MHST, no idea what it means
Hopefully this patch might be an inspiration for Calc, Impress, and Draw too :-) I am letting the bug open to track the other apps, and changed the title accordingly.
Created attachment 50298 [details]
Screenshots of this features on calc, impress and writer
Created attachment 50299 [details]
Screenshots of this features on impress
Created attachment 50300 [details]
Screenshots of this features on writer
Created attachment 50301 [details]
Screenshots of this features writer (patch applied)
Whats the state of this? It seems something went into master, but there is still stuff needed to be merged?
@kendy, Nguyen Vu Hung: Can the involved parties please clarify and please update the bug status/assignee?
This bug is still in the 'featured EasyHacks' list on http://wiki.documentfoundation.org/Development/Easy_Hack, which it obviously shouldnt, if somebody is already working on it, or no more work is needed.
Mr. Tung is working on it.
I think he is still having some problems with programs other than Writer (It seems to be fixed for Writer, we saw the commit), but not other program.
@Tung: Can you explaing what problems you are facing?
Assigning to Mr. Tung for now as he is currently active on this.
Also removing from featured EasyHacks page for now and replacing with a different EasyHack to allow newcomers to have 'their' task.
*** Bug 42337 has been marked as a duplicate of this bug. ***
sorry, I'm a newbie here, please help me, how can I fix bag by this patch on Windows 7 OS. I coudn't find any information about it.
(In reply to comment #22)
> sorry, I'm a newbie here, please help me, how can I fix bag by this patch on
> Windows 7 OS. I coudn't find any information about it.
I'm not sure what exactly do you want :-)
Do you want to fix this bug, that is, you want to 'code' this missing functionality in Calc, Draw, or Impress; correct?
Please correct me if I'm wrong.
I want to 'code' this missing functionality in writer for the first time
(In reply to comment #24)
> I want to 'code' this missing functionality in writer for the first time
but I'm not a programmer, just a user of a computer. I know hardware and using software. But I'm not a software developer.
(In reply to comment #25)
Just use LibreOffice 3.5, the fix for Writer is included there.
I use 188.8.131.52 - but there is not print current page mode in the writer there.
(In reply to comment #27)
> I use 184.108.40.206 - but there is not print current page mode in the writer there.
The current page number is shown in the print dialog (see attachment 50301 [details]). So, we don't need explicit 'Print Current Page' button.
If needed separate button on toolbar for printing current page, see comment 10. Very useful thing, IMHO.
Deleted "Easyhack" from summary.
Comment on attachment 49235 [details]
New patch with coding convention for printing current page bug
this patch seems to be obsoleted by the subsequent patch.
Comment on attachment 49253 [details]
modified patch, see comment 6
according to comment #13 this patch was integrated, removing "patch" flag so it does not turn up in bugzilla queries.
Added a patch to gerrit to change the the 2nd range-option so it displays the current page in Draw and Impress. As is already changed in writer
The current print-dialog for impress is as shown in attachment "Screenshots of this features on impress". But the selection-option (3th range-option) doesn't work ok as it shows the current object you are editing, and that only. Seems a bit useless to me as you can only edit 1 object at a time. Shouldn't that option be removed or it should take the sheets selected in the SlideSorterToolbar (But that would not be natural to understand).
Please help me, I'm a usual user of LibreOffice, but I use computer well, because I'm an IT specialist, and unfortunately I don't understand how can I use new patches for update LibreOffice. How can I learn more about using patches? Unfortunately, I'm not goot at English yet, so It's not easy for me understand it fluently.
I know as usual there are execute files for using OS for patches, but I couldn't find them here at all.
@krchat: You'll have to clone the "core" repository, apply the patch with "git am" and then compile LibreOffice yourself.
There is more information on how to build here: https://wiki.documentfoundation.org/Development/Native_Build
Please note it is recommended that you first compile LibreOffice on Linux, as building on Windows can consume excessive amounts of time, especially for configuring your computer.
Sorry, I have forgotten to say I use it in Windows. Well I will wait next upgrade for Windows, because there is no easy decision to apply current patches.
Rob Snelders committed a patch related to this issue.
It has been pushed to "master":
fdo#34697 - Print Current Page in Print dialog - Draw, Impress
*** Bug 60453 has been marked as a duplicate of this bug. ***
Is this bug fixed?
If so, could you please close it as RESOLVED FIXED?
I'd say it's as in the title: Calc still not finished.
I'd like to suggest that 'Print Current Page' be implemented so that pressing a few keys in Writer such as Alt+P would cause the printer to print only the current page. This seems to be implemented in Microsoft Word but isn't implemented in Writer. I understand that one can write a macro to do this, but I'm suggesting that it would be useful to implement this function by pressing just a couple of keys.
This matter has been raised again. See https://ask.libreoffice.org/t/print-current-page-shortcut/74871/7