File: gr_Abi_MathGraphicDevice.cpp

package info (click to toggle)
abiword 3.0.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,532 kB
  • sloc: cpp: 477,427; ansic: 16,754; makefile: 5,787; xml: 4,014; yacc: 1,818; lex: 1,104; perl: 812; python: 413; php: 183; sh: 169
file content (77 lines) | stat: -rw-r--r-- 2,634 bytes parent folder | download | duplicates (7)
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
/* AbiWord
 * Copyright (C) 2004 Luca Padovani <lpadovan@cs.unibo.it>
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 */

#include <MathView/AbstractLogger.hh>
#include <MathView/Configuration.hh>
#include <MathView/MathMLElement.hh>
#include <MathView/ShaperManager.hh>
#include <MathView/SpaceShaper.hh>

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "gr_Abi_AreaFactory.h"
#include "gr_Abi_MathGraphicDevice.h"
#include "gr_Abi_DefaultShaper.h"
#include "gr_Abi_StandardSymbolsShaper.h"
#include "gr_Abi_ComputerModernShaper.h"

GR_Abi_MathGraphicDevice::GR_Abi_MathGraphicDevice(const SmartPtr<AbstractLogger>& pLogger,
						   const SmartPtr<Configuration>& pConf,
						   GR_Graphics* pGr)
  : MathGraphicDevice(pLogger),
    m_abiFactory(GR_Abi_AreaFactory::create())
{
  UT_ASSERT(pGr);

  setShaperManager(ShaperManager::create(pLogger));
  setFactory(m_abiFactory);

  SmartPtr<GR_Abi_DefaultShaper> defaultShaper = GR_Abi_DefaultShaper::create();
  defaultShaper->setGraphics(pGr);
  getShaperManager()->registerShaper(defaultShaper);
  getShaperManager()->registerShaper(SpaceShaper::create());

#ifndef TOOLKIT_COCOA
  SmartPtr<GR_Abi_StandardSymbolsShaper> symbolsShaper = GR_Abi_StandardSymbolsShaper::create();
  symbolsShaper->setGraphics(pGr);
  getShaperManager()->registerShaper(symbolsShaper);
#endif

#if 1
  SmartPtr<GR_Abi_ComputerModernShaper> cmShaper = GR_Abi_ComputerModernShaper::create(pLogger, pConf);
  cmShaper->setGraphics(pGr);
  getShaperManager()->registerShaper(cmShaper);
#endif
}

GR_Abi_MathGraphicDevice::~GR_Abi_MathGraphicDevice()
{ }

scaled GR_Abi_MathGraphicDevice::defaultLineThickness(const class FormattingContext& /*FC*/) const
{
  return scaled(0.25);
}

SmartPtr<GR_Abi_MathGraphicDevice>
GR_Abi_MathGraphicDevice::create(const SmartPtr<AbstractLogger>& pLogger,
				 const SmartPtr<Configuration>& pConf,
				 GR_Graphics* pGr)
{ return new GR_Abi_MathGraphicDevice(pLogger, pConf, pGr); }