summaryrefslogtreecommitdiffstats
path: root/src/formula.h
blob: 4bd90af05cf51cd25408e5a344629516d9d30fb3 (plain)
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
/******************************************************************************
 *
 * 
 *
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#ifndef FORMULA_H
#define FORMULA_H

#include <memory>
#include <qcstring.h>

/*! Manager class to handle formulas */
class FormulaManager
{
  public:
    struct DisplaySize
    {
      DisplaySize(int w,int h) : width(w), height(h) {}
      int width;
      int height;
    };
    enum class Format { Bitmap, Vector };
    enum class HighDPI { On, Off };
    static FormulaManager &instance();
    void readFormulas(const char *dir,bool doCompare=false);
    void clear();
    int addFormula(const char *formulaText);
    void generateImages(const char *outputDir,Format format,HighDPI hd = HighDPI::Off) const;
    QCString findFormula(int formulaId) const;
    bool hasFormulas() const;
    DisplaySize displaySize(int formulaId) const;
  private:
    FormulaManager();
    struct Private;
    std::unique_ptr<Private> p;
};

#endif