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>
This commit is contained in:
Bartosz Kosiorek 2020-03-24 17:19:14 +01:00
parent c4dab726ca
commit adc7d311de
2 changed files with 32 additions and 3 deletions

View file

@ -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;

View file

@ -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