Re: [dev] question about improving the speed of openning .ppt file ( delay load slide page )

2005-09-19 Thread 蒋东进
Hi,Sven Jacobi

Thanks for your reply!


- Original Message - 

> Hi,
> 
> 蒋东进 wrote:
> > Hi,all
> > 
> > I have implemented delay load slide page in impress these days. Now I 
> > can import a BIG .ppt file in several seconds.
> > Here is my way: I modify func ** sal_Bool ImplSdPPTImport::Import() **, 
> > only complete load several pages( start 4-6 pages ) at import phase, for 
> > other pages I only import their notepage, but leave their masterpage and 
> > slidepage for delay loading when those pages are realy needed,eg display or 
> > operate.
> 
> A delay load slide page mechanism might be a good thing for a PPT
> viewer, but in case you are editing the file you will not save any time
> rather it is leading to many difficulties as it is required that the
> original file is always available and you have to determine if edited
> slides have to be loaded from the original PPT document or from
> something else. Additionally import errors will occur at a very late
> time, you might get the error if you are just showing your presentation.
> 

Yes, we should make the original file available always. But we do not need pay 
more attention to it, we can get it from DrawDocShell easily( by GetMedium() ). 
What we should do is to make sure it is openned if we need import something 
from it, and to clode it if we do not need it anymore. What is your meaning of 
\"Additionally import errors\", under slide show mode I get a refresh error 
what I have said in question 1, some errors else?

> > 
> > Everything is ok but 2 questions:
> > 
> > 1. Under slide show mode, if the previous/next page is not imported, I 
> > call my import func to import its masterpage and slidepage in func ** void 
> > SlideshowImpl::slideChange() **. My import func is executed well but the 
> > page still display blank, only if I forward or backward some times, the 
> > page is updated well. So I want to know how I can update the page 
> > immediately after call my import func?
> > Under source code base 1.04, I put my import func at the frant of ** 
> > void FuSlideShow::PrepareForPage( SdPage* pPage, BOOL bInitAnimObjs ) **,it 
> > works well. Now I change my source code base to 680m104, I get the problem. 
> > 
> 
> Sorry, I don\'t know what\'s wrong here.

I have resolved the problem.In code base 680, there is a new module -- 
slideshow, it is responsible for showing the presentation. I found in func ** 
bool Presentation_Impl::prefetchSlide( sal_Int32 nPage ) **, they use bufferd 
mechanism( buffered 3 pages, previouse,current and next page ), so I import 3 
pages a time if they are unimportted in func ** void 
SlideshowImpl::slideChange() **.

> 
> > 2. When I open a .ppt file, change something and save it, I must call 
> > my import func to import all those unimported pages before export it. So 
> > even we can import a BIG .ppt file in several seconds, but it will take 
> > more time( the same as import the whole .ppt file completely ) to wait the 
> > file be saved. I found ** sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 
> > nPageNum ) ** is the func to export a slidepage, I want to know how I can 
> > only export those imported pages, for those unimported pages only copy 
> > their bytes from old file medium( inputstream ) to new file medium( 
> > outputstream )? In this way the export process will fast.
> 
> In my opinion the import of a PPT file is not finished as long as the
> original PPT document is needed. There exist the possibility to store
> changed slides only, but this requires deep knowledge of the PPT format
> and it leads to the fact that you resides on the PPT format, and this is
> something that nobody really wants.
> 

Yes, but the PPT filter is reside on the PPT format of couse. We just only 
modify some codes in class PPTWriter and will not bring some side effects. But 
I am not familiar with PPT format :)



tsmail is a mail solution, 
please visit http://www.linuxts.com

Re: [dev] question about improving the speed of openning .ppt file ( delay load slide page )

2005-09-19 Thread Sven Jacobi
Hi,

蒋东进 wrote:
> Hi,all
> 
> I have implemented delay load slide page in impress these days. Now I can 
> import a BIG .ppt file in several seconds.
> Here is my way: I modify func ** sal_Bool ImplSdPPTImport::Import() **, 
> only complete load several pages( start 4-6 pages ) at import phase, for 
> other pages I only import their notepage, but leave their masterpage and 
> slidepage for delay loading when those pages are realy needed,eg display or 
> operate.

