hi Ariel
could you give me a example of use your Way doing a new
exporter, assuming that the file format is pdf?
Regards
------------------ 原始邮件 ------------------
发件人: "Armin Le Grand"<Armin.Le.Grand@me.com>;
发送时间: 2012年6月6日(星期三) 下午5:02
收件人: "ooo-dev"<ooo-dev@incubator.apache.org>;
主题: Re: a question of Export custom file format?
Hi 蜗牛 (had to copy-paste, cannot read, hope it's correct)
On 06.06.2012 06:23, 蜗牛 wrote:
> HI:
>
> I need to develop an extension program of openoffice's write,
> the extended function is export a custom file format
> , the file format similar as PDF file format ,
> But not the PDF file format.
>
> I analyzed the export of PDF files ,the Function through VCL output.
> I have two question as below:
>
> 1)Such need can be achieved in extension of openoffice's write?
Yes, when You use the UNO API. This means to get the document, iterate
over pages and objects and export them.
> 2) Can I use
> calss VirtualDevice
> calss GDIMetaFile
> interface--- Reference<XRenderable> xRenderable (mxSrcDoc, UNO_QUERY)
> in openoffice's write?
I do not know too much from it by heart, but a starting point is to get
the document as handle.
More important: Using VirtualDevice and GDIMetaFile will work, but is
somehow the older way to do things. With the current state of the core i
would suggest to use primitives for SdrObjects when you need to export
graphical representations (as in PDF export, and not the model data as
in PPT export). Primitives give you all the geometry data in double
precision and in a tree structure with some automatisms. For each
SdrObject you may get a sequence of primitives (over UNO API from
xShape). Examples how to proccess them can be found in
drawinglayer/source/processor2d. E.g. vclmetafileprocessor2d is the
instance which currently is used in the core to create GDIMetaFiles from
primitives (these are not created from 'painting' SdrObjects since some
time, this already shows that primitives contain more information than
the GDIMetaFIles). Or e.g. vclpixelprocessor2d is the current renderer
for pixel output (screen display).
In principle all exporters using geometry information as base data
can/should be rewritten to use primitives. Thus, when doing a new
exporter, I would recommend using them from the beginning.
To see how to get primitives from xShape grep for XPrimitiveFactory2D
and createPrimitivesFromXShape.
HTH!
Sincerely,
Armin
--
ALG |