This file is indexed.

/usr/include/klfapp/klflatexsymbols.h is in libklatexformula3-dev 3.3.0~beta-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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/***************************************************************************
 *   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 604 2011-02-27 23:34:37Z 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 <QHash>

#include <klfbackend.h>

#include <klfsearchbar.h>
#include <klfiteratorsearchable.h>


/** A Latex Symbol. */
struct KLF_EXPORT KLFLatexSymbol
{
  KLFLatexSymbol()
    : symbol(), symbol_numargs(0), symbol_option(false), previewlatex(), preamble(), textmode(false),
      hidden(true), keywords()  {  }
  KLFLatexSymbol(const QString& s, const QStringList& p, bool txtmod)
    : symbol(s), symbol_numargs(0), symbol_option(false), previewlatex(), preamble(p), textmode(txtmod),
      hidden(false), keywords()  {  }
  KLFLatexSymbol(const QDomElement& e);

  inline bool valid() const { return !symbol.isEmpty(); }

  QString symbol; //!< "<latex>" in XML def
  int symbol_numargs; //!< "numargs=###" in XML "<latex>" def
  bool symbol_option; //!< "option=[yes|no]" in XML "<latex>" def
  QString previewlatex; //!< "<preview-latex>" in XML def

  //! Returns the symbol with empty arguments, eg. "\sqrt[]{}". Ignores previewlatex.
  QString symbolWithArgs() const;
  //! Returns \ref previewlatex or \ref symbol with dummy args
  QString latexCodeForPreview() const;

  QStringList preamble; //!< all "<preambleline>"'s and "<usepackage>"
  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;

  QStringList keywords; //!< "<keywords>"---add symbol search terms or alternative denomination
};

KLF_EXPORT QDebug operator<<(QDebug str, const KLFLatexSymbol& symbol);

//! A Hash function for a KLFLatexSymbol
inline uint qHash(const KLFLatexSymbol& symb)
{
  return qHash(symb.symbol);
}



class KLFLatexSymbolsCachePrivate;

class KLF_EXPORT KLFLatexSymbolsCache
{
public:
  enum { Ok = 0, BadHeader, BadVersion };

  ~KLFLatexSymbolsCache();

  bool cacheNeedsSave() const;

  QPixmap getPixmap(const KLFLatexSymbol& sym, bool fromCache = true);

  int precacheList(const QList<KLFLatexSymbol>& list, bool userfeedback, QWidget *parent = NULL);

  void setBackendSettings(const KLFBackend::klfSettings& settings);

  KLFLatexSymbol findSymbol(const QString& symbolCode);
  QList<KLFLatexSymbol> findSymbols(const QString& symbolCode);
  QStringList symbolCodeList();
  QPixmap findSymbolPixmap(const QString& symbolCode);

  void debugDump();

  static KLFLatexSymbolsCache * theCache();
  static void saveTheCache();

private:
  /** Private constructor */
  KLFLatexSymbolsCache();
  /** No copy constructor */
  KLFLatexSymbolsCache(const KLFLatexSymbolsCache& /*other*/) { }

  KLFLatexSymbolsCachePrivate *d;

  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 KLFLatexSymbolsSearchable;


class KLF_EXPORT KLFLatexSymbolsView : public QScrollArea
{
  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; }

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;

  friend class KLFLatexSymbolsSearchable;

  bool symbolMatches(int symbol, const QString& qs);
  void highlightSearchMatches(int currentMatch, const QString& qs);
};


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);
  void slotKlfConfigChanged();

  void emitInsertSymbol(const KLFLatexSymbol& symbol);

protected:
  QStackedWidget *stkViews;

  QList<KLFLatexSymbolsView *> mViews;

  void closeEvent(QCloseEvent *ev);
  void showEvent(QShowEvent *ev);

private:
  Ui::KLFLatexSymbols *u;

  KLFSearchBar * pSearchBar;

  KLFLatexSymbolsSearchable * pSearchable;
  friend class KLFLatexSymbolsSearchable;

  void read_symbols_create_ui();
};


KLF_EXPORT bool operator==(const KLFLatexSymbol& a, const KLFLatexSymbol& b);



#endif