#include <KoFilter.h>
Graphe d'héritage de KoEmbeddingFilter:
Fonctions membres publiques | |
virtual | ~KoEmbeddingFilter () |
int | lruPartIndex () const |
Fonctions membres publiques statiques | |
static QString | mimeTypeByExtension (const QString &extension) |
Fonctions membres protégées | |
KoEmbeddingFilter () | |
int | embedPart (const QByteArray &from, QByteArray &to, KoFilter::ConversionStatus &status, const QString &key=QString::null) |
void | startInternalEmbedding (const QString &key, const QByteArray &mimeType) |
void | endInternalEmbedding () |
int | internalPartReference (const QString &key) const |
QByteArray | internalPartMimeType (const QString &key) const |
Fonctions membres privées | |
KoEmbeddingFilter (const KoEmbeddingFilter &rhs) | |
Better do not copy the filters. | |
KoEmbeddingFilter & | operator= (const KoEmbeddingFilter &rhs) |
Better do not assign the filters. | |
virtual void | savePartContents (QIODevice *file) |
void | filterChainEnterDirectory (const QString &directory) const |
void | filterChainLeaveDirectory () const |
Attributs privés | |
Q3PtrStack< PartState > | m_partStack |
Private * | d |
Amis | |
class | KoFilterChain |
Classes | |
struct | PartReference |
struct | PartState |
To make use of embedding features you have to know that there are two kinds of embedding for filters: embedding the output of a different filter (library) or embedding the output of several internal filters (no separate library). The first case is the simpler one. You just have to override savePartContents() and call embedPart to trigger the embedding process. One example for such a filter is Kontour's MSOD (MS Office Drawing) filter.
The more complex case is embedding various streams from within the same filter library. This is necessary for OLE like files (at least with the current design of the OLEFilter). In this case you have to use startInternalEmbedding and endInternalEmbedding accordingly. Try to use the previous method if possible.
If you're using this class you can also setup a signal/slot communication between parent and child filter. To make that work you simply have to define signals and slots along the following rules: Signals should be named "commSignal\<name\>" where <name> is the name of the signal, slots should be named "commSlot\<name\>". The connection will be done automatically if names and signatures are matching.
Définition à la ligne 145 du fichier KoFilter.h.
KoEmbeddingFilter::~KoEmbeddingFilter | ( | ) | [virtual] |
KoEmbeddingFilter::KoEmbeddingFilter | ( | ) | [protected] |
Constructs a filter. Note that the m_chain pointer is 0 inside the constructor. Most likely your constructor will be empty.
Définition à la ligne 63 du fichier KoFilter.cpp.
Références m_partStack.
KoEmbeddingFilter::KoEmbeddingFilter | ( | const KoEmbeddingFilter & | rhs | ) | [private] |
Better do not copy the filters.
int KoEmbeddingFilter::lruPartIndex | ( | ) | const |
Définition à la ligne 48 du fichier KoFilter.cpp.
Références m_partStack.
Référencé par embedPart(), et startInternalEmbedding().
Voici le graphe d'appel pour cette fonction :
QString KoEmbeddingFilter::mimeTypeByExtension | ( | const QString & | extension | ) | [static] |
A static helper method to determine the mimetype via the file extension. It allows to go from "wmf" to image/x-wmf and so on. Note that you should only pass the pure extension and not a whole pattern like "*.doc" or so.
Définition à la ligne 53 du fichier KoFilter.cpp.
int KoEmbeddingFilter::embedPart | ( | const QByteArray & | from, | |
QByteArray & | to, | |||
KoFilter::ConversionStatus & | status, | |||
const QString & | key = QString::null | |||
) | [protected] |
Embed some document using an external filter (i.e. a different filter library). This method works according to the template method pattern and calls savePartContents() during execution. Call this method when you want to convert some data using one or more KOffice filters selected via the filter manager. This is the way to go when it comes to embedding unless you have very special requirements.
from | The mimetype of the source data | |
to | The mimetype of the destination part. If this field is set to "" the filter manager will try to find the best native KOffice mimetype. When the method returns this parameter will hold the string of the used mimetype. | |
status | Returns the error status of the filter | |
key | Optional key field to allow custom keys inside the part map (see internalPartReference). If this field is left empty we generate a key from the part number (e.g. 1 -> "1") |
Définition à la ligne 68 du fichier KoFilter.cpp.
Références KoFilterManager::exp0rt(), lruPartIndex(), KoFilter::m_chain, m_partStack, et savePartContents().
Voici le graphe d'appel pour cette fonction :
void KoEmbeddingFilter::startInternalEmbedding | ( | const QString & | key, | |
const QByteArray & | mimeType | |||
) | [protected] |
Method to perform "internal" embedding of parts in olefilter-style. This method can be used to signal the start of a new embedding level within your filter. Very evil, but what shall I say ;) Unless you really have to you should always use embedPart as it's easier to use and not as hacky.
key | The key we use to store reference/mimetype of your new part | |
mimeType | The mimetype of the part you're about to embed |
Définition à la ligne 89 du fichier KoFilter.cpp.
Références filterChainEnterDirectory(), lruPartIndex(), et m_partStack.
Voici le graphe d'appel pour cette fonction :
void KoEmbeddingFilter::endInternalEmbedding | ( | ) | [protected] |
This method signals the end of an internal embedding session. You have to call that exactly as often as you call startInternalEmbedding or you'll mess up the internal stack and your file will be invalid. Again: use embedPart if you can :-)
Définition à la ligne 97 du fichier KoFilter.cpp.
Références filterChainLeaveDirectory(), et m_partStack.
Voici le graphe d'appel pour cette fonction :
int KoEmbeddingFilter::internalPartReference | ( | const QString & | key | ) | const [protected] |
Query the internal part map for the reference of the part matching the given key. Note that you can use that plain simple int to refer to the respective part (when used as string).
key | The key you would like to look up |
Définition à la ligne 107 du fichier KoFilter.cpp.
Références m_partStack.
QByteArray KoEmbeddingFilter::internalPartMimeType | ( | const QString & | key | ) | const [protected] |
Query the internal part map for the mimetype of the part matching the given key.
key | The key you would like to look up |
Définition à la ligne 115 du fichier KoFilter.cpp.
Références m_partStack.
KoEmbeddingFilter& KoEmbeddingFilter::operator= | ( | const KoEmbeddingFilter & | rhs | ) | [private] |
Better do not assign the filters.
void KoEmbeddingFilter::savePartContents | ( | QIODevice * | file | ) | [private, virtual] |
This method will be called by embedPart as soon as it needs the data of the part (template method pattern). You have to override that and simply save the part data to the (already opened) file. No need to override that when you're not using embedPart (as you should ;)
file | An already opened file |
Définition à la ligne 137 du fichier KoFilter.cpp.
Référencé par embedPart().
Voici le graphe d'appel pour cette fonction :
void KoEmbeddingFilter::filterChainEnterDirectory | ( | const QString & | directory | ) | const [private] |
Internal methods to support the start/endInternalEmbedding methods (we have to change directories and stuff). These methods are declared friends of the KoFilterChain
Définition à la ligne 141 du fichier KoFilter.cpp.
Références KoFilterChain::enterDirectory(), et KoFilter::m_chain.
Référencé par startInternalEmbedding().
Voici le graphe d'appel pour cette fonction :
Voici le graphe d'appel pour cette fonction :
void KoEmbeddingFilter::filterChainLeaveDirectory | ( | ) | const [private] |
Internal methods to support the start/endInternalEmbedding methods (we have to change directories and stuff). These methods are declared friends of the KoFilterChain
Définition à la ligne 146 du fichier KoFilter.cpp.
Références KoFilterChain::leaveDirectory(), et KoFilter::m_chain.
Référencé par endInternalEmbedding().
Voici le graphe d'appel pour cette fonction :
Voici le graphe d'appel pour cette fonction :
friend class KoFilterChain [friend] |
Q3PtrStack<PartState> KoEmbeddingFilter::m_partStack [private] |
A stack which keeps track of the current part references. We push one PartState structure for every embedding level.
Définition à la ligne 309 du fichier KoFilter.h.
Référencé par embedPart(), endInternalEmbedding(), internalPartMimeType(), internalPartReference(), KoEmbeddingFilter(), lruPartIndex(), startInternalEmbedding(), et ~KoEmbeddingFilter().
Private* KoEmbeddingFilter::d [private] |