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

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65567 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
Elen.Subbotina
2015-10-31 10:12:54 +00:00
committed by Alexander Trofimov
parent e3f5f625c5
commit c05c02cd32
24 changed files with 363 additions and 11555 deletions

View File

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

View File

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

View File

@ -66,8 +66,8 @@ public:
std::vector<CColor> m_oSchemeColors;
nullable<WORD> m_wLanguage; // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
nullable<bool> m_bBidi; // bi-direction
bool m_bRtl;
bool m_bShowComments;
public:
CPPTUserInfo();

View File

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

View File

@ -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++)
CTextAttributesEx* pText = &(pShape->m_oShape.m_oText);
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)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> shape
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -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;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (persist <20> own) - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20> 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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/* NSPresentationEditor::CColor oColor;
//todooo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 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);

View File

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

View File

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

View File

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

View File

@ -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 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);
//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;
// 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);
}
// return m_oShape.ToXml(oInfo, m_oMetric, m_dStartTime, m_dEndTime, m_pTheme, m_pLayout);
//}
CString ToAnimationXml()
{
CGeomShapeInfo oInfo;
oInfo.SetBounds(m_rcBounds);
//CString ToAnimationXml()
//{
// CGeomShapeInfo oInfo;
// oInfo.SetBounds(m_rcBounds);
oInfo.m_dRotate = m_dRotate;
oInfo.m_bFlipH = m_bFlipH;
oInfo.m_bFlipV = m_bFlipV;
// 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;
// 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);
// 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);
// 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") );
}
// 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;
}
// 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()
{

View File

@ -1,871 +0,0 @@
#include "SVGConverter.h"
#include "../../DesktopEditor/graphics/GraphicsPath.h"
NSPresentationEditor::CSVGConverter::CSVGConverter()
{
m_dDpiX = 96.0;
m_dDpiY = 96.0;
m_lClipMode = c_nClipRegionTypeWinding;
m_pSimpleGraphicsConverter = new Aggplus::CGraphicsPathSimpleConverter();
m_pSimpleGraphicsConverter->SetRenderer(this);
m_dTransformAngle = 0.0;
m_dWidth = 100;
m_dHeight = 100;
m_pFontManager = NULL;
}
void NSPresentationEditor::CSVGConverter::_SetFont()
{
if (NULL == m_pFontManager)
{
m_pFontManager = new CFontManager();
m_pFontManager->Initialize();
}
m_pFontManager->SetStringGID(m_oFont.StringGID);
if (_T("") == m_oFont.Path)
{
m_pFontManager->LoadFontByName(m_oFont.Name, (float)m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY);
}
else
{
m_pFontManager->LoadFontFromFile(m_oFont.Path, (float)m_oFont.Size, m_dDpiX, m_dDpiY, 0);
}
m_oInstalledFont = m_oFont;
}
NSPresentationEditor::CSVGConverter::~CSVGConverter()
{
RELEASEOBJECT(m_pSimpleGraphicsConverter);
RELEASEOBJECT(m_pFontManager);
}
HRESULT NSPresentationEditor::CSVGConverter::get_Type(LONG* lType)
{
if (NULL == lType)
return S_FALSE;
*lType = c_nSVGConverter;
return S_OK;
}
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::NewPage()
{
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_Height(double* dHeight)
{
if (NULL != dHeight)
*dHeight = m_dHeight;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_Height(const double &dHeight)
{
m_dHeight = dHeight;
m_oBaseTransform.Reset();
double dKoefBase = 96.0 / 25.4;
double dScaleX = 43200 / m_dOffsetW;
double dScaleY = 43200 / m_dOffsetH;
m_oBaseTransform.Translate(-m_dOffsetX, -m_dOffsetY, Aggplus::MatrixOrderAppend);
m_oBaseTransform.Scale(dScaleX, dScaleY, Aggplus::MatrixOrderAppend);
CalculateFullTransform();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_Width(double* dWidth)
{
if (NULL != dWidth)
*dWidth = m_dWidth;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_Width(const double& dWidth)
{
m_dWidth = dWidth;
m_oBaseTransform.Reset();
double dScaleX = 43200 / m_dOffsetW;
double dScaleY = 43200 / m_dOffsetH;
m_oBaseTransform.Translate(-m_dOffsetX, -m_dOffsetY, Aggplus::MatrixOrderAppend);
m_oBaseTransform.Scale(dScaleX, dScaleY, Aggplus::MatrixOrderAppend);
CalculateFullTransform();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_DpiX(double* dDpiX)
{
if (NULL != dDpiX)
*dDpiX = m_dDpiX;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_DpiY(double* dDpiY)
{
if (NULL != dDpiY)
*dDpiY = m_dDpiY;
return S_OK;
}
// pen --------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::get_PenColor(LONG* lColor)
{
*lColor = m_oPen.Color.GetLONG();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenColor(const LONG& lColor)
{
BYTE lScheme = (BYTE)(((DWORD)(lColor)) >> 24);
if (0xFF != lScheme)
m_oPen.Color.SetBGR(lColor);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenAlpha(LONG* lAlpha)
{
*lAlpha = m_oPen.Alpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenAlpha(const LONG& lAlpha)
{
m_oPen.Alpha = lAlpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenSize(double* dSize)
{
*dSize = m_oPen.Size;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenSize(const double& dSize)
{
m_oPen.Size = dSize * 25.4 / 96.0;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenDashStyle(BYTE* val)
{
*val = m_oPen.DashStyle;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenDashStyle(const BYTE& val)
{
m_oPen.DashStyle = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenLineStartCap(BYTE* val)
{
*val = m_oPen.LineStartCap;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenLineStartCap(const BYTE& val)
{
m_oPen.LineStartCap = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenLineEndCap(BYTE* val)
{
*val = m_oPen.LineEndCap;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenLineEndCap(const BYTE& val)
{
m_oPen.LineEndCap = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenLineJoin(BYTE* val)
{
*val = m_oPen.LineJoin;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenLineJoin(const BYTE& val)
{
m_oPen.LineJoin = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenDashOffset(double* val)
{
*val = m_oPen.DashOffset;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenDashOffset(const double& val)
{
m_oPen.DashOffset = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenAlign(LONG* val)
{
*val = m_oPen.Align;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenAlign(const LONG& val)
{
m_oPen.Align = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_PenMiterLimit(double* val)
{
*val = m_oPen.MiterLimit;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_PenMiterLimit(const double& val)
{
m_oPen.MiterLimit = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PenDashPattern(double* pPattern, LONG lCount)
{
if (NULL != pPattern)
{
m_oPen.SetDashPattern(pPattern, lCount);
}
return S_OK;
}
// brush ------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::get_BrushType(LONG* lType)
{
*lType = m_oBrush.Type;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushType(const LONG& lType)
{
m_oBrush.Type = lType;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushColor1(LONG* lColor)
{
*lColor = m_oBrush.Color1.GetLONG();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushColor1(const LONG& lColor)
{
BYTE lScheme = (BYTE)(((DWORD)(lColor)) >> 24);
if (0xFF != lScheme)
m_oBrush.Color1.SetBGR(lColor);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushAlpha1(LONG* lAlpha)
{
*lAlpha = m_oBrush.Alpha1;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushAlpha1(const LONG& lAlpha)
{
m_oBrush.Alpha1 = lAlpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushColor2(LONG* lColor)
{
*lColor = m_oBrush.Color2.GetLONG();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushColor2(const LONG& lColor)
{
m_oBrush.Color2.SetBGR(lColor);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushAlpha2(LONG* lAlpha)
{
*lAlpha = m_oBrush.Alpha2;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushAlpha2(const LONG& lAlpha)
{
m_oBrush.Alpha2 = lAlpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushTexturePath(std::wstring* bsPath)
{
if (bsPath == NULL) return S_FALSE;
*bsPath = m_oBrush.TexturePath;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushTexturePath(const std::wstring& bsPath)
{
m_oBrush.TexturePath = bsPath;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushTextureMode(LONG* lMode)
{
*lMode = m_oBrush.TextureMode;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushTextureMode(const LONG& lMode)
{
m_oBrush.TextureMode = lMode;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushTextureAlpha(LONG* lTxAlpha)
{
*lTxAlpha = m_oBrush.TextureAlpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushTextureAlpha(const LONG& lTxAlpha)
{
m_oBrush.TextureAlpha = lTxAlpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_BrushLinearAngle(double* dAngle)
{
*dAngle = m_oBrush.LinearAngle;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_BrushLinearAngle(const double& dAngle)
{
m_oBrush.LinearAngle = dAngle;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height)
{
m_oBrush.Rectable = val;
m_oBrush.Rect.X = (float)left;
m_oBrush.Rect.Y = (float)top;
m_oBrush.Rect.Width = (float)width;
m_oBrush.Rect.Height = (float)height;
return S_OK;
}
// font -------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::get_FontName(std::wstring* bsName)
{
*bsName = m_oFont.Name;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontName(const std::wstring& bsName)
{
m_oFont.Name = bsName;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontPath(std::wstring* bsName)
{
*bsName = m_oFont.Path;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontPath(const std::wstring& bsName)
{
m_oFont.Path = bsName;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontSize(double* dSize)
{
*dSize = m_oFont.Size;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontSize(const double& dSize)
{
m_oFont.Size = dSize;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontStyle(LONG* lStyle)
{
*lStyle = m_oFont.GetStyle();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontStyle(const LONG& lStyle)
{
m_oFont.SetStyle(lStyle);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontStringGID(INT* bGID)
{
*bGID = m_oFont.StringGID;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontStringGID(const INT& bGID)
{
m_oFont.StringGID = bGID;
if (m_pFontManager)
m_pFontManager->SetStringGID(bGID);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_FontCharSpace(double* dSpace)
{
*dSpace = m_oFont.CharSpace;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_FontCharSpace(const double& dSpace)
{
m_oFont.CharSpace = dSpace;
return S_OK;
}
// shadow -----------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::get_ShadowDistanceX(double* val)
{
*val = m_oShadow.DistanceX;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ShadowDistanceX(const double& val)
{
m_oShadow.DistanceX = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_ShadowDistanceY(double* val)
{
*val = m_oShadow.DistanceY;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ShadowDistanceY(const double& val)
{
m_oShadow.DistanceY = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_ShadowBlurSize(double* val)
{
*val = m_oShadow.BlurSize;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ShadowBlurSize(const double& val)
{
m_oShadow.BlurSize = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_ShadowColor(LONG* val)
{
*val = m_oShadow.Color.GetLONG();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ShadowColor(const LONG& val)
{
m_oShadow.Color.SetBGR(val);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_ShadowAlpha(LONG* val)
{
*val = m_oShadow.Alpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ShadowAlpha(const LONG& val)
{
m_oShadow.Alpha = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_ShadowVisible(INT* val)
{
*val = m_oShadow.Visible;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ShadowVisible(const INT& val)
{
m_oShadow.Visible = val;
return S_OK;
}
// edge -------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::get_EdgeVisible(LONG* val)
{
*val = m_oEdge.Visible;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_EdgeVisible(const LONG& val)
{
m_oEdge.Visible = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_EdgeColor(LONG* val)
{
*val = m_oEdge.Color.GetLONG();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_EdgeColor(const LONG& val)
{
m_oEdge.Color.SetBGR(val);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_EdgeAlpha(LONG* val)
{
*val = m_oEdge.Alpha;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_EdgeAlpha(const LONG& val)
{
m_oEdge.Alpha = val;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::get_EdgeDist(double* val)
{
*val = m_oEdge.Dist;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_EdgeDist(const double& val)
{
m_oEdge.Dist = val;
return S_OK;
}
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::CommandDrawText(const std::wstring& bsText, const double& fX, const double& fY, const double& fWidth, const double& fHeight)
{
if (c_nHyperlinkType == m_lCurrentCommandType)
return S_OK;
if (abs(m_dTransformAngle) > 1)
{
PathCommandEnd();
BeginCommand(c_nPathType);
PathCommandText(bsText, fX, fY, fWidth, fHeight);
DrawPath(c_nWindingFillMode);
EndCommand(c_nPathType);
PathCommandEnd();
return S_OK;
}
double x = fX;
double y = fY;
m_oFullTransform.TransformPoint(x, y);
double r = fX + fWidth;
double b = fY + fHeight;
m_oFullTransform.TransformPoint(r, b);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h)
{
if (abs(m_dTransformAngle) > 1)
{
PathCommandEnd();
BeginCommand(c_nPathType);
PathCommandTextEx(bsUnicodeText, pGids, nGidsCount, x, y, w, h);
DrawPath(c_nWindingFillMode);
EndCommand(c_nPathType);
PathCommandEnd();
return S_OK;
}
double x_ = x;
double y_ = y;
m_oFullTransform.TransformPoint(x_, y_);
double r = x + w;
double b = y + h;
m_oFullTransform.TransformPoint(r, b);
return S_OK;
}
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::BeginCommand(const DWORD& lType)
{
if (c_nPathType == lType)
{
m_pSimpleGraphicsConverter->PathCommandEnd();
}
m_lCurrentCommandType = lType;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::EndCommand(const DWORD& lType)
{
m_lCurrentCommandType = -1;
return S_OK;
}
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> Graphics Path -----------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::PathCommandMoveTo(const double& fX, const double& fY)
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
{
MoveTo(fX, fY);
}
else
{
m_pSimpleGraphicsConverter->PathCommandMoveTo(fX, fY);
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandLineTo(const double& fX, const double& fY)
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
{
LineTo(fX, fY);
}
else
{
m_pSimpleGraphicsConverter->PathCommandLineTo(fX, fY);
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandLinesTo(double* points, const int& count)
{
m_pSimpleGraphicsConverter->PathCommandLinesTo(points, count);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandCurveTo(const double& fX1, const double& fY1, const double& fX2, const double& fY2, const double& fX3, const double& fY3)
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
{
CurveTo(fX1, fY1, fX2, fY2, fX3, fY3);
}
else
{
m_pSimpleGraphicsConverter->PathCommandCurveTo(fX1, fY1, fX2, fY2, fX3, fY3);
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandCurvesTo(double* points, const int& count)
{
m_pSimpleGraphicsConverter->PathCommandCurvesTo(points, count);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle)
{
m_pSimpleGraphicsConverter->PathCommandArcTo(x, y, w, h, startAngle, sweepAngle);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandClose()
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
{
Close();
}
else
{
m_pSimpleGraphicsConverter->PathCommandClose();
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandEnd()
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
{
End();
}
else
{
m_pSimpleGraphicsConverter->PathCommandEnd();
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::DrawPath(const LONG& nType)
{
bool bIsStroke = ((0x01 == (nType & 0x01)) && (0 != m_oPen.Alpha));
bool bIsFill = ((0xFF < nType) && (0 != m_oBrush.Alpha1));
m_oSvgPen = m_oPen;
m_oSvgBrush = m_oBrush;
int lIndexPath = m_oSvgPath.m_arParts.size() - 1;
if (lIndexPath < 0)
return S_OK;
m_oSvgPath.m_arParts[lIndexPath].m_bFill = bIsFill;
m_oSvgPath.m_arParts[lIndexPath].m_bStroke = bIsStroke;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandStart()
{
if (c_nSimpleGraphicType == m_lCurrentCommandType)
{
Start();
}
else
{
m_pSimpleGraphicsConverter->PathCommandEnd();
m_pSimpleGraphicsConverter->PathCommandStart();
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandGetCurrentPoint(double* fX, double* fY)
{
m_pSimpleGraphicsConverter->PathCommandGetCurrentPoint(fX, fY);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h)
{
_SetFont();
m_pSimpleGraphicsConverter->PathCommandText(bsText, m_pFontManager, x, y, w, h, 0);
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h)
{
bool bGid = m_oFont.StringGID;
//TODOOO
//if (NULL != bsGidText)
//{
// m_oFont.StringGID = true;
// PathCommandText(bsGidText, x, y, w, h);
//}
m_oFont.StringGID = false;
PathCommandText(sText, x, y, w, h);
m_oFont.StringGID = bGid;
return S_OK;
}
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h)
{
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::DrawImageFromFile(const std::wstring& fn, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha)
{
m_oPen.Alpha = 0;
m_oSvgBrush.Type = c_BrushTypeTexture;
m_oSvgBrush.TexturePath = std_string2string(fn);
return S_OK;
}
// transform --------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::GetCommandParams(double* dAngle, double* dLeft, double* dTop, double* dWidth, double* dHeight, DWORD* lFlags)
{
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::SetCommandParams(double dAngle, double dLeft, double dTop, double dWidth, double dHeight, DWORD lFlags)
{
if ((dWidth <= 1) || (dHeight <= 1))
lFlags = 0;
bool bFlipX = (0 != (c_nParamFlipX & lFlags));
bool bFlipY = (0 != (c_nParamFlipY & lFlags));
double m11 = bFlipX ? -1.0 : 1.0;
double m22 = bFlipY ? -1.0 : 1.0;
Aggplus::CMatrix oMatrix(1, 0, 0, 1, 0, 0);
if ((0 != dAngle) || (0 != lFlags))
{
double dCentreX = (dLeft + dWidth / 2.0);
double dCentreY = (dTop + dHeight / 2.0);
oMatrix.Translate(-dCentreX, -dCentreY , Aggplus::MatrixOrderAppend);
oMatrix.Rotate(dAngle , Aggplus::MatrixOrderAppend);
oMatrix.Scale(m11, m22 , Aggplus::MatrixOrderAppend);
oMatrix.Translate(dCentreX, dCentreY , Aggplus::MatrixOrderAppend);
}
m_oTransform = oMatrix;
CalculateFullTransform();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::SetTransform(const double& dA, const double& dB, const double& dC, const double& dD, const double& dE, const double& dF)
{
Aggplus::CMatrix oTrans(dA, dB, dC, dD, dE, dF);
m_oTransform = oTrans;
CalculateFullTransform();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF)
{
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::ResetTransform(void)
{
m_oTransform.Reset();
CalculateFullTransform();
return S_OK;
}
// -----------------------------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::get_ClipMode(LONG* plMode)
{
*plMode = m_lClipMode;
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::put_ClipMode(const LONG& lMode)
{
m_lClipMode = lMode;
return S_OK;
}
// additiaonal params ----------------------------------------------------------------------
HRESULT NSPresentationEditor::CSVGConverter::SetAdditionalParam(BSTR ParamName, VARIANT ParamValue)
{
CString sParamName = ParamName;
if ( _T("AttributeClassName") == sParamName && VT_BSTR == ParamValue.vt )
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
//m_oBrush.Color1.m_lSchemeIndex = -1;
//m_oPen.Color.m_lSchemeIndex = -1;
CString strClass = (CString)ParamValue.bstrVal;
int nLen = strClass.GetLength();
TCHAR* pData = strClass.GetBuffer();
TCHAR* pDataEnd = pData + nLen;
int nIndexStroke = strClass.Find(_T("stroke"));
int nIndexFill = strClass.Find(_T("fill"));
if (-1 != nIndexStroke)
{
nIndexStroke += 6;
int nColorScheme = 0;
TCHAR* pDataMem = pData + nIndexStroke;
while ((pDataMem < pDataEnd) && XmlUtils::GetDigit(*pDataMem))
{
nColorScheme *= 10;
nColorScheme += (int)(*pDataMem - TCHAR('0'));
++pDataMem;
}
m_oPen.Color.m_lSchemeIndex = nColorScheme - 1;
m_bIsStrokeScheme = true;
}
if (-1 != nIndexFill)
{
nIndexFill += 4;
int nColorScheme = 0;
TCHAR* pDataMem = pData + nIndexFill;
while ((pDataMem < pDataEnd) && XmlUtils::GetDigit(*pDataMem))
{
nColorScheme *= 10;
nColorScheme += (int)(*pDataMem - TCHAR('0'));
++pDataMem;
}
m_oBrush.Color1.m_lSchemeIndex = nColorScheme - 1;
m_bIsFillScheme = true;
}
}
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::GetAdditionalParam(BSTR ParamName, VARIANT* ParamValue)
{
return S_OK;
}
// --------------------------------------------------------------------------------------------
// file
HRESULT NSPresentationEditor::CSVGConverter::OpenFile(BSTR bsFilePath)
{
if (NULL == m_pFontManager)
{
m_pFontManager = new CFontManager();
m_pFontManager->Initialize();
//m_pFontManager->SetDefaultFont(L"Arial");
}
m_oFont.SetDefaultParams();
m_oInstalledFont.SetDefaultParams();
return S_OK;
}
HRESULT NSPresentationEditor::CSVGConverter::CloseFile()
{
m_oSvgPath.m_arParts.clear();
return S_OK;
}

View File

@ -1,368 +0,0 @@
#pragma once
#include "Shapes/Shape.h"
#include "Shapes/BaseShape/Path.h"
#include "../../DesktopEditor/graphics/Matrix.h"
#include "../../DesktopEditor/graphics/IRenderer.h"
namespace Aggplus
{
class CMatrix;
class CGraphicsPathSimpleConverter;
}
class CFontManager;
namespace NSPresentationEditor
{
//#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
//#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
//#endiflo
//// ISVGConverter
//[ object, uuid("4EE9D2C3-7317-4540-A205-DB78DBEB9BD0"), dual, pointer_default(unique) ]
//__interface ISVGConverter : IASCRenderer
//{
// [id(5000)] HRESULT OpenFile([in] BSTR bsFileName);
// [id(5001)] HRESULT CloseFile();
//};
//// _ISVGConverter
//[uuid("8C6949B0-EEC9-45a8-AA70-B832204A423F"), dispinterface]
//__interface _ISVGConverterEvents
//{
//};
// CSVGConverter
//[ coclass, default(ISVGConverter), threading(apartment), event_source(com), vi_progid("Drawing.svgcon"), progid("Drawing.svgcon.1"), version(1.0), uuid("3779970A-DA08-4245-866D-40C1779B48B0") ]
class /*ATL_NO_VTABLE*/ CSVGConverter : public IRenderer//: public ISVGConverter
{
private:
//public:
// __event __interface _ISVGConverterEvents;
public:
//DECLARE_PROTECT_FINAL_CONSTRUCT()
CSVGConverter();
~CSVGConverter();
public:
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----------------------------------------------------------------------------
virtual HRESULT get_Type(LONG* lType) ;
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --------------------------------------------------
virtual HRESULT NewPage() ;
virtual HRESULT get_Height(double* dHeight) ;
virtual HRESULT put_Height(const double& dHeight) ;
virtual HRESULT get_Width(double* dWidth) ;
virtual HRESULT put_Width(const double& dWidth) ;
virtual HRESULT get_DpiX(double* dDpiX) ;
virtual HRESULT get_DpiY(double* dDpiY) ;
// pen --------------------------------------------------------------------------------------
virtual HRESULT get_PenColor(LONG* lColor) ;
virtual HRESULT put_PenColor(const LONG& lColor) ;
virtual HRESULT get_PenAlpha(LONG* lAlpha) ;
virtual HRESULT put_PenAlpha(const LONG& lAlpha) ;
virtual HRESULT get_PenSize(double* dSize) ;
virtual HRESULT put_PenSize(const double& dSize) ;
virtual HRESULT get_PenDashStyle(BYTE* val) ;
virtual HRESULT put_PenDashStyle(const BYTE& val) ;
virtual HRESULT get_PenLineStartCap(BYTE* val) ;
virtual HRESULT put_PenLineStartCap(const BYTE& val) ;
virtual HRESULT get_PenLineEndCap(BYTE* val) ;
virtual HRESULT put_PenLineEndCap(const BYTE& val) ;
virtual HRESULT get_PenLineJoin(BYTE* val) ;
virtual HRESULT put_PenLineJoin(const BYTE& val) ;
virtual HRESULT get_PenDashOffset(double* dOffset) ;
virtual HRESULT put_PenDashOffset(const double& dOffset) ;
virtual HRESULT get_PenAlign(LONG* lAlign) ;
virtual HRESULT put_PenAlign(const LONG& lAlign) ;
virtual HRESULT get_PenMiterLimit(double* dOffset) ;
virtual HRESULT put_PenMiterLimit(const double& dOffset) ;
virtual HRESULT PenDashPattern(double* pPattern, LONG lCount);
// brush ------------------------------------------------------------------------------------
virtual HRESULT get_BrushType(LONG* lType) ;
virtual HRESULT put_BrushType(const LONG& lType) ;
virtual HRESULT get_BrushColor1(LONG* lColor) ;
virtual HRESULT put_BrushColor1(const LONG& lColor) ;
virtual HRESULT get_BrushAlpha1(LONG* lAlpha) ;
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha) ;
virtual HRESULT get_BrushColor2(LONG* lColor) ;
virtual HRESULT put_BrushColor2(const LONG& lColor) ;
virtual HRESULT get_BrushAlpha2(LONG* lAlpha) ;
virtual HRESULT put_BrushAlpha2(const LONG& lAlpha) ;
virtual HRESULT get_BrushTexturePath(std::wstring* bsPath) ;
virtual HRESULT put_BrushTexturePath(const std::wstring& bsPath) ;
virtual HRESULT get_BrushTextureMode(LONG* lMode) ;
virtual HRESULT put_BrushTextureMode(const LONG& lMode) ;
virtual HRESULT get_BrushTextureAlpha(LONG* lTxAlpha) ;
virtual HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha) ;
virtual HRESULT get_BrushLinearAngle(double* dAngle) ;
virtual HRESULT put_BrushLinearAngle(const double& dAngle) ;
virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height) ;
virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height) { return S_OK;}
virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount) { return S_OK;}
// font -------------------------------------------------------------------------------------
virtual HRESULT get_FontName(std::wstring* bsName) ;
virtual HRESULT put_FontName(const std::wstring& bsName) ;
virtual HRESULT get_FontPath(std::wstring* bsName) ;
virtual HRESULT put_FontPath(const std::wstring& bsName) ;
virtual HRESULT get_FontSize(double* dSize) ;
virtual HRESULT put_FontSize(const double& dSize) ;
virtual HRESULT get_FontStyle(LONG* lStyle) ;
virtual HRESULT put_FontStyle(const LONG& lStyle) ;
virtual HRESULT get_FontStringGID(INT* bGID) ;
virtual HRESULT put_FontStringGID(const INT& bGID) ;
virtual HRESULT get_FontCharSpace(double* dSpace) ;
virtual HRESULT put_FontCharSpace(const double& dSpace) ;
virtual HRESULT get_FontFaceIndex(int* lFaceIndex) { return S_OK;}
virtual HRESULT put_FontFaceIndex(const int& lFaceIndex) { return S_OK;}
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --------------------------------------------------------
virtual HRESULT CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) { return S_OK;}
virtual HRESULT CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h);
virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) { return S_OK;}
virtual HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) ;
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---------------------------------------------------------------
virtual HRESULT BeginCommand(const DWORD& lType) ;
virtual HRESULT EndCommand(const DWORD& lType) ;
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> Graphics Path -----------------------------------------------
virtual HRESULT PathCommandMoveTo(const double& x, const double& y) ;
virtual HRESULT PathCommandLineTo(const double& x, const double& y) ;
virtual HRESULT PathCommandLinesTo(double* points, const int& count) ;
virtual HRESULT PathCommandCurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3) ;
virtual HRESULT PathCommandCurvesTo(double* points, const int& count) ;
virtual HRESULT PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle) ;
virtual HRESULT PathCommandClose() ;
virtual HRESULT PathCommandEnd() ;
virtual HRESULT DrawPath(const LONG& nType) ;
virtual HRESULT PathCommandStart() ;
virtual HRESULT PathCommandGetCurrentPoint(double* x, double* y) ;
virtual HRESULT PathCommandTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) {return S_OK;}
virtual HRESULT PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h);
virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) {return S_OK;}
virtual HRESULT PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) ;
//-------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---------------------------------------------------
virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) ;
virtual HRESULT DrawImageFromFile(const std::wstring& fn, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha = 255) ;
// transform --------------------------------------------------------------------------------
virtual HRESULT GetCommandParams(double* dAngle, double* dLeft, double* dTop, double* dWidth, double* dHeight, DWORD* lFlags);
virtual HRESULT SetCommandParams(double dAngle, double dLeft, double dTop, double dWidth, double dHeight, DWORD lFlags);
virtual HRESULT SetTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6) ;
virtual HRESULT GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF) ;
virtual HRESULT ResetTransform() ;
// -----------------------------------------------------------------------------------------
virtual HRESULT get_ClipMode(LONG* plMode) ;
virtual HRESULT put_ClipMode(const LONG& lMode) ;
// additiaonal params ----------------------------------------------------------------------
virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand) { return S_OK;}
virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand) { return S_OK;}
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand) { return S_OK;}
// additiaonal params ----------------------------------------------------------------------
HRESULT SetAdditionalParam (BSTR ParamName, VARIANT ParamValue);
HRESULT GetAdditionalParam (BSTR ParamName, VARIANT* ParamValue);
// --------------------------------------------------------------------------------------------
// file
HRESULT OpenFile (BSTR bsFilePath);
HRESULT CloseFile ();
// additional
HRESULT get_ShadowDistanceX (double* val);
HRESULT put_ShadowDistanceX (const double& val);
HRESULT get_ShadowDistanceY (double* val);
HRESULT put_ShadowDistanceY (const double& val);
HRESULT get_ShadowBlurSize (double* val);
HRESULT put_ShadowBlurSize (const double& val);
HRESULT get_ShadowColor (LONG* val);
HRESULT put_ShadowColor (const LONG& val);
HRESULT get_ShadowAlpha (LONG* val);
HRESULT put_ShadowAlpha (const LONG& val);
HRESULT get_ShadowVisible (INT* val);
HRESULT put_ShadowVisible (const INT& val);
// edge -------------------------------------------------------------------------------------
HRESULT get_EdgeVisible (LONG* val);
HRESULT put_EdgeVisible (const LONG& val);
HRESULT get_EdgeColor (LONG* val);
HRESULT put_EdgeColor (const LONG& val);
HRESULT get_EdgeAlpha (LONG* val);
HRESULT put_EdgeAlpha (const LONG& val);
HRESULT get_EdgeDist (double* val);
HRESULT put_EdgeDist (const double& val);
private:
Aggplus::CGraphicsPathSimpleConverter* m_pSimpleGraphicsConverter; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CFontManager* m_pFontManager; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Aggplus::CMatrix m_oBaseTransform; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
Aggplus::CMatrix m_oTransform; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Aggplus::CMatrix m_oFullTransform; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (m_oBaseTransform * m_oTransform)
double m_dTransformAngle;
LONG m_lCurrentCommandType; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double m_dDpiX;
double m_dDpiY;
LONG m_lClipMode;
CPen m_oPen; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> AVSGraphics)
CBrush m_oBrush;
CFont m_oFont;
CShadow m_oShadow;
CEdgeText m_oEdge;
CFont m_oInstalledFont;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPath m_oSvgPath;
CBrush m_oSvgBrush;
CPen m_oSvgPen;
double m_dWidth;
double m_dHeight;
double m_dOffsetX;
double m_dOffsetY;
double m_dOffsetW;
double m_dOffsetH;
bool m_bIsStrokeScheme;
bool m_bIsFillScheme;
protected:
void CalculateFullTransform()
{
m_oFullTransform = m_oBaseTransform;
m_oFullTransform.Multiply(&m_oTransform, Aggplus::MatrixOrderPrepend);
m_dTransformAngle = m_oTransform.z_Rotation();
}
inline void MoveTo(const double& dX, const double& dY)
{
//CPartPath oPart;
//m_oSvgPath.m_arParts.Add(oPart);
double x = dX;
double y = dY;
m_oFullTransform.TransformPoint(x, y);
int lIndexPath = m_oSvgPath.m_arParts.size() - 1;
if (lIndexPath < 0)
return;
CSlice oSlice(rtMoveTo);
oSlice.AddParam(x);
oSlice.AddParam(y);
m_oSvgPath.m_arParts[lIndexPath].m_arSlices.push_back(oSlice);
}
inline void LineTo(const double& dX, const double& dY)
{
double x = dX;
double y = dY;
m_oFullTransform.TransformPoint(x, y);
int lIndexPath = m_oSvgPath.m_arParts.size() - 1;
if (lIndexPath < 0)
return;
CSlice oSlice(rtLineTo);
oSlice.AddParam(x);
oSlice.AddParam(y);
m_oSvgPath.m_arParts[lIndexPath].m_arSlices.push_back(oSlice);
}
inline void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3)
{
double _x1 = x1;
double _y1 = y1;
m_oFullTransform.TransformPoint(_x1, _y1);
double _x2 = x2;
double _y2 = y2;
m_oFullTransform.TransformPoint(_x2, _y2);
double _x3 = x3;
double _y3 = y3;
m_oFullTransform.TransformPoint(_x3, _y3);
int lIndexPath = m_oSvgPath.m_arParts.size() - 1;
if (lIndexPath < 0)
return;
CSlice oSlice(rtCurveTo);
oSlice.AddParam(_x1);
oSlice.AddParam(_y1);
oSlice.AddParam(_x2);
oSlice.AddParam(_y2);
oSlice.AddParam(_x3);
oSlice.AddParam(_y3);
m_oSvgPath.m_arParts[lIndexPath].m_arSlices.push_back(oSlice);
}
void Start()
{
CPartPath oPart;
m_oSvgPath.m_arParts.push_back(oPart);
}
void End()
{
}
void Close()
{
int lIndexPath = m_oSvgPath.m_arParts.size() - 1;
if (lIndexPath < 0)
return;
CSlice oSlice(rtClose);
m_oSvgPath.m_arParts[lIndexPath].m_arSlices.push_back(oSlice);
}
void _SetFont();
public:
void SetOffsetXY(double dX, double dY, double dW, double dH)
{
/*
m_dOffsetX = dX * 96 / 25.4;
m_dOffsetY = dY * 96 / 25.4;
m_dOffsetW = dW * 96 / 25.4;
m_dOffsetH = dH * 96 / 25.4;
*/
m_dOffsetX = dX;
m_dOffsetY = dY;
m_dOffsetW = dW;
m_dOffsetH = dH;
m_bIsFillScheme = false;
m_bIsStrokeScheme = false;
}
void SetSettings(CPen& oPen, CBrush& oBrush, CPath& oPath)
{
oPen = m_oSvgPen;
oBrush = m_oSvgBrush;
oPath = m_oSvgPath;
}
};
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,96 +0,0 @@
#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;
//}

