lib Library API Documentation

KoPictureCollection Class Reference

A collection of pictures (a key and the picture itself). More...

#include <koPictureCollection.h>

Inheritance diagram for KoPictureCollection:

QMap< KoPictureKey, KoPicture > List of all members.

Public Types

typedef QMap< KoPictureKey,
QString
StoreMap
enum  Type { CollectionPicture = 0, CollectionImage, CollectionClipart }

Public Member Functions

KoPicture findPicture (const KoPictureKey &key) const
KoPicture insertPicture (const KoPictureKey &key, const KoPicture &picture)
KoPicture insertPicture (const KoPicture &picture)
KoPicture downloadPicture (const KURL &url)
KoPicture loadPicture (const QString &fileName)
bool saveToStore (const Type pictureType, KoStore *store, QValueList< KoPictureKey > keys)
bool saveToStoreAsKOffice1Dot1 (const Type pictureType, KoStore *store, QValueList< KoPictureKey > keys)
QDomElement saveXML (const Type pictureType, QDomDocument &doc, QValueList< KoPictureKey > keys)
void saveXMLAsKOffice1Dot1 (QDomDocument &doc, QDomElement &parent, QValueList< KoPictureKey > keys)
StoreMap readXML (QDomElement &pixmapsElem)
void readXML (QDomElement &pixmapsElem, QMap< KoPictureKey, QString > &map)
void readFromStore (KoStore *store, const StoreMap &storeMap)
KoPicture findOrLoad (const QString &fileName, const QDateTime &dateTime)

Detailed Description

A collection of pictures (a key and the picture itself).

Definition at line 40 of file koPictureCollection.h.


Member Enumeration Documentation

enum KoPictureCollection::Type
 

Enumeration values:
CollectionPicture  collection with mixed pictures
CollectionImage  collection with images only
CollectionClipart  collection with cliparts only

Definition at line 43 of file koPictureCollection.h.


Member Function Documentation

KoPicture KoPictureCollection::findPicture const KoPictureKey key  )  const
 

Looks for a clipart in the collection, returns 0L if not found.

Definition at line 34 of file koPictureCollection.cc.

References findPicture(), KoPicture::setKey(), and KoPictureKey::toString().

Referenced by findPicture(), insertPicture(), loadPicture(), readFromStore(), and saveXML().

KoPicture KoPictureCollection::insertPicture const KoPictureKey key,
const KoPicture picture
 

Inserts a picture into the collection, if not already there.

Definition at line 50 of file koPictureCollection.cc.

References findPicture(), insertPicture(), KoPicture::isNull(), KoPicture::setKey(), and KoPictureKey::toString().

Referenced by downloadPicture(), insertPicture(), loadPicture(), and readFromStore().

KoPicture KoPictureCollection::insertPicture const KoPicture picture  ) 
 

Inserts a picture into the collection, if not already there Same as above, but takes the key from the picture.

Definition at line 68 of file koPictureCollection.cc.

References KoPicture::getKey(), and insertPicture().

KoPicture KoPictureCollection::downloadPicture const KURL &  url  ) 
 

Download a possibly remote file If this file is really remote, it is always downloaded.

If the file is local, it acts as loadPicture.

Definition at line 73 of file koPictureCollection.cc.

References downloadPicture(), KoPicture::getKey(), insertPicture(), loadPicture(), and KoPicture::setKeyAndDownloadPicture().

Referenced by downloadPicture().

KoPicture KoPictureCollection::loadPicture const QString fileName  ) 
 

Load a clipart from a file (and insert into the collection).

The modification date of the file is checked, to create the key for this clipart. If this key maps to an existing clipart in the collection, then this picture is returned, otherwise the file is loaded.

Definition at line 100 of file koPictureCollection.cc.

References findPicture(), insertPicture(), KoPicture::isNull(), KoPicture::loadFromFile(), loadPicture(), and KoPictureKey::setKeyFromFile().

Referenced by downloadPicture(), findOrLoad(), and loadPicture().

bool KoPictureCollection::saveToStore const Type  pictureType,
KoStore store,
QValueList< KoPictureKey keys
 

Save the used picturess from the collection into the store Usually called from completeSaving.

Parameters:
store the store in which to save the pictures
keys the list of keys corresponding to the pictures to save
Returns:
true on success, false on failure (e.g. disk full)

Definition at line 189 of file koPictureCollection.cc.

References saveToStore().

Referenced by saveToStore().

bool KoPictureCollection::saveToStoreAsKOffice1Dot1 const Type  pictureType,
KoStore store,
QValueList< KoPictureKey keys
 

Save the used pictures from the collection into the store, however in KOffice 1.1 format.

Parameters:
store the store in which to save the pictures in KOffice 1.1 format
keys the list of keys corresponding to the pictures to save
Returns:
true on success, false on failure (e.g. disk full)

Definition at line 194 of file koPictureCollection.cc.

References saveToStoreAsKOffice1Dot1().

Referenced by saveToStoreAsKOffice1Dot1().

QDomElement KoPictureCollection::saveXML const Type  pictureType,
QDomDocument doc,
QValueList< KoPictureKey keys
 

Generate the <pixmaps> or <cliparts> tag, that saves the key and the related relative path in the store (e.g.

pictures/picture1.png) for each picture.

Parameters:
pictureType the type of the collection
doc the DOM document in which the tags are to be generated
keys the list of keys

Definition at line 199 of file koPictureCollection.cc.

References CollectionClipart, CollectionImage, findPicture(), KoPicture::isNull(), and saveXML().

Referenced by saveXML().

KoPictureCollection::StoreMap KoPictureCollection::readXML QDomElement pixmapsElem  ) 
 

Read the <pixmaps> or <cliparts> tag, and save the result (key<->store-filename associations) into the QMap.

You may want to 'new' a QMap in loadXML, and to use and then delete it in completeLoading (to save memory).

Parameters:
pixmapsElem the <pixmaps> or <cliparts> element

Definition at line 280 of file koPictureCollection.cc.

References readXML().

Referenced by readXML().

void KoPictureCollection::readXML QDomElement pixmapsElem,
QMap< KoPictureKey, QString > &  map
 

Helper method for readFromStore.

Definition at line 262 of file koPictureCollection.cc.

References KoPictureKey::loadAttributes(), and readXML().

void KoPictureCollection::readFromStore KoStore store,
const StoreMap storeMap
 

Read all pictures from the store, into this collection The map comes from readXML, and is used to find which pictures to load, and which key to associate them.

Definition at line 287 of file koPictureCollection.cc.

References KoStore::close(), findPicture(), insertPicture(), KoPicture::isNull(), KoPicture::load(), KoStore::open(), and readFromStore().

Referenced by readFromStore().

KoPicture KoPictureCollection::findOrLoad const QString fileName,
const QDateTime dateTime
 

Deprecated:
KPresenter needs to use the same code for loading images from a collection and for loading images from disk.
Parameters:
fileName the name of the file to read from disk if needed
the date and time
Formerly, an invalid date/time meant to read the file from disk. This is not the case anymore.

Definition at line 338 of file koPictureCollection.cc.

References findOrLoad(), and loadPicture().

Referenced by findOrLoad().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 28 04:04:05 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003