lib

KoSpeaker.h

Go to the documentation of this file.
00001 
00024 #ifndef KOSPEAKER_H
00025 #define KOSPEAKER_H
00026 
00027 // Qt includes.
00028 #include <qobject.h>
00029 #include <qstring.h>
00030 
00031 // KDE includes.
00032 #include <ksharedptr.h>
00033 
00034 // KOffice includes.
00035 #include <koffice_export.h>
00036 
00037 class QWidget;
00038 class QPoint;
00039 class KConfig;
00040 class KoSpeakerPrivate;
00041 
00042 #define kospeaker KoSpeaker::koSpeaker()
00043 
00063 class KOFFICECORE_EXPORT KoSpeaker : public QObject, public KShared
00064 {
00065    Q_OBJECT
00066 public:
00067     KoSpeaker();
00068     ~KoSpeaker();
00069 
00071     enum SpeakFlags {
00072         SpeakFocusWidget =      0x0001  ,
00073         SpeakPointerWidget =    0x0002  ,
00074         SpeakWhatsThis =        0x0004  ,
00075         SpeakTooltip =          0x0008  ,
00076         SpeakAccelerator =      0x0010  ,
00077         SpeakDisabled =         0x0020  
00078     };
00079 
00086     bool isEnabled() const;
00087 
00094     void readConfig(KConfig* config);
00095 
00102     bool maybeSayWidget(QWidget* w, const QPoint& pos = QPoint());
00103 
00113     bool sayWidget(const QString& msg);
00114 
00119     void cancelSpeakWidget();
00120 
00128     void queueSpeech(const QString& msg, const QString& langCode = QString(), bool first = true);
00129 
00133     void startSpeech();
00134 
00139     static bool isKttsdInstalled();
00140 
00145     static KoSpeaker* koSpeaker() { return KSpkr; }
00146 
00147 signals:
00159     void customSpeakNewWidget(QWidget* w, const QPoint& p, uint flags);
00160 
00172     void customSpeakWidget(QWidget* w, const QPoint& p, uint flags);
00173 
00174 protected:
00175     static KoSpeaker* KSpkr;
00176 
00177 private slots:
00182     void probe();
00183 
00184 private:
00185     // int menuBarItemAt(QMenuBar* m, const QPoint& p);
00186 
00187     // Start the KTTSD daemon if not already running.
00188     bool startKttsd();
00189     // Return the KTTSD daemon version string.
00190     QString getKttsdVersion();
00191 
00192     // These methods correspond to dcop interface in kdelibs/interfaces/kspeech/kspeech.h.
00193     // They use manual marshalling, instead of using kspeech_stub, because KOffice
00194     // supports KDE 3.3 and above and kspeech.h didn't appear until 3.4.
00195     void sayScreenReaderOutput(const QString &msg, const QString &talker);
00196     uint setText(const QString &text, const QString &talker);
00197     int appendText(const QString &text, uint jobNum=0);
00198     void startText(uint jobNum=0);
00199     void removeText(uint jobNum=0);
00200 
00201     KoSpeakerPrivate* d;
00202 };
00203 
00204 #endif      // H_KOSPEAKER
KDE Home | KDE Accessibility Home | Description of Access Keys