Kaydet (Commit) 20f9413f authored tarafından Jan Holesovsky's avatar Jan Holesovsky

EMF+: Parse custom line cap data for start and end line caps.

Change-Id: I3a5f79e22500f53c3c61c173e0827c250b2a8fd0
üst 172acd5b
...@@ -97,6 +97,12 @@ const sal_Int32 EmfPlusLineStyleDashDot = 0x00000003; ...@@ -97,6 +97,12 @@ const sal_Int32 EmfPlusLineStyleDashDot = 0x00000003;
const sal_Int32 EmfPlusLineStyleDashDotDot = 0x00000004; const sal_Int32 EmfPlusLineStyleDashDotDot = 0x00000004;
const sal_Int32 EmfPlusLineStyleCustom = 0x00000005; const sal_Int32 EmfPlusLineStyleCustom = 0x00000005;
const sal_uInt32 EmfPlusCustomLineCapDataTypeDefault = 0x00000000;
const sal_uInt32 EmfPlusCustomLineCapDataTypeAdjustableArrow = 0x00000001;
const sal_uInt32 EmfPlusCustomLineCapDataFillPath = 0x00000001;
const sal_uInt32 EmfPlusCustomLineCapDataLinePath = 0x00000002;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::basegfx; using namespace ::basegfx;
...@@ -588,6 +594,94 @@ namespace cppcanvas ...@@ -588,6 +594,94 @@ namespace cppcanvas
} }
}; };
struct EMFPCustomLineCap : public EMFPObject
{
sal_uInt32 type;
public:
EMFPCustomLineCap() : EMFPObject()
{
}
~EMFPCustomLineCap()
{
}
void Read (SvStream& s, ImplRenderer& rR)
{
sal_uInt32 header;
s >> header >> type;
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustom cap");
SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << header << " type: " << type << std::dec);
if (type == EmfPlusCustomLineCapDataTypeDefault)
{
sal_Int32 customLineCapDataFlags, baseCap, baseInset;
sal_Int32 strokeStartCap, strokeEndCap, strokeJoin;
sal_Int32 strokeMiterLimit, widthScale;
float fillHotSpotX, fillHotSpotY, strokeHotSpotX, strokeHotSpotY;
s >> customLineCapDataFlags >> baseCap >> baseInset
>> strokeStartCap >> strokeEndCap >> strokeJoin
>> strokeMiterLimit >> widthScale
>> fillHotSpotX >> fillHotSpotY >> strokeHotSpotX >> strokeHotSpotY;
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomLinCapDataFlags: 0x" << std::hex << customLineCapDataFlags);
if (customLineCapDataFlags & EmfPlusCustomLineCapDataFillPath)
{
sal_Int32 pathLength;
s >> pathLength;
SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength);
sal_uInt32 pathHeader;
sal_Int32 pathPoints, pathFlags;
s >> pathHeader >> pathPoints >> pathFlags;
SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap fill path)");
SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec );
EMFPPath path(pathPoints);
path.Read(s, pathFlags, rR);
}
if (customLineCapDataFlags & EmfPlusCustomLineCapDataLinePath)
{
sal_Int32 pathLength;
s >> pathLength;
SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength);
sal_uInt32 pathHeader;
sal_Int32 pathPoints, pathFlags;
s >> pathHeader >> pathPoints >> pathFlags;
SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap line path)");
SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec );
EMFPPath path(pathPoints);
path.Read(s, pathFlags, rR);
}
}
else if (type == EmfPlusCustomLineCapDataTypeAdjustableArrow)
{
// TODO only reads the data, does not use them [I've had
// no test document to be able to implement it]
sal_Int32 width, height, middleInset, fillState, lineStartCap;
sal_Int32 lineEndCap, lineJoin, lineMiterLimit, widthScale;
float fillHotSpotX, fillHotSpotY, lineHotSpotX, lineHotSpotY;
s >> width >> height >> middleInset >> fillState >> lineStartCap
>> lineEndCap >> lineJoin >> lineMiterLimit >> widthScale
>> fillHotSpotX >> fillHotSpotY >> lineHotSpotX >> lineHotSpotY;
SAL_INFO("cppcanvas.emf", "EMF+\t\tTODO - actually read EmfPlusCustomLineCapArrowData object (section 2.2.2.12)");
}
}
};
struct EMFPPen : public EMFPBrush struct EMFPPen : public EMFPBrush
{ {
XForm transformation; XForm transformation;
...@@ -605,9 +699,9 @@ namespace cppcanvas ...@@ -605,9 +699,9 @@ namespace cppcanvas
sal_Int32 compoundArrayLen; sal_Int32 compoundArrayLen;
float *compoundArray; float *compoundArray;
sal_Int32 customStartCapLen; sal_Int32 customStartCapLen;
sal_uInt8 *customStartCap; EMFPCustomLineCap *customStartCap;
sal_Int32 customEndCapLen; sal_Int32 customEndCapLen;
sal_uInt8 *customEndCap; EMFPCustomLineCap *customEndCap;
public: public:
EMFPPen () : EMFPBrush () EMFPPen () : EMFPBrush ()
...@@ -622,8 +716,8 @@ namespace cppcanvas ...@@ -622,8 +716,8 @@ namespace cppcanvas
{ {
delete[] dashPattern; delete[] dashPattern;
delete[] compoundArray; delete[] compoundArray;
delete[] customStartCap; delete customStartCap;
delete[] customEndCap; delete customEndCap;
} }
void SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) void SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
...@@ -762,15 +856,13 @@ namespace cppcanvas ...@@ -762,15 +856,13 @@ namespace cppcanvas
{ {
s >> customStartCapLen; s >> customStartCapLen;
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomStartCapLen: " << customStartCapLen); SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomStartCapLen: " << customStartCapLen);
sal_uInt32 pos = s.Tell();
if( customStartCapLen<0 ) customStartCap = new EMFPCustomLineCap();
customStartCapLen=0; customStartCap->Read(s, rR);
customStartCap = new sal_uInt8 [customStartCapLen];
for (i = 0; i < customStartCapLen; i++) // maybe we don't read everything yet, play it safe ;-)
{ s.Seek(pos + customStartCapLen);
s >> customStartCap [i];
SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomStartCap[" << i << "]: 0x" << std::hex << int(customStartCap[i]));
}
} }
else else
customStartCapLen = 0; customStartCapLen = 0;
...@@ -779,15 +871,13 @@ namespace cppcanvas ...@@ -779,15 +871,13 @@ namespace cppcanvas
{ {
s >> customEndCapLen; s >> customEndCapLen;
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomEndCapLen: " << customEndCapLen); SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomEndCapLen: " << customEndCapLen);
sal_uInt32 pos = s.Tell();
if( customEndCapLen<0 ) customEndCap = new EMFPCustomLineCap();
customEndCapLen=0; customEndCap->Read(s, rR);
customEndCap = new sal_uInt8 [customEndCapLen];
for (i = 0; i < customEndCapLen; i++) // maybe we don't read everything yet, play it safe ;-)
{ s.Seek(pos + customEndCapLen);
s >> customEndCap [i];
SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomEndCap[" << i << "]: 0x" << std::hex << int(customEndCap[i]));
}
} }
else else
customEndCapLen = 0; customEndCapLen = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment