/usr/include/klfapp/klflatexsymbols.h is in libklatexformula3-dev 3.2.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /***************************************************************************
* file klflatexsymbols.h
* This file is part of the KLatexFormula Project.
* Copyright (C) 2011 by Philippe Faist
* philippe.faist@bluewin.ch
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/* $Id: klflatexsymbols.h 603 2011-02-26 23:14:55Z phfaist $ */
#ifndef KLFLATEXSYMBOLS_H
#define KLFLATEXSYMBOLS_H
#include <QList>
#include <QString>
#include <QStringList>
#include <QEvent>
#include <QStackedWidget>
#include <QLayout>
#include <QGridLayout>
#include <QSpacerItem>
#include <QPushButton>
#include <QScrollArea>
#include <QDomElement>
#include <klfbackend.h>
#include <klfsearchbar.h>
#include <klfiteratorsearchable.h>
/** A Latex Symbol. */
struct KLF_EXPORT KLFLatexSymbol
{
KLFLatexSymbol() : symbol(), preamble(), textmode(false), hidden(true) { }
KLFLatexSymbol(const QString& s, const QStringList& p, bool txtmod)
: symbol(s), preamble(p), textmode(txtmod), hidden(false) { }
KLFLatexSymbol(const QDomElement& e);
inline bool valid() const { return !symbol.isEmpty(); }
QString symbol;
QStringList preamble;
bool textmode;
struct BBOffset {
BBOffset(int top = 0, int ri = 0, int bo = 0, int le = 0) : t(top), r(ri), b(bo), l(le) { }
int t, r, b, l;
} bbexpand;
bool hidden;
};
class KLF_EXPORT KLFLatexSymbolsCache
{
public:
enum { Ok = 0, BadHeader, BadVersion };
inline bool cacheNeedsSave() const { return flag_modified; }
QPixmap getPixmap(const KLFLatexSymbol& sym, bool fromcacheonly = true);
int precacheList(const QList<KLFLatexSymbol>& list, bool userfeedback, QWidget *parent = NULL);
void setBackendSettings(const KLFBackend::klfSettings& settings);
KLFLatexSymbol findSymbol(const QString& symbolCode);
QStringList symbolCodeList();
QPixmap findSymbolPixmap(const QString& symbolCode);
static KLFLatexSymbolsCache * theCache();
static void saveTheCache();
private:
/** Private constructor */
KLFLatexSymbolsCache();
/** No copy constructor */
KLFLatexSymbolsCache(const KLFLatexSymbolsCache& /*other*/) { }
QMap<KLFLatexSymbol,QPixmap> cache;
bool flag_modified;
KLFBackend::klfSettings backendsettings;
int loadCacheStream(QDataStream& stream);
int saveCacheStream(QDataStream& stream);
static KLFLatexSymbolsCache * staticCache;
/** returns -1 if file open read or the code returned by loadCache(),
* that is KLFLatexSymbolsCache::{Ok,BadHeader,BadVersion} */
int loadCacheFrom(const QString& file, int version);
};
class KLF_EXPORT KLFLatexSymbolsView : public QScrollArea, public KLFIteratorSearchable<int>
{
Q_OBJECT
public:
KLFLatexSymbolsView(const QString& category, QWidget *parent);
void setSymbolList(const QList<KLFLatexSymbol>& symbols);
void appendSymbolList(const QList<KLFLatexSymbol>& symbols);
QString category() const { return _category; }
// reimplemented from KLFIteratorSearchable
virtual SearchIterator searchIterBegin() { return 0; }
virtual SearchIterator searchIterEnd() { return mSymbols.size(); }
virtual bool searchIterMatches(const SearchIterator& pos, const QString& queryString);
virtual void searchPerformed(const SearchIterator& result);
virtual void searchAbort();
signals:
void symbolActivated(const KLFLatexSymbol& symb);
public slots:
void buildDisplay();
void recalcLayout();
protected slots:
void slotSymbolActivated();
protected:
QString _category;
QList<KLFLatexSymbol> _symbols;
private:
QWidget *mFrame;
QGridLayout *mLayout;
QSpacerItem *mSpacerItem;
QList<QWidget*> mSymbols;
void highlightSearchMatches(int currentMatch);
};
namespace Ui {
class KLFLatexSymbols;
}
/** \brief Dialog that presents a selection of latex symbols to user
*/
class KLF_EXPORT KLFLatexSymbols : public QWidget
{
Q_OBJECT
public:
KLFLatexSymbols(QWidget* parent, const KLFBackend::klfSettings& baseSettings);
~KLFLatexSymbols();
bool event(QEvent *event);
signals:
void insertSymbol(const KLFLatexSymbol& symb);
public slots:
void slotShowCategory(int cat);
void retranslateUi(bool alsoBaseUi = true);
protected:
QStackedWidget *stkViews;
QList<KLFLatexSymbolsView *> mViews;
void closeEvent(QCloseEvent *ev);
void showEvent(QShowEvent *ev);
private:
Ui::KLFLatexSymbols *u;
KLFSearchBar * pSearchBar;
void read_symbols_create_ui();
};
KLF_EXPORT bool operator==(const KLFLatexSymbol& a, const KLFLatexSymbol& b);
#endif
|