Commit c05c02cd authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

PPTFormat правки по результатам тестирования, убрано лишнее

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65567 954022d7-b5bf-4e40-9824-e11837661b57
parent e3f5f625
......@@ -68,7 +68,7 @@ HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs
m_Status = NULLMODE;
return S_FALSE;
}
if (0 < ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers.size())
if (!((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers.empty())
{
NSPresentationEditor::CPPTXWriter oPPTXWriter;
oPPTXWriter.m_strTempDirectory = std_string2string(sDstPath);
......
......@@ -18,14 +18,17 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(),
m_mapSlides(),
m_arOffsetPictures()
{
m_pDocumentInfo = NULL;
m_lIndexThisUser = -1;
m_pDocumentInfo = NULL;
m_lIndexThisUser = -1;
m_nWriteSlideTimeOffset = 0.0;
m_nWriteSlideTime = 0.0;
m_strFileDirectory = _T("");
m_bIsSetupEmpty = false;
m_strFileDirectory = _T("");
m_bIsSetupEmpty = false;
m_bRtl = false;
m_bShowComments = false;
}
CPPTUserInfo::~CPPTUserInfo()
......@@ -297,9 +300,6 @@ void CPPTUserInfo::FromDocument()
if (oSI[0]->m_oSIRun.bLang)
m_wLanguage = oSI[0]->m_oSIRun.Lang;
if (oSI[0]->m_oSIRun.bBidi)
m_bBidi = oSI[0]->m_oSIRun.Bidi;
m_oDefaultTextStyle.SetLanguage(m_wLanguage);
}
}
......@@ -312,6 +312,9 @@ void CPPTUserInfo::FromDocument()
m_oInfo.m_lMillimetresHor = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginWidth);
m_oInfo.m_lMillimetresVer = (LONG)(c_dMasterUnitsToMillimetreKoef * lOriginHeight);
m_bRtl = (oArrayDoc[0]->m_bRightToLeft!=0);
m_bShowComments = (oArrayDoc[0]->m_bShowComments!=0);
LoadMasters(lOriginWidth, lOriginHeight);
double DurationSlide = PPT_DEFAULT_SLIDE_DURATION;
......
......@@ -66,8 +66,8 @@ public:
std::vector<CColor> m_oSchemeColors;
nullable<WORD> m_wLanguage; // ()
nullable<bool> m_bBidi; // bi-direction
bool m_bRtl;
bool m_bShowComments;
public:
CPPTUserInfo();
......
......@@ -7,6 +7,73 @@
using namespace NSPresentationEditor;
namespace NSPresentationEditor
{
static CColor GetStandartPaletteColor(int index)
{
CColor color;
static BYTE palette [56][3] =
{
{ 0 , 0 , 0 },
{ 255 , 255 , 255 },
{ 255 , 0 , 0 },
{ 0 , 255 , 0 },
{ 0 , 0 , 255 },
{ 255 , 255 , 0 },
{ 255 , 0 , 255 },
{ 0 , 255 , 255 },
{ 128 , 0 , 0 },
{ 0 , 128 , 0 },
{ 0 , 0 , 128 },
{ 128 , 128 , 0 },
{ 128 , 0 , 128 },
{ 0 , 128 , 128 },
{ 192 , 192 , 192 },
{ 128 , 128 , 128 },
{ 153 , 153 , 255 },
{ 153 , 51 , 102 },
{ 255 , 255 , 204 },
{ 204 , 255 , 255 },
{ 102 , 0 , 102 },
{ 255 , 128 , 128 },
{ 0 , 102 , 204 },
{ 204 , 204 , 255 },
{ 0 , 0 , 128 },
{ 255 , 0 , 255 },
{ 255 , 255 , 0 },
{ 0 , 255 , 255 },
{ 128 , 0 , 128 },
{ 128 , 0 , 0 },
{ 0 , 128 , 128 },
{ 0 , 0 , 255 },
{ 0 , 204 , 255 },
{ 204 , 255 , 255 },
{ 204 , 255 , 204 },
{ 255 , 255 , 153 },
{ 153 , 204 , 255 },
{ 255 , 153 , 204 },
{ 204 , 153 , 255 },
{ 255 , 204 , 153 },
{ 51 , 102 , 255 },
{ 51 , 204 , 204 },
{ 153 , 204 , 0 },
{ 255 , 204 , 0 },
{ 255 , 153 , 0 },
{ 255 , 102 , 0 },
{ 102 , 102 , 153 },
{ 150 , 150 , 150 },
{ 0 , 51 , 102 },
{ 51 , 153 , 102 },
{ 0 , 51 , 0 },
{ 51 , 51 , 0 },
{ 153 , 51 , 0 },
{ 153 , 51 , 102 },
{ 51 , 51 , 153 }
};
color.SetRGB(palette[index][0], palette[index][1], palette[index][2]);
return color;
}
}
namespace NSZLib
{
......@@ -272,7 +339,11 @@ void CTextPFRun_ppt::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation)
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10)
//if (oColorAtom.Index < 64 && oColorAtom.bPaletteIndex) 1-(23).ppt
//{
// oColor = NSPresentationEditor::GetStandartPaletteColor(oColorAtom.Index);
//}
if (oColorAtom.Index < 10 && oColorAtom.bSchemeIndex)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
......@@ -428,7 +499,11 @@ void CTextCFRun_ppt::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation)
oColor.A = 255;
oColor.m_lSchemeIndex = -1;
if (oColorAtom.Index < 10/* && oColorAtom.bSchemeIndex*/)
//if (oColorAtom.Index < 64 && oColorAtom.bPaletteIndex && !oColorAtom.bPaletteRGB)
//{
// oColor = NSPresentationEditor::GetStandartPaletteColor(oColorAtom.Index);
//}
if (oColorAtom.Index < 10 && oColorAtom.bSchemeIndex)
{
oColor.m_lSchemeIndex = oColorAtom.Index;
NSPresentationEditor::CorrectColorPPT(oColor.m_lSchemeIndex);
......@@ -469,9 +544,11 @@ namespace NSPresentationEditor
oAttributes.m_arParagraphs.push_back(elm);
NSPresentationEditor::CParagraph* pPar = &oAttributes.m_arParagraphs[nIndexPF];
pPar->m_oPFRun = oArrayPF[nIndexPF].m_oRun;
pPar->m_lTextType = oAttributes.m_lTextType;
pPar->m_lTextLevel = oArrayPF[nIndexPF].m_lLevel;
pPar->m_lTextLevel = oArrayPF[nIndexPF].m_lLevel;
pPar->m_oPFRun = oArrayPF[nIndexPF].m_oRun;
pPar->m_lTextType = oAttributes.m_lTextType;
pPar->m_lStyleThemeIndex = oAttributes.m_lStyleThemeIndex;
int nCountInPF = oArrayPF[nIndexPF].m_lCount;
......
......@@ -1644,17 +1644,20 @@ public:
pShapeElem->m_rcBounds.top = dCy - dW / 2.0;
pShapeElem->m_rcBounds.bottom = dCy + dW / 2.0;
}
pSlideWrapper->m_mapElements.insert(std::pair<LONG, CElementInfo>(pShapeElem->m_lID, oElementInfo));
SetUpTextStyle(strText, pTheme, pLayout, pElem, pThemeWrapper, pSlideWrapper, pSlide);
//------------------------------------------------------------------------------------
std::vector<CRecordMasterTextPropAtom*> oArrayMasterTextProp;
GetRecordsByType(&oArrayMasterTextProp, true);
CRecordMasterTextPropAtom* master_level = NULL;
if (!oArrayMasterTextProp.empty())
{
SetUpTextMasterIndent(pElem, oArrayMasterTextProp[0]);
}
master_level = oArrayMasterTextProp[0];
pSlideWrapper->m_mapElements.insert(std::pair<LONG, CElementInfo>(pShapeElem->m_lID, oElementInfo));
SetUpTextStyle(strText, pTheme, pLayout, pElem, pThemeWrapper, pSlideWrapper, pSlide, master_level);
//------------------------------------------------------------------------------------
}
else
{
......@@ -1751,28 +1754,31 @@ public:
protected:
void SetUpTextMasterIndent(IElement* pElem, CRecordMasterTextPropAtom* master_levels)
void ApplyThemeStyle(IElement* pElem, CTheme* pTheme, CRecordMasterTextPropAtom* master_levels)
{
CShapeElement* pShape = dynamic_cast<CShapeElement*>(pElem);
if (NULL == pShape)
return;
if (master_levels->m_arrProps.empty()) return;
CTextAttributesEx* pText = &(pShape->m_oShape.m_oText);
int pos_text = 0, pos_si = 0;
int ind = 0;
for (int i = 0; i < pText->m_arParagraphs.size(); i++)
if (master_levels)
{
if (i >= master_levels->m_arrProps.size()) break;
pText->m_arParagraphs[i].m_lTextLevel = master_levels->m_arrProps[i].lIndentLevel;
pText->m_arParagraphs[i].m_oPFRun.leftMargin.reset();
pText->m_arParagraphs[i].m_oPFRun.indent.reset();
for (int i = 0; i < pText->m_arParagraphs.size(); i++)
{
if (i >= master_levels->m_arrProps.size()) break;
pText->m_arParagraphs[i].m_lTextLevel = master_levels->m_arrProps[i].lIndentLevel;
pText->m_arParagraphs[i].m_oPFRun.leftMargin.reset();
pText->m_arParagraphs[i].m_oPFRun.indent.reset();
}
}
pText->ApplyThemeStyle(pTheme);
}
void SetUpTextStyle(std::wstring& strText, CTheme* pTheme, CLayout* pLayout, IElement* pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide = NULL)
void SetUpTextStyle(std::wstring& strText, CTheme* pTheme, CLayout* pLayout, IElement* pElem, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide, CRecordMasterTextPropAtom* master_levels)
{
// shape
// -
......@@ -1909,7 +1915,7 @@ protected:
case NSOfficePPT::MasterTitle:
case NSOfficePPT::VerticalTextTitle:
{
pTextSettings->m_lTextType = 1;
pTextSettings->m_lStyleThemeIndex = 1;
if (NSOfficePPT::_Title != eTypeMaster)
{
......@@ -1924,7 +1930,7 @@ protected:
case NSOfficePPT::CenteredTitle:
case NSOfficePPT::MasterCenteredTitle:
{
pTextSettings->m_lTextType = 1;
pTextSettings->m_lStyleThemeIndex = 1;
if (NSOfficePPT::_Title != eTypeMaster)
{
......@@ -1944,9 +1950,9 @@ protected:
case NSOfficePPT::MasterSubtitle:
case NSOfficePPT::Subtitle:
{
pTextSettings->m_lTextType = 2;
pTextSettings->m_lStyleThemeIndex = 2;
if (NSOfficePPT::_Body != eTypeMaster)
if ((NSOfficePPT::_Body != eTypeMaster) || !pLayout)
{
if (0 <= nTextMasterType && nTextMasterType < 9)
{
......@@ -1958,9 +1964,9 @@ protected:
}
default:
{
pTextSettings->m_lTextType = 3;
pTextSettings->m_lStyleThemeIndex = 3;
if (NSOfficePPT::Other != eTypeMaster)
if ((NSOfficePPT::Other != eTypeMaster) || !pLayout)
{
if (0 <= nTextMasterType && nTextMasterType < 9)
{
......@@ -2016,6 +2022,7 @@ protected:
{
pTextSettings->m_oLayoutStyles = pElementLayoutPH->m_oShape.m_oText.m_oStyles;
pTextSettings->m_lTextType = pElementLayoutPH->m_oShape.m_oText.m_lTextType;
pTextSettings->m_lStyleThemeIndex = pElementLayoutPH->m_oShape.m_oText.m_lStyleThemeIndex;
}
else
{
......@@ -2025,13 +2032,13 @@ protected:
case NSOfficePPT::MasterTitle:
case NSOfficePPT::VerticalTextTitle:
{
pTextSettings->m_lTextType = 1;
pTextSettings->m_lStyleThemeIndex = 1;
break;
}
case NSOfficePPT::CenteredTitle:
case NSOfficePPT::MasterCenteredTitle:
{
pTextSettings->m_lTextType = 1;
pTextSettings->m_lStyleThemeIndex = 1;
break;
}
case NSOfficePPT::Body:
......@@ -2040,12 +2047,12 @@ protected:
case NSOfficePPT::MasterNotesBody:
case NSOfficePPT::VerticalTextBody:
{
pTextSettings->m_lTextType = 2;
pTextSettings->m_lStyleThemeIndex = 2;
break;
}
default:
{
pTextSettings->m_lTextType = 3;
pTextSettings->m_lStyleThemeIndex = 3;
break;
}
}
......@@ -2053,7 +2060,7 @@ protected:
}
else
{
pTextSettings->m_lTextType = 0;
pTextSettings->m_lStyleThemeIndex = 0;
}
// (persist own) - m_oStyles
......@@ -2124,18 +2131,20 @@ protected:
}
StreamUtils::StreamSeek(lPosition, oElemInfo.m_pStream);
}
pShape->m_oShape.m_oText.RecalcParagraphsPPT(pTheme);
pShape->m_oShape.m_oText.RecalcParagraphsPPT();
ApplyThemeStyle(pElem, pTheme, master_levels);
if (pShape->m_oActions.m_bPresent)
{
//todooo
/* NSPresentationEditor::CColor oColor;
//todooo - 1-(34).ppt
NSPresentationEditor::CColor oColor;
if ((NULL != pSlide) && !pSlide->m_bUseLayoutColorScheme) oColor = pSlide->GetColor(11);
else if ((NULL != pLayout) && (!pLayout->m_bUseThemeColorScheme)) oColor = pLayout->GetColor(11);
else if (NULL != pTheme) oColor = pTheme->GetColor(11);
oColor.m_lSchemeIndex = 1*/1;
oColor.m_lSchemeIndex = 11;
/*ApplyHyperlink(pShape, oColor);*/
ApplyHyperlink(pShape, oColor);
}
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShape->m_oShape.m_pShape);
......
......@@ -19,15 +19,17 @@ public:
std::wstring m_strText;
DWORD m_nTextType;
DWORD m_lStyleThemeIndex;
public:
CTextFullSettings() : m_arRanges()
{
m_pTextStyleProp = NULL;
m_pTextSpecInfo = NULL;
m_pTextRuler = NULL;
m_pTextStyleProp = NULL;
m_pTextSpecInfo = NULL;
m_pTextRuler = NULL;
m_nTextType = 0xFFFFFFFF;
m_nTextType = 0xFFFFFFFF;
m_lStyleThemeIndex = 0; //default
m_strText.clear();
}
CTextFullSettings(const CTextFullSettings& oSrc)
......@@ -36,12 +38,13 @@ public:
}
CTextFullSettings& operator =(const CTextFullSettings& oSrc)
{
m_pTextStyleProp = oSrc.m_pTextStyleProp;
m_pTextSpecInfo = oSrc.m_pTextSpecInfo;
m_pTextRuler = oSrc.m_pTextRuler;
m_pTextStyleProp = oSrc.m_pTextStyleProp;
m_pTextSpecInfo = oSrc.m_pTextSpecInfo;
m_pTextRuler = oSrc.m_pTextRuler;
m_lStyleThemeIndex = oSrc.m_lStyleThemeIndex;
m_nTextType = oSrc.m_nTextType;
m_strText = oSrc.m_strText;
m_nTextType = oSrc.m_nTextType;
m_strText = oSrc.m_strText;
m_arRanges = oSrc.m_arRanges;
return (*this);
......@@ -58,7 +61,9 @@ public:
if (NULL == pTextAttributes)
return m_strText;
pTextAttributes->m_lTextType = m_nTextType;
pTextAttributes->m_lTextType = m_nTextType;
pTextAttributes->m_lStyleThemeIndex = m_lStyleThemeIndex;
if (NULL != m_pTextStyleProp)
NSPresentationEditor::ConvertPPTTextToEditorStructure(m_pTextStyleProp->m_arrPFs, m_pTextStyleProp->m_arrCFs, m_strText, *pTextAttributes);
......
......@@ -56,7 +56,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;../../../DesktopEditor/freetype-2.5.2/include&quot;"
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_SVG_CONVERT_TO_IMAGE_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;_PRESENTATION_WRITER_"
PreprocessorDefinitions="_DEBUG;_LIB;_USE_MATH_DEFINES;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;PPT_FORMAT;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -986,46 +986,6 @@
RelativePath="..\..\..\ASCPresentationEditor\PPTXWriter\StylesWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\SVGConverter.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\SVGConverter.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\SVGFramework.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\SVGFramework.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\SVGTransformer.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\SVGTransformer.h"
>
</File>
<File
RelativePath="..\..\..\ASCPresentationEditor\OfficeDrawing\TextAttributesEx.cpp"
>
......
......@@ -1092,8 +1092,8 @@ namespace NSPresentationEditor
void SetDefaultParams()
{
Visible = false;
DistanceX = 0.1;
DistanceY = 0.1;
DistanceX = 0.5;
DistanceY = 0.5;
BlurSize = 0;
Alpha = 255;
......
......@@ -2,14 +2,6 @@
#include "Theme.h"
#include "Shapes/Shape.h"
#ifdef _SVG_CONVERT_TO_IMAGE_
#include "SVGTransformer.h"
#endif
#ifdef _PRESENTATION_WRITER_
#include "SVGConverter.h"
#endif
#ifndef DISABLE_FILE_DOWNLOADER
#include "../../Common/FileDownloader.h"
#endif
......@@ -505,73 +497,73 @@ namespace NSPresentationEditor
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
CString strXml = SaveToXML();
oWriter.WriteString(strXml);
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual CString SaveToXML()
{
if (!m_oAnimations.m_arAnimations.empty())
return ToAnimationXml();
CGeomShapeInfo oInfo;
oInfo.SetBounds(m_rcBounds);
oInfo.m_dRotate = m_dRotate;
oInfo.m_bFlipH = m_bFlipH;
oInfo.m_bFlipV = m_bFlipV;
return m_oShape.ToXml(oInfo, m_oMetric, m_dStartTime, m_dEndTime, m_pTheme, m_pLayout);
}
CString ToAnimationXml()
{
CGeomShapeInfo oInfo;
oInfo.SetBounds(m_rcBounds);
oInfo.m_dRotate = m_dRotate;
oInfo.m_bFlipH = m_bFlipH;
oInfo.m_bFlipV = m_bFlipV;
m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
CString timeXML;
timeXML.Format(_T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
CString baseXML = m_oShape.ToXml(oInfo, m_oMetric, m_dStartTime, m_dEndTime, m_pTheme, m_pLayout);
if ( -1 != baseXML.Find ( _T("<ImagePaint-DrawTextEx") ) )
{
CString sBounds; // FIX
sBounds.Format(_T("<bounds left='%d' top='%d' right='%d' bottom='%d'/>"),
(LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom);
CString sReplace = m_oAnimations.ToXml(m_dStartTime, m_dEndTime) + timeXML + sBounds + _T("</ImagePaint-DrawTextAnimateEx>");
baseXML.Replace ( _T("</ImagePaint-DrawTextEx>"), sReplace );
baseXML.Replace ( _T("<ImagePaint-DrawTextEx"), _T("<ImagePaint-DrawTextAnimateEx") );
}
if ( -1 != baseXML.Find ( _T("<ImagePaint-DrawGraphicPath") ) )
{
CString sAnim = m_oAnimations.ToXml(m_dStartTime, m_dEndTime, true);
if (sAnim.GetLength())
{
CString sReplace = sAnim + timeXML + _T("</ImagePaint-DrawGraphicPathAnimate>");
baseXML.Replace ( _T("</ImagePaint-DrawGraphicPath>"), sReplace );
baseXML.Replace ( _T("<ImagePaint-DrawGraphicPath"), _T("<ImagePaint-DrawGraphicPathAnimate") );
}
}
return baseXML;
}
//virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
//{
// CString strXml = SaveToXML();
// oWriter.WriteString(strXml);
//}
//virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
//{
//}
//virtual CString SaveToXML()
//{
// if (!m_oAnimations.m_arAnimations.empty())
// return ToAnimationXml();
//
// CGeomShapeInfo oInfo;
// oInfo.SetBounds(m_rcBounds);
// oInfo.m_dRotate = m_dRotate;
// oInfo.m_bFlipH = m_bFlipH;
// oInfo.m_bFlipV = m_bFlipV;
// return m_oShape.ToXml(oInfo, m_oMetric, m_dStartTime, m_dEndTime, m_pTheme, m_pLayout);
//}
//CString ToAnimationXml()
//{
// CGeomShapeInfo oInfo;
// oInfo.SetBounds(m_rcBounds);
// oInfo.m_dRotate = m_dRotate;
// oInfo.m_bFlipH = m_bFlipH;
// oInfo.m_bFlipV = m_bFlipV;
// m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
// m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
// CString timeXML;
// timeXML.Format(_T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
//
// CString baseXML = m_oShape.ToXml(oInfo, m_oMetric, m_dStartTime, m_dEndTime, m_pTheme, m_pLayout);
// if ( -1 != baseXML.Find ( _T("<ImagePaint-DrawTextEx") ) )
// {
// CString sBounds; // FIX
// sBounds.Format(_T("<bounds left='%d' top='%d' right='%d' bottom='%d'/>"),
// (LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom);
// CString sReplace = m_oAnimations.ToXml(m_dStartTime, m_dEndTime) + timeXML + sBounds + _T("</ImagePaint-DrawTextAnimateEx>");
//
// baseXML.Replace ( _T("</ImagePaint-DrawTextEx>"), sReplace );
// baseXML.Replace ( _T("<ImagePaint-DrawTextEx"), _T("<ImagePaint-DrawTextAnimateEx") );
// }
// if ( -1 != baseXML.Find ( _T("<ImagePaint-DrawGraphicPath") ) )
// {
// CString sAnim = m_oAnimations.ToXml(m_dStartTime, m_dEndTime, true);
// if (sAnim.GetLength())
// {
// CString sReplace = sAnim + timeXML + _T("</ImagePaint-DrawGraphicPathAnimate>");
//
// baseXML.Replace ( _T("</ImagePaint-DrawGraphicPath>"), sReplace );
// baseXML.Replace ( _T("<ImagePaint-DrawGraphicPath"), _T("<ImagePaint-DrawGraphicPathAnimate") );
// }
// }
//
// return baseXML;
//}
virtual IElement* CreateDublicate()
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "../../DesktopEditor/graphics/IRenderer.h"
#include "SVGTransformer.h"
//HRESULT SVGTransformer::LoadFile (BSTR bstrFile)
//{
// m_oStorage.Clear();
//
// m_oXmlParser.SetWorkingDirectory(FileUtils::FilePath(CString(bstrFile)));
// m_oRender.SetWorkingDirectory(FileUtils::FilePath(CString(bstrFile)));
// m_oStorage.SetWorkingDirectory(FileUtils::FilePath(CString(bstrFile)));
//
// if (0 == m_oXmlParser.LoadFromFile (CString(bstrFile), &m_oStorage))
// return AVS_ERROR_FILEFORMAT;
//
// return S_OK;
//}
HRESULT SVGTransformer::Load (CString strXml)
{
m_oStorage.Clear();
if (0 == m_oXmlParser.LoadFromString (strXml, &m_oStorage))
return S_FALSE;
return S_OK;
}
HRESULT SVGTransformer::Draw (void* pUnk, double dX, double dY, double dWidth, double dHeight)
{
if (NULL == pUnk)
return S_FALSE;
IRenderer* render = (IRenderer*)pUnk;
//pUnk->QueryInterface (&render);
//pUnk->Release();
if (NULL == render)
return S_FALSE;
m_oRender.SetCSS(m_oXmlParser.GetCSS());
m_oRender.Draw(&m_oStorage, render, m_oXmlParser.GetUnitSystem());
return S_OK;
}
HRESULT SVGTransformer::get_Width (LONG* pWidth)
{
*pWidth = m_oXmlParser.GetWidth();
return S_OK;
}
HRESULT SVGTransformer::get_Height (LONG* pHeight)
{
*pHeight = m_oXmlParser.GetHeight();
return S_OK;
}
HRESULT SVGTransformer::get_Metrics (LONG* pMetrics)
{
*pMetrics = m_oXmlParser.GetMetics();
return S_OK;
}
//
//HRESULT SVGTransformer::SetAdditionalParam (BSTR ParamName, VARIANT ParamValue)
//{
// if (CString(L"DefaultWidth") == CComBSTR (ParamName))
// {
// m_oXmlParser.SetDefaultWidth(ParamValue.lVal);
// return S_OK;
// }
//
// if (CString(L"DefaultHeight") == CComBSTR (ParamName))
// {
// m_oXmlParser.SetDefaultHeight(ParamValue.lVal);
// return S_OK;
// }
//
// if (CString (L"WorkingDirectory") == ParamName)
// {
// m_oXmlParser.SetWorkingDirectory((CString)ParamValue.bstrVal);
// m_oRender.SetWorkingDirectory((CString)ParamValue.bstrVal);
// m_oStorage.SetWorkingDirectory((CString)ParamValue.bstrVal);
//
// return S_OK;
// }
//
// return S_OK;
//}
//
//HRESULT SVGTransformer::GetAdditionalParam (BSTR ParamName, VARIANT* ParamValue)
//{
// return S_OK;
//}
\ No newline at end of file
#pragma once
//#include "../../../Interfaces/AVSRenderer.h"
//#include "../../../../../AVSOfficeStudio/Common/OfficeFileErrorDescription.h"
//#include "../../../../../../../Common/GdiPlusEx.h"
//#include "../../DesktopEditor/graphics/IRenderer.h"
#include "SVGFramework.h"
// ISVGTransformer
//[
// object,
// uuid("89CCD2D4-3A3B-438C-A45F-7401AFB901A2"),
// dual, helpstring("ISVGTransformer Interface"),
// pointer_default(unique)
//]
//__interface ISVGTransformer : IDispatch
//{
// [id(10101)] HRESULT LoadFile([in] BSTR File);
// [id(10102)] HRESULT Load([in] BSTR Str);
//
// [id(10103)] HRESULT Draw([in] IUnknown* pUnk, [in] double dX, [in] double dY, [in] double dWidth, [in] double dHeight);
// [id(10104), propget] HRESULT Width([out, retval] LONG* Width);
// [id(10105), propget] HRESULT Height([out, retval] LONG* Height);
// [id(10106), propget] HRESULT Metrics([out, retval] LONG* Metrics);
//
// [id(10201)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
// [id(10202)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out] VARIANT * ParamValue);
//};
//
//// _ISVGDrawerEvents
//[
// dispinterface,
// uuid("541E44F9-BDE1-4425-BE00-9D952CE2A565"),
// helpstring("_ISVGTransformerEvents Interface")
//]
//__interface _ISVGTransformerEvents
//{
//
//};
//
//// CSVGDrawer
//
//[
// coclass,
// default(ISVGTransformer, _ISVGTransformerEvents),
// threading(apartment),
// event_source(com),
// vi_progid("AVSOfficeSVGFile.SVGTransformer"),
// progid("AVSOfficeSVGFile.SVGTransformer.1"),
// version(1.0),
// uuid("AB7920A5-428A-44FD-9C36-2398FA802F74"),
// helpstring("SVGDrawer Class")
//]
class /*ATL_NO_VTABLE */SVGTransformer /*: public ISVGTransformer*/
{
public:
SVGTransformer()
{
//m_oGdiPlusInit.Init();
}
//__event __interface _ISVGTransformerEvents;
//DECLARE_PROTECT_FINAL_CONSTRUCT()
//HRESULT FinalConstruct()
//{
// return S_OK;
//}
//void FinalRelease()
//{
//}
public:
//HRESULT ( LoadFile )( BSTR File );
HRESULT ( Load )( CString Str );
HRESULT ( Draw )( void* pRender, double dX, double dY, double dWidth, double dHeight );
HRESULT ( get_Width ) ( LONG* pWidth );
HRESULT ( get_Height ) ( LONG* pHeight );
HRESULT ( get_Metrics ) ( LONG* pMetrics );
//HRESULT ( SetAdditionalParam )( BSTR ParamName, VARIANT ParamValue );
//HRESULT ( GetAdditionalParam )( BSTR ParamName, VARIANT* ParamValue );
private:
//CGdiPlusInit m_oGdiPlusInit;
SVG::Parser m_oXmlParser;
SVG::Storage m_oStorage;
SVG::Painter m_oRender;
};
......@@ -115,14 +115,14 @@ public:
}
virtual CString GetTextXml(CGeomShapeInfo& oGeomInfo, CMetricInfo& pInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout)
{
if (m_oText.IsEmptyText())
return _T("");
//virtual CString GetTextXml(CGeomShapeInfo& oGeomInfo, CMetricInfo& pInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout)
//{
// if (m_oText.IsEmptyText())
// return _T("");
GetTextRect(oGeomInfo);
return m_oText.ToString(oGeomInfo, pInfo, dStartTime, dEndTime, pTheme, pLayout);
}
// GetTextRect(oGeomInfo);
// return m_oText.ToString(oGeomInfo, pInfo, dStartTime, dEndTime, pTheme, pLayout);
//}
//virtual CString GetBrushXml()
......@@ -285,29 +285,29 @@ public:
oInfo.bottom = dTop + dHeight;
}
virtual CString ToXml(CGeomShapeInfo& oGeomInfo, CMetricInfo& pInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout)
{
CString strImageTransform = _T("");
oGeomInfo.m_dLimoX = m_lLimoX;
oGeomInfo.m_dLimoY = m_lLimoY;
m_pShape->m_oPath.SetCoordsize((LONG)m_dWidthLogic, (LONG)m_dHeightLogic);
CBrush brush; //
CPen pen;
CString strDrawing = m_pShape->ToXML(oGeomInfo, pInfo, dStartTime, dEndTime, brush, pen);
if (m_lDrawType & c_ShapeDrawType_Graphic)
{
strImageTransform += strDrawing;
}
if (m_lDrawType & c_ShapeDrawType_Text)
{
strImageTransform += GetTextXml(oGeomInfo, pInfo, dStartTime, dEndTime, pTheme, pLayout);
}
return strImageTransform;
}
//virtual CString ToXml(CGeomShapeInfo& oGeomInfo, CMetricInfo& pInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout)
//{
// CString strImageTransform = _T("");
// oGeomInfo.m_dLimoX = m_lLimoX;
// oGeomInfo.m_dLimoY = m_lLimoY;
// m_pShape->m_oPath.SetCoordsize((LONG)m_dWidthLogic, (LONG)m_dHeightLogic);
//
// CBrush brush; //
// CPen pen;
// CString strDrawing = m_pShape->ToXML(oGeomInfo, pInfo, dStartTime, dEndTime, brush, pen);
// if (m_lDrawType & c_ShapeDrawType_Graphic)
// {
// strImageTransform += strDrawing;
// }
// if (m_lDrawType & c_ShapeDrawType_Text)
// {
// strImageTransform += GetTextXml(oGeomInfo, pInfo, dStartTime, dEndTime, pTheme, pLayout);
// }
// return strImageTransform;
//}
void ToRenderer(IRenderer* pRenderer, CGeomShapeInfo& oGeomInfo, CMetricInfo& pInfo, double dStartTime, double dEndTime)
{
......
......@@ -3,12 +3,8 @@
namespace NSPresentationEditor
{
CString CTextAttributesEx::ToString(CGeomShapeInfo& oInfo, CMetricInfo& pMetricInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout)
{
return L"";
}
void CTextAttributesEx::RecalcParagraphsPPT(CTheme* pTheme)
void CTextAttributesEx::RecalcParagraphsPPT()
{
for (int i = 0; i < m_arParagraphs.size(); ++i)
{
......@@ -55,10 +51,25 @@ namespace NSPresentationEditor
}
}
}
}
void CTextAttributesEx::RecalcParagraphs(CTheme* pTheme)
{
#ifdef PPT_DEF
RecalcParagraphsPPT();
ApplyThemeStyle(pTheme);
#else
size_t nCount = m_arParagraphs.size();
for (size_t i = 0; i < nCount; ++i)
{
m_arParagraphs[i].CheckErrors();
}
#endif
}
void CTextAttributesEx::ApplyThemeStyle(CTheme* pTheme)
{
if (NULL != pTheme)
{
//
size_t nCountPFs = m_arParagraphs.size();
for (size_t nIndexP = 0; nIndexP < nCountPFs; ++nIndexP)
{
......@@ -76,33 +87,33 @@ namespace NSPresentationEditor
nullable_base<LONG> spaceBefore;
if (-1 != m_lTextType && m_lTextType < 4 && pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel].is_init())
if (-1 != m_lStyleThemeIndex && m_lStyleThemeIndex < 4 && pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel].is_init())
{
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.hasBullet.is_init())
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.hasBullet.is_init())
{
hasBullet = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.hasBullet;
hasBullet = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.hasBullet;
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletColor.is_init())
bulletColor = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletColor;
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletColor.is_init())
bulletColor = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletColor;
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletChar.is_init() )
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletChar.is_init() )
{
bulletFontRef = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletFontRef;
bulletChar = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletChar;
bulletFontRef = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletFontRef;
bulletChar = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletChar;
}
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletSize.is_init())
bulletSize = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.bulletSize;
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletSize.is_init())
bulletSize = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.bulletSize;
}
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.leftMargin.is_init())
margin = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.leftMargin;
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.leftMargin.is_init())
margin = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.leftMargin;
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.indent.is_init())
indent = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.indent;
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.indent.is_init())
indent = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.indent;
if (pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.spaceBefore.is_init())
spaceBefore = pTheme->m_pStyles[m_lTextType].m_pLevels[lLevel]->m_oPFRun.spaceBefore;
if (pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.spaceBefore.is_init())
spaceBefore = pTheme->m_pStyles[m_lStyleThemeIndex].m_pLevels[lLevel]->m_oPFRun.spaceBefore;
}
if (m_oLayoutStyles.m_pLevels[lLevel].is_init())
{
......@@ -210,20 +221,7 @@ namespace NSPresentationEditor
m_arParagraphs[i].CheckErrors();
}
ApplyRuler(pTheme);
}
void CTextAttributesEx::RecalcParagraphs(CTheme* pTheme)
{
#ifdef PPT_DEF
RecalcParagraphsPPT(pTheme);
#else
size_t nCount = m_arParagraphs.size();
for (size_t i = 0; i < nCount; ++i)
{
m_arParagraphs[i].CheckErrors();
}
#endif
ApplyRuler(pTheme);
}
void CTextAttributesEx::ApplyRuler(CTheme* pTheme)
{
......
......@@ -19,6 +19,7 @@ namespace NSPresentationEditor
LONG m_lTextMasterType; // only ppt property
public:
DWORD m_lTextType;
DWORD m_lStyleThemeIndex;
int m_lPlaceholderType;
int m_lPlaceholderID;
......@@ -56,6 +57,8 @@ namespace NSPresentationEditor
m_lPlaceholderType = -1;
m_lPlaceholderID = -1;
m_lStyleThemeIndex = 0;//default
m_lFontRef = -1;
m_bIsSlideFontRef = false;
......@@ -105,7 +108,6 @@ namespace NSPresentationEditor
m_arParagraphs.clear();
}
CString ToString(CGeomShapeInfo& oInfo, CMetricInfo& pMetricInfo, double dStartTime, double dEndTime, CTheme* pTheme, CLayout* pLayout);
public:
inline void NormalizeString(CString& strText)
......@@ -118,7 +120,8 @@ namespace NSPresentationEditor
}
void RecalcParagraphs (CTheme* pTheme = NULL);
void RecalcParagraphsPPT(CTheme* pTheme = NULL);
void RecalcParagraphsPPT();
void ApplyThemeStyle (CTheme* pTheme = NULL);
void ApplyRuler (CTheme* pTheme);
void ApplyRuler (CTextPFRun* pPar, WORD lIndentLevel);
......
......@@ -857,8 +857,9 @@ namespace NSPresentationEditor
class CParagraph
{
public:
LONG m_lTextType;
LONG m_lTextLevel;
int m_lTextType;
int m_lTextLevel;
int m_lStyleThemeIndex;
CTextPFRun m_oPFRun;
std::vector<CSpan> m_arSpans;
......@@ -866,8 +867,9 @@ namespace NSPresentationEditor
public:
CParagraph() : m_oPFRun(), m_arSpans()
{
m_lTextType = 0;
m_lTextLevel = 0;
m_lTextType = 0;
m_lTextLevel = 0;
m_lStyleThemeIndex = 0;
}
CParagraph(const CParagraph& oSrc)
{
......@@ -875,12 +877,13 @@ namespace NSPresentationEditor
}
CParagraph& operator=(const CParagraph& oSrc)
{
m_lTextLevel = oSrc.m_lTextLevel;
m_lTextType = oSrc.m_lTextType;
m_lTextLevel = oSrc.m_lTextLevel;
m_lTextType = oSrc.m_lTextType;
m_lStyleThemeIndex = oSrc.m_lStyleThemeIndex;
m_oPFRun = oSrc.m_oPFRun;
m_oPFRun = oSrc.m_oPFRun;
m_arSpans = oSrc.m_arSpans;
m_arSpans = oSrc.m_arSpans;
return *this;
}
......
#pragma once
#include "Structures.h"
#include "Layout.h"
#include "../PPTXWriter/CSS.h"
//#include "../PPTXWriter/CSS.h"
namespace NSPresentationEditor
{
......
This diff is collapsed.
......@@ -398,9 +398,19 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
}
strDefaultTextStyle += _T("</p:defaultTextStyle>");
CString strPres = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
<p:presentation xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\" saveSubsetFonts=\"1\">\
<p:sldMasterIdLst>") + strPresMasters + _T("</p:sldMasterIdLst>") + strNotesIDs + _T("<p:sldIdLst>") + strPresSlides + _T("</p:sldIdLst>") + strSizePres + strDefaultTextStyle + _T("</p:presentation>");
CString strPres = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>");
strPres += _T("<p:presentation xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\" saveSubsetFonts=\"1\"");
if ((m_pUserInfo) && (m_pUserInfo->m_bRtl))
{
strPres += _T(" rtl=\"1\"");
}
strPres += _T(">");
strPres += _T("<p:sldMasterIdLst>") + strPresMasters + _T("</p:sldMasterIdLst>");
strPres += strNotesIDs ;
strPres +=_T("<p:sldIdLst>") + strPresSlides + _T("</p:sldIdLst>");
strPres += strSizePres;
strPres += strDefaultTextStyle;
strPres +=_T("</p:presentation>");
oFile.CreateFile(m_strTempDirectory+ FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("presentation.xml"));
oFile.WriteStringUTF8(strPres);
......
#pragma once
#include "CSS.h"
//#include "CSS.h"
class CStylesWriter
{
......
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