Re: [dev] OLE conversion sun build vs. the rest of the world [ Was RE: [dev] .Doc importer performance ]

2007-04-06 Thread Laurent Denoue

Can I tell OO not to convert OLE objects when I use loadComponentFromURL (
e.g. case by case) and is there a way to tell it to never convert the
object?
My application needs to load documents very fast, and is fine with OLE
objects as bitmaps.
Laurent.

On 3/27/07, Gregoire Gentil [EMAIL PROTECTED] wrote:


Mikhail (and others),

Actually, you're right. Sun build has the OLE conversion unchecked.

Just to summarize and close this thread (perhaps it could be useful to
somebody else in the future):

We noticed huge difference of performance of the import of a big Word
document between the Sun build and all other Oo builds (15 seconds vs. 2
minutes). The problem was that this document had some enbeded OLE
objects and by default Sun binaries doesn't convert OLE objects (open as
an image upon double click) while all other Oo binaries like Novell,
Ubuntu, or Gentoo, does convert the object (open as a spreadsheet upong
double click).

Thanks to all who helped to clear up this mistery,

Gregoire


 -Original Message-
 From: Mikhail Voitenko [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 26, 2007 6:58 AM
 To: dev@openoffice.org
 Subject: Re: [dev] OLE conversion sun build vs. the rest of the world
 [ Was RE: [dev] .Doc importer performance ]


 Hi Gregoire,

 Actually all the optimizations for the OLE object loading are commited

 to the OOo cvs tree. So the behavior should be just the same, although

 I do not know the details about how the other binaries are
 built. By the
 way, had all the office builds the same version OOo2.1? Can
 it be that a
 different version was built to be compared with OOo2.1?

 How many time does it take to load the document without conversions? I

 am asking, because the mentioned difference looks pretty like as if
 the conversion was not used in the fast case. If it was
 activated, could you
 please check whether all of the imported embedded objects are
 correctly
 converted ( to do this, please activate the objects, the
 normal internal
 OOo embedded objecs should be activated inplace in this case
 usually ).

 Regards,
 Mikhail.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [dev] how to speed up pdf export?

2007-04-04 Thread Laurent Denoue

I found a solution to speed up PDF export of an Impress document.
Note: this will remove all bitmaps and backgrounds on slides, including the
master pages of course.
The goal is to generate a very small PDF that only contains text material.
I then use this text-only PDF with pdf2html to extract the lines and their
bounding boxes on the page.
Laurent.

   public void RemoveBitmaps(XShapes xShapes)
   {
   if (xShapes==null)
   return;

   int nshapes = xShapes.getCount();
   for (int i=0;inshapes;i++)
   {
   try {
   XShape xShape = (XShape)UnoRuntime.queryInterface(
XShape.class, xShapes.getByIndex( i ));
   String shapetype = xShape.getShapeType();
   if (shapetype!=null)
   {
   if (shapetype.indexOf(GroupShape)=0)
   {
   XShapes shapes = (XShapes)UnoRuntime.queryInterface(
XShapes.class, xShape );
   RemoveBitmaps(shapes);
   }
   else
   {
   XText xText = (XText) UnoRuntime.queryInterface(
XText.class, xShape );
   String text = null;
   if (xText!=null)
   text = xText.getString();
   boolean notext = false;
   if (text==null)
   notext = true;
   else if (text.length()==0)
   notext = true;
   if (notext)
   {
   xShapes.remove(xShape);
   nshapes--;
   i--;
   }
   }
   }
   }
   catch (Exception e) { System.out.println(e.toString()); }
   }
   }

   public void RemoveBackground(XDrawPage xPage)
   {
   try {
   if (xPage==null)
   return;
   XPropertySet xPagePropSet =
(XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xPage );
   if (xPagePropSet==null)
   return;
   Object any = xPagePropSet.getPropertyValue(Background);
   if (any==null)
   return;
   com.sun.star.uno.XInterface xInt =
(com.sun.star.uno.XInterface)UnoRuntime.queryInterface(
com.sun.star.uno.XInterface.class, any );
   XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xInt );
   if (xPropSet==null)
   return;
   xPropSet.setPropertyValue(FillStyle,
com.sun.star.drawing.FillStyle.SOLID);
   xPropSet.setPropertyValue(FillColor,0xff);
   xPagePropSet.setPropertyValue(Background,xPropSet);
   }
   catch (Exception e) { System.out.println(GetBackground error:  +
e.toString()); }
   }

