File indexing completed on 2024-05-12 15:28:02

0001 /***************************************************************************
0002     File                 : WorksheetDock.h
0003     Project              : LabPlot
0004     Description          : widget for worksheet properties
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2008 by Stefan Gerlach (stefan.gerlach@uni-konstanz.de)
0007     Copyright            : (C) 2010-2020 by Alexander Semke (alexander.semke@web.de)
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef WORKSHEETDOCK_H
0031 #define WORKSHEETDOCK_H
0032 
0033 #include "backend/worksheet/Worksheet.h"
0034 #include "backend/worksheet/plots/PlotArea.h"
0035 #include "kdefrontend/dockwidgets/BaseDock.h"
0036 #include "ui_worksheetdock.h"
0037 
0038 class AbstractAspect;
0039 class ThemeHandler;
0040 class Worksheet;
0041 
0042 class WorksheetDock : public BaseDock {
0043     Q_OBJECT
0044 
0045 public:
0046     explicit WorksheetDock(QWidget*);
0047     void setWorksheets(QList<Worksheet*>);
0048     void updateLocale() override;
0049     void updateUnits() override;
0050 
0051 private:
0052     Ui::WorksheetDock ui;
0053     QList<Worksheet*> m_worksheetList;
0054     Worksheet* m_worksheet{nullptr};
0055     ThemeHandler* m_themeHandler;
0056 
0057     void updatePaperSize();
0058 
0059     void load();
0060     void loadConfig(KConfig&);
0061 
0062 private slots:
0063     void retranslateUi();
0064 
0065     //SLOTs for changes triggered in WorksheetDock
0066     //"General"-tab
0067     void scaleContentChanged(bool);
0068     void sizeChanged(int);
0069     void sizeChanged();
0070     void orientationChanged(int);
0071 
0072     //"Background"-tab
0073     void backgroundTypeChanged(int);
0074     void backgroundColorStyleChanged(int);
0075     void backgroundImageStyleChanged(int);
0076     void backgroundBrushStyleChanged(int);
0077     void backgroundFirstColorChanged(const QColor&);
0078     void backgroundSecondColorChanged(const QColor&);
0079     void backgroundOpacityChanged(int);
0080     void selectFile();
0081     void fileNameChanged();
0082 
0083     //"Layout"-tab
0084     void layoutChanged(int);
0085     void layoutTopMarginChanged(double);
0086     void layoutBottomMarginChanged(double);
0087     void layoutRightMarginChanged(double);
0088     void layoutLeftMarginChanged(double);
0089     void layoutHorizontalSpacingChanged(double);
0090     void layoutVerticalSpacingChanged(double);
0091     void layoutRowCountChanged(int);
0092     void layoutColumnCountChanged(int);
0093 
0094     //SLOTs for changes triggered in Worksheet
0095     void worksheetDescriptionChanged(const AbstractAspect*);
0096     void worksheetScaleContentChanged(bool);
0097     void worksheetPageRectChanged(const QRectF&);
0098 
0099     void worksheetBackgroundTypeChanged(PlotArea::BackgroundType);
0100     void worksheetBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle);
0101     void worksheetBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle);
0102     void worksheetBackgroundBrushStyleChanged(Qt::BrushStyle);
0103     void worksheetBackgroundFirstColorChanged(const QColor&);
0104     void worksheetBackgroundSecondColorChanged(const QColor&);
0105     void worksheetBackgroundFileNameChanged(const QString&);
0106     void worksheetBackgroundOpacityChanged(float);
0107     void worksheetLayoutChanged(Worksheet::Layout);
0108     void worksheetLayoutTopMarginChanged(float);
0109     void worksheetLayoutBottomMarginChanged(float);
0110     void worksheetLayoutLeftMarginChanged(float);
0111     void worksheetLayoutRightMarginChanged(float);
0112     void worksheetLayoutVerticalSpacingChanged(float);
0113     void worksheetLayoutHorizontalSpacingChanged(float);
0114     void worksheetLayoutRowCountChanged(int);
0115     void worksheetLayoutColumnCountChanged(int);
0116 
0117     //save/load templates and themes
0118     void loadConfigFromTemplate(KConfig&);
0119     void saveConfigAsTemplate(KConfig&);
0120     void loadTheme(const QString&);
0121 
0122 signals:
0123     void info(const QString&);
0124 };
0125 
0126 #endif // WORKSHEETDOCK_H