Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

formattingbackend.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 - 2008 by Martin Mueller                           *
00003  *   orvio@orvio.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program 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         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BLOKKAL_UIFORMATTINGBACKEND_H
00021 #define BLOKKAL_UIFORMATTINGBACKEND_H
00022 
00023 #include "../blokkal_export.h"
00024 
00025 #include <kxmlguiclient.h>
00026 
00027 #include <QtCore/QObject>
00028 
00029 namespace Blokkal {
00030 
00031 namespace Ui {
00032 class EditEntryWidget;
00033 class HtmlEntryTextEdit;
00062 class BLOKKAL_EXPORT FormattingBackend : public QObject, public KXMLGUIClient
00063 {
00064 Q_OBJECT
00065 public:
00073         FormattingBackend( Blokkal::Ui::EditEntryWidget * parent );
00074 
00078         virtual ~FormattingBackend( void );
00079 
00090         virtual QString & formatForPreview( QString & richText ) const;
00091 
00096         Blokkal::Ui::EditEntryWidget * editEntryWidget( void ) const;
00097 
00098 protected:
00104         void insertTextAtCursor( const QString & text );
00105 
00114         void frameSelection( const QString & front, const QString & tail );
00115 
00119         QString & formatLinks( QString & richText ) const;
00120 
00124         QString & formatLineBreaks( QString & richText ) const;
00125 
00126 private:
00133         void setTextEdit( HtmlEntryTextEdit * textEdit );
00134                 
00135         friend class EditEntryWidget;
00136         class Private;
00137         Private * const d;
00138 };
00139 
00140 }
00141 
00142 }
00143 
00144 #endif