This file is indexed.

/usr/include/klfapp/klfliblegacyengine.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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/***************************************************************************
 *   file klfliblegacyengine.h
 *   This file is part of the KLatexFormula Project.
 *   Copyright (C) 2011 by Philippe Faist
 *   philippe.faist at 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: klfliblegacyengine.h 603 2011-02-26 23:14:55Z phfaist $ */

#ifndef KLFLIBLEGACYENGINE_H
#define KLFLIBLEGACYENGINE_H


#include <QDateTime>
#include <QList>
#include <QDataStream>
#include <QPixmap>
#include <QMap>
#include <QMetaType>
#include <QFile>
#include <QTimer>

#include <klflib.h>
#include <klflibview.h> // scheme guesser


/** Legacy data structures for KLatexFormula
 *
 * \warning This class is NOT TO BE USED DIRECTLY, it is OBSOLETE. It has been replaced by the
 *   new KLFLib framework. The "old" "legacy" library format is read/written with KLFLibLegacyEngine.
 */
class KLF_EXPORT KLFLegacyData {
public:

  struct KLFStyle {
    KLFStyle(QString nm = QString(), unsigned long fgcol = qRgba(0,0,0,255),
	     unsigned long bgcol = qRgba(255,255,255,0),
	     const QString& mmode = QString(),
	     const QString& pre = QString(),
	     int dotsperinch = -1)
      : name(nm), fg_color(fgcol), bg_color(bgcol), mathmode(mmode), preamble(pre),
	dpi(dotsperinch) { }
    QString name; // this may not always be set, it's only important in saved style list.
    unsigned long fg_color;
    unsigned long bg_color;
    QString mathmode;
    QString preamble;
    int dpi;
  };

  // THESE VALUES MUST NOT CHANGE FROM ONE VERSION TO ANOTHER OF KLATEXFORMULA :
  enum {
    LibResource_History = 0,
    LibResource_Archive = 1,
    // user resources must be in the following range:
    LibResourceUSERMIN = 100,
    LibResourceUSERMAX = 99999
  };

  struct KLFLibraryResource {
    quint32 id;
    QString name;
  };

  struct KLFLibraryItem {
    quint32 id;
    static quint32 MaxId;

    QDateTime datetime;
    /** \note \c latex contains also information of category (first line, %: ...) and
     * tags (first/second line, after category: % ...) */
    QString latex;
    QPixmap preview;

    QString category;
    QString tags;

    KLFLegacyData::KLFStyle style;
  };

  typedef QList<KLFLibraryItem> KLFLibraryList;
  typedef QList<KLFLibraryResource> KLFLibraryResourceList;
  typedef QMap<KLFLibraryResource, KLFLibraryList> KLFLibrary;

private:

  KLFLegacyData();
};

KLF_EXPORT QDataStream& operator<<(QDataStream& stream, const KLFLegacyData::KLFStyle& style);
KLF_EXPORT QDataStream& operator>>(QDataStream& stream, KLFLegacyData::KLFStyle& style);
KLF_EXPORT bool operator==(const KLFLegacyData::KLFStyle& a, const KLFLegacyData::KLFStyle& b);

// it is important to note that the >> operator imports in a compatible way to KLF 2.0
KLF_EXPORT QDataStream& operator<<(QDataStream& stream, const KLFLegacyData::KLFLibraryItem& item);
KLF_EXPORT QDataStream& operator>>(QDataStream& stream, KLFLegacyData::KLFLibraryItem& item);

KLF_EXPORT QDataStream& operator<<(QDataStream& stream, const KLFLegacyData::KLFLibraryResource& item);
KLF_EXPORT QDataStream& operator>>(QDataStream& stream, KLFLegacyData::KLFLibraryResource& item);

// exact matches, style included, but excluding ID and datetime
KLF_EXPORT bool operator==(const KLFLegacyData::KLFLibraryItem& a, const KLFLegacyData::KLFLibraryItem& b);

// is needed for QMap : these operators compare ID only.
KLF_EXPORT bool operator<(const KLFLegacyData::KLFLibraryResource a, const KLFLegacyData::KLFLibraryResource b);
KLF_EXPORT bool operator==(const KLFLegacyData::KLFLibraryResource a, const KLFLegacyData::KLFLibraryResource b);
// name comparision
KLF_EXPORT bool resources_equal_for_import(const KLFLegacyData::KLFLibraryResource a,
					   const KLFLegacyData::KLFLibraryResource b);



