Hi Mikhail,
I'm awfully sorry but my latest patch still has faults for msole
objects, even though the segment added to DoVerb() is correctly executed
during debugging, the printing just did not took place. May I ask you to
examine that patch for me please?
As for the investigation of chart and math, here's what I found.
The problem with chart2 printing is that we cannot query a valid
XPrintable from its component in PrintDocument().
With math it's different, XPrintable::print() method is excecuted but
nothing happened.
So I guess I should dig deeper. Compared to a call stack for a
spreadsheet object which is like this:
------------------------
vclmi.dll!Printer::StartPrint() Line 1292 C++
vclmi.dll!Printer::StartJob(const String & rJobName={...}) Line
1488 C++
vclmi.dll!Printer::StartJob(const String & rJobName={...}) Line
1507 + 0x12 C++
sfxmi.dll!SfxViewShell::DoPrint() + 0xb0 C++
scmi.dll!ScTabViewShell::DoPrint() + 0xc7 C++
> sfxmi.dll!SfxViewShell::ExecPrint_Impl() + 0x173f C++
sfxmi.dll!SfxStubSfxViewShellExecPrint_Impl() + 0xe C++
sfxmi.dll!SfxShell::ExecuteSlot() + 0xbd C++
sfxmi.dll!SfxPrintHelper::print(const
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> &
rOptions={...}) Line 646 C++
sfxmi.dll!SfxBaseModel::print() + 0x66 C++
embobj.dll!DocumentHolder::PrintDocument() Line 1414 + 0x1f C++
embobj.dll!OCommonEmbeddedObject::doVerb(long nVerbID=-10) Line
563 C++
sfxmi.dll!SfxInPlaceClient::DoVerb(long nVerb=-10) Line 987 +
0x37 C++
swmi.dll!SwWrtShell::LaunchOLEObj() + 0xb0 C++
swmi.dll!SwView::DoVerb() + 0x36 C++
...
------------------------
The SfxViewShell::ExecPrint_Impl() is never executed for math, so I
suspect something wrong happened around SfxShell::ExecuteSlot() here but
still need further investigation.
I'm looking forward to your help.
Thank You and Best Regards,
Felix.
Mikhail Voitenko
Hi Felix,
I am awfully sorry for the delay with answer. I had to do some
investigations to find out how a replacement image could be printed.
The implementation should be done on the container side in this case.
The container side has the replacement image and access to the vcl
implementation. So I would suggest to throw UnreachableStateException
from the MSOLE object in case "Print" verb is provided to doVerb()
call. The implementation in the sfx2/source/view/ipclient.cxx in
method DoVerb() should check in case of this exception whether the
PRINT verb is used ( it is already don for the default verb in similar
way ). In this case the container should try to print the replacement
image.
The printing can be implemented in following way:
- get the container SfxViewShell using GetViewShell() call from DoVerb
- if the shell is not NULL use pViewShell->GetPrinter() call to get
the printer
- if the printer is not null please get the graphics from the
replacement image, that would need the following steps:
- Please get the container object shell using
pViewShell->GetObjectShell()
- if it is not NULL please call
pObjectShell->GetEmbeddedObjectContainer().GetGraphicStream(
m_pImp->m_xObject )
- now the stream has to be converted to Graphic object, please see
the implementation in svtools/source/misc/embedhlp.cxx in method
EmbeddedObjectRef::GetReplacement() as example
- after you have Graphic object you can execute pGraphic->Draw(
pPrinter, Point( 0, 0 ) )
We can discuss further details/questions tomorrow on IRC meeting.
As for the testing, it would be nice to test the functionality on
Linux, but in this case it is not really necessary I think. The
implementation looks generally to be platform independent, so it is
not necessary to spend time an prepare the linux build only for this.
Best regards,
Mikhail.
On 02/24/09 05:02, Zhang Xiaofei wrote:
Hi Mikhail,
Thank you for your hint, here I created a small fragmentary patch for
the first step, please point out if there's obvious problems within.
And I would like to hear the details regarding the image printing so
that I can understand more about the related code before our next
meeting, but only if your time permits , of course. :-)
By the way do you think I should prepare a new linux build, please? I
don't know if it is necessary for testing our new implementation and
feel like need advice.
Thank you and Best Regards,
Felix.
Mikhail Voitenko
Hi Felix,
On 02/20/09 09:50, Zhang Xiaofei wrote:
Hi Mikhail,
Sorry but I searched the usage of GetVerbByShortcut() and couldn't
find an example, I may need your hint on this little question
regarding the first step: what exactly is the ShortCut of a Verb
please? Is it in our case, "PRINT"?
Yes exactly, it is "PRINT" in this case. This is the shortcut that
is used as the node name in the configuration. The method gets the
information from the configuration and fills the verb description.
You can find the implementation and the usage of the method in the
comphelper/source/misc/mimeconfighelper.cxx
Best regards,
Mikhail.
Best Regards,
Felix.
Mikhail Voitenko
Hi Felix,
Thanks a lot for the patch, it looks good.
Now the MSOLE implementation should be adjusted as we have discussed.
The first step would be to let the getSupportedVerbs()
implementation return the print verb. MSOLE objects are a special
case, the verbs are either requested from the external server ( in
case it is Windows system with installed server related to the
object ), or just empty in case of Unix systems. The new
implementation should add the print verb for both cases. To get
the PRINT verb value from configuration please use
"::comphelper::MimeConfigurationHelper::GetVerbByShortcut()" method.
The next step will be to implement the verb itself. In case
getPreferredVisualRepresentation() can retrieve the replacement
image the image could be printed by the object itself. Sometimes
it might work even on Unix systems in case the image is stored in
the object stream. Otherwise it should be printed in the
container. I will send the details regarding the image printing
tomorrow.
Best Regards,
Mikhail.
On 02/19/09 10:14, Zhang Xiaofei wrote:
Hi Mikhail,
I'm sorry our network broke down after our meeting yesterday.
With this patch the temporary frame is hidden when document is
printed now. Would you please review it for me?
Thank you for your help. :-)
Best Regards,
Felix.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@framework.openoffice.org
For additional commands, e-mail: dev-h...@framework.openoffice.org