for each xPage in the Impress document, then do:
XMasterPageTarget xMasterPageTarget =
(XMasterPageTarget)UnoRuntime.queryInterface(XMasterPageTarget.class,
xPage);
XDrawPage xMasterPage = xMasterPageTarget.getMasterPage();
RemoveBackground(xMasterPage);
XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,
xMasterPage);
RemoveBitmaps(xShapes);
RemoveBackground(xPage);
xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class, xPage);
RemoveBitmaps(xShapes);

On 4/3/07, Laurent Denoue [EMAIL PROTECTED] wrote:


Hello Joost,
Yes you're right: the size of the PS file is smaller when I select these
options.

My goal is two-fold:
#1 export each slide of an Impress into an image: this is done using
GraphicObjectFilter
#2 extract the bounding box of each word on each slide

I couldn't find a way to directly extract this information.
However, I can export the presentation to PDF and then use XPDF to extract
the words and their bounding boxes.
But: saving to PDF was very slow sometimes.
Solution: remove all shapes that are not text on each slide.

Exporting to PDF is then much faster, but for some reason I can't get rid
of all bitmaps.
For example, I have a problem going inside a group when the ShapeType is
GroupShape.

Is there a sample code somewhere to navigate through shapes on a DrawPage
and going inside the groups?
Also, is the index of the first shape within a group 0?

Laurent.


On 4/3/07, Joost Andrae [EMAIL PROTECTED] wrote:

 Hi Laurent,

 if you print to a postscript printer and want to reduce transparency,
 gradients and other things to reduce the output size of the printout
 then please have a look at /tools/options/print.

  I noticed that when I try to print to a PS file instead, Impress warns
 me
  that the Impress document contains transparent objects.

 Kind regards, Joost

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





[dev] how to speed up pdf export?

2007-04-02 Thread Laurent Denoue

Exporting an Impress to pdf takes sometimes a very long time (e.g. 1'30 on
just 60 slides).
I noticed that when I try to print to a PS file instead, Impress warns me
that the Impress document contains transparent objects.
Could this be the cause of pdf export being slow?
If so, is there a way to turn this transparency thing off?
Any other tricks on how to speed up pdf export?

Laurent.


Re: [dev] word bounding boxes in Impress?

2007-03-28 Thread Laurent Denoue

I really can't figure how to get XAccessibleShape from XShape.
Anybody help?
Laurent.


On 3/27/07, Malte Timmermann [EMAIL PROTECTED] wrote:


This information is only available for things rendered to the screen.
There you can use the Uno Accessibility API (XAccessibleText for char
glyphs)

But I don't know if you can query XAccessibleText from XShape directly.

See openoffice.org/access for details.

Malte.

Laurent Denoue wrote, On 03/27/07 04:08:
 I can get the text, position and size of all shapes on each page of an
 Impress document.
 However, I need the position of individual words that are inside
text-based
 shapes.
 How can I do this?
 Laurent.

 int npages = PageHelper.getDrawPageCount( xComponent );
 for (int i=0;iMath.min(2,npages);i++)
 {
 XDrawPage xPage = PageHelper.getDrawPageByIndex(
 xComponent,i);
 XShapes xShapes = (XShapes)UnoRuntime.queryInterface(
 XShapes.class, xPage);
 int nshapes = xShapes.getCount();
 for (int j=0;jnshapes;j++)
 {
 XShape xShape = (XShape)UnoRuntime.queryInterface(
 XShape.class, xShapes.getByIndex( j ));
 System.out.println(xShape.getShapeType());
 XText xText = (XText) UnoRuntime.queryInterface(
 XText.class, xShape );
 System.out.println(xText.getString());
 System.out.println(xShape.getPosition().X + , +
 xShape.getPosition().Y + , + xShape.getSize().Width + , +
xShape.getSize
 ().Height);
 }
 }


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




[dev] pdf Export: text only?

2007-03-27 Thread Laurent Denoue

Can I tell the pdf export filter to only output text, not the images, or
vector graphics, or background images (of an Impress for example)?
I'm trying to speed up exporting to PDF.
Other ideas are welcome.

