LibreOffice Module hwpfilter (master) 1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
HwpReader Class Reference

This class implements the external Parser interface. More...

#include <hwpreader.hxx>

Inheritance diagram for HwpReader:
[legend]
Collaboration diagram for HwpReader:
[legend]

Public Member Functions

 HwpReader ()
 
virtual ~HwpReader () override
 
virtual sal_Bool SAL_CALL filter (const Sequence< PropertyValue > &aDescriptor) override
 parseStream does Parser-startup initializations More...
 
virtual void SAL_CALL cancel () override
 
void setDocumentHandler (Reference< XDocumentHandler > const &xHandler)
 
bool importHStream (std::unique_ptr< HStream > stream)
 

Private Member Functions

void makeMeta ()
 make office:meta Completed More...
 
void makeStyles ()
 
void makeDrawMiscStyle (HWPDrawingObject *)
 
void makeAutoStyles ()
 parse automatic styles from hwpfile Define a style that is automatically reflected. More...
 
void makeMasterStyles ()
 
void makeBody ()
 make office:body More...
 
void makeTextDecls ()
 make text decls More...
 
void parsePara (HWPPara *para)
 
void make_text_p0 (HWPPara *para, bool bParaStart)
 If no special characters in the paragraph and all characters use the same CharShape. More...
 
void make_text_p1 (HWPPara *para, bool bParaStart)
 
void make_text_p3 (HWPPara *para, bool bParaStart)
 Special characters are in the paragraph and characters use different CharShapes. More...
 
void makeChars (hchar_string &rStr)
 
void makeFieldCode (hchar_string const &rStr, FieldCode const *hbox)
 
void makeBookmark (Bookmark const *hbox)
 Completed In LibreOffice, refer bookmarks as reference, but hwp doesn't have the sort of feature. More...
 
void makeDateFormat (DateCode *hbox)
 
void makeDateCode (DateCode *hbox)
 
void makeTab ()
 
void makeTable (TxtBox *hbox)
 
void makeTextBox (TxtBox *hbox)
 Parses the text boxes and tables. More...
 
void makeFormula (TxtBox *hbox)
 It must be converted into MathML. More...
 
void makeHyperText (TxtBox *hbox)
 Read the platform information. More...
 
void makePicture (Picture *hbox)
 Read the platform information. More...
 
void makePictureDRAW (HWPDrawingObject *drawobj, const Picture *hbox)
 
void makeLine ()
 
void makeHidden (Hidden *hbox)
 Input-comment-hidden description: shows a hidden explanation to the users. More...
 
void makeFootnote (Footnote *hbox)
 Converts footnote to text:footnote, endnote to text:endnote. More...
 
void makeAutoNum (AutoNum const *hbox)
 page/footnote/endnote/picture/table/formula number More...
 
void makeShowPageNum ()
 
void makeMailMerge (MailMerge *hbox)
 mail merge operation using hwp addressbook and hwp data form. More...
 
void makeOutline (Outline const *hbox)
 
void makePageStyle ()
 Create a style for the page. More...
 
void makeColumns (ColumnDef const *)
 
void makeTStyle (CharShape const *)
 
void makePStyle (ParaShape const *)
 Make the style of the Paragraph. More...
 
void makeFStyle (FBoxStyle *)
 Create a style for the Floating objects. More...
 
void makeCaptionStyle (FBoxStyle *)
 
void makeDrawStyle (HWPDrawingObject *, FBoxStyle *)
 
void makeTableStyle (Table *)
 
void parseCharShape (CharShape const *)
 Create the properties for text styles. More...
 
void parseParaShape (ParaShape const *)
 Create the properties that correspond to the real Paragraph. More...
 
void startEl (const OUString &el)
 
void endEl (const OUString &el)
 
void chars (const OUString &s)
 

Static Private Member Functions

static OUString getTStyleName (int)
 
static OUString getPStyleName (int)
 

Private Attributes

Reference< XDocumentHandler > m_rxDocumentHandler
 
rtl::Reference< AttributeListImplmxList
 
HWPFile hwpfile
 
std::unique_ptr< HwpReaderPrivated
 

