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

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65750 954022d7-b5bf-4e40-9824-e11837661b57
parent ad95d6ab
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "Elements.h"
namespace NSPresentationEditor
{
class CAudioPart
{
public:
std::wstring m_strFile;
double m_dStartTime;
double m_dEndTime;
double m_dClipStartTime;
double m_dClipEndTime;
double m_dAudioDuration;
bool m_bLoop;
bool m_bStop;
bool m_bIsTransition;
double m_dAmplify;
public:
CAudioPart()
{
m_strFile = _T("");
m_dStartTime = 0.0;
m_dEndTime = -1.0;
m_dClipStartTime = 0.0;
m_dClipEndTime = -1.0;
m_dAudioDuration = 0.0;
m_bLoop = false;
m_bStop = false;
m_bIsTransition = false;
m_dAmplify = 100.0;
}
~CAudioPart()
{
}
CAudioPart(const CAudioPart& oSrc)
{
*this = oSrc;
}
CAudioPart& operator=(const CAudioPart& oSrc)
{
m_strFile = oSrc.m_strFile;
m_dStartTime = oSrc.m_dStartTime;
m_dEndTime = oSrc.m_dEndTime;
m_dClipStartTime = oSrc.m_dClipStartTime;
m_dClipEndTime = oSrc.m_dClipEndTime;
m_dAudioDuration = oSrc.m_dAudioDuration;
m_bLoop = oSrc.m_bLoop;
m_bStop = oSrc.m_bStop;
m_bIsTransition = oSrc.m_bIsTransition;
m_dAmplify = oSrc.m_dAmplify;
return *this;
}
CAudioPart(CAudioElement* pAudioElem)
{
if (NULL == pAudioElem)
{
m_strFile = _T("");
m_dStartTime = 0.0;
m_dEndTime = -1.0;
m_dClipStartTime = 0.0;
m_dClipEndTime = -1.0;
m_dAudioDuration = 0.0;
m_bLoop = false;
m_bStop = false;
m_bIsTransition = false;
m_dAmplify = 100.0;
}
else
{
m_strFile = pAudioElem->m_strAudioFileName;
m_dStartTime = pAudioElem->m_dStartTime;
m_dEndTime = pAudioElem->m_dEndTime;
m_dClipStartTime = pAudioElem->m_dClipStartTime;
m_dClipEndTime = pAudioElem->m_dClipEndTime;
m_dAudioDuration = pAudioElem->m_dAudioDuration;
m_bLoop = ( pAudioElem->m_bLoop == TRUE) ? true : false;;
m_bStop = false;
m_bIsTransition = false;
m_dAmplify = 100.0;
}
}
public:
void CalculateDuration()
{
if (0.0 < m_dAudioDuration || _T("") == m_strFile)
return;
}
};
class CAudioOverlay
{
public:
std::vector<CAudioPart> m_arParts;
double m_dAllDuration;
public:
CAudioOverlay() : m_arParts(), m_dAllDuration(0.0)
{
}
~CAudioOverlay()
{
}
CAudioOverlay(const CAudioOverlay& oSrc)
{
*this = oSrc;
}
CAudioOverlay& operator=(const CAudioOverlay& oSrc)
{
m_arParts.insert(m_arParts.end(), oSrc.m_arParts.begin(), oSrc.m_arParts.end());
m_dAllDuration = oSrc.m_dAllDuration;
return *this;
}
public:
void Calculate()
{
size_t nCount = m_arParts.size();
//
for (size_t i = 0; i < nCount; ++i)
{
CAudioPart* pPart = &m_arParts[i];
pPart->CalculateDuration();
if (pPart->m_dStartTime < 0.0)
pPart->m_dStartTime = 0.0;
pPart->m_dEndTime = pPart->m_dStartTime + pPart->m_dAudioDuration;
if (pPart->m_dEndTime > m_dAllDuration)
{
pPart->m_dEndTime = m_dAllDuration;
}
if (pPart->m_bLoop)
{
pPart->m_dEndTime = m_dAllDuration;
}
}
//
for (size_t i = 0; i < nCount; ++i)
{
CAudioPart* pPart = &m_arParts[i];
if (pPart->m_bIsTransition)
{
if (pPart->m_bStop)
{
//
for (size_t j = 0; j < nCount; ++j)
{
if (j == i)
continue;
CAudioPart* pMem = &m_arParts[j];
if (pMem->m_dStartTime <= pPart->m_dStartTime && pMem->m_dEndTime > pPart->m_dStartTime)
{
pMem->m_dEndTime = pPart->m_dStartTime;
}
}
}
if (pPart->m_bLoop)
{
//
double dMin = m_dAllDuration;
for (size_t j = 0; j < nCount; ++j)
{
if (j == i)
continue;
CAudioPart* pMem = &m_arParts[j];
if (pMem->m_dStartTime > pPart->m_dEndTime)
{
if (dMin > pMem->m_dStartTime)
dMin = pMem->m_dStartTime;
}
}
pPart->m_dEndTime = dMin;
}
}
else
{
if (pPart->m_bLoop)
{
pPart->m_dEndTime = m_dAllDuration;
}
}
}
}
CString GetAudioOverlay()
{
CString strRes = _T("");
size_t nCount = m_arParts.size();
for (size_t i = 0; i < nCount; ++i)
{
CAudioPart* pPart = &m_arParts[i];
CString strOverlay1 = _T("");
CString strOverlay2 = _T("");
strOverlay1.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf'>"),
pPart->m_dStartTime, pPart->m_dEndTime - pPart->m_dStartTime, pPart->m_dAmplify);
int lIndex = pPart->m_strFile.find(L"file:///");
if (0 == lIndex)
{
pPart->m_strFile = pPart->m_strFile.substr(8);
//pPart->m_strFile.Replace('/', '\\');
//pPart->m_strFile.Replace(L"%20", L" ");
}
CString strFile_ = std_string2string(pPart->m_strFile);
CorrectXmlString(strFile_);
strOverlay2.Format(_T("<Source StartTime='%lf' EndTime='%lf' FilePath='%s'/></AudioSource>"),
pPart->m_dClipStartTime, pPart->m_dClipEndTime, strFile_);
strOverlay1 += strOverlay2;
strRes += strOverlay1;
}
return strRes;
}
};
}
\ No newline at end of file
This diff is collapsed.
#pragma once
#include <vector>
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
namespace NSPresentationEditor
{
class CEffect
{
public:
CString m_strEffect;
public:
CEffect() : m_strEffect(_T(""))
{
}
CEffect& operator=(const CEffect& oSrc)
{
m_strEffect = oSrc.m_strEffect;
return *this;
}
CEffect(const CEffect& oSrc)
{
*this = oSrc;
}
~CEffect()
{
}
};
class CEffects
{
public:
std::vector<CEffect> m_arEffects;
public:
CEffects() : m_arEffects()
{
}
CEffects& operator=(const CEffects& oSrc)
{
m_arEffects.insert(m_arEffects.end(), oSrc.m_arEffects.begin(), oSrc.m_arEffects.end());
return *this;
}
CEffects(const CEffects& oSrc)
{
*this = oSrc;
}
~CEffects()
{
}
};
}
#pragma once
#include "TextAttributesEx.h"
#include "Interactive.h"
#include "Animations.h"
#include "ElementProperties.h"
namespace NSPresentationEditor
{
enum ElementType
{
etVideo = 0,
etAudio = 1,
etPicture = 2,
etShape = 3,
etText = 4
};
enum enumPlaceholderType
{
PT_None = 0,
PT_MasterTitle,
PT_MasterBody,
PT_MasterCenterTitle,
PT_MasterSubTitle,
PT_MasterNotesSlideImage,
PT_MasterNotesBody,
PT_MasterDate,
PT_MasterSlideNumber,
PT_MasterFooter,
PT_MasterHeader,
PT_NotesSlideImage,
PT_NotesBody,
PT_Title,
PT_Body,
PT_CenterTitle,
PT_SubTitle,
PT_VerticalTitle,
PT_VerticalBody,
PT_Object,
PT_Graph,
PT_Table,
PT_ClipArt,
PT_OrgChart,
PT_Media,
PT_VerticalObject,
PT_Picture
};
static void CorrectPlaceholderType(int & type)
{
switch (type)
{
case PT_MasterTitle: type = PT_Title; break;
case PT_MasterBody: type = PT_Body; break;
case PT_MasterCenterTitle: type = PT_CenterTitle; break;
case PT_MasterSubTitle: type = PT_SubTitle; break;
case PT_MasterNotesSlideImage: type = PT_NotesSlideImage; break;
case PT_MasterNotesBody: type = PT_NotesBody; break;
}
}
static bool isTitlePlaceholder(int type)
{
switch (type)
{
case PT_MasterTitle:
case PT_MasterCenterTitle:
case PT_Title:
case PT_CenterTitle:
case PT_VerticalTitle:
return true;
default:
return false;
}
}
static bool isBodyPlaceholder(int type)
{
switch (type)
{
case PT_MasterBody:
case PT_Body:
case PT_VerticalBody:
return true;
default:
return false;
}
}
class CTheme;
class CLayout;
class CSlide;
class IElement
{
public:
ElementType m_etType;
CDoubleRect m_rcBounds;
CDoubleRect m_rcBoundsOriginal;
bool m_bBoundsEnabled;
double m_dStartTime;
double m_dEndTime;
CInteractiveInfo m_oActions;
CAnimationInfo m_oAnimations;
CEffects m_oEffects;
CPen m_oPen;
CBrush m_oBrush;
CShadow m_oShadow;
int m_lID;
int m_lLayoutID;
int m_lPlaceholderID;
int m_lPlaceholderType;
bool m_bPlaceholderSet;
int m_lPlaceholderSizePreset;
int m_lPlaceholderUserStr;
int m_nFormatDate;
//
CMetricInfo m_oMetric;
double m_dRotate; //
bool m_bFlipH; //
bool m_bFlipV; //
bool m_bLine;
bool m_bIsBackground;
bool m_bHaveAnchor;
bool m_bIsChangeable; //
CElementProperties m_oProperties;
CTheme* m_pTheme;
CLayout* m_pLayout;
std::wstring m_sName;
std::wstring m_sDescription;
std::wstring m_sHyperlink;
protected:
ULONG m_lCountRef;
public:
virtual ULONG AddRef()
{
++m_lCountRef;
return m_lCountRef;
}
virtual ULONG Release()
{
--m_lCountRef;
if (0 == m_lCountRef)
{
delete this;
return 0;
}
return m_lCountRef;
}
public:
IElement()
{
m_bIsBackground = false;
m_bHaveAnchor = true;
m_bIsChangeable = true;
m_lID = -1;
m_lLayoutID = -1;
m_lPlaceholderID = -1;
m_lPlaceholderType = -1;
m_bPlaceholderSet = false;
m_lPlaceholderSizePreset = -1;
m_lPlaceholderUserStr = -1;
m_nFormatDate = 1;
m_etType = etPicture;
m_bBoundsEnabled = true;
m_rcBounds.left = 0;
m_rcBounds.top = 0;
m_rcBounds.right = 1;
m_rcBounds.bottom = 1;
m_rcBoundsOriginal.left = 0;
m_rcBoundsOriginal.top = 0;
m_rcBoundsOriginal.right = 1;
m_rcBoundsOriginal.bottom = 1;
m_dStartTime = 0.0;
m_dEndTime = 30.0;
m_dRotate = 0.0;
m_bFlipH = false;
m_bFlipV = false;
m_bLine = true;
m_lCountRef = 1;
m_pTheme = NULL;
m_pLayout = NULL;
}
virtual ~IElement()
{
}
virtual void NormalizeCoords(double dScaleX, double dScaleY)
{
m_rcBounds.left = dScaleX * m_rcBoundsOriginal.left;
m_rcBounds.right = dScaleX * m_rcBoundsOriginal.right;
m_rcBounds.top = dScaleY * m_rcBoundsOriginal.top;
m_rcBounds.bottom = dScaleY * m_rcBoundsOriginal.bottom;
}
virtual void NormalizeCoordsByMetric()
{
double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor;
double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer;
m_rcBoundsOriginal.left = dScaleX * m_rcBounds.left;
m_rcBoundsOriginal.right = dScaleX * m_rcBounds.right;
m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top;
m_rcBoundsOriginal.bottom = dScaleY * m_rcBounds.bottom;
}
protected:
virtual void SetProperiesToDublicate(IElement* pDublicate)
{
if (NULL == pDublicate)
return;
pDublicate->m_bBoundsEnabled = m_bBoundsEnabled;
pDublicate->m_bIsBackground = m_bIsBackground;
pDublicate->m_bHaveAnchor = m_bHaveAnchor;
pDublicate->m_bIsChangeable = m_bIsChangeable;
pDublicate->m_etType = m_etType;
pDublicate->m_rcBounds = m_rcBounds;
pDublicate->m_rcBoundsOriginal = m_rcBoundsOriginal;
pDublicate->m_dStartTime = m_dStartTime;
pDublicate->m_dEndTime = m_dEndTime;
pDublicate->m_lID = m_lID;
pDublicate->m_lLayoutID = m_lLayoutID;
pDublicate->m_oActions = m_oActions;
pDublicate->m_oAnimations = m_oAnimations;
pDublicate->m_oEffects = m_oEffects;
pDublicate->m_lPlaceholderID = m_lPlaceholderID;
pDublicate->m_lPlaceholderType = m_lPlaceholderType;
pDublicate->m_bPlaceholderSet = m_bPlaceholderSet;
pDublicate->m_lPlaceholderSizePreset = m_lPlaceholderSizePreset;
pDublicate->m_lPlaceholderUserStr = m_lPlaceholderUserStr;
pDublicate->m_nFormatDate = m_nFormatDate;
pDublicate->m_oMetric = m_oMetric;
pDublicate->m_oProperties = m_oProperties;
pDublicate->m_dRotate = m_dRotate;
pDublicate->m_bFlipH = m_bFlipH;
pDublicate->m_bFlipV = m_bFlipV;
pDublicate->m_bLine = m_bLine;
pDublicate->m_pTheme = m_pTheme;
pDublicate->m_pLayout = m_pLayout;
pDublicate->m_oPen = m_oPen;
pDublicate->m_oBrush = m_oBrush;
pDublicate->m_oShadow = m_oShadow;
}
public:
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
std::map<CElementProperty::Type, CElementProperty>* pMap = &m_oProperties.m_arProperties;
for (std::map<CElementProperty::Type, CElementProperty>::iterator pPair = pMap->begin(); pPair != pMap->end(); ++pPair)
{
CElementProperty oProperty = pPair->second;
SetupProperty(pSlide, pTheme, pLayout, &oProperty);
}
}
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty) = 0;
virtual IElement* CreateDublicate() = 0;
virtual CString SerializeToXml()
{
CString strElement = _T("");
strElement.Format(_T("<Element type='%d' id='%d' lid='%d' pid='%d' ptp='%d' />"),
(int)m_etType, m_lID, m_lLayoutID, m_lPlaceholderID, m_lPlaceholderType);
return strElement;
}
};
}
\ No newline at end of file
This diff is collapsed.

#include "Slide.h"
void NSPresentationEditor::CShapeElement::CalculateColor(CColor& oColor, CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
LONG lOldIndex = oColor.m_lSchemeIndex;
if (-1 == oColor.m_lSchemeIndex)
return;
std::vector<CColor>* pArray = NULL;
if (pTheme) pArray = &pTheme->m_arColorScheme;
if ((NULL != pLayout) && (!pLayout->m_bUseThemeColorScheme))
pArray = &pLayout->m_arColorScheme;
if (NULL != pSlide)
{
if (!pSlide->m_bUseLayoutColorScheme)
pArray = &pSlide->m_arColorScheme;
}
if ((0 > oColor.m_lSchemeIndex) || ((pArray) && (oColor.m_lSchemeIndex >= (LONG)pArray->size())))
return;
if (pArray)
{
oColor = pArray->at(oColor.m_lSchemeIndex);
}
oColor.m_lSchemeIndex = lOldIndex;
}
void NSPresentationEditor::CShapeElement::SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
{
NSPresentationEditor::CTextAttributesEx* pAttributes = &m_oShape.m_oText;
int nCountColors = 0;
if (NULL != pTheme)
nCountColors = (int)pTheme->m_arColorScheme.size();
size_t nCount = pAttributes->m_arParagraphs.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
if (pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor.is_init())
{
int nColorIndex = (int)pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor->m_lSchemeIndex;
if (0 <= nColorIndex && nColorIndex < nCountColors)
{
CalculateColor(pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor.get(), pSlide, pTheme, pLayout);
pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor->m_lSchemeIndex = nColorIndex;
}
}
size_t nCountCFs = pAttributes->m_arParagraphs[nIndex].m_arSpans.size();
for (size_t i = 0; i < nCountCFs; ++i)
{
CTextCFRun* pRun = &pAttributes->m_arParagraphs[nIndex].m_arSpans[i].m_oRun;
if (pRun->Color.is_init())
{
int nColorIndex = (int)pRun->Color->m_lSchemeIndex;
if (0 <= nColorIndex && nColorIndex < nCountColors)
{
CalculateColor(pRun->Color.get(), pSlide, pTheme, pLayout);
pRun->Color->m_lSchemeIndex = nColorIndex;
}
}
if (NULL != pTheme)
{
if ((pRun->Typeface.is_init()) && (pRun->Typeface.get() < pTheme->m_arFonts.size()))
{
pRun->FontProperties = new CFontProperties();
pRun->FontProperties->SetFont(pTheme->m_arFonts[pRun->Typeface.get()]);
if (1 < pRun->Typeface.get())
pRun->Typeface.reset();
}
if ((pRun->EAFontRef.is_init()) && (pRun->EAFontRef.get() < pTheme->m_arFonts.size()))
{
pRun->FontPropertiesEA = new CFontProperties();
pRun->FontPropertiesEA->SetFont(pTheme->m_arFonts[pRun->EAFontRef.get()]);
}
if ((pRun->SymbolFontRef.is_init()) && (pRun->SymbolFontRef.get() < pTheme->m_arFonts.size()))
{
pRun->FontPropertiesSym = new CFontProperties();
pRun->FontPropertiesSym->SetFont(pTheme->m_arFonts[pRun->SymbolFontRef.get()]);
}
}
}
}
}
bool NSPresentationEditor::CShapeElement::SetUpTextPlaceholder(std::wstring newText)
{
bool result = false;
NSPresentationEditor::CTextAttributesEx* pText = &m_oShape.m_oText;
for (int p = 0 ; p < pText->m_arParagraphs.size(); p++) //тут по всем -> 1-(33).ppt
{
if (pText->m_arParagraphs[p].m_arSpans.size() >0)//??? по всем?
{
int pos = pText->m_arParagraphs[p].m_arSpans[0].m_strText.find(L"*");
if (pos >= 0)
{
CSpan first = pText->m_arParagraphs[p].m_arSpans[0];
CSpan last = pText->m_arParagraphs[p].m_arSpans[0];
first.m_strText = pText->m_arParagraphs[p].m_arSpans[0].m_strText.substr(0, pos);
last.m_strText = pText->m_arParagraphs[p].m_arSpans[0].m_strText.substr(pos + 1);
pText->m_arParagraphs[p].m_arSpans[0].m_strText = newText;
pText->m_arParagraphs[p].m_arSpans[0].m_bField = true;
if (last.m_strText.empty() == false)
pText->m_arParagraphs[p].m_arSpans.insert(pText->m_arParagraphs[p].m_arSpans.begin() + 1, last);
if (first.m_strText.empty() == false)
pText->m_arParagraphs[p].m_arSpans.insert(pText->m_arParagraphs[p].m_arSpans.begin(), first);
result = true;
}
}
}
return result;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "Attributes.h"
#if !defined(_WIN32) && !defined(_WIN64)
#include "../../DesktopEditor/common/ASCVariant.h"
#endif
namespace NSPresentationEditor
{
class CTextRange
{
public:
int m_lStart;
int m_lEnd;
public:
CTextRange()
{
m_lStart = 0;
m_lEnd = 0;
}
CTextRange& operator=(const CTextRange& oSrc)
{
m_lStart = oSrc.m_lStart;
m_lEnd = oSrc.m_lEnd;
return *this;
}
CTextRange(const CTextRange& oSrc)
{
*this = oSrc;
}
};
class CInteractiveInfo
{
private:
long m_lType;
VARIANT m_varParameter;
public:
bool m_bPresent;
std::vector<CTextRange> m_arRanges;
public:
CInteractiveInfo()
{
m_bPresent = false;
}
~CInteractiveInfo()
{
}
CInteractiveInfo& operator=(const CInteractiveInfo& oSrc)
{
m_lType = oSrc.m_lType;
m_varParameter = oSrc.m_varParameter;
m_bPresent = oSrc.m_bPresent;
m_arRanges.insert(m_arRanges.end(), oSrc.m_arRanges.begin(), oSrc.m_arRanges.end());
return *this;
}
CInteractiveInfo(const CInteractiveInfo& oSrc)
{
*this = oSrc;
}
};
}
#pragma once
#include "Element.h"
namespace NSPresentationEditor
{
class CLayout
{
public:
std::vector<IElement*> m_arElements;
std::vector<CColor> m_arColorScheme;
std::multimap<int,int> m_mapPlaceholders;
bool m_bUseThemeColorScheme;
// ""( ),
long m_lOriginalWidth;
long m_lOriginalHeight;
bool m_bIsBackground;
CBrush m_oBackground;
//
long m_lWidth;
long m_lHeight;
CMetricInfo m_oInfo;
bool m_bHasDate;
bool m_bHasSlideNumber;
bool m_bHasFooter;
int m_nFormatDate;
vector_string m_PlaceholdersReplaceString[3]; //0-dates, 1 - headers, 2 - footers
bool m_bShowMasterShapes;
std::wstring m_strLayoutType;
std::wstring m_sName;
public:
CLayout()
{
Clear();
}
CLayout(const CLayout& oSrc)
{
*this = oSrc;
}
CLayout& operator=(const CLayout& oSrc)
{
Clear();
m_arElements = oSrc.m_arElements;
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
ADDREFINTERFACE((m_arElements[nIndex]));
}
m_mapPlaceholders = oSrc.m_mapPlaceholders;
m_arColorScheme = oSrc.m_arColorScheme;
m_bUseThemeColorScheme = oSrc.m_bUseThemeColorScheme;
m_lOriginalWidth = oSrc.m_lOriginalWidth;
m_lOriginalHeight = oSrc.m_lOriginalHeight;
m_lWidth = oSrc.m_lWidth;
m_lHeight = oSrc.m_lHeight;
m_bIsBackground = oSrc.m_bIsBackground;
m_oBackground = oSrc.m_oBackground;
m_bHasDate = oSrc.m_bHasDate;
m_bHasSlideNumber = oSrc.m_bHasSlideNumber;
m_bHasFooter = oSrc.m_bHasFooter;
m_nFormatDate = oSrc.m_nFormatDate;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i];
m_bShowMasterShapes = oSrc.m_bShowMasterShapes;
m_strLayoutType = oSrc.m_strLayoutType;
m_sName = oSrc.m_sName;
return *this;
}
void SetMetricInfo(const CMetricInfo& oInfo)
{
m_oInfo = oInfo;
m_lWidth = m_oInfo.m_lMillimetresHor;
m_lHeight = m_oInfo.m_lMillimetresVer;
m_lOriginalWidth = m_oInfo.m_lUnitsHor;
m_lOriginalHeight = m_oInfo.m_lUnitsVer;
}
public:
void Clear()
{
size_t nCount = m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
RELEASEINTERFACE((m_arElements[nIndex]));
}
m_arElements.clear();
m_mapPlaceholders.clear();
m_bHasDate = false;
m_bHasSlideNumber = false;
m_bHasFooter = false;
m_nFormatDate = 1;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear();
m_bUseThemeColorScheme = true;
m_bShowMasterShapes = true;
m_strLayoutType = _T("obj");
m_bIsBackground = false;
m_lWidth = m_lHeight = m_lOriginalWidth = m_lOriginalHeight = 0;
}
void CreateDublicateElements()
{
//
for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex)
{
IElement* pElem = m_arElements[nIndex];
if (NULL != pElem)
{
m_arElements[nIndex] = pElem->CreateDublicate();
}
RELEASEINTERFACE(pElem);
}
}
CLayout* CreateDublicate()
{
CLayout* pNew = new CLayout(*this);
pNew->CreateDublicateElements();
return pNew;
}
IElement* GetPlaceholder(LONG lID, bool bIsAddRef)
{
size_t nCount = m_arElements.size();
for (size_t i = 0; i < nCount; ++i)
{
IElement* pElem = m_arElements[i];
if (pElem->m_lPlaceholderType == lID)
{
if (bIsAddRef)
ADDREFINTERFACE(pElem);
return pElem;
}
}
return NULL;
}
LONG GetCountPlaceholderWithType(LONG lType)
{
LONG lFound = 0;
for (size_t i = 0; i < m_arElements.size(); ++i)
{
if (m_arElements[i]->m_lPlaceholderType == lType)
{
++lFound;
}
}
return lFound;
}
public:
NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme)
{
if (lIndexScheme < (LONG)m_arColorScheme.size())
{
return m_arColorScheme[lIndexScheme];
}
return NSPresentationEditor::CColor();
}
static void CheckPlaceholderStyle(CString strStyleName, LONG& lType, LONG& lLevel, LONG& lTypeStyle)
{
int nLen = strStyleName.GetLength();
TCHAR* pData = strStyleName.GetBuffer();
lType = 0;
lLevel = 0;
lTypeStyle = -1;
TCHAR* pDataEnd = pData + nLen;
TCHAR* pDataMem = pData + 1;
for (; ((pDataMem < pDataEnd) && XmlUtils::IsDigit(*pDataMem)); ++pDataMem)
{
lType *= 10;
lType += (*pDataMem - ((TCHAR)'0'));
}
pDataMem += 4;
for (; ((pDataMem < pDataEnd) && XmlUtils::IsDigit(*pDataMem)); ++pDataMem)
{
lLevel *= 10;
lLevel += (*pDataMem - ((TCHAR)'0'));
}
++pDataMem;
if (pDataMem + 1 < pDataEnd)
{
if ((TCHAR('c') == pDataMem[0]) && (TCHAR('f') == pDataMem[1]))
lTypeStyle = 1;
if ((TCHAR('p') == pDataMem[0]) && (TCHAR('f') == pDataMem[1]))
lTypeStyle = 0;
}
}
};
}
#pragma once
#include <math.h>
#if !defined(_WIN32) && !defined(_WIN64)
#include "./../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
namespace NSPresentationEditor
{
const double c_dMasterUnitsToInchKoef = 1.0 / 576;
const double c_dInchToMillimetreKoef = 25.4;
const double c_dMasterUnitsToMillimetreKoef = c_dMasterUnitsToInchKoef * c_dInchToMillimetreKoef;
class CMetricInfo
{
public:
DWORD m_lUnitsHor;
DWORD m_lUnitsVer;
DWORD m_lMillimetresHor;
DWORD m_lMillimetresVer;
public:
CMetricInfo()
{
m_lUnitsHor = 5000;
m_lUnitsVer = 5000;
m_lMillimetresHor = 5000;
m_lMillimetresVer = 5000;
}
CMetricInfo& operator =(const CMetricInfo& oSrc)
{
m_lUnitsHor = oSrc.m_lUnitsHor;
m_lUnitsVer = oSrc.m_lUnitsVer;
m_lMillimetresHor = oSrc.m_lMillimetresHor;
m_lMillimetresVer = oSrc.m_lMillimetresVer;
return *this;
}
void SetUnitsContainerSize(DWORD lSizeX, DWORD lSizeY)
{
m_lUnitsHor = lSizeX;
m_lUnitsVer = lSizeY;
m_lMillimetresHor = (DWORD)(m_lUnitsHor * c_dMasterUnitsToMillimetreKoef);
m_lMillimetresVer = (DWORD)(m_lUnitsVer * c_dMasterUnitsToMillimetreKoef);
}
};
class CDoubleRect
{
public:
double left;
double top;
double right;
double bottom;
public:
CDoubleRect()
{
left = 0;
top = 0;
right = 0;
bottom = 0;
}
CDoubleRect& operator=(const CDoubleRect& oSrc)
{
left = oSrc.left;
top = oSrc.top;
right = oSrc.right;
bottom = oSrc.bottom;
return *this;
}
CDoubleRect(const CDoubleRect& oSrc)
{
*this = oSrc;
}
inline bool IsEqual(const CDoubleRect& oSrc, double dEps = 0.01)
{
return ((fabs(left - oSrc.left) < dEps) && (fabs(top - oSrc.top) < dEps) &&
(fabs(right - oSrc.right) < dEps) && (fabs(bottom - oSrc.bottom) < dEps));
}
inline double GetWidth() const
{
return right - left;
}
inline double GetHeight() const
{
return bottom - top;
}
inline void Scale(const double& dKoef)
{
left *= dKoef;
top *= dKoef;
right *= dKoef;
bottom *= dKoef;
}
};
//class CRectF
//{
//public:
// float X;
// float Y;
// float Width;
// float Height;
//public:
// CRectF()
// {
// X = 0;
// Y = 0;
// Width = 0;
// Height = 0;
// }
// CRectF(const CRectF& oSrc)
// {
// *this = oSrc;
// }
// CRectF& operator=(const CRectF& oSrc)
// {
// X = oSrc.X;
// Y = oSrc.Y;
// Width = oSrc.Width;
// Height = oSrc.Height;
// return *this;
// }
// bool Equals(const CRect& oSrc)
// {
// return ((X == oSrc.X) && (Y == oSrc.Y) && (Width == oSrc.Width) && (Height == oSrc.Height));
// }
//};
class CGeomShapeInfo
{
public:
class CPointD
{
public:
double dX;
double dY;
public:
CPointD()
{
dX = 0;
dY = 0;
}
CPointD& operator= (const CPointD& oSrc)
{
dX = oSrc.dX;
dY = oSrc.dY;
return *this;
}
CPointD(const CPointD& oSrc)
{
*this = oSrc;
}
};
public:
double m_dLeft;
double m_dTop;
double m_dWidth;
double m_dHeight;
double m_dLimoX;
double m_dLimoY;
// (limo)
CPointD m_oCurPoint;
double m_dRotate;
bool m_bFlipH;
bool m_bFlipV;
LONG m_lOriginalWidth;
LONG m_lOriginalHeight;
public:
CGeomShapeInfo()
{
m_dLeft = 0;
m_dTop = 0;
m_dWidth = 720;
m_dHeight = 576;
m_dLimoX = 0;
m_dLimoY = 0;
m_oCurPoint.dX = 0;
m_oCurPoint.dY = 0;
m_dRotate = 0.0;
m_bFlipH = false;
m_bFlipV = false;
m_lOriginalWidth = 0;
m_lOriginalHeight = 0;
}
~CGeomShapeInfo()
{
}
CGeomShapeInfo& operator =(const CGeomShapeInfo& oSrc)
{
m_dLeft = oSrc.m_dLeft;
m_dTop = oSrc.m_dTop;
m_dWidth = oSrc.m_dWidth;
m_dHeight = oSrc.m_dHeight;
m_dLimoX = oSrc.m_dLimoX;
m_dLimoY = oSrc.m_dLimoY;
m_oCurPoint = oSrc.m_oCurPoint;
m_dRotate = oSrc.m_dRotate;
m_bFlipH = oSrc.m_bFlipH;
m_bFlipV = oSrc.m_bFlipV;
m_lOriginalWidth = oSrc.m_lOriginalWidth;
m_lOriginalHeight = oSrc.m_lOriginalHeight;
return (*this);
}
inline void SetBounds(const CDoubleRect& oRect)
{
m_dLeft = oRect.left;
m_dTop = oRect.top;
m_dWidth = oRect.GetWidth();
m_dHeight = oRect.GetHeight();
}
inline LONG GetFlags()
{
LONG lFlags = 0;
if (m_bFlipH)
lFlags |= 0x0001;
if (m_bFlipV)
lFlags |= 0x0002;
return lFlags;
}
};
}
#pragma once
#include "SlideShow.h"
#include "Theme.h"
namespace NSPresentationEditor
{
class CSlide
{
public:
LONG m_lThemeID;
LONG m_lLayoutID;
std::vector<IElement*> m_arElements;
CSlideShowInfo m_oSlideShow;
std::multimap<int,int> m_mapPlaceholders;
//
long m_lWidth;
long m_lHeight;
// - "" ( ),
long m_lOriginalWidth;
long m_lOriginalHeight;
double m_dStartTime;
double m_dEndTime;
double m_dDuration;
bool m_bIsBackground;
CBrush m_oBackground;
std::vector<CColor> m_arColorScheme;
bool m_bUseLayoutColorScheme;
bool m_bShowMasterShapes;
CMetricInfo m_oInfo;
vector_string m_PlaceholdersReplaceString[3];
std::wstring m_strComment;
std::wstring m_sName;
public:
CSlide() : m_arElements(), m_oSlideShow()
{
Clear();
}
~CSlide()
{
Clear();
}
void Clear()
{
for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex)
{
IElement* pElem = m_arElements[nIndex];
RELEASEINTERFACE(pElem);
}
m_arColorScheme.clear();
m_arElements.clear();
m_lThemeID = -1;
m_lLayoutID = -1;
m_lWidth = 270;
m_lHeight = 190;
m_lOriginalWidth = 6000;
m_lOriginalHeight = 5000;
m_dStartTime = 0.0;
m_dEndTime = 0.0;
m_dDuration = 30000.0;
m_bShowMasterShapes = true;
m_strComment.clear();
m_sName.clear();
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i].clear();
}
CSlide(const CSlide& oSrc)
{
Clear();
size_t nCount = oSrc.m_arElements.size();
for (size_t nIndex = 0; nIndex < nCount; ++nIndex)
{
m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate());
}
m_arColorScheme = oSrc.m_arColorScheme;
m_oSlideShow = oSrc.m_oSlideShow;
m_lThemeID = oSrc.m_lThemeID;
m_lLayoutID = oSrc.m_lLayoutID;
m_lWidth = oSrc.m_lWidth;
m_lHeight = oSrc.m_lHeight;
m_lOriginalWidth = oSrc.m_lOriginalWidth;
m_lOriginalHeight = oSrc.m_lOriginalHeight;
m_dStartTime = oSrc.m_dStartTime;
m_dEndTime = oSrc.m_dEndTime;
m_dDuration = oSrc.m_dDuration;
m_bIsBackground = oSrc.m_bIsBackground;
m_oBackground = oSrc.m_oBackground;
m_bShowMasterShapes = oSrc.m_bShowMasterShapes;
for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i];
m_strComment = oSrc.m_strComment;
m_sName = oSrc.m_sName;
}
public:
void SetMetricInfo(const CMetricInfo& oInfo)
{
m_oInfo = oInfo;
m_lWidth = m_oInfo.m_lMillimetresHor;
m_lHeight = m_oInfo.m_lMillimetresVer;
m_lOriginalWidth = m_oInfo.m_lUnitsHor;
m_lOriginalHeight = m_oInfo.m_lUnitsVer;
}
virtual void ReadFromXml(XmlUtils::CXmlNode& oNode)
{
}
virtual void WriteToXml(XmlUtils::CXmlWriter& oWriter)
{
}
void SetUpPlaceholderStyles(NSPresentationEditor::CLayout* pLayout)
{
size_t nCountElements = m_arElements.size();
for (size_t nEl = 0; nEl < nCountElements; ++nEl)
{
if (-1 != m_arElements[nEl]->m_lPlaceholderType && etShape == m_arElements[nEl]->m_etType)
{
CShapeElement* pSlideElement = dynamic_cast<CShapeElement*>(m_arElements[nEl]);
if (NULL != pSlideElement)
{
LONG lCountThisType = pLayout->GetCountPlaceholderWithType(pSlideElement->m_lPlaceholderType);
size_t nCountLayout = pLayout->m_arElements.size();
for (size_t i = 0; i < nCountLayout; ++i)
{
if (1 == lCountThisType)
{
if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) &&
(pLayout->m_arElements[i]->m_etType == etShape))
{
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i]);
if (NULL != pLayoutElement)
{
pSlideElement->m_oShape.m_oText.m_oLayoutStyles = pLayoutElement->m_oShape.m_oText.m_oStyles;
}
}
}
else
{
if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) &&
(pLayout->m_arElements[i]->m_lPlaceholderID == pSlideElement->m_lPlaceholderID) &&
(pLayout->m_arElements[i]->m_etType == etShape))
{
CShapeElement* pLayoutElement = dynamic_cast<CShapeElement*>(pLayout->m_arElements[i]);
if (NULL != pLayoutElement)
{
pSlideElement->m_oShape.m_oText.m_oLayoutStyles = pLayoutElement->m_oShape.m_oText.m_oStyles;
}
}
}
}
}
}
}
}
NSPresentationEditor::CColor GetColor(const LONG& lIndexScheme)
{
if (lIndexScheme < (LONG)m_arColorScheme.size())
{
return m_arColorScheme[lIndexScheme];
}
return NSPresentationEditor::CColor();
}
};
}
#pragma once
#include "Elements.h"
namespace NSPresentationEditor
{
class CTransition
{
public:
bool m_bAudioPresent; //
CAudioElement m_oAudio; //
BYTE m_nEffectDirection; //
BYTE m_nEffectType; //
bool m_bLoopSound; //
bool m_bStopSound; //
double m_dSpeed; //
public:
CTransition() : m_oAudio()
{
m_bAudioPresent = false;
m_nEffectType = 0;
m_nEffectDirection = 0;
m_bLoopSound = false;
m_bStopSound = false;
m_dSpeed = 500.0;
}
~CTransition()
{
}
CTransition& operator=(const CTransition& oSrc)
{
m_bAudioPresent = oSrc.m_bAudioPresent;
m_nEffectType = oSrc.m_nEffectType;
m_nEffectDirection = oSrc.m_nEffectDirection;
m_bLoopSound = oSrc.m_bLoopSound;
m_bStopSound = oSrc.m_bStopSound;
m_dSpeed = oSrc.m_dSpeed;
return *this;
}
CTransition(const CTransition& oSrc)
{
*this = oSrc;
}
};
class CSlideShowInfo
{
public:
double m_dSlideDuration; // ( )
bool m_bHidden; //
CTransition m_oTransition; //
bool m_bOnlyClick; //
public:
CSlideShowInfo() : m_oTransition()
{
m_dSlideDuration = 30000.0;
m_bHidden = false;
m_bOnlyClick = false;
}
~CSlideShowInfo()
{
}
CSlideShowInfo& operator=(const CSlideShowInfo& oSrc)
{
m_dSlideDuration = oSrc.m_dSlideDuration;
m_bHidden = oSrc.m_bHidden;
m_bOnlyClick = oSrc.m_bOnlyClick;
m_oTransition = oSrc.m_oTransition;
return *this;
}
CSlideShowInfo(const CSlideShowInfo& oSrc)
{
*this = oSrc;
}
};
}
\ No newline at end of file
#pragma once
#include "Attributes.h"
#define GETBIT(from, num) ((from & (1 << num)) != 0)
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
typedef std::vector<std::wstring> vector_string;
namespace NSPresentationEditor
{
static void CorrectColorPPT(LONG& lSchemeIndex)
{
//0x00 //Background color
//0x01 //Text color
//0x02 //Shadow color
//0x03 //Title text color
//0x04 //Fill color
//0x05 //Accent 1 color
//0x06 //Accent 2 color
//0x07 //Accent 3 color
// [0]);//0
// [1]);//1
// [2]);//2
// [3]);//3
// [0]);//4
// [4]);//5 //accent1
// [5]);//6 //accent2
// [0]);//7 //accent3
// [5]);//8 //accent4
// [4]);//9 //accent5
// [7]);//10 //accent6
// [6]);//11 //hlink
// [7]);//12 //folHlink
// [0]);//13 //lt1
// [1]);//14 //dk1
// [2]);//15 //lt2
// [3]);//16 //dk2
switch (lSchemeIndex)
{
case 0:
lSchemeIndex = 13;
break;
case 1:
lSchemeIndex = 14;
break;
case 2:
lSchemeIndex = 15;
break;
case 3:
lSchemeIndex = 16;
break;
case 4:
lSchemeIndex = 5;
break;
case 5:
lSchemeIndex = 6;
break;
case 6:
lSchemeIndex = 11;
break;
case 7:
lSchemeIndex = 12;
break;
default:
lSchemeIndex = -1;
break;
}
}
struct SPointAtom
{
LONG X;
LONG Y;
CString ToString()
{
CString str = _T("");
str.Format(_T("<Point info='(%d,%d)' />"), X, Y);
return str;
}
};
struct SRectAtom
{
LONG Left;
LONG Top;
LONG Right;
LONG Bottom;
CString ToString()
{
CString str = _T("");
str.Format(_T("<Rect info='(%d,%d,%d,%d)' />"), Left, Top, Right, Bottom);
return str;
}
};
struct SSmallRectAtom
{
SHORT Left;
SHORT Top;
SHORT Right;
SHORT Bottom;
CString ToString()
{
CString str = _T("");
str.Format(_T("Rect(%d,%d,%d,%d)"), Left, Top, Right, Bottom);
return str;
}
};
struct SColorAtom
{
BYTE R;
BYTE G;
BYTE B;
BYTE Index;
bool bPaletteIndex;
bool bPaletteRGB;
bool bSystemRGB;
bool bSchemeIndex;
bool bSysIndex;
SColorAtom()
{
R = 0;
G = 0;
B = 0;
Index = -1;
bPaletteIndex = false;
bPaletteRGB = false;
bSystemRGB = false;
bSchemeIndex = false;
bSysIndex = false;
}
SColorAtom(const SColorAtom& oSrc)
{
*this = oSrc;
}
SColorAtom& operator=(const SColorAtom& oSrc)
{
R = oSrc.R;
G = oSrc.G;
B = oSrc.B;
Index = oSrc.Index;
bPaletteIndex = oSrc.bPaletteIndex;
bPaletteRGB = oSrc.bPaletteRGB;
bSystemRGB = oSrc.bSystemRGB;
bSchemeIndex = oSrc.bSchemeIndex;
bSysIndex = oSrc.bSysIndex;
return *this;
}
SColorAtom& operator=(const CColor& oSrc)
{
R = oSrc.R;
G = oSrc.G;
B = oSrc.B;
return *this;
}
CString ToString()
{
CString str = _T("");
str.Format(_T("<Color R='%d' G='%d' B='%d' index='%d' />"), R, G, B, Index);
return str;
}
CString ToString(CString name)
{
CString str = _T("");
str.Format(_T(" R='%d' G='%d' B='%d' index='%d' />"), R, G, B, Index);
str = _T("<Color_") + name + str;
return str;
}
DWORD ToValue()
{
DWORD dwVal = (R | (G << 8) | (B << 16));
return dwVal;
}
DWORD ToValue_RGB()
{
DWORD dwVal = (B | (G << 8) | (R << 16));
return dwVal;
}
DWORD ToValueProperty()
{
DWORD dwVal = 0;
if (!bSchemeIndex)
{
dwVal = (R | (G << 8) | (B << 16));
}
else
{
dwVal = (R | 0x01000000);
}
return dwVal;
}
void FromValue(BYTE _R, BYTE _G, BYTE _B)
{
R = _R;
G = _G;
B = _B;
Index = -1;
}
void FromValue(DWORD dwValue)
{
//R = (BYTE)(dwValue);
//G = (BYTE)(dwValue >> 8);
//B = (BYTE)(dwValue >> 16);
//Index = (BYTE)(dwValue >> 24);
//bPaletteIndex = (0x01 == (Index & 0x01));
//bPaletteRGB = (0x02 == (Index & 0x02));
//bSystemRGB = (0x04 == (Index & 0x04));
//bSchemeIndex = (0x08 == (Index & 0x08));
//bSysIndex = (0x10 == (Index & 0x10));
R = static_cast<unsigned char>(GETBITS(dwValue, 0, 7));
G = static_cast<unsigned char>(GETBITS(dwValue, 8, 15));
B = static_cast<unsigned char>(GETBITS(dwValue, 16, 23));
Index = -1;
bPaletteIndex = GETBIT(dwValue, 24);
bPaletteRGB = GETBIT(dwValue, 25);
bSystemRGB = GETBIT(dwValue, 26);
bSchemeIndex = GETBIT(dwValue, 27);
bSysIndex = GETBIT(dwValue, 28);
/*if(!bSchemeIndex && !bPaletteIndex && !bSysIndex)
{
colorRGB = STR::toRGB(red, green, blue);
}
else */
if(bSchemeIndex)
{
Index = R;
}
else if(bPaletteIndex)
{
Index = ((G) << 8) + R;
}
else if(bSysIndex)
{
Index = ((G) << 8) + R;
}
}
void ToColor(CColor* pColor)
{
pColor->R = R;
pColor->G = G;
pColor->B = B;
pColor->m_lSchemeIndex = -1;
if (bSchemeIndex || bSysIndex)
{
pColor->m_lSchemeIndex = R;
CorrectColorPPT(pColor->m_lSchemeIndex);
}
}
};
struct STextRange
{
UINT Begin;
UINT End;
CString ToString()
{
CString str = _T("");
str.Format(_T("TextRange(%d,%d)"), Begin, End);
return str;
}
};
class CElemInfo
{
public:
bool m_bIsBackground;
bool m_bIsChangeable;
LONG m_lID;
public:
CElemInfo()
{
m_bIsBackground = false;
m_bIsChangeable = false;
m_lID = 0;
}
CElemInfo(const CElemInfo& oSrc)
{
*this = oSrc;
}
CElemInfo& operator=(const CElemInfo& oSrc)
{
m_bIsBackground = oSrc.m_bIsBackground;
m_bIsChangeable = oSrc.m_bIsChangeable;
m_lID = oSrc.m_lID;
return *this;
}
};
}
\ No newline at end of file
This diff is collapsed.
#pragma once
#include "Structures.h"
#include "TextStructures.h"
#if !defined(_WIN32) && !defined (_WIN64)
#include "../../DesktopEditor/graphics/aggplustypes.h"
#endif
namespace NSPresentationEditor
{
class CTheme;
class CLayout;
class CTextAttributesEx
{
public:
LONG m_lTextMasterType; // only ppt property
public:
DWORD m_lTextType;
DWORD m_lStyleThemeIndex;
int m_lPlaceholderType;
int m_lPlaceholderID;
//
Aggplus::RECT m_oBounds;
// -
CTextAttributes m_oAttributes;
std::vector<CParagraph> m_arParagraphs;
bool m_bVertical;
bool m_bAutoFit;
int m_lWrapMode; // 0 - square, default; 1 - none wrap
// .
CTextRuler m_oRuler;
CTextStyles m_oLayoutStyles;
CTextStyles m_oStyles;
//
bool m_bIsSlideFontRef;
int m_lFontRef;
public:
CTextAttributesEx() :
m_oAttributes(),
m_arParagraphs(),
m_oRuler(),
m_oLayoutStyles(),
m_oStyles()
{
m_lTextType = -1;
m_lPlaceholderType = -1;
m_lPlaceholderID = -1;
m_lStyleThemeIndex = -1;
m_lFontRef = -1;
m_bIsSlideFontRef = false;
m_oBounds.left = 0;
m_oBounds.top = 0;
m_oBounds.right = 50;
m_oBounds.bottom = 50;
m_bVertical = false;
m_bAutoFit = false;
m_lWrapMode = 0;
m_lTextMasterType = -1;
}
CTextAttributesEx& operator =(const CTextAttributesEx& oSrc)
{
m_oBounds = oSrc.m_oBounds;
m_lTextType = oSrc.m_lTextType;
m_lPlaceholderType = oSrc.m_lPlaceholderType;
m_lPlaceholderID = oSrc.m_lPlaceholderID;
m_lFontRef = oSrc.m_lFontRef;
m_bIsSlideFontRef = oSrc.m_bIsSlideFontRef;
m_oAttributes = oSrc.m_oAttributes;
m_bVertical = oSrc.m_bVertical;
m_lWrapMode = oSrc.m_lWrapMode;
m_bAutoFit = oSrc.m_bAutoFit;
m_arParagraphs.insert(m_arParagraphs.end(), oSrc.m_arParagraphs.begin(), oSrc.m_arParagraphs.end());
m_oRuler = oSrc.m_oRuler;
m_oLayoutStyles = oSrc.m_oLayoutStyles;
m_oStyles = oSrc.m_oStyles;
m_lTextMasterType = oSrc.m_lTextMasterType;
return *this;
}
CTextAttributesEx(const CTextAttributesEx& oSrc)
{
*this = oSrc;
}
~CTextAttributesEx()
{
m_arParagraphs.clear();
}
public:
inline void NormalizeString(CString& strText)
{
strText.Replace(_T("&"), _T("&amp;"));
strText.Replace(_T("'"), _T("&apos;"));
strText.Replace(_T("<"), _T("&lt;"));
strText.Replace(_T(">"), _T("&gt;"));
strText.Replace(_T("\""), _T("&quot;"));
}
void RecalcParagraphs (CTheme* pTheme = NULL);
void RecalcParagraphsPPT();
void ApplyThemeStyle (CTheme* pTheme = NULL);
void ApplyRuler (CTheme* pTheme);
void ApplyRuler (CTextPFRun* pPar, WORD lIndentLevel);
bool IsEmptyText()
{
return (0 == m_arParagraphs.size()) ? true : false;
}
};
}
This diff is collapsed.
#include "Elements.h"
namespace NSPresentationEditor
{
}
This diff is collapsed.
This diff is collapsed.
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