View File

@ -1,98 +0,0 @@
#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;
};

View File

@ -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("");
//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;
// oGeomInfo.m_dLimoX = m_lLimoX;
// oGeomInfo.m_dLimoY = m_lLimoY;
m_pShape->m_oPath.SetCoordsize((LONG)m_dWidthLogic, (LONG)m_dHeightLogic);
CBrush brush; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
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);
}
// m_pShape->m_oPath.SetCoordsize((LONG)m_dWidthLogic, (LONG)m_dHeightLogic);
//
// CBrush brush; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
// 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;
}
// return strImageTransform;
//}
void ToRenderer(IRenderer* pRenderer, CGeomShapeInfo& oGeomInfo, CMetricInfo& pInfo, double dStartTime, double dEndTime)
{

View File

@ -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)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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)
{

View File

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

View File

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

View File

@ -1,7 +1,7 @@
#pragma once
#include "Structures.h"
#include "Layout.h"
#include "../PPTXWriter/CSS.h"
//#include "../PPTXWriter/CSS.h"
namespace NSPresentationEditor
{

View File

@ -1,921 +0,0 @@
#pragma once
#include "../../Common/ASCUtils.h"
#include "../OfficeDrawing/TextAttributesEx.h"
#include <map>
class CCSS
{
public:
std::map<CString, CString> m_mapSettings;
CString m_strClassName;
public:
CCSS()
{
Clear();
}
~CCSS()
{
}
AVSINLINE void Clear()
{
m_strClassName = _T("");
m_mapSettings.clear();
}
public:
void LoadFromString(CString& strParams)
{
Clear();
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mid, Find, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
TCHAR* pDataMem = pData;
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('\n') == *pDataMem) || (TCHAR('.') == *pDataMem)))
{
++nPosition;
++pDataMem;
}
int nPosNameStart = nPosition;
while ((nPosition < nCount) && (TCHAR(' ') != *pDataMem) && (TCHAR('{') != *pDataMem))
{
++nPosition;
++pDataMem;
}
m_strClassName = strParams.Mid(nPosNameStart, nPosition - nPosNameStart);
while (true)
{
++nPosition;
++pDataMem;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem)))
{
++nPosition;
++pDataMem;
}
int nPosOld = nPosition;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && (TCHAR(':') != *pDataMem))
{
++nPosition;
++pDataMem;
}
if (nPosOld == nPosition)
{
// <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
}
CString strName = strParams.Mid(nPosOld, nPosition - nPosOld);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ':'
++nPosition;
++pDataMem;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem))
{
++nPosition;
++pDataMem;
}
nPosOld = nPosition;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem))
{
++nPosition;
++pDataMem;
}
CString strValue = strParams.Mid(nPosOld, nPosition - nPosOld);
m_mapSettings.insert(std::pair<CString, CString>(strName, strValue));
}
}
void LoadFromString2(CString& strParams)
{
Clear();
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mid, Find, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
TCHAR* pDataMem = pData;
m_strClassName = _T("");
while (true)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem) || (TCHAR(';') == *pDataMem)))
{
++nPosition;
++pDataMem;
}
int nPosOld = nPosition;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && (TCHAR(':') != *pDataMem))
{
++nPosition;
++pDataMem;
}
if (nPosOld == nPosition)
{
// <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
}
CString strName = strParams.Mid(nPosOld, nPosition - nPosOld);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ':'
++nPosition;
++pDataMem;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem))
{
++nPosition;
++pDataMem;
}
nPosOld = nPosition;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem))
{
++nPosition;
++pDataMem;
}
CString strValue = strParams.Mid(nPosOld, nPosition - nPosOld);
m_mapSettings.insert(std::pair<CString, CString>(strName, strValue));
}
}
public:
AVSINLINE void LoadColor(NSPresentationEditor::CColor& oColor)
{
std::map<CString, CString>::iterator pPair = m_mapSettings.find(_T("color"));
if (m_mapSettings.end() != pPair)
{
int nLen = pPair->second.GetLength();
if (0 == nLen)
return;
if (pPair->second.GetAt(0) == TCHAR('#'))
oColor.FromString(pPair->second);
else if ((3 < nLen) && (pPair->second.Mid(0, 3) == _T("rgb")))
{
TCHAR* pBuffer = pPair->second.GetBuffer();
TCHAR* pBuffer1 = pBuffer;
TCHAR* pBuffer2 = pBuffer;
TCHAR* pBufferEnd = pBuffer + nLen;
while ((pBuffer1 < pBufferEnd) && !XmlUtils::IsDigit(*pBuffer1))
++pBuffer1;
pBuffer2 = pBuffer1;
while ((pBuffer2 < pBufferEnd) && XmlUtils::IsDigit(*pBuffer2))
++pBuffer2;
oColor.R = GetColor(pBuffer1, pBuffer2);
pBuffer1 = pBuffer2;
while ((pBuffer1 < pBufferEnd) && !XmlUtils::IsDigit(*pBuffer1))
++pBuffer1;
pBuffer2 = pBuffer1;
while ((pBuffer2 < pBufferEnd) && XmlUtils::IsDigit(*pBuffer2))
++pBuffer2;
oColor.G = GetColor(pBuffer1, pBuffer2);
pBuffer1 = pBuffer2;
while ((pBuffer1 < pBufferEnd) && !XmlUtils::IsDigit(*pBuffer1))
++pBuffer1;
pBuffer2 = pBuffer1;
while ((pBuffer2 < pBufferEnd) && XmlUtils::IsDigit(*pBuffer2))
++pBuffer2;
oColor.B = GetColor(pBuffer1, pBuffer2);
oColor.A = 0xFF;
oColor.m_lSchemeIndex = -1;
}
}
}
AVSINLINE void LoadFont(NSPresentationEditor::CFont& oFont)
{
std::map<CString, CString>::iterator pPair = m_mapSettings.find(_T("font-family"));
if (m_mapSettings.end() != pPair)
{
oFont.Name = pPair->second;
}
pPair = m_mapSettings.find(_T("tmdocs_charset"));
if (m_mapSettings.end() != pPair)
{
oFont.Charset = (BYTE)XmlUtils::GetInteger(pPair->second);
}
pPair = m_mapSettings.find(_T("tmdocs_monospace"));
if (m_mapSettings.end() != pPair)
{
oFont.Monospace = (bool)(pPair->second == _T("1"));
}
pPair = m_mapSettings.find(_T("tmdocs_panose"));
if (m_mapSettings.end() != pPair)
{
oFont.Panose = pPair->second;
}
}
AVSINLINE void LoadTextStyle(NSPresentationEditor::CTextStyleLevel& oLevel)
{
std::map<CString, CString>::iterator pPair;
pPair = m_mapSettings.find(_T("text-align"));
if (m_mapSettings.end() != pPair)
{
WORD nAlign = 1;
if (_T("left") == pPair->second)
nAlign = 0;
else if (_T("right") == pPair->second)
nAlign = 2;
else if (_T("justify") == pPair->second)
nAlign = 3;
oLevel.m_oPFRun.textAlignment = nAlign;
}
pPair = m_mapSettings.find(_T("lnspc"));
if (m_mapSettings.end() != pPair)
{
oLevel.m_oPFRun.lineSpacing = (LONG)XmlUtils::GetInteger(pPair->second);
}
pPair = m_mapSettings.find(_T("spcafter"));
if (m_mapSettings.end() != pPair)
{
oLevel.m_oPFRun.spaceAfter = (LONG)XmlUtils::GetInteger(pPair->second);
}
pPair = m_mapSettings.find(_T("spcbefore"));
if (m_mapSettings.end() != pPair)
{
oLevel.m_oPFRun.spaceBefore = (LONG)XmlUtils::GetInteger(pPair->second);
}
WORD lStyle = 0;
pPair = m_mapSettings.find(_T("font-weight"));
if (m_mapSettings.end() != pPair)
{
if (_T("bold") == pPair->second)
oLevel.m_oCFRun.FontBold = true;
else
oLevel.m_oCFRun.FontBold = false;
}
pPair = m_mapSettings.find(_T("font-style"));
if (m_mapSettings.end() != pPair)
{
if (_T("italic") == pPair->second)
oLevel.m_oCFRun.FontItalic = true;
else
oLevel.m_oCFRun.FontItalic = false;
}
pPair = m_mapSettings.find(_T("text-decoration"));
if (m_mapSettings.end() != pPair)
{
if (_T("underline") == pPair->second)
oLevel.m_oCFRun.FontUnderline = true;
else
oLevel.m_oCFRun.FontUnderline = false;
}
pPair = m_mapSettings.find(_T("font-size"));
if (m_mapSettings.end() != pPair)
{
CString strTemp = pPair->second.Mid(0, pPair->second.GetLength() - 2);
oLevel.m_oCFRun.Size = (WORD)XmlUtils::GetInteger(strTemp);
}
pPair = m_mapSettings.find(_T("color"));
if (m_mapSettings.end() != pPair)
{
oLevel.m_oCFRun.Color = new NSPresentationEditor::CColor();
oLevel.m_oCFRun.Color->FromString(pPair->second);
}
pPair = m_mapSettings.find(_T("font-family"));
if (m_mapSettings.end() != pPair)
{
oLevel.m_oCFRun.FontProperties = new NSPresentationEditor::CFontProperties();
oLevel.m_oCFRun.FontProperties->strFontName = pPair->second;
}
}
AVSINLINE void LoadStylePF(NSPresentationEditor::CTextPFRun& oRun, const NSPresentationEditor::CMetricInfo& oInfo)
{
std::map<CString, CString>::iterator pPair = m_mapSettings.find(_T("text-align"));
if (m_mapSettings.end() != pPair)
{
WORD nAlign = 1;
if (_T("left") == pPair->second)
nAlign = 0;
else if (_T("right") == pPair->second)
nAlign = 2;
else if (_T("justify") == pPair->second)
nAlign = 3;
oRun.textAlignment = nAlign;
}
double dKoef = (double)oInfo.m_lUnitsHor * 25.4 / (oInfo.m_lMillimetresHor * 96);
pPair = m_mapSettings.find(_T("text-indent"));
if (m_mapSettings.end() != pPair)
{
CString strVal = pPair->second;
CorrectStringNum(strVal);
oRun.indent = (LONG)(XmlUtils::GetInteger(strVal) * dKoef);
}
pPair = m_mapSettings.find(_T("margin-left"));
if (m_mapSettings.end() != pPair)
{
CString strVal = pPair->second;
CorrectStringNum(strVal);
oRun.leftMargin = (LONG)(XmlUtils::GetInteger(strVal) * dKoef);
}
pPair = m_mapSettings.find(_T("color"));
if (m_mapSettings.end() != pPair)
{
oRun.bulletColor = new NSPresentationEditor::CColor();
oRun.bulletColor->FromString(pPair->second);
pPair = m_mapSettings.find(_T("tm_color"));
if (m_mapSettings.end() != pPair)
{
oRun.bulletColor->m_lSchemeIndex = (LONG)XmlUtils::GetInteger(pPair->second) - 1;
}
}
pPair = m_mapSettings.find(_T("lnspc"));
if (m_mapSettings.end() != pPair)
{
oRun.lineSpacing = (LONG)XmlUtils::GetInteger(pPair->second);
}
pPair = m_mapSettings.find(_T("spcafter"));
if (m_mapSettings.end() != pPair)
{
oRun.spaceAfter = (LONG)XmlUtils::GetInteger(pPair->second);
}
pPair = m_mapSettings.find(_T("spcbefore"));
if (m_mapSettings.end() != pPair)
{
oRun.spaceBefore = (LONG)XmlUtils::GetInteger(pPair->second);
}
}
AVSINLINE void LoadStyleCF(NSPresentationEditor::CTextCFRun& oRun, const NSPresentationEditor::CMetricInfo& oInfo)
{
std::map<CString, CString>::iterator pPair;
pPair = m_mapSettings.find(_T("font-weight"));
if (m_mapSettings.end() != pPair)
{
if (_T("bold") == pPair->second)
oRun.FontBold = true;
else
oRun.FontBold = false;
}
pPair = m_mapSettings.find(_T("font-style"));
if (m_mapSettings.end() != pPair)
{
if (_T("italic") == pPair->second)
oRun.FontItalic = true;
else
oRun.FontItalic = false;
}
pPair = m_mapSettings.find(_T("text-transform"));
if (m_mapSettings.end() != pPair)
{
if (_T("uppercase") == pPair->second)
oRun.Cap = (WORD)1;
else if (_T("lowercase") == pPair->second)
oRun.Cap = (WORD)2;
else
oRun.Cap = (WORD)0;
}
pPair = m_mapSettings.find(_T("text-decoration"));
if (m_mapSettings.end() != pPair)
{
if (_T("underline") == pPair->second)
oRun.FontUnderline = true;
else
oRun.FontUnderline = false;
}
pPair = m_mapSettings.find(_T("font-size"));
if (m_mapSettings.end() != pPair)
{
CString strVal = pPair->second;
CorrectStringNum(strVal);
oRun.Size = (WORD)(XmlUtils::GetInteger(strVal));
}
pPair = m_mapSettings.find(_T("color"));
if (m_mapSettings.end() != pPair)
{
oRun.Color = new NSPresentationEditor::CColor();
oRun.Color->FromString(pPair->second);
}
else
{
pPair = m_mapSettings.find(_T("tm_color"));
if (m_mapSettings.end() != pPair)
{
oRun.Color = new NSPresentationEditor::CColor();
oRun.Color->m_lSchemeIndex = (LONG)XmlUtils::GetInteger(pPair->second) - 1;
}
}
pPair = m_mapSettings.find(_T("font-family"));
if (m_mapSettings.end() != pPair)
{
oRun.FontProperties = new NSPresentationEditor::CFontProperties();
oRun.FontProperties->strFontName = pPair->second;
}
}
private:
BYTE GetColor(TCHAR* pChar1, TCHAR* pChar2)
{
if (pChar1 == pChar2)
return 0;
CString s(pChar1, (int)(pChar2 - pChar1));
return (BYTE)XmlUtils::GetInteger(s);
}
public:
void CorrectStringNum(CString& strValue)
{
int nStart = 0;
int nEnd = strValue.GetLength() - 1;
while (nStart <= nEnd)
{
if (((TCHAR)('-') == strValue[nStart]) || ((TCHAR('0') <= strValue[nStart]) && (TCHAR('9') >= strValue[nStart])))
break;
++nStart;
}
while (nStart <= nEnd)
{
if ((TCHAR('0') <= strValue[nEnd]) && (TCHAR('9') >= strValue[nEnd]))
break;
--nEnd;
}
if (nStart > nEnd)
{
strValue = _T("0");
return;
}
strValue = strValue.Mid(nStart, nEnd - nStart + 1);
}
};
class CStylesCSS
{
public:
std::vector<CCSS> m_arStyles;
public:
CStylesCSS() : m_arStyles()
{
}
~CStylesCSS()
{
}
AVSINLINE void Clear()
{
m_arStyles.clear();
}
public:
void LoadStyles(CString& strParams)
{
Clear();
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
int nPositionOld = 0;
TCHAR* pDataMem = pData;
while (nPosition < nCount)
{
if (*pDataMem == TCHAR('}'))
{
CString strTemp = strParams.Mid(nPositionOld, nPosition - nPositionOld + 1);
CCSS elem;
m_arStyles.push_back(elem);
m_arStyles.back().LoadFromString(strTemp);
nPositionOld = nPosition + 1;
}
++nPosition;
++pDataMem;
}
}
};
using namespace NSPresentationEditor;
class CTextLoader
{
public:
static void ConvertText(XmlUtils::CXmlNode& oNode, CTextAttributesEx& oText, CMetricInfo oMetric)
{
oText.m_arParagraphs.clear();
XmlUtils::CXmlNodes oParagraphs;
if (oNode.GetNodes(_T("*"), oParagraphs))
{
int nCountPFs = oParagraphs.GetCount();
int nNumberPF = 0;
for (int i = 0; i < nCountPFs; ++i)
{
XmlUtils::CXmlNode oNodePar;
oParagraphs.GetAt(i, oNodePar);
CParagraph elem;
oText.m_arParagraphs.push_back(elem);
CParagraph* pParagraph = &oText.m_arParagraphs[nNumberPF];
++nNumberPF;
if (_T("p") == oNodePar.GetName())
{
pParagraph->m_oPFRun.hasBullet = false;
CString strClass = oNodePar.GetAttribute(_T("class"));
int n1 = strClass.Find(TCHAR('_'));
int n2 = -1;
if (n1 != -1)
n2 = strClass.Find(TCHAR('_'), n1 + 1);
if (n2 != -1)
{
pParagraph->m_lTextType = XmlUtils::GetInteger(strClass.Mid(1, n1 - 1));
n1 += 4;
pParagraph->m_lTextLevel = XmlUtils::GetInteger(strClass.Mid(n1, n2 - n1));
oText.m_lTextType = pParagraph->m_lTextType;
}
CCSS oStylePar;
CString sAttribute = oNodePar.GetAttribute(_T("style"));
oStylePar.LoadFromString2(sAttribute);
oStylePar.LoadStylePF(pParagraph->m_oPFRun, oMetric);
XmlUtils::CXmlNodes oSpans;
if (oNodePar.GetNodes(_T("*"), oSpans))
{
int nCountCFs = oSpans.GetCount();
for (int nSpan = 0; nSpan < nCountCFs; ++nSpan)
{
XmlUtils::CXmlNode oNodeSpan;
oSpans.GetAt(nSpan, oNodeSpan);
if (_T("span") == oNodeSpan.GetName())
{
CSpan oSpan;
oSpan.m_strText = oNodeSpan.GetTextExt();
CCSS oStyleSpan;
CString sAttribute = oNodeSpan.GetAttribute(_T("style"));
oStyleSpan.LoadFromString2(sAttribute);
oStyleSpan.LoadStyleCF(oSpan.m_oRun, oMetric);
pParagraph->m_arSpans.push_back(oSpan);
}
else if (FALSE)
{
CSpan oSpan;
oSpan.m_strText = _T("\n");
pParagraph->m_arSpans.push_back(oSpan);
}
}
}
}
else
{
pParagraph->m_oPFRun.hasBullet = TRUE;
CString strClass = oNodePar.GetAttribute(_T("class"));
int n1 = strClass.Find(TCHAR('_'));
int n2 = -1;
if (n1 != -1)
n2 = strClass.Find(TCHAR('_'), n1 + 1);
if (n2 != -1)
{
pParagraph->m_lTextType = XmlUtils::GetInteger(strClass.Mid(1, n1 - 1));
n1 += 4;
pParagraph->m_lTextLevel = XmlUtils::GetInteger(strClass.Mid(n1, n2 - n1));
oText.m_lTextType = pParagraph->m_lTextType;
}
XmlUtils::CXmlNode oNodeLi;
if (oNodePar.GetNode(_T("li"), oNodeLi))
{
CCSS oStylePar;
CString sAttribute = oNodeLi.GetAttribute(_T("style"));
oStylePar.LoadFromString2(sAttribute);
oStylePar.LoadStylePF(pParagraph->m_oPFRun, oMetric);
XmlUtils::CXmlNodes oSpans;
if (oNodeLi.GetNodes(_T("*"), oSpans))
{
int nCountCFs = oSpans.GetCount();
for (int nSpan = 0; nSpan < nCountCFs; ++nSpan)
{
XmlUtils::CXmlNode oNodeSpan;
oSpans.GetAt(nSpan, oNodeSpan);
if (_T("span") == oNodeSpan.GetName())
{
CSpan oSpan;
oSpan.m_strText = oNodeSpan.GetTextExt();
CCSS oStyleSpan;
CString sAttribute = oNodeSpan.GetAttribute(_T("style"));
oStyleSpan.LoadFromString2(sAttribute);
oStyleSpan.LoadStyleCF(oSpan.m_oRun, oMetric);
pParagraph->m_arSpans.push_back(oSpan);
}
else if (FALSE)
{
CSpan oSpan;
oSpan.m_strText = _T("\n");
pParagraph->m_arSpans.push_back(oSpan);
}
}
}
}
}
size_t nCountS = pParagraph->m_arSpans.size();
if (0 < nCountS)
{
if (_T("\n") == pParagraph->m_arSpans[nCountS - 1].m_strText)
{
pParagraph->m_arSpans[nCountS - 1].m_strText = _T(" ");
if (1 == nCountS)
pParagraph->m_oPFRun.hasBullet = false;
}
}
}
}
}
static void ConvertText2(XmlUtils::CXmlNode& oNode, CTextAttributesEx& oText, CMetricInfo oMetric)
{
oText.m_arParagraphs.clear();
XmlUtils::CXmlNodes oParagraphs;
if (oNode.GetNodes(_T("*"), oParagraphs))
{
int nCountPFs = oParagraphs.GetCount();
int nNumberPF = 0;
for (int i = 0; i < nCountPFs; ++i)
{
XmlUtils::CXmlNode oNodePar;
oParagraphs.GetAt(i, oNodePar);
CParagraph elem;
oText.m_arParagraphs.push_back(elem);
CParagraph* pParagraph = &oText.m_arParagraphs[nNumberPF];
++nNumberPF;
if (_T("p") == oNodePar.GetName())
{
pParagraph->m_oPFRun.hasBullet = false;
CString strClass = oNodePar.GetAttribute(_T("class"));
int n1 = strClass.Find(TCHAR('_'));
int n2 = -1;
if (n1 != -1)
n2 = strClass.Find(TCHAR('_'), n1 + 1);
if (n2 != -1)
{
pParagraph->m_lTextType = XmlUtils::GetInteger(strClass.Mid(1, n1 - 1));
n1 += 4;
pParagraph->m_lTextLevel = XmlUtils::GetInteger(strClass.Mid(n1, n2 - n1));
oText.m_lTextType = pParagraph->m_lTextType;
}
CTextLoader::ConvertParagraph(oNodePar, pParagraph, oMetric);
}
else
{
pParagraph->m_oPFRun.hasBullet = true;
CString strClass = oNodePar.GetAttribute(_T("class"));
int n1 = strClass.Find(TCHAR('_'));
int n2 = -1;
if (n1 != -1)
n2 = strClass.Find(TCHAR('_'), n1 + 1);
if (n2 != -1)
{
pParagraph->m_lTextType = XmlUtils::GetInteger(strClass.Mid(1, n1 - 1));
n1 += 4;
pParagraph->m_lTextLevel = XmlUtils::GetInteger(strClass.Mid(n1, n2 - n1));
oText.m_lTextType = pParagraph->m_lTextType;
}
LONG lParLevel = pParagraph->m_lTextLevel;
XmlUtils::CXmlNodes oNodeLis;
if (oNodePar.GetNodes(_T("li"), oNodeLis))
{
int nCountLi = oNodeLis.GetCount();
for (int j = 0; j < nCountLi; ++j)
{
XmlUtils::CXmlNode oNodeLi;
oNodeLis.GetAt(j, oNodeLi);
if (0 == j)
{
CTextLoader::ConvertParagraph(oNodeLi, pParagraph, oMetric);
}
else
{
CParagraph elem;
oText.m_arParagraphs.push_back(elem);
pParagraph = &oText.m_arParagraphs[nNumberPF];
++nNumberPF;
pParagraph->m_oPFRun.hasBullet = true;
pParagraph->m_lTextType = oText.m_lTextType;
pParagraph->m_lTextLevel = (std::max)((LONG)0, lParLevel);
CTextLoader::ConvertParagraph(oNodeLi, pParagraph, oMetric);
}
}
}
}
}
}
}
static void ConvertParagraph(XmlUtils::CXmlNode& oNode, CParagraph* pParagraph, CMetricInfo oMetric)
{
CCSS oStylePar;
CString sAttribute = oNode.GetAttribute(_T("style"));
oStylePar.LoadFromString2(sAttribute);
oStylePar.LoadStylePF(pParagraph->m_oPFRun, oMetric);
XmlUtils::CXmlNodes oNodes;
if (oNode.GetChilds(oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNodeS;
oNodes.GetAt(i, oNodeS);
CString sName = oNodeS.GetName();
if (_T("#text") == sName)
{
CSpan oSpan;
oSpan.m_strText = oNodeS.GetXml();
pParagraph->m_arSpans.push_back(oSpan);
}
else if (_T("br") == sName)
{
CSpan oSpan;
CTextCFRun oRunBR;
CCSS _oStyleCF;
CString sAttribute = oNodeS.GetAttribute(_T("style"));
_oStyleCF.LoadFromString2(sAttribute);
_oStyleCF.LoadStyleCF(oRunBR, oMetric);
oSpan.m_oRun = oRunBR;
oSpan.m_strText = _T("\n");
pParagraph->m_arSpans.push_back(oSpan);
}
else if (_T("span") == sName)
{
ConvertSpan(pParagraph, oMetric, oNodeS, NULL);
}
}
}
}
static void ConvertSpan(CParagraph* pParagraph, CMetricInfo oMetric, XmlUtils::CXmlNode& oNode, CTextCFRun* pCFRun)
{
CTextCFRun oRun;
CCSS oStyleCF;
CString sAttribute = oNode.GetAttribute(_T("style"));
oStyleCF.LoadFromString2(sAttribute);
oStyleCF.LoadStyleCF(oRun, oMetric);
if (NULL != pCFRun)
oRun.ApplyBefore(*pCFRun);
XmlUtils::CXmlNodes oNodes;
if (oNode.GetChilds(oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNodeS;
oNodes.GetAt(i, oNodeS);
CString sName = oNodeS.GetName();
if (_T("#text") == sName)
{
CSpan oSpan;
oSpan.m_oRun = oRun;
oSpan.m_strText = oNodeS.GetXml();
CorrectXmlString2(oSpan.m_strText);
pParagraph->m_arSpans.push_back(oSpan);
}
else if (_T("br") == sName)
{
CTextCFRun oRunBR;
CCSS _oStyleCF;
CString sAttribute = oNodeS.GetAttribute(_T("style"));
_oStyleCF.LoadFromString2(sAttribute);
_oStyleCF.LoadStyleCF(oRunBR, oMetric);
oRunBR.ApplyBefore(oRun);
CSpan oSpan;
oSpan.m_oRun = oRunBR;
oSpan.m_strText = _T("\n");
pParagraph->m_arSpans.push_back(oSpan);
}
else if (_T("span") == sName)
{
ConvertSpan(pParagraph, oMetric, oNodeS, &oRun);
}
}
}
else
{
CSpan oSpan;
oSpan.m_oRun = oRun;
oSpan.m_strText = oNode.GetText();
if (!oSpan.m_strText.empty())
{
CorrectXmlString2(oSpan.m_strText);
//oSpan.m_strText.Replace( _T("VVODbryakVVOD"), _T("<br/>"));//xml2_reader
pParagraph->m_arSpans.push_back(oSpan);
}
}
}
};

