00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KO_DOCUMENT_SECTION_VIEW_H
00021 #define KO_DOCUMENT_SECTION_VIEW_H
00022
00023 #include <QTreeView>
00024 #include <koffice_export.h>
00025
00026 class QStyleOptionViewItem;
00027 class KoDocumentSectionModel;
00028
00029 class KOFFICEUI_EXPORT KoDocumentSectionView: public QTreeView
00030 {
00031 typedef QTreeView super;
00032 Q_OBJECT
00033
00034 signals:
00035 void contextMenuRequested( const QPoint &globalPos, const QModelIndex &index );
00036
00037 public:
00038 KoDocumentSectionView( QWidget *parent = 0 );
00039 virtual ~KoDocumentSectionView();
00040
00042 enum DisplayMode
00043 {
00045 ThumbnailMode,
00046
00048 DetailedMode,
00049
00051 MinimalMode
00052 };
00053
00054 void setDisplayMode( DisplayMode mode );
00055
00056 DisplayMode displayMode() const;
00057
00058 void addPropertyActions( QMenu *menu, const QModelIndex &index );
00059
00060 protected:
00061 virtual bool viewportEvent( QEvent *event );
00062 virtual void contextMenuEvent( QContextMenuEvent *event );
00063 virtual void showContextMenu( const QPoint &globalPos, const QModelIndex &index );
00064
00065 protected slots:
00066 virtual void currentChanged( const QModelIndex ¤t, const QModelIndex &previous );
00067 virtual void dataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight );
00068
00069 private slots:
00070 void slotActionToggled( bool on, const QPersistentModelIndex &index, int property );
00071
00072 private:
00073 QStyleOptionViewItem optionForIndex( const QModelIndex &index ) const;
00074 typedef KoDocumentSectionModel Model;
00075 class PropertyAction;
00076 class Private;
00077 Private* const d;
00078 };
00079
00080 #endif