KDEUI
krichtextwidget.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 00003 Copyright 2008 Stephen Kelly <steveire@gmail.com> 00004 Copyright 2008 Thomas McGuire <thomas.mcguire@gmx.net> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef KRICHTEXTWIDGET_H 00021 #define KRICHTEXTWIDGET_H 00022 00023 #include "krichtextedit.h" 00024 00025 class KActionCollection; 00026 00045 class KDEUI_EXPORT KRichTextWidget : public KRichTextEdit 00046 { 00047 Q_OBJECT 00048 Q_FLAGS(RichTextSupport) 00049 Q_PROPERTY(RichTextSupport richTextSupport READ richTextSupport WRITE setRichTextSupport) 00050 public: 00051 00056 enum RichTextSupportValues { 00061 DisableRichText = 0x00, 00062 00069 SupportBold = 0x01, 00070 00077 SupportItalic = 0x02, 00078 00085 SupportUnderline = 0x04, 00086 00093 SupportStrikeOut = 0x08, 00094 00103 SupportFontFamily = 0x10, 00104 00112 SupportFontSize = 0x20, 00113 00120 SupportTextForegroundColor = 0x40, 00121 00128 SupportTextBackgroundColor = 0x80, 00129 00134 FullTextFormattingSupport = 0xff, 00135 00143 SupportChangeListStyle = 0x100, 00144 00149 SupportIndentLists = 0x200, 00150 00154 SupportDedentLists = 0x400, 00155 00160 FullListSupport = 0xf00, 00161 00162 // Not implemented yet. 00163 // SupportCreateTables = 0x1000, 00164 // SupportChangeCellMargin = 0x2000, 00165 // SupportChangeCellPadding = 0x4000, 00166 // SupportChangeTableBorderWidth = 0x8000, 00167 // SupportChangeTableBorderColor = 0x10000, 00168 // SupportChangeTableBorderStyle = 0x20000, 00169 // SupportChangeCellBackground = 0x40000, 00170 // SupportCellFillPatterns = 0x80000, 00171 // 00172 // FullTableSupport = 0xff000, 00173 00179 SupportAlignment = 0x100000, 00180 00181 // Not yet implemented SupportImages = 0x200000, 00182 00186 SupportRuleLine = 0x400000, 00187 00193 SupportHyperlinks = 0x800000, 00194 00200 SupportFormatPainting = 0x1000000, 00201 00206 SupportToPlainText = 0x2000000, 00207 00214 SupportSuperScriptAndSubScript = 0x4000000, 00215 00216 // SupportChangeParagraphSpacing = 0x200000, 00217 00221 SupportDirection = 0x8000000, 00222 00226 FullSupport = 0xffffffff 00227 }; 00228 Q_DECLARE_FLAGS(RichTextSupport, RichTextSupportValues) 00229 00230 00234 explicit KRichTextWidget(QWidget *parent); 00235 00243 explicit KRichTextWidget(const QString& text, QWidget *parent = 0); 00244 00248 ~KRichTextWidget(); 00249 00294 virtual void createActions(KActionCollection *actionCollection); 00295 00306 void setRichTextSupport(const KRichTextWidget::RichTextSupport &support); 00307 00312 RichTextSupport richTextSupport() const; 00313 00322 void updateActionStates(); 00323 00324 public Q_SLOTS: 00325 00333 void setActionsEnabled(bool enabled); 00334 00335 protected: 00340 virtual void mouseReleaseEvent(QMouseEvent *event); 00341 00342 00343 private: 00344 //@cond PRIVATE 00345 class Private; 00346 friend class Private; 00347 Private *const d; 00348 Q_PRIVATE_SLOT(d, void _k_setTextForegroundColor()) 00349 Q_PRIVATE_SLOT(d, void _k_setTextBackgroundColor()) 00350 Q_PRIVATE_SLOT(d, void _k_manageLink()) 00351 Q_PRIVATE_SLOT(d, void _k_formatPainter(bool)) 00352 Q_PRIVATE_SLOT(d, void _k_updateCharFormatActions(const QTextCharFormat &)) 00353 Q_PRIVATE_SLOT(d, void _k_updateMiscActions()) 00354 Q_PRIVATE_SLOT(d, void _k_setListStyle(int)) 00355 //@endcond 00356 }; 00357 00358 Q_DECLARE_OPERATORS_FOR_FLAGS(KRichTextWidget::RichTextSupport) 00359 00360 #endif 00361 00362 // kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on;
KDE 4.6 API Reference