View File

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

View File

@ -279,16 +279,9 @@ CString NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
strLine.Format(_T("<a:ln w=\"%d\">"), (int)(pen.Size * 36000));
line_writer.WriteString(strLine);
if (m_bWordArt)
{
line_writer.WriteString(std::wstring(L"<a:noFill/>"));
}
else
{
line_writer.WriteString(std::wstring(L"<a:solidFill>"));
line_writer.WriteString(ConvertColor(pen.Color, pen.Alpha));
line_writer.WriteString(std::wstring(L"</a:solidFill>"));
}
line_writer.WriteString(std::wstring(L"<a:solidFill>"));
line_writer.WriteString(ConvertColor(pen.Color, pen.Alpha));
line_writer.WriteString(std::wstring(L"</a:solidFill>"));
line_writer.WriteString(std::wstring(L"<a:round/><a:headEnd/><a:tailEnd/></a:ln>"));
@ -518,12 +511,12 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
m_oWriter.WriteStringXML(m_pImageElement->m_sName);
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"\""));
}
//if (!m_pImageElement->m_sDescription.empty())
//{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// m_oWriter.WriteString(std::wstring(L" descr=\""));
// m_oWriter.WriteStringXML(m_pImageElement->m_sDescription);
// m_oWriter.WriteString(std::wstring(L"\""));
//}
m_oWriter.WriteString(std::wstring(L"></p:cNvPr><p:cNvPicPr><a:spLocks noGrp=\"1\" noChangeAspect=\"1\"/></p:cNvPicPr>"));
@ -705,7 +698,27 @@ 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/>"));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_oWriter.WriteString(std::wstring(L"<a:avLst>"));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CPPTShape *pPPTShape = dynamic_cast<CPPTShape *>(m_pShapeElement->m_oShape.m_pShape);
CString strVal;
for (int i = 0 ; (pPPTShape) && (i < pPPTShape->m_arAdjustments.size()); i++)
{
switch(m_pShapeElement->m_lShapeType)
{
case oox::msosptTextFadeUp:
{
double kf = 4.63; //"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
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("\"/>"));
}break;
}
}
m_oWriter.WriteString(std::wstring(L"</a:avLst>"));
m_oWriter.WriteString(std::wstring(L"</a:prstTxWarp>"));
}
m_oWriter.WriteString(std::wstring(L"</a:bodyPr>"));
@ -728,11 +741,11 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
NSPresentationEditor::CParagraph* pParagraph = &m_pShapeElement->m_oShape.m_oText.m_arParagraphs[nIndexPar];
if (m_bWordArt && nIndexPar == nCount-1)
{
if (pParagraph->m_arSpans.size() < 1) break;
if (pParagraph->m_arSpans.size() == 1 && pParagraph->m_arSpans[0].m_strText.empty()) break;
}
//if (m_bWordArt && nIndexPar == nCount-1)
//{
// if (pParagraph->m_arSpans.size() < 1) break;
// if (pParagraph->m_arSpans.size() == 1 && pParagraph->m_arSpans[0].m_strText.empty()) break;
//}
CString _str1 = _T("");
_str1.Format(_T("<a:p><a:pPr lvl=\"%d\""), pParagraph->m_lTextLevel);
@ -835,7 +848,6 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
if (pPF->hasBullet.is_init())
{
if (pPF->hasBullet.get())
{
if (pPF->bulletColor.is_init())
@ -876,6 +888,13 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteStringXML(std::wstring(&bu, 1));
m_oWriter.WriteString(std::wstring(L"\"/>"));
}
else if (pParagraph->m_lTextLevel == 0)
{
wchar_t bu = 0x2022;
m_oWriter.WriteString(std::wstring(L"<a:buChar char=\""));
m_oWriter.WriteStringXML(std::wstring(&bu, 1));
m_oWriter.WriteString(std::wstring(L"\"/>"));
}
}
else
{
@ -896,7 +915,7 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
size_t nCountSpans = pParagraph->m_arSpans.size();
for (size_t nSpan = 0; nSpan < nCountSpans; ++nSpan)
{
if (TRUE)
if (true)
{
if ((nSpan == (nCountSpans - 1)) && (_T("\n") == pParagraph->m_arSpans[nSpan].m_strText || pParagraph->m_arSpans[nSpan].m_strText.empty()) )
{
@ -985,10 +1004,15 @@ void NSPresentationEditor::CShapeWriter::WriteTextInfo()
m_oWriter.WriteString(std::wstring(L">"));
if (m_bWordArt)
{
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> !!!
if (m_pShapeElement->m_bLine)
{
m_oWriter.WriteString(ConvertLine(m_pShapeElement->m_oPen));
}
m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oBrush));
m_oWriter.WriteString(ConvertShadow(m_pShapeElement->m_oShadow));
}
else
else
{
if (pCF->Color.is_init())
{
@ -1165,21 +1189,16 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"/>"));
}
if (m_bWordArt)
{
m_oWriter.WriteString(std::wstring(L"<a:noFill/>"));
}
else
if (!m_bWordArt)
{
m_oWriter.WriteString(ConvertBrush(m_pShapeElement->m_oBrush));
if (m_pShapeElement->m_bLine)
{
m_oWriter.WriteString(ConvertLine(m_pShapeElement->m_oPen));
}
m_oWriter.WriteString(ConvertShadow(m_pShapeElement->m_oShadow));
}
if (m_pShapeElement->m_bLine)
{
m_oWriter.WriteString(ConvertLine(m_pShapeElement->m_oPen));
}
m_oWriter.WriteString(ConvertShadow(m_pShapeElement->m_oShadow));
m_oWriter.WriteString(std::wstring(L"</p:spPr>"));
WriteTextInfo();

View File

@ -1,6 +1,6 @@
#pragma once
#include "CSS.h"
//#include "CSS.h"
class CStylesWriter
{