wxMaxima
Loading...
Searching...
No Matches
SVGout.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// Copyright (C) 2015 Gunter Königsmann <wxMaxima@physikbuch.de>
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// SPDX-License-Identifier: GPL-2.0+
22
23#ifndef SVGOUT_H
24#define SVGOUT_H
25
26#include "OutCommon.h"
27#include "precomp.h"
28#include <wx/dcsvg.h>
29#include <memory>
30
31/* Renders portions of the work sheet (including 2D maths) as svg.
32
33 This is used for exporting HTML with embedded maths as a scalable vector
34 graphics and for them on the clipboard
35*/
36class Svgout final
37{
38public:
41 explicit Svgout(const Configuration * const *configuration, const wxString &filename = {}, double scale = 1.0);
42 explicit Svgout(const Configuration * const *configuration, std::unique_ptr<Cell> &&tree,
43 const wxString &filename = {}, double scale = 1.0);
44 ~Svgout();
45
51 wxSize Render(std::unique_ptr<Cell> &&tree);
52
53 wxSize GetSize() const { return m_size; }
54 bool IsOk() const { return m_isOk; }
55
57 bool ToClipboard();
58
60 std::unique_ptr<wxCustomDataObject> GetDataObject();
61
62private:
63 std::unique_ptr<Cell> m_tree;
64 OutCommon m_cmn;
65 wxSVGFileDC m_recalculationDc;
66 wxSize m_size = wxDefaultSize;
67 bool m_isOk = false;
68
75 wxString m_CWD;
76
77 bool Layout();
78 static const wxDataFormat m_svgFormat;
79};
80
81#endif // SVGOUT_H
This is the header for common code used by various file output modules that render cells to files.
The configuration storage for the current worksheet.
Definition: Configuration.h:85
A collection of common code used in rendering the cells to a non-default output, e....
Definition: OutCommon.h:43
Definition: SVGout.h:37
bool ToClipboard()
Copies the svg representation of the list of cells that was passed to SetData()
Definition: SVGout.cpp:103
wxSize Render(std::unique_ptr< Cell > &&tree)
Renders tree as svg.
Definition: SVGout.cpp:69
std::unique_ptr< wxCustomDataObject > GetDataObject()
Returns the svg representation in a format that can be placed on the clipBoard.
Definition: SVGout.cpp:99