class KLFLibLegacyFileDataPrivate;

//! The Legacy Library support for the KLFLib framework
/** Implements a KLFLibResourceEngine resource engine for accessing (KLF<=3.1)-created libraries
 * (*.klf, default library files)
 *
 * Different legacy resources (in the *.klf file) are mapped to sub-resources (in KLFLibResourceEngine).
 */
class KLF_EXPORT KLFLibLegacyEngine : public KLFLibResourceSimpleEngine
{
  Q_OBJECT
public:
  /** Use this function as a constructor for a KLFLibLegacyEngine object.
   *
   * Opens the URL referenced by url and returns a pointer to a freshly instantiated
   * KLFLibLegacyEngine object, the parent of which is set to \c parent. Returns
   * NULL in case of an error.
   *
   */
  static KLFLibLegacyEngine * openUrl(const QUrl& url, QObject *parent = NULL);

  /** Use this function as a constructor. Creates a KLFLibLegacyEngine object,
   * with QObject parent \c parent, creating a fresh, empty .klf file.
   *
   * Returns NULL if creating the file failed.
   *
   * \c legacyResourceName is the name of an empty (legacy) resource (ie. sub-resource) to create
   * in the newly created file.
   *
   * A non-NULL returned object is linked to a file that was successfully created.
   * */
  static KLFLibLegacyEngine * createDotKLF(const QString& fileName, QString legacyResourceName,
					   QObject *parent = NULL);

  virtual ~KLFLibLegacyEngine();

  virtual uint compareUrlTo(const QUrl& other, uint interestFlags = 0xfffffff) const;

  virtual bool canModifyData(const QString& subRes, ModifyType modifytype) const;
  virtual bool canModifyProp(int propid) const;
  virtual bool canRegisterProperty(const QString& propName) const;

  virtual KLFLibEntry entry(const QString& resource, entryId id);
  virtual QList<KLFLibEntryWithId> allEntries(const QString& resource,
					      const QList<int>& wantedEntryProperties = QList<int>());

  virtual QStringList subResourceList() const;

  virtual bool canCreateSubResource() const;
  virtual bool canRenameSubResource(const QString& subResource) const;
  virtual bool canDeleteSubResource(const QString& subResource) const;

public slots:

  virtual bool createSubResource(const QString& subResource, const QString& subResourceTitle);
  virtual bool renameSubResource(const QString& subResource, const QString& subResourceName);
  virtual bool deleteSubResource(const QString& subResource);

  virtual bool save();
  virtual void setAutoSaveInterval(int intervalms);

  virtual QList<entryId> insertEntries(const QString& subResource, const KLFLibEntryList& entries);
  virtual bool changeEntries(const QString& subResource, const QList<entryId>& idlist,
			     const QList<int>& properties, const QList<QVariant>& values);
  virtual bool deleteEntries(const QString& subResource, const QList<entryId>& idlist);

  virtual bool saveTo(const QUrl& newPath);

protected:
  virtual bool saveResourceProperty(int propId, const QVariant& value);

protected slots:
  void updateResourceProperty(int propId);

private:
  KLFLibLegacyEngine(const QString& fileName, const QString& resname, const QUrl& url, QObject *parent);

  KLFLibLegacyFileDataPrivate *d;
};





class KLF_EXPORT KLFLibLegacyLocalFileSchemeGuesser : public QObject, public KLFLibLocalFileSchemeGuesser
{
public:
  KLFLibLegacyLocalFileSchemeGuesser(QObject *parent) : QObject(parent) { }

  QString guessScheme(const QString& fileName) const;
};


/** The associated factory to the KLFLibDBEngine engine. */
class KLF_EXPORT KLFLibLegacyEngineFactory : public KLFLibEngineFactory
{
  Q_OBJECT
public:
  KLFLibLegacyEngineFactory(QObject *parent = NULL);
  virtual ~KLFLibLegacyEngineFactory() { }

  virtual QStringList supportedTypes() const;
  virtual QString schemeTitle(const QString& scheme) const ;

  virtual uint schemeFunctions(const QString& scheme) const;

  virtual QString correspondingWidgetType(const QString& scheme) const;

  /** Create a library engine that opens resource stored at \c location */
  virtual KLFLibResourceEngine *openResource(const QUrl& location, QObject *parent = NULL);

  virtual KLFLibResourceEngine *createResource(const QString& scheme, const Parameters& parameters,
					       QObject *parent = NULL);
};





#endif