File indexing completed on 2024-04-28 15:51:37
0001 /* 0002 SPDX-FileCopyrightText: 2011 Michel Ludwig <michel.ludwig@kdemail.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _OKULAR_VIEWERINTERFACE_H_ 0008 #define _OKULAR_VIEWERINTERFACE_H_ 0009 0010 #include "../core/okularcore_export.h" 0011 #ifdef Q_OS_WIN 0012 #define VIEWERINTERFACE_EXPORT __declspec(dllexport) 0013 #else 0014 #define VIEWERINTERFACE_EXPORT OKULARCORE_EXPORT 0015 #endif 0016 0017 #include <QObject> 0018 #include <QString> 0019 0020 namespace Okular 0021 { 0022 /** 0023 * @short Abstract interface for controlling advanced features of a document viewer 0024 * 0025 * This interface can be used to control some more or less advanced features of a document 0026 * viewer. 0027 */ 0028 class VIEWERINTERFACE_EXPORT ViewerInterface 0029 { 0030 public: 0031 ViewerInterface() 0032 { 0033 } 0034 virtual ~ViewerInterface() 0035 { 0036 } 0037 0038 ViewerInterface(const ViewerInterface &) = delete; 0039 ViewerInterface &operator=(const ViewerInterface &) = delete; 0040 0041 /** 0042 * Show the specified source location centrally in the viewer. 0043 * 0044 * @param fileName source file name 0045 * @param line in the source file, starts from 0 0046 * @param column in the source file, starts from 0 0047 * @param showGraphically controls whether the given source location will be 0048 * shown graphically in the viewer (if that feature is globally activated) 0049 */ 0050 virtual void showSourceLocation(const QString &fileName, int line, int column, bool showGraphically = true) = 0; 0051 0052 /** 0053 * Clear the source location that was set last in the viewer. 0054 */ 0055 virtual void clearLastShownSourceLocation() = 0; 0056 0057 /** 0058 * Returns true iff source locations are shown graphically. 0059 */ 0060 virtual bool areSourceLocationsShownGraphically() const = 0; 0061 0062 /** 0063 * Allows to control whether source locations are shown graphically, or not. 0064 */ 0065 virtual void setShowSourceLocationsGraphically(bool b) = 0; 0066 0067 /** 0068 * Returns true iff the watch file mode is enabled. 0069 */ 0070 virtual bool isWatchFileModeEnabled() const = 0; 0071 0072 /** 0073 * Allows to enable or disable the watch file mode 0074 */ 0075 virtual void setWatchFileModeEnabled(bool b) = 0; 0076 0077 /** 0078 * Should the shell that supports tabs open new files in tabs? 0079 */ 0080 virtual bool openNewFilesInTabs() const = 0; 0081 0082 /** 0083 * Returns the sidebar container. 0084 * 0085 * @since 23.04 0086 */ 0087 virtual QWidget *getSideContainer() const = 0; 0088 0089 // SIGNALS 0090 /** 0091 * The signal 'openSourceReference' is emitted whenever the user has triggered a source 0092 * reference in the currently displayed document. 0093 */ 0094 void openSourceReference(const QString &absFileName, int line, int column); 0095 0096 /** 0097 * The signal 'viewerMenuStateChange' is emitted whenever the state of the menu 0098 * 'menu_okular_part_viewer' defined in 'part-viewermode.rc' has changed. 0099 */ 0100 void viewerMenuStateChange(bool enabled); 0101 }; 0102 0103 } 0104 0105 Q_DECLARE_INTERFACE(Okular::ViewerInterface, "org.kde.okular.ViewerInterface/0.1") 0106 0107 #endif