File indexing completed on 2024-05-19 16:10:00

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007 Sebastian Sauer <mail@dipe.org>
0003  * Copyright (C) 2008-2010 Thomas Zander <zander@kde.org>
0004  * Copyright (C) 2010 Boudewijn Rempt <boud@kogmbh.com>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public License
0017  * along with this library; see the file COPYING.LIB.  If not, write to
0018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA
0020  */
0021 
0022 #ifndef KWSTATUSBAR_H
0023 #define KWSTATUSBAR_H
0024 
0025 #include <QPointer>
0026 #include <QMap>
0027 
0028 class QPoint;
0029 class QAction;
0030 class QLabel;
0031 class QStatusBar;
0032 
0033 class KSqueezedTextLabel;
0034 
0035 class KoCanvasController;
0036 class KoCanvasControllerProxyObject;
0037 
0038 class KWView;
0039 class KWStatusBarEditItem;
0040 class KWStatusBarButtonItem;
0041 
0042 /**
0043  * The KWStatusBar class implements an extended statusbar for Words.
0044  */
0045 class KWStatusBar : public QObject
0046 {
0047     Q_OBJECT
0048 public:
0049 
0050     /**
0051     * Destructor.
0052     */
0053     ~KWStatusBar() override;
0054 
0055     static void addViewControls(QStatusBar *statusBar, KWView *view);
0056 
0057 public Q_SLOTS:
0058     void setText(const QString &text);
0059 
0060 private Q_SLOTS:
0061     void setModified(bool modified);
0062     void updatePageCount();
0063     void gotoPage(int pagenumber = -1);
0064     void updatePageStyle();
0065     void showPageStyle();
0066     void updatePageSize();
0067     void updateCursorPosition();
0068     void gotoLine();
0069     void updateMousePosition(const QPoint&);
0070     void canvasResourceChanged(int, const QVariant&);
0071     void updateCurrentTool(KoCanvasController*);
0072     void createZoomWidget();
0073     void showPage(bool visible);
0074     void showPageStyle(bool visible);
0075     void showPageSize(bool visible);
0076     void showLineColumn(bool visible);
0077     void showModified(bool visible);
0078     void showMouse(bool visible);
0079     void showZoom(bool visible);
0080     void removeView(QObject *);
0081 
0082 private:
0083     /**
0084     * Constructor.
0085     *
0086     * \param statusBar The parent statusbar this statusbar is child
0087     * of. We will embed our own widgets into this statusbar.
0088     * \param view The Words view instance the statusbar belongs to. Each
0089     * KWStatusBar instance belongs to exactly one view.
0090     */
0091     KWStatusBar(QStatusBar *statusBar, KWView* view);
0092 
0093     void setCurrentView(KWView *view);
0094 
0095     QStatusBar *m_statusbar;
0096     QPointer<KWView> m_currentView;
0097     QMap<KWView*, QWidget*> m_zoomWidgets;
0098     QPointer<KoCanvasControllerProxyObject> m_controller;
0099     int m_currentPageNumber;
0100     QAction *m_zoomAction;
0101 
0102     QLabel *m_modifiedLabel;
0103     KWStatusBarEditItem *m_pageLabel;
0104     KWStatusBarButtonItem *m_pageStyleLabel;
0105     QLabel *m_pageSizeLabel;
0106     KWStatusBarEditItem *m_lineLabel;
0107     QLabel *m_mousePosLabel;
0108     KSqueezedTextLabel *m_statusLabel;
0109     QList<KWView*> m_views;
0110 };
0111 
0112 #endif