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

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

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65369 954022d7-b5bf-4e40-9824-e11837661b57
parent 0eadcf7c
......@@ -373,7 +373,7 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
NSPresentationEditor::CExFilesInfo* pInfo = m_oExMedia.LockAudioFromCollection(pAtom->m_nSoundRef);
if (NULL != pInfo)
{
pTransition->m_oAudio.m_strFileName = pInfo->m_strFilePath;
pTransition->m_oAudio.m_strAudioFileName = pInfo->m_strFilePath;
}
pTransition->m_bLoopSound = pAtom->m_bLoopSound;
......@@ -1330,7 +1330,46 @@ void CPPTUserInfo::AddAudioTransition (DWORD dwSlideID, CTransition* pTransition
CAudioElement* pAudio = new CAudioElement ();
if (pAudio)
{
pAudio->m_strFileName = strFilePath;
pAudio->m_strAudioFileName = strFilePath;
}
// ??? ???
}
void CPPTUserInfo::CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle, NSPresentationEditor::CTheme* pTheme)
{
for (int i = 0; i < 10; ++i)
{
if (!pStyle.m_pLevels[i].is_init())
pStyle.m_pLevels[i] = new NSPresentationEditor::CTextStyleLevel();
NSPresentationEditor::CTextPFRun* pPF = &pStyle.m_pLevels[i]->m_oPFRun;
NSPresentationEditor::CTextCFRun* pCF = &pStyle.m_pLevels[i]->m_oCFRun;
//pPF->textAlignment = (WORD)0;
//pPF->leftMargin = (LONG)0;
//pPF->indent = (LONG)0;
//pPF->fontAlign = (WORD)0;
pPF->wrapFlags = (WORD)0x02;
pPF->textDirection = (WORD)0;
//pPF->defaultTabSize = (LONG)0;
//pPF->lineSpacing = (LONG)100;
//pPF->spaceBefore = (LONG)0;
//pPF->spaceAfter = (LONG)0;
pCF->FontBold = false;
pCF->FontItalic = false;
pCF->FontUnderline = false;
pCF->FontStrikeout = false;
pCF->Size = 18;
pCF->BaseLineOffset = (double)0;
pCF->Cap = (WORD)0;
pCF->FontProperties = new NSPresentationEditor::CFontProperties();
pCF->FontProperties->SetFont(pTheme->m_arFonts[0]);
//pCF->Color = new NSPresentationEditor::CColor();
}
}
......@@ -93,43 +93,7 @@ public:
void LoadExVideo(CRecordsContainer* pExObject);
void LoadExAudio(CRecordsContainer* pExObject);
void CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle, NSPresentationEditor::CTheme* pTheme)
{
for (int i = 0; i < 10; ++i)
{
if (!pStyle.m_pLevels[i].is_init())
pStyle.m_pLevels[i] = new NSPresentationEditor::CTextStyleLevel();
NSPresentationEditor::CTextPFRun* pPF = &pStyle.m_pLevels[i]->m_oPFRun;
NSPresentationEditor::CTextCFRun* pCF = &pStyle.m_pLevels[i]->m_oCFRun;
pPF->textAlignment = (WORD)0;
pPF->leftMargin = (LONG)0;
pPF->indent = (LONG)0;
pPF->defaultTabSize = (LONG)0;
pPF->fontAlign = (WORD)0;
pPF->wrapFlags = (WORD)0x02;
pPF->textDirection = (WORD)0;
pPF->lineSpacing = (LONG)100;
pPF->spaceBefore = (LONG)0;
pPF->spaceAfter = (LONG)0;
pCF->FontBold = false;
pCF->FontItalic = false;
pCF->FontUnderline = false;
pCF->FontStrikeout = false;
pCF->Size = 18;
pCF->BaseLineOffset = (double)0;
pCF->Cap = (WORD)0;
pCF->FontProperties = new NSPresentationEditor::CFontProperties();
pCF->FontProperties->SetFont(pTheme->m_arFonts[0]);
pCF->Color = new NSPresentationEditor::CColor();
}
}
void CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle, NSPresentationEditor::CTheme* pTheme);
void CorrectColorScheme(std::vector<CColor>& oScheme)
{
if (oScheme.size() < 1) return;
......
......@@ -400,7 +400,7 @@ public:
inline void SetUpPropertyVideo(CVideoElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
}
inline void SetUpPropertyAudio(CAudioElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
{
......@@ -417,8 +417,8 @@ public:
int dwOffset = pInfo->GetIndexPicture(pProperty->m_lValue);
if (dwOffset >=0)
{
pElement->m_strFileName = pElement->m_strFileName + pInfo->GetFileNamePicture(dwOffset);
pElement->m_bImagePresent = true;
pElement->m_strImageFileName += pInfo->GetFileNamePicture(dwOffset);
pElement->m_bImagePresent = true;
}
}break;
case pictureId://OLE identifier of the picture.
......@@ -1444,12 +1444,14 @@ public:
GetRecordsByType(&oArrayEx, true, true);
CExFilesInfo oInfo;
CExFilesInfo oInfoDefault;
// ( )
CExFilesInfo::ExFilesType exType = CExFilesInfo::eftNone;
CExFilesInfo* pInfo = pMapIDs->Lock(0xFFFFFFFF, exType);
if (NULL != pInfo)
{
oInfo = *pInfo;
oInfo = *pInfo;
oInfoDefault = oInfo;
}
if (0 != oArrayEx.size())
......@@ -1463,15 +1465,18 @@ public:
if (CExFilesInfo::eftVideo == exType)
{
CVideoElement* pVideoElem = new CVideoElement();
pVideoElem->m_strFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
CVideoElement* pVideoElem = new CVideoElement();
pVideoElem->m_strVideoFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pVideoElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
pElem = (IElement*)pVideoElem;
pElem = (IElement*)pVideoElem;
}
else if (CExFilesInfo::eftAudio == exType)
{
CAudioElement* pAudioElem = new CAudioElement();
pAudioElem->m_strFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pAudioElem->m_strAudioFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pAudioElem->m_dClipStartTime = oInfo.m_dStartTime;
pAudioElem->m_dClipEndTime = oInfo.m_dEndTime;
......@@ -1494,8 +1499,8 @@ public:
}
else
{
CImageElement* pImageElem = new CImageElement();
pImageElem->m_strFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
CImageElement* pImageElem = new CImageElement();
pImageElem->m_strImageFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
pElem = (IElement*)pImageElem;
}
......@@ -1505,6 +1510,11 @@ public:
{
// shape
CShapeElement* pShape = new CShapeElement(NSBaseShape::ppt, eType);
CPPTShape *ppt_shape = dynamic_cast<CPPTShape *>(pShape->m_oShape.m_pShape);
if ( (ppt_shape) && (OOXMLShapes::sptCustom == ppt_shape->m_eType))
{
pShape->m_bShapePreset = true;
}
if (true)//if (/* */OOXMLShapes::sptCustom != pShape->m_oShape.m_eType)
{
CExFilesInfo::ExFilesType exType = CExFilesInfo::eftNone;
......@@ -2089,16 +2099,16 @@ protected:
}
else
{
pTextSettings->m_lTextType = 0;
//pTextSettings->m_lTextType = 0;
if (NSOfficePPT::Other != eTypeMaster)
{
if (0 <= nTextMasterType && nTextMasterType < 9)
{
if (pThemeWrapper->m_pStyles[nTextMasterType].is_init())
pTextSettings->m_oStyles = pThemeWrapper->m_pStyles[nTextMasterType].get();
}
}
//if (NSOfficePPT::Other != eTypeMaster)
//{
// if (0 <= nTextMasterType && nTextMasterType < 9)
// {
// if (pThemeWrapper->m_pStyles[nTextMasterType].is_init())
// pTextSettings->m_oStyles = pThemeWrapper->m_pStyles[nTextMasterType].get();
// }
//}
}
// (persist own) - m_oStyles
......@@ -2179,15 +2189,15 @@ protected:
pTextSettings->m_oStyles.ApplyAfter(pThemeWrapper->m_pStyles[nIndexType].get());
}
}
if (eTypeOwn != NSOfficePPT::NoPresent && eTypeOwn != eTypePersist && eTypeOwn != eTypeMaster)
{
int nIndexType = (int)eTypeOwn;
if (0 <= nIndexType && nIndexType < 9 && pLayout)
{
if (pThemeWrapper->m_pStyles[nIndexType].IsInit())
pTextSettings->m_oStyles.ApplyAfter(pThemeWrapper->m_pStyles[nIndexType].get());
}
}
//if (eTypeOwn != NSOfficePPT::NoPresent && eTypeOwn != eTypePersist && eTypeOwn != eTypeMaster)
//{ !!! Antarctida.ppt 2
// int nIndexType = (int)eTypeOwn;
// if (0 <= nIndexType && nIndexType < 9 && pLayout)
// {
// if (pThemeWrapper->m_pStyles[nIndexType].IsInit())
// pTextSettings->m_oStyles.ApplyAfter(pThemeWrapper->m_pStyles[nIndexType].get());
// }
//}
}
if ((_T("") != strText) && 0 == pTextSettings->m_arParagraphs.size())
......@@ -2212,31 +2222,22 @@ protected:
NSPresentationEditor::ConvertPPTTextToEditorStructure(oArrayPF, oArrayCF, strText, *pTextSettings);
}
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 = 11;
if (pShape->m_oActions.m_bPresent)
{
//todooo
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 = 11;
ApplyHyperlink(pShape, oColor);
}
CPPTShape* pPPTShape = dynamic_cast<CPPTShape*>(pShape->m_oShape.m_pShape);
if (NULL != pPPTShape)
if (NULL != pPPTShape) // wordart
{
// -
switch (pPPTShape->m_eType)
{
case sptTextPlainText:
......@@ -2280,8 +2281,6 @@ protected:
case sptTextCanUp:
case sptTextCanDown:
{
//pShape->m_oShape.m_oText.m_arParagraphs.clear();
pShape->m_oShape.m_oText.m_oAttributes.m_oTextBrush = pShape->m_oShape.m_oBrush;
pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignHorizontal = 1;
......
......@@ -98,7 +98,7 @@ namespace NSPresentationEditor
}
else
{
m_strFile = pAudioElem->m_strFileName;
m_strFile = pAudioElem->m_strAudioFileName;
m_dStartTime = pAudioElem->m_dStartTime;
m_dEndTime = pAudioElem->m_dEndTime;
......
......@@ -270,161 +270,10 @@ namespace NSPresentationEditor
**************************************************************/
class CVideoElement : public IElement
{
public:
std::wstring m_strFileName;
double m_dVideoDuration;
BYTE m_nAlpha;
LONG m_lAngle;
double m_dClipStartTime;
double m_dClipEndTime;
bool m_bLoop;
public:
CVideoElement() : IElement()
{
m_etType = etVideo;
m_strFileName = _T("");
m_dVideoDuration = 0.0;
m_nAlpha = 0xFF;
m_dClipStartTime = -1.0;
m_dClipEndTime = -1.0;
m_bLoop = false;
}
virtual ~CVideoElement()
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
CString strXml = SaveToXML();
oWriter.WriteString(strXml);
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual CString SaveToXML()
{
return GetVideoStream () + GetAudioStream ();
}
CString ToAnimationXml()
{
return _T("");
}
virtual IElement* CreateDublicate()
{
CVideoElement* pVideoElement = new CVideoElement();
SetProperiesToDublicate((IElement*)pVideoElement);
pVideoElement->m_strFileName = m_strFileName;
pVideoElement->m_nAlpha = m_nAlpha;
pVideoElement->m_dVideoDuration = m_dVideoDuration;
pVideoElement->m_dClipStartTime = m_dClipStartTime;
pVideoElement->m_dClipEndTime = m_dClipEndTime;
pVideoElement->m_bLoop = m_bLoop;
return (IElement*)pVideoElement;
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty)
{
}
inline CString GetVideoStream ()
{
int lIndex = m_strFileName.find(L"file:///");
if (0 == lIndex)
{
m_strFileName = m_strFileName.substr(8);
/*m_strFileName.Replace('/', '\\');*/
}
CString strFileName = std_string2string(m_strFileName);
CorrectXmlString(strFileName);
CString element;
element.Format ( _T("<VideoStream left='%d' top='%d' right='%d' bottom='%d' angle='%f' loop='%d' ")
_T(" widthmetric='%d' heightmetric='%d' ")
_T(" file='%ls' begin='%f' end='%f' >"),
(LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom, m_dRotate, m_bLoop,
m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
strFileName, m_dClipStartTime, m_dClipEndTime );
CString animations;
if(!m_oAnimations.m_arAnimations.empty())
{
m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
element += animations;
}
CString timeLine;
timeLine.Format ( _T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
element += timeLine;
element += _T("</VideoStream>");
return element;
}
inline CString GetAudioStream ()
{
CString element = _T("");
element.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf' loop='%d' >"), m_dStartTime, m_dEndTime - m_dStartTime, 100.0, m_bLoop);
int lIndex = m_strFileName.find(L"file:///");
if (0 == lIndex)
{
m_strFileName = m_strFileName.substr(8);
//m_strFileName.Replace('/', '\\');
//m_strFileName.Replace(L"%20", L" ");
}
CString strFileName = std_string2string(m_strFileName);
CorrectXmlString(strFileName);
CString source;
source.Format(_T("<Source StartTime='%lf' EndTime='%lf' FilePath='%ls'/>"), m_dClipStartTime, m_dClipEndTime, strFileName);
element += source;
CString animations;
if(!m_oAnimations.m_arAnimations.empty()) // audio "media call's" - play - pause - stop
{
m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
element += animations;
}
CString timeLine;
timeLine.Format ( _T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
element += timeLine;
element += _T("</AudioSource>");
return element;
}
};
class CImageElement : public IElement
{
public:
std::wstring m_strFileName;
std::wstring m_strImageFileName;
BYTE m_nAlpha;
......@@ -446,8 +295,6 @@ namespace NSPresentationEditor
{
m_etType = etPicture;
m_strFileName = _T("");
m_nAlpha = 0xFF;
m_bCropEnabled = false;
......@@ -492,7 +339,7 @@ namespace NSPresentationEditor
strEffect.Format(_T("<ImagePaint-DrawImageFromFile left='%d' top='%d' right='%d' bottom='%d' angle='%lf' flags='%d' filepath='%ls' metric='0' backcolor='-1' scaletype='-1' scalecolor='255' widthmetric='%d' heightmetric='%d'>\
<timeline type='1' begin='%lf' end='%lf' fadein='0' fadeout='0' completeness='1.0' /></ImagePaint-DrawImageFromFile>"),
(LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom,
m_dRotate, lFlags, m_strFileName,
m_dRotate, lFlags, m_strImageFileName,
m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
m_dStartTime, m_dEndTime);
......@@ -511,7 +358,7 @@ namespace NSPresentationEditor
strEffect.Format(_T("<ImagePaint-DrawImageFromFile left='%d' top='%d' right='%d' bottom='%d' angle='%lf' flags='%d' filepath='%ls' metric='0' backcolor='-1' scaletype='-1' scalecolor='255' widthmetric='%d' heightmetric='%d'>\
<timeline type='1' begin='%lf' end='%lf' fadein='0' fadeout='0' completeness='1.0' /></ImagePaint-DrawImageFromFile>"),
(LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom,
m_dRotate, lFlags, m_strFileName,
m_dRotate, lFlags, m_strImageFileName,
m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
m_dStartTime, m_dEndTime);
......@@ -535,7 +382,7 @@ namespace NSPresentationEditor
SetProperiesToDublicate((IElement*)pImageElement);
pImageElement->m_strFileName = m_strFileName;
pImageElement->m_strImageFileName = m_strImageFileName;
pImageElement->m_nAlpha = m_nAlpha;
pImageElement->m_bCropEnabled = m_bCropEnabled;
......@@ -597,10 +444,10 @@ namespace NSPresentationEditor
if ( oDownloader.IsFileDownloaded() )
{
m_strFileName = oDownloader.GetFilePath();
m_strImageFileName = oDownloader.GetFilePath();
}
#endif
return m_strFileName;
return m_strImageFileName;
}
};
......@@ -609,30 +456,35 @@ namespace NSPresentationEditor
public:
NSBaseShape::ClassType m_ClassType;
int m_lShapeType;
CShape m_oShape;
int m_lShapeType;
CShape m_oShape;
bool m_bShapePreset; // or rect (
CShapeElement(NSBaseShape::ClassType ClassType, int eType) : IElement(), m_lShapeType(eType), m_oShape(ClassType, eType)
{
m_ClassType = ClassType;
m_etType = etShape;
m_ClassType = ClassType;
m_etType = etShape;
m_oShape.m_rcBounds = m_rcBounds;
m_oShape.m_rcBounds = m_rcBounds;
m_oShape.m_dStartTime = m_dStartTime;
m_oShape.m_dStartTime = m_dEndTime;
m_oShape.m_dStartTime = m_dStartTime;
m_oShape.m_dStartTime = m_dEndTime;
m_bShapePreset = false;
}
CShapeElement() : m_oShape(NSBaseShape::unknown, 0x1000)
{
m_lShapeType = 0x1000;
m_etType = etShape;
m_lShapeType = 0x1000;
m_etType = etShape;
m_bShapePreset = false;
}
CShapeElement(const CString& str) : IElement(), m_oShape(NSBaseShape::unknown, 0x1000)
{
m_lShapeType = 0x1000;
m_lShapeType = 0x1000;
m_bShapePreset = false;
m_oShape.LoadFromXML(str);
m_ClassType = m_oShape.m_pShape->GetClassType();
}
......@@ -726,6 +578,9 @@ namespace NSPresentationEditor
SetProperiesToDublicate((IElement*)pShapeElement);
pShapeElement->m_lShapeType = m_lShapeType;
pShapeElement->m_bShapePreset = m_bShapePreset;
m_oShape.SetToDublicate(&pShapeElement->m_oShape);
return (IElement*)pShapeElement;
}
......@@ -932,9 +787,9 @@ namespace NSPresentationEditor
}
NSGuidesVML::CFormParam pParamCoef;
pParamCoef.m_eType = ptValue;
pParamCoef.m_eType = ptValue;
pParamCoef.m_lParam = 65536;
pParamCoef.m_lCoef = 65536;
pParamCoef.m_lCoef = 65536;
return ConvertPPTtoPPTX(pPPTShape, pParamCoef, bIsNamespace);
}
......@@ -1126,7 +981,7 @@ namespace NSPresentationEditor
class CAudioElement : public IElement
{
public:
std::wstring m_strFileName;
std::wstring m_strAudioFileName;
BYTE m_nAmplify;
bool m_bWithVideo;
......@@ -1139,15 +994,13 @@ namespace NSPresentationEditor
public:
CAudioElement() : IElement()
{
m_etType = etAudio;
m_etType = etAudio;
m_strFileName = _T("");
m_nAmplify = 100;
m_bWithVideo = false;
m_nAmplify = 100;
m_bWithVideo = false;
m_dAudioDuration = 0.0;
m_bLoop = false;
m_dAudioDuration = 0.0;
m_bLoop = false;
m_dClipStartTime = 0.0;
m_dClipEndTime = -1.0;
......@@ -1162,15 +1015,15 @@ namespace NSPresentationEditor
CString element = _T("");
element.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf'>"), m_dStartTime, m_dEndTime-m_dStartTime, (double)m_nAmplify);
int lIndex = m_strFileName.find(L"file:///");
int lIndex = m_strAudioFileName.find(L"file:///");
if (0 == lIndex)
{
m_strFileName = m_strFileName.substr(8);
m_strAudioFileName = m_strAudioFileName.substr(8);
//m_strFileName.Replace('/', '\\');
//m_strFileName.Replace(L"%20", L" ");
}
CString strFileName = std_string2string(m_strFileName);
CString strFileName = std_string2string(m_strAudioFileName);
CorrectXmlString(strFileName);
CString source;
......@@ -1212,15 +1065,15 @@ namespace NSPresentationEditor
SetProperiesToDublicate((IElement*)pAudioElement);
pAudioElement->m_strFileName = m_strFileName;
pAudioElement->m_nAmplify = m_nAmplify;
pAudioElement->m_bWithVideo = m_bWithVideo;
pAudioElement->m_strAudioFileName = m_strAudioFileName;
pAudioElement->m_nAmplify = m_nAmplify;
pAudioElement->m_bWithVideo = m_bWithVideo;
pAudioElement->m_dAudioDuration = m_dAudioDuration;
pAudioElement->m_bLoop = m_bLoop;
pAudioElement->m_dAudioDuration = m_dAudioDuration;
pAudioElement->m_bLoop = m_bLoop;
pAudioElement->m_dClipStartTime = m_dClipStartTime;
pAudioElement->m_dClipEndTime = m_dClipEndTime;
pAudioElement->m_dClipStartTime = m_dClipStartTime;
pAudioElement->m_dClipEndTime = m_dClipEndTime;
return (IElement*)pAudioElement;
}
......@@ -1229,6 +1082,155 @@ namespace NSPresentationEditor
{
}
};
class CVideoElement : public CImageElement
{
public:
std::wstring m_strVideoFileName;
double m_dVideoDuration;
BYTE m_nAlpha;
double m_dClipStartTime;
double m_dClipEndTime;
bool m_bLoop;
public:
CVideoElement() : CImageElement()
{
m_etType = etVideo;
m_dVideoDuration = 0.0;
m_nAlpha = 0xFF;
m_dClipStartTime = -1.0;
m_dClipEndTime = -1.0;
m_bLoop = false;
}
virtual ~CVideoElement()
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
CString strXml = SaveToXML();
oWriter.WriteString(strXml);
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual CString SaveToXML()
{
return GetVideoStream () + GetAudioStream ();
}
CString ToAnimationXml()
{
return _T("");
}
virtual IElement* CreateDublicate()
{
CVideoElement* pVideoElement = new CVideoElement();
SetProperiesToDublicate((IElement*)pVideoElement);
pVideoElement->m_strVideoFileName = m_strVideoFileName;
pVideoElement->m_nAlpha = m_nAlpha;
pVideoElement->m_dVideoDuration = m_dVideoDuration;
pVideoElement->m_dClipStartTime = m_dClipStartTime;
pVideoElement->m_dClipEndTime = m_dClipEndTime;
pVideoElement->m_bLoop = m_bLoop;
return (IElement*)pVideoElement;
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty)
{
}
inline CString GetVideoStream ()
{
int lIndex = m_strVideoFileName.find(L"file:///");
if (0 == lIndex)
{
m_strVideoFileName = m_strVideoFileName.substr(8);
/*m_strFileName.Replace('/', '\\');*/
}
CString strFileName = std_string2string(m_strVideoFileName);
CorrectXmlString(strFileName);
CString element;
element.Format ( _T("<VideoStream left='%d' top='%d' right='%d' bottom='%d' angle='%f' loop='%d' ")
_T(" widthmetric='%d' heightmetric='%d' ")
_T(" file='%ls' begin='%f' end='%f' >"),
(LONG)m_rcBounds.left, (LONG)m_rcBounds.top, (LONG)m_rcBounds.right, (LONG)m_rcBounds.bottom, m_dRotate, m_bLoop,
m_oMetric.m_lMillimetresHor, m_oMetric.m_lMillimetresVer,
strFileName, m_dClipStartTime, m_dClipEndTime );
CString animations;
if(!m_oAnimations.m_arAnimations.empty())
{
m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
element += animations;
}
CString timeLine;
timeLine.Format ( _T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
element += timeLine;
element += _T("</VideoStream>");
return element;
}
inline CString GetAudioStream ()
{
CString element = _T("");
element.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf' loop='%d' >"), m_dStartTime, m_dEndTime - m_dStartTime, 100.0, m_bLoop);
int lIndex = m_strVideoFileName.find(L"file:///");
if (0 == lIndex)
{
m_strVideoFileName = m_strVideoFileName.substr(8);
//m_strFileName.Replace('/', '\\');
//m_strFileName.Replace(L"%20", L" ");
}
CString strFileName = std_string2string(m_strVideoFileName);
CorrectXmlString(strFileName);
CString source;
source.Format(_T("<Source StartTime='%lf' EndTime='%lf' FilePath='%ls'/>"), m_dClipStartTime, m_dClipEndTime, strFileName);
element += source;
CString animations;
if(!m_oAnimations.m_arAnimations.empty()) // audio "media call's" - play - pause - stop
{
m_oAnimations.m_dSlideWidth = m_oMetric.m_lMillimetresHor;
m_oAnimations.m_dSlideHeight = m_oMetric.m_lMillimetresVer;
animations = m_oAnimations.ToXml(m_dStartTime, m_dEndTime);
element += animations;
}
CString timeLine;
timeLine.Format ( _T("<timeline type = \"1\" begin=\"%f\" end=\"%f\" fadein=\"0\" fadeout=\"0\" completeness=\"1.0\"/> "), m_dStartTime, m_dEndTime );
element += timeLine;
element += _T("</AudioSource>");
return element;
}
};
}
namespace NSStrings
{
......
......@@ -255,7 +255,7 @@ namespace NSCustomVML
class CGuide
{
private:
public:
FormulaType m_eType;
BYTE m_param_type1;
......@@ -269,7 +269,6 @@ namespace NSCustomVML
LONG m_lShapeWidth;
LONG m_lShapeHeight;
public:
CGuide()
{
......@@ -406,25 +405,24 @@ namespace NSCustomVML
private:
RulesType m_ePath;
std::vector<Aggplus::POINT> m_arVertices;
std::vector<CSegment> m_arSegments;
std::vector<CGuide> m_arGuides;
std::vector<LONG>* m_pAdjustValues;
std::vector<Aggplus::POINT> m_arVertices;
std::vector<CSegment> m_arSegments;
std::vector<CGuide> m_arGuides;
std::vector<LONG>* m_pAdjustValues;
bool m_bIsVerticesPresent;
bool m_bIsPathPresent;
bool m_bIsVerticesPresent;
bool m_bIsPathPresent;
CBrush m_oBrush;
CPen m_oPen;
public:
CCustomVML() :
m_arVertices(), m_arSegments(), m_arGuides(), m_pAdjustValues(NULL)
CCustomVML() : m_arVertices(), m_arSegments(), m_arGuides(), m_pAdjustValues(NULL)
{
m_ePath = rtCurveTo/*rtLineTo*/;
m_bIsVerticesPresent = false;
m_bIsPathPresent = false;
m_bIsVerticesPresent = false;
m_bIsPathPresent = false;
}
CCustomVML(const CCustomVML& oSrc)
......@@ -461,7 +459,7 @@ namespace NSCustomVML
}
public:
bool IsCustom()
bool IsCustom()
{
return (m_bIsVerticesPresent && m_bIsPathPresent);
}
......@@ -486,7 +484,7 @@ namespace NSCustomVML
if (lCount > 0)
{
m_bIsVerticesPresent = true;
m_bIsVerticesPresent = true;
}
for (WORD lIndex = 0; lIndex < lCount; ++lIndex)
......@@ -494,8 +492,8 @@ namespace NSCustomVML
Aggplus::POINT oPoint;
if (pProperty->m_bIsTruncated)
{
oPoint.x = (LONG)oReader.ReadWORD();
oPoint.y = (LONG)oReader.ReadWORD();
oPoint.x = (short)oReader.ReadWORD();
oPoint.y = (short)oReader.ReadWORD();
}
else
{
......@@ -505,13 +503,13 @@ namespace NSCustomVML
LONG lMinF = (LONG)0x80000000;
LONG lMaxF = (LONG)0x8000007F;
if (lMinF <= oPoint.x)
if (lMinF <= (DWORD)oPoint.x)
{
int nGuideIndex = (DWORD)oPoint.x - 0x80000000;
bool b = false;
}
if (lMinF <= oPoint.y)
if (lMinF <= (DWORD)oPoint.y)
{
int nGuideIndex = (DWORD)oPoint.y - 0x80000000;
......@@ -617,14 +615,45 @@ namespace NSCustomVML
bool bBreak = false;
LONG lMinF = (LONG)0x80000000;
LONG lMaxF = (LONG)0x8000007F;
int nGuideIndex_x , nGuideIndex_y;
if (0 == m_arSegments.size())
{
strPath = GetRulerVML(m_ePath);
for (size_t nIndex = 0; nIndex < m_arVertices.size(); ++nIndex)
{
nGuideIndex_x = nGuideIndex_y = -1;
if (lMinF <= (DWORD)m_arVertices[nIndex].x) nGuideIndex_x = (DWORD)m_arVertices[nIndex].x - 0x80000000;
if (lMinF <= (DWORD)m_arVertices[nIndex].y) nGuideIndex_y = (DWORD)m_arVertices[nIndex].y - 0x80000000;
CString str = _T("");
str.Format(_T("%d,%d,"), m_arVertices[nIndex].x, m_arVertices[nIndex].y);
strPath += str;
if (nGuideIndex_x >= 0 )
{
//str.Format(_T("gd%d,"), nGuideIndex_x);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1);
strPath += str;
}
else
{
str.Format(_T("%d,"), m_arVertices[nIndex].x);
strPath += str;
}
if (nGuideIndex_y >= 0)
{
//str.Format(_T("gd%d,"), nGuideIndex_y);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1);
strPath += str;
}
else
{
str.Format(_T("%d,"), m_arVertices[nIndex].y);
strPath += str;
}
}
strPath.Delete(strPath.GetLength() - 1);
}
......@@ -657,7 +686,7 @@ namespace NSCustomVML
}
else
{
m_oPen.Color = (DWORD)m_arVertices[nStart].x;
m_oPen.Color = (DWORD)m_arVertices[nStart].x;
}
}
nEnd = nStart + m_arSegments[nS].m_nCount;
......@@ -680,9 +709,34 @@ namespace NSCustomVML
for (size_t nV = nStart; nV < nEnd; ++nV)
{
nGuideIndex_x = nGuideIndex_y = -1;
if (lMinF <= (DWORD)m_arVertices[nV].x) nGuideIndex_x = (DWORD)m_arVertices[nV].x - 0x80000000;
if (lMinF <= (DWORD)m_arVertices[nV].y) nGuideIndex_y = (DWORD)m_arVertices[nV].y - 0x80000000;
CString str = _T("");
str.Format(_T("%d,%d,"), m_arVertices[nV].x, m_arVertices[nV].y);
strPath += str;
if (nGuideIndex_x >= 0 )
{
//str.Format(_T("gd%d,"), nGuideIndex_x);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_x].m_param_value1);
strPath += str;
}
else
{
str.Format(_T("%d,"), m_arVertices[nV].x);
strPath += str;
}
if (nGuideIndex_y >= 0)
{
//str.Format(_T("gd%d,"), nGuideIndex_y);//m_arGuides[nGuideIndex_y].m_param_value1);
str.Format(_T("%d,"), m_arGuides[nGuideIndex_y].m_param_value1);
strPath += str;
}
else
{
str.Format(_T("%d,"), m_arVertices[nV].y);
strPath += str;
}
}
if (nEnd != nStart)
......
......@@ -16,7 +16,12 @@ CPPTShape* CPPTShape::CreateByType(PPTShapes::ShapeType type)
CPPTShape* pShape = NULL;
switch (type)
{
case 0: { pShape = new CPPTShape(); break; }
// msosptNotchedCircularArrow 0x00000064 A value that SHOULD NOT be used.
// msosptHostControl 0x000000C9 A value that SHOULD NOT be used.
case sptNotchedCircularArrow:
case sptHostControl:
case 0: { pShape = new CRectangleType(); break; }
//CREATE_BY_SPT(sptMin, CLineType)
CREATE_BY_SPT(sptAccentBorderCallout90, CAccentBorderCallout90Type)
......
......@@ -326,7 +326,7 @@ void NSPresentationEditor::CShapeWriter::WriteShapeInfo()
void NSPresentationEditor::CShapeWriter::WriteTextInfo()
{
size_t nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size();
if (/*0 == nCount || */(0x00 == (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Text)))
if (0x00 == (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Text))
return;
m_oWriter.WriteString(std::wstring(L"<p:txBody>"));
......@@ -660,8 +660,6 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
if (m_pShapeElement == NULL) return _T("");
bool bPath = false;
std::wstring prstTxWarp;
std::wstring prstGeom = oox::Spt2ShapeType((oox::MSOSPT)m_pShapeElement->m_lShapeType);
......@@ -675,15 +673,11 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
prstGeom = L"rect";
m_oBrush.Type = c_BrushTypeNoFill;
}
else bPath = true;
}
else
{
if (oox::msosptTextBox == (oox::MSOSPT)m_pShapeElement->m_lShapeType)
m_bTextBox = true;
if (m_pShapeElement->m_oShape.m_pShape->m_arAdjustments.size() > 0)
bPath = true;
}
m_oWriter.WriteString(std::wstring(L"<p:sp>"));
......@@ -739,80 +733,33 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape()
{
m_pShapeElement->m_oShape.ToRenderer(dynamic_cast<IRenderer*>(this), oInfo, m_oMetricInfo, 0.0, 1.0);
}
#if 0
if (bPath && m_oWriterVML.GetCurSize() >= 10)
if (prstTxWarp.empty())
{
if (m_pShapeElement->m_oShape.m_strPPTXShape.IsEmpty())
if (m_pShapeElement->m_bShapePreset)
{
m_oWriter.WriteString(std::wstring(L"<a:custGeom>"));
double dW = (std::max)(m_oBounds.GetWidth(), 0.1);
double dH = (std::max)(m_oBounds.GetHeight(), 0.1);
int __l = (int)((m_oTextRect.left - m_oBounds.left) * 100000 / dW);
int __t = (int)((m_oTextRect.top - m_oBounds.top) * 100000 / dH);
int __r = (int)((m_oTextRect.right - m_oBounds.left) * 100000 / dW);
int __b = (int)((m_oTextRect.bottom - m_oBounds.top) * 100000 / dH);
if (prstGeom.empty()) prstGeom = L"rect";
size_t __nCount = m_pShapeElement->m_oShape.m_oText.m_arParagraphs.size();
if (0 == __nCount || (0x00 == (m_pShapeElement->m_oShape.m_lDrawType & c_ShapeDrawType_Text)))
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
{
m_oWriter.WriteString(std::wstring(L"<a:rect l=\"l\" t=\"t\" r=\"r\" b=\"b\"/>"));
}
else
{
CString strGuides = _T("");
strGuides.Format(_T("<a:gdLst><a:gd name=\"_l\" fmla=\"*/ w %d 100000\"/><a:gd name=\"_t\" fmla=\"*/ h %d 100000\"/>\
<a:gd name=\"_r\" fmla=\"*/ w %d 100000\"/><a:gd name=\"_b\" fmla=\"*/ h %d 100000\"/></a:gdLst>"),
__l, __t, __r, __b);
m_oWriter.WriteString(strGuides);
m_oWriter.WriteString(std::wstring(L"<a:rect l=\"_l\" t=\"_t\" r=\"_r\" b=\"_b\"/>"));
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
if (!m_bWordArt)
{
m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
}
}
m_oWriter.WriteString(std::wstring(L"<a:pathLst>"));
m_oWriter.Write(m_oWriterVML);
m_oWriter.WriteString(std::wstring(L"</a:pathLst>"));
m_oWriter.WriteString(std::wstring(L"</a:custGeom>"));
m_oWriter.WriteString(std::wstring(L"</a:prstGeom>"));
}
else
{
m_oWriter.WriteString(m_pShapeElement->m_oShape.m_strPPTXShape);
}
}
else
{
if (prstGeom.empty()) prstGeom = L"rect";
m_oWriter.WriteString(std::wstring(L"<a:prstGeom"));
{
m_oWriter.WriteString(std::wstring(L" prst=\"") + prstGeom + std::wstring(L"\">"));
if (!m_bWordArt)
{
m_oWriter.WriteString(std::wstring(L"<a:avLst/>"));
//todooo !!
//for (int i = 0; i < m_pShapeElement->m_oShape.m_pShape->m_arAdjustments.size(); i++)
//{
// CString str;
// str.Format(L"<a:gd name=\"adj%d\" fmla=\"val %d\"/>", i+1, m_pShapeElement->m_oShape.m_pShape->m_arAdjustments[i]);
// m_oWriter.WriteString(str);
//}
//m_oWriter.WriteString(std::wstring(L"</a:avLst>"));
}
m_oWriter.WriteString(m_pShapeElement->ConvertPPTShapeToPPTX());
}
m_oWriter.WriteString(std::wstring(L"</a:prstGeom>"));
}
#else
if (prstTxWarp.empty())
{
m_oWriter.WriteString(m_pShapeElement->ConvertPPTShapeToPPTX());
}
else
{
//word art
m_oWriter.WriteString(std::wstring(L"<a:prstGeom prst=\"rect\"/>"));
}
#endif
m_oWriter.WriteString(ConvertBrush(m_oBrush));
......@@ -848,7 +795,7 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage()
oInfo.m_lOriginalHeight = (LONG)m_pImageElement->m_rcBoundsOriginal.GetHeight();
m_oWriter.WriteString(std::wstring(L"<p:blipFill>"));
CString strRid = m_pRels->WriteImage(m_pImageElement->m_strFileName);
CString strRid = m_pRels->WriteImage(m_pImageElement->m_strImageFileName);
CString strWrite = _T("<a:blip r:embed=\"") + strRid + _T("\"/>");
......
......@@ -124,7 +124,24 @@ public:
oWriter.WriteString(str1);
NSPresentationEditor::CTextPFRun* pPF = &oLevel.m_oPFRun;
//------------------------------------------- normalize (a-la CTextAttributesEx)
double dScaleX = 625 * 2.54 ;//???? /2
//1/576 inch = 72/576 pt = 360000 *72 * 2.54 /(72*576) emu
if (pPF->leftMargin.is_init())
pPF->leftMargin = pPF->leftMargin.get() * dScaleX;
if (pPF->indent.is_init())
pPF->indent = pPF->indent.get() * dScaleX;
if (pPF->lineSpacing.is_init())
pPF->lineSpacing =- pPF->lineSpacing.get();
if (pPF->spaceAfter.is_init())
pPF->spaceAfter = -pPF->spaceAfter.get() ;
if (pPF->spaceBefore.is_init())
pPF->spaceBefore = -pPF->spaceBefore.get() ;
if (pPF->defaultTabSize.is_init())
pPF->defaultTabSize = pPF->defaultTabSize.get()* dScaleX;
//------------------------------------------------------------
if (pPF->fontAlign.is_init())
{
CString strProp = GetFontAlign(pPF->fontAlign.get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment