WMFImport Class Reference
#include <wmfimport.h>

Public Member Functions | |
| WMFImport (ScribusMainWindow *mw, int flags) | |
| ~WMFImport () | |
| bool | import (QString fname, int flags) |
| void | wmfClosePath (FPointArray *i) |
| void | wmfMoveTo (double x1, double y1) |
| void | wmfLineTo (FPointArray *i, double x1, double y1) |
| void | wmfCurveToCubic (FPointArray *i, double x1, double y1, double x2, double y2, double x3, double y3) |
| void | setWindowOrg (QList< PageItem * > &items, long num, short *params) |
| void | setWindowExt (QList< PageItem * > &items, long num, short *params) |
| void | lineTo (QList< PageItem * > &items, long num, short *params) |
| void | moveTo (QList< PageItem * > &items, long num, short *params) |
| void | ellipse (QList< PageItem * > &items, long num, short *params) |
| void | polygon (QList< PageItem * > &items, long num, short *params) |
| void | polyPolygon (QList< PageItem * > &items, long num, short *params) |
| void | polyline (QList< PageItem * > &items, long num, short *params) |
| void | rectangle (QList< PageItem * > &items, long num, short *params) |
| void | roundRect (QList< PageItem * > &items, long num, short *params) |
| void | arc (QList< PageItem * > &items, long num, short *params) |
| void | chord (QList< PageItem * > &items, long num, short *params) |
| void | pie (QList< PageItem * > &items, long num, short *params) |
| void | setPolyFillMode (QList< PageItem * > &items, long num, short *params) |
| void | setBkColor (QList< PageItem * > &items, long num, short *params) |
| void | setBkMode (QList< PageItem * > &items, long num, short *params) |
| void | saveDC (QList< PageItem * > &items, long num, short *params) |
| void | restoreDC (QList< PageItem * > &items, long num, short *params) |
| void | intersectClipRect (QList< PageItem * > &items, long num, short *params) |
| void | excludeClipRect (QList< PageItem * > &items, long num, short *params) |
| void | setTextColor (QList< PageItem * > &items, long num, short *params) |
| void | setTextAlign (QList< PageItem * > &items, long num, short *params) |
| void | textOut (QList< PageItem * > &items, long num, short *params) |
| void | extTextOut (QList< PageItem * > &items, long num, short *params) |
| void | selectObject (QList< PageItem * > &items, long num, short *params) |
| void | deleteObject (QList< PageItem * > &items, long num, short *params) |
| void | createEmptyObject (QList< PageItem * > &items, long num, short *params) |
| void | createBrushIndirect (QList< PageItem * > &items, long num, short *params) |
| void | createPenIndirect (QList< PageItem * > &items, long num, short *params) |
| void | createFontIndirect (QList< PageItem * > &items, long num, short *params) |
| void | noop (QList< PageItem * > &items, long, short *) |
| void | end (QList< PageItem * > &items, long, short *) |
Public Attributes | |
| bool | interactive |
| bool | unsupported |
| Indicator if there is any unsupported feature in imported wmf. | |
| bool | importFailed |
| bool | importCanceled |
| ScribusDoc * | m_Doc |
| Selection * | m_tmpSel |
| QStringList | importedColors |
Protected Member Functions | |
| bool | importWMF (int flags) |
| bool | loadWMF (const QString &fileName) |
| bool | loadWMF (QBuffer &buffer) |
| QList< PageItem * > | parseWmfCommands (void) |
| void | finishCmdParsing (PageItem *item) |
| QString | importColor (const QColor &color) |
| QColor | colorFromParam (short *params) |
| QTextCodec * | codecFromCharset (int charset) |
| QString | symbolToUnicode (const QByteArray &chars) |
| FPointArray | pointsFromParam (short num, short *params) |
| FPointArray | pointsToPolyline (const FPointArray &points, bool closePath) |
| void | pointsToAngle (double xStart, double yStart, double xEnd, double yEnd, double &angleStart, double &angleLength) |
| void | addHandle (WmfObjHandle *) |
| void | deleteHandle (int) |
| unsigned short | calcCheckSum (WmfPlaceableHeader *) |
| virtual int | findFunc (unsigned short aFunc) const |
| unsigned int | toDWord (short *params) |
Protected Attributes | |
| QString | m_docDesc |
| QString | m_docTitle |
| WMFContext | m_context |
| bool | m_IsPlaceable |
| bool | m_IsEnhanced |
| bool | m_Valid |
| QRect | m_HeaderBoundingBox |
| QRect | m_BBox |
| QList< WmfCmd * > | m_commands |
| WmfObjHandle ** | m_ObjHandleTab |
| FPointArray | m_Points |
| int | m_Dpi |
Detailed Description
Definition at line 36 of file wmfimport.h.
Constructor & Destructor Documentation
| WMFImport::WMFImport | ( | ScribusMainWindow * | mw, | |
| int | flags | |||
| ) |
Definition at line 140 of file wmfimport.cpp.
References ScribusMainWindow::doc, importCanceled, importedColors, importFailed, interactive, LoadSavePlugin::lfInteractive, m_Doc, m_docDesc, m_docTitle, m_Dpi, m_ObjHandleTab, m_tmpSel, m_Valid, and unsupported.
| WMFImport::~WMFImport | ( | ) |
Definition at line 158 of file wmfimport.cpp.
References m_commands, m_ObjHandleTab, m_tmpSel, and MAX_OBJHANDLE.
Member Function Documentation
| bool WMFImport::import | ( | QString | fname, | |
| int | flags | |||
| ) |
Definition at line 332 of file wmfimport.cpp.
References importFailed, importWMF(), and loadWMF().
Referenced by WMFImportPlugin::import().
| void WMFImport::wmfClosePath | ( | FPointArray * | i | ) |
| void WMFImport::wmfMoveTo | ( | double | x1, | |
| double | y1 | |||
| ) |
| void WMFImport::wmfLineTo | ( | FPointArray * | i, | |
| double | x1, | |||
| double | y1 | |||
| ) |
| void WMFImport::wmfCurveToCubic | ( | FPointArray * | i, | |
| double | x1, | |||
| double | y1, | |||
| double | x2, | |||
| double | y2, | |||
| double | x3, | |||
| double | y3 | |||
| ) |
| bool WMFImport::importWMF | ( | int | flags | ) | [protected] |
Protected import functions
Definition at line 539 of file wmfimport.cpp.
References Selection::addItem(), ScribusView::addPage(), ScribusDoc::addPage(), FPointArray::addPoint(), ScribusView::adjustCanvas(), ScribusView::canvasOrigin(), ScribusDoc::changed(), Selection::clear(), toolPrefs::dBrush, ScribusView::Deselect(), ScribusDoc::documentInfo, ScribusDoc::DoDrawing, ScribusMainWindow::doFileNew(), toolPrefs::dPen, ScribusDoc::DragElements, ScribusDoc::DraggedElem, ScribusDoc::DragP, ColorList::ensureBlackAndWhite(), ScribusDoc::GroupCounter, PageItem::Groups, PageItem::groupsLastItem, ScribusMainWindow::HaveNewDoc(), PageItem::height, importCanceled, importedColors, importFailed, interactive, PageItem::isGroupControl, ScribusDoc::isLoading(), ScribusDoc::itemAdd(), PageItem::ItemNr, ScribusDoc::Items, ScribusDoc::itemSelection_DeleteItem(), LoadSavePlugin::lfCreateDoc, LoadSavePlugin::lfInsertPage, LoadSavePlugin::lfScripted, PageItem::lineWidth, loadIcon(), m_BBox, m_Doc, m_docDesc, m_docTitle, m_Dpi, ScribusDoc::m_pageSize, ScribusDoc::m_Selection, m_tmpSel, ScribusDoc::maxCanvasCoordinate, ScribusDoc::minCanvasCoordinate, ScribusDoc::PageColors, ScribusDoc::PageOri, parseWmfCommands(), FPointArray::point(), PageItem::Polygon, ScribusCore::primaryMainWindow(), PageItem::Rectangle, ScribusDoc::reformPages(), FPointArray::resize(), PageItem::rotation, ScribusView::scale(), ScCore, ScribusDoc::scMW(), ScribusMainWindow::ScriptRunning, ScribusView::setCanvasOrigin(), DocumentInformation::setComments(), Selection::setGroupRect(), PageItem::setItemName(), ScribusDoc::setLoading(), ScribusDoc::setPage(), PageItem::setRedrawBounding(), PageItem::setTextFlowMode(), DocumentInformation::setTitle(), PageItem::TextFlowUsesFrameShape, ScribusDoc::toolSettings, tr(), ScribusView::updatesOn(), ScribusDoc::view(), PageItem::width, ScriXmlDoc::WriteElem(), FPoint::x(), PageItem::xPos, FPoint::y(), and PageItem::yPos.
Referenced by import().
| bool WMFImport::loadWMF | ( | const QString & | fileName | ) | [protected] |
| bool WMFImport::loadWMF | ( | QBuffer & | buffer | ) | [protected] |
Definition at line 371 of file wmfimport.cpp.
References APMHEADER_KEY, WmfPlaceableHeader::bbox, _RECT32::bottom, _RECT16::bottom, calcCheckSum(), WmfPlaceableHeader::checksum, WmfEnhMetaHeader::dSignature, ENHMETA_SIGNATURE, findFunc(), WmfCmd::funcIndex, _SIZE32::height, WmfPlaceableHeader::hmf, WmfPlaceableHeader::inch, WmfEnhMetaHeader::iType, WmfPlaceableHeader::key, _RECT32::left, _RECT16::left, m_BBox, m_commands, m_Dpi, m_HeaderBoundingBox, m_IsEnhanced, m_IsPlaceable, m_Valid, WmfMetaHeader::mtHeaderSize, WmfMetaHeader::mtMaxRecord, WmfMetaHeader::mtNoObjects, WmfMetaHeader::mtNoParameters, WmfMetaHeader::mtSize, WmfMetaHeader::mtType, WmfMetaHeader::mtVersion, WmfEnhMetaHeader::nBytes, WmfEnhMetaHeader::nDescription, WmfEnhMetaHeader::nHandles, WmfEnhMetaHeader::nPalEntries, WmfEnhMetaHeader::nRecords, WmfEnhMetaHeader::nSize, WmfCmd::numParam, WmfEnhMetaHeader::nVersion, WmfEnhMetaHeader::offDescription, WmfCmd::params, WmfEnhMetaHeader::rclBounds, WmfEnhMetaHeader::rclFrame, WmfPlaceableHeader::reserved, _RECT32::right, _RECT16::right, WmfEnhMetaHeader::sReserved, WmfEnhMetaHeader::szlDevice, WmfEnhMetaHeader::szlMillimeters, _RECT32::top, _RECT16::top, _SIZE32::width, and WMFIMPORT_DEBUG.
| QList< PageItem * > WMFImport::parseWmfCommands | ( | void | ) | [protected] |
Definition at line 749 of file wmfimport.cpp.
References WmfCmd::funcIndex, m_BBox, m_commands, m_context, m_Dpi, m_ObjHandleTab, m_Valid, MAX_OBJHANDLE, metaFuncTab, MetaFuncRec::method, MetaFuncRec::name, noop(), WmfCmd::numParam, WmfCmd::params, WMFContext::reset(), WMFContext::setViewportExt(), WMFContext::setViewportOrg(), WMFContext::setWindowExt(), WMFContext::setWindowOrg(), and WMFIMPORT_DEBUG.
Referenced by importWMF().
| void WMFImport::finishCmdParsing | ( | PageItem * | item | ) | [protected] |
Definition at line 802 of file wmfimport.cpp.
References ScribusDoc::AdjustItemSize(), PageItem::asImageFrame(), PageItem::asTextFrame(), PageItem::ClipEdited, PageItem::FrameType, getMaxClipF(), ScImage::height(), PageItem::height, PageItem::lineWidth, m_context, m_Doc, FPointArray::map(), PageItem::moveBy(), ScribusDoc::OnPage(), PageItem::OwnPage, WMFContext::pen(), PageItem::PicAvail, PageItem::pixm, PageItem::PLineEnd, PageItem::PLineJoin, PageItem::PoLine, PageItem::setImageXYScale(), PageItem::setLineWidth(), PageItem::setRedrawBounding(), PageItem::setTextFlowMode(), PageItem::setWidthHeight(), PageItem::TextFlowDisabled, ScImage::width(), PageItem::width, WMFContext::worldMatrix(), FPoint::x(), and FPoint::y().
Referenced by arc(), chord(), ellipse(), extTextOut(), lineTo(), pie(), polygon(), polyline(), rectangle(), and roundRect().
| QString WMFImport::importColor | ( | const QColor & | color | ) | [protected] |
Import a QColor
Definition at line 174 of file wmfimport.cpp.
References colorModelRGB, ScColor::fromQColor(), importedColors, m_Doc, ScribusDoc::PageColors, ScColor::setRegistrationColor(), and ScColor::setSpotColor().
Referenced by arc(), chord(), ellipse(), extTextOut(), lineTo(), pie(), polygon(), polyline(), rectangle(), and roundRect().
| QColor WMFImport::colorFromParam | ( | short * | params | ) | [protected] |
Get color from parameters array
Definition at line 207 of file wmfimport.cpp.
References toDWord().
Referenced by createBrushIndirect(), createPenIndirect(), setBkColor(), and setTextColor().
| QTextCodec * WMFImport::codecFromCharset | ( | int | charset | ) | [protected] |
Get text codec from charset code
Definition at line 220 of file wmfimport.cpp.
References ANSI_CHARSET, ARABIC_CHARSET, BALTIC_CHARSET, CHINESEBIG5_CHARSET, DEFAULT_CHARSET, EASTEUROPE_CHARSET, GB2312_CHARSET, GREEK_CHARSET, HANGEUL_CHARSET, HEBREW_CHARSET, MAC_CHARSET, OEM_CHARSET, RUSSIAN_CHARSET, SHIFTJIS_CHARSET, THAI_CHARSET, TURKISH_CHARSET, and VIETNAMESE_CHARSET.
Referenced by extTextOut().
| QString WMFImport::symbolToUnicode | ( | const QByteArray & | chars | ) | [protected] |
Translate characters in symbol charset to unicode
Definition at line 260 of file wmfimport.cpp.
References greek_symbol_to_unicode, and symbol_to_unicode.
Referenced by extTextOut().
| FPointArray WMFImport::pointsFromParam | ( | short | num, | |
| short * | params | |||
| ) | [protected] |
Get polygon array from parameters array
Definition at line 283 of file wmfimport.cpp.
References FPointArray::resize(), and FPointArray::setPoint().
Referenced by polygon(), and polyline().
| FPointArray WMFImport::pointsToPolyline | ( | const FPointArray & | points, | |
| bool | closePath | |||
| ) | [protected] |
Transform a point array to an item path used as polyline
Definition at line 294 of file wmfimport.cpp.
References FPointArray::point(), polyline(), FPointArray::size(), FPointArray::svgClosePath(), FPointArray::svgInit(), FPointArray::svgLineTo(), FPointArray::svgMoveTo(), FPoint::x(), and FPoint::y().
Referenced by polygon(), and polyline().
| void WMFImport::pointsToAngle | ( | double | xStart, | |
| double | yStart, | |||
| double | xEnd, | |||
| double | yEnd, | |||
| double & | angleStart, | |||
| double & | angleLength | |||
| ) | [protected] |
| void WMFImport::addHandle | ( | WmfObjHandle * | handle | ) | [protected] |
Handle win-object-handles
Definition at line 1432 of file wmfimport.cpp.
References m_ObjHandleTab, and MAX_OBJHANDLE.
Referenced by createBrushIndirect(), createEmptyObject(), createFontIndirect(), and createPenIndirect().
| void WMFImport::deleteHandle | ( | int | idx | ) | [protected] |
Definition at line 1445 of file wmfimport.cpp.
References m_ObjHandleTab, and MAX_OBJHANDLE.
Referenced by deleteObject().
| unsigned short WMFImport::calcCheckSum | ( | WmfPlaceableHeader * | apmfh | ) | [protected] |
| int WMFImport::findFunc | ( | unsigned short | aFunc | ) | const [protected, virtual] |
Find function in metafunc table by metafile-function. Returns index or -1 if not found.
Definition at line 1469 of file wmfimport.cpp.
References metaFuncTab, and MetaFuncRec::name.
Referenced by loadWMF().
| unsigned int WMFImport::toDWord | ( | short * | params | ) | [protected] |
Converts two parameters to long
Definition at line 1480 of file wmfimport.cpp.
Referenced by colorFromParam().
| void WMFImport::setWindowOrg | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
set window origin
Definition at line 838 of file wmfimport.cpp.
References m_context, and WMFContext::setWindowOrg().
| void WMFImport::setWindowExt | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
set window extents
Definition at line 843 of file wmfimport.cpp.
References m_context, and WMFContext::setWindowExt().
| void WMFImport::lineTo | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw line to coord
Definition at line 848 of file wmfimport.cpp.
References ScribusDoc::currentPage(), finishCmdParsing(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, CommonStrings::None, WMFContext::pen(), PageItem::PoLine, PageItem::PolyLine, WMFContext::position(), FPointArray::resize(), FPointArray::setPoint(), WMFContext::setPosition(), PageItem::Unspecified, Page::xOffset(), and Page::yOffset().
| void WMFImport::moveTo | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
move pen to coord
Definition at line 875 of file wmfimport.cpp.
References m_context, and WMFContext::setPosition().
| void WMFImport::ellipse | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw ellipse
Definition at line 880 of file wmfimport.cpp.
References WMFContext::brush(), ScribusDoc::currentPage(), PageItem::Ellipse, finishCmdParsing(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, FPointArray::map(), CommonStrings::None, WMFContext::pen(), PageItem::PoLine, PageItem::Polygon, Page::xOffset(), and Page::yOffset().
| void WMFImport::polygon | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw polygon
Definition at line 901 of file wmfimport.cpp.
References WMFContext::brush(), ScribusDoc::currentPage(), PageItem::fillRule, finishCmdParsing(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, CommonStrings::None, WMFContext::pen(), pointsFromParam(), pointsToPolyline(), PageItem::PoLine, PageItem::Polygon, FPointArray::size(), PageItem::Unspecified, WMFContext::windingFill(), Page::xOffset(), and Page::yOffset().
Referenced by polyPolygon().
| void WMFImport::polyPolygon | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
| void WMFImport::polyline | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw series of lines
Definition at line 942 of file wmfimport.cpp.
References ScribusDoc::currentPage(), finishCmdParsing(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, CommonStrings::None, WMFContext::pen(), pointsFromParam(), pointsToPolyline(), PageItem::PoLine, PageItem::PolyLine, FPointArray::size(), PageItem::Unspecified, Page::xOffset(), and Page::yOffset().
Referenced by pointsToPolyline().
| void WMFImport::rectangle | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw a rectangle
Definition at line 965 of file wmfimport.cpp.
References WMFContext::brush(), ScribusDoc::currentPage(), finishCmdParsing(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, FPointArray::map(), CommonStrings::None, WMFContext::pen(), PageItem::PoLine, PageItem::Polygon, PageItem::Rectangle, Page::xOffset(), and Page::yOffset().
| void WMFImport::roundRect | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw round rectangle
Definition at line 989 of file wmfimport.cpp.
References WMFContext::brush(), ScribusDoc::currentPage(), finishCmdParsing(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, FPointArray::map(), CommonStrings::None, WMFContext::pen(), PageItem::PoLine, PageItem::Polygon, PageItem::Rectangle, PageItem::setCornerRadius(), PageItem::SetFrameRound(), ScribusDoc::setRedrawBounding(), Page::xOffset(), and Page::yOffset().
| void WMFImport::arc | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw arc
Definition at line 1021 of file wmfimport.cpp.
References ScribusDoc::currentPage(), finishCmdParsing(), FPointArray::fromQPainterPath(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, CommonStrings::None, WMFContext::pen(), pointsToAngle(), PageItem::PoLine, PageItem::PolyLine, FPointArray::size(), PageItem::Unspecified, Page::xOffset(), and Page::yOffset().
| void WMFImport::chord | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw chord
Definition at line 1054 of file wmfimport.cpp.
References WMFContext::brush(), ScribusDoc::currentPage(), finishCmdParsing(), FPointArray::fromQPainterPath(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, CommonStrings::None, WMFContext::pen(), pointsToAngle(), PageItem::PoLine, PageItem::Polygon, FPointArray::size(), PageItem::Unspecified, Page::xOffset(), and Page::yOffset().
| void WMFImport::pie | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
draw pie
Definition at line 1091 of file wmfimport.cpp.
References WMFContext::brush(), ScribusDoc::currentPage(), finishCmdParsing(), FPointArray::fromQPainterPath(), importColor(), ScribusDoc::itemAdd(), ScribusDoc::Items, m_context, m_Doc, CommonStrings::None, WMFContext::pen(), pointsToAngle(), PageItem::PoLine, PageItem::Polygon, FPointArray::size(), PageItem::Unspecified, Page::xOffset(), and Page::yOffset().
| void WMFImport::setPolyFillMode | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
set polygon fill mode
Definition at line 1129 of file wmfimport.cpp.
References m_context, and WMFContext::setWindingFill().
| void WMFImport::setBkColor | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
set background pen color
Definition at line 1134 of file wmfimport.cpp.
References colorFromParam(), m_context, and WMFContext::setBackgroundColor().
| void WMFImport::setBkMode | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
set background pen mode
Definition at line 1139 of file wmfimport.cpp.
References m_context, and WMFContext::setBackgroundMode().
| void WMFImport::saveDC | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
save device context
Definition at line 1147 of file wmfimport.cpp.
References m_context, and WMFContext::save().
| void WMFImport::restoreDC | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
restore device context
Definition at line 1152 of file wmfimport.cpp.
References m_context, and WMFContext::restore().
| void WMFImport::intersectClipRect | ( | QList< PageItem * > & | items, | |
| long | num, | |||
| short * | params | |||
| ) |