Detailed Description

This class implements the external Parser interface.

Definition at line 77 of file hwpreader.hxx.

Constructor & Destructor Documentation

◆ HwpReader()

HwpReader::HwpReader ( )

Definition at line 82 of file hwpreader.cxx.

References d.

◆ ~HwpReader()

HwpReader::~HwpReader ( )
overridevirtual

Definition at line 87 of file hwpreader.cxx.

Member Function Documentation

◆ cancel()

virtual void SAL_CALL HwpReader::cancel ( )
inlineoverridevirtual

Definition at line 88 of file hwpreader.hxx.

◆ chars()

void HwpReader::chars ( const OUString &  s)
private

◆ endEl()

void HwpReader::endEl ( const OUString &  el)
private

◆ filter()

sal_Bool HwpReader::filter ( const Sequence< PropertyValue > &  aDescriptor)
overridevirtual

parseStream does Parser-startup initializations

Definition at line 159 of file hwpreader.cxx.

References aBuffer, utl::MediaDescriptor::addInputStream(), importHStream(), utl::MediaDescriptor::PROP_INPUTSTREAM, and stream.

◆ getPStyleName()

OUString HwpReader::getPStyleName ( int  index)
staticprivate

Definition at line 2606 of file hwpreader.cxx.

References index.

Referenced by make_text_p0(), make_text_p1(), make_text_p3(), and parsePara().

◆ getTStyleName()

OUString HwpReader::getTStyleName ( int  index)
staticprivate

Definition at line 2600 of file hwpreader.cxx.

References index.

Referenced by make_text_p0(), make_text_p1(), and make_text_p3().

◆ importHStream()

bool HwpReader::importHStream ( std::unique_ptr< HStream stream)

◆ make_text_p0()

void HwpReader::make_text_p0 ( HWPPara para,
bool  bParaStart 
)
private

If no special characters in the paragraph and all characters use the same CharShape.

Definition at line 2622 of file hwpreader.cxx.

References CH_END_PARA, CH_SPACE, HWPPara::cshape, d, endEl(), HWPPara::GetParaShape(), getPStyleName(), getTStyleName(), hcharconv(), HWPPara::hhstr, ParaShape::index, makeChars(), makeShowPageNum(), mxList, startEl(), sXML_CDATA, and UNICODE.

Referenced by parsePara().

◆ make_text_p1()

void HwpReader::make_text_p1 ( HWPPara para,
bool  bParaStart 
)
private

◆ make_text_p3()

void HwpReader::make_text_p3 ( HWPPara para,
bool  bParaStart 
)
private

◆ makeAutoNum()

void HwpReader::makeAutoNum ( AutoNum const *  hbox)
private

page/footnote/endnote/picture/table/formula number

Definition at line 4546 of file hwpreader.cxx.

References chars(), endEl(), ENNUM_AUTO, EQUNUM_AUTO, FNNUM_AUTO, mxList, AutoNum::number, PGNUM_AUTO, PICNUM_AUTO, startEl(), sXML_CDATA, TBLNUM_AUTO, and AutoNum::type.

Referenced by make_text_p3().

◆ makeAutoStyles()

void HwpReader::makeAutoStyles ( )
private

parse automatic styles from hwpfile Define a style that is automatically reflected.

For example, defining styles of each paragraph, tables, header, and etc,. at here. In Body, use the defined style.

  1. supports for the styles of paragraph, text, fbox, and page.

Definition at line 749 of file hwpreader.cxx.

References FBoxStyle::boxtype, FBoxStyle::cell, endEl(), HWPFile::getCharShape(), HWPFile::getCharShapeCount(), HWPFile::getDateCode(), HWPFile::getDateFormatCount(), HWPFile::getFBoxStyle(), HWPFile::getFBoxStyleCount(), HWPFile::getPageNumber(), HWPFile::getPageNumberCount(), HWPFile::getParaShape(), HWPFile::getParaShapeCount(), HWPFile::getTable(), HWPFile::getTableCount(), hwpfile, i, makeDateFormat(), makeDrawStyle(), makeFStyle(), makePageStyle(), makePStyle(), makeTableStyle(), makeTStyle(), mxList, startEl(), sXML_CDATA, and ShowPageNum::where.

