diff options
-rw-r--r-- | emfio/inc/emfreader.hxx | 1 | ||||
-rw-r--r-- | emfio/source/reader/emfreader.cxx | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/emfio/inc/emfreader.hxx b/emfio/inc/emfreader.hxx index 8ee533c24068..4b2855cf54f6 100644 --- a/emfio/inc/emfreader.hxx +++ b/emfio/inc/emfreader.hxx @@ -31,6 +31,7 @@ namespace emfio bool mbRecordPath : 1; bool mbEMFPlus : 1; + bool mbEMFPlusDualMode : 1; bool ReadHeader(); // reads and converts the rectangle diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 859c3510b759..8ff413b79033 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -384,6 +384,7 @@ namespace emfio , mnRecordCount(0) , mbRecordPath(false) , mbEMFPlus(false) + ,mbEMFPlusDualMode(false) { } @@ -443,6 +444,15 @@ namespace emfio SAL_INFO ("vcl.emf", "\t\tEMF+ lock DC (device context)"); } + // look for the "dual mode" in header + // it indicates that either EMF or EMF+ records should be processed + // 0x4001 = EMF+ header + // flags & 1 = dual mode active + if ( type == 0x4001 && flags & 1 ) + { + mbEMFPlusDualMode = true; + } + // Get the length of the remaining data of this record based // on the alleged size sal_uInt32 nRemainingRecordData = size >= nRequiredHeaderSize ? @@ -697,6 +707,14 @@ namespace emfio } } } + else if ( !bHaveDC && mbEMFPlusDualMode && nRecType != EMR_HEADER && nRecType != EMR_EOF ) + { + // skip content (EMF record) in dual mode + // we process only EMR_COMMENT (see above) to access EMF+ data + // with 2 exceptions, according to EMF+ specification: + // EMR_HEADER and EMR_EOF + // if a device context is given (bHaveDC) process the following EMF record, too. + } else if( !mbEMFPlus || bHaveDC || nRecType == EMR_EOF ) { switch( nRecType ) |