lib

KoPictureCollection Class Reference

#include <KoPictureCollection.h>

Inherits TQMap< U, T >.

Public Types

enum  Type { CollectionPicture =0 , CollectionImage , CollectionClipart }
 
typedef TQMap< KoPictureKey, TQString > StoreMap
 

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, TQWidget *window)
 
KoPicture loadPicture (const TQString &fileName)
 
bool saveToStore (const Type pictureType, KoStore *store, const TQValueList< KoPictureKey > &keys)
 
TQDomElement saveXML (const Type pictureType, TQDomDocument &doc, TQValueList< KoPictureKey > keys)
 
bool saveOasisToStore (KoStore *store, TQValueList< KoPictureKey > keys, KoXmlWriter *manifestWriter)
 
StoreMap readXML (TQDomElement &pixmapsElem)
 
void readXML (TQDomElement &pixmapsElem, TQMap< KoPictureKey, TQString > &map)
 
void readFromStore (KoStore *store, const StoreMap &storeMap)
 
KoPicture findOrLoad (const TQString &fileName, const TQDateTime &dateTime)
 
TQString getOasisFileName (const KoPicture &picture) const
 
void assignUniqueIds ()
 

Detailed Description

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

Definition at line 40 of file KoPictureCollection.h.

Member Typedef Documentation

◆ StoreMap

typedef TQMap<KoPictureKey, TQString> KoPictureCollection::StoreMap

Definition at line 115 of file KoPictureCollection.h.

Member Enumeration Documentation

◆ Type

Enumerator
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

◆ assignUniqueIds()

void KoPictureCollection::assignUniqueIds ( )

Call it before to save Oasis file.

Definition at line 316 of file KoPictureCollection.cpp.

◆ downloadPicture()

KoPicture KoPictureCollection::downloadPicture ( const KURL &  url,
TQWidget *  window 
)

Download a possibly remote file.

If this file is really remote, it is always downloaded. If the file is local, it acts as loadPicture.

Parameters
urlthe URL to download from
windowthe parent window for the download. You can pass NULL (0) if you absolutely cannot find anything to use.

Definition at line 75 of file KoPictureCollection.cpp.

◆ findOrLoad()

KoPicture KoPictureCollection::findOrLoad ( const TQString &  fileName,
const TQDateTime &  dateTime 
)
Deprecated:
KPresenter needs to use the same code for loading images from a collection and for loading images from disk.
Parameters
fileNamethe name of the file to read from disk if needed
dateTimethe date and time

Formerly, an invalid date/time meant to read the file from disk. This is not the case anymore.

Definition at line 305 of file KoPictureCollection.cpp.

◆ findPicture()

KoPicture KoPictureCollection::findPicture ( const KoPictureKey &  key) const

Looks for a clipart in the collection, returns a new KoPicture with that key if not found.

Definition at line 35 of file KoPictureCollection.cpp.

◆ getOasisFileName()

TQString KoPictureCollection::getOasisFileName ( const KoPicture &  picture) const

Return filename as url for picture.

Definition at line 139 of file KoPictureCollection.cpp.

◆ insertPicture() [1/2]

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 70 of file KoPictureCollection.cpp.

◆ insertPicture() [2/2]

KoPicture KoPictureCollection::insertPicture ( const KoPictureKey &  key,
const KoPicture &  picture 
)

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

Definition at line 52 of file KoPictureCollection.cpp.

◆ loadPicture()

KoPicture KoPictureCollection::loadPicture ( const TQString &  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 102 of file KoPictureCollection.cpp.

◆ readFromStore()

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 254 of file KoPictureCollection.cpp.

◆ readXML() [1/2]

KoPictureCollection::StoreMap KoPictureCollection::readXML ( TQDomElement &  pixmapsElem)

Read the <PICTURES>, <PIXMAPS> or <CLIPARTS> tag, and save the result (key<->store-filename associations) into the TQMap.

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

Parameters
pixmapsElemthe <PICTURES>, <PIXMAPS> or <CLIPARTS> element

Definition at line 247 of file KoPictureCollection.cpp.

◆ readXML() [2/2]

void KoPictureCollection::readXML ( TQDomElement &  pixmapsElem,
TQMap< KoPictureKey, TQString > &  map 
)

Helper method for readFromStore.

Definition at line 229 of file KoPictureCollection.cpp.

◆ saveOasisToStore()

bool KoPictureCollection::saveOasisToStore ( KoStore *  store,
TQValueList< KoPictureKey >  keys,
KoXmlWriter *  manifestWriter 
)

Definition at line 177 of file KoPictureCollection.cpp.

◆ saveToStore()

bool KoPictureCollection::saveToStore ( const Type  pictureType,
KoStore *  store,
const TQValueList< KoPictureKey > &  keys 
)

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

Parameters
pictureTypetype for the stored picture
storethe store in which to save the pictures
keysthe list of keys corresponding to the pictures to save
Returns
true on success, false on failure (e.g. disk full)
Todo:
Reduce lameness of dox for pictureType.

Definition at line 151 of file KoPictureCollection.cpp.

◆ saveXML()

TQDomElement KoPictureCollection::saveXML ( const Type  pictureType,
TQDomDocument &  doc,
TQValueList< KoPictureKey >  keys 
)

Generate the <PICTURES>, <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
pictureTypethe type of the collection
docthe DOM document in which the tags are to be generated
keysthe list of keys

Definition at line 202 of file KoPictureCollection.cpp.


The documentation for this class was generated from the following files: