filters

presentation.cpp

00001 /* libppt - library to read PowerPoint presentation
00002    Copyright (C) 2005 Yolla Indria <yolla.indria@gmail.com>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008    
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA
00018 */
00019 
00020 #include "presentation.h"
00021 #include "slide.h"
00022 #include "powerpoint.h"
00023 
00024 #include <vector>
00025 
00026 using namespace Libppt;
00027 
00028 class Presentation::Private
00029 {
00030 public:
00031   Slide* masterSlide;
00032   std::vector<Slide*> slides;
00033 };
00034 
00035 Presentation::Presentation()
00036 {
00037   d = new Private;
00038   d->masterSlide = 0;
00039 }
00040   
00041 Presentation::~Presentation()
00042 {
00043   clear();
00044   delete d;
00045 }
00046 
00047 void Presentation::clear()
00048 {
00049   // FIXME use iterator
00050   for( unsigned i=0; i<slideCount(); i++ )
00051     delete slide( i );
00052   d->slides.clear();
00053   delete d->masterSlide;
00054   d->masterSlide = 0;
00055 }
00056   
00057 bool Presentation::load( const char* filename )
00058 {
00059   PPTReader* reader = new PPTReader;
00060   bool result = reader->load( this, filename );
00061   delete reader;
00062   return result;  
00063 }
00064 
00065 void Presentation::appendSlide( Slide* slide )
00066 {
00067   d->slides.push_back( slide );
00068 }
00069 
00070 unsigned Presentation::slideCount() const
00071 {
00072   return d->slides.size();
00073 }
00074 
00075 Slide* Presentation::slide( unsigned index )
00076 {
00077   if( index >= slideCount() ) return (Slide*)0;
00078   return d->slides[index];
00079 }
00080 
00081 
00082 Slide* Presentation::masterSlide()
00083 {
00084   return d->masterSlide;
00085 }
00086 
00087 void Presentation::setMasterSlide( Slide* masterSlide )
00088 {
00089   delete d->masterSlide;
00090   d->masterSlide = masterSlide;
00091 }
KDE Home | KDE Accessibility Home | Description of Access Keys