Commit 6e06584d authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

PptFormat - Тікбұрышты үшбұрыштарды.ppt - угол заливки градиента,...

PptFormat - Тікбұрышты үшбұрыштарды.ppt - угол заливки градиента, NotchedCircularArrow (кривой), подстройчные и надстрочные буквы, ...
parent d2abe171
#include "ShapeWriter.h"
#include "ShapeWriter.h"
#include "StylesWriter.h"
#include "../../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ShapeType.h"
......@@ -10,7 +10,7 @@
void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLevel, NSPresentationEditor::CMetricInfo& oMetricInfo,
NSPresentationEditor::CStringWriter& oWriter, const int& nLevel)
{// CTextPFRun CTextCFRun ShapeWriter - todooo -
{//дублирование CTextPFRun и CTextCFRun с ShapeWriter - todooo - вынести отдельно
CString str1;
if (nLevel == 9)
str1 = _T("<a:defPPr");
......@@ -305,6 +305,12 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
NSPresentationEditor::CStringWriter brush_writer;
if (brush.Type == c_BrushTypeTexture)
{
if (m_pImageElement)//фон для картинки с празрачностью
{
brush_writer.WriteString(std::wstring(L"<a:noFill/>"));
}
else
{
CString strRid = m_pRels->WriteImage(brush.TexturePath);
......@@ -317,6 +323,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
brush_writer.WriteString(std::wstring(L"</a:blipFill>"));
}
}
else if ( brush.Type == c_BrushTypeNoFill)
{
brush_writer.WriteString(std::wstring(L"<a:noFill/>"));
......@@ -350,11 +357,23 @@ CString NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
brush_writer.WriteString(std::wstring(L"</a:gs>"));
}
brush_writer.WriteString(std::wstring(L"</a:gsLst>"));
brush_writer.WriteString(std::wstring(L"<a:lin ang=\"5400000\" scaled=\"1\"/>"));
brush_writer.WriteString(std::wstring(L"<a:lin ang=\""));
{
if (brush.LinearAngle < -180) brush.LinearAngle += 180;
if (brush.LinearAngle > 180) brush.LinearAngle -= 180;
int val = (90 - brush.LinearAngle) ;
if (val < 0) val = 0;
if (val > 360) val -= 360;
CString str; str.Format(_T("%d"), val * 60000);
brush_writer.WriteString(str);
}
brush_writer.WriteString(std::wstring(L"\" scaled=\"1\"/>"));
brush_writer.WriteString(std::wstring(L"</a:gradFill>"));
}
else if(brush.Type == c_BrushTypePattern)
{// - -
{//типов нету в ппт - вместо них шаблон-картинка
brush_writer.WriteString(std::wstring(L"<a:pattFill prst=\"pct80\">"));
brush_writer.WriteString(std::wstring(L"<a:fgClr>"));
brush_writer.WriteString(ConvertColor(brush.Color1, brush.Alpha1));
......@@ -545,7 +564,7 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
m_oWriter.WriteString(std::wstring(L"\""));
//if (!m_pImageElement->m_sDescription.empty())
//{//
//{//бывает всякая разная бяка сохранена
// m_oWriter.WriteString(std::wstring(L" descr=\""));
// m_oWriter.WriteStringXML(m_pImageElement->m_sDescription);
// m_oWriter.WriteString(std::wstring(L"\""));
......@@ -707,7 +726,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
std::wstring prstTxWarp = oox::Spt2WordArtShapeType((oox::MSOSPT)m_pShapeElement->m_lShapeType);
m_oWriter.WriteString(std::wstring(L"<a:prstTxWarp"));
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstTxWarp + _T("\">"));
m_oWriter.WriteString(std::wstring(L"<a:avLst>"));//
m_oWriter.WriteString(std::wstring(L"<a:avLst>"));//модификаторы
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_oShape.m_pShape);
CString strVal;
......@@ -718,7 +737,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
case oox::msosptTextFadeUp:
{
double kf = 4.63; //""
double kf = 4.63; //"волшебный"
strVal.Format(L"%d", (int)(kf * pPPTShape->m_arAdjustments[i]));
m_oWriter.WriteString(std::wstring(L"<a:gd name=\"adj\" fmla=\"val "));
m_oWriter.WriteString(strVal + _T("\"/>"));
......@@ -806,7 +825,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
CString _str2 = _T(">");
m_oWriter.WriteString(_str2);
double dKoef1 = 3.52777778; // :-) ...
double dKoef1 = 3.52777778; // :-) чё это не понятно ...
if (pPF->lineSpacing.is_init())
{
LONG val = pPF->lineSpacing.get();
......@@ -979,8 +998,12 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
if ((pCF->Size.is_init()) && (pCF->Size.get() > 0) && (pCF->Size.get() < 4001))
{
CString strProp = _T("");
strProp.Format(_T(" sz=\"%d\""), (int)(100 * pCF->Size.get()));
CString strProp; strProp.Format(_T(" sz=\"%d\""), (int)(100 * pCF->Size.get()));
m_oWriter.WriteString(strProp);
}
if (pCF->BaseLineOffset.is_init())
{
CString strProp; strProp.Format(_T(" baseline=\"%d\""), (int)(1000 * pCF->BaseLineOffset.get()));
m_oWriter.WriteString(strProp);
}
if (pCF->FontBold.is_init())
......@@ -1015,7 +1038,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(std::wstring(L">"));
if (m_bWordArt)
{// - , , !!!
{//порядок важен - линия, заливка, тень !!!
if (m_pShapeElement->m_bLine)
{
m_oWriter.WriteString(ConvertLine(m_pShapeElement->m_oPen));
......@@ -1156,6 +1179,9 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"<a:xfrm"));
if (0 != m_pShapeElement->m_dRotate)
{
if (m_pShapeElement->m_bFlipH && m_pShapeElement->m_dRotate < 180)
m_pShapeElement->m_dRotate += 180; //Тікбұрышты үшбұрыштарды.ppt slide-7
str.Format(L" rot=\"%d\"", (int)(m_pShapeElement->m_dRotate * 60000));
m_oWriter.WriteString(str);
}
......@@ -1182,12 +1208,12 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"</a:xfrm>"));
}
if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic)
if (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Graphic || m_pShapeElement->m_oShape.m_pShape->m_bCustomShape)
{
m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
}
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty())
if ((prstGeom.empty() == false || m_pShapeElement->m_bShapePreset) && prstTxWarp.empty() && !m_pShapeElement->m_oShape.m_pShape->m_bCustomShape)
{
if (prstGeom.empty()) prstGeom = L"rect";
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
......@@ -1235,7 +1261,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage()
if (m_pImageElement->m_bImagePresent == false)
{
if (m_pImageElement->m_sName.empty()) return _T("");
//ppt_presentation.ppt -
//ppt_presentation.ppt - ссылка на файл на диске
m_pImageElement->m_strImageFileName.clear();
m_pImageElement->m_bImagePresent = true;
......@@ -1355,7 +1381,7 @@ HRESULT NSPresentationEditor::CShapeWriter::get_Type(LONG* lType)
*lType = c_nSVGConverter;
return S_OK;
}
//-------- --------------------------------------------------
//-------- Функции для работы со страницей --------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::NewPage()
{
return S_OK;
......@@ -1840,7 +1866,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_EdgeDist(double val)
m_oEdge.Dist = val;
return S_OK;
}
//-------- --------------------------------------------------------
//-------- Функции для вывода текста --------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h)
{
if (c_nHyperlinkType == m_lCurrentCommandType)
......@@ -1909,7 +1935,7 @@ HRESULT NSPresentationEditor::CShapeWriter::CommandDrawTextEx(const std::wstring
}
return S_OK;
}
//-------- ---------------------------------------------------------------
//-------- Маркеры для команд ---------------------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::BeginCommand(const DWORD& lType)
{
if (c_nPathType == lType)
......@@ -1926,7 +1952,7 @@ HRESULT NSPresentationEditor::CShapeWriter::EndCommand(const DWORD& lType)
m_lCurrentCommandType = -1;
return S_OK;
}
//-------- Graphics Path -----------------------------------------------
//-------- Функции для работы с Graphics Path -----------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::PathCommandMoveTo(const double& x, const double& y)
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
......@@ -2080,7 +2106,7 @@ HRESULT NSPresentationEditor::CShapeWriter::PathCommandTextEx(const std::wstring
m_oFont.StringGID = bGid;
return S_OK;
}
//-------- ---------------------------------------------------
//-------- Функции для вывода изображений ---------------------------------------------------
HRESULT NSPresentationEditor::CShapeWriter::DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h)
{
return S_OK;
......
......@@ -40,11 +40,11 @@ namespace NSPresentationEditor
{
public:
std::vector<long> m_arAdjustments;
std::vector<double> Guides;
std::vector<double> m_arGuides;
public:
LONG m_eJoin;
bool m_bConcentricFill;
bool m_bCustomShape;
std::vector<SimpleTypes::CPoint> m_arConnectors;
std::vector<LONG> m_arConnectorAngles;
......@@ -61,9 +61,11 @@ namespace NSPresentationEditor
LONG m_lLimoY;
CPath m_oPath;
public:
CBaseShape()
{
m_bCustomShape = false;
}
virtual bool LoadFromXML(const CString& xml) = 0;
......@@ -112,9 +114,9 @@ namespace NSPresentationEditor
for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
Guides.clear();
for(int i = 0; i < Shape->Guides.size(); i++)
Guides.push_back(Shape->Guides[i]);
m_arGuides.clear();
for(int i = 0; i < Shape->m_arGuides.size(); i++)
m_arGuides.push_back(Shape->m_arGuides[i]);
m_eJoin = Shape->m_eJoin;
m_bConcentricFill = Shape->m_bConcentricFill;
......@@ -154,9 +156,9 @@ namespace NSPresentationEditor
for(int i = 0; i < m_arAdjustments.size(); i++)
Shape->m_arAdjustments.push_back(m_arAdjustments[i]);
Shape->Guides.clear();
for(int i = 0; i < Guides.size(); i++)
Shape->Guides.push_back(Guides[i]);
Shape->m_arGuides.clear();
for(int i = 0; i < m_arGuides.size(); i++)
Shape->m_arGuides.push_back(m_arGuides[i]);
Shape->m_eJoin = m_eJoin;
Shape->m_bConcentricFill = m_bConcentricFill;
......
......@@ -21,6 +21,7 @@ CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type)
case sptNotchedCircularArrow:
case sptHostControl:
{ pShape = new CPPTShape(); pShape->m_eType = type; break; }
case 0: { pShape = new CRectangleType(); break; }
//CREATE_BY_SPT(sptMin, CLineType)
......
......@@ -2435,6 +2435,7 @@ namespace NSGuidesVML
switch (eParamType)
{
case ptFormula:
if (bExtShape || lParam < m_arIndexDst.size())
{
oWriter.m_oWriter.AddCharNoCheck((WCHAR)'g');
oWriter.m_oWriter.AddCharNoCheck((WCHAR)'d');
......
......@@ -250,7 +250,7 @@ public:
NSGuidesOOXML::CFormulaManager FManager;
public:
CPPTXShape() : CBaseShape(), FManager(m_arAdjustments, Guides)
CPPTXShape() : CBaseShape(), FManager(m_arAdjustments, m_arGuides)
{
m_eType = OOXMLShapes::sptMin;
}
......
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