From 00aeabb61d1d535684b05145bcc98a8d8a3e10ab Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 21 Apr 2017 10:15:26 +0100 Subject: treat ParaShape like CharShape Change-Id: I7870fdeee6bd097c94d7ae58b67506c4ab2a6fb5 --- hwpfilter/source/hpara.cxx | 23 ++++++++++++----------- hwpfilter/source/hpara.h | 4 ++-- hwpfilter/source/hwpfile.cxx | 12 ++++++------ hwpfilter/source/hwpfile.h | 4 ++-- 4 files changed, 22 insertions(+), 21 deletions(-) (limited to 'hwpfilter') 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(pex & 0x01); - pPara->pshape.reserved[1] = sal::static_int_cast(pex & 0x02); + if (pex & 0x01) + hwpf.AddPage(); + pPara->pshape->reserved[0] = sal::static_int_cast(pex & 0x01); + pPara->pshape->reserved[1] = sal::static_int_cast(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(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 cshape; /* When characters are all the same shape */ - ParaShape pshape; /* if reuse flag is 0, */ + std::shared_ptr pshape; /* if reuse flag is 0, */ std::unique_ptr linfo; std::vector> 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(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& 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(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&); void AddCharShape(std::shared_ptr&); void AddFBoxStyle(FBoxStyle *); void AddDateFormat(DateCode *); @@ -283,7 +283,7 @@ class DLLEXPORT HWPFile std::list emblist; std::list hyperlist; int currenthyper; - std::vector pslist; /* 스타오피스의 구조상 필요 */ + std::vector> pslist; /* 스타오피스의 구조상 필요 */ std::vector> cslist; std::vector fbslist; std::vector datecodes; -- cgit