1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "precompile.h"
22 #include <comphelper/newarray.hxx>
23 #include <unotools/configmgr.hxx>
35 static short fboxnum
= 1;
36 static int zindex
= 1;
37 static int lnnumber
= 0;
39 bool HBox::Read(HWPFile
& )
48 bool SkipData::Read(HWPFile
& hwpf
)
51 hwpf
.Read4b(&data_block_len
, 1);
54 hwpf
.Read2b(&dummy
, 1);
56 if (!(IS_SP_SKIP_BLOCK(hh
) && (hh
== dummy
))){
57 return hwpf
.SetState(HWP_InvalidFileFormat
);
60 return hwpf
.SkipBlock(data_block_len
);
64 bool FieldCode::Read(HWPFile
& hwpf
)
68 uint len1
; /* Length of hchar type string DATA #1 */
69 uint len2
; /* Length of hchar type string DATA #2 */
70 uint len3
; /* Length of hchar type string DATA #3 */
71 uint binlen
; /* Length of any binary data format */
73 hwpf
.Read4b(&size
, 1);
74 hwpf
.Read2b(&dummy
, 1);
75 hwpf
.ReadBlock(&type
, 2);
76 hwpf
.Read4b(reserved1
.data(), 1);
77 hwpf
.Read2b(&location_info
, 1);
78 hwpf
.ReadBlock(reserved2
.data(), 22);
79 hwpf
.Read4b(&len1
, 1);
80 hwpf
.Read4b(&len2
, 1);
81 hwpf
.Read4b(&len3
, 1);
82 hwpf
.Read4b(&binlen
, 1);
84 uint
const len1_
= std::min
<uint
>(len1
, 1024) / sizeof(hchar
);
85 uint
const len2_
= std::min
<uint
>(len2
, 1024) / sizeof(hchar
);
86 uint
const len3_
= std::min
<uint
>(len3
, 1024) / sizeof(hchar
);
88 str1
.reset( new hchar
[len1_
? len1_
: 1] );
89 str2
.reset( new hchar
[len2_
? len2_
: 1] );
90 str3
.reset( new hchar
[len3_
? len3_
: 1] );
92 hwpf
.Read2b(str1
.get(), len1_
);
93 hwpf
.SkipBlock(len1
- (len1_
* sizeof(hchar
)));
94 str1
[len1_
? (len1_
- 1) : 0] = 0;
95 hwpf
.Read2b(str2
.get(), len2_
);
96 hwpf
.SkipBlock(len2
- (len2_
* sizeof(hchar
)));
97 str2
[len2_
? (len2_
- 1) : 0] = 0;
98 hwpf
.Read2b(str3
.get(), len3_
);
99 hwpf
.SkipBlock(len3
- (len3_
* sizeof(hchar
)));
100 str3
[len3_
? (len3_
- 1) : 0] = 0;
102 hwpf
.SkipBlock(binlen
);
104 if( type
[0] == 3 && type
[1] == 2 ){ /* It must create a format as created date. */
105 DateCode
*pDate
= new DateCode
;
106 for (int i
= 0 ; i
< static_cast<int>(len3_
); i
++) {
107 if(str3
[i
] == 0 ) break;
108 if( i
>= DATE_SIZE
) break;
109 pDate
->format
[i
] = str3
[i
];
111 hwpf
.AddDateFormat(pDate
);
112 m_pDate
.reset( pDate
);
119 bool Bookmark::Read(HWPFile
& hwpf
)
123 hwpf
.Read4b(&len
, 1);
124 if (!hwpf
.Read2b(dummy
))
127 if (len
!= 34)// 2 * (BMK_COMMENT_LEN + 1) + 2
129 return hwpf
.SetState(HWP_InvalidFileFormat
);
131 if (!(hh
== dummy
&& dummy
== CH_BOOKMARK
)){
132 return hwpf
.SetState(HWP_InvalidFileFormat
);
135 hwpf
.Read2b(id
, BMK_COMMENT_LEN
+ 1);
136 hwpf
.Read2b(&type
, 1);
141 bool DateFormat::Read(HWPFile
& hwpf
)
143 hwpf
.Read2b(format
, DATE_SIZE
);
144 if (!hwpf
.Read2b(dummy
))
146 if (!(hh
== dummy
&& CH_DATE_FORM
== dummy
)){
147 return hwpf
.SetState(HWP_InvalidFileFormat
);
153 bool DateCode::Read(HWPFile
& hwpf
)
155 hwpf
.Read2b(format
, DATE_SIZE
);
156 hwpf
.Read2b(date
, 6);
157 if (!hwpf
.Read2b(dummy
))
159 if (!(hh
== dummy
&& CH_DATE_CODE
== dummy
)){
160 return hwpf
.SetState(HWP_InvalidFileFormat
);
162 hwpf
.AddDateFormat(this);
167 bool Tab::Read(HWPFile
& hwpf
)
169 unsigned short tmp16
;
170 if (!hwpf
.Read2b(tmp16
))
173 if (!hwpf
.Read2b(leader
))
175 if (!hwpf
.Read2b(dummy
))
177 if (!(hh
== dummy
&& CH_TAB
== dummy
)){
178 return hwpf
.SetState(HWP_InvalidFileFormat
);
183 // tbox(10) TABLE BOX MATH BUTTON HYPERTEXT
184 static void UpdateBBox(FBox
* fbox
)
186 fbox
->boundsy
= fbox
->pgy
;
187 fbox
->boundey
= fbox
->pgy
+ fbox
->ys
- 1;
190 bool Cell::Read(HWPFile
& hwpf
)
193 hwpf
.Read2b(&color
, 1);
198 hwpf
.Read2b(&txthigh
, 1);
199 hwpf
.Read2b(&cellhigh
, 1);
202 hwpf
.Read1b(changed
);
204 hwpf
.Read1b(ver_align
);
205 hwpf
.ReadBlock(linetype
, 4);
207 hwpf
.Read1b(diagonal
);
208 return hwpf
.Read1b(protect
);
211 bool TxtBox::Read(HWPFile
& hwpf
)
215 hwpf
.Read2b(reserved
, 2);
216 hwpf
.Read2b(&dummy
, 1);
218 if (!(hh
== dummy
&& CH_TEXT_BOX
== dummy
)){
219 return hwpf
.SetState(HWP_InvalidFileFormat
);
222 hwpf
.Read2b(&style
.cap_len
, 1);
223 hwpf
.Read2b(&dummy1
, 1);
225 hwpf
.Read2b(&next
, 1);
226 hwpf
.Read2b(&dummy2
, 1);
228 style
.boxnum
= fboxnum
++;
230 hwpf
.Read1b(style
.anchor_type
);
231 hwpf
.Read1b(style
.txtflow
);
232 hwpf
.Read2b(&style
.xpos
, 1);
233 hwpf
.Read2b(&style
.ypos
, 1);
234 hwpf
.Read2b(&option
, 1);
235 hwpf
.Read2b(&ctrl_ch
, 1);
236 hwpf
.Read2b(style
.margin
, 12);
237 hwpf
.AddFBoxStyle(&style
);
238 hwpf
.Read2b(&box_xs
, 1);
239 hwpf
.Read2b(&box_ys
, 1);
240 hwpf
.Read2b(&cap_xs
, 1);
241 hwpf
.Read2b(&cap_ys
, 1);
242 hwpf
.Read2b(&style
.cap_len
, 1);
245 hwpf
.Read2b(&cap_margin
, 1);
246 hwpf
.Read1b(xpos_type
);
247 hwpf
.Read1b(ypos_type
);
248 hwpf
.Read1b(smart_linesp
);
249 hwpf
.Read1b(reserved1
);
250 hwpf
.Read2b(&pgx
, 1);
251 hwpf
.Read2b(&pgy
, 1);
252 hwpf
.Read2b(&pgno
, 1);
253 if( ( pgno
+1 ) != hwpf
.getCurrentPage() )
254 pgno
= sal::static_int_cast
<short>(hwpf
.getCurrentPage() -1) ;
256 hwpf
.Read2b(&showpg
, 1);
257 hwpf
.Read2b(&cap_pos
, 1);
258 hwpf
.Read2b(&num
, 1);
259 hwpf
.Read2b(&dummy3
, 1);
260 hwpf
.Read2b(&baseline
, 1);
261 hwpf
.Read2b(&type
, 1);
262 hwpf
.Read2b(&nCell
, 1);
263 hwpf
.Read2b(&protect
, 1);
287 return hwpf
.SetState(HWP_InvalidFileFormat
);
290 cell
.reset( ::comphelper::newArray_null
<Cell
>(ncell
) );
292 return hwpf
.SetState(HWP_InvalidFileFormat
);
294 bool bSuccess
= true;
295 for (ii
= 0; ii
< ncell
&& bSuccess
; ii
++)
297 bSuccess
= cell
[ii
].Read(hwpf
);
298 cell
[ii
].key
= sal::static_int_cast
<unsigned char>(ii
);
303 style
.cell
= &cell
[0];
304 plists
.resize(ncell
);
305 for (ii
= 0; ii
< ncell
; ii
++)
306 hwpf
.ReadParaList(plists
[ii
]);
308 hwpf
.ReadParaList(caption
);
310 if( type
== 0 ){ // if table?
311 std::unique_ptr
<TCell
*[]> pArr(new TCell
*[ncell
]);
312 std::fill(pArr
.get(), pArr
.get() + ncell
, nullptr);
314 return hwpf
.SetState(HWP_InvalidFileFormat
);
316 std::unique_ptr
<Table
> tbl(new Table
);
317 for( ii
= 0 ; ii
< ncell
; ii
++)
319 tbl
->columns
.insert(cell
[ii
].x
);
320 tbl
->columns
.insert(cell
[ii
].x
+ cell
[ii
].w
);
321 tbl
->rows
.insert(cell
[ii
].y
);
322 tbl
->rows
.insert(cell
[ii
].y
+ cell
[ii
].h
);
324 for( ii
= 0 ; ii
< ncell
; ii
++)
326 TCell
*tcell
= new TCell
;
327 tcell
->nColumnIndex
= tbl
->columns
.getIndex(cell
[ii
].x
);
328 tcell
->nColumnSpan
= tbl
->columns
.getIndex(cell
[ii
].x
+ cell
[ii
].w
) -
330 tcell
->nRowIndex
= tbl
->rows
.getIndex(cell
[ii
].y
);
331 tcell
->nRowSpan
= tbl
->rows
.getIndex(cell
[ii
].y
+ cell
[ii
].h
) -
333 tcell
->pCell
= &cell
[ii
];
337 // Sort by row and column
338 for( ii
= 0 ; ii
< ncell
- 1; ii
++ ){
339 for( int jj
= ii
; jj
< ncell
; jj
++){
340 if( pArr
[ii
]->nRowIndex
> pArr
[jj
]->nRowIndex
){
346 for( int kk
= ii
; kk
> 0 ; kk
--){
347 if( ( pArr
[kk
]->nRowIndex
== pArr
[kk
-1]->nRowIndex
) &&
348 (pArr
[kk
]->nColumnIndex
< pArr
[kk
-1]->nColumnIndex
)){
350 pArr
[kk
] = pArr
[kk
-1];
355 for( ii
= 0 ; ii
< ncell
; ii
++ ){
356 tbl
->cells
.emplace_back(pArr
[ii
]);
359 m_pTable
= tbl
.get();
360 hwpf
.AddTable(std::move(tbl
));
365 return !hwpf
.State();
374 std::unique_ptr
<HMemIODev
> m_xNewMem
;
376 ChangeMemGuard(unsigned char* data
, size_t nLen
)
378 , m_xNewMem(std::make_unique
<HMemIODev
>(reinterpret_cast<char*>(data
), nLen
))
380 hmem
= m_xNewMem
.get();
384 assert(hmem
== m_xNewMem
.get());
391 bool Picture::Read(HWPFile
& hwpf
)
393 hwpf
.Read2b(reserved
, 2);
394 hwpf
.Read2b(&dummy
, 1);
396 if (!(hh
== dummy
&& CH_PICTURE
== dummy
)) {
397 return hwpf
.SetState(HWP_InvalidFileFormat
);
401 hwpf
.Read4b(&follow_block_size
, 1);
403 //when fuzzing with a max len set, max decompress to 10 times that limit
404 static size_t nMaxAllowedDecompression
= [](const char* pEnv
) { size_t nRet
= pEnv
? std::atoi(pEnv
) : 0; return nRet
* 10; }(std::getenv("FUZZ_MAX_INPUT_LEN"));
406 hwpf
.Read2b(&dummy1
, 1); /* Reserved 4 bytes */
407 hwpf
.Read2b(&dummy2
, 1);
409 style
.boxnum
= fboxnum
++;
411 hwpf
.Read1b(style
.anchor_type
); /* Reference position */
412 hwpf
.Read1b(style
.txtflow
); /* Avoid painting. 0-2 (seat occupied, transparency, harmony) */
413 hwpf
.Read2b(&style
.xpos
, 1); /* Horizontal position: 1=left, 2=right, 3=center, and others=any */
414 hwpf
.Read2b(&style
.ypos
, 1); /* Vertical position: 1=top, 2=down, 3=middle, and others=any */
415 hwpf
.Read2b(&option
, 1); /* Other options: Borders, reverse picture, and so on. Save as bit. */
416 hwpf
.Read2b(&ctrl_ch
, 1); /* Always 11 */
417 hwpf
.Read2b(style
.margin
, 12); /* Margin: [0-2] [] out / in / cell, [], [0-3] left / right / top / bottom margins */
418 hwpf
.Read2b(&box_xs
, 1); /* Box Size Width */
419 hwpf
.Read2b(&box_ys
, 1); /* Vertical */
420 hwpf
.Read2b(&cap_xs
, 1); /* Caption Size Width */
421 hwpf
.Read2b(&cap_ys
, 1); /* Vertical */
422 hwpf
.Read2b(&style
.cap_len
, 1); /* Length */
423 hwpf
.Read2b(&xs
, 1); /* The total size (box size + caption + margin) Horizontal */
424 hwpf
.Read2b(&ys
, 1); /* Vertical */
425 hwpf
.Read2b(&cap_margin
, 1); /* Caption margins */
426 hwpf
.Read1b(xpos_type
);
427 hwpf
.Read1b(ypos_type
);
428 hwpf
.Read1b(smart_linesp
); /* Line Spacing protection: 0 unprotected 1 protected */
429 hwpf
.Read1b(reserved1
);
430 hwpf
.Read2b(&pgx
, 1); /* Real Calculated box width */
431 hwpf
.Read2b(&pgy
, 1); /* Height */
432 hwpf
.Read2b(&pgno
, 1); /* Page number: starts from 0 */
433 hwpf
.Read2b(&showpg
, 1); /* Show the Box */
434 hwpf
.Read2b(&cap_pos
, 1); /* Caption positions 0-7 Menu Order. */
435 hwpf
.Read2b(&num
, 1); /* Box number, serial number which starts from 0 */
437 hwpf
.Read1b(pictype
); /* Picture type */
439 unsigned short tmp16
;
440 if (!hwpf
.Read2b(tmp16
)) /* the real horizontal starting point where shows the picture */
443 if (!hwpf
.Read2b(tmp16
)) /* Vertical */
446 if (!hwpf
.Read2b(tmp16
)) /* Zoom Ratio: 0:fixed, others are percentage for horizontal */
449 if (!hwpf
.Read2b(tmp16
)) /* Vertical */
453 hwpf
.ReadBlock(picinfo
.picun
.path
, 256); /* Picture File Name: when type is not a Drawing. */
454 hwpf
.ReadBlock(reserved3
, 9); /* Brightness / Contrast / Picture Effect, etc. */
457 if( pictype
!= PICTYPE_DRAW
)
458 style
.cell
= reserved3
;
461 //picinfo.picun read above is unioned with
462 //picinfo.picdraw and so wrote to the hdo pointer
463 //value, which is definitely not useful to us
464 picinfo
.picdraw
.hdo
= nullptr;
467 if (follow_block_size
!= 0)
471 //read potentially compressed data in blocks as its more
472 //likely large values are simply broken and we'll run out
473 //of data before we need to realloc
474 for (size_t i
= 0; i
< follow_block_size
; i
+= SAL_N_ELEMENTS(hwpf
.scratch
))
476 size_t nOldSize
= follow
.size();
477 size_t nBlock
= std::min(SAL_N_ELEMENTS(hwpf
.scratch
), follow_block_size
- nOldSize
);
478 size_t nReadBlock
= hwpf
.ReadBlock(hwpf
.scratch
, nBlock
);
481 follow
.insert(follow
.end(), hwpf
.scratch
, hwpf
.scratch
+ nReadBlock
);
483 if (nBlock
!= nReadBlock
)
485 if (nMaxAllowedDecompression
&& follow
.size() > nMaxAllowedDecompression
)
488 follow_block_size
= follow
.size();
490 if (pictype
== PICTYPE_DRAW
)
492 auto xGuard(std::make_unique
<ChangeMemGuard
>(follow
.data(), follow_block_size
));
493 LoadDrawingObjectBlock(this);
494 style
.cell
= picinfo
.picdraw
.hdo
;
497 else if (follow_block_size
>= 4)
499 if ((follow
[3] << 24 | follow
[2] << 16 | follow
[1] << 8 | follow
[0]) == 0x269)
505 fprintf(stderr
, "arse\n");
512 hwpf
.AddFBoxStyle(&style
);
515 hwpf
.ReadParaList(caption
);
517 return !hwpf
.State();
534 bool Line::Read(HWPFile
& hwpf
)
536 hwpf
.Read2b(reserved
, 2);
537 hwpf
.Read2b(&dummy
, 1);
539 if (!(hh
== dummy
&& CH_LINE
== dummy
)){
540 return hwpf
.SetState(HWP_InvalidFileFormat
);
544 style
.boxnum
= fboxnum
++;
547 hwpf
.ReadBlock(&reserved2
, 8);
548 hwpf
.Read1b(style
.anchor_type
);
549 hwpf
.Read1b(style
.txtflow
);
550 hwpf
.Read2b(&style
.xpos
, 1);
551 hwpf
.Read2b(&style
.ypos
, 1);
552 hwpf
.Read2b(&option
, 1);
553 hwpf
.Read2b(&ctrl_ch
, 1);
554 hwpf
.Read2b(style
.margin
, 12);
555 hwpf
.AddFBoxStyle(&style
);
556 hwpf
.Read2b(&box_xs
, 1);
557 hwpf
.Read2b(&box_ys
, 1);
558 hwpf
.Read2b(&cap_xs
, 1);
559 hwpf
.Read2b(&cap_ys
, 1);
560 hwpf
.Read2b(&style
.cap_len
, 1);
563 lnnumber
= style
.boxnum
;
565 hwpf
.Read2b(&boundsy
, 1);
566 hwpf
.Read2b(&boundey
, 1);
570 hwpf
.Read2b(&pgx
, 1);
571 hwpf
.Read2b(&pgy
, 1);
572 hwpf
.Read2b(&pgno
, 1);
573 hwpf
.Read2b(&showpg
, 1);
579 hwpf
.Read2b(&width
, 1);
580 hwpf
.Read2b(&shade
, 1);
581 hwpf
.Read2b(&color
, 1);
584 return !hwpf
.State();
594 bool Hidden::Read(HWPFile
& hwpf
)
596 hwpf
.Read2b(reserved
, 2);
597 hwpf
.Read2b(&dummy
, 1);
598 if (!(hh
== dummy
&& CH_HIDDEN
== dummy
)){
599 return hwpf
.SetState(HWP_InvalidFileFormat
);
602 hwpf
.ReadBlock(info
, 8);
603 hwpf
.ReadParaList(plist
);
605 return !hwpf
.State();
609 HeaderFooter::HeaderFooter()
610 : HBox(CH_HEADER_FOOTER
)
619 bool HeaderFooter::Read(HWPFile
& hwpf
)
621 hwpf
.Read2b(reserved
, 2);
622 hwpf
.Read2b(&dummy
, 1);
623 if (!(hh
== dummy
&& CH_HEADER_FOOTER
== dummy
)){
624 return hwpf
.SetState(HWP_InvalidFileFormat
);
627 hwpf
.ReadBlock(info
, 8);
631 hwpf
.ReadParaList(plist
, CH_HEADER_FOOTER
);
632 linenumber
= sal::static_int_cast
<unsigned char>(lnnumber
);
633 m_nPageNumber
= hwpf
.getCurrentPage();
634 hwpf
.setMaxSettedPage();
635 hwpf
.AddHeaderFooter(this);
637 return !hwpf
.State();
651 bool Footnote::Read(HWPFile
& hwpf
)
653 hwpf
.Read2b(reserved
, 2);
654 hwpf
.Read2b(&dummy
, 1);
655 if (!(hh
== dummy
&& CH_FOOTNOTE
== dummy
)){
656 return hwpf
.SetState(HWP_InvalidFileFormat
);
659 hwpf
.ReadBlock(info
, 8);
660 hwpf
.Read2b(&number
, 1);
661 hwpf
.Read2b(&type
, 1);
662 unsigned short tmp16
;
663 if (!hwpf
.Read2b(tmp16
))
666 hwpf
.ReadParaList(plist
, CH_FOOTNOTE
);
668 return !hwpf
.State();
680 bool AutoNum::Read(HWPFile
& hwpf
)
682 hwpf
.Read2b(&type
, 1);
683 hwpf
.Read2b(&number
, 1);
684 hwpf
.Read2b(&dummy
, 1);
687 return hwpf
.SetState(HWP_InvalidFileFormat
);
689 return !hwpf
.State();
703 bool NewNum::Read(HWPFile
& hwpf
)
705 hwpf
.Read2b(&type
, 1);
706 hwpf
.Read2b(&number
, 1);
707 hwpf
.Read2b(&dummy
, 1);
710 return hwpf
.SetState(HWP_InvalidFileFormat
);
712 return !hwpf
.State();
715 // show page number (20)
716 ShowPageNum::ShowPageNum()
717 : HBox(CH_SHOW_PAGE_NUM
)
725 bool ShowPageNum::Read(HWPFile
& hwpf
)
727 hwpf
.Read2b(&where
, 1);
728 hwpf
.Read2b(&shape
, 1);
729 hwpf
.Read2b(&dummy
, 1);
732 return hwpf
.SetState(HWP_InvalidFileFormat
);
734 m_nPageNumber
= hwpf
.getCurrentPage();
735 hwpf
.setMaxSettedPage();
736 hwpf
.AddPageNumber(this);
737 return !hwpf
.State();
741 PageNumCtrl::PageNumCtrl()
742 : HBox(CH_PAGE_NUM_CTRL
)
749 bool PageNumCtrl::Read(HWPFile
& hwpf
)
751 hwpf
.Read2b(&kind
, 1);
752 hwpf
.Read2b(&what
, 1);
753 hwpf
.Read2b(&dummy
, 1);
756 return hwpf
.SetState(HWP_InvalidFileFormat
);
758 return !hwpf
.State();
762 MailMerge::MailMerge()
763 : HBox(CH_MAIL_MERGE
)
768 bool MailMerge::Read(HWPFile
& hwpf
)
770 hwpf
.ReadBlock(field_name
, 20);
771 hwpf
.Read2b(&dummy
, 1);
774 return hwpf
.SetState(HWP_InvalidFileFormat
);
776 return !hwpf
.State();
779 // char composition(23)
786 bool Compose::Read(HWPFile
& hwpf
)
788 hwpf
.Read2b(compose
, 3);
789 hwpf
.Read2b(&dummy
, 1);
792 return hwpf
.SetState(HWP_InvalidFileFormat
);
794 return !hwpf
.State();
805 bool Hyphen::Read(HWPFile
& hwpf
)
807 hwpf
.Read2b(&width
, 1);
808 hwpf
.Read2b(&dummy
, 1);
811 return hwpf
.SetState(HWP_InvalidFileFormat
);
813 return !hwpf
.State();
826 bool TocMark::Read(HWPFile
& hwpf
)
828 hwpf
.Read2b(&kind
, 1);
829 hwpf
.Read2b(&dummy
, 1);
832 return hwpf
.SetState(HWP_InvalidFileFormat
);
834 return !hwpf
.State();
838 IndexMark::IndexMark()
839 : HBox(CH_INDEX_MARK
)
845 bool IndexMark::Read(HWPFile
& hwpf
)
847 hwpf
.Read2b(&keyword1
, 60);
848 hwpf
.Read2b(&keyword2
, 60);
849 hwpf
.Read2b(&pgno
, 1);
850 hwpf
.Read2b(&dummy
, 1);
853 return hwpf
.SetState(HWP_InvalidFileFormat
);
855 return !hwpf
.State();
868 bool Outline::Read(HWPFile
& hwpf
)
870 hwpf
.Read2b(&kind
, 1);
873 hwpf
.Read2b(number
, 7);
874 hwpf
.Read2b(user_shape
, 7);
875 hwpf
.Read2b(deco
, 14);
876 hwpf
.Read2b(&dummy
, 1);
879 return hwpf
.SetState(HWP_InvalidFileFormat
);
881 return !hwpf
.State();
885 /* Bundle of spaces (30)*/
886 KeepSpace::KeepSpace()
887 : HBox(CH_KEEP_SPACE
)
893 bool KeepSpace::Read(HWPFile
& hwpf
)
895 hwpf
.Read2b(&dummy
, 1);
898 return hwpf
.SetState(HWP_InvalidFileFormat
);
900 return !hwpf
.State();
904 /* Fixed-width spaces (31) */
905 FixedSpace::FixedSpace()
906 : HBox(CH_FIXED_SPACE
)
912 bool FixedSpace::Read(HWPFile
& hwpf
)
914 hwpf
.Read2b(&dummy
, 1);
917 return hwpf
.SetState(HWP_InvalidFileFormat
);
919 return !hwpf
.State();
922 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */