kpresenter
KPrLoadingInfo.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2004 Laurent Montel <montel@kde.org> 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 #ifndef KPRLOADINGINFO_H 00021 #define KPRLOADINGINFO_H 00022 00023 struct lstAnimation 00024 { 00025 QDomElement *element; 00026 int order; 00027 }; 00028 00030 class KPrLoadingInfo 00031 { 00032 public: 00033 KPrLoadingInfo( bool oldFormat = false) 00034 : presSpeed( -1 ) 00035 , m_header( false ) 00036 , m_footer( false ) 00037 , m_headerFooterByPage( false ) 00038 , m_oldFormat( oldFormat ) 00039 { 00040 m_animationsShowDict.setAutoDelete( true ); 00041 m_animationsHideDict.setAutoDelete( true ); 00042 } 00043 ~KPrLoadingInfo() {} 00044 00045 lstAnimation* animationShowById( const QString& id ) const { 00046 return m_animationsShowDict[id]; // returns 0 if not found 00047 } 00048 void storePresentationShowAnimation( lstAnimation * element, const QString& id ) { 00049 m_animationsShowDict.insert( id , element ); 00050 } 00051 void clearAnimationShowDict() { 00052 QDictIterator<lstAnimation> it( m_animationsShowDict ); // See QDictIterator 00053 for( ; it.current(); ++it ) 00054 { 00055 delete it.current()->element; 00056 } 00057 m_animationsShowDict.clear(); 00058 } 00059 00060 lstAnimation* animationHideById( const QString& id ) const { 00061 return m_animationsHideDict[id]; // returns 0 if not found 00062 } 00063 void storePresentationHideAnimation( lstAnimation * element, const QString& id ) { 00064 m_animationsHideDict.insert( id , element ); 00065 } 00066 void clearAnimationHideDict() { 00067 QDictIterator<lstAnimation> it( m_animationsHideDict ); // See QDictIterator 00068 for( ; it.current(); ++it ) 00069 { 00070 delete it.current()->element; 00071 } 00072 m_animationsHideDict.clear(); 00073 } 00074 bool oldFormat() const { return m_oldFormat; } 00075 int presSpeed; 00076 QMap<QString, KPrPage *> m_name2page; 00077 bool m_header; 00078 bool m_footer; 00079 bool m_headerFooterByPage; 00080 private: 00081 QDict<lstAnimation> m_animationsShowDict; 00082 QDict<lstAnimation> m_animationsHideDict; 00083 bool m_oldFormat; 00084 }; 00085 00086 #endif /* KPRLOADINGINFO_H */ 00087