summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hpara.cxx23
-rw-r--r--hwpfilter/source/hpara.h4
-rw-r--r--hwpfilter/source/hwpfile.cxx12
-rw-r--r--hwpfilter/source/hwpfile.h4
4 files changed, 22 insertions, 21 deletions
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx
index 6f5c4e57aace..116aa0ec3d03 100644
--- a/hwpfilter/source/hpara.cxx
+++ b/hwpfilter/source/hpara.cxx
@@ -57,10 +57,10 @@ void LineInfo::Read(HWPFile & hwpf, HWPPara *pPara)
if( pex >> 15 & 0x01 )
{
- if( pex & 0x01 )
- hwpf.AddPage();
- pPara->pshape.reserved[0] = sal::static_int_cast<unsigned char>(pex & 0x01);
- pPara->pshape.reserved[1] = sal::static_int_cast<unsigned char>(pex & 0x02);
+ if (pex & 0x01)
+ hwpf.AddPage();
+ pPara->pshape->reserved[0] = sal::static_int_cast<unsigned char>(pex & 0x01);
+ pPara->pshape->reserved[1] = sal::static_int_cast<unsigned char>(pex & 0x02);
}
}
@@ -76,9 +76,10 @@ HWPPara::HWPPara()
, ctrlflag(0)
, pstyno(0)
, cshape(new CharShape)
+ , pshape(new ParaShape)
{
memset(cshape.get(), 0, sizeof(CharShape));
- memset(&pshape, 0, sizeof(pshape));
+ memset(pshape.get(), 0, sizeof(ParaShape));
}
HWPPara::~HWPPara()
@@ -107,9 +108,9 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
/* Paragraph paragraphs shape */
if (nch && !reuse_shape)
{
- pshape.Read(hwpf);
- pshape.cshape = cshape.get();
- pshape.pagebreak = etcflag;
+ pshape->Read(hwpf);
+ pshape->cshape = cshape.get();
+ pshape->pagebreak = etcflag;
}
linfo.reset(::comphelper::newArray_null<LineInfo>(nline));
@@ -122,8 +123,8 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
}
if (nch && !reuse_shape){
- if( pshape.coldef.ncols > 1 ){
- hwpf.SetColumnDef( &pshape.coldef );
+ if( pshape->coldef.ncols > 1 ) {
+ hwpf.SetColumnDef(&(pshape->coldef));
}
}
@@ -169,7 +170,7 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
if (hhstr[ii]->hh == CH_END_PARA)
break;
if( hhstr[ii]->hh < CH_END_PARA )
- pshape.reserved[0] = 0;
+ pshape->reserved[0] = 0;
ii += hhstr[ii]->WSize();
}
return nch && !hwpf.State();
diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h
index 1385f12ed698..55af7e98120b 100644
--- a/hwpfilter/source/hpara.h
+++ b/hwpfilter/source/hpara.h
@@ -104,7 +104,7 @@ class DLLEXPORT HWPPara
unsigned long ctrlflag;
unsigned char pstyno;
std::shared_ptr<CharShape> cshape; /* When characters are all the same shape */
- ParaShape pshape; /* if reuse flag is 0, */
+ std::shared_ptr<ParaShape> pshape; /* if reuse flag is 0, */
std::unique_ptr<LineInfo[]> linfo;
std::vector<std::shared_ptr<CharShape>> cshapep;
@@ -128,7 +128,7 @@ class DLLEXPORT HWPPara
/**
* Returns the style of paragraph.
*/
- ParaShape& GetParaShape(void) { return pshape;}
+ ParaShape& GetParaShape(void) { return *pshape; }
/**
* Returns next paragraph.
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index f883a2243f40..17eed4902931 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -264,9 +264,9 @@ bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag)
spNode->reuse_shape = 0;
}
}
- spNode->pshape.pagebreak = spNode->etcflag;
- if( spNode->nch )
- AddParaShape( &spNode->pshape );
+ spNode->pshape->pagebreak = spNode->etcflag;
+ if (spNode->nch)
+ AddParaShape(spNode->pshape);
if (!aplist.empty())
aplist.back()->SetNext(spNode.get());
@@ -485,7 +485,7 @@ ParaShape *HWPFile::getParaShape(int index)
{
if (index < 0 || static_cast<unsigned int>(index) >= pslist.size())
return nullptr;
- return pslist[index];
+ return pslist[index].get();
}
CharShape *HWPFile::getCharShape(int index)
@@ -530,7 +530,7 @@ Table *HWPFile::getTable(int index)
return tables[index];
}
-void HWPFile::AddParaShape(ParaShape * pshape)
+void HWPFile::AddParaShape(std::shared_ptr<ParaShape>& pshape)
{
int nscount = 0;
for(int j = 0 ; j < MAXTABS-1 ; j++)
@@ -551,7 +551,7 @@ void HWPFile::AddParaShape(ParaShape * pshape)
if( nscount )
pshape->tabs[MAXTABS-1].type = sal::static_int_cast<char>(nscount);
- int value = compareParaShape(pshape);
+ int value = compareParaShape(pshape.get());
if( value == 0 || nscount )
{
diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h
index 7f3d29f80225..d58faa569a7b 100644
--- a/hwpfilter/source/hwpfile.h
+++ b/hwpfilter/source/hwpfile.h
@@ -212,7 +212,7 @@ class DLLEXPORT HWPFile
void AddPage(){ m_nCurrentPage++;}
void AddColumnInfo();
void SetColumnDef(ColumnDef *coldef);
- void AddParaShape(ParaShape *);
+ void AddParaShape(std::shared_ptr<ParaShape>&);
void AddCharShape(std::shared_ptr<CharShape>&);
void AddFBoxStyle(FBoxStyle *);
void AddDateFormat(DateCode *);
@@ -283,7 +283,7 @@ class DLLEXPORT HWPFile
std::list<EmPicture*> emblist;
std::list<HyperText*> hyperlist;
int currenthyper;
- std::vector<ParaShape*> pslist; /* 스타오피스의 구조상 필요 */
+ std::vector<std::shared_ptr<ParaShape>> pslist; /* 스타오피스의 구조상 필요 */
std::vector<std::shared_ptr<CharShape>> cslist;
std::vector<FBoxStyle*> fbslist;
std::vector<DateCode*> datecodes;