Referenced by importHStream().

◆ makeBody()

void HwpReader::makeBody ( )
private

make office:body

Definition at line 187 of file hwpreader.cxx.

References d, endEl(), HWPFile::GetFirstPara(), hwpfile, makeTextDecls(), parsePara(), and startEl().

Referenced by importHStream().

◆ makeBookmark()

void HwpReader::makeBookmark ( Bookmark const *  hbox)
private

Completed In LibreOffice, refer bookmarks as reference, but hwp doesn't have the sort of feature.

Definition at line 3191 of file hwpreader.cxx.

References endEl(), hstr2OUString(), Bookmark::id, mxList, startEl(), sXML_CDATA, and Bookmark::type.

Referenced by make_text_p3().

◆ makeCaptionStyle()

void HwpReader::makeCaptionStyle ( FBoxStyle fstyle)
private

◆ makeChars()

void HwpReader::makeChars ( hchar_string rStr)
private

Definition at line 2612 of file hwpreader.cxx.

References chars(), and fromHcharStringToOUString().

Referenced by make_text_p0(), make_text_p1(), make_text_p3(), and makeHidden().

◆ makeColumns()

void HwpReader::makeColumns ( ColumnDef const *  coldef)
private

◆ makeDateCode()

void HwpReader::makeDateCode ( DateCode hbox)
private

◆ makeDateFormat()

void HwpReader::makeDateFormat ( DateCode hbox)
private

◆ makeDrawMiscStyle()

void HwpReader::makeDrawMiscStyle ( HWPDrawingObject hdo)
private

◆ makeDrawStyle()

void HwpReader::makeDrawStyle ( HWPDrawingObject hdo,
FBoxStyle fstyle 
)
private

◆ makeFieldCode()

void HwpReader::makeFieldCode ( hchar_string const &  rStr,
FieldCode const *  hbox 
)
private

◆ makeFootnote()

void HwpReader::makeFootnote ( Footnote hbox)
private

Converts footnote to text:footnote, endnote to text:endnote.

Definition at line 4506 of file hwpreader.cxx.

References chars(), endEl(), mxList, Footnote::number, parsePara(), Footnote::plist, startEl(), sXML_CDATA, and Footnote::type.

Referenced by make_text_p3().

◆ makeFormula()

void HwpReader::makeFormula ( TxtBox hbox)
private

◆ makeFStyle()

void HwpReader::makeFStyle ( FBoxStyle fstyle)
private

◆ makeHidden()

void HwpReader::makeHidden ( Hidden hbox)
private

Input-comment-hidden description: shows a hidden explanation to the users.

Parse out only strings, but it may contain paragraphs.

Definition at line 4471 of file hwpreader.cxx.

References endEl(), hcharconv(), HWPPara::hhstr, makeChars(), mxList, HWPPara::Next(), Hidden::plist, startEl(), sXML_CDATA, and UNICODE.

Referenced by make_text_p3().

◆ makeHyperText()

void HwpReader::makeHyperText ( TxtBox hbox)
private

Read the platform information.

if the platform is Linux or Solaris, it needs to change C: \ => Home, D: \ => changed to root (/). Because HWP uses DOS emulator.

Definition at line 3647 of file hwpreader.cxx.

References HyperText::bookmark, endEl(), HyperText::filename, HWPFile::GetHyperText(), hstr2ksstr(), hwpfile, kstr2hstr(), makeTextBox(), mxList, startEl(), sXML_CDATA, and urltounix().

Referenced by make_text_p3().

◆ makeLine()

void HwpReader::makeLine ( )
private

Definition at line 4460 of file hwpreader.cxx.

References mxList, startEl(), and sXML_CDATA.

Referenced by make_text_p3().

◆ makeMailMerge()

void HwpReader::makeMailMerge ( MailMerge hbox)
private

mail merge operation using hwp addressbook and hwp data form.

not support operation in OO writer.

Definition at line 4634 of file hwpreader.cxx.

References chars(), MailMerge::GetString(), and hstr2OUString().

