[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
Public Member Functions | Protected Member Functions | List of all members
KLFAbstractDataOpener Class Referenceabstract

#include <klfmainwin.h>

Inheritance diagram for KLFAbstractDataOpener:
Inheritance graph
[legend]

Public Member Functions

 KLFAbstractDataOpener (KLFMainWin *mainwin)
 
virtual ~KLFAbstractDataOpener ()
 
virtual QStringList supportedMimeTypes ()=0
 
virtual bool canOpenFile (const QString &file)=0
 
virtual bool canOpenData (const QByteArray &data)=0
 
virtual bool openFile (const QString &file)=0
 
virtual bool openData (const QByteArray &data, const QString &mimetype)=0
 

Protected Member Functions

KLFMainWinmainWin ()
 

Detailed Description

A helper interface class to open old PNG files, library files or abstract data, to fill in the main window controls (latex and style), or possibly open a resource into library.

Instances of subclasses will be invoked when:

Definition at line 123 of file klfmainwin.h.

Constructor & Destructor Documentation

KLFAbstractDataOpener::KLFAbstractDataOpener ( KLFMainWin mainwin)
inline

Definition at line 126 of file klfmainwin.h.

virtual KLFAbstractDataOpener::~KLFAbstractDataOpener ( )
inlinevirtual

Definition at line 127 of file klfmainwin.h.

Member Function Documentation

virtual bool KLFAbstractDataOpener::canOpenData ( const QByteArray data)
pure virtual

Is supposed to peek into data to try to recognize if its format is one which we can open. No indication is given as to which format data is in. If the data is recognized as a format this opener can open, return TRUE, otherwise, return FALSE.

Implemented in KLFAddOnDataOpener, and KLFBasicDataOpener.

virtual bool KLFAbstractDataOpener::canOpenFile ( const QString file)
pure virtual

Is supposed to peek into file to try to recognize if its format is one which we can open. The implementation of this function may also rely on the file name's extension.

If the file is recognized as one this opener can open, then return TRUE, otherwise return FALSE.

Implemented in KLFAddOnDataOpener, and KLFBasicDataOpener.

KLFMainWin* KLFAbstractDataOpener::mainWin ( )
inlineprotected

Get a pointer to the main window passed to the constructor.

Definition at line 170 of file klfmainwin.h.

Referenced by KLFBasicDataOpener::openData(), KLFBasicDataOpener::openFile(), and KLFAddOnDataOpener::openFile().

virtual bool KLFAbstractDataOpener::openData ( const QByteArray data,
const QString mimetype 
)
pure virtual

Actually open the data. You may use the mainWin() to perform something useful.

mimetype is the mime-type of the data.

Note: the mimetype can be empty, in which case the opener should make no assumption whatsoever as to the data's format, and try to parse data, and return FALSE if it is not capable of loading the given data. In particular, it should not be assumed that canOpenData() has already been called and returned true on this data.

This function should return FALSE if it is not capable of loading the given data.

Implemented in KLFAddOnDataOpener, and KLFBasicDataOpener.

virtual bool KLFAbstractDataOpener::openFile ( const QString file)
pure virtual

Actually open the file. You may use the mainWin() to perform something useful.

Note: this function will be called for every file the main window tries to open. Do NOT assume that the file given here is a file that passed the canOpenFile() function test. (Reason: calling both canOpenFile() and openFile() may result into resources being loaded twice, which is not optimal).

This function should return FALSE if it is not capable of loading the given file.

Implemented in KLFAddOnDataOpener, and KLFBasicDataOpener.

virtual QStringList KLFAbstractDataOpener::supportedMimeTypes ( )
pure virtual

Returns a list of mime-types we can handle

Implemented in KLFAddOnDataOpener, and KLFBasicDataOpener.


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

Generated by doxygen 1.8.8