mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
more cleanup and fix a crash
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24159 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1d022b19ba
commit
a597483545
@ -77,13 +77,11 @@ static FORMATETC cfFromMime(QString const & mimetype)
|
|||||||
if (mimetype == emf_mime_type) {
|
if (mimetype == emf_mime_type) {
|
||||||
formatetc.cfFormat = CF_ENHMETAFILE;
|
formatetc.cfFormat = CF_ENHMETAFILE;
|
||||||
formatetc.tymed = TYMED_ENHMF;
|
formatetc.tymed = TYMED_ENHMF;
|
||||||
}
|
} else if (mimetype == wmf_mime_type) {
|
||||||
else if (mimetype == wmf_mime_type) {
|
|
||||||
formatetc.cfFormat = CF_METAFILEPICT;
|
formatetc.cfFormat = CF_METAFILEPICT;
|
||||||
formatetc.tymed = TYMED_MFPICT;
|
formatetc.tymed = TYMED_MFPICT;
|
||||||
}
|
}
|
||||||
else return formatetc;
|
formatetc.ptd = 0;
|
||||||
formatetc.ptd = NULL;
|
|
||||||
formatetc.dwAspect = DVASPECT_CONTENT;
|
formatetc.dwAspect = DVASPECT_CONTENT;
|
||||||
formatetc.lindex = -1;
|
formatetc.lindex = -1;
|
||||||
return formatetc;
|
return formatetc;
|
||||||
@ -112,24 +110,25 @@ QString QWindowsMimeMetafile::mimeForFormat(FORMATETC const & formatetc) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QWindowsMimeMetafile::canConvertFromMime(
|
bool QWindowsMimeMetafile::canConvertFromMime(FORMATETC const & formatetc,
|
||||||
FORMATETC const & formatetc, QMimeData const * mimedata) const
|
QMimeData const * mimedata) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QWindowsMimeMetafile::canConvertToMime(
|
bool QWindowsMimeMetafile::canConvertToMime(QString const & mimetype,
|
||||||
QString const & mimetype, IDataObject * pDataObj) const
|
IDataObject * pDataObj) const
|
||||||
{
|
{
|
||||||
|
if (mimetype != emf_mime_type && mimetype != wmf_mime_type)
|
||||||
|
return false;
|
||||||
FORMATETC formatetc = cfFromMime(mimetype);
|
FORMATETC formatetc = cfFromMime(mimetype);
|
||||||
return pDataObj->QueryGetData(&formatetc) == S_OK;
|
return pDataObj->QueryGetData(&formatetc) == S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QWindowsMimeMetafile::convertFromMime(
|
bool QWindowsMimeMetafile::convertFromMime(FORMATETC const & formatetc,
|
||||||
FORMATETC const & formatetc, QMimeData const * mimedata,
|
QMimeData const * mimedata, STGMEDIUM * pmedium) const
|
||||||
STGMEDIUM * pmedium) const
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -149,11 +148,11 @@ QVariant QWindowsMimeMetafile::convertToMime(QString const & mimetype,
|
|||||||
|
|
||||||
int dataSize;
|
int dataSize;
|
||||||
if (s.tymed == TYMED_ENHMF) {
|
if (s.tymed == TYMED_ENHMF) {
|
||||||
dataSize = GetEnhMetaFileBits(s.hEnhMetaFile, 0, NULL);
|
dataSize = GetEnhMetaFileBits(s.hEnhMetaFile, 0, 0);
|
||||||
data.resize(dataSize);
|
data.resize(dataSize);
|
||||||
dataSize = GetEnhMetaFileBits(s.hEnhMetaFile, dataSize, (LPBYTE)data.data());
|
dataSize = GetEnhMetaFileBits(s.hEnhMetaFile, dataSize, (LPBYTE)data.data());
|
||||||
} else if (s.tymed == TYMED_MFPICT) {
|
} else if (s.tymed == TYMED_MFPICT) {
|
||||||
dataSize = GetMetaFileBitsEx((HMETAFILE)s.hMetaFilePict, 0, NULL);
|
dataSize = GetMetaFileBitsEx((HMETAFILE)s.hMetaFilePict, 0, 0);
|
||||||
data.resize(dataSize);
|
data.resize(dataSize);
|
||||||
dataSize = GetMetaFileBitsEx((HMETAFILE)s.hMetaFilePict, dataSize, (LPBYTE)data.data());
|
dataSize = GetMetaFileBitsEx((HMETAFILE)s.hMetaFilePict, dataSize, (LPBYTE)data.data());
|
||||||
}
|
}
|
||||||
@ -183,13 +182,12 @@ public:
|
|||||||
QMacPasteboardMimeGraphics()
|
QMacPasteboardMimeGraphics()
|
||||||
: QMacPasteboardMime(MIME_QT_CONVERTOR|MIME_ALL)
|
: QMacPasteboardMime(MIME_QT_CONVERTOR|MIME_ALL)
|
||||||
{}
|
{}
|
||||||
~QMacPasteboardMimeGraphics() {}
|
|
||||||
QString convertorName();
|
QString convertorName();
|
||||||
QString flavorFor(const QString & mime);
|
QString flavorFor(QString const & mime);
|
||||||
QString mimeFor(QString flav);
|
QString mimeFor(QString flav);
|
||||||
bool canConvert(const QString & mime, QString flav);
|
bool canConvert(QString const & mime, QString flav);
|
||||||
QVariant convertToMime(const QString & mime, QList<QByteArray> data, QString flav);
|
QVariant convertToMime(QString const & mime, QList<QByteArray> data, QString flav);
|
||||||
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
|
QList<QByteArray> convertFromMime(QString const & mime, QVariant data, QString flav);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +197,7 @@ QString QMacPasteboardMimeGraphics::convertorName()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString QMacPasteboardMimeGraphics::flavorFor(const QString & mime)
|
QString QMacPasteboardMimeGraphics::flavorFor(QString const & mime)
|
||||||
{
|
{
|
||||||
LYXERR(Debug::ACTION, "flavorFor " << fromqstr(mime));
|
LYXERR(Debug::ACTION, "flavorFor " << fromqstr(mime));
|
||||||
if (mime == QLatin1String(pdf_mime_type))
|
if (mime == QLatin1String(pdf_mime_type))
|
||||||
@ -217,13 +215,13 @@ QString QMacPasteboardMimeGraphics::mimeFor(QString flav)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QMacPasteboardMimeGraphics::canConvert(const QString & mime, QString flav)
|
bool QMacPasteboardMimeGraphics::canConvert(QString const & mime, QString flav)
|
||||||
{
|
{
|
||||||
return mimeFor(flav) == mime;
|
return mimeFor(flav) == mime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant QMacPasteboardMimeGraphics::convertToMime(const QString & mime, QList<QByteArray> data, QString)
|
QVariant QMacPasteboardMimeGraphics::convertToMime(QString const & mime, QList<QByteArray> data, QString)
|
||||||
{
|
{
|
||||||
if(data.count() > 1)
|
if(data.count() > 1)
|
||||||
qWarning("QMacPasteboardMimeGraphics: Cannot handle multiple member data");
|
qWarning("QMacPasteboardMimeGraphics: Cannot handle multiple member data");
|
||||||
@ -231,7 +229,7 @@ QVariant QMacPasteboardMimeGraphics::convertToMime(const QString & mime, QList<Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<QByteArray> QMacPasteboardMimeGraphics::convertFromMime(const QString &mime, QVariant data, QString)
|
QList<QByteArray> QMacPasteboardMimeGraphics::convertFromMime(QString const & mime, QVariant data, QString)
|
||||||
{
|
{
|
||||||
QList<QByteArray> ret;
|
QList<QByteArray> ret;
|
||||||
ret.append(data.toByteArray());
|
ret.append(data.toByteArray());
|
||||||
|
Loading…
Reference in New Issue
Block a user