Commit 2352ae5d authored by ElenaSubbotina's avatar ElenaSubbotina

PptFormatReader - fix line shape ends

parent 2cba43e6
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="OdfFileReaderTest"
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
RootNamespace="ASCOfficeOdfFileTest"
......
......@@ -297,17 +297,75 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
{
NSPresentationEditor::CStringWriter line_writer;
std::wstring str = std::to_wstring( (int)(pen.Size * 36000));
line_writer.WriteString(L"<a:ln w=\"" + str + L"\">");
std::wstring strL;
switch(pen.LineStyle)
{
case 1: strL = L" cmpd=\"dbl\""; break;
case 2: strL = L" cmpd=\"thickThin\""; break;
case 3: strL = L" cmpd=\"thinThick\""; break;
case 4: strL = L" cmpd=\"tri\""; break;
}
line_writer.WriteString(L"<a:ln w=\"" + std::to_wstring((int)(pen.Size * 36000)) + L"\"" + strL + L">");
line_writer.WriteString(L"<a:solidFill>");
line_writer.WriteString(ConvertColor(pen.Color, pen.Alpha));
line_writer.WriteString(L"</a:solidFill>");
line_writer.WriteString(L"<a:round/><a:headEnd/><a:tailEnd/></a:ln>");
switch(pen.DashStyle)
{
case 1: line_writer.WriteString(L"<a:prstDash val=\"sysDash\"/>"); break;
case 2: line_writer.WriteString(L"<a:prstDash val=\"sysDot\"/>"); break;
case 3: line_writer.WriteString(L"<a:prstDash val=\"sysDashDot\"/>"); break;
case 4: line_writer.WriteString(L"<a:prstDash val=\"sysDashDotDot\"/>"); break;
case 5: line_writer.WriteString(L"<a:prstDash val=\"dot\"/>"); break;
case 6: line_writer.WriteString(L"<a:prstDash val=\"dash\"/>"); break;
case 7: line_writer.WriteString(L"<a:prstDash val=\"lgDash\"/>"); break;
case 8: line_writer.WriteString(L"<a:prstDash val=\"dashDot\"/>"); break;
case 9: line_writer.WriteString(L"<a:prstDash val=\"lgDashDot\"/>"); break;
case 10:line_writer.WriteString(L"<a:prstDash val=\"lgDashDotDot\"/>"); break;
}
switch(pen.LineJoin)
{
case 0: line_writer.WriteString(L"<a:bevel/>"); break;
case 1: line_writer.WriteString(L"<a:miter/>"); break;
case 2: line_writer.WriteString(L"<a:round/>"); break;
}
line_writer.WriteString(L"<a:headEnd" + ConvertLineEnd(pen.LineStartCap, pen.LineStartLength, pen.LineStartWidth) + L"/>");
line_writer.WriteString(L"<a:tailEnd" + ConvertLineEnd(pen.LineEndCap, pen.LineEndLength, pen.LineEndWidth) + L"/>");
line_writer.WriteString(L"</a:ln>");
return line_writer.GetData();
}
std::wstring NSPresentationEditor::CShapeWriter::ConvertLineEnd(unsigned char cap, unsigned char length, unsigned char width)
{
if (cap < 1) return L"";
std::wstring sResult;
switch(cap)
{
case 1: sResult += L" type=\"triangle\""; break;
case 2: sResult += L" type=\"stealth\""; break;
case 3: sResult += L" type=\"diamond\""; break;
case 4: sResult += L" type=\"oval\""; break;
case 5: sResult += L" type=\"arrow\""; break;
}
switch(length)
{
case 0: sResult += L" len=\"sm\""; break;
case 1: sResult += L" len=\"med\""; break;
case 2: sResult += L" len=\"lg\""; break;
}
switch(width)
{
case 0: sResult += L" w=\"sm\""; break;
case 1: sResult += L" w=\"med\""; break;
case 2: sResult += L" w=\"lg\""; break;
}
return sResult;
}
std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
{
NSPresentationEditor::CStringWriter brush_writer;
......
......@@ -213,6 +213,7 @@ namespace NSPresentationEditor
std::wstring ConvertShadow (CShadow & shadow);
std::wstring ConvertBrush (CBrush & brush);
static std::wstring ConvertColor (CColor & color, long alpha);
std::wstring ConvertLineEnd(unsigned char cap, unsigned char length, unsigned char width);
// тип рендерера-----------------------------------------------------------------------------
virtual HRESULT get_Type(LONG* lType) ;
//-------- Функции для работы со страницей --------------------------------------------------
......
......@@ -401,48 +401,47 @@ static std::string GetRecordName(DWORD dwType)
case RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12 : { strName = ("RoundTripNotesMasterTextStyles12"); break; }
case RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12 : { strName = ("RoundTripCustomTableStyles12"); break; }
//records greater then 0xF000 belong to with Microsoft Office Drawing format also known as Escher
case RECORD_TYPE_ESCHER_DGG_CONTAINER : { strName = ("Escher_DrawingGroupContainer"); break; }
case RECORD_TYPE_ESCHER_DGG : { strName = ("Escher_DrawingGroupRecord"); break; }
case RECORD_TYPE_ESCHER_CLSID : { strName = ("Escher_CLSID_Record"); break; }
case RECORD_TYPE_ESCHER_OPT : { strName = ("Escher_OPT"); break; }
case RECORD_TYPE_ESCHER_BSTORE_CONTAINER : { strName = ("Escher_BlipStoreContainer"); break; }
case RECORD_TYPE_ESCHER_BSE : { strName = ("Escher_BlipStoreEntry"); break; }
case RECORD_TYPE_ESCHER_BLIP_START : { strName = ("Escher_BlipStart"); break; }
case RECORD_TYPE_ESCHER_BLIP_END : { strName = ("Escher_BlipEnd"); break; }
case RECORD_TYPE_ESCHER_DG_CONTAINER : { strName = ("Escher_DrawingContainer"); break; }
case RECORD_TYPE_ESCHER_DG : { strName = ("Escher_DrawingRecord"); break; }
case RECORD_TYPE_ESCHER_REGROUPITEMS : { strName = ("Escher_RegGroupItems"); break; }
case RECORD_TYPE_ESCHER_COLORSCHEME : { strName = ("Escher_ColorSheme"); break; }
case RECORD_TYPE_ESCHER_SPGR_CONTAINER : { strName = ("Escher_GroupShapeContainer"); break; }
case RECORD_TYPE_ESCHER_SP_CONTAINER : { strName = ("Escher_ShapeContainer"); break; }
case RECORD_TYPE_ESCHER_SPGR : { strName = ("Escher_GroupShapeRecord"); break; }
case RECORD_TYPE_ESCHER_SP : { strName = ("Escher_ShapeRecord"); break; }
case RECORD_TYPE_ESCHER_TEXTBOX : { strName = ("Escher_TextBox"); break; }
case RECORD_TYPE_ESCHER_CLIENTTEXTBOX : { strName = ("Escher_ClientTextBox"); break; }
case RECORD_TYPE_ESCHER_ANCHOR : { strName = ("Escher_Anchor"); break; }
case RECORD_TYPE_ESCHER_CHILDANCHOR : { strName = ("Escher_ChildAnchor"); break; }
case RECORD_TYPE_ESCHER_CLIENTANCHOR : { strName = ("Escher_ClientAnchor"); break; }
case RECORD_TYPE_ESCHER_CLIENTDATA : { strName = ("Escher_ClientData"); break; }
case RECORD_TYPE_ESCHER_SOLVERCONTAINER : { strName = ("Escher_SolverContainer"); break; }
case RECORD_TYPE_ESCHER_CONNECTORRULE : { strName = ("Escher_ConnectorRule"); break; }
case RECORD_TYPE_ESCHER_ALIGNRULE : { strName = ("Escher_AlignRule"); break; }
case RECORD_TYPE_ESCHER_ARCRULE : { strName = ("Escher_ArcRule"); break; }
case RECORD_TYPE_ESCHER_CLIENTRULE : { strName = ("Escher_ClientRule"); break; }
case RECORD_TYPE_ESCHER_CALLOUTRULE : { strName = ("Escher_CallOutRule"); break; }
case RECORD_TYPE_ESCHER_SELECTION : { strName = ("Escher_Selection"); break; }
case RECORD_TYPE_ESCHER_COLORMRU : { strName = ("Escher_ColorMRU"); break; }
case RECORD_TYPE_ESCHER_DELETEDPSPL : { strName = ("Escher_DeletedPSPL"); break; }
case RECORD_TYPE_ESCHER_SPLITMENUCOLORS : { strName = ("Escher_SplitMenuColors"); break; }
case RECORD_TYPE_ESCHER_OLEOBJECT : { strName = ("Escher_OleObject"); break; }
case RECORD_TYPE_ESCHER_SECONDARY_OPT : { strName = ("Escher_SecondaryOPT"); break; }
case RECORD_TYPE_ESCHER_TETRIARY_OPT : { strName = ("Escher_TetriaryOPT"); break; }
case RECORD_TYPE_ESCHER_DGG_CONTAINER : { strName = ("DrawingGroupContainer"); break; }
case RECORD_TYPE_ESCHER_DGG : { strName = ("DrawingGroupRecord"); break; }
case RECORD_TYPE_ESCHER_CLSID : { strName = ("CLSID_Record"); break; }
case RECORD_TYPE_ESCHER_OPT : { strName = ("OPT"); break; }
case RECORD_TYPE_ESCHER_BSTORE_CONTAINER : { strName = ("BlipStoreContainer"); break; }
case RECORD_TYPE_ESCHER_BSE : { strName = ("BlipStoreEntry"); break; }
case RECORD_TYPE_ESCHER_BLIP_START : { strName = ("BlipStart"); break; }
case RECORD_TYPE_ESCHER_BLIP_END : { strName = ("BlipEnd"); break; }
case RECORD_TYPE_ESCHER_DG_CONTAINER : { strName = ("DrawingContainer"); break; }
case RECORD_TYPE_ESCHER_DG : { strName = ("DrawingRecord"); break; }
case RECORD_TYPE_ESCHER_REGROUPITEMS : { strName = ("RegGroupItems"); break; }
case RECORD_TYPE_ESCHER_COLORSCHEME : { strName = ("ColorSheme"); break; }
case RECORD_TYPE_ESCHER_SPGR_CONTAINER : { strName = ("GroupShapeContainer"); break; }
case RECORD_TYPE_ESCHER_SP_CONTAINER : { strName = ("ShapeContainer"); break; }
case RECORD_TYPE_ESCHER_SPGR : { strName = ("GroupShapeRecord"); break; }
case RECORD_TYPE_ESCHER_SP : { strName = ("ShapeRecord"); break; }
case RECORD_TYPE_ESCHER_TEXTBOX : { strName = ("TextBox"); break; }
case RECORD_TYPE_ESCHER_CLIENTTEXTBOX : { strName = ("ClientTextBox"); break; }
case RECORD_TYPE_ESCHER_ANCHOR : { strName = ("Anchor"); break; }
case RECORD_TYPE_ESCHER_CHILDANCHOR : { strName = ("ChildAnchor"); break; }
case RECORD_TYPE_ESCHER_CLIENTANCHOR : { strName = ("ClientAnchor"); break; }
case RECORD_TYPE_ESCHER_CLIENTDATA : { strName = ("ClientData"); break; }
case RECORD_TYPE_ESCHER_SOLVERCONTAINER : { strName = ("SolverContainer"); break; }
case RECORD_TYPE_ESCHER_CONNECTORRULE : { strName = ("ConnectorRule"); break; }
case RECORD_TYPE_ESCHER_ALIGNRULE : { strName = ("AlignRule"); break; }
case RECORD_TYPE_ESCHER_ARCRULE : { strName = ("ArcRule"); break; }
case RECORD_TYPE_ESCHER_CLIENTRULE : { strName = ("ClientRule"); break; }
case RECORD_TYPE_ESCHER_CALLOUTRULE : { strName = ("CallOutRule"); break; }
case RECORD_TYPE_ESCHER_SELECTION : { strName = ("Selection"); break; }
case RECORD_TYPE_ESCHER_COLORMRU : { strName = ("ColorMRU"); break; }
case RECORD_TYPE_ESCHER_DELETEDPSPL : { strName = ("DeletedPSPL"); break; }
case RECORD_TYPE_ESCHER_SPLITMENUCOLORS : { strName = ("SplitMenuColors"); break; }
case RECORD_TYPE_ESCHER_OLEOBJECT : { strName = ("OleObject"); break; }
case RECORD_TYPE_ESCHER_SECONDARY_OPT : { strName = ("SecondaryOPT"); break; }
case RECORD_TYPE_ESCHER_TETRIARY_OPT : { strName = ("TetriaryOPT"); break; }
default: break;
};
if ((dwType > RECORD_TYPE_ESCHER_BLIP_START) && (dwType < RECORD_TYPE_ESCHER_BLIP_END))
{
strName = ("Escher_Blip");
strName = ("Blip");
}
return strName;
......
......@@ -597,7 +597,6 @@ public:
if (bUsefLine)
pElement->m_bLine = bLine;
}break;
case lineStyle:
case lineDashStyle://from Complex
{
pElement->m_bLine = true;
......@@ -611,13 +610,11 @@ public:
pElement->m_oPen.Color = CorrectSysColor(pProperty->m_lValue, pElement, pTheme);
else
oAtom.ToColor(&pElement->m_oPen.Color);
break;
}
}break;
case lineOpacity:
{
pElement->m_oPen.Alpha = (BYTE)(std::min)(255, (int)CDirectory::NormFixedPoint(pProperty->m_lValue, 255));
break;
}
}break;
case lineBackColor:
{
SColorAtom oAtom;
......@@ -633,123 +630,48 @@ public:
{
pElement->m_oPen.Size = (double)pProperty->m_lValue / EMU_MM;
pElement->m_bLine = true;
break;
}
case lineDashing:
{
BYTE nDashStyle = 0;
switch (pProperty->m_lValue)
{
case 0:
{
nDashStyle = 0; // solid
}break;
case 1:
case 6:
case 7:
case lineStyle:
{
nDashStyle = 1; // dash
pElement->m_bLine = true;
pElement->m_oPen.LineStyle = pProperty->m_lValue;
}break;
case 2:
case 5:
case lineDashing:
{
nDashStyle = 2; // dot
pElement->m_bLine = true;
pElement->m_oPen.DashStyle = pProperty->m_lValue;
}break;
case 3:
case 8:
case 9:
case lineJoinStyle:
{
nDashStyle = 3; // dashdot
pElement->m_oPen.LineJoin = pProperty->m_lValue;
}break;
case 4:
case 10:
case lineStartArrowLength:
{
nDashStyle = 4;// dashdotdot
pElement->m_oPen.LineStartLength = pProperty->m_lValue;
}break;
default:
break;
};
pElement->m_bLine = true;
pElement->m_oPen.DashStyle = nDashStyle;
break;
}
case lineJoinStyle:
{
BYTE nLineJoin = 2;
switch (pProperty->m_lValue)
{
case 0:
case lineEndArrowLength:
{
nLineJoin = 1; // bevel
pElement->m_oPen.LineEndLength = pProperty->m_lValue;
}break;
case 1:
case lineStartArrowWidth:
{
nLineJoin = 1; // Miter
pElement->m_oPen.LineStartWidth = pProperty->m_lValue;
}break;
case 2:
case lineEndArrowWidth:
{
nLineJoin = 2; // round
pElement->m_oPen.LineEndWidth = pProperty->m_lValue;
}break;
default:
break;
};
pElement->m_oPen.LineJoin = nLineJoin;
break;
}
case lineStartArrowhead:
{
BYTE nStartCap = 0;
switch (pProperty->m_lValue)
{
case 1:
case 2:
case 5:
{
nStartCap = 0x14;
pElement->m_oPen.LineStartCap = pProperty->m_lValue;
}break;
case 3:
case 4:
{
nStartCap = 2;
}break;
default:
break;
};
pElement->m_oPen.LineStartCap = nStartCap;
break;
}
case lineEndArrowhead:
{
BYTE nEndCap = 0;
switch (pProperty->m_lValue)
{
case 1:
case 2:
case 5:
{
nEndCap = 0x14;
}break;
case 3:
case 4:
{
nEndCap = 2;
pElement->m_oPen.LineEndCap = pProperty->m_lValue;
}break;
default:
break;
};
pElement->m_oPen.LineEndCap = nEndCap;
break;
}
case shadowType:
{
pElement->m_oShadow.Type = pProperty->m_lValue;
}break;
case shadowOriginX://in emu, relative from center shape
{
......
......@@ -994,6 +994,10 @@
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Metric.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Shapes\BaseShape\PPTShape\PPTShape.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Slide.h"
>
......
......@@ -478,10 +478,17 @@ namespace NSPresentationEditor
long Alpha;
double Size;
BYTE DashStyle;
BYTE LineStartCap;
BYTE LineEndCap;
BYTE LineJoin;
unsigned char DashStyle;
unsigned char LineStyle;
unsigned char LineJoin;
unsigned char LineEndCap;
unsigned char LineEndLength;
unsigned char LineEndWidth;
unsigned char LineStartCap;
unsigned char LineStartLength;
unsigned char LineStartWidth;
double* DashPattern;
long Count;
......@@ -492,7 +499,6 @@ namespace NSPresentationEditor
double MiterLimit;
CColor Color2; //backLine
public:
void GetDashPattern(double* arrDashPattern, long& nCount) const
{
......@@ -579,10 +585,16 @@ namespace NSPresentationEditor
Alpha = 255;
Size = 0.26458;
DashStyle = 0;
LineStyle = 0; //single(Simple)
DashStyle = 0; //Solid
LineJoin = 2; //round
LineStartCap = 0;
LineEndCap = 0;
LineJoin = 0;
LineEndLength = 1; //med
LineStartLength = 1;
LineEndWidth = 1;
LineStartWidth = 1;
DashPattern = NULL;
Count = 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