A delay load slide page mechanism might be a good thing for a PPT
viewer, but in case you are editing the file you will not save any time
rather it is leading to many difficulties as it is required that the
original file is always available and you have to determine if edited
slides have to be loaded from the original PPT document or from
something else. Additionally import errors will occur at a very late
time, you might get the error if you are just showing your presentation.

> 
> Everything is ok but 2 questions:
>   
> 1. Under slide show mode, if the previous/next page is not imported, I 
> call my import func to import its masterpage and slidepage in func ** void 
> SlideshowImpl::slideChange() **. My import func is executed well but the page 
> still display blank, only if I forward or backward some times, the page is 
> updated well. So I want to know how I can update the page immediately after 
> call my import func?
> Under source code base 1.04, I put my import func at the frant of ** void 
> FuSlideShow::PrepareForPage( SdPage* pPage, BOOL bInitAnimObjs ) **,it works 
> well. Now I change my source code base to 680m104, I get the problem. 
>   

Sorry, I don't know what's wrong here.

> 2. When I open a .ppt file, change something and save it, I must call my 
> import func to import all those unimported pages before export it. So even we 
> can import a BIG .ppt file in several seconds, but it will take more time( 
> the same as import the whole .ppt file completely ) to wait the file be 
> saved. I found ** sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum ) 
> ** is the func to export a slidepage, I want to know how I can only export 
> those imported pages, for those unimported pages only copy their bytes from 
> old file medium( inputstream ) to new file medium( outputstream )? In this 
> way the export process will fast.

In my opinion the import of a PPT file is not finished as long as the
original PPT document is needed. There exist the possibility to store
changed slides only, but this requires deep knowledge of the PPT format
and it leads to the fact that you resides on the PPT format, and this is
something that nobody really wants.

>   
> Thank you to read my question. Any comment and hint are welcome.
>  
> best regards,
> jiangdongjin
> 
> 
> 
> tsmail is a mail solution, 
> please visit http://www.linuxts.com

best regards,
Sven Jacobi

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



Re: [dev] question about improving the speed of openning .ppt file

2005-05-17 Thread Sven Jacobi
Thorsten Behrens wrote:
"jiangdongjin" <[EMAIL PROTECTED]> writes:

If I omit these functions, My test .ppt file opened as fast as MS
Powerpoint(maybe 1-2 seconds slower), but all my pictures are
missing.
Hi jiangdongjin,
okay, it wasn't clear to me from your original mail that delay-loading
the images is sufficient for your case (in general, it won't be
sufficient to noticeably speed up PPT import - just try a 100 slide
document with lots of polygonal content...).

So my plan is, in the load phase, I only load some basic infomation
like width and height of the picture(I think only these are
necessary for formatting), then display.After that if I really need
some pictures(display or operation), I import it from input stream.
Yes, that's a lot easier than delay-loading of the whole
document. You'd have to extend the GraphicObject to be able to swap in
from streams with a given offset (and live with the fact that some
special-casing from the PPT import might no longer work - I vaguely
remember MS putting whole GIFs into PNG chunks).
HTH,
Hi,
I also think that delay-loading of images is not so difficult to
implement, but there are some obstacles to overcome:
- some graphics are compressed some are not
- especially ole objects needs to be placed into the correct storage
  environment
- currently we do not support all graphic attributes - sometimes
  images needs to be adjusted at load time
By the way delay-loading doesn't bring any benefit if you are just
converting files into the OOo format, because then you have to wait
until the model has been converted completely.
HTH
Sven
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [dev] question about improving the speed of openning .ppt file

2005-05-17 Thread Thorsten Behrens
"jiangdongjin" <[EMAIL PROTECTED]> writes:

> If I omit these functions, My test .ppt file opened as fast as MS
> Powerpoint(maybe 1-2 seconds slower), but all my pictures are
> missing.
>
Hi jiangdongjin,