Referenced by make_text_p3().

◆ makeMasterStyles()

void HwpReader::makeMasterStyles ( )
private

◆ makeMeta()

void HwpReader::makeMeta ( )
private

◆ makeOutline()

void HwpReader::makeOutline ( Outline const *  hbox)
private

Definition at line 4641 of file hwpreader.cxx.

References chars(), Outline::GetUnicode(), and Outline::kind.

Referenced by make_text_p3().

◆ makePageStyle()

void HwpReader::makePageStyle ( )
private

◆ makePicture()

void HwpReader::makePicture ( Picture hbox)
private

◆ makePictureDRAW()

void HwpReader::makePictureDRAW ( HWPDrawingObject drawobj,
const Picture hbox 
)
private

Definition at line 3898 of file hwpreader.cxx.

References a, FBoxStyle::anchor_type, HWPDrawingObject::arc, calcAngle(), CHAR_ANCHOR, o3tl::checked_add(), HWPDrawingObject::child, Cx, Cy, endEl(), HWPDrawingObject::extent, HWPDOProperty::fill_color, HWPDOProperty::flag, HWPDOLine::flip, HWPDrawingObject::freeform, HWPFile::GetHWPInfo(), basegfx::Tuple2D< typename TYPE >::getX(), basegfx::Tuple2D< typename TYPE >::getY(), HWPDOTextBox::h, ZZSize::h, HWPDO_ADVANCED_ARC, HWPDO_ADVANCED_ELLIPSE, HWPDO_ARC, HWPDO_CLOSED_FREEFORM, HWPDO_CONTAINER, HWPDO_CURVE, HWPDO_ELLIPSE, HWPDO_FLAG_AS_TEXTBOX, HWPDO_FLAG_DRAW_PIE, HWPDO_FLAG_ROTATION, HWPDO_FREEFORM, HWPDO_LINE, HWPDO_RECT, HWPDO_TEXTBOX, hwpfile, i, HWPDrawingObject::index, HWPDrawingObject::line_arc, make_text_p1(), o3tl::make_unsigned(), makePictureDRAW(), mxList, n, NaturalSpline(), HWPDrawingObject::next, HWPPara::Next(), HWPDOFreeForm::npt, HWPDrawingObject::offset2, PAGE_ANCHOR, HWPInfo::paper, PAPER_ANCHOR, PARA_ANCHOR, HWPDOProperty::parall, HWPDOProperty::pattern_type, PeriodicSpline(), FBox::pgno, FBox::pgx, FBox::pgy, HWPDOProperty::pPara, HWPDrawingObject::property, pt, HWPDOFreeForm::pt, ZZParall::pt, basegfx::rad2deg(), HWPDOArc::radial, HWPDOProperty::rot_originx, HWPDOProperty::rot_originy, rotate(), basegfx::Tuple2D< typename TYPE >::setX(), basegfx::Tuple2D< typename TYPE >::setY(), startEl(), FBox::style, sXML_CDATA, HWPDrawingObject::textbox, HWPDrawingObject::type, HWPDrawingObject::u, value, ZZSize::w, WTMM, x, ZZPoint::x, y, and ZZPoint::y.

Referenced by makePicture(), and makePictureDRAW().

◆ makePStyle()

void HwpReader::makePStyle ( ParaShape const *  pshape)
private

◆ makeShowPageNum()

void HwpReader::makeShowPageNum ( )
private

◆ makeStyles()

void HwpReader::makeStyles ( )
private

◆ makeTab()

void HwpReader::makeTab ( )
private

Definition at line 3376 of file hwpreader.cxx.

References endEl(), and startEl().

Referenced by make_text_p3().

◆ makeTable()

void HwpReader::makeTable ( TxtBox hbox)
private

◆ makeTableStyle()

void HwpReader::makeTableStyle ( Table tbl)
private

◆ makeTextBox()

void HwpReader::makeTextBox ( TxtBox hbox)
private

Parses the text boxes and tables.

  1. draw: style-name, draw: name, text: anchor-type, svg: width, Fo: min-height, svg: x, svg: y TODO: fo:background-color <= no idea whether the value of color setting->style is in it or not

