You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB
C++

#include "StdAfx.h"
#include "CommandModifiString.h"
#include "ObjTxt.h"
CCommandModifiString::CCommandModifiString()
{
}
CCommandModifiString::~CCommandModifiString(void)
{
}
//b 为true 时设置旧参数
void CCommandModifiString::SetStringPar(SStringPar &par,bool b)
{
if(b)
{
m_OldStringPar.Copy(par);
}
else
{
m_NewStringPar.Copy(par);
}
}
void CCommandModifiString::ExcuteExt()
{
ReCreatObj(true);
}
void CCommandModifiString::UndoExt()
{
ReCreatObj(false);
}
void CCommandModifiString::ReCreatObj(bool bExcute)
{
CObjBase *pBase = m_ObjContainer.GetCurOpObj();
if(pBase)
{
CObjString *p = dynamic_cast<CObjString*>(pBase);
if(bExcute)
{
//可变文本
p->SetValStr(m_NewStringPar.m_ValString);
//字体
p->SetFontTypeName(m_NewStringPar.m_FontTypeName);
p->SetFontName(m_NewStringPar.m_FontName);
}
else
{
//可变文本
p->SetValStr(m_OldStringPar.m_ValString);
//字体
p->SetFontTypeName(m_OldStringPar.m_FontTypeName);
p->SetFontName(m_OldStringPar.m_FontName);
}
p->Creat();
}
}