okay, it wasn't clear to me from your original mail that delay-loading
the images is sufficient for your case (in general, it won't be
sufficient to noticeably speed up PPT import - just try a 100 slide
document with lots of polygonal content...).

> So my plan is, in the load phase, I only load some basic infomation
> like width and height of the picture(I think only these are
> necessary for formatting), then display.After that if I really need
> some pictures(display or operation), I import it from input stream.
>
Yes, that's a lot easier than delay-loading of the whole
document. You'd have to extend the GraphicObject to be able to swap in
from streams with a given offset (and live with the fact that some
special-casing from the PPT import might no longer work - I vaguely
remember MS putting whole GIFs into PNG chunks).

HTH,

-- 

Thorsten

If you're not failing some of the time, you're not trying hard enough.

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



Re: [dev] question about improving the speed of openning .ppt file

2005-05-17 Thread jiangdongjin
Hi Thorsten,

- Original Message - 
From: "Thorsten Behrens" <[EMAIL PROTECTED]>
Newsgroups: openoffice.dev
To: 
Sent: Tuesday, May 17, 2005 5:38 PM
Subject: Re: [dev] question about improving the speed of openning .ppt file


> "jiangdongjin" <[EMAIL PROTECTED]> writes:
> 
> >  To my opinion, OOo impress opens .ppt file slower because of:
> >  1. It imports all contents before displays, but MS Powerpoint only
> > imports those needed;
> >  2. It create too many temp files for those pictures embeded in
> > slide pages, but MS Powerpoint do nothing about this.
> >  
> Hi jiangdongjin,
> 
> as you've found out by yourself, not streaming out the images to temp
> files hogs huge amounts of memory (and is therefore not an
> option). 
> 
> Your first item is actually the crucial point here: as our PPT import
> is just that, an import, we really have to fully read the file
> content. This is because our own, internal representation of the
> document content (the 'model') must be complete before anything can be
> displayed. There are currently no mechanisms to lazy-load only the
> first slide, and the remainder only on demand.
> 

As I mentioned :
OOo impress imports all contents before displays, but MS Powerpoint only 
imports those needed;

I have tried to change the synchronous load mechanism but I failed :)
So many things I need to know and change. 

I found when open my test .ppt file(contains many jpg or bmp pictures), the 
most time-wasted points are those functions to load picture.
i.e.
ImportGIF(...)
ImportPNG(...)
ImportJPEG(...)
ImportXBM(...)
..
If I omit these functions, My test .ppt file opened as fast as MS 
Powerpoint(maybe 1-2 seconds slower), but all my pictures are missing.
So my plan is, in the load phase, I only load some basic infomation like width 
and height of the picture(I think only these are necessary for formatting), 
then display.After that if I really need some pictures(display or operation), I 
import it from input stream.

Is my method feasible? Thanks!

best regards,
jiangdongjin

Re: [dev] question about improving the speed of openning .ppt file

2005-05-17 Thread Thorsten Behrens
"jiangdongjin" <[EMAIL PROTECTED]> writes:

>  To my opinion, OOo impress opens .ppt file slower because of:
>  1. It imports all contents before displays, but MS Powerpoint only
> imports those needed;
>  2. It create too many temp files for those pictures embeded in
> slide pages, but MS Powerpoint do nothing about this.
>  
Hi jiangdongjin,

as you've found out by yourself, not streaming out the images to temp
files hogs huge amounts of memory (and is therefore not an
option). 

Your first item is actually the crucial point here: as our PPT import
is just that, an import, we really have to fully read the file
content. This is because our own, internal representation of the
document content (the 'model') must be complete before anything can be
displayed. There are currently no mechanisms to lazy-load only the
first slide, and the remainder only on demand.

Changing that would be quite some work, as it would require large
refactorings to integrate PPT import more tightly with the drawing
layer model.

HTH,

-- 

Thorsten

If you're not failing some of the time, you're not trying hard enough.

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