LibreOffice Module hwpfilter (master) 1
|
The HWPFile class is the main class of hwp for reading file information from stream. More...
#include <hwpfile.h>
Public Types | |
enum | Paper { UserPaper = 0 , Col80Paper = 1 , Col132Paper = 2 , A4Paper = 3 , LetterPaper = 4 , B5Paper = 5 , B4Paper = 6 , LegalPaper = 7 , A3Paper = 8 } |
Public Member Functions | |
HWPFile () | |
Default constructor. More... | |
~HWPFile () | |
int | Open (std::unique_ptr< HStream >) |
Opens HStream to use it. More... | |
int | State (void) const |
Say current state. More... | |
int | SetState (int errcode) |
Sets the current state. More... | |
bool | Read1b (unsigned char &out) |
Reads one byte from HIODev. More... | |
bool | Read1b (char &out) |
bool | Read2b (unsigned short &out) |
Reads two byte from HIODev. More... | |
bool | Read2b (char16_t &out) |
bool | Read4b (unsigned int &out) |
Reads four byte from HIODev. More... | |
bool | Read4b (int &out) |
size_t | Read2b (void *ptr, size_t nmemb) |
Reads nmemb short type array from HIODev. More... | |
size_t | ReadBlock (void *ptr, size_t size) |
Reads some bytes from HIODev not regarding endian's way. More... | |
size_t | SkipBlock (size_t size) |
Skips some bytes from HIODev. More... | |
void | ReadParaList (std::vector< std::unique_ptr< HWPPara > > &aplist, unsigned char flag=0) |
Reads main paragraph list. More... | |
void | ReadParaList (std::vector< HWPPara * > &aplist) |
void | SetCompressed (bool) |
Sets if the stream is compressed. More... | |
std::unique_ptr< HIODev > | SetIODevice (std::unique_ptr< HIODev > hiodev) |
Sets current HIODev. More... | |
int | ReadHwpFile (std::unique_ptr< HStream >) |
Reads all information of hwp file from stream. More... | |
void | InfoRead (void) |
Reads document information of hwp file from HIODev. More... | |
void | FontRead (void) |
Reads font list of hwp file from HIODev. More... | |
void | StyleRead (void) |
Reads style list of hwp file from HIODev. More... | |
void | ParaListRead () |
Reads paragraph list of hwp file from HIODev. More... | |
void | TagsRead () |
Reads additional information like embedded image of hwp file from HIODev. More... | |
void | AddPage () |
void | AddColumnInfo () |
void | SetColumnDef (std::shared_ptr< ColumnDef > const &) |
void | AddParaShape (std::shared_ptr< ParaShape > const &) |
void | AddCharShape (std::shared_ptr< CharShape > const &) |
void | AddFBoxStyle (FBoxStyle *) |
void | AddDateFormat (DateCode *) |
void | AddHeaderFooter (HeaderFooter *) |
void | AddPageNumber (ShowPageNum *) |
void | AddTable (std::unique_ptr< Table >) |
ColumnDef * | GetColumnDef (int) |
int | GetPageMasterNum (int page) |
int | getCurrentPage () const |
HWPInfo & | GetHWPInfo (void) |
HWPFont & | GetHWPFont (void) |
HWPStyle & | GetHWPStyle (void) |
HWPPara * | GetFirstPara (void) |
EmPicture * | GetEmPicture (Picture *pic) |
EmPicture * | GetEmPictureByName (char *name) |
HyperText * | GetHyperText () |
ParaShape * | getParaShape (int) |
CharShape * | getCharShape (int) |
FBoxStyle * | getFBoxStyle (int) |
DateCode * | getDateCode (int) |
HeaderFooter * | getHeaderFooter (int) |
ShowPageNum * | getPageNumber (int) |
Table * | getTable (int) |
int | getParaShapeCount () const |
int | getCharShapeCount () const |
int | getFBoxStyleCount () const |
int | getDateFormatCount () const |
int | getHeaderFooterCount () const |
int | getPageNumberCount () const |
int | getTableCount () const |
int | getColumnCount () const |
int | getMaxSettedPage () const |
void | setMaxSettedPage () |
void | push_hpara_type (unsigned char scflag) |
bool | already_importing_type (unsigned char scflag) const |
void | pop_hpara_type () |
void | move_to_failed (std::unique_ptr< HWPPara > rPara) |
Public Attributes | |
int | version |
bool | compressed |
bool | encrypted |
unsigned char | linenumber |
int | info_block_len |
int | error_code |
std::unique_ptr< OlePicture > | oledata |
unsigned char | scratch [SAL_MAX_UINT16] |
int | readdepth |
Private Member Functions | |
int | compareCharShape (CharShape const *shape) |
int | compareParaShape (ParaShape const *shape) |
Private Attributes | |
int | m_nCurrentPage |
int | m_nMaxSettedPage |
std::unique_ptr< HIODev > | hiodev |
HWPInfo | _hwpInfo |
HWPFont | _hwpFont |
HWPStyle | _hwpStyle |
std::vector< std::unique_ptr< ColumnInfo > > | columnlist |
std::vector< std::unique_ptr< HWPPara > > | plist |
std::vector< std::unique_ptr< HWPPara > > | pfailedlist |
std::vector< std::unique_ptr< EmPicture > > | emblist |
std::vector< std::unique_ptr< HyperText > > | hyperlist |
int | currenthyper |
std::vector< std::shared_ptr< ParaShape > > | pslist |
std::vector< std::shared_ptr< CharShape > > | cslist |
std::vector< FBoxStyle * > | fbslist |
std::vector< DateCode * > | datecodes |
std::vector< HeaderFooter * > | headerfooters |
std::vector< ShowPageNum * > | pagenumbers |
std::vector< std::unique_ptr< Table > > | tables |
std::vector< unsigned char > | element_import_stack |
Static Private Attributes | |
static HWPFile * | cur_doc = nullptr |
Friends | |
HWPFile * | GetCurrentDoc (void) |
HWPFile * | SetCurrentDoc (HWPFile *) |
The HWPFile class is the main class of hwp for reading file information from stream.
The example is as below:
HWPFile f; f.ReadHwpFile( stream );
There are two way to read hwp information from stream, one is to read all at a time to use ReadhwpFile() method like above example, other is to read partial information to use Open(), InfoRead(), FontRead(), StyleRead(), ParaListRead(), TagsRead(),
HWP file management object
enum HWPFile::Paper |
HWPFile::HWPFile | ( | ) |
HWPFile::~HWPFile | ( | ) |
Definition at line 63 of file hwpfile.cxx.
void HWPFile::AddCharShape | ( | std::shared_ptr< CharShape > const & | cshape | ) |
Definition at line 555 of file hwpfile.cxx.
References ccount, compareCharShape(), cslist, and value.
Referenced by HWPPara::Read().
void HWPFile::AddColumnInfo | ( | ) |
Definition at line 567 of file hwpfile.cxx.
References columnlist, m_nCurrentPage, and setMaxSettedPage().
Referenced by HWPPara::Read(), and ReadHwpFile().
void HWPFile::AddDateFormat | ( | DateCode * | hbox | ) |
Definition at line 582 of file hwpfile.cxx.
References datecodecount, datecodes, and DateCode::key.
Referenced by FieldCode::Read(), and DateCode::Read().
void HWPFile::AddFBoxStyle | ( | FBoxStyle * | fbstyle | ) |
Definition at line 603 of file hwpfile.cxx.
References fbslist.
Referenced by TxtBox::Read(), Picture::Read(), and Line::Read().
void HWPFile::AddHeaderFooter | ( | HeaderFooter * | hbox | ) |
Definition at line 593 of file hwpfile.cxx.
References headerfooters.
Referenced by HeaderFooter::Read().
void HWPFile::AddPageNumber | ( | ShowPageNum * | hbox | ) |
Definition at line 588 of file hwpfile.cxx.
References pagenumbers.
Referenced by ShowPageNum::Read().
void HWPFile::AddParaShape | ( | std::shared_ptr< ParaShape > const & | pshape | ) |
Definition at line 519 of file hwpfile.cxx.
References compareParaShape(), MAXTABS, pcount, pslist, and value.
Referenced by ReadParaList().
void HWPFile::AddTable | ( | std::unique_ptr< Table > | hbox | ) |
|
inline |
Definition at line 250 of file hwpfile.h.
Referenced by HWPPara::readHBox().
Definition at line 608 of file hwpfile.cxx.
References CharShape::attr, CharShape::color, count, cslist, CharShape::font, getCharShape(), i, CharShape::index, CharShape::ratio, CharShape::shade, CharShape::size, and CharShape::space.
Referenced by AddCharShape().
Definition at line 630 of file hwpfile.cxx.
References ParaShape::arrange_type, count, ParaShape::cshape, i, ParaShape::indent, ParaShape::index, ParaShape::left_margin, ParaShape::lspacing, ParaShape::outline, ParaShape::pagebreak, pslist, ParaShape::pspacing_next, ParaShape::pspacing_prev, and ParaShape::right_margin.
Referenced by AddParaShape().
void HWPFile::FontRead | ( | void | ) |
Reads font list of hwp file from HIODev.
Definition at line 203 of file hwpfile.cxx.
References _hwpFont, and HWPFont::Read().
Referenced by ReadHwpFile().
Definition at line 477 of file hwpfile.cxx.
References cslist, index, and o3tl::make_unsigned().
Referenced by compareCharShape(), and HwpReader::makeAutoStyles().
|
inline |
Definition at line 238 of file hwpfile.h.
Referenced by HwpReader::makeAutoStyles().
|
inline |
Definition at line 244 of file hwpfile.h.
Referenced by HwpReader::makePageStyle().
Definition at line 414 of file hwpfile.cxx.
References columnlist, and o3tl::make_unsigned().
Referenced by HwpReader::makePageStyle().
|
inline |
Definition at line 220 of file hwpfile.h.
Referenced by TxtBox::Read(), HeaderFooter::Read(), and ShowPageNum::Read().
Definition at line 491 of file hwpfile.cxx.
References datecodes, index, and o3tl::make_unsigned().
Referenced by HwpReader::makeAutoStyles().
|
inline |
Definition at line 240 of file hwpfile.h.
Referenced by HwpReader::makeAutoStyles().
Definition at line 444 of file hwpfile.cxx.
References emblist, PicDefEmbed::embname, name, PicDef::picembed, and Picture::picinfo.
Referenced by HwpReader::makePicture().
EmPicture * HWPFile::GetEmPictureByName | ( | char * | name | ) |
Definition at line 458 of file hwpfile.cxx.
Referenced by HwpReader::makeDrawMiscStyle().
Definition at line 484 of file hwpfile.cxx.
References fbslist, index, and o3tl::make_unsigned().
Referenced by HwpReader::makeAutoStyles(), and HwpReader::makeStyles().
|
inline |
Definition at line 239 of file hwpfile.h.
Referenced by HwpReader::makeAutoStyles(), and HwpReader::makeStyles().
|
inline |
Definition at line 224 of file hwpfile.h.
Referenced by HwpReader::makeBody().
HeaderFooter * HWPFile::getHeaderFooter | ( | int | index | ) |
Definition at line 498 of file hwpfile.cxx.
References headerfooters, index, and o3tl::make_unsigned().
Referenced by HwpReader::makeMasterStyles().
|
inline |
Definition at line 241 of file hwpfile.h.
Referenced by HwpReader::makeMasterStyles().
|
inline |
Definition at line 222 of file hwpfile.h.
Referenced by HwpReader::parseCharShape().
|
inline |
Definition at line 221 of file hwpfile.h.
Referenced by HwpReader::makeDrawMiscStyle(), HwpReader::makeMeta(), HwpReader::makePageStyle(), HwpReader::makePictureDRAW(), and HwpReader::makeStyles().
|
inline |
Definition at line 223 of file hwpfile.h.
Referenced by HwpReader::makeStyles().
HyperText * HWPFile::GetHyperText | ( | ) |
Definition at line 435 of file hwpfile.cxx.
References currenthyper, hyperlist, and o3tl::make_unsigned().
Referenced by HwpReader::makeHyperText().
|
inline |
Definition at line 246 of file hwpfile.h.
Referenced by HwpReader::makeMasterStyles().
Definition at line 423 of file hwpfile.cxx.
References columnlist, and i.
Referenced by HwpReader::makeMasterStyles().
ShowPageNum * HWPFile::getPageNumber | ( | int | index | ) |
Definition at line 505 of file hwpfile.cxx.
References index, o3tl::make_unsigned(), and pagenumbers.
Referenced by HwpReader::makeAutoStyles(), and HwpReader::makeMasterStyles().
|
inline |
Definition at line 242 of file hwpfile.h.
Referenced by HwpReader::makeAutoStyles(), and HwpReader::makeMasterStyles().
Definition at line 470 of file hwpfile.cxx.
References index, o3tl::make_unsigned(), and pslist.
Referenced by HwpReader::makeAutoStyles().
|
inline |
Definition at line 237 of file hwpfile.h.
Referenced by HwpReader::makeAutoStyles().
Definition at line 512 of file hwpfile.cxx.
References index, o3tl::make_unsigned(), and tables.
Referenced by HwpReader::makeAutoStyles().
|
inline |
Definition at line 243 of file hwpfile.h.
Referenced by HwpReader::makeAutoStyles().
void HWPFile::InfoRead | ( | void | ) |
Reads document information of hwp file from HIODev.
Definition at line 197 of file hwpfile.cxx.
References _hwpInfo, and HWPInfo::Read().
Referenced by ReadHwpFile().
void HWPFile::move_to_failed | ( | std::unique_ptr< HWPPara > | rPara | ) |
Definition at line 288 of file hwpfile.cxx.
References pfailedlist.
Referenced by LoadDrawingObject(), and ReadParaList().
Opens HStream to use it.
Definition at line 96 of file hwpfile.cxx.
References detect_hwp_version(), HWP_EMPTY_FILE, HWP_NoError, HWP_UNSUPPORTED_VERSION, HWP_V30, HWPIDLen, ReadBlock(), SetIODevice(), SetState(), stream, and version.
Referenced by ReadHwpFile().
void HWPFile::ParaListRead | ( | ) |
Reads paragraph list of hwp file from HIODev.
Definition at line 215 of file hwpfile.cxx.
References plist, and ReadParaList().
Referenced by ReadHwpFile().
|
inline |
Definition at line 254 of file hwpfile.h.
Referenced by HWPPara::readHBox().
|
inline |
Definition at line 249 of file hwpfile.h.
Referenced by HWPPara::readHBox().
bool HWPFile::Read1b | ( | char & | out | ) |
Definition at line 128 of file hwpfile.cxx.
References hiodev.
bool HWPFile::Read1b | ( | unsigned char & | out | ) |
Reads one byte from HIODev.
Definition at line 123 of file hwpfile.cxx.
References hiodev.
Referenced by CharShape::Read(), ParaShape::Read(), Cell::Read(), HWPInfo::Read(), HyperText::Read(), TxtBox::Read(), Picture::Read(), Line::Read(), HeaderFooter::Read(), Outline::Read(), HWPPara::Read(), and SetCurrentDoc().
bool HWPFile::Read2b | ( | char16_t & | out | ) |
Definition at line 142 of file hwpfile.cxx.
bool HWPFile::Read2b | ( | unsigned short & | out | ) |
Reads two byte from HIODev.
Definition at line 137 of file hwpfile.cxx.
References hiodev.
Referenced by HWPSummary::Read(), CharShape::Read(), ParaShape::Read(), Cell::Read(), HWPFont::Read(), HWPInfo::Read(), HWPStyle::Read(), HyperText::Read(), SkipData::Read(), FieldCode::Read(), Bookmark::Read(), DateFormat::Read(), DateCode::Read(), Tab::Read(), TxtBox::Read(), Picture::Read(), Line::Read(), Hidden::Read(), HeaderFooter::Read(), Footnote::Read(), AutoNum::Read(), NewNum::Read(), ShowPageNum::Read(), PageNumCtrl::Read(), MailMerge::Read(), Compose::Read(), Hyphen::Read(), TocMark::Read(), IndexMark::Read(), Outline::Read(), KeepSpace::Read(), FixedSpace::Read(), HWPPara::Read(), Read2b(), HWPPara::readHBox(), and SetCurrentDoc().
size_t HWPFile::Read2b | ( | void * | ptr, |
size_t | nmemb | ||
) |
Reads nmemb short type array from HIODev.
Definition at line 166 of file hwpfile.cxx.
References hiodev.
bool HWPFile::Read4b | ( | int & | out | ) |
Definition at line 157 of file hwpfile.cxx.
References Read4b().
bool HWPFile::Read4b | ( | unsigned int & | out | ) |
Reads four byte from HIODev.
Definition at line 152 of file hwpfile.cxx.
References hiodev.
Referenced by OlePicture::Read(), SkipData::Read(), FieldCode::Read(), Bookmark::Read(), Picture::Read(), HWPPara::Read(), Read4b(), SetCurrentDoc(), and TagsRead().
size_t HWPFile::ReadBlock | ( | void * | ptr, |
size_t | size | ||
) |
Reads some bytes from HIODev not regarding endian's way.
size | Amount for reading |
Definition at line 171 of file hwpfile.cxx.
Referenced by HWPReadInfoBlock(), Open(), CharShape::Read(), ParaShape::Read(), Cell::Read(), HWPFont::Read(), HWPInfo::Read(), HWPStyle::Read(), EmPicture::Read(), HyperText::Read(), OlePicture::Read(), FieldCode::Read(), Picture::Read(), Line::Read(), Hidden::Read(), HeaderFooter::Read(), Footnote::Read(), MailMerge::Read(), and SetCurrentDoc().
Reads all information of hwp file from stream.
Definition at line 69 of file hwpfile.cxx.
References AddColumnInfo(), FontRead(), HWP_NoError, InfoRead(), Open(), ParaListRead(), State(), stream, StyleRead(), and TagsRead().
Referenced by HwpReader::importHStream().
void HWPFile::ReadParaList | ( | std::vector< HWPPara * > & | aplist | ) |
Definition at line 220 of file hwpfile.cxx.
References AddParaShape(), and move_to_failed().
void HWPFile::ReadParaList | ( | std::vector< std::unique_ptr< HWPPara > > & | aplist, |
unsigned char | flag = 0 |
||
) |
Reads main paragraph list.
Definition at line 254 of file hwpfile.cxx.
References AddParaShape(), and move_to_failed().
Referenced by LoadParaList(), ParaListRead(), TxtBox::Read(), Picture::Read(), Hidden::Read(), HeaderFooter::Read(), and Footnote::Read().
void HWPFile::SetColumnDef | ( | std::shared_ptr< ColumnDef > const & | rColdef | ) |
void HWPFile::SetCompressed | ( | bool | flag | ) |
Sets if the stream is compressed.
Definition at line 181 of file hwpfile.cxx.
References hiodev.
Referenced by HWPInfo::Read().
Sets current HIODev.
Definition at line 188 of file hwpfile.cxx.
References hiodev.
Referenced by LoadParaList(), and Open().
|
inline |
Definition at line 247 of file hwpfile.h.
Referenced by AddColumnInfo(), HeaderFooter::Read(), and ShowPageNum::Read().
Sets the current state.
Definition at line 117 of file hwpfile.cxx.
References error_code.
Referenced by Open(), HWPFont::Read(), SkipData::Read(), Bookmark::Read(), DateFormat::Read(), DateCode::Read(), Tab::Read(), TxtBox::Read(), Picture::Read(), Line::Read(), Hidden::Read(), HeaderFooter::Read(), Footnote::Read(), AutoNum::Read(), NewNum::Read(), ShowPageNum::Read(), PageNumCtrl::Read(), MailMerge::Read(), Compose::Read(), Hyphen::Read(), TocMark::Read(), IndexMark::Read(), Outline::Read(), KeepSpace::Read(), and FixedSpace::Read().
size_t HWPFile::SkipBlock | ( | size_t | size | ) |
Skips some bytes from HIODev.
Definition at line 176 of file hwpfile.cxx.
Referenced by CharShape::Read(), OlePicture::Read(), SkipData::Read(), FieldCode::Read(), and SetCurrentDoc().
|
inline |
Say current state.
Definition at line 119 of file hwpfile.h.
Referenced by HWPSummary::Read(), HWPInfo::Read(), HWPStyle::Read(), TxtBox::Read(), Picture::Read(), Line::Read(), Hidden::Read(), HeaderFooter::Read(), Footnote::Read(), AutoNum::Read(), NewNum::Read(), ShowPageNum::Read(), PageNumCtrl::Read(), MailMerge::Read(), Compose::Read(), Hyphen::Read(), TocMark::Read(), IndexMark::Read(), Outline::Read(), KeepSpace::Read(), FixedSpace::Read(), HWPPara::Read(), HWPPara::readHBox(), and ReadHwpFile().
void HWPFile::StyleRead | ( | void | ) |
Reads style list of hwp file from HIODev.
Definition at line 209 of file hwpfile.cxx.
References _hwpStyle, and HWPStyle::Read().
Referenced by ReadHwpFile().
void HWPFile::TagsRead | ( | ) |
Reads additional information like embedded image of hwp file from HIODev.
Definition at line 293 of file hwpfile.cxx.
References Read4b(), and size.
Referenced by ReadHwpFile().
|
friend |
Definition at line 667 of file hwpfile.cxx.
Definition at line 673 of file hwpfile.cxx.
Referenced by HWPFile().
|
private |
Definition at line 280 of file hwpfile.h.
Referenced by FontRead().
|
private |
Definition at line 279 of file hwpfile.h.
Referenced by InfoRead(), and SetCurrentDoc().
|
private |
Definition at line 281 of file hwpfile.h.
Referenced by StyleRead().
|
private |
Definition at line 282 of file hwpfile.h.
Referenced by AddColumnInfo(), GetColumnDef(), GetPageMasterNum(), and SetColumnDef().
bool HWPFile::compressed |
Definition at line 264 of file hwpfile.h.
Referenced by HWPInfo::Read().
|
private |
Definition at line 294 of file hwpfile.h.
Referenced by AddCharShape(), compareCharShape(), and getCharShape().
|
private |
Definition at line 292 of file hwpfile.h.
Referenced by GetHyperText().
|
private |
Definition at line 296 of file hwpfile.h.
Referenced by AddDateFormat(), and getDateCode().
|
private |
|
private |
Definition at line 290 of file hwpfile.h.
Referenced by GetEmPicture(), GetEmPictureByName(), and SetCurrentDoc().
bool HWPFile::encrypted |
Definition at line 265 of file hwpfile.h.
Referenced by HWPInfo::Read().
int HWPFile::error_code |
Definition at line 268 of file hwpfile.h.
Referenced by SetState().
|
private |
Definition at line 295 of file hwpfile.h.
Referenced by AddFBoxStyle(), and getFBoxStyle().
|
private |
Definition at line 297 of file hwpfile.h.
Referenced by AddHeaderFooter(), and getHeaderFooter().
|
private |
Definition at line 277 of file hwpfile.h.
Referenced by Read1b(), Read2b(), Read4b(), ReadBlock(), SetCompressed(), SetIODevice(), SkipBlock(), and ~HWPFile().
|
private |
Definition at line 291 of file hwpfile.h.
Referenced by GetHyperText(), and SetCurrentDoc().
int HWPFile::info_block_len |
Definition at line 267 of file hwpfile.h.
Referenced by HWPReadInfoBlock(), and HWPInfo::Read().
unsigned char HWPFile::linenumber |
Definition at line 266 of file hwpfile.h.
Referenced by HwpReader::makeStyles(), and Line::Read().
|
private |
Definition at line 275 of file hwpfile.h.
Referenced by AddColumnInfo().
std::unique_ptr<OlePicture> HWPFile::oledata |
Definition at line 269 of file hwpfile.h.
Referenced by HwpReader::makePicture(), SetCurrentDoc(), and ~HWPFile().
|
private |
Definition at line 298 of file hwpfile.h.
Referenced by AddPageNumber(), and getPageNumber().
|
private |
Definition at line 288 of file hwpfile.h.
Referenced by move_to_failed().
|
private |
Definition at line 284 of file hwpfile.h.
Referenced by ParaListRead().
|
private |
Definition at line 293 of file hwpfile.h.
Referenced by AddParaShape(), compareParaShape(), and getParaShape().
int HWPFile::readdepth |
Definition at line 271 of file hwpfile.h.
Referenced by DepthGuard::DepthGuard(), DepthGuard::toodeep(), and DepthGuard::~DepthGuard().
unsigned char HWPFile::scratch[SAL_MAX_UINT16] |
Definition at line 270 of file hwpfile.h.
Referenced by Picture::Read().
|
private |
Definition at line 299 of file hwpfile.h.
Referenced by AddTable(), and getTable().