Laurent.
Note: I'm interested in text only because I can already export the actual
drawpages of a document as PNG, but I also need the bounding boxes of text,
which is available in PDF using pdf2html.


[dev] word bounding boxes in Impress?

2007-03-26 Thread Laurent Denoue

I can get the text, position and size of all shapes on each page of an
Impress document.
However, I need the position of individual words that are inside text-based
shapes.
How can I do this?
Laurent.

int npages = PageHelper.getDrawPageCount( xComponent );
for (int i=0;iMath.min(2,npages);i++)
{
   XDrawPage xPage = PageHelper.getDrawPageByIndex(
xComponent,i);
   XShapes xShapes = (XShapes)UnoRuntime.queryInterface(
XShapes.class, xPage);
   int nshapes = xShapes.getCount();
   for (int j=0;jnshapes;j++)
   {
   XShape xShape = (XShape)UnoRuntime.queryInterface(
XShape.class, xShapes.getByIndex( j ));
   System.out.println(xShape.getShapeType());
   XText xText = (XText) UnoRuntime.queryInterface(
XText.class, xShape );
   System.out.println(xText.getString());
   System.out.println(xShape.getPosition().X + , +
xShape.getPosition().Y + , + xShape.getSize().Width + , + xShape.getSize
().Height);
   }
}


Re: [dev] Fwd: doc doesn't render properly

2007-03-22 Thread Laurent Denoue

On 3/22/07, Frank Meies - Sun Germany - Development - Software Engineer 
[EMAIL PROTECTED] wrote:


Hi Laurent,

On 21.03.2007 18:25, Laurent Denoue wrote:

 It looks like some tables from the second page end up on the first page.
 Maybe a problem with margins?
 If you figure out a solution, please let me know.

The table seems to be located inside a text frame. The frame of course
does not allow for automatic page breaks.



According to you, is this a bug? If so, I'm happy to add it.
In any case, MS Office renders it properly, have you tried to see the
difference?
Laurent.



Is there a place to report these problems of unexpected rendering?

If you suspect a bug to be the cause of unexpected rendering you can
file a new issue:

http://qa.openoffice.org/ooQAReloaded/ooQA-ReportBugs.html

Hope this helps,

Frank

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




[dev] Fwd: doc doesn't render properly

2007-03-21 Thread Laurent Denoue

This .doc causes problems to Writer:
http://www.vtsbdc.org/BottomLine040104.doc

It looks like some tables from the second page end up on the first page.
Maybe a problem with margins?
If you figure out a solution, please let me know.

Is there a place to report these problems of unexpected rendering?
Laurent.


Re: [dev] writer: export pages as bitmaps (e.g. PNG)

2007-03-09 Thread Laurent Denoue

Yes, pdf export is what I'm doing now, using either ghostscript or xpdf to
image each PDF page into a PNG.
But it is slower than being able to directly grab the rendered page from
Writer.
Can somebody point me to the PDF export functions?
Maybe I could hack a PNG export function instead.
Laurent.

On 3/9/07, ashok _ [EMAIL PROTECTED] wrote:


If I can add to Frank's idea of working with PDF and then processing
the pdf into images.

I have used the iText library with good results :
http://sourceforge.net/projects/itext/
which allows you to manipulate pdf split it based on page
boundaries, output each page to a different format and so on.

So you could take the pdf output of writer and process it into images

On 3/9/07, Frank Meies - Sun Germany - Development - Software Engineer
[EMAIL PROTECTED] wrote:
 Hi Laurent,

 On 03/08/07 07:54, Laurent Denoue wrote:

  Is there an API to export each page of a Writer document as a picture?
  It's possible under Impress, as shown here:
  http://www.oesf.org/forums/lofiversion/index.php/t7790.html

 I don't see a way to do this directly. What about using the pdf export
 filter and use some external tools to convert the pages to graphic
files?

 Best regards,

 Frank

 --
 Frank Meies (fme) - OpenOffice.org Writer
 OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




[dev] writer: export pages as bitmaps (e.g. PNG)

2007-03-07 Thread Laurent Denoue

Hello,
Is there an API to export each page of a Writer document as a picture?
It's possible under Impress, as shown here:
http://www.oesf.org/forums/lofiversion/index.php/t7790.html

Thanks,
Laurent.