Released version 6.1.3
This commit is contained in:
		
				commit
				
					
						a94503cb82
					
				
			
		
					 1885 changed files with 276310 additions and 0 deletions
				
			
		
							
								
								
									
										78
									
								
								textengines/mathml/mathml.pro
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								textengines/mathml/mathml.pro
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,78 @@
 | 
			
		|||
################################################################
 | 
			
		||||
# Qwt Widget Library
 | 
			
		||||
# Copyright (C) 1997   Josef Wilgen
 | 
			
		||||
# Copyright (C) 2002   Uwe Rathmann
 | 
			
		||||
#
 | 
			
		||||
# This library is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the Qwt License, Version 1.0
 | 
			
		||||
################################################################
 | 
			
		||||
 | 
			
		||||
message(The qwtmathml library contains code of the MML Widget from the Qt solutions package.)
 | 
			
		||||
message(Beside the Qwt license you also have to take care of its license. )
 | 
			
		||||
 | 
			
		||||
include( $${PWD}/../textengines.pri )
 | 
			
		||||
 | 
			
		||||
TARGET    = $$qwtLibraryTarget(qwtmathml)
 | 
			
		||||
QT       += xml
 | 
			
		||||
 | 
			
		||||
greaterThan(QT_MAJOR_VERSION, 4) {
 | 
			
		||||
 | 
			
		||||
    QT       += widgets
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HEADERS = \
 | 
			
		||||
    qwt_mathml_text_engine.h
 | 
			
		||||
 | 
			
		||||
SOURCES = \
 | 
			
		||||
    qwt_mathml_text_engine.cpp
 | 
			
		||||
 | 
			
		||||
# qwt_mml_document.h/qwt_mml_document.cpp has been stripped down from
 | 
			
		||||
# the mathml widgets offered in the Qt solutions package. 
 | 
			
		||||
 | 
			
		||||
HEADERS += qwt_mml_document.h
 | 
			
		||||
SOURCES += qwt_mml_document.cpp
 | 
			
		||||
 | 
			
		||||
qwtmathmlspec.files  = qwtmathml.prf
 | 
			
		||||
qwtmathmlspec.path  = $${QWT_INSTALL_FEATURES}
 | 
			
		||||
 | 
			
		||||
INSTALLS += qwtmathmlspec
 | 
			
		||||
 | 
			
		||||
CONFIG(lib_bundle) {
 | 
			
		||||
 | 
			
		||||
    FRAMEWORK_HEADERS.version = Versions
 | 
			
		||||
    FRAMEWORK_HEADERS.files   = qwt_mathml_text_engine.h
 | 
			
		||||
    FRAMEWORK_HEADERS.path    = Headers
 | 
			
		||||
    QMAKE_BUNDLE_DATA        += FRAMEWORK_HEADERS
 | 
			
		||||
}
 | 
			
		||||
else {
 | 
			
		||||
 | 
			
		||||
    headers.files  = qwt_mathml_text_engine.h
 | 
			
		||||
    headers.path   = $${QWT_INSTALL_HEADERS}
 | 
			
		||||
    INSTALLS       += headers
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
contains(QWT_CONFIG, QwtPkgConfig) {
 | 
			
		||||
 | 
			
		||||
    CONFIG     += create_pc create_prl no_install_prl
 | 
			
		||||
 | 
			
		||||
    QMAKE_PKGCONFIG_NAME = qwtmathml
 | 
			
		||||
    QMAKE_PKGCONFIG_DESCRIPTION = Qwt MathML renderer
 | 
			
		||||
 | 
			
		||||
    QMAKE_PKGCONFIG_LIBDIR = $${QWT_INSTALL_LIBS}
 | 
			
		||||
    QMAKE_PKGCONFIG_INCDIR = $${QWT_INSTALL_HEADERS}
 | 
			
		||||
 | 
			
		||||
    # QMAKE_PKGCONFIG_DESTDIR is buggy, in combination
 | 
			
		||||
    # with including pri files: better don't use it
 | 
			
		||||
 | 
			
		||||
    greaterThan(QT_MAJOR_VERSION, 4) {
 | 
			
		||||
 | 
			
		||||
        QMAKE_PKGCONFIG_REQUIRES = Qt5Gui Qt5Widgets Qt5Xml
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
 | 
			
		||||
        QMAKE_PKGCONFIG_REQUIRES = QtGui QtXml
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QMAKE_DISTCLEAN += $${DESTDIR}/$${QMAKE_PKGCONFIG_NAME}.pc
 | 
			
		||||
    QMAKE_DISTCLEAN += $${DESTDIR}/libqwtmathml.prl
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										44
									
								
								textengines/mathml/qtmmlwidget-license
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								textengines/mathml/qtmmlwidget-license
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
qwt_mml_document.h/qwt_mml_document.cpp have been stripped down from
 | 
			
		||||
"MML Widget" package of the solutions package, that is distributed under
 | 
			
		||||
the following licenses:
 | 
			
		||||
 | 
			
		||||
-----------------------------------------------------------------
 | 
			
		||||
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
All rights reserved.
 | 
			
		||||
Contact: Nokia Corporation (qt-info@nokia.com)
 | 
			
		||||
 | 
			
		||||
Commercial Usage  
 | 
			
		||||
Licensees holding valid Qt Commercial licenses may use this file in
 | 
			
		||||
accordance with the Qt Solutions Commercial License Agreement provided
 | 
			
		||||
with the Software or, alternatively, in accordance with the terms
 | 
			
		||||
contained in a written agreement between you and Nokia.
 | 
			
		||||
 | 
			
		||||
GNU Lesser General Public License Usage
 | 
			
		||||
Alternatively, this file may be used under the terms of the GNU Lesser
 | 
			
		||||
General Public License version 2.1 as published by the Free Software
 | 
			
		||||
Foundation and appearing in the file LICENSE.LGPL included in the
 | 
			
		||||
packaging of this file.  Please review the following information to
 | 
			
		||||
ensure the GNU Lesser General Public License version 2.1 requirements
 | 
			
		||||
will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
			
		||||
 | 
			
		||||
In addition, as a special exception, Nokia gives you certain
 | 
			
		||||
additional rights. These rights are described in the Nokia Qt LGPL
 | 
			
		||||
Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
 | 
			
		||||
package.
 | 
			
		||||
 | 
			
		||||
GNU General Public License Usage 
 | 
			
		||||
Alternatively, this file may be used under the terms of the GNU
 | 
			
		||||
General Public License version 3.0 as published by the Free Software
 | 
			
		||||
Foundation and appearing in the file LICENSE.GPL included in the
 | 
			
		||||
packaging of this file.  Please review the following information to
 | 
			
		||||
ensure the GNU General Public License version 3.0 requirements will be
 | 
			
		||||
met: http://www.gnu.org/copyleft/gpl.html.
 | 
			
		||||
 | 
			
		||||
Please note Third Party Software included with Qt Solutions may impose
 | 
			
		||||
additional restrictions and it is the user's responsibility to ensure
 | 
			
		||||
that they have met the licensing requirements of the GPL, LGPL, or Qt
 | 
			
		||||
Solutions Commercial license and the relevant license of the Third
 | 
			
		||||
Party Software they are using.
 | 
			
		||||
 | 
			
		||||
If you are unsure which license is appropriate for your use, please
 | 
			
		||||
contact Nokia at qt-info@nokia.com.
 | 
			
		||||
							
								
								
									
										132
									
								
								textengines/mathml/qwt_mathml_text_engine.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								textengines/mathml/qwt_mathml_text_engine.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,132 @@
 | 
			
		|||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 | 
			
		||||
 * Qwt Widget Library
 | 
			
		||||
 * Copyright (C) 1997   Josef Wilgen
 | 
			
		||||
 * Copyright (C) 2003   Uwe Rathmann
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the Qwt License, Version 1.0
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
// vim: expandtab
 | 
			
		||||
 | 
			
		||||
#include <qstring.h>
 | 
			
		||||
#include <qpainter.h>
 | 
			
		||||
#include "qwt_mathml_text_engine.h"
 | 
			
		||||
#include "qwt_mml_document.h"
 | 
			
		||||
 | 
			
		||||
//! Constructor
 | 
			
		||||
QwtMathMLTextEngine::QwtMathMLTextEngine()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! Destructor
 | 
			
		||||
QwtMathMLTextEngine::~QwtMathMLTextEngine()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
   Find the height for a given width
 | 
			
		||||
 | 
			
		||||
   \param font Font of the text
 | 
			
		||||
   \param flags Bitwise OR of the flags used like in QPainter::drawText
 | 
			
		||||
   \param text Text to be rendered
 | 
			
		||||
   \param width Width
 | 
			
		||||
 | 
			
		||||
   \return Calculated height
 | 
			
		||||
*/
 | 
			
		||||
double QwtMathMLTextEngine::heightForWidth( const QFont& font, int flags,
 | 
			
		||||
        const QString& text, double ) const
 | 
			
		||||
{
 | 
			
		||||
    return textSize( font, flags, text ).height();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
  Returns the size, that is needed to render text
 | 
			
		||||
 | 
			
		||||
  \param font Font of the text
 | 
			
		||||
  \param flags Bitwise OR of the flags used like in QPainter::drawText
 | 
			
		||||
  \param text Text to be rendered
 | 
			
		||||
 | 
			
		||||
  \return Caluclated size
 | 
			
		||||
*/
 | 
			
		||||
QSizeF QwtMathMLTextEngine::textSize( const QFont &font,
 | 
			
		||||
    int flags, const QString& text ) const
 | 
			
		||||
{
 | 
			
		||||
    Q_UNUSED( flags );
 | 
			
		||||
 | 
			
		||||
    static QString t;
 | 
			
		||||
    static QSize sz;
 | 
			
		||||
 | 
			
		||||
    if ( text != t )
 | 
			
		||||
    {
 | 
			
		||||
        QwtMathMLDocument doc;
 | 
			
		||||
        doc.setContent( text );
 | 
			
		||||
        doc.setBaseFontPointSize( font.pointSize() );
 | 
			
		||||
 | 
			
		||||
        sz = doc.size();
 | 
			
		||||
        t = text;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return sz;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
  Return margins around the texts
 | 
			
		||||
 | 
			
		||||
  \param left Return 0
 | 
			
		||||
  \param right Return 0
 | 
			
		||||
  \param top Return 0
 | 
			
		||||
  \param bottom Return 0
 | 
			
		||||
*/
 | 
			
		||||
void QwtMathMLTextEngine::textMargins( const QFont &, const QString &,
 | 
			
		||||
    double &left, double &right, double &top, double &bottom ) const
 | 
			
		||||
{
 | 
			
		||||
    left = right = top = bottom = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
   Draw the text in a clipping rectangle
 | 
			
		||||
 | 
			
		||||
   \param painter Painter
 | 
			
		||||
   \param rect Clipping rectangle
 | 
			
		||||
   \param flags Bitwise OR of the flags like in for QPainter::drawText
 | 
			
		||||
   \param text Text to be rendered
 | 
			
		||||
*/
 | 
			
		||||
void QwtMathMLTextEngine::draw( QPainter *painter, const QRectF &rect,
 | 
			
		||||
    int flags, const QString& text ) const
 | 
			
		||||
{
 | 
			
		||||
    QwtMathMLDocument doc;
 | 
			
		||||
    doc.setContent( text );
 | 
			
		||||
    doc.setBaseFontPointSize( painter->font().pointSize() );
 | 
			
		||||
 | 
			
		||||
    const QSizeF docSize = doc.size();
 | 
			
		||||
 | 
			
		||||
    QPointF pos = rect.topLeft();
 | 
			
		||||
    if ( rect.width() > docSize.width() )
 | 
			
		||||
    {
 | 
			
		||||
        if ( flags & Qt::AlignRight )
 | 
			
		||||
            pos.setX( rect.right() - docSize.width() );
 | 
			
		||||
        if ( flags & Qt::AlignHCenter )
 | 
			
		||||
            pos.setX( rect.center().x() - docSize.width() / 2 );
 | 
			
		||||
    }
 | 
			
		||||
    if ( rect.height() > docSize.height() )
 | 
			
		||||
    {
 | 
			
		||||
        if ( flags & Qt::AlignBottom )
 | 
			
		||||
            pos.setY( rect.bottom() - docSize.height() );
 | 
			
		||||
        if ( flags & Qt::AlignVCenter )
 | 
			
		||||
            pos.setY( rect.center().y() - docSize.height() / 2 );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    doc.paint( painter, pos.toPoint() );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
  Test if a string can be rendered by QwtMathMLTextEngine
 | 
			
		||||
 | 
			
		||||
  \param text Text to be tested
 | 
			
		||||
  \return true, if text begins with "<math>".
 | 
			
		||||
*/
 | 
			
		||||
bool QwtMathMLTextEngine::mightRender( const QString &text ) const
 | 
			
		||||
{
 | 
			
		||||
    return text.trimmed().startsWith( "<math" );
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										53
									
								
								textengines/mathml/qwt_mathml_text_engine.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								textengines/mathml/qwt_mathml_text_engine.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 | 
			
		||||
 * Qwt Widget Library
 | 
			
		||||
 * Copyright (C) 1997   Josef Wilgen
 | 
			
		||||
 * Copyright (C) 2003   Uwe Rathmann
 | 
			
		||||
 *
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the Qwt License, Version 1.0
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
// vim: expandtab
 | 
			
		||||
 | 
			
		||||
#ifndef QWT_MATHML_TEXT_ENGINE_H
 | 
			
		||||
#define QWT_MATHML_TEXT_ENGINE_H 1
 | 
			
		||||
 | 
			
		||||
#include "qwt_text_engine.h"
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
  \brief Text Engine for the MathML renderer of the Qt solutions package.
 | 
			
		||||
 | 
			
		||||
  To enable MathML support the following code needs to be added to the
 | 
			
		||||
  application:
 | 
			
		||||
  \verbatim
 | 
			
		||||
#include <qwt_mathml_text_engine.h>
 | 
			
		||||
 | 
			
		||||
QwtText::setTextEngine(QwtText::MathMLText, new QwtMathMLTextEngine());
 | 
			
		||||
  \endverbatim
 | 
			
		||||
 | 
			
		||||
  \sa QwtTextEngine, QwtText::setTextEngine
 | 
			
		||||
  \warning Unfortunately the MathML renderer doesn't support rotating of texts.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
class QWT_EXPORT QwtMathMLTextEngine: public QwtTextEngine
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    QwtMathMLTextEngine();
 | 
			
		||||
    virtual ~QwtMathMLTextEngine();
 | 
			
		||||
 | 
			
		||||
    virtual double heightForWidth( const QFont &font, int flags,
 | 
			
		||||
        const QString &text, double width ) const;
 | 
			
		||||
 | 
			
		||||
    virtual QSizeF textSize( const QFont &font, int flags,
 | 
			
		||||
                             const QString &text ) const;
 | 
			
		||||
 | 
			
		||||
    virtual void draw( QPainter *painter, const QRectF &rect,
 | 
			
		||||
        int flags, const QString &text ) const;
 | 
			
		||||
 | 
			
		||||
    virtual bool mightRender( const QString & ) const;
 | 
			
		||||
 | 
			
		||||
    virtual void textMargins( const QFont &, const QString &,
 | 
			
		||||
        double &left, double &right, double &top, double &bottom ) const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										6261
									
								
								textengines/mathml/qwt_mml_document.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6261
									
								
								textengines/mathml/qwt_mml_document.cpp
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										45
									
								
								textengines/mathml/qwt_mml_document.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								textengines/mathml/qwt_mml_document.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
#ifndef _QWT_MML_DOCUMENT_H_
 | 
			
		||||
#define _QWT_MML_DOCUMENT_H_ 1
 | 
			
		||||
 | 
			
		||||
#include <qwt_global.h>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class QPainter;
 | 
			
		||||
class QPoint;
 | 
			
		||||
 | 
			
		||||
class QwtMmlDocument;
 | 
			
		||||
 | 
			
		||||
class QWT_EXPORT QwtMathMLDocument
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    enum MmlFont
 | 
			
		||||
    {
 | 
			
		||||
        NormalFont,
 | 
			
		||||
        FrakturFont,
 | 
			
		||||
        SansSerifFont,
 | 
			
		||||
        ScriptFont,
 | 
			
		||||
        MonospaceFont,
 | 
			
		||||
        DoublestruckFont
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    QwtMathMLDocument();
 | 
			
		||||
    ~QwtMathMLDocument();
 | 
			
		||||
 | 
			
		||||
    void clear();
 | 
			
		||||
 | 
			
		||||
    bool setContent( QString text, QString *errorMsg = 0,
 | 
			
		||||
                     int *errorLine = 0, int *errorColumn = 0 );
 | 
			
		||||
    void paint( QPainter *p, const QPoint &pos ) const;
 | 
			
		||||
    QSize size() const;
 | 
			
		||||
 | 
			
		||||
    QString fontName( MmlFont type ) const;
 | 
			
		||||
    void setFontName( MmlFont type, const QString &name );
 | 
			
		||||
 | 
			
		||||
    int baseFontPointSize() const;
 | 
			
		||||
    void setBaseFontPointSize( int size );
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    QwtMmlDocument *m_doc;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										29
									
								
								textengines/mathml/qwtmathml.prf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								textengines/mathml/qwtmathml.prf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
################################################################
 | 
			
		||||
# Qwt Widget Library
 | 
			
		||||
# Copyright (C) 1997   Josef Wilgen
 | 
			
		||||
# Copyright (C) 2002   Uwe Rathmann
 | 
			
		||||
#
 | 
			
		||||
# This library is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the Qwt License, Version 1.0
 | 
			
		||||
################################################################
 | 
			
		||||
 | 
			
		||||
include ( ./qwtconfig.pri )
 | 
			
		||||
include ( ./qwtfunctions.pri )
 | 
			
		||||
 | 
			
		||||
contains(QWT_CONFIG, QwtDll) {
 | 
			
		||||
 | 
			
		||||
    DEFINES *= QWT_DLL
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QT       *= xml
 | 
			
		||||
 | 
			
		||||
contains(QWT_CONFIG, QwtFramework) {
 | 
			
		||||
 | 
			
		||||
    INCLUDEPATH *= $${QWT_INSTALL_LIBS}/qwtmathml.framework/Headers
 | 
			
		||||
}
 | 
			
		||||
else {
 | 
			
		||||
 | 
			
		||||
    INCLUDEPATH *= $${QWT_INSTALL_HEADERS}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
qwtAddLibrary($${QWT_INSTALL_LIBS}, qwtmathml)
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue