QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposerhtml.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposerhtml.h
3  ------------------------------------------------------------
4  begin : July 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSCOMPOSERHTML_H
17 #define QGSCOMPOSERHTML_H
18 
19 #include "qgscomposermultiframe.h"
20 #include <QUrl>
21 
22 class QWebPage;
23 
24 class CORE_EXPORT QgsComposerHtml: public QgsComposerMultiFrame
25 {
26  Q_OBJECT
27  public:
28  QgsComposerHtml( QgsComposition* c, bool createUndoCommands );
30  ~QgsComposerHtml();
31 
32  void setUrl( const QUrl& url );
33  const QUrl& url() const { return mUrl; }
34 
35  QSizeF totalSize() const;
36  void render( QPainter* p, const QRectF& renderExtent );
37 
38  bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const;
39  bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );
40 
41  void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true );
42 
43  private slots:
44  void frameLoaded( bool ok );
45 
46  private:
47  QUrl mUrl;
48  QWebPage* mWebPage;
49  bool mLoaded;
50  QSizeF mSize; //total size in mm
52 
53  double htmlUnitsToMM(); //calculate scale factor
54 };
55 
56 #endif // QGSCOMPOSERHTML_H