diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2020-03-24 17:19:14 +0100 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2020-03-24 20:37:52 +0100 |
commit | adc7d311de22b0026a5fa0f80f2327d0336fd7cd (patch) | |
tree | fd46ae8d883e2beca17d13fdfe9d558a13e276d9 /drawinglayer/source | |
parent | c4dab726caaa73be9f9c731312080143b0a0b89d (diff) |
tdf#131542 EMF+ Implement BeginContainer record
Change-Id: If388ef4544001fb9064aed3ce979c2790ab0645f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90997
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.cxx | 33 | ||||
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.hxx | 2 |
2 files changed, 32 insertions, 3 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index c8e0d078be39..7ec2b165de9b 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -98,6 +98,7 @@ namespace emfplushelper case EmfPlusRecordTypeSetCompositingQuality: return "EmfPlusRecordTypeSetCompositingQuality"; case EmfPlusRecordTypeSave: return "EmfPlusRecordTypeSave"; case EmfPlusRecordTypeRestore: return "EmfPlusRecordTypeRestore"; + case EmfPlusRecordTypeBeginContainer: return "EmfPlusRecordTypeBeginContainer"; case EmfPlusRecordTypeBeginContainerNoParams: return "EmfPlusRecordTypeBeginContainerNoParams"; case EmfPlusRecordTypeEndContainer: return "EmfPlusRecordTypeEndContainer"; case EmfPlusRecordTypeSetWorldTransform: return "EmfPlusRecordTypeSetWorldTransform"; @@ -234,7 +235,7 @@ namespace emfplushelper return 1.0f; case UnitTypePoint: - return Application::GetDefaultDevice()->GetDPIX() / 72; + return Application::GetDefaultDevice()->GetDPIX() / 72.0; case UnitTypeInch: return Application::GetDefaultDevice()->GetDPIX(); @@ -243,7 +244,7 @@ namespace emfplushelper return Application::GetDefaultDevice()->GetDPIX() / 25.4; case UnitTypeDocument: - return Application::GetDefaultDevice()->GetDPIX() / 300; + return Application::GetDefaultDevice()->GetDPIX() / 300.0; case UnitTypeWorld: case UnitTypeDisplay: @@ -1773,6 +1774,34 @@ namespace emfplushelper GraphicStatePop(mGSStack, stackIndex, mrPropertyHolders.Current()); break; } + case EmfPlusRecordTypeBeginContainer: + { + float dx, dy, dw, dh; + ReadRectangle(rMS, dx, dy, dw, dh); + SAL_INFO("drawinglayer", "EMF+\t Dest RectData: " << dx << "," << dy << " " << dw << "x" << dh); + + float sx, sy, sw, sh; + ReadRectangle(rMS, sx, sy, sw, sh); + SAL_INFO("drawinglayer", "EMF+\t Source RectData: " << sx << "," << sy << " " << sw << "x" << sh); + + sal_uInt32 stackIndex; + rMS.ReadUInt32(stackIndex); + SAL_INFO("drawinglayer", "EMF+\t Begin Container stack index: " << stackIndex << ", PageUnit: " << flags); + + if ((flags == UnitTypeDisplay) || (flags == UnitTypeWorld)) + { + SAL_WARN("drawinglayer", "EMF+\t file error. UnitTypeDisplay and UnitTypeWorld are not supported by BeginContainer in EMF+ specification."); + break; + } + const float aPageScale = getUnitToPixelMultiplier(static_cast<UnitType>(flags)); + GraphicStatePush(mGSContainerStack, stackIndex); + const basegfx::B2DHomMatrix transform = basegfx::utils::createScaleTranslateB2DHomMatrix( + aPageScale * ( dw / sw ), aPageScale * ( dh / sh ), + aPageScale * ( dx - sx ), aPageScale * ( dy - sy) ); + maWorldTransform *= transform; + mappingChanged(); + break; + } case EmfPlusRecordTypeBeginContainerNoParams: { sal_uInt32 stackIndex; diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx index 76e4b657dbe1..de85f2f84e31 100644 --- a/drawinglayer/source/tools/emfphelperdata.hxx +++ b/drawinglayer/source/tools/emfphelperdata.hxx @@ -71,7 +71,7 @@ namespace emfplushelper #define EmfPlusRecordTypeSetCompositingQuality 0x4024 #define EmfPlusRecordTypeSave 0x4025 #define EmfPlusRecordTypeRestore 0x4026 - //TODO EmfPlusRecordTypeBeginContainer 0x4027 + #define EmfPlusRecordTypeBeginContainer 0x4027 #define EmfPlusRecordTypeBeginContainerNoParams 0x4028 #define EmfPlusRecordTypeEndContainer 0x4029 #define EmfPlusRecordTypeSetWorldTransform 0x402A |