Definition at line 3454 of file hwpreader.cxx.

References FBoxStyle::anchor_type, FBox::box_xs, FBox::box_ys, FBoxStyle::boxnum, FBoxStyle::cap_len, TxtBox::cap_pos, FBox::cap_xs, FBox::cap_ys, TxtBox::caption, CHAR_ANCHOR, endEl(), EQU_TYPE, makeFormula(), makeTable(), FBoxStyle::margin, mxList, PAGE_ANCHOR, PAPER_ANCHOR, PARA_ANCHOR, parsePara(), FBox::pgno, FBox::pgx, FBox::pgy, TxtBox::plists, startEl(), FBox::style, sXML_CDATA, TBL_TYPE, TXT_TYPE, TxtBox::type, WTMM, x, y, and FBox::zorder.

Referenced by make_text_p3(), and makeHyperText().

◆ makeTextDecls()

void HwpReader::makeTextDecls ( )
private

make text decls

Definition at line 202 of file hwpreader.cxx.

References endEl(), mxList, startEl(), and sXML_CDATA.

Referenced by makeBody().

◆ makeTStyle()

void HwpReader::makeTStyle ( CharShape const *  cshape)
private

Definition at line 1789 of file hwpreader.cxx.

References endEl(), CharShape::index, mxList, parseCharShape(), startEl(), and sXML_CDATA.

Referenced by makeAutoStyles().

◆ parseCharShape()

void HwpReader::parseCharShape ( CharShape const *  cshape)
private

Create the properties for text styles.

  1. fo:font-size, fo:font-family, fo:letter-spacing, fo:color, style:text-background-color, fo:font-style, fo:font-weight, style:text-underline,style:text-outline,fo:text-shadow,style:text-position Support them.

Definition at line 1268 of file hwpreader.cxx.

References CharShape::attr, CharShape::color, d, CharShape::font, HWPFont::GetFontName(), HWPFile::GetHWPFont(), getRepFamilyName(), hcolor2str(), hstr2ksstr(), hwpfile, if(), kstr2hstr(), mxList, CharShape::ratio, CharShape::shade, size, CharShape::size, CharShape::space, and sXML_CDATA.

Referenced by makePStyle(), makeStyles(), and makeTStyle().

◆ parsePara()

void HwpReader::parsePara ( HWPPara para)
private

◆ parseParaShape()

void HwpReader::parseParaShape ( ParaShape const *  pshape)
private

Create the properties that correspond to the real Paragraph.

  1. fo:margin-left,fo:margin-right,fo:margin-top, fo:margin-bottom, fo:text-indent, fo:line-height, fo:text-align, fo:border are implemented. TODO: Tab Settings => set values of properties only which doesn't have the default value

Definition at line 1340 of file hwpreader.cxx.

References ParaShape::arrange_type, hcolor2str(), ParaShape::indent, ParaShape::left_margin, ParaShape::lspacing, mxList, ParaShape::outline, ParaShape::pagebreak, ParaShape::pspacing_next, ParaShape::pspacing_prev, ParaShape::right_margin, ParaShape::shade, and sXML_CDATA.

Referenced by makePStyle(), and makeStyles().

◆ setDocumentHandler()

void HwpReader::setDocumentHandler ( Reference< XDocumentHandler > const &  xHandler)
inline

Definition at line 89 of file hwpreader.hxx.

References m_rxDocumentHandler.

◆ startEl()

void HwpReader::startEl ( const OUString &  el)
private

Member Data Documentation

◆ d

std::unique_ptr<HwpReaderPrivate> HwpReader::d
private

◆ hwpfile

HWPFile HwpReader::hwpfile
private

◆ m_rxDocumentHandler

Reference<XDocumentHandler> HwpReader::m_rxDocumentHandler
private

Definition at line 97 of file hwpreader.hxx.

Referenced by chars(), endEl(), importHStream(), makeFormula(), setDocumentHandler(), and startEl().

◆ mxList

rtl::Reference<AttributeListImpl> HwpReader::mxList
private

The documentation for this class was generated from the following files: