Commit 59d0902f authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

textbox inset

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57354 954022d7-b5bf-4e40-9824-e11837661b57
parent b8b8e97e
......@@ -1034,6 +1034,9 @@ PPTX::Logic::SpTreeElem CAVSOfficeDrawingConverter::doc_LoadShape(XmlUtils::CXml
#endif
*/
if (!pShape->TextBoxBodyPr.is_init())
pShape->TextBoxBodyPr = new PPTX::Logic::BodyPr();
XmlUtils::CXmlNode oNodeTextBox;
if (oNode.GetNode(_T("v:textbox"), oNodeTextBox))
{
......@@ -1042,6 +1045,30 @@ PPTX::Logic::SpTreeElem CAVSOfficeDrawingConverter::doc_LoadShape(XmlUtils::CXml
{
pShape->TextBoxShape = oNodeContent.GetXml();
}
CString sTextInset = oNodeTextBox.GetAttribute(_T("inset"));
CString sTextInsetMode = oNodeTextBox.GetAttribute(_T("o:insetmode"));
if (_T("") != sTextInset && ((_T("") == sTextInsetMode) || (_T("custom") == sTextInsetMode)))
{
CString sL = _T("0.1in");
CString sT = _T("0.05in");
CString sR = _T("0.1in");
CString sB = _T("0.05in");
PPTX::CStringTrimmer oTrimmer;
oTrimmer.m_Separator = (TCHAR)',';
oTrimmer.LoadFromString(sTextInset);
double dTextMarginLeft = oTrimmer.GetParameter(0, 0.1);
double dTextMarginTop = oTrimmer.GetParameter(1, 0.05);
double dTextMarginRight = oTrimmer.GetParameter(2, 0.1);
double dTextMarginBottom = oTrimmer.GetParameter(3, 0.05);
pShape->TextBoxBodyPr->lIns = (int)(12700 * dTextMarginLeft);
pShape->TextBoxBodyPr->tIns = (int)(12700 * dTextMarginTop);
pShape->TextBoxBodyPr->rIns = (int)(12700 * dTextMarginRight);
pShape->TextBoxBodyPr->bIns = (int)(12700 * dTextMarginBottom);
}
}
CString strStyle = oNode.GetAttribute(_T("style"));
......@@ -1055,9 +1082,6 @@ PPTX::Logic::SpTreeElem CAVSOfficeDrawingConverter::doc_LoadShape(XmlUtils::CXml
oProps.IsTop = bIsTop;
CString strMainPos = GetDrawingMainProps(oNode, oCSSParser, oProps);
if (!pShape->TextBoxBodyPr.is_init())
pShape->TextBoxBodyPr = new PPTX::Logic::BodyPr();
// . -
pShape->TextBoxBodyPr->upright = true;
......
......@@ -14,6 +14,61 @@
namespace PPTX
{
class CStringTrimmer
{
public:
CAtlArray<CString> m_arParams;
TCHAR m_Separator;
public:
CStringTrimmer()
{
m_Separator = (TCHAR)' ';
}
~CStringTrimmer()
{
}
public:
void LoadFromString(CString& strParams)
{
// - Mid, Find,
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
TCHAR* pDataMem = pData;
int nCurPosition = 0;
while (nPosition <= nCount)
{
if (nPosition == nCount || (pData[nPosition] == m_Separator))
{
int nLen = nPosition - nCurPosition;
if (nLen == 0)
{
m_arParams.Add(_T(""));
}
else
{
m_arParams.Add(strParams.Mid(nCurPosition, nLen));
}
nCurPosition = nPosition + 1;
}
++nPosition;
}
}
double GetParameter(int nIndex, double dDefault)
{
if (nIndex < 0 || nIndex >= (int)m_arParams.GetCount())
return dDefault;
SimpleTypes::CPoint parserPoint;
return parserPoint.FromString(m_arParams[nIndex]);
}
};
class CCSS
{
public:
......
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