summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Jaap <patrick.jaap@tu-dresden.de>2017-10-02 16:21:04 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2017-10-26 20:18:52 +0200
commite06807f51d157844b357dab1bbf960cc55162330 (patch)
treeda3e5f6846259a6aa6d5b138d9b8d282b4ab66e5
parent334cc99139f59fffba214c821707c35270a6b0ee (diff)
tdf#31814 EMF/EMF+ implement dual mode
There can be a dual mode flag set in the EMF+ data. If set, we should process either EMF or EMF+ data, because the contained information should be equal (says the documentation). The more advanced EMF+ renderer is chosen here. The flag is read in the EMFPlusReader and blocks the reading of other EMF records than HEADER, EOF and COMMENT. Thanks to Chris, for pointing out the dual mode! Change-Id: I8522930cebbb9e9ecc732397cbb3deea9e8c9127 Reviewed-on: https://gerrit.libreoffice.org/43122 Reviewed-by: Patrick Jaap <patrick.jaap@tu-dresden.de> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> Tested-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
-rw-r--r--emfio/inc/emfreader.hxx1
-rw-r--r--emfio/source/reader/emfreader.cxx18
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 )